本文整理汇总了PHP中Yii::registerAutoloader方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::registerAutoloader方法的具体用法?PHP Yii::registerAutoloader怎么用?PHP Yii::registerAutoloader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::registerAutoloader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _load_wrfl
private function _load_wrfl()
{
if ($this->device == null) {
$wurflDir = Yii::getPathOfAlias($this->wurflDir);
$persistenceDir = Yii::getPathOfAlias($this->persistenceDir);
$cacheDir = Yii::getPathOfAlias($this->cacheDir);
require_once realpath($wurflDir . '/Application.php');
Yii::registerAutoloader(array('WURFL_ClassLoader', 'loadClass'));
// Create WURFL Configuration
$wurflConfig = new WURFL_Configuration_InMemoryConfig();
// Set location of the WURFL File
$wurflConfig->wurflFile(realpath(Yii::getPathOfAlias($this->wurflFileDir) . '/wurfl.zip'));
// Set the match mode for the API ('performance' or 'accuracy')
$wurflConfig->matchMode($this->matchMode);
// Setup WURFL Persistence
$wurflConfig->persistence('file', array('dir' => $persistenceDir));
// Setup Caching
$wurflConfig->cache('file', array('dir' => $cacheDir, 'expiration' => $this->expiration));
// Create a WURFL Manager Factory from the WURFL Configuration
$wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
// Create a WURFL Manager
/* @var $wurflManager WURFL_WURFLManager */
$wurflManager = $wurflManagerFactory->create();
$this->device = $wurflManager->getDeviceForHttpRequest($_SERVER);
}
}
示例2: init
/**
* Calls the registerScripts() method
*/
public function init()
{
Yii::import('ext.swiftmailer2.*');
require dirname(__FILE__) . '/lib/classes/Swift.php';
Yii::registerAutoloader(array('Swift', 'autoload'));
require dirname(__FILE__) . '/lib/swift_init.php';
parent::init();
}
示例3: render
public function render($html, $filename, $attachment = 1, $paper = 'a4', $orientation = 'portrait')
{
Yii::import('ext.vendors.pdf.dompdf.*');
require_once 'dompdf_config.inc.php';
Yii::registerAutoloader('DOMPDF_autoload');
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper($paper, $orientation);
$dompdf->render();
$dompdf->stream($filename . ".pdf", array("Attachment" => $attachment));
}
示例4: init
/**
* Inits the command and prepares the base environment.
*/
public function init()
{
Yii::app()->interceptor->intercept($this);
Yii::import('application.vendors.*');
EZendAutoloader::$prefixes = array('Zend', 'Custom');
Yii::import("ext.yiiext.components.zendAutoloader.EZendAutoloader", true);
Yii::registerAutoloader(array("EZendAutoloader", "loadClass"), true);
ini_set('max_execution_time', 9000);
ini_set('memory_limit', '1024M');
date_default_timezone_set("Europe/Berlin");
error_reporting(E_ALL ^ E_NOTICE);
#HSetting::InstallBase();
}
示例5: init
public function init()
{
parent::init();
Yii::$classMap['Smarty'] = $this->smartyPath . '/Smarty.class.php';
Yii::$classMap['Smarty_Internal_Data'] = $this->smartyPath . '/sysplugins/smarty_internal_data.php';
$this->_smarty = new Smarty();
$this->_smarty->template_dir = $this->templateDir ? $this->templateDir : Yii::app()->getViewPath();
$this->_smarty->compile_dir = $this->compileDir ? $this->compileDir : Yii::app()->getRuntimePath() . '/smarty/compile';
$this->_smarty->cache_dir = $this->cacheDir ? $this->cacheDir : Yii::app()->getRuntimePath() . '/smarty/cache';
$this->_smarty->left_delimiter = $this->leftDelimiter;
$this->_smarty->right_delimiter = $this->rightDelimiter;
$this->_smarty->force_compile = $this->forceCompile;
Yii::registerAutoloader('smartyAutoload');
}
示例6: init
public function init()
{
parent::init();
if (@class_exists('AmazonS3', true) == false) {
include_once 'AWSSDKforPHP/sdk.class.php';
}
if (@class_exists('AmazonS3', true) == false) {
throw CException('This extension require AWSSDKforPHP library');
}
if (empty($this->key) || empty($this->secret)) {
throw CException('This extension need access key and secret access key to be set.');
}
Yii::import('ext.amazon.components.*');
Yii::registerAutoloader(array('CFLoader', 'autoloader'));
}
示例7: init
public function init()
{
if (!class_exists('Swift', false)) {
require_once dirname(__FILE__) . '/lib/classes/Swift.php';
// Register SwiftMailer's autoloader before Yii for correct class loading.
Yii::registerAutoloader(array('Swift', 'autoload'));
// Include the SwiftMailer Dependencies
require_once dirname(__FILE__) . '/lib/dependency_maps/cache_deps.php';
require_once dirname(__FILE__) . '/lib/dependency_maps/mime_deps.php';
require_once dirname(__FILE__) . '/lib/dependency_maps/message_deps.php';
require_once dirname(__FILE__) . '/lib/dependency_maps/transport_deps.php';
// Load in global library preferences
require_once dirname(__FILE__) . '/lib/preferences.php';
}
}
示例8: init
public function init()
{
if (!$this->appName) {
throw new CException('Invalid application name for daemon.');
}
if ($this->logFile == '') {
$this->logFile = implode(DIRECTORY_SEPARATOR, array(Yii::getPathOfAlias('application'), 'runtime', self::LOG_FILE_NAME));
}
if (!file_exists($this->logFile)) {
if (!touch($this->logFile)) {
throw new CException('Invalid log file ' . $this->logFile);
}
}
Yii::registerAutoloader(array('System_Daemon', 'autoload'));
System_Daemon::setOptions(array('appName' => $this->appName, 'appDir' => Yii::getPathOfAlias('application'), 'sysMaxExecutionTime' => $this->sysMaxExecutionTime, 'sysMaxInputTime' => $this->sysMaxInputTime, 'sysMemoryLimit' => $this->sysMemoryLimit, 'appRunAsGID' => $this->runAsGID, 'appRunAsUID' => $this->runAsUID, 'logLocation' => $this->logFile));
}
示例9: init
/**
* Component initialization
*/
public function init()
{
parent::init();
Yii::import('application.vendors.*');
// need this to avoid Smarty rely on spl autoload function,
// this has to be done since we need the Yii autoload handler
if (!defined('SMARTY_SPL_AUTOLOAD')) {
define('SMARTY_SPL_AUTOLOAD', 0);
} elseif (SMARTY_SPL_AUTOLOAD !== 0) {
throw new CException('ESmartyViewRenderer cannot work with SMARTY_SPL_AUTOLOAD enabled. Set SMARTY_SPL_AUTOLOAD to 0.');
}
// including Smarty class and registering autoload handler
require_once 'Smarty/sysplugins/smarty_internal_data.php';
require_once 'Smarty/Smarty.class.php';
// need this since Yii autoload handler raises an error if class is not found
// Yii autoloader needs to be the last in the autoload chain
spl_autoload_unregister('smartyAutoload');
Yii::registerAutoloader('smartyAutoload');
$this->smarty = new Smarty();
// configure smarty
if (is_array($this->config)) {
foreach ($this->config as $key => $value) {
if ($key[0] != '_') {
// not setting semi-private properties
$this->smarty->{$key} = $value;
}
}
}
$this->smarty->_file_perms = $this->filePermission;
$this->smarty->_dir_perms = $this->directoryPermission;
$this->smarty->template_dir = '';
$compileDir = isset($this->config['compile_dir']) ? $this->config['compile_dir'] : Yii::app()->getRuntimePath() . '/smarty/compiled/';
// create compiled directory if not exists
if (!file_exists($compileDir)) {
mkdir($compileDir, $this->directoryPermission, true);
}
$this->smarty->compile_dir = $compileDir;
// no check for trailing /, smarty does this for us
$this->smarty->plugins_dir[] = Yii::getPathOfAlias('application.extensions.Smarty.plugins');
if (!empty($this->pluginsDir)) {
$this->smarty->plugins_dir[] = Yii::getPathOfAlias($this->pluginsDir);
}
if (!empty($this->configDir)) {
$this->smarty->config_dir = Yii::getPathOfAlias($this->configDir);
}
}
示例10: init
function init()
{
require Yii::getPathOfAlias($this->twigPathAlias) . '/Autoloader.php';
Yii::registerAutoloader(array('Twig_Autoloader', 'autoload'), true);
$app = Yii::app();
/** @var $theme CTheme */
$theme = $app->getTheme();
$this->_paths = array();
if ($theme !== null) {
$this->_paths[] = $theme->getBasePath();
}
$this->_paths[] = $app->getBasePath();
$loader = new Twig_Loader_Filesystem($this->_paths);
$defaultOptions = array('autoescape' => false, 'auto_reload' => true, 'cache' => $app->getRuntimePath() . '/twig_cache/', 'charset' => $app->charset);
$this->_twig = new Twig_Environment($loader, array_merge($defaultOptions, $this->options));
// Adding Yii::app() object to globals
$this->_twig->addGlobal('App', $app);
// Adding Yii's core static classes proxy as 'C' shortcut (usage: {{C.Html.tag(...)}})
$this->_twig->addGlobal('C', new ETwigViewRendererYiiCoreStaticClassesProxy());
// Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}})
// (@see ETwigViewRendererVoidFunction below for details)
$this->_twig->addFunction('void', new Twig_Function_Function('ETwigViewRendererVoidFunction'));
// Adding custom globals (objects or static classes)
if (!empty($this->globals)) {
$this->addGlobals($this->globals);
}
// Adding custom functions
if (!empty($this->functions)) {
$this->addFunctions($this->functions);
}
// Adding custom filters
if (!empty($this->filters)) {
$this->addFilters($this->filters);
}
// Adding custom extensions
if (!empty($this->extensions)) {
$this->addExtensions($this->extensions);
}
// Change lexer syntax
if (!empty($this->lexerOptions)) {
$this->setLexerOptions($this->lexerOptions);
}
return parent::init();
}
示例11: __construct
public function __construct()
{
$startTime = microtime(true);
$xf_path = Yii::getPathOfAlias('webroot') . '/forum';
Yii::registerAutoloader(array('XenforeLoader', 'autoload'), true);
XenForo_Autoloader::getInstance()->setupAutoloader($xf_path . '/library');
XenForo_Application::initialize($xf_path . '/library', $xf_path);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Application::disablePhpErrorHandler();
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE ^ E_WARNING);
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
XenForo_Session::startPublicSession();
$this->visitor = XenForo_Visitor::getInstance();
/*$fc = new XenForo_FrontController(new XenForo_Dependencies_Public());
ob_start();
$fc->run();
$content = ob_get_clean();*/
}
示例12: __construct
public function __construct()
{
/**
* load config from module
*/
$module = Yii::app()->getModule('d2mailer');
$this->fromEmail = $module->fromEmail;
$this->fromName = $module->fromName;
$this->smtp_host = $module->smtp_host;
$this->smtp_port = $module->smtp_port;
$this->smtp_username = $module->smtp_username;
$this->smtp_password = $module->smtp_password;
$this->logging = $module->logging;
if (class_exists('Swift', false)) {
return true;
}
require_once Yii::getPathOfAlias('swiftMailer') . '/classes/Swift.php';
Yii::registerAutoloader(array('Swift', 'autoload'));
require_once Yii::getPathOfAlias('swiftMailer') . '/swift_init.php';
return true;
}
示例13: actionFormData
/**
* Prints a JSON with URL for form action and the needed token, and dies.<br />
* Used with JSON POST requests.<br />
* <p>Asks for the following POST fields:
* <ul>
* <li>title</li>
* <li>description</li>
* <li>category (only one)</li>
* <li>keywords (comma-separated)</li>
* </ul>
* </p>
* @return JSON
*/
public function actionFormData()
{
Yii::import('system.collections.*');
Yii::import('system.base.*');
Yii::import('ext.*');
Yii::import('ext.Zend.Gdata.*');
require_once 'Zend/Loader.php';
Yii::registerAutoloader(array('Zend_Loader', 'loadClass'));
$login = Zend_Gdata_ClientLogin::getHttpClient($this->youtubeLogin, $this->youtubePassword, 'youtube', null, Yii::app()->name);
$login->setHeaders('X-GData-Key', 'key=' . $this->youtubeDevKey);
$utub = new Zend_Gdata_YouTube($login);
$video = new Zend_Gdata_YouTube_VideoEntry();
$media = $utub->newMediaGroup();
$media->title = $utub->newMediaTitle()->setText($_POST['title']);
$media->description = $utub->newMediaDescription()->setText($_POST['description']);
$media->keywords = $utub->newMediaKeywords()->setText($_POST['keywords']);
$media->category = array($utub->newMediaCategory()->setText($_POST['category'])->setScheme(self::CAT_SCHEME), $utub->newMediaCategory()->setText(preg_replace('/\\s/', '', Yii::app()->name) . 'Site')->setScheme(self::TAG_SCHEME));
$video->mediaGroup = $media;
$data = $utub->getFormUploadToken($video);
exit(json_encode($data));
}
示例14: initAutoloader
/**
*
*/
public function initAutoloader()
{
Yii::registerAutoloader(array(__CLASS__, 'autoload'));
}
示例15: registerScripts
/**
* Registers swiftMailer autoloader and includes the required files
*/
public function registerScripts()
{
if (self::$registeredScripts) {
return;
}
self::$registeredScripts = true;
require dirname(__FILE__) . '/vendors/swiftMailer/classes/Swift.php';
Yii::registerAutoloader(array('Swift', 'autoload'));
require dirname(__FILE__) . '/vendors/swiftMailer/swift_init.php';
}