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


PHP Mecha::eat方法代码示例

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


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

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

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

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

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

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

示例6: page


//.........这里部分代码省略.........
         $results['description'] = self::AMF($summary, $FP, 'description');
     }
     $content_test = isset($excludes['content']) && strpos($content, '<!--') !== false ? Text::toPage(Text::ES($content), 'content', $FP) : $results;
     $content_test = $content_test['content'];
     $content_test = is_array($content_test) ? implode("", $content_test) : $content_test;
     // Redirect 301 with `<!-- kick: "http://example.com" -->`
     if (strpos($content_test, '<!-- kick:') !== false && $config->page_type === rtrim($FP, ':')) {
         preg_match('#<!-- kick\\: *([\'"]?)(.*?)\\1 -->#', $content_test, $matches);
         Guardian::kick($matches[2]);
     }
     // External link with `<!-- link: "http://example.com" -->`
     if (strpos($content_test, '<!-- link:') !== false) {
         preg_match('#<!-- link\\: *([\'"]?)(.*?)\\1 -->#', $content_test, $matches);
         $results['link'] = $matches[2];
         $results['content'] = preg_replace('#<!-- link\\:.*? -->#', "", $results['content']);
     }
     // Manual post excerpt with `<!-- cut+ "Read More" -->`
     if (strpos($content_test, '<!-- cut+ ') !== false) {
         preg_match('#<!-- cut\\+( +([\'"]?)(.*?)\\2)? -->#', $content_test, $matches);
         $more = !empty($matches[3]) ? $matches[3] : $speak->read_more;
         $content_test = preg_replace('#<!-- cut\\+( +(.*?))? -->#', '<p><a class="fi-link" href="' . $results['url'] . '#read-more:' . $results['id'] . '">' . $more . '</a></p><!-- cut -->', $content_test);
     }
     // ... or `<!-- cut -->`
     if (strpos($content_test, '<!-- cut -->') !== false) {
         $parts = explode('<!-- cut -->', $content_test, 2);
         $results['excerpt'] = self::AMF(trim($parts[0]), $FP, 'excerpt');
         $results['content'] = preg_replace('#<p><a class="fi-link" href=".*?">.*?<\\/a><\\/p>#', "", trim($parts[0])) . NL . NL . '<span class="fi" id="read-more:' . $results['id'] . '" aria-hidden="true"></span>' . NL . NL . trim($parts[1]);
     }
     if (!isset($excludes['tags'])) {
         $tags = array();
         foreach ($results['kind'] as $id) {
             $tags[] = self::rawTag($id);
         }
         $results['tags'] = self::AMF(Mecha::eat($tags)->order('ASC', 'name')->vomit(), $FP, 'tags');
     }
     if (!isset($excludes['css']) || !isset($excludes['js'])) {
         if ($file = File::exist(CUSTOM . DS . $time . '.' . $extension)) {
             $custom = explode(SEPARATOR, File::open($file)->read());
             $css = isset($custom[0]) ? Text::DS(trim($custom[0])) : "";
             $js = isset($custom[1]) ? Text::DS(trim($custom[1])) : "";
             /**
              * CSS
              * ---
              *
              * css_raw
              * page:css_raw
              * custom:css_raw
              *
              * shortcode
              * page:shortcode
              * custom:shortcode
              *
              * css
              * page:css
              * custom:css
              *
              */
             $css = self::AMF($css, $FP, 'css_raw');
             $results['css_raw'] = Filter::apply('custom:css_raw', $css);
             $css = self::AMF($css, $FP, 'shortcode');
             $css = Filter::apply('custom:shortcode', $css);
             $css = self::AMF($css, $FP, 'css');
             $results['css'] = Filter::apply('custom:css', $css);
             /**
              * JS
              * --
开发者ID:razordaze,项目名称:mecha-cms,代码行数:67,代码来源:get.php

示例7: function

<?php

/**
 * Post Manager
 * ------------
 */
Route::accept(array($config->manager->slug . '/(' . $post . ')', $config->manager->slug . '/(' . $post . ')/(:num)'), function ($segment = "", $offset = 1) use($config, $speak) {
    $posts = false;
    $offset = (int) $offset;
    $s = call_user_func('Get::' . $segment . 's', strtoupper(Request::get('order', 'DESC')), Request::get('filter', ""), 'txt,draft,archive');
    if ($files = Mecha::eat($s)->chunk($offset, $config->manager->per_page)->vomit()) {
        $posts = Mecha::walk($files, function ($v) use($segment) {
            return call_user_func('Get::' . $segment . 'Header', $v);
        });
    } else {
        if ($offset !== 1) {
            Shield::abort();
        }
    }
    Config::set(array('page_title' => $speak->{$segment . 's'} . $config->title_separator . $config->manager->title, 'pages' => $posts, 'offset' => $offset, 'pagination' => Navigator::extract($s, $offset, $config->manager->per_page, $config->manager->slug . '/' . $segment), 'cargo' => 'cargo.post.php'));
    Shield::lot(array('segment' => $segment))->attach('manager');
});
/**
 * Post Repairer/Igniter
 * ---------------------
 */
Route::accept(array($config->manager->slug . '/(' . $post . ')/ignite', $config->manager->slug . '/(' . $post . ')/repair/id:(:num)'), function ($segment = "", $id = false) use($config, $speak, $response) {
    $units = array('title', 'slug', 'link', 'content', 'content_type', 'description', 'post' . DS . 'author');
    foreach ($units as $k => $v) {
        Weapon::add('tab_content_1_before', function ($page, $segment) use($config, $speak, $v) {
            include __DIR__ . DS . 'unit' . DS . 'form' . DS . $v . '.php';
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:route.post.php

示例8: responsesExtract

 /**
  * ==========================================================================
  *  GET LIST OF RESPONSE(S) DETAIL(S)
  * ==========================================================================
  *
  * -- CODE: -----------------------------------------------------------------
  *
  *    foreach(Get::responsesExtract() as $file) {
  *        echo $file['path'] . '<br>';
  *    }
  *
  * --------------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type   | Description
  *  --------- | ------ | ----------------------------------------------------
  *  $sorter   | string | The key of array item as sorting reference
  *  --------- | ------ | ----------------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function responsesExtract($order = 'ASC', $sorter = 'time', $filter = "", $e = 'txt', $FP = 'response:', $folder = RESPONSE)
 {
     if ($files = self::responses($order, $filter, $e, $folder)) {
         $results = array();
         foreach ($files as $file) {
             $results[] = self::responseExtract($file, $FP);
         }
         unset($files);
         return !empty($results) ? Mecha::eat($results)->order($order, $sorter)->vomit() : false;
     }
     return false;
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:33,代码来源:get.php

示例9: isset

             if (is_string($v)) {
                 $menus[$k] = $v;
             } else {
                 $stack = isset($v['stack']) ? $v['stack'] : 10;
                 $_k = (strpos($v['icon'], '<') === false ? Jot::icon($v['icon'], 'fw') : $v['icon']) . ' <span class="label">' . $k . '</span>' . (isset($v['count']) && ($v['count'] === '&infin;' || (double) $v['count'] > 0) ? ' <span class="counter">' . $v['count'] . '</span>' : "");
                 $menus[$_k] = isset($v['url']) ? $v['url'] : null;
             }
         }
     }
     Menu::add('manager', $menus);
     $html .= Menu::manager('ul', $T1);
 }
 if ($type === 'BAR') {
     $bars = array();
     if ($_bars = Mecha::A(Config::get('manager_bar'))) {
         $_bars = Mecha::eat($_bars)->order('ASC', 'stack', true, 10)->vomit();
         foreach ($_bars as $k => $v) {
             if (is_string($v)) {
                 $bar = $v;
             } else {
                 $t = ' data-tooltip="' . Text::parse(isset($v['description']) ? $v['description'] : $k, '->encoded_html') . '"';
                 if (isset($v['url'])) {
                     $url = Filter::colon('manager:url', Converter::url($v['url']));
                     $c = $config->url_current === $url ? ' ' . Widget::$config['classes']['current'] : "";
                     $bar = '<a class="item' . $c . '" href="' . $url . '"' . $t . '>';
                 } else {
                     $bar = '<span class="item a"' . $t . '>';
                 }
                 $bar .= isset($v['icon']) ? strpos($v['icon'], '<') === false ? Jot::icon($v['icon']) : $v['icon'] : $k;
                 $bar .= ' <span class="label">' . $k . '</span>';
                 if (isset($v['count']) && ($v['count'] === '&infin;' || (double) $v['count'] > 0)) {
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:widget.php

示例10: relatedPost

 /**
  * Widget Related Post
  * -------------------
  *
  * [1]. Widget::relatedPost();
  * [2]. Widget::relatedPost(5);
  *
  */
 public static function relatedPost($total = 7)
 {
     $T1 = TAB;
     $T2 = str_repeat($T1, 2);
     $config = Config::get();
     if ($config->page_type !== 'article') {
         return self::randomPost($total);
     } else {
         if (!($files = Get::articles('DESC', 'kind:' . implode(',', (array) $config->article->kind)))) {
             return O_BEGIN . '<div class="widget widget-related widget-related-post">' . Config::speak('notify_empty', strtolower($speak->posts)) . '</div>' . O_END;
         }
         if (count($files) <= 1) {
             return self::randomPost($total);
         }
         $files = Mecha::eat($files)->shake()->vomit();
         $html = O_BEGIN . '<div class="widget widget-related widget-related-post" id="widget-related-post-' . self::$id['related_post'] . '">' . NL;
         self::$id['related_post']++;
         $html .= $T1 . '<ul>' . NL;
         for ($i = 0, $count = count($files); $i < $total; ++$i) {
             if ($i === $count) {
                 break;
             }
             if ($files[$i] !== $config->article->path) {
                 $article = Get::articleAnchor($files[$i]);
                 $html .= $T2 . '<li><a href="' . $article->url . '">' . $article->title . '</a></li>' . NL;
             }
         }
         $html .= $T1 . '</ul>' . NL;
         $html .= '</div>' . O_END;
         $html = Filter::apply('widget', $html);
         return Filter::apply('widget:related.post', Filter::apply('widget:related', $html));
     }
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:41,代码来源:widget.php

示例11: execute

 /**
  * ===========================================================================
  *  EXECUTE THE ADDED ROUTE(S)
  * ===========================================================================
  *
  * -- CODE: ------------------------------------------------------------------
  *
  *    Route::execute();
  *
  * ---------------------------------------------------------------------------
  *
  *    Route::execute('foo/(:num)', array(4)); // Re-execute `foo/(:num)`
  *
  * ---------------------------------------------------------------------------
  *
  */
 public static function execute($pattern = null, $arguments = array())
 {
     if (!is_null($pattern)) {
         $pattern = self::path($pattern);
         if (isset(self::$routes[$pattern])) {
             call_user_func_array(self::$routes[$pattern]['fn'], $arguments);
         }
     } else {
         $routes = Mecha::eat(self::$routes)->order('ASC', 'stack', true)->vomit();
         foreach ($routes as $pattern => $cargo) {
             // If matched with the URL path
             if ($route = self::is($pattern)) {
                 // Loading cargo(s) ...
                 if (isset(self::$routes_over[$pattern])) {
                     $fn = Mecha::eat(self::$routes_over[$pattern])->order('ASC', 'stack')->vomit();
                     foreach ($fn as $v) {
                         call_user_func_array($v['fn'], $route['lot']);
                     }
                 }
                 // Passed!
                 return call_user_func_array($cargo['fn'], $route['lot']);
             }
         }
     }
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:41,代码来源:route.php

示例12: array

                });
                $P = array('data' => $_FILES);
                Weapon::fire(array('on_asset_update', 'on_asset_construct'), array($P, $P));
            }
            if (!Notify::errors()) {
                Guardian::kick($config->manager->slug . '/asset/' . $offset . str_replace('&', '&amp;', HTTP::query('path', $p)));
            } else {
                $tab_id = 'tab-content-3';
                include __DIR__ . DS . 'task.js.tab.php';
            }
        }
    }
    $filter = Request::get('q', "");
    $filter = $filter ? Text::parse($filter, '->safe_file_name') : "";
    $files = Get::closestFiles($d, "", 'ASC', 'path', $filter);
    $files_chunk = Mecha::eat($files)->chunk($offset, $config->per_page * 2)->vomit();
    Config::set(array('page_title' => $speak->assets . $config->title_separator . $config->manager->title, 'offset' => $offset, 'pagination' => Navigator::extract($files, $offset, $config->per_page * 2, $config->manager->slug . '/asset'), 'cargo' => 'cargo.asset.php'));
    Shield::lot(array('segment' => 'asset', 'files' => $files_chunk ? Mecha::O($files_chunk) : false))->attach('manager');
});
/**
 * Asset Repairer
 * --------------
 */
Route::accept($config->manager->slug . '/asset/repair/(file|files):(:all)', function ($path = "", $old = "") use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $old = File::path($old);
    $p = Request::get('path', false);
    if (!($file = File::exist(ASSET . DS . $old))) {
        Shield::abort();
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:route.asset.php

示例13: function

<?php

/**
 * Page Manager
 * ------------
 */
Route::accept(array($config->manager->slug . '/page', $config->manager->slug . '/page/(:num)'), function ($offset = 1) use($config, $speak) {
    $pages = false;
    $offset = (int) $offset;
    if ($files = Mecha::eat(Get::pages('DESC', "", 'txt,draft,archive'))->chunk($offset, $config->manager->per_page)->vomit()) {
        $pages = array();
        foreach ($files as $file) {
            $pages[] = Get::pageHeader($file);
        }
        unset($files);
    } else {
        if ($offset !== 1) {
            Shield::abort();
        }
    }
    Config::set(array('page_title' => $speak->pages . $config->title_separator . $config->manager->title, 'offset' => $offset, 'pages' => $pages, 'pagination' => Navigator::extract(Get::pages('DESC', "", 'txt,draft,archive'), $offset, $config->manager->per_page, $config->manager->slug . '/page'), 'cargo' => DECK . DS . 'workers' . DS . 'cargo.page.php'));
    Shield::lot('segment', 'page')->attach('manager', false);
});
/**
 * Page Composer/Updater
 * ---------------------
 */
Route::accept(array($config->manager->slug . '/page/ignite', $config->manager->slug . '/page/repair/id:(:num)'), function ($id = false) use($config, $speak) {
    Config::set('cargo', DECK . DS . 'workers' . DS . 'repair.page.php');
    if ($id && ($page = Get::page($id, array('content', 'excerpt', 'tags', 'comments')))) {
        $extension_o = $page->state === 'published' ? '.txt' : '.draft';
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:route.page.php

示例14: relatedPost

 /**
  * Widget Related Post
  * -------------------
  *
  * [1]. Widget::relatedPost();
  * [2]. Widget::relatedPost(5);
  *
  */
 public static function relatedPost($total = 7, $folder = ARTICLE)
 {
     $T1 = TAB;
     $T2 = str_repeat($T1, 2);
     $p = $folder !== POST ? File::B($folder) : 'post';
     $id = Config::get('widget_related_' . $p . '_id', 0) + 1;
     $config = Config::get();
     $speak = Config::speak();
     $kind = isset($config->{$p}->kind) ? (array) $config->{$p}->kind : array();
     $html = O_BEGIN . '<div class="widget widget-related widget-related-post" id="widget-related-post-' . $id . '">' . NL;
     if ($config->page_type !== $p) {
         return self::randomPost($total, $folder);
     } else {
         if ($files = call_user_func('Get::' . $p . 's', 'DESC', 'kind:' . implode(',', $kind))) {
             if (count($files) <= 1) {
                 return self::randomPost($total, $folder);
             }
             $files = Mecha::eat($files)->shake()->vomit();
             $html .= $T1 . '<ul>' . NL;
             for ($i = 0, $count = count($files); $i < $total; ++$i) {
                 if ($i === $count) {
                     break;
                 }
                 if ($files[$i] !== $config->{$p}->path) {
                     $post = call_user_func('Get::' . $p . 'Anchor', $files[$i]);
                     $html .= $T2 . '<li><a href="' . $post->url . '">' . $post->title . '</a></li>' . NL;
                 }
             }
             $html .= $T1 . '</ul>' . NL;
         } else {
             $html .= $T1 . Config::speak('notify_empty', strtolower($speak->{$p . 's'})) . NL;
         }
     }
     $html .= '</div>' . O_END;
     Config::set('widget_related_' . $p . '_id', $id);
     return Filter::apply(array('widget:related.' . $p, 'widget:related.post', 'widget:related', 'widget'), $html, $id);
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:45,代码来源:widget.php

示例15: function

        }
    });
    Config::set(array('page_title' => $page->title . $config->title_separator . $config->title, 'page' => $page));
    Shield::attach('page-' . $slug);
}, 100);
/**
 * Home Page
 * ---------
 *
 * [1]. /
 *
 */
Route::accept('/', function () use($config) {
    Session::kill('search_query');
    Session::kill('search_results');
    if ($files = Mecha::eat(Get::articles())->chunk(1, $config->index->per_page)->vomit()) {
        $articles = array();
        foreach ($files as $file) {
            $articles[] = Get::article($file, array('content', 'tags', 'css', 'js', 'comments'));
        }
        unset($files);
    } else {
        $articles = false;
    }
    Config::set(array('articles' => $articles, 'pagination' => Navigator::extract(Get::articles(), 1, $config->index->per_page, $config->index->slug)));
    Shield::attach('page-home');
}, 110);
/**
 * Do Routing
 * ----------
 */
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:launch.php


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