当前位置: 首页>>代码示例>>PHP>>正文


PHP EE_Error::doing_it_wrong方法代码示例

本文整理汇总了PHP中EE_Error::doing_it_wrong方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Error::doing_it_wrong方法的具体用法?PHP EE_Error::doing_it_wrong怎么用?PHP EE_Error::doing_it_wrong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EE_Error的用法示例。


在下文中一共展示了EE_Error::doing_it_wrong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * 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();
     }
 }
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:40,代码来源:EE_Register_Capabilities.lib.php

示例2: display

 /**
  *
  * @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;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:37,代码来源:EE_Checkbox_Display_Strategy.strategy.php

示例3: display

 /**
  *
  * @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;
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:38,代码来源:EE_Checkbox_Display_Strategy.strategy.php

示例4: register

 /**
  * 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));
     }
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:46,代码来源:EE_Register_Model_Extensions.lib.php

示例5: register

 /**
  * Used to register a new template pack with the messages system.
  *
  * Template packs are primarily defined via class extending EE_Messages_Template_Pack and are typically used to change entire layouts for a set of message templates.  This method is used to register the new template pack and automatically have it loaded in the appropriate places.
  *
  * This registry also verifies that there isn't already a template pack registered with the same name and if there is then it will add an EE_Error notice.
  *
  * Note that this only handles registering the your Template Pack class with the message template pack system.  However, there is also a naming schema you must follow for templates you are providing with your template pack.
  * @see EE_Messages_Template_Pack_Default for an example class
  * @see core/libraries/messages/defaults/default/* for all the example templates the default template pack supports.
  *
  *
  * @since  4.5.0
  * @throws EE_Error
  *
  * @param string $ref             The internal reference used to refer to this template pack.  Note, this is first come, first serve.  If there is already a template pack registered with this name then the registry will assign a unique reference for it so it can still be activated (but this makes it harder to deregister as it will be unique per load - so its best to try to make this a unique string!)
  * @param array  $setup_args array {
  *                           An array of required values for registering the template pack.
  *                           @type string $path 	The path for the new template pack class.
  *                           @type string $classname 	The name of the new Template Pack Class.
  * }
  *
  * @return void
  */
 public static function register($ref = NULL, $setup_args = array())
 {
     //check for required params
     if (empty($ref) || empty($setup_args['path']) || empty($setup_args['classname'])) {
         throw new EE_Error(__('In order to register a new template pack for the EE Messages system, you must include a value to reference the template pack being registered and the setup_args must have the path for the new template pack class as well as the classname for the new Template Pack Class. ', 'event_espresso'));
     }
     //make sure we don't register twice
     if (isset(self::$_registry[$ref])) {
         return;
     }
     //check that incoming $ref doesn't already exist. If it does then we'll create a unique reference for this template pack.
     if (isset(self::$_registry[$ref])) {
         $ref = uniqid() . '_' . $ref;
     }
     //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 EE Messages Template Pack given the reference "%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'), $ref), '4.5.0');
     }
     if (self::_verify_class_not_exist($setup_args['classname'])) {
         self::$_registry[$ref] = array('path' => (string) $setup_args['path'], 'classname' => (string) $setup_args['classname']);
     }
     //hook into the system
     add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array('EE_Register_Messages_Template_Pack', 'set_template_pack_path'), 10);
     add_filter('FHEE__EED_Messages__get_template_packs__template_packs', array('EE_Register_Messages_Template_Pack', 'set_template_pack'), 10);
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:49,代码来源:EE_Register_Messages_Template_Pack.lib.php

示例6: register

 /**
  * 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);
     }
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:63,代码来源:EE_Register_Messages_Shortcode_Library.lib.php

示例7: register

 /**
  *    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);
     }
 }
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:43,代码来源:EE_Register_Payment_Method.lib.php

示例8: get_default_value

 /**
  * 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;
     }
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:14,代码来源:EE_WP_User_Field.php

示例9: register

 /**
  * @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));
     }
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:67,代码来源:EE_Register_Model.lib.php

示例10: register

 /**
  *    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'));
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:25,代码来源:EE_Register_Data_Migration_Scripts.lib.php

示例11: register

 /**
  *    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'));
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:25,代码来源:EE_Register_Widget.lib.php

示例12: register

 /**
  * 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);
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:30,代码来源:EE_Register_Config.lib.php

示例13: register

 /**
  * 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);
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:56,代码来源:EE_Register_Message_Type.lib.php

示例14: __construct

 /**
  * 		@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();
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:23,代码来源:EE_Admin_Page_Init.core.php

示例15: register

 /**
  * 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);
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:33,代码来源:EE_Register_Admin_Page.lib.php


注:本文中的EE_Error::doing_it_wrong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。