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


PHP JURI::getHost方法代码示例

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


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

示例1: setRenderUrl

 /**
  * Set URL for get front-end content. Correct URL
  *
  * @param   string  $url  Link
  *
  * @return  void
  */
 public static function setRenderUrl($url = '')
 {
     $uri = new JURI($url);
     if ($uri->getScheme() == '') {
         $scheme = 'http';
         if (@$_SERVER['HTTPS']) {
             $scheme = 'https';
         }
         $uri->setScheme($scheme);
     }
     @(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
     if ($uri->getHost() == '') {
         $uri->setHost($host);
     }
     if ($uri->getPort() == '') {
         $uri->setPort($port);
     }
     if (strtolower($uri->getHost()) != strtolower($host)) {
         self::$_isExternal = true;
     } else {
         if (!$uri->hasVar('jsntpl_position')) {
             $uri->setVar('jsntpl_position', '1');
         }
         if (!$uri->hasVar('secret_key')) {
             $config = JFactory::getConfig();
             $secret = $config->get('secret');
             $uri->setVar('secret_key', md5($secret));
         }
         if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
             $uri->delVar('Itemid');
         }
         self::$_renderUrl = $uri->toString();
     }
 }
开发者ID:akilajwasala,项目名称:BuffetCorner,代码行数:41,代码来源:positionrender.php

