/**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 function display()
 {
     if (!$this->_input instanceof EE_Form_Input_With_Options_Base) {
         throw new EE_Error(sprintf(__("Cannot use Checkbox Display Strategy with an input that doesn't have options", "event_espresso")));
     }
     //d( $this->_input );
     $multi = count($this->_input->options()) > 1 ? TRUE : FALSE;
     $this->_input->set_label_sizes();
     $label_size_class = $this->_input->get_label_size_class();
     $html = '';
     if (!is_array($this->_input->raw_value()) && $this->_input->raw_value() !== NULL) {
         EE_Error::doing_it_wrong('EE_Checkbox_Display_Strategy::display()', sprintf(__('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), $this->_input->html_id(), var_export($this->_input->raw_value(), true), $this->_input->html_name() . '[]'), '4.8.1');
     }
     $input_raw_value = (array) $this->_input->raw_value();
     foreach ($this->_input->options() as $value => $display_text) {
         $option_value_as_string = $this->_input->get_normalization_strategy()->unnormalize_one($value);
         $html_id = $multi ? $this->_input->html_id() . '-' . sanitize_key($option_value_as_string) : $this->_input->html_id();
         $html .= EEH_HTML::nl(0, 'checkbox');
         $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'checkbox');
         $html .= '<input type="checkbox"';
         $html .= ' name="' . $this->_input->html_name() . '[]"';
         $html .= ' id="' . $html_id . '"';
         $html .= ' class="' . $this->_input->html_class() . '"';
         $html .= ' style="' . $this->_input->html_style() . '"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= !empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : '';
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
     }
     return $html;
 }
 /**
  *
  * @throws EE_Error
  * @return string of html to display the field
  */
 public function display()
 {
     $input = $this->get_input();
     //d( $input );
     $multi = count($input->options()) > 1 ? TRUE : FALSE;
     $input->set_label_sizes();
     $label_size_class = $input->get_label_size_class();
     $html = '';
     if (!is_array($input->raw_value()) && $input->raw_value() !== NULL) {
         EE_Error::doing_it_wrong('EE_Checkbox_Display_Strategy::display()', sprintf(__('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), $input->html_id(), var_export($input->raw_value(), true), $input->html_name() . '[]'), '4.8.1');
     }
     $input_raw_value = (array) $input->raw_value();
     foreach ($input->options() as $value => $display_text) {
         $value = $input->get_normalization_strategy()->unnormalize_one($value);
         $html_id = $multi ? $this->get_sub_input_id($value) : $input->html_id();
         $html .= EEH_HTML::nl(0, 'checkbox');
         $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">';
         $html .= EEH_HTML::nl(1, 'checkbox');
         $html .= '<input type="checkbox"';
         $html .= ' name="' . $input->html_name() . '[]"';
         $html .= ' id="' . $html_id . '"';
         $html .= ' class="' . $input->html_class() . '"';
         $html .= ' style="' . $input->html_style() . '"';
         $html .= ' value="' . esc_attr($value) . '"';
         $html .= !empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : '';
         $html .= ' ' . $this->_input->other_html_attributes();
         $html .= '>&nbsp;';
         $html .= $display_text;
         $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
     }
     return $html;
 }
 /**
  *    Method for registering new EE_PMT_Base children
  *
  * @since    4.5.0
  * @param string $payment_method_id		a unique identifier for this set of modules Required.
  * @param  array $setup_args 		an array of arguments provided for registering modules Required.{
  *	@type string[] $payment_method_paths each element is the folder containing the EE_PMT_Base child class
  *		(eg, 'public_html/wp-content/plugins/my_plugin/Payomatic/' which contains the files
  *		EE_PMT_Payomatic.pm.php)
  * }
  * @throws EE_Error
  * @internal param string payment_method_paths 	an array of full server paths to folders containing any EE_PMT_Base children, or to the EED_Module files themselves
  * @return void
  */
 public static function register($payment_method_id = NULL, $setup_args = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (empty($payment_method_id) || !is_array($setup_args) || empty($setup_args['payment_method_paths'])) {
         throw new EE_Error(__('In order to register Payment Methods with EE_Register_Payment_Method::register(), you must include a "payment_method_id" (a unique identifier for this set of modules), and an array containing the following keys: "payment_method_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso'));
     }
     //make sure we don't register twice
     if (isset(self::$_settings[$payment_method_id])) {
         return;
     }
     //make sure this was called in the right place!
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) {
         EE_Error::doing_it_wrong(__METHOD__, __('An attempt to register modules has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.', 'event_espresso'), '4.3.0');
     }
     //setup $_settings array from incoming values.
     self::$_settings[$payment_method_id] = array('payment_method_paths' => isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array());
     // add to list of modules to be registered
     add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array('EE_Register_Payment_Method', 'add_payment_methods'));
     /**
      * If EE_Payment_Method_Manager::register_payment_methods has already been called, we need it to be called again
      * (because it's missing the paymetn method we JUST registered here). We are assuming EE_Register_payment_method::register()
      * will be called only once per payment method from an addon, so going with that assumption we should always do this.
      * If that assumption is false, we should verify this newly-registered paymetn method isn't on the EE_Payment_Method_Manager::_payment_method_types array before calling this (this code should be changed to improve performance)
      */
     if (did_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods')) {
         EE_Registry::instance()->load_lib('Payment_Method_Manager');
         EE_Payment_Method_Manager::instance()->maybe_register_payment_methods(TRUE);
     }
 }
 /**
  * Used to register capability items with EE core.
  *
  * @since 4.5.0
  *
  * @param string $cap_reference usually will be a class name that references capability related items setup for something.
  * @param array  $setup_args    {
  *                              An array of items related to registering capabilities.
  *                              @type array $capabilities 	An array mapping capability strings to core WP Role.  Something like array( 'administrator' => array( 'read_cap', 'edit_cap', 'delete_cap'), 'author' => array( 'read_cap' ) ).
  *                              @type array $capability_maps EE_Meta_Capability_Map[]   @see EE_Capabilities.php for php docs on these objects.  Should be indexed by the classname for the capability map and values representing the arguments for the map.
  * }
  * @throws EE_Error
  * @return void
  */
 public static function register($cap_reference = NULL, $setup_args = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (!isset($cap_reference) || !is_array($setup_args) || empty($setup_args['capabilities'])) {
         throw new EE_Error(__('In order to register capabilities with EE_Register_Capabilities::register, you must include a unique name to reference the capabilities being registered, plus an array containing the following keys: "capabilities".', 'event_espresso'));
     }
     //make sure we don't register twice
     if (isset(self::$_registry[$cap_reference])) {
         return;
     }
     //make sure this is not registered too late or too early.
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('%s has been registered too late.  Please ensure that EE_Register_Capabilities::register has been called at some point before the "AHEE__EE_System___detect_if_activation_or_upgrade__begin" action hook has been called.', 'event_espresso'), $cap_reference), '4.5.0');
     }
     //some preliminary sanitization and setting to the $_registry property
     self::$_registry[$cap_reference] = array('caps' => isset($setup_args['capabilities']) && is_array($setup_args['capabilities']) ? $setup_args['capabilities'] : array(), 'cap_maps' => isset($setup_args['capability_maps']) ? $setup_args['capability_maps'] : array());
     //set initial caps (note that EE_Capabilities takes care of making sure that the caps get added donly once)
     add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array('EE_Register_Capabilities', 'register_capabilities'), 10);
     //add filter for cap maps
     add_filter('FHEE__EE_Capabilities___set_meta_caps__meta_caps', array('EE_Register_Capabilities', 'register_cap_maps'), 10);
     //init_role_caps to register new capabilities
     if (is_admin()) {
         EE_Registry::instance()->load('Capabilities');
         EE_Capabilities::instance()->init_caps();
     }
 }
 function _migration_step($num_items = 50)
 {
     //get teh calendar's config
     if (isset(EE_Config::instance()->addons->EE_Calendar) && EE_Config::instance()->addons->EE_Calendar instanceof EE_Calendar_Config) {
         $c = EE_Config::instance()->addons->EE_Calendar;
     } else {
         $c = new EE_Calendar_Config();
         EE_Config::instance()->addons->EE_Calendar = $c;
     }
     $items_actually_migrated = 0;
     $old_org_options = get_option('espresso_calendar_options');
     //the option's name differened depending on the version of the calendar
     if (!$old_org_options) {
         $old_org_options = get_option('espresso_calendar_settings');
     }
     foreach ($this->_org_options_we_know_how_to_migrate as $option_name) {
         //only bother migrating if there's a setting to migrate. Otherwise we'll just use the default
         if (isset($old_org_options[$option_name])) {
             $this->_handle_org_option($option_name, $old_org_options[$option_name], $c);
         }
         $items_actually_migrated++;
     }
     //		d($c);
     $success = EE_Config::instance()->update_config('addons', 'EE_Calendar', $c);
     if (!$success) {
         $this->add_error(EE_Error::get_notices());
     }
     //		d($success);
     //		d($c);
     //		die;
     if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
         $this->set_completed();
     }
     return $items_actually_migrated;
 }
 /**
  *	_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;
 }
 /**
  * Helper method for registring a new shortcodes library class for the messages system.
  *
  * Note this is not used for adding shortcodes to existing libraries.  It's for registering anything
  * related to registering a new EE_{shortcode_library_name}_Shortcodes.lib.php class.
  *
  * @since    4.3.0
  *
  * @param  array  $setup_args {
  *       An array of arguments provided for registering the new messages shortcode library.
  *
  *       @type string $name                                         What is the name of this shortcode library
  *                                                                              (e.g. 'question_list');
  *       @type array  $autoloadpaths                          An array of paths to add to the messages
  *                                                                              autoloader for the new shortcode library
  *                                                                              class file.
  *       @type string $msgr_validator_callback            Callback for a method that will register the
  *                                                                              library with the messenger
  *                                                                              _validator_config. Optional.
  *       @type string $msgr_template_fields_callback  Callback for changing adding the
  *                                                                              _template_fields property for messenger.
  *                                                                              For example, the shortcode library may add
  *                                                                              a new field to the message templates.
  *                                                                              Optional.
  *       @type string $valid_shortcodes_callback         Callback for message types
  *                                                                              _valid_shortcodes array setup. Optional.
  *       @type array  $list_type_shortcodes                 If there are any specific shortcodes with this
  *                                                                             message shortcode library that should be
  *                                                                             considered "list type" then include them in an
  *                                                                             array.  List Type shortcodes are shortcodes that
  *                                                                             have a corresponding field that indicates how
  *                                                                             they are parsed. Optional.
  * }
  * @return void
  */
 public static function register($name = NULL, $setup_args = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (empty($name) || !is_array($setup_args) || empty($setup_args['autoloadpaths'])) {
         throw new EE_Error(__('In order to register a messages shortcode library with EE_Register_Messages_Shortcode_Library::register, you must include a "name" (a unique identifier for this set of message shortcodes), and an array containing the following keys: : "autoload_paths"', 'event_espresso'));
     }
     //make sure this was called in the right place!
     if (!did_action('EE_Brewing_Regular___messages_caf') || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Should be only called on the "EE_Brewing_Regular___messages_caf" hook (Trying to register a library named %s).', 'event_espresso'), $name), '4.3.0');
     }
     $name = (string) $name;
     self::$_ee_messages_shortcode_registry[$name] = array('autoloadpaths' => (array) $setup_args['autoloadpaths'], 'list_type_shortcodes' => !empty($setup_args['list_type_shortcodes']) ? (array) $setup_args['list_type_shortcodes'] : array());
     //add filters
     add_filter('FHEE__EE_Messages_Init__autoload_messages__dir_ref', array('EE_Register_Messages_Shortcode_Library', 'register_msgs_autoload_paths'), 10);
     //add below filters if the required callback is provided.
     if (!empty($setup_args['msgr_validator_callback'])) {
         add_filter('FHEE__EE_messenger__get_validator_config', $setup_args['msgr_validator_callback'], 10, 2);
     }
     if (!empty($setup_args['msgr_template_fields_callback'])) {
         add_filter('FHEE__EE_messenger__get_template_fields', $setup_args['msgr_template_fields_callback'], 10, 2);
     }
     if (!empty($setup_args['valid_shortcodes_callback'])) {
         add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', $setup_args['valid_shortcodes_callback'], 10, 2);
     }
     if (!empty($setup_args['list_type_shortcodes'])) {
         add_filter('FHEE__EEH_Parse_Shortcodes___parse_message_template__list_type_shortcodes', array('EE_Register_Messages_Shortcode_Library', 'register_list_type_shortcodes'), 10);
     }
 }
 /**
  * register method for setting up model extensions
  *
  * @param string $model_id unique id for the extensions being setup
  * @param array   $config   {
  *               @throws EE_Error
  *               @type  array $ model_extension_paths array of folders containing DB model extensions, where each file follows the models naming convention, which is: EEME_{your_plugin_slug}_model_name_extended}.model_ext.php. Where your_plugin_slug} is really anything you want (but something having to do with your addon, like 'Calendar' or '3D_View') and model_name_extended} is the model extended. The class contained in teh file should extend EEME_Base_{model_name_extended}.model_ext.php. Where {your_plugin_slug} is really anything you want (but something having to do with your addon, like 'Calendar' or '3D_View') and {model_name_extended} is the model extended. The class contained in teh file should extend EEME_Base
  *               @type array $ class_extension_paths array of folders containing DB class extensions, where each file follows the model class extension naming convention, which is: EEE_{your_plugin_slug}_model_name_extended}.class_ext.php. Where your_plugin_slug} is something like 'Calendar','MailChimp',etc, and model_name_extended} is the name of the model extended, eg 'Attendee','Event',etc. The class contained in the file should extend EEE_Base_Class._{model_name_extended}.class_ext.php. Where {your_plugin_slug} is something like 'Calendar','MailChimp',etc, and {model_name_extended} is the name of the model extended, eg 'Attendee','Event',etc. The class contained in the file should extend EEE_Base_Class.
  * }
  *
  * @return void
  */
 public static function register($model_id = NULL, $config = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (empty($model_id) || !is_array($config) || empty($config['model_extension_paths']) && empty($config['class_extension_paths'])) {
         throw new EE_Error(__('In order to register Model extensions with EE_Register_Model_Extensions::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_extension_paths" (an array of full server paths to folders that contain model extensions), and "class_extension_paths" (an array of full server paths to folders that contain class extensions)', 'event_espresso'));
     }
     //check correct loading
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_Admin__loaded')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.', 'event_espresso'), $model_id), '4.3');
     }
     self::$_registry[$model_id] = $config;
     EE_Registry::instance()->load_helper('File');
     if (isset($config['model_extension_paths'])) {
         require_once EE_LIBRARIES . 'plugin_api/db/EEME_Base.lib.php';
         $class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_extension_paths']);
         EEH_Autoloader::register_autoloader($class_to_filepath_map);
         foreach (array_keys($class_to_filepath_map) as $classname) {
             new $classname();
         }
         unset($config['model_extension_paths']);
     }
     if (isset($config['class_extension_paths'])) {
         require_once EE_LIBRARIES . 'plugin_api/db/EEE_Base_Class.lib.php';
         $class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_extension_paths']);
         EEH_Autoloader::register_autoloader($class_to_filepath_map);
         foreach (array_keys($class_to_filepath_map) as $classname) {
             new $classname();
         }
         unset($config['class_extension_paths']);
     }
     foreach ($config as $unknown_key => $unknown_config) {
         throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key));
     }
 }
 /**
  * Gets the default which is always the current user. This can't be set when initially
  * constructing the model field because that's done before $current_user is set
  * @return mixed
  */
 function get_default_value()
 {
     if (did_action('init')) {
         return get_current_user_id();
     } else {
         EE_Error::doing_it_wrong('EE_WP_User_Field::get_default_value', __('You cant get a default value for a wp_User_Field because the "init" action is called, because current_user global hasnt yet been setup. Consider doing your business logic on the "init" hook or later.', 'event_espresso'), '4.6.20');
         return 1;
     }
 }
 /**
  * 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');
 }
 /**
  * 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();
 }
Ejemplo n.º 12
0
 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__);
     }
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  *	_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)
 {
     $templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
     $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', NULL, FALSE, FALSE, TRUE);
     $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', NULL, FALSE, FALSE, TRUE);
     if ($overridden_invoice_body || $overridden_receipt_body) {
         EE_Error::add_persistent_admin_notice('invoice_overriding_templates', sprintf(__('Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE);
     }
     //regardless of whether it worked or not, we ought to continue the migration
     $this->set_completed();
     return 1;
 }
 /**
  * @param string $model_id unique id for it
  * @param array  $config   {
  *		@type array $model_paths array of folders containing DB models, where each file follows the models naming convention,
  *                         which is: EEM_{model_name}.model.php which contains a single class called EEM_{model_name}. Eg. you could pass
  *                         "public_html/wp-content/plugins/my_addon/db_models" (with or without trailing slash) and in that folder put
  *                         each of your model files, like "EEM_Food.model.php" which contains the class "EEM_Food" and
  *                         "EEM_Monkey.model.php" which contains the class "EEM_Monkey". These will be autoloaded and added to
  *                         the EE registry so they can be used like ordinary models. The class contained in each file should extend EEM_Base.
  *		@type array $class_paths array of folders containing DB classes, where each file follows the model class naming convention,
  *                         which is EE_{model_name}.class.php. The class contained in each file should extend EE_Base_Class
  *
  * }
  * @throws EE_Error
  */
 public static function register($model_id = NULL, $config = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (empty($model_id) || !is_array($config) || empty($config['model_paths'])) {
         throw new EE_Error(__('In order to register Models with EE_Register_Model::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_paths" (an array of full server paths to folders that contain models)', 'event_espresso'));
     }
     //make sure we don't register twice
     if (isset(self::$_model_registry[$model_id])) {
         return;
     }
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('FHEE__EE_System__parse_model_names') || did_action('FHEE__EE_System__parse_implemented_model_names')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.', 'event_espresso'), $model_id), '4.5');
     }
     self::$_model_registry[$model_id] = $config;
     EE_Registry::instance()->load_helper('File');
     if (isset($config['model_paths']) && !isset($config['class_paths']) || !isset($config['model_paths']) && isset($config['class_paths'])) {
         throw new EE_Error(sprintf(__('You must register both "model_paths" AND "class_paths", not just one or the other You provided %s', 'event_espresso'), implode(", ", array_keys($config))));
     }
     if (isset($config['model_paths'])) {
         //make sure they passed in an array
         if (!is_array($config['model_paths'])) {
             $config['model_paths'] = array($config['model_paths']);
         }
         //we want to add this as a model folder
         //and autoload them all
         $class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_paths']);
         EEH_Autoloader::register_autoloader($class_to_filepath_map);
         $model_name_to_classname_map = array();
         foreach (array_keys($class_to_filepath_map) as $classname) {
             $model_name_to_classname_map[str_replace("EEM_", "", $classname)] = $classname;
         }
         self::$_model_name_to_classname_map[$model_id] = $model_name_to_classname_map;
         add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model', 'add_addon_models'));
         add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model', 'add_addon_models'));
         add_filter('FHEE__EE_Registry__load_model__paths', array('EE_Register_Model', 'add_model_folders'));
         unset($config['model_paths']);
     }
     if (isset($config['class_paths'])) {
         //make sure they passed in an array
         if (!is_array($config['class_paths'])) {
             $config['class_paths'] = array($config['class_paths']);
         }
         $class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_paths']);
         EEH_Autoloader::register_autoloader($class_to_filepath_map);
         add_filter('FHEE__EE_Registry__load_class__paths', array('EE_Register_Model', 'add_class_folders'));
         unset($config['class_paths']);
     }
     foreach ($config as $unknown_key => $unknown_config) {
         self::deregister($model_id);
         throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key));
     }
 }
 /**
  *    Method for registering new Data Migration Scripts
  *
  * @since    4.3.0
  * @param string $dms_id		a unique identifier for this set of data migration scripts
  * @param  array $setup_args  						An array of arguments provided for registering the data migration scripts
  * @internal param string dms_paths 				an array of full server paths to folders that contain data migration scripts
  * @throws EE_Error
  * @return void
  */
 public static function register($dms_id = NULL, $setup_args = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (empty($dms_id) || !is_array($setup_args) || empty($setup_args['dms_paths'])) {
         throw new EE_Error(__('In order to register Data Migration Scripts with EE_Register_Data_Migration_Scripts::register(), you must include a "dms_id" (a unique identifier for this set of data migration scripts), and  an array containing the following keys: "dms_paths" (an array of full server paths to folders that contain data migration scripts)', 'event_espresso'));
     }
     //make sure this was called in the right place!
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
         EE_Error::doing_it_wrong(__METHOD__, __('An attempt to register Data Migration Scripts has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register Data Migration Scripts.', 'event_espresso'), '4.3.0');
     }
     //setup $_settings array from incoming values.
     self::$_settings[$dms_id] = array('dms_paths' => isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array());
     // setup DMS
     add_filter('FHEE__EE_Data_Migration_Manager__get_data_migration_script_folders', array('EE_Register_Data_Migration_Scripts', 'add_data_migration_script_folders'));
 }
 /**
  * 	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' ));
 }
 /**
  *    Method for registering new EED_Widgets
  *
  * @since    4.3.0
  * @param string $widget_id			a unique identifier for this set of widgets
  * @param  array $setup_args  		an array of arguments provided for registering widgets
  * @internal param string widget_paths 		an array of full server paths to folders containing any EED_Widgets, or to the EED_Widget files themselves
  * @throws EE_Error
  * @return void
  */
 public static function register($widget_id = NULL, $setup_args = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (empty($widget_id) || !is_array($setup_args) || empty($setup_args['widget_paths'])) {
         throw new EE_Error(__('In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso'));
     }
     //make sure this was called in the right place!
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) {
         EE_Error::doing_it_wrong(__METHOD__, __('An attempt to register widgets has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register widgets.', 'event_espresso'), '4.3.0');
     }
     //setup $_settings array from incoming values.
     self::$_settings[$widget_id] = array('widget_paths' => isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array());
     // add to list of widgets to be registered
     add_filter('FHEE__EE_Config__register_widgets__widgets_to_register', array('EE_Register_Widget', 'add_widgets'));
 }
 /**
  * @param array $req_data
  */
 protected function _normalize($req_data)
 {
     parent::_normalize($req_data);
     $paypal_calculates_shipping = $this->get_input_value('paypal_shipping');
     $paypal_calculates_taxes = $this->get_input_value('paypal_taxes');
     $paypal_requests_address_info = $this->get_input_value('shipping_details');
     if (($paypal_calculates_shipping || $paypal_calculates_taxes) && $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none) {
         //they want paypal to calculate taxes or shipping. They need to ask for
         //address info, otherwise paypal can't calculate taxes or shipping
         /** @type EE_Select_Input $shipping_details_input */
         $shipping_details_input = $this->get_input('shipping_details');
         $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional);
         $shipping_details_input_options = $shipping_details_input->options();
         EE_Error::add_attention(sprintf(__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), strip_tags($shipping_details_input->html_label_text()), isset($shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional]) ? $shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional] : __('Unknown', 'event_espresso')), __FILE__, __FUNCTION__, __LINE__);
     }
 }
 /**
  * Handles registering the new config with the EE_Config::instance()->addons property
  *
  * @since    4.3.0
  * @throws EE_Error
  *
  * @param  string $config_class 	The name of the Config class being registered.
  *                                   					Note this class must extend EE_Config Base and must have already been registered with an autoloader.
  * @param  array $setup_args {
  *
  * 		@type  string $config_name 	Optional.  by default the new config will be registered to EE_Config::instance()->addons->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->addons->{config_name}
  *                       		}
  * @return void
  */
 public static function register($config_class = NULL, $setup_args = array())
 {
     $setup_args['config_name'] = isset($setup_args['config_name']) && !empty($setup_args['config_name']) ? $setup_args['config_name'] : $config_class;
     $setup_args['config_section'] = isset($setup_args['config_section']) && !empty($setup_args['config_section']) ? $setup_args['config_section'] : 'addons';
     //required fields MUST be present, so let's make sure they are.
     if (empty($config_class) || !is_array($setup_args) || empty($setup_args['config_name'])) {
         throw new EE_Error(__('In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso'));
     }
     //first find out if this happened too late.
     if (did_action('AHEE__EE_System__load_core_configuration__begin')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('An attempt to register "%s" as an EE_Config object has failed because it was not registered at the correct hookpoint.  Please register before the "AHEE__EE_System__load_core_configuration__begin" hook has fired', 'event_espresso'), $setup_args['config_name']), '4.3');
     }
     //add incoming stuff to our registry property
     self::$_ee_config_registry[$config_class] = array('section' => $setup_args['config_section'], 'name' => $setup_args['config_name']);
     add_filter('AHEE__EE_Config___load_core_config__end', array('EE_Register_Config', 'set_config'), 10);
 }
 /**
  * _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);
 }
 /**
  * @access private
  * @return EE_Cron_Tasks
  */
 private function __construct()
 {
     do_action('AHEE_log', __CLASS__, __FUNCTION__);
     // verify that WP Cron is enabled
     if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && is_admin()) {
         EE_Error::add_persistent_admin_notice('wp_cron_disabled', sprintf(__('Event Espresso has detected that wp_cron is disabled. It\'s important that wp_cron is enabled because Event Espresso depends on wp_cron for critical scheduled tasks.%1$sSince it\'s possible that your site may have an alternative task scheduler set up, we strongly suggest that you inform the website host, or developer that set up the site, about this issue.', 'event_espresso'), '<br />'));
     }
     // UPDATE TRANSACTION WITH PAYMENT
     add_action('AHEE__EE_Cron_Tasks__update_transaction_with_payment_2', array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'), 10, 2);
     // FINALIZE ABANDONED TRANSACTIONS
     add_action('AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', array('EE_Cron_Tasks', 'check_for_abandoned_transactions'), 10, 1);
     // CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
     add_action('AHEE__EE_Cron_Tasks__clean_up_junk_transactions', array('EE_Cron_Tasks', 'clean_out_junk_transactions'));
     // logging
     add_action('AHEE__EE_System__load_core_configuration__complete', array('EE_Cron_Tasks', 'log_scheduled_ee_crons'));
     EE_Registry::instance()->load_lib('Messages_Scheduler');
 }
 /**
  * Method for registering new message types in the EE_messages system.
  *
  * Note:  All message types must have the following files in order to work:
  *
  * - EE_Message_Template_Defaults extended class(es). (see /core/libraries/messages/defaults
  *     for examples).  Note, how there is a default class for each messenger/messagetype combo.
  *     This class is used for defining how the default templates get setup.
  * - Template files for default templates getting setup (or you can define it all in the above
  *      Default class).  See /core/libraries/messages/message_type/assets/defaults/ for examples.
  * - EE_Messages_Validator extended class(es).  See /core/libraries/messages/validators/email/
  *      for examples.  Note for any new message types, there will need to be a validator for each
  *      messenger combo this message type can activate with.
  * - And of course the main EE_{Message_Type_Name}_message_type class that defines the new
  *      message type and its properties.
  *
  * @since   4.3.0
  *
  * 	@param string $mt_name                               Whatever is defined for the $name property of
  *                                                                          the message type you are registering (eg.
  *                                                                          declined_registration). Required.
  * @param  array  $setup_args  {
  *        An array of arguments provided for registering the message type.
  *
  *        @type string $mtfilename                          The filename of the message type being
  *                                                                          registered.  This will be the main
  *                                                                          EE_{Messagetype_Name}_message_type class. (
  *                                                                          eg. EE_Declined_Registration_message_type.
  *                                                                          class.php). Required.
  *        @type array $autoloadpaths                       An array of paths to add to the messages
  *                                                                          autoloader for the new message type. Required.
  *        @type array $messengers_to_activate_with An array of messengers that this message
  *                                                                          type should activate with. Each value in the
  *                                                                          array should match the name property of a
  *                                                                          EE_messenger. Optional.
  *
  * }
  * @return void
  */
 public static function register($mt_name = NULL, $setup_args = array())
 {
     //required fields MUST be present, so let's make sure they are.
     if (!isset($mt_name) || !is_array($setup_args) || empty($setup_args['mtfilename']) || empty($setup_args['autoloadpaths'])) {
         throw new EE_Error(__('In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso'));
     }
     //make sure this was called in the right place!
     if (!did_action('EE_Brewing_Regular___messages_caf') || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('A message type named "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.', 'event_espresso'), $mt_name), '4.3.0');
     }
     //setup $__ee_message_type_registry array from incoming values.
     self::$_ee_message_type_registry[$mt_name] = array('mtfilename' => (string) $setup_args['mtfilename'], 'autoloadpaths' => (array) $setup_args['autoloadpaths'], 'messengers_to_activate_with' => !empty($setup_args['messengers_to_activate_with']) ? (array) $setup_args['messengers_to_activate_with'] : array());
     //add filters
     add_filter('FHEE__EE_Messages_Init__autoload_messages__dir_ref', array('EE_Register_Message_Type', 'register_msgs_autoload_paths'), 10);
     add_filter('FHEE__EE_messages__get_installed__messagetype_files', array('EE_Register_Message_Type', 'register_messagetype_files'), 10, 1);
     add_filter('FHEE__EE_messenger__get_default_message_types__default_types', array('EE_Register_Message_Type', 'register_messengers_to_activate_mt_with'), 10, 2);
 }
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');
    }
}
 /**
  *    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;
 }
 /**
  * 		@Constructor
  * 		@access public
  * 		@return void
  */
 public function __construct()
 {
     //set global defaults
     $this->_set_defaults();
     //set properties that are always available with objects.
     $this->_set_init_properties();
     //global styles/scripts across all wp admin pages
     add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
     //load initial stuff.
     $this->_set_file_and_folder_name();
     $this->_set_menu_map();
     if (empty($this->_menu_map) || is_array($this->_menu_map)) {
         EE_Error::doing_it_wrong(get_class($this) . '::$_menu_map', sprintf(__('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso'), get_class($this)), '4.4.0');
         return;
     }
     //set default capability
     $this->_set_capability();
 }
