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


PHP Guardian::forget方法代碼示例

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


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

示例1: success

 public static function success($text = "", $icon = null, $tag = 'p')
 {
     self::add('success', $text, $icon, $tag);
     Guardian::forget();
 }
開發者ID:razordaze,項目名稱:mecha-cms,代碼行數:5,代碼來源:notify.php

示例2: function

<?php

// Forget all memor(y|ies) on page visit ...
// Clear all notif(y|ies) on page visit ...
Weapon::add('shield_after', function () {
    Guardian::forget();
    Notify::clear();
});
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:8,代碼來源:weapon.php

示例3: attach

 /**
  * ==========================================================
  *  RENDER A PAGE
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    Shield::attach('article', true, false);
  *
  * ----------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type    | Description
  *  --------- | ------- | -----------------------------------
  *  $name     | string  | Name of the shield
  *  $minify   | boolean | Minify HTML output?
  *  $cache    | boolean | Create a cache file on page visit?
  *  $expire   | integer | Define cache file expiration time
  *  --------- | ------- | -----------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function attach($name, $minify = null, $cache = false, $expire = null)
 {
     $config = Config::get();
     if (is_null($minify)) {
         $minify = $config->html_minifier;
     }
     $G = array('data' => array('name' => $name, 'minify' => $minify, 'cache' => $cache, 'expire' => $expire));
     $shield = false;
     $shield_base = explode('-', $name, 2);
     if ($_file = File::exist(self::path($name))) {
         $shield = $_file;
     } else {
         if ($_file = File::exist(self::path($shield_base[0]))) {
             $shield = $_file;
         } else {
             Guardian::abort(Config::speak('notify_file_not_exist', '<code>' . self::path($name) . '</code>'));
         }
     }
     $G['data']['path'] = $shield;
     $q = !empty($config->url_query) ? '.' . md5($config->url_query) : "";
     $cache_path = is_string($cache) ? $cache : CACHE . DS . str_replace(array('/', ':'), '.', $config->url_path) . $q . '.cache';
     if ($G['data']['cache'] && file_exists($cache_path)) {
         if (is_null($expire) || is_int($expire) && time() - $expire < filemtime($cache_path)) {
             // Begin shield cache
             Weapon::fire('shield_cache_before', array($G, $G));
             echo Filter::apply('shield:cache', File::open($cache_path)->read());
             // Clear session
             Notify::clear();
             Guardian::forget();
             self::$lot = array();
             // End shield cache
             Weapon::fire('shield_cache_after', array($G, $G));
             exit;
         }
     }
     // Begin shield
     Weapon::fire('shield_before', array($G, $G));
     ob_start($minify ? 'self::s_o' : 'self::s_o_d');
     extract(Filter::apply('shield:lot', self::cargo()));
     require Filter::apply('shield:path', $shield);
     // Clear session
     Notify::clear();
     Guardian::forget();
     self::$lot = array();
     // Get shield content
     $content = ob_get_contents();
     ob_end_flush();
     // Create shield cache
     $G['data']['content'] = $minify ? self::s_o($content) : self::s_o_d($content);
     if ($G['data']['cache']) {
         $G['data']['cache'] = $cache_path;
         File::write($G['data']['content'])->saveTo($cache_path);
         Weapon::fire('on_cache_construct', array($G, $G));
     }
     // End shield
     Weapon::fire('shield_after', array($G, $G));
     exit;
 }
開發者ID:razordaze,項目名稱:mecha-cms,代碼行數:80,代碼來源:shield.php


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