/** * update_debug_logging_options * * @param array $admin_options * @return array */ public function update_debug_logging_options($admin_options = array()) { $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; $admin_options->use_full_logging = $use_full_logging; if ($use_full_logging === FALSE) { EE_Error::get_notices(FALSE); EE_Error::reset_notices(); } $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; return $admin_options; }
public function tearDown() { parent::tearDown(); global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter, $current_user; $wp_filter = $this->wp_filters_saved['wp_filter']; $wp_actions = $this->wp_filters_saved['wp_actions']; $merged_filters = $this->wp_filters_saved['merged_filters']; $wp_current_filter = $this->wp_filters_saved['wp_current_filter']; $current_user = $this->_orig_current_user; $this->_detect_accidental_txn_commit(); $notices = EE_Error::get_notices(false, false, true); EE_Error::reset_notices(); if (!empty($notices['errors'])) { $this->fail($notices['errors']); } }
/** * Tests EE_Datetime_Field prepare_for_display method when it receives an invalid DateTime object on a * non-nullable field and WP_DEBUG is false. * * @since 4.7.0 */ public function test_prepare_for_display_with_EE_Error() { if (defined('WP_DEBUG') && WP_DEBUG) { $this->markTestSkipped('Unable to complete test because WP_DEBUG is already defined and is set to true'); } $this->_set_dtt_field_object(); $this->_datetime_field->prepare_for_display(null); //have error notice? $notice = EE_Error::get_notices(false); $notice = $notice['errors']; $expected = 'An error has occurred:<br />EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the Start Date field is not nullable. When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.'; $this->assertEquals($expected, $notice); EE_Error::reset_notices(); }
/** * update_debug_logging_options * * @param array $admin_options * @return array */ public function update_debug_logging_options($admin_options = array()) { $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; // trying to enable full logging for the first time? if ($use_full_logging && $use_full_logging !== $admin_options->use_full_logging) { $admin_options->use_full_logging = $this->_request_filesystem_credentials() ? TRUE : NULL; if ($admin_options->use_full_logging === NULL) { add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', '__return_false'); } } else { $admin_options->use_full_logging = $use_full_logging; } if ($use_full_logging === FALSE) { EE_Error::get_notices(FALSE); EE_Error::reset_notices(); } $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; return $admin_options; }
/** * _final_verifications * just makes sure that everything is set up correctly before proceeding * * @access private * @return bool * @throws \EE_Error */ private function _final_verifications() { // filter checkout $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); //verify that current step is still set correctly if (!$this->checkout->current_step instanceof EE_SPCO_Reg_Step) { EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); return false; } // if returning to SPCO, then verify that primary registrant is set if (!empty($this->checkout->reg_url_link)) { $valid_registrant = $this->checkout->transaction->primary_registration(); if (!$valid_registrant instanceof EE_Registration) { EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); return false; } $valid_registrant = null; foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { if ($registration instanceof EE_Registration && $registration->reg_url_link() === $this->checkout->reg_url_link) { $valid_registrant = $registration; } } if (!$valid_registrant instanceof EE_Registration) { // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? if (EED_Single_Page_Checkout::$_checkout_verified) { // clear the session, mark the checkout as unverified, and try again EE_Registry::instance()->SSN->clear_session(); EED_Single_Page_Checkout::$_initialized = false; EED_Single_Page_Checkout::$_checkout_verified = false; $this->_initialize(); EE_Error::reset_notices(); return false; } EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); return false; } } // now that things have been kinda sufficiently verified, // let's add the checkout to the session so that's available other systems EE_Registry::instance()->SSN->set_checkout($this->checkout); return true; }