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


PHP Get::article方法代码示例

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


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

示例1: function

    Shield::attach('page-' . $slug);
}, 100);
/**
 * Home Page
 * ---------
 *
 * [1]. /
 *
 */
Route::accept('/', function () use($config, $excludes) {
    Session::kill('search.query');
    Session::kill('search.results');
    $s = Get::articles();
    if ($articles = Mecha::eat($s)->chunk(1, $config->index->per_page)->vomit()) {
        $articles = Mecha::walk($articles, function ($path) use($excludes) {
            return Get::article($path, $excludes);
        });
    } else {
        $articles = false;
    }
    Filter::add('pager:url', function ($url) {
        return Filter::apply('index:url', $url);
    });
    Config::set(array('articles' => $articles, 'pagination' => Navigator::extract($s, 1, $config->index->per_page, $config->index->slug)));
    Shield::attach('page-home');
}, 110);
/**
 * Route Hook: after
 * -----------------
 */
Weapon::fire('routes_after');
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:launch.php

示例2: function

                }
                Guardian::kick($config->manager->slug . '/article/repair/id:' . Date::format($date, 'U'));
            }
        }
    }
    Weapon::add('SHIPMENT_REGION_BOTTOM', function () {
        echo Asset::javascript('manager/assets/sword/editor.compose.js', "", 'sword/editor.compose.min.js');
    }, 11);
    Shield::lot(array('segment' => 'article', 'default' => $article))->attach('manager', false);
});
/**
 * Article Killer
 * --------------
 */
Route::accept($config->manager->slug . '/article/kill/id:(:num)', function ($id = "") use($config, $speak) {
    if (!($article = Get::article($id, array('comments')))) {
        Shield::abort();
    }
    if (Guardian::get('status') !== 'pilot' && Guardian::get('author') !== $article->author) {
        Shield::abort();
    }
    Config::set(array('page_title' => $speak->deleting . ': ' . $article->title . $config->title_separator . $config->manager->title, 'article' => $article, 'cargo' => DECK . DS . 'workers' . DS . 'kill.article.php'));
    $G = array('data' => Mecha::A($article));
    if ($request = Request::post()) {
        Guardian::checkToken($request['token']);
        File::open($article->path)->delete();
        // Deleting comment(s) ...
        if ($comments = Get::comments($id, 'DESC', 'txt,hold')) {
            foreach ($comments as $comment) {
                File::open($comment)->delete();
            }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:route.article.php

示例3: function

<?php

/**
 * Create New Comment
 * ------------------
 */
Weapon::add('shield_before', function () use($config, $speak) {
    $comment_id = 'comment-%d';
    // Your comment ID
    $comment_form_id = 'comment-form';
    // Your comment form ID
    $article = isset(Config::get('article')->path) ? Get::article(Config::get('article')->path) : false;
    if ($article && $config->page_type === 'article' && Request::method('post')) {
        $request = Request::post();
        // Check token
        Guardian::checkToken($request['token'], $config->url_current . '#' . $comment_form_id);
        $extension = $config->comment_moderation && !Guardian::happy() ? '.hold' : '.txt';
        // Check name
        if (trim($request['name']) === "") {
            Notify::error(Config::speak('notify_error_empty_field', $speak->comment_name));
        }
        // Check email
        if (trim($request['email']) !== "") {
            if (!Guardian::check($request['email'], '->email')) {
                Notify::error($speak->notify_invalid_email);
            } else {
                // Disallow passenger(s) from entering your email address in the comment email field
                if (!Guardian::happy() && $request['email'] === $config->author_email) {
                    Notify::warning(Config::speak('notify_warning_forbidden_input', '<em>' . $request['email'] . '</em>', strtolower($speak->email)));
                }
            }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:task.comment.php

示例4: function

    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
 * ----------
 */
Route::execute();
/**
 * 404 Page
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:launch.php


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