function get_active_contest_ajax_controller() { $userkey = get_option('api_user_key'); $contest_type = $_GET['contest_type']; $page = get_query_var('pages'); $post_per_page = $_GET['pageSize']; $page = $_GET['pageIndex']; $sortColumn = $_GET['sortColumn']; $sortOrder = $_GET['sortOrder']; $contest_list = get_active_contests_ajax($userkey, $contest_type, $page, $post_per_page, $sortColumn, $sortOrder); if ($contest_list->data != null) { echo json_encode($contest_list->data); } die; }
<div class="sideMostRecentChallenges"> <h3>Most Recent Challenges</h3> <?php $recentDesign = get_active_contests_ajax('', 'design', 1, 1); $recentDesign = $recentDesign->data[0]; $recentDev = get_active_contests_ajax('', 'develop', 1, 1); $recentDev = $recentDev->data[0]; $recentData = get_active_contests_ajax('', 'data/marathan'); $recentData = $recentData->data[0]; $chLink = get_page_link_by_slug('challenge-details'); ?> <ul> <li><a class="contestName contestType1" href="<?php echo $chLink . $recentDev->challengeId; ?> "> <i></i><?php echo $recentDev->challengeName; ?> </a></li> <li class="alt"><a class="contestName contestType2" href="<?php echo $chLink . $recentDesign->challengeId; ?> /?type=design"> <i></i><?php echo $recentDesign->challengeName; ?> </a></li> </ul> </div>
/** * Legacy code only for backward compatibility */ function get_active_contest_ajax_controller() { $userkey = get_option('api_user_key'); $contest_type = $_GET['contest_type']; $page = get_query_var('pages'); $post_per_page = $_GET['pageSize']; $page = $_GET['pageIndex']; $sortColumn = $_GET['sortColumn']; $sortOrder = $_GET['sortOrder']; $contest_list = get_active_contests_ajax($userkey, $contest_type, $page, $post_per_page, $sortColumn, $sortOrder); if (isset($contest_list->data)) { wp_send_json($contest_list->data); } else { wp_send_json_error(); } }
function widget($args, $instance) { extract($args); /* Before widget (defined by themes). */ echo $before_widget; $displayedTitle = "Most Recent Challenges"; /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { $displayedTitle = $before_title . $title . $after_title; } ?> <div class="sideMostRecentChallenges"> <h3><?php echo $displayedTitle; ?> </h3> <?php $recentDesign = get_active_contests_ajax('', 'design', 1, 1); $recentDesign = $recentDesign->data[0]; $recentDev = get_active_contests_ajax('', 'develop', 1, 1); $recentDev = $recentDev->data[0]; $recentData = get_active_contests_ajax('', 'data/marathan'); $recentData = $recentData->data[0]; $chLink = get_page_link_by_slug('challenge-details'); ?> <ul> <li><a class="contestName contestType1" href="<?php echo $chLink . $recentDev->challengeId; ?> "> <i></i><?php echo $recentDev->challengeName; ?> </a></li> <li class="alt"><a class="contestName contestType2" href="<?php echo $chLink . $recentDesign->challengeId; ?> /?type=design"> <i></i><?php echo $recentDesign->challengeName; ?> </a></li> </ul> </div> <?php echo $after_widget; }