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

static public url ( )
Пример #1
0
    static function will_handle_req()
    {
        if (!gb::$is_feed) {
            return;
        }
        $allowed_ips = self::$conf['allowed_ips'];
        if (!$allowed_ips) {
            $allowed_ips = array();
        } elseif (!is_array($allowed_ips)) {
            $allowed_ips = array($allowed_ips);
        }
        $isfb = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'FeedBurner/') !== false;
        if ($isfb === false and in_array($_SERVER['REMOTE_ADDR'], $allowed_ips) === false and !isset($_GET['original-feed'])) {
            # we send an atom feed as response for clients which do not follow redirects
            $site_title = h(gb::$site_title);
            $curr_url = h(gb::url()->__toString());
            $site_url = h(gb::$site_url);
            $url = h(self::$conf['url']);
            $mdate = @filemtime(self::$conf->storage()->file);
            $mdate = date('c', $mdate ? $mdate : time());
            $s = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en" xml:base="{$site_url}">
\t<id>{$curr_url}</id>
\t<title>{$site_title}</title>
\t<link rel="alternate" type="application/atom+xml" href="{$url}" />
\t<link rel="alternate" type="text/html" href="{$site_url}" />
\t<updated>{$mdate}</updated>
\t<entry>
\t\t<title type="html">This feed has moved</title>
\t\t<link rel="alternate" type="application/atom+xml" href="{$url}" />
\t\t<id>{$url}</id>
\t\t<published>{$mdate}</published>
\t\t<updated>{$mdate}</updated>
\t\t<content type="html"><![CDATA[
\t\t\t<p>This feed has moved to <a href="{$url}">{$url}</a>.</p>
\t\t\t<p>You see this because your feed client does not support automatic redirection.</p>
\t\t]]></content>
\t</entry>
</feed>

XML;
            header('HTTP/1.1 301 Moved Permanently');
            header('Location: ' . self::$conf['url']);
            header('Content-Length: ' . strlen($s));
            header('Content-Type: application/atom+xml; charset=utf-8');
            exit($s);
        }
    }
Пример #2
0
					title="How and where to download Smisk">downloads</a></li>
				<li><a href="http://github.com/rsms/smisk/issues"
					title="List of all the horrible bugs... or wait a minute... no bugs?!">issues</a></li>
				<li><a href="http://github.com/rsms/smisk/tree/master"
					title="The master repository at GitHub, including all source code and information about the current development process">code</a></li>
			</ul>
		</div>
		<?php 
if (gb::$is_page && !gb::$is_404) {
    require '_page.php';
} else {
    ?>
			<div id="error404">
				<div class="wrapper">
					<h1>404 Not Found</h1>
					The page <b><?php 
    echo h(gb::url()->toString(false));
    ?>
</b> does not exist.
				</div>
			</div>
			<?php 
}
?>

	<?php 
gb_footer();
?>
	</body>
</html>
Пример #3
0
?>
	<body>
		<div id="head">
			<?php 
if (gb::$authorized) {
    ?>
			<div class="user">
				Logged in as <?php 
    echo h(gb::$authorized);
    ?>
 &mdash;
				<a href="<?php 
    echo gb_admin::$url;
    ?>
helpers/deauthorize.php?referrer=<?php 
    echo urlencode(gb::url());
    ?>
">Log out</a>
			</div>
			<?php 
}
?>
			<h1>
				<a href="<?php 
echo gb::$site_url;
?>
"><?php 
echo h(gb::$site_title);
?>
 <span class="note">‹ visit site</span></a>
			</h1>
