diff --git a/CHANGELOG.md b/CHANGELOG.md index af646b8..3e667cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Version [2.0.11] + +### Fix + +- Meta-query with multiple arguments not working correctly. + ## Version [2.0.10] ### Feat diff --git a/openpub-base.php b/openpub-base.php index 7e11ca9..39a1f45 100644 --- a/openpub-base.php +++ b/openpub-base.php @@ -4,7 +4,7 @@ * Plugin Name: Yard | OpenPub Base * Plugin URI: https://www.openwebconcept.nl/ * Description: Acts as foundation for other OpenPub related content plugins. This plugin implements actions to allow for other plugins to add and/or change Custom Posttypes, Metaboxes, Taxonomies, en Posts 2 posts relations. - * Version: 2.0.10 + * Version: 2.0.11 * Author: Yard | Digital Agency * Author URI: https://www.yard.nl/ * License: GPL-3.0 diff --git a/src/Base/Admin/AdminServiceProvider.php b/src/Base/Admin/AdminServiceProvider.php index 99c67fc..6bb06b0 100644 --- a/src/Base/Admin/AdminServiceProvider.php +++ b/src/Base/Admin/AdminServiceProvider.php @@ -20,7 +20,7 @@ public function register() public function filterPostLink($link, \WP_Post $post): string { $itemModel = Item::makeFrom($post); - $url = $itemModel->getPortalURL(); + $url = $itemModel->getPortalURL(); return $url . "?preview=true"; } @@ -30,7 +30,7 @@ public function filterPostLink($link, \WP_Post $post): string */ public function restPrepareResponseLink(\WP_REST_Response $response, \WP_Post $post): \WP_REST_Response { - $itemModel = Item::makeFrom($post); + $itemModel = Item::makeFrom($post); $response->data['link'] = $itemModel->getPortalURL() ?? ''; return $response; diff --git a/src/Base/Foundation/Plugin.php b/src/Base/Foundation/Plugin.php index 3ac7783..09bab1a 100644 --- a/src/Base/Foundation/Plugin.php +++ b/src/Base/Foundation/Plugin.php @@ -25,7 +25,7 @@ class Plugin * * @var string VERSION */ - const VERSION = '2.0.10'; + const VERSION = '2.0.11'; /** * Path to the root of the plugin. diff --git a/src/Base/Repositories/Item.php b/src/Base/Repositories/Item.php index bd8fe25..a07f428 100644 --- a/src/Base/Repositories/Item.php +++ b/src/Base/Repositories/Item.php @@ -8,16 +8,6 @@ class Item extends AbstractRepository protected static $globalFields = []; - /** - * Add additional query arguments. - */ - public function query(array $args): AbstractRepository - { - $this->queryArgs = array_merge($this->queryArgs, $args); - - return $this; - } - /** * Add parameters to meta_query to remove items with expired date. * @@ -31,17 +21,19 @@ public static function addExpirationParameters(): array return [ 'meta_query' => [ - 'relation' => 'OR', - [ - 'key' => '_owc_openpub_expirationdate', - 'value' => $dateNow, - 'compare' => '>=', - 'type' => 'DATETIME', - ], [ - 'key' => '_owc_openpub_expirationdate', - 'compare' => 'NOT EXISTS', - ], + 'relation' => 'OR', + [ + 'key' => '_owc_openpub_expirationdate', + 'value' => $dateNow, + 'compare' => '>=', + 'type' => 'DATETIME', + ], + [ + 'key' => '_owc_openpub_expirationdate', + 'compare' => 'NOT EXISTS', + ], + ] ], ]; } @@ -58,10 +50,12 @@ public static function addHighlightedParameters(bool $highlighted): array return [ 'meta_query' => [ [ - 'key' => '_owc_openpub_highlighted_item', - 'value' => $highlighted ? 1 : 0, - 'compare' => '=', - ], + [ + 'key' => '_owc_openpub_highlighted_item', + 'value' => $highlighted ? 1 : 0, + 'compare' => '=', + ], + ] ], ]; } diff --git a/src/Base/Varnish/VarnishServiceProvider.php b/src/Base/Varnish/VarnishServiceProvider.php index 83c457c..79cb020 100644 --- a/src/Base/Varnish/VarnishServiceProvider.php +++ b/src/Base/Varnish/VarnishServiceProvider.php @@ -13,7 +13,7 @@ public function register(): void public function purgeVarnishCache(int $postID, \WP_Post $post): void { - if ( ! function_exists('curl_init')){ + if (! function_exists('curl_init')) { return; } @@ -23,7 +23,7 @@ public function purgeVarnishCache(int $postID, \WP_Post $post): void curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PURGE'); - $headers = []; + $headers = []; $headers[] = 'Host: '. \parse_url(get_site_url(), PHP_URL_HOST); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);