Beispiel #1
0
    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&lang=%s&cat=%d&id=%d&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);
            // Move the link to XHTML
            if (strpos($_url, '&') === false) {
                $_link = str_replace('&', '&', $_link);
            }
            $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . $_link);
            $oLink->itemTitle = $oLink->tooltip = $_title;