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


PHP Arr::subvalSort方法代码示例

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


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

示例1: run

 /**
  * Run functions hooked on a specific action hook.
  *
  *  <code>
  *      // Run functions hooked on a "footer" action hook.
  *      Action::run('footer');
  *  </code>
  *
  * @param  string  $action_name Action name
  * @param  array   $args        Arguments
  * @param  boolean $return      Return data or not. Default is false
  * @return mixed
  */
 public static function run($action_name, $args = array(), $return = false)
 {
     // Redefine arguments
     $action_name = (string) $action_name;
     $return = (bool) $return;
     // Run action
     if (count(Action::$actions) > 0) {
         // Sort actions by priority
         $actions = Arr::subvalSort(Action::$actions, 'priority');
         // Loop through $actions array
         foreach ($actions as $action) {
             // Execute specific action
             if ($action['action_name'] == $action_name) {
                 // isset arguments ?
                 if (isset($args)) {
                     // Return or Render specific action results ?
                     if ($return) {
                         return call_user_func_array($action['function'], $args);
                     } else {
                         call_user_func_array($action['function'], $args);
                     }
                 } else {
                     if ($return) {
                         return call_user_func_array($action['function'], $action['args']);
                     } else {
                         call_user_func_array($action['function'], $action['args']);
                     }
                 }
             }
         }
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:45,代码来源:Action.php

示例2: load

 /**
  *  Combine and load site javascript
  */
 public static function load()
 {
     $backend_site_js_path = MINIFY . DS . 'backend_site.minify.js';
     $frontend_site_js_path = MINIFY . DS . 'frontend_site.minify.js';
     // Load javascripts
     if (count(Javascript::$javascripts) > 0) {
         $backend_buffer = '';
         $backend_regenerate = false;
         $frontend_buffer = '';
         $frontend_regenerate = false;
         // Sort javascripts by priority
         $javascripts = Arr::subvalSort(Javascript::$javascripts, 'priority');
         if (BACKEND) {
             // Build backend site javascript
             foreach ($javascripts as $javascript) {
                 if (file_exists(ROOT . DS . $javascript['file']) and ($javascript['load'] == 'backend' or $javascript['load'] == 'both')) {
                     if (!file_exists($backend_site_js_path) or filemtime(ROOT . DS . $javascript['file']) > filemtime($backend_site_js_path)) {
                         $backend_regenerate = true;
                         break;
                     }
                 }
             }
             // Regenerate site javascript
             if ($backend_regenerate) {
                 foreach ($javascripts as $javascript) {
                     if (file_exists(ROOT . DS . $javascript['file']) and ($javascript['load'] == 'backend' or $javascript['load'] == 'both')) {
                         $backend_buffer .= file_get_contents(ROOT . DS . $javascript['file']) . "\n";
                     }
                 }
                 file_put_contents($backend_site_js_path, $backend_buffer);
                 $backend_regenerate = false;
             }
         } else {
             // Build frontend site javascript
             foreach ($javascripts as $javascript) {
                 if (file_exists(ROOT . DS . $javascript['file']) and ($javascript['load'] == 'frontend' or $javascript['load'] == 'both')) {
                     if (!file_exists($frontend_site_js_path) or filemtime(ROOT . DS . $javascript['file']) > filemtime($frontend_site_js_path)) {
                         $frontend_regenerate = true;
                         break;
                     }
                 }
             }
             // Regenerate site javascript
             if ($frontend_regenerate) {
                 foreach ($javascripts as $javascript) {
                     if (file_exists(ROOT . DS . $javascript['file']) and ($javascript['load'] == 'frontend' or $javascript['load'] == 'both')) {
                         $frontend_buffer .= file_get_contents(ROOT . DS . $javascript['file']) . "\n";
                     }
                 }
                 file_put_contents($frontend_site_js_path, $frontend_buffer);
                 $frontend_regenerate = false;
             }
         }
         // Render
         if (BACKEND) {
             echo '<script type="text/javascript" src="' . Option::get('siteurl') . '/tmp/minify/backend_site.minify.js?' . Option::get('javascript_version') . '"></script>';
         } else {
             echo '<script type="text/javascript" src="' . Option::get('siteurl') . '/tmp/minify/frontend_site.minify.js?' . Option::get('javascript_version') . '"></script>' . "\n";
         }
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:64,代码来源:Javascript.php

示例3: getPages

 /**
  * Get pages
  */
 public static function getPages()
 {
     // Init vars
     $pages_array = array();
     $count = 0;
     // Get pages table
     $pages = new Table('pages');
     // Get Pages List
     $pages_list = $pages->select('[slug!="error404" and status="published"]');
     foreach ($pages_list as $page) {
         $pages_array[$count]['title'] = Html::toText($page['title']);
         $pages_array[$count]['meta_title'] = !empty($page['meta_title']) ? Html::toText($page['meta_title']) : $page['title'];
         $pages_array[$count]['parent'] = $page['parent'];
         $pages_array[$count]['date'] = $page['date'];
         $pages_array[$count]['author'] = $page['author'];
         $pages_array[$count]['slug'] = $page['slug'] == Option::get('defaultpage') ? '' : $page['slug'];
         if (isset($page['parent'])) {
             $c_p = $page['parent'];
         } else {
             $c_p = '';
         }
         if ($c_p != '') {
             $_page = $pages->select('[slug="' . $page['parent'] . '"]', null);
             if (isset($_page['title'])) {
                 $_title = $_page['title'];
             } else {
                 $_title = '';
             }
             $pages_array[$count]['sort'] = $_title . ' ' . $page['title'];
         } else {
             $pages_array[$count]['sort'] = $page['title'];
         }
         $_title = '';
         $count++;
     }
     // Sort pages
     $_pages_list = Arr::subvalSort($pages_array, 'sort');
     // return
     return $_pages_list;
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:43,代码来源:pages.plugin.php

示例4: getPages

 /**
  * Get pages
  *
  *  <code>
  *      $pages = Pages::getPages('blog');
  *  </code>
  *
  * @access  public
  * @param  string  $url        Url
  * @param  string  $order_by   Order by
  * @param  string  $order_type Order type
  * @param  array   $ignore     Pages to ignore
  * @param  int     $limit      Limit of pages
  * @return array
  */
 public static function getPages($url = '', $order_by = 'date', $order_type = 'DESC', $ignore = array('404'), $limit = null)
 {
     $pages = File::scan(STORAGE_PATH . '/pages/' . $url, 'md');
     if ($pages) {
         foreach ($pages as $page) {
             $pages_cache_id .= filemtime($page);
         }
         // Create Unique Cache ID for Pages
         $pages_cache_id = md5('pages' . ROOT_DIR . $url . $order_by . $order_type . implode(",", $ignore) . ($limit === null ? 'null' : $limit) . $pages_cache_id);
     }
     if (Cache::driver()->contains($pages_cache_id)) {
         return Cache::driver()->fetch($pages_cache_id);
     } else {
         foreach ($pages as $key => $page) {
             if (!in_array(basename($page, '.md'), $ignore)) {
                 $content = file_get_contents($page);
                 $_page = explode('---', $content, 3);
                 $_pages[$key] = Yaml::parse($_page[1]);
                 $url = str_replace(STORAGE_PATH . '/pages', Url::getBase(), $page);
                 $url = str_replace('index.md', '', $url);
                 $url = str_replace('.md', '', $url);
                 $url = str_replace('\\', '/', $url);
                 $url = rtrim($url, '/');
                 $_pages[$key]['url'] = $url;
                 $_content = $_page[2];
                 // Parse page for summary <!--more-->
                 if (($pos = strpos($_content, "<!--more-->")) === false) {
                     $_content = Filter::apply('content', $_content);
                 } else {
                     $_content = explode("<!--more-->", $_content);
                     $_content['summary'] = Filter::apply('content', $_content[0]);
                     $_content['content'] = Filter::apply('content', $_content[0] . $_content[1]);
                 }
                 if (is_array($_content)) {
                     $_pages[$key]['summary'] = $_content['summary'];
                     $_pages[$key]['content'] = $_content['content'];
                 } else {
                     $_pages[$key]['summary'] = $_content;
                     $_pages[$key]['content'] = $_content;
                 }
                 $_pages[$key]['slug'] = basename($page, '.md');
             }
         }
         $_pages = Arr::subvalSort($_pages, $order_by, $order_type);
         if ($limit != null) {
             $_pages = array_slice($_pages, null, $limit);
         }
         Cache::driver()->save($pages_cache_id, $_pages);
         return $_pages;
     }
 }
开发者ID:cv0,项目名称:fansoro,代码行数:66,代码来源:Pages.php

示例5: drawItems

 /**
  * 
  */
 public static function drawItems()
 {
     // Sort items by priority
     $items = Arr::subvalSort(Dashboard::$items, 'priority');
     foreach ($items as $item) {
         echo '<li>';
         echo Html::anchor($item['title'], $item['url'], array('title' => $item['title']));
         echo '</li>';
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:13,代码来源:dashboard.admin.php

示例6: load

 /**
  *  Minify, combine and load site stylesheet
  */
 public static function load()
 {
     $backend_site_css_path = MINIFY . DS . 'backend_site.minify.css';
     $frontend_site_css_path = MINIFY . DS . 'frontend_site.minify.css';
     // Load stylesheets
     if (count(Stylesheet::$stylesheets) > 0) {
         $backend_buffer = '';
         $backend_regenerate = false;
         $frontend_buffer = '';
         $frontend_regenerate = false;
         // Sort stylesheets by priority
         $stylesheets = Arr::subvalSort(Stylesheet::$stylesheets, 'priority');
         if (BACKEND) {
             // Build backend site stylesheets
             foreach ($stylesheets as $stylesheet) {
                 if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'backend' or $stylesheet['load'] == 'both')) {
                     if (!file_exists($backend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($backend_site_css_path)) {
                         $backend_regenerate = true;
                         break;
                     }
                 }
             }
             // Regenerate site stylesheet
             if ($backend_regenerate) {
                 foreach ($stylesheets as $stylesheet) {
                     if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'backend' or $stylesheet['load'] == 'both')) {
                         $backend_buffer .= file_get_contents(ROOT . DS . $stylesheet['file']);
                     }
                 }
                 $backend_buffer = Stylesheet::parseVariables($backend_buffer);
                 file_put_contents($backend_site_css_path, MinifyCSS::process($backend_buffer));
                 $backend_regenerate = false;
             }
         } else {
             // Build frontend site stylesheets
             foreach ($stylesheets as $stylesheet) {
                 if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'frontend' or $stylesheet['load'] == 'both')) {
                     if (!file_exists($frontend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($frontend_site_css_path)) {
                         $frontend_regenerate = true;
                         break;
                     }
                 }
             }
             // Regenerate site stylesheet
             if ($frontend_regenerate) {
                 foreach ($stylesheets as $stylesheet) {
                     if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'frontend' or $stylesheet['load'] == 'both')) {
                         $frontend_buffer .= file_get_contents(ROOT . DS . $stylesheet['file']);
                     }
                 }
                 $frontend_buffer = Stylesheet::parseVariables($frontend_buffer);
                 file_put_contents($frontend_site_css_path, MinifyCSS::process($frontend_buffer));
                 $frontend_regenerate = false;
             }
         }
         // Render
         if (BACKEND) {
             echo '<link rel="stylesheet" href="' . Option::get('siteurl') . '/tmp/minify/backend_site.minify.css?' . Option::get('styles_version') . '" type="text/css" />';
         } else {
             echo '<link rel="stylesheet" href="' . Option::get('siteurl') . '/tmp/minify/frontend_site.minify.css?' . Option::get('styles_version') . '" type="text/css" />' . "\n";
         }
     }
 }
开发者ID:cmroanirgo,项目名称:monstra,代码行数:66,代码来源:Stylesheet.php

示例7: getDropdown

 /**
  * Draw dropdown items
  *
  *  <code>
  *      Navigation::getDropdown('content');
  *  <code>
  *
  * @param string $category Category
  */
 public static function getDropdown($category)
 {
     // Sort items by priority
     $items = Arr::subvalSort(Navigation::$items, 'priority');
     // Loop trough the items
     foreach ($items as $item) {
         // If current plugin id == selected item id then set class to current
         if (Request::get('id') == $item['id'] && $item['external'] == false) {
             $class = 'selected = "selected" ';
         } else {
             $class = '';
         }
         // If current category == item category and navigation type is left them draw this item
         if ($item['category'] == $category && $item['type'] == Navigation::LEFT) {
             // Is external item id or not ?
             if ($item['external'] == false) {
                 echo '<option ' . $class . 'rel="index.php?id=' . $item['id'] . '">' . $item['name'] . '</option>';
             }
         }
     }
 }
开发者ID:cmroanirgo,项目名称:monstra,代码行数:30,代码来源:Navigation.php

示例8: getRelatedPosts

 /**
  * Get related posts
  *
  *  <code> 
  *      echo Blog::getRelatedPosts();
  *  </code>
  *
  * @return string
  */
 public static function getRelatedPosts($limit = null)
 {
     $related_posts = array();
     $tags = Blog::getTagsArray(Page::slug());
     foreach ($tags as $tag) {
         $query = '[parent="' . Blog::$parent_page_name . '" and status="published" and contains(tags, "' . $tag . '") and slug!="' . Page::slug() . '"]';
         if ($result = Arr::subvalSort(Pages::$pages->select($query, $limit == null ? 'all' : (int) $limit), 'date', 'DESC')) {
             $related_posts = $result;
         }
     }
     // Display view
     return View::factory('blog/views/frontend/related_posts')->assign('related_posts', $related_posts)->render();
 }
开发者ID:cmroanirgo,项目名称:monstra,代码行数:22,代码来源:blog.plugin.php

示例9: main


//.........这里部分代码省略.........
                         }
                         // Run delete extra actions
                         Action::run('admin_pages_action_delete');
                         // Redirect
                         Request::redirect('index.php?id=pages');
                     } else {
                         die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                     }
                 }
                 break;
                 // Update page access
                 // -------------------------------------
             // Update page access
             // -------------------------------------
             case "update_access":
                 if (Request::get('slug') !== 'error404') {
                     if (Security::check(Request::get('token'))) {
                         $pages->updateWhere('[slug="' . Request::get('slug') . '"]', array('access' => Request::get('access')));
                         // Run delete extra actions
                         Action::run('admin_pages_action_update_access');
                         // Send notification
                         Notification::set('success', __('Your changes to the page <i>:page</i> have been saved.', 'pages', array(':page' => Request::get('slug'))));
                         // Redirect
                         Request::redirect('index.php?id=pages');
                     } else {
                         die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                     }
                 }
                 break;
                 // Update page status
                 // -------------------------------------
             // Update page status
             // -------------------------------------
             case "update_status":
                 if (Request::get('name') !== 'error404') {
                     if (Security::check(Request::get('token'))) {
                         $pages->updateWhere('[slug="' . Request::get('slug') . '"]', array('status' => Request::get('status')));
                         // Run delete extra actions
                         Action::run('admin_pages_action_update_status');
                         // Send notification
                         Notification::set('success', __('Your changes to the page <i>:page</i> have been saved.', 'pages', array(':page' => Request::get('slug'))));
                         // Redirect
                         Request::redirect('index.php?id=pages');
                     } else {
                         die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                     }
                 }
                 break;
         }
         // Its mean that you can add your own actions for this plugin
         Action::run('admin_pages_extra_actions');
     } else {
         // Index action
         // -------------------------------------
         // Init vars
         $pages_array = array();
         $count = 0;
         // Get pages
         $pages_list = $pages->select(null, 'all', null, array('slug', 'title', 'status', 'date', 'author', 'expand', 'access', 'parent', 'template', 'tags'));
         // Loop
         foreach ($pages_list as $page) {
             $pages_array[$count]['title'] = $page['title'];
             $pages_array[$count]['meta_title'] = isset($page['meta_title']) ? $page['meta_title'] : '';
             $pages_array[$count]['parent'] = $page['parent'];
             $pages_array[$count]['_status'] = $page['status'];
             $pages_array[$count]['_access'] = $page['access'];
             $pages_array[$count]['status'] = $status_array[$page['status']];
             $pages_array[$count]['access'] = isset($access_array[$page['access']]) ? $access_array[$page['access']] : $access_array['public'];
             // hack for old Monstra Versions
             $pages_array[$count]['date'] = $page['date'];
             $pages_array[$count]['author'] = $page['author'];
             $pages_array[$count]['expand'] = $page['expand'];
             $pages_array[$count]['slug'] = $page['slug'];
             $pages_array[$count]['tags'] = $page['tags'];
             $pages_array[$count]['template'] = $page['template'];
             if (isset($page['parent'])) {
                 $c_p = $page['parent'];
             } else {
                 $c_p = '';
             }
             if ($c_p != '') {
                 $_page = $pages->select('[slug="' . $page['parent'] . '"]', null);
                 if (isset($_page['title'])) {
                     $_title = $_page['title'];
                 } else {
                     $_title = '';
                 }
                 $pages_array[$count]['sort'] = $_title . ' ' . $page['title'];
             } else {
                 $pages_array[$count]['sort'] = $page['title'];
             }
             $_title = '';
             $count++;
         }
         // Sort pages
         $pages = Arr::subvalSort($pages_array, 'sort');
         // Display view
         View::factory('box/pages/views/backend/index')->assign('pages', $pages)->assign('site_url', $site_url)->display();
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:101,代码来源:pages.admin.php


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