當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Assets::web_path方法代碼示例

本文整理匯總了PHP中Assets::web_path方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assets::web_path方法的具體用法?PHP Assets::web_path怎麽用?PHP Assets::web_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Assets的用法示例。


在下文中一共展示了Assets::web_path方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Set up environment
  *
  * @param  string  $type
  * @param  string  $name
  */
 public function __construct($type, $name = 'all')
 {
     // Check type
     Assets::require_valid_type($type);
     // Set type and name
     $this->_type = $type;
     $this->_name = $name;
     // Set asset file and web file
     $this->_destination_file = Assets::file_path($type, $name . '.' . $type);
     $this->_destination_web = Assets::web_path($type, $name . '.' . $type);
 }
開發者ID:boomcms,項目名稱:asset-merger,代碼行數:17,代碼來源:Collection.php

示例2: __construct

 /**
  * Set up the environment
  *
  * @param string $type
  * @param string $file
  * @param string $options
  * @param string $destination_path
  * @param bool   $copy
  * @param string $folder
  */
 function __construct($type, $file, array $options = array(), $destination_path = NULL, $copy = TRUE, $folder = NULL)
 {
     // Set processor to use
     $this->_processor = Arr::get($options, 'processor', Arr::get(Kohana::$config->load('asset-merger')->get('processor'), $type));
     // Set condition
     $this->_condition = Arr::get($options, 'condition');
     $this->_folder = $folder;
     // Set weight
     if (!empty($options['weight'])) {
         $this->_weight = $options['weight'];
     }
     // Set load paths
     if (!empty($options['load_paths'])) {
         $this->_load_paths = $options['load_paths'][$type];
     } elseif ($load_paths = Kohana::$config->load('asset-merger')->get('load_paths')) {
         $this->_load_paths = Arr::get($load_paths, $type);
     }
     // Set media
     if (!empty($options['media'])) {
         $this->_media = $options['media'];
     }
     // Set type and file
     $this->_type = $type;
     $this->_file = $file;
     $this->_copy = $copy;
     // Check if the type is a valid type
     Assets::require_valid_type($type);
     if (Valid::url($file)) {
         // No remote files allowed
         throw new Kohana_Exception('The asset :file must be local file', array(':file' => $file));
     }
     // Look for the specified file in each load path
     foreach ((array) $this->_load_paths as $path) {
         $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
         if (is_file($path . $file)) {
             // Set the destination and source file
             $this->_destination_file = Assets::file_path($type, $file, $destination_path, $this->_folder);
             $this->_source_file = $path . $file;
             // Don't continue
             break;
         }
     }
     if (!$this->source_file()) {
         // File not found
         throw new Kohana_Exception('Asset :file of type :type not found inside :paths', array(':file' => $file, ':type' => $type, ':paths' => join(', ', (array) Arr::get(Kohana::$config->load('asset-merger')->get('load_paths'), $type))));
     }
     if (!is_dir(dirname($this->destination_file())) and $this->copy()) {
         // Create directory for destination file
         mkdir(dirname($this->destination_file()), 0777, TRUE);
     }
     // Get the file parts
     $fileparts = explode('.', basename($file));
     // Extension index
     $extension_index = array_search($this->type(), $fileparts);
     // Set engines
     $this->_engines = array_reverse(array_slice($fileparts, $extension_index + 1));
     // Set the web destination
     $this->_destination_web = Assets::web_path($type, $file, $destination_path, $this->_folder);
 }
開發者ID:alle,項目名稱:assets-merger,代碼行數:69,代碼來源:Asset.php

示例3: set_destinations

 protected function set_destinations()
 {
     $hash = $this->hash_content();
     $this->_destination_file = Assets::file_path($this->type(), $this->name() . '-' . $hash . '.' . $this->type(), $this->destination_path(), $this->folder());
     $this->_destination_web = Assets::web_path($this->type(), $this->name() . '-' . $hash . '.' . $this->type(), $this->destination_path(), $this->folder());
 }
開發者ID:alle,項目名稱:assets-merger,代碼行數:6,代碼來源:Collection.php

示例4: test_file_path

 public function test_file_path()
 {
     $this->assertEquals($this->data_dir() . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'test.js', Assets::file_path('js', 'test.js'));
     $this->assertEquals('assets/js/test.js', Assets::web_path('js', 'test.js'));
 }
開發者ID:alle,項目名稱:assets-merger,代碼行數:5,代碼來源:TestAssets.php

示例5: __construct

 /**
  * Set up the environment
  *
  * @param  string  $type
  * @param  string  $file
  * @param  array   $options
  */
 function __construct($type, $file, array $options = array())
 {
     // Set processor to use
     $this->_processor = Arr::get($options, 'processor', Kohana::$config->load('asset-merger.processor.' . $type));
     // Set condition
     $this->_condition = Arr::get($options, 'condition');
     // Set type and file
     $this->_type = $type;
     $this->_file = $file;
     // Check if the type is a valid type
     Assets::require_valid_type($type);
     if (Valid::url($file)) {
         // No remote files allowed
         throw new Kohana_Exception('The asset :file must be local file', array(':file' => $file));
     }
     // Look for the specified file in each load path
     foreach ((array) Kohana::$config->load('asset-merger.load_paths.' . $type) as $path) {
         if (is_file($path . $file)) {
             // Set the destination and source file
             $this->_destination_file = Assets::file_path($type, $file);
             $this->_source_file = $path . $file;
             // Don't continue
             break;
         }
     }
     if (!$this->source_file()) {
         // File not found
         throw new Kohana_Exception('Asset :file of type :type not found inside :paths', array(':file' => $file, ':type' => $type, ':paths' => join(', ', (array) Kohana::$config->load('asset-merger.load_paths.' . $type))));
     }
     if (!is_dir(dirname($this->destination_file()))) {
         // Create directory for destination file
         mkdir(dirname($this->destination_file()), 0777, TRUE);
     }
     // Get the file parts
     $fileparts = explode('.', basename($file));
     // Extension index
     $extension_index = array_search($this->type(), $fileparts);
     // Set engines
     $this->_engines = array_reverse(array_slice($fileparts, $extension_index + 1));
     // Set the web destination
     $this->_destination_web = Assets::web_path($type, $file);
 }
開發者ID:boomcms,項目名稱:asset-merger,代碼行數:49,代碼來源:Asset.php


注:本文中的Assets::web_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。