This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // disallow direct access to file if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { die('Sorry, but you cannot access this page directly.'); } if (version_compare(PHP_VERSION, '5', '<')) { $out = "
"; print $out; } define('AEC_MENU_POSITION', null); //previously 30 define('AEC_VERSION', '1.0.3'); define('AEC_FILE', basename(__FILE__)); define('AEC_NAME', str_replace('.php', '', AEC_FILE)); define('AEC_PATH', plugin_dir_path(__FILE__)); define('AEC_URL', plugin_dir_url(__FILE__)); define('AEC_EVENT_TABLE', 'aec_event'); define('AEC_CATEGORY_TABLE', 'aec_event_category'); define('AEC_HOMEPAGE', 'http://wordpress.org/extend/plugins/' . AEC_NAME . '/'); define('AEC_WP_DATE_FORMAT', get_option('date_format')); define('AEC_WP_TIME_FORMAT', get_option('time_format')); define('AEC_DB_DATETIME_FORMAT', 'Y-m-d H:i:s'); define('AEC_LOCALE', substr(get_locale(), 0, 2)); // for javascript localization scripts // if uncommented, overrides the location of the WP error log to the AEC plugin root // @ini_set('error_log', AEC_PATH . 'aec_debug.log'); if (!class_exists('ajax_event_calendar')) { class ajax_event_calendar { private $required_fields = array(); private $shortcode_params = array(); private $plugin_defaults = array( 'filter_label' => 'Show Type', 'limit' => '0', 'show_weekends' => '1', 'show_map_link' => '1', 'menu' => '1', 'make_links' => '0', 'popup_links' => '1', 'step_interval' => '30', 'addy_format' => '0', 'scroll' => '1', 'title' => '2', 'venue' => '1', 'address' => '2', 'city' => '2', 'state' => '2', 'zip' => '2', 'country' => '1', 'link' => '1', 'description' => '2', 'contact' => '2', 'contact_info' => '2', 'accessible' => '0', 'rsvp' => '0', 'reset' => '0' ); function __construct() { add_action('plugins_loaded', array($this, 'version_patches')); add_action('init', array($this, 'localize_plugin')); add_action('admin_menu', array($this, 'render_admin_menu')); add_action('admin_init', array($this, 'admin_options_initialize')); add_action('wp_print_styles', array($this, 'calendar_styles')); add_action('wp_print_scripts', array($this, 'frontend_calendar_scripts')); add_action('delete_user', array($this, 'delete_events_by_user')); // ajax hooks add_action('wp_ajax_nopriv_get_events', array($this, 'render_calendar_events')); add_action('wp_ajax_get_events', array($this, 'render_calendar_events')); add_action('wp_ajax_nopriv_get_event', array($this, 'render_frontend_modal')); add_action('wp_ajax_get_event', array($this, 'render_frontend_modal')); add_action('wp_ajax_admin_event', array($this, 'render_admin_modal')); add_action('wp_ajax_add_event', array($this, 'add_event')); add_action('wp_ajax_copy_event', array($this, 'copy_event')); add_action('wp_ajax_update_event', array($this, 'update_event')); add_action('wp_ajax_delete_event', array($this, 'delete_event')); add_action('wp_ajax_move_event', array($this, 'move_event')); add_action('wp_ajax_add_category', array($this, 'add_category')); add_action('wp_ajax_update_filter_label', array($this, 'update_filter_label')); add_action('wp_ajax_update_category', array($this, 'update_category')); add_action('wp_ajax_delete_category', array($this, 'confirm_delete_category')); add_action('wp_ajax_reassign_category', array($this, 'reassign_category')); // wordpress overrides add_filter('manage_users_columns', array($this, 'add_events_column')); add_filter('manage_users_custom_column', array($this, 'add_events_column_data'), 10, 3); add_filter('plugin_action_links', array($this, 'settings_link'), 10, 2); add_filter('option_page_capability_aec_plugin_options', array($this, 'set_option_page_capability')); add_shortcode('calendar', array($this, 'render_shortcode_calendar')); add_shortcode('eventlist', array($this, 'render_shortcode_eventlist')); // activate shortcode in text widgets add_filter('widget_text', 'shortcode_unautop'); add_filter('widget_text', 'do_shortcode'); } function install() { require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); global $wpdb; if ($wpdb->get_var('SHOW TABLES LIKE "' . $wpdb->prefix . AEC_EVENT_TABLE . '"') != $wpdb->prefix . AEC_EVENT_TABLE) { $sql = 'CREATE TABLE ' . $wpdb->prefix . AEC_EVENT_TABLE . ' ( id BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, user_id INT(10) UNSIGNED NOT NULL, title VARCHAR(100) NOT NULL, start DATETIME NOT NULL, end DATETIME NOT NULL, repeat_freq TINYINT(4) UNSIGNED DEFAULT 0, repeat_int TINYINT(4) UNSIGNED DEFAULT 0, repeat_end DATE, allDay TINYINT(1) UNSIGNED DEFAULT 0, category_id TINYINT(4) UNSIGNED NOT NULL, description VARCHAR(2500), link VARCHAR(2000), venue VARCHAR(100), address VARCHAR(100), city VARCHAR(50), state VARCHAR(50), zip VARCHAR(10), country VARCHAR(50), contact VARCHAR(50), contact_info VARCHAR(50), access TINYINT(1) UNSIGNED DEFAULT 0, rsvp TINYINT(1) UNSIGNED DEFAULT 0) CHARSET=utf8;'; dbDelta($sql); } if ($wpdb->get_var('SHOW TABLES LIKE "' . $wpdb->prefix . AEC_CATEGORY_TABLE . '"') != $wpdb->prefix . AEC_CATEGORY_TABLE) { $sql = 'CREATE TABLE ' . $wpdb->prefix . AEC_CATEGORY_TABLE . ' ( id TINYINT(4) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, category VARCHAR(25) NOT NULL, bgcolor CHAR(6) NOT NULL, fgcolor CHAR(6) NOT NULL ) CHARSET=utf8; ## DEFAULT CATEGORIES INSERT INTO ' . $wpdb->prefix . AEC_CATEGORY_TABLE . ' (id, category, bgcolor, fgcolor) VALUES (NULL, "Event", "517ed6", "FFFFFF"), (NULL, "Deadline", "e3686c", "FFFFFF"), (NULL, "Volunteer", "8fc9b0", "FFFFFF");'; dbDelta($sql); } // add new role add_role('calendar_contributor', 'Calendar Contributor', array( 'read' => 1, 'aec_add_events' => 1 )); // add calendar capabilities to administrator $role = get_role('administrator'); $role->add_cap('aec_add_events'); $role->add_cap('aec_manage_events'); $role->add_cap('aec_manage_calendar'); } function version_patches() { $plugin_updated = false; $options = get_option('aec_options'); $current = get_option('aec_version'); // initial and manual option initialization if (!is_array($options) || !isset($options['reset']) || $options['reset'] == '1') { update_option('aec_options', $this->plugin_defaults); } if (version_compare($current, AEC_VERSION, '==')) { return; } // set version for new plugin installations if ($current === false) { update_option('aec_version', AEC_VERSION); $current = get_option('aec_version'); $plugin_updated = true; } // < 0.9.6 if (version_compare($current, '0.9.6', '<')) { // set title as a required field $options = $this->insert_option('title', 2); // update database fields in event table require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); global $wpdb; $sql = 'ALTER TABLE ' . $wpdb->prefix . AEC_EVENT_TABLE . ' ' . 'modify venue VARCHAR(100),' . 'modify city VARCHAR(50),' . 'modify state CHAR(2),' . 'modify zip VARCHAR(10),' . 'modify contact VARCHAR(50),' . 'modify contact_info VARCHAR(50);'; $wpdb->query($sql); $plugin_updated = true; } // < 0.9.8.1 if (version_compare($current, '0.9.8.1', '<')) { // add calendar weekend toggle, and event detail map link toggle $options = $this->insert_option('show_weekends', 1); $options = $this->insert_option('show_map_link', 1); $plugin_updated = true; } // < 0.9.8.5 if (version_compare($current, '0.9.8.5', '<')) { // update tables to UTF8 and modify category table require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); global $wpdb; $sqla = 'ALTER TABLE ' . $wpdb->prefix . AEC_EVENT_TABLE . ' CONVERT TO CHARACTER SET utf8;'; $wpdb->query($sqla); $sqlb = 'ALTER TABLE ' . $wpdb->prefix . AEC_CATEGORY_TABLE . ' CONVERT TO CHARACTER SET utf8;'; $wpdb->query($sqlb); $sqlc = 'ALTER TABLE ' . $wpdb->prefix . AEC_CATEGORY_TABLE . ' ' . 'modify category VARCHAR(100) NOT NULL;'; $wpdb->query($sqlc); // remove sidebar option $this->decommission_options(array('sidebar')); // remove retired administrator capability $role = get_role('administrator'); $role->remove_cap('aec_run_reports'); // remove retired role remove_role('blog_calendar_contributor'); // remove outdated widget option delete_option('widget_upcoming_events'); delete_option('widget_contributor_list'); $plugin_updated = true; } // < 0.9.9.1 if (version_compare($current, '0.9.9.1', '<')) { // update table to support Aussi state length require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); global $wpdb; $sql = 'ALTER TABLE ' . $wpdb->prefix . AEC_EVENT_TABLE . ' MODIFY state CHAR(3);'; $wpdb->query($sql); // add filter label, description link options and address format options $options = $this->insert_option('filter_label', 'Show Type'); $options = $this->insert_option('make_links', 0); $options = $this->insert_option('popup_links', 1); $options = $this->insert_option('addy_format', 0); $plugin_updated = true; } // < 1.0 if (version_compare($current, '1.0', '<')) { // update table with repeating event fields, country, larger description, and larger state/province require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); global $wpdb; $sql = 'ALTER TABLE ' . $wpdb->prefix . AEC_EVENT_TABLE . ' MODIFY description VARCHAR(2500),' . ' MODIFY state VARCHAR(50),' . ' ADD country VARCHAR(50),' . ' ADD repeat_freq TINYINT(4) UNSIGNED DEFAULT 0,' . ' ADD repeat_int TINYINT(4) UNSIGNED DEFAULT 0,' . ' ADD repeat_end DATE;'; $wpdb->query($sql); // add mousescroll control, country field, and step d options $options = $this->insert_option('scroll', 1); $options = $this->insert_option('country', 0); $options = $this->insert_option('step_interval', 30); $plugin_updated = true; } // < 1.0.1 if (version_compare($current, '1.0.1', '<')) { // update to accomodate long urls require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); global $wpdb; $sql = 'ALTER TABLE ' . $wpdb->prefix . AEC_EVENT_TABLE . ' MODIFY link VARCHAR(2000);'; $wpdb->query($sql); $plugin_updated = true; } // update routines completed if ($plugin_updated) { // update plugin version update_option('aec_version', AEC_VERSION); // add sample event $_POST['event']['user_id'] = 0; // system id $_POST['event']['title'] = "Ajax Event Calendar [v" . AEC_VERSION . "] successfully installed!"; $_POST['event']['start_date'] = date('Y-m-d'); $_POST['event']['start_time'] = '00:00:00'; $_POST['event']['end_date'] = date('Y-m-d'); $_POST['event']['end_time'] = '00:00:00'; $_POST['event']['allDay'] = 1; $_POST['event']['repeat_freq'] = 0; $_POST['event']['repeat_int'] = 0; $_POST['event']['repeat_end'] = null; $_POST['event']['category_id'] = 1; $_POST['event']['description'] = "Ajax Event Calendar WordPress Plugin is a fully localized (including RTL language support) community calendar that allows authorized users to add, edit, copy, move, resize and delete events into custom categories. Highly customized calendars can be added to pages, posts or text widgets using the [calendar] shortcode. Similarly, a list view of events can be added using the [eventlist] shortcode. Click on the event link to learn about available the shortcode options."; $_POST['event']['link'] = AEC_HOMEPAGE; $_POST['event']['venue'] = 'Cloud Gate "The Bean"'; $_POST['event']['address'] = '201 East Randolph Street'; $_POST['event']['city'] = 'Chicago'; $_POST['event']['state'] = 'Illinois'; $_POST['event']['zip'] = '60601-6530'; $_POST['event']['country'] = 'United States'; $_POST['event']['contact'] = 'Eran Miller'; $_POST['event']['contact_info'] = '123-123-1234'; $_POST['event']['access'] = 1; $_POST['event']['rsvp'] = 0; // removes previously created release events and creates a new one $_POST['user_id'] = $_POST['event']['user_id']; $this->delete_events_by_user(); $this->db_insert_event($this->cleanse_event_input($_POST['event']), false); } } function localize_plugin($page) { load_plugin_textdomain(AEC_NAME, false, AEC_NAME . '/locale/'); $timezone = get_option('timezone_string'); if ($timezone) { date_default_timezone_set($timezone); } else { // TODO: look into converting gmt_offset into timezone_string date_default_timezone_set('UTC'); } // register scripts wp_register_script('fullcalendar', AEC_URL . 'js/jquery.fullcalendar.min.js', array('jquery'), '1.5.3', true); wp_register_script('simplemodal', AEC_URL . 'js/jquery.simplemodal.1.4.2.min.js', array('jquery'), '1.4.2', true); wp_register_script('jquery-ui-datepicker', AEC_URL . 'js/jquery.ui.datepicker.min.js', array('jquery-ui-core'), '1.8.5', true); wp_register_script('datepicker-locale', AEC_URL . 'js/i18n/jquery.ui.datepicker-' . substr(get_locale(), 0, 2) . '.js', array('jquery-ui-datepicker'), '1.8.5', true); wp_register_script('timepicker', AEC_URL . 'js/jquery.timePicker.min.js', array('jquery'), '5195', true); wp_register_script('growl', AEC_URL . 'js/jquery.jgrowl.min.js', array('jquery'), '1.2.5', true); wp_register_script('miniColors', AEC_URL . 'js/jquery.miniColors.min.js', array('jquery'), '0.1', true); wp_register_script('jeditable', AEC_URL . 'js/jquery.jeditable.min.js', array('jquery'), '1.7.1', true); wp_register_script('mousewheel', AEC_URL . 'js/jquery.mousewheel.min.js', array('jquery'), '3.0.6', true); wp_register_script('init_admin_calendar', AEC_URL . 'js/jquery.init_admin_calendar.js', array('jquery'), AEC_VERSION, true); wp_register_script('init_show_calendar', AEC_URL . 'js/jquery.init_show_calendar.js', array('jquery'), AEC_VERSION, true); wp_register_script('init_show_category', AEC_URL . '/js/jquery.init_admin_category.js', array('jquery'), AEC_VERSION, true); wp_register_script('tweet', 'http://platform.twitter.com/widgets.js', false, '1.0', true); wp_register_script('facebook', 'http://connect.facebook.net/en_US/all.js#xfbml=1', false, '1.0', true); // register styles wp_register_style('custom', AEC_URL . 'css/custom.css', null, AEC_VERSION); wp_register_style('custom_rtl', AEC_URL . 'css/custom_rtl.css', null, AEC_VERSION); wp_register_style('jq_ui_css', AEC_URL . 'css/jquery-ui-1.8.16.custom.css', null, '1.8.16'); } function render_admin_menu() { if (function_exists('add_options_page')) { // main menu page: calendar $page = add_menu_page('Ajax Event Calendar', __('Calendar', AEC_NAME), 'aec_add_events', AEC_FILE, array($this, 'render_admin_calendar'), AEC_URL . 'css/images/em-icon-16.png', AEC_MENU_POSITION); // calendar admin specific scripts and styles add_action("admin_print_scripts-$page", array($this, 'admin_calendar_scripts')); add_action("admin_print_styles-$page", array($this, 'calendar_styles')); if (current_user_can('aec_manage_calendar')) { // sub menu page: category management $sub_category = add_submenu_page(AEC_FILE, 'Categories', __('Categories', AEC_NAME), 'aec_manage_calendar', 'aec_manage_categories', array($this, 'render_admin_category')); // category admin specific scripts and styles add_action("admin_print_scripts-$sub_category", array($this, 'admin_category_scripts')); add_action("admin_print_scripts-$sub_category", array($this, 'admin_social_scripts')); add_action("admin_print_styles-$sub_category", array($this, 'admin_category_styles')); // sub menu page: activity report $sub_report = add_submenu_page(AEC_FILE, 'Activity Report', __('Activity Report', AEC_NAME), 'aec_manage_calendar', 'aec_activity_report', array($this, 'render_activity_report')); add_action("admin_print_scripts-$sub_report", array($this, 'admin_social_scripts')); add_action("admin_print_styles-$sub_report", array($this, 'calendar_styles')); // sub menu page: calendar options $sub_options = add_submenu_page(AEC_FILE, 'Options', __('Options', AEC_NAME), 'aec_manage_calendar', 'aec_calendar_options', array($this, 'render_calendar_options')); add_action("admin_print_scripts-$sub_options", array($this, 'admin_social_scripts')); add_action("admin_print_styles-$sub_options", array($this, 'calendar_styles')); } } } // STYLES, SCRIPTS & VIEWS function localized_variables() { $options = get_option('aec_options'); // initialize required form fields foreach ($options as $option => $value) { if ($value == 2) { $this->add_required_field($option); } } $isEuroDate = $this->parse_date_format(AEC_WP_DATE_FORMAT); $is24HrTime = $this->parse_time_format(AEC_WP_TIME_FORMAT); return array( 'is_rtl' => is_rtl(), 'locale' => AEC_LOCALE, 'start_of_week' => get_option('start_of_week'), 'step_interval' => intval($options['step_interval'], 10), 'datepicker_format' => ($isEuroDate) ? 'dd-mm-yy' : 'mm/dd/yy', // jquery datepicker format 'is24HrTime' => $is24HrTime, 'show_weekends' => $options['show_weekends'], 'agenda_time_format' => ($is24HrTime) ? 'H:mm{ - H:mm}' : 'h:mmt{ - h:mmt}', 'other_time_format' => ($is24HrTime) ? 'H:mm' : 'h:mmt', 'axis_time_format' => ($is24HrTime) ? 'HH:mm' : 'h:mmt', 'limit' => $options['limit'], 'today' => __('Today', AEC_NAME), 'all_day' => __('All Day', AEC_NAME), 'years' => __('Years', AEC_NAME), 'year' => __('Year', AEC_NAME), 'months' => __('Months', AEC_NAME), 'month' => __('Month', AEC_NAME), 'weeks' => __('Weeks', AEC_NAME), 'week' => __('Week', AEC_NAME), 'days' => __('Days', AEC_NAME), 'day' => __('Day', AEC_NAME), 'hours' => __('Hours', AEC_NAME), 'hour' => __('Hour', AEC_NAME), 'minutes' => __('Minutes', AEC_NAME), 'minute' => __('Minute', AEC_NAME), 'january' => __('January', AEC_NAME), 'february' => __('February', AEC_NAME), 'march' => __('March', AEC_NAME), 'april' => __('April', AEC_NAME), 'may' => __('May', AEC_NAME), 'june' => __('June', AEC_NAME), 'july' => __('July', AEC_NAME), 'august' => __('August', AEC_NAME), 'september' => __('September', AEC_NAME), 'october' => __('October', AEC_NAME), 'november' => __('November', AEC_NAME), 'december' => __('December', AEC_NAME), 'jan' => __('Jan', AEC_NAME), 'feb' => __('Feb', AEC_NAME), 'mar' => __('Mar', AEC_NAME), 'apr' => __('Apr', AEC_NAME), 'may_short' => _x('May', 'Three-letter month name abbreviation', AEC_NAME), 'jun' => __('Jun', AEC_NAME), 'jul' => __('Jul', AEC_NAME), 'aug' => __('Aug', AEC_NAME), 'sep' => __('Sep', AEC_NAME), 'oct' => __('Oct', AEC_NAME), 'nov' => __('Nov', AEC_NAME), 'dec' => __('Dec', AEC_NAME), 'sunday' => __('Sunday', AEC_NAME), 'monday' => __('Monday', AEC_NAME), 'tuesday' => __('Tuesday', AEC_NAME), 'wednesday' => __('Wednesday', AEC_NAME), 'thursday' => __('Thursday', AEC_NAME), 'friday' => __('Friday', AEC_NAME), 'saturday' => __('Saturday', AEC_NAME), 'sun' => __('Sun', AEC_NAME), 'mon' => __('Mon', AEC_NAME), 'tue' => __('Tue', AEC_NAME), 'wed' => __('Wed', AEC_NAME), 'thu' => __('Thu', AEC_NAME), 'fri' => __('Fri', AEC_NAME), 'sat' => __('Sat', AEC_NAME), 'close_event_form' => __('Close Event Form', AEC_NAME), 'loading_event_form' => __('Loading Event Form...', AEC_NAME), 'update_btn' => __('Update', AEC_NAME), 'delete_btn' => __('Delete', AEC_NAME), 'category_type' => __('Category type', AEC_NAME), 'hide_all_notifications' => __('hide all notifications', AEC_NAME), 'has_been_created' => __('has been created.', AEC_NAME), 'has_been_modified' => __('has been modified.', AEC_NAME), 'has_been_deleted' => __('has been deleted.', AEC_NAME), 'add_event' => __('Add Event', AEC_NAME), 'edit_event' => __('Edit Event', AEC_NAME), 'delete_event' => __('Delete this event?', AEC_NAME), 'loading' => __('Loading Events...', AEC_NAME), 'category_filter_label' => __('Category filter label', AEC_NAME), 'repeats_every' => __('Repeats Every', AEC_NAME), 'until' => __('Until', AEC_NAME), 'success' => __('Success!', AEC_NAME), 'whoops' => __('Whoops!', AEC_NAME) ); } function admin_calendar_variables() { $is_admin = (current_user_can('aec_manage_events')) ? 1 : 0; $options = get_option('aec_options'); return array_merge($this->localized_variables(), array( 'admin' => $is_admin, 'scroll' => $options['scroll'], 'required_fields' => join(",", $this->get_required_fields()), 'editable' => true, 'error_no_rights' => __('You cannot edit events created by other users.', AEC_NAME), 'error_past_create' => __('You cannot create events in the past.', AEC_NAME), 'error_future_create' => __('You cannot create events more than a year in advance.', AEC_NAME), 'error_past_resize' => __('You cannot resize expired events.', AEC_NAME), 'error_past_move' => __('You cannot move events into the past.', AEC_NAME), 'error_past_edit' => __('You cannot edit expired events.', AEC_NAME), 'error_invalid_duration' => __('Invalid duration.', AEC_NAME) ) ); } function frontend_calendar_variables() { return array_merge($this->localized_variables(), array( 'ajaxurl' => admin_url('admin-ajax.php'), // required for non-admin ajax pages 'editable' => false ) ); } function admin_category_variables() { return array_merge($this->localized_variables(), array( 'error_blank_category' => __('Category type cannot be a blank value.', AEC_NAME), 'confirm_category_delete' => __('Are you sure you want to delete this category type?', AEC_NAME), 'confirm_category_reassign' => __('Several events are associated with this category. Click OK to reassign these events to the default category.', AEC_NAME), 'events_reassigned' => __('Events have been reassigned to the default category.', AEC_NAME) ) ); } function calendar_styles() { // disabled: until I can conditionally load these scripts in text widgets with shortcodes // if ($this->has_shortcode('calendar') || $this->has_shortcode('eventlist')) { wp_enqueue_style('jq_ui_css'); wp_enqueue_style('categories'); wp_enqueue_style('custom'); if (is_rtl()) { wp_enqueue_style('custom_rtl'); } //} } function admin_category_styles() { wp_enqueue_style('categories'); wp_enqueue_style('custom'); if (is_rtl()) { wp_enqueue_style('custom_rtl'); } } function admin_calendar_scripts() { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_script('jquery-ui-datepicker'); if (AEC_LOCALE != 'en') { wp_enqueue_script('datepicker-locale'); // if not in English, load localization } wp_enqueue_script('fullcalendar'); wp_enqueue_script('simplemodal'); wp_enqueue_script('growl'); wp_enqueue_script('timepicker'); wp_enqueue_script('mousewheel'); wp_enqueue_script('init_admin_calendar'); wp_localize_script('init_admin_calendar', 'custom', $this->admin_calendar_variables()); } function frontend_calendar_scripts() { if (is_admin()) { return; } // disabled: until I can conditionally load these scripts in text widgets with shortcodes // if ($this->has_shortcode('calendar') || $this->has_shortcode('eventlist')) { wp_enqueue_script('jquery'); wp_enqueue_script('fullcalendar'); wp_enqueue_script('simplemodal'); wp_enqueue_script('mousewheel'); wp_enqueue_script('growl'); wp_enqueue_script('jquery-ui-datepicker'); if (AEC_LOCALE != 'en') { wp_enqueue_script('datepicker-locale'); // if not in English, load localization } wp_enqueue_script('init_show_calendar'); wp_localize_script('init_show_calendar', 'custom', $this->frontend_calendar_variables()); // } } function admin_social_scripts() { wp_enqueue_script('tweet'); wp_enqueue_script('facebook'); } function admin_category_scripts() { wp_enqueue_script('jquery'); wp_enqueue_script('growl'); wp_enqueue_script('miniColors'); wp_enqueue_script('jeditable'); wp_enqueue_script('init_show_category'); wp_localize_script('init_show_category', 'custom', $this->admin_category_variables()); } function render_aec_version() { return "AEC v" . AEC_VERSION . "\n"; } function render_admin_calendar() { if (!current_user_can('aec_add_events')) { wp_die(__('You do not have sufficient permissions to access this page.', AEC_NAME)); } $options = get_option('aec_options'); $out = $this->generate_css(); $out .= "", "
"); $add .= "\n"; $aec_options = get_option('aec_options'); $add .= $this->add_wrap(__('Category filter label', AEC_NAME), "", "
"); $add .= $this->add_wrap("", "", ""); $add .= $this->add_wrap(__('Update', AEC_NAME), "
"); $add .= $this->add_wrap(__('Category IDs are displayed in color bubbles at the beginning of each row.' , AEC_NAME), "", "
");
$add .= $this->add_wrap(__('To change category color, click the color swatch or edit the hex color value and click Update.', AEC_NAME), "", "
{$row->cnt} "; $out .= $this->render_i18n_data($row->category); $out .= " " . _n('Event', 'Events', $row->cnt, AEC_NAME); $out .= "
\n"; } $out .= $this->add_wrap(__('NOTE: Each repeating event is counted once.', AEC_NAME), "", "
"); } else { $out .= $this->add_wrap(__('No events this month.', AEC_NAME), "", "
"); } $out = $this->add_panel(__('Number of events scheduled for the current month, by category:', AEC_NAME), $out); $top = "\n"; $top .= $this->add_wrap(__('Activity Report', AEC_NAME), "