From 9b9726af4bbf7b5b0d67f45bd28a407d6f1710a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jul 2020 20:26:35 +0000 Subject: [PATCH 01/24] Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b697afab..ade62998 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4372,9 +4372,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "lodash.isplainobject": { From 54e5dde97014773e6320e0c951c953cedc91f0e9 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Thu, 23 Jul 2020 10:35:11 -0300 Subject: [PATCH 02/24] Fix #156, PHP notice on author page when user is not an author --- src/functions/template-tags.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/functions/template-tags.php b/src/functions/template-tags.php index 942f6087..06fbb66a 100644 --- a/src/functions/template-tags.php +++ b/src/functions/template-tags.php @@ -45,7 +45,14 @@ function get_multiple_authors($post = 0, $filter_the_author = true, $archive = f $terms = []; if (!empty($authorName)) { - $terms[] = get_term_by('slug', $authorName, 'author'); + $authorTerm = get_term_by('slug', $authorName, 'author'); + + if (empty($authorTerm)) { + // We don't have an author for this user. Fallback to the user object. + $authorTerm = get_user_by('slug', $authorName); + } + + $terms[] = $authorTerm; } } @@ -56,7 +63,17 @@ function get_multiple_authors($post = 0, $filter_the_author = true, $archive = f $term = get_term($term); } - $author = Author::get_by_term_id($term->term_id); + if (!is_object($term)) { + continue; + } + + if ($term instanceof WP_Term) { + $author = Author::get_by_term_id($term->term_id); + } elseif ($term instanceof WP_User) { + $author = $term; + } else { + continue; + } if ($filter_the_author) { $author->display_name = apply_filters('the_author', $author->display_name); From 9a32408a7d920d0862cd2834e12a3c719f4ec1fb Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Thu, 23 Jul 2020 12:22:16 -0300 Subject: [PATCH 03/24] Add more files to the ignore list --- RoboFile.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RoboFile.php b/RoboFile.php index d5f93be1..2168025f 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -22,6 +22,15 @@ public function __construct() 'src/assets/lib/chosen-v1.8.3/index.proto.html', 'src/assets/lib/chosen-v1.8.3/options.html', 'src/assets/lib/chosen-v1.8.3/package.json', + 'vendor/pimple/pimple/.gitignore', + 'vendor/pimple/pimple/.php_cs.dist', + 'vendor/psr/container/.gitignore', + 'vendor/publishpress/wordpress-version-notices/.gitignore', + 'vendor/publishpress/wordpress-version-notices/README.md', + 'vendor/publishpress/wordpress-version-notices/bin', + 'vendor/publishpress/wordpress-version-notices/codeception.dist.yml', + 'vendor/publishpress/wordpress-version-notices/codeception.yml', + 'vendor/publishpress/wordpress-version-notices/tests', ] ); } From 9709cbf3423cc12a5207d51096b552db4e2f8400 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Tue, 28 Jul 2020 17:48:50 -0300 Subject: [PATCH 04/24] Fix #162, add setting for username to the search box --- src/core/Classes/Admin_Ajax.php | 28 ++++++++-- .../multiple-authors/multiple-authors.php | 51 ++++++++++++++++--- 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/src/core/Classes/Admin_Ajax.php b/src/core/Classes/Admin_Ajax.php index 52b802a2..fe667f04 100644 --- a/src/core/Classes/Admin_Ajax.php +++ b/src/core/Classes/Admin_Ajax.php @@ -10,6 +10,7 @@ namespace MultipleAuthors\Classes; use MultipleAuthors\Classes\Objects\Author; +use MultipleAuthors\Factory; /** * Admin ajax endpoints @@ -53,15 +54,19 @@ public static function handle_authors_search() */ public static function get_possible_authors_for_search($search, $ignored = []) { + $legacyPlugin = Factory::getLegacyPlugin(); + $authors = []; $term_args = [ 'taxonomy' => 'author', 'hide_empty' => false, 'number' => 20, ]; + if (!empty($search)) { $term_args['search'] = $search; } + if (!empty($ignored)) { $term_args['exclude'] = []; $ignored_users = []; @@ -76,17 +81,30 @@ public static function get_possible_authors_for_search($search, $ignored = []) } $ignored = array_merge($ignored, $ignored_users); } + $terms = get_terms($term_args); if ($terms && !is_wp_error($terms)) { + $show_user_name = $legacyPlugin->modules->multiple_authors->options->username_in_search_field === 'yes'; foreach ($terms as $term) { - $author = Author::get_by_term_id($term->term_id); + $author = Author::get_by_term_id($term->term_id); + + $text = $term->name; + + if ($show_user_name) { + if (!$author->is_guest()) { + $user = $author->get_user_object(); + + if (!is_wp_error($user) && is_object($user)) { + $text .= sprintf(' (%s)', $user->user_nicename); + } + } + } + $authors[] = [ - // Select2 specific. 'id' => (int)$term->term_id, - 'text' => $term->name, - // Bylines specific. + 'text' => $text, 'term' => (int)$term->term_id, - 'display_name' => $term->name, + 'display_name' => $text, 'user_id' => $author->user_id, 'avatar' => $author->get_avatar(20), ]; diff --git a/src/modules/multiple-authors/multiple-authors.php b/src/modules/multiple-authors/multiple-authors.php index 8953b58b..27dc176a 100644 --- a/src/modules/multiple-authors/multiple-authors.php +++ b/src/modules/multiple-authors/multiple-authors.php @@ -83,15 +83,16 @@ public function __construct() 'icon_class' => 'dashicons dashicons-feedback', 'slug' => 'multiple-authors', 'default_options' => [ - 'enabled' => 'on', - 'post_types' => [ + 'enabled' => 'on', + 'post_types' => [ 'post' => 'on', 'page' => 'on', ], - 'append_to_content' => 'yes', - 'author_for_new_users' => [], - 'layout' => 'simple_list', - 'force_empty_author' => 'no', + 'append_to_content' => 'yes', + 'author_for_new_users' => [], + 'layout' => 'simple_list', + 'force_empty_author' => 'no', + 'username_in_search_field' => 'no', ], 'options_page' => false, 'autoload' => true, @@ -418,6 +419,17 @@ public function register_settings() $this->module->options_group_name . '_general' ); + add_settings_field( + 'username_in_search_field', + __( + 'Show username in the search field:', + 'publishpress-authors' + ), + [$this, 'settings_username_in_search_field'], + $this->module->options_group_name, + $this->module->options_group_name . '_general' + ); + do_action('publishpress_authors_register_settings_after'); /** @@ -614,6 +626,29 @@ public function settings_author_for_new_users_option($args = []) echo ''; } + /** + * @param array $args + */ + public function settings_username_in_search_field($args = []) + { + $id = $this->module->options_group_name . '_username_in_search_field'; + $value = isset($this->module->options->username_in_search_field) ? $this->module->options->username_in_search_field : ''; + + echo ''; + } + /** * Displays the field to choose display or not the email link/icon. * @@ -784,6 +819,10 @@ public function validate_module_settings($new_options, $module_name) $new_options['show_site_link'] = 'no'; } + if (!isset($new_options['username_in_search_field'])) { + $new_options['username_in_search_field'] = 'no'; + } + if (isset($new_options['layout'])) { /** * Filter the list of available layouts. From 6da69d198ecbba6ea3881c322435d606066ccb3c Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 10:37:44 -0300 Subject: [PATCH 05/24] Change the composer script from "dev" to "watch" --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94e17321..5b175388 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "webpack-cli": "3.2.3" }, "scripts": { - "dev": "webpack --watch", + "watch": "webpack --watch", "build": "cross-env NODE_ENV=production webpack" } } From c898ffc10954432f8e7be237ae61f1d5fc29fd01 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 10:38:11 -0300 Subject: [PATCH 06/24] Add installation instructions to the README.md file --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 1d201856..47bebebe 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,22 @@ By default, WordPress only allows you to add one author to each post. The Multip The Multiple authors plugin allows you to add the authors, and also it enables you to display their information. With this add-on, you can show the authors’ names, images and bios. +## Installation + +:warning: **Warning! This plugin requires to be built before being installed!** + +This repository doesn't store external dependencies required by the plugin. It's not possible to simply clone or download the repository code and have a working WordPress plugin. + +We aim to follow good practices on development, and we are using Composer as dependency manager, which recommends to not add external dependencies into the repository. You can find more information on their documentation page: [Should I commit the dependencies in my vendor directory?](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md) + +### How to install? + +You can download a built package from [releases page](/releases/) and install it on your WordPress sites by uploading the zip file. + +## How to build a package? + +Please, check the instructions on our [documentation pages](https://publishpress.github.io/docs/deployment/building). + ## License License: [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html) From 3c4075e73b5f960a8205708278d11e13f0371b13 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 10:58:36 -0300 Subject: [PATCH 07/24] Fix #167 to not show notice if the post doesn't exist After deleted the post doesn't exist so any hanging request would show a notice message. --- src/core/Classes/Utils.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/Classes/Utils.php b/src/core/Classes/Utils.php index a59aaf6c..7a9021da 100644 --- a/src/core/Classes/Utils.php +++ b/src/core/Classes/Utils.php @@ -1,4 +1,5 @@ @@ -297,12 +298,16 @@ public static function get_supported_post_types() /** * Checks to see if the current user can set authors or not + * + * @param null $post + * + * @return bool|mixed|void */ public static function current_user_can_set_authors($post = null) { - if (!$post) { + if (empty($post)) { $post = get_post(); - if (!$post) { + if (empty($post)) { if (isset($_GET['post'])) { $post = get_post($_GET['post']); } else { @@ -311,17 +316,20 @@ public static function current_user_can_set_authors($post = null) } } + if (empty($post)) { + return false; + } + $post_type = $post->post_type; // TODO: need to fix this; shouldn't just say no if don't have post_type - if (!$post_type) { + if (empty($post_type)) { return false; } - $current_user = wp_get_current_user(); - if (!$current_user) { + if (empty($current_user)) { return false; } // Super admins can do anything From b56ef8841b5c06e6bc24c57d5a2d31e752d609f5 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 11:02:58 -0300 Subject: [PATCH 08/24] Fix minor typo in the changelog --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 0507bd47..b4ca3432 100644 --- a/readme.txt +++ b/readme.txt @@ -183,7 +183,7 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec * Fixed: The get_the_author function was not working for guest authors; * Fixed: The the_post function was not working well for posts with guest authors; * Fixed: The feed_links_extra function was not working for guest authors; -* Fixed: For themes that dont't implement support for PublishPress Authors and multiple authors, we were displaying all the author names separated by comma, but only one link (due to the limitations imposed by the theme). Now we display only the first author and its respective link on those cases. The multiple authors can be added creating a child theme and adapting the code; +* Fixed: For themes that don't implement support for PublishPress Authors and multiple authors, we were displaying all the author names separated by comma, but only one link (due to the limitations imposed by the theme). Now we display only the first author and its respective link on those cases. The multiple authors can be added creating a child theme and adapting the code; * Fixed: The title for authors archive pages of guest authors; * Fixed: The author object is now compatible with the main properties of WP_User objects, so guest authors can be treated as users on most cases; * Fixed: The custom user_url is not returned for authors mapped to user; From b0f0624295b13d70ceea204e7b3d3ca5791f2a34 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 13:43:58 -0300 Subject: [PATCH 09/24] Update version number and builder --- composer.json | 2 +- composer.lock | 130 +++++++++++++++++++-------------------- publishpress-authors.php | 2 +- src/includes.php | 2 +- 4 files changed, 68 insertions(+), 68 deletions(-) diff --git a/composer.json b/composer.json index 4b4aa6fd..bf442803 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "codeception/module-phpbrowser": "^1.0", "codeception/module-db": "^1.0", "codeception/util-universalframework": "^1.0", - "publishpress/publishpress-plugin-builder": "1.1.0", + "publishpress/publishpress-plugin-builder": "^1.2", "phpmd/phpmd": "^2.8", "squizlabs/php_codesniffer": "^3.5", "sebastian/phpcpd": "^5.0" diff --git a/composer.lock b/composer.lock index aba5a9b3..a99498da 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": "b369673ad6b2e9580f5a0b4c17a6f2db", + "content-hash": "6a57a8171f12d6561a5f979a96139108", "packages": [ { "name": "pimple/pimple", @@ -2312,7 +2312,7 @@ }, { "name": "illuminate/contracts", - "version": "v7.21.0", + "version": "v7.22.4", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2356,16 +2356,16 @@ }, { "name": "illuminate/support", - "version": "v7.21.0", + "version": "v7.22.4", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "79bbfdf2cd58a3ca2daa015e523a8e0351cccd01" + "reference": "138d67507a697c3fff06710af2df7452d0fafb09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/79bbfdf2cd58a3ca2daa015e523a8e0351cccd01", - "reference": "79bbfdf2cd58a3ca2daa015e523a8e0351cccd01", + "url": "https://api.github.com/repos/illuminate/support/zipball/138d67507a697c3fff06710af2df7452d0fafb09", + "reference": "138d67507a697c3fff06710af2df7452d0fafb09", "shasum": "" }, "require": { @@ -2414,7 +2414,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2020-07-17T14:27:04+00:00" + "time": "2020-07-27T17:48:28+00:00" }, { "name": "justinrainbow/json-schema", @@ -2859,16 +2859,16 @@ }, { "name": "nesbot/carbon", - "version": "2.36.1", + "version": "2.37.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "ee7378a36cc62952100e718bcc58be4c7210e55f" + "reference": "1f61206de973d67f36ce50f041c792ddac663c3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ee7378a36cc62952100e718bcc58be4c7210e55f", - "reference": "ee7378a36cc62952100e718bcc58be4c7210e55f", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e", + "reference": "1f61206de973d67f36ce50f041c792ddac663c3e", "shasum": "" }, "require": { @@ -2934,7 +2934,7 @@ "datetime", "time" ], - "time": "2020-07-04T12:29:56+00:00" + "time": "2020-07-28T06:04:54+00:00" }, { "name": "paragonie/random_compat", @@ -4053,11 +4053,11 @@ }, { "name": "publishpress/publishpress-plugin-builder", - "version": "1.1.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/publishpress/PublishPress-Plugin-Builder", - "reference": "0136ea3fd0542c2242bd7e4e6910fc1941f54ac7" + "reference": "59bd814a0a78215772223881f78fbb676668033e" }, "require": { "consolidation/robo": "^2.0", @@ -4088,7 +4088,7 @@ } ], "description": "Robo tasks for building WordPress plugins", - "time": "2020-07-23T02:44:07+00:00" + "time": "2020-07-30T22:42:05+00:00" }, { "name": "publishpress/wp-browser", @@ -5172,16 +5172,16 @@ }, { "name": "symfony/browser-kit", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "b9adef763c4f98660d1f8b924f6d61718f8ae0bc" + "reference": "b9545e08790be2d3d7d92306e339bbcd79f461e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b9adef763c4f98660d1f8b924f6d61718f8ae0bc", - "reference": "b9adef763c4f98660d1f8b924f6d61718f8ae0bc", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b9545e08790be2d3d7d92306e339bbcd79f461e4", + "reference": "b9545e08790be2d3d7d92306e339bbcd79f461e4", "shasum": "" }, "require": { @@ -5227,20 +5227,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2020-05-23T13:13:03+00:00" + "time": "2020-06-24T13:36:18+00:00" }, { "name": "symfony/config", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "b8623ef3d99fe62a34baf7a111b576216965f880" + "reference": "cf63f0613a6c6918e96db39c07a43b01e19a0773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b8623ef3d99fe62a34baf7a111b576216965f880", - "reference": "b8623ef3d99fe62a34baf7a111b576216965f880", + "url": "https://api.github.com/repos/symfony/config/zipball/cf63f0613a6c6918e96db39c07a43b01e19a0773", + "reference": "cf63f0613a6c6918e96db39c07a43b01e19a0773", "shasum": "" }, "require": { @@ -5293,20 +5293,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-07-15T10:53:22+00:00" }, { "name": "symfony/console", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "34ac555a3627e324b660e318daa07572e1140123" + "reference": "2226c68009627934b8cfc01260b4d287eab070df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/34ac555a3627e324b660e318daa07572e1140123", - "reference": "34ac555a3627e324b660e318daa07572e1140123", + "url": "https://api.github.com/repos/symfony/console/zipball/2226c68009627934b8cfc01260b4d287eab070df", + "reference": "2226c68009627934b8cfc01260b4d287eab070df", "shasum": "" }, "require": { @@ -5372,11 +5372,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-06-15T12:59:21+00:00" + "time": "2020-07-06T13:23:11+00:00" }, { "name": "symfony/css-selector", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -5429,16 +5429,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "6508423eded583fc07e88a0172803e1a62f0310c" + "reference": "c45c3f26d2ae7c5239e5ad420b0c2717dbbc0bcb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6508423eded583fc07e88a0172803e1a62f0310c", - "reference": "6508423eded583fc07e88a0172803e1a62f0310c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c45c3f26d2ae7c5239e5ad420b0c2717dbbc0bcb", + "reference": "c45c3f26d2ae7c5239e5ad420b0c2717dbbc0bcb", "shasum": "" }, "require": { @@ -5500,7 +5500,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2020-06-12T08:11:32+00:00" + "time": "2020-07-23T08:36:24+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5554,16 +5554,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "907187782c465a564f9030a0c6ace59e8821106f" + "reference": "a96aecb36aaf081f1b012e1e62d71f1069ab3dca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/907187782c465a564f9030a0c6ace59e8821106f", - "reference": "907187782c465a564f9030a0c6ace59e8821106f", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a96aecb36aaf081f1b012e1e62d71f1069ab3dca", + "reference": "a96aecb36aaf081f1b012e1e62d71f1069ab3dca", "shasum": "" }, "require": { @@ -5612,20 +5612,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-07-23T08:36:24+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "cc0d059e2e997e79ca34125a52f3e33de4424ac7" + "reference": "7827d55911f91c070fc293ea51a06eec80797d76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/cc0d059e2e997e79ca34125a52f3e33de4424ac7", - "reference": "cc0d059e2e997e79ca34125a52f3e33de4424ac7", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7827d55911f91c070fc293ea51a06eec80797d76", + "reference": "7827d55911f91c070fc293ea51a06eec80797d76", "shasum": "" }, "require": { @@ -5684,7 +5684,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-06-18T18:24:02+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -5750,7 +5750,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -5800,7 +5800,7 @@ }, { "name": "symfony/finder", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -6171,20 +6171,20 @@ }, { "name": "symfony/process", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c714958428a85c86ab97e3a0c96db4c4f381b7f5" + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c714958428a85c86ab97e3a0c96db4c4f381b7f5", - "reference": "c714958428a85c86ab97e3a0c96db4c4f381b7f5", + "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.1.3" }, "type": "library", "extra": { @@ -6216,7 +6216,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2020-05-30T20:06:45+00:00" + "time": "2020-07-23T08:31:43+00:00" }, { "name": "symfony/service-contracts", @@ -6282,16 +6282,16 @@ }, { "name": "symfony/string", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298" + "reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac70459db781108db7c6d8981dd31ce0e29e3298", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298", + "url": "https://api.github.com/repos/symfony/string/zipball/f629ba9b611c76224feb21fe2bcbf0b6f992300b", + "reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b", "shasum": "" }, "require": { @@ -6349,20 +6349,20 @@ "utf-8", "utf8" ], - "time": "2020-06-11T12:16:36+00:00" + "time": "2020-07-08T08:27:49+00:00" }, { "name": "symfony/translation", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2" + "reference": "4b9bf719f0fa5b05253c37fc7b335337ec7ec427" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2", - "reference": "d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2", + "url": "https://api.github.com/repos/symfony/translation/zipball/4b9bf719f0fa5b05253c37fc7b335337ec7ec427", + "reference": "4b9bf719f0fa5b05253c37fc7b335337ec7ec427", "shasum": "" }, "require": { @@ -6427,7 +6427,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-06-30T17:42:22+00:00" }, { "name": "symfony/translation-contracts", @@ -6492,7 +6492,7 @@ }, { "name": "symfony/yaml", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/publishpress-authors.php b/publishpress-authors.php index b0a4695b..307f539b 100644 --- a/publishpress-authors.php +++ b/publishpress-authors.php @@ -5,7 +5,7 @@ * Description: Add support for multiple authors * Author: PublishPress * Author URI: https://publishpress.com - * Version: 3.4.0 + * Version: 3.4.0-hotfix-167 * Text Domain: publishpress-authors * * ------------------------------------------------------------------------------ diff --git a/src/includes.php b/src/includes.php index c602895f..146bd470 100644 --- a/src/includes.php +++ b/src/includes.php @@ -14,7 +14,7 @@ defined('ABSPATH') or die('No direct script access allowed.'); if (!defined('PP_AUTHORS_LOADED')) { - define('PP_AUTHORS_VERSION', '3.4.0'); + define('PP_AUTHORS_VERSION', '3.4.0-hotfix-167'); define('PP_AUTHORS_FILE', 'publishpress-authors/publishpress-authors.php'); define('PP_AUTHORS_BASE_PATH', plugin_dir_path(realpath(__DIR__ . '/../publishpress-authors.php'))); define('PP_AUTHORS_SRC_PATH', PP_AUTHORS_BASE_PATH . 'src/'); From 05e108b3c653b0856ae173dd6bc41d7fab31a1b5 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 14:18:33 -0300 Subject: [PATCH 10/24] Fix #169 adding 'product' to the supported post types --- src/core/Classes/Utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/Classes/Utils.php b/src/core/Classes/Utils.php index a59aaf6c..2d9cf4c4 100644 --- a/src/core/Classes/Utils.php +++ b/src/core/Classes/Utils.php @@ -268,6 +268,7 @@ public static function get_supported_post_types() 'lp_course', 'lp_lesson', 'lp_quiz', + 'product', ]; From 2cb27115269c6fb47de09dff18038342a123de92 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 15:12:27 -0300 Subject: [PATCH 11/24] Update the builder and refactor adding defines.php file --- RoboFile.php | 2 + composer.json | 2 +- composer.lock | 130 +++++++++++++++++++++++------------------------ src/defines.php | 23 +++++++++ src/includes.php | 13 +---- 5 files changed, 92 insertions(+), 78 deletions(-) create mode 100644 src/defines.php diff --git a/RoboFile.php b/RoboFile.php index d5f93be1..23305177 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -24,5 +24,7 @@ public function __construct() 'src/assets/lib/chosen-v1.8.3/package.json', ] ); + + $this->setVersionConstantName('PP_AUTHORS_VERSION'); } } diff --git a/composer.json b/composer.json index 4b4aa6fd..bf442803 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "codeception/module-phpbrowser": "^1.0", "codeception/module-db": "^1.0", "codeception/util-universalframework": "^1.0", - "publishpress/publishpress-plugin-builder": "1.1.0", + "publishpress/publishpress-plugin-builder": "^1.2", "phpmd/phpmd": "^2.8", "squizlabs/php_codesniffer": "^3.5", "sebastian/phpcpd": "^5.0" diff --git a/composer.lock b/composer.lock index aba5a9b3..a99498da 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": "b369673ad6b2e9580f5a0b4c17a6f2db", + "content-hash": "6a57a8171f12d6561a5f979a96139108", "packages": [ { "name": "pimple/pimple", @@ -2312,7 +2312,7 @@ }, { "name": "illuminate/contracts", - "version": "v7.21.0", + "version": "v7.22.4", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2356,16 +2356,16 @@ }, { "name": "illuminate/support", - "version": "v7.21.0", + "version": "v7.22.4", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "79bbfdf2cd58a3ca2daa015e523a8e0351cccd01" + "reference": "138d67507a697c3fff06710af2df7452d0fafb09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/79bbfdf2cd58a3ca2daa015e523a8e0351cccd01", - "reference": "79bbfdf2cd58a3ca2daa015e523a8e0351cccd01", + "url": "https://api.github.com/repos/illuminate/support/zipball/138d67507a697c3fff06710af2df7452d0fafb09", + "reference": "138d67507a697c3fff06710af2df7452d0fafb09", "shasum": "" }, "require": { @@ -2414,7 +2414,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2020-07-17T14:27:04+00:00" + "time": "2020-07-27T17:48:28+00:00" }, { "name": "justinrainbow/json-schema", @@ -2859,16 +2859,16 @@ }, { "name": "nesbot/carbon", - "version": "2.36.1", + "version": "2.37.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "ee7378a36cc62952100e718bcc58be4c7210e55f" + "reference": "1f61206de973d67f36ce50f041c792ddac663c3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ee7378a36cc62952100e718bcc58be4c7210e55f", - "reference": "ee7378a36cc62952100e718bcc58be4c7210e55f", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e", + "reference": "1f61206de973d67f36ce50f041c792ddac663c3e", "shasum": "" }, "require": { @@ -2934,7 +2934,7 @@ "datetime", "time" ], - "time": "2020-07-04T12:29:56+00:00" + "time": "2020-07-28T06:04:54+00:00" }, { "name": "paragonie/random_compat", @@ -4053,11 +4053,11 @@ }, { "name": "publishpress/publishpress-plugin-builder", - "version": "1.1.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/publishpress/PublishPress-Plugin-Builder", - "reference": "0136ea3fd0542c2242bd7e4e6910fc1941f54ac7" + "reference": "59bd814a0a78215772223881f78fbb676668033e" }, "require": { "consolidation/robo": "^2.0", @@ -4088,7 +4088,7 @@ } ], "description": "Robo tasks for building WordPress plugins", - "time": "2020-07-23T02:44:07+00:00" + "time": "2020-07-30T22:42:05+00:00" }, { "name": "publishpress/wp-browser", @@ -5172,16 +5172,16 @@ }, { "name": "symfony/browser-kit", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "b9adef763c4f98660d1f8b924f6d61718f8ae0bc" + "reference": "b9545e08790be2d3d7d92306e339bbcd79f461e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b9adef763c4f98660d1f8b924f6d61718f8ae0bc", - "reference": "b9adef763c4f98660d1f8b924f6d61718f8ae0bc", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b9545e08790be2d3d7d92306e339bbcd79f461e4", + "reference": "b9545e08790be2d3d7d92306e339bbcd79f461e4", "shasum": "" }, "require": { @@ -5227,20 +5227,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2020-05-23T13:13:03+00:00" + "time": "2020-06-24T13:36:18+00:00" }, { "name": "symfony/config", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "b8623ef3d99fe62a34baf7a111b576216965f880" + "reference": "cf63f0613a6c6918e96db39c07a43b01e19a0773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b8623ef3d99fe62a34baf7a111b576216965f880", - "reference": "b8623ef3d99fe62a34baf7a111b576216965f880", + "url": "https://api.github.com/repos/symfony/config/zipball/cf63f0613a6c6918e96db39c07a43b01e19a0773", + "reference": "cf63f0613a6c6918e96db39c07a43b01e19a0773", "shasum": "" }, "require": { @@ -5293,20 +5293,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-07-15T10:53:22+00:00" }, { "name": "symfony/console", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "34ac555a3627e324b660e318daa07572e1140123" + "reference": "2226c68009627934b8cfc01260b4d287eab070df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/34ac555a3627e324b660e318daa07572e1140123", - "reference": "34ac555a3627e324b660e318daa07572e1140123", + "url": "https://api.github.com/repos/symfony/console/zipball/2226c68009627934b8cfc01260b4d287eab070df", + "reference": "2226c68009627934b8cfc01260b4d287eab070df", "shasum": "" }, "require": { @@ -5372,11 +5372,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-06-15T12:59:21+00:00" + "time": "2020-07-06T13:23:11+00:00" }, { "name": "symfony/css-selector", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -5429,16 +5429,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "6508423eded583fc07e88a0172803e1a62f0310c" + "reference": "c45c3f26d2ae7c5239e5ad420b0c2717dbbc0bcb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6508423eded583fc07e88a0172803e1a62f0310c", - "reference": "6508423eded583fc07e88a0172803e1a62f0310c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c45c3f26d2ae7c5239e5ad420b0c2717dbbc0bcb", + "reference": "c45c3f26d2ae7c5239e5ad420b0c2717dbbc0bcb", "shasum": "" }, "require": { @@ -5500,7 +5500,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2020-06-12T08:11:32+00:00" + "time": "2020-07-23T08:36:24+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5554,16 +5554,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "907187782c465a564f9030a0c6ace59e8821106f" + "reference": "a96aecb36aaf081f1b012e1e62d71f1069ab3dca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/907187782c465a564f9030a0c6ace59e8821106f", - "reference": "907187782c465a564f9030a0c6ace59e8821106f", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a96aecb36aaf081f1b012e1e62d71f1069ab3dca", + "reference": "a96aecb36aaf081f1b012e1e62d71f1069ab3dca", "shasum": "" }, "require": { @@ -5612,20 +5612,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-07-23T08:36:24+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "cc0d059e2e997e79ca34125a52f3e33de4424ac7" + "reference": "7827d55911f91c070fc293ea51a06eec80797d76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/cc0d059e2e997e79ca34125a52f3e33de4424ac7", - "reference": "cc0d059e2e997e79ca34125a52f3e33de4424ac7", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7827d55911f91c070fc293ea51a06eec80797d76", + "reference": "7827d55911f91c070fc293ea51a06eec80797d76", "shasum": "" }, "require": { @@ -5684,7 +5684,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2020-05-20T17:43:50+00:00" + "time": "2020-06-18T18:24:02+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -5750,7 +5750,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -5800,7 +5800,7 @@ }, { "name": "symfony/finder", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -6171,20 +6171,20 @@ }, { "name": "symfony/process", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c714958428a85c86ab97e3a0c96db4c4f381b7f5" + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c714958428a85c86ab97e3a0c96db4c4f381b7f5", - "reference": "c714958428a85c86ab97e3a0c96db4c4f381b7f5", + "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.1.3" }, "type": "library", "extra": { @@ -6216,7 +6216,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2020-05-30T20:06:45+00:00" + "time": "2020-07-23T08:31:43+00:00" }, { "name": "symfony/service-contracts", @@ -6282,16 +6282,16 @@ }, { "name": "symfony/string", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298" + "reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac70459db781108db7c6d8981dd31ce0e29e3298", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298", + "url": "https://api.github.com/repos/symfony/string/zipball/f629ba9b611c76224feb21fe2bcbf0b6f992300b", + "reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b", "shasum": "" }, "require": { @@ -6349,20 +6349,20 @@ "utf-8", "utf8" ], - "time": "2020-06-11T12:16:36+00:00" + "time": "2020-07-08T08:27:49+00:00" }, { "name": "symfony/translation", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2" + "reference": "4b9bf719f0fa5b05253c37fc7b335337ec7ec427" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2", - "reference": "d387f07d4c15f9c09439cf3f13ddbe0b2c5e8be2", + "url": "https://api.github.com/repos/symfony/translation/zipball/4b9bf719f0fa5b05253c37fc7b335337ec7ec427", + "reference": "4b9bf719f0fa5b05253c37fc7b335337ec7ec427", "shasum": "" }, "require": { @@ -6427,7 +6427,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-06-30T17:42:22+00:00" }, { "name": "symfony/translation-contracts", @@ -6492,7 +6492,7 @@ }, { "name": "symfony/yaml", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/src/defines.php b/src/defines.php new file mode 100644 index 00000000..52692ccd --- /dev/null +++ b/src/defines.php @@ -0,0 +1,23 @@ + + * @copyright Copyright (C) 2018 PublishPress. All rights reserved. + * @license GPLv2 or later + * @since 1.0.0 + */ + +defined('ABSPATH') or die('No direct script access allowed.'); + +define('PP_AUTHORS_VERSION', '3.4.0-hotfix-169'); +define('PP_AUTHORS_FILE', 'publishpress-authors/publishpress-authors.php'); +define('PP_AUTHORS_BASE_PATH', plugin_dir_path(realpath(__DIR__ . '/../publishpress-authors.php'))); +define('PP_AUTHORS_SRC_PATH', PP_AUTHORS_BASE_PATH . 'src/'); +define('PP_AUTHORS_MODULES_PATH', PP_AUTHORS_SRC_PATH . 'modules/'); +define('PP_AUTHORS_TWIG_PATH', PP_AUTHORS_SRC_PATH . 'twig/'); +define('PP_AUTHORS_VENDOR_PATH', PP_AUTHORS_BASE_PATH . 'vendor/'); +define('PP_AUTHORS_URL', plugins_url('/', PP_AUTHORS_BASE_PATH . 'publishpress-authors.php')); +define('PP_AUTHORS_ASSETS_URL', plugins_url('/src/assets/', PP_AUTHORS_SRC_PATH)); +define('PP_AUTHORS_AUTOLOAD_CLASS_NAME', 'ComposerStaticInit861037e2d826162de71f57dffe180138'); diff --git a/src/includes.php b/src/includes.php index c602895f..392650e6 100644 --- a/src/includes.php +++ b/src/includes.php @@ -14,18 +14,7 @@ defined('ABSPATH') or die('No direct script access allowed.'); if (!defined('PP_AUTHORS_LOADED')) { - define('PP_AUTHORS_VERSION', '3.4.0'); - define('PP_AUTHORS_FILE', 'publishpress-authors/publishpress-authors.php'); - define('PP_AUTHORS_BASE_PATH', plugin_dir_path(realpath(__DIR__ . '/../publishpress-authors.php'))); - define('PP_AUTHORS_SRC_PATH', PP_AUTHORS_BASE_PATH . 'src/'); - define('PP_AUTHORS_MODULES_PATH', PP_AUTHORS_SRC_PATH . 'modules/'); - define('PP_AUTHORS_TWIG_PATH', PP_AUTHORS_SRC_PATH . 'twig/'); - define('PP_AUTHORS_VENDOR_PATH', PP_AUTHORS_BASE_PATH . 'vendor/'); - define('PP_AUTHORS_URL', plugins_url('/', PP_AUTHORS_BASE_PATH . 'publishpress-authors.php')); - define('PP_AUTHORS_ASSETS_URL', plugins_url('/src/assets/', PP_AUTHORS_SRC_PATH)); - define('PP_AUTHORS_AUTOLOAD_CLASS_NAME', 'ComposerStaticInit861037e2d826162de71f57dffe180138'); - - define('PP_AUTHORS_LOADED', 1); + require_once 'defines.php'; if (!class_exists(PP_AUTHORS_AUTOLOAD_CLASS_NAME) && !class_exists('MultipleAuthors\\Plugin')) { $autoloadPath = PP_AUTHORS_VENDOR_PATH . 'autoload.php'; From 67612ed48544ac21200afb98e58bcf7ac1cda80e Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 15:13:40 -0300 Subject: [PATCH 12/24] Refactor the method get_supported_post_types to get_post_types_that_support_authors Deprecate the filters: coauthors_supported_post_types and authors_post_types, in favor of publishpress_authors_supported_post_types --- src/core/Classes/Content_Model.php | 2 +- src/core/Classes/Utils.php | 89 ++++++++++++++++++++++-------- src/core/Plugin.php | 4 +- 3 files changed, 68 insertions(+), 27 deletions(-) diff --git a/src/core/Classes/Content_Model.php b/src/core/Classes/Content_Model.php index dc3f3d3a..3e722fdd 100644 --- a/src/core/Classes/Content_Model.php +++ b/src/core/Classes/Content_Model.php @@ -31,7 +31,7 @@ public static function action_init_late_register_taxonomy_for_object_type() */ public static function get_author_supported_post_types() { - return Utils::get_supported_post_types(); + return Utils::get_post_types_that_support_authors(); } /** diff --git a/src/core/Classes/Utils.php b/src/core/Classes/Utils.php index 2d9cf4c4..f13b1f2d 100644 --- a/src/core/Classes/Utils.php +++ b/src/core/Classes/Utils.php @@ -227,49 +227,62 @@ public static function is_valid_page() * Whether or not PublishPress Authors is enabled for this post type * Must be called after init * - * @param string $post_type The name of the post type we're considering + * @param string $postType The name of the post type we're considering * * @return bool Whether or not it's enabled * @since 3.0 * */ - public static function is_post_type_enabled($post_type = null) + public static function is_post_type_enabled($postType = null) { $legacyPlugin = Factory::getLegacyPlugin(); if (empty(self::$supported_post_types)) { - self::$supported_post_types = self::get_supported_post_types(); + self::$supported_post_types = self::get_post_types_that_support_authors(); } - if (!$post_type) { - $post_type = Util::get_current_post_type(); + if (!$postType) { + $postType = Util::get_current_post_type(); } - $supported = (bool)in_array($post_type, self::$supported_post_types); + $isSupported = (bool)in_array($postType, self::$supported_post_types); - $post_types = Util::get_post_types_for_module($legacyPlugin->multiple_authors->module); + $postTypesArray = Util::get_post_types_for_module($legacyPlugin->multiple_authors->module); - $is_enabled = (bool)in_array($post_type, $post_types); + $isEnabled = (bool)in_array($postType, $postTypesArray); - return $supported && $is_enabled; + return $isSupported && $isEnabled; + } + + private static function get_post_types_to_force_authors_support() + { + $postTypesToForceAuthorsSupport = [ + // LearnPress. + 'lp_course', + 'lp_lesson', + 'lp_quiz', + // WooCommerce. + 'product', + ]; + + $postTypesToForceAuthorsSupport = apply_filters( + 'publishpress_authors_post_types_to_force_author_support', + $postTypesToForceAuthorsSupport + ); + + return $postTypesToForceAuthorsSupport; } /** * Returns a list of post types which supports authors. */ - public static function get_supported_post_types() + public static function get_post_types_that_support_authors() { if (empty(self::$supported_post_types)) { // Get the post types which supports authors $post_types_with_authors = array_values(get_post_types()); // Get post types which doesn't support authors, but should support Multiple Authors. - $thirdPartySupport = [ - // LearnPress - 'lp_course', - 'lp_lesson', - 'lp_quiz', - 'product', - ]; + $thirdPartySupport = self::get_post_types_to_force_authors_support(); foreach ($post_types_with_authors as $key => $name) { @@ -283,15 +296,43 @@ public static function get_supported_post_types() } } - self::$supported_post_types = apply_filters('coauthors_supported_post_types', $post_types_with_authors); + /** + * @depreacted + * + * @param array $post_types_with_authors Post types that support authors. + */ + self::$supported_post_types = apply_filters_deprecated( + 'coauthors_supported_post_types', + [$post_types_with_authors], + '3.5.0', + 'publishpress_authors_supported_post_types' + ); + + /** + * Modify post types that use authors. + * + * @depreacted + * + * @param array $post_types_with_authors Post types that support authors. + */ + self::$supported_post_types = apply_filters_deprecated( + 'authors_post_types', + [self::$supported_post_types], + '3.5.0', + 'publishpress_authors_supported_post_types' + ); + + /** + * Modify post types that use authors. + * + * @param array $post_types_with_authors Post types that support authors. + */ + self::$supported_post_types = apply_filters( + 'publishpress_authors_supported_post_types', + self::$supported_post_types + ); } - /** - * Modify post types that use authors. - * - * @param array $post_types_with_authors Post types that support authors. - */ - self::$supported_post_types = apply_filters('authors_post_types', self::$supported_post_types); return self::$supported_post_types; } diff --git a/src/core/Plugin.php b/src/core/Plugin.php index 5afb8587..e6f0840a 100644 --- a/src/core/Plugin.php +++ b/src/core/Plugin.php @@ -489,7 +489,7 @@ public function action_init_late() add_action('edited_term_taxonomy', [$this, 'action_edited_term_taxonomy_flush_cache'], 10, 2); } - $supported_post_types = Utils::get_supported_post_types(); + $supported_post_types = Utils::get_post_types_that_support_authors(); register_taxonomy($this->coauthor_taxonomy, $supported_post_types, $args); } @@ -1279,7 +1279,7 @@ public function enqueue_scripts($hook_suffix) public function load_edit() { $screen = get_current_screen(); - $supported_post_types = Utils::get_supported_post_types(); + $supported_post_types = Utils::get_post_types_that_support_authors(); if (in_array($screen->post_type, $supported_post_types)) { add_filter('views_' . $screen->id, [$this, 'filter_views']); } From fc344776b4b8766d7be75f8fe6a322fa21527301 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 31 Jul 2020 15:13:59 -0300 Subject: [PATCH 13/24] Update version number --- publishpress-authors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publishpress-authors.php b/publishpress-authors.php index b0a4695b..0d25892d 100644 --- a/publishpress-authors.php +++ b/publishpress-authors.php @@ -5,7 +5,7 @@ * Description: Add support for multiple authors * Author: PublishPress * Author URI: https://publishpress.com - * Version: 3.4.0 + * Version: 3.4.0-hotfix-169 * Text Domain: publishpress-authors * * ------------------------------------------------------------------------------ From 9f5b9617fc1d8859c22eb35c8f6d5c8e967f8e08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2020 08:39:02 +0000 Subject: [PATCH 14/24] Bump elliptic from 6.5.2 to 6.5.3 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ade62998..849866f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2775,9 +2775,9 @@ "dev": true }, "elliptic": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", - "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "dev": true, "requires": { "bn.js": "^4.4.0", From d31288d227033d8917bf4be727655abe75253dc3 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Mon, 3 Aug 2020 18:17:21 -0300 Subject: [PATCH 15/24] Fix #171 adding cache to some methods and functions --- src/core/Classes/Objects/Author.php | 280 ++++++++++++++++++---------- src/functions/template-tags.php | 104 +++++++---- 2 files changed, 241 insertions(+), 143 deletions(-) diff --git a/src/core/Classes/Objects/Author.php b/src/core/Classes/Objects/Author.php index b9317d8b..cca57148 100644 --- a/src/core/Classes/Objects/Author.php +++ b/src/core/Classes/Objects/Author.php @@ -11,6 +11,7 @@ use MultipleAuthors\Classes\Author_Utils; use WP_Error; +use WP_User; /** * Representation of an individual author. @@ -45,6 +46,56 @@ class Author */ private $term; + /** + * @var array + */ + private static $authorsByIdCache = []; + + /** + * @var array + */ + private static $authorsBySlugCache = []; + + /** + * @var array + */ + private static $authorsByTermIdCache = []; + + /** + * @var array + */ + private static $authorsByEmailCache = []; + + /** + * @var array + */ + private $metaCache; + + /** + * @var WP_User + */ + private $userObject; + + /** + * @var bool|null + */ + private $hasCustomAvatar = null; + + /** + * @var null|array + */ + private $customAvatarUrl = null; + + /** + * @var null|string + */ + private $avatarUrl = null; + + /** + * @var array + */ + private $avatarBySize = []; + /** * Instantiate a new author object * @@ -136,21 +187,23 @@ public static function get_by_user_id($user_id) { global $wpdb; - $term_id = $wpdb->get_var( - $wpdb->prepare( - "SELECT te.term_id + if (!isset(self::$authorsByIdCache[$user_id])) { + $term_id = $wpdb->get_var( + $wpdb->prepare( + "SELECT te.term_id FROM {$wpdb->termmeta} AS te LEFT JOIN {$wpdb->term_taxonomy} AS ta ON (te.term_id = ta.term_id) WHERE ta.taxonomy = 'author' AND meta_key=%s", - 'user_id_' . $user_id - ) - ); + 'user_id_' . $user_id + ) + ); - if (!$term_id) { - return false; + if (!empty($term_id) && is_numeric($term_id)) { + self::$authorsByIdCache[$user_id] = new Author($term_id); + } } - return new Author($term_id); + return isset(self::$authorsByIdCache[$user_id]) ? self::$authorsByIdCache[$user_id] : false; } /** @@ -249,7 +302,11 @@ public static function convert_into_guest_author($term_id) */ public static function get_by_term_id($term_id) { - return new Author($term_id); + if (!isset(self::$authorsByTermIdCache[$term_id])) { + self::$authorsByTermIdCache[$term_id] = new Author($term_id); + } + + return isset(self::$authorsByTermIdCache[$term_id]) ? self::$authorsByTermIdCache[$term_id] : false; } /** @@ -261,12 +318,16 @@ public static function get_by_term_id($term_id) */ public static function get_by_term_slug($slug) { - $term = get_term_by('slug', $slug, 'author'); - if (!$term || is_wp_error($term)) { - return false; + if (!isset(self::$authorsBySlugCache[$slug])) { + $term = get_term_by('slug', $slug, 'author'); + if (!$term || is_wp_error($term)) { + return false; + } + + self::$authorsBySlugCache[$slug] = new Author($term); } - return new Author($term); + return isset(self::$authorsBySlugCache[$slug]) ? self::$authorsBySlugCache[$slug] : false; } @@ -346,24 +407,11 @@ public function __get($attribute) break; case 'user_url': - $url = $this->get_meta('user_url'); - - if (empty($url) && !$this->is_guest()) { - $user = $this->get_user_object(); - - $return = $user->user_url; - } else { - $return = $url; - } - + $return = $this->get_meta('user_url'); break; case 'first_name': - if (!$this->is_guest()) { - $return = get_user_meta($this->user_id, 'first_name', true); - } else { - $return = get_term_meta($this->term_id, 'first_name', true); - } + $return = $this->get_meta('first_name'); break; case 'term_id': @@ -371,7 +419,7 @@ public function __get($attribute) break; case 'link': - $user_id = get_term_meta($this->term_id, 'user_id', true); + $user_id = $this->get_meta('user_id'); // Is a user mapped to this author? if (!$this->is_guest()) { @@ -398,7 +446,7 @@ public function __get($attribute) break; default: - $return = get_term_meta($this->term_id, $attribute, true); + $return = $this->get_meta($attribute); if (is_null($return)) { /** @@ -420,13 +468,17 @@ public function __get($attribute) */ public function get_avatar_url($size = 96) { - if ($this->has_custom_avatar()) { - $url = $this->get_custom_avatar_url($size); - } else { - $url = get_avatar_url($this->user_email, $size); + if (!is_null($this->avatarUrl)) { + if ($this->has_custom_avatar()) { + $url = $this->get_custom_avatar_url($size); + } else { + $url = get_avatar_url($this->user_email, $size); + } + + $this->avatarUrl = $url; } - return $url; + return $this->avatarUrl; } /** @@ -437,15 +489,19 @@ public function get_avatar_url($size = 96) */ public function get_meta($key, $single = true) { - $meta = Author_Utils::get_author_meta($this->term_id, $key, $single); + if (!isset($this->metaCache[$key])) { + $meta = Author_Utils::get_author_meta($this->term_id, $key, $single); - if ($this->is_guest()) { - return $meta; - } elseif (empty($meta) && '0' !== (string)$meta) { - $meta = get_user_meta($this->user_id, $key, $single); + if ($this->is_guest()) { + return $meta; + } elseif (empty($meta) && '0' !== (string)$meta) { + $meta = get_user_meta($this->user_id, $key, $single); + } + + $this->metaCache[$key] = $meta; } - return $meta; + return $this->metaCache[$key]; } /** @@ -453,7 +509,11 @@ public function get_meta($key, $single = true) */ public function has_custom_avatar() { - return Author_Utils::author_has_custom_avatar($this->term_id); + if (is_null($this->hasCustomAvatar)) { + $this->hasCustomAvatar = Author_Utils::author_has_custom_avatar($this->term_id); + } + + return $this->hasCustomAvatar; } /** @@ -463,27 +523,31 @@ public function has_custom_avatar() */ protected function get_custom_avatar_url($size = 96) { - $avatar_attachment_id = get_term_meta($this->term_id, 'avatar', true); - - // Get the avatar from the attachments. - $url = ''; - $url2x = ''; - if (!empty($avatar_attachment_id)) { - $url = wp_get_attachment_image_url($avatar_attachment_id, $size); - $url2x = wp_get_attachment_image_url($avatar_attachment_id, $size * 2); - } - - // Check if it should return the default avatar. - if (empty($url)) { - $avatar_data = get_avatar_data(0); - $url = $avatar_data['url']; - $url2x = $avatar_data['url'] . '2x'; + if (is_null($this->customAvatarUrl)) { + $avatar_attachment_id = get_term_meta($this->term_id, 'avatar', true); + + // Get the avatar from the attachments. + $url = ''; + $url2x = ''; + if (!empty($avatar_attachment_id)) { + $url = wp_get_attachment_image_url($avatar_attachment_id, $size); + $url2x = wp_get_attachment_image_url($avatar_attachment_id, $size * 2); + } + + // Check if it should return the default avatar. + if (empty($url)) { + $avatar_data = get_avatar_data(0); + $url = $avatar_data['url']; + $url2x = $avatar_data['url'] . '2x'; + } + + $this->customAvatarUrl = [ + 'url' => $url, + 'url2x' => $url2x, + ]; } - return [ - 'url' => $url, - 'url2x' => $url2x, - ]; + return $this->customAvatarUrl; } /** @@ -496,43 +560,47 @@ protected function get_custom_avatar_url($size = 96) */ public function get_avatar($size = 96) { - /** - * Filters whether to retrieve the avatar early. - * - * Passing a non-null value will effectively short-circuit get_avatar(), passing - * the value through the {@see 'multiple_authors_get_avatar'} filter and returning early. - * - * @param string $avatar HTML for the author's avatar. Default null. - * @param Author $author The author's instance. - * @param int $size The size of the avatar. - * - * @since 2.2.1 - * - */ - $avatar = apply_filters('multiple_authors_pre_get_avatar', null, $this, $size); - - if (!is_null($avatar)) { - /** This filter is documented in core/Classes/Objects/Author.php */ - return apply_filters('multiple_authors_get_avatar', $avatar, $this, $size); - } - - if ($this->has_custom_avatar()) { - $avatar = $this->get_custom_avatar($size); - } else { - $avatar = get_avatar($this->user_email, $size); + if (!isset($this->avatarBySize[$size])) { + /** + * Filters whether to retrieve the avatar early. + * + * Passing a non-null value will effectively short-circuit get_avatar(), passing + * the value through the {@see 'multiple_authors_get_avatar'} filter and returning early. + * + * @param string $avatar HTML for the author's avatar. Default null. + * @param Author $author The author's instance. + * @param int $size The size of the avatar. + * + * @since 2.2.1 + * + */ + $avatar = apply_filters('multiple_authors_pre_get_avatar', null, $this, $size); + + if (!is_null($avatar)) { + /** This filter is documented in core/Classes/Objects/Author.php */ + return apply_filters('multiple_authors_get_avatar', $avatar, $this, $size); + } + + if ($this->has_custom_avatar()) { + $avatar = $this->get_custom_avatar($size); + } else { + $avatar = get_avatar($this->user_email, $size); + } + + /** + * Filters the avatar to retrieve. + * + * @param string $avatar HTML for the author's avatar. + * @param Author $author The author's instance. + * @param int $size The size of the avatar. + * + * @since 2.2.1 + * + */ + $this->avatarBySize[$size] = apply_filters('multiple_authors_get_avatar', $avatar, $this, $size); } - /** - * Filters the avatar to retrieve. - * - * @param string $avatar HTML for the author's avatar. - * @param Author $author The author's instance. - * @param int $size The size of the avatar. - * - * @since 2.2.1 - * - */ - return apply_filters('multiple_authors_get_avatar', $avatar, $this, $size); + return isset($this->avatarBySize[$size]) ? $this->avatarBySize[$size] : false; } /** @@ -600,7 +668,7 @@ public function user_meta($metaKey, $single = true) } /** - * @return bool|\WP_User + * @return bool|WP_User */ public function get_user_object() { @@ -608,7 +676,11 @@ public function get_user_object() return false; } - return get_user_by('ID', $this->user_id); + if (empty($this->userObject)) { + $this->userObject = get_user_by('ID', $this->user_id); + } + + return !empty($this->userObject) ? $this->userObject : false; } /** @@ -623,12 +695,14 @@ public function is_guest() public static function get_by_email($emailAddress) { - $authorTermId = Author_Utils::get_author_term_id_by_email($emailAddress); + if (!isset(self::$authorsByEmailCache[$emailAddress])) { + $authorTermId = Author_Utils::get_author_term_id_by_email($emailAddress); - if (empty($authorTermId)) { - return false; + if (!empty($authorTermId)) { + self::$authorsByEmailCache[$emailAddress] = self::get_by_term_id($authorTermId); + } } - return self::get_by_term_id($authorTermId); + return isset(self::$authorsByEmailCache[$emailAddress]) ? self::$authorsByEmailCache[$emailAddress] : false; } } diff --git a/src/functions/template-tags.php b/src/functions/template-tags.php index 942f6087..e9f19c8e 100644 --- a/src/functions/template-tags.php +++ b/src/functions/template-tags.php @@ -25,62 +25,75 @@ */ function get_multiple_authors($post = 0, $filter_the_author = true, $archive = false) { - if (!$archive) { - // If not archive, we get the authors from the current post, or from the given post. - if (is_null($post)) { - $post = get_post(); - } elseif (is_int($post) || is_numeric($post)) { - $post = get_post((int)$post); - } - - if (!$post) { - return []; - } + global $multipleAuthorsForPost; - $taxonomy = 'author'; - $terms = wp_get_post_terms($post->ID, $taxonomy, ['fields' => 'ids']); + $cacheKey = null; + if (is_object($post)) { + $cacheKey = $post->ID; } else { - // Get the term related to the current author from the archive page. - $authorName = get_query_var('author_name'); - $terms = []; - - if (!empty($authorName)) { - $terms[] = get_term_by('slug', $authorName, 'author'); - } + $cacheKey = (int)$post; } + $cacheKey .= $filter_the_author ? 1 : 0; + $cacheKey .= $archive ? 1 : 0; + $authors = []; + + if (empty($multipleAuthorsForPost) || !isset($multipleAuthorsForPost[$cacheKey])) { + if (!$archive) { + // If not archive, we get the authors from the current post, or from the given post. + if (is_null($post)) { + $post = get_post(); + } elseif (is_int($post) || is_numeric($post)) { + $post = get_post((int)$post); + } - if ($terms && !is_wp_error($terms)) { - $authors = []; - foreach ($terms as $term) { - if (is_numeric($term)) { - $term = get_term($term); + if (!$post) { + return []; } - $author = Author::get_by_term_id($term->term_id); + $taxonomy = 'author'; + $terms = wp_get_post_terms($post->ID, $taxonomy, ['fields' => 'ids']); + } else { + // Get the term related to the current author from the archive page. + $authorName = get_query_var('author_name'); + $terms = []; - if ($filter_the_author) { - $author->display_name = apply_filters('the_author', $author->display_name); + if (!empty($authorName)) { + $terms[] = get_term_by('slug', $authorName, 'author'); } - - $authors[] = $author; } - return $authors; - } elseif (!$terms) { - $user = get_user_by('id', $post->post_author); + if ($terms && !is_wp_error($terms)) { + foreach ($terms as $term) { + if (is_numeric($term)) { + $term = get_term($term); + } - if ($user) { - $user->link = get_author_posts_url($user->ID); + $author = Author::get_by_term_id($term->term_id); + + if ($filter_the_author) { + $author->display_name = apply_filters('the_author', $author->display_name); + } - if ($filter_the_author) { - $user->display_name = apply_filters('the_author', $user->display_name); + $authors[] = $author; } + } elseif (!$terms) { + $user = get_user_by('id', $post->post_author); - return [$user]; + if ($user) { + $user->link = get_author_posts_url($user->ID); + + if ($filter_the_author) { + $user->display_name = apply_filters('the_author', $user->display_name); + } + + $authors = [$user]; + } } + + $multipleAuthorsForPost[$cacheKey] = $authors; } - return []; + return isset($multipleAuthorsForPost[$cacheKey]) ? $multipleAuthorsForPost[$cacheKey] : []; } } @@ -118,6 +131,11 @@ function multiple_authors_get_all_authors($args = []) function is_multiple_author_for_post($user, $post_id = 0) { global $post; + global $postAuthorsCache; + + if (empty($postAuthorsCache)) { + $postAuthorsCache = []; + } if (!$post_id && $post) { $post_id = $post->ID; @@ -131,7 +149,13 @@ function is_multiple_author_for_post($user, $post_id = 0) return false; } - $coauthors = get_multiple_authors($post_id); + if (!isset($postAuthorsCache[$post_id])) { + $coauthors = get_multiple_authors($post_id); + + $postAuthorsCache[$post_id] = $coauthors; + } + $coauthors = $postAuthorsCache[$post_id]; + if (is_numeric($user)) { $user = (int)$user; From 79f3ca0f03746a0e14a3c84e7d768f7f80619d76 Mon Sep 17 00:00:00 2001 From: Mohamed Magdy Date: Wed, 5 Aug 2020 11:43:37 +0200 Subject: [PATCH 16/24] Adding the authors list widget --- .vscode/settings.json | 7 + Untitled.code-workspace | 7 + src/core/Authors_Widget.php | 219 +++++++++++++++ src/core/Plugin.php | 1 + src/core/Widget.php | 262 +++++++++--------- src/functions/template-tags.php | 10 +- .../default-layouts/default-layouts.php | 1 + src/twig/authors-list-widget-form.twig | 9 + src/twig/widget-form.twig | 2 + 9 files changed, 388 insertions(+), 130 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 Untitled.code-workspace create mode 100644 src/core/Authors_Widget.php create mode 100644 src/twig/authors-list-widget-form.twig diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..92767971 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "phpmd.rules": "./phpmd-ruleset.xml", + "[php]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "ecodes.vscode-phpmd" + } +} \ No newline at end of file diff --git a/Untitled.code-workspace b/Untitled.code-workspace new file mode 100644 index 00000000..362d7c25 --- /dev/null +++ b/Untitled.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file diff --git a/src/core/Authors_Widget.php b/src/core/Authors_Widget.php new file mode 100644 index 00000000..4d0d6fb8 --- /dev/null +++ b/src/core/Authors_Widget.php @@ -0,0 +1,219 @@ + + * @copyright Copyright (C) 2018 PublishPress. All rights reserved. + * @license GPLv2 or later + * @since 3.4.0 + */ + +namespace MultipleAuthors; +use WP_Widget; + +class Authors_Widget extends WP_Widget { + + /** + * Sets up the widgets name etc + */ + public function __construct() + { + $this->title = esc_html__( 'Authors List', 'publishpress-authors' ); + Parent::__construct( + 'multiple_authors_list_widget', + $this->title, + array( + 'classname' => 'multiple_authors_authors-list_widget', + 'description' => esc_html__( + 'Display authors list.', + 'publishpress-authors' + ), + ) + ); + } + + /** + * Outputs the content of the widget + * + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) + { + + $instance = wp_parse_args( + (array) $instance, + array( + 'title' => $this->title, + ) + ); + + /** This filter is documented in core/src/wp-includes/default-widgets.php */ + $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); + $output = ''; + + + $output .= $this->get_author_box_markup( $args, $instance ); + if ( ! empty( $output ) ) { + echo $args['before_widget']; + echo $args['before_title'] . apply_filters( 'widget_title', $title ) . $args['after_title']; + echo $output; + echo $args['after_widget']; + } + } + + /** + * Outputs the options form on admin + * + * @param array $instance The widget options + */ + public function form( $instance ) + { + $legacyPlugin = Factory::getLegacyPlugin(); + + $instance = wp_parse_args( + (array) $instance, + array( + 'title' => $this->title, + 'layout' => $legacyPlugin->modules->multiple_authors->options->layout, + 'show_empty' => true + ) + ); + + $title = strip_tags( $instance['title'] ); + $layout = strip_tags( $instance['layout'] ); + $showEmpty = isset( $instance['show_empty'] ) ? (bool) $instance['show_empty'] : false; + $context = array( + 'labels' => array( + 'title' => esc_html__( 'Title', 'publishpress-authors' ), + 'layout' => esc_html__( 'Layout', 'publishpress-authors' ), + 'show_empty' => esc_html__( 'Display All Authors (including those who have not written any posts)', 'publishpress-authors' ) + ), + 'ids' => array( + 'title' => $this->get_field_id( 'title' ), + 'layout' => $this->get_field_id( 'layout' ), + 'show_empty' => $this->get_field_id( 'show_empty' ) + ), + 'names' => array( + 'title' => $this->get_field_name( 'title' ), + 'layout' => $this->get_field_name( 'layout' ), + 'show_empty' => $this->get_field_name( 'show_empty' ) + ), + 'values' => array( + 'title' => $title, + 'layout' => $layout, + 'show_empty' => $showEmpty + ), + 'layouts' => apply_filters( 'pp_multiple_authors_author_layouts', array() ), + ); + + $container = Factory::get_container(); + + echo $container['twig']->render( 'authors-list-widget-form.twig', $context ); + } + + /** + * Processing widget options on save + * + * @param array $new_instance The new options + * @param array $old_instance The previous options + */ + public function update( $new_instance, $old_instance ) + { + $instance = array(); + + $instance['title'] = sanitize_text_field( $new_instance['title'] ); + $instance['layout'] = sanitize_text_field( $new_instance['layout'] ); + $instance['show_empty'] = isset( $new_instance['show_empty'] ) ? (bool) $new_instance['show_empty'] : false; + $layouts = apply_filters( 'pp_multiple_authors_author_layouts', array() ); + + if ( ! array_key_exists( $instance['layout'], $layouts ) ) { + $instance['layout'] = 'simple_list'; + } + + return $instance; + } + + + /** + * Get HTML markdown + * + * @param array $args The args. + * @param array $instance The object instance. + * + * @return string $html The html. + */ + private function get_author_box_markup( + $args, + $instance, + $target = 'widget' + ) { + $html = ''; + + $legacyPlugin = Factory::getLegacyPlugin(); + + wp_enqueue_style('dashicons'); + wp_enqueue_style( + 'multiple-authors-widget-css', + PP_AUTHORS_ASSETS_URL . 'css/multiple-authors-widget.css', + false, + PP_AUTHORS_VERSION, + 'all' + ); + + if (!function_exists('multiple_authors')) { + require_once PP_AUTHORS_SRC_PATH . 'functions/template-tags.php'; + } + + $css_class = ''; + if (!empty($target)) { + $css_class = 'multiple-authors-target-' . str_replace('_', '-', $target); + } + + $title = $instance['title']; + $title = esc_html($title); + + $layout = $instance['layout']; + if (empty($layout)) { + $layout = isset($legacyPlugin->modules->multiple_authors->options->layout) + ? $legacyPlugin->modules->multiple_authors->options->layout : 'simple_list'; + } + + $show_email = isset($legacyPlugin->modules->multiple_authors->options->show_email_link) + ? 'yes' === $legacyPlugin->modules->multiple_authors->options->show_email_link : true; + + $show_site = isset($legacyPlugin->modules->multiple_authors->options->show_site_link) + ? 'yes' === $legacyPlugin->modules->multiple_authors->options->show_site_link : true; + + $showEmpty = isset( $instance['show_empty'] ) ? $instance['show_empty'] : false; + + $args = [ + 'show_title' => false, + 'css_class' => $css_class, + 'title' => $title, + 'authors' => multiple_authors_get_all_authors(array('hide_empty' => !$showEmpty)), + 'target' => $target, + 'item_class' => 'author url fn', + 'layout' => $layout, + 'show_email' => $show_email, + 'show_site' => $show_site + ]; + + /** + * Filter the author box arguments before sending to the renderer. + * + * @param array $args + */ + $args = apply_filters('pp_multiple_authors_authors_list_box_args', $args); + + /** + * Filter the author box HTML code, allowing to use custom rendered layouts. + * + * @param string $html + * @param array $args + */ + $html = apply_filters('pp_multiple_authors_authors_list_box_html', null, $args); + + return $html; + } + + } \ No newline at end of file diff --git a/src/core/Plugin.php b/src/core/Plugin.php index 5afb8587..a77b43e1 100644 --- a/src/core/Plugin.php +++ b/src/core/Plugin.php @@ -613,6 +613,7 @@ public function filterDisplayFooter($shouldDisplay = true) public function action_widget_init() { register_widget('MultipleAuthors\\Widget'); + register_widget('MultipleAuthors\\Authors_Widget'); } /** diff --git a/src/core/Widget.php b/src/core/Widget.php index 1afd9d77..5723d868 100644 --- a/src/core/Widget.php +++ b/src/core/Widget.php @@ -7,134 +7,144 @@ * @since 1.0.0 */ -namespace MultipleAuthors; +namespace MultipleAuthors; use MultipleAuthors\Traits\Author_box; use WP_Widget; -class Widget extends WP_Widget -{ - use Author_box; - - /** - * Sets up the widgets name etc - */ - public function __construct() - { - parent::__construct( - 'multiple_authors_widget', - esc_html__('Authors', 'publishpress-authors'), - [ - 'classname' => 'multiple_authors_widget', - 'description' => esc_html__( - 'Display a list of authors for the current post.', - 'publishpress-authors' - ), - ] - ); - } - - /** - * Outputs the content of the widget - * - * @param array $args - * @param array $instance - */ - public function widget($args, $instance) - { - $legacyPlugin = Factory::getLegacyPlugin(); - - $instance = wp_parse_args( - (array)$instance, - [ - 'title' => esc_html__('Authors', 'publishpress-authors'), - ] - ); - - /** This filter is documented in core/src/wp-includes/default-widgets.php */ - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); - $output = ''; - - if ($this->should_display_author_box()) { - $layout = isset($instance['layout']) ? $instance['layout'] : $legacyPlugin->modules->multiple_authors->options->layout; - - $output .= $this->get_author_box_markup('widget', false, $layout); - - if (!empty($output)) { - echo $args['before_widget']; - echo $args['before_title'] . apply_filters('widget_title', $title) . $args['after_title']; - echo $output; - echo $args['after_widget']; - } - } - } - - /** - * Outputs the options form on admin - * - * @param array $instance The widget options - */ - public function form($instance) - { - $legacyPlugin = Factory::getLegacyPlugin(); - - $instance = wp_parse_args( - (array)$instance, - [ - 'title' => esc_html__('Authors', 'publishpress-authors'), - 'layout' => $legacyPlugin->modules->multiple_authors->options->layout, - ] - ); - - $title = strip_tags($instance['title']); - $layout = strip_tags($instance['layout']); - - $context = [ - 'labels' => [ - 'title' => esc_html__('Title', 'publishpress-authors'), - 'layout' => esc_html__('Layout', 'publishpress-authors'), - ], - 'ids' => [ - 'title' => $this->get_field_id('title'), - 'layout' => $this->get_field_id('layout'), - ], - 'names' => [ - 'title' => $this->get_field_name('title'), - 'layout' => $this->get_field_name('layout'), - ], - 'values' => [ - 'title' => $title, - 'layout' => $layout, - ], - 'layouts' => apply_filters('pp_multiple_authors_author_layouts', []), - ]; - - $container = Factory::get_container(); - - echo $container['twig']->render('widget-form.twig', $context); - } - - /** - * Processing widget options on save - * - * @param array $new_instance The new options - * @param array $old_instance The previous options - */ - public function update($new_instance, $old_instance) - { - $legacyPlugin = Factory::getLegacyPlugin(); - - $instance = []; - - $instance['title'] = sanitize_text_field($new_instance['title']); - $instance['layout'] = sanitize_text_field($new_instance['layout']); - - $layouts = apply_filters('pp_multiple_authors_author_layouts', []); - - if (!array_key_exists($instance['layout'], $layouts)) { - $instance['layout'] = $legacyPlugin->modules->multiple_authors->options->layout; - } - - return $instance; - } +class Widget extends WP_Widget { + + use Author_box; + + /** + * Widget Title + * + * @var string + * + * @since 3.4.0 + */ + protected $title; + + /** + * Sets up the widgets name etc + */ + public function __construct() + { + $this->title = esc_html__( 'Post Author', 'publishpress-authors' ); + parent::__construct( + 'multiple_authors_widget', + $this->title, + array( + 'classname' => 'multiple_authors_widget', + 'description' => esc_html__( + 'Display a list of authors for the current post.', + 'publishpress-authors' + ), + ) + ); + } + + /** + * Outputs the content of the widget + * + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) + { + $legacyPlugin = Factory::getLegacyPlugin(); + + $instance = wp_parse_args( + (array) $instance, + array( + 'title' => $this->title, + ) + ); + + /** This filter is documented in core/src/wp-includes/default-widgets.php */ + $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); + $output = ''; + + if ( $this->should_display_author_box() ) { + $layout = isset( $instance['layout'] ) ? $instance['layout'] : $legacyPlugin->modules->multiple_authors->options->layout; + + $output .= $this->get_author_box_markup( 'widget', false, $layout ); + + if ( ! empty( $output ) ) { + echo $args['before_widget']; + echo $args['before_title'] . apply_filters( 'widget_title', $title ) . $args['after_title']; + echo $output; + echo $args['after_widget']; + } + } + } + + /** + * Outputs the options form on admin + * + * @param array $instance The widget options + */ + public function form( $instance ) + { + $legacyPlugin = Factory::getLegacyPlugin(); + + $instance = wp_parse_args( + (array) $instance, + array( + 'title' => $this->title, + 'layout' => $legacyPlugin->modules->multiple_authors->options->layout, + ) + ); + + $title = strip_tags( $instance['title'] ); + $layout = strip_tags( $instance['layout'] ); + + $context = array( + 'labels' => array( + 'title' => esc_html__( 'Title', 'publishpress-authors' ), + 'layout' => esc_html__( 'Layout', 'publishpress-authors' ), + ), + 'ids' => array( + 'title' => $this->get_field_id( 'title' ), + 'layout' => $this->get_field_id( 'layout' ), + ), + 'names' => array( + 'title' => $this->get_field_name( 'title' ), + 'layout' => $this->get_field_name( 'layout' ), + ), + 'values' => array( + 'title' => $title, + 'layout' => $layout, + ), + 'layouts' => apply_filters( 'pp_multiple_authors_author_layouts', array() ), + ); + + $container = Factory::get_container(); + + echo $container['twig']->render( 'widget-form.twig', $context ); + } + + /** + * Processing widget options on save + * + * @param array $new_instance The new options + * @param array $old_instance The previous options + */ + public function update( $new_instance, $old_instance ) + { + $legacyPlugin = Factory::getLegacyPlugin(); + + $instance = array(); + + $instance['title'] = sanitize_text_field( $new_instance['title'] ); + $instance['layout'] = sanitize_text_field( $new_instance['layout'] ); + + $layouts = apply_filters( 'pp_multiple_authors_author_layouts', array() ); + + if ( ! array_key_exists( $instance['layout'], $layouts ) ) { + $instance['layout'] = $legacyPlugin->modules->multiple_authors->options->layout; + } + + return $instance; + } } diff --git a/src/functions/template-tags.php b/src/functions/template-tags.php index 942f6087..a416f668 100644 --- a/src/functions/template-tags.php +++ b/src/functions/template-tags.php @@ -99,12 +99,14 @@ function multiple_authors_get_all_authors($args = []) $args = wp_parse_args($args, $defaults); $terms = get_terms('author', $args); - - foreach ($terms as &$term) { - $term = Author::get_by_term_id($term->term_id); + $authors = []; + foreach ($terms as $term) { + $author = Author::get_by_term_id($term->term_id); + $author->display_name = apply_filters('the_author', $author->display_name); + $authors[] = $author; } - return $terms; + return $authors; } } diff --git a/src/modules/default-layouts/default-layouts.php b/src/modules/default-layouts/default-layouts.php index b573ec1d..b8988fbf 100644 --- a/src/modules/default-layouts/default-layouts.php +++ b/src/modules/default-layouts/default-layouts.php @@ -74,6 +74,7 @@ public function __construct() public function init() { add_filter('pp_multiple_authors_author_box_html', [$this, 'renderBoxHTML'], 10, 2); + add_filter('pp_multiple_authors_authors_list_box_html', [$this, 'renderBoxHTML'], 10, 2); add_filter('pp_multiple_authors_author_layouts', [$this, 'getListOfLayouts'], 10, 2); } diff --git a/src/twig/authors-list-widget-form.twig b/src/twig/authors-list-widget-form.twig new file mode 100644 index 00000000..3c2f6418 --- /dev/null +++ b/src/twig/authors-list-widget-form.twig @@ -0,0 +1,9 @@ +{% extends "widget-form.twig" %} +{% block other_options %} +

+ + +

+{% endblock %} \ No newline at end of file diff --git a/src/twig/widget-form.twig b/src/twig/widget-form.twig index 2188ca1f..8458abe2 100644 --- a/src/twig/widget-form.twig +++ b/src/twig/widget-form.twig @@ -16,3 +16,5 @@

+{% block other_options %} +{% endblock %} From 8690bbe69d71cc7687a51d766a00015591ac8109 Mon Sep 17 00:00:00 2001 From: Mohamed Magdy <65375623+mdmag@users.noreply.github.com> Date: Wed, 5 Aug 2020 13:15:40 +0200 Subject: [PATCH 17/24] Delete settings.json --- .vscode/settings.json | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 92767971..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "phpmd.rules": "./phpmd-ruleset.xml", - "[php]": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "ecodes.vscode-phpmd" - } -} \ No newline at end of file From 3b0d4c20662917c1e548a7f4fda40abb824b7e13 Mon Sep 17 00:00:00 2001 From: Mohamed Magdy <65375623+mdmag@users.noreply.github.com> Date: Wed, 5 Aug 2020 13:16:04 +0200 Subject: [PATCH 18/24] Delete Untitled.code-workspace --- Untitled.code-workspace | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Untitled.code-workspace diff --git a/Untitled.code-workspace b/Untitled.code-workspace deleted file mode 100644 index 362d7c25..00000000 --- a/Untitled.code-workspace +++ /dev/null @@ -1,7 +0,0 @@ -{ - "folders": [ - { - "path": "." - } - ] -} \ No newline at end of file From 53a9cb9fd7f3a54c07a7d230fbd712066c9f0931 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 5 Aug 2020 11:24:54 -0300 Subject: [PATCH 19/24] Add a pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..40b650e2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ + + +## Description + + +## Benefits + + +## Possible drawbacks + + +## Applicable issues + + +## Checklist + + + +- [ ] I have created a specific branch for this pull request before committing, starting off the current HEAD of `development` branch. +- [ ] I'm submitting to the `development`, feature/hotfix/release branch. (Do not submit to the master branch!) +- [ ] This pull request relates to a specific problem (bug or improvement). +- [ ] I have mentioned the issue number in the pull request description text. +- [ ] All the issues mentioned in this pull request relate to the problem I'm trying to solve. +- [ ] The code I'm sending follows the [PSR-12](https://www.php-fig.org/psr/psr-12/) coding style. From 701da39df86e57fe8e8f7d5d6cf9255edea61b8e Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Wed, 5 Aug 2020 17:22:09 -0300 Subject: [PATCH 20/24] Update the changelog --- readme.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.txt b/readme.txt index b4ca3432..c08b85da 100644 --- a/readme.txt +++ b/readme.txt @@ -127,6 +127,15 @@ There are two ways to install the PublishPress Authors plugin: The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html). += [3.5.0] - UNRELEASED = + +* Added: Added a new widget to display all the authors, #76; +* Added: Added option to display the username in the authors search field, #162; +* Fixed: Fix compatibility with WooCommerce products, #169; +* Fixed: Performance issue in the frontend. Added cache for queries that can run multiple times in the frontend, #171; +* Fixed: Fix PHP notice on author page when user is not an author, #156; +* Fixed: Fixed notice when a post doesn't exist after deleting the post, #167; + = [3.4.0] - 2020-07-23 = * Added: Add new filter "publishpress_authors_author_attribute" for customizing author attributes in the layouts; From ebbda4668ce32ba50f8695adecadd1da4875cdef Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Thu, 6 Aug 2020 13:37:15 -0300 Subject: [PATCH 21/24] Update the release issue templates --- .github/ISSUE_TEMPLATE/release-free-plugin.md | 2 +- .github/ISSUE_TEMPLATE/release-pro-plugin.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/release-free-plugin.md b/.github/ISSUE_TEMPLATE/release-free-plugin.md index 9c4434c2..741f5fdf 100644 --- a/.github/ISSUE_TEMPLATE/release-free-plugin.md +++ b/.github/ISSUE_TEMPLATE/release-free-plugin.md @@ -15,7 +15,7 @@ To release the Free plugin please make sure to check all the checkboxes below. - [ ] Make sure to directly merge or use Pull Requests to merge hotfixes or features branches into the release branch - [ ] Run `composer update` and check if there is any relevant update. Check if you need to lock the current version for any dependency. The `--no-dev` argument is optional here, since the build script will make sure to run the build with that argument. - [ ] Update the changelog - make sure all the changes are there with a user-friendly description and that the release date is correct -- [ ] Update the version number to the next stable version. Use `$ vendor/bin/robo set-version ` +- [ ] Update the version number to the next stable version. Use `$ vendor/bin/robo version ` - [ ] Commit the changes to the release branch - [ ] Build the zip package using `$ vendor/bin/robo build`. It should create a package in the `./dist` dir. - [ ] Send to the team for testing diff --git a/.github/ISSUE_TEMPLATE/release-pro-plugin.md b/.github/ISSUE_TEMPLATE/release-pro-plugin.md index e76aa22b..f092d0ee 100644 --- a/.github/ISSUE_TEMPLATE/release-pro-plugin.md +++ b/.github/ISSUE_TEMPLATE/release-pro-plugin.md @@ -16,7 +16,7 @@ To release the Pro plugin please make sure to check all the checkboxes below. - [ ] Update the `composer.json` file changing the version constraint to the Free plugin to use the most recent stable release tag - [ ] Run `composer update` and check if there is any relevant update. Check if you need to lock the current version for any dependency. The `--no-dev` argument is optional here, since the build script will make sure to run the build with that argument. - [ ] Update the changelog - make sure all the changes are there with a user-friendly description and that the release date is correct -- [ ] Update the version number to the next stable version. Use `$ vendor/bin/robo set-version ` +- [ ] Update the version number to the next stable version. Use `$ vendor/bin/robo version ` - [ ] Commit the changes to the release branch - [ ] Build the zip package using `$ vendor/bin/robo build`. It should create a package in the `./dist` dir. - [ ] Send to the team for testing From 5b9e6f99799364ed99ef988899bb28b899b843fe Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Thu, 6 Aug 2020 13:39:49 -0300 Subject: [PATCH 22/24] Bump version to 3.5.0 --- composer.lock | 62 ++++++++++++++++++++-------------------- publishpress-authors.php | 2 +- readme.txt | 2 +- src/defines.php | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/composer.lock b/composer.lock index a99498da..d7636c81 100644 --- a/composer.lock +++ b/composer.lock @@ -149,7 +149,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -889,16 +889,16 @@ }, { "name": "composer/composer", - "version": "1.10.9", + "version": "1.10.10", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "83c3250093d5491600a822e176b107a945baf95a" + "reference": "32966a3b1d48bc01472a8321fd6472b44fad033a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/83c3250093d5491600a822e176b107a945baf95a", - "reference": "83c3250093d5491600a822e176b107a945baf95a", + "url": "https://api.github.com/repos/composer/composer/zipball/32966a3b1d48bc01472a8321fd6472b44fad033a", + "reference": "32966a3b1d48bc01472a8321fd6472b44fad033a", "shasum": "" }, "require": { @@ -965,7 +965,7 @@ "dependency", "package" ], - "time": "2020-07-16T10:57:00+00:00" + "time": "2020-08-03T09:35:19+00:00" }, { "name": "composer/semver", @@ -2312,7 +2312,7 @@ }, { "name": "illuminate/contracts", - "version": "v7.22.4", + "version": "v7.23.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2356,16 +2356,16 @@ }, { "name": "illuminate/support", - "version": "v7.22.4", + "version": "v7.23.0", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "138d67507a697c3fff06710af2df7452d0fafb09" + "reference": "7bdde5ecd25f66e3e8b9a2ddc5dbc3154df103b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/138d67507a697c3fff06710af2df7452d0fafb09", - "reference": "138d67507a697c3fff06710af2df7452d0fafb09", + "url": "https://api.github.com/repos/illuminate/support/zipball/7bdde5ecd25f66e3e8b9a2ddc5dbc3154df103b6", + "reference": "7bdde5ecd25f66e3e8b9a2ddc5dbc3154df103b6", "shasum": "" }, "require": { @@ -2414,7 +2414,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2020-07-27T17:48:28+00:00" + "time": "2020-07-31T13:31:49+00:00" }, { "name": "justinrainbow/json-schema", @@ -2859,16 +2859,16 @@ }, { "name": "nesbot/carbon", - "version": "2.37.0", + "version": "2.38.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "1f61206de973d67f36ce50f041c792ddac663c3e" + "reference": "d8f6a6a91d1eb9304527b040500f61923e97674b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e", - "reference": "1f61206de973d67f36ce50f041c792ddac663c3e", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d8f6a6a91d1eb9304527b040500f61923e97674b", + "reference": "d8f6a6a91d1eb9304527b040500f61923e97674b", "shasum": "" }, "require": { @@ -2883,7 +2883,7 @@ "kylekatarnls/multi-tester": "^2.0", "phpmd/phpmd": "^2.8", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.30", + "phpstan/phpstan": "^0.12.35", "phpunit/phpunit": "^7.5 || ^8.0", "squizlabs/php_codesniffer": "^3.4" }, @@ -2934,7 +2934,7 @@ "datetime", "time" ], - "time": "2020-07-28T06:04:54+00:00" + "time": "2020-08-04T19:12:46+00:00" }, { "name": "paragonie/random_compat", @@ -3676,16 +3676,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "5672711b6b07b14d5ab694e700c62eeb82fcf374" + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5672711b6b07b14d5ab694e700c62eeb82fcf374", - "reference": "5672711b6b07b14d5ab694e700c62eeb82fcf374", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { @@ -3721,7 +3721,7 @@ "keywords": [ "tokenizer" ], - "time": "2020-06-27T06:36:25+00:00" + "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", @@ -4053,11 +4053,11 @@ }, { "name": "publishpress/publishpress-plugin-builder", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/publishpress/PublishPress-Plugin-Builder", - "reference": "59bd814a0a78215772223881f78fbb676668033e" + "reference": "2111eb9b5a27809a911c3b9f34a6a0cfbac5436c" }, "require": { "consolidation/robo": "^2.0", @@ -4088,7 +4088,7 @@ } ], "description": "Robo tasks for building WordPress plugins", - "time": "2020-07-30T22:42:05+00:00" + "time": "2020-08-05T19:47:09+00:00" }, { "name": "publishpress/wp-browser", @@ -5849,7 +5849,7 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -5913,7 +5913,7 @@ }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -5980,7 +5980,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -6043,7 +6043,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -6105,7 +6105,7 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", diff --git a/publishpress-authors.php b/publishpress-authors.php index 0d25892d..65d3a65a 100644 --- a/publishpress-authors.php +++ b/publishpress-authors.php @@ -5,7 +5,7 @@ * Description: Add support for multiple authors * Author: PublishPress * Author URI: https://publishpress.com - * Version: 3.4.0-hotfix-169 + * Version: 3.5.0 * Text Domain: publishpress-authors * * ------------------------------------------------------------------------------ diff --git a/readme.txt b/readme.txt index c08b85da..1913f262 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: multiple authors, authors, guest authors, author fields, author layouts Requires at least: 4.7 Requires PHP: 5.6 Tested up to: 5.4 -Stable tag: 3.4.0 +Stable tag: 3.5.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/src/defines.php b/src/defines.php index 52692ccd..2d6e7a2c 100644 --- a/src/defines.php +++ b/src/defines.php @@ -11,7 +11,7 @@ defined('ABSPATH') or die('No direct script access allowed.'); -define('PP_AUTHORS_VERSION', '3.4.0-hotfix-169'); +define('PP_AUTHORS_VERSION', '3.5.0'); define('PP_AUTHORS_FILE', 'publishpress-authors/publishpress-authors.php'); define('PP_AUTHORS_BASE_PATH', plugin_dir_path(realpath(__DIR__ . '/../publishpress-authors.php'))); define('PP_AUTHORS_SRC_PATH', PP_AUTHORS_BASE_PATH . 'src/'); From 13b50809b53dac24c5ef2f44bd6b8203d84b10fd Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Thu, 6 Aug 2020 13:45:45 -0300 Subject: [PATCH 23/24] Update the composer.lock file --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index d7636c81..3a68d43b 100644 --- a/composer.lock +++ b/composer.lock @@ -2312,7 +2312,7 @@ }, { "name": "illuminate/contracts", - "version": "v7.23.0", + "version": "v7.23.2", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2356,16 +2356,16 @@ }, { "name": "illuminate/support", - "version": "v7.23.0", + "version": "v7.23.2", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "7bdde5ecd25f66e3e8b9a2ddc5dbc3154df103b6" + "reference": "a73fabea211d9b26b76c64a925db4b660d150a88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/7bdde5ecd25f66e3e8b9a2ddc5dbc3154df103b6", - "reference": "7bdde5ecd25f66e3e8b9a2ddc5dbc3154df103b6", + "url": "https://api.github.com/repos/illuminate/support/zipball/a73fabea211d9b26b76c64a925db4b660d150a88", + "reference": "a73fabea211d9b26b76c64a925db4b660d150a88", "shasum": "" }, "require": { @@ -2414,7 +2414,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2020-07-31T13:31:49+00:00" + "time": "2020-08-06T13:54:33+00:00" }, { "name": "justinrainbow/json-schema", @@ -3525,16 +3525,16 @@ }, { "name": "phpunit/php-invoker", - "version": "3.0.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66" + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f6eedfed1085dd1f4c599629459a0277d25f9a66", - "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", "shasum": "" }, "require": { @@ -3550,7 +3550,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -3574,7 +3574,7 @@ "keywords": [ "process" ], - "time": "2020-06-26T11:53:53+00:00" + "time": "2020-08-06T07:04:15+00:00" }, { "name": "phpunit/php-text-template", From 2a3858f6e9c92c39ea07628b3359c8d0074f8f8b Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Thu, 6 Aug 2020 13:45:52 -0300 Subject: [PATCH 24/24] Update the release date --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 1913f262..f5dd2dbf 100644 --- a/readme.txt +++ b/readme.txt @@ -127,7 +127,7 @@ There are two ways to install the PublishPress Authors plugin: The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html). -= [3.5.0] - UNRELEASED = += [3.5.0] - 2020-08-06 = * Added: Added a new widget to display all the authors, #76; * Added: Added option to display the username in the authors search field, #162;