コード例 #1
0
ファイル: Resources.php プロジェクト: axiixc/elemental
                exLog('SharedPage->Initialize(): No pages, initializing with no identifiers.');
            }
        } else {
            exLog('SharedPage->Initialize(): Error fetching page identifiers.');
        }
    }
    public static function Fetch($offset = 0, $count = 30, $full = false, $drafts = false)
    {
        $data_source = $drafts ? $identifiers_all : $identifiers;
        for ($i = $offset; $i < $count; $i++) {
            $output[] = $full ? new Page($data_source[$i]['id']) : $data_source[$i]['id'];
        }
        return $output;
    }
}
SharedPage::Initialize();
class Page
{
    public $read_only;
    public $id, $name, $content, $author = array(), $date_modified, $date_created, $draft;
    public function __construct($page_id, $read_only = true)
    {
        exMethod("Page: Initializing with input({$page_id})");
        $this->read_only = $read_only;
        /* The "try to fetch" Block */
        // Try with Identifier
        exMethod("Page: Trying 'fetch with id'");
        $_page = query(SharedPage::$statements['fetch_with_id'], $page_id);
        // Try with Reference Identifier
        if (mysql_num_rows($_page) != 1) {
            exMethod("Page: Trying 'fetch with ref'");
コード例 #2
0
ファイル: Application.php プロジェクト: axiixc/elemental
<?php

# Pages Application
if (!is_null($_GET['arg']) and $_GET['arg'] != '') {
    exMethod("Pages: View -> Single Page with ID {$_GET['arg']}");
    $page = new Page(mysql_safe($_GET['arg']), true);
    if (!is_null($page->id)) {
        add(template('Single Page', 'Page Name: %1$s<br />Date Mod: %3$s | Date Created: %4$s<br />Author: %7$s<br /><pre style="color:green">%2$s</pre>'), $page->name, $page->content, format_date($page->date_modified), format_date($page->date_created), $page->author->id, $page->author->username, $page->author->display_name);
    } else {
        error('Page Not Found', 'You entered an invalid page.');
    }
} else {
    exMethod("Pages: View -> List with offset({$_GET['offset']}) and count({$_GET['count']})");
    $pages = SharedPage::Fetch(mysql_safe($_GET['offset']), mysql_safe($_GET['count']), true);
    // DONT CARE YET
}