From 7b8673fd9340816df9f37c468c0cf3a0274a7589 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 28 Mar 2026 12:35:40 +0100 Subject: [PATCH 1/5] Fix broken styles and scripts on extensions page Replace non-existent Indieweb::$version static property with INDIEWEB_VERSION constant to prevent PHP fatal error that blocked CSS and JS from loading. --- includes/class-plugin-installer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-plugin-installer.php b/includes/class-plugin-installer.php index 342437b..fad5924 100644 --- a/includes/class-plugin-installer.php +++ b/includes/class-plugin-installer.php @@ -318,7 +318,7 @@ public static function check_file_extension( $filename ) { * Enqueue admin scripts and scripts localization. */ public function enqueue_scripts() { - \wp_enqueue_script( 'plugin-installer', CNKT_INSTALLER_PATH . 'static/js/installer.js', array( 'jquery' ), Indieweb::$version, true ); + \wp_enqueue_script( 'plugin-installer', CNKT_INSTALLER_PATH . 'static/js/installer.js', array( 'jquery' ), INDIEWEB_VERSION, true ); \wp_localize_script( 'plugin-installer', 'cnkt_installer_localize', @@ -332,7 +332,7 @@ public function enqueue_scripts() { ) ); - \wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH . 'static/css/installer.css', array(), Indieweb::$version ); + \wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH . 'static/css/installer.css', array(), INDIEWEB_VERSION ); } } From 73124a87511d8e85de6278675f63d8cb69aca42c Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 28 Mar 2026 12:58:23 +0100 Subject: [PATCH 2/5] Bump version to 5.1.1 and update changelog --- indieweb.php | 4 ++-- readme.md | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/indieweb.php b/indieweb.php index b7b61f9..58e068f 100755 --- a/indieweb.php +++ b/indieweb.php @@ -5,7 +5,7 @@ * Description: Interested in connecting your WordPress site to the IndieWeb? * Author: IndieWebCamp WordPress Outreach Club * Author URI: https://indieweb.org/WordPress_Outreach_Club - * Version: 5.1.0 + * Version: 5.1.1 * License: MIT * License URI: http://opensource.org/licenses/MIT * Text Domain: indieweb @@ -15,7 +15,7 @@ namespace Indieweb; -\define( 'INDIEWEB_VERSION', '5.1.0' ); +\define( 'INDIEWEB_VERSION', '5.1.1' ); \defined( 'INDIEWEB_ADD_HCARD_SUPPORT' ) || \define( 'INDIEWEB_ADD_HCARD_SUPPORT', true ); \defined( 'INDIEWEB_ADD_RELME_SUPPORT' ) || \define( 'INDIEWEB_ADD_RELME_SUPPORT', true ); diff --git a/readme.md b/readme.md index 1430ec6..255a130 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ - Requires at least: 4.7 - Requires PHP: 7.4 - Tested up to: 7.0 -- Stable tag: 5.1.0 +- Stable tag: 5.1.1 - License: MIT - License URI: http://opensource.org/licenses/MIT @@ -80,6 +80,9 @@ One could certainly download, install, and activate some or all of these plugins Project maintained on github at [indieweb/wordpress-indieweb](https://github.com/indieweb/wordpress-indieweb). +### 5.1.1 +* Fix broken styles and scripts on extensions page caused by referencing non-existent static property + ### 5.1.0 * Tested with WordPress 7.0 * Added namespacing and PSR-4 style autoloader From 8a3ddb8a0ea58974bbf01bdfaa589f472c0f42ef Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 28 Mar 2026 13:01:55 +0100 Subject: [PATCH 3/5] Fix strrchr deprecation warning when plugin is not installed check_file_extension() received null from get_plugin_file() for uninstalled plugins, triggering a PHP 8.1+ deprecation warning. --- includes/class-plugin-installer.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-plugin-installer.php b/includes/class-plugin-installer.php index fad5924..930da07 100644 --- a/includes/class-plugin-installer.php +++ b/includes/class-plugin-installer.php @@ -306,6 +306,10 @@ public static function get_plugin_file( $plugin_slug ) { * @return bool True if PHP file, false otherwise. */ public static function check_file_extension( $filename ) { + if ( ! $filename ) { + return false; + } + if ( substr( strrchr( $filename, '.' ), 1 ) === 'php' ) { // Has .php extension. return true; From eaf27c1b50c9a22fc93cfb3b96bdbc5b85fa5fe7 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 28 Mar 2026 13:03:08 +0100 Subject: [PATCH 4/5] Move Plugin_Installer initialization to Indieweb::init() The autoloader only loaded the class file when Plugin_Installer was first referenced during page render, which was after admin_enqueue_scripts had already fired. Moving initialization into Indieweb::init() ensures the enqueue hooks are registered early enough for the CSS and JS to load. --- includes/class-indieweb.php | 4 ++++ includes/class-plugin-installer.php | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/class-indieweb.php b/includes/class-indieweb.php index 6f6bda8..403f8cf 100644 --- a/includes/class-indieweb.php +++ b/includes/class-indieweb.php @@ -62,6 +62,10 @@ public function init() { \add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ) ); \add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_style' ) ); + // Plugin installer (extensions page). + $plugin_installer = new Plugin_Installer(); + $plugin_installer->start(); + // Admin menu and settings. \add_action( 'admin_menu', array( $this, 'add_menu_item' ), 9 ); \add_action( 'admin_menu', array( General_Settings::class, 'admin_menu' ) ); diff --git a/includes/class-plugin-installer.php b/includes/class-plugin-installer.php index 930da07..e33dbed 100644 --- a/includes/class-plugin-installer.php +++ b/includes/class-plugin-installer.php @@ -339,8 +339,3 @@ public function enqueue_scripts() { \wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH . 'static/css/installer.css', array(), INDIEWEB_VERSION ); } } - - -// Initialize. -$indieweb_plugin_installer = new Plugin_Installer(); -$indieweb_plugin_installer->start(); From e0e782ef8c9bc6888944e763bf5c12d5b55184d3 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 28 Mar 2026 13:06:40 +0100 Subject: [PATCH 5/5] Adopt upstream Plugin Installer 1.0.2 enqueue approach Use a custom action (cnkt_installer_enqueue_scripts) triggered from init() instead of hooking admin_enqueue_scripts globally. This ensures assets load only on the extensions page and avoids the timing issue with the autoloader. Also removes check_file_extension() in favor of a null check, matching upstream's fix for the strrchr deprecation. --- includes/class-plugin-installer.php | 35 +++++++++-------------------- readme.md | 4 +++- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/includes/class-plugin-installer.php b/includes/class-plugin-installer.php index e33dbed..2e51910 100644 --- a/includes/class-plugin-installer.php +++ b/includes/class-plugin-installer.php @@ -5,7 +5,7 @@ * @author Darren Cooney * @link https://github.com/dcooney/wordpress-plugin-installer * @link https://connekthq.com - * @version 1.0 + * @version 1.0.2 * @package Indieweb */ @@ -20,9 +20,9 @@ class Plugin_Installer { * Start the installer. */ public function start() { - \add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue scripts and Localize. - \add_action( 'wp_ajax_cnkt_plugin_installer', array( $this, 'cnkt_plugin_installer' ) ); // Install plugin. - \add_action( 'wp_ajax_cnkt_plugin_activation', array( $this, 'cnkt_plugin_activation' ) ); // Activate plugin. + \add_action( 'cnkt_installer_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); + \add_action( 'wp_ajax_cnkt_plugin_installer', array( $this, 'cnkt_plugin_installer' ) ); + \add_action( 'wp_ajax_cnkt_plugin_activation', array( $this, 'cnkt_plugin_activation' ) ); } /** @@ -31,6 +31,8 @@ public function start() { * @param array $plugins Array of plugin data. */ public static function init( $plugins ) { + // Add the required plugin scripts. + \do_action( 'cnkt_installer_enqueue_scripts' ); ?>
@@ -63,10 +65,12 @@ public static function init( $plugins ) { ) ); - if ( ! \is_wp_error( $api ) ) { // Confirm error free. + if ( ! \is_wp_error( $api ) ) { $main_plugin_file = self::get_plugin_file( $plugin['slug'] ); // Get main plugin file. - if ( self::check_file_extension( $main_plugin_file ) ) { // Check file extension. + + // Plugin is installed. + if ( $main_plugin_file ) { if ( \is_plugin_active( $main_plugin_file ) ) { // Plugin activation, confirmed! $button_classes = 'button disabled'; @@ -299,25 +303,6 @@ public static function get_plugin_file( $plugin_slug ) { return null; } - /** - * A helper to check file extension. - * - * @param string $filename The filename of the plugin. - * @return bool True if PHP file, false otherwise. - */ - public static function check_file_extension( $filename ) { - if ( ! $filename ) { - return false; - } - - if ( substr( strrchr( $filename, '.' ), 1 ) === 'php' ) { - // Has .php extension. - return true; - } else { - return false; - } - } - /** * Enqueue admin scripts and scripts localization. */ diff --git a/readme.md b/readme.md index 255a130..9c317d1 100644 --- a/readme.md +++ b/readme.md @@ -81,7 +81,9 @@ One could certainly download, install, and activate some or all of these plugins Project maintained on github at [indieweb/wordpress-indieweb](https://github.com/indieweb/wordpress-indieweb). ### 5.1.1 -* Fix broken styles and scripts on extensions page caused by referencing non-existent static property +* Update Plugin Installer to upstream version 1.0.2 +* Fix broken styles and scripts on extensions page +* Fix PHP deprecation warning for uninstalled plugins ### 5.1.0 * Tested with WordPress 7.0