find() static public method

static public find ( $uri_path_or_slug, $version = null, $applyBodyFilters = true )
示例#1
0
$gb_handle_request = true;
require 'gitblog/gitblog.php';
class smisk
{
    public static $stable_version = '1.1.6';
    public static $main_repo_url = 'git://github.com/rsms/smisk.git';
    public static $pgp_key = '431B61D0';
}
# this overrides some or all values if smisk::
GBPage::find('config')->body();
# / defaults to about page
if ($gb_request_uri === '') {
    gb::$is_page = true;
    gb::$is_posts = false;
    $gb_request_uri = 'about';
    $post = GBPage::find('about');
}
function selected($startswith)
{
    global $gb_request_uri;
    if (strpos($gb_request_uri, $startswith) === 0) {
        return 'class="selected"';
    }
    return '';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<meta id="viewport" name="viewport" content="width=320; initial-scale=1.0; maximum-scale=2.0; minimum-scale=1.0; user-scalable=1;" />
示例#2
0
文件: content.php 项目: rsms/gitblog
 /** Handle object */
 function onObject($name, $id)
 {
     if (substr($name, 0, 14) !== 'content/pages/') {
         return false;
     }
     $slug = gb_fnsplit(substr($name, 14));
     $fnext = $slug[1];
     $slug = $slug[0];
     # comment or page?
     if ($fnext === 'comments') {
         $obj = $this->_onComment($name, $id, GBPage::mkCachename($slug));
     } else {
         $obj = $this->_onObject(GBPage::find($slug), 'GBPage', $name, $id, $slug);
     }
     return true;
 }
示例#3
0
文件: posts.php 项目: rsms/gitblog
<!-- ========================== top columns/info ========================== -->
<?php 
if (gb::$is_posts) {
    ?>
<div id="summary" class="columns c3">
	<div class="wrapper">
		<div class="col">
		<?php 
    if ($snippet = GBPage::find('about/intro')) {
        ?>
			<h2><?php 
        echo h($snippet->title);
        ?>
</h2>
			<?php 
        echo $snippet->body();
        ?>
		<?php 
    }
    ?>
		</div>
		<div class="col recent-posts">
			<h2>Recent posts</h2>
			<ol>
				<?php 
    foreach ($postspage->posts as $rank => $post) {
        if ($post->published->time > $time_now) {
            continue;
        }
        if ($rank === 6) {
            break;
示例#4
0
文件: gitblog.php 项目: rsms/gitblog
             } else {
                 $post = GBPage::find(urldecode($gb_request_uri), $version);
             }
             if ($post !== false) {
                 gb::$title[] = $post->title;
                 gb::$is_404 = false;
             }
             gb::$is_post = false;
             gb::$is_page = true;
         }
     } else {
         # page
         if ($preview_pathspec !== null) {
             $post = GBPage::findByName($preview_pathspec, $version);
         } else {
             $post = GBPage::find(urldecode($gb_request_uri), $version);
         }
         if ($post === false) {
             gb::$is_404 = true;
         } else {
             gb::$title[] = $post->title;
         }
         gb::$is_page = true;
     }
     # post 404?
     if (isset($post) && $post && gb::$is_preview === false && ($post->draft === true || $post->published->time > time())) {
         gb::$is_404 = true;
     }
 } else {
     # posts
     $postspage = GBPost::pageByPageno(isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0);