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


PHP EE_Registry类代码示例

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


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

示例1: __construct

 public function __construct($template_file, $args = array(), $options_array = array())
 {
     EE_Registry::instance()->load_helper('Template');
     $html = EEH_Template::locate_template($template_file, $args);
     //		echo " filepath:$template_file html $html";
     parent::__construct($html, $options_array);
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:7,代码来源:EE_Form_Section_HTML_From_Template.form.php

示例2: _validate_email

 /**
  * Validate an email address.
  * Provide email address (raw input)
  *
  * @param $email
  * @return bool of whether the email is valid or not
  * @throws \EE_Validation_Error
  */
 private function _validate_email($email)
 {
     $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) ? EE_Registry::instance()->CFG->registration->email_validation_level : 'wp_default';
     if (!preg_match('/^.+\\@\\S+$/', $email)) {
         // \.\S+
         // email not in correct {string}@{string} format
         return false;
     } else {
         $atIndex = strrpos($email, "@");
         $domain = substr($email, $atIndex + 1);
         $local = substr($email, 0, $atIndex);
         $localLen = strlen($local);
         $domainLen = strlen($domain);
         if ($localLen < 1 || $localLen > 64) {
             // local part length exceeded
             return false;
         } else {
             if ($domainLen < 1 || $domainLen > 255) {
                 // domain part length exceeded
                 return false;
             } else {
                 if ($local[0] === '.' || $local[$localLen - 1] === '.') {
                     // local part starts or ends with '.'
                     return false;
                 } else {
                     if (preg_match('/\\.\\./', $local)) {
                         // local part has two consecutive dots
                         return false;
                     } else {
                         if (preg_match('/\\.\\./', $domain)) {
                             // domain part has two consecutive dots
                             return false;
                         } else {
                             if ($validation_level === 'wp_default') {
                                 return is_email($email);
                             } else {
                                 if (($validation_level === 'i18n' || $validation_level === 'i18n_dns') && !preg_match('/^(?!\\.)((?!.*\\.{2})[a-zA-Z0-9\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}\\.!#$%&\'*+-\\/=?^_`{|}~\\-\\d]+)@(?!\\.)([a-zA-Z0-9\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}\\-\\.\\d]+)((\\.([a-zA-Z\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}]){2,63})+)$/u', $email)) {
                                     return false;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($validation_level === 'i18n_dns') {
             if (!checkdnsrr($domain, "MX")) {
                 // domain not found in MX records
                 throw new EE_Validation_Error(__('Although the email address provided is formatted correctly, a valid "MX record" could not be located for that address and domain. Please enter a valid email address.', 'event_espresso'));
             } else {
                 if (!checkdnsrr($domain, "A")) {
                     // domain not found in A records
                     throw new EE_Validation_Error(__('Although the email address provided is formatted correctly, a valid "A record" could not be located for that address and domain. Please enter a valid email address.', 'event_espresso'));
                 }
             }
         }
     }
     // you have successfully run the gauntlet young Padawan
     return true;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:68,代码来源:EE_Email_Validation_Strategy.strategy.php

示例3: generate_new_settings_form

 /**
  * Gets the form for all the settings related to this payment method type
  * @return EE_Payment_Method_Form
  */
 public function generate_new_settings_form()
 {
     EE_Registry::instance()->load_helper('Template');
     $credit_card_types = $this->credit_card_types();
     $form = new EE_Payment_Method_Form(array('extra_meta_inputs' => array('merchant_id' => new EE_Text_Input(array('html_label_text' => sprintf(__("Connection Merchant ID %s", "event_espresso"), $this->get_help_tab_link()))), 'connection_username' => new EE_Text_Input(array('html_label_text' => sprintf(__("Connection Username %s", "event_espresso"), $this->get_help_tab_link()))), 'connection_password' => new EE_Password_Input(array('html_label_text' => sprintf(__("Connection Password %s", "event_espresso"), $this->get_help_tab_link()))), 'terminal_id' => new EE_Text_Input(array('html_label_text' => sprintf(__("Terminal ID %s", "event_espresso"), $this->get_help_tab_link()), 'default' => '001')), 'bin' => new EE_Text_Input(array('html_label_text' => sprintf(__("BIN %s", "event_espresso"), $this->get_help_tab_link()), 'default' => '000002')), 'credit_card_types' => new EE_Checkbox_Multi_Input($credit_card_types, array('html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), 'default' => array_keys($credit_card_types))))));
     return $form;
 }
开发者ID:eventespresso,项目名称:eea-chase-orbital,代码行数:11,代码来源:EE_PMT_Chase_Orbital.pm.php

示例4: payment_overview_content

 /**
  * For adding any html output ab ove the payment overview.
  * Many gateways won't want ot display anything, so this function just returns an empty string.
  * Other gateways may want to override this, such as offline gateways.
  * @return string
  */
 public function payment_overview_content(EE_Payment $payment)
 {
     EE_Registry::instance()->load_helper('Template');
     $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array();
     $template_vars = array_merge(array('payment_method' => $this->_pm_instance, 'payment' => $payment, 'page_title' => '', 'payment_instructions' => ''), $extra_meta_for_payment_method);
     return EEH_Template::locate_template('payment_methods' . DS . 'Bank' . DS . 'templates' . DS . 'bank_payment_details_content.template.php', $template_vars);
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:13,代码来源:EE_PMT_Bank.pm.php

示例5: __construct

 /**
  * when constructing a proper form section, calls _construct_finalize on children
  * so that they know who their parent is, and what name they've been given.
  * @param array $options_array {
  *	@type $subsections EE_Form_Section_Validatable[] where keys are the section's name
  *	@type $include string[] numerically-indexed where values are section names to be included,
  *		and in that order. This is handy if you want
  *		the subsections to be ordered differently than the default, and if you override which fields are shown
  *	@type $exclude string[] values are subsections to be excluded. This is handy if you want
  *		to remove certain default subsections (note: if you specify BOTH 'include' AND 'exclude',
  *		the inclusions will be applied first, and the exclusions will exclude items from that list of inclusions)
  *	@type $layout_strategy EE_Form_Section_Layout_Base strategy for laying out the form
  * } @see EE_Form_Section_Validatable::__construct()
  *
  */
 public function __construct($options_array = array())
 {
     EE_Registry::instance()->load_helper('Formatter');
     //call parent first, as it may be setting the name
     parent::__construct($options_array);
     //if they've included subsections in the constructor, add them now
     if (isset($options_array['include'])) {
         //we are going to make sure we ONLY have those subsections to include
         //AND we are going to make sure they're in that specified order
         $reordered_subsections = array();
         foreach ($options_array['include'] as $input_name) {
             if (isset($this->_subsections[$input_name])) {
                 $reordered_subsections[$input_name] = $this->_subsections[$input_name];
             }
         }
         $this->_subsections = $reordered_subsections;
     }
     if (isset($options_array['exclude'])) {
         $exclude = $options_array['exclude'];
         $this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
     }
     if (isset($options_array['layout_strategy'])) {
         $this->_layout_strategy = $options_array['layout_strategy'];
     }
     if (!$this->_layout_strategy) {
         $this->_layout_strategy = new EE_Two_Column_Layout();
     }
     $this->_layout_strategy->_construct_finalize($this);
     add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
     add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
     add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
 }
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:47,代码来源:EE_Form_Section_Proper.form.php

示例6: __construct

 protected function __construct($timezone = NULL)
 {
     $this->singular_item = __('Term Relationship', 'event_espresso');
     $this->plural_item = __('Term Relationships', 'event_espresso');
     $this->_tables = array('Term_Relationship' => new EE_Primary_Table('term_relationships'));
     $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
     $this->_fields = array('Term_Relationship' => array('object_id' => new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID', 'event_espresso'), false, 0, $models_this_can_attach_to), 'term_taxonomy_id' => new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID', 'event_espresso'), false, 0, 'Term_Taxonomy'), 'term_order' => new EE_Integer_Field('term_order', __('Term Order', 'event_espresso'), false, 0)));
     $this->_model_relations = array('Term_Taxonomy' => new EE_Belongs_To_Relation());
     foreach ($models_this_can_attach_to as $model_name) {
         $this->_model_relations[$model_name] = new EE_Belongs_To_Relation();
     }
     $this->_indexes = array('PRIMARY' => new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id')));
     $path_to_event_model = 'Event.';
     $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event_model);
     $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model);
     $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model);
     $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model, EEM_Base::caps_edit);
     $path_to_tax_model = 'Term_Taxonomy.';
     //add cap restrictions for editing term relations to the "ee_assign_*"
     //and for deleting term relations too
     $cap_contexts_affected = array(EEM_Base::caps_edit, EEM_Base::caps_delete);
     foreach ($cap_contexts_affected as $cap_context_affected) {
         $this->_cap_restrictions[$cap_context_affected]['ee_assign_event_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_assign_event_category' => array('!=', 'espresso_event_categories')));
         $this->_cap_restrictions[$cap_context_affected]['ee_assign_venue_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_assign_venue_category' => array('!=', 'espresso_venue_categories')));
         $this->_cap_restrictions[$cap_context_affected]['ee_assign_event_type'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type')));
     }
     parent::__construct($timezone);
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:28,代码来源:EEM_Term_Relationship.model.php

示例7: _setup_data

 /**
  * This will just setup the _events property in the expected format.
  * @return void
  */
 protected function _setup_data()
 {
     //now let's loop and set up the _events property.  At the same time we'll set up attendee properties.
     //a variable for tracking totals
     $running_total = 0;
     //get txn
     $this->txn = $this->reg_obj->transaction();
     $this->taxes = $this->txn->tax_total();
     $this->grand_total_price_object = '';
     //possible session stuff?
     $session = $this->txn->session_data();
     $session_data = $session instanceof EE_Session ? $session->get_session_data() : array();
     //other data from the session (if possible)
     $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
     $this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
     $this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
     $this->init_access = $this->last_access = '';
     $this->payment = $this->txn->get_first_related('Payment');
     $this->payment = empty($this->payment) ? EE_Payment::new_instance(array('STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => (int) current_time('timestamp'), 'PAY_gateway' => $this->txn->selected_gateway(), 'PAY_gateway_response' => $this->txn->gateway_response_on_transaction())) : $this->payment;
     //if there is no payments associated with the transaction then we just create a default payment object for potential parsing.
     $this->billing = $this->payment->details();
     EE_Registry::instance()->load_helper('Template');
     $this->billing['total_due'] = isset($this->billing['total']) ? EEH_Template::format_currency($this->billing['total']) : '';
     //get reg_objs for txn
     $this->reg_objs = $this->txn->registrations();
     //now we can set things up like we do for other handlers
     $this->_assemble_data();
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:32,代码来源:EE_Messages_REG_incoming_data.class.php

示例8: 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

示例9: template_settings_form

 /**
  * 	template_settings_form
  *
  *  @access 	public
  *  @static
  *  @return 	void
  */
 public static function template_settings_form()
 {
     $EE = EE_Registry::instance();
     $EE->CFG->template_settings->EED_Event_Single = isset($EE->CFG->template_settings->EED_Event_Single) ? $EE->CFG->template_settings->EED_Event_Single : new EE_Event_Single_Config();
     $EE->CFG->template_settings->EED_Event_Single = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Event_Single);
     EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $EE->CFG->template_settings->EED_Event_Single);
 }
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:14,代码来源:EED_Event_Single_Caff.module.php

示例10: test_primary_registration

 public function test_primary_registration()
 {
     /** @type EE_Transaction $t */
     $t = $this->new_model_obj_with_dependencies('Transaction', NULL, FALSE);
     $this->assertEquals(0, $t->ID());
     /** @type EE_Registration $r */
     $r = $this->new_model_obj_with_dependencies('Registration', array('REG_count' => 1), FALSE);
     $this->assertEquals(0, $r->ID());
     $t->_add_relation_to($r, 'Registration');
     $this->assertEquals($r, $t->primary_registration());
     $r->save();
     $this->assertNotEquals(0, $r->ID());
     $in_map = EE_Registry::instance()->load_model('Registration')->get_from_entity_map($r->ID());
     $this->assertEquals($r, $in_map);
     $this->assertEquals($r, $t->primary_registration());
     $this->assertEquals(1, $r->count());
     $r_in_db = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($r->ID());
     $this->assertEquals($r, $r_in_db);
     $t->save();
     $this->assertEquals($r, $t->primary_registration());
     //why does the above fail? because we forgot to set the registration's TXN_ID!
     //so it makes sense, but it sure would have been considerate of the transaction if,
     //when it was saved, it would have set the ID on all foreign keys pointing to it
     //on things it had cached on itself
 }
开发者ID:kaffiemetsuker,项目名称:event-espresso-core,代码行数:25,代码来源:EE_Transaction_Test.php

示例11: run

 /**
  * run
  *
  * initial shortcode module setup called during "wp_loaded" hook
  * this method is primarily used for loading resources that will be required by the shortcode when it is actually processed
  *
  * @access public
  * @param  WP $WP
  * @return void
  * @throws \Exception
  * @throws \EE_Error
  */
 public function run(WP $WP)
 {
     $this->_current_txn = null;
     if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
         /** @var EEM_Transaction $EEM_Transaction */
         $EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
         $this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link();
     }
     if ($this->_current_txn instanceof EE_Transaction) {
         $payment_method = null;
         $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null);
         if ($payment_method_slug) {
             $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug);
         }
         if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) {
             $gateway = $payment_method->type_obj()->get_gateway();
             if ($gateway instanceof EE_Offsite_Gateway && $gateway->handle_IPN_in_this_request(\EE_Registry::instance()->REQ->params(), true)) {
                 /** @type EE_Payment_Processor $payment_processor */
                 $payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
                 $payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method);
             }
         }
         //allow gateways to add a filter to stop rendering the page
         if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) {
             exit;
         }
     }
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:40,代码来源:EES_Espresso_Txn_Page.shortcode.php

示例12: column_display_text

 public function column_display_text(EE_Question $item)
 {
     $system_question = $item->is_system_question();
     $actions = array();
     if (!defined('REG_ADMIN_URL')) {
         define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
     }
     $edit_query_args = array('action' => 'edit_question', 'QST_ID' => $item->ID());
     $trash_query_args = array('action' => 'trash_question', 'QST_ID' => $item->ID());
     $restore_query_args = array('action' => 'restore_question', 'QST_ID' => $item->ID());
     $delete_query_args = array('action' => 'delete_questions', 'QST_ID' => $item->ID());
     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
     $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
     $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
     $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID())) {
         $actions = array('edit' => '<a href="' . $edit_link . '" title="' . __('Edit Question', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>');
     }
     if (!$system_question && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_trash_question', $item->ID())) {
         $actions['delete'] = '<a href="' . $trash_link . '" title="' . __('Trash Question', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
     }
     if ($this->_view == 'trash') {
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_restore_question', $item->ID())) {
             $actions['restore'] = '<a href="' . $restore_link . '" title="' . __('Restore Question', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
         }
         if ($item->count_related('Answer') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_delete_questions', $item->ID())) {
             $actions['delete_permanently'] = '<a href="' . $delete_link . '" title="' . __('Delete Question Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
         }
     }
     $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID()) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' : $item->display_text();
     $content .= $this->row_actions($actions);
     return $content;
 }
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:33,代码来源:Extend_Registration_Form_Questions_Admin_List_Table.class.php

示例13: write_data_array_to_csv

 /**
  * Writes $data to the csv file open in $filehandle. uses the array indices of $data for column headers
  *
  * @param string 	$filepath
  * @param array 	$data 2D array, 		first numerically-indexed,
  *                    						and next-level-down preferably indexed by string
  * @param boolean 	$write_column_headers 	whether or not we should add the keys in the bottom-most array
  * 											as a row for headers in the CSV.
  *                                            Eg, if $data looked like:
  *                                            array(
  *                                              	0=>array('EVT_ID'=>1,'EVT_name'=>'monkey'...),
  * 													1=>array(...,...)
  *                                            )
  *
  * @return boolean 		if we successfully wrote to the CSV or not. If there's no $data,
  * 						we consider that a success (because we wrote everything there was...nothing)
  * @throws EE_Error
  */
 public static function write_data_array_to_csv($filepath, $data, $write_column_headers = true)
 {
     EE_Registry::instance()->load_helper('Array');
     $new_file_contents = '';
     //determine if $data is actually a 2d array
     if ($data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))) {
         //make sure top level is numerically indexed,
         if (EEH_Array::is_associative_array($data)) {
             throw new EE_Error(sprintf(__("top-level array must be numerically indexed. Does these look like numbers to you? %s", "event_espresso"), implode(",", array_keys($data))));
         }
         $item_in_top_level_array = EEH_Array::get_one_item_from_array($data);
         //now, is the last item in the top-level array of $data an associative or numeric array?
         if ($write_column_headers && EEH_Array::is_associative_array($item_in_top_level_array)) {
             //its associative, so we want to output its keys as column headers
             $keys = array_keys($item_in_top_level_array);
             $new_file_contents .= EEH_Export::get_csv_row($keys);
         }
         //start writing data
         foreach ($data as $data_row) {
             $new_file_contents .= EEH_Export::get_csv_row($data_row);
         }
         return EEH_File::write_to_file($filepath, EEH_File::get_file_contents($filepath) . $new_file_contents);
     } else {
         //no data TO write... so we can assume that's a success
         return true;
     }
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:45,代码来源:EEH_Export.helper.php

示例14: test_migrate_old_billing_infos

 public function test_migrate_old_billing_infos()
 {
     $postmeta_name = 'billing_info_Paypal_Pro';
     $billing_info = unserialize('a:13:{s:34:"_reg-page-billing-fname-Paypal_Pro";s:3:"few";s:34:"_reg-page-billing-lname-Paypal_Pro";s:3:"few";s:34:"_reg-page-billing-email-Paypal_Pro";s:9:"few@ew.ds";s:34:"_reg-page-billing-phone-Paypal_Pro";s:1:"f";s:36:"_reg-page-billing-address-Paypal_Pro";s:1:"f";s:33:"_reg-page-billing-city-Paypal_Pro";s:1:"f";s:34:"_reg-page-billing-state-Paypal_Pro";i:6;s:36:"_reg-page-billing-country-Paypal_Pro";s:2:"CA";s:32:"_reg-page-billing-zip-Paypal_Pro";s:1:"c";s:38:"_reg-page-billing-card-nmbr-Paypal_Pro";s:16:"XXXXXXXXXXXX7383";s:38:"_reg-page-billing-card-type-Paypal_Pro";s:10:"MasterCard";s:47:"_reg-page-billing-card-exp-date-mnth-Paypal_Pro";s:2:"01";s:47:"_reg-page-billing-card-exp-date-year-Paypal_Pro";s:2:"17";}');
     $att1 = $this->new_model_obj_with_dependencies('Attendee');
     $att1->update_post_meta($postmeta_name, $billing_info);
     $att2 = $this->new_model_obj_with_dependencies('Attendee');
     $att2->update_post_meta($postmeta_name, $billing_info);
     //load teh dms, which should autoload the stage we want to test
     $script = EE_Registry::instance()->load_dms('EE_DMS_Core_4_6_0');
     $stage = new EE_DMS_4_6_0_billing_info();
     $stage->_construct_finalize($script);
     $this->assertEquals(2, $stage->count_records_to_migrate());
     //		var_dump($stage);
     $stage->migration_step(1);
     $this->assertEquals(1, $stage->count_records_migrated());
     //get that updated postmeta
     $new_billing_info = $att1->get_post_meta($postmeta_name, TRUE);
     $this->assertNotEquals($billing_info, $new_billing_info);
     $this->assertArrayHasKey('first_name', $new_billing_info);
     //verify we only migrated what we said we would- the first item only
     $this->assertEquals($billing_info, $att2->get_post_meta($postmeta_name, TRUE));
     //now migrate the next one
     $stage->migration_step(1);
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:25,代码来源:EE_DMS_Core_4_6_0_Tests.php

示例15: __construct

 protected function __construct($timezone = NULL)
 {
     $this->singular_item = __('Term Taxonomy', 'event_espresso');
     $this->plural_item = __('Term Taxonomy', 'event_espresso');
     $this->_tables = array('Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'));
     $this->_fields = array('Term_Taxonomy' => array('term_taxonomy_id' => new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')), 'term_id' => new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), 'taxonomy' => new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'), 'description' => new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''), 'parent' => new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0), 'term_count' => new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)));
     $this->_model_relations = array('Term_Relationship' => new EE_Has_Many_Relation(), 'Term' => new EE_Belongs_To_Relation());
     $cpt_models = array_keys(EE_Registry::instance()->cpt_models());
     foreach ($cpt_models as $model_name) {
         $this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
     }
     $this->_indexes = array('term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')));
     $path_to_tax_model = '';
     $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
     $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
     $this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
     $this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
     //add cap restrictions for editing relating to the "ee_edit_*"
     $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')));
     $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')));
     $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')));
     //add cap restrictions for deleting relating to the "ee_deleting_*"
     $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')));
     $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')));
     $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')));
     parent::__construct($timezone);
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:27,代码来源:EEM_Term_Taxonomy.model.php


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