本文整理汇总了PHP中Yaf_Loader类的典型用法代码示例。如果您正苦于以下问题:PHP Yaf_Loader类的具体用法?PHP Yaf_Loader怎么用?PHP Yaf_Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Yaf_Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initSmarty
public function _initSmarty(Yaf_Dispatcher $dispatcher)
{
/* init smarty view engine */
Yaf_Loader::import("Smarty/Adapter.php");
$smarty = new Smarty_Adapter(null, Yaf_Application::app()->getConfig()->smarty);
$dispatcher->setView($smarty);
}
示例2: _initPlugin
function _initPlugin(Yaf_Dispatcher $dispatcher)
{
Yaf_Loader::import('vendor/autoload.php');
$dispatcher->registerPlugin(new Plugin_Init());
$dispatcher->registerPlugin(new Plugin_Smarty());
$dispatcher->registerPlugin(new LoginPlugin());
}
示例3: initContext
private static function initContext()
{
// set timezone
date_default_timezone_set('PRC');
// page start time,use $_SERVER['REQUEST_TIME'] instead above PHP 5.4+
define('REQUEST_TIME_US', intval(microtime(true) * 1000000));
// ODP pre-defined
define('IS_ODP', true);
define('ROOT_PATH', realpath(dirname(__FILE__) . '/../../../'));
define('CONF_PATH', ROOT_PATH . '/conf');
define('DATA_PATH', ROOT_PATH . '/data');
define('BIN_PATH', ROOT_PATH . '/php/bin');
define('LOG_PATH', ROOT_PATH . '/log');
define('APP_PATH', ROOT_PATH . '/app');
define('TPL_PATH', ROOT_PATH . '/template');
define('LIB_PATH', ROOT_PATH . '/php/phplib');
define('WEB_ROOT', ROOT_PATH . '/webroot');
define('PHP_EXEC', BIN_PATH . '/php');
$app_name == null && ($app_name = self::getAppName()) == null && ($app_name = 'unknown-app');
define('ODP_APP', $app_name);
define('APP', ODP_APP);
$loader = \Yaf_Loader::getInstance(null, LIB_PATH);
//var_dump($loader);
define('CLIENT_IP', \Odp\Ip::getClientIp());
define('USER_IP', \Odp\Ip::getUserIp());
define('FRONTEND_IP', \Odp\Ip::getFrontendIp());
// init autoloader
// todo PSR-4 autoloader
return true;
}
示例4: initYafBySooh
/**
*
* @param \Yaf_Dispatcher $dispatcher
* @param string $jqueryVer 使用的jquery文件,默认值:jquery-1.11.2.min.js
* @return view
*/
public static function initYafBySooh($dispatcher, $jqueryVer = 'jquery-1.11.2.min.js')
{
$router = $dispatcher->getRouter();
$router->addRoute("byVar", new \Yaf_Route_Supervar(SOOH_ROUTE_VAR));
\Yaf_Loader::getInstance()->registerLocalNameSpace($GLOBALS['CONF']['localLibs']);
$req = $dispatcher->getRequest();
$tmp = $req->get('__ONLY__');
if ($tmp == 'body') {
\SoohYaf\Viewext::$bodyonly = true;
}
$tmp = trim($req->get('__VIEW__'));
//html(default),wap, json
define('VIW_INC_PATH', APP_PATH . '/application/views/_inc/');
\SoohYaf\Viewext::$jqueryVer = $jqueryVer;
if (!empty($tmp)) {
$tmp = strtolower($tmp);
\Sooh\Base\Ini::getInstance()->viewRenderType($tmp);
if ($tmp == 'jsonp') {
\Sooh\Base\Ini::getInstance()->initGobal(array('nameJsonP' => $req->get('jsonp', 'jsonp')));
}
}
// $tmp = $dispatcher->getRequest()->get('__GZIP__');
// if(!empty($tmp)){
// $tmp = strtolower ($tmp);
// if($tmp=='gzip')define("ZIP_OUTPUT",$tmp);
// }
$view = new \SoohYaf\Viewext(null);
$dispatcher->setView($view);
$dispatcher->registerPlugin(new SoohPlugin());
return $view;
}
示例5: _initDebug
/**
* 开启调试输出
* @method _initDebug
* @author NewFuture
*/
public function _initDebug()
{
if (Config::get('isdebug')) {
/*加载 PHP Console Debug模块*/
Yaf_Loader::import('PhpConsole/__autoload.php');
$connector = PhpConsole\Connector::getInstance();
if ($connector->isActiveClient()) {
Log::write('PHP Console 已经链接', 'INFO');
$handler = PhpConsole\Handler::getInstance();
$dispatcher = $connector->getDebugDispatcher();
$handler->start();
$connector->setSourcesBasePath(APP_PATH);
$connector->setServerEncoding('utf8');
$dispatcher->detectTraceAndSource = true;
//跟踪信息
if ($pwd = Config::get('debug.auth')) {
$connector->setPassword($pwd);
$evalProvider = $connector->getEvalDispatcher()->getEvalProvider();
// $evalProvider->disableFileAccessByOpenBaseDir(); // means disable functions like include(), require(), file_get_contents() & etc
// $evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); // so you can access $_SERVER['REQUEST_URI'] just as $uri in terminal
// $evalProvider->addSharedVarReference('post', $_POST);
$connector->startEvalRequestsListener();
}
}
PhpConsole\Helper::register();
}
}
示例6: _initBase
/**
* 函数名称:_initBase
* 功能描述:引入基础base类
*/
public function _initBase()
{
Yaf_Loader::import(BASE_PATH . '/BaseAdminController.php');
Yaf_Loader::import(BASE_PATH . '/BaseIndexController.php');
Yaf_Loader::import(BASE_PATH . '/BaseAdminModel.php');
Yaf_Loader::import(BASE_PATH . '/BaseIndexModel.php');
}
示例7: _initRoutes
/**
* [路由设置]
*/
public function _initRoutes(Yaf_Dispatcher $dispatcher)
{
$router = $dispatcher->getRouter();
//$router->addConfig(Yaf_Registry::get('config')->routes);
Yaf_Loader::import(APP_CONFIG . '/route.php');
$router->addConfig($routeConfigs);
}
示例8: __construct
public function __construct()
{
$config = Yaf_Application::app()->getConfig();
Yaf_Loader::import('L_Wechat');
$options = array('token' => self::WX_TOKEN, 'appid' => $config['wx_appID'], 'appsecret' => $config['wx_appsecret'], 'access_token' => $config['wx_access_token'], 'expires' => $config['wx_expires']);
$this->wxSDK = new L_Wechat($options);
}
示例9: _initCore
public function _initCore()
{
define('TB_PREFIX', 'zt_');
define('APP_NAME', 'YOF-DEMO');
define('LIB_PATH', APP_PATH . '/application/library');
define('MODEL_PATH', APP_PATH . '/application/model');
define('FUNC_PATH', APP_PATH . '/application/function');
define('ADMIN_PATH', APP_PATH . '/application/modules/Admin');
// CSS, JS, IMG PATH
define('CSS_PATH', '/css');
define('JS_PATH', '/js');
define('IMG_PATH', '/img');
// Admin CSS, JS PATH
define('ADMIN_CSS_PATH', '/admin/css');
define('ADMIN_JS_PATH', '/admin/js');
Yaf_Loader::import('M_Model.pdo.php');
Yaf_Loader::import('Helper.class.php');
Helper::import('Basic');
Helper::import('Network');
Yaf_Loader::import('C_Basic.php');
Yaf_Loader::import(LIB_PATH . '/yar/Yar_Basic.php');
// header.html and left.html
define('HEADER_HTML', APP_PATH . '/public/common/header.html');
define('LEFT_HTML', APP_PATH . '/public/common/left.html');
// API KEY for api sign
define('API_KEY', 'THIS_is_OUR_API_keY');
}
示例10: init
/**
* method to control and navigate the user to the right view
*/
public function init()
{
if (APPLICATION_ENV === 'prod') {
// TODO: set the branch through config
$branch = 'production';
if (file_exists(APPLICATION_PATH . '/.git/refs/heads/' . $branch)) {
$this->commit = rtrim(file_get_contents(APPLICATION_PATH . '/.git/refs/heads/' . $branch), "\n");
} else {
$this->commit = md5(date('ymd'));
}
} else {
$this->commit = md5(time());
}
$this->baseUrl = $this->getRequest()->getBaseUri();
$this->addCss($this->baseUrl . '/css/bootstrap.min.css');
$this->addCss($this->baseUrl . '/css/bootstrap-datetimepicker.min.css');
$this->addCss($this->baseUrl . '/css/bootstrap-switch.css');
$this->addCss($this->baseUrl . '/css/bootstrap-multiselect.css');
$this->addCss($this->baseUrl . '/css/jsoneditor.css');
$this->addCss($this->baseUrl . '/css/main.css');
$this->addJs($this->baseUrl . '/js/vendor/bootstrap.min.js');
$this->addJs($this->baseUrl . '/js/plugins.js');
$this->addJs($this->baseUrl . '/js/moment.js');
$this->addJs($this->baseUrl . '/js/bootstrap-datetimepicker.min.js');
$this->addJs($this->baseUrl . '/js/jquery.jsoneditor.js');
$this->addJs($this->baseUrl . '/js/bootstrap-multiselect.js');
$this->addJs($this->baseUrl . '/js/bootstrap-switch.js');
$this->addJs($this->baseUrl . '/js/jquery.csv-0.71.min.js');
$this->addJs($this->baseUrl . '/js/main.js');
Yaf_Loader::getInstance(APPLICATION_PATH . '/application/helpers')->registerLocalNamespace('Admin');
}
示例11: _initCore
public function _initCore()
{
define('TB_PK', 'id');
// 表的主键, 用于 SelectByID 等
define('TB_PREFIX', 'zt_');
// 表前缀
define('APP_NAME', 'YOF-DEMO');
define('LIB_PATH', APP_PATH . '/application/library/');
define('MODEL_PATH', APP_PATH . '/application/model');
define('FUNC_PATH', APP_PATH . '/application/function');
define('ADMIN_PATH', APP_PATH . '/application/modules/Admin');
// CSS, JS, IMG PATH
define('CSS_PATH', '/css');
define('JS_PATH', '/js');
define('IMG_PATH', '/img');
// Admin CSS, JS PATH
define('ADMIN_CSS_PATH', '/admin/css');
define('ADMIN_JS_PATH', '/admin/js');
// 设置自动加载的目录
ini_set('yaf.library', LIB_PATH);
// 导入 F_Basic.php 与 F_Network.php
Helper::import('Basic');
Helper::import('Network');
Yaf_Loader::import('C_Basic.php');
Yaf_Loader::import(LIB_PATH . '/yar/Yar_Basic.php');
// header.html and left.html
define('HEADER_HTML', APP_PATH . '/public/common/header.html');
define('LEFT_HTML', APP_PATH . '/public/common/left.html');
// API KEY for api sign
define('API_KEY', 'THIS_is_OUR_API_keY');
}
示例12: _initPlugin
public function _initPlugin(Yaf_Dispatcher $dispatcher)
{
// set include paths of the system.
set_include_path(get_include_path() . PATH_SEPARATOR . Yaf_Loader::getInstance()->getLibraryPath());
/* register a billrun plugin system from config */
$config = Yaf_Application::app()->getConfig();
if (isset($config->plugins)) {
$plugins = $config->plugins->toArray();
$dispatcher = Billrun_Dispatcher::getInstance();
foreach ($plugins as $plugin) {
Billrun_Log::getInstance()->log("Load plugin " . $plugin, Zend_log::DEBUG);
$dispatcher->attach(new $plugin());
}
}
if (isset($config->chains)) {
$chains = $config->chains->toArray();
$dispatcherChain = Billrun_Dispatcher::getInstance(array('type' => 'chain'));
foreach ($chains as $chain) {
Billrun_Log::getInstance()->log("Load plugin " . $chain, Zend_log::DEBUG);
$dispatcherChain->attach(new $chain());
}
}
// make the base action auto load (required by controllers actions)
Yaf_Loader::getInstance(APPLICATION_PATH . '/application/helpers')->registerLocalNamespace('Action');
}
示例13: __construct
public function __construct()
{
$config = Yaf_Application::app()->getConfig();
Yaf_Loader::import('L_Wechat.class.php');
$options = array('token' => $config['wx_token'], 'appid' => $config['wx_appID'], 'appsecret' => $config['wx_appSecret']);
$this->wxSDK = new L_Wechat($options);
}
示例14: _initConfig
public function _initConfig(\Yaf_Dispatcher $dispatcher)
{
/*{{{*/
$this->config = Yaf_Application::app()->getConfig()->toArray();
Yaf_Registry::set('configarr', $this->config);
// 加载默认定义
\Yaf_Loader::import(APP_PATH . '/conf/defines.inc.php');
}
示例15: __construct
function __construct()
{
Yaf_Loader::import('qiniu/io.php');
Yaf_Loader::import('qiniu/rs.php');
Yaf_Loader::import('qiniu/config.php');
$this->bucket = $bucket;
$this->accessKey = $accessKey;
$this->secretKey = $secretKey;
}