Exemple #1
0
 function processModule($module, $style = 'none', $overrides = array())
 {
     $db =& JFactory::getDBO();
     $where = ' AND ( title=' . $db->quote(NoNumberElementsFunctions::html_entity_decoder($module)) . '';
     if (is_numeric($module)) {
         $where .= ' OR id=' . $module;
     }
     $where .= ' ) ';
     if (!$this->params->ignore_state) {
         $where .= ' AND published = 1';
     }
     $query = 'SELECT *' . ' FROM #__modules' . ' WHERE client_id = 0' . ' AND access ' . (defined('_JACL') ? 'IN (' . $this->params->aid_jaclplus . ')' : '<= ' . (int) $this->params->aid) . $where . ' ORDER BY ordering' . ' LIMIT 1';
     $db->setQuery($query);
     $module = $db->loadObject();
     $html = '';
     if ($module) {
         //determine if this is a custom module
         $module->user = substr($module->module, 0, 4) == 'mod_' ? 0 : 1;
         // set style
         $module->style = $style;
         // override module settings
         $params = '';
         foreach ($overrides as $key => $val) {
             $params .= "\n" . $key . '=' . $val;
         }
         if ($params != '') {
             $module->params = trim($module->params) . $params . "\n\n";
         }
         $document = clone JFactory::getDocument();
         $document->_type = 'html';
         $renderer = $document->loadRenderer('module');
         $html = $renderer->render($module, array('style' => $style));
     }
     return $html;
 }
Exemple #2
0
 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $document =& JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/plugins/system/nonumberelements/css/style.css?v=' . $this->_version);
     $title = $this->def('label');
     $description = $this->def('description');
     $xml = $this->def('xml');
     $lang_file = $this->def('language_file');
     $image = $this->def('image');
     $image_w = $this->def('image_w');
     $image_h = $this->def('image_h');
     $url = $this->def('url');
     $help_url = $this->def('help_url');
     if ($description) {
         // variables
         $v1 = $this->def('var1');
         $v2 = $this->def('var2');
         $v3 = $this->def('var3');
         $v4 = $this->def('var4');
         $v5 = $this->def('var5');
         $description = NoNumberElementsFunctions::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
     }
     if ($lang_file) {
         jimport('joomla.filesystem.file');
         // Include extra language file
         $language =& JFactory::getLanguage();
         $lang = str_replace('_', '-', $language->getTag());
         $inc = '';
         $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
         if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
             $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
         } else {
             if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                 $inc = JPATH_SITE . DS . $lang_path;
             }
         }
         if (!$inc && $lang != 'en-GB') {
             $lang = 'en-GB';
             $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
             if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
                 $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
             } else {
                 if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                     $inc = JPATH_SITE . DS . $lang_path;
                 }
             }
         }
         if ($inc) {
             include $inc;
         }
     }
     if ($title) {
         $title = JText::_($title);
     }
     if ($description) {
         $description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
         if ($description['0'] != '<') {
             $description = '<p>' . $description . '</p>';
         }
     }
     if ($xml) {
         $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . str_replace('/', DS, $xml));
         $version = 0;
         if ($xml && isset($xml['version'])) {
             $version = $xml['version'];
         }
         if ($version) {
             if ($title) {
                 $title .= ' v' . $version;
             } else {
                 $title = JText::_('Version') . ' ' . $version;
             }
         }
     }
     if ($url) {
         $url = '<a href="' . $url . '" target="_blank" title="' . $title . '">';
     }
     $html = array();
     $html[] = '<div class="panel nn_panel' . ($j15 ? ' nn_panel_15' : '') . '"><div class="nn_block nn_title">';
     if ($image) {
         $image = str_replace('/', "\n", str_replace('\\', '/', $image));
         $image = explode("\n", trim($image));
         if ($image['0'] == 'administrator') {
             $image['0'] = JURI::base(true);
         } else {
             $image['0'] = JURI::root(true) . '/' . $image['0'];
         }
         $image = '<img src="' . implode('/', $image) . '" border="0" style="float:right;margin-left:10px" alt=""';
         if ($image_w) {
             $image .= ' width="' . $image_w . '"';
         }
         if ($image_h) {
             $image .= ' height="' . $image_h . '"';
         }
         $image .= ' />';
         if ($url) {
             $image = $url . $image . '</a>';
         }
         $html[] = $image;
     }
     if ($title) {
         if ($url) {
             $title = $url . $title . '</a>';
         }
         $html[] = '<h4 style="margin: 0px;">' . NoNumberElementsFunctions::html_entity_decoder($title) . '</h4>';
     }
     if ($description) {
         $html[] = $description;
     }
     if ($help_url) {
         $html[] = '<p><a href="' . $help_url . '" target="_blank" title="' . JText::_('NN_MORE_INFO') . '">' . JText::_('NN_MORE_INFO') . '...</a></p>';
     }
     $html[] = '<div style="clear: both;"></div>';
     $html[] = '</div></div>';
     return implode($html);
 }
