1 ? lang('core', 'page', array('page' => $data['page'])) : ''; } $replaces[] = $data[$var] ? strip_tags($data[$var]) : ''; } if($titletext) { $seotitle = helper_seo::strreplace_strip_split($searchs, $replaces, $titletext); } if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) { $seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext); } if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) { $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext); } } return array($seotitle, $seodescription, $seokeywords); } public static function strreplace_strip_split($searchs, $replaces, $str) { $searchspace = array('(((\s)*\-(\s)*)+)', '(((\s)*\,(\s)*)+)', '(((\s)*\|(\s)*)+)', '(((\s)*\t(\s)*)+)', '(((\s)*_(\s)*)+)'); $replacespace = array('$3-$3', '$3,$3', '$3|$3', '$3 $3', '$3_$3'); return trim(preg_replace($searchspace, $replacespace, str_replace($searchs, $replaces, $str)), ' ,-|_'); } public static function get_title_page($navtitle, $page){ if($page > 1) { $navtitle .= ' - '.lang('core', 'page', array('page' => $page)); } return $navtitle; } public static function get_related_link($extent) { global $_G; loadcache('relatedlink'); $allextent = array('article' => 0, 'forum' => 1, 'group' => 2, 'blog' => 3); $links = array(); if($_G['cache']['relatedlink'] && isset($allextent[$extent])) { foreach($_G['cache']['relatedlink'] as $link) { $link['extent'] = sprintf('%04b', $link['extent']); if($link['extent'][$allextent[$extent]] && $link['name'] && $link['url']) { $links[] = daddslashes($link); } } } rsort($links); return $links; } public static function parse_related_link($content, $extent) { global $_G; loadcache('relatedlink'); $allextent = array('article' => 0, 'forum' => 1, 'group' => 2, 'blog' => 3); if($_G['cache']['relatedlink'] && isset($allextent[$extent])) { $searcharray = $replacearray = array(); foreach($_G['cache']['relatedlink'] as $link) { $link['extent'] = sprintf('%04b', $link['extent']); if($link['extent'][$allextent[$extent]] && $link['name'] && $link['url']) { $searcharray[$link[name]] = '/('.preg_quote($link['name']).')/i'; $replacearray[$link[name]] = "$link[name]"; } } if($searcharray && $replacearray) { $_G['trunsform_tmp'] = array(); $content = preg_replace_callback("/(.*?<\/script>)|(.*?<\/a>)|()|(\[attach\](\d+)\[\/attach\])/is", array(__CLASS__, 'parse_related_link_callback_base64_transform_1234'), $content); $content = preg_replace($searcharray, $replacearray, $content, 1); $content = preg_replace_callback("/(.*?)<\/relatedlink>/is", array(__CLASS__, 'parse_related_link_callback_base64_transform_1'), $content); } } return $content; } static public function parse_related_link_callback_base64_transform_1234($matches) { return self::base64_transform('encode', '', $matches[1].$matches[2].$matches[3].$matches[4], ''); } static function parse_related_link_callback_base64_transform_1($matches) { return self::base64_transform('decode', '', $matches[1], ''); } public static function base64_transform($type, $prefix, $string, $suffix) { global $_G; if($type == 'encode') { $_G['trunsform_tmp'][] = base64_encode(str_replace("\\\"", "\"", $string)); return $prefix.(count($_G['trunsform_tmp']) - 1).$suffix; } elseif($type == 'decode') { return $prefix.base64_decode($_G['trunsform_tmp'][$string]).$suffix; } } } ?>