1 | <?php |
||
11 | class QueryBuilder extends BaseBuilder |
||
12 | { |
||
13 | /** |
||
14 | * WP_Query instance |
||
15 | * |
||
16 | * @var WP_Query |
||
17 | */ |
||
18 | protected $query; |
||
19 | |||
20 | /** |
||
21 | * Builder constructor. |
||
22 | * |
||
23 | * @param WP_Query $query |
||
24 | */ |
||
25 | public function __construct(WP_Query $query = null) |
||
33 | |||
34 | /** |
||
35 | * Create a new instance. |
||
36 | * |
||
37 | * @param WP_Query $query |
||
38 | * |
||
39 | * @return static |
||
40 | */ |
||
41 | public static function make(WP_Query $query = null) |
||
45 | |||
46 | /** |
||
47 | * Limit the number of returned results |
||
48 | * |
||
49 | * @param integer $limit The maximum number of results to return |
||
50 | * use -1 for no limit |
||
51 | * |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function limit($limit) |
||
58 | |||
59 | /** |
||
60 | * Return an unlimited number of results. |
||
61 | * |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function all() |
||
68 | |||
69 | /** |
||
70 | * Set the order for the query |
||
71 | * |
||
72 | * @param string $order |
||
73 | * |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function order($order) |
||
80 | |||
81 | /** |
||
82 | * Query by post status |
||
83 | * |
||
84 | * @param string|array $status the post status or stati to match |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function whereStatus($status) |
||
92 | |||
93 | /** |
||
94 | * Query by slug |
||
95 | * |
||
96 | * @param string $slug the post slug to query by |
||
97 | * |
||
98 | * @return $this |
||
99 | */ |
||
100 | public function whereSlug($slug) |
||
104 | |||
105 | /** |
||
106 | * Set a query variable on the query |
||
107 | * |
||
108 | * @param string $var Query variable key |
||
109 | * @param mixed $value Query value for key |
||
110 | * |
||
111 | * @return $this |
||
112 | */ |
||
113 | public function set($var, $value) |
||
119 | |||
120 | /** |
||
121 | * Execute the query and return the raw results. |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | protected function query() |
||
134 | } |
||
135 |