From 39e3c720f12138189d42ad7eea8b1fab2dc8d713 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Tue, 1 Sep 2020 11:44:28 -0400 Subject: [PATCH 01/38] updates for nuxt js --- includes/elasticsearch/class-client.php | 72 +++++++++++++++++++++++++ includes/elasticsearch/functions.php | 20 +++++++ 2 files changed, 92 insertions(+) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index dd42cec..8d8688c 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -125,6 +125,78 @@ public static function find( $id, $index ) { } } + public static function get_pages() { + $index_name = self::read_index_alias( '*' ); + $response = self::client()->search( + array( + 'index' => $index_name, + 'size' => 10000, + 'body' => array( + 'query' => array( + 'bool' => array( + 'must' => array( + array( + 'exists' => array( + 'field' => 'url' + ) + ), + array( + 'term' => array( + 'post_status.keyword' => 'publish' + ) + ) + ), + 'must_not' => array( + 'exists' => array( + 'field' => 'taxonomy' + ) + ) + ) + ) + ) + ) + ); + $results = $response['hits']['hits']; + return $results; + } + + public static function find_by_url( $input ) { + $index_name = self::read_index_alias( '*' ); + + $record = null; + $urls = array( + "$input/", + $input + ); + foreach ($urls as $url) { + $results = self::client()->search( + array( + 'index' => $index_name, + 'body' => array( + 'query' => array( + 'term' => array( + 'url.keyword' => $url + ) + ) + ), + 'size' => 1 + ) + ); + + if ($record = $results['hits']['hits'][0]) break; + } + return $record; + } + +// private_class_method def self.term_filter(terms) +// { +// query: { +// # Add .keyword to field name for exact matching +// term: terms.transform_keys { |key| "#{key}.keyword" } +// } +// } +// end + /** * Builds a where query for Elasticsearch * diff --git a/includes/elasticsearch/functions.php b/includes/elasticsearch/functions.php index 15ce0bb..8be0a4c 100644 --- a/includes/elasticsearch/functions.php +++ b/includes/elasticsearch/functions.php @@ -51,3 +51,23 @@ function elasticsearch_where( $index_name, $params = array() ) { function elasticsearch_delete_where( $index_name, $params = array() ) { return Client::delete_where( $index_name, $params ); } + +/** + * Delete values from Elasticsearch by query params + * + * @param string $index_name The index identifier. + * @param Array $params Query array of parameters. + */ +function elasticsearch_find_by_url( $url ) { + return Client::find_by_url( $url ); +} + +/** + * Delete values from Elasticsearch by query params + * + * @param string $index_name The index identifier. + * @param Array $params Query array of parameters. + */ +function elasticsearch_get_pages() { + return Client::get_pages(); +} From e0afa010c7e8b4610384635633895ba077359f44 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Tue, 1 Sep 2020 17:03:48 -0400 Subject: [PATCH 02/38] more updates for nuxt --- includes/elasticsearch/class-client.php | 13 +++++++++++++ includes/elasticsearch/functions.php | 10 ++++++++++ includes/storage.php | 11 ++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index 8d8688c..787e89d 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -160,6 +160,19 @@ public static function get_pages() { return $results; } + public static function all( $index = '*' ) { + $index_name = self::read_index_alias( $index ); + $response = self::client()->search( + array( + 'index' => $index_name, + 'size' => 10000, + 'body' => array() + ) + ); + $results = $response['hits']['hits']; + return $results; + } + public static function find_by_url( $input ) { $index_name = self::read_index_alias( '*' ); diff --git a/includes/elasticsearch/functions.php b/includes/elasticsearch/functions.php index 8be0a4c..41dbea6 100644 --- a/includes/elasticsearch/functions.php +++ b/includes/elasticsearch/functions.php @@ -42,6 +42,16 @@ function elasticsearch_where( $index_name, $params = array() ) { return Client::where( $index_name, $params ); } +/** + * Retrieve values from Elasticsearch by query params + * + * @param string $index_name The index identifier. + * @param Array $params Query array of parameters. + */ +function elasticsearch_all( $index_name = '*' ) { + return Client::all( $index_name ); +} + /** * Delete values from Elasticsearch by query params * diff --git a/includes/storage.php b/includes/storage.php index 26a35ae..b2d33ec 100644 --- a/includes/storage.php +++ b/includes/storage.php @@ -39,11 +39,12 @@ function store_post( $post ) { * @param WP_Term $menu The menu (term) object. */ function store_menu( $menu ) { - $key = $menu->slug . '_nav'; - $items = wp_get_nav_menu_items( $menu->name ); - $data = array_map( 'ElasticPress\Serializers\nav_map', $items ); - $type = $menu->taxonomy; - ElasticSearch\elasticsearch_store( $key, $type, array( 'menu_items' => $data ) ); + $key = $menu->slug . '_nav'; + $items = wp_get_nav_menu_items( $menu->name ); + $data = term_data( $menu ); + $data['menu_items'] = array_map( 'ElasticPress\Serializers\nav_map', $items ); + $type = $menu->taxonomy; + ElasticSearch\elasticsearch_store( $key, $type, $data ); } /** From 7fc67df80c2b8b87be312ed58d5786abe3214aeb Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 2 Sep 2020 09:16:04 -0400 Subject: [PATCH 03/38] more updates --- includes/utils/fields.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/utils/fields.php b/includes/utils/fields.php index 5a10633..2553f56 100644 --- a/includes/utils/fields.php +++ b/includes/utils/fields.php @@ -108,11 +108,16 @@ function register_fields() { } if ( isset( $config['config']['group'] ) ) { + if ( isset( $config['config']['location'] ) ) { + $location = $config['config']['location']; + } else { + $location = []; + } register_group( $type, $config['config']['group'], $config['config']['fields'], - $config['config']['location'] + $location ); } From a9303f2f9f622a0d45698ab07a1c190b7a395064 Mon Sep 17 00:00:00 2001 From: James Gavin Holt Date: Thu, 10 Sep 2020 08:03:12 -0400 Subject: [PATCH 04/38] - adding filter to skip indexing if needed --- includes/wp-save-hooks.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/wp-save-hooks.php b/includes/wp-save-hooks.php index 4566d06..dcde9aa 100644 --- a/includes/wp-save-hooks.php +++ b/includes/wp-save-hooks.php @@ -25,8 +25,11 @@ * @param boolean $update Whether the post updated or not. */ function wp_insert_post( $id, $obj, $update ) { + + $filtered_object = apply_filters('ep_skip_indexing', $obj); + // Skip ACF internals. - if ( ! $update || strpos( $obj->post_type, 'acf-' ) === 0 ) { + if ($filtered_object->skip_indexing || ! $update || strpos( $obj->post_type, 'acf-' ) === 0 ) { return; } From cd528ea2c8a0dc02d37de6476625e9294ce00866 Mon Sep 17 00:00:00 2001 From: James Gavin Holt Date: Thu, 10 Sep 2020 08:03:45 -0400 Subject: [PATCH 05/38] =?UTF-8?q?-=20trying=20a=20test=20=C2=AF\=5F(?= =?UTF-8?q?=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test-wp-save-hooks.php | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index b08100e..0b7c355 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -96,4 +96,42 @@ public function test_wp_update_nav_menu() { $this->assertEquals( $found['menu_items'][0]['url'], 'http://test.com' ); } + /** + * Test ep_skip_indexing filter + */ + public function test_ep_skip_indexing_filter() { + $post_content = array( + 'post_title' => 'This will be indexed', + 'post_type' => 'post' + ); + $skip_post_content = array( + 'post_title' => 'This will not be indexed', + 'post_type' => 'skip_post' + ); + + add_filter('ep_skip_indexing', function($object) { + $skip_indexing = array( + 'skip_post' + ); + if (in_array($object->post_type, $skip_indexing)) { + $object->skip_indexing = true; + } + return $object; + }, 10, 2); + + $post = $this->factory->post->create_and_get( $post_content ); + do_action( 'wp_insert_post', $post->ID, $post, true ); + + $skip_post = $this->factory->post->create_and_get( $skip_post_content ); + do_action( 'wp_insert_post', $skip_post->ID, $skip_post, true ); + + ElasticSearch\Client::update_read_aliases(); + $found_post = elasticsearch_find( $post->ID, 'post' ); + $this->assertEquals( $found_post['post_title'], 'This will be indexed' ); + + $skip_post_exists = get_post( $skip_post->ID); + // $skip_post_is_not_indexed = elasticsearch_find( $skip_post->ID, 'do_not_index' ); + $this->assertEquals( $skip_exists['post_title'], 'This will not be indexed' ); + // $this->assertEquals( $skip_is_not_indexed, 'This will not be indexed' ); + } } From c312fd502a818bb24a907e9277d2cb1d6b41fdfe Mon Sep 17 00:00:00 2001 From: James Gavin Holt Date: Thu, 10 Sep 2020 08:15:48 -0400 Subject: [PATCH 06/38] - lets make this more generic as the filter will allow you to alter the object in anyway - rename in test --- includes/wp-save-hooks.php | 2 +- tests/test-wp-save-hooks.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/wp-save-hooks.php b/includes/wp-save-hooks.php index dcde9aa..84c3326 100644 --- a/includes/wp-save-hooks.php +++ b/includes/wp-save-hooks.php @@ -26,7 +26,7 @@ */ function wp_insert_post( $id, $obj, $update ) { - $filtered_object = apply_filters('ep_skip_indexing', $obj); + $filtered_object = apply_filters('ep_insert_post_object_filter', $obj); // Skip ACF internals. if ($filtered_object->skip_indexing || ! $update || strpos( $obj->post_type, 'acf-' ) === 0 ) { diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index 0b7c355..c48cdb3 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -109,7 +109,7 @@ public function test_ep_skip_indexing_filter() { 'post_type' => 'skip_post' ); - add_filter('ep_skip_indexing', function($object) { + add_filter('ep_insert_post_object_filter', function($object) { $skip_indexing = array( 'skip_post' ); From fc9548d4d39171c196c55e239bd85dea7f3e8f2f Mon Sep 17 00:00:00 2001 From: James Gavin Holt Date: Thu, 10 Sep 2020 09:13:00 -0400 Subject: [PATCH 07/38] - whoops --- tests/test-wp-save-hooks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index c48cdb3..9ff7b7c 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -131,7 +131,7 @@ public function test_ep_skip_indexing_filter() { $skip_post_exists = get_post( $skip_post->ID); // $skip_post_is_not_indexed = elasticsearch_find( $skip_post->ID, 'do_not_index' ); - $this->assertEquals( $skip_exists['post_title'], 'This will not be indexed' ); + $this->assertEquals( $skip_post_exists['post_title'], 'This will not be indexed' ); // $this->assertEquals( $skip_is_not_indexed, 'This will not be indexed' ); } } From 21f932dee82544cd2644f9e6cec4856d6d5d6ebc Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Tue, 17 Nov 2020 12:34:24 -0500 Subject: [PATCH 08/38] add aws signed requests --- composer.json | 5 +- composer.lock | 268 +++++++++++++++++++++++- includes/elasticsearch/class-client.php | 21 +- 3 files changed, 289 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index ecdf631..dae4be1 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,9 @@ "advanced-custom-fields/advanced-custom-fields-pro": "*", "flyntwp/acf-field-group-composer": "dev-flattenNestedFilters", "elasticsearch/elasticsearch": "^6.1", - "yoast/wordpress-seo-premium": "*" + "yoast/wordpress-seo-premium": "*", + "jsq/amazon-es-php": "^0.3.0", + "aws/aws-sdk-php": "^3.161" }, "require-dev": { "phpunit/phpunit": "^7.5", @@ -56,6 +58,7 @@ "installer-paths": { "vendor/mu-plugins/{$name}/": [ "type:wordpress-muplugin", + "aws/aws-sdk-php", "flyntwp/acf-field-group-composer", "advanced-custom-fields/advanced-custom-fields-pro", "elasticsearch/elasticsearch", diff --git a/composer.lock b/composer.lock index 420cbb8..5f9c63b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fba1bd0310bee7a195ede4ab044294f7", + "content-hash": "e433dc1cc9cba9916836aa51dc70116a", "packages": [ { "name": "advanced-custom-fields/advanced-custom-fields-pro", @@ -19,6 +19,91 @@ }, "type": "wordpress-plugin" }, + { + "name": "aws/aws-sdk-php", + "version": "3.161.2", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "2703896142f292058ce9d6c9026a9329a89778e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2703896142f292058ce9d6c9026a9329a89778e0", + "reference": "2703896142f292058ce9d6c9026a9329a89778e0", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4.1", + "mtdowling/jmespath.php": "^2.5", + "php": ">=5.5" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "paragonie/random_compat": ">= 2", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0", + "sebastian/comparator": "^1.2.3" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Aws\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "time": "2020-11-16T19:11:59+00:00" + }, { "name": "composer/installers", "version": "v1.9.0", @@ -546,6 +631,53 @@ "abandoned": true, "time": "2014-10-12T19:18:40+00:00" }, + { + "name": "jsq/amazon-es-php", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/jeskew/amazon-es-php.git", + "reference": "6f1ae9044c25c69b9c706ecb0906b45574cae589" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jeskew/amazon-es-php/zipball/6f1ae9044c25c69b9c706ecb0906b45574cae589", + "reference": "6f1ae9044c25c69b9c706ecb0906b45574cae589", + "shasum": "" + }, + "require": { + "aws/aws-sdk-php": "^3.0", + "elasticsearch/elasticsearch": "^2.1|^5.0|^6.0|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.4.0|^6.0.0|^7.0.0|^8.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Aws\\ElasticsearchService\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Jonathan Eskew", + "email": "jonathan@jeskew.net" + } + ], + "description": "Support for using IAM authentication with the official Elasticsearch PHP client", + "keywords": [ + "aws", + "client", + "elasticsearch", + "iam", + "search" + ], + "time": "2019-07-20T01:13:04+00:00" + }, { "name": "league/oauth2-client", "version": "2.5.0", @@ -613,6 +745,63 @@ ], "time": "2020-07-18T17:54:32+00:00" }, + { + "name": "mtdowling/jmespath.php", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/42dae2cbd13154083ca6d70099692fef8ca84bfb", + "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "composer/xdebug-handler": "^1.4", + "phpunit/phpunit": "^4.8.36 || ^7.5.15" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "JmesPath\\": "src/" + }, + "files": [ + "src/JmesPath.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "time": "2020-07-31T21:01:56+00:00" + }, { "name": "paragonie/random_compat", "version": "v9.99.99", @@ -1206,6 +1395,83 @@ ], "time": "2020-07-14T12:35:20+00:00" }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T14:02:19+00:00" + }, { "name": "vlucas/phpdotenv", "version": "v2.6.6", diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index 787e89d..c028097 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -9,6 +9,10 @@ use ElasticPress\Utils\CustomPostTypes; use ElasticPress\Utils\Taxonomy; +use Aws\Credentials\CredentialProvider; +use Aws\Credentials\Credentials; +use Aws\ElasticsearchService\ElasticsearchPhpHandler; +use Elasticsearch\ClientBuilder; /** * Client class for interfacing with ElasticSearch @@ -43,9 +47,20 @@ class Client { */ public static function client(): \Elasticsearch\Client { if ( null === static::$instance ) { - static::$instance = \Elasticsearch\ClientBuilder::create() - ->setHosts( array( ELASTICSEARCH_URL ) ) - ->build(); + if ( defined( 'EP_AWS_REGION' ) ) { + $provider = CredentialProvider::fromCredentials( + new Credentials( EP_AWS_ACCESS_KEY_ID, EP_AWS_SECRET_ACCESS_KEY ) + ); + $handler = new ElasticsearchPhpHandler( EP_AWS_REGION, $provider ); + static::$instance = ClientBuilder::create() + ->setHandler($handler) + ->setHosts( array( ELASTICSEARCH_URL ) ) + ->build(); + } else { + static::$instance = ClientBuilder::create() + ->setHosts( array( ELASTICSEARCH_URL ) ) + ->build(); + } } return static::$instance; } From 193838959e72d1f7b615ca4c4814eb566f24de3f Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 18 Nov 2020 14:02:29 -0500 Subject: [PATCH 09/38] add position to register_group --- includes/utils/fields.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/includes/utils/fields.php b/includes/utils/fields.php index 2553f56..9268cde 100644 --- a/includes/utils/fields.php +++ b/includes/utils/fields.php @@ -74,15 +74,26 @@ function register_layout( $type, $layout ) { * @param Array $fields The fields config. * @param Array $location The location config. */ -function register_group( $type, $group, $fields, $location ) { - $config = array( - 'name' => $group['name'], - 'title' => $group['title'], - 'fields' => $fields, +function register_group( $type, $config ) { + + if ( isset( $config['location'] ) ) { + $location = $config['location']; + } else { + $location = []; + } + + $new_config = array( + 'name' => $config['group']['name'], + 'title' => $config['group']['title'], + 'fields' => $config['fields'], 'location' => $location, ); - ACFComposer::registerFieldGroup( $config ); + if ( isset( $config['position'] ) ) { + $new_config['position'] = $config['position']; + } + + ACFComposer::registerFieldGroup( $new_config ); } /** @@ -108,16 +119,9 @@ function register_fields() { } if ( isset( $config['config']['group'] ) ) { - if ( isset( $config['config']['location'] ) ) { - $location = $config['config']['location']; - } else { - $location = []; - } register_group( $type, - $config['config']['group'], - $config['config']['fields'], - $location + $config['config'] ); } From 5a3e57110a880fd886f7ba690896a00b254a401c Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 7 Apr 2021 11:39:10 -0400 Subject: [PATCH 10/38] fix test syntax --- tests/test-wp-save-hooks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index 9ff7b7c..3d1d366 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -131,7 +131,7 @@ public function test_ep_skip_indexing_filter() { $skip_post_exists = get_post( $skip_post->ID); // $skip_post_is_not_indexed = elasticsearch_find( $skip_post->ID, 'do_not_index' ); - $this->assertEquals( $skip_post_exists['post_title'], 'This will not be indexed' ); + $this->assertEquals( $skip_post_exists->post_title, 'This will not be indexed' ); // $this->assertEquals( $skip_is_not_indexed, 'This will not be indexed' ); } } From d35beecf6da8136d90b0a7d1612856d50f835797 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 7 Apr 2021 11:39:25 -0400 Subject: [PATCH 11/38] add sort, range, from, and size to where params for further usability of Elasticsearch API --- includes/elasticsearch/class-client.php | 59 ++++++++++++++++++------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index c028097..4e1015c 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -247,6 +247,11 @@ public static function where_query( $index, $params ) { // Scope queries by published status. $status = isset( $params['post_status'] ) ? $params['post_status'] : 'publish'; $params = array_merge( $params, array( 'post_status' => $status ) ); + $sort = isset( $params['sort'] ) ? $params['sort'] : null; + $range = isset( $params['range'] ) ? $params['range'] : null; + $from = isset( $params['from'] ) ? $params['from'] : 0; + $size = isset( $params['size'] ) ? $params['size'] : 10000; + unset( $params['sort'], $params['range'], $params['from'], $params['size'] ); // Convert `id` fields into integers. array_walk( @@ -280,13 +285,6 @@ function( $v, $k ) { ARRAY_FILTER_USE_BOTH ); - $sort_param = null; - foreach ( $id_params as $key => $val ) { - if ( is_array( $val ) ) { - $sort_param = array( $key, $val ); - } - } - $query = array( 'bool' => array() ); if ( ! empty( $or_params ) ) { @@ -303,6 +301,7 @@ function( &$v, $k ) { ); } + $must_params = array(); if ( ! empty( $and_params ) ) { array_walk( $and_params, @@ -310,17 +309,33 @@ function( &$v, $k ) { $v = self::map_param( $k, $v ); } ); + $must_params = $and_params; + } + + if ( ! empty( $range ) ) { + array_push( $must_params, array( 'range' => $range ) ); + } + + if ( ! empty( $must_params ) ) { $query['bool'] = array_merge( $query['bool'], array( - 'must' => array_values( $and_params ), + 'must' => array_values( $must_params ), ) ); } $body = array( 'query' => $query ); - if ( ! empty( $sort_param ) ) { + $sort_param = null; + foreach ( $id_params as $key => $val ) { + if ( is_array( $val ) ) { + $sort_param = array( $key, $val ); + } + } + if ( ! empty( $sort ) ) { + $body['sort'] = $sort; + } elseif ( ! empty( $sort_param ) ) { list( $key, $ids ) = $sort_param; $script = self::painless_script( $key ); $body['sort'] = array( @@ -341,7 +356,8 @@ function( &$v, $k ) { return array( 'index' => $index_name, 'body' => $body, - 'size' => 10000, + 'size' => $size, + 'from' => $from ); } @@ -427,24 +443,35 @@ public static function update_write_aliases() { 'jsondata' => array( 'date_detection' => false, 'properties' => array( - 'content' => array( + 'content' => array( 'type' => 'text', ), - 'taxonomies' => array( + 'taxonomies' => array( 'type' => 'nested', ), - 'unit_id' => array( + 'unit_id' => array( + 'type' => 'keyword', + ), + 'ID' => array( 'type' => 'keyword', ), - 'ID' => array( + 'id' => array( 'type' => 'keyword', ), - 'id' => array( + 'post_id' => array( 'type' => 'keyword', ), - 'post_id' => array( + 'term_id' => array( 'type' => 'keyword', ), + 'post_date' => array( + 'type' => 'date', + 'format' => 'yyyy-MM-dd HH:mm:ss' + ), + 'post_modified' => array( + 'type' => 'date', + 'format' => 'yyyy-MM-dd HH:mm:ss' + ) ), ), ), From 2ceb1fce09df7a95bead6ffe94a7d5e3c3774dc3 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 21 Apr 2021 13:42:19 -0400 Subject: [PATCH 12/38] index non-public content and fix missing function --- includes/acf.php | 1 + includes/sweepers.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/acf.php b/includes/acf.php index 928c048..ab7e3f7 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -11,6 +11,7 @@ use ElasticPress\Utils\InlineSVG; use function ElasticPress\Serializers\post_data; use function ElasticPress\Serializers\get_image_array; +use function ElasticPress\Serializers\term_data; /** * Convert raw ACF data into nested fields diff --git a/includes/sweepers.php b/includes/sweepers.php index b3fcf53..2c92a74 100644 --- a/includes/sweepers.php +++ b/includes/sweepers.php @@ -53,13 +53,22 @@ function sweep_posts() { $post_types = array_keys( get_post_types( array( - 'public' => true, '_builtin' => false, ) ) ); array_unshift( $post_types, 'post' ); + $ignore_post_types = array( + 'acf-field-group', + 'acf-field' + ); + foreach ( $ignore_post_types as $post_type ) { + if ( ( $key = array_search($post_type, $post_types) ) !== false ) { + unset( $post_types[$key] ); + } + } + foreach ( $post_types as $post_type ) { sweep_post_type( $post_type ); } From 0aa64cd24c49d805997b8ec1abefce4ab998d4b7 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 21 Apr 2021 15:13:27 -0400 Subject: [PATCH 13/38] make mappings filterable --- includes/elasticsearch/class-client.php | 85 ++++++++++++------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index 4e1015c..fcf4766 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -142,6 +142,7 @@ public static function find( $id, $index ) { public static function get_pages() { $index_name = self::read_index_alias( '*' ); + $public_types = array_keys( get_post_types( array( 'public' => true ) ) ); $response = self::client()->search( array( 'index' => $index_name, @@ -159,6 +160,11 @@ public static function get_pages() { 'term' => array( 'post_status.keyword' => 'publish' ) + ), + array( + 'terms' => array( + 'post_type.keyword' => $public_types + ) ) ), 'must_not' => array( @@ -216,15 +222,6 @@ public static function find_by_url( $input ) { return $record; } -// private_class_method def self.term_filter(terms) -// { -// query: { -// # Add .keyword to field name for exact matching -// term: terms.transform_keys { |key| "#{key}.keyword" } -// } -// } -// end - /** * Builds a where query for Elasticsearch * @@ -429,6 +426,41 @@ public static function update_write_aliases() { self::client()->indices()->delete( array( 'index' => $old_index ) ); } } + $mappings = array( + 'date_detection' => false, + 'properties' => array( + 'content' => array( + 'type' => 'text', + ), + 'taxonomies' => array( + 'type' => 'nested', + ), + 'unit_id' => array( + 'type' => 'keyword', + ), + 'ID' => array( + 'type' => 'keyword', + ), + 'id' => array( + 'type' => 'keyword', + ), + 'post_id' => array( + 'type' => 'keyword', + ), + 'term_id' => array( + 'type' => 'keyword', + ), + 'post_date' => array( + 'type' => 'date', + 'format' => 'yyyy-MM-dd HH:mm:ss' + ), + 'post_modified' => array( + 'type' => 'date', + 'format' => 'yyyy-MM-dd HH:mm:ss' + ) + ), + ); + $mappings = apply_filters( 'ep_mappings', $mappings, $index_type ); $params = array( 'index' => $new_index, 'body' => array( @@ -440,40 +472,7 @@ public static function update_write_aliases() { ), ), 'mappings' => array( - 'jsondata' => array( - 'date_detection' => false, - 'properties' => array( - 'content' => array( - 'type' => 'text', - ), - 'taxonomies' => array( - 'type' => 'nested', - ), - 'unit_id' => array( - 'type' => 'keyword', - ), - 'ID' => array( - 'type' => 'keyword', - ), - 'id' => array( - 'type' => 'keyword', - ), - 'post_id' => array( - 'type' => 'keyword', - ), - 'term_id' => array( - 'type' => 'keyword', - ), - 'post_date' => array( - 'type' => 'date', - 'format' => 'yyyy-MM-dd HH:mm:ss' - ), - 'post_modified' => array( - 'type' => 'date', - 'format' => 'yyyy-MM-dd HH:mm:ss' - ) - ), - ), + 'jsondata' => $mappings, ), ), ); From b94d5a63826bfec7155a8bebe0a43b2ab1405547 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 22 Apr 2021 09:31:14 -0400 Subject: [PATCH 14/38] ensure non-public taxonomies are swept --- includes/sweepers.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/sweepers.php b/includes/sweepers.php index 2c92a74..61dddf4 100644 --- a/includes/sweepers.php +++ b/includes/sweepers.php @@ -99,7 +99,6 @@ function sweep_menu_cache() { function sweep_taxonomy() { $taxonomies = get_taxonomies( array( - 'public' => true, '_builtin' => false, ) ); From 1e84b60e5ffddab0121217abba6c0bae5b730531 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Fri, 14 May 2021 15:36:31 -0400 Subject: [PATCH 15/38] fix flexible content link fields --- includes/acf.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/includes/acf.php b/includes/acf.php index ab7e3f7..2088684 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -147,9 +147,10 @@ function parse_group_field( $field, $value, $data, $base_prefix ) { foreach ( $sub_fields as $sub_field ) { $sub_field_key = $sub_field['name']; - // FIXME: Why are we using $value? (repeater doesn't). - if ( isset( $value[ $sub_field_key ] ) ) { + if ( in_array( $sub_field['type'], array( 'link' ) ) ) { + $val = parse_acf_field($sub_field, $sub_field['value']); + } else if ( isset( $value[ $sub_field_key ] ) ) { $val = $value[ $sub_field_key ]; if ( isset( $val['mime_type'] ) && 'image/svg+xml' === $val['mime_type'] ) { $val['raw'] = InlineSVG::remote( $val['url'] ); @@ -199,7 +200,6 @@ function acf_data( $id ) { $data = array_merge( $data, parse_page_blocks( $field ) ); } } - return ArrayHelpers::convert_false_to_null( $data ); } @@ -211,7 +211,22 @@ function acf_data( $id ) { */ function parse_page_blocks( $field ) { $module = $field['value']; + switch ( true ) { + case ( is_array( $module ) && $field['type'] === 'flexible_content' ): + $data = array(); + foreach ($module as $m) { + foreach ($m as $k => $mod) { + if ('acf_fc_layout' === $k) continue; + $f = acf_get_field($k); + if ($k === 'copy') { + $data[$k] = $mod; + } else { + $data[$k] = parse_acf_field( $f, $mod ); + } + } + } + break; case ( is_array( $module ) ): $data = parse_acf_field( $field, $module ); break; From 4c63fd258aeda387477bed26e0f30abfe71a5c30 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Fri, 14 May 2021 15:59:09 -0400 Subject: [PATCH 16/38] rollback update - broke things further on nemacolin beta --- includes/acf.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/includes/acf.php b/includes/acf.php index 2088684..4905afa 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -147,10 +147,9 @@ function parse_group_field( $field, $value, $data, $base_prefix ) { foreach ( $sub_fields as $sub_field ) { $sub_field_key = $sub_field['name']; + // FIXME: Why are we using $value? (repeater doesn't). - if ( in_array( $sub_field['type'], array( 'link' ) ) ) { - $val = parse_acf_field($sub_field, $sub_field['value']); - } else if ( isset( $value[ $sub_field_key ] ) ) { + if ( isset( $value[ $sub_field_key ] ) ) { $val = $value[ $sub_field_key ]; if ( isset( $val['mime_type'] ) && 'image/svg+xml' === $val['mime_type'] ) { $val['raw'] = InlineSVG::remote( $val['url'] ); @@ -200,6 +199,7 @@ function acf_data( $id ) { $data = array_merge( $data, parse_page_blocks( $field ) ); } } + return ArrayHelpers::convert_false_to_null( $data ); } @@ -211,22 +211,7 @@ function acf_data( $id ) { */ function parse_page_blocks( $field ) { $module = $field['value']; - switch ( true ) { - case ( is_array( $module ) && $field['type'] === 'flexible_content' ): - $data = array(); - foreach ($module as $m) { - foreach ($m as $k => $mod) { - if ('acf_fc_layout' === $k) continue; - $f = acf_get_field($k); - if ($k === 'copy') { - $data[$k] = $mod; - } else { - $data[$k] = parse_acf_field( $f, $mod ); - } - } - } - break; case ( is_array( $module ) ): $data = parse_acf_field( $field, $module ); break; @@ -243,4 +228,4 @@ function parse_page_blocks( $field ) { $data = $module; } return array( $field['name'] => $data ); -} +} \ No newline at end of file From 764a1bf155dd1bcacfbc55856ecc1e2d2c9fd9b9 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Mon, 17 May 2021 14:11:59 -0400 Subject: [PATCH 17/38] add parsing for flexible_content fields --- includes/acf.php | 28 +++++++++- tests/test-flexible-content.php | 99 +++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 tests/test-flexible-content.php diff --git a/includes/acf.php b/includes/acf.php index 4905afa..6563b95 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -54,6 +54,28 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { $value = array(); } break; + case 'flexible_content': + $data = array(); + foreach ($value as $index => $m) { + foreach ($m as $k => $mod) { + if ('acf_fc_layout' === $k) continue; + $layout_idx = array_search($m['acf_fc_layout'], array_column($field['layouts'], 'name')); + $layout = $field['layouts'][$layout_idx]; + $f = false; + $idx = 0; + $keys = array( + $layout['key'] . "_$k", + str_replace('layout', 'field', $layout['name'] . "_$k") + ); + foreach( $keys as $key) { + $f = acf_get_field( $key ); + if ($f !== false) break; + } + $data[$index][$k] = parse_acf_field( $f, $mod, $data, $base_prefix ); + } + } + $value = $data; + break; } if ( is_array( $value ) ) { @@ -147,15 +169,17 @@ function parse_group_field( $field, $value, $data, $base_prefix ) { foreach ( $sub_fields as $sub_field ) { $sub_field_key = $sub_field['name']; + $prefix = field_prefix( $base_prefix, $field['name'], $sub_field_key ); // FIXME: Why are we using $value? (repeater doesn't). - if ( isset( $value[ $sub_field_key ] ) ) { + if ( in_array( $sub_field['type'], array( 'link' ) ) ) { + $val = parse_acf_field($sub_field, $value[$sub_field['name']], $data, $prefix); + } else if ( isset( $value[ $sub_field_key ] ) ) { $val = $value[ $sub_field_key ]; if ( isset( $val['mime_type'] ) && 'image/svg+xml' === $val['mime_type'] ) { $val['raw'] = InlineSVG::remote( $val['url'] ); } } else { - $prefix = field_prefix( $base_prefix, $field['name'], $sub_field_key ); if ( isset( $data[ $prefix ] ) ) { $val = parse_acf_field( $sub_field, $data[ $prefix ], $data, $prefix ); } else { diff --git a/tests/test-flexible-content.php b/tests/test-flexible-content.php new file mode 100644 index 0000000..1d88d11 --- /dev/null +++ b/tests/test-flexible-content.php @@ -0,0 +1,99 @@ + 'flex_components', + 'title' => 'Flex Components', + 'fields' => array( + array( + 'name' => 'components', + 'label' => 'Components', + 'type' => 'flexible_content', + 'layouts' => array( + array( + 'name' => 'callout', + 'label' => 'Callout', + 'type' => 'group', + 'layout' => 'block', + 'sub_fields' => array( + array( + 'name' => 'title', + 'label' => 'Title', + 'type' => 'text' + ), + array( + 'name' => 'cta', + 'label' => 'CTA', + 'type' => 'link' + ) + ) + ) + ) + ), + ), + 'location' => array( + array( + array( + 'param' => 'template', + 'operator' => '==', + 'value' => 'flex_components', + ), + ), + ), + ) + ); + } + + /** + * Runs after each test + */ + public function tearDown() { + $uploads_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress/wp-content/uploads'; + // Clears uploads so they don't increment. + exec( "rm -rf $uploads_dir/*" ); + } + + /** + * Test default page serialization + */ + public function test_flexible_content_serialization() { + $content = array( + 'post_title' => 'Title', + 'meta_input' => array( + '_wp_page_template' => 'flex_components', + ) + ); + $components = array( + array( + 'title' => 'Test Title', + 'cta' => null, + 'acf_fc_layout' => 'callout' + ) + ); + $page = $this->factory->post->create_and_get( $content ); + update_field( 'field_flex_components_components', $components, $page->ID ); + $result = Serializers\page_data( $page ); + + $this->assertEquals( $result['post_title'], 'Title' ); + $this->assertEquals( $result['components'][0]['title'], 'Test Title' ); + $this->assertEquals( $result['components'][0]['cta'], array() ); + } + +} From afc95d5997f0eb7a21c6e8c9cd269dec1ee2c185 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Mon, 17 May 2021 14:25:55 -0400 Subject: [PATCH 18/38] lock back to older version of Composer --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b4daf62..795bc7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ before_install: - until curl --silent -XGET --fail http://localhost:9200; do printf '.'; sleep 1; done install: + - composer self-update 1.10.6 - composer config -g http-basic.my.yoast.com token $YOAST_TOKEN - composer install From 092c62e6b7b49468be9d4e66dfbda199885fea9e Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Mon, 17 May 2021 15:47:23 -0400 Subject: [PATCH 19/38] re-add acf_fc_layout --- includes/acf.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/acf.php b/includes/acf.php index 6563b95..c1668aa 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -73,6 +73,7 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { } $data[$index][$k] = parse_acf_field( $f, $mod, $data, $base_prefix ); } + $data[$index]['acf_fc_layout'] = $m['acf_fc_layout']; } $value = $data; break; From 12e4d7b8197b26902af965753abca90a9dbe4bf3 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Fri, 21 May 2021 11:33:27 -0400 Subject: [PATCH 20/38] fix for clone fields --- includes/acf.php | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/includes/acf.php b/includes/acf.php index c1668aa..d362018 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -56,24 +56,33 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { break; case 'flexible_content': $data = array(); - foreach ($value as $index => $m) { - foreach ($m as $k => $mod) { - if ('acf_fc_layout' === $k) continue; - $layout_idx = array_search($m['acf_fc_layout'], array_column($field['layouts'], 'name')); - $layout = $field['layouts'][$layout_idx]; - $f = false; - $idx = 0; - $keys = array( + foreach ( $value as $index => $m ) { + $layout_idx = array_search( $m['acf_fc_layout'], array_column( $field['layouts'], 'name' ) ); + $layout = $field['layouts'][ $layout_idx ]; + $idx = 0; + foreach ( $m as $k => $mod ) { + if ( 'acf_fc_layout' === $k ) { + continue; + } + $f = false; + $keys = array( $layout['key'] . "_$k", - str_replace('layout', 'field', $layout['name'] . "_$k") + str_replace( 'layout', 'field', $layout['name'] . "_$k" ), + $layout['key'] . '_' . $layout['name'], ); - foreach( $keys as $key) { + foreach ( $keys as $key ) { + if ( false !== $f ) { + break; + } $f = acf_get_field( $key ); - if ($f !== false) break; } - $data[$index][$k] = parse_acf_field( $f, $mod, $data, $base_prefix ); + if ( 'clone' === $f['type'] ) { + $f = $f['sub_fields'][ $idx ]; + } + $data[ $index ][ $k ] = parse_acf_field( $f, $mod, $data, $base_prefix ); + $idx++; } - $data[$index]['acf_fc_layout'] = $m['acf_fc_layout']; + $data[ $index ]['acf_fc_layout'] = $m['acf_fc_layout']; } $value = $data; break; @@ -170,19 +179,19 @@ function parse_group_field( $field, $value, $data, $base_prefix ) { foreach ( $sub_fields as $sub_field ) { $sub_field_key = $sub_field['name']; - $prefix = field_prefix( $base_prefix, $field['name'], $sub_field_key ); + $prefix = field_prefix( $base_prefix, $field['name'], $sub_field_key ); // FIXME: Why are we using $value? (repeater doesn't). - if ( in_array( $sub_field['type'], array( 'link' ) ) ) { - $val = parse_acf_field($sub_field, $value[$sub_field['name']], $data, $prefix); - } else if ( isset( $value[ $sub_field_key ] ) ) { - $val = $value[ $sub_field_key ]; + if ( isset( $value[ $sub_field_key ] ) ) { + $val = parse_acf_field( $sub_field, $value[ $sub_field_key ], $data, $prefix ); if ( isset( $val['mime_type'] ) && 'image/svg+xml' === $val['mime_type'] ) { $val['raw'] = InlineSVG::remote( $val['url'] ); } } else { if ( isset( $data[ $prefix ] ) ) { $val = parse_acf_field( $sub_field, $data[ $prefix ], $data, $prefix ); + } elseif ( 'link' === $sub_field['type'] && isset( $value[ $sub_field['name'] ] ) ) { + $val = parse_acf_field( $sub_field, $value[ $sub_field['name'] ], $data, $prefix ); } else { $val = $value; } @@ -253,4 +262,4 @@ function parse_page_blocks( $field ) { $data = $module; } return array( $field['name'] => $data ); -} \ No newline at end of file +} From 1913a9ebedc57d108f97a5c6322cdce62f103b7b Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Fri, 21 May 2021 11:33:34 -0400 Subject: [PATCH 21/38] fix php code style --- includes/elasticsearch/class-client.php | 97 +++++++++++++++---------- includes/elasticsearch/functions.php | 7 +- includes/storage.php | 8 +- includes/sweepers.php | 7 +- includes/utils/class-arrayhelpers.php | 5 +- includes/utils/fields.php | 7 +- includes/wp-save-hooks.php | 5 +- tests/test-flexible-content.php | 30 ++++---- tests/test-wp-save-hooks.php | 31 ++++---- 9 files changed, 105 insertions(+), 92 deletions(-) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index fcf4766..b6b5b53 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -48,12 +48,12 @@ class Client { public static function client(): \Elasticsearch\Client { if ( null === static::$instance ) { if ( defined( 'EP_AWS_REGION' ) ) { - $provider = CredentialProvider::fromCredentials( + $provider = CredentialProvider::fromCredentials( new Credentials( EP_AWS_ACCESS_KEY_ID, EP_AWS_SECRET_ACCESS_KEY ) ); - $handler = new ElasticsearchPhpHandler( EP_AWS_REGION, $provider ); + $handler = new ElasticsearchPhpHandler( EP_AWS_REGION, $provider ); static::$instance = ClientBuilder::create() - ->setHandler($handler) + ->setHandler( $handler ) ->setHosts( array( ELASTICSEARCH_URL ) ) ->build(); } else { @@ -140,84 +140,101 @@ public static function find( $id, $index ) { } } + /** + * Gets all published documents with a url, a.k.a. pages + */ public static function get_pages() { - $index_name = self::read_index_alias( '*' ); + $index_name = self::read_index_alias( '*' ); $public_types = array_keys( get_post_types( array( 'public' => true ) ) ); - $response = self::client()->search( + $response = self::client()->search( array( 'index' => $index_name, - 'size' => 10000, - 'body' => array( + 'size' => 10000, + 'body' => array( 'query' => array( 'bool' => array( - 'must' => array( + 'must' => array( array( 'exists' => array( - 'field' => 'url' - ) + 'field' => 'url', + ), ), array( 'term' => array( - 'post_status.keyword' => 'publish' - ) + 'post_status.keyword' => 'publish', + ), ), array( 'terms' => array( - 'post_type.keyword' => $public_types - ) - ) + 'post_type.keyword' => $public_types, + ), + ), ), 'must_not' => array( 'exists' => array( - 'field' => 'taxonomy' - ) - ) - ) - ) - ) + 'field' => 'taxonomy', + ), + ), + ), + ), + ), ) ); - $results = $response['hits']['hits']; + $results = $response['hits']['hits']; return $results; } + /** + * Gets all documents of a given index - all indicies by default + * + * @param string $index (optional) The index for lookup. + */ public static function all( $index = '*' ) { $index_name = self::read_index_alias( $index ); - $response = self::client()->search( + $response = self::client()->search( array( 'index' => $index_name, - 'size' => 10000, - 'body' => array() + 'size' => 10000, + 'body' => array(), ) ); - $results = $response['hits']['hits']; + $results = $response['hits']['hits']; return $results; } + /** + * Finds a document by url + * + * @param string $input The url for lookup. + */ public static function find_by_url( $input ) { $index_name = self::read_index_alias( '*' ); $record = null; - $urls = array( + $urls = array( "$input/", - $input + $input, ); - foreach ($urls as $url) { + foreach ( $urls as $url ) { $results = self::client()->search( array( 'index' => $index_name, 'body' => array( 'query' => array( 'term' => array( - 'url.keyword' => $url - ) - ) + 'url.keyword' => $url, + ), + ), ), - 'size' => 1 + 'size' => 1, ) ); - if ($record = $results['hits']['hits'][0]) break; + $record = $results['hits']['hits'][0]; + + if ( $record ) { + break; + } } return $record; } @@ -331,7 +348,7 @@ function( &$v, $k ) { } } if ( ! empty( $sort ) ) { - $body['sort'] = $sort; + $body['sort'] = $sort; } elseif ( ! empty( $sort_param ) ) { list( $key, $ids ) = $sort_param; $script = self::painless_script( $key ); @@ -354,7 +371,7 @@ function( &$v, $k ) { 'index' => $index_name, 'body' => $body, 'size' => $size, - 'from' => $from + 'from' => $from, ); } @@ -452,16 +469,16 @@ public static function update_write_aliases() { ), 'post_date' => array( 'type' => 'date', - 'format' => 'yyyy-MM-dd HH:mm:ss' + 'format' => 'yyyy-MM-dd HH:mm:ss', ), 'post_modified' => array( 'type' => 'date', - 'format' => 'yyyy-MM-dd HH:mm:ss' - ) + 'format' => 'yyyy-MM-dd HH:mm:ss', + ), ), ); $mappings = apply_filters( 'ep_mappings', $mappings, $index_type ); - $params = array( + $params = array( 'index' => $new_index, 'body' => array( 'settings' => array( diff --git a/includes/elasticsearch/functions.php b/includes/elasticsearch/functions.php index 41dbea6..a5d75da 100644 --- a/includes/elasticsearch/functions.php +++ b/includes/elasticsearch/functions.php @@ -46,7 +46,6 @@ function elasticsearch_where( $index_name, $params = array() ) { * Retrieve values from Elasticsearch by query params * * @param string $index_name The index identifier. - * @param Array $params Query array of parameters. */ function elasticsearch_all( $index_name = '*' ) { return Client::all( $index_name ); @@ -65,8 +64,7 @@ function elasticsearch_delete_where( $index_name, $params = array() ) { /** * Delete values from Elasticsearch by query params * - * @param string $index_name The index identifier. - * @param Array $params Query array of parameters. + * @param string $url The url identifier. */ function elasticsearch_find_by_url( $url ) { return Client::find_by_url( $url ); @@ -74,9 +72,6 @@ function elasticsearch_find_by_url( $url ) { /** * Delete values from Elasticsearch by query params - * - * @param string $index_name The index identifier. - * @param Array $params Query array of parameters. */ function elasticsearch_get_pages() { return Client::get_pages(); diff --git a/includes/storage.php b/includes/storage.php index b2d33ec..d2a3160 100644 --- a/includes/storage.php +++ b/includes/storage.php @@ -39,11 +39,11 @@ function store_post( $post ) { * @param WP_Term $menu The menu (term) object. */ function store_menu( $menu ) { - $key = $menu->slug . '_nav'; - $items = wp_get_nav_menu_items( $menu->name ); - $data = term_data( $menu ); + $key = $menu->slug . '_nav'; + $items = wp_get_nav_menu_items( $menu->name ); + $data = term_data( $menu ); $data['menu_items'] = array_map( 'ElasticPress\Serializers\nav_map', $items ); - $type = $menu->taxonomy; + $type = $menu->taxonomy; ElasticSearch\elasticsearch_store( $key, $type, $data ); } diff --git a/includes/sweepers.php b/includes/sweepers.php index 61dddf4..9d5263a 100644 --- a/includes/sweepers.php +++ b/includes/sweepers.php @@ -61,11 +61,12 @@ function sweep_posts() { $ignore_post_types = array( 'acf-field-group', - 'acf-field' + 'acf-field', ); foreach ( $ignore_post_types as $post_type ) { - if ( ( $key = array_search($post_type, $post_types) ) !== false ) { - unset( $post_types[$key] ); + $key = array_search( $post_type, $post_types ); + if ( false !== $key ) { + unset( $post_types[ $key ] ); } } diff --git a/includes/utils/class-arrayhelpers.php b/includes/utils/class-arrayhelpers.php index 782f9e8..95272ed 100644 --- a/includes/utils/class-arrayhelpers.php +++ b/includes/utils/class-arrayhelpers.php @@ -68,12 +68,11 @@ public static function convert_false_to_null( array $array ) { array_walk_recursive( $array, function( &$value, $key ) { - $ignore_keys = array( - 'enable' + 'enable', ); - if ( !in_array( $key, $ignore_keys ) && false === $value ) { + if ( ! in_array( $key, $ignore_keys ) && false === $value ) { $value = null; } diff --git a/includes/utils/fields.php b/includes/utils/fields.php index 9268cde..3f4159f 100644 --- a/includes/utils/fields.php +++ b/includes/utils/fields.php @@ -70,16 +70,13 @@ function register_layout( $type, $layout ) { * * @since 0.1.0 * @param string $type The type of layout (component or feature). - * @param Array $group The top-level group config. - * @param Array $fields The fields config. - * @param Array $location The location config. + * @param Array $config The top-level group config. */ function register_group( $type, $config ) { - if ( isset( $config['location'] ) ) { $location = $config['location']; } else { - $location = []; + $location = array(); } $new_config = array( diff --git a/includes/wp-save-hooks.php b/includes/wp-save-hooks.php index 84c3326..2f58d90 100644 --- a/includes/wp-save-hooks.php +++ b/includes/wp-save-hooks.php @@ -25,11 +25,10 @@ * @param boolean $update Whether the post updated or not. */ function wp_insert_post( $id, $obj, $update ) { - - $filtered_object = apply_filters('ep_insert_post_object_filter', $obj); + $filtered_object = apply_filters( 'ep_insert_post_object_filter', $obj ); // Skip ACF internals. - if ($filtered_object->skip_indexing || ! $update || strpos( $obj->post_type, 'acf-' ) === 0 ) { + if ( $filtered_object->skip_indexing || ! $update || strpos( $obj->post_type, 'acf-' ) === 0 ) { return; } diff --git a/tests/test-flexible-content.php b/tests/test-flexible-content.php index 1d88d11..62c2ffb 100644 --- a/tests/test-flexible-content.php +++ b/tests/test-flexible-content.php @@ -23,10 +23,10 @@ public function setUp() { 'title' => 'Flex Components', 'fields' => array( array( - 'name' => 'components', - 'label' => 'Components', - 'type' => 'flexible_content', - 'layouts' => array( + 'name' => 'components', + 'label' => 'Components', + 'type' => 'flexible_content', + 'layouts' => array( array( 'name' => 'callout', 'label' => 'Callout', @@ -36,16 +36,16 @@ public function setUp() { array( 'name' => 'title', 'label' => 'Title', - 'type' => 'text' + 'type' => 'text', ), array( 'name' => 'cta', 'label' => 'CTA', - 'type' => 'link' - ) - ) - ) - ) + 'type' => 'link', + ), + ), + ), + ), ), ), 'location' => array( @@ -74,20 +74,20 @@ public function tearDown() { * Test default page serialization */ public function test_flexible_content_serialization() { - $content = array( + $content = array( 'post_title' => 'Title', 'meta_input' => array( '_wp_page_template' => 'flex_components', - ) + ), ); $components = array( array( 'title' => 'Test Title', 'cta' => null, - 'acf_fc_layout' => 'callout' - ) + 'acf_fc_layout' => 'callout', + ), ); - $page = $this->factory->post->create_and_get( $content ); + $page = $this->factory->post->create_and_get( $content ); update_field( 'field_flex_components_components', $components, $page->ID ); $result = Serializers\page_data( $page ); diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index 3d1d366..e8f9c34 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -100,24 +100,29 @@ public function test_wp_update_nav_menu() { * Test ep_skip_indexing filter */ public function test_ep_skip_indexing_filter() { - $post_content = array( + $post_content = array( 'post_title' => 'This will be indexed', - 'post_type' => 'post' + 'post_type' => 'post', ); $skip_post_content = array( 'post_title' => 'This will not be indexed', - 'post_type' => 'skip_post' + 'post_type' => 'skip_post', ); - add_filter('ep_insert_post_object_filter', function($object) { - $skip_indexing = array( - 'skip_post' - ); - if (in_array($object->post_type, $skip_indexing)) { - $object->skip_indexing = true; - } - return $object; - }, 10, 2); + add_filter( + 'ep_insert_post_object_filter', + function( $object ) { + $skip_indexing = array( + 'skip_post', + ); + if ( in_array( $object->post_type, $skip_indexing ) ) { + $object->skip_indexing = true; + } + return $object; + }, + 10, + 2 + ); $post = $this->factory->post->create_and_get( $post_content ); do_action( 'wp_insert_post', $post->ID, $post, true ); @@ -129,7 +134,7 @@ public function test_ep_skip_indexing_filter() { $found_post = elasticsearch_find( $post->ID, 'post' ); $this->assertEquals( $found_post['post_title'], 'This will be indexed' ); - $skip_post_exists = get_post( $skip_post->ID); + $skip_post_exists = get_post( $skip_post->ID ); // $skip_post_is_not_indexed = elasticsearch_find( $skip_post->ID, 'do_not_index' ); $this->assertEquals( $skip_post_exists->post_title, 'This will not be indexed' ); // $this->assertEquals( $skip_is_not_indexed, 'This will not be indexed' ); From 942a14ad35ae4886ff9c7f20f6fe552d5c147bfc Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Tue, 22 Jun 2021 16:38:29 -0400 Subject: [PATCH 22/38] fix delete query --- includes/elasticsearch/class-client.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index b6b5b53..20af21d 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -424,6 +424,7 @@ function( $record ) { public static function delete_where( $index, $params ) { $index_name = self::read_index_alias( $index ); $query_params = self::where_query( $index, $params ); + unset( $query_params['from'] ); self::client()->deleteByQuery( $query_params ); } From ef399bd3171db3a114a9a9630940576312fedd61 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Mon, 26 Jul 2021 14:31:57 -0400 Subject: [PATCH 23/38] add forward / backward compatibility for yoast versions 15 and 16 --- includes/seo.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/seo.php b/includes/seo.php index b1a5d3c..0d1832f 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -25,7 +25,10 @@ function get_yoast_head( $id, $type ) { } else { $context = $action->for_post( $id ); } - $head = $context->head; + // v15 of Yoast uses "head" and v16+ uses "html" + // in order to keep both versions working simultaneously we use the + // Null Coalescing Operator (??) + $head = $context->head ?? $context->html; return $head; } From e1228de3b5b17dde380bde5b1b30a8d922aaa15f Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 29 Jul 2021 12:07:51 -0400 Subject: [PATCH 24/38] make title and description more bulletproof --- includes/seo.php | 56 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/includes/seo.php b/includes/seo.php index 0d1832f..84fb5a5 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -32,6 +32,38 @@ function get_yoast_head( $id, $type ) { return $head; } +/** +* Get Yoast title +* +* @param String $id The id for the data. +* @param String $type The type of post. +* @return String $title +*/ +function get_yoast_title( $id, $type ) { + if ( 'term' === $type ) { + $context = YoastSEO()->meta->for_term( $id ); + } else { + $context = YoastSEO()->meta->for_post( $id ); + } + return $context->title; +} + +/** +* Get Yoast description +* +* @param String $id The id for the data. +* @param String $type The type of post. +* @return String $description +*/ +function get_yoast_description( $id, $type ) { + if ( 'term' === $type ) { + $context = YoastSEO()->meta->for_term( $id ); + } else { + $context = YoastSEO()->meta->for_post( $id ); + } + return $context->description; +} + /** * Serialize SEO data from Yoast * @@ -44,30 +76,34 @@ function get_seo_data( $id, $type ) { $head = get_yoast_head( $id, $type ); $doc = new \DOMDocument(); $doc->loadHTML( $head ); - $tags = $doc->getElementsByTagName( 'meta' ); - $scripts = $doc->getElementsByTagName( 'script' ); - $title = null; - $meta = array(); + $tags = $doc->getElementsByTagName( 'meta' ); + $scripts = $doc->getElementsByTagName( 'script' ); + $title = get_yoast_title( $id, $type ); + $description = get_yoast_description( $id, $type ); + $meta = array(); foreach ( $tags as $tag ) { $piece = array(); foreach ( $keys as $key ) { if ( $tag->hasAttribute( $key ) ) { $attribute = $tag->getAttribute( $key ); - if ( 'property' === $key && 'og:title' === $attribute ) { - $title = $tag->getAttribute( 'content' ); - } $piece[ $key ] = $attribute; } } + if ( preg_match( "/title/", $piece['property'] ) ) { + $piece['content'] = $title; + } + if ( preg_match( "/description/", $piece['property'] ) ) { + $piece['content'] = $description; + } array_push( $meta, $piece ); } $output = array( 'meta' => $meta ); - if ( $title ) { - $output['title'] = $title; - } + if ( $title ) $output['title'] = $title; + if ( $description ) $output['description'] = $description; + if ( $scripts[0] ) { $output['schema'] = $scripts[0]->nodeValue; } From 04d31e3762b743f5e01da7801b94b586fd6d6382 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 29 Jul 2021 12:19:00 -0400 Subject: [PATCH 25/38] add isset check --- includes/seo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/seo.php b/includes/seo.php index 84fb5a5..5bf08d7 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -90,10 +90,10 @@ function get_seo_data( $id, $type ) { $piece[ $key ] = $attribute; } } - if ( preg_match( "/title/", $piece['property'] ) ) { + if ( isset( $piece['property'] ) && preg_match( "/title/", $piece['property'] ) ) { $piece['content'] = $title; } - if ( preg_match( "/description/", $piece['property'] ) ) { + if ( isset( $piece['property'] ) && preg_match( "/description/", $piece['property'] ) ) { $piece['content'] = $description; } array_push( $meta, $piece ); From 42bc7c68766179dc644870b1b613cfcc2d268f3c Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 11 Aug 2021 15:38:04 -0400 Subject: [PATCH 26/38] add elasticsearch search method to give a more generic wrapper than `where` and add ID key to options for easier searchability --- includes/acf.php | 13 ++++++ includes/elasticsearch/class-client.php | 25 ++++++++++++ includes/seo.php | 54 +++++++++++++------------ includes/storage.php | 1 + includes/utils/class-inlinesvg.php | 2 +- tests/test-elasticsearch.php | 5 ++- tests/test-wp-save-hooks.php | 1 + 7 files changed, 74 insertions(+), 27 deletions(-) diff --git a/includes/acf.php b/includes/acf.php index d362018..44d8801 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -40,6 +40,19 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { case 'repeater': if ( ! is_array( $value ) ) { $value = parse_repeater_field( $field, $value, $data, $base_prefix ); + } else { + // pre-parsed repeater fields do not have images parsed so we + // check for all images and parse them. + foreach ( $value as $index => $repeater_field ) { + $new_value = array(); + foreach ( $repeater_field as $key => $repeater_value ) { + if ( isset( $repeater_value['type'] ) && 'image' === $repeater_value['type'] ) { + $repeater_value = get_acf_image( $repeater_value ); + } + $new_value[ $key ] = $repeater_value; + } + $value[ $index ] = $new_value; + } } break; case 'post_object': diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index 20af21d..4f12dc6 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -140,6 +140,31 @@ public static function find( $id, $index ) { } } + /** + * Gets all published documents with a url, a.k.a. pages + * + * @param array $body The query body. + */ + public static function search( $body ) { + $params = array( + 'body' => $body, + 'index' => self::read_index_alias( '*' ), + 'size' => 10000, + ); + $results = self::client()->search( $params ); + if ( empty( $results['hits']['hits'] ) ) { + $records = array(); + } else { + $records = array_map( + function( $record ) { + return $record['_source']; + }, + $results['hits']['hits'] + ); + } + return $records; + } + /** * Gets all published documents with a url, a.k.a. pages */ diff --git a/includes/seo.php b/includes/seo.php index 5bf08d7..efe7571 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -33,35 +33,35 @@ function get_yoast_head( $id, $type ) { } /** -* Get Yoast title -* -* @param String $id The id for the data. -* @param String $type The type of post. -* @return String $title -*/ + * Get Yoast title + * + * @param String $id The id for the data. + * @param String $type The type of post. + * @return String $title + */ function get_yoast_title( $id, $type ) { - if ( 'term' === $type ) { + if ( 'term' === $type ) { $context = YoastSEO()->meta->for_term( $id ); - } else { + } else { $context = YoastSEO()->meta->for_post( $id ); - } - return $context->title; + } + return $context->title; } /** -* Get Yoast description -* -* @param String $id The id for the data. -* @param String $type The type of post. -* @return String $description -*/ + * Get Yoast description + * + * @param String $id The id for the data. + * @param String $type The type of post. + * @return String $description + */ function get_yoast_description( $id, $type ) { - if ( 'term' === $type ) { + if ( 'term' === $type ) { $context = YoastSEO()->meta->for_term( $id ); - } else { + } else { $context = YoastSEO()->meta->for_post( $id ); - } - return $context->description; + } + return $context->description; } /** @@ -86,14 +86,14 @@ function get_seo_data( $id, $type ) { $piece = array(); foreach ( $keys as $key ) { if ( $tag->hasAttribute( $key ) ) { - $attribute = $tag->getAttribute( $key ); + $attribute = $tag->getAttribute( $key ); $piece[ $key ] = $attribute; } } - if ( isset( $piece['property'] ) && preg_match( "/title/", $piece['property'] ) ) { + if ( isset( $piece['property'] ) && preg_match( '/title/', $piece['property'] ) ) { $piece['content'] = $title; } - if ( isset( $piece['property'] ) && preg_match( "/description/", $piece['property'] ) ) { + if ( isset( $piece['property'] ) && preg_match( '/description/', $piece['property'] ) ) { $piece['content'] = $description; } array_push( $meta, $piece ); @@ -101,8 +101,12 @@ function get_seo_data( $id, $type ) { $output = array( 'meta' => $meta ); - if ( $title ) $output['title'] = $title; - if ( $description ) $output['description'] = $description; + if ( $title ) { + $output['title'] = $title; + } + if ( $description ) { + $output['description'] = $description; + } if ( $scripts[0] ) { $output['schema'] = $scripts[0]->nodeValue; diff --git a/includes/storage.php b/includes/storage.php index d2a3160..7e239d7 100644 --- a/includes/storage.php +++ b/includes/storage.php @@ -93,6 +93,7 @@ function store_options( $id ) { } foreach ( $clean_data as $key => $value ) { + $value['ID'] = $key; ElasticSearch\elasticsearch_store( $key, 'options', $value ); } } diff --git a/includes/utils/class-inlinesvg.php b/includes/utils/class-inlinesvg.php index 982b4b9..a4248d5 100644 --- a/includes/utils/class-inlinesvg.php +++ b/includes/utils/class-inlinesvg.php @@ -23,7 +23,7 @@ class InlineSVG { public static function remote( $remote_url ) { $file_contents = file_get_contents( $remote_url ); $headers = FileHelpers::parse_headers( $http_response_header ); - if ( 'gzip' === $headers['Content-Encoding'] ) { + if ( isset( $headers['Content-Encoding'] ) && 'gzip' === $headers['Content-Encoding'] ) { $file_contents = gzinflate( substr( $file_contents, 10, -8 ) ); } return $file_contents; diff --git a/tests/test-elasticsearch.php b/tests/test-elasticsearch.php index 1cfe158..f34b4b3 100644 --- a/tests/test-elasticsearch.php +++ b/tests/test-elasticsearch.php @@ -149,7 +149,10 @@ public function test_store_options() { Storage\store_options( 'options' ); ElasticSearch\Client::update_read_aliases(); $found = elasticsearch_find( 'globalOptionsComponentSomePage', 'options' ); - $this->assertEquals( $found, array( 'some_data' => 'test' ) ); + $this->assertEquals( $found, array( + 'some_data' => 'test', + 'ID' => 'globalOptionsComponentSomePage' + ) ); } /** diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index e8f9c34..3d2b0b2 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -62,6 +62,7 @@ public function test_acf_save_post() { $found, array( 'test_option' => 'test', + 'ID' => 'globalOptionsComponentSomeOptionsPage' ) ); } From 9076e63979f48e67d4efbb7a9d5ce947ee99189a Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 18 Aug 2021 19:01:17 -0400 Subject: [PATCH 27/38] ensure only single options page is saved at a time --- includes/storage.php | 5 ++++- includes/wp-save-hooks.php | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/storage.php b/includes/storage.php index 7e239d7..a9f115d 100644 --- a/includes/storage.php +++ b/includes/storage.php @@ -81,7 +81,7 @@ function store_terms_data( $type ) { * * @param string $id The prefix for values in the options table. */ -function store_options( $id ) { +function store_options( $id, $page = null ) { $data = acf_data( $id ); $clean_data = array(); foreach ( $data as $key => $value ) { @@ -94,6 +94,9 @@ function store_options( $id ) { foreach ( $clean_data as $key => $value ) { $value['ID'] = $key; + if ( $page && $page !== $key ) { + continue; + } ElasticSearch\elasticsearch_store( $key, 'options', $value ); } } diff --git a/includes/wp-save-hooks.php b/includes/wp-save-hooks.php index 2f58d90..4a7157a 100644 --- a/includes/wp-save-hooks.php +++ b/includes/wp-save-hooks.php @@ -62,7 +62,8 @@ function acf_save_post( $id = null ) { if ( strpos( $id, 'term_' ) === 0 ) { return; } - Storage\store_options( $id ); + $page = ( isset( $_GET['page'] ) ) ? $_GET['page'] : null; + Storage\store_options( $id, $page ); } /** From 4c5b61828ae51fc733c616a975e2622844a188e1 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Wed, 18 Aug 2021 19:01:23 -0400 Subject: [PATCH 28/38] code styling --- tests/test-elasticsearch.php | 11 +++++++---- tests/test-wp-save-hooks.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test-elasticsearch.php b/tests/test-elasticsearch.php index f34b4b3..0909635 100644 --- a/tests/test-elasticsearch.php +++ b/tests/test-elasticsearch.php @@ -149,10 +149,13 @@ public function test_store_options() { Storage\store_options( 'options' ); ElasticSearch\Client::update_read_aliases(); $found = elasticsearch_find( 'globalOptionsComponentSomePage', 'options' ); - $this->assertEquals( $found, array( - 'some_data' => 'test', - 'ID' => 'globalOptionsComponentSomePage' - ) ); + $this->assertEquals( + $found, + array( + 'some_data' => 'test', + 'ID' => 'globalOptionsComponentSomePage', + ) + ); } /** diff --git a/tests/test-wp-save-hooks.php b/tests/test-wp-save-hooks.php index 3d2b0b2..dc5c87e 100644 --- a/tests/test-wp-save-hooks.php +++ b/tests/test-wp-save-hooks.php @@ -62,7 +62,7 @@ public function test_acf_save_post() { $found, array( 'test_option' => 'test', - 'ID' => 'globalOptionsComponentSomeOptionsPage' + 'ID' => 'globalOptionsComponentSomeOptionsPage', ) ); } From 458a5251da0ebe8f43fafc5fac8ae840bc32a601 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 19 Aug 2021 14:42:42 -0400 Subject: [PATCH 29/38] sometimes $repeater_value is not an array and checking if string isset breaks without error --- includes/acf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/acf.php b/includes/acf.php index 44d8801..71c2df4 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -46,7 +46,7 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { foreach ( $value as $index => $repeater_field ) { $new_value = array(); foreach ( $repeater_field as $key => $repeater_value ) { - if ( isset( $repeater_value['type'] ) && 'image' === $repeater_value['type'] ) { + if ( is_array( $repeater_value ) && isset( $repeater_value['type'] ) && 'image' === $repeater_value['type'] ) { $repeater_value = get_acf_image( $repeater_value ); } $new_value[ $key ] = $repeater_value; From 164b6d078493a07a76db61960ef3315a8faec3f3 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 16 Sep 2021 12:32:05 -0400 Subject: [PATCH 30/38] code quality cleanup --- includes/seo.php | 2 +- includes/storage.php | 1 + includes/wp-save-hooks.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/seo.php b/includes/seo.php index efe7571..69e22c6 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -27,7 +27,7 @@ function get_yoast_head( $id, $type ) { } // v15 of Yoast uses "head" and v16+ uses "html" // in order to keep both versions working simultaneously we use the - // Null Coalescing Operator (??) + // Null Coalescing Operator (??). $head = $context->head ?? $context->html; return $head; } diff --git a/includes/storage.php b/includes/storage.php index a9f115d..ace0b64 100644 --- a/includes/storage.php +++ b/includes/storage.php @@ -80,6 +80,7 @@ function store_terms_data( $type ) { * Serializes and stores an options page into elasticsearch * * @param string $id The prefix for values in the options table. + * @param string $page The specific option page name. */ function store_options( $id, $page = null ) { $data = acf_data( $id ); diff --git a/includes/wp-save-hooks.php b/includes/wp-save-hooks.php index 4a7157a..62283b9 100644 --- a/includes/wp-save-hooks.php +++ b/includes/wp-save-hooks.php @@ -62,7 +62,7 @@ function acf_save_post( $id = null ) { if ( strpos( $id, 'term_' ) === 0 ) { return; } - $page = ( isset( $_GET['page'] ) ) ? $_GET['page'] : null; + $page = ( isset( $_GET['page'] ) ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : null; Storage\store_options( $id, $page ); } From 913c4eb38c9ff7f71bd0b0b808558055d604556f Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 16 Sep 2021 12:32:45 -0400 Subject: [PATCH 31/38] add before hook to setter --- includes/elasticsearch/class-client.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/elasticsearch/class-client.php b/includes/elasticsearch/class-client.php index 4f12dc6..2bee701 100644 --- a/includes/elasticsearch/class-client.php +++ b/includes/elasticsearch/class-client.php @@ -92,6 +92,14 @@ public static function set( $id, $index, $value ) { $index_name = self::write_index_alias( $index ); try { + do_action( + 'ep_elasticsearch_before_set', + array( + 'index' => $index, + 'id' => $id, + 'value' => $value, + ) + ); self::client()->index( array( 'index' => $index_name, From d0735e29f856c553bbe3290c7a13c34cb02f64e3 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 16 Sep 2021 12:33:25 -0400 Subject: [PATCH 32/38] fix group serialization bug where non-set fields were getting set incorrectly --- includes/acf.php | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/includes/acf.php b/includes/acf.php index 71c2df4..5aa5765 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -27,7 +27,12 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { // The default `image` metadata is just the attachment id // the image array is much more useful. case 'image': - $value = get_acf_image( $value ); + $value = ( ! empty( $value ) ) ? get_acf_image( $value ) : $value; + break; + case 'oembed': + if ( empty( $value ) ) { + $value = ''; + } break; case 'file': if ( ! is_array( $value ) ) { @@ -115,14 +120,13 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { * @return Array */ function get_acf_image( $value ) { - if ( is_array( $value ) ) { - if ( isset( $value['mime_type'] ) && 'image/svg+xml' === $value['mime_type'] ) { - $value['raw'] = InlineSVG::remote( $value['url'] ); - } - return $value; - } else { - return get_image_array( $value ); + if ( ! is_array( $value ) ) { + $value = get_image_array( $value ); } + if ( isset( $value['mime_type'] ) && 'image/svg+xml' === $value['mime_type'] ) { + $value['raw'] = InlineSVG::remote( $value['url'] ); + } + return $value; } /** @@ -193,21 +197,14 @@ function parse_group_field( $field, $value, $data, $base_prefix ) { foreach ( $sub_fields as $sub_field ) { $sub_field_key = $sub_field['name']; $prefix = field_prefix( $base_prefix, $field['name'], $sub_field_key ); + $val = $value; - // FIXME: Why are we using $value? (repeater doesn't). - if ( isset( $value[ $sub_field_key ] ) ) { + if ( is_array( $value ) && array_key_exists( $sub_field_key, $value ) ) { + // For non-gutenberge serialization. $val = parse_acf_field( $sub_field, $value[ $sub_field_key ], $data, $prefix ); - if ( isset( $val['mime_type'] ) && 'image/svg+xml' === $val['mime_type'] ) { - $val['raw'] = InlineSVG::remote( $val['url'] ); - } - } else { - if ( isset( $data[ $prefix ] ) ) { - $val = parse_acf_field( $sub_field, $data[ $prefix ], $data, $prefix ); - } elseif ( 'link' === $sub_field['type'] && isset( $value[ $sub_field['name'] ] ) ) { - $val = parse_acf_field( $sub_field, $value[ $sub_field['name'] ], $data, $prefix ); - } else { - $val = $value; - } + } elseif ( isset( $data[ $prefix ] ) ) { + // For gutenberg serialization. + $val = parse_acf_field( $sub_field, $data[ $prefix ], $data, $prefix ); } $value_array[ $sub_field_key ] = $val; } From 17204bbf57a942fb1ad5d94bb3a051807d7a39d8 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Tue, 28 Sep 2021 14:42:14 -0400 Subject: [PATCH 33/38] fix test suite --- bin/install-tests | 4 +- composer.json | 5 +- composer.lock | 1297 ++++++++++++++++++++++++++----------------- tests/bootstrap.php | 3 + 4 files changed, 795 insertions(+), 514 deletions(-) diff --git a/bin/install-tests b/bin/install-tests index 7ca7c87..200148f 100755 --- a/bin/install-tests +++ b/bin/install-tests @@ -6,6 +6,8 @@ source '.env.test'; version=latest +mysql -u $DB_USER -e "DROP DATABASE $DB_NAME;" + # when you are installing test suite for first time if you want to create the # database remove the last argument "true" -bin/install-wp-tests.sh "$DB_NAME" "$DB_USER" "$DB_PASSWORD" "$DB_HOST" "$version" "true" +bin/install-wp-tests.sh "$DB_NAME" "$DB_USER" "$DB_PASSWORD" "$DB_HOST" "$version" diff --git a/composer.json b/composer.json index dae4be1..9d51d09 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "advanced-custom-fields/advanced-custom-fields-pro": "*", "flyntwp/acf-field-group-composer": "dev-flattenNestedFilters", "elasticsearch/elasticsearch": "^6.1", - "yoast/wordpress-seo-premium": "*", + "yoast/wordpress-seo-premium": "^15.5", "jsq/amazon-es-php": "^0.3.0", "aws/aws-sdk-php": "^3.161" }, @@ -52,7 +52,8 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.6", "wp-coding-standards/wpcs": "*", "vlucas/phpdotenv": "^2.2.0", - "oscarotero/env": "^1.1.0" + "oscarotero/env": "^1.1.0", + "yoast/phpunit-polyfills": "^1.0" }, "extra": { "installer-paths": { diff --git a/composer.lock b/composer.lock index 5f9c63b..14bb8fe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e433dc1cc9cba9916836aa51dc70116a", + "content-hash": "ae34f8ee667398c4e9a62d61ebf6c6da", "packages": [ { "name": "advanced-custom-fields/advanced-custom-fields-pro", @@ -19,28 +19,75 @@ }, "type": "wordpress-plugin" }, + { + "name": "aws/aws-crt-php", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/awslabs/aws-crt-php.git", + "reference": "3942776a8c99209908ee0b287746263725685732" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/3942776a8c99209908ee0b287746263725685732", + "reference": "3942776a8c99209908ee0b287746263725685732", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.4.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "AWS SDK Common Runtime Team", + "email": "aws-sdk-common-runtime@amazon.com" + } + ], + "description": "AWS Common Runtime for PHP", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "crt", + "sdk" + ], + "time": "2021-09-03T22:57:30+00:00" + }, { "name": "aws/aws-sdk-php", - "version": "3.161.2", + "version": "3.195.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "2703896142f292058ce9d6c9026a9329a89778e0" + "reference": "e2ce251ca94661ee3d4b0b5e8cc67e964b2e5f8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2703896142f292058ce9d6c9026a9329a89778e0", - "reference": "2703896142f292058ce9d6c9026a9329a89778e0", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e2ce251ca94661ee3d4b0b5e8cc67e964b2e5f8e", + "reference": "e2ce251ca94661ee3d4b0b5e8cc67e964b2e5f8e", "shasum": "" }, "require": { + "aws/aws-crt-php": "^1.0.2", "ext-json": "*", "ext-pcre": "*", "ext-simplexml": "*", "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4.1", - "mtdowling/jmespath.php": "^2.5", + "guzzlehttp/promises": "^1.4.0", + "guzzlehttp/psr7": "^1.7.0", + "mtdowling/jmespath.php": "^2.6", "php": ">=5.5" }, "require-dev": { @@ -102,20 +149,20 @@ "s3", "sdk" ], - "time": "2020-11-16T19:11:59+00:00" + "time": "2021-09-27T18:14:14+00:00" }, { "name": "composer/installers", - "version": "v1.9.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca" + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca", - "reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca", + "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", "shasum": "" }, "require": { @@ -126,17 +173,18 @@ "shama/baton": "*" }, "require-dev": { - "composer/composer": "1.6.* || 2.0.*@dev", - "composer/semver": "1.0.* || 2.0.*@dev", - "phpunit/phpunit": "^4.8.36", - "sebastian/comparator": "^1.2.4", + "composer/composer": "1.6.* || ^2.0", + "composer/semver": "^1 || ^3", + "phpstan/phpstan": "^0.12.55", + "phpstan/phpstan-phpunit": "^0.12.16", + "symfony/phpunit-bridge": "^4.2 || ^5", "symfony/process": "^2.3" }, "type": "composer-plugin", "extra": { "class": "Composer\\Installers\\Plugin", "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "1.x-dev" } }, "autoload": { @@ -174,6 +222,7 @@ "Porto", "RadPHP", "SMF", + "Starbug", "Thelia", "Whmcs", "WolfCMS", @@ -207,13 +256,16 @@ "majima", "mako", "mediawiki", + "miaoxing", "modulework", "modx", "moodle", "osclass", + "pantheon", "phpbb", "piwik", "ppi", + "processwire", "puppet", "pxcms", "reindex", @@ -223,13 +275,28 @@ "sydes", "sylius", "symfony", + "tastyigniter", "typo3", "wordpress", "yawik", "zend", "zikula" ], - "time": "2020-04-07T06:57:05+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-09-13T08:19:44+00:00" }, { "name": "elasticsearch/elasticsearch", @@ -297,12 +364,12 @@ "source": { "type": "git", "url": "https://github.com/jGRUBBS/acf-field-group-composer.git", - "reference": "908d34676b95e8a86a560c4f98bf2dc99601c66f" + "reference": "997282e55fe99300bcaaa5a82b8d5f2479e21679" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jGRUBBS/acf-field-group-composer/zipball/908d34676b95e8a86a560c4f98bf2dc99601c66f", - "reference": "908d34676b95e8a86a560c4f98bf2dc99601c66f", + "url": "https://api.github.com/repos/jGRUBBS/acf-field-group-composer/zipball/997282e55fe99300bcaaa5a82b8d5f2479e21679", + "reference": "997282e55fe99300bcaaa5a82b8d5f2479e21679", "shasum": "" }, "require": { @@ -314,6 +381,11 @@ "squizlabs/php_codesniffer": "~2.0" }, "type": "wordpress-plugin", + "autoload": { + "psr-4": { + "ACFComposer\\": "lib/ACFComposer" + } + }, "authors": [ { "name": "bleech", @@ -323,48 +395,41 @@ "support": { "source": "https://github.com/jGRUBBS/acf-field-group-composer/tree/flattenNestedFilters" }, - "time": "2019-02-06T20:42:04+00:00" + "time": "2020-09-10T10:58:50+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.0.1", + "version": "6.5.5", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "2d9d3c186a6637a43193e66b097c50e4451eaab2" + "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/2d9d3c186a6637a43193e66b097c50e4451eaab2", - "reference": "2d9d3c186a6637a43193e66b097c50e4451eaab2", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.0", "guzzlehttp/psr7": "^1.6.1", - "php": "^7.2.5", - "psr/http-client": "^1.0" - }, - "provide": { - "psr/http-client-implementation": "1.0" + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.17.0" }, "require-dev": { - "ergebnis/composer-normalize": "^2.0", "ext-curl": "*", - "php-http/client-integration-tests": "dev-phpunit8", - "phpunit/phpunit": "^8.5.5", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", "psr/log": "^1.1" }, "suggest": { - "ext-curl": "Required for CURL handler support", - "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "6.5-dev" } }, "autoload": { @@ -384,11 +449,6 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" } ], "description": "Guzzle is a PHP HTTP client library", @@ -399,32 +459,30 @@ "framework", "http", "http client", - "psr-18", - "psr-7", "rest", "web service" ], - "time": "2020-06-27T10:33:25+00:00" + "time": "2020-06-16T21:01:06+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", + "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -455,20 +513,20 @@ "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "time": "2021-03-07T09:25:29+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "dc960a912984efb74d0a90222870c72c87f10c91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", + "reference": "dc960a912984efb74d0a90222870c72c87f10c91", "shasum": "" }, "require": { @@ -481,15 +539,15 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -526,7 +584,7 @@ "uri", "url" ], - "time": "2019-07-01T23:21:34+00:00" + "time": "2021-04-26T09:17:50+00:00" }, { "name": "guzzlehttp/ringphp", @@ -680,20 +738,20 @@ }, { "name": "league/oauth2-client", - "version": "2.5.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/oauth2-client.git", - "reference": "d9f2a1e000dc14eb3c02e15d15759385ec7ff0fb" + "reference": "cc114abc622a53af969e8664722e84ca36257530" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/d9f2a1e000dc14eb3c02e15d15759385ec7ff0fb", - "reference": "d9f2a1e000dc14eb3c02e15d15759385ec7ff0fb", + "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/cc114abc622a53af969e8664722e84ca36257530", + "reference": "cc114abc622a53af969e8664722e84ca36257530", "shasum": "" }, "require": { - "guzzlehttp/guzzle": "^6.0 || ^7.0", + "guzzlehttp/guzzle": "^6.0", "paragonie/random_compat": "^1|^2|^9.99", "php": "^5.6|^7.0" }, @@ -743,20 +801,20 @@ "oauth2", "single sign on" ], - "time": "2020-07-18T17:54:32+00:00" + "time": "2018-11-22T18:33:57+00:00" }, { "name": "mtdowling/jmespath.php", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb" + "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/42dae2cbd13154083ca6d70099692fef8ca84bfb", - "reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/9b87907a81b87bc76d19a7fb2d61e61486ee9edb", + "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb", "shasum": "" }, "require": { @@ -764,7 +822,7 @@ "symfony/polyfill-mbstring": "^1.17" }, "require-dev": { - "composer/xdebug-handler": "^1.4", + "composer/xdebug-handler": "^1.4 || ^2.0", "phpunit/phpunit": "^4.8.36 || ^7.5.15" }, "bin": [ @@ -800,24 +858,24 @@ "json", "jsonpath" ], - "time": "2020-07-31T21:01:56+00:00" + "time": "2021-06-14T00:11:39+00:00" }, { "name": "paragonie/random_compat", - "version": "v9.99.99", + "version": "v9.99.100", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", "shasum": "" }, "require": { - "php": "^7" + "php": ">= 7" }, "require-dev": { "phpunit/phpunit": "4.*|5.*", @@ -845,7 +903,7 @@ "pseudorandom", "random" ], - "time": "2018-07-02T15:55:56+00:00" + "time": "2020-10-15T08:29:30+00:00" }, { "name": "philippbaschke/acf-pro-installer", @@ -905,29 +963,29 @@ }, { "name": "pimple/pimple", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "e55d12f9d6a0e7f9c85992b73df1267f46279930" + "reference": "86406047271859ffc13424a048541f4531f53601" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/e55d12f9d6a0e7f9c85992b73df1267f46279930", - "reference": "e55d12f9d6a0e7f9c85992b73df1267f46279930", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/86406047271859ffc13424a048541f4531f53601", + "reference": "86406047271859ffc13424a048541f4531f53601", "shasum": "" }, "require": { - "php": "^7.2.5", - "psr/container": "^1.0" + "php": ">=7.2.5", + "psr/container": "^1.1" }, "require-dev": { - "symfony/phpunit-bridge": "^3.4|^4.4|^5.0" + "symfony/phpunit-bridge": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3.x-dev" + "dev-master": "3.4.x-dev" } }, "autoload": { @@ -951,31 +1009,26 @@ "container", "dependency injection" ], - "time": "2020-03-03T09:12:48+00:00" + "time": "2021-03-06T08:28:00+00:00" }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.2.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -988,7 +1041,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -1000,56 +1053,7 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/http-client", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP clients", - "homepage": "https://github.com/php-fig/http-client", - "keywords": [ - "http", - "http-client", - "psr", - "psr-18" - ], - "time": "2020-06-29T06:28:15+00:00" + "time": "2021-03-05T17:36:06+00:00" }, { "name": "psr/http-message", @@ -1103,16 +1107,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -1136,7 +1140,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1146,7 +1150,7 @@ "psr", "psr-3" ], - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "ralouphie/getallheaders", @@ -1236,16 +1240,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v3.4.43", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "3a14abc01c36e81fc1c4c48b42c103b9dd892ed3" + "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/3a14abc01c36e81fc1c4c48b42c103b9dd892ed3", - "reference": "3a14abc01c36e81fc1c4c48b42c103b9dd892ed3", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/51d2a2708c6ceadad84393f8581df1dcf9e5e84b", + "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b", "shasum": "" }, "require": { @@ -1274,11 +1278,6 @@ "symfony/yaml": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" @@ -1317,24 +1316,24 @@ "type": "tidelift" } ], - "time": "2020-07-23T09:37:51+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.18.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", - "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" @@ -1342,7 +1341,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1363,21 +1362,263 @@ ], "authors": [ { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", + "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:27:20+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.23.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "ctype", + "mbstring", "polyfill", - "portable" + "portable", + "shim" ], "funding": [ { @@ -1393,32 +1634,29 @@ "type": "tidelift" } ], - "time": "2020-07-14T12:35:20+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.20.0", + "name": "symfony/polyfill-php72", + "version": "v1.23.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", "shasum": "" }, "require": { "php": ">=7.1" }, - "suggest": { - "ext-mbstring": "For best performance" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1427,7 +1665,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Php72\\": "" }, "files": [ "bootstrap.php" @@ -1447,11 +1685,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", "polyfill", "portable", "shim" @@ -1470,20 +1707,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-05-27T09:17:38+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v2.6.6", + "version": "v2.6.7", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "e1d57f62db3db00d9139078cbedf262280701479" + "reference": "b786088918a884258c9e3e27405c6a4cf2ee246e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/e1d57f62db3db00d9139078cbedf262280701479", - "reference": "e1d57f62db3db00d9139078cbedf262280701479", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b786088918a884258c9e3e27405c6a4cf2ee246e", + "reference": "b786088918a884258c9e3e27405c6a4cf2ee246e", "shasum": "" }, "require": { @@ -1493,7 +1730,7 @@ "require-dev": { "ext-filter": "*", "ext-pcre": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7.27" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20" }, "suggest": { "ext-filter": "Required to use the boolean validator.", @@ -1542,7 +1779,7 @@ "type": "tidelift" } ], - "time": "2020-07-14T17:54:18+00:00" + "time": "2021-01-20T14:39:13+00:00" }, { "name": "yoast/i18n-module", @@ -1604,110 +1841,63 @@ }, "time": "2019-05-07T06:45:05+00:00" }, - { - "name": "yoast/license-manager", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/Yoast/License-Manager.git", - "reference": "fbacabb06d788912fead4f32d0d1d8b9a2d883c9" - }, - "dist": { - "type": "zip", - "url": "https://my.yoast.com/packages/dist/yoast/license-manager/yoast-license-manager-fbacabb06d788912fead4f32d0d1d8b9a2d883c9-zip-5d9715.zip", - "reference": "fbacabb06d788912fead4f32d0d1d8b9a2d883c9", - "shasum": "043ccf138562098d0055fc47f3feefc503567936" - }, - "type": "library", - "autoload": { - "classmap": [ - "class-api-request.php", - "class-license-manager.php", - "class-plugin-license-manager.php", - "class-plugin-update-manager.php", - "class-product.php", - "class-theme-license-manager.php", - "class-theme-update-manager.php", - "class-update-manager.php" - ] - }, - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Team Yoast", - "email": "support@yoast.com", - "homepage": "https://yoast.com" - } - ], - "description": "Yoast License Manager.", - "homepage": "https://github.com/Yoast/License-Manager", - "keywords": [ - "wordpress" - ], - "support": { - "issues": "https://github.com/Yoast/License-Manager/issues", - "source": "https://github.com/Yoast/License-Manager/tree/1.6.0" - }, - "time": "2017-08-22T07:59:16+00:00" - }, { "name": "yoast/wordpress-seo-premium", - "version": "14.8", + "version": "15.9.2", "source": { "type": "git", "url": "git@github.com:Yoast-dist/wordpress-seo-premium.git", - "reference": "112dbfbfc73224af1f304b5a502db0edbd5e3bd0" + "reference": "4552f9a6b687f827f55be784932d1dc7baf22236" }, "dist": { "type": "zip", - "url": "https://my.yoast.com/packages/dist/yoast/wordpress-seo-premium/yoast-wordpress-seo-premium-112dbfbfc73224af1f304b5a502db0edbd5e3bd0-zip-bd5c6c.zip", - "reference": "112dbfbfc73224af1f304b5a502db0edbd5e3bd0", - "shasum": "178994bac05a1c12674138aa63c7da8f8e54d5ff" + "url": "https://my.yoast.com/packages/dist/yoast/wordpress-seo-premium/yoast-wordpress-seo-premium-4552f9a6b687f827f55be784932d1dc7baf22236-zip-622f38.zip", + "reference": "4552f9a6b687f827f55be784932d1dc7baf22236", + "shasum": "6ec61bf642a6a6ceacf8c8dcf87a81d3b9cb363e" }, "require": { - "composer/installers": "~1.0", - "league/oauth2-client": "^2.4", + "composer/installers": "^1.9.0", + "league/oauth2-client": "2.4.1", "php": "^5.6.20||^7.0", "pimple/pimple": "^3.2", "psr/log": "^1.0", "symfony/dependency-injection": "^3.4", - "yoast/i18n-module": "^3.1.1", - "yoast/license-manager": "1.6.0" + "yoast/i18n-module": "^3.1.1" }, "require-dev": { - "atanamo/php-codeshift": "^1.0", - "brain/monkey": "^2.4", - "humbug/php-scoper": "^0.12.0", "php-parallel-lint/php-console-highlighter": "^0.5", "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpcompatibility/phpcompatibility-wp": "^2.0.0", + "phpunit/phpcov": "^3.1", "phpunit/phpunit": "^5.7", - "symfony/config": "^3.4", - "yoast/php-development-environment": "^1.0", - "yoast/yoastcs": "~0.4.3" + "yoast/wordpress-seo": "15.9.2", + "yoast/wp-test-utils": "^0.2.1", + "yoast/yoastcs": "^2.1.0" }, "type": "wordpress-plugin", + "extra": { + "installer-paths": { + "vendor/{$vendor}/{$name}": [ + "type:wordpress-plugin" + ] + } + }, "autoload": { "classmap": [ - "admin/", - "frontend/", - "inc/", - "deprecated/", + "classes/", "cli/", - "premium", "src/", - "lib/" + "premium.php" ], "exclude-from-classmap": [ - "/**/node_modules/" + "/**/node_modules/", + "vendor/yoast/wordpress-seo", + "vendor/yoast/i18n-module" ] }, "autoload-dev": { "classmap": [ - "tests/", - "config/" + "config/", + "tests/" ] }, "scripts": { @@ -1717,27 +1907,20 @@ "integration-test": [ "@php ./vendor/phpunit/phpunit/phpunit -c phpunit-integration.xml.dist" ], - "lint": [ - "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude vendor_prefixed --exclude node_modules --exclude .git" - ], - "lint-files": [ - "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint" - ], - "lint-branch": [ - "Yoast\\WP\\SEO\\Composer\\Actions::lint_branch" - ], - "lint-staged": [ - "Yoast\\WP\\SEO\\Composer\\Actions::lint_staged" + "compile-di": [ + "rm -f ./src/generated/container.php", + "rm -f ./src/generated/container.php.meta", + "composer du --no-scripts", + "Yoast\\WP\\SEO\\Premium\\Config\\Composer\\Actions::compile_dependency_injection_container" ], - "premium-lint": [ - "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint ./wp-seo-premium.php ./tests/unit/load/wp-seo-premium.php ./premium/ ./tests/integration/premium/ ./tests/unit/premium/ -e php" + "cs": [ + "Yoast\\WP\\SEO\\Premium\\Config\\Composer\\Actions::check_coding_standards" ], - "config-yoastcs": [ - "@php ./vendor/squizlabs/php_codesniffer/scripts/phpcs --config-set installed_paths ../../../vendor/wp-coding-standards/wpcs,../../../vendor/yoast/yoastcs,../../../vendor/phpcompatibility/php-compatibility,../../../vendor/phpcompatibility/phpcompatibility-paragonie,../../../vendor/phpcompatibility/phpcompatibility-wp", - "@php ./vendor/squizlabs/php_codesniffer/scripts/phpcs --config-set default_standard Yoast" + "lint": [ + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint --exclude vendor ./ -e php" ], - "cs": [ - "Yoast\\WP\\SEO\\Composer\\Actions::check_coding_standards" + "check-cs-summary": [ + "@check-cs-warnings --report=summary" ], "check-cs": [ "@check-cs-warnings -n" @@ -1747,72 +1930,34 @@ "composer check-cs" ], "check-cs-warnings": [ - "@php ./vendor/squizlabs/php_codesniffer/scripts/phpcs" - ], - "premium-check-cs": [ - "@before-premium-cs", - "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set ignore_warnings_on_exit 1", - "@after-premium-cs" + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs" ], "check-staged-cs": [ - "Yoast\\WP\\SEO\\Composer\\Actions::check_staged_cs" - ], - "check-branch-cs": [ - "Yoast\\WP\\SEO\\Composer\\Actions::check_branch_cs" + "@check-cs-warnings --filter=GitStaged" ], "fix-cs": [ - "@php ./vendor/squizlabs/php_codesniffer/scripts/phpcbf" - ], - "premium-fix-cs": [ - "@before-premium-cs", - "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf || true", - "@after-premium-cs" - ], - "before-premium-cs": [ - "composer require --dev yoast/yoastcs:~2.0.0 --update-with-dependencies --no-suggest --no-interaction --no-scripts", - "composer config-yoastcs-premium" - ], - "config-yoastcs-premium": [ - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run" - ], - "after-premium-cs": [ - "composer require --dev yoast/yoastcs:~0.4.3 --update-with-dependencies --no-suggest --no-interaction --no-scripts", - "@php ./config/composer/scripts/maybe-restore-composer-lock.php", - "composer config-yoastcs" - ], - "prefix-dependencies": [ - "composer prefix-oauth2-client", - "composer prefix-symfony" - ], - "prefix-oauth2-client": [ - "@php ./vendor/humbug/php-scoper/bin/php-scoper add-prefix --prefix=YoastSEO_Vendor --output-dir=./vendor_prefixed/league/oauth2-client --config=config/php-scoper/oauth2-client.inc.php --force --quiet", - "@php ./vendor/humbug/php-scoper/bin/php-scoper add-prefix --prefix=YoastSEO_Vendor --output-dir=./vendor_prefixed/guzzlehttp --config=config/php-scoper/guzzlehttp.inc.php --force --quiet", - "@php ./vendor/humbug/php-scoper/bin/php-scoper add-prefix --prefix=YoastSEO_Vendor --output-dir=./vendor_prefixed/psr --config=config/php-scoper/psr.inc.php --force --quiet" + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" ], - "prefix-symfony": [ - "@php ./vendor/humbug/php-scoper/bin/php-scoper add-prefix --prefix=YoastSEO_Vendor --output-dir=./vendor_prefixed/symfony/dependency-injection --config=config/php-scoper/dependency-injection.inc.php --force --quiet" + "lint-files": [ + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint" ], - "remove-vendor-prefixed-uses": [ - "@php ./vendor/atanamo/php-codeshift/bin/codeshift --mod=config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/src", - "@php ./vendor/atanamo/php-codeshift/bin/codeshift --mod=config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/src/config/migrations", - "@php ./vendor/atanamo/php-codeshift/bin/codeshift --mod=config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/lib" + "lint-branch": [ + "Yoast\\WP\\SEO\\Premium\\Config\\Composer\\Actions::lint_branch" ], - "remove-premium-vendor-prefixed-uses": [ - "@php ./vendor/atanamo/php-codeshift/bin/codeshift --mod=config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/premium/src", - "@php ./vendor/atanamo/php-codeshift/bin/codeshift --mod=config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/premium/migrations" + "lint-staged": [ + "Yoast\\WP\\SEO\\Premium\\Config\\Composer\\Actions::lint_staged" ], - "compile-di": [ - "rm -f ./src/generated/container.php", - "rm -f ./src/generated/container.php.meta", - "composer du --no-scripts", - "Yoast\\WP\\SEO\\Composer\\Actions::compile_dependency_injection_container" + "check-branch-cs": [ + "Yoast\\WP\\SEO\\Premium\\Config\\Composer\\Actions::check_branch_cs" ], - "post-autoload-dump": [ - "Yoast\\WP\\SEO\\Composer\\Actions::prefix_dependencies", + "post-install-cmd": [ + "cd vendor/yoast/wordpress-seo && composer install --ignore-platform-reqs && cd ../..", "composer compile-di" ], - "generate-migration": [ - "Yoast\\WP\\SEO\\Composer\\Actions::generate_migration" + "remove-vendor-prefixed-uses": [ + "@php ./vendor/yoast/wordpress-seo/vendor/atanamo/php-codeshift/bin/codeshift --mod=vendor/yoast/wordpress-seo/config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/src", + "@php ./vendor/yoast/wordpress-seo/vendor/atanamo/php-codeshift/bin/codeshift --mod=vendor/yoast/wordpress-seo/config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/vendor/yoast/wordpress-seo/src", + "@php ./vendor/yoast/wordpress-seo/vendor/atanamo/php-codeshift/bin/codeshift --mod=vendor/yoast/wordpress-seo/config/php-codeshift/remove-vendor-prefixing-codemod.php --src=artifact-composer/vendor/yoast/wordpress-seo/lib" ] }, "license": [ @@ -1832,12 +1977,10 @@ "wordpress" ], "support": { - "issues": "https://github.com/Yoast/wordpress-seo/issues", - "forum": "https://wordpress.org/support/plugin/wordpress-seo", - "wiki": "https://github.com/Yoast/wordpress-seo/wiki", - "source": "https://github.com/Yoast/wordpress-seo" + "issues": "https://github.com/Yoast/wordpress-seo-premium/issues", + "source": "https://github.com/Yoast/wordpress-seo-premium" }, - "time": "2020-08-18T09:36:59+00:00" + "time": "2021-03-11T09:59:43+00:00" } ], "packages-dev": [ @@ -1909,36 +2052,31 @@ }, { "name": "doctrine/instantiator", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -1952,7 +2090,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -1975,20 +2113,20 @@ "type": "tidelift" } ], - "time": "2020-05-29T17:27:14+00:00" + "time": "2020-11-10T18:47:58+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { @@ -2029,7 +2167,7 @@ "type": "tidelift" } ], - "time": "2020-06-29T13:22:24+00:00" + "time": "2020-11-13T09:40:50+00:00" }, { "name": "oscarotero/env", @@ -2236,28 +2374,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c" + "reference": "ddabec839cc003651f2ce695c938686d1086cf43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c", - "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", + "reference": "ddabec839cc003651f2ce695c938686d1086cf43", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "paragonie/random_compat": "dev-master", "paragonie/sodium_compat": "dev-master" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -2284,20 +2422,20 @@ "polyfill", "standards" ], - "time": "2019-11-04T15:17:54+00:00" + "time": "2021-02-15T10:24:51+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.0", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "41bef18ba688af638b7310666db28e1ea9158b2f" + "reference": "a792ab623069f0ce971b2417edef8d9632e32f75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f", - "reference": "41bef18ba688af638b7310666db28e1ea9158b2f", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/a792ab623069f0ce971b2417edef8d9632e32f75", + "reference": "a792ab623069f0ce971b2417edef8d9632e32f75", "shasum": "" }, "require": { @@ -2305,10 +2443,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -2334,7 +2472,7 @@ "standards", "wordpress" ], - "time": "2019-08-28T14:22:28+00:00" + "time": "2021-07-21T11:09:57+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2387,16 +2525,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.1", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { @@ -2435,20 +2573,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-08-15T11:14:08+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", "shasum": "" }, "require": { @@ -2456,7 +2594,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -2480,37 +2619,37 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "time": "2021-09-17T15:28:14+00:00" }, { "name": "phpspec/prophecy", - "version": "1.11.1", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2", - "phpdocumentor/reflection-docblock": "^5.0", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0" + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -2543,7 +2682,7 @@ "spy", "stub" ], - "time": "2020-07-08T12:44:21+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2610,23 +2749,23 @@ }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", + "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2656,7 +2795,13 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-19T06:46:01+00:00" }, { "name": "phpunit/php-text-template", @@ -2701,23 +2846,23 @@ }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2746,25 +2891,31 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.1.1", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.0" @@ -2795,8 +2946,14 @@ "keywords": [ "tokenizer" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "abandoned": true, - "time": "2019-09-17T06:23:10+00:00" + "time": "2021-07-26T12:15:06+00:00" }, { "name": "phpunit/phpunit", @@ -2884,23 +3041,23 @@ }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2925,29 +3082,35 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", "shasum": "" }, "require": { - "php": "^7.1", + "php": ">=7.1", "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2965,6 +3128,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -2976,10 +3143,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -2989,24 +3152,30 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:04:30+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.5 || ^8.0", @@ -3028,13 +3197,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -3045,24 +3214,30 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:59:04+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.5" @@ -3098,24 +3273,30 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", + "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.0", "sebastian/recursion-context": "^3.0" }, "require-dev": { @@ -3165,7 +3346,13 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:47:53+00:00" }, { "name": "sebastian/global-state", @@ -3220,20 +3407,20 @@ }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.0", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, @@ -3263,24 +3450,30 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -3308,24 +3501,30 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" @@ -3346,14 +3545,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -3361,24 +3560,30 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.1" }, "type": "library", "extra": { @@ -3403,7 +3608,13 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:30:19+00:00" }, { "name": "sebastian/version", @@ -3450,16 +3661,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.6", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", - "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", "shasum": "" }, "require": { @@ -3497,20 +3708,20 @@ "phpcs", "standards" ], - "time": "2020-08-10T04:50:15+00:00" + "time": "2021-04-09T00:54:41+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -3543,34 +3754,39 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -3592,7 +3808,7 @@ "check", "validate" ], - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -3639,6 +3855,65 @@ "wordpress" ], "time": "2020-05-13T23:57:56+00:00" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "f014fb21c2b0038fd329515d59025af42fb98715" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/f014fb21c2b0038fd329515d59025af42fb98715", + "reference": "f014fb21c2b0038fd329515d59025af42fb98715", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^0.5", + "php-parallel-lint/php-parallel-lint": "^1.3.0", + "yoast/yoastcs": "^2.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "files": [ + "phpunitpolyfills-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" + } + ], + "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", + "keywords": [ + "phpunit", + "polyfill", + "testing" + ], + "time": "2021-08-09T16:28:08+00:00" } ], "aliases": [], diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 85dee57..e25976a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -22,6 +22,9 @@ // Give access to test support functions. require_once 'support/nav-menus/functions.php'; +// Yoast has some phpunit-polyfills. +require_once 'vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php'; + /** * Manually load the plugin being tested. */ From 14068cee50a337883f70fac112cb248931a440f2 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Tue, 28 Sep 2021 14:42:30 -0400 Subject: [PATCH 34/38] add filters to seo data --- includes/seo.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/seo.php b/includes/seo.php index 69e22c6..c8fa0c1 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -96,9 +96,16 @@ function get_seo_data( $id, $type ) { if ( isset( $piece['property'] ) && preg_match( '/description/', $piece['property'] ) ) { $piece['content'] = $description; } + + $piece = apply_filters( 'ep_seo_meta_piece', $piece ); + if ( isset( $piece['name'] ) ) { + $piece = apply_filters( 'ep_seo_meta_piece_' . $piece['name'], $piece ); + } array_push( $meta, $piece ); } + $meta = apply_filters( 'ep_seo_meta', $meta ); + $output = array( 'meta' => $meta ); if ( $title ) { From faf96dbae521d61c841398ba37baff12fcd9cad2 Mon Sep 17 00:00:00 2001 From: Stephanie Rodrigues <> Date: Wed, 20 Oct 2021 11:21:46 -0400 Subject: [PATCH 35/38] Fix Schema Encoding to Render Special Characters --- includes/seo.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/seo.php b/includes/seo.php index c8fa0c1..f5a7731 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -116,7 +116,8 @@ function get_seo_data( $id, $type ) { } if ( $scripts[0] ) { - $output['schema'] = $scripts[0]->nodeValue; + $schema = json_decode($scripts[0]->nodeValue); + $output['schema'] = json_encode($schema, JSON_UNESCAPED_UNICODE); } return $output; From c56f39cab338e4f2794b71227e1d1059af57ed96 Mon Sep 17 00:00:00 2001 From: Stephanie Rodrigues <> Date: Thu, 28 Oct 2021 11:15:53 -0400 Subject: [PATCH 36/38] Fix SEO Content to Render Special Characters --- includes/seo.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/seo.php b/includes/seo.php index f5a7731..fa26eb8 100644 --- a/includes/seo.php +++ b/includes/seo.php @@ -99,6 +99,7 @@ function get_seo_data( $id, $type ) { $piece = apply_filters( 'ep_seo_meta_piece', $piece ); if ( isset( $piece['name'] ) ) { + $piece['content'] = utf8_decode($piece['content']); $piece = apply_filters( 'ep_seo_meta_piece_' . $piece['name'], $piece ); } array_push( $meta, $piece ); From 4a4cd66003bb18e6f1df43f6ed2e2a8719b4f247 Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Thu, 18 Nov 2021 17:18:10 -0500 Subject: [PATCH 37/38] add ability to skip processing for flexible content (was adding additional data to payload) --- includes/acf.php | 54 +++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/includes/acf.php b/includes/acf.php index 5aa5765..04b5cfc 100644 --- a/includes/acf.php +++ b/includes/acf.php @@ -73,36 +73,38 @@ function parse_acf_field( $field, $value, $data = array(), $base_prefix = '' ) { } break; case 'flexible_content': - $data = array(); - foreach ( $value as $index => $m ) { - $layout_idx = array_search( $m['acf_fc_layout'], array_column( $field['layouts'], 'name' ) ); - $layout = $field['layouts'][ $layout_idx ]; - $idx = 0; - foreach ( $m as $k => $mod ) { - if ( 'acf_fc_layout' === $k ) { - continue; - } - $f = false; - $keys = array( - $layout['key'] . "_$k", - str_replace( 'layout', 'field', $layout['name'] . "_$k" ), - $layout['key'] . '_' . $layout['name'], - ); - foreach ( $keys as $key ) { - if ( false !== $f ) { - break; + if (!getenv('ES_SKIP_ACF_PARSING')) { + $data = array(); + foreach ( $value as $index => $m ) { + $layout_idx = array_search( $m['acf_fc_layout'], array_column( $field['layouts'], 'name' ) ); + $layout = $field['layouts'][ $layout_idx ]; + $idx = 0; + foreach ( $m as $k => $mod ) { + if ( 'acf_fc_layout' === $k ) { + continue; } - $f = acf_get_field( $key ); - } - if ( 'clone' === $f['type'] ) { - $f = $f['sub_fields'][ $idx ]; + $f = false; + $keys = array( + $layout['key'] . "_$k", + str_replace( 'layout', 'field', $layout['name'] . "_$k" ), + $layout['key'] . '_' . $layout['name'], + ); + foreach ( $keys as $key ) { + if ( false !== $f ) { + break; + } + $f = acf_get_field( $key ); + } + if ( 'clone' === $f['type'] ) { + $f = $f['sub_fields'][ $idx ]; + } + $data[ $index ][ $k ] = parse_acf_field( $f, $mod, $data, $base_prefix ); + $idx++; } - $data[ $index ][ $k ] = parse_acf_field( $f, $mod, $data, $base_prefix ); - $idx++; + $data[ $index ]['acf_fc_layout'] = $m['acf_fc_layout']; } - $data[ $index ]['acf_fc_layout'] = $m['acf_fc_layout']; + $value = $data; } - $value = $data; break; } From 261da7b2fae16f52205eea1019582919b59ca3da Mon Sep 17 00:00:00 2001 From: Justin Grubbs Date: Mon, 22 Nov 2021 14:50:45 -0500 Subject: [PATCH 38/38] add undefined store_revision function - just shell for now since I am not sure how to use it --- includes/storage.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/storage.php b/includes/storage.php index ace0b64..fd23b62 100644 --- a/includes/storage.php +++ b/includes/storage.php @@ -57,6 +57,15 @@ function store_term( $term ) { ElasticSearch\elasticsearch_store( $term->term_id, $data['taxonomy'], $data ); } +/** + * Serializes and stores a revision into elasticsearch + * + * @param $revision + */ +function store_revision($revision) { + // Still need to figure out how to use this +} + /** * Serializes and stores all terms of a taxonomy type *