Options Framework - Version 1.3

Version Description

  • Allow options to save when set by theme customizer
  • Save checkbox options to boolean false rather than "0"
  • Added optionsframework_after hook
  • Hungarian translations by kardiweb.org
Download this release

Release Info

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

Code changes from version 1.2 to 1.3

lang/options-framework-hu.po ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of Options Framework in Hungarian
2
+ # This file is distributed under the same license as the Options Framework package.
3
+ msgid ""
4
+ msgstr ""
5
+ "PO-Revision-Date: 2012-06-17 03:04:08+0000\n"
6
+ "MIME-Version: 1.0\n"
7
+ "Content-Type: text/plain; charset=UTF-8\n"
8
+ "Content-Transfer-Encoding: 8bit\n"
9
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
10
+ "X-Generator: GlotPress/0.1\n"
11
+ "Project-Id-Version: Options Framework\n"
12
+
13
+ #: options-sanitize.php:233
14
+ msgid "Repeat Horizontally"
15
+ msgstr "Vízszintes ismétlődés"
16
+
17
+ #: options-sanitize.php:234
18
+ msgid "Repeat Vertically"
19
+ msgstr "Függőleges ismétlődés"
20
+
21
+ #: options-sanitize.php:235
22
+ msgid "Repeat All"
23
+ msgstr "Mindegyik ismétlődjön"
24
+
25
+ #: options-sanitize.php:248
26
+ msgid "Top Left"
27
+ msgstr "Bal felső"
28
+
29
+ #: options-sanitize.php:249
30
+ msgid "Top Center"
31
+ msgstr "Középen fent"
32
+
33
+ #: options-sanitize.php:250
34
+ msgid "Top Right"
35
+ msgstr "Jobb felső"
36
+
37
+ #: options-sanitize.php:251
38
+ msgid "Middle Left"
39
+ msgstr "Közép bal"
40
+
41
+ #: options-sanitize.php:252
42
+ msgid "Middle Center"
43
+ msgstr "Közép középen"
44
+
45
+ #: options-sanitize.php:253
46
+ msgid "Middle Right"
47
+ msgstr "Közép jobb"
48
+
49
+ #: options-sanitize.php:254
50
+ msgid "Bottom Left"
51
+ msgstr "Bal alsó"
52
+
53
+ #: options-sanitize.php:255
54
+ msgid "Bottom Center"
55
+ msgstr "Középen alul"
56
+
57
+ #: options-sanitize.php:256
58
+ msgid "Bottom Right"
59
+ msgstr "Jobb alsó"
60
+
61
+ #: options-sanitize.php:269
62
+ msgid "Scroll Normally"
63
+ msgstr "Normál lapozás"
64
+
65
+ #: options-sanitize.php:270
66
+ msgid "Fixed in Place"
67
+ msgstr "Hely javítása"
68
+
69
+ #: options-sanitize.php:344
70
+ msgid "Normal"
71
+ msgstr "Normál"
72
+
73
+ #: options-sanitize.php:345
74
+ msgid "Italic"
75
+ msgstr "Dőlt"
76
+
77
+ #: options-sanitize.php:346
78
+ msgid "Bold"
79
+ msgstr "Félkövér"
80
+
81
+ #: options-sanitize.php:347
82
+ msgid "Bold Italic"
83
+ msgstr "Félkövér dőlt"
84
+
85
+ #: options-framework.php:71
86
+ msgid "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>"
87
+ msgstr "A jelenlegi sablon nem támogatja az Options Framework bővítményt. <a href=\"%1$s\" target=\"_blank\">Bővebben</a> | <a href=\"%2$s\">Elrejtés</a>"
88
+
89
+ #: options-framework.php:254 options-framework.php:456
90
+ msgid "Theme Options"
91
+ msgstr "Sablon beállítások"
92
+
93
+ #: options-framework.php:323
94
+ msgid "Save Options"
95
+ msgstr "Beállítások mentése"
96
+
97
+ #: options-framework.php:324
98
+ msgid "Restore Defaults"
99
+ msgstr "Alapértékek visszaállítása"
100
+
101
+ #: options-framework.php:324
102
+ msgid "Click OK to reset. Any theme settings will be lost!"
103
+ msgstr "Kattintsunk az OK gombra az alapértékek visszaállításához. Minden jelenlegi beállítás elvész!"
104
+
105
+ #: options-framework.php:358
106
+ msgid "Default options restored."
107
+ msgstr "Alapértékek visszaállítása."
108
+
109
+ #: options-framework.php:400
110
+ msgid "Options saved."
111
+ msgstr "Sikeres mentés."
112
+
113
+ #: options-medialibrary-uploader.php:26
114
+ msgid "Options Framework Internal Container"
115
+ msgstr "Options Framework belső tároló"
116
+
117
+ #: options-medialibrary-uploader.php:128
118
+ msgid "Upload"
119
+ msgstr "Feltőltés"
120
+
121
+ #: options-medialibrary-uploader.php:151
122
+ msgid "View File"
123
+ msgstr "Fájl megtekintése"
124
+
125
+ #: options-medialibrary-uploader.php:288
126
+ msgid "Gallery"
127
+ msgstr "Galéria"
128
+
129
+ #: options-medialibrary-uploader.php:288
130
+ msgid "Previously Uploaded"
131
+ msgstr "Elöző feltőltés"
132
+
133
+ #: options-sanitize.php:232
134
+ msgid "No Repeat"
135
+ msgstr "Ne ismétlődjön"
options-framework.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Options Framework
4
  Plugin URI: http://www.wptheming.com
