本文整理汇总了PHP中I2CE::siteInitialized方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE::siteInitialized方法的具体用法?PHP I2CE::siteInitialized怎么用?PHP I2CE::siteInitialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE
的用法示例。
在下文中一共展示了I2CE::siteInitialized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSite
/**
* Controls the site update
* @param string $site_module_file
* @param boolean $verbose_errors. Defaults to true
*/
public static function updateSite($site_module_file, $verbose_errors = true)
{
if (!self::isAuthorizedToUpdate()) {
return false;
}
I2CE::longExecution();
$site_module_file = I2CE_FileSearch::absolut($site_module_file, 1);
I2CE::siteInitialized(false);
if (self::_updateSite($site_module_file, $verbose_errors)) {
$config = I2CE::getConfig();
$config->__set("/config/site/installation", 'done');
if (array_key_exists('HTTP_HOST', $_SERVER)) {
if (array_key_exists('request', $_GET)) {
$url = $_GET['request'];
} else {
$url = I2CE::getAccessedBaseURL();
}
echo "<br/><span style='color:#993300'>Site was succesully updated. Continue on to your <a href='{$url}'>site</a>?</span>";
$msg = "Site was succesully updated. Continue on to your site?";
echo "<script type='text/javascript'>if (confirm('{$msg}')) {setTimeout(function() {window.location= '{$url}';},500)}</script>";
//reload the requested page after 5 seconds
flush();
exit;
} else {
echo "Site was succesully updated\n";
$enable = preg_split('/,/', I2CE::getRuntimeVariable('enable', ''), -1, PREG_SPLIT_NO_EMPTY);
$disable = preg_split('/,/', I2CE::getRuntimeVariable('disable', ''), -1, PREG_SPLIT_NO_EMPTY);
if (count($enable) + count($disable) > 0) {
$succ = self::updateModules($enable, $disable);
I2CE::siteInitialized(false);
return $succ;
} else {
return true;
}
}
} else {
return false;
}
}
示例2: raiseError
/**
* Raise an error and redirect the user for any critical errors.
*
* The default redirect will go to the home page for the site.
* @param string/mixed $message The error message.
* @param integer $type The error type.
* @param string $redirect The page to redirect to for critical errors.
* @global array
*/
public static function raiseError($message = null, $type = E_USER_NOTICE, $redirect = "")
{
if ($message === null) {
if (!is_null($e = error_get_last())) {
if (substr($e['message'], 0, 19) == "Allowed memory size") {
// Memory limit has been reached so display
// something if we still can.
print_r($e);
}
foreach (self::$ignoreErrors as $part) {
if (strpos($e['message'], $part) !== false) {
return;
}
}
foreach (self::$ignoreErrorsFromFilesMatching as $part) {
if (strpos($e['file'], $part) !== false) {
return;
}
}
$message = "Fatal Error:" . print_r($e, true);
} else {
return;
}
if (array_key_exists('HTTP_HOST', $_SERVER)) {
$contents = preg_replace('/{{ERRORMESSAGE}}/', htmlentities($message), self::$badness);
if (is_array(self::$stored_messages)) {
$trace = array();
foreach (self::$stored_messages as $i => $m) {
if (!is_array($m) || !array_key_exists('msg', $m) || !$m['msg']) {
continue;
}
$trace[] = $m['trace'] . "\n" . $m['msg'] . "\n";
}
$trace = htmlentities(print_r($trace, true));
} else {
$trace = '';
}
$contents = preg_replace('/{{ERRORTRACE}}/', $trace, $contents);
if (is_string(I2CE::$email) && strlen(I2CE::$email) > 0) {
$email = I2CE::$email;
} else {
$email = 'hris@capacityplus.org';
}
$contents = preg_replace('/{{EMAIL}}/', htmlentities($email), $contents);
$contents = preg_replace('/{{REQUESTURI}}/', htmlentities($_SERVER['REQUEST_URI']), $contents);
echo $contents;
echo self::$errorImage;
flush();
}
}
$num = self::$error_num++;
$warning_level = 'Warning';
if (array_key_exists($type, self::$errorType)) {
$warning_level = self::$errorType[$type];
}
if (self::$trace_depth == 0) {
$trace = 'I2CE: ';
} else {
$debug = debug_backtrace();
$trace = 'I2CE: ' . self::getPrevMethod($debug, 1, self::$trace_depth) . ':';
}
if (count(self::$errorHandler) > 0) {
call_user_func(self::$errorHandler[0], $trace, $message, $type);
} else {
if (array_key_exists('HTTP_HOST', $_SERVER)) {
error_log($trace . $message . "\nError Type=" . $type, 0);
if (in_array($type, self::$noticeErrors)) {
$msg_level = '<b style="display:block;">' . $warning_level . '</b>';
} else {
self::$site_warnings++;
$msg_level = '<b style="display:block;color:red">' . $warning_level . '</b>';
}
$js_message = '<script type="text/javascript">addMessage("' . str_replace("\n", '<br/>', addcslashes($msg_level . $message, '"\\')) . '","' . str_replace("\n", '<br/>', addcslashes(rtrim($trace, "\n\t :"), '"\\')) . '");</script>' . "\n";
if (in_array($type, self::$noticeErrors)) {
//a notice error
if (I2CE::siteInitialized()) {
self::$stored_messages[] = array('msg' => $message, 'trace' => $trace, 'level' => $msg_level);
} else {
if (!self::$started_errors) {
echo self::$errorStart;
echo self::$errorImage;
self::$started_errors = true;
}
echo $js_message;
flush();
}
} else {
if (!I2CE::siteInitialized()) {
//we have a non notice error
//show any stored messages or warnings to give the user a clue as to what is going on
if (!self::$started_errors) {
//.........这里部分代码省略.........