本文整理汇总了PHP中Tribe__Events__Main::array_insert_after_key方法的典型用法代码示例。如果您正苦于以下问题:PHP Tribe__Events__Main::array_insert_after_key方法的具体用法?PHP Tribe__Events__Main::array_insert_after_key怎么用?PHP Tribe__Events__Main::array_insert_after_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribe__Events__Main
的用法示例。
在下文中一共展示了Tribe__Events__Main::array_insert_after_key方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_values
protected function get_values()
{
//ADD: Custom event speaker
$custom_parent_id = $this->getTaxIDBySlug('event-type');
$event_categories = array();
$event_categories_term = get_terms(Tribe__Events__Main::TAXONOMY, array('orderby' => 'name', 'order' => 'DESC', 'parent' => $custom_parent_id));
$event_categories_by_id = array();
foreach ($event_categories_term as $term) {
$event_categories_by_id[$term->term_id] = $term;
//event_categories_by_id - THIS ARRAY HAS 4 ITEMS
}
$event_categories_by_id_reverse = array_reverse($event_categories_by_id);
$parents = array($custom_parent_id);
// dyoshida was '0'
while (!empty($parents)) {
$parents_copy = $parents;
foreach ($event_categories_by_id_reverse as $term) {
// loop 4 times
if (in_array($term->parent, $parents_copy)) {
$parents[] = $term->term_id;
unset($event_categories_by_id[$term->term_id]);
$event_categories_by_id = Tribe__Events__Main::array_insert_after_key($term->parent, $event_categories_by_id, array($term->term_id => $term));
}
}
$parents = array_diff($parents, $parents_copy);
}
$child_spacer = ' ';
foreach ($event_categories_by_id as $cat) {
$child_depth = 0;
$parent_id = $cat->parent;
while ($parent_id != $custom_parent_id) {
// dyoshida was $parent_id != 0
$child_depth++;
$parent_id = $event_categories_by_id[$parent_id]->parent;
}
$child_indent = str_repeat($child_spacer, $child_depth);
$event_categories[] = array('name' => $child_indent . $cat->name, 'value' => $cat->term_id, 'data' => array('slug' => $cat->slug));
}
return $event_categories;
}
示例2: radii_filter_settings_tab_fields
function radii_filter_settings_tab_fields($fields, $tab)
{
switch ($tab) {
case 'display':
$fields = Tribe__Events__Main::array_insert_after_key('tribeDisableTribeBar', $fields, array('hideRelatedWorkshops' => array('type' => 'checkbox_bool', 'label' => __('Hide related workshops', 'tribe-events-calendar-pro'), 'tooltip' => __('Remove related workshops from the single event view', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean')));
break;
}
return $fields;
}
示例3: filter_settings_tab_fields
public function filter_settings_tab_fields($fields, $tab)
{
$this->singular_event_label = tribe_get_event_label_singular();
$this->plural_event_label = tribe_get_event_label_plural();
switch ($tab) {
case 'display':
$fields = Tribe__Events__Main::array_insert_after_key('tribeDisableTribeBar', $fields, array('hideRelatedEvents' => array('type' => 'checkbox_bool', 'label' => __('Hide related events', 'tribe-events-calendar-pro'), 'tooltip' => __('Remove related events from the single event view', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean')));
$fields = Tribe__Events__Main::array_insert_after_key('monthAndYearFormat', $fields, array('weekDayFormat' => array('type' => 'text', 'label' => __('Week Day Format', 'tribe-events-calendar-pro'), 'tooltip' => __('Enter the format to use for week days. Used when showing days of the week in Week view.', 'tribe-events-calendar-pro'), 'default' => 'D jS', 'size' => 'medium', 'validation_type' => 'html')));
$fields = Tribe__Events__Main::array_insert_after_key('hideRelatedEvents', $fields, array('week_view_hide_weekends' => array('type' => 'checkbox_bool', 'label' => __('Hide weekends on Week View', 'tribe-events-calendar-pro'), 'tooltip' => __('Check this to only show weekdays on Week View', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean')));
break;
}
return $fields;
}
示例4: inject_settings
/**
* Adds setting for hiding subsequent occurrences by default.
*
*
* @param array $args
* @param string $id
*
* @return array
*/
public static function inject_settings($args, $id)
{
if ($id == 'general') {
// we want to inject the hiding subsequent occurrences into the general section directly after "Live update AJAX"
$args = Tribe__Events__Main::array_insert_after_key('liveFiltersUpdate', $args, array('hideSubsequentRecurrencesDefault' => array('type' => 'checkbox_bool', 'label' => __('Recurring event instances', 'tribe-events-calendar-pro'), 'tooltip' => __('Show only the first instance of each recurring event (only affects list-style views).', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'), 'userToggleSubsequentRecurrences' => array('type' => 'checkbox_bool', 'label' => __('Front-end recurring event instances toggle', 'tribe-events-calendar-pro'), 'tooltip' => __('Allow users to decide whether to show all instances of a recurring event.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'), 'recurrenceMaxMonthsBefore' => array('type' => 'text', 'size' => 'small', 'label' => __('Clean up recurring events after', 'tribe-events-calendar-pro'), 'tooltip' => __('Automatically remove recurring event instances older than this', 'tribe-events-calendar-pro'), 'validation_type' => 'positive_int', 'default' => 24), 'recurrenceMaxMonthsAfter' => array('type' => 'text', 'size' => 'small', 'label' => __('Create recurring events in advance for', 'tribe-events-calendar-pro'), 'tooltip' => __('Recurring events will be created this far in advance', 'tribe-events-calendar-pro'), 'validation_type' => 'positive_int', 'default' => 24)));
add_filter('tribe_field_div_end', array(__CLASS__, 'add_months_to_settings_field'), 100, 2);
}
return $args;
}
示例5: inject_settings
/**
* Inject the GeoLoc settings into the general TEC settings screen
*
* @param $args
* @param $id
*
* @return array
*/
public function inject_settings($args, $id)
{
if ($id == 'general') {
$venues = $this->get_venues_without_geoloc_info();
// we want to inject the map default distance and unit into the map section directly after "enable Google Maps"
$args = Tribe__Events__Main::array_insert_after_key('embedGoogleMaps', $args, array('geoloc_default_geofence' => array('type' => 'text', 'label' => __('Map view search distance limit', 'tribe-events-calendar-pro'), 'size' => 'small', 'tooltip' => __('Set the distance that the location search covers (find events within X distance units of location search input).', 'tribe-events-calendar-pro'), 'default' => '25', 'class' => '', 'validation_type' => 'number_or_percent'), 'geoloc_default_unit' => array('type' => 'dropdown', 'label' => __('Map view distance unit', 'tribe-events-calendar-pro'), 'validation_type' => 'options', 'size' => 'small', 'default' => 'miles', 'options' => apply_filters('tribe_distance_units', array('miles' => __('Miles', 'tribe-events-calendar-pro'), 'kms' => __('Kilometers', 'tribe-events-calendar-pro')))), 'geoloc_fix_venues' => array('type' => 'html', 'html' => '<a name="geoloc_fix"></a><fieldset class="tribe-field tribe-field-html"><legend>' . __('Fix geolocation data', 'tribe-events-calendar-pro') . '</legend><div class="tribe-field-wrap">' . $this->fix_geoloc_data_button() . '<p class="tribe-field-indent description">' . sprintf(__("You have %d venues for which we don't have geolocation data. We need to use the Google Maps API to get that information. Doing this may take a while (aprox. 1 minute for every 200 venues).", 'tribe-events-calendar-pro'), $venues->found_posts) . '</p></div></fieldset>', 'conditional' => $venues->found_posts > 0)));
} elseif ($id == 'display') {
$args = Tribe__Events__Main::array_insert_after_key('tribeDisableTribeBar', $args, array('hideLocationSearch' => array('type' => 'checkbox_bool', 'label' => __('Hide location search', 'tribe-events-calendar-pro'), 'tooltip' => __('Removes location search field from the events bar on all views except for map view.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean')));
}
return $args;
}