本文整理汇总了PHP中YiiBase::setPathOfAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP YiiBase::setPathOfAlias方法的具体用法?PHP YiiBase::setPathOfAlias怎么用?PHP YiiBase::setPathOfAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YiiBase
的用法示例。
在下文中一共展示了YiiBase::setPathOfAlias方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
Yii::app()->clientScript->coreScriptUrl = Yii::app()->baseUrl . "/js";
//设置css路径
YiiBase::setPathOfAlias('webcss', YiiBase::getPathOfAlias('webroot') . '/css');
$this->layout = 'application.views.layouts.adminRight';
parent::init();
$_GET['r'] = isset($_GET['r']) ? $_GET['r'] : Yii::app()->homeUrl;
}
示例2: renameNgin
public function renameNgin(CEvent $event)
{
$path1 = HFile::normalizePath(Yii::getPathOfAlias('ygin'));
$path2 = str_replace(array('/ngin', '/usr/files/projects/www/'), array('/ygin', '/usr/www/'), Yii::getPathOfAlias('ygin'));
if ($path1 == $path2) {
return;
}
rename($path1, $path2);
YiiBase::setPathOfAlias('ygin', realpath(dirname(__FILE__) . '/../'));
// переименовываем ngin в ygin в прикладных файлах
HFile::replaceData('/ngin/', '/ygin/', Yii::getPathOfAlias('webroot') . '/index.php');
}
示例3: init
public function init()
{
foreach ($this->alias as $key => $s) {
$vars = $this->extract($s);
foreach ($vars as $name => $one) {
$name = $one['name'];
$var = $one['var'];
if (!$var) {
continue;
}
$s = str_replace("{" . $name . '}', $var, $s);
}
YiiBase::setPathOfAlias($key, $s);
}
}
示例4: realpath
<?php
YiiBase::setPathOfAlias('ygin', realpath(dirname(__FILE__) . '/../'));
YiiBase::setPathOfAlias('ngin', realpath(dirname(__FILE__) . '/../'));
// TODO придется оставить на какое-то время для совместимости.
//Название хоста, для отправки отчетов об ошибках
$errorSubjectHost = '';
if (isset($_SERVER['HTTP_HOST'])) {
//Если пришло в punicode
if (strpos($_SERVER['HTTP_HOST'], 'xn--') !== false) {
YiiBase::import('ygin.lib.IDNA', true);
$idna = new Net_IDNA_php4();
$errorSubjectHost = $idna->decode($_SERVER['HTTP_HOST']);
} else {
$errorSubjectHost = $_SERVER['HTTP_HOST'];
}
} else {
$errorSubjectHost = realpath(dirname(__FILE__) . '/../../');
}
return array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../protected', 'aliases' => array('temp' => 'webroot.temp', 'xupload' => 'ygin.ext.xupload', 'fileUpload' => 'ygin.components.fileUpload'), 'preload' => array('log'), 'import' => array('ygin.helpers.*', 'ygin.components.*', 'ygin.interface.*'), 'components' => array('session' => array('autoStart' => false, 'cookieParams' => array('timeout' => '7200')), 'db' => array('nullConversion' => PDO::NULL_EMPTY_STRING), 'log' => array('class' => 'CLogRouter', 'routes' => array('email_error' => array('class' => 'ygin.components.DaEmailLogRoute', 'levels' => 'error, warning', 'filter' => array('class' => 'ygin.components.DaLogFilter', 'ignoreCategories' => array('exception.CHttpException.404', 'exception.DaHttpException.*')), 'subject' => 'Ошибка на сайте (' . $errorSubjectHost . ')', 'enabled' => YII_DEBUG == false), 'mailErrorLog' => array('class' => 'DaFileLogRoute', 'categories' => 'application.sendMail.error', 'logFile' => 'mail_error_log.log'), 'errorLog' => array('class' => 'CFileLogRoute', 'levels' => 'error, warning', 'logFile' => 'error_log.log', 'filter' => array('class' => 'ygin.components.DaLogFilter', 'ignoreCategories' => array('exception.CHttpException.404', 'exception.DaHttpException.*', 'application.sendMail.error'), 'logVars' => array('_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER'))), 'loginLog' => array('class' => 'DaFileLogRoute', 'levels' => 'info', 'categories' => 'application.login.*', 'logFile' => 'login.log', 'filter' => array('class' => 'CLogFilter', 'logVars' => array()))))));
示例5: yiiVersion
/**
* Initialize Yii and return Yii version
*
* @param bool $refresh
* @return bool|string Yii version or false if Yii is not found
*/
public static function yiiVersion($refresh = false)
{
static $yiiVersion;
if ($yiiVersion !== null && !$refresh) {
return $yiiVersion;
}
$yii_file = self::yiiPath($refresh) . '/framework/YiiBase.php';
if (!file_exists($yii_file)) {
return $yiiVersion = false;
}
require_once $yii_file;
YiiBase::setPathOfAlias('yii_embed', YII_EMBED_PATH . 'app');
YiiBase::import('yii_embed.components.*');
YiiBase::import('yii_embed.models.*');
YiiBase::$enableIncludePath = false;
return $yiiVersion = YiiBase::getVersion();
}
示例6: realpath
<?php
/**
* Yii RESTful API
*
* @link https://github.com/paysio/yii-rest-api
* @copyright Copyright (c) 2012 Pays I/O Ltd. (http://pays.io)
* @license http://www.opensource.org/licenses/mit-license.php MIT license
* @package REST_Service_Demo
*/
YiiBase::setPathOfAlias('rest', realpath(__DIR__ . '/../extensions/yii-rest-api/library/rest'));
return array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', 'name' => 'My Web Application', 'preload' => array('restService'), 'import' => array('application.models.*', 'application.components.*'), 'components' => array('restService' => array('class' => '\\rest\\Service', 'enable' => isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/api/') !== false), 'urlManager' => array('urlFormat' => 'path', 'showScriptName' => false, 'baseUrl' => '', 'rules' => array(array('restUser/index', 'pattern' => 'api/users', 'verb' => 'GET', 'parsingOnly' => true), array('restUser/create', 'pattern' => 'api/users', 'verb' => 'POST', 'parsingOnly' => true), array('restUser/view', 'pattern' => 'api/users/<id>', 'verb' => 'GET', 'parsingOnly' => true), array('restUser/update', 'pattern' => 'api/users/<id>', 'verb' => 'PUT', 'parsingOnly' => true), array('restUser/delete', 'pattern' => 'api/users/<id>', 'verb' => 'DELETE', 'parsingOnly' => true)))));
示例7: define
define('YII1_BASE_PATH', YII1_PATH . DIRECTORY_SEPARATOR . 'YiiBase.php');
}
// Required in Yii2 path
if (!defined('YII2_PATH')) {
throw new Exception('Yii2 Framework not found.');
} elseif (!defined('YII2_BASE_PATH')) {
define('YII2_BASE_PATH', YII2_PATH . DIRECTORY_SEPARATOR . 'BaseYii.php');
}
// Predefine Yii1 constants before included YiiBase.php
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
*/
示例8: dirname
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* ----------------------------------------------------
*
* Date: 28/Nov/2012
* Time: 19:08:49
* File: JGoogleAPI.php
* Encoding: UTF-8
*
* @author: João Parreira <joaofrparreira@gmail.com>
* @package Project: JGoogleAPI
* @version 0.1a
*
* */
YiiBase::setPathOfAlias('JGoogleAPISrcAlias', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'google-api-php-client' . DIRECTORY_SEPARATOR . 'src');
class JGoogleAPI extends CApplicationComponent
{
/**
* @var string Defines the default authentication type to be used
*/
public $defaultAuthenticationType = 'serviceAPI';
private $authenticationType = null;
// Credentials can be obtained at https://code.google.com/apis/console
// See http://code.google.com/p/google-api-php-client/wiki/OAuth2 for more information
/**
* @var webApplication
* Saves the data for api access (Accessed by web browsers over a network.)
*/
public $webappAPI = array('clientId' => null, 'clientEmail' => null, 'clientSecret' => null, 'redirectUri' => null, 'javascriptOrigins' => null);
/**