Esempio n. 1
0
 protected function get_ad_info($ad_id)
 {
     global $wpdb, $hasextrafieldsmodule;
     $fields = array('ad_id', 'user_id', 'adterm_id', 'ad_title', 'ad_contact_name', 'ad_contact_email', 'ad_category_id', 'ad_contact_phone', 'ad_item_price', 'ad_details', 'websiteurl', 'ad_startdate', 'ad_enddate', 'ad_key');
     if ($hasextrafieldsmodule) {
         foreach (x_fields_fetch_fields() as $field) {
             $fields[] = "`{$field}` AS `awpcp-{$field}`";
         }
     }
     $query = "SELECT " . join(', ', $fields) . " ";
     $query .= "FROM " . AWPCP_TABLE_ADS . " ";
     $query .= "WHERE ad_id=%d";
     $data = $wpdb->get_row($wpdb->prepare($query, (int) $ad_id), ARRAY_A);
     if (get_awpcp_option('allowhtmlinadtext')) {
         $data['ad_details'] = awpcp_esc_textarea($data['ad_details']);
     }
     // please note we are dividing the Ad price by 100
     // Ad prices have been historically stored in cents
     $data['ad_category'] = $data['ad_category_id'];
     $data['ad_item_price'] = $data['ad_item_price'] / 100;
     $data['start_date'] = $data['ad_startdate'];
     $data['end_date'] = $data['ad_enddate'];
     $data['regions'] = AWPCP_Ad::get_ad_regions($ad_id);
     return $data;
 }