WordPress.org

Plugin Directory

Changeset 1606769


Ignore:
Timestamp:
03/02/17 21:07:55 (5 months ago)
Author:
coffee2code
Message:

Release v1.6:

  • New: Disable search item from front-end admin bar
  • Change: Prevent object instantiation
    • Add private __construct()
    • Add private __wakeup()
  • Change: Update unit test bootstrap
    • Default WP_TESTS_DIR to /tmp/wordpress-tests-lib rather than erroring out if not defined via environment variable
    • Enable more error output for unit tests
  • Change: Note compatibility through WP 4.7+
  • Change: Remove support for WordPress older than 4.6 (should still work for earlier versions back to WP 3.6)
  • Change: Update copyright date (2017)
  • New: Add LICENSE file
Location:
disable-search
Files:
2 added
5 edited
8 copied

Legend:

Unmodified
Added
Removed
  • disable-search/tags/1.6/disable-search.php

    r1395917 r1606769  
    22/** 
    33 * Plugin Name: Disable Search 
    4  * Version:     1.5.1 
     4 * Version:     1.6 
    55 * Plugin URI:  http://coffee2code.com/wp-plugins/disable-search/ 
    66 * Author:      Scott Reilly 
     
    1111 * Description: Disable the built-in front-end search capabilities of WordPress. 
    1212 * 
    13  * Compatible with WordPress 3.6 through 4.5+. 
     13 * Compatible with WordPress 4.6 through 4.7+. 
    1414 * 
    1515 * =>> Read the accompanying readme.txt file for instructions and documentation. 
     
    1919 * @package Disable_Search 
    2020 * @author  Scott Reilly 
    21  * @version 1.5.1 
     21 * @version 1.6 
    2222 */ 
    2323 
     
    3535 
    3636/* 
    37     Copyright (c) 2008-2015 by Scott Reilly (aka coffee2code) 
     37    Copyright (c) 2008-2017 by Scott Reilly (aka coffee2code) 
    3838 
    3939    This program is free software; you can redistribute it and/or 
     
    6464     */ 
    6565    public static function version() { 
    66         return '1.5.1'; 
     66        return '1.6'; 
    6767    } 
     68 
     69    /** 
     70     * Prevent instantiation. 
     71     * 
     72     * @since 1.6 
     73     */ 
     74    private function __construct() {} 
     75 
     76    /** 
     77     * Prevent unserializing an instance. 
     78     * 
     79     * @since 1.6 
     80     */ 
     81    private function __wakeup() {} 
    6882 
    6983    /** 
     
    89103        } 
    90104        add_filter( 'get_search_form', array( __CLASS__, 'get_search_form' ), 999 ); 
     105 
     106        add_action( 'admin_bar_menu',  array( __CLASS__, 'admin_bar_menu' ), 11 ); 
    91107    } 
    92108 
    93109    /** 
    94      * Disables the built-in WP search widget 
     110     * Disables the built-in WP search widget. 
    95111     */ 
    96112    public static function disable_search_widget() { 
     
    113129     * request as a 404 if a search was attempted. 
    114130     * 
    115      * @param  object $obj A WP_Query object. 
     131     * @param WP_Query $obj A query object. 
    116132     */ 
    117133    public static function parse_query( $obj ) { 
     
    129145    } 
    130146 
     147    /** 
     148     * Removes the search item from the admin bar. 
     149     * 
     150     * @since 1.6 
     151     * 
     152     * @param WP_Admin_Bar $wp_admin_bar The WP admin bar object. 
     153     */ 
     154    public static function admin_bar_menu( $wp_admin_bar ) { 
     155        $wp_admin_bar->remove_menu( 'search' ); 
     156    } 
     157 
    131158} // end c2c_DisableSearch 
    132159 
  • disable-search/tags/1.6/readme.txt

    r1395917 r1606769  
    55License: GPLv2 or later 
    66License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    7 Requires at least: 3.6 
    8 Tested up to: 4.5 
    9 Stable tag: 1.5.1 
     7Requires at least: 4.6 
     8Tested up to: 4.7 
     9Stable tag: 1.6 
    1010 
    1111Disable the built-in front-end search capabilities of WordPress. 
     
    1414== Description == 
    1515 
    16 Prevent WordPress from allowing and handling any search requests for the site.  Specifically, this plugin: 
     16Prevent WordPress from allowing and handling any search requests for the site. Specifically, this plugin: 
    1717 
    1818* Prevents the search form from appearing if the theme uses the standard `get_search_form()` function to display the search form. 
    1919* Prevents the search form from appearing if the theme uses a searchform.php template 
     20* Prevents the search item from appearing in the admin tool bar when shown on the front-end. 
    2021* Disables the search widget. 
    2122  * Removes the Search widget from the list of available widgets 
     
    5758 
    5859== Changelog == 
     60 
     61= 1.6 (2017-02-21) = 
     62* New: Disable search item from front-end admin bar 
     63* Change: Prevent object instantiation 
     64    * Add private `__construct()` 
     65    * Add private `__wakeup()` 
     66* Change: Update unit test bootstrap 
     67    * Default `WP_TESTS_DIR` to `/tmp/wordpress-tests-lib` rather than erroring out if not defined via environment variable 
     68    * Enable more error output for unit tests 
     69* Change: Note compatibility through WP 4.7+ 
     70* Change: Remove support for WordPress older than 4.6 (should still work for earlier versions back to WP 3.6) 
     71* Change: Update copyright date (2017) 
     72* New: Add LICENSE file 
    5973 
    6074= 1.5.1 (2016-01-15) = 
     
    148162== Upgrade Notice == 
    149163 
     164= 1.6 = 
     165Minor update: disabled search item from front-end admin bar, compatibility is now WP 4.6 through 4.7+, and other minor tweaks 
     166 
    150167= 1.5.1 = 
    151168Bugfix release for bug introduced in v1.5. 
  • disable-search/tags/1.6/tests/bootstrap.php

    r822761 r1606769  
    11<?php 
     2/** 
     3 * PHPUnit bootstrap file 
     4 * 
     5 * @package Disable_Search 
     6 */ 
    27 
    3 require_once getenv( 'WP_TESTS_DIR' ) . '/includes/functions.php'; 
     8ini_set('display_errors','on'); 
     9error_reporting(E_ALL); 
    410 
     11$_tests_dir = getenv( 'WP_TESTS_DIR' ); 
     12if ( ! $_tests_dir ) { 
     13        $_tests_dir = '/tmp/wordpress-tests-lib'; 
     14} 
     15 
     16// Give access to tests_add_filter() function. 
     17require_once $_tests_dir . '/includes/functions.php'; 
     18 
     19/** 
     20 * Manually load the plugin being tested. 
     21 */ 
    522function _manually_load_plugin() { 
    6     require dirname( __FILE__ ) . '/../disable-search.php'; 
     23        require dirname( dirname( __FILE__ ) ) . '/disable-search.php'; 
    724} 
    825tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); 
    926 
    10 require getenv( 'WP_TESTS_DIR' ) . '/includes/bootstrap.php'; 
     27// Start up the WP testing environment. 
     28require $_tests_dir . '/includes/bootstrap.php'; 
  • disable-search/tags/1.6/tests/test-disable-search.php

    r1329170 r1606769  
    4040 
    4141    public function test_version() { 
    42         $this->assertEquals( '1.5.1', c2c_DisableSearch::version() ); 
     42        $this->assertEquals( '1.6', c2c_DisableSearch::version() ); 
    4343    } 
    4444 
  • disable-search/trunk/disable-search.php

    r1395917 r1606769  
    22/** 
    33 * Plugin Name: Disable Search 
    4  * Version:     1.5.1 
     4 * Version:     1.6 
    55 * Plugin URI:  http://coffee2code.com/wp-plugins/disable-search/ 
    66 * Author:      Scott Reilly 
     
    1111 * Description: Disable the built-in front-end search capabilities of WordPress. 
    1212 * 
    13  * Compatible with WordPress 3.6 through 4.5+. 
     13 * Compatible with WordPress 4.6 through 4.7+. 
    1414 * 
    1515 * =>> Read the accompanying readme.txt file for instructions and documentation. 
     
    1919 * @package Disable_Search 
    2020 * @author  Scott Reilly 
    21  * @version 1.5.1 
     21 * @version 1.6 
    2222 */ 
    2323 
     
    3535 
    3636/* 
    37     Copyright (c) 2008-2015 by Scott Reilly (aka coffee2code) 
     37    Copyright (c) 2008-2017 by Scott Reilly (aka coffee2code) 
    3838 
    3939    This program is free software; you can redistribute it and/or 
     
    6464     */ 
    6565    public static function version() { 
    66         return '1.5.1'; 
     66        return '1.6'; 
    6767    } 
     68 
     69    /** 
     70     * Prevent instantiation. 
     71     * 
     72     * @since 1.6 
     73     */ 
     74    private function __construct() {} 
     75 
     76    /** 
     77     * Prevent unserializing an instance. 
     78     * 
     79     * @since 1.6 
     80     */ 
     81    private function __wakeup() {} 
    6882 
    6983    /** 
     
    89103        } 
    90104        add_filter( 'get_search_form', array( __CLASS__, 'get_search_form' ), 999 ); 
     105 
     106        add_action( 'admin_bar_menu',  array( __CLASS__, 'admin_bar_menu' ), 11 ); 
    91107    } 
    92108 
    93109    /** 
    94      * Disables the built-in WP search widget 
     110     * Disables the built-in WP search widget. 
    95111     */ 
    96112    public static function disable_search_widget() { 
     
    113129     * request as a 404 if a search was attempted. 
    114130     * 
    115      * @param  object $obj A WP_Query object. 
     131     * @param WP_Query $obj A query object. 
    116132     */ 
    117133    public static function parse_query( $obj ) { 
     
    129145    } 
    130146 
     147    /** 
     148     * Removes the search item from the admin bar. 
     149     * 
     150     * @since 1.6 
     151     * 
     152     * @param WP_Admin_Bar $wp_admin_bar The WP admin bar object. 
     153     */ 
     154    public static function admin_bar_menu( $wp_admin_bar ) { 
     155        $wp_admin_bar->remove_menu( 'search' ); 
     156    } 
     157 
    131158} // end c2c_DisableSearch 
    132159 
  • disable-search/trunk/readme.txt

    r1395917 r1606769  
    55License: GPLv2 or later 
    66License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    7 Requires at least: 3.6 
    8 Tested up to: 4.5 
    9 Stable tag: 1.5.1 
     7Requires at least: 4.6 
     8Tested up to: 4.7 
     9Stable tag: 1.6 
    1010 
    1111Disable the built-in front-end search capabilities of WordPress. 
     
    1414== Description == 
    1515 
    16 Prevent WordPress from allowing and handling any search requests for the site.  Specifically, this plugin: 
     16Prevent WordPress from allowing and handling any search requests for the site. Specifically, this plugin: 
    1717 
    1818* Prevents the search form from appearing if the theme uses the standard `get_search_form()` function to display the search form. 
    1919* Prevents the search form from appearing if the theme uses a searchform.php template 
     20* Prevents the search item from appearing in the admin tool bar when shown on the front-end. 
    2021* Disables the search widget. 
    2122  * Removes the Search widget from the list of available widgets 
     
    5758 
    5859== Changelog == 
     60 
     61= 1.6 (2017-02-21) = 
     62* New: Disable search item from front-end admin bar 
     63* Change: Prevent object instantiation 
     64    * Add private `__construct()` 
     65    * Add private `__wakeup()` 
     66* Change: Update unit test bootstrap 
     67    * Default `WP_TESTS_DIR` to `/tmp/wordpress-tests-lib` rather than erroring out if not defined via environment variable 
     68    * Enable more error output for unit tests 
     69* Change: Note compatibility through WP 4.7+ 
     70* Change: Remove support for WordPress older than 4.6 (should still work for earlier versions back to WP 3.6) 
     71* Change: Update copyright date (2017) 
     72* New: Add LICENSE file 
    5973 
    6074= 1.5.1 (2016-01-15) = 
     
    148162== Upgrade Notice == 
    149163 
     164= 1.6 = 
     165Minor update: disabled search item from front-end admin bar, compatibility is now WP 4.6 through 4.7+, and other minor tweaks 
     166 
    150167= 1.5.1 = 
    151168Bugfix release for bug introduced in v1.5. 
  • disable-search/trunk/tests/bootstrap.php

    r822761 r1606769  
    11<?php 
     2/** 
     3 * PHPUnit bootstrap file 
     4 * 
     5 * @package Disable_Search 
     6 */ 
    27 
    3 require_once getenv( 'WP_TESTS_DIR' ) . '/includes/functions.php'; 
     8ini_set('display_errors','on'); 
     9error_reporting(E_ALL); 
    410 
     11$_tests_dir = getenv( 'WP_TESTS_DIR' ); 
     12if ( ! $_tests_dir ) { 
     13        $_tests_dir = '/tmp/wordpress-tests-lib'; 
     14} 
     15 
     16// Give access to tests_add_filter() function. 
     17require_once $_tests_dir . '/includes/functions.php'; 
     18 
     19/** 
     20 * Manually load the plugin being tested. 
     21 */ 
    522function _manually_load_plugin() { 
    6     require dirname( __FILE__ ) . '/../disable-search.php'; 
     23        require dirname( dirname( __FILE__ ) ) . '/disable-search.php'; 
    724} 
    825tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); 
    926 
    10 require getenv( 'WP_TESTS_DIR' ) . '/includes/bootstrap.php'; 
     27// Start up the WP testing environment. 
     28require $_tests_dir . '/includes/bootstrap.php'; 
  • disable-search/trunk/tests/test-disable-search.php

    r1329170 r1606769  
    4040 
    4141    public function test_version() { 
    42         $this->assertEquals( '1.5.1', c2c_DisableSearch::version() ); 
     42        $this->assertEquals( '1.6', c2c_DisableSearch::version() ); 
    4343    } 
    4444 
Note: See TracChangeset for help on using the changeset viewer.