From 7d4856d630daf5ad7488e45f38432c8bef9f0878 Mon Sep 17 00:00:00 2001 From: Alex Cicovic <23142906+acicovic@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:15:13 +0200 Subject: [PATCH 1/3] Revert composer autoloader PR --- .github/workflows/deploy.yml | 1 - .github/workflows/e2e-tests.yml | 3 -- composer.json | 3 ++ wp-parsely.php | 59 +++++++++++++++++++++++++++++++-- 4 files changed, 59 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6d4c1a828..e75ec6bbd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,6 @@ jobs: run: | npm ci npm run build - composer dump-autoload --classmap-authoritative - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@stable env: diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index a69b4adb4..dc7cd15df 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -23,9 +23,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Refresh Composer autoload files - run: composer dump-autoload --classmap-authoritative - - name: Use desired version of NodeJS uses: actions/setup-node@v3.5.1 with: diff --git a/composer.json b/composer.json index b2d6f8d9d..598fc814e 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,9 @@ "autoload": { "classmap": [ "src/" + ], + "files": [ + "wp-parsely.php" ] }, "autoload-dev": { diff --git a/wp-parsely.php b/wp-parsely.php index 07c188bb9..fc7b712e9 100644 --- a/wp-parsely.php +++ b/wp-parsely.php @@ -59,9 +59,25 @@ const PARSELY_VERSION = '3.6.0'; const PARSELY_FILE = __FILE__; -if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { - require_once __DIR__ . '/vendor/autoload.php'; -} +require __DIR__ . '/src/class-parsely.php'; +require __DIR__ . '/src/class-scripts.php'; +require __DIR__ . '/src/class-dashboard-link.php'; +require __DIR__ . '/src/UI/class-admin-bar.php'; +require __DIR__ . '/src/UI/class-metadata-renderer.php'; +require __DIR__ . '/src/Endpoints/class-metadata-endpoint.php'; +require __DIR__ . '/src/Endpoints/class-graphql-metadata.php'; + +require __DIR__ . '/src/class-metadata.php'; +require __DIR__ . '/src/Metadata/class-metadata-builder.php'; +require __DIR__ . '/src/Metadata/class-author-archive-builder.php'; +require __DIR__ . '/src/Metadata/class-category-builder.php'; +require __DIR__ . '/src/Metadata/class-date-builder.php'; +require __DIR__ . '/src/Metadata/class-front-page-builder.php'; +require __DIR__ . '/src/Metadata/class-page-builder.php'; +require __DIR__ . '/src/Metadata/class-page-for-posts-builder.php'; +require __DIR__ . '/src/Metadata/class-paginated-front-page-builder.php'; +require __DIR__ . '/src/Metadata/class-post-builder.php'; +require __DIR__ . '/src/Metadata/class-tag-builder.php'; add_action( 'plugins_loaded', __NAMESPACE__ . '\\parsely_initialize_plugin' ); /** @@ -86,6 +102,11 @@ function parsely_initialize_plugin(): void { $metadata_renderer->run(); } +require __DIR__ . '/src/UI/class-admin-warning.php'; +require __DIR__ . '/src/UI/class-plugins-actions.php'; +require __DIR__ . '/src/UI/class-row-actions.php'; +require __DIR__ . '/src/UI/class-site-health.php'; + add_action( 'admin_init', __NAMESPACE__ . '\\parsely_admin_init_register' ); /** * Registers the Parse.ly wp-admin warnings, plugin actions and row actions. @@ -104,6 +125,9 @@ function parsely_admin_init_register(): void { $site_health->run(); } +require __DIR__ . '/src/UI/class-settings-page.php'; +require __DIR__ . '/src/UI/class-network-admin-sites-list.php'; + add_action( 'init', __NAMESPACE__ . '\\parsely_wp_admin_early_register' ); /** * Registers the additions the Parse.ly wp-admin settings page and Multisite @@ -117,6 +141,23 @@ function parsely_wp_admin_early_register(): void { $network_admin_sites_list->run(); } +require __DIR__ . '/src/RemoteAPI/interface-cache.php'; +require __DIR__ . '/src/RemoteAPI/interface-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-base-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-cached-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-related-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-analytics-posts-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-analytics-post-detail-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-referrers-post-detail-proxy.php'; +require __DIR__ . '/src/RemoteAPI/class-wordpress-cache.php'; + +require __DIR__ . '/src/Endpoints/class-base-api-proxy.php'; +require __DIR__ . '/src/Endpoints/class-related-api-proxy.php'; +require __DIR__ . '/src/Endpoints/class-analytics-posts-api-proxy.php'; +require __DIR__ . '/src/Endpoints/class-analytics-post-detail-api-proxy.php'; +require __DIR__ . '/src/Endpoints/class-referrers-post-detail-api-proxy.php'; +require __DIR__ . '/src/Endpoints/class-rest-metadata.php'; + add_action( 'rest_api_init', __NAMESPACE__ . '\\parsely_rest_api_init' ); /** * Registers REST Endpoints that act as a proxy to the Parse.ly API. @@ -154,6 +195,8 @@ function parsely_rest_api_init(): void { ); } +require __DIR__ . '/src/blocks/recommendations/class-recommendations-block.php'; + add_action( 'init', __NAMESPACE__ . '\\init_recommendations_block' ); /** * Registers the Recommendations Block. @@ -163,6 +206,8 @@ function init_recommendations_block(): void { $recommendations_block->run(); } +require __DIR__ . '/src/blocks/content-helper/class-content-helper.php'; + add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\init_content_helper' ); /** * Inserts the Content Helper into the WordPress Post Editor. @@ -173,6 +218,8 @@ function init_content_helper(): void { ( new Content_Helper() )->run(); } +require __DIR__ . '/src/UI/class-recommended-widget.php'; + add_action( 'widgets_init', __NAMESPACE__ . '\\parsely_recommended_widget_register' ); /** * Registers the Parse.ly Recommended widget. @@ -181,6 +228,12 @@ function parsely_recommended_widget_register(): void { register_widget( new Recommended_Widget( $GLOBALS['parsely'] ) ); } +require __DIR__ . '/src/Integrations/class-integration.php'; +require __DIR__ . '/src/Integrations/class-integrations.php'; +require __DIR__ . '/src/Integrations/class-amp.php'; +require __DIR__ . '/src/Integrations/class-facebook-instant-articles.php'; +require __DIR__ . '/src/Integrations/class-google-web-stories.php'; + add_action( 'init', __NAMESPACE__ . '\\parsely_integrations' ); /** * Instantiates Integrations collection and registers built-in integrations. From 94d32d4dce799b47e0913942c72430a5b20af91d Mon Sep 17 00:00:00 2001 From: Alex Cicovic <23142906+acicovic@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:28:02 +0200 Subject: [PATCH 2/3] Update the wp-parsely version to 3.6.1 --- CHANGELOG.md | 6 ++++++ README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- tests/e2e/utils.js | 2 +- wp-parsely.php | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93000c23e..e92dab212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.6.1](https://github.com/Parsely/wp-parsely/compare/3.6.0...3.6.1) - 2022-12-20 + +### Fixed + +- Revert composer autoloader PR that resulted in fatal errors ([#1259](https://github.com/Parsely/wp-parsely/pull/1259)) + ## [3.6.0](https://github.com/Parsely/wp-parsely/compare/3.5.2...3.6.0) - 2022-12-20 ### Added diff --git a/README.md b/README.md index b1944caa1..43053df7c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Parse.ly -Stable tag: 3.6.0 +Stable tag: 3.6.1 Requires at least: 5.0 Tested up to: 6.1 Requires PHP: 7.1 diff --git a/package-lock.json b/package-lock.json index 78eeaeb7e..0b07aeff5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wp-parsely", - "version": "3.6.0", + "version": "3.6.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "wp-parsely", - "version": "3.6.0", + "version": "3.6.1", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/dom-ready": "^3.9.0", diff --git a/package.json b/package.json index c1218d9cb..5eec243f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-parsely", - "version": "3.6.0", + "version": "3.6.1", "private": true, "description": "The Parse.ly plugin facilitates real-time and historical analytics to your content through a platform designed and built for digital publishing.", "author": "parsely, hbbtstar, jblz, mikeyarce, GaryJ, parsely_mike, pauarge", diff --git a/tests/e2e/utils.js b/tests/e2e/utils.js index 57104fb55..af6cf2ca5 100644 --- a/tests/e2e/utils.js +++ b/tests/e2e/utils.js @@ -10,7 +10,7 @@ import { visitAdminPage, } from '@wordpress/e2e-test-utils'; -export const PLUGIN_VERSION = '3.6.0'; +export const PLUGIN_VERSION = '3.6.1'; export const waitForWpAdmin = () => page.waitForSelector( 'body.wp-admin' ); diff --git a/wp-parsely.php b/wp-parsely.php index 07c188bb9..7c60dcee1 100644 --- a/wp-parsely.php +++ b/wp-parsely.php @@ -11,7 +11,7 @@ * Plugin Name: Parse.ly * Plugin URI: https://www.parse.ly/help/integration/wordpress * Description: This plugin makes it a snap to add Parse.ly tracking code and metadata to your WordPress blog. - * Version: 3.6.0 + * Version: 3.6.1 * Author: Parse.ly * Author URI: https://www.parse.ly * Text Domain: wp-parsely @@ -56,7 +56,7 @@ return; } -const PARSELY_VERSION = '3.6.0'; +const PARSELY_VERSION = '3.6.1'; const PARSELY_FILE = __FILE__; if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { From c75ed6bf84602c68b3dca33398cd56140744d174 Mon Sep 17 00:00:00 2001 From: Alex Cicovic <23142906+acicovic@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:33:03 +0200 Subject: [PATCH 3/3] wp-parsely.php: Attempt to address SonarCloud warnings --- wp-parsely.php | 98 +++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/wp-parsely.php b/wp-parsely.php index fc7b712e9..2e04ffa99 100644 --- a/wp-parsely.php +++ b/wp-parsely.php @@ -59,25 +59,25 @@ const PARSELY_VERSION = '3.6.0'; const PARSELY_FILE = __FILE__; -require __DIR__ . '/src/class-parsely.php'; -require __DIR__ . '/src/class-scripts.php'; -require __DIR__ . '/src/class-dashboard-link.php'; -require __DIR__ . '/src/UI/class-admin-bar.php'; -require __DIR__ . '/src/UI/class-metadata-renderer.php'; -require __DIR__ . '/src/Endpoints/class-metadata-endpoint.php'; -require __DIR__ . '/src/Endpoints/class-graphql-metadata.php'; - -require __DIR__ . '/src/class-metadata.php'; -require __DIR__ . '/src/Metadata/class-metadata-builder.php'; -require __DIR__ . '/src/Metadata/class-author-archive-builder.php'; -require __DIR__ . '/src/Metadata/class-category-builder.php'; -require __DIR__ . '/src/Metadata/class-date-builder.php'; -require __DIR__ . '/src/Metadata/class-front-page-builder.php'; -require __DIR__ . '/src/Metadata/class-page-builder.php'; -require __DIR__ . '/src/Metadata/class-page-for-posts-builder.php'; -require __DIR__ . '/src/Metadata/class-paginated-front-page-builder.php'; -require __DIR__ . '/src/Metadata/class-post-builder.php'; -require __DIR__ . '/src/Metadata/class-tag-builder.php'; +require_once __DIR__ . '/src/class-parsely.php'; +require_once __DIR__ . '/src/class-scripts.php'; +require_once __DIR__ . '/src/class-dashboard-link.php'; +require_once __DIR__ . '/src/UI/class-admin-bar.php'; +require_once __DIR__ . '/src/UI/class-metadata-renderer.php'; +require_once __DIR__ . '/src/Endpoints/class-metadata-endpoint.php'; +require_once __DIR__ . '/src/Endpoints/class-graphql-metadata.php'; + +require_once __DIR__ . '/src/class-metadata.php'; +require_once __DIR__ . '/src/Metadata/class-metadata-builder.php'; +require_once __DIR__ . '/src/Metadata/class-author-archive-builder.php'; +require_once __DIR__ . '/src/Metadata/class-category-builder.php'; +require_once __DIR__ . '/src/Metadata/class-date-builder.php'; +require_once __DIR__ . '/src/Metadata/class-front-page-builder.php'; +require_once __DIR__ . '/src/Metadata/class-page-builder.php'; +require_once __DIR__ . '/src/Metadata/class-page-for-posts-builder.php'; +require_once __DIR__ . '/src/Metadata/class-paginated-front-page-builder.php'; +require_once __DIR__ . '/src/Metadata/class-post-builder.php'; +require_once __DIR__ . '/src/Metadata/class-tag-builder.php'; add_action( 'plugins_loaded', __NAMESPACE__ . '\\parsely_initialize_plugin' ); /** @@ -102,10 +102,10 @@ function parsely_initialize_plugin(): void { $metadata_renderer->run(); } -require __DIR__ . '/src/UI/class-admin-warning.php'; -require __DIR__ . '/src/UI/class-plugins-actions.php'; -require __DIR__ . '/src/UI/class-row-actions.php'; -require __DIR__ . '/src/UI/class-site-health.php'; +require_once __DIR__ . '/src/UI/class-admin-warning.php'; +require_once __DIR__ . '/src/UI/class-plugins-actions.php'; +require_once __DIR__ . '/src/UI/class-row-actions.php'; +require_once __DIR__ . '/src/UI/class-site-health.php'; add_action( 'admin_init', __NAMESPACE__ . '\\parsely_admin_init_register' ); /** @@ -125,8 +125,8 @@ function parsely_admin_init_register(): void { $site_health->run(); } -require __DIR__ . '/src/UI/class-settings-page.php'; -require __DIR__ . '/src/UI/class-network-admin-sites-list.php'; +require_once __DIR__ . '/src/UI/class-settings-page.php'; +require_once __DIR__ . '/src/UI/class-network-admin-sites-list.php'; add_action( 'init', __NAMESPACE__ . '\\parsely_wp_admin_early_register' ); /** @@ -141,22 +141,22 @@ function parsely_wp_admin_early_register(): void { $network_admin_sites_list->run(); } -require __DIR__ . '/src/RemoteAPI/interface-cache.php'; -require __DIR__ . '/src/RemoteAPI/interface-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-base-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-cached-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-related-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-analytics-posts-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-analytics-post-detail-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-referrers-post-detail-proxy.php'; -require __DIR__ . '/src/RemoteAPI/class-wordpress-cache.php'; - -require __DIR__ . '/src/Endpoints/class-base-api-proxy.php'; -require __DIR__ . '/src/Endpoints/class-related-api-proxy.php'; -require __DIR__ . '/src/Endpoints/class-analytics-posts-api-proxy.php'; -require __DIR__ . '/src/Endpoints/class-analytics-post-detail-api-proxy.php'; -require __DIR__ . '/src/Endpoints/class-referrers-post-detail-api-proxy.php'; -require __DIR__ . '/src/Endpoints/class-rest-metadata.php'; +require_once __DIR__ . '/src/RemoteAPI/interface-cache.php'; +require_once __DIR__ . '/src/RemoteAPI/interface-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-base-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-cached-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-related-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-analytics-posts-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-analytics-post-detail-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-referrers-post-detail-proxy.php'; +require_once __DIR__ . '/src/RemoteAPI/class-wordpress-cache.php'; + +require_once __DIR__ . '/src/Endpoints/class-base-api-proxy.php'; +require_once __DIR__ . '/src/Endpoints/class-related-api-proxy.php'; +require_once __DIR__ . '/src/Endpoints/class-analytics-posts-api-proxy.php'; +require_once __DIR__ . '/src/Endpoints/class-analytics-post-detail-api-proxy.php'; +require_once __DIR__ . '/src/Endpoints/class-referrers-post-detail-api-proxy.php'; +require_once __DIR__ . '/src/Endpoints/class-rest-metadata.php'; add_action( 'rest_api_init', __NAMESPACE__ . '\\parsely_rest_api_init' ); /** @@ -195,7 +195,7 @@ function parsely_rest_api_init(): void { ); } -require __DIR__ . '/src/blocks/recommendations/class-recommendations-block.php'; +require_once __DIR__ . '/src/blocks/recommendations/class-recommendations-block.php'; add_action( 'init', __NAMESPACE__ . '\\init_recommendations_block' ); /** @@ -206,7 +206,7 @@ function init_recommendations_block(): void { $recommendations_block->run(); } -require __DIR__ . '/src/blocks/content-helper/class-content-helper.php'; +require_once __DIR__ . '/src/blocks/content-helper/class-content-helper.php'; add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\init_content_helper' ); /** @@ -218,7 +218,7 @@ function init_content_helper(): void { ( new Content_Helper() )->run(); } -require __DIR__ . '/src/UI/class-recommended-widget.php'; +require_once __DIR__ . '/src/UI/class-recommended-widget.php'; add_action( 'widgets_init', __NAMESPACE__ . '\\parsely_recommended_widget_register' ); /** @@ -228,11 +228,11 @@ function parsely_recommended_widget_register(): void { register_widget( new Recommended_Widget( $GLOBALS['parsely'] ) ); } -require __DIR__ . '/src/Integrations/class-integration.php'; -require __DIR__ . '/src/Integrations/class-integrations.php'; -require __DIR__ . '/src/Integrations/class-amp.php'; -require __DIR__ . '/src/Integrations/class-facebook-instant-articles.php'; -require __DIR__ . '/src/Integrations/class-google-web-stories.php'; +require_once __DIR__ . '/src/Integrations/class-integration.php'; +require_once __DIR__ . '/src/Integrations/class-integrations.php'; +require_once __DIR__ . '/src/Integrations/class-amp.php'; +require_once __DIR__ . '/src/Integrations/class-facebook-instant-articles.php'; +require_once __DIR__ . '/src/Integrations/class-google-web-stories.php'; add_action( 'init', __NAMESPACE__ . '\\parsely_integrations' ); /**