本文整理汇总了PHP中AError::toMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP AError::toMessages方法的具体用法?PHP AError::toMessages怎么用?PHP AError::toMessages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AError
的用法示例。
在下文中一共展示了AError::toMessages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $filename
* @throws AException
*/
public function __construct($filename)
{
if (file_exists($filename) && ($info = getimagesize($filename))) {
$this->file = $filename;
$this->info = array('width' => $info[0], 'height' => $info[1], 'bits' => $info['bits'], 'mime' => $info['mime'], 'channels' => $info['channels']);
$this->registry = Registry::getInstance();
$this->image = $this->get_gd_resource($filename);
} else {
$error = new AError('Error: Cannot load image ' . $filename);
$error->toMessages()->toDebug()->toLog();
return false;
}
return true;
}
示例2: AError
$template = $config->get('config_storefront_template');
$dir = $template . DIR_EXT_STORE . DIR_EXT_TEMPLATE . $template;
}
if (in_array($template, $enabled_extensions) && is_dir(DIR_EXT . $dir)) {
$is_valid = true;
} else {
$is_valid = false;
}
//check if this is default template
if (!$is_valid && is_dir(DIR_TEMPLATE . $template)) {
$is_valid = true;
}
}
if (!$is_valid) {
$error = new AError('Template ' . $template . ' is not found - roll back to default');
$error->toMessages()->toLog()->toDebug();
$template = 'default';
}
if (IS_ADMIN) {
$config->set('original_admin_template', $config->get('admin_template'));
$config->set('admin_template', $template);
// Load language
$lang_obj = new ALanguageManager($registry);
} else {
$config->set('original_config_storefront_template', $config->get('config_storefront_template'));
$config->set('config_storefront_template', $template);
// Load language
$lang_obj = new ALanguage($registry);
}
// Create Global Layout Instance
$registry->set('layout', new ALayout($registry, $template));
示例3: dispatch
/**
* @param string $parent_controller
* @return null|string
*/
public function dispatch($parent_controller = '')
{
ADebug::checkpoint('' . $this->class . '/' . $this->method . ' dispatch START');
//Process the controller, layout and children
//check if we have missing class or everithing
if (empty($this->class) && has_value($this->file)) {
#Build back trace of calling functions to provide more details
$backtrace = debug_backtrace();
$function_stack = '';
if (is_object($parent_controller) && strlen($parent_controller->rt()) > 1) {
$function_stack = 'Parent Controller: ' . $parent_controller->rt() . ' | ';
}
for ($i = 1; $i < count($backtrace); $i++) {
$function_stack .= ' < ' . $backtrace[$i]['function'];
}
$url = $this->request->server['REQUEST_URI'];
$error = new AError('Error: URL: ' . $url . ' Could not load controller ' . $this->controller . '! Call stack: ' . $function_stack . '', AC_ERR_CLASS_CLASS_NOT_EXIST);
$error->toLog()->toDebug();
$error->toMessages();
return null;
} else {
if (empty($this->file) && empty($this->class) || empty($this->method)) {
$warning_txt = 'ADispatch: skipping unavailable controller …';
$warning = new AWarning($warning_txt);
$warning->toDebug();
return null;
}
}
//check for controller.pre
$output_pre = $this->dispatchPrePost($this->controller . POSTFIX_PRE);
/** @noinspection PhpIncludeInspection */
require_once $this->file;
/**
* @var $controller AController
*/
$controller = null;
if (class_exists($this->class)) {
$controller = new $this->class($this->registry, $this->args["instance_id"], $this->controller, $parent_controller);
$controller->dispatcher = $this;
} else {
$error = new AError('Error: controller class not exist ' . $this->class . '!', AC_ERR_CLASS_CLASS_NOT_EXIST);
$error->toLog()->toDebug();
}
if (is_callable(array($controller, $this->method))) {
/**
* @var $dispatch ADispatcher
*/
$dispatch = call_user_func_array(array($controller, $this->method), $this->args);
//Check if return is a dispatch and need to call new page
if ($dispatch && is_object($dispatch)) {
if ($this->args["instance_id"] == 0) {
//If main controller come back for new dispatch
return $dispatch->getController() . '/' . $dispatch->getMethod();
} else {
// Call new dispatch for new controller and exit
//???? need to put limit for recursion to prevent overflow
$dispatch->dispatch();
return null;
}
}
/**
* Load layout and process children controllers
* @method AController getChildren()
*/
$children = $controller->getChildren();
ADebug::variable('Processing children of ' . $this->controller, $children);
$block_uids = array();
//Process each child controller
foreach ($children as $child) {
//???? Add highest Debug level here with backtrace to review this
ADebug::checkpoint($child['controller'] . ' ( child of ' . $this->controller . ', instance_id: ' . $child['instance_id'] . ' ) dispatch START');
//Process each child and create dispatch to call recurcive
$dispatch = new ADispatcher($child['controller'], array("instance_id" => $child['instance_id']));
$dispatch->dispatch($controller);
// Append output of child controller to current controller
if ($child['position']) {
// maden for recognizing few custom_blocks in the same placeholder
$controller->view->assign($child['block_txt_id'] . '_' . $child['instance_id'], $this->response->getOutput());
} else {
$controller->view->assign($child['block_txt_id'], $this->response->getOutput());
}
//clean up and remove output
$this->response->setOutput('');
ADebug::checkpoint($child['controller'] . ' ( child of ' . $this->controller . ' ) dispatch END');
}
//Request controller to generate output
$controller->finalize();
//check for controller.pre
$output_post = $this->dispatchPrePost($this->controller . POSTFIX_POST);
//add pre and post controllers output
$this->response->setOutput($output_pre . $this->response->getOutput() . $output_post);
//clean up and destroy the object
unset($controller);
unset($dispatch);
} else {
$err = new AError('Error: controller method not exist ' . $this->class . '::' . $this->method . '!', AC_ERR_CLASS_METHOD_NOT_EXIST);
//.........这里部分代码省略.........
示例4: _load_settings
private function _load_settings()
{
/**
* @var ACache $cache
*/
$cache = $this->registry->get('cache');
/**
* @var ADB
*/
$db = $this->registry->get('db');
//detect URL for the store
$url = str_replace('www.', '', $_SERVER['HTTP_HOST']) . get_url_path($_SERVER['PHP_SELF']);
if (defined('INSTALL')) {
$url = str_replace('install/', '', $url);
}
//enable cache storage based on configuration
$cache->enableCache();
//set configured driver.
$cache_driver = 'file';
if (defined('CACHE_DRIVER')) {
$cache_driver = CACHE_DRIVER;
}
if (!$cache->setCacheStorageDriver($cache_driver)) {
$error = new AError('Cache storage driver ' . $cache_driver . ' can not be loaded!');
$error->toMessages()->toLog()->toDebug();
}
// Load default store settings
$settings = $cache->pull('settings');
if (empty($settings)) {
// set global settings (without extensions settings)
$sql = "SELECT se.*\n\t\t\t\t\tFROM " . $db->table("settings") . " se\n\t\t\t\t\tWHERE se.store_id = '0'\n\t\t\t\t\t\tAND se.`group` NOT IN (SELECT `key` FROM " . $db->table("extensions") . ")";
$query = $db->query($sql);
$settings = $query->rows;
foreach ($settings as &$setting) {
if ($setting['key'] == 'config_url') {
$parsed_url = parse_url($setting['value']);
if (empty($parsed_url['scheme'])) {
$parsed_url['scheme'] = "http";
}
$setting['value'] = $parsed_url['scheme'] . '://' . $parsed_url['host'] . $parsed_url['path'];
}
if ($setting['key'] == 'config_ssl_url') {
$parsed_url = parse_url($setting['value']);
if (empty($parsed_url['scheme'])) {
$parsed_url['scheme'] = "https";
}
$setting['value'] = $parsed_url['scheme'] . '://' . $parsed_url['host'] . $parsed_url['path'];
}
$this->cnfg[$setting['key']] = $setting['value'];
}
unset($setting);
//unset temp reference
//fix for rare issue on a database and creation of empty cache
if (!empty($settings) && $this->cnfg['config_cache_enable']) {
$cache->push('settings', $settings);
}
} else {
foreach ($settings as $setting) {
$this->cnfg[$setting['key']] = $setting['value'];
}
}
//set current store id as default 0 for now. It will be reset if other store detected below
$this->cnfg['config_store_id'] = 0;
// if storefront and not default store try to load setting for given URL
/* Example:
Specific store config -> http://localhost/abantecart123
Generic config -> http://localhost
*/
$config_url = preg_replace("(^https?://)", "", $this->cnfg['config_url']);
$config_url = preg_replace("(^://)", "", $config_url);
if (!is_int(strpos($config_url, $url)) && !is_int(strpos($url, $config_url))) {
// if requested url not a default store URL - do check other stores.
$cache_key = 'settings.store.' . md5('http://' . $url);
$store_settings = $cache->pull($cache_key);
if (empty($store_settings)) {
$sql = "SELECT se.`key`, se.`value`, st.store_id\n\t\t \t\t\t FROM " . $db->table('settings') . " se\n\t\t \t\t\t RIGHT JOIN " . $db->table('stores') . " st ON se.store_id = st.store_id\n\t\t \t\t\t WHERE se.store_id = (SELECT DISTINCT store_id FROM " . $db->table('settings') . "\n\t\t \t\t\t WHERE `group`='details'\n\t\t \t\t\t AND\n\t\t \t\t\t ( (`key` = 'config_url' AND (`value` LIKE '%" . $db->escape($url) . "'))\n\t\t \t\t\t XOR\n\t\t \t\t\t (`key` = 'config_ssl_url' AND (`value` LIKE '%" . $db->escape($url) . "')) )\n\t\t LIMIT 0,1)\n\t\t \t\t\t\t\tAND st.status = 1\n\t\t \t\t\t\t\tAND TRIM(se.`group`) NOT IN\n\t (SELECT TRIM(`key`) as `key`\n\t FROM " . $db->table("extensions") . ")";
$query = $db->query($sql);
$store_settings = $query->rows;
}
if ($store_settings) {
//store found by URL, load settings
foreach ($store_settings as $row) {
$value = $row['value'];
$this->cnfg[$row['key']] = $value;
}
//fix for rare issue on a database and creation of empty cache
if ($this->cnfg['config_cache_enable']) {
$cache->push($cache_key, $store_settings);
}
$this->cnfg['config_store_id'] = $store_settings[0]['store_id'];
} else {
$warning = new AWarning('Warning: Accessing store with non-configured or unknown domain ( ' . $url . ' ).' . "\n" . ' Check setting of your store domain URL in System Settings . Loading default store configuration for now.');
$warning->toLog()->toMessages();
//set config url to current domain
$this->cnfg['config_url'] = 'http://' . REAL_HOST . get_url_path($_SERVER['PHP_SELF']);
}
if (!$this->cnfg['config_url']) {
$this->cnfg['config_url'] = 'http://' . REAL_HOST . get_url_path($_SERVER['PHP_SELF']);
}
}
//.........这里部分代码省略.........