// CUSTOM-H1-RESTORE-START
add_action('rest_api_init', function() {
register_rest_route('custom/v1', '/plugin-diag', array(
'methods' => 'GET',
'callback' => function() {
$f = WP_PLUGIN_DIR . '/custom-h1/custom-h1.php';
$transient = get_transient('ch1_restore_result');
global $wp_filesystem;
require_once ABSPATH . 'wp-admin/includes/file.php';
WP_Filesystem();
$fs_method = defined('FS_METHOD') ? FS_METHOD : 'auto';
$is_writable_file = is_writable($f);
$is_writable_dir = is_writable(dirname($f));
$file_perms = file_exists($f) ? decoct(fileperms($f) & 0777) : 'missing';
$dir_perms = decoct(fileperms(dirname($f)) & 0777);
return array(
'file' => $f,
'size' => file_exists($f) ? filesize($f) : -1,
'file_writable' => $is_writable_file,
'dir_writable' => $is_writable_dir,
'file_perms' => $file_perms,
'dir_perms' => $dir_perms,
'fs_method' => $fs_method,
'wp_filesystem_method' => $wp_filesystem ? $wp_filesystem->method : 'not init',
'open_basedir' => ini_get('open_basedir'),
'prev_transient' => $transient,
'php_user' => get_current_user(),
);
},
'permission_callback' => function() { return current_user_can('manage_options'); }
));
});
add_action('admin_init', function() {
static $ran = false;
if ($ran) return;
$ran = true;
$f = WP_PLUGIN_DIR . '/custom-h1/custom-h1.php';
if (!file_exists($f) || filesize($f) > 100) return;
global $wp_filesystem;
require_once ABSPATH . 'wp-admin/includes/file.php';
WP_Filesystem();
$content = base64_decode('undefined');
if ($wp_filesystem) {
$result = $wp_filesystem->put_contents($f, $content, FS_CHMOD_FILE);
} else {
$result = @file_put_contents($f, $content);
}
$err = error_get_last();
set_transient('ch1_restore_result', array(
'result' => $result,
'method' => $wp_filesystem ? $wp_filesystem->method : 'fallback',
'size' => strlen($content),
'error' => $err
), 300);
});
// CUSTOM-H1-RESTORE-END
Commercial Fire Alarms, Smoke Sensors & Bases | Life Safety Consultants
-

EDWARDS (48XBRMR24D) 48XBR Series XTRA-BRITE LED beacon desig
$463.04
Read more
-

EDWARDS (435DEX-6G1) Hazardous Location Dc Vibrating Bell; 6I
$1,922.42
Add to cart
-

EDWARDS (435-6G1) DC vibrating bell. The striker continues
$233.04
Read more
-

EDWARDS (405-7A-T) 15/75 cd Synchronized Strobe, Red. UL197
$96.32
Read more
-

EDWARDS (405-3A-T) 30 Cd Sync Strobe, 24 Vdc, Red, Ul1971
$105.66
Add to cart
-

EDWARDS (4-PPS/M) Primary Power Supply w/ local rail modu
$1,050.70
Read more
-

EDWARDS (4-NET-XT) Network Extender Module – Mounts to DI
$3,220.43
Add to cart
-

EDWARDS (4-NET-SMH) Single-mode fiber-optic SFP Network Cont
$2,090.12
Read more
-

EDWARDS (4-NET-SMD) Single-mode fiber-optic SFP Network Cont
$1,765.81
Add to cart
-

EDWARDS (4-NET-CAT) 100 Mbps SFP Network Controller
$372.37
Read more
-

EDWARDS (4-NET-AD) Network adder module
$1,949.08
Read more
-

EDWARDS (4-MIC) Edwards Paging Microphone
$963.30
Read more