コード例 #1
0
ファイル: callbackurl.php プロジェクト: utopszkij/keszlet
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
     $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $router = new JRouterSite(array('mode' => 1));
     $route = $router->build('index.php?option=com_slogin&task=check&plugin=' . (string) $this->element['value']);
     $CallbackUrl = JURI::root() . str_replace('/administrator/', '', $route);
     $html = '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $CallbackUrl . '" size="70%" ' . $class . $readonly . ' />';
     return $html;
 }
コード例 #2
0
 /**
  * Translates an internal Joomla URL to a humanly readable URL.
  *
  * @param   string   $url    Absolute or Relative URI to Joomla resource.
  * @param   boolean  $xhtml  Replace & by &amp; for XML compliance.
  * @param   integer  $ssl    Secure state for the resolved URI.
  *                             0: (default) No change, use the protocol currently used in the request
  *                             1: Make URI secure using global secure site URI.
  *                             2: Make URI unsecure using the global unsecure site URI.
  *
  * @return string The translated humanly readable URL.
  */
 public static function jroute($url, $xhtml = true, $ssl = null)
 {
     if (!static::$router) {
         static::$router = static::getRouter();
     }
     if (!is_array($url) && strpos($url, '&') !== 0 && strpos($url, 'index.php') !== 0) {
         return $url;
     }
     // Backup base with frontend root
     $base = TestHelper::getValue('JUri', 'base');
     TestHelper::setValue('JUri', 'base', TestHelper::getValue('JUri', 'root'));
     // Build route.
     /** @var Uri $uri */
     $uri = static::$router->build($url);
     // Restore base
     TestHelper::setValue('JUri', 'base', $base);
     $scheme = array('path', 'query', 'fragment');
     /*
      * Get the secure/unsecure URLs.
      *
      * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over
      * https and need to set our secure URL to the current request URL, if not, and the scheme is
      * 'http', then we need to do a quick string manipulation to switch schemes.
      */
     if ((int) $ssl || $uri->isSSL()) {
         static $host_port;
         if (!is_array($host_port)) {
             $uri2 = \JUri::getInstance();
             $host_port = array($uri2->getHost(), $uri2->getPort());
         }
         // Determine which scheme we want.
         $uri->setScheme((int) $ssl === 1 || $uri->isSSL() ? 'https' : 'http');
         $uri->setHost($host_port[0]);
         $uri->setPort($host_port[1]);
         $scheme = array_merge($scheme, array('host', 'port', 'scheme'));
     }
     $url = $uri->toString($scheme);
     // Replace spaces.
     $url = preg_replace('/\\s/u', '%20', $url);
     if ($xhtml) {
         $url = htmlspecialchars($url);
     }
     return $url;
 }
コード例 #3
0
 /**
  * convert from normal format to sef format
  *
  * @param unknown_type $matches
  * @return unknown
  */
 function convertUrl($originalPath, $pathonly = false)
 {
     jimport('joomla.application.router');
     // Get the router
     $router = new JRouterSite(array('mode' => JROUTER_MODE_SEF));
     // Make sure that we have our router
     if (!$router) {
         if ($pathonly) {
             return $originalPath;
         } else {
             return $this->getRootUrl() . $originalPath;
         }
     }
     // Build route
     $path = str_replace(JURI::root(true), '', $originalPath);
     $uri = $router->build($path);
     $path = $uri->toString(array('path', 'query', 'fragment'));
     if (!preg_match('/^\\/+/', $path)) {
         $path = "/{$path}";
     }
     //
     if ($pathonly) {
         return $path;
     } else {
         $url = $this->getRootUrl();
         return $url . $path;
     }
 }
