PHPFusion\Rewrite\Permalinks::appendRootAll PHP Метод

appendRootAll() защищенный Метод

Append the ROOT Dir Path to all relative links, which are from website This function will append the root directory path for all links, which are in website. (Not External HTTP links)
protected appendRootAll ( )
    protected function appendRootAll()
    {
        if (preg_match("/(href|src)='((?!(htt|ft)p(s)?:\\/\\/)[^\\']*)'/i", $this->output)) {
            $basedir = str_replace(array(".", "/"), array("\\.", "\\/"), BASEDIR);
            $basedir = preg_replace("~(href|src)=(\\'|\")(" . $basedir . ")*([^(\\'|\"):]*)(\\'|\")~i", "\$1=\$2" . ROOT . "\$3\$4\$5", $this->output);
            // Remove ../ before http://
            $loop = 20;
            for ($i = 1; $i <= $loop; $i++) {
                $basedir = str_replace(str_repeat('../', $i) . 'http://', 'http://', $basedir);
            }
            // Remove ../ before https://
            for ($i = 1; $i <= $loop; $i++) {
                $basedir = str_replace(str_repeat('../', $i) . 'https://', 'https://', $basedir);
            }
            $this->output = $basedir;
        }
    }