WP Responsive Menu - Version 2.0.1

Version Description

Download this release

Release Info

Developer sagarseth9
Plugin Icon 128x128 WP Responsive Menu
Version 2.0.1
Comparing to
See all releases

Code changes from version 1.0 to 2.0.1

admin.php DELETED
@@ -1,536 +0,0 @@
1
- <?php
2
-
3
- /**
4
- *
5
- * Default plugin settings
6
- *
7
- */
8
- $wprmenu_setup = array(
9
- 'enabled' => 1,
10
- 'menu' => '',
11
- 'menu_symbol_pos' => 'left',
12
- 'bar_title' => 'MENU',
13
- 'nesting_icon' => '',
14
- 'nesting_icon_open' => '',
15
- 'from_width' => 768,
16
- 'position' => 'left',
17
- 'how_wide' => '80',
18
- 'hide' => array(),
19
- 'zooming' => 'no',
20
- 'bar_bgd' => '#0D0D0D',
21
- 'bar_color' => '#F2F2F2',
22
- 'menu_bgd' => '#2E2E2E',
23
- 'menu_color' => '#CFCFCF',
24
- 'menu_color_hover' => '#606060',
25
- 'menu_border_top' => '#474747',
26
- 'menu_border_bottom' => '#131212',
27
- 'menu_border_bottom_show' => 'yes'
28
- );
29
-
30
- /**
31
- *
32
- * Save the default settings
33
- *
34
- */
35
- if(!get_option('wprmenu_options')) {
36
- add_option('wprmenu_options', $wprmenu_setup);
37
- }
38
-
39
- /**
40
- *
41
- * Add settings page menu item
42
- *
43
- */
44
- if ( is_admin() ){
45
- /**
46
- * action name
47
- * function that will create the menu page link / options page
48
- */
49
- add_action( 'admin_menu', 'wprmenu_admin_menu' );
50
- }
51
-
52
-
53
-
54
- /**
55
- *
56
- * Add plugin settings page
57
- *
58
- */
59
- function wprmenu_admin_menu(){
60
- /**
61
- * menu title
62
- * page title
63
- * who can acces the settings - user that can ...
64
- * the settings page identifier for the url
65
- * function that will generate the form with th esettings
66
- */
67
- add_options_page(__('WP Responsive Menu','wprmenu'),__('WP Responsive Menu','wprmenu'),'manage_options','wprmenu_settings','wprmenu_settings');
68
- }
69
-
70
-
71
-
72
- function wprmenu_add_admin_scripts() {
73
- if ( 'settings_page_wprmenu_settings' == get_current_screen()->id ) {
74
- if(function_exists( 'wp_enqueue_media' )){
75
- wp_enqueue_media();
76
- }else{
77
- wp_enqueue_style('thickbox');
78
- wp_enqueue_script('media-upload');
79
- wp_enqueue_script('thickbox');
80
- }
81
- }
82
- }
83
- add_action('admin_enqueue_scripts', 'wprmenu_add_admin_scripts');
84
-
85
- /**
86
- *
87
- * Create the tabs for the settings page
88
- * @param string $current default tab
89
- * @return HTML The tab switcher
90
- *
91
- */
92
- function wprmenu_settings_tabs( $current = 'general' ) {
93
- $tabs = array( 'general' => __('General','wprmenu'), 'appearance' => __('Menu Appearance','wprmenu'));
94
- echo '<h2 class="nav-tab-wrapper">';
95
- foreach( $tabs as $tab => $name ){
96
- $class = ( $tab == $current ) ? ' nav-tab-active' : '';
97
- echo "<a class='nav-tab$class' href='?page=wprmenu_settings&tab=$tab'>$name</a>";
98
- }
99
- echo '</h2>';
100
- }
101
-
102
- /**
103
- *
104
- * The settings wrappers
105
- * one for 'general' and 'emails' tabs
106
- * one for subscribers list
107
- *
108
- */
109
- function wprmenu_settings() {
110
- ?>
111
- <div class="wrap">
112
- <br>
113
- <h2> WP Responsive Menu </h2>
114
- <br>
115
- <?php if ( isset ( $_GET['tab'] ) ) wprmenu_settings_tabs($_GET['tab']); else wprmenu_settings_tabs('general'); ?>
116
- <form method="post" action="options.php" enctype="multipart/form-data">
117
- <?php
118
- settings_fields('wprmenu_options');
119
- do_settings_sections('wprmenu_plugin');
120
- submit_button();
121
- ?>
122
- </form>
123
- </div>
124
- <?php
125
- }
126
-
127
-
128
- /**
129
- *
130
- * Initialize the settings
131
- *
132
- */
133
- if ( is_admin() ) {
134
- /**
135
- * action name
136
- * function that will do all the initialization
137
- */
138
- add_action('admin_init', 'wprmenu_admin_init');
139
- }
140
-
141
- /**
142
- *
143
- * Settings sections and fields setup
144
- *
145
- */
146
- function wprmenu_admin_init(){
147
- register_setting( 'wprmenu_options', 'wprmenu_options', 'wprmenu_options_validate' );
148
- //
149
- if(!isset($_GET['tab']) || $_GET['tab'] == 'general') {
150
- add_settings_section('wprmenu_general_settings', '<br>'.__('General settings','wprmenu'), 'wprmenu_general_settings_section', 'wprmenu_plugin');
151
- //
152
- add_settings_field('wprmenu_enabled', __('Enable mobile navigation','wprmenu'), 'wprmenu_general_settings_enabled', 'wprmenu_plugin', 'wprmenu_general_settings');
153
- //
154
- add_settings_field('wprmenu_menu', __('Choose the wordpress menu','wprmenu'), 'wprmenu_general_settings_menu', 'wprmenu_plugin', 'wprmenu_general_settings');
155
- //
156
- add_settings_field('wprmenu_menu_symbol_pos', __('Menu symbol position (on the top menu bar)','wprmenu'), 'wprmenu_general_settings_menu_symbol_pos', 'wprmenu_plugin', 'wprmenu_general_settings');
157
- //
158
- add_settings_field('wprmenu_bar_title', __('Text on menu bar','wprmenu'), 'wprmenu_general_settings_bar_title', 'wprmenu_plugin', 'wprmenu_general_settings');
159
- //
160
- add_settings_field('wprmenu_bar_logo', __('Logo for menu bar','wprmenu'), 'wprmenu_general_settings_bar_logo', 'wprmenu_plugin', 'wprmenu_general_settings');
161
- //
162
- add_settings_field('wprmenu_from_width', __('Display menu from width (below in pixels)','wprmenu'), 'wprmenu_general_settings_from_width', 'wprmenu_plugin', 'wprmenu_general_settings');
163
- //
164
- add_settings_field('wprmenu_position', __('Menu position','wprmenu'), 'wprmenu_general_settings_position', 'wprmenu_plugin', 'wprmenu_general_settings');
165
- //
166
- add_settings_field('wprmenu_how_wide', __('Menu Width ( % of total page width )','wprmenu'), 'wprmenu_general_settings_how_wide', 'wprmenu_plugin', 'wprmenu_general_settings');
167
- //
168
- add_settings_field('wprmenu_hide', __('Hide elements on mobile','wprmenu'), 'wprmenu_general_settings_hide', 'wprmenu_plugin', 'wprmenu_general_settings');
169
- //
170
- add_settings_field('wprmenu_zooming', __('Allow zooming on mobile devices?','wprmenu'), 'wprmenu_general_settings_zooming', 'wprmenu_plugin', 'wprmenu_general_settings');
171
- }
172
- //
173
- if(isset($_GET['tab']) && $_GET['tab'] == 'appearance') {
174
- add_settings_section('wprmenu_appearance_settings', '<br>'.__('Menu appearance','wprmenu'), 'wprmenu_appearance_settings_section', 'wprmenu_plugin');
175
- //
176
- add_settings_field('wprmenu_bar_bgd', __('Menu bar background color','wprmenu'), 'wprmenu_appearance_settings_bar_bgd', 'wprmenu_plugin', 'wprmenu_appearance_settings');
177
- //
178
- add_settings_field('wprmenu_bar_color', __('Menu bar text color','wprmenu'), 'wprmenu_appearance_settings_bar_color', 'wprmenu_plugin', 'wprmenu_appearance_settings');
179
- //
180
- add_settings_field('wprmenu_menu_bgd', __('Menu background color','wprmenu'), 'wprmenu_appearance_settings_menu_bgd', 'wprmenu_plugin', 'wprmenu_appearance_settings');
181
- //
182
- add_settings_field('wprmenu_menu_color', __('Menu text color','wprmenu'), 'wprmenu_appearance_settings_menu_color', 'wprmenu_plugin', 'wprmenu_appearance_settings');
183
- //
184
- add_settings_field('wprmenu_menu_color_hover', __('Menu hover text color','wprmenu'), 'wprmenu_appearance_settings_menu_color_hover', 'wprmenu_plugin', 'wprmenu_appearance_settings');
185
- //
186
- add_settings_field('wprmenu_menu_icon_color', __('Menu icon color','wprmenu'), 'wprmenu_appearance_settings_menu_icon_color', 'wprmenu_plugin', 'wprmenu_appearance_settings');
187
- //
188
- add_settings_field('wprmenu_menu_border_top', __('Menu borders(top & left) color','wprmenu'), 'wprmenu_appearance_settings_menu_border_top', 'wprmenu_plugin', 'wprmenu_appearance_settings');
189
- //
190
- add_settings_field('wprmenu_menu_border_bottom', __('Menu borders(bottom) color','wprmenu'), 'wprmenu_appearance_settings_menu_border_bottom', 'wprmenu_plugin', 'wprmenu_appearance_settings');
191
- //
192
- add_settings_field('wprmenu_menu_border_bottom_show', __('Borders on menu items','wprmenu'), 'wprmenu_appearance_settings_menu_border_bottom_show', 'wprmenu_plugin', 'wprmenu_appearance_settings');
193
- }
194
- }
195
-
196
-
197
- function wprmenu_general_settings_section() {
198
-
199
- }
200
-
201
-
202
- function wprmenu_general_settings_enabled() {
203
- $options = get_option('wprmenu_options');
204
- ?>
205
- <label for="wprmenu_enabled">
206
- <input name="wprmenu_options[enabled]" type="checkbox" id="wprmenu_enabled" value="1" <?php if($options['enabled']) echo 'checked="checked"' ?>>
207
- <?php ' '._e('Enabled','wprmenu'); ?>
208
- </label>
209
- <?php
210
- }
211
-
212
-
213
- function wprmenu_general_settings_menu() {
214
- $options = get_option('wprmenu_options');
215
- $menus = get_terms('nav_menu',array('hide_empty'=>false));
216
- ?>
217
- <select name="wprmenu_options[menu]" >
218
- <?php foreach( $menus as $m ): ?>
219
- <option <?php if($m->term_id == $options['menu']) echo 'selected="selected"'; ?> value="<?php echo $m->term_id ?>"><?php echo $m->name ?></option>
220
- <?php endforeach; ?>
221
- </select>
222
- <?php
223
- }
224
-
225
-
226
- function wprmenu_general_settings_menu_symbol_pos() {
227
- $options = get_option('wprmenu_options');
228
- ?>
229
- <select id="sdmn_menu_symbol_pos" name="wprmenu_options[menu_symbol_pos]" >
230
- <option <?php if($options['menu_symbol_pos'] == 'left') echo 'selected="selected"'; ?> value="left">left</option>
231
- <option <?php if($options['menu_symbol_pos'] == 'right') echo 'selected="selected"'; ?> value="right">right</option>
232
- </select>
233
- <?php
234
- }
235
-
236
- function wprmenu_general_settings_bar_title() {
237
- $options = get_option('wprmenu_options');
238
- ?>
239
- <input id="wprmenu_bar_title" name="wprmenu_options[bar_title]" size="20" type="text" value="<?php echo $options['bar_title'] ?>" />
240
- <?php
241
- }
242
-
243
- function wprmenu_general_settings_bar_logo() {
244
- $options = get_option('wprmenu_options');
245
- ?>
246
- <input type="hidden" name="wprmenu_options[bar_logo]" class="wprmenu_bar_logo_url" value="<?php echo $options['bar_logo'] ?>">
247
- <span style="position:relative">
248
- <img style="<?php if(!$options['bar_logo']) echo 'display:none; ' ?> width:auto; height:20px; margin-bottom:-6px; margin-right:6px;" class="wprmenu_bar_logo_prev" src="<?php echo $options['bar_logo'] ?>" alt="">
249
- </span>
250
- <input id="upload_bar_logo_button" type="button" class="button" value="Choose image" />
251
- <span class="description"><?php if($options['bar_logo']) echo ' <a class="wprmenu_disc_bar_logo" href="#" style="margin-left:10px;"> Discard the image (disable logo)</a>'; ?></span>
252
- <?php
253
- }
254
-
255
-
256
- function wprmenu_general_settings_nesting_icon() {
257
- $options = get_option('wprmenu_options');
258
- ?>
259
- <input id="wprmenu_nesting_icon" name="wprmenu_options[nesting_icon]" size="20" type="text" value="<?php echo $options['nesting_icon'] ?>" />
260
- <?php
261
- }
262
-
263
- function wprmenu_general_settings_nesting_icon_open() {
264
- $options = get_option('wprmenu_options');
265
- ?>
266
- <input id="wprmenu_nesting_icon_open" name="wprmenu_options[nesting_icon_open]" size="20" type="text" value="<?php echo $options['nesting_icon_open'] ?>" />
267
- <?php
268
- }
269
-
270
-
271
- function wprmenu_general_settings_from_width() {
272
- $options = get_option('wprmenu_options');
273
- ?>
274
- <input id="wprmenu_from_width" name="wprmenu_options[from_width]" min="280" max="962" size="20" type="number" value="<?php echo $options['from_width'] ?>" />
275
- <?php
276
- }
277
-
278
-
279
-
280
- function wprmenu_general_settings_position() {
281
- $options = get_option('wprmenu_options');
282
- ?>
283
- <select id="wpr_menu_pos" name="wprmenu_options[position]" >
284
- <option <?php if($options['position'] == 'top') echo 'selected="selected"'; ?> value="top">top</option>
285
- <option <?php if($options['position'] == 'left') echo 'selected="selected"'; ?> value="left">left</option>
286
- <option <?php if($options['position'] == 'right') echo 'selected="selected"'; ?> value="right">right</option>
287
- </select>
288
- <?php
289
- }
290
-
291
-
292
- function wprmenu_general_settings_how_wide() {
293
- $options = get_option('wprmenu_options');
294
- ?>
295
- <input id="wprmenu_how_wide" name="wprmenu_options[how_wide]" min="30" max="100" size="20" type="number" value="<?php echo $options['how_wide'] ?>" />
296
- <?php
297
- }
298
-
299
-
300
- function wprmenu_general_settings_hide() {
301
- $options = get_option('wprmenu_options');
302
- ?>
303
- <input id="wprmenu_hide" name="wprmenu_options[hide]" size="60" type="text" value="<?php echo implode(', ',$options['hide']) ?>" />
304
- <br>CSS sellectors (IDs and classes comma separated) <i>Example: #menu, .nav</i>
305
- <?php
306
- }
307
-
308
-
309
- function wprmenu_general_settings_zooming() {
310
- $options = get_option('wprmenu_options');
311
- ?>
312
- <select id="sdmn_zooming" name="wprmenu_options[zooming]" >
313
- <option <?php if($options['zooming'] == 'yes') echo 'selected="selected"'; ?> value="yes">Yes</option>
314
- <option <?php if($options['zooming'] == 'no') echo 'selected="selected"'; ?> value="no">No</option>
315
- </select>
316
- <?php
317
- }
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
- function wprmenu_appearance_settings_section() {
330
-
331
- }
332
-
333
-
334
- function wprmenu_appearance_settings_bar_bgd() {
335
- $options = get_option('wprmenu_options');
336
- ?>
337
- <input maxlength="7" size="5" type="text" name="wprmenu_options[bar_bgd]" id="wprmenu_bar_bgd_picker" value="<?php echo $options['bar_bgd']; ?>" />
338
- <?php
339
- }
340
-
341
-
342
- function wprmenu_appearance_settings_bar_color() {
343
- $options = get_option('wprmenu_options');
344
- ?>
345
- <input maxlength="7" size="5" type="text" name="wprmenu_options[bar_color]" id="wprmenu_bar_color_picker" value="<?php echo $options['bar_color']; ?>" />
346
- <?php
347
- }
348
-
349
-
350
- function wprmenu_appearance_settings_menu_bgd() {
351
- $options = get_option('wprmenu_options');
352
- ?>
353
- <input maxlength="7" size="5" type="text" name="wprmenu_options[menu_bgd]" id="wprmenu_menu_bgd_picker" value="<?php echo $options['menu_bgd']; ?>" />
354
- <?php
355
- }
356
-
357
-
358
- function wprmenu_appearance_settings_menu_color() {
359
- $options = get_option('wprmenu_options');
360
- ?>
361
- <input maxlength="7" size="5" type="text" name="wprmenu_options[menu_color]" id="wprmenu_menu_color_picker" value="<?php echo $options['menu_color']; ?>" />
362
- <?php
363
- }
364
-
365
-
366
- function wprmenu_appearance_settings_menu_color_hover() {
367
- $options = get_option('wprmenu_options');
368
- ?>
369
- <input maxlength="7" size="5" type="text" name="wprmenu_options[menu_color_hover]" id="wprmenu_menu_color_hover_picker" value="<?php echo $options['menu_color_hover']; ?>" />
370
- <?php
371
- }
372
-
373
- function wprmenu_appearance_settings_menu_icon_color() {
374
- $options = get_option('wprmenu_options');
375
- ?>
376
- <input maxlength="7" size="5" type="text" name="wprmenu_options[menu_icon_color]" id="wprmenu_menu_icon_color_picker" value="<?php echo $options['menu_icon_color']; ?>" />
377
- <?php
378
- }
379
-
380
-
381
- function wprmenu_appearance_settings_menu_border_top() {
382
- $options = get_option('wprmenu_options');
383
- ?>
384
- <input maxlength="7" size="5" type="text" name="wprmenu_options[menu_border_top]" id="wprmenu_menu_border_top_picker" value="<?php echo $options['menu_border_top']; ?>" />
385
- <?php
386
- }
387
-
388
-
389
- function wprmenu_appearance_settings_menu_border_bottom() {
390
- $options = get_option('wprmenu_options');
391
- ?>
392
- <input maxlength="7" size="5" type="text" name="wprmenu_options[menu_border_bottom]" id="wprmenu_menu_border_bottom_picker" value="<?php echo $options['menu_border_bottom']; ?>" />
393
- <?php
394
- }
395
-
396
-
397
- function wprmenu_appearance_settings_menu_border_bottom_show() {
398
- $options = get_option('wprmenu_options');
399
- ?>
400
- <select id="wprmenu_options_bottom" name="wprmenu_options[menu_border_bottom_show]" >
401
- <option <?php if($options['menu_border_bottom_show'] == 'yes') echo 'selected="selected"'; ?> value="yes">Yes</option>
402
- <option <?php if($options['menu_border_bottom_show'] == 'no') echo 'selected="selected"'; ?> value="no">No</option>
403
- </select>
404
- <?php
405
- }
406
-
407
- /**
408
- *Save settings fields
409
- *
410
- */
411
- function wprmenu_options_validate($input) {
412
- global $wprmenu_setup; //default settings array
413
-
414
- $options = get_option('wprmenu_options');
415
-
416
- //enabled / dispabled
417
- if(isset($input['menu'])) {
418
- $options['enabled'] = $input['enabled'];
419
- }
420
-
421
- //section "General", option "menu"
422
- if(isset($input['menu'])) {
423
- $options['menu'] = $input['menu'];
424
- if($options['menu'] == false || $options['menu'] == null || $options['menu'] == 0 || $options['menu'] == '') $options['menu'] = '';
425
- }
426
-
427
- if(isset($input['menu_symbol_pos'])) {
428
- $options['menu_symbol_pos'] = $input['menu_symbol_pos'];
429
- }
430
-
431
- //section "General", option "bar_title"
432
- if(isset($input['bar_title'])) {
433
- $options['bar_title'] = trim($input['bar_title']);
434
- if($options['bar_title'] == false || $options['bar_title'] == '') $options['bar_title'] = '';
435
- }
436
-
437
- //section "General", option "bar_logo"
438
- if(isset($input['bar_logo'])) {
439
- $options['bar_logo'] = trim($input['bar_logo']);
440
- if($options['bar_logo'] == false || $options['bar_logo'] == '') $options['bar_logo'] = '';
441
- }
442
-
443
- if(isset($input['nesting_icon'])) {
444
- $options['nesting_icon'] = trim($input['nesting_icon']);
445
- if($options['nesting_icon'] == false || $options['nesting_icon'] == '') $options['nesting_icon'] = '';
446
- }
447
-
448
- if(isset($input['nesting_icon_open'])) {
449
- $options['nesting_icon_open'] = trim($input['nesting_icon_open']);
450
- if($options['nesting_icon_open'] == false || $options['nesting_icon_open'] == '') $options['nesting_icon_open'] = '';
451
- }
452
-
453
- //section "General", option "from_width"
454
- if(isset($input['from_width'])) {
455
- $options['from_width'] = $input['from_width'];
456
- }
457
-
458
- //section "General", option "position"
459
- if(isset($input['position'])) {
460
- $options['position'] = $input['position'];
461
- }
462
-
463
- //section "General", option "how_wide"
464
- if(isset($input['how_wide'])) {
465
- $options['how_wide'] = $input['how_wide'];
466
- }
467
-
468
- //section "General", option "hide"
469
- if(isset($input['hide'])) {
470
- $sel = explode(',', trim($input['hide']));
471
- foreach($sel as $s) {
472
- $selectors[] = trim($s);
473
- }
474
- $options['hide'] = $selectors;
475
- } else {
476
- }
477
-
478
- //section "General", option "zooming"
479
- if(isset($input['zooming'])) {
480
- $options['zooming'] = $input['zooming'];
481
- }
482
-
483
-
484
-
485
- //section "appearance", option "bar_bgd"
486
- if(isset($input['bar_bgd'])) {
487
- $options['bar_bgd'] = $input['bar_bgd'];
488
- }
489
-
490
- //section "appearance", option "bar_color"
491
- if(isset($input['bar_color'])) {
492
- $options['bar_color'] = $input['bar_color'];
493
- }
494
-
495
- //section "appearance", option "menu_bgd"
496
- if(isset($input['menu_bgd'])) {
497
- $options['menu_bgd'] = $input['menu_bgd'];
498
- }
499
-
500
- //section "appearance", option "menu_color"
501
- if(isset($input['menu_color'])) {
502
- $options['menu_color'] = $input['menu_color'];
503
- }
504
-
505
- //section "appearance", option "menu_color_hover"
506
- if(isset($input['menu_color_hover'])) {
507
- $options['menu_color_hover'] = $input['menu_color_hover'];
508
- }
509
-
510
- //section "appearance", option "menu_icon_color"
511
- if(isset($input['menu_icon_color'])) {
512
- $options['menu_icon_color'] = $input['menu_icon_color'];
513
- }
514
-
515
- //section "appearance", option "menu_border_top"
516
- if(isset($input['menu_border_top'])) {
517
- $options['menu_border_top'] = $input['menu_border_top'];
518
- }
519
-
520
-
521
- //section "appearance", option "menu_border_bottom"
522
- if(isset($input['menu_border_bottom'])) {
523
- $options['menu_border_bottom'] = $input['menu_border_bottom'];
524
- }
525
-
526
- if(isset($input['menu_border_bottom_show'])) {
527
- $options['menu_border_bottom_show'] = $input['menu_border_bottom_show'];
528
- }
529
-
530
- //save only the options that were changed
531
- $options = array_merge(get_option('wprmenu_options'), $options);
532
-
533
- //echo '<pre>'; print_r($options); echo '</pre>';
534
-
535
- return $options;
536
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/wprmenu.css CHANGED
@@ -51,9 +51,6 @@ Icons from icon font - setup
51
  margin: -1px 0 0 !important;
52
  width: 1px !important;
53
  }