5
  Description: A framework for building theme options.
6
- Version: 1.2
7
  Author: Devin Price
8
  Author URI: http://www.wptheming.com
9
  License: GPLv2
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
 
28
  /* Basic plugin definitions */
29
 
30
- define('OPTIONS_FRAMEWORK_VERSION', '1.2');
31
  define('OPTIONS_FRAMEWORK_URL', plugin_dir_url( __FILE__ ));
32
 
33
  load_plugin_textdomain( 'optionsframework', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
@@ -304,29 +304,28 @@ if ( !function_exists( 'optionsframework_page' ) ) {
304
  settings_errors();
305
  ?>
306
 
307
- <div class="wrap">
308
  <?php screen_icon( 'themes' ); ?>
309
  <h2 class="nav-tab-wrapper">
310
  <?php echo optionsframework_tabs(); ?>
311
  </h2>
312
 
313
- <div class="metabox-holder">
314
- <div id="optionsframework" class="postbox">
315
- <form action="options.php" method="post">
316
- <?php settings_fields('optionsframework'); ?>
317
-
318
- <?php optionsframework_fields(); /* Settings */ ?>
319
-
320
- <div id="optionsframework-submit">
321
- <input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'optionsframework' ); ?>" />
322
- <input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore Defaults', 'optionsframework' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'Click OK to reset. Any theme settings will be lost!', 'optionsframework' ) ); ?>' );" />
323
- <div class="clear"></div>
324
- </div>
325
- </form>
326
- </div> <!-- / #container -->
327
- </div>
328
- </div> <!-- / .wrap -->
329
-
330
  <?php
331
  }
332
  }
@@ -337,8 +336,7 @@ if ( !function_exists( 'optionsframework_page' ) ) {
337
  * This runs after the submit/reset button has been clicked and
338
  * validates the inputs.
339
  *
340
- * @uses $_POST['reset']
341
- * @uses $_POST['update']
342
  */
343
  function optionsframework_validate( $input ) {
344
 
@@ -354,54 +352,50 @@ function optionsframework_validate( $input ) {
354
  add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'optionsframework' ), 'updated fade' );
355
  return of_get_default_values();
356
  }
357
-
358
  /*
359
- * Udpdate Settings.
 
 
 
360
  */
 
 
 
 
361
 