示例2: testSetHost

	public function testSetHost() {
		$this->object->setHost('www.example.org');

		$this->assertThat(
			$this->object->getHost(),
			$this->equalTo('www.example.org')
		);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:8,代码来源:JURITest.php

示例3: fixImageLinks

 /**
  * 
  * Fix links
  * 
  * @param String $contents
  */
 public static function fixImageLinks($contents)
 {
     $regex = '/src=(["\'])(.*?)\\1/';
     $count = preg_match_all($regex, $contents, $match);
     if ($count > 0) {
         $changes = $match[2];
         foreach ($changes as $change) {
             $uri = new JURI($change);
             if ($uri->getHost() == '') {
                 $uri = new JURI(JURI::root() . $change);
             }
             $contents = str_replace('src="' . $change . '"', 'src="' . $uri->toString() . '"', $contents);
         }
     }
     return $contents;
 }
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:22,代码来源:jsnlayouthelper.php

示例4: JURI

 function ie_png_fix($params, $jyaml)
 {
     $document =& JFactory::getDocument();
     if ($document->getType() != 'html') {
         return;
     }
     $selector = $params->get('selector', 'img, .pngTrans');
     $blank_image = $params->get('blank_image', 1);
     if ($blank_image) {
         $script_file = 'hm_iepngfix_pre.htc';
     } else {
         $script_file = 'hm_iepngfix.htc';
     }
     $url = JURI::base(false);
     $uri = new JURI($url);
     $site_path = $uri->getScheme() . '://' . $uri->getHost() . JURI::base(true);
     $style = $selector . ' {behavior: url(' . $site_path . '/templates/' . $jyaml->template . '/plugins/ie_png_fix/scripts/' . $script_file . ');}';
     $jyaml->addStyleDeclaration('    ' . $style, 'msie 5.5');
     $jyaml->addStyleDeclaration('    ' . $style, 'msie 6');
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:20,代码来源:ie_png_fix.php

示例5: pathAddHost

 /**
  * Give a relative path, return path with host.
  *
  * @param   string $path A system path.
  *
  * @return  string  Path with host added.
  */
 public static function pathAddHost($path)
 {
     if (!$path) {
         return;
     }
     // build path
     $uri = new JURI($path);
     if ($uri->getHost()) {
         return $path;
     }
     $uri->parse(JURI::root());
     $root_path = $uri->getPath();
     if (strpos($path, $root_path) === 0) {
         $num = JString::strlen($root_path);
         $path = JString::substr($path, $num);
     }
     $uri->setPath($uri->getPath() . $path);
     $uri->setScheme('http');
     $uri->setQuery(null);
     return $uri->toString();
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:28,代码来源:uri.php

示例6: die

<?php

//no direct access
defined('_JEXEC') or die('Restricted Access');
$params = JFactory::getApplication()->getTemplate(true)->params;
if ($params->get('social_share')) {
    $url = JRoute::_(ContentHelperRoute::getArticleRoute($displayData->id . ':' . $displayData->alias, $displayData->catid, $displayData->language));
    $root = JURI::base();
    $root = new JURI($root);
    $url = $root->getScheme() . '://' . $root->getHost() . $url;
    echo '<div class="sp-social-share clearfix">';
    echo '<ul>';
    //echo JLayoutHelper::render( 'joomla.content.social_share.social.facebook', array( 'item'=>$displayData, 'params'=>$params, 'url'=>$url ) );
    //echo JLayoutHelper::render( 'joomla.content.social_share.social.twitter', array( 'item'=>$displayData, 'params'=>$params, 'url'=>$url ) );
    //echo JLayoutHelper::render( 'joomla.content.social_share.social.google_plus', array( 'item'=>$displayData, 'params'=>$params, 'url'=>$url ) );
    //echo JLayoutHelper::render( 'joomla.content.social_share.social.pinterest', array( 'item'=>$displayData, 'params'=>$params, 'url'=>$url ) );
    echo '</ul>';
    echo '</div>';
}
开发者ID:spiridonov-oa,项目名称:remontvolt,代码行数:19,代码来源:share.php

示例7: getButtons

 private function getButtons(&$article)
 {
     $view = $this->params->get('view');
     $currentView = JRequest::getWord("view");
     // Check where we are able to show buttons?
     $showInArticles = $this->params->get('showInArticles');
     /** Check for selected views, which will display the buttons. **/
     /** If there is a specific set and do not match, return an empty string.**/
     if ($showInArticles and strcmp("article", $currentView) != 0) {
         return "";
     }
     $excludedCats = $this->params->get('excludeCats');
     if (!empty($excludedCats)) {
         $excludedCats = explode(',', $excludedCats);
     }
     settype($excludedCats, 'array');
     JArrayHelper::toInteger($excludedCats);
     $excludeArticles = $this->params->get('excludeArticles');
     if (!empty($excludeArticles)) {
         $excludeArticles = explode(',', $excludeArticles);
     }
     settype($excludeArticles, 'array');
     JArrayHelper::toInteger($excludeArticles);
     // Included Articles
     $includedArticles = $this->params->get('includeArticles');
     if (!empty($includedArticles)) {
         $includedArticles = explode(',', $includedArticles);
     }
     settype($includedArticles, 'array');
     JArrayHelper::toInteger($includedArticles);
     if (!in_array($article->id, $includedArticles)) {
         // Check exluded views
         if (in_array($article->catid, $excludedCats) or in_array($article->id, $excludeArticles)) {
             return "";
         }
     }
     $html = "";
     $style = MV_SOCIAL_BUTTONS_URL . "style.css";
     $doc = JFactory::getDocument();
     /* @var $doc JDocumentHtml */
     $doc->addStyleSheet($style);
     $html .= '<div class="mv-social-buttons-box">';
     if ($this->params->get('showTitle')) {
         $html .= '<h4>' . $this->params->get('title') . '</h4>';
     }
     $html .= '<div class="' . $this->params->get('displayLines') . '">';
     $html .= '<div class="' . $this->params->get('displayIcons') . '">';
     $url = JURI::base();
     $url = new JURI($url);
     $root = $url->getScheme() . "://" . $url->getHost();
     $link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug), false);
     $link = $root . $link;
     $title = rawurlencode($article->title);
     $link = rawurlencode($link);
     if ($this->params->get("displayDelicious")) {
         $html .= $this->getDeliciousButton($title, $link);
     }
     if ($this->params->get("displayDigg")) {
         $html .= $this->getDiggButton($title, $link);
     }
     if ($this->params->get("displayFacebook")) {
         $html .= $this->getFacebookButton($title, $link);
     }
     if ($this->params->get("displayGoogle")) {
         $html .= $this->getGoogleButton($title, $link);
     }
     if ($this->params->get("displayTechnorati")) {
         $html .= $this->getTechnoratiButton($title, $link);
     }
     if ($this->params->get("displayTwitter")) {
         $html .= $this->getTwitterButton($title, $link);
     }
     if ($this->params->get("displayLinkedIn")) {
         $html .= $this->getLinkedInButton($title, $link);
     }
     if ($this->params->get("displayVkruButton")) {
         $html .= $this->getVkruButton($title, $link);
     }
     if ($this->params->get("displayLivejButton")) {
         $html .= $this->getLivejButton($title, $link);
     }
     if ($this->params->get("displayMoymirButton")) {
         $html .= $this->getMoymirButton($title, $link);
     }
     if ($this->params->get("displayYaruButton")) {
         $html .= $this->getYaruButton($title, $link);
     }
     if ($this->params->get("displayOdnoklassnikiButton")) {
         $html .= $this->getOdnoklassnikiButton($title, $link);
     }
     if ($this->params->get("displayLiveinternetButton")) {
         $html .= $this->getLiveinternetButton($title, $link);
     }
     if ($this->params->get("displayBobrdobrButton")) {
         $html .= $this->getBobrdobrButton($title, $link);
     }
     // Get extra social buttons
     $html .= $this->getExtraButtons($title, $link, $this->params);
     $html .= '</div></div></div>';
     return $html;
//.........这里部分代码省略.........
开发者ID:densem-2013,项目名称:exikom,代码行数:101,代码来源:mvsocialbuttons.php

示例8: array

 function _determineLanguage($getLang = null, $redir = false, $useMainLang = false)
 {
     // set the language for JoomFish
     if (SEFTools::JoomFishInstalled()) {
         $sefConfig =& SEFConfig::getConfig();
         $registry =& JFactory::getConfig();
         // Check if the Jfrouter is enabled
         $jfrouterEnabled = JPluginHelper::isEnabled('system', 'jfrouter');
         // save the default language of the site if needed
         if (!$jfrouterEnabled) {
             $locale = $registry->getValue('config.language');
             $GLOBALS['mosConfig_defaultLang'] = $locale;
             $registry->setValue("config.defaultlang", $locale);
         }
         // get instance of JoomFishManager to obtain active language list and config values
         $jfm =& JoomFishManager::getInstance();
         // Get language from request
         if (!empty($getLang)) {
             $lang = $getLang;
         }
         // Try to get language code from JF cookie
         if ($sefConfig->jfLangCookie) {
             $jfCookie = JRequest::getVar('jfcookie', null, 'COOKIE');
             if (isset($jfCookie['lang'])) {
                 $cookieCode = $jfCookie['lang'];
             }
         }
         // Try to find language from browser settings
         if ($sefConfig->jfBrowserLang && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
             $active_iso = array();
             $active_isocountry = array();
             $active_code = array();
             $activeLanguages = $jfm->getActiveLanguages();
             if (count($activeLanguages) > 0) {
                 foreach ($activeLanguages as $alang) {
                     $active_iso[] = $alang->iso;
                     if (preg_match('/[_-]/i', $alang->iso)) {
                         $iso = str_replace('_', '-', $alang->iso);
                         $isocountry = explode('-', $iso);
                         $active_isocountry[] = $isocountry[0];
                     }
                     $active_code[] = $alang->shortcode;
                 }
                 // figure out which language to use - browser languages are based on ISO codes
                 $browserLang = explode(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
                 foreach ($browserLang as $blang) {
                     if (in_array($blang, $active_iso)) {
                         $client_lang = $blang;
                         break;
                     }
                     $shortLang = substr($blang, 0, 2);
                     if (in_array($shortLang, $active_isocountry)) {
                         $client_lang = $shortLang;
                         break;
                     }
                     // compare with code
                     if (in_array($shortLang, $active_code)) {
                         $client_lang = $shortLang;
                         break;
                     }
                 }
                 if (!empty($client_lang)) {
                     if (strlen($client_lang) == 2) {
                         $browserCode = SEFTools::getLangLongCode($client_lang);
                     } else {
                         $browserCode = $client_lang;
                     }
                 }
             }
         }
         if (!$jfrouterEnabled && $redir && $sefConfig->langPlacement != _COM_SEF_LANG_DOMAIN && (isset($cookieCode) || isset($browserCode)) && $sefConfig->mainLanguage != '0') {
             if (isset($cookieCode)) {
                 $sc = SEFTools::getLangCode($cookieCode);
             } else {
                 $sc = SEFTools::getLangCode($browserCode);
             }
             // Check the referer to see if we should redirect
             $shouldRedir = false;
             if (isset($_SERVER['HTTP_REFERER'])) {
                 $refUri = new JURI($_SERVER['HTTP_REFERER']);
                 $uri = JURI::getInstance();
                 $refHost = $refUri->getHost();
                 $host = $uri->getHost();
                 if ($refHost != $host) {
                     $shouldRedir = true;
                 }
             } else {
                 $shouldRedir = true;
             }
             if ($shouldRedir) {
                 if (!empty($lang) && $sc != $lang || empty($lang) && $sc != $sefConfig->mainLanguage) {
                     // Redirect to correct site
                     $mainframe =& JFactory::getApplication();
                     $href = JRoute::_('index.php?lang=' . $sc, false);
                     $mainframe->redirect($href);
                     exit;
                 }
             }
         }
         // Check if language is selected
//.........这里部分代码省略.........
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:101,代码来源:joomsef.php

示例9: get_current_domain

 private static function get_current_domain()
 {
     $u = new JURI(JURI::root());
     return $u->getHost();
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:5,代码来源:Sitemap.php

示例10: _buildDataObject

 /**
  * Create and return the pagination data object.
  *
  * @return  object  Pagination data object.
  * @since   11.1
  */
 protected function _buildDataObject()
 {
     jimport('joomla.version');
     $version = new JVersion();
     $JoomlaVersionRelease = $version->RELEASE;
     $yg_anchor = '#youtubegallery';
     $data = new stdClass();
     $WebsiteRoot = '';
     if ($JoomlaVersionRelease >= 1.6) {
         $WebsiteRoot = JURI::base();
         $u = JURI::getInstance();
         $uri = $u->toString();
         $URLPath = $u->getPath();
         if ($WebsiteRoot[strlen($WebsiteRoot) - 1] != '/') {
             //Root must have slash / in the end
             $WebsiteRoot .= '/';
         }
         if ($URLPath[0] != '/') {
             //Root must have slash / in the end
             $URLPath = '/' . $URLPath;
         }
         $a = explode('/', $WebsiteRoot);
         //print_r($a);
         $b = explode('/', $URLPath);
         //print_r($b);
         $s = -1;
         $ca = count($a);
         //if($a[$ca-1]=='')
         //$ca=$ca-1;
         for ($i = 0; $i < count($b) and $i < $ca - 3; $i++) {
             if ($a[$ca - 1 - $i] == $b[$i]) {
                 $s = $i;
             } else {
                 break;
             }
         }
         //echo '$s='.$s.'<br/>';
         if ($s != -1) {
             $c = array();
             for ($i = $s + 1; $i < count($b); $i++) {
                 $c[] = $b[$i];
             }
             $URLPath = implode('/', $c);
             //print_r($c);
         }
         //echo '$URLPath='.$URLPath.'<br/>';
     } else {
         $juri = new JURI();
         $WebsiteRoot = $juri->getHost();
         $URLPath = $_SERVER['REQUEST_URI'];
         // example:  /index.php'
     }
     if ($WebsiteRoot[strlen($WebsiteRoot) - 1] != '/') {
         //Root must have slash / in the end
         $WebsiteRoot .= '/';
     }
     if ($URLPath != '') {
         if ($URLPath[0] == '/') {
             $URLPath = substr($URLPath, 1);
         }
     }
     $Translations = array();
     if ($JoomlaVersionRelease >= 1.6) {
         $Translations['all'] = JText::_('JLIB_HTML_VIEW_ALL');
         $Translations['start'] = JText::_('JLIB_HTML_START');
         $Translations['prev'] = JText::_('JPREV');
         $Translations['next'] = JText::_('JNEXT');
         $Translations['end'] = JText::_('JLIB_HTML_END');
         if (strpos($URLPath, '?') === false) {
             $URLPath .= '?' . $u->getQuery();
         } else {
             $URLPath .= '&' . $u->getQuery();
         }
     } else {
         $Translations['all'] = JText::_('All');
         $Translations['start'] = JText::_('First');
         $Translations['prev'] = JText::_('Prev');
         $Translations['next'] = JText::_('Next');
         $Translations['end'] = JText::_('Last');
     }
     if (!empty($this->_additionalUrlParams)) {
         foreach ($this->_additionalUrlParams as $key => $value) {
             if (strpos($URLPath, '?') === false) {
                 $URLPath = '?' . $key . '=' . $value;
             } else {
                 $URLPath = '&' . $key . '=' . $value;
             }
         }
     }
     //echo '$URLPath='.$URLPath.'<br/>';
     require_once 'layoutrenderer.php';
     $URLPath = YoutubeGalleryLayoutRenderer::deleteURLQueryOption($URLPath, 'videoid');
     $URLPath = YoutubeGalleryLayoutRenderer::deleteURLQueryOption($URLPath, $this->prefix . 'ygstart');
     if (strpos($URLPath, '?') === false) {
//.........这里部分代码省略.........
开发者ID:VierlingMt,项目名称:joomla-3.x,代码行数:101,代码来源:pagination.php

示例11: getButtons

 private function getButtons($article)
 {
     // excluded view mode
     if (!$this->view()) {
         return '';
     }
     // excluded categories or articles
     $categories = $this->params->get('categories', array());
     if (in_array($article->catid, $categories) && $this->params->get('categories_option') == 'exclude' || !in_array($article->catid, $categories) && $this->params->get('categories_option') == 'include') {
         return '';
     }
     $articles = trim($this->params->get('articles'));
     if (!empty($articles)) {
         $articles = explode(',', $articles);
     }
     settype($articles, 'array');
     if (in_array($article->id, $articles) && $this->params->get('articles_option') == 'exclude' || !in_array($article->id, $articles) && $this->params->get('articles_option') == 'include') {
         return '';
     }
     // get article link and title
     $url = JURI::base();
     $url = new JURI($url);
     $root = $url->getScheme() . '://' . $url->getHost();
     $link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug));
     $link = $root . $link;
     $title = rawurlencode($article->title);
     // buttons
     $style = trim($this->params->get('button_style', ''));
     !empty($style) ? $style = ' style="' . $style . '"' : NULL;
     $buttons = array();
     $this->params->get('displayFacebook') ? array_push($buttons, $this->getFacebookButton($style, $title, $link)) : NULL;
     $this->params->get('displayTwitter') ? array_push($buttons, $this->getTwitterButton($style, $title, $link)) : NULL;
     $this->params->get('displayMixxMN') ? array_push($buttons, $this->getMixxMNButton($style, $link)) : NULL;
     $this->params->get('displayGooglePlus') ? array_push($buttons, $this->getGooglePlusButton()) : NULL;
     $this->params->get('displayBiznetworkMN') ? array_push($buttons, $this->getBiznetworkMNButton()) : NULL;
     $buttons = implode('&nbsp;&nbsp;', $buttons);
     // og:tags for Facebook
     if ($this->params->get('og_tags', 1)) {
         isset($article->fulltext) ? $fulltext = $article->fulltext : ($fulltext = '');
         $fbimage = $this->catch_first_image($article->introtext . $fulltext);
         if (empty($fbimage)) {
             $fbimage = trim($this->params->get('og_image', JE_SOCIAL_SHARE_BUTTONS_URL . 'state_emblem_of_mongolia.png'));
         }
         $fbimage = JURI::base() . $fbimage;
         $mainframe = JFactory::getApplication();
         $site_name = $mainframe->getCfg('sitename');
         $metadesc = trim($article->metadesc);
         if (empty($metadesc)) {
             if ($this->params->get('og_description', 'from_metadesc') == 'from_metadesc') {
                 $metadesc = $mainframe->getCfg('metadesc');
             } else {
                 // from_article
                 $metadesc = mb_substr(strip_tags($article->introtext . $fulltext), 0, 160, 'utf8');
             }
         }
         $doc = JFactory::getDocument();
         $doc->addCustomTag('<meta property="og:title" content="' . $article->title . '" />');
         $doc->addCustomTag('<meta property="og:type" content="article" />');
         $doc->addCustomTag('<meta property="og:url" content="' . $link . '" />');
         $doc->addCustomTag('<meta property="og:image" content="' . $fbimage . '" />');
         $doc->addCustomTag('<meta property="og:site_name" content="' . $site_name . '" />');
         $doc->addCustomTag('<meta property="og:description" content="' . $metadesc . '" />');
         $doc->addCustomTag('<link rel="image_src" href="' . $fbimage . '" />');
     }
     // set title of group of buttons
     if ($this->params->get('show_title')) {
         $style = trim($this->params->get('title_style', ''));
         !empty($style) ? $style = ' style="' . $style . '"' : NULL;
         $title = '<div class="socialsharebuttonstitle" id="socialsharebuttonstitle"' . $style . '>' . $this->params->get('title') . '</div>';
     } else {
         $title = '';
     }
     // set style of main div element
     $style = trim($this->params->get('main_style', ''));
     !empty($style) ? $style = ' style="' . $style . '"' : NULL;
     // result
     return '<div class="socialsharebuttonsbox" id="socialsharebuttonsbox"' . $style . '>' . $title . $buttons . '</div>';
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:78,代码来源:jesocialsharebuttons.php

示例12: setHost

 /**
  * setHost
  *
  * @param $host
  *
  * @return void
  */
 public function setHost($host)
 {
     $uri = new JURI($host);
     $this->host = $host = $uri->getHost() . $uri->getPath();
     $this->uri->setHost($host);
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:13,代码来源:sdk.php

示例13: get_host

	/**
	 * Returns the current host name
	 * @return string
	 */
	public static function get_host()
	{
		if(defined('AKEEBACLI'))
		{
			require_once JPATH_ROOT.DS.'libraries'.DS.'joomla'.DS.'environment'.DS.'uri.php';
			$url = AEPlatform::get_platform_configuration_option('siteurl','');
			$oURI = new JURI($url);
			return $oURI->getHost();
		}
		$uri =& JURI::getInstance();
		return $uri->getHost();
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:16,代码来源:platform.php

示例14: setRenderUrl

 /**
  * Set URL for get front-end content. Correct URL
  *
  * @param   string  $url  Link
  *
  * @return  void
  */
 public function setRenderUrl($url = '')
 {
     $uri = new JURI($url);
     if ($uri->getScheme() == '') {
         $scheme = 'http';
         if (@$_SERVER['HTTPS']) {
             $scheme = 'https';
         }
         $uri->setScheme($scheme);
     }
     @(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
     if ($uri->getHost() == '') {
         $uri->setHost($host);
     }
     if ($uri->getPort() == '') {
         $uri->setPort($port);
     }
     if (JString::strtolower($uri->getHost()) != JString::strtolower($host)) {
         $this->_isExternal = true;
     } else {
         if (!$uri->hasVar('poweradmin')) {
             $uri->setVar('poweradmin', '1');
         }
         if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
             $uri->delVar('Itemid');
         }
         $this->_renderUrl = $uri->toString();
     }
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:36,代码来源:render.php

示例15: _buildDataObject

 /**
  * Create and return the pagination data object.
  *
  * @return  object  Pagination data object.
  * @since   11.1
  */
 protected function _buildDataObject()
 {
     jimport('joomla.version');
     $version = new JVersion();
     $JoomlaVersionRelease = $version->RELEASE;
     $yg_anchor = '#youtubegallery';
     $data = new stdClass();
     $WebsiteRoot = '';
     if ($JoomlaVersionRelease >= 1.6) {
         $WebsiteRoot = JURI::base();
         $u = JURI::getInstance();
         $uri = $u->toString();
         $URLPath = $u->getPath();
         if ($WebsiteRoot[strlen($WebsiteRoot) - 1] != '/') {
             //Root must have slash / in the end
             $WebsiteRoot .= '/';
         }
         if ($URLPath[0] != '/') {
             //Root must have slash / in the end
             $URLPath = '/' . $URLPath;
         }
         $a = explode('/', $WebsiteRoot);
         $b = explode('/', $URLPath);
         $s = -1;
         $ca = count($a);
         for ($i = 0; $i < count($b) and $i < $ca - 3; $i++) {
             if ($a[$ca - 1 - $i] == $b[$i]) {
                 $s = $i;
             } else {
                 break;
             }
         }
         if ($s != -1) {
             $c = array();
             for ($i = $s + 1; $i < count($b); $i++) {
                 $c[] = $b[$i];
             }
             $URLPath = implode('/', $c);
         }
     } else {
         $juri = new JURI();
         $WebsiteRoot = $juri->getHost();
         $URLPath = $_SERVER['REQUEST_URI'];
         // example:  /index.php'
     }
     //good idea:
     //$uh=parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
     if ($WebsiteRoot[strlen($WebsiteRoot) - 1] != '/') {
         //Root must have slash / in the end
         $WebsiteRoot .= '/';
     }
     //the path must start without "/"
     if ($URLPath != '') {
         if ($URLPath[0] == '/') {
             $URLPath = substr($URLPath, 1);
         }
     }
     //check if the path already contains video alias
     //delete it if found.
     if (!(strpos(JPATH_COMPONENT, '/com_youtubegallery') === false)) {
         //youtube gallery component
         $s = explode('/', $URLPath);
         $sc = count($s);
         if ($sc >= 1) {
             $pair = explode('?', $s[$sc - 1]);
             $alias = str_replace('.html', '', $pair[0]);
             $alias = str_replace('.htm', '', $alias);
             $alias = str_replace('.php', '', $alias);
             if (YGPagination::CheckIfAliasExixst($alias)) {
                 if (isset($pair[1])) {
                     $s[$sc - 1] = $pair[1];
                 } else {
                     unset($s[$sc - 1]);
                     $URLPath = implode('/', $s);
                 }
             }
         }
     }
     //---------------------
     $Translations = array();
     if ($JoomlaVersionRelease >= 1.6) {
         $Translations['all'] = JText::_('JLIB_HTML_VIEW_ALL');
         $Translations['start'] = JText::_('JLIB_HTML_START');
         $Translations['prev'] = JText::_('JPREV');
         $Translations['next'] = JText::_('JNEXT');
         $Translations['end'] = JText::_('JLIB_HTML_END');
         $URLPath .= YGPagination::QuestionmarkOrAnd($URLPath) . $u->getQuery();
     } else {
         $Translations['all'] = JText::_('All');
         $Translations['start'] = JText::_('First');
         $Translations['prev'] = JText::_('Prev');
         $Translations['next'] = JText::_('Next');
         $Translations['end'] = JText::_('Last');
     }
//.........这里部分代码省略.........
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:101,代码来源:pagination.php


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