Changeset 1823985
- Timestamp:
- 02/17/2018 10:06:02 PM (8 years ago)
- Location:
- options-framework
- Files:
-
- 42 added
- 7 edited
-
tags/1.8.6 (added)
-
tags/1.8.6/css (added)
-
tags/1.8.6/css/optionsframework.css (added)
-
tags/1.8.6/images (added)
-
tags/1.8.6/images/ico-delete.png (added)
-
tags/1.8.6/includes (added)
-
tags/1.8.6/includes/class-options-framework-admin.php (added)
-
tags/1.8.6/includes/class-options-framework.php (added)
-
tags/1.8.6/includes/class-options-interface.php (added)
-
tags/1.8.6/includes/class-options-media-uploader.php (added)
-
tags/1.8.6/includes/class-options-sanitization.php (added)
-
tags/1.8.6/js (added)
-
tags/1.8.6/js/media-uploader.js (added)
-
tags/1.8.6/js/options-custom.js (added)
-
tags/1.8.6/languages (added)
-
tags/1.8.6/languages/options-framework-da_DK.mo (added)
-
tags/1.8.6/languages/options-framework-da_DK.po (added)
-
tags/1.8.6/languages/options-framework-es_ES.mo (added)
-
tags/1.8.6/languages/options-framework-es_ES.po (added)
-
tags/1.8.6/languages/options-framework-fa_IR.mo (added)
-
tags/1.8.6/languages/options-framework-fa_IR.po (added)
-
tags/1.8.6/languages/options-framework-fr_FR.mo (added)
-
tags/1.8.6/languages/options-framework-fr_FR.po (added)
-
tags/1.8.6/languages/options-framework-hu_HU.po (added)
-
tags/1.8.6/languages/options-framework-id_ID.mo (added)
-
tags/1.8.6/languages/options-framework-id_ID.po (added)
-
tags/1.8.6/languages/options-framework-it_IT.mo (added)
-
tags/1.8.6/languages/options-framework-it_IT.po (added)
-
tags/1.8.6/languages/options-framework-pt_BR.mo (added)
-
tags/1.8.6/languages/options-framework-pt_BR.po (added)
-
tags/1.8.6/languages/options-framework-pt_PT.mo (added)
-
tags/1.8.6/languages/options-framework-pt_PT.po (added)
-
tags/1.8.6/languages/options-framework-ru_RU.mo (added)
-
tags/1.8.6/languages/options-framework-ru_RU.po (added)
-
tags/1.8.6/languages/options-framework-sv_SE.mo (added)
-
tags/1.8.6/languages/options-framework-sv_SE.po (added)
-
tags/1.8.6/languages/options-framework-zh_CN.mo (added)
-
tags/1.8.6/languages/options-framework-zh_CN.po (added)
-
tags/1.8.6/languages/options-framework.pot (added)
-
tags/1.8.6/options-framework.php (added)
-
tags/1.8.6/readme.txt (added)
-
tags/1.8.6/screenshot-1.png (added)
-
trunk/includes/class-options-framework-admin.php (modified) (12 diffs)
-
trunk/includes/class-options-framework.php (modified) (4 diffs)
-
trunk/includes/class-options-interface.php (modified) (2 diffs)
-
trunk/includes/class-options-media-uploader.php (modified) (2 diffs)
-
trunk/includes/class-options-sanitization.php (modified) (3 diffs)
-
trunk/options-framework.php (modified) (1 diff)
-
trunk/readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
options-framework/trunk/includes/class-options-framework-admin.php
r1329200 r1823985 11 11 12 12 /** 13 * Page hook for the options screen14 *15 * @since 1.7.016 * @type string17 */18 protected $options_screen = null;19 20 /**21 * Hook in the scripts and styles22 *23 * @since 1.7.024 */25 public function init() {13 * Page hook for the options screen 14 * 15 * @since 1.7.0 16 * @type string 17 */ 18 protected $options_screen = null; 19 20 /** 21 * Hook in the scripts and styles 22 * 23 * @since 1.7.0 24 */ 25 public function init() { 26 26 27 27 // Gets options to load 28 $options = & Options_Framework::_optionsframework_options();28 $options = & Options_Framework::_optionsframework_options(); 29 29 30 30 // Checks if options are available 31 if ( $options ) {31 if ( $options ) { 32 32 33 33 // Add the options page and menu item. … … 50 50 } 51 51 52 }53 54 /** 55 * Let's the user know that options aren't available for their theme56 */57 function options_notice() {52 } 53 54 /** 55 * Let's the user know that options aren't available for their theme 56 */ 57 function options_notice() { 58 58 global $pagenow; 59 if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {59 if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) { 60 60 global $current_user ; 61 61 $user_id = $current_user->ID; … … 65 65 echo "</p></div>"; 66 66 } 67 }68 } 69 70 /** 71 * Allows the user to hide the options notice72 */67 } 68 } 69 70 /** 71 * Allows the user to hide the options notice 72 */ 73 73 function options_notice_ignore() { 74 74 global $current_user; … … 80 80 81 81 /** 82 * Registers the settings83 *84 * @since 1.7.085 */86 function settings_init() {87 88 // Load Options Framework Settings89 $optionsframework_settings = get_option( 'optionsframework' );82 * Registers the settings 83 * 84 * @since 1.7.0 85 */ 86 function settings_init() { 87 88 // Load Options Framework Settings 89 $optionsframework_settings = get_option( 'optionsframework' ); 90 90 91 91 // Registers the settings fields and callback … … 95 95 add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) ); 96 96 97 }97 } 98 98 99 99 /* … … 116 116 117 117 // Modes: submenu, menu 118 'mode' => 'submenu',119 120 // Submenu default settings121 'page_title' => __( 'Theme Options', 'options-framework'),118 'mode' => 'submenu', 119 120 // Submenu default settings 121 'page_title' => __( 'Theme Options', 'options-framework'), 122 122 'menu_title' => __('Theme Options', 'options-framework'), 123 123 'capability' => 'edit_theme_options', 124 124 'menu_slug' => 'options-framework', 125 'parent_slug' => 'themes.php',126 127 // Menu default settings128 'icon_url' => 'dashicons-admin-generic',129 'position' => '61'125 'parent_slug' => 'themes.php', 126 127 // Menu default settings 128 'icon_url' => 'dashicons-admin-generic', 129 'position' => '61' 130 130 131 131 ); … … 135 135 136 136 /** 137 * Add a subpage called "Theme Options" to the appearance menu.138 *139 * @since 1.7.0140 */137 * Add a subpage called "Theme Options" to the appearance menu. 138 * 139 * @since 1.7.0 140 */ 141 141 function add_custom_options_page() { 142 142 143 143 $menu = $this->menu_settings(); 144 144 145 switch( $menu['mode'] ) {146 147 case 'menu':148 // http://codex.wordpress.org/Function_Reference/add_menu_page149 $this->options_screen = add_menu_page(150 $menu['page_title'],151 $menu['menu_title'],152 $menu['capability'],153 $menu['menu_slug'],154 array( $this, 'options_page' ),155 $menu['icon_url'],156 $menu['position']157 );158 break;159 160 default:161 // http://codex.wordpress.org/Function_Reference/add_submenu_page162 $this->options_screen = add_submenu_page(163 $menu['parent_slug'],164 $menu['page_title'],165 $menu['menu_title'],166 $menu['capability'],167 $menu['menu_slug'],168 array( $this, 'options_page' ) );169 break;170 }171 } 172 173 /** 174 * Loads the required stylesheets175 *176 * @since 1.7.0177 */145 switch( $menu['mode'] ) { 146 147 case 'menu': 148 // http://codex.wordpress.org/Function_Reference/add_menu_page 149 $this->options_screen = add_menu_page( 150 $menu['page_title'], 151 $menu['menu_title'], 152 $menu['capability'], 153 $menu['menu_slug'], 154 array( $this, 'options_page' ), 155 $menu['icon_url'], 156 $menu['position'] 157 ); 158 break; 159 160 default: 161 // http://codex.wordpress.org/Function_Reference/add_submenu_page 162 $this->options_screen = add_submenu_page( 163 $menu['parent_slug'], 164 $menu['page_title'], 165 $menu['menu_title'], 166 $menu['capability'], 167 $menu['menu_slug'], 168 array( $this, 'options_page' ) ); 169 break; 170 } 171 } 172 173 /** 174 * Loads the required stylesheets 175 * 176 * @since 1.7.0 177 */ 178 178 function enqueue_admin_styles( $hook ) { 179 179 180 if ( $this->options_screen != $hook ) 181 return; 182 183 wp_enqueue_style( 'optionsframework', plugin_dir_url( dirname(__FILE__) ) . 'css/optionsframework.css', array(), Options_Framework::VERSION ); 180 if ( $this->options_screen != $hook ) { 181 return; 182 } 183 184 wp_enqueue_style( 185 'optionsframework', 186 plugin_dir_url( dirname(__FILE__) ) . 'css/optionsframework.css', 187 array(), 188 Options_Framework::VERSION 189 ); 184 190 wp_enqueue_style( 'wp-color-picker' ); 185 191 } 186 192 187 193 /** 188 * Loads the required javascript189 *190 * @since 1.7.0191 */194 * Loads the required javascript 195 * 196 * @since 1.7.0 197 */ 192 198 function enqueue_admin_scripts( $hook ) { 193 199 194 if ( $this->options_screen != $hook ) 195 return; 200 if ( $this->options_screen != $hook ) { 201 return; 202 } 196 203 197 204 // Enqueue custom option panel JS 198 wp_enqueue_script( 'options-custom', plugin_dir_url( dirname(__FILE__) ) . 'js/options-custom.js', array( 'jquery','wp-color-picker' ), Options_Framework::VERSION ); 205 wp_enqueue_script( 206 'options-custom', 207 plugin_dir_url( dirname(__FILE__) ) . 'js/options-custom.js', 208 array( 'jquery','wp-color-picker' ), 209 Options_Framework::VERSION 210 ); 199 211 200 212 // Inline scripts from options-interface.php … … 208 220 209 221 /** 210 * Builds out the options panel.211 *222 * Builds out the options panel. 223 * 212 224 * If we were using the Settings API as it was intended we would use 213 225 * do_settings_sections here. But as we don't want the settings wrapped in a table, … … 217 229 * Nonces are provided using the settings_fields() 218 230 * 219 * @since 1.7.0220 */231 * @since 1.7.0 232 */ 221 233 function options_page() { ?> 222 234 … … 226 238 <h2><?php echo esc_html( $menu['page_title'] ); ?></h2> 227 239 228 <h2 class="nav-tab-wrapper">229 <?php echo Options_Framework_Interface::optionsframework_tabs(); ?>230 </h2>231 232 <?php settings_errors( 'options-framework' ); ?>233 234 <div id="optionsframework-metabox" class="metabox-holder">235 <div id="optionsframework" class="postbox">240 <h2 class="nav-tab-wrapper"> 241 <?php echo Options_Framework_Interface::optionsframework_tabs(); ?> 242 </h2> 243 244 <?php settings_errors( 'options-framework' ); ?> 245 246 <div id="optionsframework-metabox" class="metabox-holder"> 247 <div id="optionsframework" class="postbox"> 236 248 <form action="options.php" method="post"> 237 249 <?php settings_fields( 'optionsframework' ); ?> … … 270 282 271 283 if ( isset( $_POST['reset'] ) ) { 272 add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'options-framework' ), 'updated fade' ); 284 add_settings_error( 285 'options-framework', 286 'restore_defaults', 287 __( 'Default options restored.', 'options-framework' ), 288 'updated fade' 289 ); 273 290 return $this->get_default_values(); 274 291 } … … 324 341 325 342 function save_options_notice() { 326 add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'options-framework' ), 'updated fade' ); 343 add_settings_error( 344 'options-framework', 345 'save_options', 346 __( 'Options saved.', 'options-framework' ), 347 'updated fade' 348 ); 327 349 } 328 350 -
options-framework/trunk/includes/class-options-framework.php
r1329200 r1823985 16 16 * @type string 17 17 */ 18 const VERSION = '1.8. 5';18 const VERSION = '1.8.6'; 19 19 20 20 /** … … 38 38 39 39 // Load settings 40 $optionsframework_settings = get_option( 'optionsframework' );40 $optionsframework_settings = get_option( 'optionsframework' ); 41 41 42 // Updates the unique option id in the database if it has changed43 if ( function_exists( 'optionsframework_option_name' ) ) {42 // Updates the unique option id in the database if it has changed 43 if ( function_exists( 'optionsframework_option_name' ) ) { 44 44 optionsframework_option_name(); 45 }46 elseif ( has_action( 'optionsframework_option_name' ) ) {45 } 46 elseif ( has_action( 'optionsframework_option_name' ) ) { 47 47 do_action( 'optionsframework_option_name' ); 48 }49 // If the developer hasn't explicitly set an option id, we'll use a default50 else {51 $default_themename = get_option( 'stylesheet' );52 $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );53 $default_themename = 'optionsframework_' . $default_themename;54 if ( isset( $optionsframework_settings['id'] ) ) {48 } 49 // If the developer hasn't explicitly set an option id, we'll use a default 50 else { 51 $default_themename = get_option( 'stylesheet' ); 52 $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) ); 53 $default_themename = 'optionsframework_' . $default_themename; 54 if ( isset( $optionsframework_settings['id'] ) ) { 55 55 if ( $optionsframework_settings['id'] == $default_themename ) { 56 56 // All good, using default theme id … … 59 59 update_option( 'optionsframework', $optionsframework_settings ); 60 60 } 61 }62 else {61 } 62 else { 63 63 $optionsframework_settings['id'] = $default_themename; 64 64 update_option( 'optionsframework', $optionsframework_settings ); 65 }66 }65 } 66 } 67 67 68 68 } … … 101 101 static $options = null; 102 102 103 if ( ! $options ) {104 // Load options from options.php file (if it exists)105 $location = apply_filters( 'options_framework_location', array('options.php') );106 if ( $optionsfile = locate_template( $location ) ) {107 $maybe_options = require_once $optionsfile;108 if ( is_array( $maybe_options ) ) {103 if ( ! $options ) { 104 // Load options from options.php file (if it exists) 105 $location = apply_filters( 'options_framework_location', array( 'options.php' ) ); 106 if ( $optionsfile = locate_template( $location ) ) { 107 $maybe_options = require_once $optionsfile; 108 if ( is_array( $maybe_options ) ) { 109 109 $options = $maybe_options; 110 } else if ( function_exists( 'optionsframework_options' ) ) {110 } else if ( function_exists( 'optionsframework_options' ) ) { 111 111 $options = optionsframework_options(); 112 112 } 113 }113 } 114 114 115 // Allow setting/manipulating options via filters116 $options = apply_filters( 'of_options', $options );115 // Allow setting/manipulating options via filters 116 $options = apply_filters( 'of_options', $options ); 117 117 } 118 118 -
options-framework/trunk/includes/class-options-interface.php
r1329200 r1823985 95 95 // If the option is already saved, override $val 96 96 if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) { 97 if ( isset( $settings[ ($value['id'])]) ) {98 $val = $settings[ ($value['id'])];97 if ( isset( $settings[$value['id']]) ) { 98 $val = $settings[$value['id']]; 99 99 // Striping slashes of non-array options 100 if ( ! is_array($val) ) {100 if ( ! is_array( $val ) ) { 101 101 $val = stripslashes( $val ); 102 102 } … … 246 246 $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][size]' ) . '" id="' . esc_attr( $value['id'] . '_size' ) . '">'; 247 247 $sizes = $typography_options['sizes']; 248 foreach ( $sizes as $ i) {249 $size = $ i. 'px';248 foreach ( $sizes as $size ) { 249 $size = $size . 'px'; 250 250 $font_size .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>'; 251 251 } -
options-framework/trunk/includes/class-options-media-uploader.php
r1329200 r1823985 61 61 $class = ' has-file'; 62 62 } 63 63 64 $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'options-framework') .'" />' . "\n"; 64 65 if ( function_exists( 'wp_enqueue_media' ) ) { … … 108 109 $menu = Options_Framework_Admin::menu_settings(); 109 110 110 if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] ) 111 return; 111 if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] ) { 112 return; 113 } 112 114 113 if ( function_exists( 'wp_enqueue_media' ) ) 115 if ( function_exists( 'wp_enqueue_media' ) ) { 114 116 wp_enqueue_media(); 117 } 115 118 116 wp_register_script( 'of-media-uploader', plugin_dir_url( dirname(__FILE__) ) .'js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION ); 119 wp_register_script( 120 'of-media-uploader', 121 plugin_dir_url( dirname(__FILE__) ) .'js/media-uploader.js', 122 array( 'jquery' ), 123 Options_Framework::VERSION 124 ); 125 117 126 wp_enqueue_script( 'of-media-uploader' ); 118 127 wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array( -
options-framework/trunk/includes/class-options-sanitization.php
r1329200 r1823985 64 64 function of_sanitize_checkbox( $input ) { 65 65 if ( $input ) { 66 $output = '1'; 67 } else { 68 $output = false; 69 } 70 return $output; 66 return '1'; 67 } 68 return false; 71 69 } 72 70 add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' ); … … 79 77 */ 80 78 function of_sanitize_multicheck( $input, $option ) { 81 $output = '';79 $output = array(); 82 80 if ( is_array( $input ) ) { 83 81 foreach( $option['options'] as $key => $value ) { … … 279 277 return $value; 280 278 } 281 return apply_filters( 'of_default_font_size', $recognized);279 return apply_filters( 'of_default_font_size', current( $recognized ) ); 282 280 } 283 281 add_filter( 'of_font_size', 'of_sanitize_font_size' ); -
options-framework/trunk/options-framework.php
r1329200 r1823985 13 13 * Plugin URI: http://wptheming.com 14 14 * Description: A framework for building theme options. 15 * Version: 1.8. 515 * Version: 1.8.6 16 16 * Author: Devin Price 17 17 * Author URI: http://wptheming.com -
options-framework/trunk/readme.txt
r1756401 r1823985 5 5 Donate link: http://bit.ly/options-donate-2 6 6 Requires at least: 3.6 7 Tested up to: 4. 8.37 Tested up to: 4.9.4 8 8 Stable tag: 1.8.5 9 9 License: GPLv2 … … 30 30 = Learn More = 31 31 32 Please visit [http ://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin) for a full description of how to define and use the theme options.32 Please visit [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin) for a full description of how to define and use the theme options. 33 33 34 34 == Installation == … … 36 36 If your theme already has options enabled, they will show up under the appearance menu. 37 37 38 If your theme doesn't have options, you can define them to options.php of your theme and they will instantly show up. For more on how to do this, visit [http ://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin).38 If your theme doesn't have options, you can define them to options.php of your theme and they will instantly show up. For more on how to do this, visit [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin). 39 39 40 40 == Frequently Asked Questions == … … 46 46 The "Options Check" theme is a blueprint for how to work with options. It includes an example of every option available in the panel and sample output in the theme. 47 47 48 You can also watch the video screencast I have at [http ://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin).48 You can also watch the video screencast I have at [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin). 49 49 50 50 = What options are available to use? = … … 69 69 == Changelog == 70 70 71 = 1.8.6 = 72 73 * Fix: of_sanitize_multicheck should return an array 74 * Fix: Typography size should returns a string rather than array 75 * Fix: Fix isset notices in custom typography field for Options Check 76 71 77 = 1.8.5 = 72 78 … … 220 226 * Changes how checkboxes saved in database ("0" or "1") 221 227 * Stores typography, backgrounds and multichecks directly as arrays 222 * For full description, see: http ://wptheming.com/2011/05/options-framework-0-6/228 * For full description, see: https://wptheming.com/2011/05/options-framework-0-6/ 223 229 224 230 = 0.5.0 =
Note: See TracChangeset
for help on using the changeset viewer.