Options Framework - Version 1.7.1

Version Description

  • Fix to use option name if set in options.php
Download this release

Release Info

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

Code changes from version 1.6 to 1.7.1

Files changed (36) hide show
  1. css/color-picker.min.css +0 -1
  2. css/optionsframework.css +9 -33
  3. includes/class-options-framework-admin.php +341 -0
  4. includes/class-options-framework.php +138 -0
  5. includes/class-options-interface.php +422 -0
  6. includes/class-options-media-uploader.php +123 -0
  7. options-sanitize.php → includes/class-options-sanitization.php +26 -21
  8. js/color-picker.min.js +0 -1
  9. js/iris.min.js +0 -4
  10. js/media-uploader.js +50 -49
  11. js/options-custom.js +63 -78
  12. {lang → languages}/options-framework-hu_HU.po +0 -0
  13. languages/options-framework-pt_PT.mo +0 -0
  14. languages/options-framework-pt_PT.po +383 -0
  15. {lang → languages}/options-framework.pot +164 -165
  16. {lang → languages}/optionsframework-es_ES.mo +0 -0
  17. {lang → languages}/optionsframework-es_ES.po +0 -0
  18. {lang → languages}/optionsframework-fa_IR.mo +0 -0
  19. {lang → languages}/optionsframework-fa_IR.po +0 -0
  20. {lang → languages}/optionsframework-fr_FR.mo +0 -0
  21. {lang → languages}/optionsframework-fr_FR.po +0 -0
  22. {lang → languages}/optionsframework-it_IT.mo +0 -0
  23. {lang → languages}/optionsframework-it_IT.po +0 -0
  24. {lang → languages}/optionsframework-pt_BR.mo +0 -0
  25. {lang → languages}/optionsframework-pt_BR.po +0 -0
  26. {lang → languages}/optionsframework-ru_RU.mo +0 -0
  27. {lang → languages}/optionsframework-ru_RU.po +0 -0
  28. {lang → languages}/optionsframework-sv_SE.mo +0 -0
  29. {lang → languages}/optionsframework-sv_SE.po +0 -0
  30. {lang → languages}/optionsframework-zh_CN.mo +0 -0
  31. {lang → languages}/optionsframework-zh_CN.po +0 -0
  32. options-framework.php +54 -543
  33. options-interface.php +0 -418
  34. options-media-uploader.php +0 -113
  35. readme.txt +23 -5
  36. screenshot-1.png +0 -0
css/color-picker.min.css DELETED
@@ -1 +0,0 @@
1
- .wp-color-picker{width:80px}.wp-picker-container .hidden{display:none}.wp-color-result{background-color:#f9f9f9;border:1px solid #bbb;border-radius:2px;cursor:pointer;display:inline-block;height:22px;margin:0 6px 6px 0;position:relative;top:1px;user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;vertical-align:bottom;display:inline-block;padding-left:30px}.wp-color-result:after{background:#f3f3f3;background-image:-webkit-gradient(linear,left top,left bottom,from(#fefefe),to(#f4f4f4));background-image:-webkit-linear-gradient(top,#fefefe,#f4f4f4);background-image:-moz-linear-gradient(top,#fefefe,#f4f4f4);background-image:-o-linear-gradient(top,#fefefe,#f4f4f4);background-image:linear-gradient(to bottom,#fefefe,#f4f4f4);color:#333;text-shadow:0 1px 0 #fff;border-radius:0 1px 1px 0;border-left:1px solid #bbb;content:attr(title);display:block;font-size:11px;line-height:22px;padding:0 6px;position:relative;right:0;text-align:center;top:0}.wp-color-result:hover{border-color:#aaa;box-shadow:0 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 1px rgba(0,0,0,0.1);-ms-box-shadow:0 1px 1px rgba(0,0,0,0.1);-o-box-shadow:0 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.1)}.wp-color-result:hover:after{color:#222;border-color:#aaa;border-left:1px solid #999}.wp-color-result.wp-picker-open{top:0}.wp-color-result.wp-picker-open:after{content:attr(data-current)}.wp-picker-container,.wp-picker-container:active{display:inline-block;outline:0}.wp-color-result:focus{border-color:#888;-moz-box-shadow:0 1px 2px rgba(0,0,0,0.2);-ms-box-shadow:0 1px 2px rgba(0,0,0,0.2);-o-box-shadow:0 1px 2px rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.2);box-shadow:0 1px 2px rgba(0,0,0,0.2)}.wp-color-result:focus:after{border-color:#888}.wp-picker-open+.wp-picker-input-wrap{display:inline-block;vertical-align:top}.wp-picker-container .button{margin-left:6px}.wp-picker-container .iris-square-slider .ui-slider-handle:focus{background-color:#555}.wp-picker-container .iris-picker{border-color:#dfdfdf;margin-top:6px}input[type="text"].iris-error{background-color:#ffebe8;border-color:#c00;color:#000}
 
css/optionsframework.css CHANGED
@@ -1,22 +1,17 @@
1
  /* Options Framework Admin Styles */
2
 
3
- .updated {
4
- max-width:764px;
5
- margin-bottom:0px !important;
6
- }
7
  #optionsframework {
8
- position:relative;
9
- z-index: 0;
10
- max-width:780px;
11
- background:#fff;
12
  }
13
  #optionsframework h3 {
14
  cursor: default;
 
 
15
  }
16
  #optionsframework p {
17
  margin-bottom:0;
18
  padding-bottom:10px;
19
- line-height: 1.4em;
20
  }
21
  #optionsframework .section {
22
  padding:10px 10px 0;
@@ -24,11 +19,6 @@
24
  #optionsframework .group {
25
  padding-bottom:40px;
26
  }
27
- #optionsframework .section .heading {
28
- padding:10px 0px;
29
- margin:0 0 15px;
30
- border-bottom: 1px solid #dfdfdf;
31
- }
32
  #optionsframework .section .controls {
33
  float: left;
34
  min-width:350px;
@@ -48,9 +38,6 @@
48
  #optionsframework .section-checkbox .explain {
49
  max-width:94%;
50
  }
51
- #optionsframework .of-input {
52
- width:100%;
53
- }
54
  #optionsframework .controls select, #optionsframework .controls textarea {
55
  margin-bottom:10px;
56
  width:100%;
@@ -62,8 +49,7 @@
62
  margin-bottom: 5px;
63
  }
64
  #optionsframework input.checkbox, #optionsframework input.of-radio {
65
- width: 30px;
66
- margin-top:2px;
67
  float:left;
68
  clear:both;
69
  }
@@ -97,7 +83,7 @@
97
  }
98
  #optionsframework .of-background-properties {
99
  clear:both;
100
- margin-top: 18px;
101
  }
102
  #optionsframework .controls .of-background-repeat {
103
  width:125px;
@@ -169,15 +155,6 @@
169
  #optionsframework .controls input.upload {
170
  width:80%;
171
  }
172
- #optionsframework .controls input.upload_button {
173
- float:right;
174
- border-color:#BBBBBB;
175
- cursor:pointer;
176
- }
177
- #optionsframework .controls input.upload_button:hover {
178
- border-color:#666666;
179
- color:#000;
180
- }
181
  #optionsframework .screenshot {
182
  float:left;
183
  margin-left:1px;
@@ -186,7 +163,7 @@
186
  margin-top:3px;
187
  }
188
  #optionsframework .screenshot img {
189
- background:#FAFAFA;
190
  border-color:#ccc #eee #eee #ccc;
191
  border-style:solid;
192
  border-width:1px;
@@ -223,9 +200,8 @@
223
 
224
  #optionsframework-submit {
225
  padding: 7px 10px;
226
- border-top: 1px solid #ECECEC;
227
- background-color: #F1F1F1;
228
- background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC);
229
  }
230
  #optionsframework .button-primary {
231
  float:right;
1
  /* Options Framework Admin Styles */
2
 
 
 
 
 
3
  #optionsframework {
4
+ max-width:840px;
5
+ background:#fff;
 
 
6
  }
7
  #optionsframework h3 {
8
  cursor: default;
9
+ background-color: #f1f1f1;
10
+ border-bottom: 1px solid #ddd;
11
  }
12
  #optionsframework p {
13
  margin-bottom:0;
14
  padding-bottom:10px;
 
15
  }
16
  #optionsframework .section {
17
  padding:10px 10px 0;
19
  #optionsframework .group {
20
  padding-bottom:40px;
21
  }
 
 
 
 
 
22
  #optionsframework .section .controls {
23
  float: left;
24
  min-width:350px;
38
  #optionsframework .section-checkbox .explain {
39
  max-width:94%;
40
  }
 
 
 
41
  #optionsframework .controls select, #optionsframework .controls textarea {
42
  margin-bottom:10px;
43
  width:100%;
49
  margin-bottom: 5px;
50
  }
51
  #optionsframework input.checkbox, #optionsframework input.of-radio {
52
+ margin: 0 10px 5px 0;
 
53
  float:left;
54
  clear:both;
55
  }
83
  }
84
  #optionsframework .of-background-properties {
85
  clear:both;
86
+ margin-top: 18px;
87
  }
88
  #optionsframework .controls .of-background-repeat {
89
  width:125px;
155
  #optionsframework .controls input.upload {
156
  width:80%;
157
  }
 
 
 
 
 
 
 
 
 
158
  #optionsframework .screenshot {
159
  float:left;
160
  margin-left:1px;
163
  margin-top:3px;
164
  }
165
  #optionsframework .screenshot img {
166
+ background:#fafafa;
167
  border-color:#ccc #eee #eee #ccc;
168
  border-style:solid;
169
  border-width:1px;
200
 
201
  #optionsframework-submit {
202
  padding: 7px 10px;
203
+ border-top: 1px solid #ddd;
204
+ background-color: #f1f1f1;
 
205
  }
206
  #optionsframework .button-primary {
207
  float:right;
