コード例 #1
0
 public static function get_instance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new Eab_Options();
     }
     return self::$_instance;
 }
コード例 #2
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
 }
コード例 #3
0
 public static function get_event_details($post)
 {
     $content = '';
     $data = Eab_Options::get_instance();
     $event = $post instanceof Eab_EventModel ? $post : new Eab_EventModel($post);
     $content .= '<div class="wpmudevevents-date">' . self::get_event_dates($event) . '</div>';
     if ($event->has_venue()) {
         $venue = $event->get_venue_location(Eab_EventModel::VENUE_AS_ADDRESS);
         $content .= "<div class='wpmudevevents-location' itemprop='location'>{$venue}</div>";
     }
     if ($event->is_premium()) {
         $price = $event->get_price();
         $currency = $data->get_option('currency');
         $amount = is_numeric($price) ? number_format($price, 2) : $price;
         $content .= apply_filters('eab-events-event_details-price', "<div class='wpmudevevents-price'>{$currency} {$amount}</div>", $event->get_id());
     }
     $data = apply_filters('eab-events-after_event_details', '', $event);
     if ($data) {
         $content .= '<div class="wpmudevevents-additional_details">' . $data . '</div>';
     }
     return $content;
 }
コード例 #4
0
 public function register_taxonomy()
 {
     $data = Eab_Options::get_instance();
     register_taxonomy('eab_events_category', Eab_EventModel::POST_TYPE, array('labels' => array('name' => __('Event Categories', eab_domain()), 'singular_name' => __('Event Category', eab_domain())), 'hierarchical' => true, 'public' => true, 'rewrite' => array('slug' => $data->get_option('slug'), 'with_front' => true), 'capabilities' => array('manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'edit_events')));
 }
コード例 #5
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_meetup = new Eab_Wp_Meetup();
 }
コード例 #6
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_options = wp_parse_args($this->_data->get_option('eab-events-nre'), array('noindex_scope' => self::ALL_INSTANCES, 'noindex_archives' => self::ALL_INSTANCES, 'nofollow_too' => false));
 }
コード例 #7
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_oauth = new Eab_Fbe_Oauth_FacebookEventsImporter();
 }
コード例 #8
0
 public function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     add_filter('eab-settings-before_save', array($this, 'save_settings'));
 }
コード例 #9
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_options = wp_parse_args($this->_data->get_option('eab-events-fpe'), array('id' => false, 'integrate_with_my_events' => false));
 }
