header($title); $this->title($title); } /** * Draws a page title. * * @param $title * Page title; */ static function title($title) { if (php_sapi_name() == "cli") { echo "$title\n"; } else { echo "

$title

\n"; } } /** * Draws the page header. * * @param $title * Page title; */ static function header($title) { if (php_sapi_name() == "cli") { echo "$title\n"; } else { echo ''; echo ''; echo ''; echo ''; echo ''. $title .''; echo ''; echo ''; } } /** * Draws the page footer. */ static function footer() { if (php_sapi_name() != "cli") { echo ''; } } /** * Draws a form. * * @param $content * Form inner content. * * @param $action * Form action. * * @param $method * Form method. */ static function form($content, $action = 'index.php', $method = 'get') { if (php_sapi_name() != "cli") { echo '
'; echo $content; echo ''; echo '
'; echo '
'; } } /** * Draws a form text input. * * @param $name * Input name. * * @param $default * Default value. * * @return * Rendered text input. */ static function form_input_text($name, $default = null) { if (php_sapi_name() == "cli") { return; } if ($default) { $default = 'value="'. $default .'"'; } return ucfirst($name) .': '; } /** * Draws a navigation bar. * * @param $entry * Current entry. * * @param $entries * Total number of entries. * * @param $action * Page action. * * @param $extra * Extra parameters. */ static function navbar($entry, $entries, $action = 'index.php', $extra = NULL) { if (php_sapi_name() == "cli") { return; } // First / prev links. if ($entry != 1) { $prev = $entry - 1; echo 'first '; echo '< prev '; } // Next / last links. if ($entry < $entries) { $next = $entry + 1; echo 'next > '; echo 'last'; } } /** * Format a link. * * @param $action * Link action. * * @param $args * Action arguments. * * @param $title * Link title. * * @return * Formatted link. */ static function link($action, $args, $title) { if (php_sapi_name() != "cli") { return ''. $title .''; } } /** * Format an entry link. * * @param $entry * Entry number. * * @return * Formatted link. */ static function entry_link($entry) { if (php_sapi_name() != "cli") { return self::link('index.php', '?entry='. $entry, $entry); } } /** * Draws tags for opening a table. */ static function open_table() { if (php_sapi_name() != "cli") { echo ''; } } /** * Draws tags for closing a table. */ static function close_table() { if (php_sapi_name() != "cli") { echo '
'; } } /** * Draws a h2 element. * * @param $text * Inner text. */ static function h2($text) { if (php_sapi_name() == "cli") { echo "$text\n"; } else { echo "

$text

"; } } /** * Draws a h3 element. * * @param $text * Inner text. */ static function h3($text) { if (php_sapi_name() == "cli") { echo "$text\n"; } else { echo "

$text

"; } } /** * Draws a line break element. */ static function br() { if (php_sapi_name() == "cli") { echo "\n"; } else { echo "
"; } } /** * Draws a pre format block element. * * @param $text * Inner text. */ static function pre($text) { if (php_sapi_name() == "cli") { echo "$text\n"; } else { echo "
\n$text
"; } } }