Exemple #3
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;
 }
Exemple #4
0
 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $label = $this->def('label');
     $description = $this->def('description');
     $lang_file = $this->def('language_file');
     $show_apply = $this->def('show_apply');
     $html = '</td></tr></table></div></div>';
     $html .= '<div class="panel"><h3 class="jpane-toggler title" id="advanced-page"><span>';
     $html .= NoNumberElementsFunctions::html_entity_decoder(JText::_($label));
     $html .= '</span></h3>';
     $html .= '<div class="jpane-slider content"><table width="100%" class="paramlist admintable" cellspacing="1"><tr><td colspan="2" class="paramlist_value">';
     if ($description) {
         // variables
         $v1 = $this->def('var1');
         $v2 = $this->def('var2');
         $v3 = $this->def('var3');
         $v4 = $this->def('var4');
         $v5 = $this->def('var5');
         $description = NoNumberElementsFunctions::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
     }
     if ($lang_file) {
         jimport('joomla.filesystem.file');
         // Include extra language file
         $language =& JFactory::getLanguage();
         $lang = str_replace('_', '-', $language->getTag());
         $inc = '';
         $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
         if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
             $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
         } else {
             if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                 $inc = JPATH_SITE . DS . $lang_path;
             }
         }
         if (!$inc && $lang != 'en-GB') {
             $lang = 'en-GB';
             $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
             if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
                 $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
             } else {
                 if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                     $inc = JPATH_SITE . DS . $lang_path;
                 }
             }
         }
         if ($inc) {
             include $inc;
         }
     }
     if ($description) {
         $description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
         if ($description['0'] != '<') {
             $description = '<p>' . $description . '</p>';
         }
         $class = 'panel nn_panel nn_panel_description';
         if ($j15) {
             $class .= ' nn_panel_15';
         }
         $html .= '<div class="' . $class . '"><div class="nn_block nn_title">';
         if ($show_apply) {
             $apply_button = '<a href="#" onclick="submitbutton( \'apply\' );" title="' . JText::_('Apply') . '"><img align="right" border="0" alt="' . JText::_('Apply') . '" src="images/tick.png"/></a>';
             $html .= $apply_button;
         }
         $html .= $description;
         $html .= '<div style="clear: both;"></div></div></div>';
     }
     return $html;
 }
Exemple #5
0
 private function getTitleBlock($title = '', $description = '', $start = 0, $j15 = 0)
 {
     $nostyle = $this->def('nostyle', 0);
     if ($title) {
         $title = NoNumberElementsFunctions::html_entity_decoder(JText::_($title));
     }
     if ($description) {
         // variables
         $v1 = $this->def('var1');
         $v2 = $this->def('var2');
         $v3 = $this->def('var3');
         $v4 = $this->def('var4');
         $v5 = $this->def('var5');
         $description = NoNumberElementsFunctions::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
         $description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
     }
     $html = array();
     if ($title) {
         if ($nostyle) {
             $html[] = '<div style="clear:both;"><div>';
         } else {
             $class = 'panel nn_panel nn_panel_title';
             if ($j15) {
                 $class .= ' nn_panel_15';
             }
             if ($start || $description) {
                 $class .= ' nn_panel_top';
             }
             $html[] = '<div class="' . $class . '"><div class="nn_block nn_title">';
         }
         $html[] = $title;
         $html[] = '<div style="clear: both;"></div>';
         $html[] = '</div></div>';
     }
     if ($description) {
         if ($nostyle) {
             $html[] = '<div style="clear:both;"><div>';
         } else {
             $class = 'panel nn_panel nn_panel_description';
             if ($j15) {
                 $class .= ' nn_panel_15';
             }
             if ($start) {
                 $class .= ' nn_panel_top';
             }
             if ($title) {
                 $class .= ' nn_panel_hastitle';
             }
             $html[] = '<div class="' . $class . '"><div class="nn_block nn_title">';
         }
         $html[] = $description;
         $html[] = '<div style="clear: both;"></div>';
         $html[] = '</div></div>';
     }
     return implode($html);
 }
