Exemplo n.º 1
0
 function add_category_defaults($ids, $ids_array, $items)
 {
     global $wpdb, $table_prefix;
     $sql = sprintf("select category_id from %sgdsr_data_category where category_id in %s", $table_prefix, $ids);
     $cats = array();
     $rows = $wpdb->get_results($sql, ARRAY_N);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             $cats[] = $row[0];
         }
     }
     if (is_array($cats)) {
         foreach ($ids_array as $id) {
             if (!in_array($id, $cats)) {
                 GDSRDatabase::add_category_default($id, $items[$id] > 0);
             }
         }
     }
 }
Exemplo n.º 2
0
 function add_category_defaults($ids, $ids_array)
 {
     global $wpdb, $table_prefix;
     $rows = $wpdb->get_results(sprintf("select category_id from %sgdsr_data_category where category_id in %s", $table_prefix, $ids), ARRAY_N);
     if (count($rows) == 0) {
         $rows = array();
     }
     foreach ($ids_array as $id) {
         if (!in_array($id, $rows)) {
             GDSRDatabase::add_category_default($id);
         }
     }
 }