/** * Returns the title of the result page as found in code section of page * * @return string * @throws Exception */ public function getTitle() { if (is_null($this->title)) { $this->title = PageHelper::getTitle($this->getContents()); } return $this->title; }
/** * * Look for Content in Content Files * * @return Finder */ protected function searchContent() { // echo "search content <br>"; // Try locating the term in the contents. $files = $this->search($this->getPath() . "content"); $result = []; // We retrieved all content files holding the search term. Now we need to look if they are linked in page files foreach ($files as $file) { // Get Filename to search for in page content's component. $filename = $file->getFilename(); // In Case we have multilanguage support and a language suffix in the file // We only need the filename without the suffix $name = substr($filename, 0, strrpos($filename, ".")); if ($pPos = strpos($name, ".")) { $name = substr($name, 0, $pPos); $suffix = substr($filename, strrpos($filename, ".")); $filename = $name . $suffix; // I.E. "welcome.de.html" => "welcome.html" } $pagesWithTerm = $this->searchPage($this->prepareTerm($filename)); foreach ($pagesWithTerm as $i => $pageWithTerm) { // filter results for component "editable" or content file="" $includes = ['/{%\\s?component\\s?["|\']editable["|\']\\s?file=["|\']([^"\']+)["|\']\\s?%}/is', '/{%\\s?content\\s?["|\']contacts\\.htm["\']\\s?%}/is']; $contentRewritten = preg_replace($includes, $file->getContents(), $pageWithTerm->getContents()); $contentRewritten = PageHelper::stripTwigTags($contentRewritten); $pageWithTerm->setContents($contentRewritten); $result[] = $pageWithTerm; } } return $result; }