| @@ -63,15 +63,9 @@ | ||
| 63 | 63 | * |
| 64 | 64 | */ |
| 65 | 65 | public function __toString() |
| 66 | 66 | { |
| 67 | - # In case of Error at $this->makeBlocksQuery dont processed | |
| 68 | - if ( $this->blocksQuery === FALSE ) | |
| 69 | - { | |
| 70 | - return ''; | |
| 71 | - } | |
| 72 | - | |
| 73 | - | |
| 67 | + | |
| 74 | 68 | $filters = $this->query->filter; |
| 75 | 69 | $customPins = $this->customPins; |
| 76 | 70 | |
| 77 | 71 | $customPins = implode( ' OR ', $customPins ); |
| @@ -100,18 +94,10 @@ | ||
| 100 | 94 | */ |
| 101 | 95 | public function exec() |
| 102 | 96 | { |
| 103 | 97 | |
| 104 | - $blocks = array(); | |
| 105 | - $query = ( string ) $this; | |
| 106 | - | |
| 107 | - # It will return empty query, in case of error | |
| 108 | - if ( $query ) | |
| 109 | - { | |
| 110 | - # Note: OBJECT_K get unique blocks as they will override each others | |
| 111 | - $blocks = $this->driver->select( $query, OBJECT_K ); | |
| 112 | - } | |
| 113 | - | |
| 98 | + # Note: OBJECT_K get unique blocks as they will override each others | |
| 99 | + $blocks = $this->driver->select( $this, OBJECT_K ); | |
| 114 | 100 | |
| 115 | 101 | return $blocks; |
| 116 | 102 | } |
| 117 | 103 | |
| @@ -173,29 +159,12 @@ | ||
| 173 | 159 | |
| 174 | 160 | // build custom pins filter. |
| 175 | 161 | $customPins = array(); |
| 176 | 162 | |
| 177 | - global $wp_query; | |
| 178 | - | |
| 179 | 163 | foreach ( $filters->customPins as $pinFilter ) |
| 180 | 164 | { |
| 181 | - | |
| 182 | 165 | $pinFilter = (object) $pinFilter; |
| 183 | 166 | $pins = implode( ',', $pinFilter->pins ); |
| 184 | - | |
| 185 | - // Scan Pins, sometime if happened to be empty | |
| 186 | - // The Wordpress request that carry $pins to be empty is not yet | |
| 187 | - // known, we simply now need to discard that request | |
| 188 | - // as user's server error log file filled with this error | |
| 189 | - // and users complains about it all the time | |
| 190 | - if ( ! $pins ) | |
| 191 | - { | |
| 192 | - | |
| 193 | - $this->blocksQuery = FALSE; | |
| 194 | - | |
| 195 | - return $this; | |
| 196 | - } | |
| 197 | - | |
| 198 | 167 | $customPins[ ] = "( ( blocks.`pinPoint` & {$pinFilter->flag} ) AND ( pins.pin = '{$pinFilter->pin}' ) AND ( pins.`value` IN ( {$pins} ) ) )"; |
| 199 | 168 | } |
| 200 | 169 | |
| 201 | 170 | $this->customPins = $customPins; |