WP Responsive Menu - Version 1.0

Version Description

Download this release

Release Info

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

Version 1.0

admin.php ADDED
@@ -0,0 +1,536 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Basic font for the plugin
3
+ */
4
+ @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,600);
5
+ /*
6
+ Icons from icon font - setup
7
+ */
8
+ @font-face {
9
+ font-family: 'wprmenu';
10
+ src:url('../fonts/wprmenu.eot');
11
+ src:url('../fonts/wprmenu.eot?#iefix') format('embedded-opentype'),
12
+ url('../fonts/wprmenu.woff') format('woff'),
13
+ url('../fonts/wprmenu.ttf') format('truetype'),
14
+ url('../fonts/wprmenu.svg#wprmenu') format('svg');
15
+ font-weight: normal;
16
+ font-style: normal;
17
+ }
18
+ #wprmenu_menu .wprmenu_icon:before, #wprmenu_bar [data-icon]:before {
19
+ font-family: 'wprmenu';
20
+ speak: none;
21
+ font-weight: normal;
22
+ font-variant: normal;
23
+ text-transform: none;
24
+ line-height: 1;
25
+ -webkit-font-smoothing: antialiased;
26
+ }
27
+ #wprmenu_bar,
28
+ #wprmenu_bar *,
29
+ #wprmenu_menu,
30
+ #wprmenu_menu * {
31
+ /* reset */
32
+ margin:0;
33
+ padding:0;
34
+ -moz-box-sizing: border-box!important;
35
+ -webkit-box-sizing: border-box!important;
36
+ box-sizing: border-box!important;
37
+ font-family: 'Open Sans', sans-serif;
38
+ list-style:none;
39
+ text-align:left;
40
+ font-size:100%;
41
+ font-weight:normal;
42
+ }
43
+ #wprmenu_menu img, #wprmenu_bar img {
44
+ border:0; border:none;
45
+ }
46
+
47
+ .wprmenu_clear {
48
+ clear: both !important;
49
+ display: block !important;
50
+ height: 1px !important;
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
+ */
60
+ #wprmenu_bar {
61
+ position:fixed;
62
+ top:0px;
63
+ left:0px;
64
+ background: #0D0D0D;
65
+ padding:10px 16px;
66
+ width:100%;
67
+ display: none;
68
+ cursor: pointer;
69
+ z-index: 99998;
70
+ overflow: hidden;
71
+ height:42px;
72
+ display: none;
73
+ }
74
+ #wprmenu_bar .menu_title {
75
+ color:#f2f2f2;
76
+ font-weight: 400;
77
+ font-size: 20px;
78
+ line-height: 20px;
79
+ }
80
+ #wprmenu_bar .bar_logo {
81
+ border:0px;
82
+ border:none;
83
+ margin:0xp;
84
+ padding:0px;
85
+ margin-top: -2px;
86
+ padding-right: 8px;
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;
109
+ -ms-transition: all .01s ease-in-out;
110
+ transition: all .01s ease-in-out;
111
+ display: block;
112
+ position: absolute;
113
+ width: 20px;
114
+ height: 4px;
115
+ left: 0px;
116
+ background: #f2f2f2;
117
+ }
118
+ #wprmenu_bar .wprmenu_ic_1 {
119
+ top:0px;
120
+ }
121
+ #wprmenu_bar .wprmenu_ic_2 {
122
+ top:7px;
123
+ }
124
+ #wprmenu_bar .wprmenu_ic_3 {
125
+ top:14px;
126
+ }
127
+ #wprmenu_bar.menu_is_opened .wprmenu_ic_1 {
128
+ top:-10px;
129
+ }
130
+ #wprmenu_bar.menu_is_opened .wprmenu_ic_2 {
131
+ top:9px!important;
132
+ -webkit-transform: rotate(45deg);
133
+ -moz-transform: rotate(45deg);
134
+ -ms-transform: rotate(45deg);
135
+ -o-transform: rotate(45deg);
136
+ transform: rotate(45deg);
137
+ zoom:1;
138
+ }
139
+ #wprmenu_bar.menu_is_opened .wprmenu_ic_3 {
140
+ top:9px!important;
141
+ -webkit-transform: rotate(-45deg);
142
+ -moz-transform: rotate(-45deg);
143
+ -ms-transform: rotate(-45deg);
144
+ -o-transform: rotate(-45deg);
145
+ transform: rotate(-45deg);
146
+ zoom:1;
147
+ }
148
+
149
+
150
+
151
+ body { position: relative!important; }
152
+
153
+
154
+
155
+
156
+ #wprmenu_menu.top {
157
+ top:0px;
158
+ left:0px;
159
+ width:100%;
160
+ display: none;
161
+ position: relative;
162
+ }
163
+ #wprmenu_menu.left, #wprmenu_menu.right {
164
+ display: none;
165
+ position: absolute;
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;
190
+ padding:0px;
191
+ display: block;
192
+ width:100%;
193
+ position: relative;
194
+ list-style: none;
195
+ }
196
+ #wprmenu_menu ul li {
197
+ display: block;
198
+ list-style: none;
199
+ }
200
+
201
+ #wprmenu_menu ul li a, #wprmenu_menu ul li a:hover {
202
+ border-bottom:1px solid #131212;
203
+ border-top:1px solid #474747;
204
+ display: block;
205
+ color:#D3D3D3;
206
+ padding: 13px 14px;
207
+ font-size:14px;
208
+ margin:0px;
209
+ text-decoration: none;
210
+ }
211
+
212
+
213
+ /*********/
214
+ #wprmenu_menu.wprmenu_levels ul li {
215
+ display: block;
216
+ overflow: hidden;
217
+ border-bottom:1px solid #131212;
218
+ border-top:1px solid #474747;
219
+ width:100%;
220
+ position: relative;
221
+ }
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;
229
+ margin-left: 44px;
230
+ }
231
+ #wprmenu_menu .wprmenu_icon_par {
232
+ position: relative;
233
+ display: block;
234
+ color: #CFCFCF;
235
+ width: 46px;
236
+ padding: 13px 14px 10px 14px;
237
+ cursor: pointer;
238
+ float: left;
239
+ position: absolute;
240
+ top:0px;
241
+ left:0px;
242
+ }
243
+
244
+
245
+
246
+ #wprmenu_menu .wprmenu_no_border_bottom {
247
+ border-bottom: none!important;
248
+ }
249
+
250
+ #wprmenu_menu.wprmenu_levels ul li ul { border-top:1px solid #131212;}
251
+
252
+ #wprmenu_menu.wprmenu_levels ul li ul li { padding-left:44px;}
253
+
254
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li { padding-left:88px;}
255
+
256
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li { padding-left:132px;}
257
+
258
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li ul li { padding-left:176px;}
259
+
260
+
261
+ #wprmenu_menu.wprmenu_levels ul li ul li.wprmenu_parent_item_li { padding-left:0px;}
262
+ #wprmenu_menu.wprmenu_levels ul li ul li.wprmenu_parent_item_li .wprmenu_icon_par { margin-left:44px;}
263
+ #wprmenu_menu.wprmenu_levels ul li ul li.wprmenu_parent_item_li a.wprmenu_parent_item { margin-left: 88px;}
264
+
265
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li.wprmenu_parent_item_li { padding-left:0px;}
266
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li.wprmenu_parent_item_li .wprmenu_icon_par { margin-left:88px;}
267
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li.wprmenu_parent_item_li a.wprmenu_parent_item { margin-left: 132px;}
268
+
269
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li.wprmenu_parent_item_li { padding-left:0px;}
270
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li.wprmenu_parent_item_li .wprmenu_icon_par { margin-left:132px;}
271
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li.wprmenu_parent_item_li a.wprmenu_parent_item { margin-left: 176px;}
272
+
273
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li ul li.wprmenu_parent_item_li { padding-left:0px;}
274
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li ul li.wprmenu_parent_item_li .wprmenu_icon_par { margin-left:176px;}
275
+ #wprmenu_menu.wprmenu_levels ul li ul li ul li ul li ul li.wprmenu_parent_item_li a.wprmenu_parent_item { margin-left: 220px;}
276
+ /********/
277
+
278
+ .icon_default.wprmenu_icon_par:before {
279
+ content:"t";
280
+ }
281
+
282
+
283
+ .icon_default.wprmenu_par_opened:before {
284
+ content:"o";
285
+ }
fonts/wprmenu.eot ADDED
Binary file
fonts/wprmenu.svg ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>
5
+ This is a custom SVG font generated by IcoMoon.
6
+ <iconset grid="16"></iconset>
7
+ </metadata>
8
+ <defs>
9
+ <font id="icomoon" horiz-adv-x="512" >
10
+ <font-face units-per-em="512" ascent="480" descent="-32" />
11
+ <missing-glyph horiz-adv-x="512" />
12
+ <glyph class="hidden" unicode="&#xf000;" d="M0,480L 512 -32L0 -32 z" horiz-adv-x="0" />
13
+ <glyph unicode="&#x74;" d="M 96,416L 416,224L 96,32 z" />
14
+ <glyph unicode="&#x6f;" d="M 448,384L 256,64L 64,384 z" />
15
+ <glyph unicode="&#x6d;" d="M 32,384L 480,384L 480,288L 32,288zM 32,256L 480,256L 480,160L 32,160zM 32,128L 480,128L 480,32L 32,32z" />
16
+ <glyph unicode="&#x20;" horiz-adv-x="256" />
17
+ </font></defs></svg>
fonts/wprmenu.ttf ADDED
Binary file
fonts/wprmenu.woff ADDED
Binary file
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ //silence is golden.
js/jquery.sidr.js ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Sidr
3
+ * https://github.com/artberri/sidr
4
+ *
5
+ * Copyright (c) 2013 Alberto Varela
6
+ * Licensed under the MIT license.
7
+ */
8
+
9
+ ;(function( $ ){
10
+
11
+ var sidrMoving = false,
12
+ sidrOpened = false;
13
+
14
+ // Private methods
15
+ var privateMethods = {
16
+ // Check for valids urls
17
+ // From : http://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-an-url
18
+ isUrl: function (str) {
19
+ var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
20
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
21
+ '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
22
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
23
+ '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
24
+ '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
25
+ if(!pattern.test(str)) {
26
+ return false;
27
+ } else {
28
+ return true;
29
+ }
30
+ },
31
+ // Loads the content into the menu bar
32
+ loadContent: function($menu, content) {
33
+ $menu.html(content);
34
+ },
35
+ // Add sidr prefixes
36
+ addPrefix: function($element) {
37
+ var elementId = $element.attr('id'),
38
+ elementClass = $element.attr('class');
39
+
40
+ if(typeof elementId === 'string' && '' !== elementId) {
41
+ $element.attr('id', elementId.replace(/([A-Za-z0-9_.\-]+)/g, 'sidr-id-$1'));
42
+ }
43
+ if(typeof elementClass === 'string' && '' !== elementClass && 'sidr-inner' !== elementClass) {
44
+ $element.attr('class', elementClass.replace(/([A-Za-z0-9_.\-]+)/g, 'sidr-class-$1'));
45
+ }
46
+ $element.removeAttr('style');
47
+ },
48
+ execute: function(action, name, callback) {
49
+ // Check arguments
50
+ if(typeof name === 'function') {
51
+ callback = name;
52
+ name = 'sidr';
53
+ }
54
+ else if(!name) {
55
+ name = 'sidr';
56
+ }
57
+
58
+ // Declaring
59
+ var $menu = $('#' + name),
60
+ $body = $($menu.data('body')),
61
+ $html = $('html'),
62
+ menuWidth = $menu.outerWidth(true),
63
+ speed = $menu.data('speed'),
64
+ side = $menu.data('side'),
65
+ displace = $menu.data('displace'),
66
+ onOpen = $menu.data('onOpen'),
67
+ onClose = $menu.data('onClose'),
68
+ bodyAnimation,
69
+ menuAnimation,
70
+ scrollTop,
71
+ bodyClass = (name === 'sidr' ? 'sidr-open' : 'sidr-open ' + name + '-open');
72
+
73
+ // Open Sidr
74
+ if('open' === action || ('toggle' === action && !$menu.is(':visible'))) {
75
+ // Check if we can open it
76
+ if( $menu.is(':visible') || sidrMoving ) {
77
+ return;
78
+ }
79
+
80
+ // If another menu opened close first
81
+ if(sidrOpened !== false) {
82
+ methods.close(sidrOpened, function() {
83
+ methods.open(name);
84
+ });
85
+
86
+ return;
87
+ }
88
+
89
+ // Lock sidr
90
+ sidrMoving = true;
91
+
92
+ // Left or right?
93
+ if(side === 'left') {
94
+ bodyAnimation = {left: menuWidth + 'px'};
95
+ menuAnimation = {left: '0px'};
96
+ }
97
+ else {
98
+ bodyAnimation = {right: menuWidth + 'px'};
99
+ menuAnimation = {right: '0px'};
100
+ }
101
+
102
+ // Prepare page if container is body
103
+ if($body.is('body')){
104
+ scrollTop = $html.scrollTop();
105
+ $html.css('overflow-x', 'hidden').scrollTop(scrollTop);
106
+ }
107
+
108
+ // Open menu
109
+ if(displace){
110
+ $body.addClass('sidr-animating').css({
111
+ width: $body.width(),
112
+ position: 'absolute'
113
+ }).animate(bodyAnimation, speed, function() {
114
+ $(this).addClass(bodyClass);
115
+ });
116
+ }
117
+ else {
118
+ setTimeout(function() {
119
+ $(this).addClass(bodyClass);
120
+ }, speed);
121
+ }
122
+ $menu.css('display', 'block').animate(menuAnimation, speed, function() {
123
+ sidrMoving = false;
124
+ sidrOpened = name;
125
+ // Callback
126
+ if(typeof callback === 'function') {
127
+ callback(name);
128
+ }
129
+ $body.removeClass('sidr-animating');
130
+ });
131
+
132
+ // onOpen callback
133
+ onOpen();
134
+ }
135
+ // Close Sidr
136
+ else {
137
+ // Check if we can close it
138
+ if( !$menu.is(':visible') || sidrMoving ) {
139
+ return;
140
+ }
141
+
142
+ // Lock sidr
143
+ sidrMoving = true;
144
+
145
+ // Right or left menu?
146
+ if(side === 'left') {
147
+ bodyAnimation = {left: 0};
148
+ menuAnimation = {left: '-' + menuWidth + 'px'};
149
+ }
150
+ else {
151
+ bodyAnimation = {right: 0};
152
+ menuAnimation = {right: '-' + menuWidth + 'px'};
153
+ }
154
+
155
+ // Close menu
156
+ if($body.is('body')){
157
+ scrollTop = $html.scrollTop();
158
+ $html.removeAttr('style').scrollTop(scrollTop);
159
+ }
160
+ $body.addClass('sidr-animating').animate(bodyAnimation, speed).removeClass(bodyClass);
161
+ $menu.animate(menuAnimation, speed, function() {
162
+ $menu.removeAttr('style').hide();
163
+ $body.removeAttr('style');
164
+ $('html').removeAttr('style');
165
+ sidrMoving = false;
166
+ sidrOpened = false;
167
+ // Callback
168
+ if(typeof callback === 'function') {
169
+ callback(name);
170
+ }
171
+ $body.removeClass('sidr-animating');
172
+ });
173
+
174
+ // onClose callback
175
+ onClose();
176
+ }
177
+ }
178
+ };
179
+
180
+ // Sidr public methods
181
+ var methods = {
182
+ open: function(name, callback) {
183
+ privateMethods.execute('open', name, callback);
184
+ },
185
+ close: function(name, callback) {
186
+ privateMethods.execute('close', name, callback);
187
+ },
188
+ toggle: function(name, callback) {
189
+ privateMethods.execute('toggle', name, callback);
190
+ },
191
+ // I made a typo, so I mantain this method to keep backward compatibilty with 1.1.1v and previous
192
+ toogle: function(name, callback) {
193
+ privateMethods.execute('toggle', name, callback);
194
+ }
195
+ };
196
+
197
+ $.sidr = function( method ) {
198
+
199
+ if ( methods[method] ) {
200
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
201
+ }
202
+ else if ( typeof method === 'function' || typeof method === 'string' || ! method ) {
203
+ return methods.toggle.apply( this, arguments );
204
+ }
205
+ else {
206
+ $.error( 'Method ' + method + ' does not exist on jQuery.sidr' );
207
+ }
208
+
209
+ };
210
+
211
+ $.fn.sidr = function( options ) {
212
+
213
+ var settings = $.extend( {
214
+ name : 'sidr', // Name for the 'sidr'
215
+ speed : 200, // Accepts standard jQuery effects speeds (i.e. fast, normal or milliseconds)
216
+ side : 'left', // Accepts 'left' or 'right'
217
+ source : null, // Override the source of the content.
218
+ renaming : true, // The ids and classes will be prepended with a prefix when loading existent content
219
+ body : 'body', // Page container selector,
220
+ displace: true, // Displace the body content or not
221
+ onOpen : function() {}, // Callback when sidr opened
222
+ onClose : function() {} // Callback when sidr closed
223
+ }, options);
224
+
225
+ var name = settings.name,
226
+ $sideMenu = $('#' + name);
227
+
228
+ // If the side menu do not exist create it
229
+ if( $sideMenu.length === 0 ) {
230
+ $sideMenu = $('<div />')
231
+ .attr('id', name)
232
+ .appendTo($('body'));
233
+ }
234
+
235
+ // Adding styles and options
236
+ $sideMenu
237
+ .addClass('sidr')
238
+ .addClass(settings.side)
239
+ .data({
240
+ speed : settings.speed,
241
+ side : settings.side,
242
+ body : settings.body,
243
+ displace : settings.displace,
244
+ onOpen : settings.onOpen,
245
+ onClose : settings.onClose
246
+ });
247
+
248
+ // The menu content
249
+ if(typeof settings.source === 'function') {
250
+ var newContent = settings.source(name);
251
+ privateMethods.loadContent($sideMenu, newContent);
252
+ }
253
+ else if(typeof settings.source === 'string' && privateMethods.isUrl(settings.source)) {
254
+ $.get(settings.source, function(data) {
255
+ privateMethods.loadContent($sideMenu, data);
256
+ });
257
+ }
258
+ else if(typeof settings.source === 'string') {
259
+ var htmlContent = '',
260
+ selectors = settings.source.split(',');
261
+
262
+ $.each(selectors, function(index, element) {
263
+ htmlContent += '<div class="sidr-inner">' + $(element).html() + '</div>';
264
+ });
265
+
266
+ // Renaming ids and classes
267
+ if(settings.renaming) {
268
+ var $htmlContent = $('<div />').html(htmlContent);
269
+ $htmlContent.find('*').each(function(index, element) {
270
+ var $element = $(element);
271
+ privateMethods.addPrefix($element);
272
+ });
273
+ htmlContent = $htmlContent.html();
274
+ }
275
+ privateMethods.loadContent($sideMenu, htmlContent);
276
+ }
277
+ else if(settings.source !== null) {
278
+ $.error('Invalid Sidr Source');
279
+ }
280
+
281
+ return this.each(function(){
282
+ var $this = $(this),
283
+ data = $this.data('sidr');
284
+
285
+ // If the plugin hasn't been initialized yet
286
+ if ( ! data ) {
287
+
288
+ $this.data('sidr', name);
289
+ if('ontouchstart' in document.documentElement) {
290
+ $this.bind('touchstart', function(e) {
291
+ var theEvent = e.originalEvent.touches[0];
292
+ this.touched = e.timeStamp;
293
+ });
294
+ $this.bind('touchend', function(e) {
295
+ var delta = Math.abs(e.timeStamp - this.touched);
296
+ if(delta < 200) {
297
+ e.preventDefault();
298
+ methods.toggle(name);
299
+ }
300
+ });
301
+ }
302
+ else {
303
+ $this.click(function(e) {
304
+ e.preventDefault();
305
+ methods.toggle(name);
306
+ });
307
+ }
308
+ }
309
+ });
310
+ };
311
+
312
+ })( jQuery );
js/jquery.transit.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Transit - CSS3 transitions and transformations
3
+ * (c) 2011-2012 Rico Sta. Cruz <rico@ricostacruz.com>
4
+ * MIT Licensed.
5
+ *
6
+ * http://ricostacruz.com/jquery.transit
7
+ * http://github.com/rstacruz/jquery.transit
8
+ */
9
+ (function(k){k.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var d=document.createElement("div");var q={};function b(v){if(v in d.style){return v}var u=["Moz","Webkit","O","ms"];var r=v.charAt(0).toUpperCase()+v.substr(1);if(v in d.style){return v}for(var t=0;t<u.length;++t){var s=u[t]+r;if(s in d.style){return s}}}function e(){d.style[q.transform]="";d.style[q.transform]="rotateY(90deg)";return d.style[q.transform]!==""}var a=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;q.transition=b("transition");q.transitionDelay=b("transitionDelay");q.transform=b("transform");q.transformOrigin=b("transformOrigin");q.transform3d=e();var i={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var f=q.transitionEnd=i[q.transition]||null;for(var p in q){if(q.hasOwnProperty(p)&&typeof k.support[p]==="undefined"){k.support[p]=q[p]}}d=null;k.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};k.cssHooks["transit:transform"]={get:function(r){return k(r).data("transform")||new j()},set:function(s,r){var t=r;if(!(t instanceof j)){t=new j(t)}if(q.transform==="WebkitTransform"&&!a){s.style[q.transform]=t.toString(true)}else{s.style[q.transform]=t.toString()}k(s).data("transform",t)}};k.cssHooks.transform={set:k.cssHooks["transit:transform"].set};if(k.fn.jquery<"1.8"){k.cssHooks.transformOrigin={get:function(r){return r.style[q.transformOrigin]},set:function(r,s){r.style[q.transformOrigin]=s}};k.cssHooks.transition={get:function(r){return r.style[q.transition]},set:function(r,s){r.style[q.transition]=s}}}n("scale");n("translate");n("rotate");n("rotateX");n("rotateY");n("rotate3d");n("perspective");n("skewX");n("skewY");n("x",true);n("y",true);function j(r){if(typeof r==="string"){this.parse(r)}return this}j.prototype={setFromString:function(t,s){var r=(typeof s==="string")?s.split(","):(s.constructor===Array)?s:[s];r.unshift(t);j.prototype.set.apply(this,r)},set:function(s){var r=Array.prototype.slice.apply(arguments,[1]);if(this.setter[s]){this.setter[s].apply(this,r)}else{this[s]=r.join(",")}},get:function(r){if(this.getter[r]){return this.getter[r].apply(this)}else{return this[r]||0}},setter:{rotate:function(r){this.rotate=o(r,"deg")},rotateX:function(r){this.rotateX=o(r,"deg")},rotateY:function(r){this.rotateY=o(r,"deg")},scale:function(r,s){if(s===undefined){s=r}this.scale=r+","+s},skewX:function(r){this.skewX=o(r,"deg")},skewY:function(r){this.skewY=o(r,"deg")},perspective:function(r){this.perspective=o(r,"px")},x:function(r){this.set("translate",r,null)},y:function(r){this.set("translate",null,r)},translate:function(r,s){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(r!==null&&r!==undefined){this._translateX=o(r,"px")}if(s!==null&&s!==undefined){this._translateY=o(s,"px")}this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var r=(this.scale||"1,1").split(",");if(r[0]){r[0]=parseFloat(r[0])}if(r[1]){r[1]=parseFloat(r[1])}return(r[0]===r[1])?r[0]:r},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var r=0;r<=3;++r){if(t[r]){t[r]=parseFloat(t[r])}}if(t[3]){t[3]=o(t[3],"deg")}return t}},parse:function(s){var r=this;s.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,v,u){r.setFromString(v,u)})},toString:function(t){var s=[];for(var r in this){if(this.hasOwnProperty(r)){if((!q.transform3d)&&((r==="rotateX")||(r==="rotateY")||(r==="perspective")||(r==="transformOrigin"))){continue}if(r[0]!=="_"){if(t&&(r==="scale")){s.push(r+"3d("+this[r]+",1)")}else{if(t&&(r==="translate")){s.push(r+"3d("+this[r]+",0)")}else{s.push(r+"("+this[r]+")")}}}}}return s.join(" ")}};function m(s,r,t){if(r===true){s.queue(t)}else{if(r){s.queue(r,t)}else{t()}}}function h(s){var r=[];k.each(s,function(t){t=k.camelCase(t);t=k.transit.propertyMap[t]||k.cssProps[t]||t;t=c(t);if(k.inArray(t,r)===-1){r.push(t)}});return r}function g(s,v,x,r){var t=h(s);if(k.cssEase[x]){x=k.cssEase[x]}var w=""+l(v)+" "+x;if(parseInt(r,10)>0){w+=" "+l(r)}var u=[];k.each(t,function(z,y){u.push(y+" "+w)});return u.join(", ")}k.fn.transition=k.fn.transit=function(z,s,y,C){var D=this;var u=0;var w=true;if(typeof s==="function"){C=s;s=undefined}if(typeof y==="function"){C=y;y=undefined}if(typeof z.easing!=="undefined"){y=z.easing;delete z.easing}if(typeof z.duration!=="undefined"){s=z.duration;delete z.duration}if(typeof z.complete!=="undefined"){C=z.complete;delete z.complete}if(typeof z.queue!=="undefined"){w=z.queue;delete z.queue}if(typeof z.delay!=="undefined"){u=z.delay;delete z.delay}if(typeof s==="undefined"){s=k.fx.speeds._default}if(typeof y==="undefined"){y=k.cssEase._default}s=l(s);var E=g(z,s,y,u);var B=k.transit.enabled&&q.transition;var t=B?(parseInt(s,10)+parseInt(u,10)):0;if(t===0){var A=function(F){D.css(z);if(C){C.apply(D)}if(F){F()}};m(D,w,A);return D}var x={};var r=function(H){var G=false;var F=function(){if(G){D.unbind(f,F)}if(t>0){D.each(function(){this.style[q.transition]=(x[this]||null)})}if(typeof C==="function"){C.apply(D)}if(typeof H==="function"){H()}};if((t>0)&&(f)&&(k.transit.useTransitionEnd)){G=true;D.bind(f,F)}else{window.setTimeout(F,t)}D.each(function(){if(t>0){this.style[q.transition]=E}k(this).css(z)})};var v=function(F){this.offsetWidth;r(F)};m(D,w,v);return this};function n(s,r){if(!r){k.cssNumber[s]=true}k.transit.propertyMap[s]=q.transform;k.cssHooks[s]={get:function(v){var u=k(v).css("transit:transform");return u.get(s)},set:function(v,w){var u=k(v).css("transit:transform");u.setFromString(s,w);k(v).css({"transit:transform":u})}}}function c(r){return r.replace(/([A-Z])/g,function(s){return"-"+s.toLowerCase()})}function o(s,r){if((typeof s==="string")&&(!s.match(/^[\-0-9\.]+$/))){return s}else{return""+s+r}}function l(s){var r=s;if(k.fx.speeds[r]){r=k.fx.speeds[r]}return o(r,"ms")}k.transit.getTransitionValue=g})(jQuery);
10
+ (function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);
js/wprmenu-admin.js ADDED
@@ -0,0 +1 @@
 
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 ADDED
@@ -0,0 +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(){})}})}}})
readme.txt ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
10
+
11
+ WP Responsive Menu turns your WordPress menu to a highy customizable sliding responsive menu.
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.
22
+ * Easily replace your menu with responsive menu on mobile devices.
23
+ * Choose your custom colors to match your theme.
24
+ * Option to open menu from top, left and right.
25
+ * Easily add your website logo the the menu.
26
+ * Easily hide unwanted elements on mobile devices.
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
+
38
+ == Installation ==
39
+
40
+ 1. Go to your admin area and select Plugins -> Add new from the menu.
41
+ 2. Search for "WP Responsive Menu".
42
+ 3. Click install.
43
+ 4. Click activate.
44
+ 5. Go to Settings > WP Responsive Menu and start playing with the configurations.
45
+
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.
screenshot-1.png ADDED
Binary file
wp-responsive-menu.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ *
15
+ * Enable Localization
16
+ *
17
+ */
18
+ load_plugin_textdomain('wprmenu', false, basename( dirname( __FILE__ ) ) . '/lang' );
19
+
20
+ /**
21
+ *
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>
57
+ </div>
58
+ <div class="menu_title">
59
+ <?php echo $options['bar_title'] ?>
60
+ <?php if($options['bar_logo']) echo '<img class="bar_logo" src="'.$options['bar_logo'].'"/>' ?>
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));
68
+ if($menus) : foreach($menus as $m) :
69
+ if($m->term_id == $options['menu']) $menu = $m;
70
+ endforeach; endif;
71
+ if(is_object($menu)) :
72
+ wp_nav_menu( array('menu'=>$menu->name,'container'=>false,'items_wrap'=>'%3$s'));
73
+ endif;
74
+ ?>
75
+ </ul>
76
+ </div>
77
+ <?php
78
+ endif;
79
+ }
80
+
81
+
82
+ function wprmenu_header_styles() {
83
+ $options = get_option('wprmenu_options');
84
+ if($options['enabled']) :
85
+ ?>
86
+ <style id="wprmenu_css" type="text/css" >
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"] ?>;
96
+ }
97
+ #wprmenu_menu {
98
+ background: <?php echo $options["menu_bgd"] ?>!important;
99
+ }
100
+ #wprmenu_menu.wprmenu_levels ul li {
101
+ border-bottom:1px solid <?php echo $options["menu_border_bottom"] ?>;
102
+ border-top:1px solid <?php echo $options["menu_border_top"] ?>;
103
+ }
104
+ #wprmenu_menu ul li a {
105
+ color: <?php echo $options["menu_color"] ?>;
106
+ }
107
+ #wprmenu_menu ul li a:hover {
108
+ color: <?php echo $options["menu_color_hover"] ?>;
109
+ }
110
+ #wprmenu_menu.wprmenu_levels a.wprmenu_parent_item {
111
+ border-left:1px solid <?php echo $options["menu_border_top"] ?>;
112
+ }
113
+ #wprmenu_menu .wprmenu_icon_par {
114
+ color: <?php echo $options["menu_color"] ?>;
115
+ }
116
+ #wprmenu_menu .wprmenu_icon_par:hover {
117
+ color: <?php echo $options["menu_color_hover"] ?>;
118
+ }
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
126
+ //when option "hide bottom borders is on...
127
+ if($options["menu_border_bottom_show"] === 'no') { ?>
128
+ #wprmenu_menu, #wprmenu_menu ul, #wprmenu_menu li {
129
+ border-bottom:none!important;
130
+ }
131
+ #wprmenu_menu.wprmenu_levels > ul {
132
+ border-bottom:1px solid <?php echo $options["menu_border_top"] ?>!important;
133
+ }
134
+ .wprmenu_no_border_bottom {
135
+ border-bottom:none!important;
136
+ }
137
+ #wprmenu_menu.wprmenu_levels ul li ul {
138
+ border-top:none!important;
139
+ }
140
+ <?php } ?>
141
+
142
+ #wprmenu_menu.left {
143
+ width:<?php echo $options["how_wide"] ?>%;
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"] ?>%;
155
+ left: auto;
156
+ }
157
+
158
+
159
+ <?php if($options["nesting_icon"] != '') : ?>
160
+ #wprmenu_menu .wprmenu_icon:before {
161
+ font-family: 'fontawesome'!important;
162
+ }
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
+ }
170
+ #wprmenu_bar .bar_logo {
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;
194
+ }
195
+ add_action('wp_head', 'wprmenu_header_styles');