当前位置: 首页>>代码示例>>PHP>>正文


PHP Craft::getPathOfAlias方法代码示例

本文整理汇总了PHP中Craft::getPathOfAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Craft::getPathOfAlias方法的具体用法?PHP Craft::getPathOfAlias怎么用?PHP Craft::getPathOfAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Craft的用法示例。


在下文中一共展示了Craft::getPathOfAlias方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Initializes the application component.
  *
  * @return null
  */
 public function init()
 {
     parent::init();
     // Import this here to ensure that libs like SimplePie are using our version of the class and not any server's
     // random version.
     require_once Craft::getPathOfAlias('app.vendor.simplepie.simplepie.idn.') . DIRECTORY_SEPARATOR . 'idna_convert.class.php';
 }
开发者ID:scisahaha,项目名称:generator-craft,代码行数:12,代码来源:FeedsService.php

示例2: findMissingTranslation

 /**
  * Looks for a missing translation string in Yii's core translations.
  *
  * @param \CMissingTranslationEvent $event
  *
  * @return null
  */
 public static function findMissingTranslation(\CMissingTranslationEvent $event)
 {
     // Look for translation file from most to least specific.  So nl_nl.php gets checked before nl.php, for example.
     $translationFiles = array();
     $parts = explode('_', $event->language);
     $totalParts = count($parts);
     for ($i = 1; $i <= $totalParts; $i++) {
         $translationFiles[] = implode('_', array_slice($parts, 0, $i));
     }
     $translationFiles = array_reverse($translationFiles);
     // First see if we have any cached info.
     foreach ($translationFiles as $translationFile) {
         // We've loaded the translation file already, just check for the translation.
         if (isset(static::$_translations[$translationFile])) {
             if (isset(static::$_translations[$translationFile][$event->message])) {
                 $event->message = static::$_translations[$translationFile][$event->message];
             }
             // No translation... just give up.
             return;
         }
     }
     // No luck in cache, check the file system.
     $frameworkMessagePath = IOHelper::normalizePathSeparators(Craft::getPathOfAlias('app.framework.messages'));
     foreach ($translationFiles as $translationFile) {
         $path = $frameworkMessagePath . $translationFile . '/yii.php';
         if (IOHelper::fileExists($path)) {
             // Load it up.
             static::$_translations[$translationFile] = (include $path);
             if (isset(static::$_translations[$translationFile][$event->message])) {
                 $event->message = static::$_translations[$translationFile][$event->message];
                 return;
             }
         }
     }
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:42,代码来源:LocalizationHelper.php

示例3: __construct

 public function __construct()
 {
     require_once Craft::getPathOfAlias('system.vendors.htmlpurifier') . '/HTMLPurifier.standalone.php';
     $whitelist = EmbeddedAssetsPlugin::getWhitelist();
     foreach ($whitelist as $i => $url) {
         $whitelist[$i] = preg_quote($url);
     }
     $regexp = '%^(https?:)?//([a-z0-9\\-]+\\.)?(' . implode('|', $whitelist) . ')([:/].*)?$%';
     $config = \HTMLPurifier_Config::createDefault();
     $config->set('HTML.SafeIframe', true);
     $config->set('URI.SafeIframeRegexp', $regexp);
     $config->set('Cache.SerializerPath', \Yii::app()->getRuntimePath());
     $this->_purifier = new \HTMLPurifier($config);
 }
开发者ID:benjamminf,项目名称:craft-embedded-assets,代码行数:14,代码来源:EmbeddedAssetsService.php

示例4: setContentTypeByExtension

 /**
  * Sets the Content-Type header based on a file extension.
  *
  * @param string $extension
  *
  * @return bool Whether setting the header was successful.
  */
 public static function setContentTypeByExtension($extension)
 {
     $extension = strtolower($extension);
     $mimeTypes = (require Craft::getPathOfAlias('app.framework.utils.mimeTypes') . '.php');
     if (!isset($mimeTypes[$extension])) {
         Craft::log('Tried to set the header mime type for the extension ' . $extension . ', but could not find in the mimeTypes list.', LogLevel::Warning);
         return false;
     }
     $mimeType = $mimeTypes[$extension];
     if (static::setHeader(array('Content-Type' => $mimeType . '; charset=utf-8'))) {
         // Save the MIME type for getMimeType()
         static::$_mimeType = $mimeType;
         return true;
     } else {
         return false;
     }
 }
开发者ID:sweetroll,项目名称:craft-test,代码行数:24,代码来源:HeaderHelper.php

示例5: convertToUTF8

 /**
  * Attempts to convert a string to UTF-8 and clean any non-valid UTF-8 characters.
  *
  * @param      $string
  *
  * @return bool|string
  */
 public static function convertToUTF8($string)
 {
     // Don't wrap in a class_exists in case the server already has it's own version of HTMLPurifier and they have
     // open_basedir restrictions
     require_once Craft::getPathOfAlias('system.vendors.htmlpurifier') . '/HTMLPurifier.standalone.php';
     // If it's already a UTF8 string, just clean and return it
     if (static::isUTF8($string)) {
         return \HTMLPurifier_Encoder::cleanUTF8($string);
     }
     // Otherwise set HTMLPurifier to the actual string encoding
     $config = \HTMLPurifier_Config::createDefault();
     $config->set('Core.Encoding', static::getEncoding($string));
     // Clean it
     $string = \HTMLPurifier_Encoder::cleanUTF8($string);
     // Convert it to UTF8 if possible
     if (static::checkForIconv()) {
         $string = \HTMLPurifier_Encoder::convertToUTF8($string, $config, null);
     } else {
         $encoding = static::getEncoding($string);
         $string = mb_convert_encoding($string, 'utf-8', $encoding);
     }
     return $string;
 }
开发者ID:ericnormannn,项目名称:m,代码行数:30,代码来源:StringHelper.php

示例6: getTemplate

 /**
  * @return string
  */
 public function getTemplate()
 {
     return file_get_contents(Craft::getPathOfAlias('app.etc.updates.migrationtemplate') . '.php');
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:7,代码来源:MigrationsService.php


注:本文中的Craft::getPathOfAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。