function check_my_calendar() { global $wpdb, $initial_listjs, $initial_caljs, $initial_minijs, $initial_ajaxjs, $mc_version, $grid_template, $rss_template, $list_template, $mini_template, $single_template, $defaults; $mcdb = $wpdb; mc_if_needs_permissions(); $current_version = get_option('mc_version') == '' ? get_option('my_calendar_version') : get_option('mc_version'); // If current version matches, don't bother running this. if ($current_version == $mc_version) { return true; } // Lets see if this is first run and create a table if it is! // Assume this is not a new install until we prove otherwise $new_install = false; $my_calendar_exists = false; $upgrade_path = array(); // Determine the calendar version $tables = $mcdb->get_results("show tables;"); foreach ($tables as $table) { foreach ($table as $value) { if ($value == MY_CALENDAR_TABLE) { $my_calendar_exists = true; // check whether installed version matches most recent version, establish upgrade process. } } } if ($my_calendar_exists == true && $current_version == '') { // If the table exists, but I don't know what version it is, I have to run the full cycle of upgrades. $current_version = '1.5.9'; } if ($my_calendar_exists == false) { $new_install = true; } else { // for each release requiring an upgrade path, add a version compare. // Loop will run every relevant upgrade cycle. if (version_compare($current_version, "1.8.0", "<")) { $upgrade_path[] = "1.8.0"; } if (version_compare($current_version, "1.9.0", "<")) { $upgrade_path[] = "1.9.0"; } if (version_compare($current_version, "1.9.1", "<")) { $upgrade_path[] = "1.9.1"; } if (version_compare($current_version, "1.9.3", "<")) { $upgrade_path[] = "1.9.3"; } if (version_compare($current_version, "1.10.0", "<")) { $upgrade_path[] = "1.10.0"; } if (version_compare($current_version, "1.10.7", "<")) { $upgrade_path[] = "1.10.7"; } if (version_compare($current_version, "1.11.0", "<")) { $upgrade_path[] = "1.11.0"; } if (version_compare($current_version, "1.11.1", "<")) { $upgrade_path[] = "1.11.1"; } if (version_compare($current_version, "2.0.0", "<")) { $upgrade_path[] = "2.0.0"; } if (version_compare($current_version, "2.0.4", "<")) { $upgrade_path[] = "2.0.4"; } if (version_compare($current_version, "2.1.0", "<")) { $upgrade_path[] = "2.1.0"; } if (version_compare($current_version, "2.2.0", "<")) { $upgrade_path[] = "2.2.0"; } if (version_compare($current_version, "2.2.6", "<")) { $upgrade_path[] = "2.2.6"; } if (version_compare($current_version, "2.2.10", "<")) { $upgrade_path[] = "2.2.10"; } if (version_compare($current_version, "2.3.0", "<")) { $upgrade_path[] = "2.3.0"; } } // having determined upgrade path, assign new version number update_option('mc_version', $mc_version); // Now we've determined what the current install is or isn't if ($new_install == true) { //add default settings mc_default_settings(); $sql = "INSERT INTO " . MY_CALENDAR_CATEGORIES_TABLE . " SET category_id=1, category_name='General', category_color='#ffffcc', category_icon='event.png'"; $mcdb->query($sql); } else { // clear cache so updates are immediately available mc_delete_cache(); } // switch for different upgrade paths foreach ($upgrade_path as $upgrade) { switch ($upgrade) { // only upgrade db on most recent version case '2.3.0': delete_option('mc_location_control'); $user_data = get_option('mc_user_settings'); $loc_type = get_option('mc_location_type') == '' ? 'event_state' : get_option('mc_location_type'); $locations[$loc_type] = $user_data['my_calendar_location_default']['values']; add_option('mc_use_permalinks', false); delete_option('mc_modified_feeds'); add_option('mc_location_controls', $locations); add_option('mc_location_access', array('1' => __('Accessible Entrance', 'my-calendar'), '2' => __('Accessible Parking Designated', 'my-calendar'), '3' => __('Accessible Restrooms', 'my-calendar'), '4' => __('Accessible Seating', 'my-calendar'), '5' => __('Accessible Transportation Available', 'my-calendar'), '6' => __('Wheelchair Accessible', 'my-calendar'), '7' => __('Courtesy Wheelchairs', 'my-calendar'), '8' => __('Bariatric Seating Available', 'my-calendar'), '9' => __('Elevator to all public areas', 'my-calendar'), '10' => __('Braille Signage', 'my-calendar'), '11' => __('Fragrance-Free Policy', 'my-calendar'), '12' => __('Other', 'my-calendar'))); add_option('mc_event_access', array('1' => __('Audio Description', 'my-calendar'), '2' => __('ASL Interpretation', 'my-calendar'), '3' => __('ASL Interpretation with voicing', 'my-calendar'), '4' => __('Deaf-Blind ASL', 'my-calendar'), '5' => __('Real-time Captioning', 'my-calendar'), '6' => __('Scripted Captioning', 'my-calendar'), '7' => __('Assisted Listening Devices', 'my-calendar'), '8' => __('Tactile/Touch Tour', 'my-calendar'), '9' => __('Braille Playbill', 'my-calendar'), '10' => __('Large Print Playbill', 'my-calendar'), '11' => __('Sensory Friendly', 'my-calendar'), '12' => __('Other', 'my-calendar'))); $mc_input_options = get_option('mc_input_options'); $mc_input_options['event_access'] = 'on'; update_option('mc_input_options', $mc_input_options); mc_upgrade_db(); mc_transition_db(); break; case '2.2.10': delete_option('mc_show_print'); delete_option('mc_show_ical'); delete_option('mc_show_rss'); break; case '2.2.8': delete_option('mc_draggable'); break; case '2.2.6': delete_option('mc_caching_enabled'); // remove caching support via options. Filter only. break; case '2.2.0': add_option('mc_inverse_color', 'true'); break; case '2.1.0': $templates = get_option('mc_templates'); global $rss_template; $templates['rss'] = $rss_template; update_option('mc_templates', $templates); break; case '2.0.4': update_option('mc_ical_utc', 'true'); break; case '2.0.0': mc_migrate_db(); update_option('mc_db_version', '2.0.0'); $mc_input = get_option('mc_input_options'); if (!isset($mc_input['event_specials'])) { $mc_input['event_specials'] = 'on'; update_option('mc_input_options', $mc_input); } break; case '1.11.1': add_option('mc_event_link', 'true'); break; case '1.11.0': add_option('mc_convert', 'true'); add_option('mc_process_shortcodes', 'false'); $add = get_option('mc_can_manage_events'); // yes, this is correct. $manage = get_option('mc_event_edit_perms'); $approve = get_option('mc_event_approve_perms'); mc_add_roles($add, $manage, $approve); delete_option('mc_can_manage_events'); delete_option('mc_event_edit_perms'); delete_option('mc_event_approve_perms'); break; case '1.10.7': update_option('mc_multisite_show', 0); break; case '1.10.0': update_option('mc_week_caption', "The week's events"); break; case '1.9.1': update_option('mc_widget_defaults', $defaults); break; case '1.9.0': delete_option('mc_show_heading'); add_option('mc_time_format', get_option('time_format')); add_option('mc_display_jump', get_option('display_jump')); add_option('mc_display_author', get_option('display_author')); if (get_option('can_manage_events') != '') { add_option('mc_can_manage_events', get_option('can_manage_events')); } else { add_option('mc_can_manage_events', 'manage_options'); } add_option('mc_ajaxjs', get_option('my_calendar_ajaxjs')); add_option('mc_caljs', get_option('my_calendar_caljs')); add_option('mc_css_file', get_option('my_calendar_css_file')); add_option('mc_date_format', get_option('my_calendar_date_format')); add_option('mc_hide_icons', get_option('my_calendar_hide_icons')); add_option('mc_listjs', get_option('my_calendar_listjs')); add_option('mc_minijs', get_option('my_calendar_minijs')); add_option('mc_notime_text', get_option('my_calendar_notime_text')); add_option('mc_show_address', get_option('my_calendar_show_address')); add_option('mc_show_css', get_option('my_caledar_show_css')); add_option('mc_show_heading', get_option('my_calendar_show_heading')); add_option('mc_show_js', get_option('my_calendar_show_js')); add_option('mc_show_map', get_option('my_calendar_show_map')); add_option('mc_show_months', get_option('my_calendar_show_months')); add_option('mc_templates', get_option('my_calendar_templates')); add_option('mc_use_styles', get_option('my_calendar_use_styles')); add_option('mc_version', get_option('my_calendar_version')); add_option('mc_widget_defaults', get_option('my_calendar_widget_defaults')); add_option('mc_week_format', "M j, 'y"); add_option('mc_calendar_javascript', get_option('calendar_javascript')); add_option('mc_list_javascript', get_option('list_javascript')); add_option('mc_mini_javascript', get_option('mini_javascript')); add_option('mc_ajax_javascript', get_option('ajax_javascript')); delete_option('ajax_javascript'); delete_option('mini_javascript'); delete_option('calendar_javascript'); delete_option('list_javascript'); delete_option('display_jump'); delete_option('display_author'); delete_option('can_manage_events'); delete_option('my_calendar_week_format'); delete_option('my_calendar_ajaxjs'); delete_option('my_calendar_caljs'); delete_option('my_calendar_css_file'); delete_option('my_calendar_date_format'); delete_option('my_calendar_hide_icons'); delete_option('my_calendar_listjs'); delete_option('my_calendar_minijs'); delete_option('my_calendar_notime_text'); delete_option('my_calendar_show_address'); delete_option('my_calendar_show_css'); delete_option('my_calendar_show_heading'); delete_option('my_calendar_show_js'); delete_option('my_calendar_show_map'); delete_option('my_calendar_show_months'); delete_option('my_calendar_templates'); delete_option('my_calendar_use_styles'); delete_option('my_calendar_version'); delete_option('my_calendar_widget_defaults'); add_option('mc_location_control', ''); add_site_option('mc_multisite', '0'); add_option('mc_templates', array('title' => '{title}', 'link' => '{title}', 'label' => '{title}', 'mini' => $mini_template, 'grid' => $grid_template, 'list' => $list_template, 'details' => $single_template)); $mc_input = get_option('mc_input_options'); $mc_input['event_image'] = 'on'; update_option('mc_input_options', $mc_input); mc_upgrade_db(); update_option('mc_db_version', '1.9.0'); case '1.8.0': $mc_input = get_option('mc_input_options'); add_option('mc_show_weekends', 'true'); add_option('mc_uri', ''); delete_option('my_calendar_stored_styles'); break; default: break; } } /* if the user has fully uninstalled the plugin but kept the database of events, this will restore default settings and upgrade db if needed. */ if (get_option('mc_uninstalled') == 'true') { mc_default_settings(); update_option('mc_db_version', $mc_version); delete_option('mc_uninstalled'); } }
function mc_default_settings() { global $initial_db, $initial_occur_db, $initial_loc_db, $initial_cat_db, $grid_template, $rss_template, $list_template, $mini_template, $single_template, $mc_version, $defaults; add_option('mc_location_access', array('1' => __('Accessible Entrance', 'my-calendar'), '2' => __('Accessible Parking Designated', 'my-calendar'), '3' => __('Accessible Restrooms', 'my-calendar'), '4' => __('Accessible Seating', 'my-calendar'), '5' => __('Accessible Transportation Available', 'my-calendar'), '6' => __('Wheelchair Accessible', 'my-calendar'), '7' => __('Courtesy Wheelchairs', 'my-calendar'), '8' => __('Bariatric Seating Available', 'my-calendar'), '9' => __('Elevator to all public areas', 'my-calendar'), '10' => __('Braille Signage', 'my-calendar'), '11' => __('Fragrance-Free Policy', 'my-calendar'), '12' => __('Other', 'my-calendar'))); add_option('mc_event_access', array('1' => __('Audio Description', 'my-calendar'), '2' => __('ASL Interpretation', 'my-calendar'), '3' => __('ASL Interpretation with voicing', 'my-calendar'), '4' => __('Deaf-Blind ASL', 'my-calendar'), '5' => __('Real-time Captioning', 'my-calendar'), '6' => __('Scripted Captioning', 'my-calendar'), '7' => __('Assisted Listening Devices', 'my-calendar'), '8' => __('Tactile/Touch Tour', 'my-calendar'), '9' => __('Braille Playbill', 'my-calendar'), '10' => __('Large Print Playbill', 'my-calendar'), '11' => __('Sensory Friendly', 'my-calendar'), '12' => __('Other', 'my-calendar'))); add_option('mc_display_author', 'false'); add_option('mc_version', $mc_version); add_option('mc_use_styles', 'false'); add_option('mc_show_months', 1); add_option('mc_show_map', 'true'); add_option('mc_show_address', 'false'); add_option('mc_calendar_javascript', 0); add_option('mc_list_javascript', 0); add_option('mc_mini_javascript', 0); add_option('mc_ajax_javascript', 0); add_option('mc_notime_text', 'N/A'); add_option('mc_hide_icons', 'false'); add_option('mc_event_link_expires', 'no'); add_option('mc_apply_color', 'background'); add_option('mc_inverse_color', 'true'); add_option('mc_input_options', array('event_short' => 'off', 'event_desc' => 'on', 'event_category' => 'on', 'event_image' => 'on', 'event_link' => 'on', 'event_recurs' => 'on', 'event_open' => 'off', 'event_location' => 'off', 'event_location_dropdown' => 'on', 'event_specials' => 'on', 'event_access' => 'on')); add_option('mc_input_options_administrators', 'false'); add_site_option('mc_multisite', '0'); add_option('mc_event_mail', 'false'); add_option('mc_desc', 'true'); add_option('mc_process_shortcodes', 'false'); add_option('mc_short', 'false'); add_option('mc_event_approve', 'false'); add_option('mc_event_approve_perms', 'manage_options'); add_option('mc_no_fifth_week', 'true'); add_option('mc_week_format', "M j, 'y"); add_option('mc_location_type', 'event_state'); add_option('mc_user_settings_enabled', false); add_option('mc_user_location_type', 'state'); add_option('mc_date_format', get_option('date_format')); // This option *must* be complete, if it's partial we get errors. So use update instead of add. update_option('mc_templates', array('title' => '{title}', 'link' => '{title}', 'grid' => $grid_template, 'list' => $list_template, 'mini' => $mini_template, 'rss' => $rss_template, 'details' => $single_template, 'label' => addslashes('More<span class="screen-reader-text"> about {title}</span>'))); add_option('mc_skip_holidays', 'false'); add_option('mc_css_file', 'twentyfifteen.css'); add_option('mc_time_format', get_option('time_format')); add_option('mc_widget_defaults', $defaults); add_option('mc_show_weekends', 'true'); add_option('mc_convert', 'true'); add_option('mc_show_event_vcal', 'false'); add_option('mc_week_caption', "The week's events"); add_option('mc_multisite_show', 0); add_option('mc_event_link', 'true'); add_option('mc_topnav', 'toggle,timeframe,jump,nav'); add_option('mc_bottomnav', 'key,category,feeds'); update_option('mc_update_notice', 1); mc_add_roles(); $has_uri = mc_guess_calendar(); if ($has_uri['response'] == false) { // if mc_guess_calendar returns a string, no valid URI was found. $slug = sanitize_title(__('my-calendar', 'my-calendar')); mc_generate_calendar_page($slug); } require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($initial_db); dbDelta($initial_occur_db); dbDelta($initial_cat_db); dbDelta($initial_loc_db); }
function mc_do_upgrades($upgrade_path) { foreach ($upgrade_path as $upgrade) { switch ($upgrade) { // only upgrade db on most recent version case '2.4.4': add_option('mc_display_more', 'true'); $input_options = get_option('mc_input_options'); $input_options['event_host'] = 'on'; update_option('mc_input_options', $input_options); add_option('mc_default_direction', 'DESC'); mc_upgrade_db(); break; case '2.3.15': delete_option('mc_event_groups'); delete_option('mc_details'); break; case '2.3.11': add_option('mc_use_custom_js', 0); add_option('mc_update_notice', 0); break; case '2.3.0': delete_option('mc_location_control'); $user_data = get_option('mc_user_settings'); $loc_type = get_option('mc_location_type') == '' ? 'event_state' : get_option('mc_location_type'); $locations[$loc_type] = $user_data['my_calendar_location_default']['values']; add_option('mc_use_permalinks', false); delete_option('mc_modified_feeds'); add_option('mc_location_controls', $locations); $mc_input_options = get_option('mc_input_options'); $mc_input_options['event_access'] = 'on'; update_option('mc_input_options', $mc_input_options); mc_transition_db(); break; case '2.2.10': delete_option('mc_show_print'); delete_option('mc_show_ical'); delete_option('mc_show_rss'); break; case '2.2.8': delete_option('mc_draggable'); break; case '2.2.6': delete_option('mc_caching_enabled'); // remove caching support via options. Filter only. break; case '2.2.0': add_option('mc_inverse_color', 'true'); break; case '2.1.0': $templates = get_option('mc_templates'); global $rss_template; $templates['rss'] = $rss_template; update_option('mc_templates', $templates); break; case '2.0.4': update_option('mc_ical_utc', 'true'); break; case '2.0.0': mc_migrate_db(); update_option('mc_db_version', '2.0.0'); $mc_input = get_option('mc_input_options'); if (!isset($mc_input['event_specials'])) { $mc_input['event_specials'] = 'on'; update_option('mc_input_options', $mc_input); } break; case '1.11.1': add_option('mc_event_link', 'true'); break; case '1.11.0': add_option('mc_convert', 'true'); add_option('mc_process_shortcodes', 'false'); $add = get_option('mc_can_manage_events'); // yes, this is correct. $manage = get_option('mc_event_edit_perms'); $approve = get_option('mc_event_approve_perms'); mc_add_roles($add, $manage, $approve); delete_option('mc_can_manage_events'); delete_option('mc_event_edit_perms'); delete_option('mc_event_approve_perms'); break; default: break; } } }
function mc_do_upgrades($upgrade_path) { foreach ($upgrade_path as $upgrade) { switch ($upgrade) { // only upgrade db on most recent version case '2.3.15': delete_option('mc_event_groups'); delete_option('mc_details'); mc_upgrade_db(); break; case '2.3.11': add_option('mc_use_custom_js', 0); add_option('mc_update_notice', 0); break; case '2.3.0': delete_option('mc_location_control'); $user_data = get_option('mc_user_settings'); $loc_type = get_option('mc_location_type') == '' ? 'event_state' : get_option('mc_location_type'); $locations[$loc_type] = $user_data['my_calendar_location_default']['values']; add_option('mc_use_permalinks', false); delete_option('mc_modified_feeds'); add_option('mc_location_controls', $locations); add_option('mc_location_access', array('1' => __('Accessible Entrance', 'my-calendar'), '2' => __('Accessible Parking Designated', 'my-calendar'), '3' => __('Accessible Restrooms', 'my-calendar'), '4' => __('Accessible Seating', 'my-calendar'), '5' => __('Accessible Transportation Available', 'my-calendar'), '6' => __('Wheelchair Accessible', 'my-calendar'), '7' => __('Courtesy Wheelchairs', 'my-calendar'), '8' => __('Bariatric Seating Available', 'my-calendar'), '9' => __('Elevator to all public areas', 'my-calendar'), '10' => __('Braille Signage', 'my-calendar'), '11' => __('Fragrance-Free Policy', 'my-calendar'), '12' => __('Other', 'my-calendar'))); add_option('mc_event_access', array('1' => __('Audio Description', 'my-calendar'), '2' => __('ASL Interpretation', 'my-calendar'), '3' => __('ASL Interpretation with voicing', 'my-calendar'), '4' => __('Deaf-Blind ASL', 'my-calendar'), '5' => __('Real-time Captioning', 'my-calendar'), '6' => __('Scripted Captioning', 'my-calendar'), '7' => __('Assisted Listening Devices', 'my-calendar'), '8' => __('Tactile/Touch Tour', 'my-calendar'), '9' => __('Braille Playbill', 'my-calendar'), '10' => __('Large Print Playbill', 'my-calendar'), '11' => __('Sensory Friendly', 'my-calendar'), '12' => __('Other', 'my-calendar'))); $mc_input_options = get_option('mc_input_options'); $mc_input_options['event_access'] = 'on'; update_option('mc_input_options', $mc_input_options); mc_transition_db(); break; case '2.2.10': delete_option('mc_show_print'); delete_option('mc_show_ical'); delete_option('mc_show_rss'); break; case '2.2.8': delete_option('mc_draggable'); break; case '2.2.6': delete_option('mc_caching_enabled'); // remove caching support via options. Filter only. break; case '2.2.0': add_option('mc_inverse_color', 'true'); break; case '2.1.0': $templates = get_option('mc_templates'); global $rss_template; $templates['rss'] = $rss_template; update_option('mc_templates', $templates); break; case '2.0.4': update_option('mc_ical_utc', 'true'); break; case '2.0.0': mc_migrate_db(); update_option('mc_db_version', '2.0.0'); $mc_input = get_option('mc_input_options'); if (!isset($mc_input['event_specials'])) { $mc_input['event_specials'] = 'on'; update_option('mc_input_options', $mc_input); } break; case '1.11.1': add_option('mc_event_link', 'true'); break; case '1.11.0': add_option('mc_convert', 'true'); add_option('mc_process_shortcodes', 'false'); $add = get_option('mc_can_manage_events'); // yes, this is correct. $manage = get_option('mc_event_edit_perms'); $approve = get_option('mc_event_approve_perms'); mc_add_roles($add, $manage, $approve); delete_option('mc_can_manage_events'); delete_option('mc_event_edit_perms'); delete_option('mc_event_approve_perms'); break; default: break; } } }
function mc_default_settings() { global $default_template, $initial_listjs, $initial_caljs, $initial_minijs, $initial_ajaxjs, $initial_db, $initial_occur_db, $initial_loc_db, $initial_cat_db, $grid_template, $rss_template, $list_template, $mini_template, $single_template, $mc_version, $defaults; // no arguments add_option('mc_location_access', array('1' => __('Accessible Entrance', 'my-calendar'), '2' => __('Accessible Parking Designated', 'my-calendar'), '3' => __('Accessible Restrooms', 'my-calendar'), '4' => __('Accessible Seating', 'my-calendar'), '5' => __('Accessible Transportation Available', 'my-calendar'), '6' => __('Wheelchair Accessible', 'my-calendar'), '7' => __('Courtesy Wheelchairs', 'my-calendar'), '8' => __('Bariatric Seating Available', 'my-calendar'), '9' => __('Elevator to all public areas', 'my-calendar'), '10' => __('Braille Signage', 'my-calendar'), '11' => __('Fragrance-Free Policy', 'my-calendar'), '12' => __('Other', 'my-calendar'))); add_option('mc_event_access', array('1' => __('Audio Description', 'my-calendar'), '2' => __('ASL Interpretation', 'my-calendar'), '3' => __('ASL Interpretation with voicing', 'my-calendar'), '4' => __('Deaf-Blind ASL', 'my-calendar'), '5' => __('Real-time Captioning', 'my-calendar'), '6' => __('Scripted Captioning', 'my-calendar'), '7' => __('Assisted Listening Devices', 'my-calendar'), '8' => __('Tactile/Touch Tour', 'my-calendar'), '9' => __('Braille Playbill', 'my-calendar'), '10' => __('Large Print Playbill', 'my-calendar'), '11' => __('Sensory Friendly', 'my-calendar'), '12' => __('Other', 'my-calendar'))); add_option('mc_display_author', 'false'); add_option('mc_display_jump', 'false'); add_option('mc_version', $mc_version); add_option('mc_use_styles', 'false'); add_option('mc_show_months', 1); add_option('mc_show_map', 'true'); add_option('mc_show_address', 'false'); add_option('mc_calendar_javascript', 0); add_option('mc_list_javascript', 0); add_option('mc_mini_javascript', 0); add_option('mc_ajax_javascript', 1); add_option('mc_minijs', $initial_minijs); add_option('mc_listjs', $initial_listjs); add_option('mc_caljs', $initial_caljs); add_option('mc_ajaxjs', $initial_ajaxjs); add_option('mc_notime_text', 'N/A'); add_option('mc_hide_icons', 'false'); add_option('mc_event_link_expires', 'no'); add_option('mc_apply_color', 'background'); add_option('mc_inverse_color', 'true'); add_option('mc_input_options', array('event_short' => 'off', 'event_desc' => 'on', 'event_category' => 'on', 'event_image' => 'on', 'event_link' => 'on', 'event_recurs' => 'on', 'event_open' => 'off', 'event_location' => 'on', 'event_location_dropdown' => 'on', 'event_specials' => 'on', 'event_access' => 'on')); add_option('mc_input_options_administrators', 'false'); add_site_option('mc_multisite', '0'); add_option('mc_event_mail', 'false'); add_option('mc_desc', 'true'); add_option('mc_process_shortcodes', 'false'); add_option('mc_short', 'false'); add_option('mc_event_mail_subject', ''); add_option('mc_event_mail_to', ''); add_option('mc_event_mail_message', ''); add_option('mc_event_approve', 'false'); add_option('mc_event_approve_perms', 'manage_options'); add_option('mc_no_fifth_week', 'true'); add_option('mc_week_format', "M j, 'y"); add_option('mc_location_type', 'event_state'); add_option('mc_user_settings_enabled', false); add_option('mc_user_location_type', 'state'); add_option('mc_show_js', ''); add_option('mc_show_css', ''); add_option('mc_date_format', get_option('date_format')); add_option('mc_templates', array('title' => '{title}', 'link' => '{title}', 'grid' => $grid_template, 'list' => $list_template, 'mini' => $mini_template, 'rss' => $rss_template, 'details' => $single_template, 'label' => '{title}')); add_option('mc_skip_holidays', 'false'); add_option('mc_css_file', 'twentyfourteen.css'); add_option('mc_time_format', get_option('time_format')); add_option('mc_widget_defaults', $defaults); add_option('mc_show_weekends', 'true'); add_option('mc_convert', 'true'); add_option('mc_uri', ''); add_option('mc_show_event_vcal', 'false'); add_option('mc_week_caption', "The week's events"); add_option('mc_multisite_show', 0); add_option('mc_event_link', 'true'); mc_add_roles(); require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($initial_db); dbDelta($initial_occur_db); dbDelta($initial_cat_db); dbDelta($initial_loc_db); }
function mc_default_settings() { global $initial_db, $initial_occur_db, $initial_loc_db, $initial_cat_db, $grid_template, $rss_template, $list_template, $mini_template, $single_template, $mc_version, $defaults; add_option('mc_display_author', 'false'); add_option('mc_version', $mc_version); add_option('mc_use_styles', 'false'); add_option('mc_show_months', 1); add_option('mc_show_map', 'true'); add_option('mc_show_address', 'false'); add_option('mc_display_more', 'true'); add_option('mc_calendar_javascript', 0); add_option('mc_list_javascript', 0); add_option('mc_mini_javascript', 0); add_option('mc_ajax_javascript', 0); add_option('mc_notime_text', 'N/A'); add_option('mc_hide_icons', 'false'); add_option('mc_event_link_expires', 'no'); add_option('mc_apply_color', 'background'); add_option('mc_inverse_color', 'true'); add_option('mc_input_options', array('event_short' => 'off', 'event_desc' => 'on', 'event_category' => 'on', 'event_image' => 'on', 'event_link' => 'on', 'event_recurs' => 'on', 'event_open' => 'off', 'event_location' => 'off', 'event_location_dropdown' => 'on', 'event_specials' => 'on', 'event_access' => 'on', 'event_host' => 'on')); add_option('mc_input_options_administrators', 'false'); add_site_option('mc_multisite', '0'); add_option('mc_event_mail', 'false'); add_option('mc_desc', 'true'); add_option('mc_process_shortcodes', 'false'); add_option('mc_short', 'false'); add_option('mc_event_approve', 'false'); add_option('mc_event_approve_perms', 'manage_options'); add_option('mc_no_fifth_week', 'true'); add_option('mc_week_format', "M j, 'y"); add_option('mc_location_type', 'event_state'); add_option('mc_user_settings_enabled', false); add_option('mc_user_location_type', 'state'); add_option('mc_date_format', get_option('date_format')); // This option *must* be complete, if it's partial we get errors. So use update instead of add. update_option('mc_templates', array('title' => '{time}: {title}', 'title_list' => '{title}', 'title_solo' => '{title}', 'link' => '{title}', 'grid' => $grid_template, 'list' => $list_template, 'mini' => $mini_template, 'rss' => $rss_template, 'details' => $single_template, 'label' => addslashes('More<span class="screen-reader-text"> about {title}</span>'))); add_option('mc_skip_holidays', 'false'); add_option('mc_css_file', 'twentyfifteen.css'); add_option('mc_time_format', get_option('time_format')); add_option('mc_widget_defaults', $defaults); add_option('mc_show_weekends', 'true'); add_option('mc_convert', 'true'); add_option('mc_show_event_vcal', 'false'); add_option('mc_week_caption', "The week's events"); add_option('mc_multisite_show', 0); add_option('mc_event_link', 'true'); add_option('mc_topnav', 'toggle,timeframe,jump,nav'); add_option('mc_bottomnav', 'key,category,feeds'); add_option('mc_default_direction', 'DESC'); update_option('mc_update_notice', 1); mc_add_roles(); $has_uri = mc_guess_calendar(); if ($has_uri['response'] == false) { // if mc_guess_calendar returns a string, no valid URI was found. $slug = sanitize_title(__('my-calendar', 'my-calendar')); mc_generate_calendar_page($slug); } require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($initial_db); dbDelta($initial_occur_db); dbDelta($initial_cat_db); dbDelta($initial_loc_db); }