Changeset 469914
- Timestamp:
- 12/01/2011 04:03:12 PM (14 years ago)
- Location:
- tm-replace-howdy
- Files:
-
- 1 deleted
- 6 edited
- 5 copied
- 1 moved
-
tags/1.3 (copied) (copied from tm-replace-howdy/trunk)
-
tags/1.3/index.php (copied) (copied from tm-replace-howdy/trunk/index.php) (2 diffs)
-
tags/1.3/js (copied) (copied from tm-replace-howdy/trunk/js)
-
tags/1.3/js/tm-replace-howdy-3_3.js (modified) (1 diff)
-
tags/1.3/options.php (copied) (copied from tm-replace-howdy/trunk/techm_options.php) (1 diff)
-
tags/1.3/readme.txt (copied) (copied from tm-replace-howdy/trunk/readme.txt) (4 diffs)
-
tags/1.3/screenshot-1.jpg (modified) (previous)
-
tags/1.3/techm_options.php (deleted)
-
trunk/index.php (modified) (2 diffs)
-
trunk/js/tm-replace-howdy-3_3.js (modified) (1 diff)
-
trunk/options.php (moved) (moved from tm-replace-howdy/trunk/techm_options.php) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/screenshot-1.jpg (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
tm-replace-howdy/tags/1.3/index.php
r465373 r469914 2 2 /* 3 3 Plugin Name: TM Replace Howdy 4 Plugin URI: http://technicalmastermind.com/ wordpress-plugins/replace-howdy/4 Plugin URI: http://technicalmastermind.com/plugins/tm-replace-howdy/ 5 5 Description: 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)! 6 6 Author: David Wood 7 Version: 1. 27 Version: 1.3 8 8 Author URI: http://iamdavidwood.com/ 9 9 Contributors: Micah Wood … … 23 23 24 24 define('TM_REPLACE_HOWDY_URL', plugins_url('', __FILE__)); 25 define('TM_REPLACE_HOWDY_PATH', dirname(__FILE__)); 25 26 26 27 class tm_replace_howdy { 27 private $techm_howdy_fun = array( // Array containing standard greetings 28 'Hello', 29 'Bonjour', 30 'Greetings', 31 'Aloha', 32 'Chow', 33 'Welcome', 34 'Konichiwa', 35 'Get to the choppa', 36 'Looking good today', 37 'Wipe that grin off your face', 38 'There is a ninja behind you', 39 'Don\'t read this directly or you will get a lazy eye', 40 'I can see you right now', 41 'I know you are sitting at a computer', 42 'I can hear you breathing', 43 'Did you put on clean underwear this morning', 44 'Don\'t make me come down there', 45 'Did you remember to brush your teeth', 46 'Do you know what time it is', 47 'Eat all your vegetables', 48 'You just gained +5 WordPress skills', 49 'Have you showered recently', 50 'Wassap', 51 'We require a shrubbery', 52 ), 53 $techm_howdy_pooper = array( // Array containing "proper" greetings 54 'Hello', 55 'Bonjour', 56 'Greetings', 57 'Aloha', 58 'Chow', 59 'Welcome', 60 'Konichiwa', 61 ), $tm_help; 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')); 28 private $version = '1.3', 29 $tm_howdy_fun = array( // Array containing standard greetings 30 'Hello', 31 'Bonjour', 32 'Greetings', 33 'Aloha', 34 'Chow', 35 'Welcome', 36 'Konnichiwa', 37 'Get to the choppa', 38 'Looking good today', 39 'Wipe that grin off your face', 40 'There is a ninja behind you', 41 'Don\'t read this directly or you will get a lazy eye', 42 'I can see you right now', 43 'I know you are sitting at a computer', 44 'I can hear you breathing', 45 'Did you put on clean underwear this morning', 46 'Don\'t make me come down there', 47 'Did you remember to brush your teeth', 48 'Do you know what time it is', 49 'Eat all your vegetables', 50 'You just gained +5 WordPress skills', 51 'Have you showered recently', 52 'Wassap', 53 'We require a shrubbery', 54 'Don\'t mind me', 55 'Pay no attention to the man behind the curtain', 56 ), 57 $tm_howdy_pooper = array( // Array containing "proper" greetings 58 'Hello', 59 'Bonjour', 60 'Greetings', 61 'Aloha', 62 'Chow', 63 'Welcome', 64 'Konnichiwa', 65 ), 66 $tm_help; 71 67 72 $techm_replace_howdy = get_option('techm_replace_howdy_values'); // Get options from DB if they exist 73 if(is_array($techm_replace_howdy)) $values = $techm_replace_howdy; // Values stored in DB, use them 74 else $values = $this->techm_howdy_fun; // No values in DB, use default. 75 $no_howdy = $values[rand(0,count($values)-1)]; // Get a random item from the array 68 function tm_replace_howdy() { 69 // Check if an upgrade needs to be performed 70 if(get_option('tm_replace_howdy_ver') != $this->version) $this->upgrade(); 76 71 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)); 85 } 86 function techm_replace_howdy_start() { 87 $this->tm_help = add_submenu_page('options-general.php', 'Replace Howdy Settings', 'Replace Howdy', 'manage_options', 'techm_replace_howdy', array(&$this, 'techm_replace_howdy_options')); // Add sub-menu under settings 88 } 89 function techm_replace_howdy_help() { 90 $help = '<h2>Explanation of modes</h2> 91 <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> 92 93 <p><b>Party Pooper Mode:</b> This mode is here because I realize that while many people enjoy random and exciting words/phrases to replace their "Howdy" with, many people (and businesses) prefer a more professional approach. Because of this, this mode only contains business appropriate greetings such as "Hello", "Aloha" and "Konichiwa". The full list can be viewed on <a href="http://technicalmastermind.com/">TechnicalMastermind.com</a></p> 94 95 <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> 96 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> 98 <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> 99 <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> 100 <p><b>NOTE 2:</b> If you have and questions, comments, feedback or suggestions please contact me via <a href="http://technicalmastermind.com/" target="_blank">TechnicalMastermind.com</a>. Thanks for using my plugin!</p>'; 101 add_contextual_help($this->tm_help, $help); 102 } 103 function techm_replace_howdy_options() { 104 if (!current_user_can('manage_options')) wp_die( __('You do not have sufficient permissions to access this page.') ); 105 if(isset($_POST['techm_submitted_form']) && $_POST['techm_submitted_form'] == 'Save Settings') { // Process form 106 $new_values = array('mode' => 'normal', 107 'static' => '', 108 'custom' => '', 109 'custom_mode' => 'custom_plus', 110 ); // Lists defaults 111 if(isset($_POST['techm_replace_howdy']) && is_array($_POST['techm_replace_howdy']) && count($_POST['techm_replace_howdy']) > 0) 112 $new_values = $_POST['techm_replace_howdy']; 113 $techm_replace_howdy = $new_values; 114 update_option( 'techm_replace_howdy', $new_values ); 115 if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] != '') { 116 switch($techm_replace_howdy['mode']) { 117 case 'pooper': $techm_values_array = $this->techm_howdy_pooper; 118 break; // Mode is pooper, set the values array to equal array of "Proper Greetings" 119 case 'static': if(isset($techm_replace_howdy['static']) && $techm_replace_howdy['static'] != '') $techm_values_array = array($techm_replace_howdy['static']); 120 break; // Only one thing, create array with only one element. 121 case 'custom': if(isset($techm_replace_howdy['custom']) && $techm_replace_howdy['custom'] != '') { 122 if(isset($techm_replace_howdy['custom_mode']) && $techm_replace_howdy['custom_mode'] == 'custom_plus') 123 $techm_values_array = $this->techm_howdy_fun; 124 else $techm_values_array = array(); 125 $tmp_values = explode('|', $techm_replace_howdy['custom']); 126 foreach($tmp_values as $value) $techm_values_array[] = $value; 127 } break; // Using custom list, merge lists if needed 128 default: $techm_values_array = $this->techm_howdy_fun; 129 break; // Using the regular list 130 } 131 } 132 update_option('techm_replace_howdy_values', $techm_values_array); // Store the list for use! 133 echo '<div class="updated"><p><strong>'. __('Settings Saved!') .'</strong></p></div>'; // Let the user know what happened! 134 } 135 elseif(isset($_POST['techm_submitted_form_defaults']) && $_POST['techm_submitted_form_defaults'] == 'Reset to Defaults') { 136 $new_values = array('mode' => 'normal', 137 'static' => '', 138 'custom' => '', 139 'custom_mode' => 'custom_plus', 140 ); // Lists defaults 141 $techm_replace_howdy = $new_values; 142 update_option('techm_replace_howdy', $new_values); // Set the settings to the default 143 delete_option('techm_replace_howdy_values', ''); // Clear the saved lists, it will now use the default 144 echo '<div class="updated"><p><strong>'. __('Settings Reset to Default!') .'</strong></p></div>'; 145 } 146 require(dirname(__FILE__) . '/techm_options.php'); // Display the form 147 } 72 // Call function to replace howdy 73 $this->replace_howdy(); 74 75 // Add admin menus 76 if(is_admin()) { // Only runs if this is an admin page 77 add_action('admin_menu', array(&$this, 'add_admin_page')); // Call function to add admin options menu 78 add_action('admin_init', array(&$this, 'options_help')); 79 } 80 81 // Register deactivation hook 82 register_deactivation_hook(__FILE__, array($this, 'deactivation')); 83 } 84 85 function replace_howdy() { 86 // Get current WP version 87 global $wp_version; 88 // Find out what version is in use and register the appropriate script 89 if(preg_match('/^3\.[3-9]/', $wp_version)) // Version 3.3.x+ 90 wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_3.js', array('jquery')); 91 elseif(preg_match('/^3\.2/', $wp_version)) // Version 3.2.x 92 wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_2.js', array('jquery')); 93 elseif(preg_match('/^3\.[1|0]/', $wp_version)) // Version 3.0.x - 3.1.x 94 wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_1.js', array('jquery')); 95 // Enqueue script when appropriate 96 if(is_admin()) add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); 97 elseif(preg_match('/^3\.[1-2|0]/', $wp_version)) $x = 1; // Doing nothing if version is before 3.3 and not admin area 98 else add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); 99 } 100 101 function enqueue_scripts() { 102 // Get what mode we are in 103 $mode = get_option('tm_replace_howdy_mode'); 104 switch($mode) { 105 case 'pooper': // We are in a non-custom mode, use list already in PHP 106 $values = $this->tm_howdy_pooper; 107 break; 108 case 'custom': // We are in a custom mode, get list from DB 109 $options = get_option('tm_replace_howdy_values'); 110 if(is_array($options) && is_array($options[1])) $values = $options[1]; 111 // Fallback if something is wrong with the list from the DB 112 else $values = $this->tm_howdy_fun; 113 break; 114 default: // Fallback and regular mode, use list already in PHP 115 $values = $this->tm_howdy_fun; 116 }; 117 // Get our random value from the array 118 $no_howdy = stripslashes($values[rand(0,count($values)-1)]); 119 // Enqueue our script and give access to the howdy replacement 120 wp_enqueue_script('tm_replace_howdy'); 121 wp_localize_script('tm_replace_howdy', 'tmReplaceHowdy', array('noHowdy' => $no_howdy)); 122 } 123 124 function add_admin_page() { 125 // Add sub-menu under settings 126 $this->tm_help = add_options_page('Replace Howdy Settings', 'Replace Howdy', 'manage_options', 'tm_replace_howdy', array(&$this, 'options_page')); 127 } 128 129 function options_page() { 130 // Check that the user has permission to be on this page 131 if(!current_user_can('manage_options')) 132 wp_die( __('You do not have sufficient permissions to access this page.') ); 133 // Include our file to handle saving of options and displaying of options form 134 require(TM_REPLACE_HOWDY_PATH.'/options.php'); 135 } 136 137 function options_help() { 138 $help = '<h2>Explanation of modes</h2> 139 <p><strong>Normal Mode:</strong> "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/plugins/tm-replace-howdy/">TechnicalMastermind.com</a></p> 140 141 <p><strong>Professional Mode:</strong> This mode is here because I realize that while many people enjoy random and exciting words/phrases to replace their "Howdy" with, many people (and businesses) prefer a more professional approach. Because of this, this mode only contains business appropriate greetings such as "Hello", "Aloha" and "Konnichiwa". The full list can be viewed on <a href="http://technicalmastermind.com/plugins/tm-replace-howdy/">TechnicalMastermind.com</a></p> 142 143 <p><strong>Custom Mode:</strong> This mode is for people that like to be unique, want to add an item or two to the list, or simply want it to always same the same thing. 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 directly below the backspace key.</p> 144 145 <p><strong>Custom Mode Options:</strong> 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> 146 147 <p><strong>NOTE:</strong> For custom defined text, know that ", <username>" is appended to the end of each item when displayed. So no ending commas(,)!</p>'; 148 add_contextual_help($this->tm_help, $help); 149 } 150 151 function upgrade() { 152 // Check for signs of previous versions 153 $old_options = get_option('techm_replace_howdy'); 154 $old_list = get_option('techm_replace_howdy_values'); 155 if($old_options) { 156 if($old_options['mode'] == 'static') $mode = 'custom'; 157 else $mode = $old_options['mode']; 158 // Remove old options from DB 159 delete_option('techm_replace_howdy'); 160 // Add new options to DB 161 update_option('tm_replace_howdy_mode', $mode); 162 } 163 if(is_array($old_list)) { 164 $values = array('custom_plus', array()); 165 $values[1] = array_diff($old_list, $this->tm_howdy_fun); 166 update_option('tm_replace_howdy_values', $values); 167 delete_option('techm_replace_howdy_values'); 168 } 169 // Store new version number 170 update_option('tm_replace_howdy_ver', $this->version); 171 } 172 173 function deactivation() { 174 $save_data = get_option('tm_replace_howdy_save'); 175 if($save_data == 'delete') { 176 // Delete all saved data 177 delete_option('tm_replace_howdy_mode'); 178 delete_option('tm_replace_howdy_values'); 179 delete_option('tm_replace_howdy_save'); 180 delete_option('tm_replace_howdy_ver'); 181 } 182 } 148 183 } 149 184 new tm_replace_howdy; -
tm-replace-howdy/tags/1.3/js/tm-replace-howdy-3_3.js
r465373 r469914 1 1 jQuery(document).ready(function($) { 2 $('#wp-admin-bar-my-account > a > span').html(3 $('#wp-admin-bar-my-account > a > span')2 $('#wp-admin-bar-my-account > a').html( 3 $('#wp-admin-bar-my-account > a') 4 4 .html() 5 5 .replace(/Howdy/,tmReplaceHowdy.noHowdy)); -
tm-replace-howdy/tags/1.3/options.php
r465326 r469914 1 <div class="wrap"> 2 <h2><?php _e('TM Replace Howdy Settings'); ?></h2> 3 <form method="post" action=""> 4 <table class="form-table"> 5 <tr valign="top"> 6 <th scope="row"><?php _e('Operating Mode:'); ?></th> 7 <td><select name="techm_replace_howdy[mode]"> 8 <option value="normal" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'normal') echo 'selected'; ?> ><?php _e('Normal'); ?></option> 9 <option value="pooper" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'pooper') echo 'selected'; ?> ><?php _e('Party Pooper Mode'); ?></option> 10 <option value="static" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'static') echo 'selected'; ?> ><?php _e('Static Mode'); ?></option> 11 <option value="custom" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'custom') echo 'selected'; ?> ><?php _e('Custom (see below)'); ?></option> 12 </select> 13 </td> 14 </tr> 15 <tr> 16 <th scope="row"><?php _e('Static replacement word (static mode only)'); ?>:</th> 17 <td><input type="text" name="techm_replace_howdy[static]" value="<?php if(isset($techm_replace_howdy['static'])) echo $techm_replace_howdy['static']; ?>" /></td> 18 </tr> 19 <tr valign="top"> 20 <th scope="row"><?php _e('Custom word list (custom mode only, use "greeting 1|greeting 2|greeting 3" format)'); ?></th> 21 <td> 22 <textarea name="techm_replace_howdy[custom]" rows="5" cols="30"><?php if(isset($techm_replace_howdy['custom'])) echo $techm_replace_howdy['custom']; ?></textarea> 23 </td> 24 </tr> 25 <tr> 26 <th scope="row"><?php _e('Custom mode options (custom mode only)'); ?>:</th> 27 <td><select name="techm_replace_howdy[custom_mode]"> 28 <option value="custom_plus" <?php if(isset($techm_replace_howdy['custom_mode']) && $techm_replace_howdy['custom_mode'] == 'custom_plus') echo 'selected'; ?> ><?php _e('Custom list + our list'); ?></option> 29 <option value="custom_only" <?php if(isset($techm_replace_howdy['custom_mode']) && $techm_replace_howdy['custom_mode'] == 'custom_only') echo 'selected'; ?> ><?php _e('Custom list only'); ?></option> 30 </select> 31 </td> 32 </tr> 33 </table> 34 <p class="submit"> 35 <input type="submit" class="button-primary" name="techm_submitted_form" value="<?php _e('Save Settings'); ?>" /> <input type="submit" class="button-primary" name="techm_submitted_form_defaults" value="<?php _e('Reset to Defaults'); ?>" /> 36 </p> 37 </form> 1 <?php 2 // Get settings from DB 3 $mode = get_option('tm_replace_howdy_mode'); 4 $values = get_option('tm_replace_howdy_values'); 5 $save_data = get_option('tm_replace_howdy_save'); 6 if(isset($_POST['tm_replace_howdy_form'])) { 7 // Update settings in DB, we are saving 8 if($_POST['tm_rh_mode']) $mode = $_POST['tm_rh_mode']; 9 if($_POST['tm_rh_list']) { 10 $list = explode(';', $_POST['tm_rh_list']); 11 $tmp = array(); 12 foreach($list as $item) { 13 $test = esc_attr(trim($item)); 14 if(!empty($test)) // Clears out any blank items from the array 15 $tmp[] = $test; 16 } 17 $values[1] = $tmp; 18 } 19 if($_POST['tm_rh_custom']) $values[0] = esc_attr($_POST['tm_rh_custom']); 20 if($_POST['tm_rh_save']) $save_data = $_POST['tm_rh_save']; 21 if($values[0] == 'custom_plus') $values[1] = array_merge($values[1], $this->tm_howdy_fun); 22 // Update options in DB 23 update_option('tm_replace_howdy_mode', esc_attr($mode)); 24 update_option('tm_replace_howdy_values', $values); 25 update_option('tm_replace_howdy_save', esc_attr($save_data)); 26 } elseif(isset($_POST['tm_replace_howdy_form_defaults'])) { 27 // Clear settings in DB, we are resetting 28 delete_option('tm_replace_howdy_mode'); 29 delete_option('tm_replace_howdy_values'); 30 delete_option('tm_replace_howdy_save'); 31 // Clear out variables 32 $mode = ''; 33 $values = array('', array()); 34 $save_data = ''; 35 } 36 // Set quick variables 37 $selected = ' selected="selected"'; 38 $checked = ' checked="checked"'; 39 ?><div class="wrap"> 40 <h2><?php _e('Replace Howdy Settings'); ?></h2> 41 <p><?php _e('For explanations of each mode and other helpful tips, click on "Help" in the upper right corner of this page.'); ?></p> 42 <form method="post" action=""> 43 <p> 44 <label for="tm_rh_mode"><?php _e('Operating Mode:'); ?></label> 45 <br/> 46 <select name="tm_rh_mode" id="tm_rh_mode"> 47 <option value="normal"<?php if($mode && $mode == 'normal') echo $selected; ?>><?php _e('Normal'); ?></option> 48 <option value="pooper"<?php if($mode && $mode == 'pooper') echo $selected; ?>><?php _e('Professional'); ?></option> 49 <option value="custom"<?php if($mode && $mode == 'custom') echo $selected; ?>><?php _e('Custom (see below)'); ?></option> 50 </select> 51 </p> 52 <p> 53 <label for="tm_rh_list"><?php _e('Custom word list (custom mode only, separate items with semi-colons(;))'); ?>:</label> 54 <br/> 55 <textarea name="tm_rh_list" rows="5" cols="30" id="tm_rh_list"><?php if(isset($values[1]) && is_array($values[1])) echo stripslashes(implode(';', array_diff($values[1], $this->tm_howdy_fun))); ?></textarea> 56 </p> 57 <p> 58 <label for="tm_rh_custom"><?php _e('Custom mode options (custom mode only)'); ?>:</label> 59 <br/> 60 <select name="tm_rh_custom" id="tm_rh_custom"> 61 <option value="custom_plus"<?php if(isset($values[0]) && $values[0] == 'custom_plus') echo $selected; ?>><?php _e('Custom list + our list'); ?></option> 62 <option value="custom_only"<?php if(isset($values[0]) && $values[0] == 'custom_only') echo $selected; ?>><?php _e('Custom list only'); ?></option> 63 </select> 64 </p> 65 <p> 66 <input type="checkbox" name="tm_rh_save" id="tm_rh_save" value="delete"<?php if($save_data == 'delete') echo $checked; ?> /> 67 <label for="tm_rh_save"><?php _e('Delete all plugin settings when deactivated'); ?></label> 68 </p> 69 <p class="submit"> 70 <input type="submit" class="button-primary" name="tm_replace_howdy_form" value="<?php _e('Save Settings'); ?>" /> 71 <input type="submit" class="button-primary" name="tm_replace_howdy_form_defaults" value="<?php _e('Reset to Defaults'); ?>" /> 72 </p> 73 </form> 38 74 </div> -
tm-replace-howdy/tags/1.3/readme.txt
r465373 r469914 3 3 Contributors URI: http://www.orderofbusiness.net/micah-wood/ 4 4 Plugin Name: TM Replace Howdy 5 Plugin URI: http://technicalmastermind.com/ wordpress-plugins/replace-howdy/5 Plugin URI: http://technicalmastermind.com/plugins/tm-replace-howdy/ 6 6 Tags: howdy, replace howdy, remove howdy, technical mastermind, replace, remove, kill howdy, no howdy, rip howdy 7 7 Author URI: http://iamdavidwood.com/ … … 10 10 Requires at least: 3.0 11 11 Tested up to: 3.3 12 Stable tag: 1. 213 Version: 1. 212 Stable tag: 1.3 13 Version: 1.3 14 14 15 15 == Description == 16 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)! 16 The Replace Howdy Plugin is designed to replace the word "Howdy" in the WordPress admin area/admin bar 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)! 17 18 = List of replacement words/phrases = 19 Professional greetings, also part of the default list 20 21 * Hello, 22 * Bonjour, 23 * Greetings, 24 * Aloha, 25 * Chow, 26 * Welcome, 27 * Konnichiwa, 28 29 Default list 30 31 * Get to the choppa, 32 * Looking good today, 33 * Wipe that grin off your face, 34 * There is a ninja behind you, 35 * Don't read this directly or you will get a lazy eye, 36 * I can see you right now, 37 * I know you are sitting at a computer, 38 * I can hear you breathing, 39 * Did you put on clean underwear this morning, 40 * Don't make me come down there, 41 * Did you remember to brush your teeth, 42 * Do you know what time it is, 43 * Eat all your vegetables, 44 * You just gained +5 WordPress skills, 45 * Have you showered recently, 46 * Wassap, 47 * We require a shrubbery, 48 * Don't mind me, 49 * Pay no attention to the man behind the curtain, 17 50 18 51 == Installation == 19 52 1. Upload the entire 'tm-replace-howdy' folder and its contents to the '/wp-content/plugins/' directory 20 53 2. Activate the plugin through the 'Plugins' menu in WordPress 21 3. (Optional) You may edit plugin settings through the 'Replace Howdy' menu option under 'Settings' 22 4. You're done! No more "Howdy"! 54 3. You're done! No more "Howdy"! 55 4. (Optional) You may edit plugin settings through the 'Replace Howdy' menu option under 'Settings' for more customization 56 23 57 NOTE: Replace Howdy relies on JavaScript to replace "Howdy" with a different word or phrase. If "Howdy" is not being replaced, please first check that JavaScript is enabled. 24 58 25 59 == Upgrade Notice == 60 = 1.3 = 61 Further updated for WordPress 3.3 compatibility and updated core functionality to be more secure and efficient. 26 62 = 1.2 = 27 63 * Updated plugin to be compatible with WP 3.3 … … 36 72 == Screenshots == 37 73 38 1. The WordPress backend without the"Howdy"74 1. WordPress without "Howdy" 39 75 40 76 == Changelog == 77 = 1.3 = 78 * Further updated for WordPress 3.3 compatibility 79 * Updated core functionality to be more secure and efficient 80 * Merged the static and custom modes into the custom mode 81 * Made "custom" mode more robust in handling user input 41 82 = 1.2 = 42 83 * Updated plugin to be compatible with WP 3.3 … … 55 96 56 97 == Frequently Asked Questions == 57 = Does this make the WordPress backend load slower? =58 I t shouldn't. I have tested it on several systems and have noticed little to no difference in load times. Any heavy lifting is done after saving any changes on the settings page.98 = Why do I sometimes still see the word "Howdy"? = 99 If it goes away when the page is done loading, it is a restriction of having to use JavaScript to replace it. If it remains after the page is done loading it is either an issue with your web browser, a bug in the program or a version of WordPress older than 3.0. -
tm-replace-howdy/trunk/index.php
r465373 r469914 2 2 /* 3 3 Plugin Name: TM Replace Howdy 4 Plugin URI: http://technicalmastermind.com/ wordpress-plugins/replace-howdy/4 Plugin URI: http://technicalmastermind.com/plugins/tm-replace-howdy/ 5 5 Description: 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)! 6 6 Author: David Wood 7 Version: 1. 27 Version: 1.3 8 8 Author URI: http://iamdavidwood.com/ 9 9 Contributors: Micah Wood … … 23 23 24 24 define('TM_REPLACE_HOWDY_URL', plugins_url('', __FILE__)); 25 define('TM_REPLACE_HOWDY_PATH', dirname(__FILE__)); 25 26 26 27 class tm_replace_howdy { 27 private $techm_howdy_fun = array( // Array containing standard greetings 28 'Hello', 29 'Bonjour', 30 'Greetings', 31 'Aloha', 32 'Chow', 33 'Welcome', 34 'Konichiwa', 35 'Get to the choppa', 36 'Looking good today', 37 'Wipe that grin off your face', 38 'There is a ninja behind you', 39 'Don\'t read this directly or you will get a lazy eye', 40 'I can see you right now', 41 'I know you are sitting at a computer', 42 'I can hear you breathing', 43 'Did you put on clean underwear this morning', 44 'Don\'t make me come down there', 45 'Did you remember to brush your teeth', 46 'Do you know what time it is', 47 'Eat all your vegetables', 48 'You just gained +5 WordPress skills', 49 'Have you showered recently', 50 'Wassap', 51 'We require a shrubbery', 52 ), 53 $techm_howdy_pooper = array( // Array containing "proper" greetings 54 'Hello', 55 'Bonjour', 56 'Greetings', 57 'Aloha', 58 'Chow', 59 'Welcome', 60 'Konichiwa', 61 ), $tm_help; 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')); 28 private $version = '1.3', 29 $tm_howdy_fun = array( // Array containing standard greetings 30 'Hello', 31 'Bonjour', 32 'Greetings', 33 'Aloha', 34 'Chow', 35 'Welcome', 36 'Konnichiwa', 37 'Get to the choppa', 38 'Looking good today', 39 'Wipe that grin off your face', 40 'There is a ninja behind you', 41 'Don\'t read this directly or you will get a lazy eye', 42 'I can see you right now', 43 'I know you are sitting at a computer', 44 'I can hear you breathing', 45 'Did you put on clean underwear this morning', 46 'Don\'t make me come down there', 47 'Did you remember to brush your teeth', 48 'Do you know what time it is', 49 'Eat all your vegetables', 50 'You just gained +5 WordPress skills', 51 'Have you showered recently', 52 'Wassap', 53 'We require a shrubbery', 54 'Don\'t mind me', 55 'Pay no attention to the man behind the curtain', 56 ), 57 $tm_howdy_pooper = array( // Array containing "proper" greetings 58 'Hello', 59 'Bonjour', 60 'Greetings', 61 'Aloha', 62 'Chow', 63 'Welcome', 64 'Konnichiwa', 65 ), 66 $tm_help; 71 67 72 $techm_replace_howdy = get_option('techm_replace_howdy_values'); // Get options from DB if they exist 73 if(is_array($techm_replace_howdy)) $values = $techm_replace_howdy; // Values stored in DB, use them 74 else $values = $this->techm_howdy_fun; // No values in DB, use default. 75 $no_howdy = $values[rand(0,count($values)-1)]; // Get a random item from the array 68 function tm_replace_howdy() { 69 // Check if an upgrade needs to be performed 70 if(get_option('tm_replace_howdy_ver') != $this->version) $this->upgrade(); 76 71 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)); 85 } 86 function techm_replace_howdy_start() { 87 $this->tm_help = add_submenu_page('options-general.php', 'Replace Howdy Settings', 'Replace Howdy', 'manage_options', 'techm_replace_howdy', array(&$this, 'techm_replace_howdy_options')); // Add sub-menu under settings 88 } 89 function techm_replace_howdy_help() { 90 $help = '<h2>Explanation of modes</h2> 91 <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> 92 93 <p><b>Party Pooper Mode:</b> This mode is here because I realize that while many people enjoy random and exciting words/phrases to replace their "Howdy" with, many people (and businesses) prefer a more professional approach. Because of this, this mode only contains business appropriate greetings such as "Hello", "Aloha" and "Konichiwa". The full list can be viewed on <a href="http://technicalmastermind.com/">TechnicalMastermind.com</a></p> 94 95 <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> 96 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> 98 <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> 99 <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> 100 <p><b>NOTE 2:</b> If you have and questions, comments, feedback or suggestions please contact me via <a href="http://technicalmastermind.com/" target="_blank">TechnicalMastermind.com</a>. Thanks for using my plugin!</p>'; 101 add_contextual_help($this->tm_help, $help); 102 } 103 function techm_replace_howdy_options() { 104 if (!current_user_can('manage_options')) wp_die( __('You do not have sufficient permissions to access this page.') ); 105 if(isset($_POST['techm_submitted_form']) && $_POST['techm_submitted_form'] == 'Save Settings') { // Process form 106 $new_values = array('mode' => 'normal', 107 'static' => '', 108 'custom' => '', 109 'custom_mode' => 'custom_plus', 110 ); // Lists defaults 111 if(isset($_POST['techm_replace_howdy']) && is_array($_POST['techm_replace_howdy']) && count($_POST['techm_replace_howdy']) > 0) 112 $new_values = $_POST['techm_replace_howdy']; 113 $techm_replace_howdy = $new_values; 114 update_option( 'techm_replace_howdy', $new_values ); 115 if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] != '') { 116 switch($techm_replace_howdy['mode']) { 117 case 'pooper': $techm_values_array = $this->techm_howdy_pooper; 118 break; // Mode is pooper, set the values array to equal array of "Proper Greetings" 119 case 'static': if(isset($techm_replace_howdy['static']) && $techm_replace_howdy['static'] != '') $techm_values_array = array($techm_replace_howdy['static']); 120 break; // Only one thing, create array with only one element. 121 case 'custom': if(isset($techm_replace_howdy['custom']) && $techm_replace_howdy['custom'] != '') { 122 if(isset($techm_replace_howdy['custom_mode']) && $techm_replace_howdy['custom_mode'] == 'custom_plus') 123 $techm_values_array = $this->techm_howdy_fun; 124 else $techm_values_array = array(); 125 $tmp_values = explode('|', $techm_replace_howdy['custom']); 126 foreach($tmp_values as $value) $techm_values_array[] = $value; 127 } break; // Using custom list, merge lists if needed 128 default: $techm_values_array = $this->techm_howdy_fun; 129 break; // Using the regular list 130 } 131 } 132 update_option('techm_replace_howdy_values', $techm_values_array); // Store the list for use! 133 echo '<div class="updated"><p><strong>'. __('Settings Saved!') .'</strong></p></div>'; // Let the user know what happened! 134 } 135 elseif(isset($_POST['techm_submitted_form_defaults']) && $_POST['techm_submitted_form_defaults'] == 'Reset to Defaults') { 136 $new_values = array('mode' => 'normal', 137 'static' => '', 138 'custom' => '', 139 'custom_mode' => 'custom_plus', 140 ); // Lists defaults 141 $techm_replace_howdy = $new_values; 142 update_option('techm_replace_howdy', $new_values); // Set the settings to the default 143 delete_option('techm_replace_howdy_values', ''); // Clear the saved lists, it will now use the default 144 echo '<div class="updated"><p><strong>'. __('Settings Reset to Default!') .'</strong></p></div>'; 145 } 146 require(dirname(__FILE__) . '/techm_options.php'); // Display the form 147 } 72 // Call function to replace howdy 73 $this->replace_howdy(); 74 75 // Add admin menus 76 if(is_admin()) { // Only runs if this is an admin page 77 add_action('admin_menu', array(&$this, 'add_admin_page')); // Call function to add admin options menu 78 add_action('admin_init', array(&$this, 'options_help')); 79 } 80 81 // Register deactivation hook 82 register_deactivation_hook(__FILE__, array($this, 'deactivation')); 83 } 84 85 function replace_howdy() { 86 // Get current WP version 87 global $wp_version; 88 // Find out what version is in use and register the appropriate script 89 if(preg_match('/^3\.[3-9]/', $wp_version)) // Version 3.3.x+ 90 wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_3.js', array('jquery')); 91 elseif(preg_match('/^3\.2/', $wp_version)) // Version 3.2.x 92 wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_2.js', array('jquery')); 93 elseif(preg_match('/^3\.[1|0]/', $wp_version)) // Version 3.0.x - 3.1.x 94 wp_register_script('tm_replace_howdy', TM_REPLACE_HOWDY_URL.'/js/tm-replace-howdy-3_1.js', array('jquery')); 95 // Enqueue script when appropriate 96 if(is_admin()) add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); 97 elseif(preg_match('/^3\.[1-2|0]/', $wp_version)) $x = 1; // Doing nothing if version is before 3.3 and not admin area 98 else add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); 99 } 100 101 function enqueue_scripts() { 102 // Get what mode we are in 103 $mode = get_option('tm_replace_howdy_mode'); 104 switch($mode) { 105 case 'pooper': // We are in a non-custom mode, use list already in PHP 106 $values = $this->tm_howdy_pooper; 107 break; 108 case 'custom': // We are in a custom mode, get list from DB 109 $options = get_option('tm_replace_howdy_values'); 110 if(is_array($options) && is_array($options[1])) $values = $options[1]; 111 // Fallback if something is wrong with the list from the DB 112 else $values = $this->tm_howdy_fun; 113 break; 114 default: // Fallback and regular mode, use list already in PHP 115 $values = $this->tm_howdy_fun; 116 }; 117 // Get our random value from the array 118 $no_howdy = stripslashes($values[rand(0,count($values)-1)]); 119 // Enqueue our script and give access to the howdy replacement 120 wp_enqueue_script('tm_replace_howdy'); 121 wp_localize_script('tm_replace_howdy', 'tmReplaceHowdy', array('noHowdy' => $no_howdy)); 122 } 123 124 function add_admin_page() { 125 // Add sub-menu under settings 126 $this->tm_help = add_options_page('Replace Howdy Settings', 'Replace Howdy', 'manage_options', 'tm_replace_howdy', array(&$this, 'options_page')); 127 } 128 129 function options_page() { 130 // Check that the user has permission to be on this page 131 if(!current_user_can('manage_options')) 132 wp_die( __('You do not have sufficient permissions to access this page.') ); 133 // Include our file to handle saving of options and displaying of options form 134 require(TM_REPLACE_HOWDY_PATH.'/options.php'); 135 } 136 137 function options_help() { 138 $help = '<h2>Explanation of modes</h2> 139 <p><strong>Normal Mode:</strong> "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/plugins/tm-replace-howdy/">TechnicalMastermind.com</a></p> 140 141 <p><strong>Professional Mode:</strong> This mode is here because I realize that while many people enjoy random and exciting words/phrases to replace their "Howdy" with, many people (and businesses) prefer a more professional approach. Because of this, this mode only contains business appropriate greetings such as "Hello", "Aloha" and "Konnichiwa". The full list can be viewed on <a href="http://technicalmastermind.com/plugins/tm-replace-howdy/">TechnicalMastermind.com</a></p> 142 143 <p><strong>Custom Mode:</strong> This mode is for people that like to be unique, want to add an item or two to the list, or simply want it to always same the same thing. 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 directly below the backspace key.</p> 144 145 <p><strong>Custom Mode Options:</strong> 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> 146 147 <p><strong>NOTE:</strong> For custom defined text, know that ", <username>" is appended to the end of each item when displayed. So no ending commas(,)!</p>'; 148 add_contextual_help($this->tm_help, $help); 149 } 150 151 function upgrade() { 152 // Check for signs of previous versions 153 $old_options = get_option('techm_replace_howdy'); 154 $old_list = get_option('techm_replace_howdy_values'); 155 if($old_options) { 156 if($old_options['mode'] == 'static') $mode = 'custom'; 157 else $mode = $old_options['mode']; 158 // Remove old options from DB 159 delete_option('techm_replace_howdy'); 160 // Add new options to DB 161 update_option('tm_replace_howdy_mode', $mode); 162 } 163 if(is_array($old_list)) { 164 $values = array('custom_plus', array()); 165 $values[1] = array_diff($old_list, $this->tm_howdy_fun); 166 update_option('tm_replace_howdy_values', $values); 167 delete_option('techm_replace_howdy_values'); 168 } 169 // Store new version number 170 update_option('tm_replace_howdy_ver', $this->version); 171 } 172 173 function deactivation() { 174 $save_data = get_option('tm_replace_howdy_save'); 175 if($save_data == 'delete') { 176 // Delete all saved data 177 delete_option('tm_replace_howdy_mode'); 178 delete_option('tm_replace_howdy_values'); 179 delete_option('tm_replace_howdy_save'); 180 delete_option('tm_replace_howdy_ver'); 181 } 182 } 148 183 } 149 184 new tm_replace_howdy; -
tm-replace-howdy/trunk/js/tm-replace-howdy-3_3.js
r465373 r469914 1 1 jQuery(document).ready(function($) { 2 $('#wp-admin-bar-my-account > a > span').html(3 $('#wp-admin-bar-my-account > a > span')2 $('#wp-admin-bar-my-account > a').html( 3 $('#wp-admin-bar-my-account > a') 4 4 .html() 5 5 .replace(/Howdy/,tmReplaceHowdy.noHowdy)); -
tm-replace-howdy/trunk/options.php
r465326 r469914 1 <div class="wrap"> 2 <h2><?php _e('TM Replace Howdy Settings'); ?></h2> 1 <?php 2 // Get settings from DB 3 $mode = get_option('tm_replace_howdy_mode'); 4 $values = get_option('tm_replace_howdy_values'); 5 $save_data = get_option('tm_replace_howdy_save'); 6 if(isset($_POST['tm_replace_howdy_form'])) { 7 // Update settings in DB, we are saving 8 if($_POST['tm_rh_mode']) $mode = $_POST['tm_rh_mode']; 9 if($_POST['tm_rh_list']) { 10 $list = explode(';', $_POST['tm_rh_list']); 11 $tmp = array(); 12 foreach($list as $item) { 13 $test = esc_attr(trim($item)); 14 if(!empty($test)) // Clears out any blank items from the array 15 $tmp[] = $test; 16 } 17 $values[1] = $tmp; 18 } 19 if($_POST['tm_rh_custom']) $values[0] = esc_attr($_POST['tm_rh_custom']); 20 if($_POST['tm_rh_save']) $save_data = $_POST['tm_rh_save']; 21 if($values[0] == 'custom_plus') $values[1] = array_merge($values[1], $this->tm_howdy_fun); 22 // Update options in DB 23 update_option('tm_replace_howdy_mode', esc_attr($mode)); 24 update_option('tm_replace_howdy_values', $values); 25 update_option('tm_replace_howdy_save', esc_attr($save_data)); 26 } elseif(isset($_POST['tm_replace_howdy_form_defaults'])) { 27 // Clear settings in DB, we are resetting 28 delete_option('tm_replace_howdy_mode'); 29 delete_option('tm_replace_howdy_values'); 30 delete_option('tm_replace_howdy_save'); 31 // Clear out variables 32 $mode = ''; 33 $values = array('', array()); 34 $save_data = ''; 35 } 36 // Set quick variables 37 $selected = ' selected="selected"'; 38 $checked = ' checked="checked"'; 39 ?><div class="wrap"> 40 <h2><?php _e('Replace Howdy Settings'); ?></h2> 41 <p><?php _e('For explanations of each mode and other helpful tips, click on "Help" in the upper right corner of this page.'); ?></p> 3 42 <form method="post" action=""> 4 <table class="form-table"> 5 <tr valign="top"> 6 <th scope="row"><?php _e('Operating Mode:'); ?></th> 7 <td><select name="techm_replace_howdy[mode]"> 8 <option value="normal" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'normal') echo 'selected'; ?> ><?php _e('Normal'); ?></option> 9 <option value="pooper" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'pooper') echo 'selected'; ?> ><?php _e('Party Pooper Mode'); ?></option> 10 <option value="static" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'static') echo 'selected'; ?> ><?php _e('Static Mode'); ?></option> 11 <option value="custom" <?php if(isset($techm_replace_howdy['mode']) && $techm_replace_howdy['mode'] == 'custom') echo 'selected'; ?> ><?php _e('Custom (see below)'); ?></option> 12 </select> 13 </td> 14 </tr> 15 <tr> 16 <th scope="row"><?php _e('Static replacement word (static mode only)'); ?>:</th> 17 <td><input type="text" name="techm_replace_howdy[static]" value="<?php if(isset($techm_replace_howdy['static'])) echo $techm_replace_howdy['static']; ?>" /></td> 18 </tr> 19 <tr valign="top"> 20 <th scope="row"><?php _e('Custom word list (custom mode only, use "greeting 1|greeting 2|greeting 3" format)'); ?></th> 21 <td> 22 <textarea name="techm_replace_howdy[custom]" rows="5" cols="30"><?php if(isset($techm_replace_howdy['custom'])) echo $techm_replace_howdy['custom']; ?></textarea> 23 </td> 24 </tr> 25 <tr> 26 <th scope="row"><?php _e('Custom mode options (custom mode only)'); ?>:</th> 27 <td><select name="techm_replace_howdy[custom_mode]"> 28 <option value="custom_plus" <?php if(isset($techm_replace_howdy['custom_mode']) && $techm_replace_howdy['custom_mode'] == 'custom_plus') echo 'selected'; ?> ><?php _e('Custom list + our list'); ?></option> 29 <option value="custom_only" <?php if(isset($techm_replace_howdy['custom_mode']) && $techm_replace_howdy['custom_mode'] == 'custom_only') echo 'selected'; ?> ><?php _e('Custom list only'); ?></option> 30 </select> 31 </td> 32 </tr> 33 </table> 43 <p> 44 <label for="tm_rh_mode"><?php _e('Operating Mode:'); ?></label> 45 <br/> 46 <select name="tm_rh_mode" id="tm_rh_mode"> 47 <option value="normal"<?php if($mode && $mode == 'normal') echo $selected; ?>><?php _e('Normal'); ?></option> 48 <option value="pooper"<?php if($mode && $mode == 'pooper') echo $selected; ?>><?php _e('Professional'); ?></option> 49 <option value="custom"<?php if($mode && $mode == 'custom') echo $selected; ?>><?php _e('Custom (see below)'); ?></option> 50 </select> 51 </p> 52 <p> 53 <label for="tm_rh_list"><?php _e('Custom word list (custom mode only, separate items with semi-colons(;))'); ?>:</label> 54 <br/> 55 <textarea name="tm_rh_list" rows="5" cols="30" id="tm_rh_list"><?php if(isset($values[1]) && is_array($values[1])) echo stripslashes(implode(';', array_diff($values[1], $this->tm_howdy_fun))); ?></textarea> 56 </p> 57 <p> 58 <label for="tm_rh_custom"><?php _e('Custom mode options (custom mode only)'); ?>:</label> 59 <br/> 60 <select name="tm_rh_custom" id="tm_rh_custom"> 61 <option value="custom_plus"<?php if(isset($values[0]) && $values[0] == 'custom_plus') echo $selected; ?>><?php _e('Custom list + our list'); ?></option> 62 <option value="custom_only"<?php if(isset($values[0]) && $values[0] == 'custom_only') echo $selected; ?>><?php _e('Custom list only'); ?></option> 63 </select> 64 </p> 65 <p> 66 <input type="checkbox" name="tm_rh_save" id="tm_rh_save" value="delete"<?php if($save_data == 'delete') echo $checked; ?> /> 67 <label for="tm_rh_save"><?php _e('Delete all plugin settings when deactivated'); ?></label> 68 </p> 34 69 <p class="submit"> 35 <input type="submit" class="button-primary" name="techm_submitted_form" value="<?php _e('Save Settings'); ?>" /> <input type="submit" class="button-primary" name="techm_submitted_form_defaults" value="<?php _e('Reset to Defaults'); ?>" /> 70 <input type="submit" class="button-primary" name="tm_replace_howdy_form" value="<?php _e('Save Settings'); ?>" /> 71 <input type="submit" class="button-primary" name="tm_replace_howdy_form_defaults" value="<?php _e('Reset to Defaults'); ?>" /> 36 72 </p> 37 73 </form> -
tm-replace-howdy/trunk/readme.txt
r465373 r469914 3 3 Contributors URI: http://www.orderofbusiness.net/micah-wood/ 4 4 Plugin Name: TM Replace Howdy 5 Plugin URI: http://technicalmastermind.com/ wordpress-plugins/replace-howdy/5 Plugin URI: http://technicalmastermind.com/plugins/tm-replace-howdy/ 6 6 Tags: howdy, replace howdy, remove howdy, technical mastermind, replace, remove, kill howdy, no howdy, rip howdy 7 7 Author URI: http://iamdavidwood.com/ … … 10 10 Requires at least: 3.0 11 11 Tested up to: 3.3 12 Stable tag: 1. 213 Version: 1. 212 Stable tag: 1.3 13 Version: 1.3 14 14 15 15 == Description == 16 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)! 16 The Replace Howdy Plugin is designed to replace the word "Howdy" in the WordPress admin area/admin bar 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)! 17 18 = List of replacement words/phrases = 19 Professional greetings, also part of the default list 20 21 * Hello, 22 * Bonjour, 23 * Greetings, 24 * Aloha, 25 * Chow, 26 * Welcome, 27 * Konnichiwa, 28 29 Default list 30 31 * Get to the choppa, 32 * Looking good today, 33 * Wipe that grin off your face, 34 * There is a ninja behind you, 35 * Don't read this directly or you will get a lazy eye, 36 * I can see you right now, 37 * I know you are sitting at a computer, 38 * I can hear you breathing, 39 * Did you put on clean underwear this morning, 40 * Don't make me come down there, 41 * Did you remember to brush your teeth, 42 * Do you know what time it is, 43 * Eat all your vegetables, 44 * You just gained +5 WordPress skills, 45 * Have you showered recently, 46 * Wassap, 47 * We require a shrubbery, 48 * Don't mind me, 49 * Pay no attention to the man behind the curtain, 17 50 18 51 == Installation == 19 52 1. Upload the entire 'tm-replace-howdy' folder and its contents to the '/wp-content/plugins/' directory 20 53 2. Activate the plugin through the 'Plugins' menu in WordPress 21 3. (Optional) You may edit plugin settings through the 'Replace Howdy' menu option under 'Settings' 22 4. You're done! No more "Howdy"! 54 3. You're done! No more "Howdy"! 55 4. (Optional) You may edit plugin settings through the 'Replace Howdy' menu option under 'Settings' for more customization 56 23 57 NOTE: Replace Howdy relies on JavaScript to replace "Howdy" with a different word or phrase. If "Howdy" is not being replaced, please first check that JavaScript is enabled. 24 58 25 59 == Upgrade Notice == 60 = 1.3 = 61 Further updated for WordPress 3.3 compatibility and updated core functionality to be more secure and efficient. 26 62 = 1.2 = 27 63 * Updated plugin to be compatible with WP 3.3 … … 36 72 == Screenshots == 37 73 38 1. The WordPress backend without the"Howdy"74 1. WordPress without "Howdy" 39 75 40 76 == Changelog == 77 = 1.3 = 78 * Further updated for WordPress 3.3 compatibility 79 * Updated core functionality to be more secure and efficient 80 * Merged the static and custom modes into the custom mode 81 * Made "custom" mode more robust in handling user input 41 82 = 1.2 = 42 83 * Updated plugin to be compatible with WP 3.3 … … 55 96 56 97 == Frequently Asked Questions == 57 = Does this make the WordPress backend load slower? =58 I t shouldn't. I have tested it on several systems and have noticed little to no difference in load times. Any heavy lifting is done after saving any changes on the settings page.98 = Why do I sometimes still see the word "Howdy"? = 99 If it goes away when the page is done loading, it is a restriction of having to use JavaScript to replace it. If it remains after the page is done loading it is either an issue with your web browser, a bug in the program or a version of WordPress older than 3.0.
Note: See TracChangeset
for help on using the changeset viewer.