Options Framework - Version 1.8.6

Version Description

  • Fix: of_sanitize_multicheck should return an array
  • Fix: Typography size should returns a string rather than array
  • Fix: Fix isset notices in custom typography field for Options Check
Download this release

Release Info

Developer downstairsdev
Plugin Icon wp plugin Options Framework
Version 1.8.6
Comparing to
See all releases

Code changes from version 1.8.5 to 1.8.6

includes/class-options-framework-admin.php CHANGED
@@ -10,25 +10,25 @@
10
  class Options_Framework_Admin {
11
 
12
  /**
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
 
27
  // Gets options to load
28
- $options = & Options_Framework::_optionsframework_options();
29
 
30
  // Checks if options are available
31
- if ( $options ) {
32
 
33
  // Add the options page and menu item.
34
  add_action( 'admin_menu', array( $this, 'add_custom_options_page' ) );
@@ -49,14 +49,14 @@ class Options_Framework_Admin {
49
  add_action( 'admin_init', array( $this, 'options_notice_ignore' ) );
50
  }
51
 
52
- }
53
 
54
  /**
55
- * Let's the user know that options aren't available for their theme
56
- */
57
- function options_notice() {
58
  global $pagenow;
59
- if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {
60
  global $current_user ;
61
  $user_id = $current_user->ID;
62
  if ( ! get_user_meta($user_id, 'optionsframework_ignore_notice') ) {
@@ -64,12 +64,12 @@ class Options_Framework_Admin {
64
  printf( __('Your current theme does not have support for the Options Framework plugin. <a href="%1$s" target="_blank">Learn More</a> | <a href="%2$s">Hide Notice</a>', 'options-framework' ), 'http://wptheming.com/options-framework-plugin', '?optionsframework_nag_ignore=0');
65
  echo "</p></div>";
66
  }
67
- }
68
  }
69
 
70
  /**
71
- * Allows the user to hide the options notice
72
- */
73
  function options_notice_ignore() {
74
  global $current_user;
75
  $user_id = $current_user->ID;
@@ -79,14 +79,14 @@ class Options_Framework_Admin {
79
  }
80
 
81
  /**
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
 
91
  // Registers the settings fields and callback
92
  register_setting( 'optionsframework', $optionsframework_settings['id'], array ( $this, 'validate_options' ) );
@@ -94,7 +94,7 @@ class Options_Framework_Admin {
94
  // Displays notice after options save
95
  add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) );
96
 
97
- }
98
 
99
  /*
100
  * Define menu options (still limited to appearance section)
@@ -115,18 +115,18 @@ class Options_Framework_Admin {
115
  $menu = array(
116
 
117
  // Modes: submenu, menu
118
- 'mode' => 'submenu',
119
 
120
- // Submenu default settings
121
- 'page_title' => __( 'Theme Options', 'options-framework'),
122
  'menu_title' => __('Theme Options', 'options-framework'),
123
  'capability' => 'edit_theme_options',
124
  'menu_slug' => 'options-framework',
125
- 'parent_slug' => 'themes.php',
126
 
127
- // Menu default settings
128
- 'icon_url' => 'dashicons-admin-generic',
129
- 'position' => '61'
130
 
131
  );
132
 
@@ -134,68 +134,80 @@ class Options_Framework_Admin {
134
  }
135
 
136
  /**
137
- * Add a subpage called "Theme Options" to the appearance menu.
138
- *
139
- * @since 1.7.0
140
- */
141
  function add_custom_options_page() {
142
 
143
  $menu = $this->menu_settings();
144
 
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
  function enqueue_admin_styles( $hook ) {
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 );
 
 
 
 
 
184
  wp_enqueue_style( 'wp-color-picker' );
185
  }
186
 
187
  /**
188
- * Loads the required javascript
189
- *
190
- * @since 1.7.0
191
- */
192
  function enqueue_admin_scripts( $hook ) {
193
 
194
- if ( $this->options_screen != $hook )
195
- return;
 
196
 
197
  // 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 );
 
 
 
 
 
199
 
200
  // Inline scripts from options-interface.php
201
  add_action( 'admin_head', array( $this, 'of_admin_head' ) );
@@ -207,8 +219,8 @@ class Options_Framework_Admin {
207
  }
208
 
209
  /**
210
- * Builds out the options panel.
211
- *
212
  * If we were using the Settings API as it was intended we would use
213
  * do_settings_sections here. But as we don't want the settings wrapped in a table,
214
  * we'll call our own custom optionsframework_fields. See options-interface.php
@@ -216,8 +228,8 @@ class Options_Framework_Admin {
216
  *
217
  * Nonces are provided using the settings_fields()
218
  *
219
- * @since 1.7.0
220
- */
221
  function options_page() { ?>
222
 
223
  <div id="optionsframework-wrap" class="wrap">
@@ -225,14 +237,14 @@ class Options_Framework_Admin {
225
  <?php $menu = $this->menu_settings(); ?>
226
  <h2><?php echo esc_html( $menu['page_title'] ); ?></h2>
227
 
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">
236
  <form action="options.php" method="post">
237
  <?php settings_fields( 'optionsframework' ); ?>
238
  <?php Options_Framework_Interface::optionsframework_fields(); /* Settings */ ?>
@@ -269,7 +281,12 @@ class Options_Framework_Admin {
269
  */
270
 
271
  if ( isset( $_POST['reset'] ) ) {
272
- add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'options-framework' ), 'updated fade' );
 
 
 
 
 
273
  return $this->get_default_values();
274
  }
275
 
@@ -323,7 +340,12 @@ class Options_Framework_Admin {
323
  */
324
 
325
  function save_options_notice() {
326
- add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'options-framework' ), 'updated fade' );
 
 
 
 
 
327
  }
328
 
329
  /**
@@ -385,4 +407,4 @@ class Options_Framework_Admin {
385
  $wp_admin_bar->add_menu( apply_filters( 'optionsframework_admin_bar', $args ) );
386
  }
387
 
388
- }
10
  class Options_Framework_Admin {
11
 
12
  /**
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
 
27
  // Gets options to load
28
+ $options = & Options_Framework::_optionsframework_options();
29
 
30
  // Checks if options are available
31
+ if ( $options ) {
32
 
33
  // Add the options page and menu item.
34
  add_action( 'admin_menu', array( $this, 'add_custom_options_page' ) );
49
  add_action( 'admin_init', array( $this, 'options_notice_ignore' ) );
50
  }
51
 
52
+ }
53
 
54
  /**
55
+ * Let's the user know that options aren't available for their theme
56
+ */
57
+ function options_notice() {
58
  global $pagenow;
59
+ if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {
60
  global $current_user ;
61
  $user_id = $current_user->ID;
62
  if ( ! get_user_meta($user_id, 'optionsframework_ignore_notice') ) {
64
  printf( __('Your current theme does not have support for the Options Framework plugin. <a href="%1$s" target="_blank">Learn More</a> | <a href="%2$s">Hide Notice</a>', 'options-framework' ), 'http://wptheming.com/options-framework-plugin', '?optionsframework_nag_ignore=0');
65
  echo "</p></div>";
66
  }
67
+ }
68
  }
69
 
70
  /**
71
+ * Allows the user to hide the options notice
72
+ */
73
  function options_notice_ignore() {
74
  global $current_user;
75
  $user_id = $current_user->ID;
79
  }
80
 
81
  /**
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
 
91
  // Registers the settings fields and callback
92
  register_setting( 'optionsframework', $optionsframework_settings['id'], array ( $this, 'validate_options' ) );
94
  // Displays notice after options save
95
  add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) );
96
 
97
+ }
98
 
99
  /*
100
  * Define menu options (still limited to appearance section)
115
  $menu = array(
116
 
117
  // Modes: submenu, menu
118
+ 'mode' => 'submenu',
119
 
120
+ // Submenu default settings
121
+ 'page_title' => __( 'Theme Options', 'options-framework'),
122
  'menu_title' => __('Theme Options', 'options-framework'),
123
  'capability' => 'edit_theme_options',
124
  'menu_slug' => 'options-framework',
125
+ 'parent_slug' => 'themes.php',
126
 
127
+ // Menu default settings
128
+ 'icon_url' => 'dashicons-admin-generic',
129
+ 'position' => '61'
130
 
131
  );
132
 
134
  }
135
 
136
  /**
137
+ * Add a subpage called "Theme Options" to the appearance menu.
138
+ *
139
+ * @since 1.7.0
140
+ */
141
  function add_custom_options_page() {
142
 
143
  $menu = $this->menu_settings();
144
 
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
  function enqueue_admin_styles( $hook ) {
179
 
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
+ );
190
  wp_enqueue_style( 'wp-color-picker' );
191
  }
192
 
193
  /**
194
+ * Loads the required javascript
195
+ *
196
+ * @since 1.7.0
197
+ */
198
  function enqueue_admin_scripts( $hook ) {
199
 
200
+ if ( $this->options_screen != $hook ) {
201
+ return;
202
+ }
203
 
204
  // Enqueue custom option panel JS
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
+ );
211
 
212
  // Inline scripts from options-interface.php
213
  add_action( 'admin_head', array( $this, 'of_admin_head' ) );
219
  }
220
 
221
  /**
222
+ * Builds out the options panel.
223
+ *
224
  * If we were using the Settings API as it was intended we would use
225
  * do_settings_sections here. But as we don't want the settings wrapped in a table,
226
  * we'll call our own custom optionsframework_fields. See options-interface.php
228
  *
229
  * Nonces are provided using the settings_fields()
230
  *
231
+ * @since 1.7.0
232
+ */
233
  function options_page() { ?>
234
 
235
  <div id="optionsframework-wrap" class="wrap">
237
  <?php $menu = $this->menu_settings(); ?>
238
  <h2><?php echo esc_html( $menu['page_title'] ); ?></h2>
239
 
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">
248
  <form action="options.php" method="post">
249
  <?php settings_fields( 'optionsframework' ); ?>
250
  <?php Options_Framework_Interface::optionsframework_fields(); /* Settings */ ?>
281
  */
282
 
283
  if ( isset( $_POST['reset'] ) ) {
284
+ add_settings_error(
285
+ 'options-framework',
286
+ 'restore_defaults',
287
+ __( 'Default options restored.', 'options-framework' ),
288
+ 'updated fade'
289
+ );
290
  return $this->get_default_values();
291
  }
292
 
340
  */
341
 
342
  function save_options_notice() {
343
+ add_settings_error(
344
+ 'options-framework',
345
+ 'save_options',
346
+ __( 'Options saved.', 'options-framework' ),
347
+ 'updated fade'
348
+ );
349
  }
350
 
351
  /**
407
  $wp_admin_bar->add_menu( apply_filters( 'optionsframework_admin_bar', $args ) );
408
  }
409
 
410
+ }
includes/class-options-framework.php CHANGED
@@ -15,7 +15,7 @@ class Options_Framework {
15
  * @since 1.7.0
16
  * @type string
17
  */
18
- const VERSION = '1.8.5';
19
 
20
  /**
21
  * Initialize the plugin.
@@ -37,33 +37,33 @@ class Options_Framework {
37
  function set_theme_option() {
38
 
39
  // Load settings
40
- $optionsframework_settings = get_option( 'optionsframework' );
41
 
42
- // Updates the unique option id in the database if it has changed
43
- if ( function_exists( 'optionsframework_option_name' ) ) {
44
  optionsframework_option_name();
45
- }
46
- elseif ( has_action( 'optionsframework_option_name' ) ) {
47
  do_action( 'optionsframework_option_name' );
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
  if ( $optionsframework_settings['id'] == $default_themename ) {
56
  // All good, using default theme id
57
  } else {
58
  $optionsframework_settings['id'] = $default_themename;
59
  update_option( 'optionsframework', $optionsframework_settings );
60
  }
61
- }
62
- else {
63
  $optionsframework_settings['id'] = $default_themename;
64
  update_option( 'optionsframework', $optionsframework_settings );
65
- }
66
- }
67
 
68
  }
69
 
@@ -100,23 +100,23 @@ class Options_Framework {
100
  static function &_optionsframework_options() {
101
  static $options = null;
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 ) ) {
109
  $options = $maybe_options;
110
- } else if ( function_exists( 'optionsframework_options' ) ) {
111
  $options = optionsframework_options();
112
  }
113
- }
114
 
115
- // Allow setting/manipulating options via filters
116
- $options = apply_filters( 'of_options', $options );
117
  }
118
 
119
  return $options;
120
  }
121
 
122
- }
15
  * @since 1.7.0
16
  * @type string
17
  */
18
+ const VERSION = '1.8.6';
19
 
20
  /**
21
  * Initialize the plugin.
37
  function set_theme_option() {
38
 
39
  // Load settings
40
+ $optionsframework_settings = get_option( 'optionsframework' );
41
 
42
+ // Updates the unique option id in the database if it has changed
43
+ if ( function_exists( 'optionsframework_option_name' ) ) {
44
  optionsframework_option_name();
45
+ }
46
+ elseif ( has_action( 'optionsframework_option_name' ) ) {
47
  do_action( 'optionsframework_option_name' );
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
  if ( $optionsframework_settings['id'] == $default_themename ) {
56
  // All good, using default theme id
57
  } else {
58
  $optionsframework_settings['id'] = $default_themename;
59
  update_option( 'optionsframework', $optionsframework_settings );
60
  }
61
+ }
62
+ else {
63
  $optionsframework_settings['id'] = $default_themename;
64
  update_option( 'optionsframework', $optionsframework_settings );
65
+ }
66
+ }
67
 
68
  }
69
 
100
  static function &_optionsframework_options() {
101
  static $options = null;
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 ) ) {
109
  $options = $maybe_options;
110
+ } else if ( function_exists( 'optionsframework_options' ) ) {
111
  $options = optionsframework_options();
112
  }
113
+ }
114
 
115
+ // Allow setting/manipulating options via filters
116
+ $options = apply_filters( 'of_options', $options );
117
  }
118
 
119
  return $options;
120
  }
121
 
122
+ }
includes/class-options-interface.php CHANGED
@@ -94,10 +94,10 @@ class Options_Framework_Interface {
94
 
95
  // If the option is already saved, override $val
96
  if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) {
97
- if ( isset( $settings[($value['id'])]) ) {
98
- $val = $settings[($value['id'])];
99
  // Striping slashes of non-array options
100
- if ( !is_array($val) ) {
101
  $val = stripslashes( $val );
102
  }
103
  }
@@ -245,8 +245,8 @@ class Options_Framework_Interface {
245
  if ( $typography_options['sizes'] ) {
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
  $sizes = $typography_options['sizes'];
248
- foreach ( $sizes as $i ) {
249
- $size = $i . 'px';
250
  $font_size .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
251
  }
252
  $font_size .= '</select>';
@@ -419,4 +419,4 @@ class Options_Framework_Interface {
419
  }
420
  }
421
 
422
- }
94
 
95
  // If the option is already saved, override $val
96
  if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) {
97
+ if ( isset( $settings[$value['id']]) ) {
98
+ $val = $settings[$value['id']];
99
  // Striping slashes of non-array options
100
+ if ( ! is_array( $val ) ) {
101
  $val = stripslashes( $val );
102
  }
103
  }
245
  if ( $typography_options['sizes'] ) {
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
  $sizes = $typography_options['sizes'];
248
+ foreach ( $sizes as $size ) {
249
+ $size = $size . 'px';
250
  $font_size .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
251
  }
252
  $font_size .= '</select>';
419
  }
420
  }
421
 
422
+ }
includes/class-options-media-uploader.php CHANGED
@@ -60,6 +60,7 @@ class Options_Framework_Media_Uploader {
60
  if ( $value ) {
61
  $class = ' has-file';
62
  }
 
63
  $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'options-framework') .'" />' . "\n";
64
  if ( function_exists( 'wp_enqueue_media' ) ) {
65
  if ( ( $value == '' ) ) {
@@ -107,17 +108,25 @@ class Options_Framework_Media_Uploader {
107
 
108
  $menu = Options_Framework_Admin::menu_settings();
109
 
110
- if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] )
111
- return;
 
112
 
113
- if ( function_exists( 'wp_enqueue_media' ) )
114
  wp_enqueue_media();
 
 
 
 
 
 
 
 
115
 
116
- wp_register_script( 'of-media-uploader', plugin_dir_url( dirname(__FILE__) ) .'js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION );
117
  wp_enqueue_script( 'of-media-uploader' );
118
  wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
119
  'upload' => __( 'Upload', 'options-framework' ),
120
  'remove' => __( 'Remove', 'options-framework' )
121
  ) );
122
  }
123
- }
60
  if ( $value ) {
61
  $class = ' has-file';
62
  }
63
+
64
  $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'options-framework') .'" />' . "\n";
65
  if ( function_exists( 'wp_enqueue_media' ) ) {
66
  if ( ( $value == '' ) ) {
108
 
109
  $menu = Options_Framework_Admin::menu_settings();
110
 
111
+ if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] ) {
112
+ return;
113
+ }
114
 
115
+ if ( function_exists( 'wp_enqueue_media' ) ) {
116
  wp_enqueue_media();
117
+ }
118
+
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
 
 
126
  wp_enqueue_script( 'of-media-uploader' );
127
  wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
128
  'upload' => __( 'Upload', 'options-framework' ),
129
  'remove' => __( 'Remove', 'options-framework' )
130
  ) );
131
  }
132
+ }
includes/class-options-sanitization.php CHANGED
@@ -63,11 +63,9 @@ add_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
63
  */
64
  function of_sanitize_checkbox( $input ) {
65
  if ( $input ) {
66
- $output = '1';
67
- } else {
68
- $output = false;
69
  }
70
- return $output;
71
  }
72
  add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' );
73
 
@@ -78,7 +76,7 @@ add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' );
78
  * @return array of sanitized values ('1' or false)
79
  */
80
  function of_sanitize_multicheck( $input, $option ) {
81
- $output = '';
82
  if ( is_array( $input ) ) {
83
  foreach( $option['options'] as $key => $value ) {
84
  $output[$key] = false;
@@ -278,7 +276,7 @@ function of_sanitize_font_size( $value ) {
278
  if ( in_array( (int) $value_check, $recognized ) ) {
279
  return $value;
280
  }
281
- return apply_filters( 'of_default_font_size', $recognized );
282
  }
283
  add_filter( 'of_font_size', 'of_sanitize_font_size' );
284
 
@@ -451,4 +449,4 @@ function of_validate_hex( $hex ) {
451
  else {
452
  return true;
453
  }
454
- }
63
  */
64
  function of_sanitize_checkbox( $input ) {
65
  if ( $input ) {
66
+ return '1';
 
 
67
  }
68
+ return false;
69
  }
70
  add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' );
71
 
76
  * @return array of sanitized values ('1' or false)
77
  */
78
  function of_sanitize_multicheck( $input, $option ) {
79
+ $output = array();
80
  if ( is_array( $input ) ) {
81
  foreach( $option['options'] as $key => $value ) {
82
  $output[$key] = false;
276
  if ( in_array( (int) $value_check, $recognized ) ) {
277
  return $value;
278
  }
279
+ return apply_filters( 'of_default_font_size', current( $recognized ) );
280
  }
281
  add_filter( 'of_font_size', 'of_sanitize_font_size' );
282
 
449
  else {
450
  return true;
451
  }
452
+ }
options-framework.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Options Framework
13
  * Plugin URI: http://wptheming.com
14
  * Description: A framework for building theme options.
15
- * Version: 1.8.5
16
  * Author: Devin Price
17
  * Author URI: http://wptheming.com
18
  * License: GPL-2.0+
@@ -83,4 +83,4 @@ function of_get_option( $name, $default = false ) {
83
  return $default;
84
  }
85
 
86
- endif;
12
  * Plugin Name: Options Framework
13
  * Plugin URI: http://wptheming.com
14
  * Description: A framework for building theme options.
15
+ * Version: 1.8.6
16
  * Author: Devin Price
17
  * Author URI: http://wptheming.com
18
  * License: GPL-2.0+
83
  return $default;
84
  }
85
 
86
+ endif;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: downstairsdev
4
  Tags: options, theme options
5
  Donate link: http://bit.ly/options-donate-2
6
  Requires at least: 3.6
7
- Tested up to: 4.8.3
8
  Stable tag: 1.8.5
9
  License: GPLv2
10
 
@@ -29,13 +29,13 @@ The Options Framework Plugin makes it easy to include an options panel in any Wo
29
 
30
  = Learn More =
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.
33
 
34
  == Installation ==
35
 
36
  If your theme already has options enabled, they will show up under the appearance menu.
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).
39
 
40
  == Frequently Asked Questions ==
41
 
@@ -45,7 +45,7 @@ Download the development version from GitHub [https://github.com/devinsays/optio
45
 
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
 
48
- You can also watch the video screencast I have at [http://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin).
49
 
50
  = What options are available to use? =
51
 
@@ -68,6 +68,12 @@ You can also watch the video screencast I have at [http://wptheming.com/options-
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
71
  = 1.8.5 =
72
 
73
  * Update: Style headers to look nice in WordPress 4.4
@@ -219,7 +225,7 @@ You can also watch the video screencast I have at [http://wptheming.com/options-
219
  * Updates labels in options-interface.php
220
  * Changes how checkboxes saved in database ("0" or "1")
221
  * Stores typography, backgrounds and multichecks directly as arrays
222
- * For full description, see: http://wptheming.com/2011/05/options-framework-0-6/
223
 
224
  = 0.5.0 =
225
 
@@ -245,4 +251,4 @@ You can also watch the video screencast I have at [http://wptheming.com/options-
245
 
246
  = 0.1.0 =
247
 
248
- * Initial release
4
  Tags: options, theme options
5
  Donate link: http://bit.ly/options-donate-2
6
  Requires at least: 3.6
7
+ Tested up to: 4.9.4
8
  Stable tag: 1.8.5
9
  License: GPLv2
10
 
29
 
30
  = Learn More =
31
 
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
 
34
  == Installation ==
35
 
36
  If your theme already has options enabled, they will show up under the appearance menu.
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 [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin).
39
 
40
  == Frequently Asked Questions ==
41
 
45
 
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
 
48
+ You can also watch the video screencast I have at [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin).
49
 
50
  = What options are available to use? =
51
 
68
 
69
  == Changelog ==
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
+
77
  = 1.8.5 =
78
 
79
  * Update: Style headers to look nice in WordPress 4.4
225
  * Updates labels in options-interface.php
226
  * Changes how checkboxes saved in database ("0" or "1")
227
  * Stores typography, backgrounds and multichecks directly as arrays
228
+ * For full description, see: https://wptheming.com/2011/05/options-framework-0-6/
229
 
230
  = 0.5.0 =
231
 
251
 
252
  = 0.1.0 =
253
 
254
+ * Initial release