index() статический публичный Метод

static public index ( $name, $fallback = null )
Пример #1
0
<?php

require_once '../_base.php';
gb::authenticate();
gb::$title[] = 'Posts';
include '../_header.php';
$unapproved_comments = gb::index('unapproved-comments', array());
?>
<div id="content" class="<?php 
echo gb_admin::$current_domid;
?>
 manage items">
	<h2>Pending comments</h2>
	<table class="items comments">
	<?php 
foreach ($unapproved_comments as $t) {
    list($comment, $post) = $t;
    ?>
		<?php 
    $post_editurl = gb_admin::$url . 'edit/post.php?name=' . urlencode($post->name);
    ?>
		<tr class="<?php 
    echo $comment->spam === true ? 'spam' : '';
    ?>
">
			<td class="avatar">
				<img src="<?php 
    echo h($comment->avatarURL(48, gb_admin::$url . 'res/default-avatar.png'));
    ?>
" alt="Avatar" width="48" height="48" />
			</td>
Пример #2
0
<div id="sidebar">
	<?php 
if ($recent_comments = gb::index('recent-comments')) {
    ?>
	<h2>Recent comments</h2>
	<ol class="recent-comments">
	<?php 
    foreach ($recent_comments as $tuple) {
        list($comment, $_post) = $tuple;
        ?>
		<li>
			<a href="<?php 
        echo h($_post->url());
        ?>
#comment-<?php 
        echo $comment->id;
        ?>
"><?php 
        echo h($comment->name);
        ?>
				on <em><?php 
        echo h($_post->title);
        ?>
</em></a>
			<small><?php 
        echo $comment->date->age();
        ?>
</small>
		</li>
	<?php 
    }
Пример #3
0
            $post = GBPost::findByName($name, $status === 'deleted' ? null : 'work', false);
            if ($post) {
                if (!isset($muxed_posts[$post->name])) {
                    $muxed_posts[$post->name] = array();
                }
                $muxed_posts[$post->name][] = array($post, $stageflag . _mkflags($post, $status));
            }
        }
    }
}
# Add dirty staged, unstaged and untracked files
_add_posts_from_status($st, 'content/posts/', 'staged', st::STAGED);
_add_posts_from_status($st, 'content/posts/', 'unstaged', st::UNSTAGED);
_add_posts_from_status($st, 'content/posts/', 'untracked', st::UNTRACKED);
# Add clean drafts
foreach (gb::index('draft-posts') as $post) {
    if (!isset($muxed_posts[$post->name])) {
        $muxed_posts[$post->name] = array();
    }
    $muxed_posts[$post->name][] = array($post, st::DRAFT);
}
function _post_tuple_sortfunc($a, $b)
{
    return $b[0]->modified->time - $a[0]->modified->time;
}
function _muxed_posts_sortfunc($a, $b)
{
    return $b[0][0]->modified->time - $a[0][0]->modified->time;
}
# Add published and scheduled posts
$pageno = 0;
Пример #4
0
 static function findByMetaIndex($tags, $indexname, $pageno)
 {
     $index = gb::index($indexname);
     $objs = self::_findByMetaIndex($tags, $index);
     if (!$objs) {
         return false;
     }
     $page = GBPagedObjects::split($objs, $pageno);
     if ($page !== false) {
         if ($pageno === null) {
             # no pageno specified returns a list of all pages
             foreach ($page as $p) {
                 $p->posts = new GBLazyObjectsIterator($p->posts);
             }
         } else {
             # specific, single page
             $page->posts = new GBLazyObjectsIterator($page->posts);
         }
     }
     return $page;
 }
Пример #5
0
>Home</a></li>
					<!--li>
						<a href="<?php 
echo gb::url_to('/archive/');
?>
" 
							<?php 
if (strpos(gb::url()->path, '/archive/') !== false) {
    echo 'class="current"';
}
?>
>Archive</a>
					</li-->
					<li class="divider"></li>
					<?php 
foreach (gb::index('pages') as $page) {
    if ($page->hidden) {
        continue;
    }
    ?>
						<li class="page">
							<a href="<?php 
    echo h($page->url());
    ?>
" <?php 
    echo $page->isCurrent() ? 'class="current"' : '';
    ?>
><?php 
    echo h($page->title);
    ?>
</a>