本文整理汇总了PHP中get_base_href函数的典型用法代码示例。如果您正苦于以下问题:PHP get_base_href函数的具体用法?PHP get_base_href怎么用?PHP get_base_href使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_base_href函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_mass_tagger
public function display_mass_tagger(Page $page, Event $event, $config)
{
$data_href = get_base_href();
$body = "\n\t\t\t<form action='" . make_link("mass_tagger/tag") . "' method='POST'>\n\t\t\t\t<input id='mass_tagger_activate' type='button' onclick='activate_mass_tagger(\"{$data_href}\");' value='Activate'/>\n\t\t\t\t<div id='mass_tagger_controls' style='display: none;'>\n\t\t\t\t\tClick on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images.\n\t\t\t\t\t<br />\n\t\t\t\t\t<input type='hidden' name='ids' id='mass_tagger_ids' />\n\t\t\t\t\tSet instead of add? <input type='checkbox' name='setadd' value='set' />\n\t\t\t\t\t<label>Tags: <input type='text' name='tag' /></label>\n\n\t\t\t\t\t<input type='submit' value='Tag Marked Images' />\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t";
$block = new Block("Mass Tagger", $body, "left", 50);
$page->add_block($block);
}
示例2: get_body
private function get_body()
{
// returns just the contents of the body
global $database;
global $config;
$base_href = $config->get_string('base_href');
$data_href = get_base_href();
$sitename = $config->get_string('title');
$contact_link = $config->get_string('contact_link');
$counter_dir = $config->get_string('home_counter', 'default');
$total = ceil($database->db->GetOne("SELECT COUNT(*) FROM images"));
$strtotal = "{$total}";
$num_comma = number_format($total);
$counter_text = "";
for ($n = 0; $n < strlen($strtotal); $n++) {
$cur = $strtotal[$n];
$counter_text .= " <img alt='{$cur}' src='{$data_href}/ext/home/counters/{$counter_dir}/{$cur}.gif' /> ";
}
// get the homelinks and process them
$main_links = $config->get_string('home_links');
$main_links = str_replace('$base', $base_href, $main_links);
$main_links = str_replace('[', "<a href='", $main_links);
$main_links = str_replace('|', "'>", $main_links);
$main_links = str_replace(']', "</a>", $main_links);
$main_text = $config->get_string('home_text');
return $this->theme->build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text);
}
示例3: get_body
private function get_body()
{
// returns just the contents of the body
global $database;
global $config;
$base_href = $config->get_string('base_href');
$data_href = get_base_href();
$sitename = $config->get_string('title');
$contact_link = $config->get_string('contact_link');
$counter_dir = $config->get_string('home_counter', 'default');
$total = Image::count_images();
$strtotal = "{$total}";
$num_comma = number_format($total);
$counter_text = "";
for ($n = 0; $n < strlen($strtotal); $n++) {
$cur = $strtotal[$n];
$counter_text .= " <img alt='{$cur}' src='{$data_href}/ext/home/counters/{$counter_dir}/{$cur}.gif' /> ";
}
// get the homelinks and process them
$main_links = $config->get_string('home_links');
$main_links = str_replace('$base', $base_href, $main_links);
$main_links = preg_replace('#\\[(.*?)\\|(.*?)\\]#', "<a href='\\1'>\\2</a>", $main_links);
$main_links = str_replace('//', "/", $main_links);
$main_text = $config->get_string('home_text');
return $this->theme->build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text);
}
示例4: display_image
public function display_image(Page $page, Image $image)
{
$data_href = get_base_href();
$ilink = $image->get_image_link();
$html = "\n\t\t\t<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'\n\t\t\t codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'\n\t\t\t\t\twidth='400' height='15'>\n\t\t\t\t<param name='movie' value='{$data_href}/ext/handle_mp3/xspf_player_slim.swf?song_url={$ilink}'/>\n\t\t\t\t<param name='quality' value='high' />\n\t\t\t\t<embed src='{$data_href}/ext/handle_mp3/xspf_player_slim.swf?song_url={$ilink}' quality='high'\n\t\t\t\t\tpluginspage='http://www.macromedia.com/go/getflashplayer'\n\t\t\t\t\twidth='400' height='15'\n\t\t\t\t\ttype='application/x-shockwave-flash'></embed>\n\t\t\t</object>\n\t\t\t<p><a href='{$ilink}'>Download</a>";
$page->add_block(new Block("Music", $html, "main", 0));
}
示例5: get_body
private function get_body()
{
// returns just the contents of the body
global $config;
$base_href = get_base_href();
$sitename = $config->get_string('title');
$contact_link = $config->get_string('contact_link');
$counter_dir = $config->get_string('home_counter', 'default');
$total = Image::count_images();
$strtotal = "{$total}";
$num_comma = number_format($total);
$counter_text = "";
$length = strlen($strtotal);
for ($n = 0; $n < $length; $n++) {
$cur = $strtotal[$n];
$counter_text .= " <img alt='{$cur}' src='{$base_href}/ext/home/counters/{$counter_dir}/{$cur}.gif' /> ";
}
// get the homelinks and process them
if (strlen($config->get_string('home_links', '')) > 0) {
$main_links = $config->get_string('home_links');
} else {
$main_links = '[url=site://post/list]Posts[/url] [url=site://comment/list]Comments[/url] [url=site://tags]Tags[/url]';
if (class_exists("Pools")) {
$main_links .= ' [url=site://pool]Pools[/url]';
}
if (class_exists("Wiki")) {
$main_links .= ' [url=site://wiki]Wiki[/url]';
}
$main_links .= ' [url=site://ext_doc]Documentation[/url]';
}
$main_links = format_text($main_links);
$main_text = $config->get_string('home_text');
return $this->theme->build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text);
}
示例6: do_rss
/**
* @param array $images
* @param array $search_terms
* @param int $page_number
*/
private function do_rss($images, $search_terms, $page_number)
{
global $page;
global $config;
$page->set_mode("data");
$page->set_type("application/rss+xml");
$data = "";
foreach ($images as $image) {
$data .= $this->thumb($image);
}
$title = $config->get_string('title');
$base_href = make_http(get_base_href());
$search = "";
if (count($search_terms) > 0) {
$search = url_escape(implode(" ", $search_terms)) . "/";
}
if ($page_number > 1) {
$prev_url = make_link("rss/images/{$search}" . ($page_number - 1));
$prev_link = "<atom:link rel=\"previous\" href=\"{$prev_url}\" />";
} else {
$prev_link = "";
}
$next_url = make_link("rss/images/{$search}" . ($page_number + 1));
$next_link = "<atom:link rel=\"next\" href=\"{$next_url}\" />";
// no end...
$version = VERSION;
$xml = "<" . "?xml version=\"1.0\" encoding=\"utf-8\" ?" . ">\n<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n <title>{$title}</title>\n <description>The latest uploads to the image board</description>\n\t\t<link>{$base_href}</link>\n\t\t<generator>Shimmie-{$version}</generator>\n\t\t<copyright>(c) 2007 Shish</copyright>\n\t\t{$prev_link}\n\t\t{$next_link}\n\t\t{$data}\n\t</channel>\n</rss>";
$page->set_data($xml);
}
示例7: __construct
function __construct($main)
{
$matches = array();
$lines = file($main);
$number_of_lines = count($lines);
preg_match("#ext/(.*)/main.php#", $main, $matches);
$this->ext_name = $matches[1];
$this->name = $this->ext_name;
$this->enabled = $this->is_enabled($this->ext_name);
for ($i = 0; $i < $number_of_lines; $i++) {
$line = $lines[$i];
if (preg_match("/Name: (.*)/", $line, $matches)) {
$this->name = $matches[1];
}
if (preg_match("/Visibility: (.*)/", $line, $matches)) {
$this->visibility = $matches[1];
}
if (preg_match("/Link: (.*)/", $line, $matches)) {
$this->link = $matches[1];
if ($this->link[0] == "/") {
$this->link = make_link(substr($this->link, 1));
}
}
if (preg_match("/Version: (.*)/", $line, $matches)) {
$this->version = $matches[1];
}
if (preg_match("/Author: (.*) [<\\(](.*@.*)[>\\)]/", $line, $matches)) {
$this->author = $matches[1];
$this->email = $matches[2];
} else {
if (preg_match("/Author: (.*)/", $line, $matches)) {
$this->author = $matches[1];
}
}
if (preg_match("/(.*)Description: ?(.*)/", $line, $matches)) {
$this->description = $matches[2];
$start = $matches[1] . " ";
$start_len = strlen($start);
while (substr($lines[$i + 1], 0, $start_len) == $start) {
$this->description .= " " . substr($lines[$i + 1], $start_len);
$i++;
}
}
if (preg_match("/(.*)Documentation: ?(.*)/", $line, $matches)) {
$this->documentation = $matches[2];
$start = $matches[1] . " ";
$start_len = strlen($start);
while (substr($lines[$i + 1], 0, $start_len) == $start) {
$this->documentation .= " " . substr($lines[$i + 1], $start_len);
$i++;
}
$this->documentation = str_replace('$site', make_http(get_base_href()), $this->documentation);
}
if (preg_match("/\\*\\//", $line, $matches)) {
break;
}
}
}
示例8: build_tagger
public function build_tagger(Page $page, $event)
{
// Initialization code
$base_href = get_base_href();
// TODO: AJAX test and fallback.
$page->add_html_header("<script src='{$base_href}/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null, "<script type='text/javascript'>\n\t\t\t\t\$( document ).ready(function() {\n\t\t\t\t\tTagger.initialize(" . $event->get_image()->id . ");\n\t\t\t\t});\n\t\t\t</script>", "main", 1000));
// Tagger block
$page->add_block(new Block(null, $this->html($event->get_image()), "main"));
}
示例9: onPageRequest
public function onPageRequest(PageRequestEvent $event)
{
global $page, $user;
// Adds header to enable chatbox
$root = get_base_href();
$yPath = make_http($root . "/ext/chatbox/");
$page->add_html_header("\n\t\t\t\t<script src=\"http://code.jquery.com/jquery-migrate-1.2.1.js\" type=\"text/javascript\"></script>\n\t\t\t\t<script src=\"{$root}/ext/chatbox/js/yshout.js\" type=\"text/javascript\"></script>\n\n\t\t\t\t<link rel=\"stylesheet\" href=\"{$root}/ext/chatbox/css/dark.yshout.css\" />\n\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tnickname = '{$user->name}';\n\t\t\t\t\tnew YShout({ yPath: '{$yPath}' });\n\t\t\t\t</script>\n\t\t", 500);
// loads the chatbox at the set location
$html = "<div id=\"yshout\"></div>";
$chatblock = new Block("Chatbox", $html, "main", 97);
$page->add_block($chatblock);
}
示例10: get_smarty_instance
/**
* @return Smarty Locally-usable Smarty instance.
*/
function get_smarty_instance()
{
$s = new Smarty();
$s->compile_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache'));
$s->cache_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache'));
$s->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates'));
$s->config_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates'));
$s->assign('domain', get_domain_name());
$s->assign('base_dir', get_base_dir());
$s->assign('base_href', get_base_href());
$s->assign('constants', get_defined_constants());
$s->assign('request', array('get' => $_GET));
return $s;
}
示例11: display_holiday
public function display_holiday($date)
{
global $page;
if ($date) {
$csssheet = "<link rel='stylesheet' href='" . get_base_href() . "/contrib/holiday/stylesheets/";
// April Fools
// Flips the entire page upside down!
// TODO: Make it possible for the user to turn this off!
if (date('d/m') == '01/04') {
$csssheet .= "aprilfools.css";
}
$csssheet .= "' type='text/css'>";
$page->add_html_header("{$csssheet}");
}
}
示例12: display_message
/**
* Display $message and exit
*
* @param string $message
*/
public function display_message($message)
{
global $config, $user, $page;
$theme_name = $config->get_string('theme');
$data_href = get_base_href();
$login_link = make_link("user_admin/login");
$auth = $user->get_auth_html();
$page->set_mode('data');
$page->set_code(503);
$page->set_data(<<<EOD
<html>
\t<head>
\t\t<title>Downtime</title>
\t\t<link rel="stylesheet" href="{$data_href}/themes/{$theme_name}/style.css" type="text/css">
\t</head>
\t<body>
\t\t<div id="downtime">
\t\t\t<section>
\t\t\t\t<h1><center>Down for Maintenance</center></h1>
\t\t\t\t<div id="message" class="blockbody">
\t\t\t\t\t{$message}
\t\t\t\t</div>
\t\t\t</section>
\t\t\t<section>
\t\t\t\t<h3>Admin Login</h3>
\t\t\t\t<div id="login" class="blockbody">
\t\t\t\t\t<form action="{$login_link}" method="POST">
\t\t\t\t\t\t{$auth}
\t\t\t\t\t\t<table id="login_table" summary="Login Form">
\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t<td width="70"><label for="user">Name</label></td>
\t\t\t\t\t\t\t\t<td width="70"><input id="user" type="text" name="user"></td>
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t<td><label for="pass">Password</label></td>
\t\t\t\t\t\t\t\t<td><input id="pass" type="password" name="pass"></td>
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr><td colspan="2"><input type="submit" value="Log In"></td></tr>
\t\t\t\t\t\t</table>
\t\t\t\t\t</form>
\t\t\t\t</div>
\t\t\t</section>
\t\t</div>
\t</body>
</html>
EOD
);
}
示例13: get_smarty_instance
/**
* @return Smarty Locally-usable Smarty instance.
*/
function get_smarty_instance()
{
$s = new Smarty();
$s->compile_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache'));
$s->cache_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates', 'cache'));
$s->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates'));
$s->config_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates'));
$s->register_modifier('url_domain', 'get_url_domain');
$s->register_modifier('nice_relative_time', 'get_relative_time');
$s->assign('domain', get_domain_name());
$s->assign('base_dir', get_base_dir());
$s->assign('base_href', get_base_href());
$s->assign('logo', '<img src="' . LOGO . '" />');
$s->assign('site_title', SITE_TITLE);
// $s->clear_all_cache();
return $s;
}
示例14: display_page
public function display_page()
{
global $config, $page;
$base_href = get_base_href();
$oekW = $config->get_int("oekaki_width", 400);
$oekH = $config->get_int("oekaki_height", 400);
if (isset($_POST['oekW']) && isset($_POST['oekH'])) {
$oekW = int_escape($_POST['oekW']);
$oekH = int_escape($_POST['oekH']);
}
$html = "\n <applet archive='{$base_href}/ext/oekaki/chibipaint.jar' code='chibipaint.ChibiPaint.class' width='800' height='600'>\n <param name='canvasWidth' value='" . $oekW . "' />\n <param name='canvasHeight' value='" . $oekH . "' />\n <param name='postUrl' value='" . make_http(make_link("oekaki/upload")) . "' />\n <param name='exitUrl' value='" . make_http(make_link("oekaki/claim")) . "' />\n <param name='exitUrlTarget' value='_self' />\n JAVA NOT INSTALLED :(<!-- alternative content for users who don't have Java installed -->\n </applet>\n\t\t";
# <param name='loadImage' value='http://yourserver/oekaki/pictures/168.png' />
# <param name='loadChibiFile' value='http://yourserver/oekaki/pictures/168.chi' />
// FIXME: prevent oekaki block from collapsing on click in cerctain themes. This causes canvas reset
$page->set_title("Oekaki");
$page->set_heading("Oekaki");
$page->add_block(new NavBlock());
$page->add_block(new Block("Oekaki", $html, "main", 20));
}
示例15: get_info
/**
* Collect the information and return it in a keyed array.
*/
private function get_info()
{
global $config, $database;
global $_event_listeners;
// yay for using secret globals \o/
$info = array();
$info['site_title'] = $config->get_string("title");
$info['site_theme'] = $config->get_string("theme");
$info['site_url'] = "http://" . $_SERVER["HTTP_HOST"] . get_base_href();
$info['sys_shimmie'] = VERSION;
$info['sys_schema'] = $config->get_string("db_version");
$info['sys_php'] = phpversion();
$info['sys_db'] = $database->get_driver_name();
$info['sys_os'] = php_uname();
$info['sys_disk'] = to_shorthand_int(disk_total_space("./") - disk_free_space("./")) . " / " . to_shorthand_int(disk_total_space("./"));
$info['sys_server'] = $_SERVER["SERVER_SOFTWARE"];
$info['thumb_engine'] = $config->get_string("thumb_engine");
$info['thumb_quality'] = $config->get_int('thumb_quality');
$info['thumb_width'] = $config->get_int('thumb_width');
$info['thumb_height'] = $config->get_int('thumb_height');
$info['thumb_mem'] = $config->get_int("thumb_mem_limit");
$info['stat_images'] = $database->get_one("SELECT COUNT(*) FROM images");
$info['stat_comments'] = $database->get_one("SELECT COUNT(*) FROM comments");
$info['stat_users'] = $database->get_one("SELECT COUNT(*) FROM users");
$info['stat_tags'] = $database->get_one("SELECT COUNT(*) FROM tags");
$info['stat_image_tags'] = $database->get_one("SELECT COUNT(*) FROM image_tags");
$els = array();
foreach (get_declared_classes() as $class) {
$rclass = new ReflectionClass($class);
if ($rclass->isAbstract()) {
// don't do anything
} elseif (is_subclass_of($class, "Extension")) {
$els[] = $class;
}
}
$info['sys_extensions'] = join(', ', $els);
//$cfs = array();
//foreach($database->get_all("SELECT name, value FROM config") as $pair) {
// $cfs[] = $pair['name']."=".$pair['value'];
//}
//$info[''] = "Config: ".join(", ", $cfs);
return $info;
}