Plugin Directory

Changeset 3457283


Ignore:
Timestamp:
02/09/2026 04:51:55 PM (7 weeks ago)
Author:
graphicscove
Message:

Added License in plugin header
Duplicate line removed
Switched hook from wp_head to wp_enqueue_scripts
Exit files if accessed directly
Fixed extraneous plugin assets file

Location:
wp-killswitch
Files:
14 added
7 edited

Legend:

Unmodified
Added
Removed
  • wp-killswitch/trunk/api/callbacks/remote.php

    r2542245 r3457283  
    11<?php
    22function wpkillswitch_remote(WP_REST_Request $request) {
    3     if (!$request['api_key']) {
    4         return new WP_Error( "no_key", "API Key is missing!", array("status" => 400) );
     3    $api_key = $request->get_param( 'api_key' );
     4    $state   = $request->get_param( 'state' );
     5
     6    if ( ! $api_key ) {
     7        return new WP_Error( "no_key", "API Key is missing!", array( "status" => 400 ) );
    58    }
    6     if (!$request['state']) {
    7         return new WP_Error( "no_state", "State variable is missing!", array("status" => 400) );
     9    if ( ! $state ) {
     10        return new WP_Error( "no_state", "State variable is missing!", array( "status" => 400 ) );
    811    }
    9     if ($request['api_key'] !== WP_KILLSWITCH_API_KEY) {
    10         return new WP_Error( "invalid_key", "API Key is invalid!", array("status" => 400) );
     12    if ( $api_key !== WP_KILLSWITCH_API_KEY ) {
     13        return new WP_Error( "invalid_key", "API Key is invalid!", array( "status" => 400 ) );
    1114    }
    12     $response = [];
     15    $response = array();
    1316
    14     if ($request['state']) {
     17    if ( $state ) {
    1518        $current_state = get_option( 'wpkillswitch_state' );
    16         if ($current_state) {
    17             update_option( 'wpkillswitch_state', $request['state'] );
     19        if ( $current_state ) {
     20            update_option( 'wpkillswitch_state', $state );
    1821        } else {
    19             add_option( 'wpkillswitch_state', $request['state'] );
     22            add_option( 'wpkillswitch_state', $state );
    2023        }
    2124        $new_state = get_option( 'wpkillswitch_state' );
    2225        $response['update'] = 'State updated successfully';
    23         $response['state'] = 'wpkillswitch is now ' . $new_state;
     26        $response['state']  = 'wpkillswitch is now ' . $new_state;
    2427    }
    2528
    26     return new WP_REST_Response($response, 200);
     29    return new WP_REST_Response( $response, 200 );
    2730}
  • wp-killswitch/trunk/inc/admin-notice.php

    r2542245 r3457283  
    55    if ($current_state === 'on') {
    66        ?>
    7         <div class="error">
     7        <div class="notice notice-error">
    88            <?php echo '<p>Warning: Your website is currently inaccessible, please contact your webmaster as soon as possible.</p> '; ?>
    99        </div>
  • wp-killswitch/trunk/inc/frontend.php

    r2542245 r3457283  
    11<?php
    22/* Hides all content on the frontend when activated */
    3 add_action( 'wp_head', 'wp_killswitch_frontend' );
     3add_action( 'wp_enqueue_scripts', 'wp_killswitch_frontend' );
    44
    5 function wp_killswitch_frontend()
    6 {
     5function wp_killswitch_frontend() {
    76    $current_state = get_option( 'wpkillswitch_state' );
    8     if ($current_state == 'on') {
    9         $output="<style>body { background-color: #fff !important; } body * { display: none !important; }</style>";
    10         echo $output;
     7    if ( $current_state !== 'on' ) {
     8        return;
    119    }
     10    $handle = 'wp-killswitch-frontend';
     11    wp_register_style( $handle, false );
     12    wp_enqueue_style( $handle );
     13    wp_add_inline_style( $handle, 'body { background-color: #fff !important; } body * { display: none !important; }' );
    1214}
  • wp-killswitch/trunk/inc/hide-plugin.php

    r2542245 r3457283  
    22function wp_killswitch_hide_plugin() {
    33    global $wp_list_table;
    4     $hidearr = array('wp-killswitch/wp-killswitch.php');
     4    if ( ! isset( $wp_list_table->items ) || ! is_array( $wp_list_table->items ) ) {
     5        return;
     6    }
     7    $hidearr  = array( 'wp-killswitch/wp-killswitch.php' );
    58    $myplugins = $wp_list_table->items;
    6     foreach ($myplugins as $key => $val) {
    7         if (in_array($key,$hidearr)) {
    8             unset($wp_list_table->items[$key]);
     9    foreach ( $myplugins as $key => $val ) {
     10        if ( in_array( $key, $hidearr ) ) {
     11            unset( $wp_list_table->items[ $key ] );
    912        }
    1013    }
  • wp-killswitch/trunk/inc/local-killswitch.php

    r2542369 r3457283  
    22if (!defined( 'WP_KILLSWITCH_API_KEY' )) {
    33    /* Hides all content on the frontend when activated */
    4     add_action('wp_head','hook_killswitch');
     4    add_action( 'wp_enqueue_scripts', 'hook_killswitch' );
    55
    66    function hook_killswitch() {
    7         $output="<style>body { background-color: #fff !important; } body * { display: none !important; }</style>";
    8         echo $output;
     7        $handle = 'wp-killswitch-local';
     8        wp_register_style( $handle, false );
     9        wp_enqueue_style( $handle );
     10        wp_add_inline_style( $handle, 'body { background-color: #fff !important; } body * { display: none !important; }' );
    911    }
    1012
    1113    /* Adds an administration notice for the client to contact the webmaster */
    1214    function client_notice() { ?>
    13         <div class="error">
     15        <div class="notice notice-error">
    1416            <p>Warning: Your website is currently inaccessible, please contact your webmaster as soon as possible.</p>
    1517        </div>
  • wp-killswitch/trunk/readme.txt

    r3457245 r3457283  
    55Requires at least: 4.0
    66Tested up to: 6.9
    7 Stable tag: 0.1.2
     7Stable tag: 0.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333== Changelog ==
    3434
     35= 0.1.3 =
     36* Added License in plugin header
     37* Duplicate line removed
     38* Switched hook from wp_head to wp_enqueue_scripts
     39* Exit files if accessed directly
     40* Fixed extraneous plugin assets file
     41
    3542= 0.1.2 =
    3643* Updated compatible version number
  • wp-killswitch/trunk/wp-killswitch.php

    r2542369 r3457283  
    33Plugin URI:   https://wpkillswitch.io
    44GitHub Plugin URI: https://github.com/graphicscove/wp-killswitch
    5 GitHub Plugin URI: https://github.com/graphicscove/wp-killswitch
    65Description:  WP Killswitch lets you non-destructively white out a Wordpress website.
    7 Version:      0.1.1
     6Version:      0.1.3
    87Author:       Steven Noble
    98Author URI:   https://graphicscove.com
     9License:      GPLv2 or later
     10License URI:  https://www.gnu.org/licenses/gpl-2.0.html
    1011*/
    1112
Note: See TracChangeset for help on using the changeset viewer.