コード例 #10
0
 public function get_weekly_calendar($timestamp = false, $id = '', $class = '')
 {
     $options = Eab_Options::get_instance();
     if (!is_object($options)) {
         $options = new Eab_Options();
     }
     $timestamp = $timestamp ? $timestamp : $this->get_local_time();
     $year = date("Y", $timestamp);
     $month = date("m", $timestamp);
     //$query = Eab_CollectionFactory::get_upcoming(strtotime("{$year}-{$month}-01 00:00"));
     $query = Eab_CollectionFactory::get_upcoming_weeks(strtotime("{$year}-{$month}-01 00:00"));
     $this->_events = $query->posts;
     $date = $timestamp ? $timestamp : $this->get_local_time();
     $sunday = $this->sunday($date);
     // Timestamp of first Sunday of any date
     if (!($start = $this->_data->get_option('weekly_calendar_start')) or $start > 23) {
         $start = 10;
     }
     // Set a default working time start
     $first = $start * 3600 + $sunday;
     // Timestamp of the first cell of first Sunday
     if (!($end = $this->_data->get_option('weekly_calendar_end')) or $end < 1) {
         $end = 24;
     }
     // Set a default working time end
     $last = $end * 3600 + $sunday;
     // Timestamp of the last cell of first Sunday
     if (!($interval = $this->_data->get_option('weekly_calendar_interval')) or $interval < 10 or $interval > 60 * 12) {
         $interval = 120;
     }
     // Set a default interval in minutes
     $step = $interval * 60;
     // Timestamp increase interval to one cell below
     $days = $this->arrange(array(0, 1, 2, 3, 4, 5, 6), -1);
     // Arrange days acc. to start of week
     $post_info = array();
     foreach ($this->_events as $event) {
         $post_info[] = $this->_get_item_data($event);
     }
     $tbl_id = $id;
     $tbl_id = $tbl_id ? "id='{$tbl_id}'" : '';
     $tbl_class = $class;
     $tbl_class = $tbl_class ? "class='{$tbl_class}'" : '';
     $ret = '';
     $ret .= "<table width='100%' {$tbl_id} {$tbl_class}>";
     $ret .= $this->_get_table_meta_row('thead');
     $ret .= '<tbody>';
     $ret .= $this->_get_first_row();
     $todays_no = date("w", $this->get_local_time());
     // Number of today
     for ($t = $first; $t < $last; $t = $t + $step) {
         foreach ($days as $key => $i) {
             // Not sure if it's current fix, but it works!
             if ($i == 0) {
                 $i = 7;
             }
             if ($i == -1) {
                 $from = $this->secs2hours($t - $sunday);
                 $to = $this->secs2hours($t - $sunday + $step);
                 $ret .= "<td class='wpmudevevents-weekly-calendar-hours-mins'>" . $from . " - " . $to . "</td>";
             } else {
                 $current_cell_start = $t + $i * 86400;
                 $current_cell_end = $current_cell_start + $step;
                 $this->reset_event_info_storage();
                 foreach ($post_info as $ipost) {
                     $count = count($ipost['event_starts']);
                     for ($k = 0; $k < $count; $k++) {
                         $start = strtotime($ipost['event_starts'][$k]);
                         $end = strtotime($ipost['event_ends'][$k]);
                         if ($start < $current_cell_end && $end > $current_cell_start) {
                             if ($options->get_option('weekly_calendar_display')) {
                                 $this->set_event_info_author(array('start' => $start, 'end' => $end), array('start' => $current_cell_start, 'end' => $current_cell_end), $ipost);
                             } else {
                                 $this->set_event_info(array('start' => $start, 'end' => $end), array('start' => $current_cell_start, 'end' => $current_cell_end), $ipost);
                             }
                         }
                     }
                 }
                 $activity = $this->get_event_info_as_string($i);
                 $now = $todays_no == $i ? 'class="today"' : '';
                 if ($this->get_local_time() < $current_cell_end && $this->get_local_time() > $current_cell_start) {
                     $now = 'class="now"';
                 }
                 $ret .= "<td {$now}>{$activity}</td>";
             }
         }
         $ret .= '</tr><tr>';
         // Close the last day of the week
     }
     $ret .= $this->_get_last_row();
     $ret .= '</tbody>';
     $ret .= $this->_get_table_meta_row('tfoot');
     $ret .= '</table>';
     return $ret;
 }
コード例 #11
0
 function eab_to_wpml__rewrite_rules($rules)
 {
     global $sitepress;
     $wpml_settings = $sitepress->get_settings();
     if ($wpml_settings['language_negotiation_type'] == 1 && $sitepress->get_current_language() != $sitepress->get_default_language()) {
         $data = Eab_Options::get_instance();
         $slug = $data->get_option('slug');
         $rules = $sitepress->rewrite_rules_filter((array) $rules + Eab_EventsHub::get_rewrite_rules($slug));
     }
     return $rules;
 }
コード例 #12
0
 function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_default_subject = __('Bad news! EVENT_NAME has been cancelled', Eab_EventsHub::TEXT_DOMAIN);
     $this->_default_message = __("Hello, USER_NAME\n\nUnfortunately, our EVENT_LINK event has been cancelled.", Eab_EventsHub::TEXT_DOMAIN);
 }
コード例 #13
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_oauth = new Eab_Gcal_Oauth_GoogleImporter();
     $this->_gcal = new Eab_Gcal_Calendar_GoogleImporter();
 }