Exemple #6
0
 function getInput($name, $id, $value, $params, $children, $j15 = 0)
 {
     $this->params = $params;
     $start = $this->def('start');
     $end = $this->def('end');
     $blocktype = $this->def('blocktype');
     if ($blocktype == 'spacer') {
         return;
     }
     $document =& JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/plugins/system/nonumberelements/css/style.css?v=' . $this->_version);
     if ($end) {
         $html = '';
         if ($j15) {
             $random = rand(100000, 999999);
             $html .= '<div id="end-' . $random . '"></div><script type="text/javascript">NoNumberElementsHideTD( "end-' . $random . '" );</script>';
             $html .= '</td></tr></table>';
         } else {
             $html .= '<div style="clear: both;"></div></li></ul>';
         }
         if ($j15 && $blocktype == 'fieldset') {
             $html .= '</fieldset>';
         } else {
             $html .= '</div></div>';
         }
         return $html;
     }
     $description = $this->def('description');
     $nostyle = $this->def('nostyle');
     $title = $this->def('label');
     $lang_file = $this->def('language_file');
     $message_type = $this->def('message_type');
     $image = $this->def('image');
     $image_w = $this->def('image_w');
     $image_h = $this->def('image_h');
     $show_apply = $this->def('show_apply');
     $toggle = $this->def('toggle');
     $tooltip = $this->def('tooltip');
     // The main url
     $url = $this->def('url');
     $help = $this->def('help_url');
     $extension = $this->def('extension');
     $xml = $this->def('xml');
     $version = $this->def('version');
     $version_file = $this->def('version_file');
     if (!$extension) {
         $extension = str_replace('version_', '', $version_file);
     }
     $msg = '';
     if ($description) {
         // variables
         $v1 = $this->def('var1');
         $v2 = $this->def('var2');
         $v3 = $this->def('var3');
         $v4 = $this->def('var4');
         $v5 = $this->def('var5');
         $description = NoNumberElementsFunctions::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
     }
     if ($lang_file) {
         jimport('joomla.filesystem.file');
         // Include extra language file
         $language =& JFactory::getLanguage();
         $lang = str_replace('_', '-', $language->getTag());
         $inc = '';
         $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
         if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
             $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
         } else {
             if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                 $inc = JPATH_SITE . DS . $lang_path;
             }
         }
         if (!$inc && $lang != 'en-GB') {
             $lang = 'en-GB';
             $lang_path = 'language' . DS . $lang . DS . $lang . '.' . $lang_file . '.inc.php';
             if (JFile::exists(JPATH_ADMINISTRATOR . DS . $lang_path)) {
                 $inc = JPATH_ADMINISTRATOR . DS . $lang_path;
             } else {
                 if (JFile::exists(JPATH_SITE . DS . $lang_path)) {
                     $inc = JPATH_SITE . DS . $lang_path;
                 }
             }
         }
         if ($inc) {
             include $inc;
         }
     }
     if ($description) {
         $description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
         if (!$nostyle && $description['0'] != '<') {
             $description = '<p>' . $description . '</p>';
         }
     }
     if ($nostyle && $description) {
         return $description;
     }
     if ($title) {
         $title = JText::_($title);
     }
     $user = JFactory::getUser();
     if (strlen($version) && strlen($version_file) && ($user->usertype == 'Super Administrator' || $user->usertype == 'Administrator')) {
         // Import library dependencies
         require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'versions.php';
         $versions = NNVersions::instance();
         $msg = $versions->getMessage($extension, $xml, $version, 1);
         if ($version) {
             if ($title) {
                 $title .= ' v' . $version;
             } else {
                 $title = JText::_('Version') . ' ' . $version;
             }
         }
     } else {
         if ($xml) {
             $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . str_replace('/', DS, $xml));
             if ($xml && isset($xml['version'])) {
                 $version = $xml['version'];
             }
             if ($version) {
                 if ($title) {
                     $title .= ' v' . $version;
                 } else {
                     $title = JText::_('Version') . ' ' . $version;
                 }
             }
         }
     }
     if ($url) {
         $url = '<a href="' . $url . '" target="_blank" title="' . $title . '">';
     }
     if ($image) {
         $image = str_replace('/', "\n", str_replace('\\', '/', $image));
         $image = explode("\n", trim($image));
         if ($image['0'] == 'administrator') {
             $image['0'] = JURI::base(true);
         } else {
             $image['0'] = JURI::root(true) . '/' . $image['0'];
         }
         $image = $url . '<img src="' . implode('/', $image) . '" border="0" style="float:right;margin-left:10px" alt=""';
         if ($image_w) {
             $image .= ' width="' . $image_w . '"';
         }
         if ($image_h) {
             $image .= ' height="' . $image_h . '"';
         }
         $image .= ' />';
         if ($url) {
             $image .= '</a>';
         }
     }
     if ($url) {
         $title = $url . $title . '</a>';
     }
     if ($help) {
         $help = '<a href="' . $help . '" target="_blank" title="' . JText::_('NN_MORE_INFO') . '">' . JText::_('NN_MORE_INFO') . '...</a>';
     }
     if ($title) {
         $title = NoNumberElementsFunctions::html_entity_decoder($title);
     }
     $html = '';
     if ($image) {
         $html .= $image;
     }
     if ($show_apply) {
         $onclick = '';
         if ($j15) {
             $onclick = 'submitbutton( \'apply\' );';
         } else {
             $bar = JToolBar::getInstance('toolbar');
             foreach ($bar->getItems() as $b) {
                 if (isset($b['3']) && $b['1'] == 'apply') {
                     $onclick = 'Joomla.submitbutton(\'' . $b['3'] . '\')';
                 }
             }
         }
         if ($onclick) {
             $html .= '<a href="#" onclick="' . $onclick . '" title="' . JText::_('Apply') . '"><img style="float:right;" border="0" alt="' . JText::_('Apply') . '" src="' . JURI::root() . 'plugins/system/nonumberelements/images/tick.png"/></a>';
         }
     }
     if ($toggle && $description) {
         $el = 'document.getElementById( \'' . $id . 'description\' )';
         $onclick = 'if( this.innerHTML == \'' . JText::_(JText::_('Show') . ' ' . $title) . '\' ){' . $el . '.style.display = \'block\';' . 'this.innerHTML = \'' . JText::_(JText::_('Hide') . ' ' . $title) . '\';' . '}else{' . $el . '.style.display = \'none\';' . 'this.innerHTML = \'' . JText::_(JText::_('Show') . ' ' . $title) . '\';' . '}' . 'this.blur();return false;';
         $html .= '<div class="button2-left" style="margin:0px 0px 5px 0px;"><div class="blank"><a href="javascript://;" onclick="' . $onclick . '">' . JText::_(JText::_('Show') . ' ' . $title) . '</a></div></div>' . "\n";
         $html .= '<br clear="all" />';
         $html .= '<div id="' . $id . 'description" style="display:none;">';
     } else {
         if ($title) {
             if (!$j15 || $blocktype != 'fieldset') {
                 $html .= '<h4 style="margin: 0px;">' . $title . '</h4>';
             }
         }
     }
     if ($description && !$tooltip) {
         $html .= $description;
     }
     if ($help) {
         $html .= '<p>' . $help . '</p>';
     }
     if ($description) {
         $html = '<div class="nn_block nn_title">' . $html . '</div>';
     }
     if ($toggle && $description) {
         $html .= '</div>';
     }
     if ($message_type) {
         $html = '<dl id="system-message"><dd class="' . $message_type . '"><ul><li>' . NoNumberElementsFunctions::html_entity_decoder($html) . '</li></ul></dd></dl>';
     } else {
         if ((!$j15 || $blocktype != 'fieldset') && !$nostyle) {
             $class = 'panel nn_panel';
             if ($j15) {
                 $class .= ' nn_panel_15';
             }
             $html = '<div class="' . $class . '"><div class="nn_block nn_title">' . $html . '<div style="clear: both;"></div>';
         }
         if ($start) {
             if ($j15 && $blocktype == 'fieldset') {
                 if ($description && $tooltip) {
                     $title = '<span class="hasTip" title="' . htmlentities($title . '::' . $description) . '">' . $title . '</span>';
                 }
                 $html = '<fieldset class="adminform"><legend>' . $title . '</legend>' . $html;
             }
             if ($j15) {
                 $html .= '<table width="100%" class="paramlist admintable" cellspacing="1">';
                 $html .= '<tr><td colspan="2" class="paramlist_value">';
                 $random = rand(100000, 999999);
                 $html .= '<div id="end-' . $random . '"></div><script type="text/javascript">NoNumberElementsHideTD( "end-' . $random . '" );</script>';
             } else {
                 $html .= '<ul class="adminformlist"><li>';
             }
         } else {
             $html .= '</div></div>';
         }
     }
     if ($msg) {
         $html = $msg . $html;
     }
     return $html;
 }
