本文整理汇总了PHP中AError类的典型用法代码示例。如果您正苦于以下问题:PHP AError类的具体用法?PHP AError怎么用?PHP AError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run_system_check
/**
* Main driver for running system check
* @since 1.2.4
* @param $registry
* @param $mode ('log', 'return')
* @return array
*
* Note: This is English text only. Can be call before database and languges are loaded
*/
function run_system_check($registry, $mode = 'log')
{
$mlog = $counts = array();
$mlog[] = check_install_directory($registry);
$mlog = array_merge($mlog, check_file_permissions($registry));
$mlog = array_merge($mlog, check_php_configuraion($registry));
$mlog = array_merge($mlog, check_server_configuration($registry));
$counts['error_count'] = $counts['warning_count'] = $counts['notice_count'] = 0;
foreach ($mlog as $message) {
if ($message['type'] == 'E') {
if ($mode == 'log') {
//only save errors to the log
$error = new AError($message['body']);
$error->toLog()->toDebug();
$registry->get('messages')->saveError($message['title'], $message['body']);
}
$counts['error_count']++;
} else {
if ($message['type'] == 'W') {
if ($mode == 'log') {
$registry->get('messages')->saveWarning($message['title'], $message['body']);
}
$counts['warning_count']++;
} else {
if ($message['type'] == 'N') {
if ($mode == 'log') {
$registry->get('messages')->saveNotice($message['title'], $message['body']);
}
$counts['notice_count']++;
}
}
}
}
return array($mlog, $counts);
}
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info-store,代码行数:44,代码来源:system_check.php
示例2: save
public function save()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$output = array();
$this->loadLanguage('tool/rl_manager');
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->is_POST() && $this->_validateRLTypeForm($this->request->post)) {
$post_data = $this->request->post;
$rm = new AResourceManager();
if ($rm->updateResourceType($post_data)) {
$output['result_text'] = $this->language->get('text_success');
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
} else {
$error = new AError('');
$err_data = array('error_text' => 'Unable to save resource type');
return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
}
} else {
$error = new AError('');
$err_data = array('error_text' => $this->error);
return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:28,代码来源:rl_manager.php
示例3: update
public function update()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify('listing_grid/location_zones')) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/location_zones'), 'reset_value' => true));
}
$this->loadModel('localisation/zone');
$this->loadLanguage('localisation/zone');
switch ($this->request->post['oper']) {
case 'del':
$this->loadModel('localisation/location');
$ids = explode(',', $this->request->post['id']);
if (!empty($ids)) {
foreach ($ids as $id) {
$this->model_localisation_location->deleteLocationZone($id);
}
}
break;
default:
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:25,代码来源:location_zones.php
示例4: update_field
/**
* update only one field
*
* @return void
*/
public function update_field()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify('listing_grid/store')) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/store'), 'reset_value' => true));
}
$this->loadLanguage('setting/store');
$this->loadModel('setting/store');
if (isset($this->request->get['id'])) {
//request sent from edit form. ID in url
foreach ($this->request->post as $key => $value) {
$err = $this->_validateField($key, $value);
if (!empty($err)) {
$dd = new ADispatcher('responses/error/ajaxerror/validation', array('error_text' => $err));
return $dd->dispatch();
}
$data = array($key => $value);
$this->model_setting_store->editStore($this->request->get['id'], $data);
}
return;
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:31,代码来源:store.php
示例5: update
public function update()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify($this->rt)) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), $this->rt), 'reset_value' => true));
}
$this->loadModel('localisation/language_definitions');
$this->loadLanguage('localisation/language_definitions');
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->_validateForm()) {
foreach ($this->request->post['language_definition_id'] as $lang_id => $id) {
$data = array('language_id' => $lang_id, 'section' => $this->request->post['section'], 'block' => $this->request->post['block'], 'language_key' => $this->request->post['language_key'], 'language_value' => $this->request->post['language_value'][$lang_id]);
if ($id) {
$this->model_localisation_language_definitions->editLanguageDefinition($id, $data);
} else {
$this->model_localisation_language_definitions->addLanguageDefinition($data);
}
}
$this->view->assign('success', $this->language->get('text_success'));
}
$this->_getForm();
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:30,代码来源:language_definition_form.php
示例6: not_found
public function not_found()
{
//build not_found responce
$this->loadLanguage('error/not_found');
$error = new AError('');
$err_data = array('error_title' => $this->language->get('heading_title'), 'error_text' => $this->language->get('text_not_found'));
return $error->toJSONResponse('NOT_FOUND_404', $err_data);
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:8,代码来源:ajaxerror.php
示例7: writeToLog
/**
* SOAP request/response logging to a file
*/
function writeToLog($client)
{
if (!($logfile = fopen(TRANSACTIONS_LOG_FILE, "a"))) {
$error = new AError("Cannot open " . TRANSACTIONS_LOG_FILE . " file.\n");
$error->toLog()->toMessages->toDebug();
exit(1);
}
fwrite($logfile, sprintf("\r%s:- %s", date("D M j G:i:s T Y"), $client->__getLastRequest() . "\n\n" . $client->__getLastResponse()));
}
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:12,代码来源:fedex_func.php
示例8: updateField
public function updateField()
{
$this->loadLanguage('forms_manager/forms_manager');
$this->loadModel('tool/forms_manager');
if (!$this->_validateFieldForm($this->request->post) || !$this->request->get['form_id']) {
$error = new AError('');
return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $this->error));
}
$data = $this->request->post;
$data['form_id'] = $this->request->get['form_id'];
$this->model_tool_forms_manager->updateFormFieldData($data);
$this->response->setOutput('');
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:13,代码来源:fields.php
示例9: __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;
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:18,代码来源:image.php
示例10: __construct
/**
* @param string $type
*/
public function __construct($type)
{
$this->registry = Registry::getInstance();
//NOTE: Storefront can not access all resource at once. Resource type required
if ($type) {
$this->type = $type;
//get type details
$this->_loadType();
}
if (!$this->type_id) {
$message = "Error: Incorrect or missing resource type ";
$error = new AError($message);
$error->toLog()->toDebug();
}
}
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info-store,代码行数:18,代码来源:resources.php
示例11: update
public function update()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify($this->rt)) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), $this->rt), 'reset_value' => true));
}
$this->loadModel('localisation/language_definitions');
$this->loadLanguage('localisation/language_definitions');
if ($this->request->is_POST()) {
$output = array('error_text' => '', 'result_text' => '');
if ($this->_validateForm()) {
foreach ($this->request->post['language_definition_id'] as $lang_id => $id) {
$data = array('language_id' => $lang_id, 'section' => $this->request->post['section'], 'block' => $this->request->post['block'], 'language_key' => $this->request->post['language_key'], 'language_value' => $this->request->post['language_value'][$lang_id]);
if ($id) {
$this->model_localisation_language_definitions->editLanguageDefinition($id, $data);
} else {
$this->model_localisation_language_definitions->addLanguageDefinition($data);
}
}
$output['result_text'] = $this->language->get('text_success');
} else {
foreach ($this->error as $err) {
if (is_array($err)) {
$error_text[] = implode('<br>', $err);
} else {
$error_text[] = $err;
}
}
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_406', array('error_text' => $error_text, 'reset_value' => true));
}
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
} else {
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$this->document->setTitle($this->language->get('heading_title'));
$this->_getForm();
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:47,代码来源:language_definition_form.php
示例12: main
public function main()
{
if (!$this->user->canModify('setting/setting_quick_form')) {
$this->error['warning'] = $this->language->get('error_permission');
}
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$output = array('result_text' => '');
$this->loadModel('setting/setting');
$this->loadLanguage('setting/setting');
$this->loadLanguage('common/header');
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$setting = explode('-', $this->request->get['active']);
$this->data['group'] = $setting[0];
$this->data['setting_key'] = $setting[1];
$this->data['store_id'] = !isset($this->session->data['current_store_id']) ? $setting[2] : $this->session->data['current_store_id'];
if (is_int(strpos($this->data['setting_key'], 'config_description'))) {
$this->data['setting_key'] = substr($this->data['setting_key'], 0, strrpos($this->data['setting_key'], '_'));
$this->request->get['active'] = $this->data['group'] . '-' . $setting[1] . '-' . $this->data['store_id'];
} else {
$this->request->get['active'] = $this->data['group'] . '-' . $this->data['setting_key'] . '-' . $this->data['store_id'];
}
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->is_POST()) {
if ($this->_validateForm($this->data['group'])) {
$this->model_setting_setting->editSetting($this->data['group'], $this->request->post, $this->data['store_id']);
$output['result_text'] = $this->language->get('text_success');
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
} else {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_406', array('error_text' => $this->error, 'reset_value' => true));
}
} else {
$this->_getForm();
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:vglide,项目名称:abantecart-src,代码行数:43,代码来源:setting_quick_form.php
示例13: onControllerResponsesListingGridExtension_InitData
public function onControllerResponsesListingGridExtension_InitData()
{
if ($this->baseObject_method != 'update') {
return null;
}
$that = $this->baseObject;
if ($that->request->get['id'] != 'default_pp_express') {
return false;
}
if (!has_value($that->request->post['default_pp_express_custom_bg_color'])) {
return false;
}
$that->request->post['default_pp_express_custom_bg_color'] = ltrim($that->request->post['default_pp_express_custom_bg_color'], '#');
$is_valid = $this->_check_valid_colorhex($that->request->post['default_pp_express_custom_bg_color']);
if (!$is_valid) {
$that->loadLanguage('default_pp_express/default_pp_express');
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => $that->language->get('default_pp_express_error_bg_color'), 'reset_value' => false));
}
}
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:20,代码来源:default_pp_express.php
示例14: addStatus
public function addStatus($order_status_id, $status_text_id)
{
$order_status_id = (int) $order_status_id;
//preformat text_id at first
$status_text_id = preformatTextID($status_text_id);
if (in_array($order_status_id, array_keys($this->statuses)) || in_array($status_text_id, $this->statuses)) {
$error_text = 'Error: Cannot add new order status with id ' . $order_status_id . ' and text id ' . $status_text_id . ' into AOrderStatus class.';
$e = new AError($error_text);
$e->toLog()->toDebug();
return false;
}
if (!$status_text_id) {
$error_text = 'Error: Cannot add new order status with id ' . $order_status_id . ' and empty text id';
$e = new AError($error_text);
$e->toLog()->toDebug();
return false;
}
$this->statuses[$order_status_id] = $status_text_id;
return true;
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:20,代码来源:order_status.php
示例15: buildTask
public function buildTask()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->data['output'] = array();
if ($this->request->is_POST() && $this->_validate()) {
$this->loadModel('tool/backup');
$task_details = $this->model_tool_backup->createBackupTask('manual_backup', $this->request->post);
if (!$task_details) {
$this->errors = array_merge($this->errors, $this->model_tool_backup->errors);
$error = new AError('files backup error');
return $error->toJSONResponse('APP_ERROR_402', array('error_text' => implode(' ', $this->errors), 'reset_value' => true));
} else {
$this->data['output']['task_details'] = $task_details;
}
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($this->data['output']));
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:22,代码来源:backup.php
示例16: processDownloadForm
public function processDownloadForm()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify('product/product')) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'product/product'), 'reset_value' => true));
}
if (!$this->request->is_POST()) {
return null;
}
$this->loadModel('catalog/download');
if ($this->_validateDownloadForm($this->request->post)) {
$post_data = $this->request->post;
//disable download if file not set
if (!$post_data['filename']) {
$post_data['status'] = 0;
}
// for shared downloads
if (!isset($post_data['shared']) && !$this->request->get['product_id']) {
$post_data['shared'] = 1;
}
if ((int) $this->request->get['download_id']) {
$this->model_catalog_download->editDownload($this->request->get['download_id'], $post_data);
$download_id = (int) $this->request->get['download_id'];
} else {
$post_data['product_id'] = (int) $this->request->get['product_id'];
$download_id = $this->model_catalog_download->addDownload($post_data);
$this->session->data['success'] = $this->language->get('text_success_download_save');
}
$this->data['output'] = array('download_id' => $download_id, 'success' => true, 'result_text' => $this->language->get('text_success'));
} else {
$error = new AError('');
$err_data = array('error_text' => $this->error);
return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->response->addJSONHeader();
$this->load->library('json');
$this->response->setOutput(AJson::encode($this->data['output']));
}
开发者ID:vglide,项目名称:abantecart-src,代码行数:42,代码来源:product.php
示例17: _load_from_xml
/**
* Load definition values from XML
* @param string $filename
* @param string $directory
* @param string $mode
* @return array|null
*/
protected function _load_from_xml($filename, $directory, $mode)
{
if (!$filename) {
return null;
}
$definitions = array();
ADebug::checkpoint('ALanguage ' . $this->language_details['name'] . ' ' . $filename . ' prepare loading language from XML');
//get default extension language file
$default_language_info = $this->getDefaultLanguage();
if ($filename == $directory) {
// for common language file (english.xml. russian.xml, etc)
$file_name = $default_language_info['filename'];
$mode = 'silent';
} else {
$file_name = $filename;
}
$default_file_path = $this->_detect_language_xml_file($file_name, $default_language_info['directory']);
// if default language file path wrong - takes english
if (!file_exists($default_file_path)) {
$file_name = $filename == $directory ? 'english' : $file_name;
$default_file_path = $this->_detect_language_xml_file($file_name, 'english');
}
// get path to actual language
$file_path = $this->_detect_language_xml_file($filename, $this->language_details['directory']);
if (file_exists($file_path)) {
ADebug::checkpoint('ALanguage ' . $this->language_details['name'] . ' loading XML file ' . $file_path);
$definitions = $this->ReadXmlFile($file_path);
} else {
if (file_exists($default_file_path)) {
ADebug::checkpoint('ALanguage ' . $this->language_details['name'] . ' loading XML file ' . $default_file_path);
$definitions = $this->ReadXmlFile($default_file_path);
} else {
if ($mode != 'silent') {
$error = new AError('Missing default English definition XML file for ' . $filename . ' !');
$error->toLog()->toDebug();
}
}
}
//skip if not required and language file does not exist for silent mode.
if (empty($definitions) && $mode != 'silent') {
$error = new AError('Could not load language ' . $filename . ' from file "' . $file_path . '"!');
$error->toLog()->toDebug();
}
return $definitions;
}
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info-store,代码行数:52,代码来源:language.php
示例18: update_field
/**
* update only one field
*
* @return void
*/
public function update_field()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
if (!$this->user->canModify('listing_grid/attribute')) {
$error = new AError('');
return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/attribute'), 'reset_value' => true));
}
if (isset($this->request->get['id'])) {
//request sent from edit form. ID in url
foreach ($this->request->post as $key => $value) {
$err = $this->_validateField($key, $value);
if (!empty($err)) {
$error = new AError('');
return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $err));
}
$data = array($key => $value);
$this->attribute_manager->updateAttribute($this->request->get['id'], $data);
}
return null;
}
//request sent from jGrid. ID is key of array
$fields = array('sort_order', 'status');
foreach ($fields as $f) {
if (isset($this->request->post[$f])) {
foreach ($this->request->post[$f] as $k => $v) {
$err = $this->_validateField($f, $v);
if (!empty($err)) {
$error = new AError('');
return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $err));
}
$this->attribute_manager->updateAttribute($k, array($f => $v));
}
}
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
开发者ID:InquisitiveQuail,项目名称:abantecart-src,代码行数:43,代码来源:attribute.php
示例19: processError
/**
* @param string $title
* @param string $error
* @param string $level
* @return string
*/
private function processError($title, $error, $level = 'warning')
{
$this->message->{'save' . ucfirst($level)}($title, $error);
$wrn = new AError($error);
$wrn->toDebug()->toLog();
return $error;
}
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:13,代码来源:data.php
示例20: escape
/**
* @param string $value
* @return string
*/
public function escape($value)
{
if (is_array($value)) {
$dump = var_export($value, true);
$backtrace = debug_backtrace();
$dump .= ' (file: ' . $backtrace[1]['file'] . ' line ' . $backtrace[1]['line'] . ')';
$message = 'PostreSQL class error: Try to escape non-string value: ' . $dump;
$error = new AError($message);
$error->toLog()->toDebug()->toMessages();
return false;
}
return pg_escape_string($this->connection, (string) $value);
}
开发者ID:siddht1,项目名称:abantecart-src,代码行数:17,代码来源:postgresql.php
注:本文中的AError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论