362
- if ( isset( $_POST['update'] ) ) {
363
-
364
- $clean = array();
365
- $options =& _optionsframework_options();
366
- foreach ( $options as $option ) {
367
-
368
- if ( ! isset( $option['id'] ) ) {
369
- continue;
370
- }
371
-
372
- if ( ! isset( $option['type'] ) ) {
373
- continue;
374
- }
375
 
376
- $id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );
 
 
377
 
378
- // Set checkbox to false if it wasn't sent in the $_POST
379
- if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
380
- $input[$id] = '0';
381
- }
382
 
383
- // Set each item in the multicheck to false if it wasn't sent in the $_POST
384
- if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
385
- foreach ( $option['options'] as $key => $value ) {
386
- $input[$id][$key] = '0';
387
- }
388
- }
389
 
390
- // For a value to be submitted to database it must pass through a sanitization filter
391
- if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
392
- $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
 
393
  }
394
  }
395
 
396
- add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'optionsframework' ), 'updated fade' );
397
- return $clean;
 
 
398
  }
399
 
400
- /*
401
- * Request Not Recognized.
402
- */
403
 
404
- return of_get_default_values();
405
  }
406
 
407
  /**
3
  Plugin Name: Options Framework
4
  Plugin URI: http://www.wptheming.com
5
  Description: A framework for building theme options.
6
+ Version: 1.3
7
  Author: Devin Price
8
  Author URI: http://www.wptheming.com
9
  License: GPLv2
27
 
28
  /* Basic plugin definitions */
29
 
30
+ define('OPTIONS_FRAMEWORK_VERSION', '1.3');
31
  define('OPTIONS_FRAMEWORK_URL', plugin_dir_url( __FILE__ ));
32
 
33
  load_plugin_textdomain( 'optionsframework', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
304
  settings_errors();
305
  ?>
306
 
307
+ <div id="optionsframework-wrap" class="wrap">
308
  <?php screen_icon( 'themes' ); ?>
309
  <h2 class="nav-tab-wrapper">
310
  <?php echo optionsframework_tabs(); ?>
311
  </h2>
312
 
313
+ <div id="optionsframework-metabox" class="metabox-holder">
314
+ <div id="optionsframework" class="postbox">
315
+ <form action="options.php" method="post">
316
+ <?php settings_fields('optionsframework'); ?>
317
+ <?php optionsframework_fields(); /* Settings */ ?>
318
+ <div id="optionsframework-submit">
319
+ <input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'optionsframework' ); ?>" />
320
+ <input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore Defaults', 'optionsframework' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'Click OK to reset. Any theme settings will be lost!', 'optionsframework' ) ); ?>' );" />
321
+ <div class="clear"></div>
322
+ </div>
323
+ </form>
324
+ </div> <!-- / #container -->
325
+ </div>
326
+ <?php do_action('optionsframework_after'); ?>
327
+ </div> <!-- / .wrap -->
328
+
 
329
  <?php
330
  }
331
  }
336
  * This runs after the submit/reset button has been clicked and
337
  * validates the inputs.
338
  *
339
+ * @uses $_POST['reset'] to restore default options
 
340
  */
341
  function optionsframework_validate( $input ) {
342
 
352
  add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'optionsframework' ), 'updated fade' );
353
  return of_get_default_values();
354
  }
355
+
356
  /*
357
+ * Update Settings
358
+ *
359
+ * This used to check for $_POST['update'], but has been updated
360
+ * to be compatible with the theme customizer introduced in WordPress 3.4
361
  */
362
+
363
+ $clean = array();
364
+ $options =& _optionsframework_options();
365
+ foreach ( $options as $option ) {
366
 
367
+ if ( ! isset( $option['id'] ) ) {
368
+ continue;
369
+ }
 
 
 
 
 
 
 
 
 
 
370
 
371
+ if ( ! isset( $option['type'] ) ) {
372
+ continue;
373
+ }
374
 
375
+ $id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );
 
 
 
376
 
377
+ // Set checkbox to false if it wasn't sent in the $_POST
378
+ if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
379
+ $input[$id] = false;
380
+ }
 
 
381
 
382
+ // Set each item in the multicheck to false if it wasn't sent in the $_POST
383
+ if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
384
+ foreach ( $option['options'] as $key => $value ) {
385
+ $input[$id][$key] = false;
386
  }
