Changeset 3184742
- Timestamp:
- 11/09/2024 06:30:18 AM (16 months ago)
- Location:
- sim-site-maintenance
- Files:
-
- 2 added
- 26 edited
- 1 copied
-
tags/0.2.12 (copied) (copied from sim-site-maintenance/trunk)
-
tags/0.2.12/readme.txt (modified) (1 diff)
-
tags/0.2.12/sim-site-maintenance.php (modified) (1 diff)
-
tags/0.2.12/src/SimSiteMaintenance/Plugin.php (modified) (1 diff)
-
tags/0.2.12/vendor/autoload.php (modified) (1 diff)
-
tags/0.2.12/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/0.2.12/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/0.2.12/vendor/composer/autoload_static.php (modified) (3 diffs)
-
tags/0.2.12/vendor/composer/installed.json (modified) (2 diffs)
-
tags/0.2.12/vendor/composer/installed.php (modified) (3 diffs)
-
tags/0.2.12/vendor/devuri/plugin-interface/README.md (modified) (4 diffs)
-
tags/0.2.12/vendor/devuri/plugin-interface/composer.json (modified) (1 diff)
-
tags/0.2.12/vendor/devuri/plugin-interface/src/AbstractPlugin.php (modified) (1 diff)
-
tags/0.2.12/vendor/devuri/plugin-interface/src/PluginInterface.php (modified) (1 diff)
-
tags/0.2.12/vendor/devuri/plugin-interface/src/TraitInstalled.php (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/sim-site-maintenance.php (modified) (1 diff)
-
trunk/src/SimSiteMaintenance/Plugin.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.json (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (3 diffs)
-
trunk/vendor/devuri/plugin-interface/README.md (modified) (4 diffs)
-
trunk/vendor/devuri/plugin-interface/composer.json (modified) (1 diff)
-
trunk/vendor/devuri/plugin-interface/src/AbstractPlugin.php (modified) (1 diff)
-
trunk/vendor/devuri/plugin-interface/src/PluginInterface.php (modified) (1 diff)
-
trunk/vendor/devuri/plugin-interface/src/TraitInstalled.php (added)
Legend:
- Unmodified
- Added
- Removed
-
sim-site-maintenance/tags/0.2.12/readme.txt
r3128836 r3184742 6 6 Tested up to: 6.6 7 7 Requires PHP: 7.3 8 Stable tag: 0.2.1 18 Stable tag: 0.2.12 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
sim-site-maintenance/tags/0.2.12/sim-site-maintenance.php
r3128836 r3184742 5 5 * Plugin URI: https://urielwilson.com/ 6 6 * Description: Puts the site in maintenance mode for all non-logged-in users. 7 * Version: 0.2.1 17 * Version: 0.2.12 8 8 * Requires at least: 4.0 9 9 * Requires PHP: 7.3 -
sim-site-maintenance/tags/0.2.12/src/SimSiteMaintenance/Plugin.php
r3126660 r3184742 26 26 $is_login_register_page = \in_array( $GLOBALS['pagenow'], [ 'wp-login.php', 'wp-register.php' ], true ); 27 27 28 if ( $is_login_register_page) {28 if ( $is_login_register_page || current_user_can( 'manage_options' ) ) { 29 29 return; 30 30 } -
sim-site-maintenance/tags/0.2.12/vendor/autoload.php
r3128830 r3184742 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a3654::getLoader();25 return ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e::getLoader(); -
sim-site-maintenance/tags/0.2.12/vendor/composer/autoload_classmap.php
r3126660 r3184742 11 11 'Urisoft\\AbstractPlugin' => $vendorDir . '/devuri/plugin-interface/src/AbstractPlugin.php', 12 12 'Urisoft\\PluginInterface' => $vendorDir . '/devuri/plugin-interface/src/PluginInterface.php', 13 'Urisoft\\TraitInstalled' => $vendorDir . '/devuri/plugin-interface/src/TraitInstalled.php', 13 14 ); -
sim-site-maintenance/tags/0.2.12/vendor/composer/autoload_real.php
r3128830 r3184742 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a36545 class ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a3654', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a3654', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::getInitializer($loader)); 33 33 34 34 $loader->setClassMapAuthoritative(true); 35 35 $loader->register(true); 36 36 37 $filesToLoad = \Composer\Autoload\ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$files;37 $filesToLoad = \Composer\Autoload\ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$files; 38 38 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 39 39 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
sim-site-maintenance/tags/0.2.12/vendor/composer/autoload_static.php
r3128830 r3184742 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit d6976cbd529e0f101b1b542f1c3a36547 class ComposerStaticInit2846a37ebf10948744cdaafff9badd1e 8 8 { 9 9 public static $files = array ( … … 38 38 'Urisoft\\AbstractPlugin' => __DIR__ . '/..' . '/devuri/plugin-interface/src/AbstractPlugin.php', 39 39 'Urisoft\\PluginInterface' => __DIR__ . '/..' . '/devuri/plugin-interface/src/PluginInterface.php', 40 'Urisoft\\TraitInstalled' => __DIR__ . '/..' . '/devuri/plugin-interface/src/TraitInstalled.php', 40 41 ); 41 42 … … 43 44 { 44 45 return \Closure::bind(function () use ($loader) { 45 $loader->prefixLengthsPsr4 = ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$prefixLengthsPsr4;46 $loader->prefixDirsPsr4 = ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$prefixDirsPsr4;47 $loader->classMap = ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$classMap;46 $loader->prefixLengthsPsr4 = ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$prefixLengthsPsr4; 47 $loader->prefixDirsPsr4 = ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$prefixDirsPsr4; 48 $loader->classMap = ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$classMap; 48 49 49 50 }, null, ClassLoader::class); -
sim-site-maintenance/tags/0.2.12/vendor/composer/installed.json
r3126660 r3184742 3 3 { 4 4 "name": "devuri/plugin-interface", 5 "version": " v0.2.0",6 "version_normalized": "0.2. 0.0",5 "version": "0.2.2", 6 "version_normalized": "0.2.2.0", 7 7 "source": { 8 8 "type": "git", 9 9 "url": "https://github.com/devuri/plugin-interface.git", 10 "reference": " 2bbd4d5e6fd60af077f86dc7070683c38b162a4d"10 "reference": "ea052f329287d261445f9849811dd045c280247c" 11 11 }, 12 12 "dist": { 13 13 "type": "zip", 14 "url": "https://api.github.com/repos/devuri/plugin-interface/zipball/ 2bbd4d5e6fd60af077f86dc7070683c38b162a4d",15 "reference": " 2bbd4d5e6fd60af077f86dc7070683c38b162a4d",14 "url": "https://api.github.com/repos/devuri/plugin-interface/zipball/ea052f329287d261445f9849811dd045c280247c", 15 "reference": "ea052f329287d261445f9849811dd045c280247c", 16 16 "shasum": "" 17 17 }, … … 24 24 "phpstan/phpstan-strict-rules": "^1.3", 25 25 "phpunit/phpunit": "^9.5", 26 "szepeviktor/phpstan-wordpress": "^1.3", 26 27 "vimeo/psalm": "^4.24 || ^5.0" 27 28 }, 28 "time": "2024- 03-23T16:22:10+00:00",29 "time": "2024-10-30T13:04:52+00:00", 29 30 "type": "library", 30 31 "installation-source": "dist", -
sim-site-maintenance/tags/0.2.12/vendor/composer/installed.php
r3128836 r3184742 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 6947fc8893ad52863cb8e1ff3763922dd9415943',6 'reference' => '117f5948a51cb1391630b5eee9a4988caf724e08', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'devuri/plugin-interface' => array( 14 'pretty_version' => ' v0.2.0',15 'version' => '0.2. 0.0',16 'reference' => ' 2bbd4d5e6fd60af077f86dc7070683c38b162a4d',14 'pretty_version' => '0.2.2', 15 'version' => '0.2.2.0', 16 'reference' => 'ea052f329287d261445f9849811dd045c280247c', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../devuri/plugin-interface', … … 23 23 'pretty_version' => 'dev-main', 24 24 'version' => 'dev-main', 25 'reference' => ' 6947fc8893ad52863cb8e1ff3763922dd9415943',25 'reference' => '117f5948a51cb1391630b5eee9a4988caf724e08', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../', -
sim-site-maintenance/tags/0.2.12/vendor/devuri/plugin-interface/README.md
r3126660 r3184742 2 2 3 3 A simple PHP interface designed to provide a consistent structure for WordPress plugins. It defines a set of methods that any implementing class must adhere to, ensuring uniformity and ease of use across different plugins. 4 5 ## Table of Contents6 7 - [Installation](#installation)8 - [Usage](#usage)9 - [Implementing the Plugin Interface](#implementing-the-plugin-interface)10 - [Using the Plugin Interface](#using-the-plugin-interface)11 - [Example](#example)12 - [Benefits of the Interface](#benefits-of-the-interface)13 - [License](#license)14 4 15 5 ## Installation … … 83 73 ``` 84 74 85 > Or you can also use the base abstract Implementation, which will include s`init()` and the required properties `$plugin_dir_path` and `$plugin_dir_url`75 > Or you can also use the base abstract Implementation, which will include `init()` and the required properties `$plugin_dir_path` and `$plugin_dir_url` 86 76 ```php 87 77 <?php … … 143 133 > using `wp_plugin_dir_path()` and `plugin_dir_url()` to set the plugin path and URL provides a robust approach to plugin development. 144 134 135 136 ## TraitInstalled 137 138 The `TraitInstalled` on `AbstractPlugin` provides utility methods to check if a WordPress plugin is installed and active. It helps manage plugin dependencies efficiently. 139 140 - **Check if a plugin is installed** 141 - **Check if a plugin is active** 142 - **Retrieve all installed plugins** 143 144 ### 1. `MyPlugin::is_installed($plugin_file)` 145 146 Checks if a plugin is installed. 147 148 - **Parameter**: 149 `$plugin_file` (string) - Path to the plugin file, e.g., `'example-plugin/example-plugin.php'`. 150 151 - **Returns**: 152 `bool` - `true` if installed, `false` otherwise. 153 154 - **Example**: 155 ```php 156 if (MyPlugin::is_installed('example-plugin/example-plugin.php')) { 157 echo 'Plugin is installed.'; 158 } 159 ``` 160 161 ### 2. `MyPlugin::is_active($plugin_file)` 162 163 Checks if a plugin is active. 164 165 - **Parameter**: 166 `$plugin_file` (string) - Path to the plugin file, e.g., `'example-plugin/example-plugin.php'`. 167 168 - **Returns**: 169 `bool` - `true` if active, `false` otherwise. 170 171 - **Example**: 172 ```php 173 if (MyPlugin::is_active('example-plugin/example-plugin.php')) { 174 echo 'Plugin is active.'; 175 } 176 ``` 177 178 ### 3. `MyPlugin::get_installed_plugins()` 179 180 Retrieves all installed plugins. 181 182 - **Returns**: 183 `array` - An array of installed plugins. 184 185 - **Example**: 186 ```php 187 $installed_plugins = MyPlugin::get_installed_plugins(); 188 print_r($installed_plugins); 189 ``` 190 191 ### Example Usage 192 193 Check if a plugin is both installed and active: 194 195 ```php 196 function is_example_plugin_ready() { 197 $plugin_file = 'example-plugin/example-plugin.php'; 198 return MyPlugin::is_installed($plugin_file) && MyPlugin::is_active($plugin_file); 199 } 200 201 if (!is_example_plugin_ready()) { 202 // Show admin notice or handle plugin dependency 203 } 204 ``` 205 145 206 ## Benefits of the Interface 146 207 … … 157 218 - **Promotes Dependency Injection**: The `init()` method acts as a form of dependency injection, enabling clients to provide external dependencies (such as plugin directory path and URL) to the implementing class. This fosters decoupling and enhances flexibility and reusability. 158 219 159 160 220 ## License 161 221 -
sim-site-maintenance/tags/0.2.12/vendor/devuri/plugin-interface/composer.json
r3126660 r3184742 38 38 "phpstan/phpstan-strict-rules": "^1.3", 39 39 "phpunit/phpunit": "^9.5", 40 "szepeviktor/phpstan-wordpress": "^1.3", 40 41 "vimeo/psalm": "^4.24 || ^5.0" 41 42 }, -
sim-site-maintenance/tags/0.2.12/vendor/devuri/plugin-interface/src/AbstractPlugin.php
r3126660 r3184742 15 15 abstract class AbstractPlugin implements PluginInterface 16 16 { 17 use TraitInstalled; 18 17 19 public static $plugin_dir_path; 18 20 public static $plugin_dir_url; -
sim-site-maintenance/tags/0.2.12/vendor/devuri/plugin-interface/src/PluginInterface.php
r3126660 r3184742 39 39 * one instance of the plugin is created. 40 40 */ 41 public static function init( string $plugin_dir_path = '', string $plugin_dir_url = ''): PluginInterface;41 public static function init( string $plugin_dir_path = '', string $plugin_dir_url = ''): self; 42 42 43 43 /** -
sim-site-maintenance/trunk/readme.txt
r3128836 r3184742 6 6 Tested up to: 6.6 7 7 Requires PHP: 7.3 8 Stable tag: 0.2.1 18 Stable tag: 0.2.12 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
sim-site-maintenance/trunk/sim-site-maintenance.php
r3128836 r3184742 5 5 * Plugin URI: https://urielwilson.com/ 6 6 * Description: Puts the site in maintenance mode for all non-logged-in users. 7 * Version: 0.2.1 17 * Version: 0.2.12 8 8 * Requires at least: 4.0 9 9 * Requires PHP: 7.3 -
sim-site-maintenance/trunk/src/SimSiteMaintenance/Plugin.php
r3126660 r3184742 26 26 $is_login_register_page = \in_array( $GLOBALS['pagenow'], [ 'wp-login.php', 'wp-register.php' ], true ); 27 27 28 if ( $is_login_register_page) {28 if ( $is_login_register_page || current_user_can( 'manage_options' ) ) { 29 29 return; 30 30 } -
sim-site-maintenance/trunk/vendor/autoload.php
r3128830 r3184742 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a3654::getLoader();25 return ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e::getLoader(); -
sim-site-maintenance/trunk/vendor/composer/autoload_classmap.php
r3126660 r3184742 11 11 'Urisoft\\AbstractPlugin' => $vendorDir . '/devuri/plugin-interface/src/AbstractPlugin.php', 12 12 'Urisoft\\PluginInterface' => $vendorDir . '/devuri/plugin-interface/src/PluginInterface.php', 13 'Urisoft\\TraitInstalled' => $vendorDir . '/devuri/plugin-interface/src/TraitInstalled.php', 13 14 ); -
sim-site-maintenance/trunk/vendor/composer/autoload_real.php
r3128830 r3184742 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a36545 class ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a3654', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit d6976cbd529e0f101b1b542f1c3a3654', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit2846a37ebf10948744cdaafff9badd1e', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::getInitializer($loader)); 33 33 34 34 $loader->setClassMapAuthoritative(true); 35 35 $loader->register(true); 36 36 37 $filesToLoad = \Composer\Autoload\ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$files;37 $filesToLoad = \Composer\Autoload\ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$files; 38 38 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 39 39 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
sim-site-maintenance/trunk/vendor/composer/autoload_static.php
r3128830 r3184742 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit d6976cbd529e0f101b1b542f1c3a36547 class ComposerStaticInit2846a37ebf10948744cdaafff9badd1e 8 8 { 9 9 public static $files = array ( … … 38 38 'Urisoft\\AbstractPlugin' => __DIR__ . '/..' . '/devuri/plugin-interface/src/AbstractPlugin.php', 39 39 'Urisoft\\PluginInterface' => __DIR__ . '/..' . '/devuri/plugin-interface/src/PluginInterface.php', 40 'Urisoft\\TraitInstalled' => __DIR__ . '/..' . '/devuri/plugin-interface/src/TraitInstalled.php', 40 41 ); 41 42 … … 43 44 { 44 45 return \Closure::bind(function () use ($loader) { 45 $loader->prefixLengthsPsr4 = ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$prefixLengthsPsr4;46 $loader->prefixDirsPsr4 = ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$prefixDirsPsr4;47 $loader->classMap = ComposerStaticInit d6976cbd529e0f101b1b542f1c3a3654::$classMap;46 $loader->prefixLengthsPsr4 = ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$prefixLengthsPsr4; 47 $loader->prefixDirsPsr4 = ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$prefixDirsPsr4; 48 $loader->classMap = ComposerStaticInit2846a37ebf10948744cdaafff9badd1e::$classMap; 48 49 49 50 }, null, ClassLoader::class); -
sim-site-maintenance/trunk/vendor/composer/installed.json
r3126660 r3184742 3 3 { 4 4 "name": "devuri/plugin-interface", 5 "version": " v0.2.0",6 "version_normalized": "0.2. 0.0",5 "version": "0.2.2", 6 "version_normalized": "0.2.2.0", 7 7 "source": { 8 8 "type": "git", 9 9 "url": "https://github.com/devuri/plugin-interface.git", 10 "reference": " 2bbd4d5e6fd60af077f86dc7070683c38b162a4d"10 "reference": "ea052f329287d261445f9849811dd045c280247c" 11 11 }, 12 12 "dist": { 13 13 "type": "zip", 14 "url": "https://api.github.com/repos/devuri/plugin-interface/zipball/ 2bbd4d5e6fd60af077f86dc7070683c38b162a4d",15 "reference": " 2bbd4d5e6fd60af077f86dc7070683c38b162a4d",14 "url": "https://api.github.com/repos/devuri/plugin-interface/zipball/ea052f329287d261445f9849811dd045c280247c", 15 "reference": "ea052f329287d261445f9849811dd045c280247c", 16 16 "shasum": "" 17 17 }, … … 24 24 "phpstan/phpstan-strict-rules": "^1.3", 25 25 "phpunit/phpunit": "^9.5", 26 "szepeviktor/phpstan-wordpress": "^1.3", 26 27 "vimeo/psalm": "^4.24 || ^5.0" 27 28 }, 28 "time": "2024- 03-23T16:22:10+00:00",29 "time": "2024-10-30T13:04:52+00:00", 29 30 "type": "library", 30 31 "installation-source": "dist", -
sim-site-maintenance/trunk/vendor/composer/installed.php
r3128836 r3184742 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 6947fc8893ad52863cb8e1ff3763922dd9415943',6 'reference' => '117f5948a51cb1391630b5eee9a4988caf724e08', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'devuri/plugin-interface' => array( 14 'pretty_version' => ' v0.2.0',15 'version' => '0.2. 0.0',16 'reference' => ' 2bbd4d5e6fd60af077f86dc7070683c38b162a4d',14 'pretty_version' => '0.2.2', 15 'version' => '0.2.2.0', 16 'reference' => 'ea052f329287d261445f9849811dd045c280247c', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../devuri/plugin-interface', … … 23 23 'pretty_version' => 'dev-main', 24 24 'version' => 'dev-main', 25 'reference' => ' 6947fc8893ad52863cb8e1ff3763922dd9415943',25 'reference' => '117f5948a51cb1391630b5eee9a4988caf724e08', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../', -
sim-site-maintenance/trunk/vendor/devuri/plugin-interface/README.md
r3126660 r3184742 2 2 3 3 A simple PHP interface designed to provide a consistent structure for WordPress plugins. It defines a set of methods that any implementing class must adhere to, ensuring uniformity and ease of use across different plugins. 4 5 ## Table of Contents6 7 - [Installation](#installation)8 - [Usage](#usage)9 - [Implementing the Plugin Interface](#implementing-the-plugin-interface)10 - [Using the Plugin Interface](#using-the-plugin-interface)11 - [Example](#example)12 - [Benefits of the Interface](#benefits-of-the-interface)13 - [License](#license)14 4 15 5 ## Installation … … 83 73 ``` 84 74 85 > Or you can also use the base abstract Implementation, which will include s`init()` and the required properties `$plugin_dir_path` and `$plugin_dir_url`75 > Or you can also use the base abstract Implementation, which will include `init()` and the required properties `$plugin_dir_path` and `$plugin_dir_url` 86 76 ```php 87 77 <?php … … 143 133 > using `wp_plugin_dir_path()` and `plugin_dir_url()` to set the plugin path and URL provides a robust approach to plugin development. 144 134 135 136 ## TraitInstalled 137 138 The `TraitInstalled` on `AbstractPlugin` provides utility methods to check if a WordPress plugin is installed and active. It helps manage plugin dependencies efficiently. 139 140 - **Check if a plugin is installed** 141 - **Check if a plugin is active** 142 - **Retrieve all installed plugins** 143 144 ### 1. `MyPlugin::is_installed($plugin_file)` 145 146 Checks if a plugin is installed. 147 148 - **Parameter**: 149 `$plugin_file` (string) - Path to the plugin file, e.g., `'example-plugin/example-plugin.php'`. 150 151 - **Returns**: 152 `bool` - `true` if installed, `false` otherwise. 153 154 - **Example**: 155 ```php 156 if (MyPlugin::is_installed('example-plugin/example-plugin.php')) { 157 echo 'Plugin is installed.'; 158 } 159 ``` 160 161 ### 2. `MyPlugin::is_active($plugin_file)` 162 163 Checks if a plugin is active. 164 165 - **Parameter**: 166 `$plugin_file` (string) - Path to the plugin file, e.g., `'example-plugin/example-plugin.php'`. 167 168 - **Returns**: 169 `bool` - `true` if active, `false` otherwise. 170 171 - **Example**: 172 ```php 173 if (MyPlugin::is_active('example-plugin/example-plugin.php')) { 174 echo 'Plugin is active.'; 175 } 176 ``` 177 178 ### 3. `MyPlugin::get_installed_plugins()` 179 180 Retrieves all installed plugins. 181 182 - **Returns**: 183 `array` - An array of installed plugins. 184 185 - **Example**: 186 ```php 187 $installed_plugins = MyPlugin::get_installed_plugins(); 188 print_r($installed_plugins); 189 ``` 190 191 ### Example Usage 192 193 Check if a plugin is both installed and active: 194 195 ```php 196 function is_example_plugin_ready() { 197 $plugin_file = 'example-plugin/example-plugin.php'; 198 return MyPlugin::is_installed($plugin_file) && MyPlugin::is_active($plugin_file); 199 } 200 201 if (!is_example_plugin_ready()) { 202 // Show admin notice or handle plugin dependency 203 } 204 ``` 205 145 206 ## Benefits of the Interface 146 207 … … 157 218 - **Promotes Dependency Injection**: The `init()` method acts as a form of dependency injection, enabling clients to provide external dependencies (such as plugin directory path and URL) to the implementing class. This fosters decoupling and enhances flexibility and reusability. 158 219 159 160 220 ## License 161 221 -
sim-site-maintenance/trunk/vendor/devuri/plugin-interface/composer.json
r3126660 r3184742 38 38 "phpstan/phpstan-strict-rules": "^1.3", 39 39 "phpunit/phpunit": "^9.5", 40 "szepeviktor/phpstan-wordpress": "^1.3", 40 41 "vimeo/psalm": "^4.24 || ^5.0" 41 42 }, -
sim-site-maintenance/trunk/vendor/devuri/plugin-interface/src/AbstractPlugin.php
r3126660 r3184742 15 15 abstract class AbstractPlugin implements PluginInterface 16 16 { 17 use TraitInstalled; 18 17 19 public static $plugin_dir_path; 18 20 public static $plugin_dir_url; -
sim-site-maintenance/trunk/vendor/devuri/plugin-interface/src/PluginInterface.php
r3126660 r3184742 39 39 * one instance of the plugin is created. 40 40 */ 41 public static function init( string $plugin_dir_path = '', string $plugin_dir_url = ''): PluginInterface;41 public static function init( string $plugin_dir_path = '', string $plugin_dir_url = ''): self; 42 42 43 43 /**
Note: See TracChangeset
for help on using the changeset viewer.