/** * Volltextsuche ausfuehren * * *Description* * * @param $term string, $page string * * @return string */ public function startSearch($term = NULL, $page) { if (!empty($term)) { if ($page == 'search') { //Ergebnisse aus DB Tabelle holen $searchRequest = $this->result->getSearch($term); $arrResult = array(); foreach ($searchRequest as $key => $value) { $arrResult[$key] = preg_replace('/{%\\S*%}/', '', $value); } //Suchergebnis zurück geben return \View\Search::ViewResult($arrResult); } else { $term = \Controller\Helpers::Clean($term); if (!URL_REWRITING) { $s = '&'; } else { $s = '?'; } if (!empty($_GET)) { foreach ($_GET as $k => $v) { if ($k != 'site') { $param .= '&' . $k . '=' . $v; } } } $filename = \Controller\Helpers::buildLink('search') . $s . $param; $this->response->modifyHeader('location', $filename, TRUE); } } }
private final function buildMenu($menuArray) { $list = ''; foreach ($menuArray as $node) { if ($node['page'] == \Controller\Helpers::getGlobals('Page')) { $activ = ' class="activ"'; } else { $activ = ''; } $list .= "\n\t\t\t\t<li>\n\t\t\t\t\t" . '<a href="' . \Controller\Helpers::buildLink($node['page']) . '" title="' . $node['title'] . '"' . $activ . '>' . $node['anchor'] . "</a>\n"; if (!empty($node['children'])) { $list .= "\n\t\t\t\t<ul>\n"; $list .= $this->buildMenu($node['children']); $list .= "\t\t\t\t</ul>\n"; } $list .= "\t\t\t\t</li>\n"; } return $list; }
public function sitemap($pages) { $sitemap = $this->xmlHeader; $sitemap .= "\n\t<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n\txsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" \n\txmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n\t\t\t"; // Content start here foreach ($pages as $page) { if ($page['indexation'] == 'index') { $sitemap .= ' <url> <loc>' . \Controller\Helpers::buildLink($page['page']) . '</loc> <lastmod>' . $page['created'] . '</lastmod> <changefreq>monthly</changefreq> </url> '; } } $sitemap .= "\n\t</urlset>\n"; return $sitemap; }
public static function ViewResult($arrRequest) { $result = ' <ol>'; if (!empty($arrRequest)) { foreach ($arrRequest as $request) { // Inhalt auf 250 Zeichen kuerzen $shortcontent = $request['content']; $shortcontent = strip_tags($shortcontent); $shortcontent = preg_replace("/(?<=.{250}?\\b)(.*)/is", "…", $shortcontent); $result .= ' <li> <a href="' . \Controller\Helpers::buildLink($request['page']) . '">' . $request['headline'] . '</a> <span>' . $shortcontent . '</span> </li>'; } } else { $result .= ' <li>Kein Ergebnis</li>'; } $result .= ' </ol>'; return $result; }
/** * Daten Ausgabe Seitenbearbeitung erzeugen * * *Description* * * @param string * * @return array */ public function DataPage($page = '') { // Lade Inhalt Single Page $data = array(); $data['Action'] = DIR . '?load=page&action=insert'; // im GET-Parameter ist die Page enthalten if (!empty($page)) { // ActionController gibt einen Error zurück if (!empty($this->success['Entry']) and $this->success['Entry']['error']) { $data['Entry'] = $this->request['setEntry']; } else { // wurde der Dateiname geändert, lese Inhalte für diesen if (!empty($this->request['setEntry']['page']) and $page != $this->request['setEntry']['page']) { $p = isset($this->success['Entry']['fixedPage']) ? $this->success['Entry']['fixedPage'] : $this->request['setEntry']['page']; } else { $p = $page; } // Hole die Daten des geänderten oder neuen Eintrag aus Datenbank $data['Entry'] = $this->entries->getEntry($p); } $data['Action'] = DIR . '?load=page&page=' . $p . '&action=edit'; $data['Delete'] = DIR . '?action=delete&page=' . $data['Entry']['page']; $data['View'] = \Controller\Helpers::buildLink($p); } else { if (!empty($this->success['Entry'])) { if ($this->success['Entry']['error']) { $data['Entry'] = $this->request['setEntry']; } else { $data['Entry'] = $this->entries->getEntry($this->request['setEntry']['page']); if (!empty($data['Entry'])) { $data['Action'] = DIR . '?load=page&page=' . $this->request['setEntry']['page'] . '&action=edit'; $data['View'] = \Controller\Helpers::buildLink($this->request['setEntry']['page']); } } } else { $data['Entry'] = $this->entries->getEntry(''); } $data['Delete'] = '#" onclick="alert(\'Aktion nicht möglich!\')'; } $data['Success'] = $this->success; $data['Navigation'] = $this->entries->getNavigation(); $data['EnumIndex'] = $this->entries->getDBEnumSet('meta', 'indexation'); return $data; }
/** * HTML Formulare laden * * *Description* * * @param string * * @return boolean */ private function getHTMLForms($form = NULL) { switch ($form) { case 'Search': $path = PATH_PAGES . SEARCHFORM; $url = \Controller\Helpers::buildLink('search'); break; case 'Contact': $path = PATH_PAGES . CONTACTFORM; $url = \Controller\Helpers::buildLink($this->page); break; } if (file_exists($path)) { $html = sprintf(file_get_contents($path), $url); } else { $html = '<strong>Warning:</strong> Form/' . $form . ' not found'; } return $html; }
/** * Daten laden * * *Description* * * @param string * * @return array */ private function loadData($param) { $data = array(); switch ($param) { case 'image_list': $i = 0; foreach ($this->entries->getAllImages() as $images) { $data[$i]['title'] = 'Thumbnail ' . $images['alt']; $data[$i]['value'] = $images['thumb']; $i++; $data[$i]['title'] = $images['alt']; $data[$i]['value'] = $images['large']; $i++; } break; case 'link_list': $i = 0; foreach ($this->entries->getNavigation() as $navigation) { $data[$i]['title'] = !empty($navigation['anchor']) ? $navigation['anchor'] : ucfirst(str_replace('-', ' ', $navigation['page'])); $data[$i]['value'] = \Controller\Helpers::buildLink($navigation['page']); $i++; } break; case 'plugin': if (!empty($this->request['extension']) and file_exists(DIR_PLUGIN . $this->request['extension'] . '/ajax.php')) { include_once DIR_PLUGIN . $this->request['extension'] . '/ajax.php'; if (function_exists('AjaxData')) { //Funktion in Plugin aufrufen GET-Parameter als Array übergeben unset($this->request['extension'], $this->request['data'], $this->request['load']); $data = AjaxData($this->request); } else { $data = array('No data found for ' . $this->request['extension']); } } break; default: $data = array('Sorry! Nothing found.'); } return $data; }