387
  }
388
 
389
+ // For a value to be submitted to database it must pass through a sanitization filter
390
+ if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
391
+ $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
392
+ }
393
  }
394
 
395
+ add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'optionsframework' ), 'updated fade' );
396
+
397
+ return $clean;
398
 
 
399
  }
400
 
401
  /**
options-medialibrary-uploader.php CHANGED
@@ -23,7 +23,7 @@ if ( ! function_exists( 'optionsframework_mlu_init' ) ) {
23
  function optionsframework_mlu_init () {
24
  register_post_type( 'optionsframework', array(
25
  'labels' => array(
26
- 'name' => __( 'Theme Options Media' ),
27
  ),
28
  'public' => true,
29
  'show_ui' => false,
@@ -126,7 +126,7 @@ if ( ! function_exists( 'optionsframework_medialibrary_uploader' ) ) {
126
 
127
  if ( $value ) { $class = ' has-file'; }
128
  $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" />' . "\n";
129
- $output .= '<input id="upload_' . $id . '" class="upload_button button" type="button" value="' . __( 'Upload' ) . '" rel="' . $int . '" />' . "\n";
130
 
131
  if ( $_desc != '' ) {
132
  $output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
23
  function optionsframework_mlu_init () {
24
  register_post_type( 'optionsframework', array(
25
  'labels' => array(
26
+ 'name' => __( 'Theme Options Media', 'optionsframework' ),
27
  ),
28
  'public' => true,
29
  'show_ui' => false,
126
 
127
  if ( $value ) { $class = ' has-file'; }
128
  $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" />' . "\n";
129
+ $output .= '<input id="upload_' . $id . '" class="upload_button button" type="button" value="' . __( 'Upload', 'optionsframework' ) . '" rel="' . $int . '" />' . "\n";
130
 
131
  if ( $_desc != '' ) {
132
  $output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
options-sanitize.php CHANGED
@@ -32,7 +32,7 @@ function of_sanitize_checkbox( $input ) {
32
  if ( $input ) {
33
  $output = '1';
34
  } else {
35
- $output = '0';
36
  }
37
  return $output;
38
  }
@@ -44,7 +44,7 @@ function of_sanitize_multicheck( $input, $option ) {
44
  $output = '';
45
  if ( is_array( $input ) ) {
46
  foreach( $option['options'] as $key => $value ) {
47
- $output[$key] = "0";
48
  }
49
  foreach( $input as $key => $value ) {
50
  if ( array_key_exists( $key, $option['options'] ) && $value ) {
32
  if ( $input ) {
33
  $output = '1';
34
  } else {
35
+ $output = false;
36
  }
37
  return $output;
38
  }
44
  $output = '';
45
  if ( is_array( $input ) ) {
46
  foreach( $option['options'] as $key => $value ) {
47
+ $output[$key] = false;
48
  }
49
  foreach( $input as $key => $value ) {
50
  if ( array_key_exists( $key, $option['options'] ) && $value ) {
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: Devin Price
4
  Tags: options, theme options
5
  Donate link: http://bit.ly/options-donate
6
  Requires at least: 3.3
7
- Tested up to: 3.4
8
- Stable tag: 1.2
9
  License: GPLv2
10
 
11
  == Description ==
@@ -67,6 +67,13 @@ You can also watch the video screencast I have at [http://wptheming.com/options-
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
 
 
70
  = 1.2 =
71
 
72
  * Fix for font_size santization
4
  Tags: options, theme options
5
  Donate link: http://bit.ly/options-donate
6
  Requires at least: 3.3
7
+ Tested up to: 3.4.1
8
+ Stable tag: 1.3
9
  License: GPLv2
10
 
11
  == Description ==
67
 
68
  == Changelog ==
69
 
70
+ = 1.3 =
71
+
72
+ * Allow options to save when set by theme customizer
73
+ * Save checkbox options to boolean false rather than "0"
74
+ * Added optionsframework_after hook
75
+ * Hungarian translations by kardiweb.org
76
+
77
  = 1.2 =
78
 
79
  * Fix for font_size santization