Example #1
0
 /**
  * Loads all the plugin files for a particular type if no specific plugin is specified
  * otherwise only the specific pugin is loaded.
  *
  * @access public
  * @param string 	$type 	The plugin type, relates to the sub-directory in the plugins directory
  * @param string 	$plugin	The plugin name
  * @return boolean True if success
  */
 public static function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null)
 {
     $result = false;
     $plugins = JPluginHelper::_load();
     $total = count($plugins);
     for ($i = 0; $i < $total; $i++) {
         if ($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) {
             JPluginHelper::_import($plugins[$i], $autocreate, $dispatcher);
             $result = true;
         }
     }
     return $result;
 }
 /**
  * Loads all the plugin files for a particular type if no specific plugin is specified
  * otherwise only the specific pugin is loaded.
  *
  * @access public
  * @param string 	$type 	The plugin type, relates to the sub-directory in the plugins directory
  * @param string 	$plugin	The plugin name
  * @return boolean True if success
  */
 function importPlugin($type, $plugin = null)
 {
     $result = false;
     $plugins = JPluginHelper::_load();
     $total = count($plugins);
     for ($i = 0; $i < $total; $i++) {
         if ($plugins[$i]->type == $type && ($plugins[$i]->element == $plugin || $plugin === null)) {
             JPluginHelper::_import($plugins[$i]);
             $result = true;
         }
     }
     return $result;
 }
Example #3
0
 /**
  * Loads all the plugin files for a particular type if no specific plugin is specified
  * otherwise only the specific pugin is loaded.
  *
  * @access	public
  * @param	string 		$type 		The plugin type, relates to the sub-directory in the plugins directory.
  * @param	string 		$plugin		The plugin name.
  * @return	boolean		True if success
  */
 public static function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null)
 {
     $results = null;
     // Load the plugins from the database.
     $plugins = JPluginHelper::_load();
     // Get the specified plugin(s).
     for ($i = 0, $t = count($plugins); $i < $t; $i++) {
         if ($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) {
             JPluginHelper::_import($plugins[$i], $autocreate, $dispatcher);
             $results = true;
         }
     }
     return $results;
 }
