示例#1
0
 /**
  * Registers additional field filters unless the additional field data is not ready/still
  * in need of an update.
  *
  * @return bool
  */
 protected static function register_filters()
 {
     if (!self::additional_fields_ready()) {
         return false;
     }
     foreach ((array) tribe_get_option('custom-fields', array()) as $field) {
         /**
          * Controls whether a filter is created or not for a particular additional field.
          *
          * @var bool  $create  create a filter object for this additional field
          * @var array $field   additional field definition
          */
         if (!apply_filters('tribe_events_filter_create_additional_field_filter', true, $field)) {
             continue;
         }
         /**
          * Controls the title used for an additional field filter.
          *
          * @var string $label  default title for the additional field filter
          * @var array  $field  additional field definition
          */
         $title = apply_filters('tribe_events_filter_additional_field_title', $field['label'], $field);
         /**
          * Controls the slug used for an additional field filter. This should generally be
          * unique or else unexpected results could be returned when users apply the filter.
          *
          * @var string $slug   default slug for the additional field filter
          * @var array  $field  additional field definition
          */
         $slug = apply_filters('tribe_events_filter_additional_field_slug', $field['name'], $field);
         // For multichoice fields we need an extra leading underscore for our meta queries
         $meta_key = Tribe__Events__Pro__Custom_Meta::is_multichoice($field) ? '_' . $field['name'] : $field['name'];
         self::$filters[$meta_key] = new Tribe__Events__Filterbar__Filters__Additional_Field($title, $slug, $meta_key);
     }
     return true;
 }
示例#2
0
 /**
  * The class init function.
  *
  * @return void
  */
 public function init()
 {
     Tribe__Events__Pro__Mini_Calendar::instance();
     Tribe__Events__Pro__Custom_Meta::init();
     Tribe__Events__Pro__Recurrence_Meta::init();
     Tribe__Events__Pro__Geo_Loc::instance();
     Tribe__Events__Pro__Community_Modifications::init();
     $this->displayMetaboxCustomFields();
     $this->single_event_meta = new Tribe__Events__Pro__Single_Event_Meta();
     $this->queue_processor = new Tribe__Events__Pro__Recurrence__Queue_Processor();
     $this->queue_realtime = new Tribe__Events__Pro__Recurrence__Queue_Realtime();
     $this->embedded_maps = new Tribe__Events__Pro__Embedded_Maps();
     $this->widget_wrappers = new Tribe__Events__Pro__Shortcodes__Widget_Wrappers();
     $this->singular_event_label = tribe_get_event_label_singular();
     $this->plural_event_label = tribe_get_event_label_plural();
 }
 /**
  * Provides a list of all currently defined (ECP) custom fields which are "multichoice"
  * in nature (for example, checkbox-type fields would be included in this list by default).
  *
  * @return array
  */
 public function multichoice_fields()
 {
     $multichoice_fields = array();
     $defined_fields = (array) tribe_get_option('custom-fields', array());
     foreach ($defined_fields as $custom_field) {
         if (Tribe__Events__Pro__Custom_Meta::is_multichoice($custom_field['type'])) {
             $multichoice_fields[] = $custom_field;
         }
     }
     return $multichoice_fields;
 }
示例#4
0
 /**
  * Echo Event Custom Field by Label
  *
  * same as above but echo instead of return
  *
  * @param (string) $label, the label to search for
  * @param (int) $eventID (optional), the event to look for, defaults to global $post
  *
  * @return (string) value of the field
  * @deprecated
  * @todo   remove in 3.11
  */
 function tribe_custom_field($label, $eventID = null)
 {
     _deprecated_function(__FUNCTION__, '3.9', 'tribe_get_custom_fields');
     $field = Tribe__Events__Pro__Custom_Meta::get_custom_field_by_label($label, $eventID);
     echo $field;
 }
示例#5
0
文件: Main.php 项目: TakenCdosG/chefs
 /**
  * The class init function.
  *
  * @return void
  */
 public function init()
 {
     Tribe__Events__Pro__Mini_Calendar::instance();
     Tribe__Events__Pro__This_Week::instance();
     Tribe__Events__Pro__Custom_Meta::init();
     Tribe__Events__Pro__Recurrence__Meta::init();
     Tribe__Events__Pro__Geo_Loc::instance();
     Tribe__Events__Pro__Community_Modifications::init();
     $this->displayMetaboxCustomFields();
     $this->custom_meta_tools = new Tribe__Events__Pro__Admin__Custom_Meta_Tools();
     $this->single_event_meta = new Tribe__Events__Pro__Single_Event_Meta();
     $this->single_event_overrides = new Tribe__Events__Pro__Recurrence__Single_Event_Overrides();
     $this->queue_processor = new Tribe__Events__Pro__Recurrence__Queue_Processor();
     $this->queue_realtime = new Tribe__Events__Pro__Recurrence__Queue_Realtime();
     $this->aggregator = new Tribe__Events__Pro__Recurrence__Aggregator();
     $this->embedded_maps = new Tribe__Events__Pro__Embedded_Maps();
     $this->shortcodes = new Tribe__Events__Pro__Shortcodes__Register();
     $this->singular_event_label = tribe_get_event_label_singular();
     $this->plural_event_label = tribe_get_event_label_plural();
     $this->singular_event_label_lowercase = tribe_get_event_label_singular_lowercase();
     $this->plural_event_label_lowercase = tribe_get_event_label_plural_lowercase();
 }