Example #1
0
 /**
  * Displays notices.
  *
  * @return void
  */
 function notices()
 {
     $post = get_queried_object();
     if ($post->post_status == 'pending') {
         if (cp_have_pending_payment($post->ID)) {
             appthemes_display_notice('warning', __('This ad listing is currently pending and awaiting payment.', APP_TD));
         } else {
             appthemes_display_notice('warning', __('This ad listing is currently pending and must be approved by an administrator.', APP_TD));
         }
     } else {
         if ($post->post_status == 'draft') {
             $expire_time = strtotime(get_post_meta($post->ID, 'cp_sys_expire_date', true));
             if (current_time('timestamp') > $expire_time) {
                 appthemes_display_notice('success', __('This ad listing is expired.', APP_TD));
             } else {
                 appthemes_display_notice('success', __('This ad listing is paused.', APP_TD));
             }
         }
     }
     parent::notices();
 }
     $ad_views = number_format(get_post_meta($post->ID, 'cp_total_count', true));
 } else {
     $ad_views = '-';
 }
 // now let's figure out what the ad status and options should be
 // it's a live and published ad
 if ($post->post_status == 'publish') {
     $post_status = 'live';
     $post_status_name = __('Live Until', APP_TD) . '<br /><p class="small">(' . $expire_date . ')</p>';
     $fontcolor = '#33CC33';
     $postimage = 'pause.png';
     $postalt = __('Pause Ad', APP_TD);
     $postaction = 'pause';
     // it's a pending ad which gives us several possibilities
 } elseif ($post->post_status == 'pending') {
     if (cp_have_pending_payment($post->ID)) {
         $post_status = 'pending_payment';
         $post_status_name = __('Awaiting payment', APP_TD);
         $fontcolor = '#C00202';
         $postimage = '';
         $postalt = '';
         $postaction = 'pending';
     } else {
         $post_status = 'pending';
         $post_status_name = __('Awaiting approval', APP_TD);
         $fontcolor = '#C00202';
         $postimage = '';
         $postalt = '';
         $postaction = 'pending';
     }
 } elseif ($post->post_status == 'draft') {
Example #3
0
/**
 * Returns ad listing status name.
 *
 * @param int $listing_id (optional)
 *
 * @return string
 */
function cp_get_listing_status_name($listing_id = 0)
{
    global $cp_options;
    $listing_id = $listing_id ? $listing_id : get_the_ID();
    $listing = get_post($listing_id);
    if (cp_is_listing_expired($listing->ID)) {
        if ($listing->post_status == 'publish' && !$cp_options->post_prune) {
            return 'live_expired';
        } else {
            return 'ended';
        }
    } else {
        if ($listing->post_status == 'draft') {
            return 'offline';
        } else {
            if ($listing->post_status == 'pending') {
                if (cp_have_pending_payment($listing->ID)) {
                    return 'pending_payment';
                } else {
                    return 'pending_moderation';
                }
            }
        }
    }
    return 'live';
}