本文整理汇总了PHP中Site::get_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::get_url方法的具体用法?PHP Site::get_url怎么用?PHP Site::get_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::get_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_theme_call_header
public function filter_theme_call_header($return, $theme)
{
if (User::identify() != FALSE) {
Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
}
return $return;
}
示例2: action_template_header
public function action_template_header($theme)
{
Stack::add('template_header_javascript', Site::get_url('scripts') . "/jquery.js", 'jquery');
Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.bigframe.js", 'jquery.bigframe', 'jquery');
Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.dimensions.js", 'jquery.dimensions', 'jquery');
Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.tooltip.js", 'jquery.tooltip', 'jquery');
}
示例3: get_all_data
/**
* Returns all theme information -- dir, path, theme.xml, screenshot url
* @return array An array of Theme data
**/
public static function get_all_data()
{
if ( !isset( self::$all_data ) ) {
foreach ( self::get_all() as $theme_dir => $theme_path ) {
$themedata = array();
$themedata['dir'] = $theme_dir;
$themedata['path'] = $theme_path;
$themedata['theme_dir'] = $theme_path;
$themedata['info'] = simplexml_load_file( $theme_path . '/theme.xml' );
if ( $themedata['info']->getName() != 'pluggable' || (string) $themedata['info']->attributes()->type != 'theme' ) {
$themedata['screenshot'] = Site::get_url( 'admin_theme' ) . "/images/screenshot_default.png";
$themedata['info']->description = '<span class="error">' . _t( 'This theme is a legacy theme that is not compatible with Habari ' ) . Version::get_habariversion() . '. <br><br>Please update your theme.</span>';
$themedata['info']->license = '';
}
else {
foreach ( $themedata['info'] as $name=>$value ) {
$themedata[$name] = (string) $value;
}
if ( $screenshot = Utils::glob( $theme_path . '/screenshot.{png,jpg,gif}', GLOB_BRACE ) ) {
$themedata['screenshot'] = Site::get_url( 'habari' ) . dirname( str_replace( HABARI_PATH, '', $theme_path ) ) . '/' . basename( $theme_path ) . "/" . basename( reset( $screenshot ) );
}
else {
$themedata['screenshot'] = Site::get_url( 'admin_theme' ) . "/images/screenshot_default.png";
}
}
self::$all_data[$theme_dir] = $themedata;
}
}
return self::$all_data;
}
示例4: get_bookmarklet
/**
* Create the bookmarklet that is appropriate for the client's User Agent
*
* @return array The array of actions to attach to the specified $plugin_id
*/
private function get_bookmarklet()
{
$admin_url = Site::get_url('admin');
$link_name = Options::get('title');
$bookmarklet = "\n\t\t<p>Bookmark this link to leave the page when quoting:\n\t\t<a href=\"javascript:var w=window,d=document,gS='getSelection';location.href='{$admin_url}/publish?quote='+encodeURIComponent((''+(w[gS]?w[gS]():d[gS]?d[gS]():d.selection.createRange().text)).replace(/(^\\s+|\\s+\$)/g,''))+'&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(d.title);\">Quote on {$link_name}</a>\n\t\t<br>\n\t\tBookmark this link to open a new tab or window when quoting:\n\t\t<a href=\"javascript:var w=window,d=document,gS='getSelection';window.open('{$admin_url}/publish?quote='+encodeURIComponent((''+(w[gS]?w[gS]():d[gS]?d[gS]():d.selection.createRange().text)).replace(/(^\\s+|\\s+\$)/g,''))+'&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(d.title));void(0);\">Quote on {$link_name}</a>\n\t\t</p>";
return $bookmarklet;
}
示例5: __static
/**
* Constructor for RenderCache
*
* Sets up paths and gets the list of groups from file
*/
public static function __static()
{
//Define the cache path and url
self::$cache_path = HABARI_PATH . '/' . self::$rel_cache_path;
self::$cache_url = Site::get_url('habari') . '/' . self::$rel_cache_path;
//If the cache directory doesn't exist, make it
if (!is_dir(self::$cache_path)) {
mkdir(self::$cache_path, 0755);
}
//Enable only if the cache directory now exists and is writable
self::$enabled = is_dir(self::$cache_path) && is_writeable(self::$cache_path);
//Give an error if the cache directory is not writable
if (!self::$enabled) {
Session::error(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled. The user, or group, which your web server is running as, needs to have read, write, and execute permissions on this directory."), self::$cache_path), 'RenderCache');
EventLog::log(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled."), self::$cache_path), 'notice', 'RenderCache', 'habari');
return;
}
//Get the list of group names
$group_file = self::get_group_list_file();
if (file_exists($group_file)) {
self::$group_list = unserialize(file_get_contents($group_file));
} else {
self::$group_list = array();
}
}
示例6: get_incoming_links
private function get_incoming_links()
{
$links = array();
try {
$search = new RemoteRequest('http://blogsearch.google.com/blogsearch_feeds?scoring=d&num=10&output=atom&q=link:' . Site::get_url('habari'));
$search->set_timeout(5);
$result = $search->execute();
if (Error::is_error($result)) {
throw $result;
}
$response = $search->get_response_body();
if (mb_detect_encoding($response, 'UTF-8', true)) {
$xml = new SimpleXMLElement($response);
foreach ($xml->entry as $entry) {
//<!-- need favicon discovery and caching here: img class="favicon" src="http://skippy.net/blog/favicon.ico" alt="favicon" / -->
$links[] = array('href' => (string) $entry->link['href'], 'title' => (string) $entry->title);
}
} else {
EventLog::log(_t('The response had non-UTF-8 characters'), 'err', 'plugin');
}
} catch (Exception $e) {
$links['error'] = $e->getMessage();
}
return $links;
}
示例7: parse_data
private static function parse_data($block, $data)
{
// Unserialize and manipulate the data
$flickrfeed = unserialize($data);
$flickrfeed = array_slice($flickrfeed['items'], 0, $block->image_count);
// Photo size
foreach ($flickrfeed as &$image) {
$image['image_sizes'] = array('thumbnail' => str_replace('_m.jpg', '_t.jpg', $image['m_url']), 'small' => $image['m_url'], 'medium' => $image['l_url'], 'medium_z' => str_replace('_m.jpg', '_z.jpg', $image['m_url']), 'large' => str_replace('_m.jpg', '_b.jpg', $image['m_url']), 'original' => $image['photo_url'], 'square' => $image['t_url'], 'default' => $image['t_url']);
if (isset($image['image_sizes'][$block->image_size])) {
$image['local_file'] = Site::get_dir('user', '/files/flickrfeed/' . $block->image_size . '/' . basename($image['image_sizes'][$block->image_size]));
$image['local_url'] = Site::get_url('user', '/files/flickrfeed/' . $block->image_size . '/' . basename($image['image_sizes'][$block->image_size]));
$image['image_url'] = $image['image_sizes'][$block->image_size];
} else {
$image['local_file'] = Site::get_dir('user', '/files/flickrfeed/default/' . basename($image['image_sizes']['default']));
$image['local_url'] = Site::get_url('user', '/files/flickrfeed/default/' . basename($image['image_sizes']['default']));
$image['image_url'] = $image['image_sizes']['default'];
}
if ($block->cache_locally) {
if (!file_exists($image['local_file'])) {
if (!file_exists(dirname($image['local_file']))) {
$umask = umask(0);
mkdir(dirname($image['local_file']), 0777, true);
umask($umask);
}
if (is_writable(dirname($image['local_file']))) {
file_put_contents($image['local_file'], file_get_contents($image['image_url']));
}
}
if (file_exists($image['local_file'])) {
$image['image_url'] = $image['local_url'];
}
}
}
return $flickrfeed;
}
示例8: SitemapBuild
public function SitemapBuild()
{
//return cached sitemap if exsist
if (Cache::has('sitemap')) {
$xml = Cache::get('sitemap');
} else {
$types = Options::get_group(__CLASS__);
//..or generate a new one
$xml = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="' . $this->get_url() . '/sitemap.xsl"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>';
$xml = new SimpleXMLElement($xml);
if (array_key_exists('any', $types) && $types['any'] || empty($types)) {
// Retrieve all published content, regardless of the type
$content['any'] = Posts::get(array('content_type' => 'any', 'status' => 'published', 'nolimit' => 1));
} else {
// Retreive all published content for select content types
$content['posts'] = Posts::get(array('content_type' => array_keys($types, 1), 'status' => 'published', 'nolimit' => 1));
}
// Add the index page first
$url = $xml->addChild('url');
$url_loc = $url->addChild('loc', Site::get_url('habari'));
// Generate the `<url>`, `<loc>`, `<lastmod>` markup for each post and page.
foreach ($content as $entries) {
foreach ($entries as $entry) {
$url = $xml->addChild('url');
$url_loc = $url->addChild('loc', $entry->permalink);
$url_lastmod = $url->addChild('lastmod', $entry->updated->get('c'));
}
}
$xml = $xml->asXML();
Cache::set('sitemap', $xml);
}
return $xml;
}
示例9: action_template_header
public function action_template_header($theme)
{
Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
Stack::add('template_header_javascript', Site::get_url('theme') . '/thickbox-compressed.js', 'thickbox');
Stack::add('template_header_javascript', Site::get_url('theme') . '/swfobject.js', 'swfobject');
Stack::add('template_header_javascript', Site::get_url('theme') . '/features.js', 'features');
Stack::add('template_stylesheet', array(Site::get_url('theme') . '/thickbox.css', 'screen'), 'thickbox');
}
示例10: action_init_theme_any
public function action_init_theme_any()
{
if ($this->show_sudo()) {
Stack::add('template_header_javascript', Site::get_url('vendor', '/jquery.js'), 'jquery');
Stack::add('template_header_javascript', Site::get_url('vendor', '/jquery-ui.min.js'), 'jquery-ui');
Stack::add('template_header_javascript', $this->get_url('/sudo.js'), 'sudo', 'jquery');
}
}
示例11: action_template_header
public function action_template_header($theme)
{
// Add the stylesheets to the stack for output
Stack::add('template_stylesheet', array(Site::get_url('theme') . '/style.css', 'screen'));
Stack::add('template_stylesheet', array(Site::get_url('theme') . '/print.css', 'print'));
Stack::add('template_header_javascript', 'jquery');
Stack::add('template_header_javascript', Site::get_url('them') . '/menu.js', 'select-menu', array('jquery'));
}
示例12: filter_post_comments
public function filter_post_comments(Comments $comments, Post $post)
{
$url = Site::get_url('habari', true) . $post->slug;
foreach (self::fetch_backtype($url) as $new) {
$comments[] = $new;
}
return $comments;
}
示例13: remove_template
public function remove_template()
{
Post::deactivate_post_type('poll');
$this->remove_template('widget', dirname(__FILE__) . '/widget.php');
Stack::remove('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
Stack::remove('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/widget.css', 'screen'), 'pollwigitcss');
$this->remove_template('poll.single', dirname(__FILE__) . '/poll.single.php');
}
示例14: action_init_theme
public function action_init_theme()
{
Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/magicarchives.css', 'screen'), 'magicarchives');
Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/magicarchives.js', 'magicarchives', array('jquery', 'ajax_manager'));
Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/ajax_manager.js', 'ajax_manager', 'jquery');
Stack::add('template_header_javascript', 'magicArchives.endpoint=\'' . URL::get('ajax', array('context' => 'archive_posts')) . '\'', 'magicurl', 'magicarchives');
}
示例15: action_add_prettyphoto_template
public function action_add_prettyphoto_template()
{
$social_string = Options::get(__CLASS__ . 'hide_social', false) ? "{social_tools:false}" : "";
Stack::add('template_header_javascript', Site::get_url('vendor') . '/jquery.js', 'jquery');
Stack::add('template_stylesheet', array($this->get_url() . '/css/prettyPhoto.css', 'screen'));
Stack::add('template_header_javascript', $this->get_url() . '/js/jquery.prettyPhoto.js', 'prettyphoto', 'jquery');
$init_string = "\$(document).ready(function(){ \$(\"a[rel^='prettyPhoto']\").prettyPhoto(" . $social_string . ");});";
Stack::add('template_header_javascript', $init_string, 'prettyphoto_init', 'prettyphoto');
}