本文整理汇总了PHP中EE_Registry::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Registry::instance方法的具体用法?PHP EE_Registry::instance怎么用?PHP EE_Registry::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Registry
的用法示例。
在下文中一共展示了EE_Registry::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: _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();
}
示例3: 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);
}
示例4: 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);
}
示例5: __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);
}
示例6: 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;
}
}
}
示例7: 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));
}
}
示例8: 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
示例9: 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
}
示例10: 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);
}
示例11: 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;
}
}
示例12: __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);
}
示例13: parse_post_content_on_save
/**
* parse_post_content_on_save
*
* any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
* and then track what posts those shortcodes are on, so that we can initialize shortcodes well before the_content() runs.
* this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the shortcodes are actually used on
*
* @access public
* @param int $post_ID
* @param \WP_Post $post
* @return void
*/
public static function parse_post_content_on_save($post_ID, $post)
{
// if the post is trashed, then let's remove our post shortcode tracking
if ($post instanceof \WP_Post && $post->post_status === 'trash') {
PostShortcodeTracking::unset_post_shortcodes_on_delete($post_ID);
return;
}
// default post types
$post_types = array('post' => 0, 'page' => 1);
// add CPTs
$CPTs = \EE_Register_CPTs::get_CPTs();
$post_types = array_merge($post_types, $CPTs);
// for default or CPT posts...
if (isset($post_types[$post->post_type])) {
// post on frontpage ?
$page_for_posts = \EE_Config::get_page_for_posts();
if ($post->post_name === $page_for_posts) {
PostShortcodeTracking::set_post_shortcodes_for_posts_page($page_for_posts);
return;
}
// array of shortcodes indexed by post name
\EE_Registry::CFG()->core->post_shortcodes = isset(\EE_Registry::CFG()->core->post_shortcodes) ? \EE_Registry::CFG()->core->post_shortcodes : array();
// whether to proceed with update
$update_post_shortcodes = false;
// empty both arrays
\EE_Registry::CFG()->core->post_shortcodes[$post->post_name] = array();
// check that posts page is already being tracked
if (!isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) {
// if not, then ensure that it is properly added
\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
}
// loop thru shortcodes
foreach (\EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
// convert to UPPERCASE to get actual shortcode
$EES_Shortcode = strtoupper($EES_Shortcode);
// is the shortcode in the post_content ?
if (strpos($post->post_content, $EES_Shortcode) !== false) {
// map shortcode to post names and post IDs
\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
// and add this shortcode to the tracking for the blog page
PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID);
$update_post_shortcodes = true;
} else {
// shortcode is not present in post content, so check if we were tracking it previously
// stop tracking if shortcode is not used in this specific post
if (isset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode])) {
unset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode]);
$update_post_shortcodes = true;
}
// make sure that something is set for the shortcode posts (even though we may remove this)
$shortcode_posts = isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]) ? \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] : array();
// and stop tracking for this shortcode on the blog page if it is not used
$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post($post_ID, $EES_Shortcode, $shortcode_posts, $page_for_posts, $update_post_shortcodes) ? true : $update_post_shortcodes;
}
}
if ($update_post_shortcodes) {
PostShortcodeTracking::update_post_shortcodes($page_for_posts);
}
}
}
示例14: __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
示例15: _add_view_counts
protected function _add_view_counts()
{
$this->_views['all']['count'] = $this->_all_data_count;
if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) {
$this->_views['trashed']['count'] = $this->_trashed_count;
}
}