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


PHP Bundle::element方法代碼示例

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


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

示例1: path

 /**
  * Get the path to a view on disk.
  *
  * @param $view
  *
  * @return string
  * @throws \Exception
  */
 protected function path($view)
 {
     $view = str_replace('.', '/', $view);
     $this->bundle_root = $root = Bundle::path(Bundle::name($view)) . 'views';
     $path = $root . DS . Bundle::element($view) . $this->template_ext;
     if (file_exists($path)) {
         $this->template = $view . $this->template_ext;
         return $path;
     }
     throw new \Exception("View [{$view}] does not exist.");
 }
開發者ID:SerdarSanri,項目名稱:laravel-weed,代碼行數:19,代碼來源:view.php

示例2: parse

 /**
  * Parse a language key into its bundle, file, and line segments.
  *
  * Language lines follow a {bundle}::{file}.{line} naming convention.
  *
  * @param  string  $key
  * @return array
  */
 protected function parse($key)
 {
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     // If there are not at least two segments in the array, it means that
     // the developer is requesting the entire language line array to be
     // returned. If that is the case, we'll make the item "null".
     if (count($segments) >= 2) {
         $line = implode('.', array_slice($segments, 1));
         return array($bundle, $segments[0], $line);
     } else {
         return array($bundle, $segments[0], null);
     }
 }
開發者ID:victoroliveira1605,項目名稱:Laravel-Bootstrap,代碼行數:22,代碼來源:lang.php

示例3: parse

 /**
  * Parse a key and return its bundle, file, and key segments.
  *
  * Configuration items are named using the {bundle}::{file}.{item} convention.
  *
  * @param  string  $key
  * @return array
  */
 protected static function parse($key)
 {
     // First, we'll check the keyed cache of configuration items, as this will
     // be the fastest method of retrieving the configuration option. After an
     // item is parsed, it is always stored in the cache by its key.
     if (array_key_exists($key, static::$cache)) {
         return static::$cache[$key];
     }
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     // If there are not at least two segments in the array, it means that the
     // developer is requesting the entire configuration array to be returned.
     // If that is the case, we'll make the item field "null".
     if (count($segments) >= 2) {
         $parsed = array($bundle, $segments[0], implode('.', array_slice($segments, 1)));
     } else {
         $parsed = array($bundle, $segments[0], null);
     }
     return static::$cache[$key] = $parsed;
 }
開發者ID:richthegeek,項目名稱:Sasshare,代碼行數:28,代碼來源:config.php

示例4: path

 /**
  * Get the path to a given view on disk.
  *
  * @param  string  $view
  * @return string
  */
 protected function path($view)
 {
     $view = str_replace('.', '/', $view);
     $root = Bundle::path(Bundle::name($view)) . 'views/';
     // Views may have the normal PHP extension or the Blade PHP extension, so
     // we need to check if either of them exist in the base views directory
     // for the bundle and return the first one we find.
     foreach (array(EXT, BLADE_EXT) as $extension) {
         if (file_exists($path = $root . Bundle::element($view) . $extension)) {
             return $path;
         }
     }
     throw new \Exception("View [{$view}] does not exist.");
 }
開發者ID:richthegeek,項目名稱:Sasshare,代碼行數:20,代碼來源:view.php

示例5: get

 /**
  * Parse the filter string, returning the filter name and parameters.
  *
  * @param  string  $filter
  * @return array
  */
 public function get($filter)
 {
     // If the parameters were specified by passing an array into the collection,
     // then we will simply return those parameters. Combining passed parameters
     // with parameters specified directly in the filter attachment is not
     // currently supported by the framework.
     if (!is_null($this->parameters)) {
         return array($filter, $this->parameters());
     }
     // If no parameters were specified when the collection was created, we will
     // check the filter string itself to see if the parameters were injected
     // into the string as raw values, such as "role:admin".
     if (($colon = strpos(Bundle::element($filter), ':')) !== false) {
         $parameters = explode(',', substr(Bundle::element($filter), $colon + 1));
         // If the filter belongs to a bundle, we need to re-calculate the position
         // of the parameter colon, since we originally calculated it without the
         // bundle identifier because the identifier uses colons as well.
         if (($bundle = Bundle::name($filter)) !== DEFAULT_BUNDLE) {
             $colon = strlen($bundle . '::') + $colon;
         }
         return array(substr($filter, 0, $colon), $parameters);
     }
     // If no parameters were specified when the collection was created or
     // in the filter string, we will just return the filter name as is
     // and give back an empty array of parameters.
     return array($filter, array());
 }
開發者ID:bamper,項目名稱:laravel.com,代碼行數:33,代碼來源:filter.php

示例6: parse

 protected function parse($key)
 {
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     if (count($segments) >= 2) {
         $line = implode('.', array_slice($segments, 1));
         return array($bundle, $segments[0], $line);
     } else {
         return array($bundle, $segments[0], null);
     }
 }
開發者ID:laravelbook,項目名稱:framework3,代碼行數:11,代碼來源:laravel_lite.php

示例7: get

 public function get($filter)
 {
     if (!is_null($this->parameters)) {
         return array($filter, $this->parameters());
     }
     if (($colon = strpos(Bundle::element($filter), ':')) !== false) {
         $parameters = explode(',', substr(Bundle::element($filter), $colon + 1));
         if (($bundle = Bundle::name($filter)) !== DEFAULT_BUNDLE) {
             $colon = strlen($bundle . '::') + $colon;
         }
         return array(substr($filter, 0, $colon), $parameters);
     }
     return array($filter, array());
 }
開發者ID:laravelbook,項目名稱:framework3,代碼行數:14,代碼來源:laravel_lite.php

示例8: isFresh

 /**
  * Returns true if the template is still fresh
  *
  * @param  string     $name  The template name
  * @param  timestamp  $time  The last modification time of the cached template
  * @return bool
  */
 public function isFresh($name, $time)
 {
     return filemtime($this->getPath(Bundle::name($name), Bundle::element($name))) < $time;
 }
開發者ID:SerdarSanri,項目名稱:twig-bundle,代碼行數:11,代碼來源:loader.php


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