GetTable() . ' WHERE occurrence_id IN (' . implode( ',', $occurence_ids ) . ')'; // Execute query. parent::DeleteQuery( $sql ); } } /** * Load metadata by name and occurrence_id. * * @param string $meta_name - Metadata name. * @param string $occurence_id - Metadata occurrence_id. * @return \WSAL\MainWPExtension\Adapters\MySQL\Meta[] */ public function LoadByNameAndOccurenceId( $meta_name, $occurence_id ) { return $this->Load( 'occurrence_id = %d AND name = %s', array( $occurence_id, $meta_name ) ); } /** * Get distinct values of IPs. * * @param int $limit - (Optional) Limit. * @return array - Distinct values of IPs. */ public function GetMatchingIPs( $limit = null ) { $_wpdb = $this->connection; $sql = "SELECT DISTINCT value FROM {$this->GetTable()} WHERE name = \"ClientIP\""; if ( ! is_null( $limit ) ) { $sql .= ' LIMIT ' . $limit; } $ips = $_wpdb->get_col( $sql ); foreach ( $ips as $key => $ip ) { $ips[ $key ] = str_replace( '"', '', $ip ); } return array_unique( $ips ); } }