54
-
55
-
56
-
57
  /*
58
  The top Bar that shows/hides the menu
59
  */
@@ -66,7 +63,7 @@ The top Bar that shows/hides the menu
66
  width:100%;
67
  display: none;
68
  cursor: pointer;
69
- z-index: 99998;
70
  overflow: hidden;
71
  height:42px;
72
  display: none;
@@ -87,22 +84,32 @@ The top Bar that shows/hides the menu
87
  width:auto;
88
  height: 25px;
89
  }
 
 
 
 
 
 
 
 
 
 
90
  /* font icon */
91
  #wprmenu_bar .wprmenu_icon_menu {
92
  color:#f2f2f2;
93
  margin-right:5px;
94
  }
95
  /* html icon */
96
- #wprmenu_bar .wprmenu_ic {
97
  width: 20px;
98
  height: 22px;
99
  overflow: hidden;
100
  float: left;
101
  margin-right: 16px;
102
  padding-top: 2px;
103
- position: relative;
104
  }
105
- #wprmenu_bar .wprmenu_ic span {
106
  -webkit-transition: all .01s ease-in-out;
107
  -moz-transition: all .01s ease-in-out;
108
  -o-transition: all .01s ease-in-out;
@@ -166,24 +173,28 @@ body { position: relative!important; }
166
  position: fixed;
167
  top: 0px;
168
  height: 100%;
169
- z-index: 99997;
170
  overflow-x: none;
171
  overflow-y: auto;
172
  background: #2E2E2E;
 
173
  }
174
- #wprmenu_menu.left ul#wprmenu_menu_ul, #wprmenu_menu.right ul#wprmenu_menu_ul {
175
- padding-top: 42px;
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
  /*1st level*/
188
  #wprmenu_menu ul {
189
  margin:0px;
@@ -222,7 +233,7 @@ body { position: relative!important; }
222
  #wprmenu_menu.wprmenu_levels ul li a{
223
  float: left;
224
  border: none;
225
-
226
  }
227
  #wprmenu_menu.wprmenu_levels a.wprmenu_parent_item {
228
  border-left:1px solid #474747;
51
  margin: -1px 0 0 !important;
52
  width: 1px !important;
53
  }
 
 
 
54
  /*
55
  The top Bar that shows/hides the menu
56
  */
63
  width:100%;
64
  display: none;
65
  cursor: pointer;
66
+ z-index: 98;
67
  overflow: hidden;
68
  height:42px;
69
  display: none;
84
  width:auto;
85
  height: 25px;
86
  }
87
+ /* Search Box */
88
+ .wpr_search {
89
+ padding: 10px !important;
90
+ }
91
+ .wpr_search .wpr-search-field {
92
+ padding: 5px !important;
93
+ border: 1px solid #ccc;
94
+ max-width: 100%;
95
+ width: 100%;
96
+ }
97
  /* font icon */
98
  #wprmenu_bar .wprmenu_icon_menu {
99
  color:#f2f2f2;
100
  margin-right:5px;
101
  }
102
  /* html icon */
103
+ #wprmenu_bar .wprmenu_icon {
104
  width: 20px;
105
  height: 22px;
106
  overflow: hidden;
107
  float: left;
108
  margin-right: 16px;
109
  padding-top: 2px;
110
+ position: relative;
111
  }
112
+ #wprmenu_bar .wprmenu_icon span {
113
  -webkit-transition: all .01s ease-in-out;
114
  -moz-transition: all .01s ease-in-out;
115
  -o-transition: all .01s ease-in-out;
173
  position: fixed;
174
  top: 0px;
175
  height: 100%;
176
+ z-index: 97;
177
  overflow-x: none;
178
  overflow-y: auto;
179
  background: #2E2E2E;
180
+ top: 42px;
181
  }
182
+ body.admin-bar #wprmenu_bar {
183
+ top:32px;
184
+ }
185
+ body.admin-bar #wprmenu_menu.left,
186
+ body.admin-bar #wprmenu_menu.right {
187
+ top: 74px;
188
+ }
189
+ @media only screen and (max-width: 782px) {
190
+ body.admin-bar #wprmenu_menu.left,
191
+ body.admin-bar #wprmenu_menu.right {
192
+ top: 86px;
193
+ }
194
+ body.admin-bar #wprmenu_bar {
195
+ top:46px;
196
+ }
197
  }
 
 
 
 
 
 
 
 
 
 
198
  /*1st level*/
199
  #wprmenu_menu ul {
200
  margin:0px;
233
  #wprmenu_menu.wprmenu_levels ul li a{
234
  float: left;
235
  border: none;
236
+ width: 100%;
237
  }
238
  #wprmenu_menu.wprmenu_levels a.wprmenu_parent_item {
239
  border-left:1px solid #474747;
