当前位置: 首页>>代码示例>>PHP>>正文


PHP url::base方法代码示例

本文整理汇总了PHP中url::base方法的典型用法代码示例。如果您正苦于以下问题:PHP url::base方法的具体用法?PHP url::base怎么用?PHP url::base使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在url的用法示例。


在下文中一共展示了url::base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index($feedtype = 'rss2')
 {
     if (!Kohana::config('settings.allow_feed')) {
         throw new Kohana_404_Exception();
     }
     if ($feedtype != 'atom' and $feedtype != 'rss2') {
         throw new Kohana_404_Exception();
     }
     // How Many Items Should We Retrieve?
     $limit = (isset($_GET['l']) and !empty($_GET['l']) and (int) $_GET['l'] <= 200) ? (int) $_GET['l'] : 20;
     // Start at which page?
     $page = (isset($_GET['p']) and !empty($_GET['p']) and (int) $_GET['p'] >= 1) ? (int) $_GET['p'] : 1;
     $page_position = $page == 1 ? 0 : $page * $limit;
     // Query position
     $site_url = url::base();
     // Cache the Feed with subdomain in the cache name if mhi is set
     $subdomain = '';
     if (substr_count($_SERVER["HTTP_HOST"], '.') > 1 and Kohana::config('config.enable_mhi') == TRUE) {
         $subdomain = substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], '.'));
     }
     $cache = Cache::instance();
     $feed_items = $cache->get($subdomain . '_feed_' . $limit . '_' . $page);
     if ($feed_items == NULL) {
         // Cache is Empty so Re-Cache
         $incidents = ORM::factory('incident')->where('incident_active', '1')->orderby('incident_date', 'desc')->limit($limit, $page_position)->find_all();
         $items = array();
         foreach ($incidents as $incident) {
             $categories = array();
             foreach ($incident->category as $category) {
                 $categories[] = (string) $category->category_title;
             }
             $item = array();
             $item['id'] = $incident->id;
             $item['title'] = $incident->incident_title;
             $item['link'] = $site_url . 'reports/view/' . $incident->id;
             $item['description'] = $incident->incident_description;
             $item['date'] = $incident->incident_date;
             $item['categories'] = $categories;
             if ($incident->location_id != 0 and $incident->location->longitude and $incident->location->latitude) {
                 $item['point'] = array($incident->location->latitude, $incident->location->longitude);
                 $items[] = $item;
             }
         }
         $cache->set($subdomain . '_feed_' . $limit . '_' . $page, $items, array('feed'), 3600);
         // 1 Hour
         $feed_items = $items;
     }
     $feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/';
     header('Content-Type: application/' . ($feedtype == 'atom' ? 'atom' : 'rss') . '+xml; charset=utf-8');
     $view = new View('feed/' . $feedtype);
     $view->feed_title = Kohana::config('settings.site_name');
     $view->site_url = $site_url;
     $view->georss = 1;
     // this adds georss namespace in the feed
     $view->feed_url = $site_url . $feedpath;
     $view->feed_date = gmdate("D, d M Y H:i:s T", time());
     $view->feed_description = Kohana::lang('ui_admin.incident_feed') . ' ' . Kohana::config('settings.site_name');
     $view->items = $feed_items;
     $view->render(TRUE);
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:60,代码来源:feed.php

示例2: add

 /**
  * Adds all the events to the main Ushahidi application
  */
 public function add()
 {
     $session = Session::instance();
     // Has user switched to Full Website?
     if (isset($_GET['full']) and $_GET['full'] == 1) {
         // Create the Full website session
         $session->set('full', 1);
     }
     if (!$session->get('full')) {
         //error_log($_GET['full']);
         // If Mobile Configure Mobile Settings
         if (isset($_SERVER['HTTP_USER_AGENT']) and !$this->_is_keitai() and $this->_is_mobile() and strrpos(url::current(), "mobile") === FALSE and strrpos(url::current(), "page/index/9") === FALSE and strrpos(url::current(), "contact") === FALSE and strrpos(url::current(), "alerts/verify") === FALSE and Router::$controller != 'api') {
             // Only add the events if we are on that controller
             $request_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
             $replace_url1 = "http://" . $_SERVER["HTTP_HOST"] . "/ushahidi/mobile/";
             $replace_url2 = "http://" . $_SERVER["HTTP_HOST"] . "/mobile/";
             if (strpos($request_url, "ushahidi") === false) {
                 $url = str_replace("http://" . $_SERVER["HTTP_HOST"] . "/", $replace_url2, $request_url);
             } else {
                 $url = str_replace(url::base(), $replace_url1, $request_url);
             }
             //url::redirect(url::base()."mobile");
             url::redirect($url);
         }
     }
 }
