(.*?)

Aus HL7 Austria MediaWiki
Wechseln zu: Navigation, Suche

Diese Seite dient zur Erklärung von verschiedenen Fehlercodes die behoben worden sind.

1 Fehler in PHP

1.1 CustomTitle

Mit der Extension CustomTitle trat das Problem auf, dass im Text immer wieder Codeteile dargestellt wurden, wie z.B.

Um dies zu Unterbinden wurden in der CustomTitle.php die Funktion onOutputPageBeforeHTML verändert.

vorheriger Code:

function onOutputPageBeforeHTML(&$out, &$text)
    {
        if (($found = strpos($text, 'xxx-CustomTitleStart-xxx')) !== false) {
            if (preg_match("//", $text, $matches)) {
                $this->customTitle = $matches[1];
                $text = str_replace($matches[0], "", $text);
            }
        }

        if (($found = strpos($text, 'xxx-CustomPageTitleStart-xxx')) !== false) {
            if (preg_match("//", $text, $matches)) {
                $this->customPageTitle = $matches[1];
                $text = str_replace($matches[0], "", $text);
            }
        }

        return true;
    }

Lösung:

   function onOutputPageBeforeHTML(&$out, &$text)
    {
        if (($found = strpos($text, 'xxx-CustomTitleStart-xxx')) !== false) {
            if (preg_match("//", $text, $matches)) {
                $this->customTitle = $matches[1];
                $text = str_replace($matches[0], "", $text);
                // replace any remaining occurrences
                while (preg_match("//", $text, $matches)) {
                    $text = str_replace($matches[0], "", $text);
                }
            }
        }
 
        if (($found = strpos($text, 'xxx-CustomPageTitleStart-xxx')) !== false) {
            if (preg_match("//", $text, $matches)) {
                $this->customPageTitle = $matches[1];
                $text = str_replace($matches[0], "", $text);
                // replace any remaining occurrences
                while (preg_match("//", $text, $matches)) {
                    $text = str_replace($matches[0], "", $text);
                }
            }
        }
 
        return true;
    }