functions.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Loads the Options Panel
5
+ *
6
+ * If you're loading from a child theme use stylesheet_directory
7
+ * instead of template_directory
8
+ */
9
+
10
+ define( 'WPR_OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' );
11
+ require_once dirname( __FILE__ ) . '/inc/options-framework.php';
12
+
13
+ /*
14
+ * This is an example of how to add custom scripts to the options panel.
15
+ * This one shows/hides the an option when a checkbox is clicked.
16
+ *
17
+ * You can delete it if you not using that option
18
+ */
19
+ add_action( 'optionsframework_custom_scripts', 'optionsframework_custom_scripts' );
20
+
21
+ function optionsframework_custom_scripts() { ?>
22
+
23
+ <script type="text/javascript">
24
+ jQuery(document).ready(function() {
25
+
26
+ jQuery('#example_showhidden').click(function() {
27
+ jQuery('#section-example_text_hidden').fadeToggle(400);
28
+ });
29
+
30
+ if (jQuery('#example_showhidden:checked').val() !== undefined) {
31
+ jQuery('#section-example_text_hidden').show();
32
+ }
33
+
34
+ });
35
+ </script>
36
+
37
+ <?php
38
+ }
39
+
40
+ /*
41
+ * This is an example of filtering menu parameters
42
+ */
43
+
44
+ /*
45
+ function prefix_options_menu_filter( $menu ) {
46
+ $menu['mode'] = 'menu';
47
+ $menu['page_title'] = __( 'Hello Options', 'textdomain');
48
+ $menu['menu_title'] = __( 'Hello Options', 'textdomain');
49
+ $menu['menu_slug'] = 'hello-options';
50
+ return $menu;
51
+ }
52
+
53
+ add_filter( 'optionsframework_menu', 'prefix_options_menu_filter' );
54
+ */
inc/css/wpr_optionsframework.css ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Options Framework Admin Styles */
2
+
3
+ #wpr_optionsframework {
4
+ max-width:840px;
5
+ background:#344A5F;
6
+ color:#fff;
7
+ }
8
+ #wpr_optionsframework h3 {
9
+ cursor: default;
10
+ background-color: #14A085;
11
+ border-bottom: 1px solid #ddd;
12
+ color:#fff;
13
+ }
14
+ #wpr_optionsframework p {
15
+ margin-bottom:0;
16
+ padding-bottom:10px;
17
+ }
18
+ #wpr_optionsframework .section {
19
+ padding:10px 10px 0;
20
+ }
21
+ #wpr_optionsframework .group {
22
+ padding-bottom:40px;
23
+ }
24
+ #wpr_optionsframework .section .controls {
25
+ float: left;
26
+ min-width:350px;
27
+ width: 54%;
28
+ padding-right:2%;
29
+ }
30
+ #wpr_optionsframework .section .explain {
31
+ max-width:38%;
32
+ float: left;
33
+ font-size: 12px;
34
+ line-height:16px;
35
+ color: #ccc;
36
+ }
37
+ #wpr_optionsframework .section-checkbox .controls {
38
+ width: 98%;
39
+ }
40
+ #wpr_optionsframework .section-checkbox .explain {
41
+ max-width:94%;
42
+ }
43
+ #wpr_optionsframework .controls input[type=text] {
44
+ width:100%;
45
+ }
46
+ #wpr_optionsframework .controls input[type=text].wp-color-picker {
47
+ width: 65px;
48
+ }
49
+ #wpr_optionsframework .controls select, #wpr_optionsframework .controls textarea {
50
+ margin-bottom:10px;
51
+ width:100%;
52
+ }
53
+ #wpr_optionsframework .section-radio label, #wpr_optionsframework .section-multicheck label {
54
+ float:left;
55
+ max-width:90%;
56
+ line-height: 16px;
57
+ margin-bottom: 5px;
58
+ }
59
+ #wpr_optionsframework input.checkbox, #wpr_optionsframework input.of-radio {
60
+ margin: 0 10px 5px 0;
61
+ float:left;
62
+ clear:both;
63
+ }
64
+ #wpr_optionsframework .section-typography .controls {
65
+ float:none;
66
+ width:auto;
67
+ }
68
+ #wpr_optionsframework .section-typography .explain {
69
+ float:none;
70
+ width:auto;
71
+ }
72
+ #wpr_optionsframework .controls .of-typography-size {
73
+ width:80px;
74
+ float:left
75
+ }
76
+ #wpr_optionsframework .controls .of-typography-unit {
77
+ width:50px;
78
+ margin-left:5px;
79
+ float:left
80
+ }
81
+ #wpr_optionsframework .controls .of-typography-face {
82
+ width:100px;
83
+ margin-left:5px;
84
+ float:left
85
+ }
86
+ #wpr_optionsframework .controls .of-typography-style {
87
+ width:80px;
88
+ margin-left:5px;
89
+ margin-right:5px;
90
+ float:left
91
+ }
92
+ #wpr_optionsframework .section-typography .wp-picker-container {
93
+ margin-top:2px;
94
+ }
95
+ #wpr_optionsframework .of-background-properties {
96
+ clear:both;
97
+ margin-top: 18px;
98
+ }
99
+ #wpr_optionsframework .controls .of-background-repeat {
100
+ width:125px;
101
+ margin-right:5px;
102
+ float:left
103
+ }
104
+ #wpr_optionsframework .controls .of-background-position {
105
+ width:125px;
106
+ margin-right:5px;
107
+ float:left
108
+ }
109
+ #wpr_optionsframework .controls .of-background-attachment {
110
+ width:125px;
111
+ margin-right:5px;
112
+ float:left
113
+ }
114
+ #wpr_optionsframework .section-background .wp-picker-container {
115
+ margin-bottom:10px;
116
+ }
117
+ #wpr_optionsframework .controls .of-radio-img-img {
118
+ border:3px solid #f9f9f9;
119
+ margin:0 5px 10px 0;
120
+ display:none;
121
+ cursor:pointer;
122
+ float:left;
123
+ }
124
+ #wpr_optionsframework .controls .of-radio-img-selected {
125
+ border:3px solid #ccc
126
+ }
127
+ #wpr_optionsframework .controls .of-radio-img-img:hover {
128
+ opacity:.8;
129
+ }
130
+ #wpr_optionsframework .controls .of-border-width {
131
+ width:80px;
132
+ float:left
133
+ }
134
+ #wpr_optionsframework .controls .of-border-style {
135
+ width:120px;
136
+ float:left
137
+ }
138
+ #wpr_optionsframework .hide {
139
+ display:none;
140
+ }
141
+ #wpr_optionsframework .of-option-image {
142
+ max-width:340px;
143
+ margin:3px 0 18px 0;
144
+ }
145
+ #wpr_optionsframework .mini .controls select, #wpr_optionsframework .section .mini .controls {
146
+ width: 140px;
147
+ }
148
+ #wpr_optionsframework .mini .controls input, #wpr_optionsframework .mini .controls {
149
+ min-width:140px;
150
+ width: 140px;
151
+ }
152
+ #wpr_optionsframework .mini .explain {
153
+ max-width:74%;
154
+ }
155
+
156
+ /* Editor */
157
+
158
+ #wpr_optionsframework .section-editor .explain {
159
+ max-width: 98%;
160
+ float:none;
161
+ margin-bottom:5px;
162
+ color: #ccc;
163
+ }
164
+
165
+ /* Image Uploader */
166
+
167
+ #wpr_optionsframework .controls input.upload {
168
+ width:80%;
169
+ }
170
+ #wpr_optionsframework .screenshot {
171
+ float:left;
172
+ margin-left:1px;
173
+ position:relative;
174
+ width:344px;
175
+ margin-top:3px;
176
+ }
177
+ #wpr_optionsframework .screenshot img {
178
+ background:#fafafa;
179
+ border-color:#ccc #eee #eee #ccc;
180
+ border-style:solid;
181
+ border-width:1px;
182
+ float:left;
183
+ max-width:334px;
184
+ padding:4px;
185
+ margin-bottom:10px;
186
+ }
187
+ #wpr_optionsframework .screenshot .remove-image {
188
+ background:url("../images/ico-delete.png") no-repeat;
189
+ border:medium none;
190
+ bottom:4px;
191
+ display:block;
192
+ float:left;
193
+ height:16px;
194
+ padding:0;
195
+ position:absolute;
196
+ left:-4px;
197
+ text-indent:-9999px;
198
+ width:16px;
199
+ }
200
+ .wpr_optionsframework .button-primary {
201
+ background: #344A5F;
202
+ }
203
+ #wpr_optionsframework .screenshot .no_image .file_link {
204
+ margin-left: 20px;
205
+ }
206
+ #wpr_optionsframework .screenshot .no_image .remove-button {
207
+ bottom: 0px;
208
+ }
209
+ #wpr_optionsframework .reset-button {
210
+ float:left;
211
+ cursor:pointer;
212
+ }
213
+
214
+ /* Bottom Section */
215
+
216
+ #wpr_optionsframework-submit {
217
+ padding: 7px 10px;
218
+ border-top: 1px solid #ddd;
219
+ background-color: #14A085;
220
+ }
221
+ #wpr_optionsframework .button-primary {
222
+ float:right;
223
+ background-color: #344A5F;
224
+ }
225
+ #wpr_optionsframework .section:after {
226
+ content: "";
227
+ display: table;
228
+ }
229
+ #wpr_optionsframework .section:after {
230
+ clear: both;
231
+ }
232
+ .icons-search-input{
233
+ min-width: 100% !important;
234
+ }
235
+ #wpr_optionsframework .section#section-social .controls {
236
+ width: 100%;
237
+ }
238
+ #section-social .controls input.social_link {
239
+ width: 50%;
240
+ margin-left: 20px;
241
+ margin-right: 20px;
242
+ }
243
+ #wpr_optionsframework-wrap .nav-tab {
244
+ background: #344A5F;
245
+ color: #fff;
246
+ }
247
+ #wpr_optionsframework-wrap .nav-tab-active {
248
+ background: #14a085;
249
+ color: #fff;
250
+ }
251
+ .wpr-new-field,.wpr-new-fields {
252
+ margin: 0px 0px 20px 0px;
253
+ }
254
+ .metabox-holder {
255
+ width: 70%;
256
+ float: left;
257
+ }
258
+ .queries-holder {
259
+ width: 28%;
260
+ margin-left: 2%;
261
+ float: left;
262
+ padding-top: 1%;
263
+ font-size: 20px;
264
+ line-height: 34px;
265
+ text-align: center;
266
+ }
267
+ .wpr_help {
268
+ background: #14A085;
269
+ padding: 10px;
270
+ color: #344A5F;
271
+ }
272
+ .wpr_help a {
273
+ text-decoration: none;
274
+ color: #fff;
275
+ }
276
+ .wpr_pro a {
277
+ color: #fff;
278
+ text-decoration: none;
279
+ border-bottom: 1px dotted #fff;
280
+ margin-left: 3px;
281
+ }
282
+
283
+ .wpr_pro {
284
+ background: #000;
285
+ padding: 10px;
286
+ color: yellow;
287
+ }
inc/images/ico-delete.png ADDED
Binary file
inc/includes/class-options-framework-admin.php ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Wpr_Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2010-2014 WP Theming
8
+ */
9
+
10
+ class Wpr_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 = & Wpr_Options_Framework::_wpr_optionsframework_options();
29
+
30
+ // Checks if options are available
31
+ if ( $options ) {
32
+
33
+ // Add the options page and menu item.
34
+ add_action( 'admin_menu', array( $this, 'add_custom_options_page' ) );
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, 'wpr_optionsframework_admin_bar' ) );
45
+
46
+ }
47
+
48
+ }
49
+
50
+ /**
51
+ * Registers the settings
52
+ *
53
+ * @since 1.7.0
54
+ */
55
+ function settings_init() {
56
+
57
+ // Load Options Framework Settings
58
+ $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
59
+
60
+ // Registers the settings fields and callback
61
+ register_setting( 'wpr_optionsframework', $wpr_optionsframework_settings['id'], array ( $this, 'validate_options' ) );
62
+
63
+ // Displays notice after options save
64
+ add_action( 'wpr_optionsframework_after_validate', array( $this, 'save_options_notice' ) );
65
+
66
+ }
67
+
68
+ /*
69
+ * Define menu options
70
+ *
71
+ * Examples usage:
72
+ *
73
+ * add_filter( 'wpr_optionsframework_menu', function( $menu ) {
74
+ * $menu['page_title'] = 'The Options';
75
+ * $menu['menu_title'] = 'The Options';
76
+ * return $menu;
77
+ * });
78
+ *
79
+ * @since 1.7.0
80
+ *
81
+ */
82
+ static function menu_settings() {
83
+
84
+ $menu = array(
85
+
86
+ // Modes: submenu, menu
87
+ 'mode' => 'menu',
88
+
89
+ // Submenu default settings
90
+ 'page_title' => __( 'Theme Options', 'textdomain'),
91
+ 'menu_title' => __('Theme Options', 'textdomain'),
92
+ 'capability' => 'edit_theme_options',
93
+ 'menu_slug' => 'options-framework',
94
+ 'parent_slug' => 'themes.php',
95
+
96
+ // Menu default settings
97
+ 'icon_url' => 'dashicons-menu',
98
+ 'position' => '61'
99
+
100
+ );
101
+
102
+ return apply_filters( 'wpr_optionsframework_menu', $menu );
103
+ }
104
+
105
+ /**
106
+ * Add a subpage called "Theme Options" to the appearance menu.
107
+ *
108
+ * @since 1.7.0
109
+ */
110
+ function add_custom_options_page() {
111
+
112
+ $menu = $this->menu_settings();
113
+
114
+ switch( $menu['mode'] ) {
115
+
116
+ case 'menu':
117
+ // http://codex.wordpress.org/Function_Reference/add_menu_page
118
+ $this->options_screen = add_menu_page(
119
+ $menu['page_title'],
120
+ $menu['menu_title'],
121
+ $menu['capability'],
122
+ $menu['menu_slug'],
123
+ array( $this, 'options_page' ),
124
+ $menu['icon_url'],
125
+ $menu['position']
126
+ );
127
+ break;
128
+
129
+ default:
130
+ // http://codex.wordpress.org/Function_Reference/add_submenu_page
131
+ $this->options_screen = add_submenu_page(
132
+ $menu['parent_slug'],
133
+ $menu['page_title'],
134
+ $menu['menu_title'],
135
+ $menu['capability'],
136
+ $menu['menu_slug'],
137
+ array( $this, 'options_page' ) );
138
+ break;
139
+ }
140
+
141
+ }
142
+
143
+ /**
144
+ * Loads the required stylesheets
145
+ *
146
+ * @since 1.7.0
147
+ */
148
+
149
+ function enqueue_admin_styles( $hook ) {
150
+
151
+ if ( $this->options_screen != $hook )
152
+ return;
153
+
154
+ wp_enqueue_style( 'wpr_optionsframework', WPR_OPTIONS_FRAMEWORK_DIRECTORY . 'css/wpr_optionsframework.css', array(), Wpr_Options_Framework::VERSION );
155
+ wp_enqueue_style( 'wp-color-picker' );
156
+ }
157
+
158
+ /**
159
+ * Loads the required javascript
160
+ *
161
+ * @since 1.7.0
162
+ */
163
+ function enqueue_admin_scripts( $hook ) {
164
+
165
+ if ( $this->options_screen != $hook )
166
+ return;
167
+
168
+ // Enqueue custom option panel JS
169
+ wp_enqueue_script( 'options-custom', WPR_OPTIONS_FRAMEWORK_DIRECTORY . 'js/options-custom.js', array( 'jquery','wp-color-picker' ), Wpr_Options_Framework::VERSION );
170
+
171
+ // Inline scripts from options-interface.php
172
+ add_action( 'admin_head', array( $this, 'wpr_of_admin_head' ) );
173
+ }
174
+
175
+ function wpr_of_admin_head() {
176
+ // Hook to add custom scripts
177
+ do_action( 'wpr_optionsframework_custom_scripts' );
178
+ }
179
+
180
+ /**
181
+ * Builds out the options panel.
182
+ *
183
+ * If we were using the Settings API as it was intended we would use
184
+ * do_settings_sections here. But as we don't want the settings wrapped in a table,
185
+ * we'll call our own custom wpr_optionsframework_fields. See options-interface.php
186
+ * for specifics on how each individual field is generated.
187
+ *
188
+ * Nonces are provided using the settings_fields()
189
+ *
190
+ * @since 1.7.0
191
+ */
192
+ function options_page() { ?>
193
+
194
+ <div id="wpr_optionsframework-wrap" class="wrap">
195
+
196
+ <?php $menu = $this->menu_settings(); ?>
197
+ <h2><?php echo esc_html( $menu['page_title'] ); ?></h2>
198
+
199
+ <h2 class="nav-tab-wrapper">
200
+ <?php echo Wpr_Options_Framework_Interface::wpr_optionsframework_tabs(); ?>
201
+ </h2>
202
+
203
+ <?php settings_errors( 'options-framework' ); ?>
204
+
205
+ <div id="wpr_optionsframework-metabox" class="metabox-holder">
206
+ <div id="wpr_optionsframework" class="postbox">
207
+ <form action="options.php" method="post">
208
+ <?php settings_fields( 'wpr_optionsframework' ); ?>
209
+ <?php Wpr_Options_Framework_Interface::wpr_optionsframework_fields(); /* Settings */ ?>
210
+ <div id="wpr_optionsframework-submit">
211
+ <input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'textdomain' ); ?>" />
212
+ <input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore Defaults', 'textdomain' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'Click OK to reset. Any theme settings will be lost!', 'textdomain' ) ); ?>' );" />
213
+ <div class="clear"></div>
214
+ </div>
215
+ </form>
216
+ </div> <!-- / #container -->
217
+ </div>
218
+ <?php do_action( 'wpr_optionsframework_after' ); ?>
219
+ </div> <!-- / .wrap -->
220
+
221
+ <?php
222
+ }
223
+
224
+ /**
225
+ * Validate Options.
226
+ *
227
+ * This runs after the submit/reset button has been clicked and
228
+ * validates the inputs.
229
+ *
230
+ * @uses $_POST['reset'] to restore default options
231
+ */
232
+ function validate_options( $input ) {
233
+
234
+ /*
235
+ * Restore Defaults.
236
+ *
237
+ * In the event that the user clicked the "Restore Defaults"
238
+ * button, the options defined in the theme's options.php
239
+ * file will be added to the option for the active theme.
240
+ */
241
+
242
+ if ( isset( $_POST['reset'] ) ) {
243
+ add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'textdomain' ), 'updated fade' );
244
+ return $this->get_default_values();
245
+ }
246
+
247
+ /*
248
+ * Update Settings
249
+ *
250
+ * This used to check for $_POST['update'], but has been updated
251
+ * to be compatible with the theme customizer introduced in WordPress 3.4
252
+ */
253
+
254
+ $clean = array();
255
+ $options = & Wpr_Options_Framework::_wpr_optionsframework_options();
256
+ foreach ( $options as $option ) {
257
+
258
+ if ( ! isset( $option['id'] ) ) {
259
+ continue;
260
+ }
261
+
262
+ if ( ! isset( $option['type'] ) ) {
263
+ continue;
264
+ }
265
+
266
+ $id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );
267
+
268
+ // Set checkbox to false if it wasn't sent in the $_POST
269
+ if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
270
+ $input[$id] = false;
271
+ }
272
+
273
+ // Set each item in the multicheck to false if it wasn't sent in the $_POST
274
+ if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
275
+ foreach ( $option['options'] as $key => $value ) {
276
+ $input[$id][$key] = false;
277
+ }
278
+ }
279
+
280
+ // For a value to be submitted to database it must pass through a sanitization filter
281
+ if ( has_filter( 'wpr_of_sanitize_' . $option['type'] ) ) {
282
+ $clean[$id] = apply_filters( 'wpr_of_sanitize_' . $option['type'], $input[$id], $option );
283
+ }
284
+ }
285
+
286
+ // Hook to run after validation
287
+ do_action( 'wpr_optionsframework_after_validate', $clean );
288
+
289
+ return $clean;
290
+ }
291
+
292
+ /**
293
+ * Display message when options have been saved
294
+ */
295
+
296
+ function save_options_notice() {
297
+ add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'textdomain' ), 'updated fade' );
298
+ }
299
+
300
+ /**
301
+ * Get the default values for all the theme options
302
+ *
303
+ * Get an array of all default values as set in
304
+ * options.php. The 'id','std' and 'type' keys need
305
+ * to be defined in the configuration array. In the
306
+ * event that these keys are not present the option
307
+ * will not be included in this function's output.
308
+ *
309
+ * @return array Re-keyed options configuration array.
310
+ *
311
+ */
312
+
313
+ function get_default_values() {
314
+ $output = array();
315
+ $config = & Wpr_Options_Framework::_wpr_optionsframework_options();
316
+ foreach ( (array) $config as $option ) {
317
+ if ( ! isset( $option['id'] ) ) {
318
+ continue;
319
+ }
320
+ if ( ! isset( $option['std'] ) ) {
321
+ continue;
322
+ }
323
+ if ( ! isset( $option['type'] ) ) {
324
+ continue;
325
+ }
326
+ if ( has_filter( 'wpr_of_sanitize_' . $option['type'] ) ) {
327
+ $output[$option['id']] = apply_filters( 'wpr_of_sanitize_' . $option['type'], $option['std'], $option );
328
+ }
329
+ }
330
+ return $output;
331
+ }
332
+
333
+ /**
334
+ * Add options menu item to admin bar
335
+ */
336
+
337
+ function wpr_optionsframework_admin_bar() {
338
+
339
+ $menu = $this->menu_settings();
340
+
341
+ global $wp_admin_bar;
342
+
343
+ if ( 'menu' == $menu['mode'] ) {
344
+ $href = admin_url( 'admin.php?page=' . $menu['menu_slug'] );
345
+ } else {
346
+ $href = admin_url( 'themes.php?page=' . $menu['menu_slug'] );
347
+ }
348
+
349
+ $args = array(
350
+ 'parent' => 'appearance',
351
+ 'id' => 'wpr_of_theme_options',
352
+ 'title' => $menu['menu_title'],
353
+ 'href' => $href
354
+ );
355
+
356
+ $wp_admin_bar->add_menu( apply_filters( 'wpr_optionsframework_admin_bar', $args ) );
357
+ }
358
+
359
+ }
inc/includes/class-options-framework.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Wpr_Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2010-2014 WP Theming
8
+ */
9
+
10
+ class Wpr_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.8.0';
19
+
20
+ /**
21
+ * Initialize the plugin.
22
+ *
23
+ * @since 1.7.0
24
+ */
25
+ public function init() {
26
+
27
+ // Needs to run every time in case theme has been changed
28
+ add_action( 'admin_init', array( $this, 'set_theme_option' ) );
29
+
30
+ }
31
+
32
+ /**
33
+ * Sets option defaults
34
+ *
35
+ * @since 1.7.0
36
+ */
37
+ function set_theme_option() {
38
+
39
+ // Load settings
40
+ $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
41
+
42
+ // Updates the unique option id in the database if it has changed
43
+ if ( function_exists( 'wpr_optionsframework_option_name' ) ) {
44
+ wpr_optionsframework_option_name();
45
+ }
46
+ elseif ( has_action( 'wpr_optionsframework_option_name' ) ) {
47
+ do_action( 'wpr_optionsframework_option_name' );
48
+ }
49
+ // If the developer hasn't explicitly set an option id, we'll use a default
50
+ else {
51
+ $default_themename = get_option( 'stylesheet' );
52
+ $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
53
+ $default_themename = 'wpr_optionsframework_' . $default_themename;
54
+ if ( isset( $wpr_optionsframework_settings['id'] ) ) {
55
+ if ( $wpr_optionsframework_settings['id'] == $default_themename ) {
56
+ // All good, using default theme id
57
+ } else {
58
+ $wpr_optionsframework_settings['id'] = $default_themename;
59
+ update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
60
+ }
61
+ }
62
+ else {
63
+ $wpr_optionsframework_settings['id'] = $default_themename;
64
+ update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
65
+ }
66
+ }
67
+
68
+ }
69
+
70
+ /**
71
+ * Wrapper for wpr_optionsframework_options()
72
+ *
73
+ * Allows for manipulating or setting options via 'wpr_of_options' filter
74
+ * For example:
75
+ *
76
+ * <code>
77
+ * add_filter( 'wpr_of_options', function( $options ) {
78
+ * $options[] = array(
79
+ * 'name' => 'Input Text Mini',
80
+ * 'desc' => 'A mini text input field.',
81
+ * 'id' => 'example_text_mini',
82
+ * 'std' => 'Default',
83
+ * 'class' => 'mini',
84
+ * 'type' => 'text'
85
+ * );
86
+ *
87
+ * return $options;
88
+ * });
89
+ * </code>
90
+ *
91
+ * Also allows for setting options via a return statement in the
92
+ * options.php file. For example (in options.php):
93
+ *
94
+ * <code>
95
+ * return array(...);
96
+ * </code>
97
+ *
98
+ * @return array (by reference)
99
+ */
100
+ static function &_wpr_optionsframework_options() {
101
+ static $options = null;
102
+
103
+ if ( !$options ) {
104
+ // Load options from options.php file (if it exists)
105
+
106
+ $maybe_options = require_once WPR_OPTIONS_FRAMEWORK_PATH . 'options.php';;
107
+ if ( is_array( $maybe_options ) ) {
108
+ $options = $maybe_options;
109
+ }
110
+ else if ( function_exists( 'wpr_optionsframework_options' ) ) {
111
+ $options = wpr_optionsframework_options();
112
+ }
113
+
114
+ // Allow setting/manipulating options via filters
115
+ $options = apply_filters( 'wpr_of_options', $options );
116
+ }
117
+
118
+ return $options;
119
+ }
120
+
121
+ }
inc/includes/class-options-interface.php ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Wpr_Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2010-2014 WP Theming
8
+ */
9
+
10
+ class Wpr_Options_Framework_Interface {
11
+
12
+ /**
13
+ * Generates the tabs that are used in the options menu
14
+ */
15
+ static function wpr_optionsframework_tabs() {
16
+ $counter = 0;
17
+ $options = & Wpr_Options_Framework::_wpr_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 wpr_optionsframework_fields() {
38
+
39
+ global $allowedtags;
40
+ $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
41
+
42
+ // Gets the unique option id
43
+ if ( isset( $wpr_optionsframework_settings['id'] ) ) {
44
+ $option_name = $wpr_optionsframework_settings['id'];
45
+ }
46
+ else {
47
+ $option_name = 'wpr_optionsframework';
48
+ };
49
+
50
+ $settings = get_option($option_name);
51
+ $options = & Wpr_Options_Framework::_wpr_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
+ // Set the placeholder if one exists
113
+ $placeholder = '';
114
+ if ( isset( $value['placeholder'] ) ) {
115
+ $placeholder = ' placeholder="' . esc_attr( $value['placeholder'] ) . '"';
116
+ }
117
+
118
+ if ( has_filter( 'wpr_optionsframework_' . $value['type'] ) ) {
119
+ $output .= apply_filters( 'wpr_optionsframework_' . $value['type'], $option_name, $value, $val );
120
+ }
121
+
122
+
123
+ switch ( $value['type'] ) {
124
+
125
+ // Basic text input
126
+ case 'text':
127
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
128
+ break;
129
+
130
+ // Password input
131
+ case 'password':
132
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="password" value="' . esc_attr( $val ) . '" />';
133
+ break;
134
+
135
+ // Textarea
136
+ case 'textarea':
137
+ $rows = '8';
138
+
139
+ if ( isset( $value['settings']['rows'] ) ) {
140
+ $custom_rows = $value['settings']['rows'];
141
+ if ( is_numeric( $custom_rows ) ) {
142
+ $rows = $custom_rows;
143
+ }
144
+ }
145
+
146
+ $val = stripslashes( $val );
147
+ $output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea( $val ) . '</textarea>';
148
+ break;
149
+
150
+ // Select Box
151
+ case 'select':
152
+ $output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '">';
153
+
154
+ foreach ($value['options'] as $key => $option ) {
155
+ $output .= '<option'. selected( $val, $key, false ) .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>';
156
+ }
157
+ $output .= '</select>';
158
+ break;
159
+
160
+
161
+ // Radio Box
162
+ case "radio":
163
+ $name = $option_name .'['. $value['id'] .']';
164
+ foreach ($value['options'] as $key => $option) {
165
+ $id = $option_name . '-' . $value['id'] .'-'. $key;
166
+ $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>';
167
+ }
168
+ break;
169
+
170
+ // Image Selectors
171
+ case "images":
172
+ $name = $option_name .'['. $value['id'] .']';
173
+ foreach ( $value['options'] as $key => $option ) {
174
+ $selected = '';
175
+ if ( $val != '' && ($val == $key) ) {
176
+ $selected = ' of-radio-img-selected';
177
+ }
178
+ $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 ) .' />';
179
+ $output .= '<div class="of-radio-img-label">' . esc_html( $key ) . '</div>';
180
+ $output .= '<img src="' . esc_url( $option ) . '" alt="' . $option .'" class="of-radio-img-img' . $selected .'" onclick="document.getElementById(\''. esc_attr($value['id'] .'_'. $key) .'\').checked=true;" />';
181
+ }
182
+ break;
183
+
184
+ // Checkbox
185
+ case "checkbox":
186
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" '. checked( $val, 1, false) .' />';
187
+ $output .= '<label class="explain" for="' . esc_attr( $value['id'] ) . '">' . wp_kses( $explain_value, $allowedtags) . '</label>';
188
+ break;
189
+
190
+ // Multicheck
191
+ case "multicheck":
192
+ foreach ($value['options'] as $key => $option) {
193
+ $checked = '';
194
+ $label = $option;
195
+ $option = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($key));
196
+
197
+ $id = $option_name . '-' . $value['id'] . '-'. $option;
198
+ $name = $option_name . '[' . $value['id'] . '][' . $option .']';
199
+
200
+ if ( isset($val[$option]) ) {
201
+ $checked = checked($val[$option], 1, false);
202
+ }
203
+
204
+ $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>';
205
+ }
206
+ break;
207
+
208
+ // Color picker
209
+ case "color":
210
+ $default_color = '';
211
+ if ( isset($value['std']) ) {
212
+ if ( $val != $value['std'] )
213
+ $default_color = ' data-default-color="' .$value['std'] . '" ';
214
+ }
215
+ $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 .' />';
216
+
217
+ break;
218
+
219
+ // Uploader
220
+ case "upload":
221
+ $output .= Wpr_Options_Framework_Media_Uploader::wpr_optionsframework_uploader( $value['id'], $val, null );
222
+
223
+ break;
224
+ //Number field
225
+ case "number":
226
+ $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="number" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
227
+ break;
228
+
229
+ // Background
230
+ case 'background':
231
+
232
+ $background = $val;
233
+
234
+ // Background Color
235
+ $default_color = '';
236
+ if ( isset( $value['std']['color'] ) ) {
237
+ if ( $val != $value['std']['color'] )
238
+ $default_color = ' data-default-color="' .$value['std']['color'] . '" ';
239
+ }
240
+ $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 .' />';
241
+
242
+ // Background Image
243
+ if ( !isset($background['image']) ) {
244
+ $background['image'] = '';
245
+ }
246
+
247
+ $output .= Wpr_Options_Framework_Media_Uploader::wpr_optionsframework_uploader( $value['id'], $background['image'], null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) );
248
+
249
+ $class = 'of-background-properties';
250
+ if ( '' == $background['image'] ) {
251
+ $class .= ' hide';
252
+ }
253
+ $output .= '<div class="' . esc_attr( $class ) . '">';
254
+
255
+ // Background Repeat
256
+ $output .= '<select class="of-background of-background-repeat" name="' . esc_attr( $option_name . '[' . $value['id'] . '][repeat]' ) . '" id="' . esc_attr( $value['id'] . '_repeat' ) . '">';
257
+ $repeats = wpr_of_recognized_background_repeat();
258
+
259
+ foreach ($repeats as $key => $repeat) {
260
+ $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['repeat'], $key, false ) . '>'. esc_html( $repeat ) . '</option>';
261
+ }
262
+ $output .= '</select>';
263
+
264
+ // Background Position
265
+ $output .= '<select class="of-background of-background-position" name="' . esc_attr( $option_name . '[' . $value['id'] . '][position]' ) . '" id="' . esc_attr( $value['id'] . '_position' ) . '">';
266
+ $positions = wpr_of_recognized_background_position();
267
+
268
+ foreach ($positions as $key=>$position) {
269
+ $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['position'], $key, false ) . '>'. esc_html( $position ) . '</option>';
270
+ }
271
+ $output .= '</select>';
272
+
273
+ // Background Attachment
274
+ $output .= '<select class="of-background of-background-attachment" name="' . esc_attr( $option_name . '[' . $value['id'] . '][attachment]' ) . '" id="' . esc_attr( $value['id'] . '_attachment' ) . '">';
275
+ $attachments = wpr_of_recognized_background_attachment();
276
+
277
+ foreach ($attachments as $key => $attachment) {
278
+ $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['attachment'], $key, false ) . '>' . esc_html( $attachment ) . '</option>';
279
+ }
280
+ $output .= '</select>';
281
+ $output .= '</div>';
282
+
283
+ break;
284
+
285
+ // Editor
286
+ case 'editor':
287
+ $output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags ) . '</div>'."\n";
288
+ echo $output;
289
+ $textarea_name = esc_attr( $option_name . '[' . $value['id'] . ']' );
290
+ $default_editor_settings = array(
291
+ 'textarea_name' => $textarea_name,
292
+ 'media_buttons' => false,
293
+ 'tinymce' => array( 'plugins' => 'wordpress' )
294
+ );
295
+ $editor_settings = array();
296
+ if ( isset( $value['settings'] ) ) {
297
+ $editor_settings = $value['settings'];
298
+ }
299
+ $editor_settings = array_merge( $default_editor_settings, $editor_settings );
300
+ wp_editor( $val, $value['id'], $editor_settings );
301
+ $output = '';
302
+ break;
303
+
304
+ // Info
305
+ case "info":
306
+ $id = '';
307
+ $class = 'section';
308
+ if ( isset( $value['id'] ) ) {
309
+ $id = 'id="' . esc_attr( $value['id'] ) . '" ';
310
+ }
311
+ if ( isset( $value['type'] ) ) {
312
+ $class .= ' section-' . $value['type'];
313
+ }
314
+ if ( isset( $value['class'] ) ) {
315
+ $class .= ' ' . $value['class'];
316
+ }
317
+
318
+ $output .= '<div ' . $id . 'class="' . esc_attr( $class ) . '">' . "\n";
319
+ if ( isset($value['name']) ) {
320
+ $output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
321
+ }
322
+ if ( isset( $value['desc'] ) ) {
323
+ $output .= apply_filters('wpr_of_sanitize_info', $value['desc'] ) . "\n";
324
+ }
325
+ $output .= '</div>' . "\n";
326
+ break;
327
+
328
+ // Heading for Navigation
329
+ case "heading":
330
+ $counter++;
331
+ if ( $counter >= 2 ) {
332
+ $output .= '</div>'."\n";
333
+ }
334
+ $class = '';
335
+ $class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
336
+ $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) );
337
+ $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
338
+ $output .= '<h3>' . esc_html( $value['name'] ) . '</h3>' . "\n";
339
+ break;
340
+ }
341
+
342
+ if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
343
+ $output .= '</div>';
344
+ if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) {
345
+ $output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags) . '</div>'."\n";
346
+ }
347
+ $output .= '</div></div>'."\n";
348
+ }
349
+
350
+ echo $output;
351
+ }
352
+
353
+ // Outputs closing div if there tabs
354
+ if ( Wpr_Options_Framework_Interface::wpr_optionsframework_tabs() != '' ) {
355
+ echo '</div>';
356
+ }
357
+ }
358
+
359
+ }
inc/includes/class-options-media-uploader.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Wpr_Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2010-2014 WP Theming
8
+ */
9
+
10
+ class Wpr_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, 'wpr_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 wpr_optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
33
+
34
+ $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
35
+
36
+ // Gets the unique option id
37
+ $option_name = $wpr_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', 'textdomain') .'" />' . "\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', 'textdomain' ) . '" />' . "\n";
67
+ } else {
68
+ $output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'textdomain' ) . '" />' . "\n";
69
+ }
70
+ } else {
71
+ $output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'textdomain' ) . '</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', 'textdomain' );
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 wpr_optionsframework_media_scripts( $hook ) {
107
+
108
+ $menu = Wpr_Options_Framework_Admin::menu_settings();
109
+
110
+ if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] )
111
+ return;
112
+
113
+ if ( function_exists( 'wp_enqueue_media' ) )
114
+ wp_enqueue_media();
115
+
116
+ wp_register_script( 'of-media-uploader', WPR_OPTIONS_FRAMEWORK_DIRECTORY .'js/media-uploader.js', array( 'jquery' ), Wpr_Options_Framework::VERSION );
117
+ wp_enqueue_script( 'of-media-uploader' );
118
+ wp_localize_script( 'of-media-uploader', 'wpr_optionsframework_l10n', array(
119
+ 'upload' => __( 'Upload', 'textdomain' ),
120
+ 'remove' => __( 'Remove', 'textdomain' )
121
+ ) );
122
+ }
123
+ }
inc/includes/class-options-sanitization.php ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Wpr_Options_Framework
4
+ * @author Devin Price <devin@wptheming.com>
5
+ * @license GPL-2.0+
6
+ * @link http://wptheming.com
7
+ * @copyright 2010-2014 WP Theming
8
+ */
9
+
10
+ /* Text */
11
+
12
+ add_filter( 'wpr_of_sanitize_text', 'sanitize_text_field' );
13
+
14
+ /* Password */
15
+
16
+ add_filter( 'wpr_of_sanitize_password', 'sanitize_text_field' );
17
+
18
+ /* Textarea */
19
+
20
+ function wpr_of_sanitize_textarea( $input) {
21
+ global $allowedposttags;
22
+ $output = wp_kses( $input, $allowedposttags);
23
+ return $output;
24
+ }
25
+
26
+ add_filter( 'wpr_of_sanitize_textarea', 'wpr_of_sanitize_textarea' );
27
+
28
+ /* Select */
29
+
30
+ add_filter( 'wpr_of_sanitize_select', 'wpr_of_sanitize_enum', 10, 2 );
31
+
32
+ /* Radio */
33
+
34
+ add_filter( 'wpr_of_sanitize_radio', 'wpr_of_sanitize_enum', 10, 2 );
35
+
36
+ /* Images */
37
+
38
+ add_filter( 'wpr_of_sanitize_images', 'wpr_of_sanitize_enum', 10, 2 );
39
+
40
+ /* Checkbox */
41
+
42
+ function wpr_of_sanitize_checkbox( $input ) {
43
+ if ( $input ) {
44
+ $output = '1';
45
+ } else {
46
+ $output = false;
47
+ }
48
+ return $output;
49
+ }
50
+ add_filter( 'wpr_of_sanitize_checkbox', 'wpr_of_sanitize_checkbox' );
51
+
52
+ /* Multicheck */
53
+
54
+ function wpr_of_sanitize_multicheck( $input, $option ) {
55
+ $output = '';
56
+ if ( is_array( $input ) ) {
57
+ foreach( $option['options'] as $key => $value ) {
58
+ $output[$key] = false;
59
+ }
60
+ foreach( $input as $key => $value ) {
61
+ if ( array_key_exists( $key, $option['options'] ) && $value ) {
62
+ $output[$key] = "1";
63
+ }
64
+ }
65
+ }
66
+ return $output;
67
+ }
68
+ add_filter( 'wpr_of_sanitize_multicheck', 'wpr_of_sanitize_multicheck', 10, 2 );
69
+
70
+ /* Color Picker */
71
+
72
+ add_filter( 'wpr_of_sanitize_color', 'wpr_of_sanitize_hex' );
73
+
74
+ /* Uploader */
75
+
76
+ function wpr_of_sanitize_upload( $input ) {
77
+ $output = '';
78
+ $filetype = wp_check_filetype( $input );
79
+ if ( $filetype["ext"] ) {
80
+ $output = esc_url( $input );
81
+ }
82
+ return $output;
83
+ }
84
+ add_filter( 'wpr_of_sanitize_upload', 'wpr_of_sanitize_upload' );
85
+
86
+ /* Editor */
87
+
88
+ function wpr_of_sanitize_editor( $input ) {
89
+ if ( current_user_can( 'unfiltered_html' ) ) {
90
+ $output = $input;
91
+ }
92
+ else {
93
+ global $allowedtags;
94
+ $output = wpautop(wp_kses( $input, $allowedtags));
95
+ }
96
+ return $output;
97
+ }
98
+ add_filter( 'wpr_of_sanitize_editor', 'wpr_of_sanitize_editor' );
99
+
100
+ /* Allowed Tags */
101
+
102
+ function wpr_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 wpr_of_sanitize_allowedposttags( $input ) {
111
+ global $allowedposttags;
112
+ $output = wpautop( wp_kses( $input, $allowedposttags) );
113
+ return $output;
114
+ }
115
+ add_filter( 'wpr_of_sanitize_info', 'wpr_of_sanitize_allowedposttags' );
116
+
117
+ /* Check that the key value sent is valid */
118
+
119
+ function wpr_of_sanitize_enum( $input, $option ) {
120
+ $output = '';
121
+ if ( array_key_exists( $input, $option['options'] ) ) {
122
+ $output = $input;
123
+ }
124
+ return $output;
125
+ }
126
+
127
+ /* Background */
128
+
129
+ function wpr_of_sanitize_background( $input ) {
130
+ $output = wp_parse_args( $input, array(
131
+ 'color' => '',
132
+ 'image' => '',
133
+ 'repeat' => 'repeat',
134
+ 'position' => 'top center',
135
+ 'attachment' => 'scroll'
136
+ ) );
137
+
138
+ $output['color'] = apply_filters( 'wpr_of_sanitize_hex', $input['color'] );
139
+ $output['image'] = apply_filters( 'wpr_of_sanitize_upload', $input['image'] );
140
+ $output['repeat'] = apply_filters( 'wpr_of_background_repeat', $input['repeat'] );
141
+ $output['position'] = apply_filters( 'wpr_of_background_position', $input['position'] );
142
+ $output['attachment'] = apply_filters( 'wpr_of_background_attachment', $input['attachment'] );
143
+
144
+ return $output;
145
+ }
146
+ add_filter( 'wpr_of_sanitize_background', 'wpr_of_sanitize_background' );
147
+
148
+ function wpr_of_sanitize_background_repeat( $value ) {
149
+ $recognized = wpr_of_recognized_background_repeat();
150
+ if ( array_key_exists( $value, $recognized ) ) {
151
+ return $value;
152
+ }
153
+ return apply_filters( 'wpr_of_default_background_repeat', current( $recognized ) );
154
+ }
155
+ add_filter( 'wpr_of_background_repeat', 'wpr_of_sanitize_background_repeat' );
156
+
157
+ function wpr_of_sanitize_background_position( $value ) {
158
+ $recognized = wpr_of_recognized_background_position();
159
+ if ( array_key_exists( $value, $recognized ) ) {
160
+ return $value;
161
+ }
162
+ return apply_filters( 'wpr_of_default_background_position', current( $recognized ) );
163
+ }
164
+ add_filter( 'wpr_of_background_position', 'wpr_of_sanitize_background_position' );
165
+
166
+ function wpr_of_sanitize_background_attachment( $value ) {
167
+ $recognized = wpr_of_recognized_background_attachment();
168
+ if ( array_key_exists( $value, $recognized ) ) {
169
+ return $value;
170
+ }
171
+ return apply_filters( 'wpr_of_default_background_attachment', current( $recognized ) );
172
+ }
173
+ add_filter( 'wpr_of_background_attachment', 'wpr_of_sanitize_background_attachment' );
174
+
175
+
176
+ /* Typography */
177
+
178
+ function wpr_of_sanitize_typography( $input, $option ) {
179
+
180
+ $output = wp_parse_args( $input, array(
181
+ 'size' => '',
182
+ 'face' => '',
183
+ 'style' => '',
184
+ 'color' => ''
185
+ ) );
186
+
187
+ if ( isset( $option['options']['faces'] ) && isset( $input['face'] ) ) {
188
+ if ( !( array_key_exists( $input['face'], $option['options']['faces'] ) ) ) {
189
+ $output['face'] = '';
190
+ }
191
+ }
192
+ else {
193
+ $output['face'] = apply_filters( 'wpr_of_font_face', $output['face'] );
194
+ }
195
+
196
+ $output['size'] = apply_filters( 'wpr_of_font_size', $output['size'] );
197
+ $output['style'] = apply_filters( 'wpr_of_font_style', $output['style'] );
198
+ $output['color'] = apply_filters( 'wpr_of_sanitize_color', $output['color'] );
199
+ return $output;
200
+ }
201
+ add_filter( 'wpr_of_sanitize_typography', 'wpr_of_sanitize_typography', 10, 2 );
202
+
203
+ function wpr_of_sanitize_font_size( $value ) {
204
+ $recognized = wpr_of_recognized_font_sizes();
205
+ $value_check = preg_replace('/px/','', $value);
206
+ if ( in_array( (int) $value_check, $recognized ) ) {
207
+ return $value;
208
+ }
209
+ return apply_filters( 'wpr_of_default_font_size', $recognized );
210
+ }
211
+ add_filter( 'wpr_of_font_size', 'wpr_of_sanitize_font_size' );
212
+
213
+
214
+ function wpr_of_sanitize_font_style( $value ) {
215
+ $recognized = wpr_of_recognized_font_styles();
216
+ if ( array_key_exists( $value, $recognized ) ) {
217
+ return $value;
218
+ }
219
+ return apply_filters( 'wpr_of_default_font_style', current( $recognized ) );
220
+ }
221
+ add_filter( 'wpr_of_font_style', 'wpr_of_sanitize_font_style' );
222
+
223
+
224
+ function wpr_of_sanitize_font_face( $value ) {
225
+ $recognized = wpr_of_recognized_font_faces();
226
+ if ( array_key_exists( $value, $recognized ) ) {
227
+ return $value;
228
+ }
229
+ return apply_filters( 'wpr_of_default_font_face', current( $recognized ) );
230
+ }
231
+ add_filter( 'wpr_of_font_face', 'wpr_of_sanitize_font_face' );
232
+
233
+ /**
234
+ * Get recognized background repeat settings
235
+ *
236
+ * @return array
237
+ *
238
+ */
239
+ function wpr_of_recognized_background_repeat() {
240
+ $default = array(
241
+ 'no-repeat' => __( 'No Repeat', 'textdomain' ),
242
+ 'repeat-x' => __( 'Repeat Horizontally', 'textdomain' ),
243
+ 'repeat-y' => __( 'Repeat Vertically', 'textdomain' ),
244
+ 'repeat' => __( 'Repeat All', 'textdomain' ),
245
+ );
246
+ return apply_filters( 'wpr_of_recognized_background_repeat', $default );
247
+ }
248
+
249
+ /**
250
+ * Get recognized background positions
251
+ *
252
+ * @return array
253
+ *
254
+ */
255
+ function wpr_of_recognized_background_position() {
256
+ $default = array(
257
+ 'top left' => __( 'Top Left', 'textdomain' ),
258
+ 'top center' => __( 'Top Center', 'textdomain' ),
259
+ 'top right' => __( 'Top Right', 'textdomain' ),
260
+ 'center left' => __( 'Middle Left', 'textdomain' ),
261
+ 'center center' => __( 'Middle Center', 'textdomain' ),
262
+ 'center right' => __( 'Middle Right', 'textdomain' ),
263
+ 'bottom left' => __( 'Bottom Left', 'textdomain' ),
264
+ 'bottom center' => __( 'Bottom Center', 'textdomain' ),
265
+ 'bottom right' => __( 'Bottom Right', 'textdomain')
266
+ );
267
+ return apply_filters( 'wpr_of_recognized_background_position', $default );
268
+ }
269
+
270
+ /**
271
+ * Get recognized background attachment
272
+ *
273
+ * @return array
274
+ *
275
+ */
276
+ function wpr_of_recognized_background_attachment() {
277
+ $default = array(
278
+ 'scroll' => __( 'Scroll Normally', 'textdomain' ),
279
+ 'fixed' => __( 'Fixed in Place', 'textdomain')
280
+ );
281
+ return apply_filters( 'wpr_of_recognized_background_attachment', $default );
282
+ }
283
+
284
+ /**
285
+ * Sanitize a color represented in hexidecimal notation.
286
+ *
287
+ * @param string Color in hexidecimal notation. "#" may or may not be prepended to the string.
288
+ * @param string The value that this function should return if it cannot be recognized as a color.
289
+ * @return string
290
+ *
291
+ */
292
+
293
+ function wpr_of_sanitize_hex( $hex, $default = '' ) {
294
+ if ( wpr_of_validate_hex( $hex ) ) {
295
+ return $hex;
296
+ }
297
+ return $default;
298
+ }
299
+
300
+ /**
301
+ * Get recognized font sizes.
302
+ *
303
+ * Returns an indexed array of all recognized font sizes.
304
+ * Values are integers and represent a range of sizes from
305
+ * smallest to largest.
306
+ *
307
+ * @return array
308
+ */
309
+
310
+ function wpr_of_recognized_font_sizes() {
311
+ $sizes = range( 9, 71 );
312
+ $sizes = apply_filters( 'wpr_of_recognized_font_sizes', $sizes );
313
+ $sizes = array_map( 'absint', $sizes );
314
+ return $sizes;
315
+ }
316
+
317
+ /**
318
+ * Get recognized font faces.
319
+ *
320
+ * Returns an array of all recognized font faces.
321
+ * Keys are intended to be stored in the database
322
+ * while values are ready for display in in html.
323
+ *
324
+ * @return array
325
+ *
326
+ */
327
+ function wpr_of_recognized_font_faces() {
328
+ $default = array(
329
+ 'arial' => 'Arial',
330
+ 'verdana' => 'Verdana, Geneva',
331
+ 'trebuchet' => 'Trebuchet',
332
+ 'georgia' => 'Georgia',
333
+ 'times' => 'Times New Roman',
334
+ 'tahoma' => 'Tahoma, Geneva',
335
+ 'palatino' => 'Palatino',
336
+ 'helvetica' => 'Helvetica*'
337
+ );
338
+ return apply_filters( 'wpr_of_recognized_font_faces', $default );
339
+ }
340
+
341
+ /**
342
+ * Get recognized font styles.
343
+ *
344
+ * Returns an array of all recognized font styles.
345
+ * Keys are intended to be stored in the database
346
+ * while values are ready for display in in html.
347
+ *
348
+ * @return array
349
+ *
350
+ */
351
+ function wpr_of_recognized_font_styles() {
352
+ $default = array(
353
+ 'normal' => __( 'Normal', 'textdomain' ),
354
+ 'italic' => __( 'Italic', 'textdomain' ),
355
+ 'bold' => __( 'Bold', 'textdomain' ),
356
+ 'bold italic' => __( 'Bold Italic', 'textdomain' )
357
+ );
358
+ return apply_filters( 'wpr_of_recognized_font_styles', $default );
359
+ }
360
+
361
+ /**
362
+ * Is a given string a color formatted in hexidecimal notation?
363
+ *
364
+ * @param string Color in hexidecimal notation. "#" may or may not be prepended to the string.
365
+ * @return bool
366
+ *
367
+ */
368
+
369
+ function wpr_of_validate_hex( $hex ) {
370
+ $hex = trim( $hex );
371
+ /* Strip recognized prefixes. */
372
+ if ( 0 === strpos( $hex, '#' ) ) {
373
+ $hex = substr( $hex, 1 );
374
+ }
375
+ elseif ( 0 === strpos( $hex, '%23' ) ) {
376
+ $hex = substr( $hex, 3 );
377
+ }
378
+ /* Regex match. */
379
+ if ( 0 === preg_match( '/^[0-9a-fA-F]{6}$/', $hex ) ) {
380
+ return false;
381
+ }
382
+ else {
383
+ return true;
384
+ }
385
+ }
inc/js/media-uploader.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+
3
+ var wpr_optionsframework_upload;
4
+ var wpr_optionsframework_selector;
5
+
6
+ function wpr_optionsframework_add_file(event, selector) {
7
+
8
+ var upload = $(".uploaded-file"), frame;
9
+ var $el = $(this);
10
+ wpr_optionsframework_selector = selector;
11
+
12
+ event.preventDefault();
13
+
14
+ // If the media frame already exists, reopen it.
15
+ if ( wpr_optionsframework_upload ) {
16
+ wpr_optionsframework_upload.open();
17
+ } else {
18
+ // Create the media frame.
19
+ wpr_optionsframework_upload = wp.media.frames.wpr_optionsframework_upload = wp.media({
20
+ // Set the title of the modal.
21
+ title: $el.data('choose'),
22
+
23
+ // Customize the submit button.
24
+ button: {
25
+ // Set the text of the button.
26
+ text: $el.data('update'),
27
+ // Tell the button not to close the modal, since we're
28
+ // going to refresh the page when the image is selected.
29
+ close: false
30
+ }
31
+ });
32
+
33
+ // When an image is selected, run a callback.
34
+ wpr_optionsframework_upload.on( 'select', function() {
35
+ // Grab the selected attachment.
36
+ var attachment = wpr_optionsframework_upload.state().get('selection').first();
37
+ wpr_optionsframework_upload.close();
38
+ wpr_optionsframework_selector.find('.upload').val(attachment.attributes.url);
39
+ if ( attachment.attributes.type == 'image' ) {
40
+ wpr_optionsframework_selector.find('.screenshot').empty().hide().append('<img src="' + attachment.attributes.url + '"><a class="remove-image">Remove</a>').slideDown('fast');
41
+ }
42
+ wpr_optionsframework_selector.find('.upload-button').unbind().addClass('remove-file').removeClass('upload-button').val(wpr_optionsframework_l10n.remove);
43
+ wpr_optionsframework_selector.find('.of-background-properties').slideDown();
44
+ wpr_optionsframework_selector.find('.remove-image, .remove-file').on('click', function() {
45
+ wpr_optionsframework_remove_file( $(this).parents('.section') );
46
+ });
47
+ });
48
+
49
+ }
50
+
51
+ // Finally, open the modal.
52
+ wpr_optionsframework_upload.open();
53
+ }
54
+
55
+ function wpr_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(wpr_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
+ wpr_optionsframework_add_file(event, $(this).parents('.section'));
68
+ });
69
+ }
70
+
71
+ $('.remove-image, .remove-file').on('click', function() {
72
+ wpr_optionsframework_remove_file( $(this).parents('.section') );
73
+ });
74
+
75
+ $('.upload-button').click( function( event ) {
76
+ wpr_optionsframework_add_file(event, $(this).parents('.section'));
77
+ });
78
+
79
+ });
inc/js/options-custom.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ var $group = $('.group'),
29
+ $navtabs = $('.nav-tab-wrapper a'),
30
+ active_tab = '';
31
+
32
+ // Hides all the .group sections to start
33
+ $group.hide();
34
+
35
+ // Find if a selected tab is saved in localStorage
36
+ if ( typeof(localStorage) != 'undefined' ) {
37
+ active_tab = localStorage.getItem('active_tab');
38
+ }
39
+
40
+ // If active tab is saved and exists, load it's .group
41
+ if ( active_tab != '' && $(active_tab).length ) {
42
+ $(active_tab).fadeIn();
43
+ $(active_tab + '-tab').addClass('nav-tab-active');
44
+ } else {
45
+ $('.group:first').fadeIn();
46
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
47
+ }
48
+
49
+ // Bind tabs clicks
50
+ $navtabs.click(function(e) {
51
+
52
+ e.preventDefault();
53
+
54
+ // Remove active class from all tabs
55
+ $navtabs.removeClass('nav-tab-active');
56
+
57
+ $(this).addClass('nav-tab-active').blur();
58
+
59
+ if (typeof(localStorage) != 'undefined' ) {
60
+ localStorage.setItem('active_tab', $(this).attr('href') );
61
+ }
62
+
63
+ var selected = $(this).attr('href');
64
+
65
+ $group.hide();
66
+ $(selected).fadeIn();
67
+
68
+ });
69
+ }
70
+
71
+ });
inc/options-framework.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // If this file is called directly, abort.
4
+ if ( ! defined( 'WPINC' ) ) {
5
+ die;
6
+ }
7
+
8
+ // Don't load if wpr_optionsframework_init is already defined
9
+ if (is_admin() && ! function_exists( 'wpr_optionsframework_init' ) ) :
10
+
11
+ function wpr_optionsframework_init() {
12
+
13
+ // If user can't edit theme options, exit
14
+ if ( ! current_user_can( 'edit_theme_options' ) )
15
+ return;
16
+
17
+ // Loads the required Options Framework classes.
18
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework.php';
19
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework-admin.php';
20
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-interface.php';
21
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-media-uploader.php';
22
+ require plugin_dir_path( __FILE__ ) . 'includes/class-options-sanitization.php';
23
+
24
+ // Instantiate the main plugin class.
25
+ $options_framework = new Wpr_Options_Framework;
26
+ $options_framework->init();
27
+
28
+ // Instantiate the options page.
29
+ $Wpr_Options_Framework_Admin = new Wpr_Options_Framework_Admin;
30
+ $Wpr_Options_Framework_Admin->init();
31
+
32
+ // Instantiate the media uploader class
33
+ $options_framework_media_uploader = new Wpr_Options_Framework_Media_Uploader;
34
+ $options_framework_media_uploader->init();
35
+
36
+ }
37
+
38
+ add_action( 'init', 'wpr_optionsframework_init', 20 );
39
+
40
+ endif;
41
+
42
+
43
+ /**
44
+ * Helper function to return the theme option value.
45
+ * If no value has been saved, it returns $default.
46
+ * Needed because options are saved as serialized strings.
47
+ *
48
+ * Not in a class to support backwards compatibility in themes.
49
+ */
50
+
51
+ if ( ! function_exists( 'wpr_of_get_option' ) ) :
52
+
53
+ function wpr_of_get_option( $name, $default = false ) {
54
+ $config = get_option( 'wpr_optionsframework' );
55
+
56
+ if ( ! isset( $config['id'] ) ) {
57
+ return $default;
58
+ }
59
+
60
+ $options = get_option( $config['id'] );
61
+
62
+ if ( isset( $options[$name] ) ) {
63
+ return $options[$name];
64
+ }
65
+
66
+ return $default;
67
+ }
68
+
69
+ endif;
inc/options.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * A unique identifier is defined to store the options in the database and reference them from the theme.
4
+ * By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
5
+ * If the identifier changes, it'll appear as if the options have been reset.
6
+ */
7
+
8
+ function wpr_optionsframework_option_name() {
9
+ $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
10
+ $wpr_optionsframework_settings['id'] = 'wprmenu_options';
11
+ update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
12
+ }
13
+
14
+ add_action( 'wpr_optionsframework_after', 'wpr_support_link' );
15
+
16
+ function wpr_support_link() { ?>
17
+ <div class="queries-holder">
18
+ <div class="wpr_pro"> Wp Responsive Menu Pro is out and it has much more features that you ever wanted.
19
+ <div>
20
+ Check out the
21
+ <a href="http://magnigenie.com/wp-responsive-menu-pro/" target="_blank">Pro Features</a> <br>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <div class="queries-holder">
26
+ <div class="wpr_help">Need help? No Problem.
27
+ <div>
28
+ <a href="http://magnigenie.com/support/queries/wp-responsive-menu/" target="_blank">Visit Our Support Forum</a>
29
+ </div>
30
+ </div>
31
+ </div><?php
32
+ }
33
+
34
+ add_filter( 'wpr_optionsframework_menu', 'wpr_add_responsive_menu' );
35
+
36
+ function wpr_add_responsive_menu( $menu ) {
37
+ $menu['page_title'] = 'WP Responsive Menu';
38
+ $menu['menu_title'] = 'WPR Menu';
39
+ $menu['mode'] = 'menu';
40
+ $menu['menu_slug'] = 'wp-responsive-menu';
41
+ $menu['position'] = '30';
42
+ return $menu;
43
+ }
44
+ /**
45
+ * Defines an array of options that will be used to generate the settings page and be saved in the database.
46
+ * When creating the 'id' fields, make sure to use all lowercase and no spaces.
47
+ *
48
+ * If you are making your theme translatable, you should replace 'options_framework_theme'
49
+ * with the actual text domain for your theme. Read more:
50
+ * http://codex.wordpress.org/Function_Reference/load_theme_textdomain
51
+ */
52
+ $options = get_option('wprmenu_options');
53
+ function wpr_optionsframework_options() {
54
+
55
+ $options = array();
56
+
57
+ $options[] = array('name' => __('General Settings', 'wprmenu'),
58
+ 'type' => 'heading');
59
+
60
+ $options[] = array('name' => __('Enable Mobile Navigation', 'wprmenu'),
61
+ 'desc' => __('Check if you want to activate mobile navigation.', 'wprmenu'),
62
+ 'id' => 'enabled',
63
+ 'std' => '1',
64
+ 'type' => 'checkbox');
65
+ $menus = get_terms('nav_menu',array('hide_empty'=>false));
66
+ $menu = array();
67
+ foreach( $menus as $m ) {
68
+ $menu[$m->term_id] = $m->name;
69
+ }
70
+ $options[] = array('name' => __('Select Menu', 'wprmenu'),
71
+ 'desc' => __('Select the menu you want to display for mobile devices.', 'wprmenu'),
72
+ 'id' => 'menu',
73
+ 'std' => '',
74
+ 'class' => 'mini',
75
+ 'options' => $menu,
76
+ 'type' => 'select');
77
+
78
+ $options[] = array('name' => __('Elements to hide in mobile:', 'wprmenu'),
79
+ 'desc' => __('Enter the css class/ids for different elements you want to hide on mobile separeted by a comma(,). Example: .nav,#main-menu ', 'wprmenu'),
80
+ 'id' => 'hide',
81
+ 'std' => '',
82
+ 'type' => 'text');
83
+
84
+ $options[] = array('name' => __('Enable Swipe', 'wprmenu'),
85
+ 'desc' => __('Enable swipe gesture to open/close menus, Only applicable for left/right menu.', 'wprmenu'),
86
+ 'id' => 'swipe',
87
+ 'std' => 'yes',
88
+ 'options' => array('yes' => 'Yes','no' => 'No'),
89
+ 'type' => 'radio');
90
+
91
+ $options[] = array('name' => __(' Search Box', 'wprmenu'),
92
+ 'desc' => __(' Select the position of search box or simply hide the search box if you donot need it.', 'wprmenu'),
93
+ 'id' => 'search_box',
94
+ 'std' => 'hide',
95
+ 'options' => array('above_menu' => 'Above Menu','below_menu' => 'Below Menu', 'hide'=> 'Hide search box' ),
96
+ 'type' => 'select');
97
+
98
+ $options[] = array('name' => __('Allow zoom on mobile devices', 'wprmenu'),
99
+ 'desc' => __('', 'wprmenu'),
100
+ 'id' => 'zooming',
101
+ 'std' => 'yes',
102
+ 'options' => array('yes' => 'Yes','no' => 'No'),
103
+ 'type' => 'radio');
104
+
105
+ $options[] = array('name' => __('Menu Appearance', 'wprmenu'),
106
+ 'type' => 'heading');
107
+
108
+ $options[] = array('name' => __('Menu Symbol Position', 'wprmenu'),
109
+ 'desc' => __('Select menu icon position which will be displayed on the menu bar.', 'wprmenu'),
110
+ 'id' => 'menu_symbol_pos',
111
+ 'std' => 'left',
112
+ 'class' => 'mini',
113
+ 'options' => array('left' => 'Left','right' => 'Right'),
114
+ 'type' => 'select');
115
+
116
+ $options[] = array('name' => __('Menu Text', 'wprmenu'),
117
+ 'desc' => __('Entet the text you would like to display on the menu bar.', 'wprmenu'),
118
+ 'id' => 'bar_title',
119
+ 'std' => 'MENU',
120
+ 'class' => 'mini',
121
+ 'type' => 'text');
122
+
123
+ $options[] = array('name' => __('Menu Logo', 'wprmenu'),
124
+ 'desc' => __('Select menu logo.', 'wprmenu'),
125
+ 'id' => 'bar_logo',
126
+ 'std' => '',
127
+ 'type' => 'upload');
128
+
129
+ $options[] = array('name' => __('Menu Open Direction', 'wprmenu'),
130
+ 'desc' => __('Select the direction from where menu will open.', 'wprmenu'),
131
+ 'id' => 'position',
132
+ 'std' => 'left',
133
+ 'class' => 'mini',
134
+ 'options' => array('left' => 'Left','right' => 'Right', 'top' => 'Top' ),
135
+ 'type' => 'select');
136
+
137
+ $options[] = array('name' => __('Display menu from width (in px)', 'wprmenu'),
138
+ 'desc' => __(' Enter the width (in px) below which the responsive menu will be visible on screen', 'wprmenu'),
139
+ 'id' => 'from_width',
140
+ 'std' => '768',
141
+ 'class' => 'mini',
142
+ 'type' => 'text');
143
+
144
+ $options[] = array('name' => __('Menu Width', 'wprmenu'),
145
+ 'desc' => __('Enter menu width in (%) only applicable for left and right menu.', 'wprmenu'),
146
+ 'id' => 'how_wide',
147
+ 'std' => '80',
148
+ 'class' => 'mini',
149
+ 'type' => 'text');
150
+
151
+ $options[] = array('name' => __('Menu bar background color', 'wprmenu'),
152
+ 'desc' => __('', 'wprmenu'),
153
+ 'id' => 'bar_bgd',
154
+ 'std' => '#0D0D0D',
155
+ 'type' => 'color');
156
+
157
+ $options[] = array('name' => __('Menu bar text color', 'wprmenu'),
158
+ 'desc' => __('', 'wprmenu'),
159
+ 'id' => 'bar_color',
160
+ 'std' => '#F2F2F2',
161
+ 'type' => 'color');
162
+
163
+ $options[] = array('name' => __('Menu background color', 'wprmenu'),
164
+ 'desc' => __('', 'wprmenu'),
165
+ 'id' => 'menu_bgd',
166
+ 'std' => '#2E2E2E',
167
+ 'type' => 'color');
168
+
169
+ $options[] = array('name' => __('Menu text color', 'wprmenu'),
170
+ 'desc' => __('', 'wprmenu'),
171
+ 'id' => 'menu_color',
172
+ 'std' => '#CFCFCF',
173
+ 'type' => 'color');
174
+
175
+ $options[] = array('name' => __('Menu mouse over text color', 'wprmenu'),
176
+ 'desc' => __('', 'wprmenu'),
177
+ 'id' => 'menu_color_hover',
178
+ 'std' => '#606060',
179
+ 'type' => 'color');
180
+
181
+ $options[] = array('name' => __('Menu icon color', 'wprmenu'),
182
+ 'desc' => __('', 'wprmenu'),
183
+ 'id' => 'menu_icon_color',
184
+ 'std' => '#FFFFFF',
185
+ 'type' => 'color');
186
+
187
+ $options[] = array('name' => __('Menu borders(top & left) color', 'wprmenu'),
188
+ 'desc' => __('', 'wprmenu'),
189
+ 'id' => 'menu_border_top',
190
+ 'std' => '#0D0D0D',
191
+ 'type' => 'color');
192
+
193
+ $options[] = array('name' => __('Menu borders(bottom) color', 'wprmenu'),
194
+ 'desc' => __('', 'wprmenu'),
195
+ 'id' => 'menu_border_bottom',
196
+ 'std' => '#131212',
197
+ 'type' => 'color');
198
+
199
+ $options[] = array('name' => __('Enable borders for menu items', 'wprmenu'),
200
+ 'desc' => __('', 'wprmenu'),
201
+ 'id' => 'menu_border_bottom_show',
202
+ 'std' => 'yes',
203
+ 'options' => array('yes' => 'Yes','no' => 'No'),
204
+ 'type' => 'radio');
205
+
206
+ return $options;
207
+ }
js/wprmenu-admin.js DELETED
@@ -1 +0,0 @@
1
- jQuery(document).ready(function(o){var r=o("#wpr_menu_pos"),e=r.val(),l=r.closest("tr").first().next("tr");"top"==e?l.hide():l.show(),r.on("change",function(){e=o(this).val(),"top"==e?l.hide():l.show()}),o("#upload_bar_logo_button").click(function(r){r.preventDefault();var e=wp.media({title:"Select your logo for responsive menu",button:{text:"Select image"},multiple:!1}).on("select",function(){var r=e.state().get("selection").first().toJSON();console.log(r.url),o(".wprmenu_bar_logo_prev").attr("src",r.url).show(),o(".wprmenu_bar_logo_url").val(r.url)}).open()}),o(".wprmenu_disc_bar_logo").click(function(r){r.preventDefault(),o(".wprmenu_bar_logo_prev").hide(),o(".wprmenu_bar_logo_url").val("")}),o("#wprmenu_bar_bgd_picker").wpColorPicker({defaultColor:"#0D0D0D"}),o("#wprmenu_bar_color_picker").wpColorPicker({defaultColor:"#F2F2F2"}),o("#wprmenu_menu_bgd_picker").wpColorPicker({defaultColor:"#2E2E2E"}),o("#wprmenu_menu_color_picker").wpColorPicker({defaultColor:"#CFCFCF"}),o("#wprmenu_menu_color_hover_picker").wpColorPicker({defaultColor:"#606060"}),o("#wprmenu_menu_border_top_picker").wpColorPicker({defaultColor:"#474747"}),o("#wprmenu_menu_border_bottom_picker").wpColorPicker({defaultColor:"#131212"}),o("#wprmenu_menu_icon_color_picker").wpColorPicker({defaultColor:"#F2F2F2"})});
 