开发者ID:nastasio,项目名称:Ushahidi_Web,代码行数:29,代码来源:mobile.php

示例3: add_device_history

 /**
  * 增加设备上传文件历史
  * @param string $md5 MD5
  * @param string $guid GUID
  * @param int $client_id 来源
  * @return Database_Result
  */
 public function add_device_history($md5, $guid, $client_id)
 {
     $this->url = url::base(FALSE) . 'graph/download/' . $md5;
     $this->guid = $guid;
     $this->result = $this->db->insert('cs_contact_device_history', array('file_md5' => $md5, 'guid' => $guid, 'client_id' => $client_id, 'dateline' => time()));
     return $this->result;
 }
开发者ID:momoim,项目名称:momo-api,代码行数:14,代码来源:graph.php

示例4: AvailLink

 public static function AvailLink($hostname, $servicedesc, $start, $end)
 {
     $config = new Config_Model();
     $config->read_config();
     $hostname = urlencode($hostname);
     $servicedesc = urlencode($servicedesc);
     $smon = date('m', $start);
     $sday = date('d', $start);
     $syear = date('Y', $start);
     $shour = date('G', $start);
     $smin = date('i', $start);
     $ssec = date('s', $start);
     $emon = date('m', $end);
     $eday = date('d', $end);
     $eyear = date('Y', $end);
     $ehour = date('G', $end);
     $emin = date('i', $end);
     $esec = date('s', $end);
     $nagios_base = $config->conf['nagios_base'];
     if ($servicedesc == "Host+Perfdata") {
         print "<a href=\"{$nagios_base}/avail.cgi?show_log_entries=&host={$hostname}&timeperiod=custom&smon={$smon}&sday={$sday}&syear={$syear}&shour={$shour}&smin={$smin}&ssec={$ssec}&emon={$emon}&eday={$eday}&eyear={$eyear}&ehour={$ehour}&emin={$emin}&esec={$esec}&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedservicestate=6&backtrack=4\"";
     } else {
         print "<a href=\"{$nagios_base}/avail.cgi?show_log_entries=&host={$hostname}&service={$servicedesc}&timeperiod=custom&smon={$smon}&sday={$sday}&syear={$syear}&shour={$shour}&smin={$smin}&ssec={$ssec}&emon={$emon}&eday={$eday}&eyear={$eyear}&ehour={$ehour}&emin={$emin}&esec={$esec}&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedservicestate=6&backtrack=4\"";
     }
     print " title=\"" . Kohana::lang('common.nagios-avail-link-title') . "\"><img src=\"" . url::base() . "media/images/trends.gif\" ></a>\n";
 }
开发者ID:rbarraud,项目名称:pnp4nagios,代码行数:26,代码来源:nagios.php

示例5: layer

    /**
     * Read in new layer KML via file_get_contents
     * @param int $layer_id - ID of the new KML Layer
     */
    public function layer($layer_id = 0)
    {
        $this->template = "";
        $this->auto_render = FALSE;

        $layer = ORM::factory('layer')
            ->where('layer_visible', 1)
            ->find($layer_id);

        if ($layer->loaded)
        {
            $layer_url = $layer->layer_url;
            $layer_file = $layer->layer_file;

            $layer_link = (!$layer_url) ?
                url::base().Kohana::config('upload.relative_directory').'/'.$layer_file :
                $layer_url;

            $content = file_get_contents($layer_link);

            if ($content !== false)
            {
                echo $content;
            }
            else
            {
                echo "";
            }
        }
        else
        {
            echo "";
        }
    }
