Exemplo n.º 1
0
 /**
  * Build the sql query.
  *
  * @since 1.0
  *
  * @return string
  */
 protected function build_sql()
 {
     $builder = new Builder();
     $select = $this->parse_select();
     $from = new From($this->table->get_table_name($GLOBALS['wpdb']), 'q');
     $where = new Where(1, true, 1);
     if (($activation = $this->parse_activation()) !== null) {
         $where->qAnd($activation);
     }
     if (($release = $this->parse_release()) !== null) {
         $where->qAnd($release);
     }
     if (($update_date = $this->parse_update_date()) !== null) {
         $where->qAnd($update_date);
     }
     $order = $this->parse_order();
     $limit = $this->parse_pagination();
     $builder->append($select)->append($from);
     $builder->append($where);
     $builder->append($order);
     if ($limit !== null) {
         $builder->append($limit);
     }
     return $builder->build();
 }
 /**
  * Build the sql query.
  *
  * @since 1.0
  *
  * @return string
  */
 protected function build_sql()
 {
     $builder = new Builder();
     $select = $this->parse_select();
     $from = new From($this->table->get_table_name($GLOBALS['wpdb']), 'q');
     $where = new Where(1, true, 1);
     if (($key = $this->parse_key()) !== null) {
         $where->qAnd($key);
     }
     if (($location = $this->parse_location()) !== null) {
         $where->qAnd($location);
     }
     if (($location_search = $this->parse_location_search()) !== null) {
         $where->qAnd($location_search);
     }
     if (($status = $this->parse_status()) !== null) {
         $where->qAnd($status);
     }
     if (($activation = $this->parse_activation()) !== null) {
         $where->qAnd($activation);
     }
     if (($deactivation = $this->parse_deactivation()) !== null) {
         $where->qAnd($deactivation);
     }
     if (($release = $this->parse_release()) !== null) {
         $where->qAnd($release);
     }
     $order = $this->parse_order();
     $limit = $this->parse_pagination();
     $builder->append($select)->append($from);
     if (($join = $this->parse_join()) !== null) {
         $builder->append($join);
     }
     $builder->append($where);
     $builder->append($order);
     if ($limit !== null) {
         $builder->append($limit);
     }
     return $builder->build();
 }
Exemplo n.º 3
0
 /**
  * Build the sql query.
  *
  * @since 1.0
  *
  * @return string
  */
 protected function build_sql()
 {
     $builder = new Builder();
     $select = $this->parse_select();
     $from = new From($this->table->get_table_name($GLOBALS['wpdb']), 'q');
     $where = new Where(1, true, 1);
     if (($product = $this->parse_product()) !== null) {
         $where->qAnd($product);
     }
     if (($download = $this->parse_download()) !== null) {
         $where->qAnd($download);
     }
     if (($status = $this->parse_status()) !== null) {
         $where->qAnd($status);
     }
     if (($type = $this->parse_type()) !== null) {
         $where->qAnd($type);
     }
     if (($version = $this->parse_version()) !== null) {
         $where->qAnd($version);
     }
     if (($version_search = $this->parse_version_search()) !== null) {
         $where->qAnd($version_search);
     }
     if (($changelog_search = $this->parse_changelog_search()) !== null) {
         $where->qAnd($changelog_search);
     }
     if (($start_date = $this->parse_start_date()) !== null) {
         $where->qAnd($start_date);
     }
     $order = $this->parse_order();
     $limit = $this->parse_pagination();
     $builder->append($select)->append($from);
     $builder->append($where);
     $builder->append($order);
     if ($limit !== null) {
         $builder->append($limit);
     }
     return $builder->build();
 }
Exemplo n.º 4
0
 /**
  * Parse the search query.
  *
  * @since 1.0
  *
  * @return Join|null
  */
 protected function parse_customer_search()
 {
     if (empty($this->args['customer_search']) || empty($this->args['customer_search_columns'])) {
         return null;
     }
     $clause = esc_sql($this->args['customer_search']);
     $search_ids = new Where_Raw('u.ID = q.customer');
     $white_list = $this->get_default_arg('customer_search_columns');
     foreach ((array) $this->args['customer_search_columns'] as $column) {
         if (!in_array($column, $white_list)) {
             throw new \InvalidArgumentException("Invalid customer_search_column {$column}.");
         }
         if (!isset($search_where)) {
             $search_where = new Where("u.{$column}", 'LIKE', $clause);
         } else {
             /**
              * @var Where $search_where
              */
             $search_where->qOr(new Where("u.{$column}", 'LIKE', $clause));
         }
     }
     if (!isset($search_where)) {
         return null;
     }
     $search_ids->qAnd($search_where);
     return new Join(new From($GLOBALS['wpdb']->users, 'u'), $search_ids);
 }