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


PHP ACL::cache方法代码示例

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


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

示例1: test_cache_stores_route_objects

 /**
  * If Route::cache() was able to restore routes from the cache then
  * it should return TRUE and load the cached routes
  *
  * @test
  * @covers Route::cache
  */
 public function test_cache_stores_route_objects()
 {
     $acls = ACL::all();
     // First we create the cache
     ACL::cache(TRUE);
     // Now lets modify the "current" routes
     ACL::set('contact', array('sending mail' => array('title' => __('Sending Mails'), 'restrict access' => FALSE, 'description' => __('Ability to send messages for administrators from your site'))));
     // Then try and load said cache
     $this->assertTrue(ACL::cache());
     // Check the route cache flag
     $this->assertTrue(ACL::$cache);
     // And if all went ok the nonsensical route should be gone...
     $this->assertEquals($acls, ACL::all());
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:21,代码来源:AclTest.php

示例2: cache

 /**
  * Setter/Getter for ACL cache
  *
  * If your perms will remain the same for a long period of time, use this
  * to reload the ACL from the cache rather than redefining them on every page load.
  *
  * Example:
  * ~~~
  *  if ( ! ACL::cache())
  *  {
  *    // Set perms here
  *    ACL::cache(TRUE);
  *  }
  * ~~~
  *
  * @param   boolean  $save    Cache the current perms [Optional]
  * @param   boolean  $append  Append, rather than replace, cached perms when loading [Optional]
  *
  * @return  boolean
  *
  * @uses    Cache::set
  * @uses    Cache::get
  * @uses    Arr::merge
  */
 public static function cache($save = FALSE, $append = FALSE)
 {
     $cache = Cache::instance();
     if ($save) {
         // set the cache for performance in production
         if (Kohana::$environment === Kohana::PRODUCTION) {
             // Cache all defined perms
             return $cache->set('ACL::cache()', self::$_all_perms);
         }
         return false;
     } else {
         if ($perms = $cache->get('ACL::cache()')) {
             if ($append) {
                 // Append cached perms
                 self::$_all_perms = Arr::merge(self::$_all_perms, $perms);
             } else {
                 // Replace existing perms
                 self::$_all_perms = $perms;
             }
             // perms were cached
             return self::$cache = TRUE;
         } else {
             // perms were not cached
             return self::$cache = FALSE;
         }
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:51,代码来源:acl.php

示例3: array

 *
 * Definition of user privileges by default if the ACL is present in the system.
 * Note: Parameter `restrict access` indicates that these privileges have serious
 * implications for safety.
 *
 * @uses  ACL::cache
 * @uses  ACL::set
 */
if (!ACL::cache()) {
    ACL::set('comment', array('administer comment' => array('title' => __('Administer Comments'), 'restrict access' => TRUE, 'description' => __('Administer comments and comments settings')), 'access comment' => array('title' => __('Access comments'), 'restrict access' => FALSE, 'description' => __('Access to any published comments')), 'post comment' => array('title' => __('Post comments'), 'restrict access' => FALSE, 'description' => __('Ability to publish comments')), 'skip comment approval' => array('title' => __('Skip comment approval'), 'restrict access' => FALSE, 'description' => __('Ability to publish comments without approval by the moderator')), 'edit own comment' => array('title' => __('Edit own comments'), 'restrict access' => FALSE, 'description' => __('Ability to editing own comments'))));
    ACL::set('content', array('administer content' => array('title' => __('Administer content'), 'restrict access' => TRUE, 'description' => __('Most of the tasks associated with the administration of the contents of this website associated with this permission')), 'access content' => array('title' => __('Access content'), 'restrict access' => FALSE, 'description' => __('')), 'view own unpublished content' => array('title' => __('View own unpublished content'), 'restrict access' => FALSE, 'description' => __('')), 'administer page' => array('title' => __('Administer pages'), 'restrict access' => TRUE, 'description' => __('')), 'create page' => array('title' => __('Create pages'), 'restrict access' => FALSE, 'description' => __('The ability to create pages')), 'edit own page' => array('title' => __('Edit own pages'), 'restrict access' => FALSE, 'description' => __('')), 'edit any page' => array('title' => __('Edit any pages'), 'restrict access' => FALSE, 'description' => __('')), 'delete own page' => array('title' => __('Delete own pages'), 'restrict access' => FALSE, 'description' => __('')), 'delete any page' => array('title' => __('Delete any pages'), 'restrict access' => FALSE, 'description' => __(''))));
    ACL::set('site', array('administer menu' => array('title' => __('Administer Menus'), 'restrict access' => TRUE, 'description' => __('')), 'administer paths' => array('title' => __('Administer Paths'), 'restrict access' => FALSE, 'description' => __('')), 'administer site' => array('title' => __('Administer Site'), 'restrict access' => TRUE, 'description' => __('')), 'administer tags' => array('title' => __('Administer Tags'), 'restrict access' => FALSE, 'description' => __('')), 'administer terms' => array('title' => __('Administer Terms'), 'restrict access' => FALSE, 'description' => __('')), 'administer formats' => array('title' => __('Administer Formats'), 'restrict access' => TRUE, 'description' => __('Managing the text formats of editor'))));
    ACL::set('contact', array('sending mail' => array('title' => __('Sending Mails'), 'restrict access' => FALSE, 'description' => __('Ability to send messages for administrators from your site'))));
    ACL::set('blog', array('administer blog' => array('title' => __('Administer Blog'), 'restrict access' => TRUE, 'description' => __('Administer Blog and Blog settings')), 'create blog' => array('title' => __('Create Blog post'), 'restrict access' => FALSE, 'description' => ''), 'edit own blog' => array('title' => __('Edit own Blog post'), 'restrict access' => FALSE, 'description' => ''), 'edit any blog' => array('title' => __('Edit any Blog posts'), 'restrict access' => FALSE, 'description' => ''), 'delete own blog' => array('title' => __('Delete own Blog post'), 'restrict access' => FALSE, 'description' => ''), 'delete any blog' => array('title' => __('Delete any Blog posts'), 'restrict access' => FALSE, 'description' => '')));
    /** Cache the module specific permissions in production */
    ACL::cache(Kohana::$environment === Kohana::PRODUCTION);
}
/**
 * Load the filter cache
 *
 * @uses  Filter::cache
 * @uses  Filter::set
 * @uses  Text::html
 * @uses  Text::htmlcorrector
 * @uses  Text::autop
 * @uses  Text::plain
 * @uses  Text::autolink
 * @uses  Text::initialcaps
 * @uses  Text::markdown
 */
if (!Filter::cache()) {
开发者ID:MenZil-Team,项目名称:cms,代码行数:31,代码来源:init.php


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