Plugin Directory

Changeset 465373


Ignore:
Timestamp:
11/20/2011 09:36:30 PM (14 years ago)
Author:
technical_mastermind
Message:

Updated to version 1.2

Location:
tm-replace-howdy
Files:
8 added
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tm-replace-howdy/tags/1.2/index.php

    r393250 r465373  
    55Description: The Replace Howdy Plugin is designed to replace the word "Howdy" in the WordPress backend header with something else. By default it randomly pulls from a list of several replacement words and phrases such as "Hello", "Welcome", and "Get to the choppa". The plugin also comes with a menu where you can limit it to "professional" sounding greetings, set a static word or phrase, or add your own list (which can be by itself or added into the default list for even more variety)!
    66Author: David Wood
    7 Version: 1.1
     7Version: 1.2
    88Author URI: http://iamdavidwood.com/
    99Contributors: Micah Wood
     
    1111============================================================================================================
    1212This software is provided "as is" and any express or implied warranties, including, but not limited to, the
    13 implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
     13implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall
    1414the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
    1515consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
     
    2121============================================================================================================
    2222*/
     23
     24define('TM_REPLACE_HOWDY_URL', plugins_url('', __FILE__));
     25
    2326class tm_replace_howdy {
    2427private $techm_howdy_fun = array( // Array containing standard greetings
     
    5760'Konichiwa',
    5861), $tm_help;
    59     function tm_replace_howdy() { // Initialze the plugin and handle the output (more or less)
    60         global $nohowdy, $wp_version;
     62    function tm_replace_howdy() { // Initialize the plugin and handle the output (more or less)
     63        if(is_admin()) { // Only runs if this is an admin page
     64            add_action('admin_menu', array(&$this, 'techm_replace_howdy_start')); // Call function to add admin options menu
     65            add_action('admin_init', array(&$this, 'techm_replace_howdy_help'));
     66        }
     67        global $wp_version, $no_howdy;
     68        if(preg_match('/^3\.[3-9]/', $wp_version)) wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_3.js', array('jquery'));
     69        elseif(preg_match('/^3\.2/', $wp_version)) wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_2.js', array('jquery'));
     70        elseif(preg_match('/^3\.[1|0]/', $wp_version)) wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_1.js', array('jquery'));
     71
    6172        $techm_replace_howdy = get_option('techm_replace_howdy_values'); // Get options from DB if they exist
    6273        if(is_array($techm_replace_howdy)) $values = $techm_replace_howdy; // Values stored in DB, use them
    6374        else $values = $this->techm_howdy_fun; // No values in DB, use default.
    64         $nohowdy = $values[rand(0,count($values)-1)]; // Get a random item from the array
    65         if(is_admin()) { // Only runs if this is an admin page
    66             add_action('admin_menu', array(&$this, 'techm_replace_howdy_start')); // Call function to add admin options menu
    67             add_action('admin_init', array(&$this, 'techm_replace_howdy_help'));
    68             add_action('admin_head', array(&$this, 'techm_replace_howdy_h')); // Add jQuery to header
    69             if(preg_match('/^3\.[2-9]/', $wp_version)) add_action('admin_footer', array(&$this, 'techm_replace_howdy_3_2')); // Run replace-howdy if 3.2 or later
    70             elseif(preg_match('/^3\.[1|0]/', $wp_version)) add_action('admin_footer', array(&$this, 'techm_replace_howdy_3_1')); // Run replace-howdy if prior to version 3.2
    71         }
     75        $no_howdy = $values[rand(0,count($values)-1)]; // Get a random item from the array
     76
     77        if(is_admin()) add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
     78        elseif(preg_match('/^3\.[1-2|0]/', $wp_version)) $x = 1; // Doing nothing if version is before 3.3 and not admin area
     79        else add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     80    }
     81    function enqueue_scripts() {
     82        global $no_howdy;
     83        wp_enqueue_script('tm_replace_howdy');
     84        wp_localize_script('tm_replace_howdy', 'tmReplaceHowdy', array('noHowdy' => $no_howdy));
    7285    }
    7386    function techm_replace_howdy_start() {
     
    7588    }
    7689    function techm_replace_howdy_help() {
    77         $help = '<h2>Explanition of modes</h2>
     90        $help = '<h2>Explanation of modes</h2>
    7891        <p><b>Normal Mode:</b> "Howdy" is replaced by one of the words/phrases in the default list. The default list is available for viewing on <a href="http://technicalmastermind.com/">TechnicalMastermind.com</a></p>
    7992       
     
    8295        <p><b>Static Mode:</b> For much the same reason party pooper mode exists, this mode is there for the people that want it to say one thing and one thing only. You can make it as funny or as boring as you want! You can define this in the "Static replacement word" option.</p>
    8396       
    84         <p><b>Custom Mode:</b> This mode is for people that like to be unique or just want to add an item or two to the list. To create your own word/phrase list, simply type them all into the field labeled as "Custom Word List". Make sure each word/phrase has no spaces before or after it (between words in a phrase is allowed) and don\'t put a comma (,) after anything, it gets added in later. Seperate each word/phrase with a pipe(|). On most keyboards the pipe is located on the key between the backspace/delete key and the return/enter key (you will need to hold down shift when typing a pipe character).</p>
     97        <p><b>Custom Mode:</b> This mode is for people that like to be unique or just want to add an item or two to the list. To create your own word/phrase list, simply type them all into the field labeled as "Custom Word List". Make sure each word/phrase has no spaces before or after it (between words in a phrase is allowed) and don\'t put a comma (,) after anything, it gets added in later. Separate each word/phrase with a pipe(|). On most keyboards the pipe is located on the key between the backspace/delete key and the return/enter key (you will need to hold down shift when typing a pipe character).</p>
    8598        <p><b>Custom Mode Options:</b> Continuing from the custom mode explanation, when you use custom mode there are two variations of it (chosen through the "Custom mode options" menu item). 1) "Custom list + our list", this takes what you put in the "Custom word list" and adds it to our default list of words and phrases. 2) "Custom list only", this mode takes what you enter into the "Custom word list" and uses that as the entire list.</p>
    8699        <p><b>NOTE:</b> For custom defined text, know that ", <username>" is appended to the end of each item when displayed. So no ending commas(,)!</p>
     
    133146        require(dirname(__FILE__) . '/techm_options.php'); // Display the form
    134147    }
    135     function techm_replace_howdy_h() { // Load jQuery into wp-head
    136         wp_enqueue_script('jquery');
    137     }
    138     function techm_replace_howdy_3_1() { // Replace "Howdy" if version 3.1.x or older.
    139         global $nohowdy;
    140         echo "<script type=\"text/javascript\">
    141         var nohowdy = \"".$nohowdy."\";
    142         jQuery('#user_info p')
    143         .html(
    144             jQuery('#user_info p')
    145             .html()
    146             .replace(/Howdy/,nohowdy)
    147         );</script>";
    148     }
    149     function techm_replace_howdy_3_2() { // Replace "Howdy" if version 3.2 or newer.
    150         global $nohowdy;
    151         echo "<script type=\"text/javascript\">
    152         var nohowdy = \"".$nohowdy."\";
    153         jQuery('#user_info .hide-if-no-js p')
    154         .html(
    155             jQuery('#user_info .hide-if-no-js p')
    156             .html()
    157             .replace(/Howdy/,nohowdy)
    158         );</script>";
    159     }
    160148}
    161149new tm_replace_howdy;
  • tm-replace-howdy/tags/1.2/readme.txt

    r394041 r465373  
    99Donate link:       http://technicalmastermind.com/donate/
    1010Requires at least: 3.0
    11 Tested up to:      3.2
    12 Stable tag:        1.1
    13 Version:           1.1
     11Tested up to:      3.3
     12Stable tag:        1.2
     13Version:           1.2
    1414
    1515== Description ==
     
    2424
    2525== Upgrade Notice ==
     26= 1.2 =
     27* Updated plugin to be compatible with WP 3.3
     28* Maintained backwards compatibility through WP 3.0
     29* Moved JavaScript code to separate files
     30* JavaScript is now included using builtin WP methods
    2631= 1.1 =
    2732* Updated plugin to be compatible with the new WP 3.2 admin interface!
    2833* Maintained backwards compatibility through at least WP 3.0.
    29 * Optimized and cleaned up the code some to make it easier to read and more efficent (hopefully).
     34* Optimized and cleaned up the code some to make it easier to read and more efficient (hopefully).
    3035
    3136== Screenshots ==
     
    3439
    3540== Changelog ==
     41= 1.2 =
     42* Updated plugin to be compatible with WP 3.3
     43* Maintained backwards compatibility through WP 3.0
     44* Moved JavaScript code to separate files
     45* JavaScript is now included using builtin WP methods
    3646= 1.1 =
    3747* Updated plugin to be compatible with the new WP 3.2 admin interface!
    3848* Maintained backwards compatibility through at least WP 3.0.
    39 * Optimized and cleaned up the code some to make it easier to read and more efficent (hopefully).
    40 * Cleaned up the admin page by placeing the bulk of the text in the contextual help (little "help" tab under your username in the admin area)
     49* Optimized and cleaned up the code some to make it easier to read and more efficient (hopefully).
     50* Cleaned up the admin page by placing the bulk of the text in the contextual help (little "help" tab under your username in the admin area)
    4151= 1.0 =
    4252* Created Plugin!
  • tm-replace-howdy/trunk/index.php

    r393250 r465373  
    55Description: The Replace Howdy Plugin is designed to replace the word "Howdy" in the WordPress backend header with something else. By default it randomly pulls from a list of several replacement words and phrases such as "Hello", "Welcome", and "Get to the choppa". The plugin also comes with a menu where you can limit it to "professional" sounding greetings, set a static word or phrase, or add your own list (which can be by itself or added into the default list for even more variety)!
    66Author: David Wood
    7 Version: 1.1
     7Version: 1.2
    88Author URI: http://iamdavidwood.com/
    99Contributors: Micah Wood
     
    1111============================================================================================================
    1212This software is provided "as is" and any express or implied warranties, including, but not limited to, the
    13 implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
     13implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall
    1414the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
    1515consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
     
    2121============================================================================================================
    2222*/
     23
     24define('TM_REPLACE_HOWDY_URL', plugins_url('', __FILE__));
     25
    2326class tm_replace_howdy {
    2427private $techm_howdy_fun = array( // Array containing standard greetings
     
    5760'Konichiwa',
    5861), $tm_help;
    59     function tm_replace_howdy() { // Initialze the plugin and handle the output (more or less)
    60         global $nohowdy, $wp_version;
     62    function tm_replace_howdy() { // Initialize the plugin and handle the output (more or less)
     63        if(is_admin()) { // Only runs if this is an admin page
     64            add_action('admin_menu', array(&$this, 'techm_replace_howdy_start')); // Call function to add admin options menu
     65            add_action('admin_init', array(&$this, 'techm_replace_howdy_help'));
     66        }
     67        global $wp_version, $no_howdy;
     68        if(preg_match('/^3\.[3-9]/', $wp_version)) wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_3.js', array('jquery'));
     69        elseif(preg_match('/^3\.2/', $wp_version)) wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_2.js', array('jquery'));
     70        elseif(preg_match('/^3\.[1|0]/', $wp_version)) wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_1.js', array('jquery'));
     71
    6172        $techm_replace_howdy = get_option('techm_replace_howdy_values'); // Get options from DB if they exist
    6273        if(is_array($techm_replace_howdy)) $values = $techm_replace_howdy; // Values stored in DB, use them
    6374        else $values = $this->techm_howdy_fun; // No values in DB, use default.
    64         $nohowdy = $values[rand(0,count($values)-1)]; // Get a random item from the array
    65         if(is_admin()) { // Only runs if this is an admin page
    66             add_action('admin_menu', array(&$this, 'techm_replace_howdy_start')); // Call function to add admin options menu
    67             add_action('admin_init', array(&$this, 'techm_replace_howdy_help'));
    68             add_action('admin_head', array(&$this, 'techm_replace_howdy_h')); // Add jQuery to header
    69             if(preg_match('/^3\.[2-9]/', $wp_version)) add_action('admin_footer', array(&$this, 'techm_replace_howdy_3_2')); // Run replace-howdy if 3.2 or later
    70             elseif(preg_match('/^3\.[1|0]/', $wp_version)) add_action('admin_footer', array(&$this, 'techm_replace_howdy_3_1')); // Run replace-howdy if prior to version 3.2
    71         }
     75        $no_howdy = $values[rand(0,count($values)-1)]; // Get a random item from the array
     76
     77        if(is_admin()) add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
     78        elseif(preg_match('/^3\.[1-2|0]/', $wp_version)) $x = 1; // Doing nothing if version is before 3.3 and not admin area
     79        else add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     80    }
     81    function enqueue_scripts() {
     82        global $no_howdy;
     83        wp_enqueue_script('tm_replace_howdy');
     84        wp_localize_script('tm_replace_howdy', 'tmReplaceHowdy', array('noHowdy' => $no_howdy));
    7285    }
    7386    function techm_replace_howdy_start() {
     
    7588    }
    7689    function techm_replace_howdy_help() {
    77         $help = '<h2>Explanition of modes</h2>
     90        $help = '<h2>Explanation of modes</h2>
    7891        <p><b>Normal Mode:</b> "Howdy" is replaced by one of the words/phrases in the default list. The default list is available for viewing on <a href="http://technicalmastermind.com/">TechnicalMastermind.com</a></p>
    7992       
     
    8295        <p><b>Static Mode:</b> For much the same reason party pooper mode exists, this mode is there for the people that want it to say one thing and one thing only. You can make it as funny or as boring as you want! You can define this in the "Static replacement word" option.</p>
    8396       
    84         <p><b>Custom Mode:</b> This mode is for people that like to be unique or just want to add an item or two to the list. To create your own word/phrase list, simply type them all into the field labeled as "Custom Word List". Make sure each word/phrase has no spaces before or after it (between words in a phrase is allowed) and don\'t put a comma (,) after anything, it gets added in later. Seperate each word/phrase with a pipe(|). On most keyboards the pipe is located on the key between the backspace/delete key and the return/enter key (you will need to hold down shift when typing a pipe character).</p>
     97        <p><b>Custom Mode:</b> This mode is for people that like to be unique or just want to add an item or two to the list. To create your own word/phrase list, simply type them all into the field labeled as "Custom Word List". Make sure each word/phrase has no spaces before or after it (between words in a phrase is allowed) and don\'t put a comma (,) after anything, it gets added in later. Separate each word/phrase with a pipe(|). On most keyboards the pipe is located on the key between the backspace/delete key and the return/enter key (you will need to hold down shift when typing a pipe character).</p>
    8598        <p><b>Custom Mode Options:</b> Continuing from the custom mode explanation, when you use custom mode there are two variations of it (chosen through the "Custom mode options" menu item). 1) "Custom list + our list", this takes what you put in the "Custom word list" and adds it to our default list of words and phrases. 2) "Custom list only", this mode takes what you enter into the "Custom word list" and uses that as the entire list.</p>
    8699        <p><b>NOTE:</b> For custom defined text, know that ", <username>" is appended to the end of each item when displayed. So no ending commas(,)!</p>
     
    133146        require(dirname(__FILE__) . '/techm_options.php'); // Display the form
    134147    }
    135     function techm_replace_howdy_h() { // Load jQuery into wp-head
    136         wp_enqueue_script('jquery');
    137     }
    138     function techm_replace_howdy_3_1() { // Replace "Howdy" if version 3.1.x or older.
    139         global $nohowdy;
    140         echo "<script type=\"text/javascript\">
    141         var nohowdy = \"".$nohowdy."\";
    142         jQuery('#user_info p')
    143         .html(
    144             jQuery('#user_info p')
    145             .html()
    146             .replace(/Howdy/,nohowdy)
    147         );</script>";
    148     }
    149     function techm_replace_howdy_3_2() { // Replace "Howdy" if version 3.2 or newer.
    150         global $nohowdy;
    151         echo "<script type=\"text/javascript\">
    152         var nohowdy = \"".$nohowdy."\";
    153         jQuery('#user_info .hide-if-no-js p')
    154         .html(
    155             jQuery('#user_info .hide-if-no-js p')
    156             .html()
    157             .replace(/Howdy/,nohowdy)
    158         );</script>";
    159     }
    160148}
    161149new tm_replace_howdy;
  • tm-replace-howdy/trunk/readme.txt

    r394041 r465373  
    99Donate link:       http://technicalmastermind.com/donate/
    1010Requires at least: 3.0
    11 Tested up to:      3.2
    12 Stable tag:        1.1
    13 Version:           1.1
     11Tested up to:      3.3
     12Stable tag:        1.2
     13Version:           1.2
    1414
    1515== Description ==
     
    2424
    2525== Upgrade Notice ==
     26= 1.2 =
     27* Updated plugin to be compatible with WP 3.3
     28* Maintained backwards compatibility through WP 3.0
     29* Moved JavaScript code to separate files
     30* JavaScript is now included using builtin WP methods
    2631= 1.1 =
    2732* Updated plugin to be compatible with the new WP 3.2 admin interface!
    2833* Maintained backwards compatibility through at least WP 3.0.
    29 * Optimized and cleaned up the code some to make it easier to read and more efficent (hopefully).
     34* Optimized and cleaned up the code some to make it easier to read and more efficient (hopefully).
    3035
    3136== Screenshots ==
     
    3439
    3540== Changelog ==
     41= 1.2 =
     42* Updated plugin to be compatible with WP 3.3
     43* Maintained backwards compatibility through WP 3.0
     44* Moved JavaScript code to separate files
     45* JavaScript is now included using builtin WP methods
    3646= 1.1 =
    3747* Updated plugin to be compatible with the new WP 3.2 admin interface!
    3848* Maintained backwards compatibility through at least WP 3.0.
    39 * Optimized and cleaned up the code some to make it easier to read and more efficent (hopefully).
    40 * Cleaned up the admin page by placeing the bulk of the text in the contextual help (little "help" tab under your username in the admin area)
     49* Optimized and cleaned up the code some to make it easier to read and more efficient (hopefully).
     50* Cleaned up the admin page by placing the bulk of the text in the contextual help (little "help" tab under your username in the admin area)
    4151= 1.0 =
    4252* Created Plugin!
Note: See TracChangeset for help on using the changeset viewer.