Example #4
0
    exit;
}
define('_JEXEC', 1);
define('JPATH_BASE', dirname(dirname(dirname(dirname(dirname(__FILE__))))));
define('DS', DIRECTORY_SEPARATOR);
$results = array();
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'import.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'user' . DS . 'user.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'language' . DS . 'language.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'environment' . DS . 'uri.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'event' . DS . 'dispatcher.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'utilities' . DS . 'string.php';
require JPATH_LIBRARIES . DS . 'joomla' . DS . 'application' . DS . 'menu.php';
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$plugins = JPluginHelper::_load();
$total = count($plugins);
for ($i = 0; $i < $total; $i++) {
    if ($plugins[$i]->type == 'system' && in_array($plugins[$i]->name, array('sef', 'sef_advance'))) {
        JPluginHelper::_import($plugins[$i]);
    }
}
$mainframe->triggerEvent('onAfterInitialise');
foreach ($_POST['pages'] as $url) {
    $url = urldecode($url);
    $results[] = JRoute::_($url);
}
print_r($results);
unset($mainframe);
return $results;
Example #5
0
 function processArticle($article, $art, $text = '', $type = 'article')
 {
     if ($type == 'k2' && !$this->params->dbselects_k2) {
         $type = '';
     }
     $regex = '#\\{(/?[^\\}]+)\\}#si';
     if (preg_match_all($regex, $text, $matches, PREG_SET_ORDER) > 0) {
         if ($type == 'k2') {
             $selects = $this->params->dbselects_k2;
         } else {
             $selects = $this->params->dbselects_content;
         }
         foreach ($matches as $match) {
             $data = trim($match['1']);
             if (!(strpos($data, 'intro') === false)) {
                 $selects[] = 'introtext';
             } else {
                 if (!(strpos($data, 'full') === false)) {
                     $selects[] = 'fulltext';
                 } else {
                     if (!(strpos($data, 'text') === false)) {
                         $selects[] = 'introtext';
                         $selects[] = 'fulltext';
                     }
                 }
             }
         }
         $selects = array_unique($selects);
         $selects = 'c.`' . implode('`, c.`', $selects) . '`';
         $joins = '';
         if ($type == 'article') {
             $selects .= ', CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug';
             $selects .= ', CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug';
             $joins = ' LEFT JOIN #__categories as cc ON cc.id = c.catid';
         }
         $where = ' AND ( c.title = ' . $this->database->quote(NoNumberElementsFunctions::html_entity_decoder($article));
         $where .= ' OR c.alias = ' . $this->database->quote(NoNumberElementsFunctions::html_entity_decoder($article));
         if (is_numeric($article)) {
             $where .= ' OR c.id = ' . $article;
         }
         $where .= ' ) ';
         if (!$this->params->ignore_state) {
             $jnow =& JFactory::getDate();
             $now = $jnow->toMySQL();
             $nullDate = $this->database->getNullDate();
             if ($type == 'k2') {
                 $where .= ' AND c.published = 1 AND trash = 0';
             } else {
                 $where .= ' AND c.state = 1';
             }
             $where .= ' AND ( c.publish_up = ' . $this->database->quote($nullDate) . ' OR c.publish_up <= ' . $this->database->quote($now) . ' )' . ' AND ( c.publish_down = ' . $this->database->quote($nullDate) . ' OR c.publish_down >= ' . $this->database->quote($now) . ' )';
         }
         $query = 'SELECT ' . $selects . ' FROM ' . ($type == 'k2' ? '#__k2_items as c' : '#__content as c') . $joins . ' WHERE c.access ' . (defined('_JACL') ? 'IN (' . $this->params->aid_jaclplus . ')' : '<= ' . (int) $this->params->aid) . $where . ' ORDER BY c.ordering' . ' LIMIT 1';
         $this->database->setQuery($query);
         $article = $this->database->loadObject();
         if (!$article) {
             return '<!-- ' . JText::_('AA_ACCESS_TO_ARTICLE_DENIED') . ' -->';
         }
         $ifregex = '#\\{if:([^\\}]+)\\}(.*?)(?:\\{else\\}(.*?))?\\{/if\\}#si';
         if (preg_match_all($ifregex, $text, $ifs, PREG_SET_ORDER) > 0) {
             foreach ($ifs as $if) {
                 $pass = 0;
                 $eval = '$pass = ( ( $article->' . str_replace('=', '==', trim($if['1'])) . ' ) ? 1 : 0 );';
                 $eval = str_replace('$article->!', '!$article->', $eval);
                 eval($eval);
                 if (!$pass) {
                     $text = str_replace($if['0'], isset($if['3']) ? $if['3'] : '', $text);
                 } else {
                     $text = str_replace($if['0'], $if['2'], $text);
                 }
             }
         }
     }
     if (preg_match_all($regex, $text, $matches, PREG_SET_ORDER) > 0) {
         foreach ($matches as $match) {
             $data = trim($match['1']);
             $ok = 0;
             $str = '';
             $data = explode(':', $data, 2);
             $tag = trim($data['0']);
             $extra = isset($data['1']) ? trim($data['1']) : '';
             if ($tag == '/link') {
                 $str = '</a>';
                 $ok = 1;
             } else {
                 if ($tag == '/div') {
                     $str = '</div>';
                     $ok = 1;
                 } else {
                     if ($tag == 'div' || strpos($tag, 'div ') === 0) {
                         if ($tag != 'div') {
                             $extra = str_replace('div ', '', $tag) . ':' . $extra;
                         }
                         $str = '';
                         if ($extra) {
                             $extra = explode('|', $extra);
                             $extras = new stdClass();
                             foreach ($extra as $e) {
                                 if (!(strpos($e, ':') === false)) {
                                     list($key, $val) = explode(':', $e, 2);
                                     $extras->{$key} = $val;
                                 }
                             }
                             if (isset($extras->class)) {
                                 $str .= 'class="' . $extras->class . '"';
                             }
                             $style = array();
                             if (isset($extras->width)) {
                                 if (is_numeric($extras->width)) {
                                     $extras->width .= 'px';
                                 }
                                 $style[] = 'width:' . $extras->width;
                             }
                             if (isset($extras->height)) {
                                 if (is_numeric($extras->height)) {
                                     $extras->height .= 'px';
                                 }
                                 $style[] = 'height:' . $extras->height;
                             }
                             if (isset($extras->align)) {
                                 $style[] = 'float:' . $extras->align;
                             } else {
                                 if (isset($extras->float)) {
                                     $style[] = 'float:' . $extras->float;
                                 }
                             }
                             if (!empty($style)) {
                                 $str .= ' style="' . implode(';', $style) . ';"';
                             }
                         }
                         $str = trim('<div ' . trim($str)) . '>';
                         $ok = 1;
                     } else {
                         if ($tag == 'link' || $tag == 'url' || !(strpos($tag, 'readmore') === false)) {
                             if (isset($article->id)) {
                                 if ($type == 'k2') {
                                     $link = 'index.php?option=com_k2&view=item&id=' . $article->id;
                                     $component =& JComponentHelper::getComponent('com_k2');
                                     $menus =& JApplication::getMenu('site', array());
                                     $menuitems = $menus->getItems('componentid', $component->id);
                                     $id = 0;
                                     if (is_array($menuitems)) {
                                         foreach ($menuitems as $item) {
                                             if (@$item->query['view'] == 'item' && @$item->query['layout'] == 'item' && @$item->query['id'] == $article->id) {
                                                 $id = $item->id;
                                                 break;
                                             }
                                         }
                                         if (!$id) {
                                             foreach ($menuitems as $item) {
                                                 if (@$item->query['view'] == 'itemlist' && @$item->query['layout'] == 'category' && @$item->query['id'] == $article->catid) {
                                                     $id = $item->id;
                                                     break;
                                                 }
                                             }
                                         }
                                     }
                                 } else {
                                     $slug = 'id=' . $article->slug;
                                     if ($article->catid) {
                                         $slug .= '&catid=' . $article->catslug;
                                     }
                                     $link = 'index.php?option=com_content&view=article&' . $slug;
                                     $component =& JComponentHelper::getComponent('com_content');
                                     $menus =& JApplication::getMenu('site', array());
                                     $menuitems = $menus->getItems('componentid', $component->id);
                                     $id = 0;
                                     if (is_array($menuitems)) {
                                         foreach ($menuitems as $item) {
                                             if (@$item->query['view'] == 'article' && @$item->query['id'] == $article->id) {
                                                 $id = $item->id;
                                                 break;
                                             }
                                         }
                                         if (!$id) {
                                             foreach ($menuitems as $item) {
                                                 if (@$item->query['view'] == 'category' && @$item->query['id'] == $article->catid) {
                                                     $id = $item->id;
                                                     break;
                                                 }
                                             }
                                         }
                                         if (!$id) {
                                             foreach ($menuitems as $item) {
                                                 if (@$item->query['view'] == 'section' && @$item->query['id'] == $article->sectionid) {
                                                     $id = $item->id;
                                                     break;
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 if ($id) {
                                     $link .= '&Itemid=' . $id;
                                 }
                                 $link = JRoute::_($link);
                                 if ($tag == 'link') {
                                     $str = '<a href="' . $link . '">';
                                 } else {
                                     if ($tag == 'url') {
                                         $str = $link;
                                     } else {
                                         $readmore = JText::_('Read more...');
                                         $class = 'readon';
                                         if ($extra) {
                                             $extra = explode('|', $extra);
                                             if (trim($extra['0'])) {
                                                 $readmore = JText::_(trim($extra['0']));
                                             }
                                             if (isset($extra['1'])) {
                                                 $class = trim($extra['1']);
                                             }
                                         }
                                         $str = '<a href="' . $link . '" class="' . $class . '">' . $readmore . '</a>';
                                     }
                                 }
                                 $ok = 1;
                             }
                         } else {
                             if (!(strpos($tag, 'text') === false) || !(strpos($tag, 'intro') === false) || !(strpos($tag, 'full') === false)) {
                                 // TEXT data
                                 $article->text = '';
                                 if (!(strpos($tag, 'intro') === false)) {
                                     if (isset($article->introtext)) {
                                         $article->text = $article->introtext;
                                         $ok = 1;
                                     }
                                 } else {
                                     if (!(strpos($tag, 'full') === false)) {
                                         if (isset($article->fulltext)) {
                                             $article->text = $article->fulltext;
                                             $ok = 1;
                                         }
                                     } else {
                                         if (!(strpos($tag, 'text') === false)) {
                                             if (isset($article->introtext) && isset($article->fulltext)) {
                                                 $article->text = $article->introtext . $article->fulltext;
                                                 $ok = 1;
                                             }
                                         }
                                     }
                                 }
                                 if ($type == 'k2') {
                                     $article->parameters = new JParameter($article->params);
                                 } else {
                                     $article->parameters = new JParameter($article->attribs);
                                 }
                                 if ($this->params->run_content_plugins) {
                                     if (!$this->params->dispatcher) {
                                         $plugins = JPluginHelper::_load();
                                         foreach ($plugins as $plugin) {
                                             if ($plugin->type == 'content' || $plugin->type == 'system' || $plugin->type == 'k2') {
                                                 JPluginHelper::_import($plugin);
                                             }
                                         }
                                         $this->params->dispatcher = clone JDispatcher::getInstance();
                                         foreach ($this->params->dispatcher->_observers as $i => $observer) {
                                             if (!is_array($observer) && ($observer->_name == 'articlesanywhere' || $observer->_name == 'betterpreview')) {
                                                 unset($this->params->dispatcher->_observers[$i]);
                                             }
                                         }
                                     }
                                     $this->params->dispatcher->trigger('onPrepareContent', array(&$article, &$article->parameters, 0));
                                 }
                                 $str = $article->text;
                                 if ($extra) {
                                     $attribs = explode(':', $extra);
                                     $max = 0;
                                     $strip = 0;
                                     foreach ($attribs as $attrib) {
                                         if (trim($attrib) == 'strip') {
                                             $strip = 1;
                                         } else {
                                             $max = $attrib;
                                         }
                                     }
                                     $word_limit = !(strpos($max, 'word') === false);
                                     if ($strip) {
                                         // remove pagenavcounter
                                         $str = preg_replace('#(<' . 'div class="pagenavcounter">.*?</div>)#si', ' ', $str);
                                         // remove pagenavbar
                                         $str = preg_replace('#(<' . 'div class="pagenavbar">(<div>.*?</div>)*</div>)#si', ' ', $str);
                                         // remove scripts
                                         $str = preg_replace('#(<' . 'script[^a-z0-9].*?</script>)#si', ' ', $str);
                                         $str = preg_replace('#(<' . 'noscript[^a-z0-9].*?</noscript>)#si', ' ', $str);
                                         // remove other tags
                                         $str = preg_replace('#(<' . '/?[a-z][a-z0-9]?.*?>)#si', ' ', $str);
                                         // remove double whitespace
                                         $str = trim(preg_replace('#\\s+#s', ' ', $str));
                                         if ($max) {
                                             $orig_len = strlen($str);
                                             if ($word_limit) {
                                                 // word limit
                                                 $str = trim(preg_replace('#^(([^\\s]+\\s*){' . (int) $max . '}).*$#s', '\\1', $str));
                                                 if (strlen($str) < $orig_len) {
                                                     if (preg_match('#[^a-z0-9]$#si', $str)) {
                                                         $str .= ' ';
                                                     }
                                                     if ($this->params->use_ellipsis) {
                                                         $str .= '...';
                                                     }
                                                 }
                                             } else {
                                                 // character limit
                                                 $max = (int) $max;
                                                 if ($max < $orig_len) {
                                                     $str = rtrim(substr($str, 0, $max - 3));
                                                     if (preg_match('#[^a-z0-9]$#si', $str)) {
                                                         $str .= ' ';
                                                     }
                                                     if ($this->params->use_ellipsis) {
                                                         $str .= '...';
                                                     }
                                                 }
                                             }
                                         }
                                     } else {
                                         if ($max && ($word_limit || (int) $max < strlen($str))) {
                                             $max = (int) $max;
                                             // store pagenavcounter & pagenav (exclude from count)
                                             preg_match('#<' . 'div class="pagenavcounter">.*?</div>#si', $str, $pagenavcounter);
                                             $pagenavcounter = isset($pagenavcounter['0']) ? $pagenavcounter['0'] : '';
                                             if ($pagenavcounter) {
                                                 $str = str_replace($pagenavcounter, '<!-- ARTA_PAGENAVCOUNTER -->', $str);
                                             }
                                             preg_match('#<' . 'div class="pagenavbar">(<div>.*?</div>)*</div>#si', $str, $pagenav);
                                             $pagenav = isset($pagenav['0']) ? $pagenav['0'] : '';
                                             if ($pagenav) {
                                                 $str = str_replace($pagenav, '<!-- ARTA_PAGENAV -->', $str);
                                             }
                                             // add explode helper strings around tags
                                             $explode_str = '<!-- ARTA_TAG -->';
                                             $str = preg_replace('#(<\\/?[a-z][a-z0-9]?.*?>|<!--.*?-->)#si', $explode_str . '\\1' . $explode_str, $str);
                                             $str_array = explode($explode_str, $str);
                                             $str = array();
                                             $tags = array();
                                             $count = 0;
                                             $is_script = 0;
                                             foreach ($str_array as $i => $str_part) {
                                                 if (fmod($i, 2)) {
                                                     // is tag
                                                     $str[] = $str_part;
                                                     preg_match('#^<(\\/?([a-z][a-z0-9]*))#si', $str_part, $tag);
                                                     if (!empty($tag)) {
                                                         if ($tag['1'] == 'script') {
                                                             $is_script = 1;
                                                         }
                                                         if (!$is_script && strpos($str_part, '/>') === false && !in_array($tag['2'], array('area', 'br', 'hr', 'img', 'input', 'param'))) {
                                                             $tags[] = $tag['1'];
                                                         }
                                                         if ($tag['1'] == '/script') {
                                                             $is_script = 0;
                                                         }
                                                     }
                                                 } else {
                                                     if ($is_script) {
                                                         $str[] = $str_part;
                                                     } else {
                                                         if ($word_limit) {
                                                             // word limit
                                                             if ($str_part) {
                                                                 $words = explode(' ', trim($str_part));
                                                                 $word_count = count($words);
                                                                 if ($max < $count + $word_count) {
                                                                     $words_part = array();
                                                                     $word_count = 0;
                                                                     foreach ($words as $word) {
                                                                         if ($word) {
                                                                             $word_count++;
                                                                         }
                                                                         if ($max < $count + $word_count) {
                                                                             break;
                                                                         }
                                                                         $words_part[] = $word;
                                                                     }
                                                                     $string = rtrim(implode(' ', $words_part));
                                                                     if (preg_match('#[^a-z0-9]$#si', $string)) {
                                                                         $string .= ' ';
                                                                     }
                                                                     if ($this->params->use_ellipsis) {
                                                                         $string .= '...';
                                                                     }
                                                                     $str[] = $string;
                                                                     break;
                                                                 }
                                                                 $count += $word_count;
                                                             }
                                                             $str[] = $str_part;
                                                         } else {
                                                             // character limit
                                                             if ($max < $count + strlen($str_part)) {
                                                                 // strpart has to be cut off
                                                                 $maxlen = $max - $count;
                                                                 if ($maxlen < 3) {
                                                                     $string = '';
                                                                     if (preg_match('#[^a-z0-9]$#si', $str_part)) {
                                                                         $string .= ' ';
                                                                     }
                                                                     if ($this->params->use_ellipsis) {
                                                                         $string .= '...';
                                                                     }
                                                                     $str[] = $string;
                                                                 } else {
                                                                     $string = rtrim(substr($str_part, 0, $maxlen - 3));
                                                                     if (preg_match('#[^a-z0-9]$#si', $string)) {
                                                                         $string .= ' ';
                                                                     }
                                                                     if ($this->params->use_ellipsis) {
                                                                         $string .= '...';
                                                                     }
                                                                     $str[] = $string;
                                                                 }
                                                                 break;
                                                             }
                                                             $count += strlen($str_part);
                                                             $str[] = $str_part;
                                                         }
                                                     }
                                                 }
                                             }
                                             // revers sort open tags
                                             krsort($tags);
                                             $tags = array_values($tags);
                                             $count = count($tags);
                                             for ($i = 0; $i < 3; $i++) {
                                                 foreach ($tags as $ti => $tag) {
                                                     if ($tag['0'] == '/') {
                                                         for ($oi = $ti + 1; $oi < $count; $oi++) {
                                                             $opentag = $tags[$oi];
                                                             if ($opentag == $tag) {
                                                                 break;
                                                             }
                                                             if ('/' . $opentag == $tag) {
                                                                 unset($tags[$ti]);
                                                                 unset($tags[$oi]);
                                                                 break;
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                             foreach ($tags as $tag) {
                                                 // add closing tag to end of string
                                                 if ($tag['0'] != '/') {
                                                     $str[] = '</' . $tag . '>';
                                                 }
                                             }
                                             $str = implode('', $str);
                                             $str = str_replace(array('<!-- ARTA_PAGENAVCOUNTER -->', '<!-- ARTA_PAGENAV -->'), array($pagenavcounter, $pagenav), $str);
                                         }
                                     }
                                 }
                                 if ($art && isset($art->id) && $art->id) {
                                     $str = str_replace('view=article&amp;id=' . $art->id, 'view=article&amp;id=' . $article->id, $str);
                                 }
                             } else {
                                 // Get data from db columns
                                 if (isset($article->{$tag})) {
                                     $str = $article->{$tag};
                                     $ok = 1;
                                 }
                                 // otherwise get data from parameter data
                                 if (!$ok) {
                                     $params = new stdClass();
                                     if (isset($article->attribs)) {
                                         $params = $this->parameters->getParams($article->attribs);
                                     } else {
                                         if (isset($article->params)) {
                                             $params = $this->parameters->getParams($article->params);
                                         }
                                     }
                                     if ($params && isset($params->{$tag})) {
                                         $str = $params->{$tag};
                                         $ok = 1;
                                     }
                                 }
                                 // otherwise get data from extra fields (for k2 items)
                                 if (!$ok && $type == 'k2') {
                                     $extravalue = $this->getExtraFieldValue($article->extra_fields, $tag, $article->catid);
                                     if ($extravalue !== null) {
                                         $str = $extravalue;
                                         $ok = 1;
                                     }
                                 }
                                 if ($ok && !(strpos($str, '-') == false) && !preg_match('#[a-z]#i', $str) && strtotime($str)) {
                                     if ($extra && strpos($extra, '%') === false) {
                                         $extra = NoNumberElementsFunctions::dateToStrftimeFormat($extra);
                                     }
                                     $str = JHTML::_('date', strtotime($str), $extra);
                                 }
                             }
                         }
                     }
                 }
             }
             if ($ok) {
                 $text = str_replace($match['0'], $str, $text);
             }
         }
     }
     return $text;
 }
Example #6
0
 /**
  * This function is used as a replacement to JRoute::_() to generate sef urls in Joomla admin
  * 
  * @param mixed $urls
  * @param mixed $xhtml
  * @param mixed $ssl
  */
 function siteRoute($urls, $xhtml = true, $ssl = null)
 {
     global $mainframe;
     !is_array($urls) and $urls = array($urls);
     $parsed_urls = array();
     // Check if plugins already processed
     $_this = cmsFramework::getInstance();
     if (!is_object($_this->jMainframe)) {
         // Backup original mainframe object
         $_this->jMainframe = clone $mainframe;
         // Get a new mainframe object to process the sef plugins
         $mainframe = JApplication::getInstance('site');
         $router = $mainframe->getRouter();
         $plugins = JPluginHelper::_load();
         $total = count($plugins);
         for ($i = 0; $i < $total; $i++) {
             $plugins[$i]->type == 'system' and in_array($plugins[$i]->name, $_this->sef_plugins) and JPluginHelper::_import($plugins[$i]);
         }
         if (class_exists('plgSystemSEF_Advance')) {
             plgSystemSEF_Advance::trigger();
         } else {
             $mainframe->triggerEvent('onAfterInitialise');
         }
         // Store modified mainframe object with sef plugin router
         $_this->newMainframe = $mainframe;
     } else {
         // Load the modified mainframe object with sef plugin router
         $mainframe = $_this->newMainframe;
     }
     $router = $mainframe->getRouter();
     foreach ($urls as $url) {
         $uri = $router->build($url);
         $parsed_url = $uri->toString();
         $parsed_urls[] = str_replace('/administrator', '', $parsed_url);
     }
     // Restore original mainframe object
     $mainframe = $_this->jMainframe;
     return count($parsed_urls) == 1 ? array_shift($parsed_urls) : $parsed_urls;
 }