开发者ID:rindou240,项目名称:Ushahidi_Web,代码行数:38,代码来源:bigmap_json.php

示例6: testSiteProtocol

 /**
  * Tests the protocol in $config['site_protocol'] against the URL
  */
 public function testSiteProtocol()
 {
     // Build the regular expression for site protocol
     $site_protocol = '/' . Kohana::config('core.site_protocol') . ':\\/\\//';
     // Check if the url base contains the site protocol
     $this->assertRegExp($site_protocol, url::base());
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:10,代码来源:Hook_Https_Check_Test.php

示例7: header

 public static function header($page = array())
 {
     $page['js'] = array_merge(array('jquery' => url::common() . '/js/jquery.js', 'plugins' => url::common() . '/js/jquery.plugins.js', 'zotop' => url::common() . '/js/zotop.js'), (array) $page['js']);
     $page['css'] = array_merge(array('zotop' => url::theme() . '/css/zotop.css', 'global' => url::theme() . '/css/global.css'), (array) $page['css']);
     $page = self::settings($page);
     $html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
     $html[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
     $html[] = '<head>';
     $html[] = '	<title>' . $page['title'] . ' Powered by ' . zotop::config("zotop.title") . '</title>';
     $html[] = self::meta($page['meta']);
     $html[] = self::stylesheet($page['css']);
     $html[] = self::script($page['js']);
     $html[] = '	' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon'));
     $html[] = '	' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'icon', 'type' => 'image/x-icon'));
     $html[] = '	' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon'));
     $html[] = '	<script type="text/javascript">';
     $html[] = '		zotop.url.base = "' . url::base() . '";';
     $html[] = '		zotop.url.common = "' . url::common() . '";';
     $html[] = '		zotop.page.id = "' . page::id() . '";';
     $html[] = '		zotop.user.id =0;';
     $html[] = '		zotop.user.username = "";';
     $html[] = '	</script>';
     $html[] = '</head>';
     $html[] = '<body' . html::attributes($page['body']) . '>';
     $html[] = '<div id="wrapper">';
     $html[] = '';
     $str = implode("\n", $html);
     echo $str;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:29,代码来源:page.php

示例8: render

	public static function render($type)
	{
		$files = $type.'s';
		
		$html = '';

		foreach (self::$$files as $key => $file)
		{
			switch ($type)
			{
				case 'stylesheet':
					if (substr_compare($file, '.css', -3, 3, FALSE) !== 0)
					{
						// Add the javascript suffix
						$file .= '.css';
					}
					$html .= '<link rel="stylesheet" type="text/css" href="'.url::base()."plugins/".$file.'" />';
					break;
				case 'javascript':
					if (substr_compare($file, '.js', -3, 3, FALSE) !== 0)
					{
						// Add the javascript suffix
						$file .= '.js';
					}
					$html .= '<script type="text/javascript" src="'.url::base()."plugins/".$file.'"></script>';
					break;
			}
		}
		
		return $html;
	}
开发者ID:rindou240,项目名称:Ushahidi_Web,代码行数:31,代码来源:plugin.php

示例9: login

    public function login()
    {
        // user is logged in....
        if (Auth::instance()->logged_in()) {
            echo 'u are logged in.... <a href="' . url::base() . 'login/logout">Logout</a>';
        } else {
            echo '
				<a href="' . url::base() . 'login_test/create">Click here to create a user</a><br><br>
				Login form:<br>
				<form method="post" action="' . url::base() . 'login_test/login">
				name:<input type="text" name="username"><br>
				pass:<input type="text" name="password"><br>
				<input type="submit" value="login">
				</form>
			';
            $form = $_POST;
            if ($form) {
                // Load the user
                $user = ORM::factory('user', $form['username']);
                // orm user object or $form['username'] could be used
                if (Auth::instance()->login($user, $form['password'])) {
                    // Login successful, redirect
                    // or do some other things u like
                    url::redirect('login_test/login');
                } else {
                    echo 'login_failed Invalid username or password.';
                }
            }
        }
    }
开发者ID:bicho44,项目名称:imglistados,代码行数:30,代码来源:loginlogin.php

示例10: notify_admins

 public function notify_admins($subject = NULL, $message = NULL)
 {
     // Don't show the exceptions for this operation to the user. Log them
     // instead
     try {
         if ($subject && $message) {
             $settings = kohana::config('settings');
             $from = array();
             $from[] = $settings['site_email'];
             $from[] = $settings['site_name'];
             $users = ORM::factory('user')->where('notify', 1)->find_all();
             foreach ($users as $user) {
                 if ($user->has(ORM::factory('role', 'admin'))) {
                     $address = $user->email;
                     $message .= "\n\n\n\n~~~~~~~~~~~~\n" . Kohana::lang('notifications.admin_footer') . "\n" . url::base() . "\n\n" . Kohana::lang('notifications.admin_login_url') . "\n" . url::base() . "admin";
                     if (!email::send($address, $from, $subject, $message, FALSE)) {
                         Kohana::log('error', "email to {$address} could not be sent");
                     }
                 }
             }
         } else {
             Kohana::log('error', "email to {$address} could not be sent\n\t\t\t\t - Missing Subject or Message");
         }
     } catch (Exception $e) {
         Kohana::log('error', "An exception occured " . $e->__toString());
     }
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:27,代码来源:notifications.php

示例11: register

 /**
  * Loads ushahidi themes
  */
 public function register()
 {
     // Array to hold all the CSS files
     $theme_css = array();
     // 1. Load the default theme
     Kohana::config_set('core.modules', array_merge(array(THEMEPATH . "default"), Kohana::config("core.modules")));
     $css_url = Kohana::config("cache.cdn_css") ? Kohana::config("cache.cdn_css") : url::base();
     // HACK: don't include the default style.css if using the ccnz theme
     if (Kohana::config("settings.site_style") != "ccnz") {
         $theme_css[] = $css_url . "themes/default/css/style.css";
     }
     // 2. Extend the default theme
     if (Kohana::config("settings.site_style") != "default") {
         $theme = THEMEPATH . Kohana::config("settings.site_style");
         Kohana::config_set('core.modules', array_merge(array($theme), Kohana::config("core.modules")));
         if (is_dir($theme . '/css')) {
             $css = dir($theme . '/css');
             // Load all the themes css files
             while (($css_file = $css->read()) !== FALSE) {
                 if (preg_match('/\\.css/i', $css_file)) {
                     $theme_css[] = url::base() . "themes/" . Kohana::config("settings.site_style") . "/css/" . $css_file;
                 }
             }
         }
     }
     Kohana::config_set('settings.site_style_css', $theme_css);
 }
开发者ID:redspider,项目名称:Ushahidi_Web,代码行数:30,代码来源:register_themes.php

示例12: login

 public function login()
 {
     // Load the view
     $view = new view(url::location());
     // populate the post information if it exists
     $view->post = array();
     // assign the form post information, if it exists
     $view->post['unique'] = isset($this->post['unique']) ? $this->post['unique'] : '';
     // HAXXX
     $view->title = 'Spicers | Admin Login';
     $view->base_href = isset($this->base_href) ? $this->base_href : 'http://' . $_SERVER['HTTP_HOST'] . url::base();
     if ($this->notification->count()) {
         $view->notifications = View::factory('templates/notification_ajax', array('notifications' => $this->notification->get()));
     }
     $this->auth = new Security();
     if ($this->auth->logged_in()) {
         // note if they do not have access to the dashboard and they are signed in, this will
         // start an infinate loop. @todo fix this. maybe just a check to see if they have access
         // before the redirect - jpeake
         url::redirect('home');
         die;
     }
     echo $view;
     die;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:25,代码来源:account.php

示例13: index

 public function index($feedtype = 'rss2')
 {
     if (!Kohana::config('settings.allow_feed')) {
         throw new Kohana_404_Exception();
     }
     if ($feedtype != 'atom' and $feedtype != 'rss2') {
         throw new Kohana_404_Exception();
     }
     $feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/';
     $site_url = url::base();
     $incidents = ORM::factory('incident')->where('incident_active', '1')->orderby('incident_date', 'desc')->limit(20)->find_all();
     $items = array();
     foreach ($incidents as $incident) {
         $item = array();
         $item['title'] = $incident->incident_title;
         $item['link'] = $site_url . 'reports/view/' . $incident->id;
         $item['description'] = $incident->incident_description;
         $item['date'] = $incident->incident_date;
         if ($incident->location_id != 0 and $incident->location->longitude and $incident->location->latitude) {
             $item['point'] = array($incident->location->latitude, $incident->location->longitude);
             $items[] = $item;
         }
     }
     header("Content-Type: text/xml; charset=utf-8");
     $view = new View('feed_' . $feedtype);
     $view->feed_title = htmlspecialchars(Kohana::config('settings.site_name'));
     $view->site_url = $site_url;
     $view->georss = 1;
     // this adds georss namespace in the feed
     $view->feed_url = $site_url . $feedpath;
     $view->feed_date = gmdate("D, d M Y H:i:s T", time());
     $view->feed_description = 'Incident feed for ' . Kohana::config('settings.site_name');
     $view->items = $items;
     $view->render(TRUE);
 }
开发者ID:sclode,项目名称:Ushahidi_Web,代码行数:35,代码来源:feed.php

示例14: show

 /**
  * Methode : page de détail d'un article
  */
 public function show($idActualite = FALSE)
 {
     if (!$idActualite || !is_numeric($idActualite)) {
         return parent::redirect_erreur('articles');
     }
     cookie::set('UserFilesPath', url::base() . '../images/articles/' . $idActualite);
     cookie::set('UserFilesAbsolutePath', DOCROOT . '../images/articles/' . $idActualite);
     if (!cookie::get('UserFilesPath')) {
         return url::redirect('articles/show/' . $idActualite);
     }
     if (!($actualite = $this->acticles->select(array('id_article' => $idActualite), TRUE))) {
         return parent::redirect_erreur('articles');
     }
     $actualiteCategories = $this->acticles->selectListeCategories();
     $this->script = array('js/lib/jquery.validate', 'js/articles');
     $this->css = array('form', 'article');
     $this->template->titre = array(Kohana::lang('article.all_article') => 'articles', $actualite->title => NULL);
     $this->template->button = TRUE;
     $this->template->navigation = $this->acticles->navigation($idActualite, 'id_article', 'articles');
     $this->template->navigationURL = 'articles/show';
     $this->template->contenu = new View('formulaire/form');
     $this->template->contenu->action = 'articles/save';
     $this->template->contenu->id = $idActualite;
     $this->template->contenu->formulaire = new View('articles/show');
     $this->template->contenu->formulaire->row = $actualite;
     $this->template->contenu->formulaire->actualiteCategories = $actualiteCategories;
     $this->template->contenu->formulaire->regions = Region_Model::instance()->listing_parent();
 }
开发者ID:ezioms,项目名称:RpgEditor,代码行数:31,代码来源:articles.php

示例15: __construct

    public function __construct($api_service)    
    {    
        $this->db = new Database();
        
        $this->api_settings = new Api_Settings_Model(1);

        // Set the list limit
        $this->list_limit = ((int) $this->api_settings->default_record_limit > 0)
            ? $this->api_settings->default_record_limit
            : (int) Kohana::config('settings.items_per_api_request');
        
        $this->domain = url::base();
        $this->record_count = 1;
        $this->table_prefix = Kohana::config('database.default.table_prefix');
        $this->api_service = $api_service;
        
        // Check if the response type for the API service has already been set
        if ( ! is_null($api_service->get_response_type()))
        {
            $this->request = $api_service->get_request();
            $this->response_type = $api_service->get_response_type();
        }
        else
        {
            $this->set_request($api_service->get_request());
        }
    }
开发者ID:nurous,项目名称:bushfireconnect,代码行数:27,代码来源:Api_Object.php


注:本文中的url::base方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。