本文整理汇总了PHP中EE_Error::add_error方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Error::add_error方法的具体用法?PHP EE_Error::add_error怎么用?PHP EE_Error::add_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Error
的用法示例。
在下文中一共展示了EE_Error::add_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _request_filesystem_credentials
/**
* _request_filesystem_credentials
* if attempting to enable full logging, WordPress may require filesystem credentials for FTP or SSH depending on the server
*
* @access protected
* @param bool $show_errors
* @return bool
*/
protected function _request_filesystem_credentials($show_errors = TRUE)
{
require_once ABSPATH . 'wp-admin/includes/file.php';
$url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'request_filesystem_credentials'), $this->_admin_base_url);
$credentials = request_filesystem_credentials($url);
if ($credentials == FALSE) {
if ($show_errors) {
EE_Error::get_notices(FALSE);
EE_Error::reset_notices();
EE_Error::add_error(__('Connection settings are missing or incorrect. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false');
}
return FALSE;
}
// now we have some credentials, try to get the wp_filesystem running
$WP_Filesystem = WP_Filesystem($credentials);
if (!$WP_Filesystem) {
if ($show_errors) {
EE_Error::get_notices(FALSE);
EE_Error::reset_notices();
EE_Error::add_error(__('There was an error connecting to the server. Please verify that the connection settings below are correct.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false');
}
// our credentials were no good, ask the user for them again
request_filesystem_credentials($url);
return FALSE;
}
EE_Registry::instance()->CFG->admin->use_full_logging = TRUE;
return TRUE;
}
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:38,代码来源:Extend_General_Settings_Admin_Page.core.php
示例2: _migration_step
/**
* _migration_step
*
* @access protected
* @param int $num_items
* @throws EE_Error
* @return int number of items ACTUALLY migrated
*/
protected function _migration_step($num_items = 1)
{
// if this isn't set then something is really wrong
if (!EE_Config::instance()->core instanceof EE_Core_Config) {
throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso'));
}
// name of the WP Posts Page
$posts_page = $this->_get_page_for_posts();
// make sure critical pages get removed
$this->_update_post_shortcodes($posts_page);
// save updated config, but don't add errors
if (!EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
EE_Error::add_error(__('The Event Espresso Configuration Settings were not updated when attempting to save the "critical page post shortcodes".', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
}
// check for errors
$notices = EE_Error::get_notices(FALSE);
// any errors to report?
if (isset($notices['errors'])) {
foreach ($notices as $value) {
$this->add_error($value);
}
}
//regardless of whether it worked or not, we ought to continue the migration
$this->set_completed();
return 1;
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:34,代码来源:EE_DMS_4_3_0_critical_page_shortcode_tracking.dmsstage.php
示例3: remove_relation_to_term_taxonomy
/**
* Removes the relation to the specified term taxonomy, and maintains the
* data integrity of the term taxonomy provided
* @param EE_Term_Taxonomy $term_taxonomy
* @return EE_Base_Class the relation was removed from
*/
function remove_relation_to_term_taxonomy($term_taxonomy)
{
if (!$term_taxonomy) {
EE_Error::add_error(sprintf(__("No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso"), get_class($this), $this->ID()), __FILE__, __FUNCTION__, __LINE__);
return NULL;
}
$term_taxonomy->set_count($term_taxonomy->count() - 1);
$term_taxonomy->save();
return $this->_remove_relation_to($term_taxonomy, 'Term_Taxonomy');
}
示例4: __construct
/**
* constructor for questions
* @param \EE_Question $QST EE_Question object
* @param \EE_Answer $ANS EE_Answer object
* @param array $q_meta
* @access public
* @return \EE_Question_Form_Input
*/
public function __construct(EE_Question $QST = NULL, EE_Answer $ANS = NULL, $q_meta = array())
{
if (empty($QST) || empty($ANS)) {
EE_Error::add_error(__('An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return NULL;
}
$this->_QST = $QST;
$this->_ANS = $ANS;
$this->set_question_form_input_meta($q_meta);
$this->set_question_form_input_init();
}
示例5: __construct
public function __construct($url_link = 0)
{
if ($this->registration = EE_Registry::instance()->load_model('Registration')->get_registration_for_reg_url_link($url_link)) {
$this->transaction = $this->registration->transaction();
$payment_settings = EE_Config::instance()->gateway->payment_settings;
//get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Invoice');
} else {
EE_Error::add_error(__('Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
}
}
示例6: prepare_for_set
/**
* When setting, just verify that the value being used matches what we've defined as allowable enum values.
* If not, throw an error (but if WP_DEBUG is false, just set the value to default)
* @param string $value_inputted_for_field_on_model_object
* @return string
* @throws EE_Error
*/
function prepare_for_set($value_inputted_for_field_on_model_object)
{
if ($value_inputted_for_field_on_model_object !== null && !array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) {
if (defined('WP_DEBUG') && WP_DEBUG) {
$msg = sprintf(__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'), $value_inputted_for_field_on_model_object, $this->_name);
$msg2 = sprintf(__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'), $this->_name, implode(", ", array_keys($this->_allowed_enum_values)), $value_inputted_for_field_on_model_object);
EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
}
return $this->get_default_value();
}
return $value_inputted_for_field_on_model_object;
}
示例7: run
/**
* run - initial module setup
*
* @access public
* @return void
*/
public function run($WP)
{
if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
require_once EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php';
} else {
$msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
}
// add_filter( 'FHEE_load_ee_config', '__return_true' );
// add_filter( 'FHEE_run_EE_wp', '__return_true' );
// add_filter( 'FHEE_load_EE_Session', '__return_true' );
// add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
// add_action( 'wp', array( $this, 'wp' ));
// add_filter( 'the_content', array( $this, 'the_content' ));
}
示例8: load_espresso_calendar_class
function load_espresso_calendar_class()
{
// check for duplicate copy of Calendar addon
if (class_exists('EE_Calendar')) {
EE_Error::add_error(sprintf(__('It appears there are multiple copies of the Event Espresso Calendar installed on your server.%sPlease remove (delete) all copies except for this version: "%s"', 'event_espresso'), '<br />', EE_CALENDAR_VERSION), __FILE__, __FUNCTION__, __LINE__);
add_action('admin_notices', 'espresso_calendar_activation_error');
return;
}
// todo: remove version check since this has been added to later versions of register_addon in EE core
if (class_exists('EE_Addon') && version_compare(EVENT_ESPRESSO_VERSION, EE_CORE_VERSION_REQUIRED, '>=')) {
// calendar_version
require_once plugin_dir_path(__FILE__) . 'EE_Calendar.class.php';
EE_Calendar::register_addon();
} else {
add_action('admin_notices', 'espresso_calendar_activation_error');
}
}
示例9: add_query_args_and_nonce
/**
* _add_query_arg
* adds nonce to array of arguments then calls WP add_query_arg function
*
* @access public
* @param array $args
* @param string $url
* @return string
*/
public static function add_query_args_and_nonce($args = array(), $url = '')
{
if (empty($url)) {
$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso');
$dev_msg = $user_msg . "\n" . sprintf(__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso'), __CLASS__);
EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
}
// check that an action exists
if (isset($args['action']) && !empty($args['action'])) {
$args = array_merge($args, array($args['action'] . '_nonce' => wp_create_nonce($args['action'] . '_nonce')));
} else {
$args = array_merge($args, array('action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')));
}
//finally, let's always add a return address (if present) :)
$args = !empty($_REQUEST['action']) ? array_merge($args, array('return' => $_REQUEST['action'])) : $args;
return add_query_arg($args, $url);
}
示例10: format
/**
* format - output formatted EE object address information
*
* @access public
* @param object EEI_Address $obj_with_address
* @param string $type how the address is formatted. for example: 'multiline' or 'inline'
* @param boolean $use_schema whether to apply schema.org formatting to the address
* @param bool $add_wrapper
* @return string
*/
public static function format($obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true)
{
// check that incoming object implements the EEI_Address interface
if (!$obj_with_address instanceof EEI_Address) {
$msg = __('The address could not be formatted.', 'event_espresso');
$dev_msg = __('The Address Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso');
EE_Error::add_error($msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
return null;
}
// obtain an address formatter
$formatter = EEH_Address::_get_formatter($type);
// apply schema.org formatting ?
$use_schema = !is_admin() ? $use_schema : false;
$formatted_address = $use_schema ? EEH_Address::_schema_formatting($formatter, $obj_with_address) : EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
$formatted_address = $add_wrapper && !$use_schema ? '<div class="espresso-address-dv">' . $formatted_address . '</div>' : $formatted_address;
// return the formatted address
return $formatted_address;
}
示例11: set_redirection_info
/**
* Set redirection info
*
* @see https://github.com/eventespresso/event-espresso-core/blob/4.6.17.p/core/libraries/payment_methods/EE_Offsite_Gateway.lib.php#L51-L59
*
* @param EEI_Payment $payment
* @param type $billing_info
* @param type $return_url
* @param type $cancel_url
*/
public function set_redirection_info($ee_payment, $billing_info = array(), $return_url = null, $notify_url = null, $cancel_url = null)
{
$pronamic_gateway = Pronamic_WP_Pay_Plugin::get_gateway($this->_config_id);
if ($pronamic_gateway) {
$transaction = $ee_payment->transaction();
$total_line_item = $transaction->total_line_item();
$data = new Pronamic_WP_Pay_Extensions_EventEspresso_PaymentData($this, $total_line_item, $transaction);
$pronamic_payment = Pronamic_WP_Pay_Plugin::start($this->_config_id, $pronamic_gateway, $data);
$error = $pronamic_gateway->get_error();
if (is_wp_error($error)) {
// @see https://github.com/eventespresso/event-espresso-core/blob/4.6.18.p/caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php#L147
$error_message = sprintf(__('Errors communicating with gateway: %s', 'pronamic_ideal'), implode(',', $error->get_error_messages()));
EE_Error::add_error($error_message, __FILE__, __FUNCTION__, __LINE__);
throw new EE_Error($error_message);
} else {
update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_return', $return_url);
update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_success', $return_url);
update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_cancel', $cancel_url);
update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_error', $cancel_url);
$redirect_url = $pronamic_payment->get_action_url();
$redirect_args = $pronamic_gateway->get_output_fields();
/*
* Since Event Espresso uses an HTML form to redirect users to the payment gateway
* we have to make sure an POST method is used when the redirect URL has query arguments.
* Otheriwse the URL query arguments will be stripped by the users webbrowser.
* Herefor we have to make sure the redirect arguments array is not empty.
*
* @see https://github.com/eventespresso/event-espresso-core/blob/4.6.18.p/core/db_classes/EE_Payment.class.php#L547
* @see http://stackoverflow.com/q/1116019
*/
if (false !== strpos($redirect_url, '?') && empty($redirect_args)) {
$redirect_args[] = '';
}
$ee_payment->set_redirect_url($redirect_url);
$ee_payment->set_redirect_args($redirect_args);
}
} else {
$error = Pronamic_WP_Pay_Plugin::get_default_error_message();
// @see https://github.com/eventespresso/event-espresso-core/blob/4.6.18.p/caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php#L147
throw new EE_Error($error);
}
return $ee_payment;
}
示例12: ee_deprecated_update_attendee_registration_form_old
/**
* @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165
* it is preferred to instead use _update_attendee_registration_form_new() which
* also better handles form validation. Exits
* @param EE_Admin_Page $admin_page
* @return void
*/
function ee_deprecated_update_attendee_registration_form_old($admin_page)
{
//check if the old hooks are in use. If not, do the default
if (!ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() || !$admin_page instanceof EE_Admin_Page) {
return;
}
$req_data = $admin_page->get_request_data();
$qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE;
$REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE;
$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
if (!$REG_ID || !$qstns) {
EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
}
$success = TRUE;
// allow others to get in on this awesome fun :D
do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
// loop thru questions... FINALLY!!!
foreach ($qstns as $QST_ID => $qstn) {
//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
if (!is_array($qstn)) {
$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
continue;
}
foreach ($qstn as $ANS_ID => $ANS_value) {
//get answer
$query_params = array(0 => array('ANS_ID' => $ANS_ID, 'REG_ID' => $REG_ID, 'QST_ID' => $QST_ID));
$answer = EEM_Answer::instance()->get_one($query_params);
//this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer
if (!$answer instanceof EE_Answer) {
$set_values = array('QST_ID' => $QST_ID, 'REG_ID' => $REG_ID, 'ANS_value' => $qstn);
$success = EEM_Answer::instance()->insert($set_values);
continue 2;
}
$answer->set('ANS_value', $ANS_value);
$success = $answer->save();
}
}
$what = __('Registration Form', 'event_espresso');
$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
$admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
exit;
}
示例13: _get_notify_url
/**
* Gets the URL that the user should generally be sent back to after payment completion offiste
* Adds the reg_url_link in order to remember which session we were in the middle of processing
* @param EE_Registration or int, current registration we want to link back to in the return url.
* @param boolean $urlencode whether or not to url-encode the url (if true, you probably intend to pass
* this string as a URL parameter itself, or maybe a post parameter)
* @return string URL on the current site of the thank_you page, with parameters added on to know which registration was just
* processed in order to correctly display the payment status. And it gets URL-encoded by default
*/
protected function _get_notify_url($registration, $urlencode = false)
{
//if $registration is an ID instead of an EE_Registration, make it an EE_Registration
if (!$registration instanceof EE_Registration) {
$registration = $this->_REG->get_one_by_ID($registration);
}
if (empty($registration)) {
$msg[0] = __("Cannot get Notify URL for gateway. Invalid registration", 'event_espresso');
$msg[1] = sprinf(__("Registration being used is %s.", 'event_espresso'), print_r($registration, true));
EE_Error::add_error(implode("||", $msg), __FILE__, __FUNCTION__, __LINE__);
return '';
}
//get a registration that's currently getting processed
/*@var $registration EE_Registration */
$url = add_query_arg(array('e_reg_url_link' => $registration->reg_url_link(), 'ee_gateway' => $this->_gateway_name), get_permalink(EE_Registry::instance()->CFG->core->txn_page_id));
if ($urlencode) {
$url = urlencode($url);
}
return $url;
}
示例14: _insert_term
private function _insert_term($update = FALSE, $taxonomy = 'espresso_people_categories')
{
if ($taxonomy == 'espresso_people_categories') {
$term_id = $update ? $this->_req_data['PER_CAT_ID'] : '';
} else {
$term_id = $update ? $this->_req_data['PER_TYPE_ID'] : '';
}
$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
$term_args = array('name' => $category_name, 'description' => $category_desc, 'parent' => $category_parent);
//was the category_identifier input disabled?
if (isset($this->_req_data['category_identifier'])) {
$term_args['slug'] = $this->_req_data['category_identifier'];
}
$insert_ids = $update ? wp_update_term($term_id, $taxonomy, $term_args) : wp_insert_term($category_name, $taxonomy, $term_args);
if (!is_array($insert_ids)) {
$msg = $taxonomy == 'espresso_people_categories' ? __('An error occurred and the category has not been saved to the database.', 'event_espresso') : __('An error occurred and the people type has not been saved to the database.', 'event_espresso');
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
} else {
$term_id = $insert_ids['term_id'];
$msg = $taxonomy == 'espresso_people_categories' ? sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name) : sprintf(__('The people type %s was successfuly saved', 'event_espresso'), $category_name);
EE_Error::add_success($msg);
}
return $term_id;
}
示例15: get_options_for_question
/**
* get_options_for_question
*
* @access public
* @param string $QST_IDs csv list of $QST IDs
* @return array
*/
public function get_options_for_question($QST_IDs)
{
if (empty($QST_IDs)) {
EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return FALSE;
}
return EE_Registry::instance()->load_model('Question_Option')->get_all(array(array('Question.QST_ID' => array('IN', $QST_IDs), 'QSO_deleted' => FALSE), 'order_by' => 'QSO_ID'));
}