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


PHP Guardian::abort方法代码示例

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


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

示例1: __callStatic

 public static function __callStatic($kin, $arguments = array())
 {
     $kin = get_called_class() . '::' . $kin;
     if (!isset(self::$o[$kin])) {
         Guardian::abort('Method <code>' . $kin . '()</code> does not exist.');
     }
     return call_user_func_array(self::$o[$kin], $arguments);
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:8,代码来源:base.php

示例2: take

 public static function take($files)
 {
     if (!extension_loaded('gd')) {
         Guardian::abort('<a href="http://www.php.net/manual/en/book.image.php" title="PHP &ndash; Image Processing and GD" rel="nofollow" target="_blank">PHP GD</a> extension is not installed on your web server.');
     }
     if (is_array($files)) {
         self::$open = array();
         foreach ($files as $file) {
             self::$open[] = File::path($file);
         }
     } else {
         self::$open = File::path($files);
     }
     $file = is_array(self::$open) ? self::$open[0] : self::$open;
     self::$placeholder = File::D($file) . DS . '__' . File::B($file);
     self::$original = $file;
     File::open($file)->copyTo(self::$placeholder);
     self::gen($file);
     return new static();
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:20,代码来源:image.php

示例3: attach

 /**
  * ==========================================================
  *  RENDER A PAGE
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    Shield::attach('article');
  *
  * ----------------------------------------------------------
  *
  */
 public static function attach($name, $fallback = false, $buffer = true)
 {
     $path__ = File::path($name);
     $s = explode('-', File::N($name), 2);
     $G = array('data' => array('name' => $name, 'name_base' => $s[0]));
     if (strpos($path__, ROOT) === 0 && file_exists($path__) && is_file($path__)) {
         // do nothing ...
     } else {
         if ($_path = File::exist(self::path($path__, $fallback))) {
             $path__ = $_path;
         } else {
             if ($_path = File::exist(self::path($s[0], $fallback))) {
                 $path__ = $_path;
             } else {
                 Guardian::abort(Config::speak('notify_file_not_exist', '<code>' . $path__ . '</code>'));
             }
         }
     }
     $lot__ = self::cargo();
     $path__ = Filter::apply('shield:path', $path__);
     $G['data']['lot'] = $lot__;
     $G['data']['path'] = $path__;
     $G['data']['path_base'] = $s[0];
     $out = "";
     // Begin shield
     Weapon::fire('shield_lot_before', array($G, $G));
     extract(Filter::apply('shield:lot', $lot__));
     Weapon::fire('shield_lot_after', array($G, $G));
     Weapon::fire('shield_before', array($G, $G));
     if ($buffer) {
         ob_start(function ($content) use($path__, &$out) {
             $content = Filter::apply('shield:input', $content, $path__);
             $out = Filter::apply('shield:output', $content, $path__);
             return $out;
         });
         require $path__;
         ob_end_flush();
     } else {
         require $path__;
     }
     $G['data']['content'] = $out;
     // Reset shield lot
     self::$lot = array();
     // End shield
     Weapon::fire('shield_after', array($G, $G));
     exit;
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:59,代码来源:shield.php

示例4: take

 public static function take($files)
 {
     if (!extension_loaded('zip')) {
         Guardian::abort('<a href="http://www.php.net/manual/en/book.zip.php" title="PHP &ndash; Zip" rel="nofollow" target="_blank">PHP Zip</a> extension is not installed on your web server.');
     }
     self::$open = self::$opens = null;
     self::$zip = new ZipArchive();
     if (is_array($files)) {
         self::$opens = array();
         $taken = false;
         foreach ($files as $key => $value) {
             $key = File::path($key);
             $value = File::path($value);
             self::$opens[$key] = $value;
             if (!$taken) {
                 self::$open = $key;
                 $taken = true;
             }
         }
     } else {
         self::$open = File::path($files);
     }
     return new static();
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:24,代码来源:package.php

示例5: post

 /**
  * ============================================================
  *  CREATE POST REQUEST WITHOUT HTML FORM
  * ============================================================
  *
  * -- CODE: ---------------------------------------------------
  *
  *    HTTP::post('/path', array('test' => 'OK!'));
  *
  * ------------------------------------------------------------
  *
  */
 public static function post($url, $fields = array())
 {
     if (!function_exists('curl_init')) {
         Guardian::abort('<a href="http://php.net/curl" title="PHP &ndash; cURL" rel="nofollow" target="_blank">PHP cURL</a> extension is not installed on your web server.');
     }
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_HEADER, false);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
     $output = curl_exec($curl);
     curl_close($curl);
     return $output;
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:27,代码来源:http.php

示例6: __callStatic

 /**
  * Custom Widget
  * -------------
  *
  * [1]. Widget::my_custom_widget($a, $b, $c);
  *
  */
 public static function __callStatic($kin, $arguments = array())
 {
     $c = get_called_class();
     if (!isset(self::$w[$c][$kin])) {
         Guardian::abort(Config::speak('notify_not_exist', '<code>' . $c . '::' . $kin . '()</code>'), false);
     } else {
         // built-in
         if (!is_array(self::$w[$c][$kin])) {
             return call_user_func_array(self::$w[$c][$kin], $arguments);
         }
         // custom
         $snake = Text::parse($kin, '->snake_case');
         $slug = Text::parse($snake, '->slug');
         $id = Config::get('widget_custom_' . $snake . '_id', 0) + 1;
         $html = "";
         if (self::$w[$c][$kin]['wrapper']) {
             $html .= O_BEGIN . '<div class="widget widget-custom widget-custom-' . $slug . '" id="widget-custom-' . $slug . '-' . $id . '">' . NL;
         }
         $html .= call_user_func_array(self::$w[$c][$kin]['fn'], $arguments);
         if (self::$w[$c][$kin]['wrapper']) {
             $html .= NL . '</div>' . O_END;
         }
         Config::set('widget_custom_' . $snake . '_id', $id);
         return Filter::apply(array('widget:custom.' . $snake, 'widget:custom.' . $kin, 'widget:custom', 'widget'), $html, $id);
     }
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:33,代码来源:widget.php

示例7: array_shift

    if ($path === 'feed/json' || strpos($path, 'feed/json/') === 0 || $path === 'feeds/json' || strpos($path, 'feeds/json/') === 0) {
        $page = 'json';
    }
    // Create a proper query string data
    if ($path !== "") {
        array_shift($_GET);
    }
    $queries = array();
    foreach ($_GET as $k => $v) {
        $queries[] = $k . '=' . urlencode($v);
    }
    // Loading the language file(s)
    $lang = LANGUAGE . DS . 'en_US' . DS . 'speak.txt';
    $lang_a = LANGUAGE . DS . $config['language'] . DS . 'speak.txt';
    if (!file_exists($lang) && !file_exists($lang_a)) {
        Guardian::abort('Language file not found.');
    }
    $lang = file_exists($lang) ? Text::toArray(File::open($lang)->read(), S, '  ') : array();
    if ($config['language'] !== 'en_US') {
        $lang_a = file_exists($lang_a) ? Text::toArray(File::open($lang_a)->read(), S, '  ') : array();
        Mecha::extend($lang, $lang_a);
    }
    $config['url_query'] = !empty($queries) ? '?' . implode('&', $queries) : "";
    $config['offset'] = isset($s[1]) && is_numeric($s[1]) ? (int) $s[1] : 1;
    $config['page_type'] = $page;
    $config['speak'] = $lang;
    Config::set($config);
});
/**
 * =============================================================
 *  GET LANGUAGE FILE TO SPEAK
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:config.php

示例8: 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

示例9: __callStatic

 /**
  * Alternate Method for Calling the Custom Widget
  * ----------------------------------------------
  *
  * [1]. Widget::my_custom_widget($a, $b, $c);
  *
  */
 public static function __callStatic($kin, $arguments = array())
 {
     $_kin = get_called_class() . '::' . $kin;
     if (!isset(self::$o[$_kin])) {
         Guardian::abort('<code>Widget::' . $kin . '()</code> does not exist.');
     }
     $html = call_user_func_array(self::$o[$_kin], $arguments);
     $html = Filter::apply('widget', $html);
     return Filter::apply('widget:custom.' . Text::parse($kin, '->snake_case'), Filter::apply('widget:custom.' . $kin, Filter::apply('widget:custom', $html)));
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:17,代码来源:widget.php


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