Пример #1
0
 /**
  * Determines how to handle this field's creation
  * either calls a callback function or runs this class' course of action
  * logs an error if it fails
  *
  * @since 2.0.5
  * @author jkudish
  * @return void
  */
 public function doField()
 {
     if ($this->conditional) {
         if ($this->display_callback && is_callable($this->display_callback)) {
             // if there's a callback, run it
             call_user_func($this->display_callback);
         } elseif (in_array($this->type, $this->valid_field_types)) {
             // the specified type exists, run the appropriate method
             $field = call_user_func(array($this, $this->type));
             // filter the output
             $field = apply_filters('tribe_field_output_' . $this->type, $field, $this->id, $this);
             echo apply_filters('tribe_field_output_' . $this->type . '_' . $this->id, $field, $this->id, $this);
         } else {
             // fail, log the error
             TribeEvents::debug(__('Invalid field type specified', 'tribe-events-calendar'), $this->type, 'notice');
         }
     }
 }
 public function addSupportForm()
 {
     if (class_exists('Debug_Bar')) {
         TribeEvents::debug(self::supportForm());
     }
 }
 /**
  * Search for legacy events
  *
  * @param int $number max event count to look up
  * @return query of posts
  */
 private static function getLegacyEvents($number = -1)
 {
     // TODO: needs to account for either v1 posts or v2 'sp_events'
     $query = new WP_Query(array('post_status' => 'any', 'posts_per_page' => $number, 'meta_key' => '_EventStartDate', 'category_name' => 'Events'));
     if (count($query->posts)) {
         TribeEvents::debug(__('Install has 1 or more legacy event!', 'tribe-events-calendar'), false, 'warning');
     }
     return $query->posts;
 }