/** * Load fields for Pages in the CMS section of the site * * @param [Widget Object] $widget Called in Plugins.php ->register() * */ public function loadFields($widget) { if ($this->isLoaded) { return; } $this->widget = $widget; $this->controller = $widget->getController(); if ($this->isExcludedHandler($this->controller)) { trace_log('excluded'); // return; } $pageFilename = $this->getTemplateFilename($widget->model->filename); $fields = $this->getFields($pageFilename); if (count($fields) > 0) { //Primary = normal tabs //Secondary = the code editor //outside = Top banner //Check if there are any tabs if (isset($fields['tabs'])) { $widget->addTabFields($fields['tabs'], 'primary'); } //Check if there are any standalone fields if (isset($fields['fields'])) { $storedData = $this->getValues($pageFilename); //Load all of our data into the widget thingy foreach ($storedData as $name => $value) { // tracelog($name); // tracelog($value); $widget->data[$name] = $value; } $widget->addFields($fields['fields'], 'primary'); } //Breaks layouts // $widget->removeField('markup'); // $widget->removeField('code'); } $this->isLoaded = true; }
if ($use_plugins) { load_plugins(); } // This step deprecated as of 1.0 - really only useful with old-style section // placeholders, which passed $s='section_name'. $s = empty($s) ? '' : $s; $pretext = !isset($pretext) ? array() : $pretext; $pretext = array_merge($pretext, pretext($s, $prefs)); callback_event('pretext_end'); extract($pretext); // Now that everything is initialised, we can crank down error reporting. set_error_level($production_status); if (!empty($feed) && in_array($feed, array('atom', 'rss'), true)) { include txpath . "/publish/{$feed}.php"; echo $feed(); trace_log(TEXTPATTERN_TRACE_DISPLAY); exit; } if (gps('parentid') && gps('submit')) { saveComment(); } elseif (gps('parentid') and $comments_mode == 1) { // Popup comments? header("Content-type: text/html; charset=utf-8"); exit(parse_form('popup_comments')); } // We are dealing with a download. if (@$s == 'file_download' && !empty($filename)) { output_file_download($filename); exit(0); } // Send 304 Not Modified if appropriate.
textpattern(); exit; } if (!empty($admin_side_plugins) and gps('event') != 'plugin') { load_plugins(1); } // Plugins may have altered privilege settings. if (!defined('TXP_UPDATE_DONE') && !gps('event') && !empty($default_event) && has_privs($default_event)) { $event = $default_event; } // Initialise private theme. $theme = theme::init(); include txpath . '/lib/txplib_head.php'; require_privs($event); callback_event($event, $step, 1); $inc = txpath . '/include/txp_' . $event . '.php'; if (is_readable($inc)) { include $inc; } callback_event($event, $step, 0); end_page(); if ($app_mode != 'async') { trace_log(TEXTPATTERN_TRACE_DISPLAY); } else { $trace = trace_log(TEXTPATTERN_TRACE_RESULT); header("X-Textpattern-Runtime: " . @$trace['microdiff']); header("X-Textpattern-Memory: " . @$trace['memory_peak']); } } else { txp_die('DB-Connect was successful, but the textpattern-table was not found.', '503 Service Unavailable'); }
/** * Обработчик исключений * Вызывается автоматически при исключениях и ошибках * @param \Exception $e Обрабатываемое исключение * @return bool */ static function exception($e) { // Если обработчики событий не вернут положительный результат, то // обрабатываем исключение по умолчанию if (!\boolive\core\events\Events::trigger('Core::error', [$e])) { trace_log(get_class($e) . ' [' . $e->getCode() . ']: ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine()); if (isset($e->xdebug_message)) { echo '<table cellspacing="0" cellpadding="1" border="1" dir="ltr">' . $e->xdebug_message . '</table>'; } else { trace($e, 'error'); } } }
function textpattern() { global $pretext, $prefs, $production_status, $siteurl, $has_article_tag; $has_article_tag = false; callback_event('textpattern'); if ($pretext['status'] == '404') { txp_die(gTxt('404_not_found'), '404'); } if ($pretext['status'] == '410') { txp_die(gTxt('410_gone'), '410'); } // Useful for clean URLs with error-handlers. txp_status_header('200 OK'); set_error_handler('tagErrorHandler'); $html = parse_page($pretext['page']); if ($html === false) { txp_die(gTxt('unknown_section'), '404'); } // Make sure the page has an article tag if necessary. if (!$has_article_tag and $production_status != 'live' and $pretext['context'] == 'article' and (!empty($pretext['id']) or !empty($pretext['c']) or !empty($pretext['q']) or !empty($pretext['pg']))) { trigger_error(gTxt('missing_article_tag', array('{page}' => $pretext['page']))); } restore_error_handler(); header("Content-type: text/html; charset=utf-8"); echo $html; trace_log(TEXTPATTERN_TRACE_DISPLAY); callback_event('textpattern_end'); }
/** * Alias for trace_log() * @return void */ function traceLog($message, $level = 'info') { trace_log($message, $level); }