当前位置: 首页>>代码示例>>PHP>>正文


PHP my_calendar_table函数代码示例

本文整理汇总了PHP中my_calendar_table函数的典型用法代码示例。如果您正苦于以下问题:PHP my_calendar_table函数的具体用法?PHP my_calendar_table怎么用?PHP my_calendar_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了my_calendar_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mc_switch_sites

function mc_switch_sites()
{
    if (function_exists('is_multisite') && is_multisite()) {
        if (get_site_option('mc_multisite') == 2 && my_calendar_table() != my_calendar_table('global')) {
            if (get_option('mc_current_table') == '1') {
                // can post to either, but is currently set to post to central table
                return true;
            }
        } else {
            if (get_site_option('mc_multisite') == 1 && my_calendar_table() != my_calendar_table('global')) {
                // can only post to central table
                return true;
            }
        }
    }
    return false;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:17,代码来源:general-utilities.php

示例2: mc_deal_with_deleted_user

function mc_deal_with_deleted_user($id)
{
    global $wpdb;
    $mcdb = $wpdb;
    // Do the queries
    // This may not work quite right in multi-site. Need to explore further when I have time.
    $mcdb->get_results("UPDATE " . my_calendar_table() . " SET event_author=" . apply_filters('mc_deleted_author', $mcdb->get_var("SELECT MIN(ID) FROM " . $mcdb->prefix . "users", 0, 0)) . " WHERE event_author=" . $id);
    $mcdb->get_results("UPDATE " . my_calendar_table() . " SET event_host=" . apply_filters('mc_deleted_host', $mcdb->get_var("SELECT MIN(ID) FROM " . $mcdb->prefix . "users", 0, 0)) . " WHERE event_host=" . $id);
}
开发者ID:newmight2015,项目名称:psmpsm,代码行数:9,代码来源:my-calendar-core.php

示例3: mc_list_groups

function mc_list_groups()
{
    global $wpdb;
    $mcdb = $wpdb;
    $sortby = isset($_GET['sort']) ? (int) $_GET['sort'] : get_option('mc_default_sort');
    if (isset($_GET['order'])) {
        $sortdir = isset($_GET['order']) && $_GET['order'] == 'ASC' ? 'ASC' : 'default';
    } else {
        $sortdir = 'default';
    }
    if (empty($sortby)) {
        $sortbyvalue = 'event_begin';
    } else {
        switch ($sortby) {
            case 1:
                $sortbyvalue = 'event_ID';
                break;
            case 2:
                $sortbyvalue = 'event_title';
                break;
            case 3:
                $sortbyvalue = 'event_desc';
                break;
            case 4:
                $sortbyvalue = 'event_begin';
                break;
            case 5:
                $sortbyvalue = 'event_author';
                break;
            case 6:
                $sortbyvalue = 'event_category';
                break;
            case 7:
                $sortbyvalue = 'event_label';
                break;
            case 8:
                $sortbyvalue = 'group_id';
                break;
            default:
                $sortbyvalue = 'event_begin';
        }
    }
    $sortbydirection = $sortdir == 'default' ? 'DESC' : $sortdir;
    $sorting = $sortbydirection == 'DESC' ? "&order=ASC" : '';
    $current = empty($_GET['paged']) ? 1 : intval($_GET['paged']);
    $user = get_current_user_id();
    $screen = get_current_screen();
    $option = $screen->get_option('per_page', 'option');
    $items_per_page = get_user_meta($user, $option, true);
    if (empty($items_per_page) || $items_per_page < 1) {
        $items_per_page = $screen->get_option('per_page', 'default');
    }
    $limit = isset($_GET['limit']) ? $_GET['limit'] : 'all';
    switch ($limit) {
        case 'all':
            $limit = '';
            break;
        case 'grouped':
            $limit = 'WHERE event_group_id <> 0';
            break;
        case 'ungrouped':
            $limit = 'WHERE event_group_id = 0';
            break;
        default:
            $limit = '';
    }
    $events = $mcdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM " . my_calendar_table() . " {$limit} ORDER BY {$sortbyvalue} {$sortbydirection} LIMIT " . ($current - 1) * $items_per_page . ", " . $items_per_page);
    $found_rows = $wpdb->get_col("SELECT FOUND_ROWS();");
    $items = $found_rows[0];
    ?>
<div class='inside'><?php 
    if (get_option('mc_event_approve') == 'true') {
        ?>
		<ul class="links">
		<li><a <?php 
        echo isset($_GET['limit']) && $_GET['limit'] == 'groupeed' ? ' class="active-link"' : '';
        ?>
 href="<?php 
        echo admin_url('admin.php?page=my-calendar-groups&amp;limit=grouped#my-calendar-admin-table');
        ?>
"><?php 
        _e('Grouped Events', 'my-calendar');
        ?>
</a></li>
		<li><a <?php 
        echo isset($_GET['limit']) && $_GET['limit'] == 'ungrouped' ? ' class="active-link"' : '';
        ?>
  href="<?php 
        echo admin_url('admin.php?page=my-calendar-groups&amp;limit=ungrouped#my-calendar-admin-table');
        ?>
"><?php 
        _e('Ungrouped Events', 'my-calendar');
        ?>
</a></li> 
		<li><a <?php 
        echo isset($_GET['limit']) && $_GET['limit'] == 'all' || !isset($_GET['limit']) ? ' class="active-link"' : '';
        ?>
  href="<?php 
        echo admin_url('admin.php?page=my-calendar-groups#my-calendar-admin-table');
        ?>
//.........这里部分代码省略.........
开发者ID:newmight2015,项目名称:psmpsm,代码行数:101,代码来源:my-calendar-group-manager.php

示例4: mc_get_data

function mc_get_data($field, $id)
{
    global $wpdb;
    $mcdb = $wpdb;
    if (get_option('mc_remote') == 'true' && function_exists('mc_remote_db')) {
        $mcdb = mc_remote_db();
    }
    $field = esc_sql($field);
    $sql = $wpdb->prepare("SELECT {$field} FROM " . my_calendar_table() . " WHERE event_id = %d", $id);
    $result = $mcdb->get_var($sql);
    return $result;
}
开发者ID:patlegris,项目名称:On-off-Studio,代码行数:12,代码来源:my-calendar-events.php

示例5: mc_transition_db

function mc_transition_db()
{
    // copy to post types. Don't do this if referencing remote sites.
    if (get_option('mc_remote') != 'true') {
        global $wpdb;
        $results = $wpdb->get_results('SELECT * FROM ' . my_calendar_locations_table(), ARRAY_A);
        $locations = array();
        foreach ($results as $result) {
            $location_id = $result['location_id'];
            unset($result['location_id']);
            $hash = md5(serialize($result));
            $locations[$location_id] = $result;
        }
        $results = $wpdb->get_results('SELECT * FROM ' . my_calendar_categories_table());
        foreach ($results as $category) {
            $term = wp_insert_term($category->category_name, 'mc-event-category');
            if (!is_wp_error($term)) {
                $term_id = $term['term_id'];
                mc_update_category('category_term', $term_id, $category->category_id);
            } else {
                if (isset($term->error_data['term_exists'])) {
                    $term_id = $term->error_data['term_exists'];
                    mc_update_category('category_term', $term_id, $category->category_id);
                }
            }
        }
        $results = $wpdb->get_results('SELECT * FROM ' . my_calendar_table(), ARRAY_A);
        foreach ($results as $event) {
            $post_id = mc_create_event_post($event, $event['event_id']);
            mc_update_event('event_post', $post_id, $event['event_id']);
            // false if not found, id if found.
            $location = mc_check_location_table($event, $locations);
            if ($location) {
                mc_update_event('event_location', $location, $event['event_id']);
            } else {
                if ($event['event_label'] == '' && $event['event_street'] == '' && $event['event_url'] == '' && $event['event_city'] == '' && $event['event_state'] == '' && $event['event_country'] == '') {
                    // don't insert the row if location does not have basic data.
                } else {
                    $add = array('location_label' => $event['event_label'], 'location_street' => $event['event_street'], 'location_street2' => $event['event_street2'], 'location_city' => $event['event_city'], 'location_state' => $event['event_state'], 'location_postcode' => $event['event_postcode'], 'location_region' => $event['event_region'], 'location_country' => $event['event_country'], 'location_url' => $event['event_url'], 'location_longitude' => $event['event_longitude'], 'location_latitude' => $event['event_latitude'], 'location_zoom' => $event['event_zoom'], 'location_phone' => $event['event_phone'], 'location_access' => '');
                    mc_insert_location($add);
                }
                // could add delete routine to allow user to select what location to use for events using a given location.
            }
        }
    }
}
开发者ID:hoitomt,项目名称:shamrocks_wordpress_site,代码行数:46,代码来源:my-calendar-install.php

示例6: my_calendar_import

function my_calendar_import()
{
    if (get_option('ko_calendar_imported') != 'true') {
        global $wpdb;
        $mcdb = $wpdb;
        define('KO_CALENDAR_TABLE', $mcdb->prefix . 'calendar');
        define('KO_CALENDAR_CATS', $mcdb->prefix . 'calendar_categories');
        $events = $mcdb->get_results("SELECT * FROM " . KO_CALENDAR_TABLE, 'ARRAY_A');
        $event_ids = array();
        foreach ($events as $key) {
            $endtime = $key['event_time'] == '00:00:00' ? '00:00:00' : date('H:i:s', strtotime("{$key['event_time']} +1 hour"));
            $data = array('event_title' => $key['event_title'], 'event_desc' => $key['event_desc'], 'event_begin' => $key['event_begin'], 'event_end' => $key['event_end'], 'event_time' => $key['event_time'], 'event_endtime' => $endtime, 'event_recur' => $key['event_recur'], 'event_repeats' => $key['event_repeats'], 'event_author' => $key['event_author'], 'event_category' => $key['event_category'], 'event_hide_end' => 1, 'event_link' => isset($key['event_link']) ? $key['event_link'] : '');
            $format = array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%s');
            $update = $mcdb->insert(my_calendar_table(), $data, $format);
            $events_results = $update ? true : false;
            $event_ids[] = $mcdb->insert_id;
        }
        foreach ($event_ids as $value) {
            // propagate event instances.
            $sql = "SELECT event_begin, event_time, event_end, event_endtime FROM " . my_calendar_table() . " WHERE event_id = {$value}";
            $event = $wpdb->get_results($sql);
            $event = $event[0];
            $dates = array('event_begin' => $event->event_begin, 'event_end' => $event->event_end, 'event_time' => $event->event_time, 'event_endtime' => $event->event_endtime);
            $event = mc_increment_event($value, $dates);
        }
        $cats = $mcdb->get_results("SELECT * FROM " . KO_CALENDAR_CATS, 'ARRAY_A');
        $catsql = "";
        foreach ($cats as $key) {
            $name = esc_sql($key['category_name']);
            $color = esc_sql($key['category_colour']);
            $id = (int) $key['category_id'];
            $catsql = "INSERT INTO " . my_calendar_categories_table() . " SET \n\t\t\t\tcategory_id='" . $id . "',\n\t\t\t\tcategory_name='" . $name . "', \n\t\t\t\tcategory_color='" . $color . "' \n\t\t\t\tON DUPLICATE KEY UPDATE \n\t\t\t\tcategory_name='" . $name . "', \n\t\t\t\tcategory_color='" . $color . "';\n\t\t\t\t";
            $cats_results = $mcdb->query($catsql);
        }
        $message = $cats_results !== false ? __('Categories imported successfully.', 'my-calendar') : __('Categories not imported.', 'my-calendar');
        $e_message = $events_results !== false ? __('Events imported successfully.', 'my-calendar') : __('Events not imported.', 'my-calendar');
        $return = "<div id='message' class='updated fade'><ul><li>{$message}</li><li>{$e_message}</li></ul></div>";
        echo $return;
        if ($cats_results !== false && $events_results !== false) {
            update_option('ko_calendar_imported', 'true');
        }
    }
}
开发者ID:newmight2015,项目名称:psmpsm,代码行数:43,代码来源:my-calendar-settings.php

示例7: mc_event_is_grouped

function mc_event_is_grouped($group_id)
{
    global $wpdb;
    $mcdb = $wpdb;
    if ($group_id == 0) {
        return false;
    } else {
        $query = "SELECT count( event_group_id ) FROM " . my_calendar_table() . " WHERE event_group_id = {$group_id}";
        $value = $mcdb->get_var($query);
        if ($value > 1) {
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:16,代码来源:my-calendar-event-manager.php

示例8: my_calendar_check_db

function my_calendar_check_db()
{
    if (get_option('mc_remote') == 'true' && function_exists('mc_remote_db')) {
        return;
    }
    global $wpdb;
    $mcdb = $wpdb;
    $row = $mcdb->get_row('SELECT * FROM ' . my_calendar_table());
    if (isset($_POST['upgrade']) && $_POST['upgrade'] == 'true') {
        my_calendar_mc_upgrade_db();
        ?>
		<div class='upgrade-db updated'>
			<p><?php 
        _e('My Calendar Database is updated.', 'my-calendar');
        ?>
</p>
		</div>
	<?php 
    } else {
        if (!isset($row->event_tickets) && isset($row->event_id)) {
            if ($_GET['page'] == 'my-calendar-config') {
                ?>
			<div class='upgrade-db error'>
				<form method="post" action="<?php 
                echo admin_url("admin.php?page=my-calendar-config");
                ?>
">
					<div>
						<input type="hidden" name="_wpnonce"
						       value="<?php 
                echo wp_create_nonce('my-calendar-nonce');
                ?>
"/>
						<input type="hidden" name="upgrade" value="true"/>
					</div>
					<p>
						<?php 
                _e('The My Calendar database needs to be updated.', 'my-calendar');
                ?>
						<input type="submit" value="<?php 
                _e('Update now', 'my-calendar');
                ?>
" name="update-calendar"
						       class="button-primary"/>
					</p>
				</form>
			</div>
		<?php 
            } else {
                ?>
			<div class='upgrade-db error'>
			<p>
				<?php 
                _e('The My Calendar database needs to be updated.', 'my-calendar');
                ?>
 <a
					href="<?php 
                echo admin_url("admin.php?page=my-calendar-config");
                ?>
"><?php 
                _e('Update now', 'my-calendar');
                ?>
</a>
			</p>
			</div><?php 
            }
        } elseif (!isset($row->event_id)) {
            ?>
		<div class='upgrade-db error'>
		<form method="post" action="<?php 
            echo admin_url("admin.php?page=my-calendar-config");
            ?>
">
			<div>
				<input type="hidden" name="_wpnonce" value="<?php 
            echo wp_create_nonce('my-calendar-nonce');
            ?>
" />
				<input type="hidden" name="upgrade" value="true" />
			</div>
			<p>
				<?php 
            _e('You haven\'t entered any events, so My Calendar can\'t tell whether your database is up to date. If you can\'t add events, upgrade your database!', 'my-calendar');
            ?>
				<input type="submit" value="<?php 
            _e('Update now', 'my-calendar');
            ?>
" name="update-calendar"
				       class="button-primary" />
			</p>
		</form>
		</div><?php 
        }
    }
}
开发者ID:patlegris,项目名称:On-off-Studio,代码行数:95,代码来源:my-calendar-upgrade-db.php

示例9: my_calendar_manage_categories

function my_calendar_manage_categories()
{
    global $wpdb;
    $mcdb = $wpdb;
    $formats = array('%s', '%s', '%s');
    ?>
	<div class="wrap jd-my-calendar">
		<?php 
    my_calendar_check_db();
    // We do some checking to see what we're doing
    if (!empty($_POST)) {
        $nonce = $_REQUEST['_wpnonce'];
        if (!wp_verify_nonce($nonce, 'my-calendar-nonce')) {
            die("Security check failed");
        }
    }
    if (isset($_POST['mode']) && $_POST['mode'] == 'add') {
        $term = wp_insert_term($_POST['category_name'], 'mc-event-category');
        if (!is_wp_error($term)) {
            $term = $term['term_id'];
        } else {
            $term = false;
        }
        $add = array('category_name' => $_POST['category_name'], 'category_color' => $_POST['category_color'], 'category_icon' => $_POST['category_icon'], 'category_private' => isset($_POST['category_private']) ? 1 : 0, 'category_term' => $term);
        // actions and filters
        $add = apply_filters('mc_pre_add_category', $add, $_POST);
        $results = $mcdb->insert(my_calendar_categories_table(), $add, $formats);
        do_action('mc_post_add_category', $add, $results, $_POST);
        $cat_ID = $mcdb->insert_id;
        if (isset($_POST['mc_default_category'])) {
            update_option('mc_default_category', $cat_ID);
            $append = __('Default category changed.', 'my-calendar');
        } else {
            $append = '';
        }
        if (isset($_POST['mc_skip_holidays_category'])) {
            update_option('mc_skip_holidays_category', $cat_ID);
            $append .= __('Holiday category changed.', 'my-calendar');
        }
        if ($results) {
            echo "<div class=\"updated\"><p><strong>" . __('Category added successfully', 'my-calendar') . ". {$append}</strong></p></div>";
        } else {
            echo "<div class=\"updated error\"><p><strong>" . __('Category addition failed.', 'my-calendar') . "</strong></p></div>";
        }
    } else {
        if (isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'delete') {
            $cat_ID = (int) $_GET['category_id'];
            $sql = "DELETE FROM " . my_calendar_categories_table() . " WHERE category_id={$cat_ID}";
            $results = $mcdb->query($sql);
            if ($results) {
                $sql = "UPDATE " . my_calendar_table() . " SET event_category=1 WHERE event_category={$cat_ID}";
                $cal_results = $mcdb->query($sql);
                mc_delete_cache();
            } else {
                $cal_results = false;
            }
            if (get_option('mc_default_category') == $cat_ID) {
                update_option('mc_default_category', 1);
            }
            if ($results && $cal_results) {
                echo "<div class=\"updated\"><p><strong>" . __('Category deleted successfully. Categories in calendar updated.', 'my-calendar') . "</strong></p></div>";
            } else {
                if ($results && !$cal_results) {
                    echo "<div class=\"updated\"><p><strong>" . __('Category deleted successfully. Categories in calendar not updated.', 'my-calendar') . "</strong></p></div>";
                } else {
                    if (!$results && $cal_results) {
                        echo "<div class=\"updated error\"><p><strong>" . __('Category not deleted. Categories in calendar updated.', 'my-calendar') . "</strong></p></div>";
                    }
                }
            }
        } else {
            if (isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'edit' && !isset($_POST['mode'])) {
                $cur_cat = (int) $_GET['category_id'];
                mc_edit_category_form('edit', $cur_cat);
            } else {
                if (isset($_POST['mode']) && isset($_POST['category_id']) && isset($_POST['category_name']) && isset($_POST['category_color']) && $_POST['mode'] == 'edit') {
                    $update = array('category_name' => $_POST['category_name'], 'category_color' => $_POST['category_color'], 'category_icon' => $_POST['category_icon'], 'category_private' => isset($_POST['category_private']) ? 1 : 0);
                    $where = array('category_id' => (int) $_POST['category_id']);
                    $append = '';
                    if (isset($_POST['mc_default_category'])) {
                        update_option('mc_default_category', (int) $_POST['category_id']);
                        $append .= __('Default category changed.', 'my-calendar');
                    } else {
                        if (get_option('mc_default_category') == (int) $_POST['category_id']) {
                            delete_option('mc_default_category');
                        }
                    }
                    if (isset($_POST['mc_skip_holidays_category'])) {
                        update_option('mc_skip_holidays_category', (int) $_POST['category_id']);
                        $append .= __('Holiday category changed.', 'my-calendar');
                    } else {
                        if (get_option('mc_skip_holidays_category') == (int) $_POST['category_id']) {
                            delete_option('mc_skip_holidays_category');
                        }
                    }
                    $results = $mcdb->update(my_calendar_categories_table(), $update, $where, $formats, '%d');
                    mc_delete_cache();
                    if ($results) {
                        echo "<div class=\"updated\"><p><strong>" . __('Category edited successfully.', 'my-calendar') . " {$append}</strong></p></div>";
                    } else {
//.........这里部分代码省略.........
开发者ID:patlegris,项目名称:On-off-Studio,代码行数:101,代码来源:my-calendar-categories.php

示例10: mc_span_time

function mc_span_time($group_id)
{
    global $wpdb;
    $mcdb = $wpdb;
    if (get_option('mc_remote') == 'true' && function_exists('mc_remote_db')) {
        $mcdb = mc_remote_db();
    }
    $group_id = (int) $group_id;
    $sql = "SELECT event_begin, event_time, event_end, event_endtime FROM " . my_calendar_table() . " WHERE event_group_id = {$group_id} ORDER BY event_begin ASC";
    $dates = $mcdb->get_results($sql);
    $count = count($dates);
    $last = $count - 1;
    $begin = $dates[0]->event_begin . ' ' . $dates[0]->event_time;
    $end = $dates[$last]->event_end . ' ' . $dates[$last]->event_endtime;
    return array($begin, $end);
}
开发者ID:hoitomt,项目名称:shamrocks_wordpress_site,代码行数:16,代码来源:my-calendar-widgets.php

示例11: my_calendar_exists

function my_calendar_exists()
{
    global $wpdb;
    $tables = $wpdb->get_results("show tables;");
    foreach ($tables as $table) {
        foreach ($table as $value) {
            if ($value == my_calendar_table()) {
                // if the table exists, then My Calendar was already installed.
                return true;
            }
        }
    }
    return false;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:14,代码来源:my-calendar-core.php

示例12: mc_generator


//.........这里部分代码省略.........
</label>
					<select name="time" id="time">
						<option value="month" selected="selected"><?php 
        _e('Month', 'my-calendar');
        ?>
</option>
						<option value="month+1"><?php 
        _e('Next Month', 'my-calendar');
        ?>
</option>
						<option value="week"><?php 
        _e('Week', 'my-calendar');
        ?>
</option>
						<option value="day"><?php 
        _e('Day', 'my-calendar');
        ?>
</option>
					</select>
				</p>
				<p>
					<label for="year"><?php 
        _e('Year', 'my-calendar');
        ?>
</label>
					<select name="year" id="year">
						<option value=''><?php 
        _e('Default', 'my-calendar');
        ?>
</option>					
						<?php 
        global $wpdb;
        $mcdb = $wpdb;
        $query = "SELECT event_begin FROM " . my_calendar_table() . " WHERE event_approved = 1 AND event_flagged <> 1 ORDER BY event_begin ASC LIMIT 0 , 1";
        $year1 = date('Y', strtotime($mcdb->get_var($query)));
        $diff1 = date('Y') - $year1;
        $past = $diff1;
        $future = apply_filters('mc_jumpbox_future_years', 5, false);
        $fut = 1;
        $f = '';
        $p = '';
        $offset = 60 * 60 * get_option('gmt_offset');
        while ($past > 0) {
            $p .= '<option value="';
            $p .= date("Y", time() + $offset) - $past;
            $p .= '">';
            $p .= date("Y", time() + $offset) - $past . "</option>\n";
            $past = $past - 1;
        }
        while ($fut < $future) {
            $f .= '<option value="';
            $f .= date("Y", time() + $offset) + $fut;
            $f .= '">';
            $f .= date("Y", time() + $offset) + $fut . "</option>\n";
            $fut = $fut + 1;
        }
        echo $p . '<option value="' . date("Y") . '">' . date("Y") . "</option>\n" . $f;
        ?>
					</select>
					</p>
					<p>
					<label for="month"><?php 
        _e('Month', 'my-calendar');
        ?>
</label>
					<select name="month" id="month">
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:my-calendar-generator.php

示例13: mc_get_search_results

function mc_get_search_results($search)
{
    global $wpdb;
    $mcdb = $wpdb;
    $event_array = array();
    if (get_option('mc_remote') == 'true' && function_exists('mc_remote_db')) {
        $mcdb = mc_remote_db();
    }
    $before = apply_filters('mc_past_search_results', 0);
    $after = apply_filters('mc_future_search_results', 15);
    // return only future events, nearest 10
    if (is_array($search)) {
        // if from & to are set, we need to use an alternate search query
        $from = $search['from'];
        $to = $search['to'];
        $category = isset($search['category']) ? $search['category'] : null;
        $ltype = isset($search['ltype']) ? $search['ltype'] : null;
        $lvalue = isset($search['lvalue']) ? $search['lvalue'] : null;
        $author = isset($search['author']) ? $search['author'] : null;
        $host = isset($search['host']) ? $search['host'] : null;
        $search = isset($search['search']) ? $search['search'] : '';
        $event_array = my_calendar_events($from, $to, $category, $ltype, $lvalue, 'search', $author, $host, $search);
    } else {
        $date = date('Y', current_time('timestamp')) . '-' . date('m', current_time('timestamp')) . '-' . date('d', current_time('timestamp'));
        // if a value is non-zero, I'll grab a handful of extra events so I can throw out holidays and others like that.
        if ($before > 0) {
            $before = $before + 5;
            $events1 = $mcdb->get_results("SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end \r\n\t\t\tFROM " . my_calendar_event_table() . " \r\n\t\t\tJOIN " . my_calendar_table() . " \r\n\t\t\tON (event_id=occur_event_id) \r\n\t\t\tJOIN " . my_calendar_categories_table() . " \r\n\t\t\tON (event_category=category_id) WHERE event_approved = 1 {$search} AND event_flagged <> 1 \r\n\t\t\tAND DATE(occur_begin) < '{$date}' ORDER BY occur_begin DESC LIMIT 0,{$before}");
        } else {
            $events1 = array();
        }
        $events3 = $mcdb->get_results("SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end \r\n\t\tFROM " . my_calendar_event_table() . " \r\n\t\tJOIN " . my_calendar_table() . " \r\n\t\tON (event_id=occur_event_id) \r\n\t\tJOIN " . my_calendar_categories_table() . " \r\n\t\tON (event_category=category_id) WHERE event_approved = 1 {$search} AND event_flagged <> 1 \r\n\t\tAND DATE(occur_begin) = '{$date}'");
        if ($after > 0) {
            $after = $after + 5;
            $events2 = $mcdb->get_results("SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end \r\n\t\t\tFROM " . my_calendar_event_table() . " \r\n\t\t\tJOIN " . my_calendar_table() . " \r\n\t\t\tON (event_id=occur_event_id) \r\n\t\t\tJOIN " . my_calendar_categories_table() . " \r\n\t\t\tON (event_category=category_id) WHERE event_approved = 1 {$search} AND event_flagged <> 1 \r\n\t\t\tAND DATE(occur_begin) > '{$date}' ORDER BY occur_begin ASC LIMIT 0,{$after}");
        } else {
            $events2 = array();
        }
        $arr_events = array();
        if (!empty($events1) || !empty($events2) || !empty($events3)) {
            $arr_events = array_merge($events1, $events3, $events2);
        }
        if (!get_option('mc_skip_holidays_category') || get_option('mc_skip_holidays_category') == '') {
            $holidays = array();
        } else {
            $holidays = mc_get_all_holidays($before, $after, 'yes');
            $holiday_array = mc_set_date_array($holidays);
        }
        if (is_array($arr_events) && !empty($arr_events)) {
            $no_events = false;
            $event_array = mc_set_date_array($arr_events);
            if (is_array($holidays) && count($holidays) > 0) {
                $event_array = mc_holiday_limit($event_array, $holiday_array);
                // if there are holidays, rejigger.
            }
        }
    }
    return $event_array;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:59,代码来源:my-calendar-output.php

示例14: mc_get_db_type

function mc_get_db_type()
{
    global $wpdb;
    $mcdb = $wpdb;
    $db_type = 'MyISAM';
    if (get_option('mc_remote') == 'true' && function_exists('mc_remote_db')) {
        $mcdb = mc_remote_db();
    }
    $my_calendar = my_calendar_table();
    $dbs = $mcdb->get_results("SHOW TABLE STATUS WHERE name='{$my_calendar}'");
    foreach ($dbs as $db) {
        if ($db->Name == my_calendar_table()) {
            $db_type = $db->Engine;
        }
    }
    return $db_type;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:17,代码来源:my-calendar-events.php

示例15: edit_my_calendar_config


//.........这里部分代码省略.........
            _e('You will need to allow remote connections from this site to the site hosting your My Calendar events. Replace the above placeholders with the host-site information. The two sites must have the same WP table prefix. While this option is enabled, you may not enter or edit events through this installation.', 'my-calendar');
            ?>
									</li>
								<?php 
        }
        ?>
								<li><?php 
        mc_settings_field('mc_event_approve', __('Enable approval options.', 'my-calendar'), '', '', array(), 'checkbox-single');
        ?>
</li>
								<li><?php 
        mc_settings_field('mc_api_enabled', __('Enable external API.', 'my-calendar'), '', '', array(), 'checkbox-single');
        ?>
</li>
								<?php 
        if (apply_filters('mc_caching_clear', false)) {
            ?>
									<li><?php 
            mc_settings_field('mc_clear_cache', __('Clear current cache. (Necessary if you edit shortcodes to change displayed categories, for example.)', 'my-calendar'), '', '', array(), 'checkbox-single');
            ?>
</li>
								<?php 
        }
        ?>
								<li><?php 
        mc_settings_field('mc_default_sort', __('Default Sort order for Admin Events List', 'my-calendar'), array('1' => __('Event ID', 'my-calendar'), '2' => __('Title', 'my-calendar'), '3' => __('Description', 'my-calendar'), '4' => __('Start Date', 'my-calendar'), '5' => __('Author', 'my-calendar'), '6' => __('Category', 'my-calendar'), '7' => __('Location Name', 'my-calendar')), '', array(), 'select');
        ?>
</li>
								<li><?php 
        mc_settings_field('mc_default_direction', __('Sort direction', 'my-calendar'), array('ASC' => __('Ascending', 'my-calendar'), 'DESC' => __('Descending', 'my-calendar')), '', array(), 'select');
        ?>
</li>										
								<?php 
        if (get_site_option('mc_multisite') == 2 && my_calendar_table() != my_calendar_table('global')) {
            mc_settings_field('mc_current_table', array('0' => __('Currently editing my local calendar', 'my-calendar'), '1' => __('Currently editing the network calendar', 'my-calendar')), '0', '', array(), 'radio');
        } else {
            if (get_option('mc_remote') != 'true' && current_user_can('manage_network') && is_multisite()) {
                ?>
										<li><?php 
                _e('You are currently working in the primary site for this network; your local calendar is also the global table.', 'my-calendar');
                ?>
</li><?php 
            }
        }
        ?>
								<li><?php 
        mc_settings_field('remigrate', __('Re-generate event occurrences table.', 'my-calendar'), '', '', array(), 'checkbox-single');
        ?>
</li>
							</ul>
						</fieldset>
						<p>
							<input type="submit" name="mc_manage" class="button-primary"
							       value="<?php 
        _e('Save Management Settings', 'my-calendar');
        ?>
"/>
						</p>
					</form>
				<?php 
    } else {
        ?>
					<?php 
        _e('My Calendar management settings are only available to administrators.', 'my-calendar');
        ?>
				<?php 
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:my-calendar-settings.php


注:本文中的my_calendar_table函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。