OP#499 - Explain PS Plugin to customer in WP Admin #2
@@ -273,12 +273,16 @@ class HostingSupport1984 {
|
|||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function get_protected_plugins(): array {
|
private function get_protected_plugins(): array {
|
||||||
|
// Always protect this plugin from deactivation/deletion.
|
||||||
$own = plugin_basename( __FILE__ );
|
$own = plugin_basename( __FILE__ );
|
||||||
|
$protected = array( $own );
|
||||||
|
|
||||||
return array(
|
// Additionally protect Patchstack - but only while it is active.
|
||||||
$own,
|
if ( $this->is_patchstack_active() ) {
|
||||||
'patchstack/patchstack.php',
|
$protected[] = 'patchstack/patchstack.php';
|
||||||
|
saevar marked this conversation as resolved
Outdated
|
|||||||
);
|
}
|
||||||
|
|
||||||
|
return $protected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,7 +323,7 @@ class HostingSupport1984 {
|
|||||||
$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 cannot be deactivated or deleted. Patchstack cannot be deactivated or deleted while it is active.', 'hostingsupport1984' ),
|
||||||
403
|
403
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -328,6 +332,6 @@ class HostingSupport1984 {
|
|||||||
|
|
||||||
$hosting_support_1984 = new HostingSupport1984();
|
$hosting_support_1984 = new HostingSupport1984();
|
||||||
|
|
||||||
const A1984_HOSTING_SUPPORT_BASE_FILE = __FILE__;
|
define( 'A1984_HOSTING_SUPPORT_BASE_FILE', __FILE__ );
|
||||||
|
|
||||||
require_once __DIR__ . '/1984-hosting-support-ui.php';
|
require_once __DIR__ . '/1984-hosting-support-ui.php';
|
||||||
|
|||||||
@@ -11,12 +11,7 @@ function HostingSupport1984CopyEmailAddress(e) {
|
|||||||
.catch(err => console.error("Clipboard write failed:", err));
|
.catch(err => console.error("Clipboard write failed:", err));
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector('#hosting-support-1984-link')
|
const hostingSupport1984Link = document.querySelector('#hosting-support-1984-link');
|
||||||
?.addEventListener('click', HostingSupport1984CopyEmailAddress);
|
if (hostingSupport1984Link) {
|
||||||
|
saevar marked this conversation as resolved
Outdated
gdh
commented
Er þetta nauðsynlegt þegar kóðinn fyrir neðan er til staðar (lína 17-21)? Virðist gera það sama. Er þetta nauðsynlegt þegar kóðinn fyrir neðan er til staðar (lína 17-21)? Virðist gera það sama.
|
|||||||
|
hostingSupport1984Link.addEventListener('click', HostingSupport1984CopyEmailAddress);
|
||||||
if (document.querySelector('#hosting-support-1984-link')) {
|
|
||||||
document.querySelector('#hosting-support-1984-link').addEventListener(
|
|
||||||
'click',
|
|
||||||
HostingSupport1984CopyEmailAddress
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user
Indent using spaces for some reason - should be tabs.