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


PHP Parse::pipeList方法代碼示例

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


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

示例1: _routes__before

 public function _routes__before()
 {
     // check that caching is turned on
     if (!$this->core->isEnabled()) {
         return;
     }
     $today = Date::format('F j, Y');
     $keys = $this->fetchConfig('new_day_invalidation', null, null, false, false);
     if (empty($keys) || $this->cache->get('last_new_day', null) == $today) {
         // don't need to do this
         return;
     }
     // set that we did this today
     $this->cache->put('last_new_day', $today);
     // invalidate if needed
     $this->core->deleteByKey(Parse::pipeList($keys));
 }
開發者ID:andorpandor,項目名稱:git-deploy.eu2.frbit.com-yr-prototype,代碼行數:17,代碼來源:hooks.cache.php

示例2: isEnabled

 /**
  * Is HTML-caching enabled (either globally or for $url)?
  * 
  * @param string  $url  URL to check specifically for
  * @return bool
  */
 public function isEnabled($url)
 {
     // check to see if html-caching is on
     $global_enable = (bool) $this->fetchConfig('enable', false, null, true);
     if (!$global_enable || !Cache::exists()) {
         return false;
     }
     // check that the URL being requested is a content file
     $data = ContentService::getContent($this->removeQueryString($url));
     // not a content file, not enabled
     if (!$data) {
         return false;
     }
     // check for exclude on the current page
     $exclude_raw = $this->fetchConfig('exclude');
     // if excludes were set
     if ($exclude_raw) {
         $excluded = Parse::pipeList($exclude_raw);
         // loop through excluded options
         foreach ($excluded as $exclude) {
             // account for non-/-starting locations
             $this_url = substr($exclude, 0, 1) !== "/" ? ltrim($url, '/') : $url;
             if ($exclude === "*" || $exclude === "/*") {
                 // exclude all
                 return false;
             } elseif (substr($exclude, -1) === "*") {
                 // wildcard check
                 if (strpos($this_url, substr($exclude, 0, -1)) === 0) {
                     return false;
                 }
             } else {
                 // plain check
                 if ($exclude == $this_url) {
                     return false;
                 }
             }
         }
     }
     // all is well, return true
     return true;
 }
開發者ID:zane-insight,項目名稱:WhiteLaceInn,代碼行數:47,代碼來源:tasks.html_caching.php

