當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。