Plugin Directory

Changeset 2286705


Ignore:
Timestamp:
04/19/2020 10:20:03 AM (6 years ago)
Author:
earnjam
Message:

Update to version 1.1 from GitHub

Location:
site-health-tool-manager
Files:
2 added
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • site-health-tool-manager/tags/1.1/readme.txt

    r2285205 r2286705  
    55Tested up to: 5.4
    66Requires PHP: 5.6
    7 Stable tag: 1.0.1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    27272. Disable the tests that aren't needed
    28283. Disabled tests are not run on the Site Health screen
     29
     30== Changelog ==
     31
     321.1
     33- Adds ability to disable the Dashboard widget
     34- Fixes fatal error in WP 5.4
     35
     361.0.1
     37- Fix issue for plugins that use closures for test callbacks
     38
     391.0
     40- Initial Release
  • site-health-tool-manager/tags/1.1/site-health-tool-manager.php

    r2083969 r2286705  
    44 * Plugin URI:  https://github.com/earnjam/site-health-tool-manager
    55 * Description: Control which tests appear in the the Site Health Tool
    6  * Version:     1.0.1
     6 * Version:     1.1
    77 * Author:      William Earnhardt
    88 * Author URI:  https://wearnhardt.com
     
    4848
    4949/**
     50 * Disable the dashboard widget
     51 */
     52function shtm_filter_dashboard_widget() {
     53    if ( ! get_option( 'shtm_widget_enabled', 1 ) ) {
     54        global $wp_meta_boxes;
     55        unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health'] );
     56    }
     57}
     58add_action( 'wp_dashboard_setup', 'shtm_filter_dashboard_widget' );
     59
     60
     61/**
    5062 * Output for the Site Health Tool Settings page
    5163 */
     
    6173    }
    6274
    63     include ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
     75    include_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
    6476    $tests    = WP_Site_Health::get_tests();
    6577    $disabled = get_option( 'shtm_hidden_tests', array() );
     78    $widget   = get_option( 'shtm_widget_enabled', 1 );
    6679    $enabled  = array();
    6780
    6881    // If tests have been submitted, process the form data
    69     if ( isset( $_POST['checked'] ) ) {
     82    if ( isset( $_POST['submit'] ) ) {
    7083
    7184        // Verify form nonce before saving
     
    87100            $disabled = $new_disabled;
    88101
     102            $widget = ( isset( $_POST['widget'] ) ) ? 1 : 0;
     103            update_option( 'shtm_widget_enabled', $widget );
     104
    89105            $classes = 'notice notice-success is-dismissible';
    90106            $message = __( 'Settings saved.', 'site-health-tool-manager' );
     
    100116    }
    101117    ?>
    102     <h2><?php _e( 'Tests Enabled', 'site-health-tool-manager' ); ?></h2>
    103     <p><?php _e( 'Certain tests may not be relevant to your environment. Uncheck a test to remove it from the Site Health Status screen.', 'site-health-tool-manager' ); ?></p>
    104118    <form method="POST" action="">
    105         <?php wp_nonce_field( 'shtm-disable-tests', 'shtm-disable-tests-nonce' ); ?>
     119        <h2><?php _e( 'Tests Enabled', 'site-health-tool-manager' ); ?></h2>
     120        <p><?php _e( 'Certain tests may not be relevant to your environment. Uncheck a test to remove it from the Site Health Status screen.', 'site-health-tool-manager' ); ?></p>
     121            <?php wp_nonce_field( 'shtm-disable-tests', 'shtm-disable-tests-nonce' ); ?>
     122            <ul>
     123            <?php
     124            foreach ( $tests as $type ) {
     125                $checked = false;
     126                foreach ( $type as $test => $details ) {
     127                    $checked = ( ! in_array( $test, $disabled ) );
     128                    echo '<li><input type="checkbox" ';
     129                    if ( $checked ) {
     130                        echo 'checked="checked" ';
     131                    }
     132                    echo 'name="checked[]" id="' . $test . '" value="' . $test . '" />';
     133                    echo '<label for="' . $test . '">' . $details['label'] . '</label></li>';
     134                }
     135            }
     136            ?>
     137            </ul>
     138        <h2><?php _e( 'Other Settings', 'site-health-tool-manager' ); ?></h2>
    106139        <ul>
    107         <?php
    108         foreach ( $tests as $type ) {
    109             $checked = false;
    110             foreach ( $type as $test => $details ) {
    111                 $checked = ( ! in_array( $test, $disabled ) );
    112                 echo '<li><input type="checkbox" ';
    113                 if ( $checked ) {
    114                     echo 'checked="checked" ';
    115                 }
    116                 echo 'name="checked[]" id="' . $test . '" value="' . $test . '" />';
    117                 echo '<label for="' . $test . '">' . $details['label'] . '</label></li>';
    118             }
    119         }
    120         ?>
     140            <li>
     141                <input type="checkbox" name="widget" id="widget-setting"
     142                    <?php
     143                    if ( $widget ) {
     144                        echo 'checked="checked"';
     145                    }
     146                    ?>
     147                />
     148                <label for="widget-setting"><?php _e( 'Dashboard Widget Enabled', 'site-health-tool-manager' ); ?></label>
     149            </li>
    121150        </ul>
    122         <input class="button button-primary" type="submit" value="<?php _e( 'Save Tests', 'site-health-tool-manager' ); ?>" />
     151        <p>
     152            <input class="button button-primary" type="submit" value="<?php _e( 'Save Settings', 'site-health-tool-manager' ); ?>" name="submit" />
     153        </p>
    123154    </form>
    124155</div>
  • site-health-tool-manager/trunk/readme.txt

    r2285205 r2286705  
    55Tested up to: 5.4
    66Requires PHP: 5.6
    7 Stable tag: 1.0.1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    27272. Disable the tests that aren't needed
    28283. Disabled tests are not run on the Site Health screen
     29
     30== Changelog ==
     31
     321.1
     33- Adds ability to disable the Dashboard widget
     34- Fixes fatal error in WP 5.4
     35
     361.0.1
     37- Fix issue for plugins that use closures for test callbacks
     38
     391.0
     40- Initial Release
  • site-health-tool-manager/trunk/site-health-tool-manager.php

    r2083969 r2286705  
    44 * Plugin URI:  https://github.com/earnjam/site-health-tool-manager
    55 * Description: Control which tests appear in the the Site Health Tool
    6  * Version:     1.0.1
     6 * Version:     1.1
    77 * Author:      William Earnhardt
    88 * Author URI:  https://wearnhardt.com
     
    4848
    4949/**
     50 * Disable the dashboard widget
     51 */
     52function shtm_filter_dashboard_widget() {
     53    if ( ! get_option( 'shtm_widget_enabled', 1 ) ) {
     54        global $wp_meta_boxes;
     55        unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health'] );
     56    }
     57}
     58add_action( 'wp_dashboard_setup', 'shtm_filter_dashboard_widget' );
     59
     60
     61/**
    5062 * Output for the Site Health Tool Settings page
    5163 */
     
    6173    }
    6274
    63     include ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
     75    include_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
    6476    $tests    = WP_Site_Health::get_tests();
    6577    $disabled = get_option( 'shtm_hidden_tests', array() );
     78    $widget   = get_option( 'shtm_widget_enabled', 1 );
    6679    $enabled  = array();
    6780
    6881    // If tests have been submitted, process the form data
    69     if ( isset( $_POST['checked'] ) ) {
     82    if ( isset( $_POST['submit'] ) ) {
    7083
    7184        // Verify form nonce before saving
     
    87100            $disabled = $new_disabled;
    88101
     102            $widget = ( isset( $_POST['widget'] ) ) ? 1 : 0;
     103            update_option( 'shtm_widget_enabled', $widget );
     104
    89105            $classes = 'notice notice-success is-dismissible';
    90106            $message = __( 'Settings saved.', 'site-health-tool-manager' );
     
    100116    }
    101117    ?>
    102     <h2><?php _e( 'Tests Enabled', 'site-health-tool-manager' ); ?></h2>
    103     <p><?php _e( 'Certain tests may not be relevant to your environment. Uncheck a test to remove it from the Site Health Status screen.', 'site-health-tool-manager' ); ?></p>
    104118    <form method="POST" action="">
    105         <?php wp_nonce_field( 'shtm-disable-tests', 'shtm-disable-tests-nonce' ); ?>
     119        <h2><?php _e( 'Tests Enabled', 'site-health-tool-manager' ); ?></h2>
     120        <p><?php _e( 'Certain tests may not be relevant to your environment. Uncheck a test to remove it from the Site Health Status screen.', 'site-health-tool-manager' ); ?></p>
     121            <?php wp_nonce_field( 'shtm-disable-tests', 'shtm-disable-tests-nonce' ); ?>
     122            <ul>
     123            <?php
     124            foreach ( $tests as $type ) {
     125                $checked = false;
     126                foreach ( $type as $test => $details ) {
     127                    $checked = ( ! in_array( $test, $disabled ) );
     128                    echo '<li><input type="checkbox" ';
     129                    if ( $checked ) {
     130                        echo 'checked="checked" ';
     131                    }
     132                    echo 'name="checked[]" id="' . $test . '" value="' . $test . '" />';
     133                    echo '<label for="' . $test . '">' . $details['label'] . '</label></li>';
     134                }
     135            }
     136            ?>
     137            </ul>
     138        <h2><?php _e( 'Other Settings', 'site-health-tool-manager' ); ?></h2>
    106139        <ul>
    107         <?php
    108         foreach ( $tests as $type ) {
    109             $checked = false;
    110             foreach ( $type as $test => $details ) {
    111                 $checked = ( ! in_array( $test, $disabled ) );
    112                 echo '<li><input type="checkbox" ';
    113                 if ( $checked ) {
    114                     echo 'checked="checked" ';
    115                 }
    116                 echo 'name="checked[]" id="' . $test . '" value="' . $test . '" />';
    117                 echo '<label for="' . $test . '">' . $details['label'] . '</label></li>';
    118             }
    119         }
    120         ?>
     140            <li>
     141                <input type="checkbox" name="widget" id="widget-setting"
     142                    <?php
     143                    if ( $widget ) {
     144                        echo 'checked="checked"';
     145                    }
     146                    ?>
     147                />
     148                <label for="widget-setting"><?php _e( 'Dashboard Widget Enabled', 'site-health-tool-manager' ); ?></label>
     149            </li>
    121150        </ul>
    122         <input class="button button-primary" type="submit" value="<?php _e( 'Save Tests', 'site-health-tool-manager' ); ?>" />
     151        <p>
     152            <input class="button button-primary" type="submit" value="<?php _e( 'Save Settings', 'site-health-tool-manager' ); ?>" name="submit" />
     153        </p>
    123154    </form>
    124155</div>
Note: See TracChangeset for help on using the changeset viewer.