示例3: filter

 /**
  * Filters the current content set down based on the filters given
  *
  * @param array  $filters  Filters to use to narrow down content
  * @return void
  * @throws Exception
  */
 public function filter($filters)
 {
     $hash = Debug::markStart('content', 'filtering');
     $filters = Helper::ensureArray($filters);
     // nothing to filter, abort
     if (!$this->count()) {
         return;
     }
     $since_date = null;
     $until_date = null;
     $remove_hidden = null;
     $remove_drafts = null;
     $keep_type = "all";
     $folders = null;
     $conditions = null;
     $located = false;
     $where = null;
     // standardize filters
     // -------------------
     $given_filters = $filters;
     $filters = array('show_hidden' => isset($given_filters['show_hidden']) ? $given_filters['show_hidden'] : null, 'show_drafts' => isset($given_filters['show_drafts']) ? $given_filters['show_drafts'] : null, 'since' => isset($given_filters['since']) ? $given_filters['since'] : null, 'until' => isset($given_filters['until']) ? $given_filters['until'] : null, 'show_past' => isset($given_filters['show_past']) ? $given_filters['show_past'] : null, 'show_future' => isset($given_filters['show_future']) ? $given_filters['show_future'] : null, 'type' => isset($given_filters['type']) ? strtolower($given_filters['type']) : null, 'folders' => isset($given_filters['folders']) ? $given_filters['folders'] : null, 'conditions' => isset($given_filters['conditions']) ? $given_filters['conditions'] : null, 'located' => isset($given_filters['located']) ? $given_filters['located'] : null, 'where' => isset($given_filters['where']) ? $given_filters['where'] : null);
     // determine filters
     // -----------------
     if (!is_null($filters['show_hidden'])) {
         $remove_hidden = !(bool) $filters['show_hidden'];
     }
     if (!is_null($filters['show_drafts'])) {
         $remove_drafts = !(bool) $filters['show_drafts'];
     }
     if ($filters['since']) {
         $since_date = Date::resolve($filters['since']);
     }
     if ($filters['show_past'] === false && (!$since_date || $since_date < time())) {
         $since_date = Config::getEntryTimestamps() ? time() : Date::resolve("today midnight");
     }
     if ($filters['until']) {
         $until_date = Date::resolve($filters['until']);
     }
     if ($filters['show_future'] === false && (!$until_date || $until_date > time())) {
         $until_date = Config::getEntryTimestamps() ? time() : Date::resolve("tomorrow midnight") - 1;
     }
     if ($filters['type'] === "entries" || $filters['type'] === "pages") {
         $keep_type = $filters['type'];
     }
     if ($filters['folders']) {
         $folders = Parse::pipeList($filters['folders']);
     }
     if ($filters['conditions']) {
         $conditions = Parse::conditions($filters['conditions']);
     }
     if ($filters['located']) {
         $located = true;
     }
     if ($filters['where']) {
         $where = $filters['where'];
     }
     // before we run filters, we need to look through conditions if they
     // were set to see if we're going to need content or content_raw
     // -----------
     if ($conditions) {
         // check for conditions involving content
         $uses_content = false;
         foreach ($conditions as $field => $instructions) {
             if (strtolower($field) === 'content') {
                 $uses_content = true;
                 break;
             }
         }
         // this uses content, which means we need to load it for all content
         if ($uses_content) {
             $this->prepare(true, false);
             $this->content_parsed = false;
         }
     }
     // run filters
     // -----------
     foreach ($this->content as $key => $data) {
         // entry or page removal
         if ($keep_type === "pages" && !$data['_is_page']) {
             unset($this->content[$key]);
             continue;
         } elseif ($keep_type === "entries" && !$data['_is_entry']) {
             unset($this->content[$key]);
             continue;
         }
         // check for non-public content
         if ($remove_drafts && $data['_is_draft']) {
             unset($this->content[$key]);
             continue;
         }
         if ($remove_hidden && $data['_is_hidden']) {
             unset($this->content[$key]);
             continue;
//.........這裏部分代碼省略.........
開發者ID:zane-insight,項目名稱:WhiteLaceInn,代碼行數:101,代碼來源:contentset.php

示例4: getContentByFolders

 /**
  * Gets cached content for pages from given folders
  *
  * @param array  $folders  Folders to grab from
  * @return ContentSet
  */
 public static function getContentByFolders($folders)
 {
     self::loadCache();
     $content = array();
     $folders = Parse::pipeList($folders);
     foreach ($folders as $folder) {
         foreach (self::$cache['content'] as $content_folder => $content_pages) {
             if (!Folder::matchesPattern($content_folder, $folder)) {
                 continue;
             }
             foreach ($content_pages as $data) {
                 $content[$data['path']] = $data['data'];
             }
         }
     }
     return new ContentSet($content);
 }
開發者ID:andorpandor,項目名稱:git-deploy.eu2.frbit.com-yr-prototype,代碼行數:23,代碼來源:contentservice.php

示例5: getData

 /**
  * Gets the target data from the cache
  *
  * @param array  $config  Configuration array
  * @return array
  */
 public function getData($config)
 {
     // load data
     if ($config['taxonomy']) {
         $taxonomy_parts = Taxonomy::getCriteria(URL::getCurrent());
         $taxonomy_type = $taxonomy_parts[0];
         $taxonomy_slug = Config::get('_taxonomy_slugify') ? Slug::humanize($taxonomy_parts[1]) : urldecode($taxonomy_parts[1]);
         $content_set = ContentService::getContentByTaxonomyValue($taxonomy_type, $taxonomy_slug, $config['folders']);
     } else {
         $content_set = ContentService::getContentByFolders($config['folders']);
     }
     // filters
     $content_set->filter($config);
     // custom filter, remove the 404 page if needed
     if (!$config['include_404']) {
         $content_set->customFilter(function ($item) {
             return $item['url'] !== '/404';
         });
     }
     // custom filter, remove any excluded folders
     if ($config['exclude']) {
         $excluded = Parse::pipeList($config['exclude']);
         $content_set->customFilter(function ($item) use($excluded) {
             foreach ($excluded as $exclude) {
                 if ($exclude === "*" || $exclude === "/*") {
                     // exclude all
                     return false;
                 } elseif (substr($exclude, -1) === "*") {
                     // wildcard check
                     if (strpos($item['_folder'], substr($exclude, 0, -1)) === 0) {
                         return false;
                     }
                 } else {
                     // plain check
                     if ($exclude == $item['_folder']) {
                         return false;
                     }
                 }
             }
             return true;
         });
     }
     $content_set->supplement(array('merge_with_data' => false));
     $content_set->prepare($config['include_content']);
     $data = $content_set->get();
     return $data;
 }
開發者ID:Synergy23,項目名稱:RealEstate,代碼行數:53,代碼來源:tasks.bloodhound.php

示例6: filter

 /**
  * Filters the current users based on the filters given
  * 
  * @param array  $filters  Filters to apply
  * @return void
  */
 public function filter($filters)
 {
     $filters = Helper::ensureArray($filters);
     // nothing to filter, abort
     if (!$this->count()) {
         return;
     }
     $roles = null;
     $conditions = null;
     $where = null;
     // standardize filters
     $given_filters = $filters;
     $filters = array('role' => isset($given_filters['role']) ? $given_filters['role'] : null, 'conditions' => isset($given_filters['conditions']) ? $given_filters['conditions'] : null, 'where' => isset($given_filters['where']) ? $given_filters['where'] : null);
     // determine filters
     if ($filters['role']) {
         $roles = Parse::pipeList($filters['role']);
     }
     if ($filters['conditions']) {
         $conditions = Parse::conditions($filters['conditions']);
     }
     if ($filters['where']) {
         $where = $filters['where'];
     }
     // run filters
     foreach ($this->members as $username => $data) {
         if ($roles) {
             $found = false;
             foreach ($roles as $role) {
                 if (in_array($role, $data['roles'])) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 unset($this->members[$username]);
                 continue;
             }
         }
         if ($where && !(bool) Parse::template("{{ if " . $where . " }}1{{ else }}0{{ endif }}", $data)) {
             unset($this->members[$username]);
             continue;
         }
         if ($conditions) {
             foreach ($conditions as $field => $instructions) {
                 try {
                     // are we looking for existence?
                     if ($instructions['kind'] === "existence") {
                         if ($instructions['type'] === "has") {
                             if (!isset($data[$field]) || !$data[$field]) {
                                 throw new Exception("Does not fit condition");
                             }
                         } elseif ($instructions['type'] === "lacks") {
                             if (isset($data[$field]) && $data[$field]) {
                                 throw new Exception("Does not fit condition");
                             }
                         } else {
                             throw new Exception("Unknown existence type");
                         }
                         // are we looking for a comparison?
                     } elseif ($instructions['kind'] === "comparison") {
                         if (!isset($data[$field])) {
                             $field = false;
                             $values = null;
                         } else {
                             $field = is_array($data[$field]) ? array_map('strtolower', $data[$field]) : strtolower($data[$field]);
                             $values = is_array($instructions['value']) ? array_map('strtolower', $instructions['value']) : strtolower($instructions['value']);
                         }
                         // convert boolean-like statements to boolean values
                         if (is_array($values)) {
                             foreach ($values as $item => $value) {
                                 if ($value == "true" || $value == "yes") {
                                     $values[$item] = true;
                                 } elseif ($value == "false" || $value == "no") {
                                     $values[$item] = false;
                                 }
                             }
                         } else {
                             if ($values == "true" || $values == "yes") {
                                 $values = true;
                             } elseif ($values == "false" || $values == "no") {
                                 $values = false;
                             }
                         }
                         // equal comparisons
                         if ($instructions['type'] == "equal") {
                             // if this isn't set, it's not equal
                             if (!$field) {
                                 throw new Exception("Does not fit condition");
                             }
                             if (!is_array($field)) {
                                 if ($field != $values) {
                                     throw new Exception("Does not fit condition");
                                 }
                             } elseif (!in_array($values, $field)) {
//.........這裏部分代碼省略.........
開發者ID:zane-insight,項目名稱:WhiteLaceInn,代碼行數:101,代碼來源:memberset.php

示例7: parseForFolders

 /**
  * Parses a mixed folder representation into a standardized array
  *
  * @deprecated
  * @param mixed  $folders  Folders
  * @return array
  */
 public static function parseForFolders($folders)
 {
     Log::warn('Helper::parseForFolders has been deprecated. Use Parse::pipeList() instead.', 'core', 'api');
     return Parse::pipeList($folders);
 }
開發者ID:jalmelb,項目名稱:24hl2015,代碼行數:12,代碼來源:helper.php


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