Authored by whb

初始化项目

<?php
/**
* @name Bootstrap
* @author liuziyang
* @desc 所有在Bootstrap类中, 以_init开头的方法, 都会被Yaf调用,
* @see http://www.php.net/manual/en/class.yaf-bootstrap-abstract.php
* 这些方法, 都接受一个参数:Yaf_Dispatcher $dispatcher
* 调用的次序, 和申明的次序相同
*/
use Yaf\Bootstrap_Abstract;
use Yaf\Dispatcher;
use Yaf\Application;
use Yaf\Registry;
use Yaf\Loader;
use Yaf\Config;
use Plugin\Routes;
use Plugin\Xhprof;
use Plugin\Layout;
use Hood\Debug;
class Bootstrap extends Bootstrap_Abstract
{
private $_config;
/**
* 初始化配置
* @param Yaf_Dispatcher $dispatcher
*/
public function _initConfig(Dispatcher $dispatcher)
{
define('REQUEST_METHOD', strtoupper($dispatcher->getRequest()->getMethod()));
$this->_config = Application::app()->getConfig();
Registry::set('appConfig', $this->_config);
}
/**
* 初始化应用
* @param Yaf_Dispatcher $dispatcher
*/
public function _initApplication(Dispatcher $dispatcher)
{
defined('APPLICATION_SYSTEM_CONFIG') || define('APPLICATION_SYSTEM_CONFIG', $this->_config->application->servers->config);
if (APPLICATION_ENV != 'production') {
error_reporting(E_ALL);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
}
Loader::getInstance()->registerLocalNameSpace(explode(',', $this->_config->application->namespaces));
}
/**
* Layout
* @param Dispatcher $dispatcher
*/
public function _initLayout(Dispatcher $dispatcher)
{
if (!$dispatcher->getRequest()->isXmlHttpRequest()) {
$dispatcher->setView(new Layout($this->_config->application->layout->path));
}
}
/**
* 初始化路由
* @param Yaf_Dispatcher $dispatcher
*/
public function _initRoute(Dispatcher $dispatcher)
{
#系统默认路由
$config = new Config\Ini(APPLICATION_PATH . '/configs/routes.ini');
if (isset($config->routes)) {
$dispatcher->getRouter()->addConfig($config->routes);
}
#模块路由
$_modules = $this->_config['application']['modules'];
$_modulesList = explode(',', $_modules);
foreach ($_modulesList as $modules) {
$routesFile = APPLICATION_PATH . '/application/modules/' . ucfirst($modules) . '/routes.ini';
if (file_exists($routesFile)) {
$config = new Config\Ini($routesFile);
$routesModules = strtolower($modules);
if (isset($config->$routesModules)) {
$dispatcher->getRouter()->addConfig($config->$routesModules);
}
}
}
}
/**
* 初始化插件
* @param Yaf_Dispatcher $dispatcher
*/
public function _initPlugin(Dispatcher $dispatcher)
{
$dispatcher->registerPlugin(new Routes());
}
/**
* 初始化Composer
* @param Yaf_Dispatcher $dispatcher
*/
public function _initComposer(Dispatcher $dispatcher)
{
if ($this->_config->composer->autoload->enable == 1) {
$composerAutoload = (string)$this->_config->composer->autoload->phpfile;
Loader::import($composerAutoload);
}
}
public function _initDebugXhprofPlugin(Dispatcher $dispatcher)
{
/* if ($this->_config->application->xhprof->enable == 1) {
$slowTimeout = 500;
if (!empty($this->_config->application->xhprof->slow_timeout)) {
$slowTimeout = $this->_config->application->xhprof->slow_timeout;
}
$xhprof = new Xhprof($slowTimeout);
if (!empty($this->_config->application->xhprof->output_dir)) {
$xhprof->setOutputDir($this->_config->application->xhprof->output_dir);
}
$dispatcher->registerPlugin($xhprof);
}*/
}
public function _initDebug(Dispatcher $dispatcher)
{
$dispatcher = $this->_config->application->dispatcher;
if ($dispatcher->throwException == 0 && $dispatcher->catchException == 0) {
Debug::exceptionHandler();
Debug::errorHandler();
}
}
}
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<?php
echo $this->_headTitle;
echo $this->_headLink;
echo $this->_headScript;
echo $this->_headmeta;
?>
</head>
<body>
<?php echo $content . PHP_EOL;?>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<?php
echo $this->_headTitle;
echo $this->_headLink;
echo $this->_headScript;
echo $this->_headmeta;
?>
</head>
<body>
<?php echo $content . PHP_EOL; ?>
</body>
</html>
... ...
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 15/6/17
* Time: 下午1:08
*/
use Action\RootAction;
use QUtils\XMLElement\ArrayToXml;
use \Yaf\Dispatcher;
class ApiController extends RootAction
{
public function init()
{
Dispatcher::getInstance()->autoRender(false);
}
public function indexAction()
{
$_className = $this->getRequest()->getParam('class_name');
$version = $this->getRequest()->getParam('version', 1);
$methodName = $this->getRequest()->getParam('method_name');
$params = array_merge($this->_getRequests(), $this->_getParams());
print_r($_className);
$fields = '_fields';
$returnType = $this->_getParam2('_return_type', 'xml');
if (empty($_className)) {
$this->resultJson(500, 'class_name is null.');
}
if (empty($version)) {
$this->resultJson(500, 'version is null.');
}
if (empty($methodName)) {
$this->resultJson(500, 'method_name is null.');
}
$_classNameList = explode('.', $_className);
if (count($_classNameList) != 2) {
$this->resultJson(500, 'class name error.');
}
list($className, $functionClass) = $_classNameList;
$className = 'Q' . ucwords($methodName) . 'Api\\Api\\V' . $version . '\\' . ucwords($className);
if (class_exists($className) == false) {
$this->resultJson(500, $className . ' Not Class.');
}
if (method_exists($className, 'init') === true) {
$methodName::init($params);
}
$result = $className::$functionClass($params, $fields);
switch ($returnType) {
case 'xml':
header('Content-type: application/xml');
echo ArrayToXml::to($result['data'], $result['node_name']);
break;
case 'json':
header('Content-type: application/json');
unset($result['node_name']);
echo json_encode($result);
break;
}
}
}
\ No newline at end of file
... ...
<?php
/**
* @name ErrorController
* @desc 错误控制器, 在发生未捕获的异常时刻被调用
* @see http://www.php.net/manual/en/yaf-dispatcher.catchexception.php
* @author liuziyang
*/
use Action\RootAction;
class ErrorController extends RootAction
{
public function init()
{
$this->getView()->setLayout('error');
$this->_viewLink()->offsetSetFile(100, $this->_css('style.default', true));
}
public function errorAction($exception)
{
//YAF_ERR_NOTFOUND_VIEW
switch ($exception->getCode()) {
case 517:
case 516:
case 515:
//404
$this->redirect('/404.html');
break;
case 521:
case 520:
case 519:
case 518:
case 514:
case 513:
case 512:
$this->getView()->assign("exception", $exception);
break;
//break;
default:
//自定义的异常
$this->getView()->assign("exception", $exception);
}
}
public function indexAction()
{
}
public function notFoundAction()
{
header("Not Found");
}
public function alertAction()
{
$alertMessage = $this->_session('system_alert')->__get('alert_message');
$this->_assign('alertMessage', $alertMessage);
}
}
... ...
<?php
use Action\RootAction;
use Hood\Cache;
use QAdmin\Profile\Client as ProfileClient;
use Hood\Core\Security\AuthCode;
use QAdmin\Config as QAdminConfig;
use QAdmin\Session\Client as SessionClient;
class IndexController extends RootAction
{
public function indexAction()
{
$this->getView()->setLayout('signin');
$this->_viewLink()->offsetSetFile(100, $this->_css('style.default', true));
$this->_viewScript()->conditional('lt IE 9')
->offsetSetFile(100, $this->_js('html5shiv', true))
->offsetSetFile(101, $this->_js('respond', true));
$this->_viewLink()->offsetSetFile(200, $this->_css('debugbar', true));
}
public function signinAction()
{
$this->disableView();
$account = $this->_post('account');
$password = $this->_post('password');
$validator = $this->validator(
['account' => $account, 'password' => $password],
['account' => 'required', 'password' => 'required']
);
if ($validator->fails() == true) {
$this->helpJsRedirect($validator->errors()->first());
}
$accountInfo = ProfileClient::self()->Dao()->getProfileByAccount($account);
if (empty($accountInfo)) {
$this->helpJsRedirect('没有这个账号.');
}
$authPass = AuthCode::authPassword($password, $accountInfo['password']);
if ($authPass == false) {
$this->helpJsRedirect('密码错误.');
}
if ($accountInfo['expiration'] > QAdminConfig::$expiration) {
$this->helpJsRedirect('你账号 ' . QAdminConfig::$expiration . ' 天没有登陆,已经冻结.');
}
$accountInfo['token'] = $token = md5(uniqid('profile_info', true));
SessionClient::self()->Dao()->setSession($accountInfo['pid'], $token);
$this->_session('adminx_profile')->__set('profile_info', $accountInfo);
$this->redirect('/display');
}
}
\ No newline at end of file
... ...
<?php
use Action\RootAction;
use \Yaf\Dispatcher;
use Hood\Debug;
class ServiceController extends RootAction
{
public function init()
{
Dispatcher::getInstance()->autoRender(false);
Dispatcher::getInstance()->disableView();
}
public function indexAction()
{
$_methodName = $this->getRequest()->getParam('method_name');
$_className = $this->getRequest()->getParam('class_name');
$_version = $this->getRequest()->getParam('version', 1);
if (empty($_methodName)) {
throw new \Yar_Server_Exception('method_name is null.');
}
if (empty($_className)) {
throw new \Yar_Server_Exception('class_name is null.');
}
if (empty($_version)) {
throw new \Yar_Server_Exception('version is null.');
}
$className = 'Q' . ucwords($_methodName) . 'Api\\Service\\V' . (int)$_version . '\\' . ucwords($_className);
if (class_exists($className) == false) {
throw new \Yar_Server_Exception($className . ' Not Class.');
}
$service = new \Yar_Server(new $className());
$service->handle();
}
}
... ...
ass
\ No newline at end of file
... ...
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-home"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li>Dashboard</li>
</ul>
<h4>Dashboard</h4>
</div>
</div><!-- media -->
</div><!-- pageheader -->
<div class="contentpanel">
<div class="row row-stat">
<div class="col-md-4">
<div class="panel panel-success-alt noborder">
<div class="panel-heading noborder">
<div class="panel-btns">
<a href="" class="panel-close tooltips" data-toggle="tooltip" title="Close Panel"><i class="fa fa-times"></i></a>
</div><!-- panel-btns -->
<div class="panel-icon"><i class="fa fa-dollar"></i></div>
<div class="media-body">
<h5 class="md-title nomargin">Today's Earnings</h5>
<h1 class="mt5">$8,102.32</h1>
</div><!-- media-body -->
<hr>
<div class="clearfix mt20">
<div class="pull-left">
<h5 class="md-title nomargin">Yesterday</h5>
<h4 class="nomargin">$29,009.17</h4>
</div>
<div class="pull-right">
<h5 class="md-title nomargin">This Week</h5>
<h4 class="nomargin">$99,103.67</h4>
</div>
</div>
</div><!-- panel-body -->
</div><!-- panel -->
</div><!-- col-md-4 -->
<div class="col-md-4">
<div class="panel panel-primary noborder">
<div class="panel-heading noborder">
<div class="panel-btns">
<a href="" class="panel-close tooltips" data-toggle="tooltip" title="Close Panel"><i class="fa fa-times"></i></a>
</div><!-- panel-btns -->
<div class="panel-icon"><i class="fa fa-users"></i></div>
<div class="media-body">
<h5 class="md-title nomargin">New User Accounts</h5>
<h1 class="mt5">138,102</h1>
</div><!-- media-body -->
<hr>
<div class="clearfix mt20">
<div class="pull-left">
<h5 class="md-title nomargin">Yesterday</h5>
<h4 class="nomargin">10,009</h4>
</div>
<div class="pull-right">
<h5 class="md-title nomargin">This Week</h5>
<h4 class="nomargin">178,222</h4>
</div>
</div>
</div><!-- panel-body -->
</div><!-- panel -->
</div><!-- col-md-4 -->
<div class="col-md-4">
<div class="panel panel-dark noborder">
<div class="panel-heading noborder">
<div class="panel-btns">
<a href="" class="panel-close tooltips" data-toggle="tooltip" data-placement="left" title="Close Panel"><i class="fa fa-times"></i></a>
</div><!-- panel-btns -->
<div class="panel-icon"><i class="fa fa-pencil"></i></div>
<div class="media-body">
<h5 class="md-title nomargin">New User Posts</h5>
<h1 class="mt5">153,900</h1>
</div><!-- media-body -->
<hr>
<div class="clearfix mt20">
<div class="pull-left">
<h5 class="md-title nomargin">Yesterday</h5>
<h4 class="nomargin">144,009</h4>
</div>
<div class="pull-right">
<h5 class="md-title nomargin">This Week</h5>
<h4 class="nomargin">987,212</h4>
</div>
</div>
</div><!-- panel-body -->
</div><!-- panel -->
</div><!-- col-md-4 -->
</div><!-- row -->
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body padding15">
<h5 class="md-title mt0 mb10">Site Statistics</h5>
<div id="basicFlotLegend" class="flotLegend"></div>
<div id="basicflot" class="flotChart"></div>
</div><!-- panel-body -->
<div class="panel-footer">
<div class="tinystat pull-left">
<div id="sparkline" class="chart mt5"></div>
<div class="datainfo">
<span class="text-muted">Average</span>
<h4>$9,201</h4>
</div>
</div><!-- tinystat -->
<div class="tinystat pull-right">
<div id="sparkline2" class="chart mt5"></div>
<div class="datainfo">
<span class="text-muted">Total</span>
<h4>$8,201</h4>
</div>
</div><!-- tinystat -->
</div><!-- panel-footer -->
</div><!-- panel -->
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body padding15">
<h5 class="md-title mt0 mb10">Site Visitors</h5>
<div id="basicFlotLegend2" class="flotLegend"></div>
<div id="basicflot2" class="flotChart"></div>
</div><!-- panel-body -->
<div class="panel-footer">
<div class="tinystat pull-left">
<div id="sparkline3" class="chart mt5"></div>
<div class="datainfo">
<span class="text-muted">Average</span>
<h4>52,201</h4>
</div>
</div><!-- tinystat -->
<div class="tinystat pull-right">
<div id="sparkline4" class="chart mt5"></div>
<div class="datainfo">
<span class="text-muted">Total</span>
<h4>11,201</h4>
</div>
</div><!-- tinystat -->
</div><!-- panel-footer -->
</div><!-- panel -->
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body padding15">
<h5 class="md-title mt0 mb10">Site Impressions</h5>
<div id="basicFlotLegend3" class="flotLegend"></div>
<div id="basicflot3" class="flotChart"></div>
</div><!-- panel-body -->
<div class="panel-footer">
<div class="tinystat pull-left">
<div id="sparkline5" class="chart mt5"></div>
<div class="datainfo">
<span class="text-muted">Average</span>
<h4>37,101</h4>
</div>
</div><!-- tinystat -->
<div class="tinystat pull-right">
<div id="sparkline6" class="chart mt5"></div>
<div class="datainfo">
<span class="text-muted">Total</span>
<h4>18,899</h4>
</div>
</div><!-- tinystat -->
</div><!-- panel-footer -->
</div><!-- panel -->
</div>
</div><!-- row -->
</div><!-- contentpanel -->
... ...
<section>
<div class="notfoundpanel">
<h2>Error!</h2>
<h3><?php echo $this->alertMessage;?></h3>
</div>
</section>
\ No newline at end of file
... ...
<section>
<div class="notfoundpanel">
<h1>50X!</h1>
<h3>Error:</h3>
<p><?php echo "Error Msg:" . $exception; ?></p>
</div><!-- notfoundpanel -->
</section>
... ...
<section>
<div class="notfoundpanel">
<h1>50X!</h1>
<h3>The page you are looking for has not been found!</h3>
<p></p>
</div><!-- notfoundpanel -->
</section>
\ No newline at end of file
... ...
<section>
<div class="notfoundpanel">
<h1>404!</h1>
<h3>找不到此页面</h3>
<p>The page you are looking for has not been found!</p>
</div><!-- notfoundpanel -->
</section>
\ No newline at end of file
... ...
<?php
use DebugBar\StandardDebugBar;
$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();
$debugbar["messages"]->addMessage("hello world!");
echo $debugbarRenderer->renderHead();
echo $debugbarRenderer->render();
\ No newline at end of file
... ...
<section>
<div class="panel panel-signin">
<div class="panel-body">
<!--div class="logo text-center">
<img src="images/logo-primary.png" alt="Chain Logo" >
</div-->
<h3 class="text-center mb5"><?php echo $this->globalSiteName;?></h3>
<div class="mb30"></div>
<form action="/signin.html" method="post">
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="account" class="form-control" placeholder="Username">
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" name="password" class="form-control" placeholder="Password">
</div><!-- input-group -->
<div class="clearfix">
<div class="pull-right">
<button type="submit" class="btn btn-success">Sign In <i class="fa fa-angle-right ml5"></i></button>
</div>
</div>
</form>
</div><!-- panel-body -->
</div><!-- panel -->
</section>
\ No newline at end of file
... ...
[common]
;;默认项目
application.directory = APPLICATION_PATH "/application"
;;website library
application.library = APPLICATION_PATH "/library"
;;默认模块
application.modules = "Default,Admin"
;;加载
application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php"
;;view文件的扩展名
application.view.ext = "phtml"
;;默认layouts
application.layout.path = APPLICATION_PATH "/application/layouts"
;;layouts 默认文件
application.layout.default = "default.phtml"
;;默认Controller
application.dispatcher.defaultController = "index"
;;默认Action
application.dispatcher.defaultAction = "index"
;;站点网址
website.domain = "http://www.example.com/"
;;静态资源地址
website.static.url = "http://static.example.com/"
;;调试模式
application.debug = true
;;初始化命名空间
application.namespaces = "Action,Plugin,Configs"
;;使用composer
composer.autoload.enable = true
;;composer phpfile
composer.autoload.phpfile = APPLICATION_PATH "/library/Package/vendor/autoload.php"
;;Debug xhprof
application.xhprof.enable = true
application.xhprof.output_dir = /tmp
;;毫秒
application.xhprof.slow_timeout = 500
;出错的时候是否抛出异常
application.dispatcher.throwException = False
;是否使用默认的异常 捕获Controller, 如果开启, 在有未捕获的异常的时候,
;控制权会交给ErrorController的errorAction 方法,
;可以通过$request->getException()获得此异常对象 False
application.dispatcher.catchException = False
[developer : common]
application.servers.config = "/Volumes/MacNode/Code/Q.ERP/QErp/Config"
application.service.host = "/service/"
[testing : common]
application.servers.config = "/Volumes/MacNode/Code/Q.ERP/QErp/Config"
application.service.host = APP_HTTP_HOST "/service/"
[production : common]
application.debug = False
application.servers.config = "/Volumes/MacNode/Code/Q.ERP/QErp/Config"
application.service.host = APP_HTTP_HOST "/service/"
\ No newline at end of file
... ...
;/service
routes.service2.type = "regex"
routes.service2.match = "#/service/([\S]*)/([\S]*)#"
routes.service2.route.module = Default
routes.service2.route.controller = Service
routes.service2.route.action = Index
routes.service2.map.1 = method_name
routes.service2.map.2 = class_name
routes.service.type = "regex"
routes.service.match = "#/service/v([0-9]+)/([\S]*)/([\S]*)#"
routes.service.route.module = Default
routes.service.route.controller = Service
routes.service.route.action = Index
routes.service.map.1 = version
routes.service.map.2 = method_name
routes.service.map.3 = class_name
routes.signout.type = "rewrite"
routes.signout.match = "/(signout/|signout|signout.html)$"
routes.signout.route.module = Default
routes.signout.route.controller = Signout
routes.signout.route.action = index
;/api
routes.api.type = "regex"
routes.api.match = "#/api/v([0-9]+)/([\w]*)/([.\w]*)#"
routes.api.route.module = Default
routes.api.route.controller = Api
routes.api.route.action = Index
routes.api.map.1 = version
routes.api.map.2 = method_name
routes.api.map.3 = class_name
;notfound
routes.notfound.type = "rewrite"
routes.notfound.match = "/(error/notfound|notfound/|notfound|notfound.html|404.html)$"
routes.notfound.route.module = Default
routes.notfound.route.controller = Error
routes.notfound.route.action = notfound
routes.signin.type = "rewrite"
routes.signin.match = "/(index/signin|signin/|signin|signin.html)$"
routes.signin.route.module = Default
routes.signin.route.controller = Index
routes.signin.route.action = Signin
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 15/6/23
* Time: 上午11:32
*/
namespace Action;
class AuthAction extends RootAction
{
public function init()
{
parent::init();
$this->_auth();
$this->_assign('_pid', $this->_pid);
$this->_assign('_token', $this->_token);
}
}
\ No newline at end of file
... ...
<?php
namespace Action;
use Hood\Action as HoodAction;
use Yaf\Registry;
use Yaf\Dispatcher;
use Configs\StaticCss;
use Configs\StaticJs;
use Configs\Site;
use Plugin\Paging;
class RootAction extends HoodAction
{
protected $_appConfig = array();
/**
* 账号信息
* @var array
*/
protected $_accountInfo = array();
/**
* 账号ID
* @var int
*/
protected $_pid = 0;
protected $_token = '';
public function init()
{
$this->_appConfig = Registry::get('appConfig');
if ($this->getRequest()->isXmlHttpRequest() == false) {
$this->getView()->setLayout('default');
}
$this->_assign('globalSiteName', Site::$globalSiteName);
}
public function _assign($name, $value)
{
return $this->getView()->assign($name, $value);
}
/**
* 验证
* @param string $refer
* @return mixed
* @throws \Hood\Debug\DebugException
*/
public function _auth($refer = 'auto')
{
return $this->_accountInfo = $accountInfo;
}
/**
* 分页
* @param string $template
* @return \Plugin\Paging
*/
public function _paging($template)
{
$paging = new Paging($template);
return $paging;
}
/**
* 获取参数
* @param null $name
* @param null $default
* @return mixed
*/
protected function _getEnv($name = null, $default = null)
{
return $this->getRequest()->getEnv($name, $default);
}
/**
* 封装一下获取param参数
* @param String $key
* @param mixed $default
* @return mixed
*/
protected function _getParam($key, $default = null)
{
return $this->getRequest()->getParam($key, $default);
}
/**
* 获取所有参数
* @return array
*/
protected function _getParams()
{
return $this->_request->getParams();
}
/**
* 获取所有参数
* @return mixed
*/
protected function _getRequests()
{
return $this->_request->getRequest();
}
/**
* 封装一下获取get参数
* @param String $key
* @param mixed $default
* @return mixed
*/
protected function _get($key, $default = null)
{
return $this->getRequest()->getQuery($key, $default);
}
/**
* 封装一下获取post参数
* @param String $key
* @param mixed $default
* @return mixed
*/
protected function _post($key, $default = null)
{
return $this->getRequest()->getPost($key, $default);
}
/**
*
* 兼容POST和GET的调用方法
*
* @param $key
* @param null $default
* @return mixed|null
*/
protected function _getParam2($key, $default = null)
{
if (($result = $this->_get($key)) || ($result = $this->_post($key))) {
return $result;
}
return $default;
}
/**
* 封装一下获取post参数
* @param String $key
* @param mixed $default
* @return mixed
*/
protected function _typePost($key, $settype = null, $default = null)
{
$result = $this->getRequest()->getPost($key, $default);
switch ($settype) {
case 'bool':
$result = (bool)$result;
break;
case 'int':
$result = (int)$result;
break;
case 'string':
$result = (string)$result;
break;
case 'float':
$result = (float)$result;
break;
case 'binary':
$result = (binary)$result;
break;
default:
$result = $result;
break;
}
return $result;
}
/**
* 关闭模板
*/
public function disableView()
{
Dispatcher::getInstance()->autoRender(FALSE);
}
/**
* 获取JS URL
*
* @param String $jsName
* @return String
*/
public function _js($jsName, $local = false)
{
if (isset(StaticJs::$res[$jsName])) {
$js = $this->_appConfig['website']['static']['url'];
if ($local == false) {
$js .= StaticJs::$res[$jsName];
} else {
$js = StaticJs::$res[$jsName];
}
return $js;
}
return '';
}
/**
* 获取JS URL
*
* @param String $jsName
* @return String
*/
public function _viewScriptPush(array $jsList, $scriptName = '_footerScript')
{
$script = $this->_viewScript($scriptName);
foreach ($jsList as $js) {
$script->appendFile($this->_js($js, true));
}
}
/**
* 获取JS URL
*
* @param String $jsName
* @return String
*/
public function _viewCssPush(array $cssList, $linkName = '_headLink')
{
$link = $this->_viewLink($linkName);
foreach ($cssList as $css) {
$link->appendFile($this->_css($css, true));
}
}
/**
* 获取Css URL
*
* @param String $cssName
* @return String
*/
public function _css($cssName, $local = false)
{
if (isset(StaticCss::$res[$cssName])) {
if ($local == false) {
$css = $this->_appConfig['website']['static']['url'] . StaticCss::$res[$cssName];
} else {
$css = StaticCss::$res[$cssName];
}
return $css;
}
return '';
}
public function result($code, $message, $data = array())
{
return array(
'code' => $code,
'message' => $message,
'data' => $data
);
}
public function resultJson($code, $message, $data = array())
{
header('Content-type: application/json');
die(json_encode($this->result($code, $message, $data)));
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: liuziyang
* Date: 14-1-13
* Time: 10:45
*/
namespace Action;
class StatusesAction extends RootAction
{
public function init(){
parent::init();
$this->disableView();
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 15/4/12
* Time: 上午11:36
*/
namespace Configs;
class Site
{
public static $globalSiteName = 'YOHO!BUY';
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 15/4/12
* Time: 上午11:12
*/
namespace Configs;
class StaticCss
{
public static $res = array();
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 15/4/12
* Time: 上午11:14
*/
namespace Configs;
class StaticJs
{
public static $res = array();
}
\ No newline at end of file
... ...
{
"repositories": [
{
"type": "git",
"url": "http://git.dev.yoho.cn/web/qsns.git"
},
{"packagist": false}
],
"require": {
"php": ">=5.4.0",
"qSns": "dev-master"
},
"scripts": {
"post-install-cmd": [
"QProduct\\Composer\\Install::postInit"
],
"post-update-cmd": [],
"post-autoload-dump": [],
"post-package-install": [],
"pre-package-uninstall": []
}
}
... ...
<?php
/**
* Created by PhpStorm.
* User: liuziyang
* Date: 14-1-12
* Time: 16:32
*/
namespace Plugin;
use Yaf\View_Interface;
use Yaf\View\Simple as View_Simple;
use Yaf\Application;
class Layout implements View_Interface
{
public $breadcrumb = array();
public $engine;
protected $options = array();
protected $layout_path;
protected $layout;
protected $content;
protected $tpl_vars = array();
protected $tpl_dir;
public function __construct($path, $options = array())
{
$this->layout_path = $path;
$this->options = $options;
}
protected function engine()
{
$this->engine = $this->engine ?: new View_Simple(
$this->tpl_dir,
$this->options
);
return $this->engine;
}
public function setScriptPath($path)
{
if (is_readable($path)) {
$this->tpl_dir = $path;
$this->engine()->setScriptPath($path);
$this->layout_path = $path . "/../layouts";
return true;
}
throw new Exception("Invalid path: {$path}");
}
public function getScriptPath()
{
return $this->engine()->getScriptPath();
}
public function setLayout($name)
{
$this->layout = $name;
}
public function getLayout()
{
return $this->layout;
}
public function setLayoutPath($path)
{
$this->layout_path = $path;
return $this;
}
public function getLayoutPath()
{
$config = Application::app()->getConfig()->get('application');
return $this->layout_path . "/" . $this->layout . ".{$config->view->ext}";
}
public function __set($name, $value)
{
$this->assign($name, $value);
}
public function __isset($name)
{
return (null !== $this->engine()->$name);
}
public function __unset($name)
{
$this->engine()->clear($name);
}
public function assign($name, $value = null)
{
$this->tpl_vars[$name] = $value;
$this->engine()->assign($name, $value);
}
public function assignRef($name, &$value)
{
$this->tpl_vars[$name] = $value;
$this->engine()->assignRef($name, $value);
}
public function clearVars($name)
{
$this->tpl_vars = array();
$this->engine()->clear($name);
}
public function render($tpl, $tpl_vars = array())
{
$tpl_vars = array_merge($this->tpl_vars, $tpl_vars);
$this->content = $this->engine()->render($tpl, $tpl_vars);
if (null == $this->layout) {
return $this->content;
}
$ref = new \ReflectionClass($this->engine());
$prop = $ref->getProperty('_tpl_vars');
$prop->setAccessible(true);
$view_vars = $prop->getValue($this->engine());
$tpl_vars = array_merge($tpl_vars, $view_vars);
$tpl_vars['content'] = $this->content;
$this->engine()->assign('breadcrumb', $this->breadcrumb);
return $this->engine()->render(
$this->getLayoutPath(),
$tpl_vars
);
}
public function display($tpl, $tpl_vars = array())
{
echo $this->render($tpl, $tpl_vars);
}
}
... ...
<?php
/**
* Created by PhpStorm.
* User: Hbomb
* Date: 15-3-12
* Time: 20:10
*/
namespace Plugin;
use Yaf\Application;
use Yaf\Dispatcher;
use Mustache;
class MustacheLayout extends Layout
{
protected $config = null;
public function __construct()
{
$this->config = Application::app()->getConfig()->get('application');
$this->layout = $this->config->layout->default;//默认布局名称是layout
$this->layout_path = $this->config->layout->path;//系统默认布局路径
}
/**
* 设置视图路径
*/
public function setScriptPath($path)
{
if (is_readable($path)) {
$this->tpl_dir = $path;
$this->layout_path = $path . "/../layouts";
return true;
}
throw new \Exception("Invalid path: {$path}");
}
/**
* 获取视图路径
*/
public function getScriptPath()
{
return $this->tpl_dir;
}
public function __isset($name)
{
return (null !== $this->tpl_vars[$name]);
}
public function __unset($name)
{
unset($this->tpl_vars[$name]);
}
/**
* 分配视图传参
*/
public function assign($name, $value = null)
{
$this->tpl_vars[$name] = $value;
}
public function assignRef($name, &$value)
{
$this->tpl_vars[$name] = $value;
}
/**
* 清除视图传参
*/
public function clearVars($name)
{
if (empty($name)) {
$this->tpl_vars[$name] = array();
}
$this->tpl_vars = array();
}
/**
* 渲染视图
*/
public function render($tpl, $tpl_vars = array())
{
$tpl_vars = array_merge($this->tpl_vars, $tpl_vars);
$dispatcher = Dispatcher::getInstance();
$module = $dispatcher->getRequest()->module;
$module_dir = $this->config->directory . '/modules/';//所在模块
$ext = array('extension' => $this->config->view->ext);//视图扩展名
if (!$this->tpl_dir)//如果没有设置视图目录的,默认当前模块的目录
{
$this->tpl_dir = $module_dir . $module . '/views';
}
$viewLoader = new Mustache\Loader\FilesystemLoader($this->tpl_dir, $ext);//设置视图目录
$partialsLoader = new Mustache\Loader\FilesystemLoader($this->tpl_dir . '/partials', $ext);//设置视图片段目录
$layoutLoader = new Mustache\Loader\FilesystemLoader($this->layout_path, $ext);//设置布局目录
//模板引擎初始化
$m = new Mustache\Engine(array(
'loader' => $viewLoader,
'partials_loader' => $partialsLoader,
));
$this->content = $m->render($tpl, $tpl_vars);//视图内容渲染
if (null == $this->layout) //如果没有布局,直接返回视图内容
{
return $this->content;
}
$tpl_vars['content'] = $this->content;//设置视图内容
$m->setLoader($layoutLoader);//设置布局视图的路径
return $m->render($this->layout, $tpl_vars);//和布局合成渲染html
}
/**
* 显示视图
*/
public function display($tpl, $tpl_vars = array())
{
echo $this->render($tpl, $tpl_vars);
}
}
\ No newline at end of file
... ...
<?php
namespace Plugin;
use Hood\Paging as HPage;
class Paging extends HPage
{
/**
* 路径
*
* @var String
*/
private $path = '';
/**
* 查询参数
* String or Array
* @var mixed
*/
private $query;
/**
* 分页集尺寸
*
* @var Integer
*/
private $pageSetSize = 11;
/**
* 子串
*
* @var String
*/
private $substring = '?';
/**
* 连接符号
*
* @var String
*/
private $sign = '=';
/**
* 对符
*
* @var String
*/
private $pairs = '&';
/**
* 模板路径
*
* @var String
*/
private $templatePath = '';
/**
* jsName
* @var String
*/
private $jsFName = '';
/**
* 废弃参数
* @var String
*/
private $disuse = null;
/**
* 设置分页链接中的关键字
*
* @var String
*/
private $keyword = 'page';
/**
* 是否开启rewrite url
*
* @var bool
*/
private $rewrite = false;
/**
* 附加参数
* @var string
*/
private $appendParam = '';
/**
* 分页中代码当前页码的常量
*
*/
const PAGER_VARIABLE_STRING = "%{PAGE_NO}";
public function __construct($file)
{
$this->templatePath = __DIR__ . '/Paging/' . ucfirst($file) . '.php';
}
/**
* 新的获取当前偏移
* @return Integer
*/
public function getNewCurrent()
{
if ($this->currentPage > 1) {
return min($this->currentPage, $this->getPageNum());
}
$pageNo = !isset($_GET[$this->keyword]) ? 0 : (int)(intval($_GET[$this->keyword]) * $this->getSize()) - $this->getSize();
return (int)($pageNo < 0 ? 0 : $pageNo);
}
/**
* 重载当前页方法
* @return Integer
*/
public function getCurrent()
{
if ($this->currentPage > 1) {
return min($this->currentPage, $this->getPageNum());
}
$pageNo = isset($_GET[$this->keyword]) ? (int)intval($_GET[$this->keyword]) : 1;
if ($pageNo <= 0) {
$pageNo = 1;
}
$this->currentPage = min($pageNo, $this->getPageNum());
return $this->currentPage;
}
/**
* 获取关键词
* @return String
*/
public function getKeyword()
{
return $this->keyword;
}
/**
* 设置关键词
*
* @param String $keyword
* @return QLib_Paging
*/
public function setKeyword($keyword)
{
if (!empty($keyword)) {
$this->keyword = $keyword;
}
return $this;
}
/**
* 设置js名字
* @param String $name
* @return Q_Page_Abstract
*/
public function setFJs($name)
{
if (!empty($name)) {
$this->jsFName = $name;
}
return $this;
}
/**
* 设置附加参数
* @param string $param
* @return Q_Page_Abstract
*/
public function setAppendParam($param)
{
$this->appendParam = $param;
return $this;
}
/**
* 获取附加参数
* @return string
*/
public function getAppendParam()
{
return $this->appendParam;
}
/**
* 获取分页js名字
* @return String
*
*/
public function getFJs()
{
return $this->jsFName;
}
/**
*
* 设置链接的路径
*
* @param String $path
* @return QLib_Paging
*/
public function setPath($path)
{
if (!empty($path)) {
$this->path = trim($path);
}
return $this;
}
/**
* 设置连续Url
*
* @param bool $seo
* @return QLib_Paging
*/
public function rewrite($rw = true)
{
if ($rw == true) {
$this->substring = '';
$this->sign = '/';
$this->pairs = '/';
$this->rewrite = true;
}
return $this;
}
/**
* 取得程序路径
* @return String
*/
public function getPath()
{
return $this->path;
}
/**
* 设置分页集尺寸
*
* @param integer $num 大于1
* @return QLib_Paging
*/
public function setPageSetSize($num)
{
$this->pageSetSize = (int)intval($num);
return $this;
}
/**
* 取得分页集尺寸
*
* @return integer
*/
public function getPageSetSize()
{
return (int)$this->pageSetSize;
}
/**
* 获取查询参数
* @return String
*/
public function getQuery()
{
if (empty($this->query)) {
$this->query = $this->autoUrl();
}
if (is_array($this->query) && count($this->query) > 0) {
$_query = array();
foreach ($this->query as $key => $value) {
if ($key == $this->getKeyword()) {
continue;
}
if (is_array($value)) {
foreach ($value as $k => $val) {
$_query[] = "{$key}[]" . $this->sign . $val;
}
} else {
$_query[] = "{$key}" . $this->sign . $value;
}
}
$this->query = $this->pairs . implode($this->pairs, $_query);
}
return $this->query ? $this->query : '';
}
/**
* 获取URL
*
* @param Integer $pageNo
* @return String
*/
public function getUrl($pageNo)
{
$query = $this->getQuery();
if (strstr($query, self::PAGER_VARIABLE_STRING) && is_string($query)) {
$query = str_replace(self::PAGER_VARIABLE_STRING, $pageNo, $query);
} else {
if (empty($query)) {
$query = $this->getKeyword() . $this->sign . $pageNo;
} else {
$query = $this->getKeyword() . $this->sign . $pageNo . $query;
}
}
$url = $this->getPath() . $this->substring . $query;
if ($this->getFJs()) {
$url = $query;
}
return $url;
}
/**
* 设置查询参数
*
* @param mixed $query String or Array
* @return QLib_Paging
*/
public function setQuery($query)
{
$this->query = $query;
return $this;
}
/**
* 设置模板路径
*
* @param String $path
* @return QLib_Paging
*/
public function setTemplate($path)
{
$this->templatePath = $path;
return $this;
}
/**
* 输出模板
*/
public function view()
{
if ($this->getTotal() > 0) {
include($this->templatePath);
}
}
/**
* 自动组织 URL
* @return Array
*/
private function autoUrl()
{
$queryOpt = $_SERVER['REQUEST_URI'];
$queryArg = parse_url($queryOpt);
$queryOpt = isset($queryArg['query']) ? explode('&', $queryArg['query']) : array();
$query = array();
foreach ($queryOpt as $key => $val) {
$strTmp = explode('=', $val);
if (count($strTmp) < 2 || empty($strTmp[0]) || $strTmp[1] == '' || $strTmp[0] == $this->getKeyword()) {
continue;
}
if (is_array($this->disuse)) {
if (in_array($strTmp[1], $this->disuse) || in_array($strTmp[0], $this->disuse)) {
continue;
}
} else {
if ($strTmp[1] == $this->disuse || $strTmp[0] == $this->disuse) {
continue;
}
}
$query[$strTmp[0]] = $strTmp[1];
}
return $query;
}
/**
* set废弃参数
* @param mixed $disuse
* @return QLib_Paging
*/
public function setDisuse($disuse = null)
{
$this->disuse = $disuse;
return $this;
}
}
\ No newline at end of file
... ...
<?php
$pages = array();
$pageNum = $this->getPageNum(); #总分页数
$current = $this->getCurrent(); #当前页
$size = $this->getSize(); #每页显示数
$total = $this->getTotal(); #获取总数
$pageSetNum = $this->getPageSetSize(); #分页集数
$start = $end = 0;
if($current <= 4){
$start = 1;
$end = $start + 4;
}elseif(($pageNum - $current - 2) > 1)
{
$start = $current - 2 < 1 ? 1 : $current - 2;
$end = $current + 2;
}else{
$start = $current - 2;
$end = $pageNum;
}
if($end > $pageNum)
{
$end = $pageNum;
}
$startNum = $size * ($current - 1) + 1;
$endNum = min($size * $current, $total);
$html = '';
if($current > 1)
{
$html .= '<a href="' . $this->getUrl($current - 1) . '" title="上一页"><span class="ifont10"><</span></a>';
}
if ($pageNum > 1) {
if($pageNum > 5 && $current > 4){
$html .= '<a href="' . $this->getUrl(1) . '"><span>' . 1 . '</span></a>';
$html .= '<a><span>...</span></a>';
$start = $current - 2;
$end = $pageNum - $current <= 3 ? $pageNum : $current + 2;
}
for ($i = $start; $i <= $end; ++$i) {
$_start = $size * ($i - 1) + 1;
$_end = min($size * $i, $total);
if ($i != $current) {
$html .= '<a href="' . $this->getUrl($i) . '"><span>' . $i . '</span></a>';
}
else {
$html .= '<a href="'. $this->getUrl($i) .'" class="cur"><span>' . $i . '</span></a>';
}
}
if($pageNum > 5 && $pageNum - $current > 3){
$html .= '<a><span>...</span></a>';
$html .= '<a href="' . $this->getUrl($pageNum) . '"><span>' . $pageNum . '</span></a>';
}
}
if ($current < $pageNum) {
$html .= '<a href="' . $this->getUrl($current + 1) . '" class="page_next" title="下一页"><span class="ifont10">></span></a>';
}
print $html;
\ No newline at end of file
... ...
<?php
$pages = array();
$pageNum = $this->getPageNum(); #总分页数
$current = $this->getCurrent(); #当前页
$size = $this->getSize(); #每页显示数
$total = $this->getTotal(); #获取总数
$pageSetNum = $this->getPageSetSize(); #分页集数
$start = $end = 0;
if($current <= 4){
$start = 1;
$end = $start + 4;
}elseif(($pageNum - $current - 2) > 1)
{
$start = $current - 2 < 1 ? 1 : $current - 2;
$end = $current + 2;
}else{
$start = $current - 2;
$end = $pageNum;
}
if($end > $pageNum)
{
$end = $pageNum;
}
$startNum = $size * ($current - 1) + 1;
$endNum = min($size * $current, $total);
$html = '<div class="left"><span class="rgb9">'.$startNum.' - '.$endNum.' / 共'.$total.'件商品</span></div><div class="goods-page right">';
if ($current > 1) {
$html .= '<a href="' . $this->getUrl($current - 1) . '" class="page_pre" title="上一页"><span class="ifont10"><</span>上一页</a>';
}
if ($pageNum > 1) {
if($pageNum > 5 && $current > 4){
$html .= '<a href="' . $this->getUrl(1) . '"><span>' . 1 . '</span></a>';
$html .= '<a><span>...</span></a>';
$start = $current - 2;
$end = $pageNum - $current <= 3 ? $pageNum : $current + 2;
}
for ($i = $start; $i <= $end; ++$i) {
$_start = $size * ($i - 1) + 1;
$_end = min($size * $i, $total);
if ($i != $current) {
$html .= '<a href="' . $this->getUrl($i) . '"><span>' . $i . '</span></a>';
}else {
$html .= '<a href="'. $this->getUrl($i) .'" class="cur"><span>' . $i . '</span></a>';
}
}
if($pageNum > 5 && $pageNum - $current > 3){
$html .= '<a><span>...</span></a>';
$html .= '<a href="' . $this->getUrl($pageNum) . '"><span>' . $pageNum . '</span></a>';
}
}
if ($current < $pageNum) {
$html .= '<a href="' . $this->getUrl($current + 1) . '" title="下一页">下一页<span class="ifont10">></span></a>';
}
$html .= '</div>';
print $html;
\ No newline at end of file
... ...
<?php
$pages = array();
$pageNum = $this->getPageNum(); #总分页数
$current = $this->getCurrent(); #当前页
$size = $this->getSize(); #每页显示数
$total = $this->getTotal(); #获取总数
$pageSetNum = $this->getPageSetSize(); #分页集数
$start = $end = 0;
if($current <= 4){
$start = 1;
$end = $start + 4;
}elseif(($pageNum - $current - 2) > 1)
{
$start = $current - 2 < 1 ? 1 : $current - 2;
$end = $current + 2;
}else{
$start = $current - 2;
$end = $pageNum;
}
if($end > $pageNum)
{
$end = $pageNum;
}
$startNum = $size * ($current - 1) + 1;
$endNum = min($size * $current, $total);
$html = '';
$html .= '<ul class="pagination pagination-metro pagination-split nomargin">';
if($current > 1)
{
$html .= '<li><a href="' . $this->getUrl($current - 1) . '"><i class="fa fa-angle-left"></i></a></li>';
}else{
$html .= '<li class="disabled"><a href="' . $this->getUrl($current - 1) . '"><i class="fa fa-angle-left"></i></a></li>';
}
if ($pageNum > 1) {
if($pageNum > 5 && $current > 4){
$html .= '<li><a href="' . $this->getUrl(1) . '">1</a></li>';
$start = $current - 2;
$end = $pageNum - $current <= 3 ? $pageNum : $current + 2;
}
for ($i = $start; $i <= $end; ++$i) {
$_start = $size * ($i - 1) + 1;
$_end = min($size * $i, $total);
if ($i != $current) {
$html .= '<li><a href="' . $this->getUrl($i) . '">' . $i . '</a></li>';
}
else {
$html .= '<li class="active"><a href="'. $this->getUrl($i) .'">' . $i . '</a></li>';
}
}
if($pageNum > 5 && $pageNum - $current > 3){
$html .= '<li><a href="' . $this->getUrl($pageNum) . '">' . $pageNum . '</a></li>';
}
}
if ($current < $pageNum) {
$html .= '<li><a href="' . $this->getUrl($current + 1) . '"><i class="fa fa-angle-right"></i></a></li>';
}else{
$html .= '<li class="disabled"><a href="' . $this->getUrl($current + 1) . '"><i class="fa fa-angle-right"></i></a></li>';
}
$html .= '</ul>';
print $html;
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: liuziyang
* Date: 14-1-15
* Time: 16:13
*/
namespace Plugin;
use Yaf\Plugin_abstract;
use Yaf\Request_Abstract;
use Yaf\Response_Abstract;
use Yaf\Registry;
use Yaf\Dispatcher;
use Yaf\Config;
class Routes extends Plugin_abstract
{
/**
*
*
* 在路由之前触发,这个是7个事件中, 最早的一个. 但是一些全局自定的工作, 还是应该放在Bootstrap中去完成
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function routerStartup(Request_Abstract $request, Response_Abstract $response)
{
$_httpResult = explode('.', $request->getServer('HTTP_HOST'));
$level = 'www';
if (count($_httpResult) == 3) {
list ($level, $domainName, $suffix) = $_httpResult;
}
$_config = Registry::get('appConfig');
$_modulesList = array();
// $handler = opendir($_config['application']['directory'] . DIRECTORY_SEPARATOR . 'modules');
// while (($filename = readdir($handler)) !== false) {
// if ($filename != "." && $filename != "..") {
// $_modulesList[] = $filename;
// }
// }
// closedir($handler);
if (!empty($_config['application']['modules'])) {
$_modules = $_config['application']['modules'];
$_modulesList = explode(',', $_modules);
}
if ($level != 'www' && in_array(ucfirst($level), $_modulesList, true)) {
$request->module = ucfirst($level);
} else {
$request->module = 'Default';
}
}
/**
*
*
* 路由结束之后触发,此时路由一定正确完成, 否则这个事件不会触发
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function routerShutdown(Request_Abstract $request, Response_Abstract $response)
{
}
/**
*
*
* 分发循环开始之前被触发
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function dispatchLoopStartup(Request_Abstract $request, Response_Abstract $response)
{
}
/**
*
*
* 分发之前触发 如果在一个请求处理过程中, 发生了forward, 则这个事件会被触发多次
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function preDispatch(Request_Abstract $request, Response_Abstract $response)
{
}
/**
*
*
* 分发结束之后触发,此时动作已经执行结束, 视图也已经渲染完成. 和preDispatch类似, 此事件也可能触发多次
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function postDispatch(Request_Abstract $request, Response_Abstract $response)
{
}
/**
*
*
* 分发循环结束之后触发,此时表示所有的业务逻辑都已经运行完成, 但是响应还没有发送
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function dispatchLoopShutdown(Request_Abstract $request, Response_Abstract $response)
{
}
/**
* @param Request_Abstract $request
* @param Response_Abstract $response
* @return bool|void
*/
public function preResponse(Request_Abstract $request, Response_Abstract $response)
{
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 2/22/15
* Time: 11:42 AM
*/
namespace Plugin;
use Yaf\Request_Abstract;
use Yaf\Response_Abstract;
use Yaf\Plugin_abstract;
use Hood\Debug\XHProf as hoodXHProf;
class Xhprof extends Plugin_abstract
{
private $beginTime = 0;
private $requestSlowTimeout = 500;
private $outputDir = null;
public function __construct($requestSlowTimeout = 500)
{
$this->requestSlowTimeout = $requestSlowTimeout;
}
/**
* 设置分析数据路径
* @param null $outputDir
* @return $this
*/
public function setOutputDir($outputDir = null)
{
$this->outputDir = $outputDir;
return $this;
}
/**
* (Yaf >= 2.2.9)
* 在路由之前触发
*
* @param Request_Abstract $request 当前请求对象
* @param Response_Abstract $response 当前响应对象
*
* @return mixed
*/
public function routerStartup(Request_Abstract $request, Response_Abstract $response)
{
$this->beginTime = microtime(true);
xhprof_enable();
}
/**
* (Yaf >= 2.2.9)
* 路由结束之后触发
*
* @param Request_Abstract $request 当前请求对象
* @param Response_Abstract $response 当前响应对象
*
* @return mixed
*/
public function routerShutdown(Request_Abstract $request, Response_Abstract $response)
{
}
/**
* (Yaf >= 2.2.9)
* 分发循环开始之前被触发
*
* @param Request_Abstract $request 当前请求对象
* @param Response_Abstract $response 当前响应对象
*
* @return mixed
*/
public function dispatchLoopStartup(Request_Abstract $request, Response_Abstract $response)
{
}
/**
* (Yaf >= 2.2.9)
* 分发之前触发
*
* @param Request_Abstract $request 当前请求对象
* @param Response_Abstract $response 当前响应对象
*
* @return mixed
*/
public function preDispatch(Request_Abstract $request, Response_Abstract $response)
{
}
/**
* (Yaf >= 2.2.9)
* 分发结束之后触发
*
* @param Request_Abstract $request 当前请求对象
* @param Response_Abstract $response 当前响应对象
*
* @return mixed
*/
public function postDispatch(Request_Abstract $request, Response_Abstract $response)
{
}
/**
* (Yaf >= 2.2.9)
* dispatchLoopShutdown
*
* @param Request_Abstract $request 当前请求对象
* @param Response_Abstract $response 当前响应对象
*
* @return mixed
*/
public function dispatchLoopShutdown(Request_Abstract $request, Response_Abstract $response)
{
$useTime = round((microtime(true) - $this->beginTime) * 1000);
if ($useTime > $this->requestSlowTimeout) {
$xhprofData = xhprof_disable();
$dir = $this->outputDir . $request->getRequestUri();
$xhprofRuns = new hoodXHProf\Runs($dir);
$runID = $xhprofRuns->save_run($xhprofData, "service");
}
//echo "<p><a href='http://x/index.php?run=$run_id&source=xhprof_foo' target='_blank'>Xhprof</a></p>";
}
}
\ No newline at end of file
... ...
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
\ No newline at end of file
... ...
<?php
use Yaf\Application;
use Yaf\Dispatcher;
header("server: YH-" . (getenv('APPLICATION_HOST') ? getenv('APPLICATION_HOST') : 'local'));
define('APPLICATION_PATH', dirname(__DIR__));
define('APP_HTTP_HOST', $_SERVER['HTTP_HOST']);
###########################################################################################
defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'developer'));
###########################################################################################
$application = new Application(APPLICATION_PATH . "/configs/application.ini");
Dispatcher::getInstance()->flushInstantly(TRUE);
$application->bootstrap()->run();
\ No newline at end of file
... ...
/*!
* Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@font-face {
font-family: 'FontAwesome';
src: url('fonts/fontawesome-webfont.eot?v=4.3.0');
src: url('fonts/fontawesome-webfont.eot?#iefix&v=4.3.0') format('embedded-opentype'), url('fonts/fontawesome-webfont.woff2?v=4.3.0') format('woff2'), url('fonts/fontawesome-webfont.woff?v=4.3.0') format('woff'), url('fonts/fontawesome-webfont.ttf?v=4.3.0') format('truetype'), url('fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0)
}
.fa-lg {
font-size: 1.33333333em;
line-height: .75em;
vertical-align: -15%
}
.fa-2x {
font-size: 2em
}
.fa-3x {
font-size: 3em
}
.fa-4x {
font-size: 4em
}
.fa-5x {
font-size: 5em
}
.fa-fw {
width: 1.28571429em;
text-align: center
}
.fa-ul {
padding-left: 0;
margin-left: 2.14285714em;
list-style-type: none
}
.fa-ul > li {
position: relative
}
.fa-li {
position: absolute;
left: -2.14285714em;
width: 2.14285714em;
top: .14285714em;
text-align: center
}
.fa-li.fa-lg {
left: -1.85714286em
}
.fa-border {
padding: .2em .25em .15em;
border: solid .08em #eee;
border-radius: .1em
}
.pull-right {
float: right
}
.pull-left {
float: left
}
.fa.pull-left {
margin-right: .3em
}
.fa.pull-right {
margin-left: .3em
}
.fa-spin {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear
}
.fa-pulse {
-webkit-animation: fa-spin 1s infinite steps(8);
animation: fa-spin 1s infinite steps(8)
}
@-webkit-keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg)
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg)
}
}
@keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg)
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg)
}
}
.fa-rotate-90 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg)
}
.fa-rotate-180 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg)
}
.fa-rotate-270 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg)
}
.fa-flip-horizontal {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
-webkit-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1)
}
.fa-flip-vertical {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
-webkit-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1)
}
:root .fa-rotate-90, :root .fa-rotate-180, :root .fa-rotate-270, :root .fa-flip-horizontal, :root .fa-flip-vertical {
filter: none
}
.fa-stack {
position: relative;
display: inline-block;
width: 2em;
height: 2em;
line-height: 2em;
vertical-align: middle
}
.fa-stack-1x, .fa-stack-2x {
position: absolute;
left: 0;
width: 100%;
text-align: center
}
.fa-stack-1x {
line-height: inherit
}
.fa-stack-2x {
font-size: 2em
}
.fa-inverse {
color: #fff
}
.fa-glass:before {
content: "\f000"
}
.fa-music:before {
content: "\f001"
}
.fa-search:before {
content: "\f002"
}
.fa-envelope-o:before {
content: "\f003"
}
.fa-heart:before {
content: "\f004"
}
.fa-star:before {
content: "\f005"
}
.fa-star-o:before {
content: "\f006"
}
.fa-user:before {
content: "\f007"
}
.fa-film:before {
content: "\f008"
}
.fa-th-large:before {
content: "\f009"
}
.fa-th:before {
content: "\f00a"
}
.fa-th-list:before {
content: "\f00b"
}
.fa-check:before {
content: "\f00c"
}
.fa-remove:before, .fa-close:before, .fa-times:before {
content: "\f00d"
}
.fa-search-plus:before {
content: "\f00e"
}
.fa-search-minus:before {
content: "\f010"
}
.fa-power-off:before {
content: "\f011"
}
.fa-signal:before {
content: "\f012"
}
.fa-gear:before, .fa-cog:before {
content: "\f013"
}
.fa-trash-o:before {
content: "\f014"
}
.fa-home:before {
content: "\f015"
}
.fa-file-o:before {
content: "\f016"
}
.fa-clock-o:before {
content: "\f017"
}
.fa-road:before {
content: "\f018"
}
.fa-download:before {
content: "\f019"
}
.fa-arrow-circle-o-down:before {
content: "\f01a"
}
.fa-arrow-circle-o-up:before {
content: "\f01b"
}
.fa-inbox:before {
content: "\f01c"
}
.fa-play-circle-o:before {
content: "\f01d"
}
.fa-rotate-right:before, .fa-repeat:before {
content: "\f01e"
}
.fa-refresh:before {
content: "\f021"
}
.fa-list-alt:before {
content: "\f022"
}
.fa-lock:before {
content: "\f023"
}
.fa-flag:before {
content: "\f024"
}
.fa-headphones:before {
content: "\f025"
}
.fa-volume-off:before {
content: "\f026"
}
.fa-volume-down:before {
content: "\f027"
}
.fa-volume-up:before {
content: "\f028"
}
.fa-qrcode:before {
content: "\f029"
}
.fa-barcode:before {
content: "\f02a"
}
.fa-tag:before {
content: "\f02b"
}
.fa-tags:before {
content: "\f02c"
}
.fa-book:before {
content: "\f02d"
}
.fa-bookmark:before {
content: "\f02e"
}
.fa-print:before {
content: "\f02f"
}
.fa-camera:before {
content: "\f030"
}
.fa-font:before {
content: "\f031"
}
.fa-bold:before {
content: "\f032"
}
.fa-italic:before {
content: "\f033"
}
.fa-text-height:before {
content: "\f034"
}
.fa-text-width:before {
content: "\f035"
}
.fa-align-left:before {
content: "\f036"
}
.fa-align-center:before {
content: "\f037"
}
.fa-align-right:before {
content: "\f038"
}
.fa-align-justify:before {
content: "\f039"
}
.fa-list:before {
content: "\f03a"
}
.fa-dedent:before, .fa-outdent:before {
content: "\f03b"
}
.fa-indent:before {
content: "\f03c"
}
.fa-video-camera:before {
content: "\f03d"
}
.fa-photo:before, .fa-image:before, .fa-picture-o:before {
content: "\f03e"
}
.fa-pencil:before {
content: "\f040"
}
.fa-map-marker:before {
content: "\f041"
}
.fa-adjust:before {
content: "\f042"
}
.fa-tint:before {
content: "\f043"
}
.fa-edit:before, .fa-pencil-square-o:before {
content: "\f044"
}
.fa-share-square-o:before {
content: "\f045"
}
.fa-check-square-o:before {
content: "\f046"
}
.fa-arrows:before {
content: "\f047"
}
.fa-step-backward:before {
content: "\f048"
}
.fa-fast-backward:before {
content: "\f049"
}
.fa-backward:before {
content: "\f04a"
}
.fa-play:before {
content: "\f04b"
}
.fa-pause:before {
content: "\f04c"
}
.fa-stop:before {
content: "\f04d"
}
.fa-forward:before {
content: "\f04e"
}
.fa-fast-forward:before {
content: "\f050"
}
.fa-step-forward:before {
content: "\f051"
}
.fa-eject:before {
content: "\f052"
}
.fa-chevron-left:before {
content: "\f053"
}
.fa-chevron-right:before {
content: "\f054"
}
.fa-plus-circle:before {
content: "\f055"
}
.fa-minus-circle:before {
content: "\f056"
}
.fa-times-circle:before {
content: "\f057"
}
.fa-check-circle:before {
content: "\f058"
}
.fa-question-circle:before {
content: "\f059"
}
.fa-info-circle:before {
content: "\f05a"
}
.fa-crosshairs:before {
content: "\f05b"
}
.fa-times-circle-o:before {
content: "\f05c"
}
.fa-check-circle-o:before {
content: "\f05d"
}
.fa-ban:before {
content: "\f05e"
}
.fa-arrow-left:before {
content: "\f060"
}
.fa-arrow-right:before {
content: "\f061"
}
.fa-arrow-up:before {
content: "\f062"
}
.fa-arrow-down:before {
content: "\f063"
}
.fa-mail-forward:before, .fa-share:before {
content: "\f064"
}
.fa-expand:before {
content: "\f065"
}
.fa-compress:before {
content: "\f066"
}
.fa-plus:before {
content: "\f067"
}
.fa-minus:before {
content: "\f068"
}
.fa-asterisk:before {
content: "\f069"
}
.fa-exclamation-circle:before {
content: "\f06a"
}
.fa-gift:before {
content: "\f06b"
}
.fa-leaf:before {
content: "\f06c"
}
.fa-fire:before {
content: "\f06d"
}
.fa-eye:before {
content: "\f06e"
}
.fa-eye-slash:before {
content: "\f070"
}
.fa-warning:before, .fa-exclamation-triangle:before {
content: "\f071"
}
.fa-plane:before {
content: "\f072"
}
.fa-calendar:before {
content: "\f073"
}
.fa-random:before {
content: "\f074"
}
.fa-comment:before {
content: "\f075"
}
.fa-magnet:before {
content: "\f076"
}
.fa-chevron-up:before {
content: "\f077"
}
.fa-chevron-down:before {
content: "\f078"
}
.fa-retweet:before {
content: "\f079"
}
.fa-shopping-cart:before {
content: "\f07a"
}
.fa-folder:before {
content: "\f07b"
}
.fa-folder-open:before {
content: "\f07c"
}
.fa-arrows-v:before {
content: "\f07d"
}
.fa-arrows-h:before {
content: "\f07e"
}
.fa-bar-chart-o:before, .fa-bar-chart:before {
content: "\f080"
}
.fa-twitter-square:before {
content: "\f081"
}
.fa-facebook-square:before {
content: "\f082"
}
.fa-camera-retro:before {
content: "\f083"
}
.fa-key:before {
content: "\f084"
}
.fa-gears:before, .fa-cogs:before {
content: "\f085"
}
.fa-comments:before {
content: "\f086"
}
.fa-thumbs-o-up:before {
content: "\f087"
}
.fa-thumbs-o-down:before {
content: "\f088"
}
.fa-star-half:before {
content: "\f089"
}
.fa-heart-o:before {
content: "\f08a"
}
.fa-sign-out:before {
content: "\f08b"
}
.fa-linkedin-square:before {
content: "\f08c"
}
.fa-thumb-tack:before {
content: "\f08d"
}
.fa-external-link:before {
content: "\f08e"
}
.fa-sign-in:before {
content: "\f090"
}
.fa-trophy:before {
content: "\f091"
}
.fa-github-square:before {
content: "\f092"
}
.fa-upload:before {
content: "\f093"
}
.fa-lemon-o:before {
content: "\f094"
}
.fa-phone:before {
content: "\f095"
}
.fa-square-o:before {
content: "\f096"
}
.fa-bookmark-o:before {
content: "\f097"
}
.fa-phone-square:before {
content: "\f098"
}
.fa-twitter:before {
content: "\f099"
}
.fa-facebook-f:before, .fa-facebook:before {
content: "\f09a"
}
.fa-github:before {
content: "\f09b"
}
.fa-unlock:before {
content: "\f09c"
}
.fa-credit-card:before {
content: "\f09d"
}
.fa-rss:before {
content: "\f09e"
}
.fa-hdd-o:before {
content: "\f0a0"
}
.fa-bullhorn:before {
content: "\f0a1"
}
.fa-bell:before {
content: "\f0f3"
}
.fa-certificate:before {
content: "\f0a3"
}
.fa-hand-o-right:before {
content: "\f0a4"
}
.fa-hand-o-left:before {
content: "\f0a5"
}
.fa-hand-o-up:before {
content: "\f0a6"
}
.fa-hand-o-down:before {
content: "\f0a7"
}
.fa-arrow-circle-left:before {
content: "\f0a8"
}
.fa-arrow-circle-right:before {
content: "\f0a9"
}
.fa-arrow-circle-up:before {
content: "\f0aa"
}
.fa-arrow-circle-down:before {
content: "\f0ab"
}
.fa-globe:before {
content: "\f0ac"
}
.fa-wrench:before {
content: "\f0ad"
}
.fa-tasks:before {
content: "\f0ae"
}
.fa-filter:before {
content: "\f0b0"
}
.fa-briefcase:before {
content: "\f0b1"
}
.fa-arrows-alt:before {
content: "\f0b2"
}
.fa-group:before, .fa-users:before {
content: "\f0c0"
}
.fa-chain:before, .fa-link:before {
content: "\f0c1"
}
.fa-cloud:before {
content: "\f0c2"
}
.fa-flask:before {
content: "\f0c3"
}
.fa-cut:before, .fa-scissors:before {
content: "\f0c4"
}
.fa-copy:before, .fa-files-o:before {
content: "\f0c5"
}
.fa-paperclip:before {
content: "\f0c6"
}
.fa-save:before, .fa-floppy-o:before {
content: "\f0c7"
}
.fa-square:before {
content: "\f0c8"
}
.fa-navicon:before, .fa-reorder:before, .fa-bars:before {
content: "\f0c9"
}
.fa-list-ul:before {
content: "\f0ca"
}
.fa-list-ol:before {
content: "\f0cb"
}
.fa-strikethrough:before {
content: "\f0cc"
}
.fa-underline:before {
content: "\f0cd"
}
.fa-table:before {
content: "\f0ce"
}
.fa-magic:before {
content: "\f0d0"
}
.fa-truck:before {
content: "\f0d1"
}
.fa-pinterest:before {
content: "\f0d2"
}
.fa-pinterest-square:before {
content: "\f0d3"
}
.fa-google-plus-square:before {
content: "\f0d4"
}
.fa-google-plus:before {
content: "\f0d5"
}
.fa-money:before {
content: "\f0d6"
}
.fa-caret-down:before {
content: "\f0d7"
}
.fa-caret-up:before {
content: "\f0d8"
}
.fa-caret-left:before {
content: "\f0d9"
}
.fa-caret-right:before {
content: "\f0da"
}
.fa-columns:before {
content: "\f0db"
}
.fa-unsorted:before, .fa-sort:before {
content: "\f0dc"
}
.fa-sort-down:before, .fa-sort-desc:before {
content: "\f0dd"
}
.fa-sort-up:before, .fa-sort-asc:before {
content: "\f0de"
}
.fa-envelope:before {
content: "\f0e0"
}
.fa-linkedin:before {
content: "\f0e1"
}
.fa-rotate-left:before, .fa-undo:before {
content: "\f0e2"
}
.fa-legal:before, .fa-gavel:before {
content: "\f0e3"
}
.fa-dashboard:before, .fa-tachometer:before {
content: "\f0e4"
}
.fa-comment-o:before {
content: "\f0e5"
}
.fa-comments-o:before {
content: "\f0e6"
}
.fa-flash:before, .fa-bolt:before {
content: "\f0e7"
}
.fa-sitemap:before {
content: "\f0e8"
}
.fa-umbrella:before {
content: "\f0e9"
}
.fa-paste:before, .fa-clipboard:before {
content: "\f0ea"
}
.fa-lightbulb-o:before {
content: "\f0eb"
}
.fa-exchange:before {
content: "\f0ec"
}
.fa-cloud-download:before {
content: "\f0ed"
}
.fa-cloud-upload:before {
content: "\f0ee"
}
.fa-user-md:before {
content: "\f0f0"
}
.fa-stethoscope:before {
content: "\f0f1"
}
.fa-suitcase:before {
content: "\f0f2"
}
.fa-bell-o:before {
content: "\f0a2"
}
.fa-coffee:before {
content: "\f0f4"
}
.fa-cutlery:before {
content: "\f0f5"
}
.fa-file-text-o:before {
content: "\f0f6"
}
.fa-building-o:before {
content: "\f0f7"
}
.fa-hospital-o:before {
content: "\f0f8"
}
.fa-ambulance:before {
content: "\f0f9"
}
.fa-medkit:before {
content: "\f0fa"
}
.fa-fighter-jet:before {
content: "\f0fb"
}
.fa-beer:before {
content: "\f0fc"
}
.fa-h-square:before {
content: "\f0fd"
}
.fa-plus-square:before {
content: "\f0fe"
}
.fa-angle-double-left:before {
content: "\f100"
}
.fa-angle-double-right:before {
content: "\f101"
}
.fa-angle-double-up:before {
content: "\f102"
}
.fa-angle-double-down:before {
content: "\f103"
}
.fa-angle-left:before {
content: "\f104"
}
.fa-angle-right:before {
content: "\f105"
}
.fa-angle-up:before {
content: "\f106"
}
.fa-angle-down:before {
content: "\f107"
}
.fa-desktop:before {
content: "\f108"
}
.fa-laptop:before {
content: "\f109"
}
.fa-tablet:before {
content: "\f10a"
}
.fa-mobile-phone:before, .fa-mobile:before {
content: "\f10b"
}
.fa-circle-o:before {
content: "\f10c"
}
.fa-quote-left:before {
content: "\f10d"
}
.fa-quote-right:before {
content: "\f10e"
}
.fa-spinner:before {
content: "\f110"
}
.fa-circle:before {
content: "\f111"
}
.fa-mail-reply:before, .fa-reply:before {
content: "\f112"
}
.fa-github-alt:before {
content: "\f113"
}
.fa-folder-o:before {
content: "\f114"
}
.fa-folder-open-o:before {
content: "\f115"
}
.fa-smile-o:before {
content: "\f118"
}
.fa-frown-o:before {
content: "\f119"
}
.fa-meh-o:before {
content: "\f11a"
}
.fa-gamepad:before {
content: "\f11b"
}
.fa-keyboard-o:before {
content: "\f11c"
}
.fa-flag-o:before {
content: "\f11d"
}
.fa-flag-checkered:before {
content: "\f11e"
}
.fa-terminal:before {
content: "\f120"
}
.fa-code:before {
content: "\f121"
}
.fa-mail-reply-all:before, .fa-reply-all:before {
content: "\f122"
}
.fa-star-half-empty:before, .fa-star-half-full:before, .fa-star-half-o:before {
content: "\f123"
}
.fa-location-arrow:before {
content: "\f124"
}
.fa-crop:before {
content: "\f125"
}
.fa-code-fork:before {
content: "\f126"
}
.fa-unlink:before, .fa-chain-broken:before {
content: "\f127"
}
.fa-question:before {
content: "\f128"
}
.fa-info:before {
content: "\f129"
}
.fa-exclamation:before {
content: "\f12a"
}
.fa-superscript:before {
content: "\f12b"
}
.fa-subscript:before {
content: "\f12c"
}
.fa-eraser:before {
content: "\f12d"
}
.fa-puzzle-piece:before {
content: "\f12e"
}
.fa-microphone:before {
content: "\f130"
}
.fa-microphone-slash:before {
content: "\f131"
}
.fa-shield:before {
content: "\f132"
}
.fa-calendar-o:before {
content: "\f133"
}
.fa-fire-extinguisher:before {
content: "\f134"
}
.fa-rocket:before {
content: "\f135"
}
.fa-maxcdn:before {
content: "\f136"
}
.fa-chevron-circle-left:before {
content: "\f137"
}
.fa-chevron-circle-right:before {
content: "\f138"
}
.fa-chevron-circle-up:before {
content: "\f139"
}
.fa-chevron-circle-down:before {
content: "\f13a"
}
.fa-html5:before {
content: "\f13b"
}
.fa-css3:before {
content: "\f13c"
}
.fa-anchor:before {
content: "\f13d"
}
.fa-unlock-alt:before {
content: "\f13e"
}
.fa-bullseye:before {
content: "\f140"
}
.fa-ellipsis-h:before {
content: "\f141"
}
.fa-ellipsis-v:before {
content: "\f142"
}
.fa-rss-square:before {
content: "\f143"
}
.fa-play-circle:before {
content: "\f144"
}
.fa-ticket:before {
content: "\f145"
}
.fa-minus-square:before {
content: "\f146"
}
.fa-minus-square-o:before {
content: "\f147"
}
.fa-level-up:before {
content: "\f148"
}
.fa-level-down:before {
content: "\f149"
}
.fa-check-square:before {
content: "\f14a"
}
.fa-pencil-square:before {
content: "\f14b"
}
.fa-external-link-square:before {
content: "\f14c"
}
.fa-share-square:before {
content: "\f14d"
}
.fa-compass:before {
content: "\f14e"
}
.fa-toggle-down:before, .fa-caret-square-o-down:before {
content: "\f150"
}
.fa-toggle-up:before, .fa-caret-square-o-up:before {
content: "\f151"
}
.fa-toggle-right:before, .fa-caret-square-o-right:before {
content: "\f152"
}
.fa-euro:before, .fa-eur:before {
content: "\f153"
}
.fa-gbp:before {
content: "\f154"
}
.fa-dollar:before, .fa-usd:before {
content: "\f155"
}
.fa-rupee:before, .fa-inr:before {
content: "\f156"
}
.fa-cny:before, .fa-rmb:before, .fa-yen:before, .fa-jpy:before {
content: "\f157"
}
.fa-ruble:before, .fa-rouble:before, .fa-rub:before {
content: "\f158"
}
.fa-won:before, .fa-krw:before {
content: "\f159"
}
.fa-bitcoin:before, .fa-btc:before {
content: "\f15a"
}
.fa-file:before {
content: "\f15b"
}
.fa-file-text:before {
content: "\f15c"
}
.fa-sort-alpha-asc:before {
content: "\f15d"
}
.fa-sort-alpha-desc:before {
content: "\f15e"
}
.fa-sort-amount-asc:before {
content: "\f160"
}
.fa-sort-amount-desc:before {
content: "\f161"
}
.fa-sort-numeric-asc:before {
content: "\f162"
}
.fa-sort-numeric-desc:before {
content: "\f163"
}
.fa-thumbs-up:before {
content: "\f164"
}
.fa-thumbs-down:before {
content: "\f165"
}
.fa-youtube-square:before {
content: "\f166"
}
.fa-youtube:before {
content: "\f167"
}
.fa-xing:before {
content: "\f168"
}
.fa-xing-square:before {
content: "\f169"
}
.fa-youtube-play:before {
content: "\f16a"
}
.fa-dropbox:before {
content: "\f16b"
}
.fa-stack-overflow:before {
content: "\f16c"
}
.fa-instagram:before {
content: "\f16d"
}
.fa-flickr:before {
content: "\f16e"
}
.fa-adn:before {
content: "\f170"
}
.fa-bitbucket:before {
content: "\f171"
}
.fa-bitbucket-square:before {
content: "\f172"
}
.fa-tumblr:before {
content: "\f173"
}
.fa-tumblr-square:before {
content: "\f174"
}
.fa-long-arrow-down:before {
content: "\f175"
}
.fa-long-arrow-up:before {
content: "\f176"
}
.fa-long-arrow-left:before {
content: "\f177"
}
.fa-long-arrow-right:before {
content: "\f178"
}
.fa-apple:before {
content: "\f179"
}
.fa-windows:before {
content: "\f17a"
}
.fa-android:before {
content: "\f17b"
}
.fa-linux:before {
content: "\f17c"
}
.fa-dribbble:before {
content: "\f17d"
}
.fa-skype:before {
content: "\f17e"
}
.fa-foursquare:before {
content: "\f180"
}
.fa-trello:before {
content: "\f181"
}
.fa-female:before {
content: "\f182"
}
.fa-male:before {
content: "\f183"
}
.fa-gittip:before, .fa-gratipay:before {
content: "\f184"
}
.fa-sun-o:before {
content: "\f185"
}
.fa-moon-o:before {
content: "\f186"
}
.fa-archive:before {
content: "\f187"
}
.fa-bug:before {
content: "\f188"
}
.fa-vk:before {
content: "\f189"
}
.fa-weibo:before {
content: "\f18a"
}
.fa-renren:before {
content: "\f18b"
}
.fa-pagelines:before {
content: "\f18c"
}
.fa-stack-exchange:before {
content: "\f18d"
}
.fa-arrow-circle-o-right:before {
content: "\f18e"
}
.fa-arrow-circle-o-left:before {
content: "\f190"
}
.fa-toggle-left:before, .fa-caret-square-o-left:before {
content: "\f191"
}
.fa-dot-circle-o:before {
content: "\f192"
}
.fa-wheelchair:before {
content: "\f193"
}
.fa-vimeo-square:before {
content: "\f194"
}
.fa-turkish-lira:before, .fa-try:before {
content: "\f195"
}
.fa-plus-square-o:before {
content: "\f196"
}
.fa-space-shuttle:before {
content: "\f197"
}
.fa-slack:before {
content: "\f198"
}
.fa-envelope-square:before {
content: "\f199"
}
.fa-wordpress:before {
content: "\f19a"
}
.fa-openid:before {
content: "\f19b"
}
.fa-institution:before, .fa-bank:before, .fa-university:before {
content: "\f19c"
}
.fa-mortar-board:before, .fa-graduation-cap:before {
content: "\f19d"
}
.fa-yahoo:before {
content: "\f19e"
}
.fa-google:before {
content: "\f1a0"
}
.fa-reddit:before {
content: "\f1a1"
}
.fa-reddit-square:before {
content: "\f1a2"
}
.fa-stumbleupon-circle:before {
content: "\f1a3"
}
.fa-stumbleupon:before {
content: "\f1a4"
}
.fa-delicious:before {
content: "\f1a5"
}
.fa-digg:before {
content: "\f1a6"
}
.fa-pied-piper:before {
content: "\f1a7"
}
.fa-pied-piper-alt:before {
content: "\f1a8"
}
.fa-drupal:before {
content: "\f1a9"
}
.fa-joomla:before {
content: "\f1aa"
}
.fa-language:before {
content: "\f1ab"
}
.fa-fax:before {
content: "\f1ac"
}
.fa-building:before {
content: "\f1ad"
}
.fa-child:before {
content: "\f1ae"
}
.fa-paw:before {
content: "\f1b0"
}
.fa-spoon:before {
content: "\f1b1"
}
.fa-cube:before {
content: "\f1b2"
}
.fa-cubes:before {
content: "\f1b3"
}
.fa-behance:before {
content: "\f1b4"
}
.fa-behance-square:before {
content: "\f1b5"
}
.fa-steam:before {
content: "\f1b6"
}
.fa-steam-square:before {
content: "\f1b7"
}
.fa-recycle:before {
content: "\f1b8"
}
.fa-automobile:before, .fa-car:before {
content: "\f1b9"
}
.fa-cab:before, .fa-taxi:before {
content: "\f1ba"
}
.fa-tree:before {
content: "\f1bb"
}
.fa-spotify:before {
content: "\f1bc"
}
.fa-deviantart:before {
content: "\f1bd"
}
.fa-soundcloud:before {
content: "\f1be"
}
.fa-database:before {
content: "\f1c0"
}
.fa-file-pdf-o:before {
content: "\f1c1"
}
.fa-file-word-o:before {
content: "\f1c2"
}
.fa-file-excel-o:before {
content: "\f1c3"
}
.fa-file-powerpoint-o:before {
content: "\f1c4"
}
.fa-file-photo-o:before, .fa-file-picture-o:before, .fa-file-image-o:before {
content: "\f1c5"
}
.fa-file-zip-o:before, .fa-file-archive-o:before {
content: "\f1c6"
}
.fa-file-sound-o:before, .fa-file-audio-o:before {
content: "\f1c7"
}
.fa-file-movie-o:before, .fa-file-video-o:before {
content: "\f1c8"
}
.fa-file-code-o:before {
content: "\f1c9"
}
.fa-vine:before {
content: "\f1ca"
}
.fa-codepen:before {
content: "\f1cb"
}
.fa-jsfiddle:before {
content: "\f1cc"
}
.fa-life-bouy:before, .fa-life-buoy:before, .fa-life-saver:before, .fa-support:before, .fa-life-ring:before {
content: "\f1cd"
}
.fa-circle-o-notch:before {
content: "\f1ce"
}
.fa-ra:before, .fa-rebel:before {
content: "\f1d0"
}
.fa-ge:before, .fa-empire:before {
content: "\f1d1"
}
.fa-git-square:before {
content: "\f1d2"
}
.fa-git:before {
content: "\f1d3"
}
.fa-hacker-news:before {
content: "\f1d4"
}
.fa-tencent-weibo:before {
content: "\f1d5"
}
.fa-qq:before {
content: "\f1d6"
}
.fa-wechat:before, .fa-weixin:before {
content: "\f1d7"
}
.fa-send:before, .fa-paper-plane:before {
content: "\f1d8"
}
.fa-send-o:before, .fa-paper-plane-o:before {
content: "\f1d9"
}
.fa-history:before {
content: "\f1da"
}
.fa-genderless:before, .fa-circle-thin:before {
content: "\f1db"
}
.fa-header:before {
content: "\f1dc"
}
.fa-paragraph:before {
content: "\f1dd"
}
.fa-sliders:before {
content: "\f1de"
}
.fa-share-alt:before {
content: "\f1e0"
}
.fa-share-alt-square:before {
content: "\f1e1"
}
.fa-bomb:before {
content: "\f1e2"
}
.fa-soccer-ball-o:before, .fa-futbol-o:before {
content: "\f1e3"
}
.fa-tty:before {
content: "\f1e4"
}
.fa-binoculars:before {
content: "\f1e5"
}
.fa-plug:before {
content: "\f1e6"
}
.fa-slideshare:before {
content: "\f1e7"
}
.fa-twitch:before {
content: "\f1e8"
}
.fa-yelp:before {
content: "\f1e9"
}
.fa-newspaper-o:before {
content: "\f1ea"
}
.fa-wifi:before {
content: "\f1eb"
}
.fa-calculator:before {
content: "\f1ec"
}
.fa-paypal:before {
content: "\f1ed"
}
.fa-google-wallet:before {
content: "\f1ee"
}
.fa-cc-visa:before {
content: "\f1f0"
}
.fa-cc-mastercard:before {
content: "\f1f1"
}
.fa-cc-discover:before {
content: "\f1f2"
}
.fa-cc-amex:before {
content: "\f1f3"
}
.fa-cc-paypal:before {
content: "\f1f4"
}
.fa-cc-stripe:before {
content: "\f1f5"
}
.fa-bell-slash:before {
content: "\f1f6"
}
.fa-bell-slash-o:before {
content: "\f1f7"
}
.fa-trash:before {
content: "\f1f8"
}
.fa-copyright:before {
content: "\f1f9"
}
.fa-at:before {
content: "\f1fa"
}
.fa-eyedropper:before {
content: "\f1fb"
}
.fa-paint-brush:before {
content: "\f1fc"
}
.fa-birthday-cake:before {
content: "\f1fd"
}
.fa-area-chart:before {
content: "\f1fe"
}
.fa-pie-chart:before {
content: "\f200"
}
.fa-line-chart:before {
content: "\f201"
}
.fa-lastfm:before {
content: "\f202"
}
.fa-lastfm-square:before {
content: "\f203"
}
.fa-toggle-off:before {
content: "\f204"
}
.fa-toggle-on:before {
content: "\f205"
}
.fa-bicycle:before {
content: "\f206"
}
.fa-bus:before {
content: "\f207"
}
.fa-ioxhost:before {
content: "\f208"
}
.fa-angellist:before {
content: "\f209"
}
.fa-cc:before {
content: "\f20a"
}
.fa-shekel:before, .fa-sheqel:before, .fa-ils:before {
content: "\f20b"
}
.fa-meanpath:before {
content: "\f20c"
}
.fa-buysellads:before {
content: "\f20d"
}
.fa-connectdevelop:before {
content: "\f20e"
}
.fa-dashcube:before {
content: "\f210"
}
.fa-forumbee:before {
content: "\f211"
}
.fa-leanpub:before {
content: "\f212"
}
.fa-sellsy:before {
content: "\f213"
}
.fa-shirtsinbulk:before {
content: "\f214"
}
.fa-simplybuilt:before {
content: "\f215"
}
.fa-skyatlas:before {
content: "\f216"
}
.fa-cart-plus:before {
content: "\f217"
}
.fa-cart-arrow-down:before {
content: "\f218"
}
.fa-diamond:before {
content: "\f219"
}
.fa-ship:before {
content: "\f21a"
}
.fa-user-secret:before {
content: "\f21b"
}
.fa-motorcycle:before {
content: "\f21c"
}
.fa-street-view:before {
content: "\f21d"
}
.fa-heartbeat:before {
content: "\f21e"
}
.fa-venus:before {
content: "\f221"
}
.fa-mars:before {
content: "\f222"
}
.fa-mercury:before {
content: "\f223"
}
.fa-transgender:before {
content: "\f224"
}
.fa-transgender-alt:before {
content: "\f225"
}
.fa-venus-double:before {
content: "\f226"
}
.fa-mars-double:before {
content: "\f227"
}
.fa-venus-mars:before {
content: "\f228"
}
.fa-mars-stroke:before {
content: "\f229"
}
.fa-mars-stroke-v:before {
content: "\f22a"
}
.fa-mars-stroke-h:before {
content: "\f22b"
}
.fa-neuter:before {
content: "\f22c"
}
.fa-facebook-official:before {
content: "\f230"
}
.fa-pinterest-p:before {
content: "\f231"
}
.fa-whatsapp:before {
content: "\f232"
}
.fa-server:before {
content: "\f233"
}
.fa-user-plus:before {
content: "\f234"
}
.fa-user-times:before {
content: "\f235"
}
.fa-hotel:before, .fa-bed:before {
content: "\f236"
}
.fa-viacoin:before {
content: "\f237"
}
.fa-train:before {
content: "\f238"
}
.fa-subway:before {
content: "\f239"
}
.fa-medium:before {
content: "\f23a"
}
\ No newline at end of file
... ...