本文整理汇总了PHP中Get::pages方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::pages方法的具体用法?PHP Get::pages怎么用?PHP Get::pages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Get
的用法示例。
在下文中一共展示了Get::pages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
/**
* Configuration Manager
* ---------------------
*/
Route::accept($config->manager->slug . '/config', function () use($config, $speak) {
if (!Guardian::happy(1)) {
Shield::abort();
}
Config::set(array('page_title' => $speak->configs . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.config.php'));
if ($request = Request::post()) {
Guardian::checkToken($request['token']);
$bools = array('comments.allow' => false, 'comments.moderation' => false, 'widget_include_css' => false, 'widget_include_js' => false, 'html_parser.active' => Request::post('html_parser.active', false));
$pages = array('index' => 'article', 'tag' => 'tag', 'archive' => 'archive', 'search' => 'search', 'manager' => 'manager');
$slugs = array();
if ($files = Get::pages()) {
foreach ($files as $file) {
list($_time, $_kind, $_slug) = explode('_', File::N($file), 3);
$slugs[$_slug] = 1;
}
unset($files);
}
foreach ($bools as $bool => $fallback) {
// Fix(es) for checkbox input(s)
Mecha::SVR($request, $bool, Request::post($bool, $fallback));
}
foreach ($pages as $page => $default) {
// Fix(es) for slug pattern input(s)
$request[$page]['slug'] = Text::parse(Request::post($page . '.slug', $default), '->slug');
if (Request::post($page . '.per_page') < 1 || floor(Request::post($page . '.per_page')) != Request::post($page . '.per_page')) {
Notify::error($speak->notify_invalid_per_page_number);
示例2: array
<?php
$bucket = array();
if ($config->total_pages > 0) {
foreach (Get::pages() as $page) {
list($time, $kind, $slug) = explode('_', File::N($page), 3);
$bucket[] = (object) array('url' => $config->url . '/' . $slug, 'date' => Date::format($time, 'c'), 'changefreq' => 'weekly', 'priority' => (string) '0.5');
}
}
if ($config->total_articles > 0) {
foreach (Get::articles() as $article) {
list($time, $kind, $slug) = explode('_', File::N($article), 3);
$bucket[] = (object) array('url' => $config->url . '/' . $config->index->slug . '/' . $slug, 'date' => Date::format($time, 'c'), 'changefreq' => 'weekly', 'priority' => (string) '1.0');
}
}
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
if (!empty($bucket)) {
foreach ($bucket as $i => $item) {
echo '<url>';
echo '<loc>' . $item->url . '</loc>';
echo '<lastmod>' . $item->date . '</lastmod>';
echo '<changefreq>' . $item->changefreq . '</changefreq>';
echo '<priority>' . $item->priority . '</priority>';
Weapon::fire('sitemap_item', array($item, $i));
echo '</url>';
}
}
echo '</urlset>';
示例3: array
}
$page = Mecha::O(array('id' => "", 'path' => "", 'state' => 'draft', 'date' => array('W3C' => ""), 'title' => $config->defaults->page_title, 'slug' => "", 'content_raw' => $config->defaults->page_content, 'content_type' => $config->html_parser, 'description' => "", 'author' => Guardian::get('author'), 'css_raw' => $config->defaults->page_custom_css, 'js_raw' => $config->defaults->page_custom_js, 'fields' => array()));
Config::set(array('page_title' => Config::speak('manager.title_new_', $speak->page) . $config->title_separator . $config->manager->title, 'page' => Mecha::A($page)));
}
$G = array('data' => Mecha::A($page));
Config::set('html_parser', $page->content_type);
if ($request = Request::post()) {
Guardian::checkToken($request['token']);
$task_connect = $page;
include DECK . DS . 'workers' . DS . 'task.field.5.php';
include DECK . DS . 'workers' . DS . 'task.field.6.php';
$extension = $request['action'] === 'publish' ? '.txt' : '.draft';
// Check for duplicate slug, except for the current old slug.
// Allow user(s) to change their post slug, but make sure they
// do not type the slug of another post.
if (trim($slug) !== "" && $slug !== $page->slug && ($files = Get::pages('DESC', "", 'txt,draft,archive'))) {
foreach ($files as $file) {
if (strpos(File::B($file), '_' . $slug . '.') !== false) {
Notify::error(Config::speak('notify_error_slug_exist', $slug));
Guardian::memorize($request);
break;
}
}
unset($files);
}
// Slug must contains at least one letter or one `-`
if (!preg_match('#[a-z\\-]#i', $slug)) {
Notify::error($speak->notify_error_slug_missing_letter);
Guardian::memorize($request);
}
// Check for empty post content