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


PHP Mecha类代码示例

本文整理汇总了PHP中Mecha的典型用法代码示例。如果您正苦于以下问题:PHP Mecha类的具体用法?PHP Mecha怎么用?PHP Mecha使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __callStatic

 public static function __callStatic($id, $arguments = array())
 {
     $c = get_called_class();
     $d = Tree::$config;
     $dd = self::$config['classes'];
     if (!isset(self::$menus[$c][$id])) {
         return false;
     }
     $AD = array('ul', "", $id . ':');
     $arguments = Mecha::extend($AD, $arguments);
     $type = $arguments[0];
     $arguments[0] = self::$menus[$c][$id];
     if (!is_array($arguments[0])) {
         return "";
     }
     Tree::$config['trunk'] = $type;
     Tree::$config['branch'] = $type;
     Tree::$config['twig'] = 'li';
     Tree::$config['classes']['trunk'] = $dd['parent'];
     Tree::$config['classes']['branch'] = $dd['child'];
     Tree::$config['classes']['twig'] = false;
     Tree::$config['classes']['current'] = $dd['current'];
     Tree::$config['classes']['chink'] = $dd['separator'];
     $output = call_user_func_array('Tree::grow', $arguments);
     Tree::$config = $d;
     // reset to the previous state
     return $output;
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:28,代码来源:menu.php

示例2: placeholder

 public static function placeholder($url = null)
 {
     if (is_array($url)) {
         return Mecha::eat($url)->shake()->get(0);
     }
     return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:7,代码来源:image.php

示例3: do_private_post

function do_private_post($content, $results)
{
    global $config, $speak;
    $results = Mecha::O($results);
    $results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false;
    if ($results === false) {
        return $speak->plugin_private_post->description;
    }
    $s = isset($results->fields->pass) ? $results->fields->pass : "";
    if (strpos($s, ':') !== false) {
        $s = explode(':', $s, 2);
        if (isset($s[1])) {
            $speak->plugin_private_post->hint = ltrim($s[1]);
        }
        // override password hint
        $s = $s[0];
    }
    $hash = md5($s . PRIVATE_POST_SALT);
    $html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL;
    $html .= TAB . Form::hidden('token', Guardian::token()) . NL;
    $html .= TAB . Form::hidden('_', $hash) . NL;
    $html .= TAB . Form::hidden('kick', $config->url_current) . NL;
    $html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL;
    $html .= TAB . '<p>' . Form::text('access', "", $speak->password . '&hellip;', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL;
    $html .= '</form>' . O_END;
    if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") {
        if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) {
            return $html;
        }
    }
    return $content;
}
开发者ID:tovic,项目名称:private-post-plugin-for-mecha-cms,代码行数:32,代码来源:launch.php

示例4: get

 public static function get($param = null, $fallback = false, $str_eval = true)
 {
     if (is_null($param)) {
         return $_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET) && !empty($_GET) ? $str_eval ? Converter::strEval($_GET, false) : $_GET : $fallback;
     }
     $output = Mecha::GVR($_GET, $param, $fallback);
     return $output === '0' || !empty($output) ? $str_eval ? Converter::strEval($output, false) : $output : $fallback;
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:8,代码来源:request.php

示例5: inspect

 public static function inspect($path, $output = null, $fallback = false)
 {
     $path = self::path($path);
     $n = self::N($path);
     $e = self::E($path);
     $update = self::T($path);
     $update_date = !is_null($update) ? date('Y-m-d H:i:s', $update) : null;
     $results = array('path' => $path, 'name' => $n, 'url' => self::url($path), 'extension' => is_file($path) ? $e : null, 'update_raw' => $update, 'update' => $update_date, 'size_raw' => file_exists($path) ? filesize($path) : null, 'size' => file_exists($path) ? self::size($path) : null, 'is' => array('hidden' => strpos($n, '__') === 0 || strpos($n, '.') === 0, 'file' => is_file($path), 'folder' => is_dir($path)));
     return !is_null($output) ? Mecha::GVR($results, $output, $fallback) : $results;
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:10,代码来源:file.php

示例6: info

 public static function info($folder = null, $array = false)
 {
     $config = Config::get();
     $speak = Config::speak();
     // Check whether the localized "about" file is available
     if (!($info = File::exist(PLUGIN . DS . $folder . DS . 'about.' . $config->language . '.txt'))) {
         $info = PLUGIN . DS . $folder . DS . 'about.txt';
     }
     $default = 'Title' . S . ' ' . ucwords(Text::parse($folder, '->text')) . "\n" . 'Author' . S . ' ' . $speak->anon . "\n" . 'URL' . S . ' #' . "\n" . 'Version' . S . ' 0.0.0' . "\n" . "\n" . SEPARATOR . "\n" . "\n" . Config::speak('notify_not_available', $speak->description);
     $info = Text::toPage(File::open($info)->read($default), 'content', 'plugin:');
     return $array ? $info : Mecha::O($info);
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:12,代码来源:plugin.php

示例7: fire

 /**
  * ==============================================================
  *  FIRE !!!
  * ==============================================================
  *
  * -- CODE: -----------------------------------------------------
  *
  *    Weapon::fire('tank');
  *
  * --------------------------------------------------------------
  *
  *    Weapon::fire('jet', array('Blue', '1.1.0'));
  *
  * --------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type   | Description
  *  ---------- | ------ | ---------------------------------------
  *  $name      | string | Hook name
  *  $arguments | array  | Hook function argument(s)
  *  ---------- | ------ | ---------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function fire($name, $arguments = array())
 {
     $name = get_called_class() . '::' . $name;
     if (isset(self::$armaments[$name])) {
         if (func_num_args() > 2) {
             $arguments = array_slice(func_get_args(), 1);
         }
         $weapons = Mecha::eat(self::$armaments[$name])->order('ASC', 'stack')->vomit();
         foreach ($weapons as $weapon => $cargo) {
             if (!isset(self::$armaments_e[$name . '->' . $cargo['stack']])) {
                 call_user_func_array($cargo['fn'], $arguments);
             }
         }
     } else {
         self::$armaments[$name] = array();
     }
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:41,代码来源:weapon.php

示例8: header

 public static function header($data = array(), $value = "")
 {
     if (!is_array($data)) {
         $data = array(self::fix($data) => $value);
     }
     foreach ($data as $k => $v) {
         if ($v === false) {
             unset($data[self::fix($k)], self::$bucket[self::fix($k)]);
         } else {
             // Restrict user(s) from inputting the `SEPARATOR` constant
             // to prevent mistake(s) in parsing the file content
             $data[self::fix($k)] = Text::ES($v);
         }
     }
     Mecha::extend(self::$bucket, $data);
     return new static();
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:17,代码来源:page.php

示例9: apply

 /**
  * ===================================================================
  *  APPLY FILTER
  * ===================================================================
  *
  * -- CODE: ----------------------------------------------------------
  *
  *    Filter::apply('content', $content);
  *
  * -------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type   | Description
  *  --------- | ------ | ---------------------------------------------
  *  $name     | string | Filter name
  *  $value    | string | String to be manipulated
  *  --------- | ------ | ---------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function apply($name, $value)
 {
     $name = get_called_class() . '::' . $name;
     if (!isset(self::$filters[$name])) {
         self::$filters[$name] = array();
         return $value;
     }
     $params = array_slice(func_get_args(), 2);
     $filters = Mecha::eat(self::$filters[$name])->order('ASC', 'stack')->vomit();
     foreach ($filters as $filter => $cargo) {
         if (!isset(self::$filters_e[$name . '->' . $cargo['stack']])) {
             $arguments = array_merge(array($value), $params);
             $value = call_user_func_array($cargo['fn'], $arguments);
         }
     }
     return $value;
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:37,代码来源:filter.php

示例10: fire

 /**
  * ==============================================================
  *  FIRE !!!
  * ==============================================================
  *
  * -- CODE: -----------------------------------------------------
  *
  *    Weapon::fire('tank');
  *
  * --------------------------------------------------------------
  *
  *    Weapon::fire('jet', array('Blue', '1.1.0'));
  *
  * --------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type   | Description
  *  ---------- | ------ | ---------------------------------------
  *  $name      | string | Hook name
  *  $arguments | array  | Hook function argument(s)
  *  ---------- | ------ | ---------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function fire($name, $arguments = array())
 {
     if (!is_array($name)) {
         $c = get_called_class();
         if (isset(self::$armaments[$c][$name])) {
             if (func_num_args() > 2) {
                 $arguments = array_slice(func_get_args(), 1);
             }
             $weapons = Mecha::eat(self::$armaments[$c][$name])->order('ASC', 'stack')->vomit();
             foreach ($weapons as $weapon => $cargo) {
                 call_user_func_array($cargo['fn'], $arguments);
             }
         } else {
             self::$armaments[$c][$name] = array();
         }
     } else {
         $arguments = func_get_args();
         foreach ($name as $v) {
             $arguments[0] = $v;
             call_user_func_array('self::fire', $arguments);
         }
     }
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:47,代码来源:weapon.php

示例11: apply

 /**
  * ===================================================================
  *  APPLY FILTER
  * ===================================================================
  *
  * -- CODE: ----------------------------------------------------------
  *
  *    Filter::apply('content', $content);
  *
  *    Filter::apply(array('page:title', 'title'), $content);
  *
  * -------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type   | Description
  *  --------- | ------ | ---------------------------------------------
  *  $name     | string | Filter name
  *  $value    | string | String to be manipulated
  *  --------- | ------ | ---------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function apply($name, $value)
 {
     if (!is_array($name)) {
         $c = get_called_class();
         if (!isset(self::$filters[$c][$name])) {
             self::$filters[$c][$name] = array();
             return $value;
         }
         $arguments = array_slice(func_get_args(), 1);
         $filters = Mecha::eat(self::$filters[$c][$name])->order('ASC', 'stack')->vomit();
         foreach ($filters as $filter => $cargo) {
             $arguments[0] = $value;
             $value = call_user_func_array($cargo['fn'], $arguments);
         }
     } else {
         $arguments = func_get_args();
         foreach (array_reverse($name) as $v) {
             $arguments[0] = $v;
             $arguments[1] = $value;
             $value = call_user_func_array('self::apply', $arguments);
         }
     }
     return $value;
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:46,代码来源:filter.php

示例12: pageAnchor

 /**
  * ==========================================================================
  *  GET MINIMUM DATA OF A PAGE
  * ==========================================================================
  *
  * -- CODE: -----------------------------------------------------------------
  *
  *    var_dump(Get::pageAnchor('about'));
  *
  * --------------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type   | Description
  *  ---------- | ------ | ---------------------------------------------------
  *  $path      | string | The URL path of the page file, or a page slug
  *  $folder    | string | Folder of the page(s)
  *  $connector | string | See `Get::page()`
  *  $FP        | string | See `Get::page()`
  *  ---------- | ------ | ---------------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function pageAnchor($path, $folder = PAGE, $connector = '/', $FP = 'page:')
 {
     $config = Config::get();
     if (strpos($path, ROOT) === false) {
         $path = self::pagePath($path, $folder);
         // By page slug, ID or time
     }
     if ($path && ($buffer = File::open($path)->get(1)) !== false) {
         $results = self::pageExtract($path);
         $parts = explode(S, $buffer, 2);
         $results['url'] = self::AMF($config->url . $connector . $results['slug'], $FP, 'url');
         $results['title'] = self::AMF(isset($parts[1]) ? Text::DS(trim($parts[1])) : "", $FP, 'title');
         return Mecha::O($results);
     }
     return false;
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:38,代码来源:get.php

示例13: glob

    $filter = Request::get('q', "");
    $filter = $filter ? Text::parse($filter, '->safe_file_name') : false;
    $takes = glob($d . DS . '*', GLOB_NOSORT);
    if ($filter) {
        foreach ($takes as $k => $v) {
            if (strpos(File::N($v), $filter) === false) {
                unset($takes[$k]);
            }
        }
    }
    if ($_files = Mecha::eat($takes)->chunk($offset, $config->per_page * 2)->vomit()) {
        $files = array();
        foreach ($_files as $_file) {
            $files[] = File::inspect($_file);
        }
        $files = Mecha::eat($files)->order('ASC', 'path')->vomit();
        unset($_files);
    } else {
        $files = false;
    }
    Config::set(array('page_title' => $speak->assets . $config->title_separator . $config->manager->title, 'offset' => $offset, 'files' => $files, 'pagination' => Navigator::extract($takes, $offset, $config->per_page * 2, $config->manager->slug . '/asset'), 'cargo' => DECK . DS . 'workers' . DS . 'cargo.asset.php'));
    Shield::lot('segment', 'asset')->attach('manager', false);
});
/**
 * Asset Repair
 * ------------
 */
Route::accept($config->manager->slug . '/asset/repair/(file|files):(:all)', function ($path = "", $old = "") use($config, $speak) {
    if (Guardian::get('status') !== 'pilot') {
        Shield::abort();
    }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:route.asset.php

示例14: info

 /**
  * ==========================================================
  *  GET SHIELD INFO
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    var_dump(Shield::info('normal'));
  *
  * ----------------------------------------------------------
  *
  */
 public static function info($folder = null, $array = false)
 {
     $config = Config::get();
     $speak = Config::speak();
     if (is_null($folder)) {
         $folder = $config->shield;
     }
     // Check whether the localized "about" file is available
     if (!($info = File::exist(SHIELD . DS . $folder . DS . 'about.' . $config->language . '.txt'))) {
         $info = SHIELD . DS . $folder . DS . 'about.txt';
     }
     $d = 'Title' . S . ' ' . Text::parse($folder, '->title') . "\n" . 'Author' . S . ' ' . $speak->anon . "\n" . 'URL' . S . ' #' . "\n" . 'Version' . S . ' 0.0.0' . "\n" . "\n" . SEPARATOR . "\n" . "\n" . Config::speak('notify_not_available', $speak->description);
     $info = Text::toPage(File::open($info)->read($d), 'content', 'shield:', array('id' => File::exist(SHIELD . DS . $folder) ? $folder : false));
     return $array ? $info : Mecha::O($info);
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:27,代码来源:shield.php

示例15: configure

 public static function configure($key, $value = null)
 {
     if (is_array($key)) {
         Mecha::extend(self::$config, $key);
     } else {
         if (is_array($value)) {
             Mecha::extend(self::$config[$key], $value);
         } else {
             self::$config[$key] = $value;
         }
     }
     return new static();
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:13,代码来源:file.php


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