includes/class-options-framework-admin.php ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2013 WP Theming
8
+ */
9
+
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_options_page' ) );
35
+
36
+ // Add the required scripts and styles
37
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
38
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
39
+
40
+ // Settings need to be registered after admin_init
41
+ add_action( 'admin_init', array( $this, 'settings_init' ) );
42
+
43
+ // Adds options menu to the admin bar
44
+ add_action( 'wp_before_admin_bar_render', array( $this, 'optionsframework_admin_bar' ) );
45
+
46
+ } else {
47
+ // Display a notice if options aren't present in the theme
48
+ add_action( 'admin_notices', array( $this, 'options_notice' ) );
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') ) {
63
+ echo '<div class="updated optionsframework_setup_nag"><p>';
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>', 'optionsframework'), '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;
76
+ if ( isset( $_GET['optionsframework_nag_ignore'] ) && '0' == $_GET['optionsframework_nag_ignore'] ) {
77
+ add_user_meta( $user_id, 'optionsframework_ignore_notice', 'true', true );
78
+ }
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' ) );
93
+
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)
101
+ *
102
+ * Examples usage:
103
+ *
104
+ * add_filter( 'optionsframework_menu', function( $menu ) {
105
+ * $menu['page_title'] = 'The Options';
106
+ * $menu['menu_title'] = 'The Options';
107
+ * return $menu;
108
+ * });
109
+ *
110
+ * @since 1.7.0
111
+ *
112
+ */
113
+ static function menu_settings() {
114
+
115
+ $menu = array(
116
+ 'page_title' => __( 'Theme Options', 'optionsframework'),
117
+ 'menu_title' => __('Theme Options', 'optionsframework'),
118
+ 'capability' => 'edit_theme_options',
119
+ 'menu_slug' => 'options-framework'
120
+ );
121
+
122
+ return apply_filters( 'optionsframework_menu', $menu );
123
+ }
124
+
125
+ /**
126
+ * Add a subpage called "Theme Options" to the appearance menu.
127
+ *
128
+ * @since 1.7.0
129
+ */
130
+ function add_options_page() {
131
+
132
+ $menu = $this->menu_settings();
133
+ $this->options_screen = add_theme_page( $menu['page_title'], $menu['menu_title'], $menu['capability'], $menu['menu_slug'], array( $this, 'options_page' ) );
134
+
135
+ }
136
+
137
+ /**
138
+ * Loads the required stylesheets
139
+ *
140
+ * @since 1.7.0
141
+ */
142
+ function enqueue_admin_styles() {
143
+ wp_enqueue_style( 'optionsframework', plugin_dir_url( dirname(__FILE__) ) . 'css/optionsframework.css', array(), Options_Framework::VERSION );
144
+ wp_enqueue_style( 'wp-color-picker' );
145
+ }
146
+
147
+ /**
148
+ * Loads the required javascript
149
+ *
150
+ * @since 1.7.0
151
+ */
152
+ function enqueue_admin_scripts( $hook ) {
153
+
154
+ $menu = $this->menu_settings();
155
+
156
+ if ( 'appearance_page_' . $menu['menu_slug'] != $hook )
157
+ return;
158
+
159
+ // Enqueue custom option panel JS
160
+ wp_enqueue_script( 'options-custom', plugin_dir_url( dirname(__FILE__) ) . 'js/options-custom.js', array( 'jquery','wp-color-picker' ), Options_Framework::VERSION );
161
+
162
+ // Inline scripts from options-interface.php
163
+ add_action( 'admin_head', array( $this, 'of_admin_head' ) );
164
+ }
165
+
166
+ function of_admin_head() {
167
+ // Hook to add custom scripts
168
+ do_action( 'optionsframework_custom_scripts' );
169
+ }
170
+
171
+ /**
172
+ * Builds out the options panel.
173
+ *
174
+ * If we were using the Settings API as it was intended we would use
175
+ * do_settings_sections here. But as we don't want the settings wrapped in a table,
176
+ * we'll call our own custom optionsframework_fields. See options-interface.php
177
+ * for specifics on how each individual field is generated.
178
+ *
179
+ * Nonces are provided using the settings_fields()
180
+ *
181
+ * @since 1.7.0
182
+ */
183
+ function options_page() { ?>
184
+
185
+ <div id="optionsframework-wrap" class="wrap">
186
+
187
+ <?php $menu = $this->menu_settings(); ?>
188
+ <h2><?php echo esc_html( $menu['page_title'] ); ?></h2>
189
+
190
+ <h2 class="nav-tab-wrapper">
191
+ <?php echo Options_Framework_Interface::optionsframework_tabs(); ?>
192
+ </h2>
193
+
194
+ <?php settings_errors( 'options-framework' ); ?>
195
+
196
+ <div id="optionsframework-metabox" class="metabox-holder">
197
+ <div id="optionsframework" class="postbox">
198
+ <form action="options.php" method="post">
199
+ <?php settings_fields( 'optionsframework' ); ?>
200
+ <?php Options_Framework_Interface::optionsframework_fields(); /* Settings */ ?>
201
+ <div id="optionsframework-submit">
202
+ <input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'optionsframework' ); ?>" />
203
+ <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' ) ); ?>' );" />
204
+ <div class="clear"></div>
205
+ </div>
206
+ </form>
207
+ </div> <!-- / #container -->
208
+ </div>
209
+ <?php do_action( 'optionsframework_after' ); ?>
210
+ </div> <!-- / .wrap -->
211
+
212
+ <?php
213
+ }
214
+
215
+ /**
216
+ * Validate Options.
217
+ *
218
+ * This runs after the submit/reset button has been clicked and
219
+ * validates the inputs.
220
+ *
221
+ * @uses $_POST['reset'] to restore default options
222
+ */
223
+ function validate_options( $input ) {
224
+
225
+ /*
226
+ * Restore Defaults.
227
+ *
228
+ * In the event that the user clicked the "Restore Defaults"
229
+ * button, the options defined in the theme's options.php
230
+ * file will be added to the option for the active theme.
231
+ */
232
+
233
+ if ( isset( $_POST['reset'] ) ) {
234
+ add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'optionsframework' ), 'updated fade' );
235
+ return $this->get_default_values();
236
+ }
237
+
238
+ /*
239
+ * Update Settings
240
+ *
241
+ * This used to check for $_POST['update'], but has been updated
242
+ * to be compatible with the theme customizer introduced in WordPress 3.4
243
+ */
244
+
245
+ $clean = array();
246
+ $options = & Options_Framework::_optionsframework_options();
247
+ foreach ( $options as $option ) {
248
+
249
+ if ( ! isset( $option['id'] ) ) {
250
+ continue;
251
+ }
252
+
253
+ if ( ! isset( $option['type'] ) ) {
254
+ continue;
255
+ }
256
+
257
+ $id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );
258
+
259
+ // Set checkbox to false if it wasn't sent in the $_POST
260
+ if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
261
+ $input[$id] = false;
262
+ }
263
+
264
+ // Set each item in the multicheck to false if it wasn't sent in the $_POST
265
+ if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
266
+ foreach ( $option['options'] as $key => $value ) {
267
+ $input[$id][$key] = false;
268
+ }
269
+ }
270
+
271
+ // For a value to be submitted to database it must pass through a sanitization filter
272
+ if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
273
+ $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
274
+ }
275
+ }
276
+
277
+ // Hook to run after validation
278
+ do_action( 'optionsframework_after_validate', $clean );
279
+
280
+ return $clean;
281
+ }
282
+
283
+ /**
284
+ * Display message when options have been saved
285
+ */
286
+
287
+ function save_options_notice() {
288
+ add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'optionsframework' ), 'updated fade' );
289
+ }
290
+
291
+ /**
292
+ * Get the default values for all the theme options
293
+ *
294
+ * Get an array of all default values as set in
295
+ * options.php. The 'id','std' and 'type' keys need
296
+ * to be defined in the configuration array. In the
297
+ * event that these keys are not present the option
298
+ * will not be included in this function's output.
299
+ *
300
+ * @return array Re-keyed options configuration array.
301
+ *
302
+ */
303
+
304
+ function get_default_values() {
305
+ $output = array();
306
+ $config = & Options_Framework::_optionsframework_options();
307
+ foreach ( (array) $config as $option ) {
308
+ if ( ! isset( $option['id'] ) ) {
309
+ continue;
310
+ }
311
+ if ( ! isset( $option['std'] ) ) {
312
+ continue;
313
+ }
314
+ if ( ! isset( $option['type'] ) ) {
315
+ continue;
316
+ }
317
+ if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
318
+ $output[$option['id']] = apply_filters( 'of_sanitize_' . $option['type'], $option['std'], $option );
319
+ }
320
+ }
321
+ return $output;
322
+ }
323
+
324
+ /**
325
+ * Add options menu item to admin bar
326
+ */
327
+
328
+ function optionsframework_admin_bar() {
329
+
330
+ $menu = $this->menu_settings();
331
+ global $wp_admin_bar;
332
+
333
+ $wp_admin_bar->add_menu( array(
334
+ 'parent' => 'appearance',
335
+ 'id' => 'of_theme_options',
336
+ 'title' => __( 'Theme Options', 'optionsframework' ),
337
+ 'href' => admin_url( 'themes.php?page=' . $menu['menu_slug'] )
338
+ ) );
339
+ }
340
+
341
+ }
includes/class-options-framework.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2013 WP Theming
8
+ */
9
+
10
+ class Options_Framework {
11
+
12
+ /**
13
+ * Plugin version, used for cache-busting of style and script file references.
14
+ *
15
+ * @since 1.7.0
16
+ * @type string
17
+ */
18
+ const VERSION = '1.7.1';
19
+
20
+ /**
21
+ * Initialize the plugin.
22
+ *
23
+ * @since 1.7.0
24
+ */
25
+ public function init() {
26
+
27
+ // Load plugin text domain
28
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
29
+
30
+ // Needs to run every time in case theme has been changed
31
+ add_action( 'admin_init', array( $this, 'set_theme_option' ) );
32
+
33
+ }
34
+
35
+ /**
36
+ * Load the plugin text domain for translation.
37
+ *
38
+ * @since 1.7.0
39
+ */
40
+ public function load_plugin_textdomain() {
41
+ $domain = 'optionsframework';
42
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
43
+
44
+ load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
45
+ load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages' );
46
+ }
47
+
48
+ /**
49
+ * Sets option defaults
50
+ *
51
+ * @since 1.7.0
52
+ */
53
+ function set_theme_option() {
54
+
55
+ // Load settings
56
+ $optionsframework_settings = get_option( 'optionsframework' );
57
+
58
+ // Updates the unique option id in the database if it has changed
59
+ if ( function_exists( 'optionsframework_option_name' ) ) {
60
+ optionsframework_option_name();
61
+ }
62
+ elseif ( has_action( 'optionsframework_option_name' ) ) {
63
+ do_action( 'optionsframework_option_name' );
64
+ }
65
+ // If the developer hasn't explicitly set an option id, we'll use a default
66
+ else {
67
+ $default_themename = get_option( 'stylesheet' );
68
+ $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
69
+ $default_themename = 'optionsframework_' . $default_themename;
70
+ if ( isset( $optionsframework_settings['id'] ) ) {
71
+ if ( $optionsframework_settings['id'] == $default_themename ) {
72
+ // All good, using default theme id
73
+ } else {
74
+ $optionsframework_settings['id'] = $default_themename;
75
+ update_option( 'optionsframework', $optionsframework_settings );
76
+ }
77
+ }
78
+ else {
79
+ $optionsframework_settings['id'] = $default_themename;
80
+ update_option( 'optionsframework', $optionsframework_settings );
81
+ }
82
+ }
83
+
84
+ }
85
+
86
+ /**
87
+ * Wrapper for optionsframework_options()
88
+ *
89
+ * Allows for manipulating or setting options via 'of_options' filter
90
+ * For example:
91
+ *
92
+ * <code>
93
+ * add_filter( 'of_options', function( $options ) {
94
+ * $options[] = array(
95
+ * 'name' => 'Input Text Mini',
96
+ * 'desc' => 'A mini text input field.',
97
+ * 'id' => 'example_text_mini',
98
+ * 'std' => 'Default',
99
+ * 'class' => 'mini',
100
+ * 'type' => 'text'
101
+ * );
102
+ *
103
+ * return $options;
104
+ * });
105
+ * </code>
106
+ *
107
+ * Also allows for setting options via a return statement in the
108
+ * options.php file. For example (in options.php):
109
+ *
110
+ * <code>
111
+ * return array(...);
112
+ * </code>
113
+ *
114
+ * @return array (by reference)
115
+ */
116
+ static function &_optionsframework_options() {
117
+ static $options = null;
118
+
119
+ if ( !$options ) {
120
+ // Load options from options.php file (if it exists)
121
+ $location = apply_filters( 'options_framework_location', array('options.php') );
122
+ if ( $optionsfile = locate_template( $location ) ) {
123
+ $maybe_options = require_once $optionsfile;
124
+ if ( is_array( $maybe_options ) ) {
125
+ $options = $maybe_options;
126
+ } else if ( function_exists( 'optionsframework_options' ) ) {
127
+ $options = optionsframework_options();
128
+ }
129
+ }
130
+
131
+ // Allow setting/manipulating options via filters
132
+ $options = apply_filters( 'of_options', $options );
133
+ }
134
+
135
+ return $options;
136
+ }
137
+
138
+ }
includes/class-options-interface.php ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2013 WP Theming
8
+ */
9
+
10
+ class Options_Framework_Interface {
11
+
12
+ /**
13
+ * Generates the tabs that are used in the options menu
14
+ */
15
+ static function optionsframework_tabs() {
16
+ $counter = 0;
17
+ $options = & Options_Framework::_optionsframework_options();
18
+ $menu = '';
19
+
20
+ foreach ( $options as $value ) {
21
+ // Heading for Navigation
22
+ if ( $value['type'] == "heading" ) {
23
+ $counter++;
24
+ $class = '';
25
+ $class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
26
+ $class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab';
27
+ $menu .= '<a id="options-group-'. $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'. $counter ) . '">' . esc_html( $value['name'] ) . '</a>';
28
+ }
29
+ }
30
+
31
+ return $menu;
32
+ }
33
+
34
+ /**
35
+ * Generates the options fields that are used in the form.
36
+ */
37
+ static function optionsframework_fields() {
38
+
39
+ global $allowedtags;
40
+ $optionsframework_settings = get_option( 'optionsframework' );
41
+
42
+ // Gets the unique option id
43
+ if ( isset( $optionsframework_settings['id'] ) ) {
44
+ $option_name = $optionsframework_settings['id'];
45
+ }
46
+ else {
47
+ $option_name = 'optionsframework';
48
+ };
49
+
50
+ $settings = get_option($option_name);
51
+ $options = & Options_Framework::_optionsframework_options();
52
+
53
+ $counter = 0;
54
+ $menu = '';
55
+
56
+ foreach ( $options as $value ) {
57
+
58
+ $val = '';
59
+ $select_value = '';
60
+ $output = '';
61
+
62
+ // Wrap all options
63
+ if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
64
+
65
+ // Keep all ids lowercase with no spaces
66
+ $value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id']) );
67
+
68
+ $id = 'section-' . $value['id'];
69
+
70
+ $class = 'section';
71
+ if ( isset( $value['type'] ) ) {
72
+ $class .= ' section-' . $value['type'];
73
+ }
74
+ if ( isset( $value['class'] ) ) {
75
+ $class .= ' ' . $value['class'];
76
+ }
77
+
78
+ $output .= '<div id="' . esc_attr( $id ) .'" class="' . esc_attr( $class ) . '">'."\n";
79
+ if ( isset( $value['name'] ) ) {
80
+ $output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
81
+ }
82
+ if ( $value['type'] != 'editor' ) {
83
+ $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
84
+ }
85
+ else {
86
+ $output .= '<div class="option">' . "\n" . '<div>' . "\n";
87
+ }
88
+ }
89
+
90
+ // Set default value to $val
91
+ if ( isset( $value['std'] ) ) {
92
+ $val = $value['std'];
93
+ }
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
+ }
104
+ }
105
+
106
+ // If there is a description save it for labels
107
+ $explain_value = '';
108
+ if ( isset( $value['desc'] ) ) {
109
+ $explain_value = $value['desc'];
110
+ }
111
+
112
+ if ( has_filter( 'optionsframework_' . $value['type'] ) ) {
113
+ $output .= apply_filters( 'optionsframework_' . $value['type'], $option_name, $value, $val );
114
+ }
115
+
116
+
117
+ switch ( $value['type'] ) {
118
+
119
+ // Basic text input
120
+ case 'text':
121
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '" />';
122
+ break;
123
+
124
+ // Password input
125
+ case 'password':
126
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="password" value="' . esc_attr( $val ) . '" />';
127
+ break;
128
+
129
+ // Textarea
130
+ case 'textarea':
131
+ $rows = '8';
132
+
133
+ if ( isset( $value['settings']['rows'] ) ) {
134
+ $custom_rows = $value['settings']['rows'];
135
+ if ( is_numeric( $custom_rows ) ) {
136
+ $rows = $custom_rows;
137
+ }
138
+ }
139
+
140
+ $val = stripslashes( $val );
141
+ $output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '">' . esc_textarea( $val ) . '</textarea>';
142
+ break;
143
+
144
+ // Select Box
145
+ case 'select':
146
+ $output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '">';
147
+
148
+ foreach ($value['options'] as $key => $option ) {
149
+ $output .= '<option'. selected( $val, $key, false ) .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>';
150
+ }
151
+ $output .= '</select>';
152
+ break;
153
+
154
+
155
+ // Radio Box
156
+ case "radio":
157
+ $name = $option_name .'['. $value['id'] .']';
158
+ foreach ($value['options'] as $key => $option) {
159
+ $id = $option_name . '-' . $value['id'] .'-'. $key;
160
+ $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="'. esc_attr( $key ) . '" '. checked( $val, $key, false) .' /><label for="' . esc_attr( $id ) . '">' . esc_html( $option ) . '</label>';
161
+ }
162
+ break;
163
+
164
+ // Image Selectors
165
+ case "images":
166
+ $name = $option_name .'['. $value['id'] .']';
167
+ foreach ( $value['options'] as $key => $option ) {
168
+ $selected = '';
169
+ if ( $val != '' && ($val == $key) ) {
170
+ $selected = ' of-radio-img-selected';
171
+ }
172
+ $output .= '<input type="radio" id="' . esc_attr( $value['id'] .'_'. $key) . '" class="of-radio-img-radio" value="' . esc_attr( $key ) . '" name="' . esc_attr( $name ) . '" '. checked( $val, $key, false ) .' />';
173
+ $output .= '<div class="of-radio-img-label">' . esc_html( $key ) . '</div>';
174
+ $output .= '<img src="' . esc_url( $option ) . '" alt="' . $option .'" class="of-radio-img-img' . $selected .'" onclick="document.getElementById(\''. esc_attr($value['id'] .'_'. $key) .'\').checked=true;" />';
175
+ }
176
+ break;
177
+
178
+ // Checkbox
179
+ case "checkbox":
180
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" '. checked( $val, 1, false) .' />';
181
+ $output .= '<label class="explain" for="' . esc_attr( $value['id'] ) . '">' . wp_kses( $explain_value, $allowedtags) . '</label>';
182
+ break;
183
+
184
+ // Multicheck
185
+ case "multicheck":
186
+ foreach ($value['options'] as $key => $option) {
187
+ $checked = '';
188
+ $label = $option;
189
+ $option = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($key));
190
+
191
+ $id = $option_name . '-' . $value['id'] . '-'. $option;
192
+ $name = $option_name . '[' . $value['id'] . '][' . $option .']';
193
+
194
+ if ( isset($val[$option]) ) {
195
+ $checked = checked($val[$option], 1, false);
196
+ }
197
+
198
+ $output .= '<input id="' . esc_attr( $id ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $name ) . '" ' . $checked . ' /><label for="' . esc_attr( $id ) . '">' . esc_html( $label ) . '</label>';
199
+ }
200
+ break;
201
+
202
+ // Color picker
203
+ case "color":
204
+ $default_color = '';
205
+ if ( isset($value['std']) ) {
206
+ if ( $val != $value['std'] )
207
+ $default_color = ' data-default-color="' .$value['std'] . '" ';
208
+ }
209
+ $output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '" class="of-color" type="text" value="' . esc_attr( $val ) . '"' . $default_color .' />';
210
+
211
+ break;
212
+
213
+ // Uploader
214
+ case "upload":
215
+ $output .= Options_Framework_Media_Uploader::optionsframework_uploader( $value['id'], $val, null );
216
+
217
+ break;
218
+
219
+ // Typography
220
+ case 'typography':
221
+
222
+ unset( $font_size, $font_style, $font_face, $font_color );
223
+
224
+ $typography_defaults = array(
225
+ 'size' => '',
226
+ 'face' => '',
227
+ 'style' => '',
228
+ 'color' => ''
229
+ );
230
+
231
+ $typography_stored = wp_parse_args( $val, $typography_defaults );
232
+
233
+ $typography_options = array(
234
+ 'sizes' => of_recognized_font_sizes(),
235
+ 'faces' => of_recognized_font_faces(),
236
+ 'styles' => of_recognized_font_styles(),
237
+ 'color' => true
238
+ );
239
+
240
+ if ( isset( $value['options'] ) ) {
241
+ $typography_options = wp_parse_args( $value['options'], $typography_options );
242
+ }
243
+
244
+ // Font Size
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>';
253
+ }
254
+
255
+ // Font Face
256
+ if ( $typography_options['faces'] ) {
257
+ $font_face = '<select class="of-typography of-typography-face" name="' . esc_attr( $option_name . '[' . $value['id'] . '][face]' ) . '" id="' . esc_attr( $value['id'] . '_face' ) . '">';
258
+ $faces = $typography_options['faces'];
259
+ foreach ( $faces as $key => $face ) {
260
+ $font_face .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['face'], $key, false ) . '>' . esc_html( $face ) . '</option>';
261
+ }
262
+ $font_face .= '</select>';
263
+ }
264
+
265
+ // Font Styles
266
+ if ( $typography_options['styles'] ) {
267
+ $font_style = '<select class="of-typography of-typography-style" name="'.$option_name.'['.$value['id'].'][style]" id="'. $value['id'].'_style">';
268
+ $styles = $typography_options['styles'];
269
+ foreach ( $styles as $key => $style ) {
270
+ $font_style .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['style'], $key, false ) . '>'. $style .'</option>';
271
+ }
272
+ $font_style .= '</select>';
273
+ }
274
+
275
+ // Font Color
276
+ if ( $typography_options['color'] ) {
277
+ $default_color = '';
278
+ if ( isset($value['std']['color']) ) {
279
+ if ( $val != $value['std']['color'] )
280
+ $default_color = ' data-default-color="' .$value['std']['color'] . '" ';
281
+ }
282
+ $font_color = '<input name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" class="of-color of-typography-color type="text" value="' . esc_attr( $typography_stored['color'] ) . '"' . $default_color .' />';
283
+ }
284
+
285
+ // Allow modification/injection of typography fields
286
+ $typography_fields = compact( 'font_size', 'font_face', 'font_style', 'font_color' );
287
+ $typography_fields = apply_filters( 'of_typography_fields', $typography_fields, $typography_stored, $option_name, $value );
288
+ $output .= implode( '', $typography_fields );
289
+
290
+ break;
291
+
292
+ // Background
293
+ case 'background':
294
+
295
+ $background = $val;
296
+
297
+ // Background Color
298
+ $default_color = '';
299
+ if ( isset( $value['std']['color'] ) ) {
300
+ if ( $val != $value['std']['color'] )
301
+ $default_color = ' data-default-color="' .$value['std']['color'] . '" ';
302
+ }
303
+ $output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" class="of-color of-background-color" type="text" value="' . esc_attr( $background['color'] ) . '"' . $default_color .' />';
304
+
305
+ // Background Image
306
+ if ( !isset($background['image']) ) {
307
+ $background['image'] = '';
308
+ }
309
+
310
+ $output .= Options_Framework_Media_Uploader::optionsframework_uploader( $value['id'], $background['image'], null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) );
311
+
312
+ $class = 'of-background-properties';
313
+ if ( '' == $background['image'] ) {
314
+ $class .= ' hide';
315
+ }
316
+ $output .= '<div class="' . esc_attr( $class ) . '">';
317
+
318
+ // Background Repeat
319
+ $output .= '<select class="of-background of-background-repeat" name="' . esc_attr( $option_name . '[' . $value['id'] . '][repeat]' ) . '" id="' . esc_attr( $value['id'] . '_repeat' ) . '">';
320
+ $repeats = of_recognized_background_repeat();
321
+
322
+ foreach ($repeats as $key => $repeat) {
323
+ $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['repeat'], $key, false ) . '>'. esc_html( $repeat ) . '</option>';
324
+ }
325
+ $output .= '</select>';
326
+
327
+ // Background Position
328
+ $output .= '<select class="of-background of-background-position" name="' . esc_attr( $option_name . '[' . $value['id'] . '][position]' ) . '" id="' . esc_attr( $value['id'] . '_position' ) . '">';
329
+ $positions = of_recognized_background_position();
330
+
331
+ foreach ($positions as $key=>$position) {
332
+ $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['position'], $key, false ) . '>'. esc_html( $position ) . '</option>';
333
+ }
334
+ $output .= '</select>';
335
+
336
+ // Background Attachment
337
+ $output .= '<select class="of-background of-background-attachment" name="' . esc_attr( $option_name . '[' . $value['id'] . '][attachment]' ) . '" id="' . esc_attr( $value['id'] . '_attachment' ) . '">';
338
+ $attachments = of_recognized_background_attachment();
339
+
340
+ foreach ($attachments as $key => $attachment) {
341
+ $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['attachment'], $key, false ) . '>' . esc_html( $attachment ) . '</option>';
342
+ }
343
+ $output .= '</select>';
344
+ $output .= '</div>';
345
+
346
+ break;
347
+
348
+ // Editor
349
+ case 'editor':
350
+ $output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags ) . '</div>'."\n";
351
+ echo $output;
352
+ $textarea_name = esc_attr( $option_name . '[' . $value['id'] . ']' );
353
+ $default_editor_settings = array(
354
+ 'textarea_name' => $textarea_name,
355
+ 'media_buttons' => false,
356
+ 'tinymce' => array( 'plugins' => 'wordpress' )
357
+ );
358
+ $editor_settings = array();
359
+ if ( isset( $value['settings'] ) ) {
360
+ $editor_settings = $value['settings'];
361
+ }
362
+ $editor_settings = array_merge( $default_editor_settings, $editor_settings );
363
+ wp_editor( $val, $value['id'], $editor_settings );
364
+ $output = '';
365
+ break;
366
+
367
+ // Info
368
+ case "info":
369
+ $id = '';
370
+ $class = 'section';
371
+ if ( isset( $value['id'] ) ) {
372
+ $id = 'id="' . esc_attr( $value['id'] ) . '" ';
373
+ }
374
+ if ( isset( $value['type'] ) ) {
375
+ $class .= ' section-' . $value['type'];
376
+ }
377
+ if ( isset( $value['class'] ) ) {
378
+ $class .= ' ' . $value['class'];
379
+ }
380
+
381
+ $output .= '<div ' . $id . 'class="' . esc_attr( $class ) . '">' . "\n";
382
+ if ( isset($value['name']) ) {
383
+ $output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
384
+ }
385
+ if ( $value['desc'] ) {
386
+ $output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n";
387
+ }
388
+ $output .= '</div>' . "\n";
389
+ break;
390
+
391
+ // Heading for Navigation
392
+ case "heading":
393
+ $counter++;
394
+ if ( $counter >= 2 ) {
395
+ $output .= '</div>'."\n";
396
+ }
397
+ $class = '';
398
+ $class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
399
+ $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) );
400
+ $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
401
+ $output .= '<h3>' . esc_html( $value['name'] ) . '</h3>' . "\n";
402
+ break;
403
+ }
404
+
405
+ if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
406
+ $output .= '</div>';
407
+ if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) {
408
+ $output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags) . '</div>'."\n";
409
+ }
410
+ $output .= '</div></div>'."\n";
411
+ }
412
+
413
+ echo $output;
414
+ }
415
+
416
+ // Outputs closing div if there tabs
417
+ if ( Options_Framework_Interface::optionsframework_tabs() != '' ) {
418
+ echo '</div>';
419
+ }
420
+ }
421
+
422
+ }
includes/class-options-media-uploader.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2013 WP Theming
8
+ */
9
+
10
+ class Options_Framework_Media_Uploader {
11
+
12
+ /**
13
+ * Initialize the media uploader class
14
+ *
15
+ * @since 1.7.0
16
+ */
17
+ public function init() {
18
+ add_action( 'admin_enqueue_scripts', array( $this, 'optionsframework_media_scripts' ) );
19
+ }
20
+
21
+ /**
22
+ * Media Uploader Using the WordPress Media Library.
23
+ *
24
+ * Parameters:
25
+ *
26
+ * string $_id - A token to identify this field (the name).
27
+ * string $_value - The value of the field, if present.
28
+ * string $_desc - An optional description of the field.
29
+ *
30
+ */
31
+
32
+ static function optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
33
+
34
+ $optionsframework_settings = get_option( 'optionsframework' );
35
+
36
+ // Gets the unique option id
37
+ $option_name = $optionsframework_settings['id'];
38
+
39
+ $output = '';
40
+ $id = '';
41
+ $class = '';
42
+ $int = '';
43
+ $value = '';
44
+ $name = '';
45
+
46
+ $id = strip_tags( strtolower( $_id ) );
47
+
48
+ // If a value is passed and we don't have a stored value, use the value that's passed through.
49
+ if ( $_value != '' && $value == '' ) {
50
+ $value = $_value;
51
+ }
52
+
53
+ if ($_name != '') {
54
+ $name = $_name;
55
+ }
56
+ else {
57
+ $name = $option_name.'['.$id.']';
58
+ }
59
+
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', 'optionsframework') .'" />' . "\n";
64
+ if ( function_exists( 'wp_enqueue_media' ) ) {
65
+ if ( ( $value == '' ) ) {
66
+ $output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( 'Upload', 'optionsframework' ) . '" />' . "\n";
67
+ } else {
68
+ $output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'optionsframework' ) . '" />' . "\n";
69
+ }
70
+ } else {
71
+ $output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'optionsframework' ) . '</i></p>';
72
+ }
73
+
74
+ if ( $_desc != '' ) {
75
+ $output .= '<span class="of-metabox-desc">' . $_desc . '</span>' . "\n";
76
+ }
77
+
78
+ $output .= '<div class="screenshot" id="' . $id . '-image">' . "\n";
79
+
80
+ if ( $value != '' ) {
81
+ $remove = '<a class="remove-image">Remove</a>';
82
+ $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value );
83
+ if ( $image ) {
84
+ $output .= '<img src="' . $value . '" alt="" />' . $remove;
85
+ } else {
86
+ $parts = explode( "/", $value );
87
+ for( $i = 0; $i < sizeof( $parts ); ++$i ) {
88
+ $title = $parts[$i];
89
+ }
90
+
91
+ // No output preview if it's not an image.
92
+ $output .= '';
93
+
94
+ // Standard generic output if it's not an image.
95
+ $title = __( 'View File', 'optionsframework' );
96
+ $output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">'.$title.'</a></span></div>';
97
+ }
98
+ }
99
+ $output .= '</div>' . "\n";
100
+ return $output;
101
+ }
102
+
103
+ /**
104
+ * Enqueue scripts for file uploader
105
+ */
106
+ function optionsframework_media_scripts( $hook ) {
107
+
108
+ $menu = Options_Framework_Admin::menu_settings();
109
+
110
+ if ( 'appearance_page_' . $menu['menu_slug'] != $hook )
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', 'optionsframework' ),
120
+ 'remove' => __( 'Remove', 'optionsframework' )
121
+ ) );
122
+ }
123
+ }
options-sanitize.php → includes/class-options-sanitization.php RENAMED
@@ -1,4 +1,11 @@
1
  <?php
 
 
 
 
 
 
 
