本文整理汇总了PHP中Helpers::fatalError方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::fatalError方法的具体用法?PHP Helpers::fatalError怎么用?PHP Helpers::fatalError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::fatalError方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPDO
/**
* Erstellt ein PDO Objekt
*
* @return PDO pdo
*/
public static function getPDO()
{
if (self::$pdo == null) {
$config = Config::getArray();
if (!isset($config["database"])) {
Helpers::fatalError("No database configuration found.");
}
$host = '';
if (isset($config['database']['host'])) {
$host = 'host=' . $config['database']['host'] . ';';
}
$port = '';
if (isset($config['database']['port'])) {
$port = 'port=' . $config['database']['port'] . ';';
}
$socket = '';
if (isset($config['database']['socket'])) {
$socket = 'unix_socket=' . $config['database']['socket'] . ';';
}
$dsn = 'mysql:dbname=' . $config["database"]["name"] . ';' . $host . $port . $socket . 'charset=utf8;';
try {
$pdo = new PDO($dsn, $config["database"]["user"], $config["database"]["password"], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
} catch (PDOException $e) {
Helpers::fatalError("Could no connect to the database: " . $e->getMessage());
}
self::$pdo = $pdo;
}
return self::$pdo;
}
示例2: loadStrings
public static function loadStrings($file, $id = '')
{
if (is_file($file)) {
$temp = (include $file);
if (is_array($temp)) {
self::$strings = array_merge(self::$strings, $temp);
self::$id = $id;
}
} else {
Helpers::fatalError('The language file [' . $file . '] could not be found.');
}
}
示例3: loadArray
protected static function loadArray($file, $can_not_be_empty)
{
if (!file_exists($file)) {
Helpers::fatalError('DataStructure: Missing file: ' . $file . '!');
}
$array = (include $file);
if (!is_array($array)) {
Helpers::fatalError('DataStructure: file must return an array in: ' . $file . '!');
}
if ($can_not_be_empty && count($array) < 1) {
Helpers::fatalError('DataStructure: the array is empty in: ' . $file . '!');
}
return $array;
}
示例4: error
protected static function error($function)
{
$message = $function . ' could not succeed.';
if (function_exists("error_get_last")) {
$info = error_get_last();
$message .= ' Error-Message: ' . $info['message'];
}
switch (self::$error_mode) {
case self::ERROR_MODE_DEBUG:
Helpers::debugError($message);
break;
case self::ERROR_MODE_FATAL:
Helpers::fatalError($message);
break;
case self::ERROR_MODE_SILENT:
break;
default:
break;
}
}
示例5: walkElementContainer
public function walkElementContainer(&$data, $structure, $parameters)
{
if (is_array($data)) {
if (count($data) > 0) {
$elements_structure = DataStructure::elementsArray();
for ($element_index = 0; $element_index < count($data); $element_index++) {
$element_data =& $data[$element_index]['content'];
$element_id = $data[$element_index]['elementId'];
$element_parameters = array('elementId' => $element_id, 'elementIndex' => $element_index);
$element_parameters = array_merge($parameters, $element_parameters);
if (!isset($elements_structure[$element_id])) {
Helpers::fatalError('DataModifier: A element with the ID [' . $element_id . '] does not exist.');
}
$element_structure = $elements_structure[$element_id]['structure'];
$this->modifyFields($element_data, $element_structure, $element_parameters);
$this->walkFields($element_data, $element_structure, $element_parameters);
}
}
}
}
示例6: configured
$configuration_ok = false;
} else {
if (count($config['languages']['list']) < 1) {
$configuration_ok = false;
}
}
}
if (!$configuration_ok) {
Helpers::fatalError('The system is not properly configured (in /system/custom/config/main.config.php)', true);
}
}
// Datenstruktur, Plugins, Module, Modifikatoren laden
DataStructure::load();
Plugins::load();
FrontendModules::load();
DataModifiers::load();
// Frontend-Controller-Klassen-Datei laden
$controller_file_name = Config::get()->frontendController->classFile;
if (!file_exists($controller_file_name)) {
Helpers::fatalError('Frontend controller class file not found (' . $controller_file_name . ' doesn\'t exist)!', true);
}
require_once $controller_file_name;
// Klasse instanziieren
$controller_class_name = Config::get()->frontendController->className;
if (!class_exists($controller_class_name)) {
Helpers::fatalError('Frontend controller class not found (class "' . $controller_class_name . '" doesn\'t exist in ' . $controller_file_name . ')!', true);
}
$controller = new $controller_class_name();
Registry::set('frontendController', $controller);
// Und los...
$controller->run();
示例7: found
$action = $path[2];
} else {
$action = 'default';
}
$method = $action . 'Action';
// Datei inkludieren
require_once APPLICATION_ROOT . 'system/core/backend/controllers/' . $folder . '/' . $file;
// Prüfen, ob Klasse existiert
if (!class_exists($class)) {
Helpers::fatalError('Page not found (class "' . $class . '" doesn\'t exist in system/core/backend/controllers/' . $folder . '/' . $file . ')!', true);
}
// Klasse instanziieren
$controller = new $class($module);
// Prüfen, ob Methode existiert
if (!method_exists($controller, $method)) {
Helpers::fatalError('Page not found (class-method "' . $method . '" doesn\'t exist in class "' . $class . '" ist in system/core/backend/controllers/' . $folder . '/' . $file . ')!', true);
}
// View erzeugen und mit Controller verbinden
$view = new View();
$view->assignTemplate(APPLICATION_ROOT . 'system/core/backend/views/' . $folder . '/' . UTF8String::strtolower($file));
$view->assign('baseUrl', Config::get()->baseUrl);
$view->assign('moduleUrl', Config::get()->baseUrl . 'admin/' . $folder . '/' . $module . '/');
$view->assign('publicUrl', Config::get()->baseUrl . 'system/core/backend/public/');
$view->assign('backendLanguage', $language_id);
$controller->assignView($view);
// Action-Methode ausführen
$controller->callActionMethod($action);
// Ausgabe des Views...
if ($controller->getView() != null) {
$controller->getView()->output();
}
示例8: getPage
public function getPage($page_id, $language_id, $preview = false)
{
// Smarty initialisieren
$smarty = new Template();
// Seiten-Infos laden
$pages = new Pages();
$page_properties = $pages->getProperties($page_id);
if ($page_properties === false) {
Helpers::fatalError('A page with the ID "' . $page_id . '" does not exist!');
}
// Wenn die Vorschau-Version der Seite angefordert wurde,
// überprüfen, ob überhaupt eine editierte Version der Seite existiert,
// wenn nicht, Vorschau-Modus ignorieren
if ($preview) {
if ($page_properties['status'] == Pages::STATUS_PUBLISHED) {
$preview = false;
}
}
// Seiteneigenes Verzeichnis abhängig von $preview auslesen
if ($preview) {
$page_files = $pages->getPageFilesEditFolder($page_id, $page_properties);
$page_files_url = $pages->getPageFilesEditUrl($page_id, $page_properties);
} else {
$page_files = $pages->getPageFilesPublishedFolder($page_id, $page_properties);
$page_files_url = $pages->getPageFilesPublishedUrl($page_id, $page_properties);
}
$page_url = $pages->getPageUrl($page_id, $language_id, $page_properties);
// Grundlegende Variablen zuweisen, die zwar mit dem Inhalt nichts zu tun haben, aber wichtig sind :-)
$smarty->assign('baseUrl', Config::get()->baseUrl);
$smarty->assign('publicUrl', Config::get()->baseUrl . 'system/custom/frontend/public/');
$smarty->assign('pageUrl', $page_url);
$smarty->assign('pageId', $page_id);
$smarty->assign('languageId', $language_id);
$smarty->assign('templateId', $page_properties['template-id']);
$smarty->assign('uniqueId', $page_properties['unique-id']);
$smarty->assign('pageFiles', $page_files);
$smarty->assign('pageFilesUrl', $page_files_url);
$languages = Config::get()->languages->list->getArrayCopy();
foreach ($languages as $key => $value) {
$languages[$key]['id'] = $key;
}
$smarty->assign('languages', $languages);
// Seiten-Struktur laden
$pages_structure = DataStructure::pagesArray();
if (!isset($pages_structure[$page_properties['template-id']]['structure'])) {
Helpers::fatalError('A page template with the ID "' . $page_properties['template-id'] . '" does not exist!');
}
$page_structure = $pages_structure[$page_properties['template-id']]['structure'];
// Die folgenden Parameter werden an die Modifikatoren und Plugins übergeben
$parameters = array('preview' => $preview, 'pageId' => $page_id, 'languageId' => $language_id, 'templateId' => $page_properties['template-id'], 'uniqueId' => $page_properties['unique-id'], 'pageUrl' => $page_url, 'pageFiles' => $page_files, 'pageFilesUrl' => $page_files_url, 'smarty' => $smarty);
// Seiten-Inhalt laden
$content_object = new PageContent();
if (!$content_object->load($page_id, !$preview)) {
Helpers::fatalError('The content of the page with the ID "' . $page_id . '" could not be loaded!');
}
$page_content = $content_object->getArray($language_id, $smarty, $parameters);
// Globale Elemente laden
$this->loadGlobalElementsPage($smarty, $language_id);
$this->assignGlobalElementsToSmarty($smarty, $language_id);
// Inhalte zuweisen
foreach ($page_structure as $block_id => $block) {
if ($block['type'] == 'datablock') {
$block_data = null;
if (isset($page_content[$block_id])) {
$block_data = $page_content[$block_id];
}
$smarty->assign($block_id, $block_data);
} elseif ($block['type'] == 'container') {
$container_content = '';
if (isset($page_content[$block_id])) {
if (is_array($page_content[$block_id])) {
foreach ($page_content[$block_id] as $container_element_key => $container_element) {
$container_content = $container_content . $this->getElement($page_id, $language_id, $container_element['elementId'], $container_element['content'], $preview);
}
}
}
$smarty->assign($block_id, $container_content);
}
}
// registrierte Plugins aufrufen, vielleicht hat ja noch jemand etwas hinzuzufügen :-)
Plugins::call(Plugins::ASSIGN_PAGE_DATA, $parameters);
// Smarty-Template für die Template-ID der aktuellen Seite zurückgeben
$page_template = $pages_structure[$page_properties['template-id']];
return $smarty->fetch('file:[pages]' . $page_template['template']);
}
示例9: realpath
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!Auth::isLoggedIn()) {
Helpers::fatalError('Error: No valid user logged in.', true);
}
require_once realpath(dirname(__FILE__) . '/../../../library/elfinder/elFinderConnector.class.php');
require_once realpath(dirname(__FILE__) . '/../../../library/elfinder/elFinder.class.php');
require_once realpath(dirname(__FILE__) . '/../../../library/elfinder/elFinderVolumeDriver.class.php');
require_once realpath(dirname(__FILE__) . '/../../../library/elfinder/elFinderVolumeLocalFileSystem.class.php');
// Required for MySQL storage connector
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
// Required for FTP connector support
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
/**
* Simple function to demonstrate how to control file access using "accessControl" callback.
* This method will disable accessing files/folders starting from '.' (dot)
*
* @param UTF8String $attr attribute name (read|write|locked|hidden)
* @param UTF8String $path file path relative to volume root directory started with directory separator
示例10: callActionMethod
public function callActionMethod($action)
{
// JS 26.02.2014 - habe gerade gesehen dass eine Aktion "before" zu �blen Problemen f�hren k�nnte...
// Eigentlich m�sste man die Funktion "beforeAction" umbenennen, aber aus Kompatibilit�tsgr�nden lassen wir es mal so
// und fangen es einfach ggf. ab...
if ($action == 'before') {
Helpers::fatalError('An action can not have the name "before" because it is used internal.', true);
}
$method = $action . 'Action';
if (method_exists($this, $method)) {
if ($this->userIsAuthorized($action)) {
if ($this->beforeAction($action)) {
$this->{$method}();
}
}
return true;
} else {
return false;
}
}
示例11: run
public function run()
{
// Startup-Ereignis
Plugins::call(Plugins::STARTUP, null);
// Router laden
$router_file_name = Config::get()->frontendRouter->classFile;
if (!file_exists($router_file_name)) {
Helpers::fatalError('Frontend router class file not found (' . $router_file_name . ' doesn\'t exist)!', true);
}
require_once $router_file_name;
$router_class_name = Config::get()->frontendRouter->className;
if (!class_exists($router_class_name)) {
Helpers::fatalError('Frontend router class not found (class "' . $router_class_name . '" doesn\'t exist in ' . $router_file_name . ')!', true);
}
$router = new $router_class_name();
Registry::set('frontendRouter', $router);
// PageBuilder laden
$page_builder_file_name = Config::get()->pageBuilder->classFile;
if (!file_exists($page_builder_file_name)) {
Helpers::fatalError('PageBuilder class file not found (' . $page_builder_file_name . ' doesn\'t exist)!', true);
}
require_once $page_builder_file_name;
$page_builder_class_name = Config::get()->pageBuilder->className;
if (!class_exists($page_builder_class_name)) {
Helpers::fatalError('PageBuilder class not found (class "' . $page_builder_class_name . '" doesn\'t exist in ' . $page_builder_file_name . ')!', true);
}
$page_builder = new $page_builder_class_name();
Registry::set('pageBuilder', $page_builder);
// routing
$router->route();
$languageId = $router->getLanguageId();
if ($router->pageFound()) {
$pageId = $router->getPageId();
$error_404 = false;
} else {
$pageId = $router->getErrorPageId();
$error_404 = true;
}
if ($pageId !== false) {
// Ist die Seite ein Link? Dann einfach auf die angegebene URL weiterleiten...
if ($router->isPageLink()) {
Helpers::redirect($router->getPageLinkUrl(), Config::get()->pageLinkRedirectionResponseCode);
exit;
}
// �bersetzungen laden
$config = Config::getArray();
$languages = $config['languages']['list'];
setlocale(LC_ALL, $languages[$languageId]['locale']);
if (is_array($languages[$languageId]['translation'])) {
if (count($languages[$languageId]['translation']) > 0) {
foreach ($languages[$languageId]['translation'] as $translation_file) {
Translate::loadStrings($translation_file, $languageId);
}
}
} else {
if ($languages[$languageId]['translation'] != '') {
Translate::loadStrings($languages[$languageId]['translation'], $languageId);
}
}
// Before-Display-Ereignis
Plugins::call(Plugins::BEFORE_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
if (!$router->isPreview()) {
// Versuchen, die Seite aus dem Cache zu holen
$output = PageCache::getPage($pageId, $languageId);
$output_cached = false;
// Keine Version im Cache verf�gbar, Seite neu erzeugen
if ($output === false) {
$output = $page_builder->getPage($pageId, $languageId);
} else {
$output_cached = true;
}
// Wenn noch nicht im Cache, erzeugte Ausgabe im Cache ablegen
if (!$output_cached) {
PageCache::cachePage($pageId, $languageId, $output);
}
} else {
// Im Vorschau-Modus den Cache nicht verwenden
// Und dem PageBuilder sagen, dass er die Vorschau-Version erstellen soll
$output = $page_builder->getPage($pageId, $languageId, true);
$output_cached = false;
}
// HTTP-Header senden
if ($error_404) {
if (!headers_sent()) {
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
}
}
$page_builder->outputHeader($pageId, $languageId);
// Header-Senden-Ereignis
Plugins::call(Plugins::SEND_HEADER, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
// Modify-Output-Before-Display-Ereignis, bietet die M�glichkeit,
// dass ein Plugin die Ausgabe vor der Ausgabe nochmal ver�ndert,
// unabh�ngig davon, ob die Seite aus dem Cache geladen wurde oder nicht
Plugins::call(Plugins::MODIFY_OUTPUT_BEFORE_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId, 'isCached' => $output_cached), $output);
// Seite ausgeben
print $output;
// After-Display-Ereignis
Plugins::call(Plugins::AFTER_DISPLAY, array('preview' => $router->isPreview(), 'pageId' => $pageId, 'languageId' => $languageId));
} else {
Helpers::fatalError('Error 404: page not found ', true);
//.........这里部分代码省略.........