Exemple #1
0
if (!is_null($highlight) && $highlight != "/" && $highlight != "<" && $highlight != ">" && PMF_String::strlen($highlight) > 3) {
    $highlight = str_replace("'", "´", $highlight);
    $highlight = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']'), '', $highlight);
    $highlight = preg_quote($highlight, '/');
    $searchItems = explode(' ', $highlight);
    $attributes = array('href', 'src', 'title', 'alt', 'class', 'style', 'id', 'name', 'face', 'size', 'dir', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup');
    foreach ($searchItems as $item) {
        $thema = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((' . implode('|', $attributes) . ')="[^"]*' . $item . '[^"]*")|' . '(\\s+)(' . $item . ')(\\s+)' . '/mis', 'highlight_no_links', $thema);
        $content = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((' . implode('|', $attributes) . ')="[^"]*' . $item . '[^"]*")|' . '(\\s+)(' . $item . ')(\\s+)' . '/mis', 'highlight_no_links', $content);
    }
}
// Hack: Apply the new SEO schema to those HTML anchors to
//       other faq records (Internal Links) added with WYSIWYG Editor:
//         href="index.php?action=artikel&cat=NNN&id=MMM&artlang=XYZ"
// Search for href attribute links
$oLnk->resetPool();
$oLnk->parse_string($content);
$fixedContent = str_replace('href="#', sprintf('href="index.php?action=artikel&amp;lang=%s&amp;cat=%d&amp;id=%d&amp;artlang=%s#', $LANGCODE, $currentCategory, $record_id, $LANGCODE), $content);
$oLnk->resetPool();
$oLnk->parse_string($fixedContent);
// Search for href attributes only
$linkArray = $oLnk->getUrlpool();
if (isset($linkArray['href'])) {
    foreach (array_unique($linkArray['href']) as $_url) {
        if (!(strpos($_url, 'index.php?action=artikel') === false)) {
            // Get the Faq link title
            $matches = array();
            preg_match('/id=([\\d]+)/ism', $_url, $matches);
            $_id = $matches[1];
            $_title = $faq->getRecordTitle($_id, false);
            $_link = substr($_url, 9);