2
 
3
  /* Text */
4
 
@@ -10,7 +17,7 @@ add_filter( 'of_sanitize_password', 'sanitize_text_field' );
10
 
11
  /* Textarea */
12
 
13
- function of_sanitize_textarea($input) {
14
  global $allowedposttags;
15
  $output = wp_kses( $input, $allowedposttags);
16
  return $output;
@@ -92,23 +99,21 @@ add_filter( 'of_sanitize_editor', 'of_sanitize_editor' );
92
 
93
  /* Allowed Tags */
94
 
95
- function of_sanitize_allowedtags($input) {
96
  global $allowedtags;
97
- $output = wpautop(wp_kses( $input, $allowedtags));
98
  return $output;
99
  }
100
 
101
  /* Allowed Post Tags */
102
 
103
- function of_sanitize_allowedposttags($input) {
104
  global $allowedposttags;
105
  $output = wpautop(wp_kses( $input, $allowedposttags));
106
  return $output;
107
  }
108
-
109
  add_filter( 'of_sanitize_info', 'of_sanitize_allowedposttags' );
110
 
111
-
112
  /* Check that the key value sent is valid */
113
 
114
  function of_sanitize_enum( $input, $option ) {
@@ -233,10 +238,10 @@ add_filter( 'of_font_face', 'of_sanitize_font_face' );
233
  */
234
  function of_recognized_background_repeat() {
235
  $default = array(
236
- 'no-repeat' => __('No Repeat', 'optionsframework'),
237
- 'repeat-x' => __('Repeat Horizontally', 'optionsframework'),
238
- 'repeat-y' => __('Repeat Vertically', 'optionsframework'),
239
- 'repeat' => __('Repeat All', 'optionsframework'),
240
  );
241
  return apply_filters( 'of_recognized_background_repeat', $default );
242
  }
@@ -249,15 +254,15 @@ function of_recognized_background_repeat() {
249
  */
250
  function of_recognized_background_position() {
251
  $default = array(
252
- 'top left' => __('Top Left', 'optionsframework'),
253
- 'top center' => __('Top Center', 'optionsframework'),
254
- 'top right' => __('Top Right', 'optionsframework'),
255
- 'center left' => __('Middle Left', 'optionsframework'),
256
- 'center center' => __('Middle Center', 'optionsframework'),
257
- 'center right' => __('Middle Right', 'optionsframework'),
258
- 'bottom left' => __('Bottom Left', 'optionsframework'),
259
- 'bottom center' => __('Bottom Center', 'optionsframework'),
260
- 'bottom right' => __('Bottom Right', 'optionsframework')
261
  );
262
  return apply_filters( 'of_recognized_background_position', $default );
263
  }
@@ -270,8 +275,8 @@ function of_recognized_background_position() {
270
  */
271
  function of_recognized_background_attachment() {
272
  $default = array(
273
- 'scroll' => __('Scroll Normally', 'optionsframework'),
274
- 'fixed' => __('Fixed in Place', 'optionsframework')
275
  );
276
  return apply_filters( 'of_recognized_background_attachment', $default );
277
  }
1
  <?php
2
+ /**
3
+ * @package Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2013 WP Theming
8
+ */
9
 
10
  /* Text */
11
 
17
 
18
  /* Textarea */
19
 
20
+ function of_sanitize_textarea( $input) {
21
  global $allowedposttags;
22
  $output = wp_kses( $input, $allowedposttags);
23
  return $output;
99
 
100
  /* Allowed Tags */
101
 
102
+ function of_sanitize_allowedtags( $input ) {
103
  global $allowedtags;
104
+ $output = wpautop( wp_kses( $input, $allowedtags ) );
105
  return $output;
106
  }
107
 
108
  /* Allowed Post Tags */
109
 
110
+ function of_sanitize_allowedposttags( $input ) {
111
  global $allowedposttags;
112
  $output = wpautop(wp_kses( $input, $allowedposttags));
113
  return $output;
114
  }
 
115
  add_filter( 'of_sanitize_info', 'of_sanitize_allowedposttags' );
116
 
 
117
  /* Check that the key value sent is valid */
118
 
119
  function of_sanitize_enum( $input, $option ) {
238
  */
239
  function of_recognized_background_repeat() {
240
  $default = array(
241
+ 'no-repeat' => __( 'No Repeat', 'optionsframework' ),
242
+ 'repeat-x' => __( 'Repeat Horizontally', 'optionsframework' ),
243
+ 'repeat-y' => __( 'Repeat Vertically', 'optionsframework' ),
244
+ 'repeat' => __( 'Repeat All', 'optionsframework' ),
245
  );
246
  return apply_filters( 'of_recognized_background_repeat', $default );
247
  }
254
  */
255
  function of_recognized_background_position() {
256
  $default = array(
257
+ 'top left' => __( 'Top Left', 'optionsframework' ),
258
+ 'top center' => __( 'Top Center', 'optionsframework' ),
259
+ 'top right' => __( 'Top Right', 'optionsframework' ),
260
+ 'center left' => __( 'Middle Left', 'optionsframework' ),
261
+ 'center center' => __( 'Middle Center', 'optionsframework' ),
262
+ 'center right' => __( 'Middle Right', 'optionsframework' ),
263
+ 'bottom left' => __( 'Bottom Left', 'optionsframework' ),
264
+ 'bottom center' => __( 'Bottom Center', 'optionsframework' ),
265
+ 'bottom right' => __( 'Bottom Right', 'optionsframework')
266
  );
267
  return apply_filters( 'of_recognized_background_position', $default );
268
  }
275
  */
276
  function of_recognized_background_attachment() {
277
  $default = array(
278
+ 'scroll' => __( 'Scroll Normally', 'optionsframework' ),
279
+ 'fixed' => __( 'Fixed in Place', 'optionsframework')
280
  );
281
  return apply_filters( 'of_recognized_background_attachment', $default );
282
  }
js/color-picker.min.js DELETED
@@ -1 +0,0 @@
1
- (function(f,e){var a='<a tabindex="0" class="wp-color-result" />',c='<div class="wp-picker-holder" />',b='<div class="wp-picker-container" />',g='<input type="button" class="button button-small hidden" />';var d={options:{defaultColor:false,change:false,clear:false,hide:true,palettes:true},_create:function(){if(f.browser.msie&&parseInt(f.browser.version,10)<8){return}var h=this;var i=h.element;f.extend(h.options,i.data());h.initialValue=i.val();i.addClass("wp-color-picker").hide().wrap(b);h.wrap=i.parent();h.toggler=f(a).insertBefore(i).css({backgroundColor:h.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);h.pickerContainer=f(c).insertAfter(i);h.button=f(g);if(h.options.defaultColor){h.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{h.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}i.wrap('<span class="wp-picker-input-wrap" />').after(h.button);i.iris({target:h.pickerContainer,hide:true,width:255,mode:"hsv",palettes:h.options.palettes,change:function(j,k){h.toggler.css({backgroundColor:k.color.toString()});if(f.isFunction(h.options.change)){h.options.change.call(this,j,k)}}});i.val(h.initialValue);h._addListeners();if(!h.options.hide){h.toggler.click()}},_addListeners:function(){var h=this;h.toggler.click(function(i){i.stopPropagation();h.element.toggle().iris("toggle");h.button.toggleClass("hidden");h.toggler.toggleClass("wp-picker-open");if(h.toggler.hasClass("wp-picker-open")){f("body").on("click",{wrap:h.wrap,toggler:h.toggler},h._bodyListener)}else{f("body").off("click",h._bodyListener)}});h.element.change(function(j){var i=f(this),k=i.val();if(k===""||k==="#"){h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}});h.toggler.on("keyup",function(i){if(i.keyCode===13||i.keyCode===32){i.preventDefault();h.toggler.trigger("click").next().focus()}});h.button.click(function(j){var i=f(this);if(i.hasClass("wp-picker-clear")){h.element.val("");h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}else{if(i.hasClass("wp-picker-default")){h.element.val(h.options.defaultColor).change()}}})},_bodyListener:function(h){if(!h.data.wrap.find(h.target).length){h.data.toggler.click()}},color:function(h){if(h===e){return this.element.iris("option","color")}this.element.iris("option","color",h)},defaultColor:function(h){if(h===e){return this.options.defaultColor}this.options.defaultColor=h}};f.widget("wp.wpColorPicker",d)}(jQuery));
 
js/iris.min.js DELETED
@@ -1,4 +0,0 @@
1
- /*! Iris - v0.9.14 - 2012-11-20
2
- * https://github.com/Automattic/Iris
3
- * Copyright (c) 2012 Matt Wiebe; Licensed GPL */
4
- (function(e,t){function u(){if(r)i="filter";else{var t=e('<div id="iris-gradtest" />'),n="linear-gradient(top,#fff,#000)";e.each(s,function(e,r){t.css("backgroundImage",r+n);if(t.css("backgroundImage").match("gradient"))return i=e,!1}),e.browser.webkit&&i===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css("backgroundImage").match("gradient")&&(i="webkit")),t.remove()}}function a(t,n){return t=t==="top"?"top":"left",n=e.isArray(n)?n:Array.prototype.slice.call(arguments,1),i==="webkit"?l(t,n):s[i]+"linear-gradient("+t+", "+n.join(", ")+")"}function f(t,n){t=t==="top"?"top":"left",n=e.isArray(n)?n:Array.prototype.slice.call(arguments,1);var r=t==="top"?0:1,i=e(this),s=n.length-1,o=parseInt(e.browser.version,10)>=8?"-ms-filter":"filter";o="filter";var u=r===1?"left":"top",a=r===1?"right":"bottom",f=r===1?"height":"width",l='<div class="iris-ie-gradient-shim" style="position:absolute;'+f+":100%;"+u+":%start%;"+a+":%end%;"+o+':%filter%;" data-color:"%color%"></div>',h="";i.css("position")==="static"&&i.css({position:"relative"}),n=c(n),e.each(n,function(e,t){if(e===s)return!1;var i=n[e+1];if(t.stop===i.stop)return;var o=100-parseFloat(i.stop)+"%";t.octoHex=(new Color(t.color)).toIEOctoHex(),i.octoHex=(new Color(i.color)).toIEOctoHex();var u="progid:DXImageTransform.Microsoft.Gradient(GradientType="+r+", StartColorStr='"+t.octoHex+"', EndColorStr='"+i.octoHex+"')";h+=l.replace("%start%",t.stop).replace("%end%",o).replace("%filter%",u)}),i.find(".iris-ie-gradient-shim").remove(),e(h).prependTo(i)}function l(t,n){var r=[];return t=t==="top"?"0% 0%,0% 100%,":"0% 100%,100% 100%,",n=c(n),e.each(n,function(e,t){r.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+r.join(",")+")"}function c(t){var n=[],r=[],i=[],s=t.length-1;return e.each(t,function(e,t){var i=t,s=!1,o=t.match(/1?[0-9]{1,2}%$/);o&&(i=t.replace(/\s?1?[0-9]{1,2}%$/,""),s=o.shift()),n.push(i),r.push(s)}),r[0]===!1&&(r[0]="0%"),r[s]===!1&&(r[s]="100%"),r=h(r),e.each(r,function(e){i[e]={color:n[e],stop:r[e]}}),i}function h(t){var n=0,r=t.length-1,i=0,s=!1,o,u,a,f;if(t.length<=2||e.inArray(!1,t)<0)return t;while(i<t.length-1)!s&&t[i]===!1?(n=i-1,s=!0):s&&t[i]!==!1&&(r=i,i=t.length),i++;u=r-n,f=parseInt(t[n].replace("%"),10),o=(parseFloat(t[r].replace("%"))-f)/u,i=n+1,a=1;while(i<r)t[i]=f+a*o+"%",a++,i++;return h(t)}var n='<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>',r=!!(e.browser.msie&&parseInt(e.browser.version,10)<10),i=!1,s=["-moz-","-webkit-","-o-","-ms-"],o='.iris-picker{display:block;position:relative}.iris-error{background-color:#ffafaf}.iris-border{border-radius:3px;border:1px solid #aaa;width:200px;background-color:#fff}.iris-picker-inner{position:absolute;top:0;right:0;left:0;bottom:0}.iris-border .iris-picker-inner{top:10px;right:10px;left:10px;bottom:10px}.iris-picker .iris-square-inner{position:absolute;left:0;right:0;top:0;bottom:0}.iris-picker .iris-square,.iris-picker .iris-slider,.iris-picker .iris-square-inner,.iris-picker .iris-palette{border-radius:3px;box-shadow:inset 0 0 5px rgba(0,0,0,0.4);height:100%;width:12.5%;float:left;margin-right:5%}.iris-picker .iris-square{width:76%;margin-right:10%;position:relative}.iris-picker .iris-square-inner{width:auto;margin:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-square-inner,.iris-ie-9 .iris-palette{box-shadow:none;border-radius:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-palette{outline:1px solid rgba(0,0,0,.1)}.iris-ie-lt9 .iris-square,.iris-ie-lt9 .iris-slider,.iris-ie-lt9 .iris-square-inner,.iris-ie-lt9 .iris-palette{outline:1px solid #aaa}.iris-ie-lt9 .iris-square .ui-slider-handle{outline:1px solid #aaa;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.iris-ie-lt9 .iris-square .iris-square-handle{background:none;border:3px solid #fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"}.iris-picker .iris-strip{margin-right:0;position:relative}.iris-picker .iris-strip .ui-slider-handle{position:absolute;background:none;right:-3px;left:-3px;border:4px solid #aaa;border-width:4px 3px;width:auto;height:6px;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);opacity:.9;z-index:5;cursor:ns-resize}.iris-strip .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;border-radius:3px}.iris-picker .iris-slider-offset{position:absolute;top:11px;left:0;right:0;bottom:-3px}.iris-picker .iris-square-handle{background:transparent;border:5px solid #aaa;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.iris-picker .iris-square-handle:hover{border-color:#999}.iris-picker .iris-square-value:focus .iris-square-handle{box-shadow:0 0 2px rgba(0,0,0,.75);opacity:.8}.iris-picker .iris-square-handle:hover::after{border-color:#fff}.iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.iris-palette-container{position:absolute;bottom:0;left:0;margin:0;padding:0}.iris-border .iris-palette-container{left:10px;bottom:10px}.iris-picker .iris-palette{margin:0;cursor:pointer}';if(r&&parseInt(e.browser.version,10)<=7)return e.fn.iris=e.noop;e.fn.gradient=function(t){var n=arguments;return this.each(function(){r?f.apply(this,n):e(this).css("backgroundImage",a.apply(this,n))})},e.fn.raninbowGradient=function(t,n){t=t||"top";var r=e.extend({},{s:100,l:50},n),i="hsl(%h%,"+r.s+"%,"+r.l+"%)",s=0,o=[];while(s<=360)o.push(i.replace("%h%",s)),s+=30;return this.each(function(){e(this).gradient(t,o)})};var p={options:{color:!1,mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},hide:!0,border:!0,target:!1,width:200,palettes:!1},_palettes:["#000","#fff","#d33","#d93","#ee2","#81d742","#1e73be","#8224e3"],_inited:!1,_scale:{h:360,s:100,l:100,v:100},_create:function(){var t=this,r=t.element,s=t.options.color||r.val(),o;i===!1&&u(),r.is("input")?(t.options.target?t.picker=e(n).appendTo(t.options.target):t.picker=e(n).insertAfter(r),t._addInputListeners(r)):(r.append(n),t.picker=r.find(".iris-picker"));if(e.browser.mozilla)t.picker.addClass("iris-mozilla");else if(e.browser.msie){var a=parseInt(e.browser.version,10);a===9?t.picker.addClass("iris-ie-9"):a<=8&&t.picker.addClass("iris-ie-lt9")}t.options.palettes&&t._addPalettes(),t.color=(new Color(s)).setHSpace(t.options.mode),t.options.color=t.color.toString(),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},t.options.mode==="hsv"&&t.options.controls.vert==="l"&&(t.options.controls={horiz:"h",vert:"v",strip:"s"}),t.hue=t.color.h(),t.options.hide&&t.picker.hide(),t.options.border&&t.picker.addClass("iris-border"),t._initControls(),t.active="external",t._dimensions(),t._change()},_addPalettes:function(){var t=e("<div class='iris-palette-container' />"),n=e("<a class='iris-palette' tabindex='0' />"),r=e.isArray(this.options.palettes)?this.options.palettes:this._palettes;e.each(r,function(e,r){n.clone().data("color",r).css("backgroundColor",r).appendTo(t).height(10).width(10)}),this.picker.append(t)},_paint:function(){var e=this;e._paintDimension("top","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var n=this,r=n.color,i=n.options.mode,s=n._getHSpaceColor(),o=n.controls[t],u=n.options.controls,a;if(t===n.active||n.active==="square"&&t!=="strip")return;switch(u[t]){case"h":if(i==="hsv"){s=r.clone();switch(t){case"horiz":s[u.vert](100);break;case"vert":s[u.horiz](100);break;case"strip":s.setHSpace("hsl")}a=s.toHsl()}else t==="strip"?a={s:s.s,l:s.l}:a={s:100,l:s.l};o.raninbowGradient(e,a);break;case"s":i==="hsv"?t==="vert"?a=[r.clone().a(0).s(0).toCSS("rgba"),r.clone().a(1).s(0).toCSS("rgba")]:t==="strip"?a=[r.clone().s(100).toCSS("hsl"),r.clone().s(0).toCSS("hsl")]:t==="horiz"&&(a=["#fff","hsl("+s.h+",100%,50%)"]):t==="vert"&&n.options.controls.horiz==="h"?a=["hsla(0, 0%, "+s.l+"%, 0)","hsla(0, 0%, "+s.l+"%, 1)"]:a=["hsl("+s.h+",0%,50%)","hsl("+s.h+",100%,50%)"],o.gradient(e,a);break;case"l":t==="strip"?a=["hsl("+s.h+",100%,100%)","hsl("+s.h+", "+s.s+"%,50%)","hsl("+s.h+",100%,0%)"]:a=["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],o.gradient(e,a);break;case"v":t==="strip"?a=[r.clone().v(100).toCSS(),r.clone().v(0).toCSS()]:a=["rgba(0,0,0,0)","#000"],o.gradient(e,a);break;default:}},_getHSpaceColor:function(){return this.options.mode==="hsv"?this.color.toHsv():this.color.toHsl()},_dimensions:function(t){var n=this,r=n.options,i=n.picker.find(".iris-picker-inner"),s=n.controls,o=s.square,u=n.picker.find(".iris-strip"),a="77.5%",f="12%",l=20,c=r.border?r.width-l:r.width,h,p=e.isArray(r.palettes)?r.palettes.length:n._palettes.length,d,v,m;t&&(o.css("width",""),u.css("width",""),n.picker.removeAttr("style")),a=c*(parseFloat(a)/100),f=c*(parseFloat(f)/100),h=r.border?a+l:a,o.width(a).height(a),u.height(a).width(f),n.picker.css({width:r.width,height:h});if(!r.palettes)return;d=a*2/100,m=a-(p-1)*d,v=m/p,n.picker.find(".iris-palette").each(function(t,n){var r=t===0?0:d;e(this).css({width:v,height:v,marginLeft:r})}),n.picker.css("paddingBottom",v+d),u.height(v+d+a)},_addInputListeners:function(e){var t=this,n=100,r=function(n){var r=new Color(e.val()),i=e.val().replace(/^#/,"");e.removeClass("iris-error"),r.error?i!==""&&e.addClass("iris-error"):r.toString()!==t.color.toString()&&(n.type!=="keyup"||!i.match(/^[0-9a-fA-F]{3}$/))&&t._setOption("color",r.toString())};e.on("change",r).on("keyup",t._debounce(r,n))},_initControls:function(){var t=this,n=t.controls,r=n.square,i=t.options.controls,s=t._scale[i.strip];n.stripSlider.slider({orientation:"vertical",max:s,slide:function(e,n){t.active="strip",i.strip==="h"&&(n.value=s-n.value),t.color[i.strip](n.value),t._change.apply(t,arguments)}}),n.squareDrag.draggable({containment:"parent",zIndex:1e3,cursor:"move",drag:function(e,n){t._squareDrag(e,n)},start:function(){r.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){r.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(n){n.preventDefault();var r="ui-state-focus";n.type==="mousedown"?(t.picker.find("."+r).removeClass(r).blur(),e(this).addClass(r).focus()):e(this).removeClass(r)}).on("keydown",function(e){var r=n.square,i=n.squareDrag,s=i.position(),o=t.options.width/100;e.altKey&&(o*=10);switch(e.keyCode){case 37:s.left-=o;break;case 38:s.top-=o;break;case 39:s.left+=o;break;case 40:s.top+=o;break;default:return!0}s.left=Math.max(0,Math.min(s.left,r.width())),s.top=Math.max(0,Math.min(s.top,r.height())),i.css(s),t._squareDrag(e,{position:s}),e.preventDefault()}),r.mousedown(function(n){if(n.which!==1)return;if(!e(n.target).is("div"))return;var r=t.controls.square.offset(),i={top:n.pageY-r.top,left:n.pageX-r.left};n.preventDefault(),t._squareDrag(n,{position:i}),n.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(i).trigger(n)}),t.options.palettes&&t.picker.find(".iris-palette-container").on("click",".iris-palette",function(n){t.color.fromCSS(e(this).data("color")),t.active="external",t._change()}).on("keydown",".iris-palette",function(t){if(t.keyCode!==13&&t.keyCode!==32)return!0;t.stopPropagation(),e(this).click()})},_squareDrag:function(e,t){var n=this,r=n.options.controls,i=n._squareDimensions(),s=Math.round((i.h-t.position.top)/i.h*n._scale[r.vert]),o=n._scale[r.horiz]-Math.round((i.w-t.position.left)/i.w*n._scale[r.horiz]);n.color[r.horiz](o)[r.vert](s),n.active="square",n._change.apply(n,arguments)},_setOption:function(e,t){var n=this.options[e];if(e==="color"){t=""+t;var r=t.replace(/^#/,""),i=(new Color(t)).setHSpace(this.options.mode);i.error||(this.color=i,this.options.color=this.options[e]=this.color.toString(),this.active="external",this._change())}},_squareDimensions:function(e){var n=this.controls.square,r,i;return e!==t&&n.data("dimensions")?n.data("dimensions"):(i=this.controls.squareDrag,r={w:n.width(),h:n.height()},n.data("dimensions",r),r)},_isNonHueControl:function(e,t){return e==="square"&&this.options.controls.strip==="h"?!0:t==="external"||t==="h"&&e==="strip"?!1:!0},_change:function(t,n){var r=this,i=r.controls,s=r._getHSpaceColor(),o=r.color.toString(),u=["square","strip"],a=r.options.controls,f=a[r.active]||"external",l=r.hue;r.active==="strip"?u=[]:r.active!=="external"&&u.pop(),e.each(u,function(e,t){var n;if(t!==r.active)switch(t){case"strip":n=a.strip==="h"?r._scale[a.strip]-s[a.strip]:s[a.strip],i.stripSlider.slider("value",n);break;case"square":var o=r._squareDimensions(),u={left:s[a.horiz]/r._scale[a.horiz]*o.w,top:o.h-s[a.vert]/r._scale[a.vert]*o.h};r.controls.squareDrag.css(u)}}),s.h!==l&&r._isNonHueControl(r.active,f)&&r.color.h(l),r.hue=r.color.h(),r.options.color=r.color.toString(),r._inited&&r._trigger("change",{type:r.active},{color:r.color}),r.element.is(":input")&&!r.color.error&&(r.element.removeClass("iris-error"),r.element.val()!==r.color.toString()&&r.element.val(r.color.toString())),r._paint(),r._inited=!0,r.active=!1},_debounce:function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},show:function(){this.picker.show()},hide:function(){this.picker.hide()},toggle:function(){this.picker.toggle()}};e.widget("a8c.iris",p),e('<style id="iris-css">'+o+"</style>").appendTo("head")})(jQuery),function(e,t){var n=function(e,t){return this instanceof n?this._init(e,t):new n(e,t)};n.fn=n.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var n="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),n=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":n,this[n](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){var e=new n(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"];for(var r=t.length-1;r>=0;r--)e[t[r]]=this[t[r]];return e},setHSpace:function(e){return this._hSpace=e==="hsv"?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,n,r=/^(rgb|hs(l|v))a?\(/;this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,"");if(e.match(r)&&e.match(/\)$/)){n=e.replace(/(\s|%)/g,"").replace(r,"").replace(/,?\);?$/,"").split(",");if(n.length<3)return this._error();if(n.length===4){this.a(parseFloat(n.pop()));if(this.error)return this}for(var i=n.length-1;i>=0;i--){n[i]=parseInt(n[i],10);if(isNaN(n[i]))return this._error()}return e.match(/^rgb/)?this.fromRgb({r:n[0],g:n[1],b:n[2]}):e.match(/^hsv/)?this.fromHsv({h:n[0],s:n[1],v:n[2]}):this.fromHsl({h:n[0],s:n[1],l:n[2]})}return this.fromHex(e)},fromRgb:function(e,n){return typeof e!="object"||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),n))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var n,r,i,s,o,u,a,f;return typeof e!="object"||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",u=e.h/360,a=e.s/100,f=e.l/100,a===0?n=r=i=f:(s=f<.5?f*(1+a):f+a-f*a,o=2*f-s,n=this.hue2rgb(o,s,u+1/3),r=this.hue2rgb(o,s,u),i=this.hue2rgb(o,s,u-1/3)),this.fromRgb({r:n*255,g:r*255,b:i*255},!0))},fromHsv:function(e){var n,r,i,s,o,u,a,f,l,c,h;if(typeof e!="object"||e.h===t||e.s===t||e.v===t)return this._error();this._hsv=e,this._hSpace="hsv",n=e.h/360,r=e.s/100,i=e.v/100,a=Math.floor(n*6),f=n*6-a,l=i*(1-r),c=i*(1-f*r),h=i*(1-(1-f)*r);switch(a%6){case 0:s=i,o=h,u=l;break;case 1:s=c,o=i,u=l;break;case 2:s=l,o=i,u=h;break;case 3:s=l,o=c,u=i;break;case 4:s=h,o=l,u=i;break;case 5:s=i,o=l,u=c}return this.fromRgb({r:s*255,g:o*255,b:u*255},!0)},fromInt:function(e,n){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),n===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},toString:function(){var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){e=e||"hex",t=parseFloat(t||this._alpha);switch(e){case"rgb":case"rgba":var n=this.toRgb();return t<1?"rgba( "+n.r+", "+n.g+", "+n.b+", "+t+" )":"rgb( "+n.r+", "+n.g+", "+n.b+" )";case"hsl":case"hsla":var r=this.toHsl();return t<1?"hsla( "+r.h+", "+r.s+"%, "+r.l+"%, "+t+" )":"hsl( "+r.h+", "+r.s+"%, "+r.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o,u,a=(i+s)/2;if(i===s)o=u=0;else{var f=i-s;u=a>.5?f/(2-i-s):f/(i+s);switch(i){case t:o=(n-r)/f+(n<r?6:0);break;case n:o=(r-t)/f+2;break;case r:o=(t-n)/f+4}o/=6}return o=Math.round(o*360),o===0&&this._hsl.h!==o&&(o=this._hsl.h),u=Math.round(u*100),u===0&&this._hsl.s&&(u=this._hsl.s),{h:o,s:u,l:Math.round(a*100)}},toHsv:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o,u,a=i,f=i-s;u=i===0?0:f/i;if(i===s)o=u=0;else{switch(i){case t:o=(n-r)/f+(n<r?6:0);break;case n:o=(r-t)/f+2;break;case r:o=(t-n)/f+4}o/=6}return o=Math.round(o*360),o===0&&this._hsv.h!==o&&(o=this._hsv.h),u=Math.round(u*100),u===0&&this._hsv.s&&(u=this._hsv.s),{h:o,s:u,v:Math.round(a*100)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return t.length===1&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(e instanceof n){var t=this.toLuminosity(),r=e.toLuminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)}throw"getDistanceLuminosityFrom requires a Color object"},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new n(t)},getGrayscaleContrastingColor:function(e){if(!e)return this.getMaxContrastColor();var t=e<5?5:e,n=this.getMaxContrastColor();e=n.getDistanceLuminosityFrom(this);if(e<=t)return n;var r=0===n.toInt()?1:-1;while(e>t)n=n.incrementLightness(r),e=n.getDistanceLuminosityFrom(this);return n},getReadableContrastingColor:function(e,r){if(!e instanceof n)return this;var i=r===t?5:r,s=e.getDistanceLuminosityFrom(this),o=e.getMaxContrastColor(),u=o.getDistanceLuminosityFrom(e);if(u<=i)return o;if(s>=i)return this;var a=0===o.toInt()?-1:1;while(s<i){this.incrementLightness(a),s=this.getDistanceLuminosityFrom(e);if(this._color===0||this._color===16777215)break}return this},a:function(e){if(e===t)return this._alpha;var n=parseFloat(e);return isNaN(n)?this._error():(this._alpha=n,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+e*30;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=e*30;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=e*60;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=e*120;return this.h(t,!0)},_partial:function(e){var n=r[e];return function(r,i){var s=this._spaceFunc("to",n.space);return r===t?s[e]:(i===!0&&(r=s[e]+r),n.mod&&(r%=n.mod),n.range&&(r=r<n.range[0]?n.range[0]:r>n.range[1]?n.range[1]:r),s[e]=r,this._spaceFunc("from",n.space,s))}},_spaceFunc:function(e,t,n){var r=t||this._hSpace,i=e+r.charAt(0).toUpperCase()+r.substr(1);return this[i](n)}};var r={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var i in r)r.hasOwnProperty(i)&&(n.fn[i]=n.fn._partial(i));e.Color=n}(typeof exports=="object"&&exports||this);
 
 
 
 
js/media-uploader.js CHANGED
@@ -1,21 +1,22 @@
1
- (function($) {
2
- $(document).ready(function() {
3
 
4
- function optionsframework_add_file(event, selector) {
5
-
6
- var upload = $(".uploaded-file"), frame;
7
- var $el = $(this);
8
 
9
- event.preventDefault();
10
 
11
- // If the media frame already exists, reopen it.
12
- if ( frame ) {
13
- frame.open();
14
- return;
15
- }
16
 
 
 
 
 
 
 
17
  // Create the media frame.
18
- frame = wp.media({
19
  // Set the title of the modal.
20
  title: $el.data('choose'),
21
 
@@ -30,49 +31,49 @@
30
  });
31
 
32
  // When an image is selected, run a callback.
33
- frame.on( 'select', function() {
34
  // Grab the selected attachment.
35
- var attachment = frame.state().get('selection').first();
36
- frame.close();
37
- selector.find('.upload').val(attachment.attributes.url);
38
  if ( attachment.attributes.type == 'image' ) {
39
- selector.find('.screenshot').empty().hide().append('<img src="' + attachment.attributes.url + '"><a class="remove-image">Remove</a>').slideDown('fast');
40
  }
41
- selector.find('.upload-button').unbind().addClass('remove-file').removeClass('upload-button').val(optionsframework_l10n.remove);
42
- selector.find('.of-background-properties').slideDown();
43
- selector.find('.remove-image, .remove-file').on('click', function() {
44
  optionsframework_remove_file( $(this).parents('.section') );
45
  });
46
  });
47
 
48
- // Finally, open the modal.
49
- frame.open();
50
  }
51
-
52
- function optionsframework_remove_file(selector) {
53
- selector.find('.remove-image').hide();
54
- selector.find('.upload').val('');
55
- selector.find('.of-background-properties').hide();
56
- selector.find('.screenshot').slideUp();
57
- selector.find('.remove-file').unbind().addClass('upload-button').removeClass('remove-file').val(optionsframework_l10n.upload);
58
- // We don't display the upload button if .upload-notice is present
59
- // This means the user doesn't have the WordPress 3.5 Media Library Support
60
- if ( $('.section-upload .upload-notice').length > 0 ) {
61
- $('.upload-button').remove();
62
- }
63
- selector.find('.upload-button').on('click', function() {
64
- optionsframework_add_file(event, $(this).parents('.section'));
65
- });
66
  }
67
-
68
- $('.remove-image, .remove-file').on('click', function() {
69
- optionsframework_remove_file( $(this).parents('.section') );
70
- });
71
-
72
- $('.upload-button').click( function( event ) {
73
- optionsframework_add_file(event, $(this).parents('.section'));
74
- });
75
-
 
 
76
  });
77
-
78
- })(jQuery);
1
+ jQuery(document).ready(function($){
 
2
 
3
+ var optionsframework_upload;
4
+ var optionsframework_selector;
 
 
5
 
6
+ function optionsframework_add_file(event, selector) {
7
 
8
+ var upload = $(".uploaded-file"), frame;
9
+ var $el = $(this);
10
+ optionsframework_selector = selector;
 
 
11
 
12
+ event.preventDefault();
13
+
14
+ // If the media frame already exists, reopen it.
15
+ if ( optionsframework_upload ) {
16
+ optionsframework_upload.open();
17
+ } else {
18
  // Create the media frame.
19
+ optionsframework_upload = wp.media.frames.optionsframework_upload = wp.media({
20
  // Set the title of the modal.
21
  title: $el.data('choose'),
22
 
31
  });
32
 
33
  // When an image is selected, run a callback.
34
+ optionsframework_upload.on( 'select', function() {
35
  // Grab the selected attachment.
36
+ var attachment = optionsframework_upload.state().get('selection').first();
37
+ optionsframework_upload.close();
38
+ optionsframework_selector.find('.upload').val(attachment.attributes.url);
39
  if ( attachment.attributes.type == 'image' ) {
40
+ optionsframework_selector.find('.screenshot').empty().hide().append('<img src="' + attachment.attributes.url + '"><a class="remove-image">Remove</a>').slideDown('fast');
41
  }
42
+ optionsframework_selector.find('.upload-button').unbind().addClass('remove-file').removeClass('upload-button').val(optionsframework_l10n.remove);
43
+ optionsframework_selector.find('.of-background-properties').slideDown();
44
+ optionsframework_selector.find('.remove-image, .remove-file').on('click', function() {
45
  optionsframework_remove_file( $(this).parents('.section') );
46
  });
47
  });
48
 
 
 
49
  }
50
+
51
+ // Finally, open the modal.
52
+ optionsframework_upload.open();
53
+ }
54
+
55
+ function optionsframework_remove_file(selector) {
56
+ selector.find('.remove-image').hide();
57
+ selector.find('.upload').val('');
58
+ selector.find('.of-background-properties').hide();
59
+ selector.find('.screenshot').slideUp();
60
+ selector.find('.remove-file').unbind().addClass('upload-button').removeClass('remove-file').val(optionsframework_l10n.upload);
61
+ // We don't display the upload button if .upload-notice is present
62
+ // This means the user doesn't have the WordPress 3.5 Media Library Support
63
+ if ( $('.section-upload .upload-notice').length > 0 ) {
64
+ $('.upload-button').remove();
65
  }
66
+ selector.find('.upload-button').on('click', function(event) {
67
+ optionsframework_add_file(event, $(this).parents('.section'));
68
+ });
69
+ }
70
+
71
+ $('.remove-image, .remove-file').on('click', function() {
72
+ optionsframework_remove_file( $(this).parents('.section') );
73
+ });
74
+
75
+ $('.upload-button').click( function( event ) {
76
+ optionsframework_add_file(event, $(this).parents('.section'));
77
  });
78
+
79
+ });
js/options-custom.js CHANGED
@@ -1,91 +1,76 @@
1
  /**
2
- * Prints out the inline javascript needed for the colorpicker and choosing
3
- * the tabs in the panel.
4
  */
5
 
6
  jQuery(document).ready(function($) {
7
-
8
- // Fade out the save message
9
- $('.fade').delay(1000).fadeOut(1000);
10
-
11
  $('.of-color').wpColorPicker();
12
-
13
- // Switches option sections
14
- $('.group').hide();
15
- var active_tab = '';
16
- if (typeof(localStorage) != 'undefined' ) {
17
- active_tab = localStorage.getItem("active_tab");
18
- }
19
- if (active_tab != '' && $(active_tab).length ) {
20
- $(active_tab).fadeIn();
21
- } else {
22
- $('.group:first').fadeIn();
23
- }
24
- $('.group .collapsed').each(function(){
25
- $(this).find('input:checked').parent().parent().parent().nextAll().each(
26
- function(){
27
- if ($(this).hasClass('last')) {
28
- $(this).removeClass('hidden');
29
- return false;
30
- }
31
- $(this).filter('.hidden').removeClass('hidden');
32
- });
33
- });
34
- if (active_tab != '' && $(active_tab + '-tab').length ) {
35
- $(active_tab + '-tab').addClass('nav-tab-active');
36
- }
37
- else {
38
- $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
39
- }
40
-
41
- $('.nav-tab-wrapper a').click(function(evt) {
42
- $('.nav-tab-wrapper a').removeClass('nav-tab-active');
43
- $(this).addClass('nav-tab-active').blur();
44
- var clicked_group = $(this).attr('href');
45
- if (typeof(localStorage) != 'undefined' ) {
46
- localStorage.setItem("active_tab", $(this).attr('href'));
47
- }
48
- $('.group').hide();
49
- $(clicked_group).fadeIn();
50
- evt.preventDefault();
51
-
52
- // Editor Height (needs improvement)
53
- $('.wp-editor-wrap').each(function() {
54
- var editor_iframe = $(this).find('iframe');
55
- if ( editor_iframe.height() < 30 ) {
56
- editor_iframe.css({'height':'auto'});
57
- }
58
- });
59
-
60
- });
61
-
62
- $('.group .collapsed input:checkbox').click(unhideHidden);
63
-
64
- function unhideHidden(){
65
- if ($(this).attr('checked')) {
66
- $(this).parent().parent().parent().nextAll().removeClass('hidden');
67
- }
68
- else {
69
- $(this).parent().parent().parent().nextAll().each(
70
- function(){
71
- if ($(this).filter('.last').length) {
72
- $(this).addClass('hidden');
73
- return false;
74
- }
75
- $(this).addClass('hidden');
76
- });
77
-
78
- }
79
- }
80
-
81
  // Image Options
82
  $('.of-radio-img-img').click(function(){
83
  $(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
84
- $(this).addClass('of-radio-img-selected');
85
  });
86
-
87
  $('.of-radio-img-label').hide();
88
  $('.of-radio-img-img').show();
89
  $('.of-radio-img-radio').hide();
90
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  });
1
  /**
2
+ * Custom scripts needed for the colorpicker, image button selectors,
3
+ * and navigation tabs.
4
  */
5
 
6
  jQuery(document).ready(function($) {
7
+
8
+ // Loads the color pickers
 
 
9
  $('.of-color').wpColorPicker();
10
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  // Image Options
12
  $('.of-radio-img-img').click(function(){
13
  $(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
14
+ $(this).addClass('of-radio-img-selected');
15
  });
16
+
17
  $('.of-radio-img-label').hide();
18
  $('.of-radio-img-img').show();
19
  $('.of-radio-img-radio').hide();
20
+
21
+ // Loads tabbed sections if they exist
22
+ if ( $('.nav-tab-wrapper').length > 0 ) {
23
+ options_framework_tabs();
24
+ }
25
+
26
+ function options_framework_tabs() {
27
+
28
+ // Hides all the .group sections to start
29
+ $('.group').hide();
30
+
31
+ // Find if a selected tab is saved in localStorage
32
+ var active_tab = '';
33
+ if ( typeof(localStorage) != 'undefined' ) {
34
+ active_tab = localStorage.getItem("active_tab");
35
+ }
36
+
37
+ // If active tab is saved and exists, load it's .group
38
+ if (active_tab != '' && $(active_tab).length ) {
39
+ $(active_tab).fadeIn();
40
+ $(active_tab + '-tab').addClass('nav-tab-active');
41
+ } else {
42
+ $('.group:first').fadeIn();
43
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
44
+ }
45
+
46
+ // Bind tabs clicks
47
+ $('.nav-tab-wrapper a').click(function(evt) {
48
+
49
+ evt.preventDefault();
50
+
51
+ // Remove active class from all tabs
52
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
53
+
54
+ $(this).addClass('nav-tab-active').blur();
55
+
56
+ var group = $(this).attr('href');
57
+
58
+ if (typeof(localStorage) != 'undefined' ) {
59
+ localStorage.setItem("active_tab", $(this).attr('href') );
60
+ }
61
+
62
+ $('.group').hide();
63
+ $(group).fadeIn();
64
+
65
+ // Editor height sometimes needs adjustment when unhidden
66
+ $('.wp-editor-wrap').each(function() {
67
+ var editor_iframe = $(this).find('iframe');
68
+ if ( editor_iframe.height() < 30 ) {
69
+ editor_iframe.css({'height':'auto'});
70
+ }
71
+ });
72
+
73
+ });
74
+ }
75
+
76
  });
{lang → languages}/options-framework-hu_HU.po RENAMED
File without changes
languages/options-framework-pt_PT.mo ADDED
Binary file
languages/options-framework-pt_PT.po ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Options Framework Plugin\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/options-framework-plugin\n"
7
+ "POT-Creation-Date: 2013-10-23 13:35:37+00:00\n"
8
+ "PO-Revision-Date: 2013-10-23 14:37-0000\n"
9
+ "Last-Translator: Pedro Duarte <pedroduarte@djope.com>\n"
10
+ "Language-Team: \n"
11
+ "Language: pt_PT\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.5.7\n"
16
+
17
+ #: options-check/options.php:32
18
+ msgid "One"
19
+ msgstr "Um"
20
+
21
+ #: options-check/options.php:33
22
+ msgid "Two"
23
+ msgstr "Dois"
24
+
25
+ #: options-check/options.php:34
26
+ msgid "Three"
27
+ msgstr "Três"
28
+
29
+ #: options-check/options.php:35
30
+ msgid "Four"
31
+ msgstr "Quatro"
32
+
33
+ #: options-check/options.php:36
34
+ msgid "Five"
35
+ msgstr "Cinco"
36
+
37
+ #: options-check/options.php:41
38
+ msgid "French Toast"
39
+ msgstr "Tosta"
40
+
41
+ #: options-check/options.php:42
42
+ msgid "Pancake"
43
+ msgstr "Panqueca"
44
+
45
+ #: options-check/options.php:43
46
+ msgid "Omelette"
47
+ msgstr "Omolete"
48
+
49
+ #: options-check/options.php:44
50
+ msgid "Crepe"
51
+ msgstr "Crepe"
52
+
53
+ #: options-check/options.php:45
54
+ msgid "Waffle"
55
+ msgstr "Waffle"
56
+
57
+ #: options-check/options.php:105
58
+ msgid "Basic Settings"
59
+ msgstr "Definições Básicas"
60
+
61
+ #: options-check/options.php:109
62
+ msgid "Input Text Mini"
63
+ msgstr "Campo de Texto Mini"
64
+
65
+ #: options-check/options.php:110
66
+ msgid "A mini text input field."
67
+ msgstr "Um campo de texto mini."
68
+
69
+ #: options-check/options.php:117
70
+ msgid "Input Text"
71
+ msgstr "Campo de Texto"
72
+
73
+ #: options-check/options.php:118
74
+ msgid "A text input field."
75
+ msgstr "Um campo de texto."
76
+
77
+ #: options-check/options.php:124
78
+ msgid "Textarea"
79
+ msgstr "Área de Texto"
80
+
81
+ #: options-check/options.php:125
82
+ msgid "Textarea description."
83
+ msgstr "Descrição da área de texto."
84
+
85
+ #: options-check/options.php:131
86
+ msgid "Input Select Small"
87
+ msgstr "Campo de Selecção Pequeno"
88
+
89
+ #: options-check/options.php:132
90
+ msgid "Small Select Box."
91
+ msgstr "Caixa de selecção pequena."
92
+
93
+ #: options-check/options.php:140
94
+ msgid "Input Select Wide"
95
+ msgstr "Campo de Selecção Largo"
96
+
97
+ #: options-check/options.php:141
98
+ msgid "A wider select box."
99
+ msgstr "Uma caixa de selecção mais larga."
100
+
101
+ #: options-check/options.php:148
102
+ msgid "Select a Category"
103
+ msgstr "Seleccione uma Categoria"
104
+
105
+ #: options-check/options.php:149
106
+ msgid "Passed an array of categories with cat_ID and cat_name"
107
+ msgstr "Passou uma série de categorias com cat_ID e cat_name"
108
+
109
+ #: options-check/options.php:155
110
+ msgid "Select a Tag"
111
+ msgstr "Seleccionar uma Etiqueta"
112
+
113
+ #: options-check/options.php:156
114
+ msgid "Passed an array of tags with term_id and term_name"
115
+ msgstr "Passou uma série de etiquetas com term_id e term_name"
116
+
117
+ #: options-check/options.php:162
118
+ msgid "Select a Page"
119
+ msgstr "Seleccione uma Página"
120
+
121
+ #: options-check/options.php:163
122
+ msgid "Passed an array of pages with ID and post_title"
123
+ msgstr "Passou uma série de categorias com cat_ID e cat_name"
124
+
125
+ #: options-check/options.php:169
126
+ msgid "Input Radio (one)"
127
+ msgstr "Campo de Rádio (um)"
128
+
129
+ #: options-check/options.php:170
130
+ msgid "Radio select with default options \"one\"."
131
+ msgstr "Selector rádio com opções por defeito \"um\""
132
+
133
+ #: options-check/options.php:177
134
+ msgid "Example Info"
135
+ msgstr "Exemplo de Informação"
136
+
137
+ #: options-check/options.php:178
138
+ msgid "This is just some example information you can put in the panel."
139
+ msgstr "Isto é apenas informação de exemplo que pode colocar no painel."
140
+
141
+ #: options-check/options.php:182
142
+ msgid "Input Checkbox"
143
+ msgstr "Caixa de Verificação"
144
+
145
+ #: options-check/options.php:183
146
+ msgid "Example checkbox, defaults to true."
147
+ msgstr "Caixa de verificação de exemplo, valor por defeito igual a \"true\"."
148
+
149
+ #: options-check/options.php:189
150
+ msgid "Advanced Settings"
151
+ msgstr "Definições Avançadas"
152
+
153
+ #: options-check/options.php:193
154
+ msgid "Check to Show a Hidden Text Input"
155
+ msgstr "Seleccionar para Mostrar um Campo de Texto Escondido"
156
+
157
+ #: options-check/options.php:194
158
+ msgid "Click here and see what happens."
159
+ msgstr "Click aqui e veja o que acontece."
160
+
161
+ #: options-check/options.php:199
162
+ msgid "Hidden Text Input"
163
+ msgstr "Campo de Texto Escondido"
164
+
165
+ #: options-check/options.php:200
166
+ msgid "This option is hidden unless activated by a checkbox click."
167
+ msgstr ""
168
+ "Esta opção encontra-se escondida a não ser que seja activada por uma caixa "
169
+ "de verificação."
170
+
171
+ #: options-check/options.php:207
172
+ msgid "Uploader Test"
173
+ msgstr "Texte de Upload"
174
+
175
+ #: options-check/options.php:208
176
+ msgid "This creates a full size uploader that previews the image."
177
+ msgstr "Isto cria um campo de upload com pré-visualização da imagem."
178
+
179
+ #: options-check/options.php:225
180
+ msgid "Example Background"
181
+ msgstr "Fundo de Exemplo"
182
+
183
+ #: options-check/options.php:226
184
+ msgid "Change the background CSS."
185
+ msgstr "Alterar o fundo CSS."
186
+
187
+ #: options-check/options.php:232
188
+ msgid "Multicheck"
189
+ msgstr "Multi-verificação"
190
+
191
+ #: options-check/options.php:233
192
+ msgid "Multicheck description."
193
+ msgstr "Descrição da multi-verificação."
194
+
195
+ #: options-check/options.php:240
196
+ msgid "Colorpicker"
197
+ msgstr "Selector de Cor"
198
+
199
+ #: options-check/options.php:241
200
+ msgid "No color selected by default."
201
+ msgstr "Sem cor seleccionada por defeito."
202
+
203
+ #: options-check/options.php:246
204
+ msgid "Typography"
205
+ msgstr "Tipografia"
206
+
207
+ #: options-check/options.php:247
208
+ msgid "Example typography."
209
+ msgstr "Tipografia de exemplo."
210
+
211
+ #: options-check/options.php:253
212
+ msgid "Custom Typography"
213
+ msgstr "Tipografia Customizada"
214
+
215
+ #: options-check/options.php:254
216
+ msgid "Custom typography options."
217
+ msgstr "Opções de tipografia customizada."
218
+
219
+ #: options-check/options.php:261
220
+ msgid "Text Editor"
221
+ msgstr "Editor de Texto"
222
+
223
+ #: options-check/options.php:279
224
+ msgid "Default Text Editor"
225
+ msgstr "Editor de Texto Padrão"
226
+
227
+ #: options-check/options.php:280
228
+ msgid ""
229
+ "You can also pass settings to the editor. Read more about wp_editor in <a "
230
+ "href=\"%1$s\" target=\"_blank\">the WordPress codex</a>"
231
+ msgstr ""
232
+ "Também é possível passer opções para o editor. Ler mais sobre wp_editor no "
233
+ "<a href=\"%1$s\" target=\"_blank\">codex do WordPress</a>"
234
+
235
+ #: options-framework.php:70
236
+ msgid ""
237
+ "Your current theme does not have support for the Options Framework plugin. "
238
+ "<a href=\"%1$s\" target=\"_blank\">Learn More</a> | <a href=\"%2$s\">Hide "
239
+ "Notice</a>"
240
+ msgstr ""
241
+ "O set tema actual não ten support para o plugin Options Framework. <a href="
242
+ "\"%1$s\" target=\"_blank\">Saber Mais</a> | <a href=\"%2$s\">Esconder</a>"
243
+
244
+ #: options-framework.php:259 options-framework.php:260
245
+ #: options-framework.php:490
246
+ msgid "Theme Options"
247
+ msgstr "Opções do Tema"
248
+
249
+ #: options-framework.php:305
250
+ msgid "Clear"
251
+ msgstr "Limpar"
252
+
253
+ #: options-framework.php:306
254
+ msgid "Default"
255
+ msgstr "Padrão"
256
+
257
+ #: options-framework.php:307
258
+ msgid "Select Color"
259
+ msgstr "Seleccionar Cor"
260
+
261
+ #: options-framework.php:353
262
+ msgid "Save Options"
263
+ msgstr "Guardar Opções"
264
+
265
+ #: options-framework.php:354
266
+ msgid "Restore Defaults"
267
+ msgstr "Restaurar Opções Padrão"
268
+
269
+ #: options-framework.php:354
270
+ msgid "Click OK to reset. Any theme settings will be lost!"
271
+ msgstr "Click OK para restaurar. Todas as opções do tema serão perdidas."
272
+
273
+ #: options-framework.php:386
274
+ msgid "Default options restored."
275
+ msgstr "Opções padrão restauradas."
276
+
277
+ #: options-framework.php:440
278
+ msgid "Options saved."
279
+ msgstr "Opções guardadas."
280
+
281
+ #: options-media-uploader.php:46
282
+ msgid "No file chosen"
283
+ msgstr "Nenhum ficheiro escolhido."
284
+
285
+ #: options-media-uploader.php:49 options-media-uploader.php:106
286
+ msgid "Upload"
287
+ msgstr "Upload"
288
+
289
+ #: options-media-uploader.php:51 options-media-uploader.php:107
290
+ msgid "Remove"
291
+ msgstr "Remover"
292
+
293
+ #: options-media-uploader.php:54
294
+ msgid "Upgrade your version of WordPress for full media support."
295
+ msgstr "Actualize a sua versão do WordPress para total suporte media."
296
+
297
+ #: options-media-uploader.php:78
298
+ msgid "View File"
299
+ msgstr "Ver Ficheiro"
300
+
301
+ #: options-sanitize.php:236
302
+ msgid "No Repeat"
303
+ msgstr "Não Repetir"
304
+
305
+ #: options-sanitize.php:237
306
+ msgid "Repeat Horizontally"
307
+ msgstr "Repetir Horizontalmente"
308
+
309
+ #: options-sanitize.php:238
310
+ msgid "Repeat Vertically"
311
+ msgstr "Repetir Verticalmente"
312
+
313
+ #: options-sanitize.php:239
314
+ msgid "Repeat All"
315
+ msgstr "Repetir Todos"
316
+
317
+ #: options-sanitize.php:252
318
+ msgid "Top Left"
319
+ msgstr "Esquerda Topo"
320
+
321
+ #: options-sanitize.php:253
322
+ msgid "Top Center"
323
+ msgstr "Centro Topo"
324
+
325
+ #: options-sanitize.php:254
326
+ msgid "Top Right"
327
+ msgstr "Direita Topo"
328
+
329
+ #: options-sanitize.php:255
330
+ msgid "Middle Left"
331
+ msgstr "Esquerda Meio"
332
+
333
+ #: options-sanitize.php:256
334
+ msgid "Middle Center"
335
+ msgstr "Centro Meio"
336
+
337
+ #: options-sanitize.php:257
338
+ msgid "Middle Right"
339
+ msgstr "Direita Meio"
340
+
341
+ #: options-sanitize.php:258
342
+ msgid "Bottom Left"
343
+ msgstr "Esquerda Fundo"
344
+
345
+ #: options-sanitize.php:259
346
+ msgid "Bottom Center"
347
+ msgstr "Centro Fundo"
348
+
349
+ #: options-sanitize.php:260
350
+ msgid "Bottom Right"
351
+ msgstr "Direita Fundo"
352
+
353
+ #: options-sanitize.php:273
354
+ msgid "Scroll Normally"
355
+ msgstr "Rolar Normalmente"
356
+
357
+ #: options-sanitize.php:274
358
+ msgid "Fixed in Place"
359
+ msgstr "Fixo"
360
+
361
+ #: options-sanitize.php:348
362
+ msgid "Normal"
363
+ msgstr "Normal"
364
+
365
+ #: options-sanitize.php:349
366
+ msgid "Italic"
367
+ msgstr "Itálico"
368
+
369
+ #: options-sanitize.php:350
370
+ msgid "Bold"
371
+ msgstr "Negrito"
372
+
373
+ #: options-sanitize.php:351
374
+ msgid "Bold Italic"
375
+ msgstr "Itálico Negrito"
376
+
377
+ #: options-theme-customizer/options.php:101
378
+ msgid "Basic"
379
+ msgstr "Básico"
380
+
381
+ #: options-theme-customizer/options.php:158
382
+ msgid "Extended"
383
+ msgstr "Extended"
{lang → languages}/options-framework.pot RENAMED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/options-framework-plugin\n"
7
- "POT-Creation-Date: 2013-06-05 21:22:45+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,6 +12,134 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  #: options-check/options.php:32
16
  msgid "One"
17
  msgstr ""
@@ -104,261 +232,132 @@ msgstr ""
104
  msgid "Passed an array of categories with cat_ID and cat_name"
105
  msgstr ""
106
 
107
- #: options-check/options.php:155
108
  msgid "Select a Tag"
109
  msgstr ""
110
 
111
- #: options-check/options.php:156
112
  msgid "Passed an array of tags with term_id and term_name"
113
  msgstr ""
114
 
115
- #: options-check/options.php:162
116
  msgid "Select a Page"
117
  msgstr ""
118
 
119
- #: options-check/options.php:163
120
- msgid "Passed an pages with ID and post_title"
121
  msgstr ""
122
 
123
- #: options-check/options.php:169
124
  msgid "Input Radio (one)"
125
  msgstr ""
126
 
127
- #: options-check/options.php:170
128
  msgid "Radio select with default options \"one\"."
129
  msgstr ""
130
 
131
- #: options-check/options.php:177
132
  msgid "Example Info"
133
  msgstr ""
134
 
135
- #: options-check/options.php:178
136
  msgid "This is just some example information you can put in the panel."
137
  msgstr ""
138
 
139
- #: options-check/options.php:182
140
  msgid "Input Checkbox"
141
  msgstr ""
142
 
143
- #: options-check/options.php:183
144
  msgid "Example checkbox, defaults to true."
145
  msgstr ""
146
 
147
- #: options-check/options.php:189
148
  msgid "Advanced Settings"
149
  msgstr ""
150
 
151
- #: options-check/options.php:193
152
  msgid "Check to Show a Hidden Text Input"
153
  msgstr ""
154
 
155
- #: options-check/options.php:194
156
  msgid "Click here and see what happens."
157
  msgstr ""
158
 
159
- #: options-check/options.php:199
160
  msgid "Hidden Text Input"
161
  msgstr ""
162
 
163
- #: options-check/options.php:200
164
  msgid "This option is hidden unless activated by a checkbox click."
165
  msgstr ""
166
 
167
- #: options-check/options.php:207
168
  msgid "Uploader Test"
169
  msgstr ""
170
 
171
- #: options-check/options.php:208
172
  msgid "This creates a full size uploader that previews the image."
173
  msgstr ""
174
 
175
- #: options-check/options.php:225
176
  msgid "Example Background"
177
  msgstr ""
178
 
179
- #: options-check/options.php:226
180
  msgid "Change the background CSS."
181
  msgstr ""
182
 
183
- #: options-check/options.php:232
184
  msgid "Multicheck"
185
  msgstr ""
186
 
187
- #: options-check/options.php:233
188
  msgid "Multicheck description."
189
  msgstr ""
190
 
191
- #: options-check/options.php:240
192
  msgid "Colorpicker"
193
  msgstr ""
194
 
195
- #: options-check/options.php:241
196
  msgid "No color selected by default."
197
  msgstr ""
198
 
199
- #: options-check/options.php:246
200
  msgid "Typography"
201
  msgstr ""
202
 
203
- #: options-check/options.php:247
204
  msgid "Example typography."
205
  msgstr ""
206
 
207
- #: options-check/options.php:253
208
  msgid "Custom Typography"
209
  msgstr ""
210
 
211
- #: options-check/options.php:254
212
  msgid "Custom typography options."
213
  msgstr ""
214
 
215
- #: options-check/options.php:261
216
  msgid "Text Editor"
217
  msgstr ""
218
 
219
- #: options-check/options.php:279
220
  msgid "Default Text Editor"
221
  msgstr ""
222
 
223
- #: options-check/options.php:280
224
  msgid "You can also pass settings to the editor. Read more about wp_editor in <a href=\"%1$s\" target=\"_blank\">the WordPress codex</a>"
225
  msgstr ""
226
 
227
- #: options-framework.php:70
228
- 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>"
229
- msgstr ""
230
-
231
- #: options-framework.php:259 options-framework.php:260
232
- #: options-framework.php:489
233
- msgid "Theme Options"
234
- msgstr ""
235
-
236
- #: options-framework.php:305
237
- msgid "Clear"
238
- msgstr ""
239
-
240
- #: options-framework.php:306
241
- msgid "Default"
242
- msgstr ""
243
-
244
- #: options-framework.php:307
245
- msgid "Select Color"
246
- msgstr ""
247
-
248
- #: options-framework.php:352
249
- msgid "Save Options"
250
- msgstr ""
251
-
252
- #: options-framework.php:353
253
- msgid "Restore Defaults"
254
- msgstr ""
255
-
256
- #: options-framework.php:353
257
- msgid "Click OK to reset. Any theme settings will be lost!"
258
- msgstr ""
259
-
260
- #: options-framework.php:385
261
- msgid "Default options restored."
262
- msgstr ""
263
-
264
- #: options-framework.php:439
265
- msgid "Options saved."
266
- msgstr ""
267
-
268
- #: options-media-uploader.php:46
269
- msgid "No file chosen"
270
- msgstr ""
271
-
272
- #: options-media-uploader.php:49 options-media-uploader.php:106
273
- msgid "Upload"
274
- msgstr ""
275
-
276
- #: options-media-uploader.php:51 options-media-uploader.php:107
277
- msgid "Remove"
278
- msgstr ""
279
-
280
- #: options-media-uploader.php:54
281
- msgid "Upgrade your version of WordPress for full media support."
282
- msgstr ""
283
-
284
- #: options-media-uploader.php:78
285
- msgid "View File"
286
- msgstr ""
287
-
288
- #: options-sanitize.php:236
289
- msgid "No Repeat"
290
- msgstr ""
291
-
292
- #: options-sanitize.php:237
293
- msgid "Repeat Horizontally"
294
  msgstr ""
295
 
296
- #: options-sanitize.php:238
297
- msgid "Repeat Vertically"
298
- msgstr ""
299
-
300
- #: options-sanitize.php:239
301
- msgid "Repeat All"
302
- msgstr ""
303
-
304
- #: options-sanitize.php:252
305
- msgid "Top Left"
306
- msgstr ""
307
-
308
- #: options-sanitize.php:253
309
- msgid "Top Center"
310
- msgstr ""
311
-
312
- #: options-sanitize.php:254
313
- msgid "Top Right"
314
- msgstr ""
315
-
316
- #: options-sanitize.php:255
317
- msgid "Middle Left"
318
- msgstr ""
319
-
320
- #: options-sanitize.php:256
321
- msgid "Middle Center"
322
- msgstr ""
323
-
324
- #: options-sanitize.php:257
325
- msgid "Middle Right"
326
- msgstr ""
327
-
328
- #: options-sanitize.php:258
329
- msgid "Bottom Left"
330
- msgstr ""
331
-
332
- #: options-sanitize.php:259
333
- msgid "Bottom Center"
334
- msgstr ""
335
-
336
- #: options-sanitize.php:260
337
- msgid "Bottom Right"
338
- msgstr ""
339
-
340
- #: options-sanitize.php:273
341
- msgid "Scroll Normally"
342
- msgstr ""
343
-
344
- #: options-sanitize.php:274
345
- msgid "Fixed in Place"
346
- msgstr ""
347
-
348
- #: options-sanitize.php:348
349
- msgid "Normal"
350
- msgstr ""
351
-
352
- #: options-sanitize.php:349
353
- msgid "Italic"
354
- msgstr ""
355
-
356
- #: options-sanitize.php:350
357
- msgid "Bold"
358
- msgstr ""
359
-
360
- #: options-sanitize.php:351
361
- msgid "Bold Italic"
362
  msgstr ""
363
 
364
  #: options-theme-customizer/options.php:101
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/options-framework-plugin\n"
7
+ "POT-Creation-Date: 2013-11-26 23:01:08+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: includes/class-options-framework-admin.php:64
16
+ 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>"
17
+ msgstr ""
18
+
19
+ #: includes/class-options-framework-admin.php:116
20
+ #: includes/class-options-framework-admin.php:117
21
+ #: includes/class-options-framework-admin.php:336
22
+ msgid "Theme Options"
23
+ msgstr ""
24
+
25
+ #: includes/class-options-framework-admin.php:202
26
+ msgid "Save Options"
27
+ msgstr ""
28
+
29
+ #: includes/class-options-framework-admin.php:203
30
+ msgid "Restore Defaults"
31
+ msgstr ""
32
+
33
+ #: includes/class-options-framework-admin.php:203
34
+ msgid "Click OK to reset. Any theme settings will be lost!"
35
+ msgstr ""
36
+
37
+ #: includes/class-options-framework-admin.php:234
38
+ msgid "Default options restored."
39
+ msgstr ""
40
+
41
+ #: includes/class-options-framework-admin.php:288
42
+ msgid "Options saved."
43
+ msgstr ""
44
+
45
+ #: includes/class-options-media-uploader.php:63
46
+ msgid "No file chosen"
47
+ msgstr ""
48
+
49
+ #: includes/class-options-media-uploader.php:66
50
+ #: includes/class-options-media-uploader.php:119
51
+ msgid "Upload"
52
+ msgstr ""
53
+
54
+ #: includes/class-options-media-uploader.php:68
55
+ #: includes/class-options-media-uploader.php:120
56
+ msgid "Remove"
57
+ msgstr ""
58
+
59
+ #: includes/class-options-media-uploader.php:71
60
+ msgid "Upgrade your version of WordPress for full media support."
61
+ msgstr ""
62
+
63
+ #: includes/class-options-media-uploader.php:95
64
+ msgid "View File"
65
+ msgstr ""
66
+
67
+ #: includes/class-options-sanitization.php:241
68
+ msgid "No Repeat"
69
+ msgstr ""
70
+
71
+ #: includes/class-options-sanitization.php:242
72
+ msgid "Repeat Horizontally"
73
+ msgstr ""
74
+
75
+ #: includes/class-options-sanitization.php:243
76
+ msgid "Repeat Vertically"
77
+ msgstr ""
78
+
79
+ #: includes/class-options-sanitization.php:244
80
+ msgid "Repeat All"
81
+ msgstr ""
82
+
83
+ #: includes/class-options-sanitization.php:257
84
+ msgid "Top Left"
85
+ msgstr ""
86
+
87
+ #: includes/class-options-sanitization.php:258
88
+ msgid "Top Center"
89
+ msgstr ""
90
+
91
+ #: includes/class-options-sanitization.php:259
92
+ msgid "Top Right"
93
+ msgstr ""
94
+
95
+ #: includes/class-options-sanitization.php:260
96
+ msgid "Middle Left"
97
+ msgstr ""
98
+
99
+ #: includes/class-options-sanitization.php:261
100
+ msgid "Middle Center"
101
+ msgstr ""
102
+
103
+ #: includes/class-options-sanitization.php:262
104
+ msgid "Middle Right"
105
+ msgstr ""
106
+
107
+ #: includes/class-options-sanitization.php:263
108
+ msgid "Bottom Left"
109
+ msgstr ""
110
+
111
+ #: includes/class-options-sanitization.php:264
112
+ msgid "Bottom Center"
113
+ msgstr ""
114
+
115
+ #: includes/class-options-sanitization.php:265
116
+ msgid "Bottom Right"
117
+ msgstr ""
118
+
119
+ #: includes/class-options-sanitization.php:278
120
+ msgid "Scroll Normally"
121
+ msgstr ""
122
+
123
+ #: includes/class-options-sanitization.php:279
124
+ msgid "Fixed in Place"
125
+ msgstr ""
126
+
127
+ #: includes/class-options-sanitization.php:353
128
+ msgid "Normal"
129
+ msgstr ""
130
+
131
+ #: includes/class-options-sanitization.php:354
132
+ msgid "Italic"
133
+ msgstr ""
134
+
135
+ #: includes/class-options-sanitization.php:355
136
+ msgid "Bold"
137
+ msgstr ""
138
+
139
+ #: includes/class-options-sanitization.php:356
140
+ msgid "Bold Italic"
141
+ msgstr ""
142
+
143
  #: options-check/options.php:32
144
  msgid "One"
145
  msgstr ""
232
  msgid "Passed an array of categories with cat_ID and cat_name"
233
  msgstr ""
234
 
235
+ #: options-check/options.php:156
236
  msgid "Select a Tag"
237
  msgstr ""
238
 
239
+ #: options-check/options.php:157
240
  msgid "Passed an array of tags with term_id and term_name"
241
  msgstr ""
242
 
243
+ #: options-check/options.php:164
244
  msgid "Select a Page"
245
  msgstr ""
246
 
247
+ #: options-check/options.php:165
248
+ msgid "Passed an array of pages with ID and post_title"
249
  msgstr ""
250
 
251
+ #: options-check/options.php:171
252
  msgid "Input Radio (one)"
253
  msgstr ""
254
 
255
+ #: options-check/options.php:172
256
  msgid "Radio select with default options \"one\"."
257
  msgstr ""
258
 
259
+ #: options-check/options.php:179
260
  msgid "Example Info"
261
  msgstr ""
262
 
263
+ #: options-check/options.php:180
264
  msgid "This is just some example information you can put in the panel."
265
  msgstr ""
266
 
267
+ #: options-check/options.php:184
268
  msgid "Input Checkbox"
269
  msgstr ""
270
 
271
+ #: options-check/options.php:185
272
  msgid "Example checkbox, defaults to true."
273
  msgstr ""
274
 
275
+ #: options-check/options.php:191
276
  msgid "Advanced Settings"
277
  msgstr ""
278
 
279
+ #: options-check/options.php:195
280
  msgid "Check to Show a Hidden Text Input"
281
  msgstr ""
282
 
283
+ #: options-check/options.php:196
284
  msgid "Click here and see what happens."
285
  msgstr ""
286
 
287
+ #: options-check/options.php:201
288
  msgid "Hidden Text Input"
289
  msgstr ""
290
 
291
+ #: options-check/options.php:202
292
  msgid "This option is hidden unless activated by a checkbox click."
293
  msgstr ""
294
 
295
+ #: options-check/options.php:209
296
  msgid "Uploader Test"
297
  msgstr ""
298
 
299
+ #: options-check/options.php:210
300
  msgid "This creates a full size uploader that previews the image."
301
  msgstr ""
302
 
303
+ #: options-check/options.php:227
304
  msgid "Example Background"
305
  msgstr ""
306
 
307
+ #: options-check/options.php:228
308
  msgid "Change the background CSS."
309
  msgstr ""
310
 
311
+ #: options-check/options.php:234
312
  msgid "Multicheck"
313
  msgstr ""
314
 
315
+ #: options-check/options.php:235
316
  msgid "Multicheck description."
317
  msgstr ""
318
 
319
+ #: options-check/options.php:242
320
  msgid "Colorpicker"
321
  msgstr ""
322
 
323
+ #: options-check/options.php:243
324
  msgid "No color selected by default."
325
  msgstr ""
326
 
327
+ #: options-check/options.php:248
328
  msgid "Typography"
329
  msgstr ""
330
 
331
+ #: options-check/options.php:249
332
  msgid "Example typography."
333
  msgstr ""
334
 
335
+ #: options-check/options.php:255
336
  msgid "Custom Typography"
337
  msgstr ""
338
 
339
+ #: options-check/options.php:256
340
  msgid "Custom typography options."
341
  msgstr ""
342
 
343
+ #: options-check/options.php:263
344
  msgid "Text Editor"
345
  msgstr ""
346
 
347
+ #: options-check/options.php:281
348
  msgid "Default Text Editor"
349
  msgstr ""
350
 
351
+ #: options-check/options.php:282
352
  msgid "You can also pass settings to the editor. Read more about wp_editor in <a href=\"%1$s\" target=\"_blank\">the WordPress codex</a>"
353
  msgstr ""
354
 
355
+ #: options-check/options.php:294
356
+ msgid "Additional Text Editor"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  msgstr ""
358
 
359
+ #: options-check/options.php:295
360
+ msgid "This editor includes media button."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  msgstr ""
362
 
363
  #: options-theme-customizer/options.php:101
{lang → languages}/optionsframework-es_ES.mo RENAMED
File without changes
{lang → languages}/optionsframework-es_ES.po RENAMED
File without changes
{lang → languages}/optionsframework-fa_IR.mo RENAMED
File without changes
{lang → languages}/optionsframework-fa_IR.po RENAMED
File without changes
{lang → languages}/optionsframework-fr_FR.mo RENAMED
File without changes
{lang → languages}/optionsframework-fr_FR.po RENAMED
File without changes
{lang → languages}/optionsframework-it_IT.mo RENAMED
File without changes
{lang → languages}/optionsframework-it_IT.po RENAMED
File without changes
{lang → languages}/optionsframework-pt_BR.mo RENAMED
File without changes
{lang → languages}/optionsframework-pt_BR.po RENAMED
File without changes
{lang → languages}/optionsframework-ru_RU.mo RENAMED
File without changes
{lang → languages}/optionsframework-ru_RU.po RENAMED
File without changes
{lang → languages}/optionsframework-sv_SE.mo RENAMED
File without changes
{lang → languages}/optionsframework-sv_SE.po RENAMED
File without changes
{lang → languages}/optionsframework-zh_CN.mo RENAMED
File without changes
{lang → languages}/optionsframework-zh_CN.po RENAMED
File without changes
options-framework.php CHANGED
@@ -1,572 +1,83 @@
1
  <?php
2
- /*
3
- Plugin Name: Options Framework
4
- Plugin URI: http://www.wptheming.com
5
- Description: A framework for building theme options.
6
- Version: 1.6
7
- Author: Devin Price
8
- Author URI: http://www.wptheming.com
9
- License: GPLv2
10
- */
11
-
12
- /*
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
- */
27
-
28
- /* Basic plugin definitions */
29
-
30
- define( 'OPTIONS_FRAMEWORK_VERSION', '1.6' );
31
- define( 'OPTIONS_FRAMEWORK_URL', plugin_dir_url( __FILE__ ) );
32
-
33
- load_plugin_textdomain( 'optionsframework', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
34
-
35
- /* Make sure we don't expose any info if called directly */
36
-
37
- if ( !function_exists( 'add_action' ) ) {
38
- echo "Hi there! I'm just a little plugin, don't mind me.";
39
- exit;
40
- }
41
-
42
- /* If the user can't edit theme options, no use running this plugin */
43
-
44
- add_action( 'init', 'optionsframework_rolescheck', 20 );
45
-
46
- function optionsframework_rolescheck() {
47
- if ( current_user_can( 'edit_theme_options' ) ) {
48
- $options =& _optionsframework_options();
49
- if ( $options ) {
50
- // If the user can edit theme options, let the fun begin!
51
- add_action( 'admin_menu', 'optionsframework_add_page' );
52
- add_action( 'admin_init', 'optionsframework_init' );
53
- add_action( 'wp_before_admin_bar_render', 'optionsframework_adminbar' );
54
- }
55
- else {
56
- // Display a notice if options aren't present in the theme
57
- add_action( 'admin_notices', 'optionsframework_admin_notice' );
58
- add_action( 'admin_init', 'optionsframework_nag_ignore' );
59
- }
60
- }
61
- }
62
-
63
- function optionsframework_admin_notice() {
64
- global $pagenow;
65
- if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {
66
- global $current_user ;
67
- $user_id = $current_user->ID;
68
- if ( ! get_user_meta($user_id, 'optionsframework_ignore_notice') ) {
69
- echo '<div class="updated optionsframework_setup_nag"><p>';
70
- 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>', 'optionsframework'), 'http://wptheming.com/options-framework-plugin', '?optionsframework_nag_ignore=0');
71
- echo "</p></div>";
72
- }
73
- }
74
- }
75
-
76
- function optionsframework_nag_ignore() {
77
- global $current_user;
78
- $user_id = $current_user->ID;
79
- if ( isset( $_GET['optionsframework_nag_ignore'] ) && '0' == $_GET['optionsframework_nag_ignore'] ) {
80
- add_user_meta( $user_id, 'optionsframework_ignore_notice', 'true', true );
81
- }
82
- }
83
-
84
- /* Register plugin activation hooks */
85
-
86
- register_activation_hook( __FILE__,'optionsframework_activation_hook' );
87
-
88
- function optionsframework_activation_hook() {
89
- register_uninstall_hook( __FILE__, 'optionsframework_delete_options' );
90
- }
91
-
92
- /* When uninstalled, deletes options */
93
-
94
- register_uninstall_hook( __FILE__, 'optionsframework_delete_options' );
95
-
96
- function optionsframework_delete_options() {
97
-
98
- $optionsframework_settings = get_option( 'optionsframework' );
99
-
100
- // Each theme saves its data in a seperate option, which all gets deleted
101
- $knownoptions = $optionsframework_settings['knownoptions'];
102
- if ( $knownoptions ) {
103
- foreach ( $knownoptions as $key ) {
104
- delete_option( $key );
105
- }
106
- }
107
- delete_option( 'optionsframework' );
108
- delete_user_meta( $user_id, 'optionsframework_ignore_notice', 'true' );
109
- }
110
-
111
- /* Loads the file for option sanitization */
112
-
113
- add_action( 'init', 'optionsframework_load_sanitization' );
114
-
115
- function optionsframework_load_sanitization() {
116
- require_once dirname( __FILE__ ) . '/options-sanitize.php';
117
- }
118
-
119
- /*
120
- * The optionsframework_init loads all the required files and registers the settings.
121
- *
122
- * Read more about the Settings API in the WordPress codex:
123
- * http://codex.wordpress.org/Settings_API
124
- *
125
- * The theme options are saved using a unique option id in the database. Developers
126
- * traditionally set the option id via in theme using the function
127
- * optionsframework_option_name, but it can also be set using a hook of the same name.
128
- *
129
- * If a theme developer doesn't explictly set the unique option id using one of those
130
- * functions it will be set by default to: optionsframework_[the theme name]
131
- *
132
- */
133
-
134
- function optionsframework_init() {
135
-
136
- // Include the required files
137
- require_once dirname( __FILE__ ) . '/options-interface.php';
138
- require_once dirname( __FILE__ ) . '/options-media-uploader.php';
139
-
140
- // Optionally Loads the options file from the theme
141
- $location = apply_filters( 'options_framework_location', array( 'options.php' ) );
142
- $optionsfile = locate_template( $location );
143
-
144
- // Load settings
145
- $optionsframework_settings = get_option( 'optionsframework' );
146
-
147
- // Updates the unique option id in the database if it has changed
148
- if ( function_exists( 'optionsframework_option_name' ) ) {
149
- optionsframework_option_name();
150
- }
151
- elseif ( has_action( 'optionsframework_option_name' ) ) {
152
- do_action( 'optionsframework_option_name' );
153
- }
154
- // If the developer hasn't explicitly set an option id, we'll use a default
155
- else {
156
- $default_themename = get_option( 'stylesheet' );
157
- $default_themename = preg_replace("/\W/", "_", strtolower($default_themename) );
158
- $default_themename = 'optionsframework_' . $default_themename;
159
- if ( isset( $optionsframework_settings['id'] ) ) {
160
- if ( $optionsframework_settings['id'] == $default_themename ) {
161
- // All good, using default theme id
162
- } else {
163
- $optionsframework_settings['id'] = $default_themename;
164
- update_option( 'optionsframework', $optionsframework_settings );
165
- }
166
- }
167
- else {
168
- $optionsframework_settings['id'] = $default_themename;
169
- update_option( 'optionsframework', $optionsframework_settings );
170
- }
171
- }
172
-
173
- // If the option has no saved data, load the defaults
174
- if ( ! get_option( $optionsframework_settings['id'] ) ) {
175
- optionsframework_setdefaults();
176
- }
177
-
178
- // Registers the settings fields and callback
179
- register_setting( 'optionsframework', $optionsframework_settings['id'], 'optionsframework_validate' );
180
- // Change the capability required to save the 'optionsframework' options group.
181
- add_filter( 'option_page_capability_optionsframework', 'optionsframework_page_capability' );
182
- }
183
-
184
- /**
185
- * Ensures that a user with the 'edit_theme_options' capability can actually set the options
186
- * See: http://core.trac.wordpress.org/ticket/14365
187
- *
188
- * @param string $capability The capability used for the page, which is manage_options by default.
189
- * @return string The capability to actually use.
190
- */
191
-
192
- function optionsframework_page_capability( $capability ) {
193
- return 'edit_theme_options';
194
- }
195
-
196
- /*
197
- * Adds default options to the database if they aren't already present.
198
- * May update this later to load only on plugin activation, or theme
199
- * activation since most people won't be editing the options.php
200
- * on a regular basis.
201
- *
202
- * http://codex.wordpress.org/Function_Reference/add_option
203
- *
204
- */
205
-
206
- function optionsframework_setdefaults() {
207
-
208
- $optionsframework_settings = get_option( 'optionsframework' );
209
-
210
- // Gets the unique option id
211
- $option_name = $optionsframework_settings['id'];
212
-
213
- /*
214
- * Each theme will hopefully have a unique id, and all of its options saved
215
- * as a separate option set. We need to track all of these option sets so
216
- * it can be easily deleted if someone wishes to remove the plugin and
217
- * its associated data. No need to clutter the database.
218
- *
219
- */
220
-
221
- if ( isset( $optionsframework_settings['knownoptions'] ) ) {
222
- $knownoptions = $optionsframework_settings['knownoptions'];
223
- if ( !in_array( $option_name, $knownoptions ) ) {
224
- array_push( $knownoptions, $option_name );
225
- $optionsframework_settings['knownoptions'] = $knownoptions;
226
- update_option( 'optionsframework', $optionsframework_settings);
227
- }
228
- } else {
229
- $newoptionname = array($option_name);
230
- $optionsframework_settings['knownoptions'] = $newoptionname;
231
- update_option('optionsframework', $optionsframework_settings);
232
- }
233
-
234
- // Gets the default options data from the array in options.php
235
- $options =& _optionsframework_options();
236
-
237
- // If the options haven't been added to the database yet, they are added now
238
- $values = of_get_default_values();
239
-
240
- if ( isset($values) ) {
241
- add_option( $option_name, $values ); // Add option with default settings
242
- }
243
- }
244
-
245
- /* Define menu options (still limited to appearance section)
246
- *
247
- * Examples usage:
248
- *
249
- * add_filter( 'optionsframework_menu', function($menu) {
250
- * $menu['page_title'] = 'Hello Options';
251
- * $menu['menu_title'] = 'Hello Options';
252
- * return $menu;
253
- * });
254
- */
255
-
256
- function optionsframework_menu_settings() {
257
-
258
- $menu = array(
259
- 'page_title' => __( 'Theme Options', 'optionsframework'),
260
- 'menu_title' => __('Theme Options', 'optionsframework'),
261
- 'capability' => 'edit_theme_options',
262
- 'menu_slug' => 'options-framework',
263
- 'callback' => 'optionsframework_page'
264
- );
265
-
266
- return apply_filters( 'optionsframework_menu', $menu );
267
- }
268
-
269
- /* Add a subpage called "Theme Options" to the appearance menu. */
270
-
271
- function optionsframework_add_page() {
272
-
273
- $menu = optionsframework_menu_settings();
274
- $of_page = add_theme_page( $menu['page_title'], $menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['callback'] );
275
-
276
- // Load the required CSS and javscript
277
- add_action( 'admin_enqueue_scripts', 'optionsframework_load_scripts' );
278
- add_action( 'admin_print_styles-' . $of_page, 'optionsframework_load_styles' );
279
- }
280
-
281
- /* Loads the CSS */
282
-
283
- function optionsframework_load_styles() {
284
- wp_enqueue_style( 'optionsframework', OPTIONS_FRAMEWORK_URL.'css/optionsframework.css' );
285
- if ( !wp_style_is( 'wp-color-picker','registered' ) ) {
286
- wp_register_style('wp-color-picker', OPTIONS_FRAMEWORK_URL.'css/color-picker.min.css');
287
- }
288
- wp_enqueue_style( 'wp-color-picker' );
289
- }
290
-
291
- /* Loads the javascript */
292
-
293
- function optionsframework_load_scripts( $hook ) {
294
-
295
- $menu = optionsframework_menu_settings();
296
-
297
- if ( 'appearance_page_' . $menu['menu_slug'] != $hook )
298
- return;
299
-
300
- // Enqueue colorpicker scripts for versions below 3.5 for compatibility
301
- if ( !wp_script_is( 'wp-color-picker', 'registered' ) ) {
302
- wp_register_script( 'iris', OPTIONS_FRAMEWORK_URL . 'js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
303
- wp_register_script( 'wp-color-picker', OPTIONS_FRAMEWORK_URL . 'js/color-picker.min.js', array( 'jquery', 'iris' ) );
304
- $colorpicker_l10n = array(
305
- 'clear' => __( 'Clear' ),
306
- 'defaultString' => __( 'Default' ),
307
- 'pick' => __( 'Select Color' )
308
- );
309
- wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n );
310
- }
311
-
312
- // Enqueue custom option panel JS
313
- wp_enqueue_script( 'options-custom', OPTIONS_FRAMEWORK_URL . 'js/options-custom.js', array( 'jquery','wp-color-picker' ) );
314
-
315
- // Inline scripts from options-interface.php
316
- add_action( 'admin_head', 'of_admin_head' );
317
- }
318
-
319
- function of_admin_head() {
320
- // Hook to add custom scripts
321
- do_action( 'optionsframework_custom_scripts' );
322
- }
323
-
324
- /*
325
- * Builds out the options panel.
326
- *
327
- * If we were using the Settings API as it was likely intended we would use
328
- * do_settings_sections here. But as we don't want the settings wrapped in a table,
329
- * we'll call our own custom optionsframework_fields. See options-interface.php
330
- * for specifics on how each individual field is generated.
331
- *
332
- * Nonces are provided using the settings_fields()
333
- *
334
- */
335
-
336
- if ( !function_exists( 'optionsframework_page' ) ) :
337
- function optionsframework_page() {
338
- settings_errors(); ?>
339
-
340
- <div id="optionsframework-wrap" class="wrap">
341
- <?php screen_icon( 'themes' ); ?>
342
- <h2 class="nav-tab-wrapper">
343
- <?php echo optionsframework_tabs(); ?>
344
- </h2>
345
-
346
- <div id="optionsframework-metabox" class="metabox-holder">
347
- <div id="optionsframework" class="postbox">
348
- <form action="options.php" method="post">
349
- <?php settings_fields( 'optionsframework' ); ?>
350
- <?php optionsframework_fields(); /* Settings */ ?>
351
- <div id="optionsframework-submit">
352
- <input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'optionsframework' ); ?>" />
353
- <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' ) ); ?>' );" />
354
- <div class="clear"></div>
355
- </div>
356
- </form>
357
- </div> <!-- / #container -->
358
- </div>
359
- <?php do_action( 'optionsframework_after' ); ?>
360
- </div> <!-- / .wrap -->
361
-
362
- <?php
363
- }
364
- endif;
365
-
366
  /**
367
- * Validate Options.
368
- *
369
- * This runs after the submit/reset button has been clicked and
370
- * validates the inputs.
371
- *
372
- * @uses $_POST['reset'] to restore default options
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  */
374
- function optionsframework_validate( $input ) {
375
 
376
- /*
377
- * Restore Defaults.
378
- *
379
- * In the event that the user clicked the "Restore Defaults"
380
- * button, the options defined in the theme's options.php
381
- * file will be added to the option for the active theme.
382
- */
383
-
384
- if ( isset( $_POST['reset'] ) ) {
385
- add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'optionsframework' ), 'updated fade' );
386
- return of_get_default_values();
387
- }
388
-
389
- /*
390
- * Update Settings
391
- *
392
- * This used to check for $_POST['update'], but has been updated
393
- * to be compatible with the theme customizer introduced in WordPress 3.4
394
- */
395
-
396
- $clean = array();
397
- $options =& _optionsframework_options();
398
- foreach ( $options as $option ) {
399
-
400
- if ( ! isset( $option['id'] ) ) {
401
- continue;
402
- }
403
-
404
- if ( ! isset( $option['type'] ) ) {
405
- continue;
406
- }
407
-
408
- $id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );
409
-
410
- // Set checkbox to false if it wasn't sent in the $_POST
411
- if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
412
- $input[$id] = false;
413
- }
414
-
415
- // Set each item in the multicheck to false if it wasn't sent in the $_POST
416
- if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
417
- foreach ( $option['options'] as $key => $value ) {
418
- $input[$id][$key] = false;
419
- }
420
- }
421
-
422
- // For a value to be submitted to database it must pass through a sanitization filter
423
- if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
424
- $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
425
- }
426
- }
427
-
428
- // Hook to run after validation
429
- do_action( 'optionsframework_after_validate', $clean );
430
-
431
- return $clean;
432
  }
433
 
434
- /**
435
- * Display message when options have been saved
436
- */
437
-
438
- function optionsframework_save_options_notice() {
439
- add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'optionsframework' ), 'updated fade' );
440
- }
441
 
442
- add_action( 'optionsframework_after_validate', 'optionsframework_save_options_notice' );
 
 
443
 
444
- /**
445
- * Format Configuration Array.
446
- *
447
- * Get an array of all default values as set in
448
- * options.php. The 'id','std' and 'type' keys need
449
- * to be defined in the configuration array. In the
450
- * event that these keys are not present the option
451
- * will not be included in this function's output.
452
- *
453
- * @return array Rey-keyed options configuration array.
454
- *
455
- * @access private
456
- */
457
 
458
- function of_get_default_values() {
459
- $output = array();
460
- $config =& _optionsframework_options();
461
- foreach ( (array) $config as $option ) {
462
- if ( ! isset( $option['id'] ) ) {
463
- continue;
464
- }
465
- if ( ! isset( $option['std'] ) ) {
466
- continue;
467
- }
468
- if ( ! isset( $option['type'] ) ) {
469
- continue;
470
- }
471
- if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
472
- $output[$option['id']] = apply_filters( 'of_sanitize_' . $option['type'], $option['std'], $option );
473
- }
474
- }
475
- return $output;
476
- }
477
 
478
- /**
479
- * Add Theme Options menu item to Admin Bar.
480
- */
481
-
482
- function optionsframework_adminbar() {
483
 
484
- global $wp_admin_bar;
 
 
485
 
486
- $wp_admin_bar->add_menu( array(
487
- 'parent' => 'appearance',
488
- 'id' => 'of_theme_options',
489
- 'title' => __( 'Theme Options', 'optionsframework' ),
490
- 'href' => admin_url( 'themes.php?page=options-framework' )
491
- ));
492
  }
 
493
 
494
  /**
495
- * Get Option.
496
- *
497
  * Helper function to return the theme option value.
498
  * If no value has been saved, it returns $default.
499
  * Needed because options are saved as serialized strings.
 
 
500
  */
501
 
502
  if ( ! function_exists( 'of_get_option' ) ) :
503
 
504
- function of_get_option( $name, $default = false ) {
505
- $config = get_option( 'optionsframework' );
506
-
507
- if ( ! isset( $config['id'] ) ) {
508
- return $default;
509
- }
510
-
511
- $options = get_option( $config['id'] );
512
-
513
- if ( isset( $options[$name] ) ) {
514
- return $options[$name];
515
- }
516
 
 
517
  return $default;
518
  }
519
-
520
- endif;
521
-
522
- /**
523
- * Wrapper for optionsframework_options()
524
- *
525
- * Allows for manipulating or setting options via 'of_options' filter
526
- * For example:
527
- *
528
- * <code>
529
- * add_filter('of_options', function($options) {
530
- * $options[] = array(
531
- * 'name' => 'Input Text Mini',
532
- * 'desc' => 'A mini text input field.',
533
- * 'id' => 'example_text_mini',
534
- * 'std' => 'Default',
535
- * 'class' => 'mini',
536
- * 'type' => 'text'
537
- * );
538
- *
539
- * return $options;
540
- * });
541
- * </code>
542
- *
543
- * Also allows for setting options via a return statement in the
544
- * options.php file. For example (in options.php):
545
- *
546
- * <code>
547
- * return array(...);
548
- * </code>
549
- *
550
- * @return array (by reference)
551
- */
552
- function &_optionsframework_options() {
553
- static $options = null;
554
 
555
- if ( !$options ) {
556
- // Load options from options.php file (if it exists)
557
- $location = apply_filters( 'options_framework_location', array('options.php') );
558
- if ( $optionsfile = locate_template( $location ) ) {
559
- $maybe_options = require_once $optionsfile;
560
- if (is_array($maybe_options)) {
561
- $options = $maybe_options;
562
- } else if ( function_exists( 'optionsframework_options' ) ) {
563
- $options = optionsframework_options();
564
- }
565
- }
566
 
567
- // Allow setting/manipulating options via filters
568
- $options = apply_filters('of_options', $options);
569
  }
570
 
571
- return $options;
572
- }
 
 
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
+ * Options Framework
4
+ *
5
+ * @package Options Framework
6
+ * @author Devin Price <devin@wptheming.com>
7
+ * @license GPL-2.0+
8
+ * @link http://wptheming.com
9
+ * @copyright 2013 WP Theming
10
+ *
11
+ * @wordpress-plugin
12
+ * Plugin Name: Options Framework
13
+ * Plugin URI: http://wptheming.com
14
+ * Description: A framework for building theme options.
15
+ * Version: 1.7.1
16
+ * Author: Devin Price
17
+ * Author URI: http://wptheming.com
18
+ * License: GPL-2.0+
19
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
20
+ * Text Domain: optionsframework
21
+ * Domain Path: /languages
22
  */
 
23
 
24
+ // If this file is called directly, abort.
25
+ if ( ! defined( 'WPINC' ) ) {
26
+ die;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
+ function optionsframework_init() {
 
 
 
 
 
 
30
 
31
+ // If user can't edit theme options, exit
32
+ if ( !current_user_can( 'edit_theme_options' ) )
33
+ return;
34
 
35
+ // Loads the required Options Framework classes.
36
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework.php';
37
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework-admin.php';
38
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-interface.php';
39
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-media-uploader.php';
40
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-sanitization.php';
 
 
 
 
 
 
 
41
 
42
+ // Instantiate the main plugin class.
43
+ $options_framework = new Options_Framework;
44
+ $options_framework->init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ // Instantiate the options page.
47
+ $options_framework_admin = new Options_Framework_Admin;
48
+ $options_framework_admin->init();
 
 
49
 
50
+ // Instantiate the media uploader class
51
+ $options_framework_media_uploader = new Options_Framework_Media_Uploader;
52
+ $options_framework_media_uploader->init();
53
 
 
 
 
 
 
 
54
  }
55
+ add_action( 'init', 'optionsframework_init', 20 );
56
 
57
  /**
 
 
58
  * Helper function to return the theme option value.
59
  * If no value has been saved, it returns $default.
60
  * Needed because options are saved as serialized strings.
61
+ *
62
+ * Not in a class to support backwards compatibility in themes.
63
  */
64
 
65
  if ( ! function_exists( 'of_get_option' ) ) :
66
 
67
+ function of_get_option( $name, $default = false ) {
68
+ $config = get_option( 'optionsframework' );
 
 
 
 
 
 
 
 
 
 
69
 
70
+ if ( ! isset( $config['id'] ) ) {
71
  return $default;
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ $options = get_option( $config['id'] );
 
 
 
 
 
 
 
 
 
 
75
 
76
+ if ( isset( $options[$name] ) ) {
77
+ return $options[$name];
78
  }
79
 
80
+ return $default;
81
+ }
82
+
83
+ endif;
options-interface.php DELETED
@@ -1,418 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Generates the tabs that are used in the options menu
5
- */
6
-
7
- function optionsframework_tabs() {
8
- $counter = 0;
9
- $options =& _optionsframework_options();
10
- $menu = '';
11
-
12
- foreach ( $options as $value ) {
13
- // Heading for Navigation
14
- if ( $value['type'] == "heading" ) {
15
- $counter++;
16
- $class = '';
17
- $class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
18
- $class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab';
19
- $menu .= '<a id="options-group-'. $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'. $counter ) . '">' . esc_html( $value['name'] ) . '</a>';
20
- }
21
- }
22
-
23
- return $menu;
24
- }
25
-
26
- /**
27
- * Generates the options fields that are used in the form.
28
- */
29
-
30
- function optionsframework_fields() {
31
-
32
- global $allowedtags;
33
- $optionsframework_settings = get_option( 'optionsframework' );
34
-
35
- // Gets the unique option id
36
- if ( isset( $optionsframework_settings['id'] ) ) {
37
- $option_name = $optionsframework_settings['id'];
38
- }
39
- else {
40
- $option_name = 'optionsframework';
41
- };
42
-
43
- $settings = get_option($option_name);
44
- $options =& _optionsframework_options();
45
-
46
- $counter = 0;
47
- $menu = '';
48
-
49
- foreach ( $options as $value ) {
50
-
51
- $val = '';
52
- $select_value = '';
53
- $checked = '';
54
- $output = '';
55
-
56
- // Wrap all options
57
- if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
58
-
59
- // Keep all ids lowercase with no spaces
60
- $value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id']) );
61
-
62
- $id = 'section-' . $value['id'];
63
-
64
- $class = 'section';
65
- if ( isset( $value['type'] ) ) {
66
- $class .= ' section-' . $value['type'];
67
- }
68
- if ( isset( $value['class'] ) ) {
69
- $class .= ' ' . $value['class'];
70
- }
71
-
72
- $output .= '<div id="' . esc_attr( $id ) .'" class="' . esc_attr( $class ) . '">'."\n";
73
- if ( isset( $value['name'] ) ) {
74
- $output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
75
- }
76
- if ( $value['type'] != 'editor' ) {
77
- $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
78
- }
79
- else {
80
- $output .= '<div class="option">' . "\n" . '<div>' . "\n";
81
- }
82
- }
83
-
84
- // Set default value to $val
85
- if ( isset( $value['std'] ) ) {
86
- $val = $value['std'];
87
- }
88
-
89
- // If the option is already saved, ovveride $val
90
- if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) {
91
- if ( isset( $settings[($value['id'])]) ) {
92
- $val = $settings[($value['id'])];
93
- // Striping slashes of non-array options
94
- if ( !is_array($val) ) {
95
- $val = stripslashes( $val );
96
- }
97
- }
98
- }
99
-
100
- // If there is a description save it for labels
101
- $explain_value = '';
102
- if ( isset( $value['desc'] ) ) {
103
- $explain_value = $value['desc'];
104
- }
105
-
106
- if ( has_filter( 'optionsframework_' . $value['type'] ) ) {
107
- $output .= apply_filters( 'optionsframework_' . $value['type'], $option_name, $value, $val );
108
- }
109
-
110
-
111
- switch ( $value['type'] ) {
112
-
113
- // Basic text input
114
- case 'text':
115
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '" />';
116
- break;
117
-
118
- // Password input
119
- case 'password':
120
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="password" value="' . esc_attr( $val ) . '" />';
121
- break;
122
-
123
- // Textarea
124
- case 'textarea':
125
- $rows = '8';
126
-
127
- if ( isset( $value['settings']['rows'] ) ) {
128
- $custom_rows = $value['settings']['rows'];
129
- if ( is_numeric( $custom_rows ) ) {
130
- $rows = $custom_rows;
131
- }
132
- }
133
-
134
- $val = stripslashes( $val );
135
- $output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '">' . esc_textarea( $val ) . '</textarea>';
136
- break;
137
-
138
- // Select Box
139
- case 'select':
140
- $output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '">';
141
-
142
- foreach ($value['options'] as $key => $option ) {
143
- $selected = '';
144
- if ( $val != '' ) {
145
- if ( $val == $key) { $selected = ' selected="selected"';}
146
- }
147
- $output .= '<option'. $selected .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>';
148
- }
149
- $output .= '</select>';
150
- break;
151
-
152
-
153
- // Radio Box
154
- case "radio":
155
- $name = $option_name .'['. $value['id'] .']';
156
- foreach ($value['options'] as $key => $option) {
157
- $id = $option_name . '-' . $value['id'] .'-'. $key;
158
- $output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="'. esc_attr( $key ) . '" '. checked( $val, $key, false) .' /><label for="' . esc_attr( $id ) . '">' . esc_html( $option ) . '</label>';
159
- }
160
- break;
161
-
162
- // Image Selectors
163
- case "images":
164
- $name = $option_name .'['. $value['id'] .']';
165
- foreach ( $value['options'] as $key => $option ) {
166
- $selected = '';
167
- $checked = '';
168
- if ( $val != '' ) {
169
- if ( $val == $key ) {
170
- $selected = ' of-radio-img-selected';
171
- $checked = ' checked="checked"';
172
- }
173
- }
174
- $output .= '<input type="radio" id="' . esc_attr( $value['id'] .'_'. $key) . '" class="of-radio-img-radio" value="' . esc_attr( $key ) . '" name="' . esc_attr( $name ) . '" '. $checked .' />';
175
- $output .= '<div class="of-radio-img-label">' . esc_html( $key ) . '</div>';
176
- $output .= '<img src="' . esc_url( $option ) . '" alt="' . $option .'" class="of-radio-img-img' . $selected .'" onclick="document.getElementById(\''. esc_attr($value['id'] .'_'. $key) .'\').checked=true;" />';
177
- }
178
- break;
179
-
180
- // Checkbox
181
- case "checkbox":
182
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" '. checked( $val, 1, false) .' />';
183
- $output .= '<label class="explain" for="' . esc_attr( $value['id'] ) . '">' . wp_kses( $explain_value, $allowedtags) . '</label>';
184
- break;
185
-
186
- // Multicheck
187
- case "multicheck":
188
- foreach ($value['options'] as $key => $option) {
189
- $checked = '';
190
- $label = $option;
191
- $option = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($key));
192
-
193
- $id = $option_name . '-' . $value['id'] . '-'. $option;
194
- $name = $option_name . '[' . $value['id'] . '][' . $option .']';
195
-
196
- if ( isset($val[$option]) ) {
197
- $checked = checked($val[$option], 1, false);
198
- }
199
-
200
- $output .= '<input id="' . esc_attr( $id ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $name ) . '" ' . $checked . ' /><label for="' . esc_attr( $id ) . '">' . esc_html( $label ) . '</label>';
201
- }
202
- break;
203
-
204
- // Color picker
205
- case "color":
206
- $default_color = '';
207
- if ( isset($value['std']) ) {
208
- if ( $val != $value['std'] )
209
- $default_color = ' data-default-color="' .$value['std'] . '" ';
210
- }
211
- $output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '" class="of-color" type="text" value="' . esc_attr( $val ) . '"' . $default_color .' />';
212
-
213
- break;
214
-
215
- // Uploader
216
- case "upload":
217
- $output .= optionsframework_uploader( $value['id'], $val, null );
218
-
219
- break;
220
-
221
- // Typography
222
- case 'typography':
223
-
224
- unset( $font_size, $font_style, $font_face, $font_color );
225
-
226
- $typography_defaults = array(
227
- 'size' => '',
228
- 'face' => '',
229
- 'style' => '',
230
- 'color' => ''
231
- );
232
-
233
- $typography_stored = wp_parse_args( $val, $typography_defaults );
234
-
235
- $typography_options = array(
236
- 'sizes' => of_recognized_font_sizes(),
237
- 'faces' => of_recognized_font_faces(),
238
- 'styles' => of_recognized_font_styles(),
239
- 'color' => true
240
- );
241
-
242
- if ( isset( $value['options'] ) ) {
243
- $typography_options = wp_parse_args( $value['options'], $typography_options );
244
- }
245
-
246
- // Font Size
247
- if ( $typography_options['sizes'] ) {
248
- $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][size]' ) . '" id="' . esc_attr( $value['id'] . '_size' ) . '">';
249
- $sizes = $typography_options['sizes'];
250
- foreach ( $sizes as $i ) {
251
- $size = $i . 'px';
252
- $font_size .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
253
- }
254
- $font_size .= '</select>';
255
- }
256
-
257
- // Font Face
258
- if ( $typography_options['faces'] ) {
259
- $font_face = '<select class="of-typography of-typography-face" name="' . esc_attr( $option_name . '[' . $value['id'] . '][face]' ) . '" id="' . esc_attr( $value['id'] . '_face' ) . '">';
260
- $faces = $typography_options['faces'];
261
- foreach ( $faces as $key => $face ) {
262
- $font_face .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['face'], $key, false ) . '>' . esc_html( $face ) . '</option>';
263
- }
264
- $font_face .= '</select>';
265
- }
266
-
267
- // Font Styles
268
- if ( $typography_options['styles'] ) {
269
- $font_style = '<select class="of-typography of-typography-style" name="'.$option_name.'['.$value['id'].'][style]" id="'. $value['id'].'_style">';
270
- $styles = $typography_options['styles'];
271
- foreach ( $styles as $key => $style ) {
272
- $font_style .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['style'], $key, false ) . '>'. $style .'</option>';
273
- }
274
- $font_style .= '</select>';
275
- }
276
-
277
- // Font Color
278
- if ( $typography_options['color'] ) {
279
- $default_color = '';
280
- if ( isset($value['std']['color']) ) {
281
- if ( $val != $value['std']['color'] )
282
- $default_color = ' data-default-color="' .$value['std']['color'] . '" ';
283
- }
284
- $font_color = '<input name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" class="of-color of-typography-color type="text" value="' . esc_attr( $typography_stored['color'] ) . '"' . $default_color .' />';
285
- }
286
-
287
- // Allow modification/injection of typography fields
288
- $typography_fields = compact( 'font_size', 'font_face', 'font_style', 'font_color' );
289
- $typography_fields = apply_filters( 'of_typography_fields', $typography_fields, $typography_stored, $option_name, $value );
290
- $output .= implode( '', $typography_fields );
291
-
292
- break;
293
-
294
- // Background
295
- case 'background':
296
-
297
- $background = $val;
298
-
299
- // Background Color
300
- $default_color = '';
301
- if ( isset( $value['std']['color'] ) ) {
302
- if ( $val != $value['std']['color'] )
303
- $default_color = ' data-default-color="' .$value['std']['color'] . '" ';
304
- }
305
- $output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" class="of-color of-background-color" type="text" value="' . esc_attr( $background['color'] ) . '"' . $default_color .' />';
306
-
307
- // Background Image
308
- if ( !isset($background['image']) ) {
309
- $background['image'] = '';
310
- }
311
-
312
- $output .= optionsframework_uploader( $value['id'], $background['image'], null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) );
313
-
314
- $class = 'of-background-properties';
315
- if ( '' == $background['image'] ) {
316
- $class .= ' hide';
317
- }
318
- $output .= '<div class="' . esc_attr( $class ) . '">';
319
-
320
- // Background Repeat
321
- $output .= '<select class="of-background of-background-repeat" name="' . esc_attr( $option_name . '[' . $value['id'] . '][repeat]' ) . '" id="' . esc_attr( $value['id'] . '_repeat' ) . '">';
322
- $repeats = of_recognized_background_repeat();
323
-
324
- foreach ($repeats as $key => $repeat) {
325
- $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['repeat'], $key, false ) . '>'. esc_html( $repeat ) . '</option>';
326
- }
327
- $output .= '</select>';
328
-
329
- // Background Position
330
- $output .= '<select class="of-background of-background-position" name="' . esc_attr( $option_name . '[' . $value['id'] . '][position]' ) . '" id="' . esc_attr( $value['id'] . '_position' ) . '">';
331
- $positions = of_recognized_background_position();
332
-
333
- foreach ($positions as $key=>$position) {
334
- $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['position'], $key, false ) . '>'. esc_html( $position ) . '</option>';
335
- }
336
- $output .= '</select>';
337
-
338
- // Background Attachment
339
- $output .= '<select class="of-background of-background-attachment" name="' . esc_attr( $option_name . '[' . $value['id'] . '][attachment]' ) . '" id="' . esc_attr( $value['id'] . '_attachment' ) . '">';
340
- $attachments = of_recognized_background_attachment();
341
-
342
- foreach ($attachments as $key => $attachment) {
343
- $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['attachment'], $key, false ) . '>' . esc_html( $attachment ) . '</option>';
344
- }
345
- $output .= '</select>';
346
- $output .= '</div>';
347
-
348
- break;
349
-
350
- // Editor
351
- case 'editor':
352
- $output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags ) . '</div>'."\n";
353
- echo $output;
354
- $textarea_name = esc_attr( $option_name . '[' . $value['id'] . ']' );
355
- $default_editor_settings = array(
356
- 'textarea_name' => $textarea_name,
357
- 'media_buttons' => false,
358
- 'tinymce' => array( 'plugins' => 'wordpress' )
359
- );
360
- $editor_settings = array();
361
- if ( isset( $value['settings'] ) ) {
362
- $editor_settings = $value['settings'];
363
- }
364
- $editor_settings = array_merge( $default_editor_settings, $editor_settings );
365
- wp_editor( $val, $value['id'], $editor_settings );
366
- $output = '';
367
- break;
368
-
369
- // Info
370
- case "info":
371
- $id = '';
372
- $class = 'section';
373
- if ( isset( $value['id'] ) ) {
374
- $id = 'id="' . esc_attr( $value['id'] ) . '" ';
375
- }
376
- if ( isset( $value['type'] ) ) {
377
- $class .= ' section-' . $value['type'];
378
- }
379
- if ( isset( $value['class'] ) ) {
380
- $class .= ' ' . $value['class'];
381
- }
382
-
383
- $output .= '<div ' . $id . 'class="' . esc_attr( $class ) . '">' . "\n";
384
- if ( isset($value['name']) ) {
385
- $output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
386
- }
387
- if ( $value['desc'] ) {
388
- $output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n";
389
- }
390
- $output .= '</div>' . "\n";
391
- break;
392
-
393
- // Heading for Navigation
394
- case "heading":
395
- $counter++;
396
- if ( $counter >= 2 ) {
397
- $output .= '</div>'."\n";
398
- }
399
- $class = '';
400
- $class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
401
- $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) );
402
- $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
403
- $output .= '<h3>' . esc_html( $value['name'] ) . '</h3>' . "\n";
404
- break;
405
- }
406
-
407
- if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
408
- $output .= '</div>';
409
- if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) {
410
- $output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags) . '</div>'."\n";
411
- }
412
- $output .= '</div></div>'."\n";
413
- }
414
-
415
- echo $output;
416
- }
417
- echo '</div>';
418
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
options-media-uploader.php DELETED
@@ -1,113 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Media Uploader Using the WordPress Media Library.
5
- *
6
- * Parameters:
7
- * - string $_id - A token to identify this field (the name).
8
- * - string $_value - The value of the field, if present.
9
- * - string $_desc - An optional description of the field.
10
- *
11
- */
12
-
13
- if ( ! function_exists( 'optionsframework_uploader' ) ) :
14
-
15
- function optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
16
-
17
- $optionsframework_settings = get_option( 'optionsframework' );
18
-
19
- // Gets the unique option id
20
- $option_name = $optionsframework_settings['id'];
21
-
22
- $output = '';
23
- $id = '';
24
- $class = '';
25
- $int = '';
26
- $value = '';
27
- $name = '';
28
-
29
- $id = strip_tags( strtolower( $_id ) );
30
-
31
- // If a value is passed and we don't have a stored value, use the value that's passed through.
32
- if ( $_value != '' && $value == '' ) {
33
- $value = $_value;
34
- }
35
-
36
- if ($_name != '') {
37
- $name = $_name;
38
- }
39
- else {
40
- $name = $option_name.'['.$id.']';
41
- }
42
-
43
- if ( $value ) {
44
- $class = ' has-file';
45
- }
46
- $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'optionsframework') .'" />' . "\n";
47
- if ( function_exists( 'wp_enqueue_media' ) ) {
48
- if ( ( $value == '' ) ) {
49
- $output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( 'Upload', 'optionsframework' ) . '" />' . "\n";
50
- } else {
51
- $output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'optionsframework' ) . '" />' . "\n";
52
- }
53
- } else {
54
- $output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'optionsframework' ) . '</i></p>';
55
- }
56
-
57
- if ( $_desc != '' ) {
58
- $output .= '<span class="of-metabox-desc">' . $_desc . '</span>' . "\n";
59
- }
60
-
61
- $output .= '<div class="screenshot" id="' . $id . '-image">' . "\n";
62
-
63
- if ( $value != '' ) {
64
- $remove = '<a class="remove-image">Remove</a>';
65
- $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value );
66
- if ( $image ) {
67
- $output .= '<img src="' . $value . '" alt="" />' . $remove;
68
- } else {
69
- $parts = explode( "/", $value );
70
- for( $i = 0; $i < sizeof( $parts ); ++$i ) {
71
- $title = $parts[$i];
72
- }
73
-
74
- // No output preview if it's not an image.
75
- $output .= '';
76
-
77
- // Standard generic output if it's not an image.
78
- $title = __( 'View File', 'optionsframework' );
79
- $output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">'.$title.'</a></span></div>';
80
- }
81
- }
82
- $output .= '</div>' . "\n";
83
- return $output;
84
- }
85
-
86
- endif;
87
-
88
- /**
89
- * Enqueue scripts for file uploader
90
- */
91
-
92
- if ( ! function_exists( 'optionsframework_media_scripts' ) ) :
93
-
94
- function optionsframework_media_scripts( $hook ) {
95
-
96
- $menu = optionsframework_menu_settings();
97
-
98
- if ( 'appearance_page_' . $menu['menu_slug'] != $hook )
99
- return;
100
-
101
- if ( function_exists( 'wp_enqueue_media' ) )
102
- wp_enqueue_media();
103
- wp_register_script( 'of-media-uploader', OPTIONS_FRAMEWORK_URL .'js/media-uploader.js', array( 'jquery' ) );
104
- wp_enqueue_script( 'of-media-uploader' );
105
- wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
106
- 'upload' => __( 'Upload', 'optionsframework' ),
107
- 'remove' => __( 'Remove', 'optionsframework' )
108
- ) );
109
- }
110
-
111
- add_action( 'admin_enqueue_scripts', 'optionsframework_media_scripts' );
112
-
113
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Options Framework ===
2
 
