Exemple #1
0
 /**
  * Do query
  *
  * @since 1.1.0
  *
  * @access protected
  *
  * @param $wpdb
  * @param $sql
  *
  * @return array
  */
 protected static function query($wpdb, $sql)
 {
     $results = $wpdb->get_results($sql, ARRAY_A);
     if (is_array($results)) {
         return group::bulk_results($results);
     }
     return [];
 }
Exemple #2
0
 /**
  * Get all destination tests
  *
  * @since 1.1.0
  *
  * @param bool $ids Optional. If true, the ID of found groups is returned. If false, full group configs are returned
  *
  * @return array|null|object
  */
 public static function get_destination_tests($ids = true)
 {
     global $wpdb;
     if ($ids) {
         $select = '`ID`';
     } else {
         $select = '*';
     }
     $tablename = group::get_table_name();
     $sql = sprintf("SELECT %s FROM `%s` WHERE `type` = 'click' AND `sub_type` = 'destination'", $select, $tablename);
     $results = $wpdb->get_results($sql, ARRAY_A);
     if (!empty($results)) {
         if ($ids) {
             $results = wp_list_pluck($results, 'ID');
         } else {
             $results = group::bulk_results($results);
         }
     }
     return $results;
 }