コード例 #14
0
 /**
  * Initializing object
  *
  * Plugin register actions, filters and hooks.
  */
 function __construct()
 {
     global $wpdb, $wp_version;
     // Actions
     add_action('init', array($this, 'init'), 0);
     add_action('init', array($this, 'process_rsvps'), 99);
     // Bind this a bit later, so BP can load up
     add_action('admin_init', array($this, 'admin_init'), 0);
     add_action('admin_menu', array($this, 'admin_menu'));
     add_action('admin_notices', array($this, 'check_permalink_format'));
     add_action('option_rewrite_rules', array($this, 'check_rewrite_rules'));
     add_action('wp_print_styles', array($this, 'wp_print_styles'));
     add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));
     add_action('manage_incsub_event_posts_custom_column', array($this, 'manage_posts_custom_column'));
     add_filter('manage_incsub_event_posts_columns', array($this, 'manage_posts_columns'), 99);
     /**
      * Wipe out the default post actions, because we're using our own
      * @since  WP 4.3
      */
     add_filter('post_row_actions', array($this, 'manage_post_actions'), 10, 2);
     add_action('add_meta_boxes_incsub_event', array($this, 'meta_boxes'));
     add_action('wp_insert_post', array($this, 'save_event_meta'), 10, 2);
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('admin_print_styles', array($this, 'admin_print_styles'));
     add_action('widgets_init', array($this, 'widgets_init'));
     add_filter('post_updated_messages', array($this, 'handle_post_updated_messages'));
     add_filter('single_template', array($this, 'handle_single_template'));
     add_filter('archive_template', array($this, 'handle_archive_template'));
     add_action('wp', array($this, 'load_events_from_query'), 20);
     add_filter('rewrite_rules_array', array($this, 'add_rewrite_rules'));
     add_filter('post_type_link', array($this, 'post_type_link'), 10, 3);
     add_filter('query_vars', array($this, 'query_vars'));
     add_filter('cron_schedules', array($this, 'cron_schedules'));
     add_filter('views_edit-incsub_event', array($this, 'views_list'));
     add_filter('agm_google_maps-post_meta-address', array($this, 'agm_google_maps_post_meta_address'));
     add_filter('agm_google_maps-options', array($this, 'agm_google_maps_options'));
     add_filter('user_has_cap', array($this, 'user_has_cap'), 10, 3);
     add_filter('login_message', array($this, 'login_message'), 10);
     $this->_data = Eab_Options::get_instance();
     $this->_api = new Eab_Api();
     // Thrashing recurrent post trashes its instances, likewise for deleting.
     add_action('wp_trash_post', array($this, 'process_recurrent_trashing'));
     add_action('untrash_post', array($this, 'process_recurrent_untrashing'));
     add_action('before_delete_post', array($this, 'process_recurrent_deletion'));
     // Listen to transition from drafts and (re)spawn the recurring instances
     add_action('draft_to_publish', array($this, 'respawn_recurring_instances'));
     // API login after the options have been initialized
     $this->_api->initialize();
 }
コード例 #15
0
 private function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_capabilities = array('edit_events' => __('Edit Events', Eab_EventsHub::TEXT_DOMAIN), 'edit_others_events' => __('Edit Others Events', Eab_EventsHub::TEXT_DOMAIN), 'publish_events' => __('Publish Events', Eab_EventsHub::TEXT_DOMAIN), 'edit_published_events' => __('Edit Published Events', Eab_EventsHub::TEXT_DOMAIN), 'delete_events' => __('Delete Events', Eab_EventsHub::TEXT_DOMAIN), 'delete_published_events' => __('Delete Published Events', Eab_EventsHub::TEXT_DOMAIN));
 }
コード例 #16
0
 public function __construct()
 {
     $this->_data = Eab_Options::get_instance();
     $this->_client_id = $this->get_data('client_id');
     $this->_client_secret = $this->get_data('client_secret');
     parent::__construct();
 }