3
- Contributors: Devin Price
4
  Tags: options, theme options
5
  Donate link: http://bit.ly/options-donate-2
6
- Requires at least: 3.3
7
- Tested up to: 3.6
8
- Stable tag: 1.6
9
  License: GPLv2
10
 
11
  == Description ==
@@ -63,10 +63,28 @@ You can also watch the video screencast I have at [http://wptheming.com/options-
63
 
64
  == Screenshots ==
65
 
66
- 1. An example of the "Advanced Options" tag in the "Options Check" theme using this plugin.
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  = 1.6 =
71
 
72
  * Allow media buttons in the editor option
1
  === Options Framework ===
2
 
3
+ 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: 3.7.1
8
+ Stable tag: 1.7.1
9
  License: GPLv2
10
 
11
  == Description ==
63
 
64
  == Screenshots ==
65
 
66
+ 1. An example of the "Advanced Options" tab in the "Options Check" theme using this plugin.
67
 
68
  == Changelog ==
69
 
70
+ = 1.7.1 =
71
+
72
+ * Fix to use option name if set in options.php
73
+
74
+ = 1.7.0 =
75
+
76
+ * Update to class based plugin (large code refactor)
77
+ * Drop color picker support for older versions of WordPress
78
+ * Better support for new admin interface in WordPress 3.8
79
+ * Allow option pages without tabs
80
+
81
+ = 1.6.1 =
82
+
83
+ * Fix for update notice location
84
+ * Use selected and checked functions more consistently
85
+ * Reuse media modal for uploads
86
+ * Portuguese translations (props @xipasduarte)
87
+
88
  = 1.6 =
89
 
90
  * Allow media buttons in the editor option
screenshot-1.png CHANGED
Binary file