Merged in feature/from-pantheon (pull request #16)

code from pantheon

* code from pantheon
This commit is contained in:
Tony Volpe
2024-01-10 17:03:02 +00:00
parent 054b4fffc9
commit 4eb982d7a8
16492 changed files with 3475854 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* Admin 2020 Lite compatibility plugin.
*
* @since 2.8.0
*/
class Admin2020 extends PluginAbstract {
/**
* Get plugin name.
*
* @since 2.8.0
*
* @return string
*/
public static function get_name() {
return 'Admin 2020';
}
/**
* Get plugin path.
*
* @since 2.8.0
*
* @return string
*/
public static function get_path() {
return 'admin-2020/admin-2020.php';
}
/**
* Execute on init action in admin area.
*
* @since 2.8.0
*/
public function load_admin() {
add_action( 'wp_mail_smtp_admin_setup_wizard_load_setup_wizard_before', [ $this, 'disable_admin_bar' ] );
}
/**
* Disable admin bar on Setup Wizard page.
*
* @since 2.8.0
*/
public function disable_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
use WPMailSMTP\WP;
/**
* Compatibility plugin.
*
* @since 2.8.0
*/
abstract class PluginAbstract implements PluginInterface {
/**
* Class constructor.
*
* @since 2.8.0
*/
public function __construct() {
add_action( 'init', [ $this, 'load' ], 0 );
if ( WP::in_wp_admin() ) {
add_action( 'init', [ $this, 'load_admin' ], 0 );
}
$this->after_plugins_loaded();
}
/**
* Is plugin can be loaded.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_applicable() {
return static::is_activated();
}
/**
* Is plugin activated.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_activated() {
return WP::is_plugin_activated( static::get_path() );
}
/**
* Execute after plugins loaded.
*
* @since 2.8.0
*/
public function after_plugins_loaded() {
}
/**
* Execute on init action in admin area.
*
* @since 2.8.0
*/
public function load_admin() {
}
/**
* Execute on init action.
*
* @since 2.8.0
*/
public function load() {
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* Compatibility plugin interface.
*
* @since 2.8.0
*/
interface PluginInterface {
/**
* Is plugin can be loaded.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_applicable();
/**
* Is plugin activated.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_activated();
/**
* Execute after plugins loaded.
*
* @since 2.8.0
*/
public function after_plugins_loaded();
/**
* Execute on init action in admin area.
*
* @since 2.8.0
*/
public function load_admin();
/**
* Execute on init action.
*
* @since 2.8.0
*/
public function load();
/**
* Get plugin name.
*
* @since 2.8.0
*
* @return string
*/
public static function get_name();
/**
* Get plugin path.
*
* @since 2.8.0
*
* @return string
*/
public static function get_path();
}