js/wprmenu.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){var t=e("#wprmenu_bar"),n=t.outerHeight(true),r=t.attr("data-from_width"),i=e("#wprmenu_menu"),s=e("#wprmenu_menu_ul"),o=i.find("a"),u=e("body"),a=e("html"),f=300,l=e("#wpadminbar"),c=t.length>0&&i.length>0?true:false,h=i.width(),p=window.innerHeight<u.height()?u.height():window.innerHeight,d=window.innerWidth<u.width()?u.width():window.innerWidth;if(c){s.find("li").first().css({"border-top":"none"});e(document).mouseup(function(t){if(!i.is(t.target)&&i.has(t.target).length===0){if(i.is(":visible")){e.sidr("close","wprmenu_menu")}}});i.find("ul.sub-menu").each(function(){var t=e(this),n=t.prev("a"),r=n.parent("li").first();n.addClass("wprmenu_parent_item");r.addClass("wprmenu_parent_item_li");var s=n.before('<span class="wprmenu_icon wprmenu_icon_par icon_default '+i.attr("data-custom_icon")+'"></span> ').find(".wprmenu_icon_par");t.hide()});function v(){e(".wprmenu_parent_item_li").each(function(){var t=e(this),n=0,r=t.find(".wprmenu_icon_par").first(),o=t.find("a.wprmenu_parent_item").first();if(i.hasClass("top")){n=window.innerWidth}else{n=s.innerWidth()}if(t.find(".wprmenu_clear").length==0)o.after('<br class="wprmenu_clear"/>')})}v();e(".wprmenu_icon_par").on("click",function(){var t=e(this),n=t.parent("li").find("ul.sub-menu").first();n.slideToggle(300);t.toggleClass("wprmenu_par_opened");if(i.attr("data-custom_icon")!="")t.toggleClass(i.attr("data-custom_icon_open"));t.parent("li").first().toggleClass("wprmenu_no_border_bottom")});function m(){i.find("ul.sub-menu").each(function(){var t=e(this),n=t.parent("li").find(".wprmenu_icon_par"),r=t.parent("li");if(t.is(":visible"))t.slideUp(300);n.removeClass("wprmenu_par_opened");r.removeClass("wprmenu_no_border_bottom")})}var g=e("meta[name=viewport]");g=g.length?g:e('<meta name="viewport" />').appendTo("head");if(i.attr("data-zooming")=="no"){g.attr("content","user-scalable=no, width=device-width, maximum-scale=1, minimum-scale=1")}else{g.attr("content","user-scalable=yes, width=device-width, initial-scale=1.0, minimum-scale=1")}if(e.browser.mozilla){screen.addEventListener("orientationchange",function(){y()})}else{window.addEventListener("orientationchange",y,false)}function y(){window.scrollBy(1,1);window.scrollBy(-1,-1);h=i.width();if(i.is(":visible")&&i.hasClass("left")){u.css({left:h});u.scrollLeft(0)}}if(i.hasClass("left")||i.hasClass("right")){var b=i.hasClass("left")?"left":"right";t.sidr({name:"wprmenu_menu",side:b,speed:f,onOpen:function(){t.addClass("menu_is_opened")},onClose:function(){t.removeClass("menu_is_opened");m()}});o.on("click",function(t){t.preventDefault();var n=e(this).attr("href");e.sidr("close","wprmenu_menu");setTimeout(function(){window.location.href=n},f)});e("body").touchwipe({wipeLeft:function(){e.sidr("close","wprmenu_menu")},wipeRight:function(){e.sidr("open","wprmenu_menu")},preventDefaultEvents:false});e(window).resize(function(){d=window.innerWidth<u.width()?u.width():window.innerWidth;if(d>r&&i.is(":visible")){e.sidr("close","wprmenu_menu")}})}else if(i.hasClass("top")){u.prepend(i);t.on("click",function(t){e("html, body").animate({scrollTop:0},f);m();i.stop(true,false).slideToggle(f)});o.on("click",function(t){t.preventDefault();var n=e(this).attr("href");i.slideUp(f,function(){window.location.href=n})});e(window).resize(function(){d=window.innerWidth<u.width()?u.width():window.innerWidth;if(d>r&&i.is(":visible")){m();i.slideUp(f,function(){})}})}}})
1
+ jQuery(document).ready(function(n){function e(){n(".wprmenu_parent_item_li").each(function(){var e=n(this),i=0,t=(e.find(".wprmenu_icon_par").first(),e.find("a.wprmenu_parent_item").first());i=s.hasClass("top")?window.innerWidth:a.innerWidth(),0==e.find(".wprmenu_clear").length&&t.after('<br class="wprmenu_clear"/>')})}function i(){s.find("ul.sub-menu").each(function(){var e=n(this),i=e.parent("li").find(".wprmenu_icon_par"),t=e.parent("li");e.is(":visible")&&e.slideUp(300),i.removeClass("wprmenu_par_opened"),t.removeClass("wprmenu_no_border_bottom")})}function t(){window.scrollBy(1,1),window.scrollBy(-1,-1),m=s.width(),s.is(":visible")&&s.hasClass("left")&&(l.css({left:m}),l.scrollLeft(0))}var r=n("#wprmenu_bar"),o=(r.outerHeight(!0),wprmenu.from_width),s=n("#wprmenu_menu"),a=n("#wprmenu_menu_ul"),d=s.find("a"),l=n("body"),u=(n("html"),300),w=(n("#wpadminbar"),r.length>0&&s.length>0?!0:!1),m=s.width(),p=(window.innerHeight<l.height()?l.height():window.innerHeight,window.innerWidth<l.width()?l.width():window.innerWidth);if(w){a.find("li").first().css({"border-top":"none"}),n(document).mouseup(function(e){s.is(e.target)||0!==s.has(e.target).length||s.is(":visible")&&n.sidr("close","wprmenu_menu")}),s.find("ul.sub-menu").each(function(){var e=n(this),i=e.prev("a"),t=i.parent("li").first();i.addClass("wprmenu_parent_item"),t.addClass("wprmenu_parent_item_li");i.before('<span class="wprmenu_icon wprmenu_icon_par icon_default"></span> ').find(".wprmenu_icon_par");e.hide()}),e(),n(".wprmenu_icon_par").on("click",function(){var e=n(this),i=e.parent("li").find("ul.sub-menu").first();i.slideToggle(300),e.toggleClass("wprmenu_par_opened"),e.parent("li").first().toggleClass("wprmenu_no_border_bottom")});var c=n("meta[name=viewport]");if(c=c.length?c:n('<meta name="viewport" />').appendTo("head"),"no"==wprmenu.zooming?c.attr("content","user-scalable=no, width=device-width, maximum-scale=1, minimum-scale=1"):c.attr("content","user-scalable=yes, width=device-width, initial-scale=1.0, minimum-scale=1"),n.browser.mozilla?screen.addEventListener("orientationchange",function(){t()}):window.addEventListener("orientationchange",t,!1),s.hasClass("left")||s.hasClass("right")){var h=s.hasClass("left")?"left":"right";r.sidr({name:"wprmenu_menu",side:h,speed:u,onOpen:function(){r.addClass("menu_is_opened")},onClose:function(){r.removeClass("menu_is_opened"),i()}}),d.on("click",function(){n.sidr("close","wprmenu_menu")}),"no"!=wprmenu.swipe&&n("body").touchwipe({wipeLeft:function(){n.sidr("close","wprmenu_menu")},wipeRight:function(){n.sidr("open","wprmenu_menu")},min_move_x:60,min_move_y:60,preventDefaultEvents:!1}),n(window).resize(function(){p=window.innerWidth<l.width()?l.width():window.innerWidth,p>o&&s.is(":visible")&&n.sidr("close","wprmenu_menu")})}else s.hasClass("top")&&(l.prepend(s),r.on("click",function(){n("html, body").animate({scrollTop:0},u),i(),s.stop(!0,!1).slideToggle(u)}),d.on("click",function(e){e.preventDefault();var i=n(this).attr("href");s.slideUp(u,function(){window.location.href=i})}),n(window).resize(function(){p=window.innerWidth<l.width()?l.width():window.innerWidth,p>o&&s.is(":visible")&&(i(),s.slideUp(u,function(){}))}))}});
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === WP Responsive Menu ===
2
- Contributors: sagarseth9
3
- Tags: Responsive Menu, Mobile Menu, Responsive Menu Plugin, WP Responsive Menu, Wordpress mobile menu
4
- Requires at least: 3.0
5
- Tested up to: 3.9
6
- Stable tag: 1.0
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=sagar.seth9@gmail.com&item_name=WP%20Responsive%20Menu&return=http://magnigenie.com
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,10 +12,9 @@ WP Responsive Menu turns your WordPress menu to a highy customizable sliding res
12
 
