Beispiel #1
0
function dpProEventCalendar_getWeekly()
{
    $nonce = $_POST['postEventsNonce'];
    //if ( ! wp_verify_nonce( $nonce, 'ajax-get-events-nonce' ) )
    //    die ( 'Busted!');
    if (!is_numeric($_POST['date'])) {
        die;
    }
    $timestamp = $_POST['date'];
    $currDate = date("Y-m-d", $timestamp);
    $calendar = $_POST['calendar'];
    $is_admin = $_POST['is_admin'];
    $category = $_POST['category'];
    $event_id = $_POST['event_id'];
    $author = $_POST['author'];
    if ($is_admin && strtolower($is_admin) !== "false") {
        $is_admin = true;
    } else {
        $is_admin = false;
    }
    require_once 'classes/base.class.php';
    $dpProEventCalendar = new DpProEventCalendar($is_admin, $calendar, $timestamp, null, '', $category, $event_id, $author);
    if ($dpProEventCalendar->calendar_obj->first_day == 1) {
        $weekly_first_date = strtotime('last monday', $timestamp + 24 * 60 * 60);
        $weekly_last_date = strtotime('next sunday', $timestamp - 24 * 60 * 60);
    } else {
        $weekly_first_date = strtotime('last sunday', $timestamp + 24 * 60 * 60);
        $weekly_last_date = strtotime('next saturday', $timestamp - 24 * 60 * 60);
    }
    $weekly_txt = date_i18n('d F', $weekly_first_date) . ' - ' . date_i18n('d F, Y', $weekly_last_date);
    if (date('m', $weekly_first_date) == date('m', $weekly_last_date)) {
        $weekly_txt = date('d', $weekly_first_date) . ' - ' . date('d F, Y', $weekly_last_date);
    }
    if (date('Y', $weekly_first_date) != date('Y', $weekly_last_date)) {
        $weekly_txt = date_i18n(get_option('date_format'), $weekly_first_date) . ' - ' . date_i18n(get_option('date_format'), $weekly_last_date);
    }
    echo "<!--" . $weekly_txt . ">!]-->";
    die($dpProEventCalendar->weeklyCalendarLayout());
}