Changeset 1379486
- Timestamp:
- 03/26/2016 05:34:53 PM (10 years ago)
- Location:
- wp-options-editor/trunk
- Files:
-
- 3 edited
-
admin/manager-page.php (modified) (19 diffs)
-
readme.txt (modified) (4 diffs)
-
wp-options-editor.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-options-editor/trunk/admin/manager-page.php
r1010131 r1379486 2 2 defined( 'ABSPATH' ) OR exit; 3 3 4 /** 5 * Options Manager Settings Page 6 * 7 * This class declares & creates the settings page that runs the manager. All 8 * PHP work including AJAX callbacks, page display, and various functionality 9 * are currently housed in this class. 10 * 11 * @category WordPress 12 * @author Mike Selander 13 * @since Class available since Release 1.0 14 */ 4 15 class OptionsManagerSettingsPage { 16 17 /** 18 * dir 19 * Directory path that this file is in 20 * 21 * @var string 22 * @access private 23 */ 5 24 private $dir; 25 26 /** 27 * file 28 * Parent file that calls this class. 29 * 30 * @var string 31 * @access private 32 */ 6 33 private $file; 34 35 /** 36 * assets_dir 37 * Directory path housing the plugin assets. 38 * 39 * @var string 40 * @access private 41 */ 7 42 private $assets_dir; 43 44 /** 45 * assets_url 46 * Directory URL housing the plugin assets. 47 * 48 * @var string 49 * @access private 50 */ 8 51 private $assets_url; 52 53 /** 54 * settings_base 55 * Base ID slug for any options created. 56 * 57 * @var string 58 * @access private 59 */ 9 60 private $settings_base; 61 62 /** 63 * settings 64 * Settings base if created. 65 * 66 * @var string 67 * @access private 68 */ 10 69 private $settings; 70 71 /** 72 * wp_vital_options 73 * Array of options that are vital to WP working and cannot be deleted. 74 * 75 * @var array 76 * @access private 77 */ 11 78 private $wp_vital_options; 79 80 /** 81 * wp_default_options 82 * Array of options that are created by Wp core, but not vital. 83 * 84 * @var array 85 * @access private 86 */ 12 87 private $wp_default_options; 13 88 89 /** 90 * Constructor functon. 91 * 92 * @param string $file File path of declaring parent file. 93 */ 14 94 public function __construct( $file ) { 15 $this->file = $file; 16 $this->dir = dirname( $this->file ); 17 $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; 18 $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) ); 19 $this->settings_base = 'cn_'; 20 $this->wp_vital_options = array( 'siteurl', 'blogname', 'blogdescription', 'users_can_register', 'admin_email', 'start_of_week', 'use_balanceTags', 'use_smilies', 'require_name_email', 'comments_notify', 'posts_per_rss', 'rss_excerpt_length', 'rss_use_excerpt', 'mailserver_url', 'mailserver_login', 'mailserver_pass', 'mailserver_port', 'default_category', 'default_comment_status', 'default_ping_status', 'default_pingback_flag', 'default_post_edit_rows', 'posts_per_page', 'what_to_show', 'date_format', 'time_format', 'links_updated_date_format', 'links_recently_updated_prepend', 'links_recently_updated_append', 'links_recently_updated_time', 'comment_moderation', 'moderation_notify', 'permalink_structure', 'gzipcompression', 'hack_file', 'blog_charset', 'moderation_keys', 'active_plugins', 'home', 'category_base', 'ping_sites', 'advanced_edit', 'comment_max_links', 'gmt_offset', 'default_email_category', 'recently_edited', 'use_linksupdate', 'template', 'stylesheet', 'comment_whitelist', 'blacklist_keys', 'comment_registration', 'open_proxy_check', 'rss_language', 'html_type', 'use_trackback', 'default_role', 'db_version', 'wp_user_roles', 'uploads_use_yearmonth_folders', 'upload_path', 'secret', 'blog_public', 'default_link_category', 'show_on_front', 'default_link_category', 'cron', 'doing_cron', 'sidebars_widgets', 'widget_pages', 'widget_calendar', 'widget_archives', 'widget_meta', 'widget_categories', 'widget_recent_entries', 'widget_text', 'widget_rss', 'widget_recent_comments', 'widget_wholinked', 'widget_polls', 'tag_base', 'page_on_front', 'page_for_posts', 'page_uris', 'page_attachment_uris', 'show_avatars', 'avatar_rating', 'upload_url_path', 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'dashboard_widget_options', 'current_theme', 'auth_salt', 'avatar_default', 'enable_app', 'enable_xmlrpc', 'logged_in_salt', 'recently_activated', 'random_seed', 'large_size_w', 'large_size_h', 'image_default_link_type', 'image_default_size', 'image_default_align', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'use_ssl', 'sticky_posts', 'dismissed_update_core', 'update_themes', 'nonce_salt', 'update_core', 'uninstall_plugins', 'wporg_popular_tags', 'stats_options', 'stats_cache', 'rewrite_rules', 'update_plugins', 'category_children', 'timezone_string', 'can_compress_scripts', 'db_upgraded', 'widget_search', 'default_post_format', 'link_manager_enabled', 'initial_db_version', 'theme_switched' ); 21 $this->wp_default_options = array( '_site_transient_update_core', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', '_site_transient_update_themes', '_site_transient_update_plugins', '_transient_doing_cron', '_transient_plugins_delete_result_1', '_transient_plugin_slugs', '_transient_random_seed', '_transient_rewrite_rules', '_transient_update_core', '_transient_update_plugins', '_transient_update_themes', 'widget_recent-posts', 'widget_recent-comments' ); 95 $this->file = $file; 96 $this->dir = dirname( $this->file ); 97 $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; 98 $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) ); 99 $this->settings_base = 'cn_'; 100 $this->wp_vital_options = array( 101 'siteurl', 102 'blogname', 103 'blogdescription', 104 'users_can_register', 105 'admin_email', 106 'start_of_week', 107 'use_balanceTags', 108 'use_smilies', 109 'require_name_email', 110 'comments_notify', 111 'posts_per_rss', 112 'rss_excerpt_length', 113 'rss_use_excerpt', 114 'mailserver_url', 115 'mailserver_login', 116 'mailserver_pass', 117 'mailserver_port', 118 'default_category', 119 'default_comment_status', 120 'default_ping_status', 121 'default_pingback_flag', 122 'default_post_edit_rows', 123 'posts_per_page', 124 'what_to_show', 125 'date_format', 126 'time_format', 127 'links_updated_date_format', 128 'links_recently_updated_prepend', 129 'links_recently_updated_append', 130 'links_recently_updated_time', 131 'comment_moderation', 132 'moderation_notify', 133 'permalink_structure', 134 'gzipcompression', 135 'hack_file', 136 'blog_charset', 137 'moderation_keys', 138 'active_plugins', 139 'home', 140 'category_base', 141 'ping_sites', 142 'advanced_edit', 143 'comment_max_links', 144 'gmt_offset', 145 'default_email_category', 146 'recently_edited', 147 'use_linksupdate', 148 'template', 149 'stylesheet', 150 'comment_whitelist', 151 'blacklist_keys', 152 'comment_registration', 153 'open_proxy_check', 154 'rss_language', 155 'html_type', 156 'use_trackback', 157 'default_role', 158 'db_version', 159 'wp_user_roles', 160 'uploads_use_yearmonth_folders', 161 'upload_path', 162 'secret', 163 'blog_public', 164 'default_link_category', 165 'show_on_front', 166 'default_link_category', 167 'cron', 168 'doing_cron', 169 'sidebars_widgets', 170 'widget_pages', 171 'widget_calendar', 172 'widget_archives', 173 'widget_meta', 174 'widget_categories', 175 'widget_recent_entries', 176 'widget_text', 177 'widget_rss', 178 'widget_recent_comments', 179 'widget_wholinked', 180 'widget_polls', 181 'tag_base', 182 'page_on_front', 183 'page_for_posts', 184 'page_uris', 185 'page_attachment_uris', 186 'show_avatars', 187 'avatar_rating', 188 'upload_url_path', 189 'thumbnail_size_w', 190 'thumbnail_size_h', 191 'thumbnail_crop', 192 'medium_size_w', 193 'medium_size_h', 194 'dashboard_widget_options', 195 'current_theme', 196 'auth_salt', 197 'avatar_default', 198 'enable_app', 199 'enable_xmlrpc', 200 'logged_in_salt', 201 'recently_activated', 202 'random_seed', 203 'large_size_w', 204 'large_size_h', 205 'image_default_link_type', 206 'image_default_size', 207 'image_default_align', 208 'close_comments_for_old_posts', 209 'close_comments_days_old', 210 'thread_comments', 211 'thread_comments_depth', 212 'page_comments', 213 'comments_per_page', 214 'default_comments_page', 215 'comment_order', 216 'use_ssl', 217 'sticky_posts', 218 'dismissed_update_core', 219 'update_themes', 220 'nonce_salt', 221 'update_core', 222 'uninstall_plugins', 223 'wporg_popular_tags', 224 'stats_options', 225 'stats_cache', 226 'rewrite_rules', 227 'update_plugins', 228 'category_children', 229 'timezone_string', 230 'can_compress_scripts', 231 'db_upgraded', 232 'widget_search', 233 'default_post_format', 234 'link_manager_enabled', 235 'initial_db_version', 236 'theme_switched' 237 ); 238 $this->wp_default_options = array( 239 '_site_transient_update_core', 240 '_site_transient_timeout_theme_roots', 241 '_site_transient_theme_roots', 242 '_site_transient_update_themes', 243 '_site_transient_update_plugins', 244 '_transient_doing_cron', 245 '_transient_plugins_delete_result_1', 246 '_transient_plugin_slugs', 247 '_transient_random_seed', 248 '_transient_rewrite_rules', 249 '_transient_update_core', 250 '_transient_update_plugins', 251 '_transient_update_themes', 252 'widget_recent-posts', 253 'widget_recent-comments' 254 ); 22 255 23 256 add_action( 'admin_menu' , array( $this, 'add_menu_item' ) ); … … 26 259 // Add settings link to plugins page 27 260 add_filter( 'plugin_action_links_' . plugin_basename( $this->file ) , array( $this, 'add_settings_link' ) ); 28 } 29 30 /** 31 * Add settings page to admin menu 32 * @return void 261 262 } 263 264 265 /** 266 * Add settings page to admin menu. 267 * 268 * @see $this->options_assets 33 269 */ 34 270 public function add_menu_item() { 271 35 272 $page = add_submenu_page( 36 273 'tools.php', … … 45 282 add_action('load-'.$page, array( $this, 'manager_delete_options' ) ); 46 283 add_action('load-'.$page, array( $this, 'manager_add_option' ) ); 47 } 48 49 /** 50 * Load settings JS & CSS 51 * @return void 284 285 } 286 287 288 /** 289 * Load settings JS & CSS on our specific admin page 290 * 291 * @see wp_register_script, wp_localize_script, wp_enqueue_style, wp_enqueue_script 52 292 */ 53 293 public function options_assets() { … … 55 295 // We're including the farbtastic script & styles here because they're needed for the colour picker 56 296 wp_register_script( 'comment-notifier-js', $this->assets_url . 'js/manager-list.js', array( 'jquery' ), '1.0.0', true ); 57 wp_localize_script( 'comment-notifier-js', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); 297 wp_localize_script( 298 'comment-notifier-js', 299 'ajax_object', 300 array( 301 'ajax_url' => admin_url( 'admin-ajax.php' ) 302 ) 303 ); 304 58 305 wp_register_style( 'manager-css', $this->assets_url . 'css/manager-css.css', array(), '1', 'all' ); 59 306 … … 63 310 } 64 311 65 /** 66 * Add settings link to plugin list table 312 313 /** 314 * Add settings link to plugin list table. 315 * 67 316 * @param array $links Existing links 68 317 * @return array Modified links 69 318 */ 70 319 public function add_settings_link( $links ) { 320 71 321 $settings_link = '<a href="options-general.php?page=options_editor">' . __( 'Settings', 'options_editor' ) . '</a>'; 72 322 array_push( $links, $settings_link ); 73 323 return $links; 74 } 75 76 /** 77 * Parse for certain sources of options rows and return a specialized icon if applicable 324 325 } 326 327 328 /** 329 * Parse for certain sources of options rows and return a specialized icon 330 * if applicable. 331 * 332 * This function is a basic case evaluator that swaps out an icon for easy 333 * identification of the author of a particular option. The benefit here is 334 * that you can easily see who's adding a bunch of nonsense to your options 335 * table. 336 * 78 337 * @param string $name Name of the option 79 * @return string $htmlString with icon338 * @return string String with icon 80 339 */ 81 340 public function wp_options_source( $name ) { 341 $html = ''; 82 342 83 343 // WP Core … … 99 359 // Gravity Forms 100 360 } else if ( preg_match( '/gform\w{3,}/', $name ) || preg_match( '/gravityform\w{3,}/', $name ) || preg_match( '/rg_form\w{3,}/', $name ) ){ 101 $html .= "<a class=' source-dashicon' title='Gravity Forms option'><img src='".WP_PLUGIN_URL . "/gravityforms/images/gravity-admin-icon.png'></a>";361 $html .= "<a class='dashicons source-dashicon' style='background-image: url(\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMTUgNzcgNTgxIDY0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMTUgNzcgNTgxIDY0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGcgaWQ9IkxheWVyXzIiPjxwYXRoIGZpbGw9IiM5OTkiIGQ9Ik00ODkuNSwyMjdMNDg5LjUsMjI3TDMxNS45LDEyNi44Yy0yMi4xLTEyLjgtNTguNC0xMi44LTgwLjUsMEw2MS44LDIyN2MtMjIuMSwxMi44LTQwLjMsNDQuMi00MC4zLDY5Ljd2MjAwLjVjMCwyNS42LDE4LjEsNTYuOSw0MC4zLDY5LjdsMTczLjYsMTAwLjJjMjIuMSwxMi44LDU4LjQsMTIuOCw4MC41LDBMNDg5LjUsNTY3YzIyLjItMTIuOCw0MC4zLTQ0LjIsNDAuMy02OS43VjI5Ni44QzUyOS44LDI3MS4yLDUxMS43LDIzOS44LDQ4OS41LDIyN3ogTTQwMSwzMDAuNHY1OS4zSDI0MXYtNTkuM0g0MDF6IE0xNjMuMyw0OTAuOWMtMTYuNCwwLTI5LjYtMTMuMy0yOS42LTI5LjZjMC0xNi40LDEzLjMtMjkuNiwyOS42LTI5LjZzMjkuNiwxMy4zLDI5LjYsMjkuNkMxOTIuOSw0NzcuNiwxNzkuNiw0OTAuOSwxNjMuMyw0OTAuOXogTTE2My4zLDM1OS43Yy0xNi40LDAtMjkuNi0xMy4zLTI5LjYtMjkuNnMxMy4zLTI5LjYsMjkuNi0yOS42czI5LjYsMTMuMywyOS42LDI5LjZTMTc5LjYsMzU5LjcsMTYzLjMsMzU5Ljd6IE0yNDEsNDkwLjl2LTU5LjNoMTYwdjU5LjNIMjQxeiIvPjwvZz48L3N2Zz4=\"); background-repeat: no-repeat;' title='Gravity Forms option'></a>"; 102 362 103 363 // iThemes Security … … 105 365 $html .= "<a class='dashicons source-dashicon' style='font-family: ithemes-icons!important; font-size: 1.3em!important;' title='iThemes Security option'></a>"; 106 366 367 // Yoast/WP SEO 368 } else if ( preg_match( '/wpseo\w{3,}/', $name ) ){ 369 $html .= "<a class='dashicons source-dashicon' style='background-image: url(\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIGZpbGw9IiM5OTkiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48Zz48Zz48Zz48Zz48cGF0aCBzdHlsZT0iZmlsbDojOTk5IiBkPSJNMjAzLjYsMzk1YzYuOC0xNy40LDYuOC0zNi42LDAtNTRsLTc5LjQtMjA0aDcwLjlsNDcuNywxNDkuNGw3NC44LTIwNy42SDExNi40Yy00MS44LDAtNzYsMzQuMi03Niw3NlYzNTdjMCw0MS44LDM0LjIsNzYsNzYsNzZIMTczQzE4OSw0MjQuMSwxOTcuNiw0MTAuMywyMDMuNiwzOTV6Ii8+PC9nPjxnPjxwYXRoIHN0eWxlPSJmaWxsOiM5OTkiIGQ9Ik00NzEuNiwxNTQuOGMwLTQxLjgtMzQuMi03Ni03Ni03NmgtM0wyODUuNywzNjVjLTkuNiwyNi43LTE5LjQsNDkuMy0zMC4zLDY4aDIxNi4yVjE1NC44eiIvPjwvZz48L2c+PHBhdGggc3R5bGU9ImZpbGw6Izk5OSIgc3Ryb2tlLXdpZHRoPSIyLjk3NCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMzM4LDEuM2wtOTMuMywyNTkuMWwtNDIuMS0xMzEuOWgtODkuMWw4My44LDIxNS4yYzYsMTUuNSw2LDMyLjUsMCw0OGMtNy40LDE5LTE5LDM3LjMtNTMsNDEuOWwtNy4yLDF2NzZoOC4zYzgxLjcsMCwxMTguOS01Ny4yLDE0OS42LTE0Mi45TDQzMS42LDEuM0gzMzh6IE0yNzkuNCwzNjJjLTMyLjksOTItNjcuNiwxMjguNy0xMjUuNywxMzEuOHYtNDVjMzcuNS03LjUsNTEuMy0zMSw1OS4xLTUxLjFjNy41LTE5LjMsNy41LTQwLjcsMC02MGwtNzUtMTkyLjdoNTIuOGw1My4zLDE2Ni44bDEwNS45LTI5NGg1OC4xTDI3OS40LDM2MnoiLz48L2c+PC9nPjwvc3ZnPg==\"); background-repeat: no-repeat' title='Yoast/WP SEO option'></a>"; 370 107 371 // All others from plugins 108 372 } else { … … 114 378 } 115 379 116 /** 117 * Return a delete button only for non-core options 380 381 /** 382 * Return a delete button only for non-core options. 383 * 118 384 * @param string $name Name of the option 119 * @return string $html String with icon385 * @return string Deletion button 120 386 */ 121 387 public function get_options_delete_button( $name ) { 388 389 // Check that the user is logged in & has proper permissions 390 if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ){ 391 return; 392 } 122 393 123 394 if ( !in_array( $name, $this->wp_vital_options ) ){ … … 127 398 } 128 399 129 /** 130 * Handle deletion of options 131 * @return void 400 401 /** 402 * Handle deletion of options. 403 * 404 * @global object $wpdb WP database object access 132 405 */ 133 406 public function manager_delete_options(){ 134 407 global $wpdb; 135 408 136 if ( $_GET['delete_option']){409 if ( isset( $_GET['delete_option'] ) ){ 137 410 $screen = get_current_screen(); 138 411 139 412 // Check if current screen is My Admin Page 140 if ( $screen->id != 'tools_page_ '.'options_editor' ){413 if ( $screen->id != 'tools_page_options_editor' ){ 141 414 return; 142 415 } 143 416 417 // Check that the user is logged in & has proper permissions 418 if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ){ 419 return; 420 } 421 144 422 // Verify the nonce 145 if ( wp_verify_nonce( $_GET['nonce'], 'wp_options_delete_'.$_GET['delete_option'] ) ){ 146 147 //$where = $wpdb->prepare( "WHERE option_name=%s", $_GET['delete_option'] ); 423 if ( isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'wp_options_delete_'.$_GET['delete_option'] ) ){ 424 148 425 $wpdb->delete( $wpdb->options , array( 'option_name' => $_GET['delete_option'] ), array( '%s' ) ); 149 426 … … 152 429 } 153 430 } 154 } 155 156 /** 157 * Handle addition of options 158 * @return void 431 432 } 433 434 435 /** 436 * Handle addition of options. 437 * 438 * @global object $wpdb WP database object access 159 439 */ 160 440 public function manager_add_option(){ … … 164 444 165 445 // Check if current screen is My Admin Page 166 if ( $screen->id != 'tools_page_ '.'options_editor' ){446 if ( $screen->id != 'tools_page_options_editor' ){ 167 447 return; 168 448 } 169 449 170 if ( wp_verify_nonce( $_POST['add_option_nonce'], 'add_option_nonce' ) ){ 450 // Check that the user is logged in & has proper permissions 451 if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ){ 452 return; 453 } 454 455 if ( isset( $_POST['add_option_nonce'] ) && wp_verify_nonce( $_POST['add_option_nonce'], 'add_option_nonce' ) ){ 171 456 172 457 $wpdb->insert( … … 185 470 } 186 471 187 /** 188 * Quick count of all options in the wp_options table 472 473 /** 474 * Quick count of all options in the wp_options table. 475 * 476 * @global object $wpdb WP database object access 477 * 189 478 * @return string H3 with count of options 190 479 */ … … 192 481 global $wpdb; 193 482 483 // Check that the user is logged in & has proper permissions 484 if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ){ 485 return; 486 } 487 194 488 $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->options" ); 195 489 … … 200 494 } 201 495 202 /** 203 * AJAX function for updating rows 204 * @return string Modified value 205 */ 206 function manager_ajax_update_option_callback() { 207 global $wpdb; // this is how you get access to the database 208 209 $name = $_REQUEST['id']; 210 $value = $_REQUEST['value']; 496 497 /** 498 * AJAX function for updating rows. 499 * 500 * @global object $wpdb WP database object access 501 * 502 * @return string Modified value 503 */ 504 public function manager_ajax_update_option_callback() { 505 global $wpdb; 506 507 // Check that the user is logged in & has proper permissions 508 if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ){ 509 return; 510 } 511 512 $name = $_REQUEST['id']; 513 $value = $_REQUEST['value']; 211 514 212 515 $wpdb->update( … … 224 527 } 225 528 226 /** 227 * A cacheless function for getting all the options 228 * @return array All options from the wp_options table 529 530 /** 531 * A cacheless function for getting all the options. 532 * 533 * @global object $wpdb WP database object access 534 * 535 * @return array All options from the wp_options table 229 536 */ 230 537 public function get_all_options_cacheless(){ … … 241 548 } 242 549 243 /** 244 * Load settings page content245 * @return void550 551 /** 552 * Load settings page content. 246 553 */ 247 554 public function settings_page() { 555 $html = ''; 556 557 // Check that the user is logged in & has proper permissions 558 if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ){ 559 return; 560 } 248 561 249 562 // Build page HTML 250 $html = '<div class="wrap" id="options_editor">' . "\n";251 $html .= '<h2>' . __( 'Manage Options' , 'options_editor' ) . '</h2>' . "\n";563 $html .= '<div class="wrap" id="options_editor">'; 564 $html .= '<h2>' . __( 'Manage Options' , 'options_editor' ) . '</h2>'; 252 565 253 566 $all_options = $this->get_all_options_cacheless(); … … 258 571 259 572 $html .= "<fieldset class='search-options'>"; 260 $html .= "<label> Search Options:</label>";261 $html .= "<input type='text' class='search' placeholder=' Search' />";573 $html .= "<label>".__( 'Live Search', 'options_editor' )." </label>"; 574 $html .= "<input type='text' class='search' placeholder='".__( 'Search', 'options_editor' )."' />"; 262 575 $html .= "</fieldset>"; 263 576 264 $html .= "<a href='javascript:void(0);' class='button-primary add-option'>".__( 'Add Option s', 'options_editor' )."</a>";577 $html .= "<a href='javascript:void(0);' class='button-primary add-option'>".__( 'Add Option', 'options_editor' )."</a>"; 265 578 266 579 $html .= "<form method='POST' action='".admin_url()."tools.php?page=options_editor' class='add-option-form'>"; 267 580 268 $html .= "<h2> Add Option</h2>";581 $html .= "<h2>".__( 'Add Option', 'options_editor' )."</h2>"; 269 582 270 583 $html .= "<table class='form-table'>"; … … 300 613 $html .= "<thead>"; 301 614 302 $html .= "<th scope='col' class='manage-column column-source' style='width:7%;'>".__( ' Source', 'options_editor' )."</th>";615 $html .= "<th scope='col' class='manage-column column-source' style='width:7%;'>".__( 'Author', 'options_editor' )."</th>"; 303 616 $html .= "<th scope='col' class='sort manage-column column-name' data-sort='option-name'>".__( 'Option Name', 'options_editor' )."</th>"; 304 617 $html .= "<th scope='col' class='sort manage-column column-information' data-sort='option-value'>".__( 'Option Data', 'options_editor' )."</th>"; … … 336 649 $html .= "</div>"; 337 650 338 $html .= '</div>' . "\n";651 $html .= "</div>"; 339 652 340 653 echo $html; -
wp-options-editor/trunk/readme.txt
r1156418 r1379486 1 1 === WP Options Editor === 2 2 Contributors: mikeselander 3 Donate link: http ://mikeselander.com3 Donate link: https://mikeselander.com 4 4 Tags: wp_options, development, wp options table, edit, delete, add 5 5 Requires at least: 3.4 6 Tested up to: 4. 2.27 Stable tag: 1. 0.06 Tested up to: 4.4.2 7 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 15 15 WP Options Editor allows you to easily view, edit, delete, and add options in your WP options table. The easy interface allows you to search for a particular option, edit it or delete it all within the same WP admin page. 16 17 Please be careful when using this plugin! You can easily delete an option that is crucial to your site operating. In addition, this plugin does not autocorrect for serialized data. 16 18 17 19 == Installation == … … 28 30 == Upgrade Notice == 29 31 32 = 1.0.1 = 33 Cleanup Release 34 * Fixed all WP_DEBUG-triggered errors 35 * General code audit/cleanup 36 * Fixed GF con & added Yoast SEO icon 37 * Fixed wording in search & replace sections 38 30 39 = 1.0.0 = 31 40 Initial Release … … 33 42 == Changelog == 34 43 44 = 1.0.1 = 45 Cleanup Release 46 * Fixed all WP_DEBUG-triggered errors 47 * General code audit/cleanup 48 * Fixed GF con & added Yoast SEO icon 49 * Fixed wording in search & replace sections 50 35 51 = 1.0.0 = 36 52 * Initial release -
wp-options-editor/trunk/wp-options-editor.php
r1010131 r1379486 5 5 Description: More easily view, edit, add, and delete all of your WP Options from the dashboard 6 6 Author: Mike Selander 7 Version: 1. 07 Version: 1.1 8 8 Author URI: http://www.mikeselander.com/ 9 9 */ … … 18 18 19 19 // define the plugin url 20 if ( ! defined('WPOE_URL') ){21 define( 'WPOE_URL', plugins_url( '' , __FILE__ ) );20 if ( ! defined( 'WPOE_URL' ) ){ 21 define( 'WPOE_URL', plugins_url( '' , __FILE__ ) ); 22 22 } 23 ?>
Note: See TracChangeset
for help on using the changeset viewer.