Changeset 336399
- Timestamp:
- 01/24/2011 05:23:12 AM (15 years ago)
- Location:
- wp-category-manager/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (1 diff)
-
wp-category-manager.php (modified) (9 diffs)
-
wpcm-options.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-category-manager/trunk/readme.txt
r293641 r336399 39 39 == Changelog == 40 40 41 = 2.0.0.2 = 42 * Checks for compatible version of PHP before allowing plugin to be activated. 43 * Better cleanup on plugin deactivation. (Also means loss of settings on deactivation) 44 41 45 = 2.0.0.1 = 42 46 * Minor Patch to stop loading of JS & CSS files outside the Admin section -
wp-category-manager/trunk/wp-category-manager.php
r293641 r336399 35 35 { 36 36 var $plugin_url; 37 37 38 38 function CategoryManager() 39 39 { … … 50 50 } 51 51 } 52 53 function add_dashboard_widgets() 52 53 function add_dashboard_widgets() 54 54 { 55 55 if(wpcm_options::get_option('OnDashboard') == 'on' && (function_exists('current_user_can') ? current_user_can('edit_posts') : true) ) … … 59 59 , array(&$this, 'dashboard_widget_render_function')); 60 60 } 61 } 62 63 function dashboard_widget_render_function() 61 } 62 63 function dashboard_widget_render_function() 64 64 { 65 65 $term = wpcm_options::get_option('defaultTerm'); 66 66 $postlist = wpcm_functions::get_posts($term, 0); 67 67 68 68 69 69 if(wpcm_options::get_option('enableDropdown') == 'on') … … 75 75 echo '<div class="catmanheader" style="display:none;">'; 76 76 } 77 77 78 78 echo '<span class="catmanpostcount"></span>'; 79 79 echo '<span class="catmanselection">'; … … 81 81 echo '</span>'; 82 82 echo '</div>'; 83 83 84 84 85 85 echo '<div id="catmanpostlist" class="list:catmanpost" >'; … … 100 100 echo '<span class="catmannextPage"><a href="javascript:void(0);">[Next]</a></span>'; 101 101 echo '</div>'; 102 } 103 102 } 103 104 104 // Set up default values 105 function install() 106 { 107 wpcm_options::get_options(); 105 function install() 106 { 107 if (version_compare(PHP_VERSION, '5.0.0', '<') ) 108 { 109 exit("Sorry, this version of WP-Category-Manager will only run on PHP version 5 or greater!\n"); 110 } 111 wpcm_options::set_options(); 112 } 113 114 // Uninstall the options set for this plugin 115 function uninstall() 116 { 117 wpcm_options::delete_options(); 108 118 } 109 119 … … 207 217 echo '</div>'; 208 218 } 209 219 210 220 function admin_menu() 211 221 { 212 222 add_options_page('Category Manager Options', 'Category Manager', 8, basename(__FILE__), array('wpcm_options', 'render_option_settings')); 213 223 } 214 224 215 225 function print_scripts() 216 226 { 217 227 $nonce = wp_create_nonce("wp-category-manager"); 218 228 219 229 wp_enqueue_script('jquery'); 220 230 wp_enqueue_script('categoryManager_script', $this->plugin_url . 'wp-category-manager.js', array('jquery')); … … 227 237 , 'showConfirm' => wpcm_options::get_option('showConfirm') 228 238 ,'nonce' => $nonce)); 229 230 } 231 239 240 } 241 232 242 function print_styles() 233 243 { … … 237 247 } 238 248 239 endif; 249 endif; 240 250 241 251 if ( class_exists('CategoryManager') ) : 242 252 243 253 $categoryManager = new CategoryManager(); 244 254 if (isset($categoryManager)) { 245 255 register_activation_hook( __FILE__, array(&$categoryManager, 'install') ); 246 } 247 256 register_deactivation_hook(__FILE__, array(&$categoryManager, 'uninstall') ); 257 } 258 248 259 endif; 249 260 -
wp-category-manager/trunk/wpcm-options.php
r293639 r336399 1 1 <?php 2 /* 2 /* 3 3 * This class acts as the interface to the wordpress options table and is used to get and set the option values 4 * for the current plugin. 5 * It is a simple wrapper around the WordPress Options API such that it abstracts out the maintenance 6 * of a single options array for a given plugin. 7 * ToDo : refactor the class such as the options array maintained by this class is defined by the 8 * plugin using this class. Right now it is hardcoded to maintain the specific options array 9 * associated with the category manager. 4 10 */ 5 11 if ( !class_exists('wpcm_options') ) : … … 8 14 { 9 15 private static $db_option = 'CategoryManager_options'; 10 16 11 17 // handle the settings/options page 12 18 public static function render_option_settings() 13 19 { 14 $options = self:: get_options();20 $options = self::set_options(); 15 21 16 22 if( isset($_POST['submitted'])) … … 49 55 50 56 // Save/Update the options from the DB 51 public static function get_options()57 public static function set_options() 52 58 { 53 59 $options = array … … 79 85 } 80 86 87 // Retrieve the value of a specific option from the plugin's option set 81 88 public static function get_option($optionName) 82 89 { 83 $options = self:: get_options();90 $options = self::set_options(); 84 91 85 92 return $options[$optionName]; 86 93 } 87 94 95 // removes any option entries associated with the plugin from the options table 96 public static function delete_options() 97 { 98 delete_option(self::$db_option); 99 } 88 100 } 89 101 endif;
Note: See TracChangeset
for help on using the changeset viewer.