本文整理汇总了PHP中Yii::classMap方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::classMap方法的具体用法?PHP Yii::classMap怎么用?PHP Yii::classMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::classMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
parent::init();
$app = Yii::app();
if (isset($_GET['lang'])) {
$app->language = $_GET['lang'];
$app->session['_lang'] = $app->language;
} else {
if (isset($app->session['_lang'])) {
$app->language = $app->session['_lang'];
}
}
if (isset($_GET['layout'])) {
$this->layout = '//layouts/' . $_GET['layout'];
Yii::app()->user->loginUrl = array('site/login', 'layout' => $_GET['layout']);
} else {
Yii::app()->user->loginUrl = array('site/login');
}
// register class paths for extension captcha extended
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
}
示例2: init
public function init()
{
//Yii::app()->setTheme('adm');
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/global.js');
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-ui.min.js');
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery.alerts.js');
//$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/jquery.confirm.js');
//$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/jquery.blockui.js');
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-ui-1.8.2.custom.min.js');
//$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/bsystemgroup.js');
$cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/jquery.alerts.css');
Yii::app()->clientScript->registerScript('global', '
yii = {
urls: {
base: ' . CJSON::encode(Yii::app()->theme->baseUrl) . '
}
};
', CClientScript::POS_HEAD);
if (Yii::app()->user->id) {
$user = new ASystemUser();
$userInfo = $user->getSystemUserById(Yii::app()->user->id);
//var_dump($userInfo->cp_code);exit();
$this->group_id = $userInfo->group_id;
$this->username = $userInfo->username;
Yii::app()->session['group_id'] = $this->group_id;
Yii::app()->session['username'] = $this->username;
}
//$xmlPath = realpath($path = Yii::app()->basePath.'/../'.Yii::app()->params['config_folder'].'/');
// $xmlFile = Yii::app()->params['config_file_name'];
// $this->config = new LoadConfigXML($xmlPath,$xmlFile);
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
}
示例3: init
public function init()
{
// register class paths for extension captcha extended
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
$this->search = new Search();
$this->link = new Linksite();
}
示例4: init
public function init()
{
// register class paths for extension captcha extended
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
$this->unreadReceivedMessagesCount = Yii::app()->db->createCommand()->select('count(*)')->from('message')->where(array('and', 'id_user = :id', 'is_read = 0'), array('id' => Yii::app()->user->getId()))->queryScalar();
$this->viewer = null;
if (!Yii::app()->user->getIsGuest()) {
$this->viewer = Account::model()->findByPk(Yii::app()->user->getId());
}
$params = $this->getActionParams();
if (!empty($params) && array_key_exists('code', $params) && $params['code']) {
Yii::app()->setLanguage($params['code']);
}
}
示例5: init
public function init()
{
date_default_timezone_set('Asia/Ho_Chi_Minh');
parent::init();
$this->pageTitle = Yii::app()->params['page_title'];
$this->metaKeywords = 'hoc online, training online';
$this->metaDescription = 'hoc online, training online';
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/global.js');
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/countdown.js');
$language = Yii::app()->session->get('language') ? Yii::app()->session->get('language') : 'en';
Yii::app()->setLanguage($language);
//echo Yii::app()->user->id; exit();
if (Yii::app()->user->id) {
//$user = new WUsers;
$userInfo = WUser::getUserById(Yii::app()->user->id);
//$agen = unserialize($userInfo['group']);
$this->username = Yii::app()->user->name;
Yii::app()->session['username'] = $this->username;
Yii::app()->session['fullname'] = $userInfo['fullname'];
Yii::app()->session['group_id'] = $userInfo['user_group_id'];
if (Yii::app()->session['group_id'] == 2) {
Yii::app()->session['company_code'] = $userInfo['company_code'];
}
// var_dump($userInfo['avatar']);
$string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/no_avatar.jpg';
if (isset($userInfo['user_group_id']) && !empty($userInfo['user_group_id'])) {
// gv
if ($userInfo['user_group_id'] == 1) {
$string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/trainer.gif';
}
// hs
if ($userInfo['user_group_id'] == 2) {
$string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/trainee.gif';
}
// sp
if ($userInfo['user_group_id'] == 3) {
$string_avatar_none = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->theme->baseUrl . '/img/supervisor.gif';
}
}
Yii::app()->session['avatar'] = (isset($userInfo['avatar']) and !empty($userInfo['avatar'])) ? Yii::app()->params['url_base'] . '/uploads/avatars/user/' . $userInfo['avatar'] : $string_avatar_none;
}
//load XML Config
//$xmlPath = realpath($path = Yii::app()->basePath.'/../'.Yii::app()->params['config_folder'].'/');
//$xmlFile = Yii::app()->params['config_file_name'];
//$this->config = new LoadConfigXML($xmlPath,$xmlFile);
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
}
示例6: setup
/**
* Defines Yii constants, includes base yii class and sets aliases and classmap
*/
public function setup()
{
//set yii constants
defined('YII_DEBUG') or define('YII_DEBUG', $this->yiiDebug);
defined('YII_ENV') or define('YII_ENV', $this->yiiEnv);
//include yii
require_once $this->yiiPath;
//set aliases and classmap
foreach ($this->aliases as $alias => $path) {
\Yii::setAlias($alias, $path);
}
\Yii::$classMap = array_merge(\Yii::$classMap, $this->classMap);
}
示例7:
<?php
/**
* Yii bootstrap file.
* Used for enhanced IDE code autocompletion.
*/
require __DIR__ . '/vendor/yiisoft/yii2/BaseYii.php';
class Yii extends \yii\BaseYii
{
/**
* @var BaseApplication|WebApplication|ConsoleApplication the application instance
*/
public static $app;
}
spl_autoload_register(['Yii', 'autoload'], true, true);
Yii::$classMap = (include __DIR__ . '/vendor/yiisoft/yii2/classes.php');
Yii::$container = new yii\di\Container();
/**
* Class BaseApplication
* Used for properties that are identical for both WebApplication and ConsoleApplication
*
* @property \common\my\helpers\Debugger $debugger
* @property \common\my\helpers\Current $current
* @property \common\my\helpers\Exception $exception
*/
abstract class BaseApplication extends yii\base\Application
{
}
/**
* Class WebApplication
* Include only Web application related components here
示例8: define
defined('YII_ZII_PATH') or define('YII_ZII_PATH', YII1_PATH . DIRECTORY_SEPARATOR . 'zii');
// We must first include Yii2 base class to define the correct constant
require YII2_BASE_PATH;
// Include Yii1 base class
require YII1_BASE_PATH;
// Override Yii1 system alias
YiiBase::setPathOfAlias('system', YII1_PATH);
/**
* Yii bridge between v1.1.x and v2.0.
*
* @method static CWebApplication|CConsoleApplication app()
* @method static CWebApplication|CConsoleApplication createApplication($class, $config = null)
* @method static mixed createComponent($config)
* @method static string import($alias, $forceInclude = false)
* @method static string getPathOfAlias($alias)
* @method static void setPathOfAlias($alias, $path)
* @method static void trace($msg, $category = 'application')
*
* @author Veaceslav Medvedev <slavcopost@gmail.com>
* @version 0.1
* @since 1.1.17
*/
class Yii extends \yii\BaseYii
{
use Slavcodev\YiiBridge\FirstYiiCompatibility;
}
// Yii2 Autoloader and class map
// @link https://github.com/yiisoft/yii2/blob/master/framework/Yii.php#L25:L28
spl_autoload_register(['Yii', 'autoload'], true, true);
Yii::$classMap = (include YII2_PATH . '/classes.php');
Yii::$container = new yii\di\Container();
示例9: handleImports
/**
* Import all files that need to be included(for lazy loading)
* @param $event
*/
public function handleImports($event)
{
//Clears file cache so that everything is clean.
if (isset($_GET['clearCache']) && $_GET['clearCache'] == 1) {
GeneralCache::forgetEntry('filesClassMap');
}
try {
// not using default value to save cpu cycles on requests that follow the first exception.
Yii::$classMap = GeneralCache::getEntry('filesClassMap');
} catch (NotFoundException $e) {
$filesToInclude = FileUtil::getFilesFromDir(Yii::app()->basePath . '/modules', Yii::app()->basePath . '/modules', 'application.modules');
$filesToIncludeFromCore = FileUtil::getFilesFromDir(Yii::app()->basePath . '/core', Yii::app()->basePath . '/core', 'application.core');
$totalFilesToIncludeFromModules = count($filesToInclude);
foreach ($filesToIncludeFromCore as $key => $file) {
$filesToInclude[$totalFilesToIncludeFromModules + $key] = $file;
}
foreach ($filesToInclude as $file) {
Yii::import($file);
}
GeneralCache::cacheEntry('filesClassMap', Yii::$classMap);
}
Yii::app()->setAllClassesAreImported();
}
示例10: dirname
<?php
/**
* Yii bootstrap file.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
require __DIR__ . '/BaseYii.php';
/**
* Yii is a helper class serving common framework functionalities.
*
* It extends from [[\yii\BaseYii]] which provides the actual implementation.
* By writing your own Yii class, you can customize some functionalities of [[\yii\BaseYii]].
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class Yii extends \yii\BaseYii
{
}
spl_autoload_register(['Yii', 'autoload'], true, true);
foreach ([dirname(dirname(dirname(__DIR__))), dirname(__DIR__) . '/vendor'] as $dir) {
$file = $dir . '/composer/autoload_classmap.php';
if (file_exists($file)) {
Yii::$classMap = (require $file);
break;
}
}
Yii::$container = new yii\di\Container();
示例11: init
public function init()
{
// register class paths for extension captcha extended
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captcha') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captcha') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
parent::init();
}
示例12: array
<?php
date_default_timezone_set('Europe/Ljubljana');
if (!function_exists('pre_print')) {
function pre_print($obj)
{
echo '<pre>';
print_r($obj);
echo '</pre>';
}
}
Yii::$classMap = array();
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR, 'name' => 'Bober', 'charset' => 'utf-8', 'language' => 'en', 'sourceLanguage' => '00', 'theme' => 'abound', 'preload' => array('log'), 'import' => array('application.models.*', 'application.components.*', 'application.modules.user.models.*', 'application.modules.user.components.*', 'application.validators.*', 'ext.galleryManager.models.*', 'ext.galleryManager.*'), 'behaviors' => array('onbeginRequest' => array('class' => 'application.components.StartupBehavior')), 'modules' => array('gii' => array('class' => 'system.gii.GiiModule', 'password' => 'CHANGETHIS', 'ipFilters' => array('127.0.0.1', '::1'), 'generatorPaths' => array('bootstrap.gii')), 'user' => array('hash' => 'sha512', 'sendActivationMail' => true, 'loginNotActiv' => false, 'activeAfterRegister' => false, 'autoLogin' => true, 'registrationUrl' => array('/user/registration'), 'recoveryUrl' => array('/user/recovery'), 'loginUrl' => array('/site/login'), 'returnUrl' => array('/site/index'), 'returnLogoutUrl' => array('/site/login'))), 'components' => array('themeManager' => array(), 'localtime' => array('class' => 'LocalTime'), 'user' => array('class' => 'WebUser', 'allowAutoLogin' => true, 'loginUrl' => array('/user/login')), 'browser' => array('class' => 'application.extensions.browser.CBrowserComponent'), 'urlManager' => array('urlFormat' => 'path', 'rules' => array('<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>')), 'session' => array('sessionName' => 'Session', 'class' => 'system.web.CDbHttpSession', 'autoCreateSessionTable' => false, 'connectionID' => 'db', 'autoStart' => 'true', 'timeout' => 3600), 'assetManager' => array('class' => 'application.components.CustomCAssetManager'), 'db' => array('connectionString' => 'mysql:host=127.0.0.1;dbname=bober', 'username' => 'bober', 'password' => 'DATABASE PASSWORD', 'charset' => 'utf8'), 'cache' => array('class' => 'system.caching.CMemCache', 'servers' => array(array('host' => '127.0.0.1', 'port' => '11211', 'weight' => '60'))), 'errorHandler' => array('errorAction' => 'site/error'), 'log' => array('class' => 'CLogRouter', 'routes' => array(array('class' => 'CFileLogRoute', 'levels' => 'error, warning'))), 'image' => array('class' => 'ext.image.CImageComponent', 'driver' => 'GD'), 'widgetFactory' => array('class' => 'WidgetFactory', 'onAfterCreateWidget' => function (WidgetEvent $event) {
static $defaultPageSize = 20;
$widget = $event->widget;
// pre_print(get_class($widget));
if ($widget instanceof CBaseListView || $widget instanceof CGridView) {
/** @var CBaseListView $widget */
if ($widget->dataProvider !== null && $widget->dataProvider->pagination !== false) {
$widget->dataProvider->pagination->pageSize = $defaultPageSize;
}
}
})), 'controllerMap' => array('gallery' => 'ext.galleryManager.GalleryController'), 'params' => array('preferred_language' => 'en', 'dump_answers_to_disk' => False, 'adminEmail' => 'admin@localhost', 'staticDomain' => in_array($_SERVER['HTTP_HOST'], array('bober.comcode.si', 'boberadmin.comcode.si')) ? 'static-bober.comcode.si' : 'static.bober' . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '')));
示例13: init
public function init()
{
parent::init();
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captchaExtended') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php'));
}
示例14: setup
/**
* Defines Yii constants, includes base Yii class, sets aliases and merges class map.
*/
public function setup()
{
/**
* This constant defines whether the application should be in debug mode or not.
*/
defined('YII_DEBUG') or define('YII_DEBUG', $this->yiiDebug);
/**
* This constant defines in which environment the application is running.
* The value could be 'prod' (production), 'stage' (staging), 'test' (testing) or 'dev' (development).
*/
defined('YII_ENV') or define('YII_ENV', $this->yiiEnv);
/**
* Whether the the application is running in staging environment.
*/
defined('YII_ENV_STAGE') or define('YII_ENV_STAGE', YII_ENV === 'stage');
// Include Yii.
require $this->yiiPath;
// Set aliases.
foreach ($this->aliases as $alias => $path) {
\Yii::setAlias($alias, $path);
}
// Merge class map.
if (!empty($this->classMap)) {
\Yii::$classMap = static::merge(\Yii::$classMap, $this->classMap);
}
}
示例15: init
/**
*
*/
public function init()
{
//Подключение сторонней каптчи
Yii::$classMap = array_merge(Yii::$classMap, array('CaptchaExtendedAction' => Yii::getPathOfAlias('ext.captcha') . DIRECTORY_SEPARATOR . 'CaptchaExtendedAction.php', 'CaptchaExtendedValidator' => Yii::getPathOfAlias('ext.captcha') . DIRECTORY_SEPARATOR . 'CaptchaExtendedValidator.php'));
}