13
  == Description ==
14
 
15
- Using WP Responsive Menu plugin you can easily get highly customizable mobile menu plugin for your wordpress site. This plugin can easily convert your wordpress 3.0+ menu to a great looking sliding menu for mobile devices.
16
 
17
  = Features: =
18
-
19
  * Fully responsive and works on all type of mobile devices.
20
  * Easily integrates with wordpress menu system.
21
  * Easy to use admin interface.
@@ -27,11 +26,18 @@ Using WP Responsive Menu plugin you can easily get highly customizable mobile me
27
  * Supports swipe gestures.
28
  * Enable/Disable pinch to zoom feature.
29
  * Works perfectly on all devices/platforms.
 
 
 
30
 
31
  = Important Notes =
 
 
32
  This plugin is based on [sidr jquery menu plugin](https://github.com/artberri/sidr).
33
 
34
- If you have any suggestions for a new plugin, feel free to email me at sagarseth9@gmail.com.
 
 
35
 
36
  Check out [the demo](http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress/)
37
 
@@ -46,14 +52,26 @@ Check out [the demo](http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin
46
  == Screenshots ==
47
 
48
  1. Check out [the demo](http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress/)
 
49
  == ChangeLog ==
50
 
 
 
 
 
 
 
 
 
 
 
 
51
  = Version 1.0 =
52
 
53
  * Initial public release.
54
 
55
  == Upgrade Notice ==
56
 
57
- = Version 1.0 =
58
 
59
- * Initial public release.
1
  === WP Responsive Menu ===
2
+ Contributors: sagarseth9,magnigenie
3
+ Tags: Wordpress Responsive Menu, Genesis responsive menu, Genesis Mobile Menu, Thesis Mobile Menu, Thesis Responsive Menu, Mobile Menu, Responsive Menu Plugin, WP Responsive Menu, Wordpress mobile menu
4
+ Requires at least: 3.4
5
+ Tested up to: 3.9.2
6
+ Stable tag: 2.0.1
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=sagar.seth9@gmail.com&item_name=WP%20Responsive%20Menu&return=http://magnigenie.com
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
  == Description ==
14
 
15
+ WordPress Responsive Menu plugin will help you to get a cool, highly customizable mobile menu plugin. Using this plugin you can easily convert your wordpress menu to a great, elegant looking sliding menu for all mobile devices.
16
 
17
  = Features: =
 
18
  * Fully responsive and works on all type of mobile devices.
19
  * Easily integrates with wordpress menu system.
20
  * Easy to use admin interface.
26
  * Supports swipe gestures.
27
  * Enable/Disable pinch to zoom feature.
28
  * Works perfectly on all devices/platforms.
29
+ * Add a custom search bar to your menu.
30
+
31
+ This plugin works out of box with any theme frameworks like genesis or thesis and it also works fine with multisite setups.
32
 
33
  = Important Notes =
34
+ If you are looking for more options then [check out the pro version](http://magnigenie.com/wp-responsive-menu-pro/) of the plugin.
35
+
36
  This plugin is based on [sidr jquery menu plugin](https://github.com/artberri/sidr).
37
 
38
+ For Quick support please check WP Responsive menu [Support forum](http://magnigenie.com/support/queries/wp-responsive-menu/).
39
+
40
+ If you have any suggestions for a new plugin, feel free to email me at sagar@magnigenie.com.
41
 
42
  Check out [the demo](http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress/)
43
 
52
  == Screenshots ==
53
 
54
  1. Check out [the demo](http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress/)
55
+
56
  == ChangeLog ==
57
 
58
+ = Version 2.0.1 =
59
+
60
+ * Fixed plugin conflict with the themes already using options framework for their theme configuration.
61
+
62
+ = Version 2.0 =
63
+
64
+ * Completely removed plugin settings page and used options framework for admin settings of the plugin.
65
+ * Fixed admin bar issue when user is logged in.
66
+ * Add option to disable swipe.
67
+ * Added admin option to add search box to menu.
68
+
69
  = Version 1.0 =
70
 
71
  * Initial public release.
72
 
73
  == Upgrade Notice ==
74
 
75
+ = Version 2.0.1 =
76
 
77
+ * As I have updated the plugin options panel so there might be few settings problems. If you are having any such problem try to check the plugin settings and configure it accordingly.
screenshot-1.png CHANGED
Binary file
wp-responsive-menu.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: WP Responsive Menu
4
  Plugin URI: http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress/
5
- Description: WP Responsive Menu adds a cool sliding responsive menu to your site.
6
- Version: 1.0
7
  Author: Nirmal Ram
8
  Author URI: http://magnigenie.com
9
  License: GPLv2 or later
@@ -22,35 +22,34 @@ load_plugin_textdomain('wprmenu', false, basename( dirname( __FILE__ ) ) . '/lan
22
  * Add admin settings
23
  *
24
  */
25
- if( is_admin() ) require dirname(__FILE__).'/admin.php';
 
 
26
 
27
- add_action( 'wp_enqueue_scripts', 'wprmenu_enqueue_scripts' ); // add required js/css files
 
28
 
29
  function wprmenu_enqueue_scripts() {
 
 
30
  wp_enqueue_script('jquery.transit', plugins_url( '/js/jquery.transit.min.js', __FILE__ ), array( 'jquery' ));
31
  wp_enqueue_script('sidr', plugins_url( '/js/jquery.sidr.js', __FILE__ ), array( 'jquery' ));
32
  wp_enqueue_script('wprmenu.js', plugins_url( '/js/wprmenu.js', __FILE__ ), array( 'jquery' ));
33
-
34
- wp_enqueue_style( 'wprmenu.css' , plugins_url('css/wprmenu.css', __FILE__) );
35
  }
36
 
37
-
38
- add_action( 'admin_enqueue_scripts', 'wprmenu_admin_scripts' );
39
- function wprmenu_admin_scripts() {
40
- wp_enqueue_style( 'wp-color-picker' );
41
- wp_enqueue_script( 'wprmenu-admin-js', plugins_url('js/wprmenu-admin.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), false, true );
42
  }
43
 
44
- $options = get_option('wprmenu_options');
45
-
46
  add_action('wp_footer', 'wprmenu_menu', 100);
47
-
48
  function wprmenu_menu() {
49
  $options = get_option('wprmenu_options');
50
  if($options['enabled']) :
51
  ?>
52
- <div id="wprmenu_bar" class="wprmenu_bar" data-from_width="<?php echo $options['from_width'] ?>">
53
- <div class="wprmenu_ic">
54
  <span class="wprmenu_ic_1"></span>
55
  <span class="wprmenu_ic_2"></span>
56
  <span class="wprmenu_ic_3"></span>
@@ -61,7 +60,12 @@ function wprmenu_menu() {
61
  </div>
62
  </div>
63
 
64
- <div id="wprmenu_menu" class="wprmenu_levels <?php echo $options['position'] ?> <?php if($options["nesting_icon"] != '') echo 'wprmenu_custom_icons' ?>" data-custom_icon="<?php echo $options["nesting_icon"] ?>" data-custom_icon_open="<?php echo $options["nesting_icon_open"] ?>" data-zooming="<?php echo $options["zooming"] ?>" >
 
 
 
 
 
65
  <ul id="wprmenu_menu_ul">
66
  <?php
67
  $menus = get_terms('nav_menu',array('hide_empty'=>false));
@@ -73,6 +77,11 @@ function wprmenu_menu() {
73
  endif;
74
  ?>
75
  </ul>
 
 
 
 
 
76
  </div>
77
  <?php
78
  endif;
@@ -87,9 +96,6 @@ function wprmenu_header_styles() {
87
  /* apply appearance settings */
88
  #wprmenu_bar {
89
  background: <?php echo $options["bar_bgd"] ?>;
90
- <?php if (is_admin_bar_showing()) : ?>
91
- top:28px;
92
- <?php endif; ?>
93
  }
94
  #wprmenu_bar .menu_title, #wprmenu_bar .wprmenu_icon_menu {
95
  color: <?php echo $options["bar_color"] ?>;
@@ -119,7 +125,7 @@ function wprmenu_header_styles() {
119
  #wprmenu_menu.wprmenu_levels ul li ul {
120
  border-top:1px solid <?php echo $options["menu_border_bottom"] ?>;
121
  }
122
- #wprmenu_bar .wprmenu_ic span {
123
  background: <?php echo $options["menu_icon_color"] ?>;
124
  }
125
  <?php
@@ -144,11 +150,6 @@ function wprmenu_header_styles() {
144
  left: -<?php echo $options["how_wide"] ?>%;
145
  right: auto;
146
  }
147
- <?php if (is_admin_bar_showing()) : ?>
148
- #wprmenu_menu.left ul#wprmenu_menu_ul, #wprmenu_menu.right ul#wprmenu_menu_ul {
149
- padding-top: 70px; /* 42 + 28 */
150
- }
151
- <?php endif; ?>
152
  #wprmenu_menu.right {
153
  width:<?php echo $options["how_wide"] ?>%;
154
  right: -<?php echo $options["how_wide"] ?>%;
@@ -163,7 +164,7 @@ function wprmenu_header_styles() {
163
  <?php endif; ?>
164
 
165
  <?php if($options["menu_symbol_pos"] == 'right') : ?>
166
- #wprmenu_bar .wprmenu_ic {
167
  float: <?php echo $options["menu_symbol_pos"] ?>!important;
168
  margin-right:0px!important;
169
  }
@@ -171,23 +172,18 @@ function wprmenu_header_styles() {
171
  pading-left: 0px;
172
  }
173
  <?php endif; ?>
174
-
175
-
176
  /* show the bar and hide othere navigation elements */
177
  @media only screen and (max-width: <?php echo $options["from_width"] ?>px) {
178
  html { padding-top: 42px!important; }
179
  #wprmenu_bar { display: block!important; }
 
180
  <?php
181
- if(count($options['hide']) > 0) {
182
- echo implode(', ', $options['hide']);
183
  echo ' { display:none!important; }';
184
  }
185
  ?>
186
  }
187
- /* hide the bar & the menu */
188
- @media only screen and (min-width: <?php echo (int)$options["from_width"]+1 ?>px) {
189
- }
190
-
191
  </style>
192
  <?php
193
  endif;
2
  /*
3
  Plugin Name: WP Responsive Menu
4
  Plugin URI: http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress/
5
+ Description: WP Responsive menu is a mobile menu plugin which comes with 1 click installation and has lots of admin option to customize the plugin as per your needs.
6
+ Version: 2.0.1
7
  Author: Nirmal Ram
8
  Author URI: http://magnigenie.com
9
  License: GPLv2 or later
22
  * Add admin settings
23
  *
24
  */
25
+ define( 'WPR_OPTIONS_FRAMEWORK_DIRECTORY', plugins_url( '/inc/', __FILE__ ) );
26
+ define( 'WPR_OPTIONS_FRAMEWORK_PATH', dirname( __FILE__ ) . '/inc/' );
27
+ require_once dirname( __FILE__ ) . '/inc/options-framework.php';
28
 
29
+ // add required js/css files
30
+ add_action( 'wp_enqueue_scripts', 'wprmenu_enqueue_scripts' );
31
 
32
  function wprmenu_enqueue_scripts() {
33
+ $options = get_option('wprmenu_options');
34
+ wp_enqueue_style( 'wprmenu.css' , plugins_url('css/wprmenu.css', __FILE__) );
35
  wp_enqueue_script('jquery.transit', plugins_url( '/js/jquery.transit.min.js', __FILE__ ), array( 'jquery' ));
36
  wp_enqueue_script('sidr', plugins_url( '/js/jquery.sidr.js', __FILE__ ), array( 'jquery' ));
37
  wp_enqueue_script('wprmenu.js', plugins_url( '/js/wprmenu.js', __FILE__ ), array( 'jquery' ));
38
+ $wpr_options = array( 'zooming' => $options['zooming'],'from_width' => $options['from_width'],'swipe' => $options['swipe'] );
39
+ wp_localize_script( 'wprmenu.js', 'wprmenu', $wpr_options );
40
  }
41
 
42
+ function wpr_search_form() {
43
+ return '<form role="search" method="get" class="wpr-search-form" action="' . site_url() . '"><label><input type="search" class="wpr-search-field" placeholder="Search ..." value="" name="s" title="Search for:"></label></form>';
 
 
 
44
  }
45
 
 
 
46
  add_action('wp_footer', 'wprmenu_menu', 100);
 
47
  function wprmenu_menu() {
48
  $options = get_option('wprmenu_options');
49
  if($options['enabled']) :
50
  ?>
51
+ <div id="wprmenu_bar" class="wprmenu_bar">
52
+ <div class="wprmenu_icon">
53
  <span class="wprmenu_ic_1"></span>
54
  <span class="wprmenu_ic_2"></span>
55
  <span class="wprmenu_ic_3"></span>
60
  </div>
61
  </div>
62
 
63
+ <div id="wprmenu_menu" class="wprmenu_levels <?php echo $options['position'] ?> wprmenu_custom_icons">
64
+ <?php if( $options['search_box'] == 'above_menu' ) { ?>
65
+ <div class="wpr_search">
66
+ <?php echo wpr_search_form(); ?>
67
+ </div>
68
+ <?php } ?>
69
  <ul id="wprmenu_menu_ul">
70
  <?php
71
  $menus = get_terms('nav_menu',array('hide_empty'=>false));
77
  endif;
78
  ?>
79
  </ul>
80
+ <?php if( $options['search_box'] == 'below_menu' ) { ?>
81
+ <div class="wpr_search">
82
+ <?php echo wpr_search_form(); ?>
83
+ </div>
84
+ <?php } ?>
85
  </div>
86
  <?php
87
  endif;
96
  /* apply appearance settings */
97
  #wprmenu_bar {
98
  background: <?php echo $options["bar_bgd"] ?>;
 
 
 
99
  }
100
  #wprmenu_bar .menu_title, #wprmenu_bar .wprmenu_icon_menu {
101
  color: <?php echo $options["bar_color"] ?>;
125
  #wprmenu_menu.wprmenu_levels ul li ul {
126
  border-top:1px solid <?php echo $options["menu_border_bottom"] ?>;
127
  }
128
+ #wprmenu_bar .wprmenu_icon span {
129
  background: <?php echo $options["menu_icon_color"] ?>;
130
  }
131
  <?php
150
  left: -<?php echo $options["how_wide"] ?>%;
151
  right: auto;
152
  }
 
 
 
 
 
153
  #wprmenu_menu.right {
154
  width:<?php echo $options["how_wide"] ?>%;
155
  right: -<?php echo $options["how_wide"] ?>%;
164
  <?php endif; ?>
165
 
166
  <?php if($options["menu_symbol_pos"] == 'right') : ?>
167
+ #wprmenu_bar .wprmenu_icon {
168
  float: <?php echo $options["menu_symbol_pos"] ?>!important;
169
  margin-right:0px!important;
170
  }
172
  pading-left: 0px;
173
  }
174
  <?php endif; ?>
 
 
175
  /* show the bar and hide othere navigation elements */
176
  @media only screen and (max-width: <?php echo $options["from_width"] ?>px) {
177
  html { padding-top: 42px!important; }
178
  #wprmenu_bar { display: block!important; }
179
+ div#wpadminbar { position: fixed; }
180
  <?php
181
+ if( $options['hide'] != '' ) {
182
+ echo $options['hide'];
183
  echo ' { display:none!important; }';
184
  }
185
  ?>
186
  }
 
 
 
 
187
  </style>
188
  <?php
189
  endif;