Exemplo n.º 1
0
 /**
  *  Converts WP_Query object into array and imports additional lead data
  *
  *  @param OBJECT $results WP_Query results
  *  @return ARRAY $leads updated array of results
  */
 public static function prepare_lead_results($results)
 {
     if (!$results->have_posts()) {
         return null;
     }
     $leads = array();
     $leads['results_count'] = $results->found_posts;
     $leads['results_per_page'] = self::get_results_per_page();
     $leads['max_pages'] = $results->max_num_pages;
     while ($results->have_posts()) {
         $results->the_post();
         $ID = $results->post->ID;
         /* set ID */
         $leads['results'][$ID]['ID'] = $ID;
         /* set lead lists */
         $lists = get_the_terms($ID, 'wplead_list_category');
         $leads['results'][$ID]['lists'] = $lists;
         /* set lead tags */
         $tags = get_the_terms($ID, 'lead-tags');
         $leads['results'][$ID]['tags'] = $tags;
         /* set lead meta data */
         $meta_data = get_post_custom($ID);
         $leads['results'][$ID]['meta_data'] = $meta_data;
     }
     return $leads;
 }
Exemplo n.º 2
0
 /**
  * 删除
  */
 public function delete()
 {
     $this->checkPermission($this->rankId . '03');
     //检测权限
     $ids = $this->input->get_post('params');
     //'2,3,4,5,6,7,8';
     if (empty($ids)) {
         $ids = $this->getData('id');
     }
     $status = $this->bindModel->deletes($ids);
     if ($status) {
         $msg = "删除成功";
     } else {
         $msg = "删除失败";
     }
     $this->echoAjax(0, $msg);
 }