Ejemplo n.º 28
0
 /**
  * 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;
 }
 protected function _init_props()
 {
     $this->label = __('Messenger Shortcodes', 'event_espresso');
     $this->description = __('All shortcodes that are messenger specific.', 'event_espresso');
     //add messages about what happens  when the messenger is active.
     $this->_active_messengers = EE_Registry::instance()->load_lib('messages')->get_active_messengers();
     $this->_shortcodes['[DISPLAY_HTML_URL]'] = __('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
     $this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso');
     $this->_shortcodes['[DISPLAY_PDF_BUTTON]'] = __('This will return html for a download pdf button trigger if the pdf messenger is active.', 'event_espresso');
     //show error message about buttons/urls not working as expected if messenger deactivated.
     if (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update_message_template') {
         if (!isset($this->_active_messengers['pdf'])) {
             EE_Error::add_attention(__('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso'));
         }
         if (!isset($this->_active_messengers['html'])) {
             EE_Error::add_attention(__('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso'));
         }
     }
 }
 /**
  * The purpose of this method is to provide an easy way for addons to register their admin pages (using the EE Admin Page loader system).
  *
  * @since 4.3.0
  *
  * @param  string $page_basename 	This string represents the basename of the Admin Page init.
  *                                                        		The init file must use this basename in its name and class (i.e. {page_basename}_Admin_Page_Init.core.php).
  * @param  array  $config  {              An array of configuration options that will be used in different circumstances
  *
  *		@type  string $page_path             This is the path where the registered admin pages reside ( used to setup autoloaders).
  *
  * 	}
  * @return void
  */
 public static function register($page_basename = NULL, $config = array())
 {
     // check that an admin_page has not already been registered with that name
     if (isset(self::$_ee_admin_page_registry[$page_basename])) {
         throw new EE_Error(sprintf(__('An Admin Page with the name "%s" has already been registered and each Admin Page requires a unique name.', 'event_espresso'), $page_basename));
     }
     // required fields MUST be present, so let's make sure they are.
     if (empty($page_basename) || !is_array($config) || empty($config['page_path'])) {
         throw new EE_Error(__('In order to register an Admin Page with EE_Register_Admin_Page::register(), you must include the "page_basename" (the class name of the page), and an array containing the following keys: "page_path" (the path where the registered admin pages reside)', 'event_espresso'));
     }
     if (!did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_Admin__loaded')) {
         EE_Error::doing_it_wrong(__METHOD__, sprintf(__('An attempt was made to register "%s" as an EE Admin page has failed because it was not registered at the correct time.  Please use the "AHEE__EE_Admin__loaded" hook to register Admin pages.', 'event_espresso'), $page_basename), '4.3');
     }
     //add incoming stuff to our registry property
     self::$_ee_admin_page_registry[$page_basename] = array('page_path' => $config['page_path'], 'config' => $config);
     //add filters
     add_filter('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', array('EE_Register_Admin_Page', 'set_page_basename'), 10);
     add_filter('FHEE__EEH_Autoloader__load_admin_core', array('EE_Register_Admin_Page', 'set_page_path'), 10);
 }