コード例 #4
0
ファイル: view.html.php プロジェクト: site4com/prometheus
    /**
     * Control panel display
     *        	
     * @access public
     * @param string $tpl
     * @return void
     */
    public function display($tpl = null)
    {
        $doc = $this->document;
        $componentParams = $this->getModel()->getState('cparams');
        $base = JUri::root();
        $this->loadJQuery($doc);
        $this->loadBootstrap($doc);
        $doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/cpanel.css');
        $doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/jquery.fancybox.css');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/chart.js');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/cpanel.js');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/analyzer.js');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/metainfo.js');
        if ($componentParams->get('seostats_enabled', 1)) {
            $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/seostats.js');
        }
        if ($componentParams->get('enable_precaching', 0)) {
            $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/xmlprecaching.js');
        }
        $doc->addCustomTag('<script type="text/javascript" src="' . JURI::root(true) . '/administrator/components/com_jmap/js/jquery.fancybox.pack.js' . '"></script>');
        // Inject js translations
        $translations = array('COM_JMAP_ROBOTSPROGRESSTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLESUCCESS', 'COM_JMAP_ROBOTSPROGRESSSUBTITLEERROR', 'COM_JMAP_PRECACHING_TITLE', 'COM_JMAP_START_PRECACHING_PROCESS', 'COM_JMAP_PRECACHING_NO_DATASOURCES_FOUND', 'COM_JMAP_PRECACHING_PROCESS_RUNNING', 'COM_JMAP_PRECACHING_PROCESS_COMPLETED', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE_TYPE', 'COM_JMAP_PRECACHING_REPORT_LINKS', 'COM_JMAP_PRECACHING_DATA_SOURCE_COMPLETED', 'COM_JMAP_PRECACHING_DATASOURCES_RETRIEVED', 'COM_JMAP_PRECACHING_PROCESS_FINALIZING', 'COM_JMAP_PRECACHING_INTERRUPT', 'COM_JMAP_PRECACHING_CACHED', 'COM_JMAP_PRECACHING_NOT_CACHED', 'COM_JMAP_PRECACHING_CLEARING', 'COM_JMAP_PRECACHING_CLEAR_CACHE', 'COM_JMAP_PUBLISHED_DATA_SOURCE_CHART', 'COM_JMAP_TOTAL_DATA_SOURCE_CHART', 'COM_JMAP_DATASETS_CHART', 'COM_JMAP_MENU_DATA_SOURCE_CHART', 'COM_JMAP_USER_DATA_SOURCE_CHART', 'COM_JMAP_ANALYZER_TITLE', 'COM_JMAP_ANALYZER_PROCESS_RUNNING', 'COM_JMAP_ANALYZER_STARTED_SITEMAP_GENERATION', 'COM_JMAP_ANALYZER_ERROR_STORING_FILE', 'COM_JMAP_ANALYZER_GENERATION_COMPLETE', 'COM_JMAP_METAINFO_TITLE', 'COM_JMAP_METAINFO_PROCESS_RUNNING', 'COM_JMAP_METAINFO_STARTED_SITEMAP_GENERATION', 'COM_JMAP_METAINFO_ERROR_STORING_FILE', 'COM_JMAP_METAINFO_GENERATION_COMPLETE', 'COM_JMAP_SEOSTATS_LOADING', 'COM_JMAP_ALEXA_GRAPH', 'COM_JMAP_NULL_RESPONSEDATA', 'COM_JMAP_ERROR_HTTP');
        $this->injectJsTranslations($translations, $doc);
        // Check for custom link domain
        $customDomain = trim($componentParams->get('custom_sitemap_domain', ''));
        $livesite = $customDomain ? rtrim($customDomain, '/') : substr_replace(JURI::root(), "", -1, 1);
        $user = JFactory::getUser();
        $lists = $this->get('Lists');
        $infoData = $this->get('Data');
        $doc->addScriptDeclaration('var jmapChartData = ' . json_encode($infoData));
        $doc->addScriptDeclaration("var jmap_baseURI='{$base}';");
        $doc->addScriptDeclaration("var jmap_linksRandom=" . $componentParams->get('sitemap_links_random', 0) . ";");
        $doc->addScriptDeclaration("var jmap_forceFormat=" . $componentParams->get('sitemap_links_forceformat', 0) . ";");
        // Assign SEF mode
        $this->siteRouter = JRouterSite::getInstance('site', array('mode' => JROUTER_MODE_SEF));
        $this->showSefLinks = $componentParams->get('sitemap_links_sef', false);
        $this->joomlaSefLinks = JFactory::getConfig()->get('sef', true);
        $this->siteItemid = null;
        if ($this->showSefLinks && $this->joomlaSefLinks) {
            $siteItemid = trim($componentParams->get('site_itemid', null));
            if ($siteItemid && is_numeric($siteItemid)) {
                $menuItem = JMenu::getInstance('site')->getItem((int) $siteItemid);
                if (isset($menuItem->alias)) {
                    $menuAlias = $menuItem->alias;
                    $doc->addScriptDeclaration("var jmap_sef_alias_links='{$menuAlias}';");
                    $this->siteItemid = '&Itemid=' . (int) $siteItemid;
                }
            }
        }
        // Buffer delle icons
        ob_start();
        $this->getIcon('index.php?option=com_jmap&task=sources.display', 'icon-48-data.png', JText::_('COM_JMAP_SITEMAP_SOURCES'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_SOURCES') . '"');
        $this->getIcon('index.php?option=com_jmap&task=wizard.display', 'icon-48-wizard.png', JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE'), '', 'title="' . JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE') . '"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap', 'icon-48-html_sitemap.png', JText::_('COM_JMAP_SHOW_HTML_MAP'), 'target="_blank"', 'title="' . JText::_('COM_JMAP_SHOW_HTML_MAP') . '"', 'data-role="torefresh"');
        $this->getIcon('#xmlsitemap', 'icon-48-xml_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP') . '"', 'class="fancybox"');
        $this->getIcon('#xmlsitemap_xslt', 'icon-48-xsl_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP_XSLT'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP_XSLT') . '"', 'class="fancybox"');
        $this->getIcon('#xmlsitemap_export', 'icon-48-xml_export.png', JText::_('COM_JMAP_EXPORT_XML_SITEMAP'), '', 'title="' . JText::_('COM_JMAP_EXPORT_XML_SITEMAP') . '"', 'class="fancybox"');
        $this->getIcon(substr_replace(JURI::root(), "", -1, 1) . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-analyze.png', JText::_('COM_JMAP_ANALYZE_MAP'), '', 'title="' . JText::_('COM_JMAP_ANALYZE_MAP') . '"', 'class="jmap_analyzer"');
        $this->getIcon(substr_replace(JURI::root(), "", -1, 1) . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-metainfo.png', JText::_('COM_JMAP_METAINFO'), '', 'title="' . JText::_('COM_JMAP_METAINFO') . '"', 'class="jmap_metainfo"');
        $this->getIcon('index.php?option=com_jmap&task=indexing.display', 'icon-48-indexing.png', JText::_('COM_JMAP_SITEMAP_INDEXING'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_INDEXING') . '"');
        $this->getIcon('index.php?option=com_jmap&task=datasets.display', 'icon-48-datasets.png', JText::_('COM_JMAP_SITEMAP_DATASETS'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_DATASETS') . '"');
        if ($user->authorise('core.edit', 'com_jmap')) {
            $this->getIcon('index.php?option=com_jmap&task=cpanel.editEntity', 'icon-48-robots.png', JText::_('COM_JMAP_ROBOTS_EDITOR'), '', 'title="' . JText::_('COM_JMAP_ROBOTS_EDITOR') . '"', 'class="fancybox_iframe"');
            $this->getIcon('index.php?option=com_jmap&task=htaccess.editEntity', 'icon-48-htaccess.png', JText::_('COM_JMAP_HTACCESS_EDITOR'), '', 'title="' . JText::_('COM_JMAP_HTACCESS_EDITOR') . '"', 'class="fancybox_iframe"');
        }
        $this->getIcon('index.php?option=com_jmap&task=pingomatic.display', 'icon-48-pingomatic.png', JText::_('COM_JMAP_PINGOMATIC_LINKS'), '', 'title="' . JText::_('COM_JMAP_PINGOMATIC_LINKS') . '"');
        $this->getIcon('#rssfeed', 'icon-48-rss-feed.png', JText::_('COM_JMAP_SHOW_RSS_FEED'), '', 'title="' . JText::_('COM_JMAP_SHOW_RSS_FEED') . '"', 'class="fancybox rss"');
        // Access check.
        if ($user->authorise('jmap.google', 'com_jmap')) {
            $this->getIcon('index.php?option=com_jmap&task=google.display', 'icon-48-google.png', JText::_('COM_JMAP_GOOGLE'), '', 'title="' . JText::_('COM_JMAP_GOOGLE_ANALYTICS') . '"');
        }
        // Access check.
        if ($user->authorise('core.admin', 'com_jmap')) {
            $this->getIcon('index.php?option=com_jmap&task=config.display', 'icon-48-config.png', JText::_('COM_JMAP_CONFIG'), '', 'title="' . JText::_('COM_JMAP_CONFIG') . '"');
        }
        $this->getIcon('http://storejextensions.org/jsitemap_professional_documentation.html', 'icon-48-help.png', JText::_('COM_JMAP_HELPTITLE'), '', 'title="' . JText::_('COM_JMAP_HELPTITLE') . '"');
        echo '<div style="display:none" id="xmlsitemap">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=xml', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_SHOW_XML_STANDARD_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=images', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_SHOW_XML_IMAGES_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=gnews', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_SHOW_XML_GNEWS_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=mobile', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_SHOW_XML_MOBILE_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=videos', 'icon-48-xml_sitemap_videos.png', JText::_('COM_JMAP_SHOW_XML_VIDEOS_MAP'), 'target="_blank"');
        echo '</div>';
        echo '<div style="display:none" id="xmlsitemap_xslt">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=xml&xslt=1', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_SHOW_XML_STANDARD_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=images&xslt=1', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_SHOW_XML_IMAGES_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=gnews&xslt=1', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_SHOW_XML_GNEWS_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=mobile&xslt=1', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_SHOW_XML_MOBILE_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=videos&xslt=1', 'icon-48-xml_sitemap_videos.png', JText::_('COM_JMAP_SHOW_XML_VIDEOS_MAP'), 'target="_blank"');
        echo '</div>';
        echo '<div style="display:none" id="xmlsitemap_export">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_EXPORT_XML_STANDARD_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=images', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_EXPORT_XML_IMAGES_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=gnews', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_EXPORT_XML_GNEWS_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=mobile', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_EXPORT_XML_MOBILE_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=videos', 'icon-48-xml_sitemap_videos.png', JText::_('COM_JMAP_EXPORT_XML_VIDEOS_MAP'));
        echo '</div>';
        echo '<div style="display:none" id="rssfeed">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss', 'icon-48-xml_sitemap.png', JText::_('COM_JMAP_SHOW_RSS_FEED'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss&xslt=1', 'icon-48-xsl_sitemap.png', JText::_('COM_JMAP_SHOW_RSS_FEED_FORMATTED'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=rss', 'icon-48-xml_export.png', JText::_('COM_JMAP_EXPORT_RSS_FEED'));
        echo '<label class="label label-primary">' . JText::_('COM_JMAP_RSS_FEED_LINK') . '</label>';
        if (!$this->showSefLinks || !$this->joomlaSefLinks) {
            ?>
		<input data-role="sitemap_links" class="sitemap_links" type="text" value="<?php 
            echo JFilterOutput::ampReplace($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss');
            ?>
" />
		<?php 
        } else {
            ?>
		<input data-role="sitemap_links_sef" class="sitemap_links" type="text" data-valuenosef="<?php 
            echo JFilterOutput::ampReplace($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss');
            ?>
" value="<?php 
            echo $livesite . preg_replace('/(\\/[A-Za-z0-9_-~]*)*\\/administrator\\//i', '/', $this->siteRouter->build('index.php?option=com_jmap&view=sitemap&format=rss' . $this->siteItemid));
            ?>
"/>
		<?php 
        }
        echo '</div>';
        $contents = ob_get_clean();
        // Assign reference variables
        $this->icons = $contents;
        $this->livesite = $livesite;
        $this->componentParams = $componentParams;
        $this->infodata = $infoData;
        $this->lists = $lists;
        $this->updatesData = $this->getModel()->getUpdates($this->get('httpclient'));
        $this->currentVersion = strval(simplexml_load_file(JPATH_COMPONENT_ADMINISTRATOR . '/jmap.xml')->version);
        // Aggiunta toolbar
        $this->addDisplayToolbar();
        // Output del template
        parent::display();
    }
コード例 #5
0
 /**
  * Actual method performing parsing of a request as described
  * by an JURI object
  *
  * Also performs additional duties, like checking on aliases,
  * searching alternates syntax (add/remove trailing slash),
  * auto-redirect from non-sef to sef, etc
  * Possibly trigger a 404 if url can't be parsed to a valid
  * non sef url
  *
  * @see JRouter::_parseSefRoute()
  */
 protected function _parseSefRoute(&$uri)
 {
     // will hold query vars parsed
     $vars = array();
     // general config
     $sefConfig = Sh404sefFactory::getConfig();
     // we'll need to work on the menu, get it
     $menu = JFactory::getApplication()->getMenu(true);
     // get request path and try to decode it
     $path = $uri->getPath();
     // home page
     if (empty($path)) {
         // check more redirects: from non sef to sef
         $this->_checkNonSefToSefRedirects($uri);
         // now if no query vars, this is really home page
         $uriVars = $uri->getQuery(true);
         if (empty($uriVars)) {
             $menuItem = $menu->getDefault(JFactory::getLanguage()->getTag());
             //get home menu item query vars
             $vars = $menuItem->query;
             //Get its Itemid
             $vars['Itemid'] = $menuItem->id;
         } else {
             // if some query vars, just pass them thru
             $vars = $uriVars;
         }
     }
     // non home page
     if (!empty($path)) {
         // fix the path before checking url. Joomla unfortunately remove
         // the trailing slash from the path
         $trailingSlash = $this->_hasTrailingSlash($uri);
         if ($trailingSlash & JString::substr($path, -1) != '/') {
             // if trailing slash on original request, but not on path
             // put it back
             $path .= '/';
         }
         // lookup db for this sef
         $lookUp = $this->_lookupSef($uri, $vars, $path);
         // store the fetched data, if any
         $vars = $lookUp->vars;
         // and take additional actions based on the result of the lookup
         switch ($lookUp->urlType) {
             // existing matching url
             case sh404SEF_URLTYPE_AUTO:
             case sh404SEF_URLTYPE_CUSTOM:
                 // permanently fix the path, if we had to fix it for a missing trailing slash
                 // TODO: check how this would affect Joomla!
                 // may not be a good idea
                 // actually it won't hurt J! as we're working on a clone of $uri
                 if ($trailingSlash) {
                     $uri->setPath($path);
                 }
                 break;
                 // 404 or some kind of redirect
             // 404 or some kind of redirect
             default:
                 // try using J! router
                 // if at least one extension uses Joomla! router, we must first try to use that
                 if (!empty(Sh404sefFactory::getConfig()->useJoomlaRouter)) {
                     // use parent parser
                     $vars = parent::_parseSefRoute($uri);
                     // if we found something, raise a flag
                     self::$parsedWithJoomlaRouter = true;
                     // collect vars that may have been stored by J! such as Itemid
                     $vars = array_merge(Sh404sefFactory::getPageInfo()->router->getVars(), $vars);
                     $this->setVars(array());
                     // and cut through the rest of the processing
                     break;
                 }
                 // check more redirects: from Joomla SEF to our SEF
                 $this->_checkJoomlaSefToSefRedirects($uri);
                 // try find similar urls to redirect to: with or without trailing slash
                 $this->_checkTrailingSlash($uri);
                 // there might be an alias we're supposed to redirect current request to
                 $this->_checkAliases($uri);
                 // check if this is a short url
                 $this->_checkShurls($uri);
                 // if no alternative found, issue a 404
                 $vars = $this->_do404($uri);
                 break;
         }
     }
     // Set the menu item as active, if we found any
     // this would normally be done by Joomla own _parseSefRoute() method
     // except it's not gonna be run as we changed the routing mode from
     // JROUTER_MODE_SEF to our own (ROUTER_MODE_SH404SEF)
     if (!empty($vars['Itemid'])) {
         $menu->setActive($vars['Itemid']);
     }
     // do security checks after decoding url
     if ($sefConfig->shSecEnableSecurity) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_sh404sef' . DS . 'shSec.php';
         // do security checks
         shDoSecurityChecks($uri->get('_uri'), false);
         // check this newly created URL
     }
     return $vars;
 }
コード例 #6
0
 /**
  * Create Joomla SEF URLs
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see 		http://www.joomla.org/
  * @see			_getSiteRoute()
  * @access 		private
  * @param 		string	$url	the original URL to turn into SEF
  * @return 		string SEF URL
  * @since 		3.0
  */
 private function _joomlaSef($url)
 {
     // Load Joomla core files for SEF
     jimport('joomla.application.router');
     require_once JPATH_ROOT . '/includes/application.php';
     require_once JPATH_ROOT . '/includes/router.php';
     $router = new JRouterSite(array('mode' => 1));
     $uri = $router->build($url);
     return $uri->toString();
 }
コード例 #7
0
ファイル: pingomatic.php プロジェクト: knigherrant/decopatio
 /**
  * Route save single article to the corresponding SEF link
  *
  * @access private
  * @return string
  */
 private function routeArticleToSefMenu($articleID, $catID, $language, $article)
 {
     // Try to route the article to a single article menu item view
     $helperRouteClass = $this->context['class'];
     $classMethod = $this->context['method'];
     // Route helper native by component, com_content, com_k2
     if (!isset($this->context['routing'])) {
         $articleHelperRoute = $helperRouteClass::$classMethod($articleID, $catID, $language);
     } else {
         // Route helper universal JSitemap, com_zoo
         $articleHelperRoute = $helperRouteClass::$classMethod($article->option, $article->view, $article->id, $article->catid, null);
         if ($articleHelperRoute) {
             $articleHelperRoute = '?Itemid=' . $articleHelperRoute;
         }
     }
     // Extract Itemid from the helper routed URL
     $extractedItemid = preg_match('/Itemid=\\d+/i', $articleHelperRoute, $result);
     if (isset($result[0])) {
         // Get uri instance avoidng subdomains already included in the routing chunks
         $uriInstance = JUri::getInstance();
         $resourceLiveSite = rtrim($uriInstance->getScheme() . '://' . $uriInstance->getHost(), '/');
         $extractedItemid = $result[0];
         $siteRouter = JRouterSite::getInstance('site', array('mode' => JROUTER_MODE_SEF));
         $articleMenuRouted = $siteRouter->build('?' . $extractedItemid)->toString();
         // Check if multilanguage is enabled
         if (JMapLanguageMultilang::isEnabled()) {
             if ($language != '*') {
                 // New language manager instance
                 $languageManager = JMapLanguageMultilang::getInstance($language);
             } else {
                 // Get the default language tag
                 // New language manager instance
                 $languageManager = JMapLanguageMultilang::getInstance();
             }
             // Extract the language tag
             $localeTag = $languageManager->getLocale();
             $sefTag = $localeTag[4];
             $articleMenuRouted = str_replace('/administrator', '/' . $sefTag, $articleMenuRouted);
         } else {
             $articleMenuRouted = str_replace('/administrator', '', $articleMenuRouted);
         }
         $articleMenuRouted = preg_match('/http/i', $articleMenuRouted) ? $articleMenuRouted : $resourceLiveSite . '/' . ltrim($articleMenuRouted, '/');
         return $articleMenuRouted;
     } else {
         // Check if routing is valid otherwise throw exception
         throw new RuntimeException(JText::_('COM_JMAP_AUTOPING_ERROR_NOSEFROUTE_FOUND'));
     }
 }
コード例 #8
0
 /**
  * Tests the setComponentRouter() method
  *
  * @return  void
  *
  * @since   3.4
  */
 public function testInvalidRouterIsRejected()
 {
     $object = new JRouterSite(array(), $this->getMockCmsApp(), TestMockMenu::create($this));
     $this->assertFalse($object->setComponentRouter('com_test3', new stdClass()));
 }
コード例 #9
0
$message_walloriginal=str_replace($temp,'',AwdwallHelperUser::showSmileyicons($message_walloriginal));
// adding to com_awdwall
if(file_exists(JPATH_SITE . '/components/com_awdwall/awdwall.php'))
{
$websitename=$mainframe->getCfg('fromname');
$user 			= &JFactory::getUser($userId);
$db->setQuery('SELECT cat.id FROM #__categories cat RIGHT JOIN #__content cont ON cat.id = cont.catid WHERE cont.id='.$contentid);
$category_id = $db->loadResult();
$db->setQuery('SELECT alias FROM #__content WHERE id='.$contentid);
$alias = $db->loadResult();
//$articlelink='index.php?option=com_content&view=article&id='.$contentid.'&Itemid='.$ItemId;
// $url = ' '.JURI::root().ContentHelperRoute::getArticleRoute($article->id, $article->catid); 
//$articlelink=ContentHelperRoute::getArticleRoute($contentid, $category_id, 0);
$mode=$mainframe->getCfg('sef');
$newUrl = ContentHelperRoute::getArticleRoute($contentid.':'.$alias, $category_id);
$router = new JRouterSite(array('mode'=>$mode));
$newUrl = $router->build($newUrl)->toString(array('path', 'query', 'fragment'));
$newUrl = str_replace('/administrator/', '', $newUrl);
$newUrl = str_replace('component/content/article/', '', $newUrl);
$newUrl = str_replace('plugins/content/loadjomwall/', '', $newUrl);
$articlelink=$newUrl;

	$query 	= "SELECT title FROM #__content where id = " . (int)$contentid;
	$db->setQuery($query);
	$articletitle = $db->loadResult();
$message_wall=' '.JText::_('has comment on').' <a href="'.$articlelink.'" >'.$articletitle.'</a>&nbsp;'.JText::_('article').'<br>'.nl2br($message_wall);
	$query = "INSERT INTO #__awd_wall (user_id, type, commenter_id, message,wall_date) VALUES ('".intval($user->id)."','text', '".intval($user->id)."', '".nl2br($message_wall)."', '".time()."') ";
	$db->setQuery($query);			
	if (!@$db->query()) {
		$error = 1;
		$message = $db->stderr();
コード例 #10
0
ファイル: router.php プロジェクト: janssit/www.reliancelaw.be
 public function _decodeSegments(array $segments)
 {
     try {
         $router = KFactory::get('site::com.nooku.router.' . substr($this->getVar('option'), 4));
         $segments = $router->decode($segments);
     } catch (KFactoryException $e) {
         $segments = parent::_decodeSegments($segments);
     }
     return $segments;
 }
コード例 #11
0
 /**
  * Control panel display
  *        	
  * @access public
  * @param string $tpl
  * @return void
  */
 public function display($tpl = null)
 {
     $doc = $this->document;
     $componentParams = $this->getModel()->getState('cparams');
     $this->loadJQuery($doc);
     $this->loadBootstrap($doc);
     $doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/cpanel.css');
     $doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/jquery.fancybox.css');
     $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/chart.js');
     $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/cpanel.js');
     $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/analyzer.js');
     if ($componentParams->get('enable_precaching', 0)) {
         $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/xmlprecaching.js');
     }
     $doc->addCustomTag('<script type="text/javascript" src="' . JURI::root(true) . '/administrator/components/com_jmap/js/jquery.fancybox.pack.js' . '"></script>');
     // Inject js translations
     $translations = array('COM_JMAP_ROBOTSPROGRESSTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLESUCCESS', 'COM_JMAP_ROBOTSPROGRESSSUBTITLEERROR', 'COM_JMAP_PRECACHING_TITLE', 'COM_JMAP_START_PRECACHING_PROCESS', 'COM_JMAP_PRECACHING_NO_DATASOURCES_FOUND', 'COM_JMAP_PRECACHING_PROCESS_RUNNING', 'COM_JMAP_PRECACHING_PROCESS_COMPLETED', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE_TYPE', 'COM_JMAP_PRECACHING_REPORT_LINKS', 'COM_JMAP_PRECACHING_DATA_SOURCE_COMPLETED', 'COM_JMAP_PRECACHING_DATASOURCES_RETRIEVED', 'COM_JMAP_PRECACHING_PROCESS_FINALIZING', 'COM_JMAP_PRECACHING_INTERRUPT', 'COM_JMAP_PRECACHING_CACHED', 'COM_JMAP_PRECACHING_NOT_CACHED', 'COM_JMAP_PRECACHING_CLEARING', 'COM_JMAP_PRECACHING_CLEAR_CACHE', 'COM_JMAP_PUBLISHED_DATA_SOURCE_CHART', 'COM_JMAP_TOTAL_DATA_SOURCE_CHART', 'COM_JMAP_MENU_DATA_SOURCE_CHART', 'COM_JMAP_USER_DATA_SOURCE_CHART', 'COM_JMAP_ANALYZER_TITLE', 'COM_JMAP_ANALYZER_PROCESS_RUNNING', 'COM_JMAP_ANALYZER_STARTED_SITEMAP_GENERATION', 'COM_JMAP_ANALYZER_ERROR_STORING_FILE', 'COM_JMAP_ANALYZER_GENERATION_COMPLETE');
     $this->injectJsTranslations($translations, $doc);
     $livesite = substr_replace(JURI::root(), "", -1, 1);
     $user = JFactory::getUser();
     $lists = $this->get('Lists');
     $infoData = $this->get('Data');
     $doc->addScriptDeclaration('var jmapChartData = ' . json_encode($infoData));
     // Buffer delle icons
     ob_start();
     $this->getIcon('index.php?option=com_jmap&task=sources.display', 'icon-48-data.png', JText::_('COM_JMAP_SITEMAP_SOURCES'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_SOURCES') . '"');
     $this->getIcon('index.php?option=com_jmap&task=wizard.display', 'icon-48-wizard.png', JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE'), '', 'title="' . JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE') . '"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap', 'icon-48-html_sitemap.png', JText::_('COM_JMAP_SHOW_HTML_MAP'), 'target="_blank"', 'title="' . JText::_('COM_JMAP_SHOW_HTML_MAP') . '"', 'data-role="torefresh"');
     $this->getIcon('#xmlsitemap', 'icon-48-xml_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP') . '"', 'class="fancybox"');
     $this->getIcon('#xmlsitemap_xslt', 'icon-48-xsl_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP_XSLT'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP_XSLT') . '"', 'class="fancybox"');
     $this->getIcon('#xmlsitemap_export', 'icon-48-xml_export.png', JText::_('COM_JMAP_EXPORT_XML_SITEMAP'), '', 'title="' . JText::_('COM_JMAP_EXPORT_XML_SITEMAP') . '"', 'class="fancybox"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-analyze.png', JText::_('COM_JMAP_ANALYZE_MAP'), '', 'title="' . JText::_('COM_JMAP_ANALYZE_MAP') . '"', 'class="jmap_analyzer"');
     if ($user->authorise('core.edit', 'com_jmap')) {
         $this->getIcon('index.php?option=com_jmap&task=cpanel.editEntity', 'icon-48-robots.png', JText::_('COM_JMAP_ROBOTS_EDITOR'), '', 'title="' . JText::_('COM_JMAP_ROBOTS_EDITOR') . '"', 'class="fancybox_iframe"');
     }
     $this->getIcon('index.php?option=com_jmap&task=pingomatic.display', 'icon-48-pingomatic.png', JText::_('COM_JMAP_PINGOMATIC_LINKS'), '', 'title="' . JText::_('COM_JMAP_PINGOMATIC_LINKS') . '"');
     // Access check.
     if ($user->authorise('core.admin', 'com_jmap')) {
         $this->getIcon('index.php?option=com_jmap&task=config.display', 'icon-48-config.png', JText::_('COM_JMAP_CONFIG'), '', 'title="' . JText::_('COM_JMAP_CONFIG') . '"');
     }
     $this->getIcon('http://storejextensions.org/jsitemap_professional_documentation.html', 'icon-48-help.png', JText::_('COM_JMAP_HELPTITLE'), '', 'title="' . JText::_('COM_JMAP_HELPTITLE') . '"');
     echo '<div style="display:none" id="xmlsitemap">';
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=xml', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_SHOW_XML_STANDARD_MAP'), 'target="_blank"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=images', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_SHOW_XML_IMAGES_MAP'), 'target="_blank"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=gnews', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_SHOW_XML_GNEWS_MAP'), 'target="_blank"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=mobile', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_SHOW_XML_MOBILE_MAP'), 'target="_blank"');
     echo '</div>';
     echo '<div style="display:none" id="xmlsitemap_xslt">';
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=xml&xslt=1', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_SHOW_XML_STANDARD_MAP'), 'target="_blank"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=images&xslt=1', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_SHOW_XML_IMAGES_MAP'), 'target="_blank"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=gnews&xslt=1', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_SHOW_XML_GNEWS_MAP'), 'target="_blank"');
     $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=mobile&xslt=1', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_SHOW_XML_MOBILE_MAP'), 'target="_blank"');
     echo '</div>';
     echo '<div style="display:none" id="xmlsitemap_export">';
     $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_EXPORT_XML_STANDARD_MAP'));
     $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=images', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_EXPORT_XML_IMAGES_MAP'));
     $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=gnews', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_EXPORT_XML_GNEWS_MAP'));
     $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=mobile', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_EXPORT_XML_MOBILE_MAP'));
     echo '</div>';
     $contents = ob_get_clean();
     // Assign reference variables
     $this->icons = $contents;
     $this->livesite = $livesite;
     $this->componentParams = $componentParams;
     $this->infodata = $infoData;
     $this->lists = $lists;
     $this->updatesData = $this->getModel()->getUpdates($this->get('httpclient'));
     $this->siteRouter = JRouterSite::getInstance('site', array('mode' => JROUTER_MODE_SEF));
     $this->showSefLinks = $this->componentParams->get('sitemap_links_sef', false);
     $this->joomlaSefLinks = JFactory::getConfig()->get('sef', true);
     $this->currentVersion = strval(simplexml_load_file(JPATH_COMPONENT_ADMINISTRATOR . '/jmap.xml')->version);
     // Aggiunta toolbar
     $this->addDisplayToolbar();
     // Output del template
     parent::display();
 }
コード例 #12
0
ファイル: JRouterSiteTest.php プロジェクト: Rai-Ka/joomla-cms
 /**
  * Tests the parseCheckSSL method
  *
  * @return  void
  *
  * @since         4.0
  */
 public function testParseCheckSSL()
 {
     $app = $this->getMockCmsApp();
     $app->expects($this->never())->method('redirect');
     $object = new JRouterSite($app, $app->getMenu());
     $uri = new JUri('https://www.example.test');
     // No redirect and no error with a https URL
     $object->parseCheckSSL($object, $uri);
     $app = $this->getMockCmsApp();
     $app->expects($this->once())->method('redirect');
     $object = new JRouterSite($app, $app->getMenu());
     $uri = new JUri('http://www.example.test');
     $object->parseCheckSSL($object, $uri);
     $this->assertEquals('https', $uri->getScheme());
 }
コード例 #13
0
ファイル: analyzer.php プロジェクト: knigherrant/decopatio
 /**
  * Main get data method
  *
  * @access public
  * @return Object[]
  */
 public function getData()
 {
     // Load data from XML file, parse it to load records
     $cachedSitemapFilePath = JPATH_COMPONENT_ADMINISTRATOR . '/cache/analyzer/';
     // Has sitemap some vars such as lang or Itemid?
     $sitemapLang = $this->getState('sitemaplang', '');
     $sitemapLinksLang = $sitemapLang ? $sitemapLang . '/' : '';
     $sitemapLang = $sitemapLang ? '_' . $sitemapLang : '';
     $sitemapDataset = $this->getState('sitemapdataset', '');
     $sitemapDataset = $sitemapDataset ? '_dataset' . (int) $sitemapDataset : '';
     $sitemapItemid = $this->getState('sitemapitemid', '');
     $sitemapItemid = $sitemapItemid ? '_menuid' . (int) $sitemapItemid : '';
     // Final name
     $cachedSitemapFilename = 'sitemap_xml' . $sitemapLang . $sitemapDataset . $sitemapItemid . '.xml';
     // Start processing
     try {
         // Now check if the file correctly exists
         if (JFile::exists($cachedSitemapFilePath . $cachedSitemapFilename)) {
             $loadedSitemapXML = simplexml_load_file($cachedSitemapFilePath . $cachedSitemapFilename);
         } else {
             throw new JMapException(JText::sprintf('COM_JMAP_ANALYZER_NOCACHED_FILE_EXISTS', $this->_db->getErrorMsg()), 'error');
         }
         // Execute HTTP request and associate HTTP response code with each record links
         $httpClient = new JMapHttp();
         if ($loadedSitemapXML->url->count()) {
             // Manage splice pagination here for the XML records
             $convertedIteratorToArray = iterator_to_array($loadedSitemapXML->url, false);
             // Store number of records for pagination
             $this->recordsNumber = count($convertedIteratorToArray);
             // Execute pagination splicing if any limit is set
             $limit = $this->getState('limit');
             if ($limit) {
                 $loadedSitemapXML = array_splice($convertedIteratorToArray, $this->getState('limitstart'), $this->getState('limit'));
             } else {
                 $loadedSitemapXML = $convertedIteratorToArray;
             }
             // Now start the Analyzer
             $siteRouter = JRouterSite::getInstance('site', array('mode' => JROUTER_MODE_SEF));
             if (version_compare(JVERSION, '3.4', '>=')) {
                 JApplicationCms::getInstance('site')->loadLanguage();
             }
             $headers = array('Accept' => 'text/html', 'User-Agent' => 'Googlebot-Image/1.0');
             foreach ($loadedSitemapXML as $url) {
                 $httpResponse = $httpClient->get($url->loc, $headers);
                 $url->httpstatus = $httpResponse->code;
                 // Find informations about the link, component and menu itemid if any, need a workaround to parse correctly from backend
                 $baseAdmin = JURI::base();
                 $baseSite = str_replace('/administrator', '', $baseAdmin);
                 $fakedUrl = str_replace($baseSite, $baseAdmin, $url->loc);
                 $fakedUrl = str_replace($sitemapLinksLang, '', $fakedUrl);
                 // Now instantiate and parse the faked url from backend, replacing the uri base it will be = site
                 $uriObject = JURI::getInstance((string) $fakedUrl);
                 $parseUri = $siteRouter->parse($uriObject);
                 // Now augment the object to show informations
                 $url->component = isset($parseUri['option']) ? $parseUri['option'] : JText::_('COM_JMAP_ANALYZER_NOINFO');
                 $url->menuId = isset($parseUri['Itemid']) ? $parseUri['Itemid'] : JText::_('COM_JMAP_ANALYZER_NOINFO');
                 $url->menuTitle = JText::_('COM_JMAP_ANALYZER_NOINFO');
                 // Translate human menu
                 if (isset($parseUri['Itemid'])) {
                     $query = "SELECT" . $this->_db->quoteName('title') . "\n FROM #__menu" . "\n WHERE " . $this->_db->quoteName('id') . " = " . (int) $parseUri['Itemid'];
                     $menuTitle = $this->_db->setQuery($query)->loadResult();
                     $url->menuTitle = $menuTitle;
                 }
             }
             // Perform array sorting if any
             $order = $this->getState('order', null);
             $jmapAnalyzerOrderDir = $this->getState('order_dir', 'asc');
             if ($order == 'httpstatus') {
                 function cmpAsc($a, $b)
                 {
                     return (int) $a->httpstatus < (int) $b->httpstatus ? -1 : 1;
                 }
                 function cmpDesc($a, $b)
                 {
                     return (int) $a->httpstatus > (int) $b->httpstatus ? -1 : 1;
                 }
                 $callbackName = $jmapAnalyzerOrderDir == 'asc' ? 'cmpAsc' : 'cmpDesc';
                 usort($loadedSitemapXML, $callbackName);
             }
             if ($order == 'link') {
                 function cmpAsc($a, $b)
                 {
                     return strcmp($a->loc, $b->loc);
                 }
                 function cmpDesc($a, $b)
                 {
                     return strcmp($b->loc, $a->loc);
                 }
                 $callbackName = $jmapAnalyzerOrderDir == 'asc' ? 'cmpAsc' : 'cmpDesc';
                 usort($loadedSitemapXML, $callbackName);
             }
         } else {
             throw new JMapException(JText::sprintf('COM_JMAP_ANALYZER_EMPTY_SITEMAP', $this->_db->getErrorMsg()), 'notice');
         }
     } catch (JMapException $e) {
         $this->app->enqueueMessage($e->getMessage(), $e->getErrorLevel());
         $loadedSitemapXML = array();
     } catch (Exception $e) {
         $jmapException = new JMapException($e->getMessage(), 'error');
         $this->app->enqueueMessage($jmapException->getMessage(), $jmapException->getErrorLevel());
         $loadedSitemapXML = array();
     }
     return $loadedSitemapXML;
 }
コード例 #14
0
ファイル: csvisef.php プロジェクト: alesconti/FF_2015
 /**
  * Create Joomla SEF URLs
  *
  * In the backend, the languagefilter plugin is not triggered, so we need
  * to add our own language tag to the URL
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see 		http://www.joomla.org/
  * @see			_getSiteRoute()
  * @access 		private
  * @param 		string	$url	the original URL to turn into SEF
  * @return 		string SEF URL
  * @since 		3.0
  */
 private function _joomlaSef($url)
 {
     $jinput = JFactory::getApplication()->input;
     $template = $jinput->get('template', null, null);
     // Load Joomla core files for SEF
     jimport('joomla.application.router');
     require_once JPATH_ROOT . '/includes/application.php';
     require_once JPATH_ROOT . '/includes/router.php';
     $router = new JRouterSite(array('mode' => 1));
     $uri = $router->build($url);
     // Add the language tag since we can't use the languagefilter
     $jconfig = JFactory::getConfig();
     $path = str_ireplace(JURI::root(true), '', $uri->getPath());
     $adminpos = strpos($path, '/administrator/');
     // Check if the language filter is being used
     if (JPluginHelper::isEnabled('system', 'languagefilter')) {
         if ($jconfig->get('sef_rewrite')) {
             // Using SEF Rewrite
             if ($adminpos !== false) {
                 $path = substr($template->get('language', 'general'), 0, 2) . '/' . substr($path, $adminpos + 15);
             }
         } else {
             //  Not using SEF Rewrite
             if ($adminpos !== false) {
                 $path = 'index.php/' . substr($template->get('language', 'general'), 0, 2) . '/' . substr($path, $adminpos + 24);
             }
         }
     } else {
         if ($adminpos !== false) {
             $path = substr($path, $adminpos + 15);
         }
     }
     $uri->setPath($path);
     return $uri->toString();
 }
コード例 #15
0
ファイル: router.php プロジェクト: BetterBetterBetter/B3App
 public static function getRoutedURL($url, $xhtml = false, $external = false)
 {
     if (!$external) {
         return DiscussRouter::_($url, $xhtml);
     }
     $mainframe = JFactory::getApplication();
     $uri = JURI::getInstance(JURI::base());
     //To fix 1.6 Jroute issue as it will include the administrator into the url path.
     $url = str_replace('/administrator/', '/', DiscussRouter::_($url, $xhtml));
     if ($mainframe->isAdmin() && DiscussRouter::isSefEnabled()) {
         if (DiscussHelper::getJoomlaVersion() >= '1.6') {
             JFactory::$application = JApplication::getInstance('site');
         }
         if (DiscussHelper::getJoomlaVersion() >= '3.0') {
             jimport('joomla.libraries.cms.router');
         } else {
             jimport('joomla.application.router');
             require_once JPATH_ROOT . '/includes/router.php';
             require_once JPATH_ROOT . '/includes/application.php';
         }
         $router = new JRouterSite(array('mode' => JROUTER_MODE_SEF));
         $urls = $router->build($url)->toString(array('path', 'query', 'fragment'));
         $urls = DISCUSS_JURIROOT . '/' . ltrim(str_replace('/administrator/', '/', $urls), '/');
         $container = explode('/', $urls);
         $container = array_unique($container);
         $urls = implode('/', $container);
         if (DiscussHelper::getJoomlaVersion() >= '1.6') {
             JFactory::$application = JApplication::getInstance('administrator');
         }
         return $urls;
     } else {
         $url = rtrim($uri->toString(array('scheme', 'host', 'port')), '/') . '/' . ltrim($url, '/');
         $url = str_replace('/administrator/', '/', $url);
         if (DiscussRouter::isSefEnabled()) {
             $container = explode('/', $url);
             $container = array_unique($container);
             $url = implode('/', $container);
         }
         return $url;
     }
 }
コード例 #16
0
ファイル: weibo.php プロジェクト: apachesep/joomla-weibo
 function __construct($options = array())
 {
     parent::__construct($options);
 }