Change to WordPress format
This commit is contained in:
@@ -15,49 +15,51 @@
|
|||||||
* Feel free to remove this file if you don't intend to use the 1984/HostingSupport1984
|
* Feel free to remove this file if you don't intend to use the 1984/HostingSupport1984
|
||||||
* user interface additions.
|
* user interface additions.
|
||||||
*/
|
*/
|
||||||
class HostingSupport1984UI
|
class HostingSupport1984UI {
|
||||||
{
|
|
||||||
const VIEWS_DIR = './views/';
|
const VIEWS_DIR = './views/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a new HostingSupport1984UI object
|
* Build a new HostingSupport1984UI object
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
// Add the 1984 Support Information dashboard widget.
|
// Add the 1984 Support Information dashboard widget.
|
||||||
add_action(
|
add_action(
|
||||||
'wp_dashboard_setup',
|
'wp_dashboard_setup',
|
||||||
array($this,
|
array(
|
||||||
'add_dashboard_widget')
|
$this,
|
||||||
|
'add_dashboard_widget',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Enqueue the admin JS and CSS.
|
// Enqueue the admin JS and CSS.
|
||||||
add_action(
|
add_action(
|
||||||
'admin_enqueue_scripts',
|
'admin_enqueue_scripts',
|
||||||
array($this,
|
array(
|
||||||
'enqueue_admin_scripts')
|
$this,
|
||||||
|
'enqueue_admin_scripts',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 1984 Hosting dashboard widget.
|
* Add the 1984 Hosting dashboard widget.
|
||||||
*/
|
*/
|
||||||
public function add_dashboard_widget()
|
public function add_dashboard_widget() {
|
||||||
{
|
|
||||||
wp_add_dashboard_widget(
|
wp_add_dashboard_widget(
|
||||||
'1984_hosting_support_widget',
|
'1984_hosting_support_widget',
|
||||||
__('1984 Hosting Support', 'hostingsupport1984'),
|
__( '1984 Hosting Support', 'hostingsupport1984' ),
|
||||||
array($this,
|
array(
|
||||||
'render_dashboard_widget')
|
$this,
|
||||||
|
'render_dashboard_widget',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the 1984 Hosting dashboard widget.
|
* Render the 1984 Hosting dashboard widget.
|
||||||
*/
|
*/
|
||||||
public function render_dashboard_widget()
|
public function render_dashboard_widget() {
|
||||||
{
|
$this->render_view( 'support-dashboard-widget.php' );
|
||||||
$this->render_view('support-dashboard-widget.php');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,15 +70,16 @@ class HostingSupport1984UI
|
|||||||
*
|
*
|
||||||
* @return Boolean True if the user has access to the view. False if not.
|
* @return Boolean True if the user has access to the view. False if not.
|
||||||
*/
|
*/
|
||||||
public function render_view(string $view_file, bool $admin_only = true): bool
|
public function render_view( string $view_file, bool $admin_only = true ): bool {
|
||||||
{
|
|
||||||
if (
|
if (
|
||||||
true === $admin_only && current_user_can('manage_options') ||
|
true === $admin_only && current_user_can( 'manage_options' ) ||
|
||||||
false === $admin_only
|
false === $admin_only
|
||||||
) {
|
) {
|
||||||
require self::view_path($view_file);
|
require self::view_path( $view_file );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,16 +90,14 @@ class HostingSupport1984UI
|
|||||||
*
|
*
|
||||||
* @return String The path.
|
* @return String The path.
|
||||||
*/
|
*/
|
||||||
private function view_path(string $view_file): string
|
private function view_path( string $view_file ): string {
|
||||||
{
|
return plugin_dir_path( __FILE__ ) . self::VIEWS_DIR . $view_file;
|
||||||
return plugin_dir_path(__FILE__) . self::VIEWS_DIR . $view_file;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue the 1984 wp-admin scripts
|
* Enqueue the 1984 wp-admin scripts
|
||||||
*/
|
*/
|
||||||
public function enqueue_admin_scripts()
|
public function enqueue_admin_scripts() {
|
||||||
{
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'1984-hosting-support-admin',
|
'1984-hosting-support-admin',
|
||||||
plugins_url(
|
plugins_url(
|
||||||
@@ -124,9 +125,8 @@ class HostingSupport1984UI
|
|||||||
*
|
*
|
||||||
* @return bool [type] [description]
|
* @return bool [type] [description]
|
||||||
*/
|
*/
|
||||||
private function current_user_can_view_admin_panel(): bool
|
private function current_user_can_view_admin_panel(): bool {
|
||||||
{
|
return ( true === current_user_can( 'manage_options' ) );
|
||||||
return (true === current_user_can('manage_options'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,50 +21,58 @@
|
|||||||
* There are other classes that may depend on this file, so only remove it if
|
* There are other classes that may depend on this file, so only remove it if
|
||||||
* you do not intend to use the plugin.
|
* you do not intend to use the plugin.
|
||||||
*/
|
*/
|
||||||
class HostingSupport1984
|
class HostingSupport1984 {
|
||||||
{
|
|
||||||
const HOSTING_SUPPORT_VERSION = '0.4.0';
|
const HOSTING_SUPPORT_VERSION = '0.4.0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new HostingSupport1984 object
|
* Construct a new HostingSupport1984 object
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct() {
|
||||||
{
|
|
||||||
// Loading the text domain for a mu-plugin is tricky.
|
// Loading the text domain for a mu-plugin is tricky.
|
||||||
// We need to use admin_init instead of plugins_loaded as we are only
|
// We need to use admin_init instead of plugins_loaded as we are only
|
||||||
// using the plugin in the admin interface.
|
// using the plugin in the admin interface.
|
||||||
add_action(
|
add_action(
|
||||||
'admin_init',
|
'admin_init',
|
||||||
array($this,
|
array(
|
||||||
'load_textdomain')
|
$this,
|
||||||
|
'load_textdomain',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Register the activation hook.
|
// Register the activation hook.
|
||||||
register_activation_hook(
|
register_activation_hook(
|
||||||
__FILE__,
|
__FILE__,
|
||||||
array($this,
|
array(
|
||||||
'activation_hook')
|
$this,
|
||||||
|
'activation_hook',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Run on activation of any plugin.
|
// Run on activation of any plugin.
|
||||||
add_action(
|
add_action(
|
||||||
'activated_plugin',
|
'activated_plugin',
|
||||||
array($this,
|
array(
|
||||||
'plugin_activation_hook')
|
$this,
|
||||||
|
'plugin_activation_hook',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Run on activation of theme.
|
// Run on activation of theme.
|
||||||
add_action(
|
add_action(
|
||||||
'switch_theme',
|
'switch_theme',
|
||||||
array($this,
|
array(
|
||||||
'theme_switch_hook')
|
$this,
|
||||||
|
'theme_switch_hook',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add a clear warning on the Patchstack plugin row to discourage removal.
|
// Add a clear warning on the Patchstack plugin row to discourage removal.
|
||||||
add_filter(
|
add_filter(
|
||||||
'plugin_row_meta',
|
'plugin_row_meta',
|
||||||
array($this,
|
array(
|
||||||
'add_patchstack_warning_row_meta'),
|
$this,
|
||||||
|
'add_patchstack_warning_row_meta',
|
||||||
|
),
|
||||||
10,
|
10,
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
@@ -72,26 +80,36 @@ class HostingSupport1984
|
|||||||
// Prevent deactivation/deletion of this plugin and Patchstack via UI links.
|
// Prevent deactivation/deletion of this plugin and Patchstack via UI links.
|
||||||
add_filter(
|
add_filter(
|
||||||
'plugin_action_links',
|
'plugin_action_links',
|
||||||
array($this,
|
array(
|
||||||
'filter_plugin_action_links'),
|
$this,
|
||||||
|
'filter_plugin_action_links',
|
||||||
|
),
|
||||||
10,
|
10,
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
add_filter(
|
add_filter(
|
||||||
'network_admin_plugin_action_links',
|
'network_admin_plugin_action_links',
|
||||||
array($this,
|
array(
|
||||||
'filter_plugin_action_links'),
|
$this,
|
||||||
|
'filter_plugin_action_links',
|
||||||
|
),
|
||||||
10,
|
10,
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
|
|
||||||
// Guard against direct requests (single and bulk) on Plugins screens and updater endpoints.
|
// Guard against direct requests (single and bulk) on Plugins screens and updater endpoints.
|
||||||
add_action('load-plugins.php', array($this,
|
add_action( 'load-plugins.php', array(
|
||||||
'protect_plugins_admin_actions'));
|
$this,
|
||||||
add_action('load-plugins-network.php', array($this,
|
'protect_plugins_admin_actions',
|
||||||
'protect_plugins_admin_actions'));
|
) );
|
||||||
add_action('load-update.php', array($this,
|
add_action( 'load-plugins-network.php', array(
|
||||||
'protect_plugins_admin_actions'));
|
$this,
|
||||||
|
'protect_plugins_admin_actions',
|
||||||
|
) );
|
||||||
|
add_action( 'load-update.php', array(
|
||||||
|
$this,
|
||||||
|
'protect_plugins_admin_actions',
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,8 +117,7 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public function load_textdomain(): bool
|
public function load_textdomain(): bool {
|
||||||
{
|
|
||||||
return load_plugin_textdomain(
|
return load_plugin_textdomain(
|
||||||
'hostingsupport1984',
|
'hostingsupport1984',
|
||||||
false,
|
false,
|
||||||
@@ -114,24 +131,23 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* This is skipped if Patchstack is active on the site.
|
* This is skipped if Patchstack is active on the site.
|
||||||
*/
|
*/
|
||||||
public function activation_hook()
|
public function activation_hook() {
|
||||||
{
|
if ( $this->is_patchstack_active() ) {
|
||||||
if ($this->is_patchstack_active()) {
|
|
||||||
// In case Patchstack is active, do not continue.
|
// In case Patchstack is active, do not continue.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-update WordPress core.
|
// Auto-update WordPress core.
|
||||||
update_site_option('auto_update_core_major', 'enabled');
|
update_site_option( 'auto_update_core_major', 'enabled' );
|
||||||
|
|
||||||
// Auto-update plugins.
|
// Auto-update plugins.
|
||||||
$all_plugins = apply_filters('all_plugins', get_plugins());
|
$all_plugins = apply_filters( 'all_plugins', get_plugins() );
|
||||||
|
|
||||||
update_site_option('auto_update_plugins', array_keys($all_plugins));
|
update_site_option( 'auto_update_plugins', array_keys( $all_plugins ) );
|
||||||
|
|
||||||
// Auto-update themes.
|
// Auto-update themes.
|
||||||
$all_themes = wp_get_themes();
|
$all_themes = wp_get_themes();
|
||||||
update_site_option('auto_update_themes', array_keys($all_themes));
|
update_site_option( 'auto_update_themes', array_keys( $all_themes ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,9 +155,8 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public function is_patchstack_active()
|
public function is_patchstack_active() {
|
||||||
{
|
return is_plugin_active( 'patchstack/patchstack.php' );
|
||||||
return is_plugin_active('patchstack/patchstack.php');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,17 +164,16 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* This is skipped if Patchstack is active on the site.
|
* This is skipped if Patchstack is active on the site.
|
||||||
*/
|
*/
|
||||||
public function plugin_activation_hook($plugin)
|
public function plugin_activation_hook( $plugin ) {
|
||||||
{
|
if ( $this->is_patchstack_active() ) {
|
||||||
if ($this->is_patchstack_active()) {
|
|
||||||
// In case Patchstack is active, do not continue.
|
// In case Patchstack is active, do not continue.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$auto_updated_plugins = (array)get_site_option('auto_update_plugins', array());
|
$auto_updated_plugins = (array) get_site_option( 'auto_update_plugins', array() );
|
||||||
$auto_updated_plugins[] = $plugin;
|
$auto_updated_plugins[] = $plugin;
|
||||||
|
|
||||||
update_site_option('auto_update_plugins', array_unique($auto_updated_plugins));
|
update_site_option( 'auto_update_plugins', array_unique( $auto_updated_plugins ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,15 +181,14 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* This is skipped if Patchstack is active on the site.
|
* This is skipped if Patchstack is active on the site.
|
||||||
*/
|
*/
|
||||||
public function theme_switch_hook($theme)
|
public function theme_switch_hook( $theme ) {
|
||||||
{
|
if ( $this->is_patchstack_active() ) {
|
||||||
if ($this->is_patchstack_active()) {
|
|
||||||
// In case Patchstack is active, do not continue.
|
// In case Patchstack is active, do not continue.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$all_themes = wp_get_themes();
|
$all_themes = wp_get_themes();
|
||||||
update_site_option('auto_update_themes', array_keys($all_themes));
|
update_site_option( 'auto_update_themes', array_keys( $all_themes ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,21 +199,20 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* @return array Modified row meta-links.
|
* @return array Modified row meta-links.
|
||||||
*/
|
*/
|
||||||
public function add_patchstack_warning_row_meta(array $links, string $file): array
|
public function add_patchstack_warning_row_meta( array $links, string $file ): array {
|
||||||
{
|
|
||||||
// Only show the warning on the Patchstack row AND only if Patchstack is active.
|
// Only show the warning on the Patchstack row AND only if Patchstack is active.
|
||||||
if ('patchstack/patchstack.php' !== $file || !$this->is_patchstack_active()) {
|
if ( 'patchstack/patchstack.php' !== $file || ! $this->is_patchstack_active() ) {
|
||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
$warning_text =
|
$warning_text =
|
||||||
__('1984 Hosting: Please do not deactivate or delete this plugin - part of your WordPress Service Pack.', 'hostingsupport1984');
|
__( '1984 Hosting: Please do not deactivate or delete this plugin - part of your WordPress Service Pack.', 'hostingsupport1984' );
|
||||||
|
|
||||||
$logo_1984_url = plugins_url('icons/1984-hosting-logo.webp', __FILE__);
|
$logo_1984_url = plugins_url( 'icons/1984-hosting-logo.webp', __FILE__ );
|
||||||
$logo_patchstack = plugins_url('icons/patchstack-logo.svg', __FILE__);
|
$logo_patchstack = plugins_url( 'icons/patchstack-logo.svg', __FILE__ );
|
||||||
|
|
||||||
$title_1984 = __('Visit 1984 Hosting Homepage', 'hostingsupport1984');
|
$title_1984 = __( 'Visit 1984 Hosting Homepage', 'hostingsupport1984' );
|
||||||
$title_patchstack = __('Visit Patchstack Homepage', 'hostingsupport1984');
|
$title_patchstack = __( 'Visit Patchstack Homepage', 'hostingsupport1984' );
|
||||||
|
|
||||||
$container_open =
|
$container_open =
|
||||||
'<span class="description" style="color:#b32d2e;font-weight:700;display:inline-grid;grid-template-columns:auto 1fr;column-gap:6px;row-gap:4px;align-items:center;line-height:1.5;vertical-align:middle;">';
|
'<span class="description" style="color:#b32d2e;font-weight:700;display:inline-grid;grid-template-columns:auto 1fr;column-gap:6px;row-gap:4px;align-items:center;line-height:1.5;vertical-align:middle;">';
|
||||||
@@ -208,21 +220,21 @@ class HostingSupport1984
|
|||||||
$warning_icon =
|
$warning_icon =
|
||||||
'<span class="dashicons dashicons-warning" aria-hidden="true" style="color:#b32d2e;grid-column:1;"></span>';
|
'<span class="dashicons dashicons-warning" aria-hidden="true" style="color:#b32d2e;grid-column:1;"></span>';
|
||||||
|
|
||||||
$text_html = '<span style="grid-column:2;">' . esc_html($warning_text) . '</span>';
|
$text_html = '<span style="grid-column:2;">' . esc_html( $warning_text ) . '</span>';
|
||||||
|
|
||||||
|
|
||||||
$logos_html =
|
$logos_html =
|
||||||
'<span style="grid-column:2;display:inline-flex;align-items:center;gap:4px;">'
|
'<span style="grid-column:2;display:inline-flex;align-items:center;gap:4px;">'
|
||||||
.
|
.
|
||||||
'<a href="https://1984.hosting" target="_blank" rel="noopener noreferrer" title="' . esc_attr($title_1984) . '" aria-label="' . esc_attr($title_1984) . '">'
|
'<a href="https://1984.hosting" target="_blank" rel="noopener noreferrer" title="' . esc_attr( $title_1984 ) . '" aria-label="' . esc_attr( $title_1984 ) . '">'
|
||||||
.
|
.
|
||||||
'<img src="' . esc_url($logo_1984_url) . '" alt="1984 Hosting" style="height:16px;width:auto;display:inline-block;" />'
|
'<img src="' . esc_url( $logo_1984_url ) . '" alt="1984 Hosting" style="height:16px;width:auto;display:inline-block;" />'
|
||||||
.
|
.
|
||||||
'</a>'
|
'</a>'
|
||||||
.
|
.
|
||||||
'<a href="https://patchstack.com" target="_blank" rel="noopener noreferrer" title="' . esc_attr($title_patchstack) . '" aria-label="' . esc_attr($title_patchstack) . '">'
|
'<a href="https://patchstack.com" target="_blank" rel="noopener noreferrer" title="' . esc_attr( $title_patchstack ) . '" aria-label="' . esc_attr( $title_patchstack ) . '">'
|
||||||
.
|
.
|
||||||
'<img src="' . esc_url($logo_patchstack) . '" alt="Patchstack" style="height:16px;width:auto;display:inline-block;" />'
|
'<img src="' . esc_url( $logo_patchstack ) . '" alt="Patchstack" style="height:16px;width:auto;display:inline-block;" />'
|
||||||
.
|
.
|
||||||
'</a>'
|
'</a>'
|
||||||
.
|
.
|
||||||
@@ -243,12 +255,13 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function filter_plugin_action_links(array $actions, string $plugin_file, array $plugin_data,
|
public function filter_plugin_action_links(
|
||||||
string $context): array
|
array $actions, string $plugin_file, array $plugin_data,
|
||||||
{
|
string $context
|
||||||
if ($this->is_protected_plugin($plugin_file)) {
|
): array {
|
||||||
unset($actions['deactivate']);
|
if ( $this->is_protected_plugin( $plugin_file ) ) {
|
||||||
unset($actions['delete']);
|
unset( $actions['deactivate'] );
|
||||||
|
unset( $actions['delete'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
@@ -261,9 +274,8 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function is_protected_plugin(string $plugin_file): bool
|
private function is_protected_plugin( string $plugin_file ): bool {
|
||||||
{
|
return in_array( $plugin_file, $this->get_protected_plugins(), true );
|
||||||
return in_array($plugin_file, $this->get_protected_plugins(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,9 +283,9 @@ class HostingSupport1984
|
|||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function get_protected_plugins(): array
|
private function get_protected_plugins(): array {
|
||||||
{
|
$own = plugin_basename( __FILE__ );
|
||||||
$own = plugin_basename(__FILE__);
|
|
||||||
return array(
|
return array(
|
||||||
$own,
|
$own,
|
||||||
'patchstack/patchstack.php',
|
'patchstack/patchstack.php',
|
||||||
@@ -283,23 +295,22 @@ class HostingSupport1984
|
|||||||
/**
|
/**
|
||||||
* Intercept admin actions attempting to deactivate or delete protected plugins and block them.
|
* Intercept admin actions attempting to deactivate or delete protected plugins and block them.
|
||||||
*/
|
*/
|
||||||
public function protect_plugins_admin_actions()
|
public function protect_plugins_admin_actions() {
|
||||||
{
|
|
||||||
// Collect requested action(s).
|
// Collect requested action(s).
|
||||||
$action = isset($_REQUEST['action']) ? sanitize_key((string)$_REQUEST['action']) : '';
|
$action = isset( $_REQUEST['action'] ) ? sanitize_key( (string) $_REQUEST['action'] ) : '';
|
||||||
$action2 = isset($_REQUEST['action2']) ? sanitize_key((string)$_REQUEST['action2']) : '';
|
$action2 = isset( $_REQUEST['action2'] ) ? sanitize_key( (string) $_REQUEST['action2'] ) : '';
|
||||||
|
|
||||||
$targets = array();
|
$targets = array();
|
||||||
if (!empty($_REQUEST['plugin'])) {
|
if ( ! empty( $_REQUEST['plugin'] ) ) {
|
||||||
$targets[] = sanitize_text_field((string)$_REQUEST['plugin']);
|
$targets[] = sanitize_text_field( (string) $_REQUEST['plugin'] );
|
||||||
}
|
}
|
||||||
if (!empty($_REQUEST['checked']) && is_array($_REQUEST['checked'])) {
|
if ( ! empty( $_REQUEST['checked'] ) && is_array( $_REQUEST['checked'] ) ) {
|
||||||
foreach ($_REQUEST['checked'] as $pf) {
|
foreach ( $_REQUEST['checked'] as $pf ) {
|
||||||
$targets[] = sanitize_text_field((string)$pf);
|
$targets[] = sanitize_text_field( (string) $pf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($targets)) {
|
if ( empty( $targets ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,15 +322,15 @@ class HostingSupport1984
|
|||||||
'delete-plugin',
|
'delete-plugin',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!in_array($action, $blocked_actions, true) && !in_array($action2, $blocked_actions, true)) {
|
if ( ! in_array( $action, $blocked_actions, true ) && ! in_array( $action2, $blocked_actions, true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$protected = $this->get_protected_plugins();
|
$protected = $this->get_protected_plugins();
|
||||||
$intersect = array_intersect($targets, $protected);
|
$intersect = array_intersect( $targets, $protected );
|
||||||
if (!empty($intersect)) {
|
if ( ! empty( $intersect ) ) {
|
||||||
wp_die(
|
wp_die(
|
||||||
__('For security, this action is blocked: 1984 Hosting Support and Patchstack cannot be deactivated or deleted while this policy is active.', 'hostingsupport1984'),
|
__( 'For security, this action is blocked: 1984 Hosting Support and Patchstack cannot be deactivated or deleted while this policy is active.', 'hostingsupport1984' ),
|
||||||
403
|
403
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<a href="https://management.1984.hosting/accounts/settings/" target="_blank">
|
<a href="https://management.1984.hosting/accounts/settings/" target="_blank">
|
||||||
<div>
|
<div>
|
||||||
<img class="hosting-support-1984-icon"
|
<img class="hosting-support-1984-icon"
|
||||||
src="<?php echo plugins_url('icons/profile.svg', A1984_HOSTING_SUPPORT_BASE_FILE); ?>">
|
src="<?php echo plugins_url( 'icons/profile.svg', A1984_HOSTING_SUPPORT_BASE_FILE ); ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="hosting-support-1984-text">
|
<div class="hosting-support-1984-text">
|
||||||
<?php esc_html_e(
|
<?php esc_html_e(
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<li class="hosting-support-1984-li">
|
<li class="hosting-support-1984-li">
|
||||||
<a href="https://management.1984.hosting/dashboard/" target="_blank">
|
<a href="https://management.1984.hosting/dashboard/" target="_blank">
|
||||||
<div><img class="hosting-support-1984-icon"
|
<div><img class="hosting-support-1984-icon"
|
||||||
src="<?php echo plugins_url('icons/sites.svg', A1984_HOSTING_SUPPORT_BASE_FILE); ?>"></div>
|
src="<?php echo plugins_url( 'icons/sites.svg', A1984_HOSTING_SUPPORT_BASE_FILE ); ?>"></div>
|
||||||
<div class="hosting-support-1984-text">
|
<div class="hosting-support-1984-text">
|
||||||
<?php esc_html_e(
|
<?php esc_html_e(
|
||||||
'My Sites, Domains & VPSs',
|
'My Sites, Domains & VPSs',
|
||||||
@@ -39,10 +39,10 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="hosting-support-1984-li">
|
<li class="hosting-support-1984-li">
|
||||||
<a href="<?php echo get_bloginfo('language') == 'is' ? 'https://kb.1984.is/doku.php?id=start' : 'https://kb.1984hosting.com/doku.php?id=start'; ?>"
|
<a href="<?php echo get_bloginfo( 'language' ) == 'is' ? 'https://kb.1984.is/doku.php?id=start' : 'https://kb.1984hosting.com/doku.php?id=start'; ?>"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
<div><img class="hosting-support-1984-icon"
|
<div><img class="hosting-support-1984-icon"
|
||||||
src="<?php echo plugins_url('icons/knowledge-base.svg', A1984_HOSTING_SUPPORT_BASE_FILE); ?>">
|
src="<?php echo plugins_url( 'icons/knowledge-base.svg', A1984_HOSTING_SUPPORT_BASE_FILE ); ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="hosting-support-1984-text">
|
<div class="hosting-support-1984-text">
|
||||||
<?php esc_html_e(
|
<?php esc_html_e(
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<li class="hosting-support-1984-li">
|
<li class="hosting-support-1984-li">
|
||||||
<a href="mailto:1984@1984.is" target="_blank">
|
<a href="mailto:1984@1984.is" target="_blank">
|
||||||
<div><img class="hosting-support-1984-icon"
|
<div><img class="hosting-support-1984-icon"
|
||||||
src="<?php echo plugins_url('icons/contact-support.svg', A1984_HOSTING_SUPPORT_BASE_FILE); ?>">
|
src="<?php echo plugins_url( 'icons/contact-support.svg', A1984_HOSTING_SUPPORT_BASE_FILE ); ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="hosting-support-1984-text">
|
<div class="hosting-support-1984-text">
|
||||||
<?php esc_html_e(
|
<?php esc_html_e(
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div id="hosting-support-1984-logo">
|
<div id="hosting-support-1984-logo">
|
||||||
<a href="<?php echo get_bloginfo('language') == 'is' ? 'https://1984.is' : 'https://1984.hosting'; ?>"
|
<a href="<?php echo get_bloginfo( 'language' ) == 'is' ? 'https://1984.is' : 'https://1984.hosting'; ?>"
|
||||||
target="_blank"><img
|
target="_blank"><img
|
||||||
src="<?php echo plugins_url('icons/1984-hosting-logo.webp', A1984_HOSTING_SUPPORT_BASE_FILE); ?>"></a>
|
src="<?php echo plugins_url( 'icons/1984-hosting-logo.webp', A1984_HOSTING_SUPPORT_BASE_FILE ); ?>"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user