Exemple #7
0
 function replaceTags(&$str, $shownav = 1)
 {
     $shownav = $shownav ? !JRequest::getInt('print') : 0;
     if (!$shownav || strpos($str, '{/' . $this->params->tag_close) === false) {
         if (preg_match_all($this->params->regex, $str, $matches, PREG_SET_ORDER) > 0) {
             foreach ($matches as $match) {
                 $name = trim(preg_replace('#</?[a-z][^>]*>#usi', '', $match['4']));
                 $replace = '<a name="' . $name . '"></a><' . $this->params->title_tag . ' class="tabber_title">' . trim($match['4']) . '</' . $this->params->title_tag . '>';
                 $str = str_replace($match['0'], $replace, $str);
             }
         }
         if (preg_match_all($this->params->regex_end, $str, $matches, PREG_SET_ORDER) > 0) {
             foreach ($matches as $match) {
                 $str = str_replace($match['0'], '', $str);
             }
         }
         if (preg_match_all($this->params->regex_link, $str, $matches, PREG_SET_ORDER) > 0) {
             foreach ($matches as $match) {
                 $link = '<a href="#' . $match['1'] . '">' . $match['2'] . '</a>';
                 $str = str_replace($match['0'], $link, $str);
             }
         }
         return;
     }
     $allitems = array();
     $sets = array();
     $setids = array();
     $setcount = 0;
     if (preg_match_all($this->params->regex, $str, $matches, PREG_SET_ORDER) > 0) {
         foreach ($matches as $match) {
             if ($match['2']['0'] == '/') {
                 array_pop($setids);
                 continue;
             }
             end($setids);
             $item = new stdClass();
             $item->orig = $match['0'];
             $item->setid = trim(str_replace('-', '_', $match['3']));
             if (empty($setids) || current($setids) != $item->setid) {
                 $setcount++;
                 $setids[$setcount . '_'] = $item->setid;
             }
             $item->set = str_replace('__', '_', array_search($item->setid, array_reverse($setids)) . $item->setid);
             $item->title = trim($match['4']);
             $item->title_full = $item->title;
             list($item->pre, $item->post) = NoNumberElementsFunctions::setSurroundingTags($match['1'], $match['5']);
             if (!isset($sets[$item->set])) {
                 $sets[$item->set] = array();
             }
             $sets[$item->set][] = $item;
         }
     }
     $urlitem = JRequest::getString('tab', '', 'default', 1);
     $doscroll = $this->params->tabber_urlscroll;
     if ($doscroll) {
         if (substr($urlitem, -1, 1) == '-') {
             $doscroll = 0;
             $urlitem = trim(substr($urlitem, 0, strlen($urlitem) - 1));
         }
     } else {
         if (substr($urlitem, -1, 1) == ' ') {
             $doscroll = 1;
         }
     }
     $urlitem = trim($urlitem);
     if (is_numeric($urlitem)) {
         $urlitem = '1-' . $urlitem;
     }
     $urlscroll = '';
     $active_url = '';
     $cookies = '';
     if ($this->params->use_cookies) {
         $c = JRequest::getString($this->params->cookie_name, null, 'COOKIE');
         if ($c) {
             $c = explode('|', $c);
             $cookies = array();
             foreach ($c as $cookie) {
                 $cookie = explode('=', $cookie);
                 if ($cookie['0'] && isset($cookie['1'])) {
                     $cookies[$cookie['0']] = (int) $cookie['1'];
                 }
             }
         }
     }
     foreach ($sets as $set_id => $items) {
         $rand = '|' . rand(100, 999) . '|';
         $active_by_url = '';
         $active_by_cookie = '';
         $active = 0;
         foreach ($items as $i => $item) {
             $item->class = '';
             $item->active = 0;
             $item->title_full = trim($item->title);
             if (!(strpos($item->title_full, '|') === false)) {
                 list($item->title_full, $extra) = explode('|', $item->title_full, 2);
                 $item->title_full = trim($item->title_full);
                 $extra = explode('|', $extra);
                 foreach ($extra as $e) {
                     switch ($e) {
                         case 'active':
                         case 'opened':
                         case 'open':
                             $active = $i;
                             break;
                         default:
                             $item->class = trim($item->class . ' ' . $e);
                             break;
                     }
                 }
             }
             // remove tags
             $item->title = trim(preg_replace('#</?[a-z][^>]*>#usi', '', $item->title_full));
             $item->set = $set_id . $rand;
             $item->setname = $set_id;
             $item->count = $i + 1;
             $item->id = $item->set . '-' . $item->count;
             $item->haslink = preg_match('#<a [^>]*>.*?</a>#usi', $item->title_full);
             if (!empty($cookies) && isset($cookies[$set_id]) && $cookies[$set_id] == $item->count) {
                 $active_by_cookie = $i;
             }
             $match_titles = array();
             $match_titles[] = $item->title;
             $match_titles[] = utf8_encode(html_entity_decode($match_titles['0'], ENT_COMPAT, 'UTF-8'));
             if (extension_loaded('mbstring')) {
                 $match_titles[] = mb_convert_case($match_titles['0'], MB_CASE_LOWER, 'UTF-8');
                 $match_titles[] = utf8_encode(html_entity_decode($match_titles['2'], ENT_COMPAT, 'UTF-8'));
             }
             $item->matches = array();
             foreach ($match_titles as $title) {
                 $item->matches[] = $title;
                 $item->matches[] = str_replace(' ', '', $title);
                 $item->matches[] = urlencode($title);
                 $item->matches[] = utf8_decode($title);
             }
             $alias = preg_replace('#&([a-z])[a-z]*;#s', '\\1', $match_titles['2']);
             $alias = trim(preg_replace('#[^a-z0-9]#s', '', $alias));
             if ($alias) {
                 $item->matches[] = $alias;
             }
             $item->matches[] = $i + 1 . '';
             $item->matches[] = (int) $item->set . '-' . ($i + 1);
             $item->matches = array_unique($item->matches);
             if ($urlitem != '' && (in_array($urlitem, $item->matches, 1) || in_array(strtolower($urlitem), $item->matches, 1))) {
                 if (!$item->haslink) {
                     $active_by_url = $i;
                     if ($doscroll) {
                         $urlscroll = $item->id;
                     }
                 }
             }
             if ($active == $i && $item->haslink) {
                 $active++;
             }
             $sets[$set_id][$i] = $item;
             $allitems[] = $item;
         }
         $active = (int) $active;
         if ($active_by_url !== '' && isset($sets[$set_id][$active_by_url])) {
             $sets[$set_id][$active_by_url]->active = 1;
             $active_url = $sets[$set_id][$active_by_url]->id;
         } else {
             if ($active_by_cookie !== '' && isset($sets[$set_id][$active_by_cookie])) {
                 $sets[$set_id][$active_by_cookie]->active = 1;
             } else {
                 if (isset($sets[$set_id][$active])) {
                     $sets[$set_id][$active]->active = 1;
                 }
             }
         }
     }
     $script_set = 0;
     foreach ($sets as $items) {
         foreach ($items as $i => $item) {
             $html = array();
             $html[] = $item->post;
             $html[] = $item->pre;
             if ($i == 0) {
                 if (!$script_set) {
                     $html[] = '<script type="text/javascript">document.write( \'<style type="text/css">div.tabber_item_inactive { height: 0; }</style>\' );</script>';
                 }
                 $html[] = '<div class="' . trim('tabber_container tabber_container_' . $item->setname . ' tabber_noscript ' . ($this->params->rounded && $this->params->rounded_radius ? 'rounded' : '')) . '" id="tabber_container_' . $item->set . '">';
                 $html[] = $this->getNav($items);
                 $html[] = '<div class="tabber_content" id="tabber_content_' . $item->set . '">';
             } else {
                 $html[] = '<div style="clear:both;"></div>';
                 $html[] = '</div>';
             }
             $html[] = '<div class="' . trim('tabber_item tabber_count_' . $item->count . ' ' . trim($item->class)) . ' tabber_item_' . ($item->active ? '' : 'in') . 'active" id="tabber_item_' . $item->id . '">';
             $html[] = '<a name="' . $item->id . '"></a><' . $this->params->title_tag . ' class="tabber_title">' . $item->title_full . '</' . $this->params->title_tag . '>';
             $s = '#' . preg_quote($item->orig, '#') . '#';
             if (@preg_match($s . 'u', $str)) {
                 $s .= 'u';
             }
             if (preg_match($s, $str)) {
                 $str = preg_replace($s, implode("\n", $html), $str, 1);
                 if ($i == 0) {
                     $script_set = 1;
                 }
             }
         }
     }
     // closing html
     $html = array();
     $html[] = '<div style="clear:both;"></div>';
     $html[] = '</div>';
     $html[] = '<div style="clear:both;"></div>';
     $html[] = '</div>';
     $html[] = '<div style="height:1px;"></div>';
     $html[] = '</div>';
     if ($active_url) {
         $html[] = '<script type="text/javascript">';
         $html[] = 'tabber_url = \'' . $active_url . '\';';
         if ($doscroll && $urlscroll) {
             $html[] = 'tabber_urlscroll = \'' . $urlscroll . '\';';
         }
         $html[] = '</script>';
     }
     $html = implode("\n", $html);
     if (preg_match_all($this->params->regex_end, $str, $matches, PREG_SET_ORDER) > 0) {
         foreach ($matches as $match) {
             $m_html = $html;
             list($pre, $post) = NoNumberElementsFunctions::setSurroundingTags($match['1'], $match['2']);
             $m_html = $pre . $m_html . $post;
             $str = str_replace($match['0'], $m_html, $str);
         }
     }
     if (preg_match_all($this->params->regex_link, $str, $matches, PREG_SET_ORDER) > 0) {
         foreach ($matches as $match) {
             $link = $match['2'];
             $linkitem = 0;
             $name = $match['1'];
             if (is_numeric($name)) {
                 foreach ($allitems as $item) {
                     if (in_array($name, $item->matches, 1) || in_array((int) $name, $item->matches, 1)) {
                         $linkitem = $item;
                         break;
                     }
                 }
             } else {
                 foreach ($allitems as $item) {
                     if (in_array($name, $item->matches, 1) || in_array(strtolower($name), $item->matches, 1)) {
                         $linkitem = $item;
                         break;
                     }
                 }
             }
             if ($linkitem) {
                 $link = '<a href="#' . $linkitem->id . '" class="tabber_tablink" rel="' . $linkitem->id . '">' . $link . '</a>';
             } else {
                 $link = '<a href="#' . $name . '">' . $link . '</a>';
             }
             $str = str_replace($match['0'], $link, $str);
         }
     }
 }