private function dev_link($die = true, $quick = false) { $realpages = listFiles(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/", "@^[^_](.*)\\.htm(l?)\$@i"); $tmp = listFiles(CONS_PATH_PAGES . $_SESSION['CODE'] . "/actions/"); $pages = array(); foreach ($realpages as $x => $page) { // removes extensions $page = explode(".", $page); array_pop($page); $pages[] = implode(".", $page); } foreach ($tmp as $x => $page) { // adds actions that are not covered in content/template $page = explode(".", $page); array_pop($page); $page = implode(".", $page); if (!in_array($page, $pages)) { $pages[] = $page; } } if (isset($this->parent->dimconfig['_contentManager'])) { // add CMS pages if (!is_array($this->parent->dimconfig['_contentManager'])) { $this->parent->dimconfig['_contentManager'] = explode(",", $this->parent->dimconfig['_contentManager']); } foreach ($this->parent->dimconfig['_contentManager'] as $page) { $page = substr($page, 1); // removes initial / if ($page != '' && !in_array($page, $pages)) { $pages[] = $page; } } } if (isset($this->parent->dimconfig['_seoManager'])) { // add SEO alias if (!is_array($this->parent->dimconfig['_seoManager'])) { $this->parent->dimconfig['_seoManager'] = explode(",", $this->parent->dimconfig['_seoManager']); } foreach ($this->parent->dimconfig['_seoManager'] as $page) { if ($page != '') { if ($page[0] == '/') { $page = substr($page, 1); } // removes initial / if ($page != '' && !in_array($page, $pages)) { $pages[] = $page; } } } } $missingContent = array(); if (!function_exists('xmlParamsParser')) { include CONS_PATH_SYSTEM . "lib/xmlHandler.php"; } foreach ($realpages as $page) { $xhtml = new xmlHandler(); $xhtml->cReadXML(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/" . $page, array(C_XML_AUTOPARSE => true, C_XML_LAX => true), true); $objects = $xhtml->XMLParsedContent(); foreach ($objects[C_XHTML_LINKS] as $link) { $oL = $link; if ($link == '') { $missingContent[] = $page . ": Empty link"; } else { if ($link[0] != "?" && $link[0] != "#" && strpos($link, "javascript:") === false && strpos($link, "mailto:") === false && strpos($link, "http") === false) { if (strpos($link, "{") !== false) { $link = explode("{", $link); $newLink = ""; foreach ($link as $part) { $part = explode("}", $part); $part[0] = explode("|", $part[0]); if ($part[0][0] == "seo") { $part = $part[0][1]; if (strpos($part, ".") !== false) { $part = explode(".", $part); array_pop($part); $part = implode(".", $part); } if (strpos($part, "?") !== false) { $part = explode("?", $part); array_pop($part); $part = implode("?", $part); } if ($part != '' && $part[0] == '/') { $part = substr($part, 1); } // removes initial / if (!in_array($part, $pages)) { $missingContent[] = $page . ": " . $part . " (SEO from {$oL}) "; } } } } else { if (strpos($link, ".") !== false) { $link = explode(".", $link); array_pop($link); $link = implode(".", $link); } if (strpos($link, "?") !== false) { $link = explode("?", $link); array_pop($link); $link = implode("?", $link); } if ($link != '' && $link[0] == '/') { $link = substr($link, 1); } // removes initial / if (!in_array($link, $pages)) { $missingContent[] = $page . ": " . $link . " ({$oL})"; } } } } } } if (!$quick) { if (count($missingContent) == 0) { echo "No link issues on " . count($realpages) . " pages"; } else { echo "<b>" . count($missingContent) . " link issues on " . count($realpages) . " pages:</b><br/>"; echo implode($missingContent, "<br/>\n"); } } if ($die) { $this->parent->close(true); die; } return count($missingContent) > 0 ? $missingContent : false; }