Пример #4
0
 function render_menu($menu_disabled = false, $items = null, $baseurl = null, $currurlpath = null, $liststart = '<ul>', $listend = '</ul>')
 {
     if ($items === null) {
         $items = self::$menu;
     }
     if ($baseurl === null) {
         $baseurl = gb_admin::$url;
     }
     if ($currurlpath === null) {
         $currurlpath = gb::url()->path;
     }
     $accesskey_prefix = '';
     $is_osx = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac OS X') !== false;
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false) {
         if ($is_osx) {
             $accesskey_prefix = '&#x2303;&#x2325;';
         }
     }
     $s = $liststart;
     foreach ($items as $k => $item) {
         $uri = $url = '';
         $is_curr = $is_todo = false;
         $accesskey = is_string($k) ? strtoupper($k) : '';
         if (isset($item[1]) && is_string($item[1])) {
             $uri = $item[1];
             $url = $uri && ($uri[0] === '/' || strpos($uri, '://') !== false) ? $uri : $baseurl . $uri;
             $url_st = GBURL::parse($url);
             $actual_currpath = $url_st->path;
             $is_todo = strpos($url_st->fragment, 'todo:') === 0;
             $is_curr = !$is_todo && $actual_currpath === substr($currurlpath, 0, strlen($actual_currpath));
             if ($uri === '') {
                 $is_curr = gb::url()->path === GBURL::parse(gb_admin::$url)->path;
             }
         }
         $dom_id = $uri ? gb_strtodomid(gb_filenoext($item[1])) : $k;
         $s .= '<li id="menu-item-' . $dom_id . '"';
         $css_class = '';
         if ($is_curr) {
             $css_class .= 'selected';
             self::$current_domid = $dom_id;
         }
         if ($is_todo) {
             $css_class .= ' todo';
         }
         if ($css_class) {
             $s .= ' class="' . $css_class . '"';
         }
         $s .= '><a';
         if ($url && !$is_todo && !$menu_disabled) {
             $s .= ' href="' . h($url) . '"';
         }
         if ($accesskey && !$menu_disabled) {
             $s .= ' accesskey="' . $accesskey . '"';
         }
         $s .= '><span class="title">' . h($item[0]) . '</span>';
         if ($accesskey && !$menu_disabled) {
             $s .= '<span class="accesskey-hint">' . $accesskey_prefix . $accesskey . '</span>';
         }
         $s .= '</a>';
         if (isset($item[2]) && $item[2]) {
             $s .= self::render_menu($menu_disabled, $item[2], $baseurl, $currurlpath, $liststart, $listend);
         }
         $s .= '</li>';
     }
     $s .= $listend;
     return $s;
 }
Пример #5
0
 function _bounceURL($relpath, $post = null, $include_referrer = true)
 {
     $post = $this->_post($post);
     if ($this->id === null) {
         throw new UnexpectedValueException('$this->id is null');
     }
     $object = strpos(gb::$content_cache_fnext, '.') !== false ? gb_filenoext($post->cachename()) : $post->cachename();
     return gb::$site_url . $relpath . 'object=' . urlencode($object) . '&comment=' . $this->id . ($include_referrer ? '&referrer=' . urlencode(gb::url()) : '');
 }
Пример #6
0
$updated_time = $postspage->posts ? $postspage->posts[0]->modified->time : time();
header('Content-Type: application/atom+xml; charset=utf-8');
header('Last-Modified: ' . date('r', $updated_time));
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0"
      xmlns:gb="http://gitblog.se/ns/atom/1.0"
      xml:lang="en"
      xml:base="<?php 
echo h(gb::$site_url);
?>
">
	<id><?php 
echo h(gb::url());
?>
</id>
	<title><?php 
echo h(gb::$site_title);
?>
</title>
	<link rel="alternate" type="text/html" href="<?php 
echo h(gb::$site_url);
?>
" />
	<updated><?php 
echo date('c', $updated_time);
?>
</updated>
	<generator uri="http://gitblog.se/" version="<?php 
Пример #7
0
	};
	$(function(){
		// give username or password field focus when dom has loaded
		var username = $('#chap-username').get(0);
		var password = $('#chap-password').get(0);
		if (username.value.length)
			password.select();
		else
			username.select();
	});
	//]]>
</script>
<div id="content" class="authorize margins">
	<h2>Authorize</h2>
	<form action="<?php 
echo gb::url();
?>
" method="post" 
		onsubmit="chap.submit('<?php 
echo $auth->nonce();
?>
','<?php 
echo $auth->opaque();
?>
','<?php 
echo $auth->context;
?>
')">
		<div>
			<input type="hidden" id="chap-response" name="chap-response" value="" />
		</div>