WP Responsive Menu - Version 3.1.7.1

Version Description

Download this release

Release Info

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

Code changes from version 3.1.7 to 3.1.7.1

inc/assets/js/wprmenu-import-demo.js CHANGED
@@ -36,12 +36,11 @@ jQuery(function($) {
36
  $.ajax({
37
  type : 'POST',
38
  url : wprmenu_params.ajax_url,
39
- data : 'settings_id='+ SettingsId + '&demo_id=' + DemoId + '&demo_type=' +DemoType+ '&action=wprmenu_import_data',
40
  success : function( response ) {
41
  response = $.parseJSON( response );
42
 
43
  if( response.status == 'success' ) {
44
- wprmenu_setCookie( 'wprmenu_live_preview', '', 1 );
45
  Swal({
46
  type : 'success',
47
  title : wprmenu_params.import_done,
@@ -69,12 +68,6 @@ jQuery(function($) {
69
 
70
  $.exitIntent( 'enable' );
71
  $(document).bind( 'exitintent', function() {
72
-
73
- $check_cookie = wprmenu_getCookie( 'wprmenu_live_preview' );
74
-
75
- if( $check_cookie !== 'yes' )
76
- return;
77
-
78
  const swalWithBootstrapButtons = Swal.mixin({
79
  confirmButtonClass: 'btn btn-primary',
80
  cancelButtonClass: 'btn btn-secondary',
@@ -96,13 +89,11 @@ jQuery(function($) {
96
  $.ajax({
97
  type : 'POST',
98
  url : wprmenu_params.ajax_url,
99
- data : 'action=wpr_get_transient_from_data',
100
  success : function( response ) {
101
  response = $.parseJSON( response );
102
 
103
  if( response.status == 'success' ) {
104
- wprmenu_setCookie( 'wprmenu_live_preview', '', 1 );
105
-
106
  swalWithBootstrapButtons(
107
  wprmenu_params.options_saved,
108
  wprmenu_params.options_saved_msg,
@@ -124,7 +115,6 @@ jQuery(function($) {
124
  } else if (
125
  result.dismiss === Swal.DismissReason.cancel
126
  ) {
127
- wprmenu_setCookie( 'wprmenu_live_preview', '', 1 );
128
  swalWithBootstrapButtons(
129
  wprmenu_params.options_not_saved,
130
  'The recent changes are reverted back',
36
  $.ajax({
37
  type : 'POST',
38
  url : wprmenu_params.ajax_url,
39
+ data : 'nonce='+ wprmenu_params.nonce + '&settings_id='+ SettingsId + '&demo_id=' + DemoId + '&demo_type=' +DemoType+ '&action=wprmenu_import_data',
40
  success : function( response ) {
41
  response = $.parseJSON( response );
42
 
43
  if( response.status == 'success' ) {
 
44
  Swal({
45
  type : 'success',
46
  title : wprmenu_params.import_done,
68
 
69
  $.exitIntent( 'enable' );
70
  $(document).bind( 'exitintent', function() {
 
 
 
 
 
 
71
  const swalWithBootstrapButtons = Swal.mixin({
72
  confirmButtonClass: 'btn btn-primary',
73
  cancelButtonClass: 'btn btn-secondary',
89
  $.ajax({
90
  type : 'POST',
91
  url : wprmenu_params.ajax_url,
92
+ data : 'action=wpr_get_transient_from_data&nonce='+ wprmenu_params.nonce,
93
  success : function( response ) {
94
  response = $.parseJSON( response );
95
 
96
  if( response.status == 'success' ) {
 
 
97
  swalWithBootstrapButtons(
98
  wprmenu_params.options_saved,
99
  wprmenu_params.options_saved_msg,
115
  } else if (
116
  result.dismiss === Swal.DismissReason.cancel
117
  ) {
 
118
  swalWithBootstrapButtons(
119
  wprmenu_params.options_not_saved,
120
  'The recent changes are reverted back',
inc/class-wp-responsive-menu.php CHANGED
@@ -49,8 +49,6 @@ class WP_Responsive_Menu {
49
 
50
  // add_action( 'wpr_optionsframework_after_validate', array( $this, 'save_options_notice' ) );
51
 
52
- add_action( 'wp_ajax_wpr_live_update', array( $this, 'wpr_live_update' ) );
53
-
54
  add_action( 'wp_ajax_wprmenu_import_data', array( $this, 'wprmenu_import_data' ) );
55
 
56
  add_action( 'wp_ajax_wpr_get_transient_from_data', array( $this, 'wpr_get_transient_from_data' ) );
@@ -94,22 +92,9 @@ class WP_Responsive_Menu {
94
  }
95
 
96
  public function option( $option ){
97
- if ( isset( $_COOKIE['wprmenu_live_preview'] )
98
- && $_COOKIE['wprmenu_live_preview'] == 'yes' ) {
99
- $check_transient = get_transient( 'wpr_live_settings' );
100
-
101
- if ( $check_transient ) {
102
- if ( isset( $check_transient[$option] )
103
- && $check_transient[$option] != '' ) {
104
- return $check_transient[$option];
105
- }
106
- }
107
- }
108
- else {
109
- if ( isset( $this->options[$option] ) && $this->options[$option] != '' )
110
- return $this->options[$option];
111
- return '';
112
- }
113
  }
114
 
115
 
@@ -205,8 +190,8 @@ class WP_Responsive_Menu {
205
  'parent_click' => ( $this->option('parent_click') == 'yes' || $this->option('parent_click') == '1' ) ? 'yes' : '',
206
  'swipe' => $this->option( 'swipe' ),
207
  'enable_overlay' => $this->option( 'enable_overlay' ),
208
- 'nonce' => wp_create_nonce( 'wprmenu-nonce' ),
209
  );
 
210
 
211
  //Localize necessary variables
212
  wp_localize_script( 'wprmenu.js', 'wprmenu', $params );
@@ -335,26 +320,6 @@ class WP_Responsive_Menu {
335
  }
336
  }
337
 
338
- /**
339
- *
340
- * Save settings into transient
341
- *
342
- * @since 3.1
343
- * @param empty
344
- * @return array
345
- */
346
- public function wpr_live_update() {
347
-
348
- if ( ! wp_verify_nonce( $_POST['nonce'], 'wprmenu-nonce' ) ) {
349
- die ( __( 'Error while verifying your request! Try again.', 'wprmenu' ) );
350
- }
351
-
352
- if ( isset( $_POST['wprmenu_options'] ) ) {
353
- set_transient('wpr_live_settings', sanitize_text_field( $_POST['wprmenu_options'] ), 60 * 60 * 24);
354
- }
355
- wp_die();
356
- }
357
-
358
  /**
359
  *
360
  * Get demo settings from the file
@@ -380,7 +345,7 @@ class WP_Responsive_Menu {
380
  $settings_id = isset($_POST['settings_id']) ? sanitize_text_field( $_POST['settings_id'] ) : '';
381
  $demo_type = isset($_POST['demo_type']) ? sanitize_text_field( $_POST['demo_type'] ) : '';
382
 
383
- $demo_id = isset($_POST['demo_id']) ? sanitize_text_field( $_POST['demo_id'] ) : '';
384
 
385
  if ( $settings_id !== ''
386
  && $demo_type !== ''
49
 
50
  // add_action( 'wpr_optionsframework_after_validate', array( $this, 'save_options_notice' ) );
51
 
 
 
52
  add_action( 'wp_ajax_wprmenu_import_data', array( $this, 'wprmenu_import_data' ) );
53
 
54
  add_action( 'wp_ajax_wpr_get_transient_from_data', array( $this, 'wpr_get_transient_from_data' ) );
92
  }
93
 
94
  public function option( $option ){
95
+ if ( isset( $this->options[$option] ) && $this->options[$option] != '' )
96
+ return $this->options[$option];
97
+ return '';
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
 
100
 
190
  'parent_click' => ( $this->option('parent_click') == 'yes' || $this->option('parent_click') == '1' ) ? 'yes' : '',
191
  'swipe' => $this->option( 'swipe' ),
192
  'enable_overlay' => $this->option( 'enable_overlay' ),
 
193
  );
194
+
195
 
196
  //Localize necessary variables
197
  wp_localize_script( 'wprmenu.js', 'wprmenu', $params );
320
  }
321
  }
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  /**
324
  *
325
  * Get demo settings from the file
345
  $settings_id = isset($_POST['settings_id']) ? sanitize_text_field( $_POST['settings_id'] ) : '';
346
  $demo_type = isset($_POST['demo_type']) ? sanitize_text_field( $_POST['demo_type'] ) : '';
347
 
348
+ $demo_id = isset( $_POST['demo_id'] ) ? sanitize_text_field( $_POST['demo_id'] ) : '';
349
 
350
  if ( $settings_id !== ''
351
  && $demo_type !== ''
inc/includes/class-options-framework.php DELETED
@@ -1,126 +0,0 @@
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
-
40
-
41
- // Load settings
42
- $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
43
-
44
- // Updates the unique option id in the database if it has changed
45
- if ( function_exists( 'wpr_optionsframework_option_name' ) ) {
46
- wpr_optionsframework_option_name();
47
- }
48
- elseif ( has_action( 'wpr_optionsframework_option_name' ) ) {
49
- do_action( 'wpr_optionsframework_option_name' );
50
- }
51
- // If the developer hasn't explicitly set an option id, we'll use a default
52
- else {
53
-
54
- $default_themename = get_option( 'stylesheet' );
55
- $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
56
- $default_themename = 'wpr_optionsframework_' . $default_themename;
57
- if ( isset( $wpr_optionsframework_settings['id'] ) ) {
58
- if ( $wpr_optionsframework_settings['id'] == $default_themename ) {
59
- // All good, using default theme id
60
- } else {
61
- $wpr_optionsframework_settings['id'] = $default_themename;
62
- update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
63
- }
64
- }
65
- else {
66
-
67
- $wpr_optionsframework_settings['id'] = $default_themename;
68
- update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
69
-
70
- }
71
- }
72
-
73
- }
74
-
75
- /**
76
- * Wrapper for wpr_optionsframework_options()
77
- *
78
- * Allows for manipulating or setting options via 'wpr_of_options' filter
79
- * For example:
80
- *
81
- * <code>
82
- * add_filter( 'wpr_of_options', function( $options ) {
83
- * $options[] = array(
84
- * 'name' => 'Input Text Mini',
85
- * 'desc' => 'A mini text input field.',
86
- * 'id' => 'example_text_mini',
87
- * 'std' => 'Default',
88
- * 'class' => 'mini',
89
- * 'type' => 'text'
90
- * );
91
- *
92
- * return $options;
93
- * });
94
- * </code>
95
- *
96
- * Also allows for setting options via a return statement in the
97
- * options.php file. For example (in options.php):
98
- *
99
- * <code>
100
- * return array(...);
101
- * </code>
102
- *
103
- * @return array (by reference)
104
- */
105
- static function &_wpr_optionsframework_options() {
106
- static $options = null;
107
-
108
- if ( !$options ) {
109
- // Load options from options.php file (if it exists)
110
-
111
- $maybe_options = require_once WPR_OPTIONS_FRAMEWORK_PATH . 'options.php';;
112
- if ( is_array( $maybe_options ) ) {
113
- $options = $maybe_options;
114
- }
115
- else if ( function_exists( 'wpr_optionsframework_options' ) ) {
116
- $options = wpr_optionsframework_options();
117
- }
118
-
119
- // Allow setting/manipulating options via filters
120
- $options = apply_filters( 'wpr_of_options', $options );
121
- }
122
-
123
- return $options;
124
- }
125
-
126
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/includes/class-options-interface.php DELETED
@@ -1,506 +0,0 @@
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 ) . '">' . $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
- // If there is a description save it for labels
79
- $explain_value = '';
80
- if ( isset( $value['desc'] ) ) {
81
- $explain_value = $value['desc'];
82
- }
83
-
84
- $output .= '<div id="' . esc_attr( $id ) .'" class="row ' . esc_attr( $class ) . '">'."\n";
85
- if ( isset( $value['name'] ) ) {
86
- $output .= '<div class="col-md-4 heading"><label class="explain" for="' . esc_attr( $value['id'] ) . '">' . esc_html( $value['name'] ) . '</label>';
87
- if( $explain_value != '' )
88
- $output .= '<span class="dashicons dashicons-editor-help pull-right" data-toggle="tooltip" data-placement="top" title="'. wp_kses( $explain_value, $allowedtags) .'"></span>';
89
- $output .= '</div>' . "\n";
90
- }
91
- if ( $value['type'] != 'editor' ) {
92
- $output .= '<div class="col-md-8 option">' . "\n" . '<div class="controls">' . "\n";
93
- }
94
- else {
95
- $output .= '<div class="option">' . "\n" . '<div>' . "\n";
96
- }
97
- }
98
-
99
- // Set default value to $val
100
- if ( isset( $value['std'] ) ) {
101
- $val = $value['std'];
102
- }
103
-
104
- // If the option is already saved, override $val
105
- if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) {
106
- if ( isset( $settings[($value['id'])]) ) {
107
- $val = $settings[($value['id'])];
108
- // Striping slashes of non-array options
109
- if ( !is_array($val) ) {
110
- $val = stripslashes( $val );
111
- }
112
- }
113
- }
114
-
115
- // Set the placeholder if one exists
116
- $placeholder = '';
117
- if ( isset( $value['placeholder'] ) ) {
118
- $placeholder = ' placeholder="' . esc_attr( $value['placeholder'] ) . '"';
119
- }
120
-
121
- if ( has_filter( 'wpr_optionsframework_' . $value['type'] ) ) {
122
- $output .= apply_filters( 'wpr_optionsframework_' . $value['type'], $option_name, $value, $val );
123
- }
124
-
125
-
126
- switch ( $value['type'] ) {
127
-
128
- // Basic text input
129
- case 'text':
130
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="form-control" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
131
- break;
132
-
133
- // Code
134
- case 'code':
135
- $output .= '<div id="' . esc_attr( $value['id'] ) . '" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '"></div>';
136
- $output .= '<textarea name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '_textarea" style="display: none">'.esc_attr( $val ).'</textarea>';
137
- break;
138
-
139
- // Password input
140
- case 'password':
141
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="password" value="' . esc_attr( $val ) . '" />';
142
- break;
143
-
144
- // Textarea
145
- case 'textarea':
146
- $rows = '8';
147
-
148
- if ( isset( $value['settings']['rows'] ) ) {
149
- $custom_rows = $value['settings']['rows'];
150
- if ( is_numeric( $custom_rows ) ) {
151
- $rows = $custom_rows;
152
- }
153
- }
154
-
155
- $val = stripslashes( $val );
156
- $output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea( $val ) . '</textarea>';
157
- break;
158
-
159
- // Select Box
160
- case 'select':
161
- $output .= '<select class="form-control" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '">';
162
-
163
- foreach ($value['options'] as $key => $option ) {
164
- $output .= '<option'. selected( $val, $key, false ) .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>';
165
- }
166
- $output .= '</select>';
167
- break;
168
-
169
-
170
- // Radio Box
171
- case "radio":
172
- $name = $option_name .'['. $value['id'] .']';
173
- $output .= '<div class="btn-group" data-toggle="buttons">';
174
- foreach ($value['options'] as $key => $option) {
175
- $id = $option_name . '-' . $value['id'] .'-'. $key;
176
- $active = '';
177
- if( $val == $key ) $active = 'active';
178
- $output .= '<label class="btn btn-default '. $active .'" for="' . esc_attr( $id ) . '"><input class="of-input of-radio" type="radio" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="'. esc_attr( $key ) . '" '. checked( $val, $key, false) .' autocomplete="off" />' . esc_html( $option ) . '</label>';
179
- }
180
- $output .= '</div>';
181
- break;
182
-
183
- // Image Selectors
184
- case "images":
185
- $name = $option_name .'['. $value['id'] .']';
186
- foreach ( $value['options'] as $key => $option ) {
187
- $selected = '';
188
- if ( $val != '' && ($val == $key) ) {
189
- $selected = ' of-radio-img-selected';
190
- }
191
- $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 ) .' />';
192
- $output .= '<div class="of-radio-img-label">' . esc_html( $key ) . '</div>';
193
- $output .= '<img src="' . esc_url( $option ) . '" alt="' . $option .'" class="of-radio-img-img' . $selected .'" onclick="document.getElementById(\''. esc_attr($value['id'] .'_'. $key) .'\').checked=true;" />';
194
- }
195
- break;
196
-
197
- case "hidemenupages":
198
- $cats = $val;
199
-
200
- $output .= '<select class="wprmenu-hide-menu-pages of-input" multiple="multiple" name="' . esc_attr( $option_name . '[' . $value['id'] . '][]' ) . '" id="' . esc_attr( $value['id'] ) . '">';
201
- foreach ($value['options'] as $key => $option ) {
202
- if( is_array( $cats) && !empty( $cats ) && isset($cats[$key] ) && $cats[$key] === $option ) {
203
- $output .= '<option value="' . esc_attr( $key ) . '" selected="selected">' . esc_html( $option ) . '</option>';
204
- }
205
- else {
206
- $output .= '<option value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>';
207
- }
208
- }
209
- $output .= '</select>';
210
- break;
211
-
212
- // Checkbox
213
- case "checkbox":
214
- $output .= '<label class="toggle"><input id="' . esc_attr( $value['id'] ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" '. checked( $val, 1, false) .' /><span class="handle"></span></label>';
215
- // $output .= '<span class="dashicons dashicons-editor-help" data-toggle="tooltip" data-placement="top" title="'. wp_kses( $explain_value, $allowedtags) .'"></span>';
216
- break;
217
-
218
- // Multicheck
219
- case "multicheck":
220
- foreach ($value['options'] as $key => $option) {
221
- $checked = '';
222
- $label = $option;
223
- $option = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($key));
224
-
225
- $id = $option_name . '-' . $value['id'] . '-'. $option;
226
- $name = $option_name . '[' . $value['id'] . '][' . $option .']';
227
-
228
- if ( isset($val[$option]) ) {
229
- $checked = checked($val[$option], 1, false);
230
- }
231
-
232
- $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>';
233
- }
234
- break;
235
-
236
- // Color picker
237
- case "color":
238
- $default_color = '';
239
- if ( isset($value['std']) ) {
240
- if ( $val != $value['std'] )
241
- $default_color = ' data-default-color="' .$value['std'] . '" ';
242
- }
243
- $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 .' />';
244
-
245
- break;
246
-
247
- // Uploader
248
- case "upload":
249
- $output .= Wpr_Options_Framework_Media_Uploader::wpr_optionsframework_uploader( $value['id'], $val, null );
250
-
251
- break;
252
- //Number field
253
- case "number":
254
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="number" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
255
- break;
256
-
257
- //Icon field
258
- case "icon":
259
- $output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input wpr-icon-picker" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
260
- break;
261
-
262
- //Sort Field
263
- case "menusort":
264
- $order = empty($val) ? 'Menu,Search,Social' : $val;
265
- $output .= '<input type="hidden" id="' . esc_attr( $value['id'] ) . '" class="of-input" name="'.esc_attr( $option_name . '[order_menu_items]' ).'" value="'.$val.'"><ul id="wpr-sortable" class="list-group">';
266
- foreach( explode(',', $order) as $item ) {
267
- if( $item == 'Social' ) {
268
- $class = 'facebook';
269
- $disabled = 'disabled';
270
- }
271
- else {
272
- $class = $item;
273
- $disabled = '';
274
- }
275
- $output .= '<li class=" '.$disabled.' list-group-item list-group-item-primary " id="'.$item.'"><i class="wpr-icon-'.strtolower($class).'"></i>'.$item.'</li>';
276
- }
277
- $output .= '</ul>';
278
- break;
279
-
280
- //Repeater field for social icons
281
- case "social" :
282
- $socials = json_decode( $val );
283
- $output .='<div class="wpr-new-field"><input type="button" class="wpr-add-new btn btn-success" value="Add New"></div><div class="wpr-social-fields">';
284
-
285
- if( is_array ( $socials ) && count( $socials ) > 0 ) {
286
- foreach( $socials as $social ) {
287
-
288
- $output .= '<div class="wpr-new-fields"><input type="text" name="' . esc_attr( $option_name . '[' . $value['id'] . '][icon][]' ) . '" class="wpr-icon-picker" value="'.$social->icon.'">';
289
-
290
- $output .= '<input type="text" name="' . esc_attr( $option_name . '[' . $value['id'] . '][link][]' ) . '" class="social_link form-control" value="'.$social->link.'"><input type="button" class="button" value="Remove" /></div>';
291
-
292
- }
293
- }
294
- else {
295
- $output .= '<div class="wpr-new-fields"><input type="text" name="' . esc_attr( $option_name . '[' . $value['id'] . '][icon][]' ) . '" class="wpr-icon-picker" value="">';
296
-
297
- $output .= '<input type="text" placeholder="Enter your url here" name="' . esc_attr( $option_name . '[' . $value['id'] . '][link][]' ) . '" class="' . esc_attr( $value['id'] . '_link form-control' ) . '" value=""><input type="button" class="btn btn-danger" value="Remove" /></div>';
298
- }
299
- $output .= '</div>';
300
- break;
301
-
302
- // Showcase and demo import
303
- case "showcase":
304
- $output .= '<div class="wprmenu-showcase-wrapper">';
305
- $output .= Wpr_Options_Framework_Interface::wprmenu_get_demodata();
306
- $output .= '</div>';
307
- break;
308
-
309
- // Background
310
- case 'background':
311
-
312
- $background = $val;
313
-
314
- // Background Color
315
- $default_color = '';
316
- if ( isset( $value['std']['color'] ) ) {
317
- if ( $val != $value['std']['color'] )
318
- $default_color = ' data-default-color="' .$value['std']['color'] . '" ';
319
- }
320
- $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 .' />';
321
-
322
- // Background Image
323
- if ( !isset($background['image']) ) {
324
- $background['image'] = '';
325
- }
326
-
327
- $output .= Wpr_Options_Framework_Media_Uploader::wpr_optionsframework_uploader( $value['id'], $background['image'], null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) );
328
-
329
- $class = 'of-background-properties';
330
- if ( '' == $background['image'] ) {
331
- $class .= ' hide';
332
- }
333
- $output .= '<div class="' . esc_attr( $class ) . '">';
334
-
335
- // Background Repeat
336
- $output .= '<select class="of-background of-background-repeat" name="' . esc_attr( $option_name . '[' . $value['id'] . '][repeat]' ) . '" id="' . esc_attr( $value['id'] . '_repeat' ) . '">';
337
- $repeats = wpr_of_recognized_background_repeat();
338
-
339
- foreach ($repeats as $key => $repeat) {
340
- $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['repeat'], $key, false ) . '>'. esc_html( $repeat ) . '</option>';
341
- }
342
- $output .= '</select>';
343
-
344
- // Background Position
345
- $output .= '<select class="of-background of-background-position" name="' . esc_attr( $option_name . '[' . $value['id'] . '][position]' ) . '" id="' . esc_attr( $value['id'] . '_position' ) . '">';
346
- $positions = wpr_of_recognized_background_position();
347
-
348
- foreach ($positions as $key=>$position) {
349
- $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['position'], $key, false ) . '>'. esc_html( $position ) . '</option>';
350
- }
351
- $output .= '</select>';
352
-
353
- // Background Attachment
354
- $output .= '<select class="of-background of-background-attachment" name="' . esc_attr( $option_name . '[' . $value['id'] . '][attachment]' ) . '" id="' . esc_attr( $value['id'] . '_attachment' ) . '">';
355
- $attachments = wpr_of_recognized_background_attachment();
356
-
357
- foreach ($attachments as $key => $attachment) {
358
- $output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['attachment'], $key, false ) . '>' . esc_html( $attachment ) . '</option>';
359
- }
360
- $output .= '</select>';
361
- $output .= '</div>';
362
-
363
- break;
364
-
365
- // Editor
366
- case 'editor':
367
- // $output .= '<span class="dashicons dashicons-editor-help" data-toggle="tooltip" data-placement="top" title="'. wp_kses( $explain_value, $allowedtags) .'"></span>'."\n";
368
- echo $output;
369
- $textarea_name = esc_attr( $option_name . '[' . $value['id'] . ']' );
370
- $default_editor_settings = array(
371
- 'textarea_name' => $textarea_name,
372
- 'media_buttons' => false,
373
- 'tinymce' => array( 'plugins' => 'wordpress' )
374
- );
375
- $editor_settings = array();
376
- if ( isset( $value['settings'] ) ) {
377
- $editor_settings = $value['settings'];
378
- }
379
- $editor_settings = array_merge( $default_editor_settings, $editor_settings );
380
- wp_editor( $val, $value['id'], $editor_settings );
381
- $output = '';
382
- break;
383
-
384
- // Info
385
- case "info":
386
- $id = '';
387
- $class = 'section';
388
- if ( isset( $value['id'] ) ) {
389
- $id = 'id="' . esc_attr( $value['id'] ) . '" ';
390
- }
391
- if ( isset( $value['type'] ) ) {
392
- $class .= ' section-' . $value['type'];
393
- }
394
- if ( isset( $value['class'] ) ) {
395
- $class .= ' ' . $value['class'];
396
- }
397
-
398
- $output .= '<div ' . $id . 'class="' . esc_attr( $class ) . '">' . "\n";
399
- if ( isset($value['name']) ) {
400
- $output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
401
- }
402
- if ( isset( $value['desc'] ) ) {
403
- $output .= apply_filters('wpr_of_sanitize_info', $value['desc'] ) . "\n";
404
- }
405
- $output .= '</div>' . "\n";
406
- break;
407
-
408
- // Heading for Navigation
409
- case "heading":
410
- $counter++;
411
- if ( $counter >= 2 ) {
412
- $output .= '</div>'."\n";
413
- }
414
- $class = '';
415
- $class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
416
- $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) );
417
- $output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
418
- $output .= '<h3>' . esc_html( $value['name'] ) . '</h3>' . "\n";
419
- break;
420
- }
421
-
422
- if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
423
- $output .= '</div>';
424
- if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) {
425
- // $output .= '<span class="dashicons dashicons-editor-help" data-toggle="tooltip" data-placement="top" title="'. wp_kses( $explain_value, $allowedtags) .'"></span>'."\n";
426
- }
427
- $output .= '</div></div>'."\n";
428
- }
429
-
430
- echo $output;
431
- }
432
-
433
- // Outputs closing div if there tabs
434
- if ( Wpr_Options_Framework_Interface::wpr_optionsframework_tabs() != '' ) {
435
- echo '</div>';
436
- }
437
- }
438
-
439
-
440
- //Get demo data
441
- static function wprmenu_get_demodata() {
442
-
443
- $items = get_transient('wprm_api_demo_items_list');
444
-
445
- if( ! $items )
446
- $items = Wpr_Options_Framework_Interface::wprm_fetch_demo_items();
447
-
448
-
449
- $data = '';
450
- $class = '';
451
- $data .= '<h6 class="wprmenu-demo">'.__( 'Easy Setup With Our Predefined Demo', 'wprmenu' ).'</h6>';
452
-
453
- if( is_object($items) ) {
454
-
455
- if( isset($items->Free) && !empty($items->Free) ) {
456
- $data .= '<h6 class="wpr-demo-type">'.__('Free Demo', 'wprmenu').'</h6>';
457
- $data .= '<ul class="wprmenu-demo-list">';
458
- foreach( $items->Free as $key => $val ) {
459
- $image_path = $val->image_path;
460
- $data .= '<li class="wprmenu-data-list">';
461
- $data .= '<div class="wprmenu-content image-overlay" >';
462
- $data .= '<div data-demo-type="Free" data-demo-id="'.$val->demo_id.'" data-settings="'.$val->settings.'" class="wprmenu-content-image" style="background-image: url('.$image_path.'); "></div>';
463
- $data .= '<span class="view-demo"><a target="_blank" href="'.$val->demo_url.'">'.__('View Demo', 'wprmenu').'</a></span>';
464
- $data .= '<span class="wprmenu-data import-demo">'.__('Import Demo', 'wprmenu').'</span>';
465
- $data .= '</div>';
466
- $data .= '</li>';
467
- }
468
- $data .= '</ul>';
469
- }
470
-
471
- if( isset($items->Pro) && !empty($items->Pro) ) {
472
- $data .= '<h6 class="wpr-demo-type">'.__('Pro Demo', 'wprmenu').'</h6>';
473
- $data .= '<ul class="wprmenu-demo-list">';
474
- foreach( $items->Pro as $key => $val ) {
475
- $image_path = $val->image_path;
476
- $data .= '<li class="wprmenu-data-list">';
477
- $data .= '<div class="wprmenu-content image-overlay">';
478
- $data .= '<div data-demo-type="Pro" class="wprmenu-content-image free-version" style="background-image: url('.$image_path.'); "></div>';
479
- $data .= '<span class="view-demo"><a target="_blank" href="'.$val->demo_url.'">'.__('View Demo', 'wprmenu').'</a></span>';
480
- $data .= '<span class="wprmenu-data import-demo">'.__('Import Requires Pro Version', 'wprmenu').'</span>';
481
- $data .= '</div>';
482
- $data .= '</li>';
483
- }
484
- $data .= '</ul>';
485
- }
486
- }
487
-
488
- return $data;
489
- }
490
-
491
- static function wprm_fetch_demo_items() {
492
- $site_name = MG_WPRM_DEMO_SITE_URL;
493
- $remoteLink = $site_name.'/wp-json/wprmenu-server/v1';
494
-
495
- $data = wp_remote_get($remoteLink);
496
- $items = array();
497
-
498
- if( is_array($data) && isset($data['body']) ) {
499
- $items = $data['body'];
500
- $items = json_decode($items);
501
- set_transient('wprm_api_demo_items_list', $items, 60 * 60 * 24);
502
- }
503
- return $items;
504
- }
505
-
506
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/includes/class-options-media-uploader.php DELETED
@@ -1,115 +0,0 @@
1
- <?php
2
- class Wpr_Options_Framework_Media_Uploader {
3
-
4
- /**
5
- * Initialize the media uploader class
6
- *
7
- * @since 1.7.0
8
- */
9
- public function init() {
10
- add_action( 'admin_enqueue_scripts', array( $this, 'wpr_optionsframework_media_scripts' ) );
11
- }
12
-
13
- /**
14
- * Media Uploader Using the WordPress Media Library.
15
- *
16
- * Parameters:
17
- *
18
- * string $_id - A token to identify this field (the name).
19
- * string $_value - The value of the field, if present.
20
- * string $_desc - An optional description of the field.
21
- *
22
- */
23
-
24
- static function wpr_optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
25
-
26
- $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
27
-
28
- // Gets the unique option id
29
- $option_name = $wpr_optionsframework_settings['id'];
30
-
31
- $output = '';
32
- $id = '';
33
- $class = '';
34
- $int = '';
35
- $value = '';
36
- $name = '';
37
-
38
- $id = strip_tags( strtolower( $_id ) );
39
-
40
- // If a value is passed and we don't have a stored value, use the value that's passed through.
41
- if ( $_value != '' && $value == '' ) {
42
- $value = $_value;
43
- }
44
-
45
- if ($_name != '') {
46
- $name = $_name;
47
- }
48
- else {
49
- $name = $option_name.'['.$id.']';
50
- }
51
-
52
- if ( $value ) {
53
- $class = ' has-file';
54
- }
55
- $output .= '<input id="' . $id . '" class="upload form-control pull-left' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'textdomain') .'" />' . "\n";
56
- if ( function_exists( 'wp_enqueue_media' ) ) {
57
- if ( ( $value == '' ) ) {
58
- $output .= '<input id="upload-' . $id . '" class="upload-button btn btn-success pull-left" type="button" value="' . __( 'Upload', 'textdomain' ) . '" />' . "\n";
59
- } else {
60
- $output .= '<input id="remove-' . $id . '" class="remove-file btn btn-success pull-left" type="button" value="' . __( 'Remove', 'textdomain' ) . '" />' . "\n";
61
- }
62
- } else {
63
- $output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'textdomain' ) . '</i></p>';
64
- }
65
-
66
- if ( $_desc != '' ) {
67
- $output .= '<span class="of-metabox-desc">' . $_desc . '</span>' . "\n";
68
- }
69
-
70
- $output .= '<div class="screenshot" id="' . $id . '-image">' . "\n";
71
-
72
- if ( $value != '' ) {
73
- $remove = '<a class="remove-image">Remove</a>';
74
- $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value );
75
- if ( $image ) {
76
- $output .= '<img src="' . $value . '" alt="" />' . $remove;
77
- } else {
78
- $parts = explode( "/", $value );
79
- for( $i = 0; $i < sizeof( $parts ); ++$i ) {
80
- $title = $parts[$i];
81
- }
82
-
83
- // No output preview if it's not an image.
84
- $output .= '';
85
-
86
- // Standard generic output if it's not an image.
87
- $title = __( 'View File', 'textdomain' );
88
- $output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">'.$title.'</a></span></div>';
89
- }
90
- }
91
- $output .= '</div>' . "\n";
92
- return $output;
93
- }
94
-
95
- /**
96
- * Enqueue scripts for file uploader
97
- */
98
- function wpr_optionsframework_media_scripts( $hook ) {
99
-
100
- $menu = Wpr_Options_Framework_Admin::menu_settings();
101
-
102
- if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] )
103
- return;
104
-
105
- if ( function_exists( 'wp_enqueue_media' ) )
106
- wp_enqueue_media();
107
-
108
- wp_register_script( 'of-media-uploader', WPR_OPTIONS_FRAMEWORK_DIRECTORY .'js/media-uploader.js', array( 'jquery' ), Wpr_Options_Framework::VERSION );
109
- wp_enqueue_script( 'of-media-uploader' );
110
- wp_localize_script( 'of-media-uploader', 'wpr_optionsframework_l10n', array(
111
- 'upload' => __( 'Upload', 'textdomain' ),
112
- 'remove' => __( 'Remove', 'textdomain' )
113
- ) );
114
- }
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/includes/class-options-sanitization.php DELETED
@@ -1,391 +0,0 @@
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
- add_filter( 'wpr_of_sanitize_menusort', 'sanitize_text_field' );
11
-
12
- /* Text */
13
-
14
- add_filter( 'wpr_of_sanitize_text', 'sanitize_text_field' );
15
-
16
- /* Code */
17
-
18
- add_filter( 'wpr_of_sanitize_code', 'sanitize_text_field' );
19
-
20
- /* Password */
21
-
22
- add_filter( 'wpr_of_sanitize_password', 'sanitize_text_field' );
23
-
24
- /* Textarea */
25
-
26
- function wpr_of_sanitize_textarea( $input) {
27
- global $allowedposttags;
28
- $output = wp_kses( $input, $allowedposttags);
29
- return $output;
30
- }
31
-
32
- add_filter( 'wpr_of_sanitize_textarea', 'wpr_of_sanitize_textarea' );
33
-
34
- /* Select */
35
-
36
- add_filter( 'wpr_of_sanitize_select', 'wpr_of_sanitize_enum', 10, 2 );
37
-
38
- /* Radio */
39
-
40
- add_filter( 'wpr_of_sanitize_radio', 'wpr_of_sanitize_enum', 10, 2 );
41
-
42
- /* Images */
43
-
44
- add_filter( 'wpr_of_sanitize_images', 'wpr_of_sanitize_enum', 10, 2 );
45
-
46
- /* Checkbox */
47
-
48
- function wpr_of_sanitize_checkbox( $input ) {
49
- if ( $input ) {
50
- $output = '1';
51
- } else {
52
- $output = false;
53
- }
54
- return $output;
55
- }
56
- add_filter( 'wpr_of_sanitize_checkbox', 'wpr_of_sanitize_checkbox' );
57
-
58
- /* Multicheck */
59
-
60
- function wpr_of_sanitize_multicheck( $input, $option ) {
61
- $output = '';
62
- if ( is_array( $input ) ) {
63
- foreach( $option['options'] as $key => $value ) {
64
- $output[$key] = false;
65
- }
66
- foreach( $input as $key => $value ) {
67
- if ( array_key_exists( $key, $option['options'] ) && $value ) {
68
- $output[$key] = "1";
69
- }
70
- }
71
- }
72
- return $output;
73
- }
74
- add_filter( 'wpr_of_sanitize_multicheck', 'wpr_of_sanitize_multicheck', 10, 2 );
75
-
76
- /* Color Picker */
77
-
78
- add_filter( 'wpr_of_sanitize_color', 'wpr_of_sanitize_hex' );
79
-
80
- /* Uploader */
81
-
82
- function wpr_of_sanitize_upload( $input ) {
83
- $output = '';
84
- $filetype = wp_check_filetype( $input );
85
- if ( $filetype["ext"] ) {
86
- $output = esc_url( $input );
87
- }
88
- return $output;
89
- }
90
- add_filter( 'wpr_of_sanitize_upload', 'wpr_of_sanitize_upload' );
91
-
92
- /* Editor */
93
-
94
- function wpr_of_sanitize_editor( $input ) {
95
- if ( current_user_can( 'unfiltered_html' ) ) {
96
- $output = $input;
97
- }
98
- else {
99
- global $allowedtags;
100
- $output = wpautop(wp_kses( $input, $allowedtags));
101
- }
102
- return $output;
103
- }
104
- add_filter( 'wpr_of_sanitize_editor', 'wpr_of_sanitize_editor' );
105
-
106
- /* Allowed Tags */
107
-
108
- function wpr_of_sanitize_allowedtags( $input ) {
109
- global $allowedtags;
110
- $output = wpautop( wp_kses( $input, $allowedtags ) );
111
- return $output;
112
- }
113
-
114
- /* Allowed Post Tags */
115
-
116
- function wpr_of_sanitize_allowedposttags( $input ) {
117
- global $allowedposttags;
118
- $output = wpautop( wp_kses( $input, $allowedposttags) );
119
- return $output;
120
- }
121
- add_filter( 'wpr_of_sanitize_info', 'wpr_of_sanitize_allowedposttags' );
122
-
123
- /* Check that the key value sent is valid */
124
-
125
- function wpr_of_sanitize_enum( $input, $option ) {
126
- $output = '';
127
- if ( array_key_exists( $input, $option['options'] ) ) {
128
- $output = $input;
129
- }
130
- return $output;
131
- }
132
-
133
- /* Background */
134
-
135
- function wpr_of_sanitize_background( $input ) {
136
- $output = wp_parse_args( $input, array(
137
- 'color' => '',
138
- 'image' => '',
139
- 'repeat' => 'repeat',
140
- 'position' => 'top center',
141
- 'attachment' => 'scroll'
142
- ) );
143
-
144
- $output['color'] = apply_filters( 'wpr_of_sanitize_hex', $input['color'] );
145
- $output['image'] = apply_filters( 'wpr_of_sanitize_upload', $input['image'] );
146
- $output['repeat'] = apply_filters( 'wpr_of_background_repeat', $input['repeat'] );
147
- $output['position'] = apply_filters( 'wpr_of_background_position', $input['position'] );
148
- $output['attachment'] = apply_filters( 'wpr_of_background_attachment', $input['attachment'] );
149
-
150
- return $output;
151
- }
152
- add_filter( 'wpr_of_sanitize_background', 'wpr_of_sanitize_background' );
153
-
154
- function wpr_of_sanitize_background_repeat( $value ) {
155
- $recognized = wpr_of_recognized_background_repeat();
156
- if ( array_key_exists( $value, $recognized ) ) {
157
- return $value;
158
- }
159
- return apply_filters( 'wpr_of_default_background_repeat', current( $recognized ) );
160
- }
161
- add_filter( 'wpr_of_background_repeat', 'wpr_of_sanitize_background_repeat' );
162
-
163
- function wpr_of_sanitize_background_position( $value ) {
164
- $recognized = wpr_of_recognized_background_position();
165
- if ( array_key_exists( $value, $recognized ) ) {
166
- return $value;
167
- }
168
- return apply_filters( 'wpr_of_default_background_position', current( $recognized ) );
169
- }
170
- add_filter( 'wpr_of_background_position', 'wpr_of_sanitize_background_position' );
171
-
172
- function wpr_of_sanitize_background_attachment( $value ) {
173
- $recognized = wpr_of_recognized_background_attachment();
174
- if ( array_key_exists( $value, $recognized ) ) {
175
- return $value;
176
- }
177
- return apply_filters( 'wpr_of_default_background_attachment', current( $recognized ) );
178
- }
179
- add_filter( 'wpr_of_background_attachment', 'wpr_of_sanitize_background_attachment' );
180
-
181
-
182
- /* Typography */
183
-
184
- function wpr_of_sanitize_typography( $input, $option ) {
185
-
186
- $output = wp_parse_args( $input, array(
187
- 'size' => '',
188
- 'face' => '',
189
- 'style' => '',
190
- 'color' => ''
191
- ) );
192
-
193
- if ( isset( $option['options']['faces'] ) && isset( $input['face'] ) ) {
194
- if ( !( array_key_exists( $input['face'], $option['options']['faces'] ) ) ) {
195
- $output['face'] = '';
196
- }
197
- }
198
- else {
199
- $output['face'] = apply_filters( 'wpr_of_font_face', $output['face'] );
200
- }
201
-
202
- $output['size'] = apply_filters( 'wpr_of_font_size', $output['size'] );
203
- $output['style'] = apply_filters( 'wpr_of_font_style', $output['style'] );
204
- $output['color'] = apply_filters( 'wpr_of_sanitize_color', $output['color'] );
205
- return $output;
206
- }
207
- add_filter( 'wpr_of_sanitize_typography', 'wpr_of_sanitize_typography', 10, 2 );
208
-
209
- function wpr_of_sanitize_font_size( $value ) {
210
- $recognized = wpr_of_recognized_font_sizes();
211
- $value_check = preg_replace('/px/','', $value);
212
- if ( in_array( (int) $value_check, $recognized ) ) {
213
- return $value;
214
- }
215
- return apply_filters( 'wpr_of_default_font_size', $recognized );
216
- }
217
- add_filter( 'wpr_of_font_size', 'wpr_of_sanitize_font_size' );
218
-
219
-
220
- function wpr_of_sanitize_font_style( $value ) {
221
- $recognized = wpr_of_recognized_font_styles();
222
- if ( array_key_exists( $value, $recognized ) ) {
223
- return $value;
224
- }
225
- return apply_filters( 'wpr_of_default_font_style', current( $recognized ) );
226
- }
227
- add_filter( 'wpr_of_font_style', 'wpr_of_sanitize_font_style' );
228
-
229
-
230
- function wpr_of_sanitize_font_face( $value ) {
231
- $recognized = wpr_of_recognized_font_faces();
232
- if ( array_key_exists( $value, $recognized ) ) {
233
- return $value;
234
- }
235
- return apply_filters( 'wpr_of_default_font_face', current( $recognized ) );
236
- }
237
- add_filter( 'wpr_of_font_face', 'wpr_of_sanitize_font_face' );
238
-
239
- /**
240
- * Get recognized background repeat settings
241
- *
242
- * @return array
243
- *
244
- */
245
- function wpr_of_recognized_background_repeat() {
246
- $default = array(
247
- 'no-repeat' => __( 'No Repeat', 'textdomain' ),
248
- 'repeat-x' => __( 'Repeat Horizontally', 'textdomain' ),
249
- 'repeat-y' => __( 'Repeat Vertically', 'textdomain' ),
250
- 'repeat' => __( 'Repeat All', 'textdomain' ),
251
- );
252
- return apply_filters( 'wpr_of_recognized_background_repeat', $default );
253
- }
254
-
255
- /**
256
- * Get recognized background positions
257
- *
258
- * @return array
259
- *
260
- */
261
- function wpr_of_recognized_background_position() {
262
- $default = array(
263
- 'top left' => __( 'Top Left', 'textdomain' ),
264
- 'top center' => __( 'Top Center', 'textdomain' ),
265
- 'top right' => __( 'Top Right', 'textdomain' ),
266
- 'center left' => __( 'Middle Left', 'textdomain' ),
267
- 'center center' => __( 'Middle Center', 'textdomain' ),
268
- 'center right' => __( 'Middle Right', 'textdomain' ),
269
- 'bottom left' => __( 'Bottom Left', 'textdomain' ),
270
- 'bottom center' => __( 'Bottom Center', 'textdomain' ),
271
- 'bottom right' => __( 'Bottom Right', 'textdomain')
272
- );
273
- return apply_filters( 'wpr_of_recognized_background_position', $default );
274
- }
275
-
276
- /**
277
- * Get recognized background attachment
278
- *
279
- * @return array
280
- *
281
- */
282
- function wpr_of_recognized_background_attachment() {
283
- $default = array(
284
- 'scroll' => __( 'Scroll Normally', 'textdomain' ),
285
- 'fixed' => __( 'Fixed in Place', 'textdomain')
286
- );
287
- return apply_filters( 'wpr_of_recognized_background_attachment', $default );
288
- }
289
-
290
- /**
291
- * Sanitize a color represented in hexidecimal notation.
292
- *
293
- * @param string Color in hexidecimal notation. "#" may or may not be prepended to the string.
294
- * @param string The value that this function should return if it cannot be recognized as a color.
295
- * @return string
296
- *
297
- */
298
-
299
- function wpr_of_sanitize_hex( $hex, $default = '' ) {
300
- if ( wpr_of_validate_hex( $hex ) ) {
301
- return $hex;
302
- }
303
- return $default;
304
- }
305
-
306
- /**
307
- * Get recognized font sizes.
308
- *
309
- * Returns an indexed array of all recognized font sizes.
310
- * Values are integers and represent a range of sizes from
311
- * smallest to largest.
312
- *
313
- * @return array
314
- */
315
-
316
- function wpr_of_recognized_font_sizes() {
317
- $sizes = range( 9, 71 );
318
- $sizes = apply_filters( 'wpr_of_recognized_font_sizes', $sizes );
319
- $sizes = array_map( 'absint', $sizes );
320
- return $sizes;
321
- }
322
-
323
- /**
324
- * Get recognized font faces.
325
- *
326
- * Returns an array of all recognized font faces.
327
- * Keys are intended to be stored in the database
328
- * while values are ready for display in in html.
329
- *
330
- * @return array
331
- *
332
- */
333
- function wpr_of_recognized_font_faces() {
334
- $default = array(
335
- 'arial' => 'Arial',
336
- 'verdana' => 'Verdana, Geneva',
337
- 'trebuchet' => 'Trebuchet',
338
- 'georgia' => 'Georgia',
339
- 'times' => 'Times New Roman',
340
- 'tahoma' => 'Tahoma, Geneva',
341
- 'palatino' => 'Palatino',
342
- 'helvetica' => 'Helvetica*'
343
- );
344
- return apply_filters( 'wpr_of_recognized_font_faces', $default );
345
- }
346
-
347
- /**
348
- * Get recognized font styles.
349
- *
350
- * Returns an array of all recognized font styles.
351
- * Keys are intended to be stored in the database
352
- * while values are ready for display in in html.
353
- *
354
- * @return array
355
- *
356
- */
357
- function wpr_of_recognized_font_styles() {
358
- $default = array(
359
- 'normal' => __( 'Normal', 'textdomain' ),
360
- 'italic' => __( 'Italic', 'textdomain' ),
361
- 'bold' => __( 'Bold', 'textdomain' ),
362
- 'bold italic' => __( 'Bold Italic', 'textdomain' )
363
- );
364
- return apply_filters( 'wpr_of_recognized_font_styles', $default );
365
- }
366
-
367
- /**
368
- * Is a given string a color formatted in hexidecimal notation?
369
- *
370
- * @param string Color in hexidecimal notation. "#" may or may not be prepended to the string.
371
- * @return bool
372
- *
373
- */
374
-
375
- function wpr_of_validate_hex( $hex ) {
376
- $hex = trim( $hex );
377
- /* Strip recognized prefixes. */
378
- if ( 0 === strpos( $hex, '#' ) ) {
379
- $hex = substr( $hex, 1 );
380
- }
381
- elseif ( 0 === strpos( $hex, '%23' ) ) {
382
- $hex = substr( $hex, 3 );
383
- }
384
- /* Regex match. */
385
- if ( 0 === preg_match( '/^[0-9a-fA-F]{6}$/', $hex ) ) {
386
- return false;
387
- }
388
- else {
389
- return true;
390
- }
391
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/includes/class-wprmenu-framework-admin.php CHANGED
@@ -217,6 +217,7 @@ class WPRMenu_Framework_Admin {
217
  'preview_url' => home_url(),
218
  'enable_preview' => $enable_preview,
219
  'import_error' => __('Something went wrong', 'wprmenu'),
 
220
  );
221
 
222
  wp_localize_script( 'wprmenu-import-demo' , 'wprmenu_params', $params );
@@ -431,12 +432,6 @@ class WPRMenu_Framework_Admin {
431
  // Hook to run after validation
432
  do_action( 'wpr_optionsframework_after_validate', $clean );
433
 
434
- if (isset($_COOKIE['wprmenu_live_preview']) && $_COOKIE['wprmenu_live_preview'] == 'yes' ) {
435
- unset($_COOKIE['wprmenu_live_preview']);
436
- setcookie('wprmenu_live_preview', null, -1, '/');
437
- }
438
-
439
-
440
  return $clean;
441
  }
442
 
217
  'preview_url' => home_url(),
218
  'enable_preview' => $enable_preview,
219
  'import_error' => __('Something went wrong', 'wprmenu'),
220
+ 'nonce' => wp_create_nonce( 'wprmenu-nonce' ),
221
  );
222
 
223
  wp_localize_script( 'wprmenu-import-demo' , 'wprmenu_params', $params );
432
  // Hook to run after validation
433
  do_action( 'wpr_optionsframework_after_validate', $clean );
434
 
 
 
 
 
 
 
435
  return $clean;
436
  }
437
 
inc/js/options-custom.js DELETED
@@ -1,438 +0,0 @@
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
- $('[data-toggle="tooltip"]').tooltip();
12
-
13
- $('.wprmenu-hide-menu-pages').select2();
14
-
15
- // Image Options
16
- $( '.of-radio-img-img' ).click( function(){
17
- $( this ).parent().parent().find( '.of-radio-img-img' ).removeClass( 'of-radio-img-selected' );
18
- $( this ).addClass( 'of-radio-img-selected' );
19
- } );
20
-
21
- $( '.of-radio-img-label' ).hide();
22
- $( '.of-radio-img-img' ).show();
23
- $( '.of-radio-img-radio' ).hide();
24
-
25
- var ProHtml = '<div class="wpr-pro-block"><span><a target="_blank" href="http://magnigenie.com/downloads/wp-responsive-menu-pro/">Upgrade to PRO to use this option</a></span></div>';
26
-
27
- $('#wpr_optionsframework .pro-feature').append(ProHtml);
28
-
29
- $('.pro-feature').hover(function() {
30
- $(this).find('.wpr-pro-block').toggleClass('show');
31
- });
32
-
33
-
34
- $('#wpr-sortable').sortable({
35
- update: function(event, ui) {
36
- var order = [];
37
- $('#wpr-sortable li').each( function(e) {
38
- order.push( $(this).attr('id'));
39
- });
40
- $('#wpr_optionsframework').find('input#order_menu_items').val(order);
41
- }
42
- });
43
-
44
- $("#wpr-sortable").disableSelection();
45
-
46
- $("ul#wpr-sortable li#Social").append('<span class="pro-ftr">[ Available In Pro ]</span>');
47
-
48
-
49
- // Loads tabbed sections if they exist
50
- if ( $( '.nav-tab-wrapper' ).length > 0 ) {
51
- options_framework_tabs();
52
- }
53
-
54
- function options_framework_tabs() {
55
-
56
- var $group = $( '.group' ),
57
- $navtabs = $( '.nav-tab-wrapper a' ),
58
- active_tab = '';
59
-
60
- // Hides all the .group sections to start
61
- $group.hide();
62
-
63
- // Find if a selected tab is saved in localStorage
64
- if ( typeof( localStorage ) != 'undefined' ) {
65
- active_tab = localStorage.getItem( 'active_tab' );
66
- }
67
-
68
- // If active tab is saved and exists, load it's .group
69
- if ( active_tab != '' && $( active_tab ).length ) {
70
- $( active_tab ).fadeIn();
71
- $( active_tab + '-tab' ).addClass( 'nav-tab-active' );
72
- } else {
73
- $( '.group:first' ).fadeIn();
74
- $( '.nav-tab-wrapper a:first' ).addClass( 'nav-tab-active' );
75
- }
76
-
77
- // Bind tabs clicks
78
- $navtabs.click( function( e ) {
79
-
80
- e.preventDefault();
81
-
82
- // Remove active class from all tabs
83
- $navtabs.removeClass( 'nav-tab-active' );
84
-
85
- $( this ).addClass( 'nav-tab-active' ).blur();
86
-
87
- if ( typeof( localStorage ) != 'undefined' ) {
88
- localStorage.setItem( 'active_tab', $( this ).attr( 'href' ) );
89
- }
90
-
91
- var selected = $( this ).attr( 'href' );
92
-
93
- $group.hide();
94
- $( selected ).fadeIn();
95
-
96
- } );
97
- }
98
-
99
-
100
- var slideOpt = $( '#section-slide_type option:selected' ).val();
101
- if ( slideOpt == 'bodyslide' ) {
102
- $( '#section-position option:eq( 2 )' ).css( 'display', 'none' );
103
- $( '#section-position option:eq( 3 )' ).css( 'display', 'none' );
104
- }
105
-
106
- $( '#slide_type' ).change( function() {
107
- if ( $( this ).val() == 'bodyslide' ) {
108
- $( '#section-position option:eq( 2 )' ).css( 'display', 'none' );
109
- $( '#section-position option:eq( 3 )' ).css( 'display', 'none' );
110
- }
111
- else {
112
- $( '#section-position option:eq( 2 )' ).css( 'display', 'block' );
113
- $( '#section-position option:eq( 3 )' ).css( 'display', 'block' );
114
- }
115
- } )
116
-
117
- var menutype = $( "input[name='wprmenu_options[menu_type]']:checked" ).val();
118
- if ( menutype == 'default' ) {
119
- $( '#section-custom_menu_top' ).css( 'display', 'none' );
120
- $( '#section-custom_menu_left' ).css( 'display', 'none' );
121
- $( '#section-custom_menu_bg_color' ).css( 'display', 'none' );
122
- }
123
-
124
-
125
- $( '#section-menu_type input' ).on( 'change', function() {
126
- var menuType = $( 'input[name="wprmenu_options[menu_type]"]:checked', '#section-menu_type' ).val();
127
-
128
- if ( menuType == 'default' ) {
129
- $( '#section-custom_menu_top' ).css( 'display', 'none' );
130
- $( '#section-custom_menu_left' ).css( 'display', 'none' );
131
- $( '#section-custom_menu_bg_color' ).css( 'display', 'none' );
132
- }
133
- else {
134
- $( '#section-custom_menu_top' ).css( 'display', 'block' );
135
- $( '#section-custom_menu_left' ).css( 'display', 'block' );
136
- $( '#section-custom_menu_bg_color' ).css( 'display', 'block' );
137
- }
138
- });
139
-
140
- //Live Preview Opts
141
- $('body').on('click', '.live-preview-badge', function() {
142
- $(this).toggleClass('expand');
143
- var IFrame = $(this).parents('.queries-holder.live-preview').find('iframe#wpr_iframe');
144
- IFrame.contents().find('#wpadminbar').remove();
145
- IFrame.contents().find('#wprmenu_bar').css('top','0px');
146
- IFrame.contents().find('body').removeClass("admin-bar ");
147
-
148
-
149
- $('div.live-preview-container').toggleClass('disable');
150
-
151
- if( ! $('div.live-preview-container').hasClass('disable') ) {
152
- $('div.live-preview-container').animate({ "right": "3px" }, "speed" );
153
- $('div.live-preview-badge').css('position','relative');
154
- $('div.live-preview-badge').css('top','307');
155
- $('div.live-preview-badge').animate({ "right": "292" }, "speed" );
156
- $(this).parent('.queries-holder.live-preview').find('.live-preview-badge').text('Hide Live Preview');
157
- }
158
- else {
159
- $('div.live-preview-badge').css('position','fixed');
160
- $('div.live-preview-badge').css('top','307');
161
- $('div.live-preview-badge').animate({ "right": "-66px" }, "speed" );
162
- $('div.live-preview-container').animate({ "right": "-400px" }, "speed" );
163
- $(this).parent('.queries-holder.live-preview').find('.live-preview-badge').text('Show Live Preview');
164
- }
165
-
166
- if( $(this).hasClass('expand') ) {
167
- $('html, body').animate({
168
- scrollTop: $("#wpr_optionsframework-metabox").offset().top-60
169
- }, 1000);
170
- }
171
- });
172
-
173
- //Demo import section
174
- $('body').on('click', '.wprmenu-data.import-demo', function(e) {
175
- e.preventDefault();
176
- var SelectedButton = $(this);
177
- var SelectedButtonText = $(this).text();
178
- var SelectedNode = $(this).parents('.wprmenu-content').find('.wprmenu-content-image');
179
- var DemoType = SelectedNode.attr('data-demo-type');
180
- var DemoId = SelectedNode.attr('data-demo-id');
181
- var SettingsId = SelectedNode.attr('data-settings');
182
-
183
- if( SelectedNode.hasClass('free-version') ) {
184
- Swal({
185
- type : 'info',
186
- title : wprOption.pro_version_text,
187
- text : wprOption.pro_version_upgrade_error,
188
- });
189
- return;
190
- }
191
-
192
- if( SettingsId !== ''
193
- && DemoType !== ''
194
- && DemoId !== '' ) {
195
- SelectedButton.text(wprOption.please_wait);
196
-
197
- $.ajax({
198
- type : 'POST',
199
- url : wprOption.ajax_url,
200
- nonce : wprOption.nonce,
201
- data : 'settings_id='+ SettingsId + '&demo_id=' + DemoId + '&demo_type=' + DemoType + '&action=wprmenu_import_data',
202
- success : function(response) {
203
- response = $.parseJSON(response);
204
-
205
- if( response.status == 'success' ) {
206
- wprmenu_setCookie('wprmenu_live_preview', '', 1);
207
- Swal({
208
- type : 'success',
209
- title : wprOption.import_done,
210
- text : wprOption.please_reload,
211
- }).then(function () {
212
- location.reload();
213
- }).catch(swal.noop);
214
-
215
- SelectedButton.text(wprOption.import_done);
216
- }
217
- else {
218
- Swal({
219
- type : 'error',
220
- title : wprOption.import_error_title,
221
- text : wprOption.import_error,
222
- });
223
- SelectedButton.text(wprOption.import_error);
224
- }
225
- }
226
- });
227
- }
228
- });
229
-
230
- $('.wprmenu-showcase-wrapper').find('li.wprmenu-data-list').hover(function() {
231
- $(this).find('.wprmenu-content').toggleClass('overlay');
232
- $(this).find('.wprmenu-content').toggleClass('image-overlay');
233
- });
234
-
235
- //Get Live Preview
236
- $('body').on('click', '.wpr-load-priv', function() {
237
-
238
- var Selected = $(this);
239
- var OldText = Selected.text();
240
- Selected.text(wprOption.loading_preview);
241
-
242
- var wpr_data = $('div#wpr_optionsframework form').serialize();
243
-
244
- $('div.smartphone-content').find('.overlay').removeClass('hide');
245
- $('div.smartphone-content').find('.overlay').addClass('show');
246
-
247
- $.ajax({
248
- type : 'POST',
249
- url : wprOption.ajax_url,
250
- nonce : wprOption.nonce,
251
- data : wpr_data + '&action=wpr_live_update',
252
- success : function(response) {
253
-
254
- wprmenu_setCookie('wprmenu_live_preview', 'yes', 1);
255
-
256
- $('div.smartphone-content iframe').attr('src', wprOption.site_url);
257
-
258
- setTimeout(function() {
259
- $('div.smartphone-content iframe').contents().find('#wpadminbar').remove();
260
- $('div.smartphone-content iframe').contents().find('#wprmenu_bar').css('top','0px');
261
- $('div.smartphone-content iframe').contents().find('body').removeClass('admin-bar');
262
- $('div.smartphone-content').find('.overlay').removeClass('show');
263
- $('div.smartphone-content').find('.overlay').addClass('hide');
264
- }, 2000);
265
-
266
- Selected.text(wprOption.preview_done);
267
- Selected.text(OldText);
268
- }
269
- });
270
- });
271
-
272
- // Set Cookie
273
- function wprmenu_setCookie(cname, cvalue, exdays) {
274
- var d = new Date();
275
- d.setTime(d.getTime() + (exdays*24*60*60*1000));
276
- var expires = "expires="+d.toUTCString();
277
- document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";
278
- }
279
-
280
- // Get Cookie
281
- function wprmenu_getCookie(cname) {
282
- var name = cname + "=";
283
- var ca = document.cookie.split(';');
284
- for(var i=0; i<ca.length; i++) {
285
- var c = ca[i];
286
- while (c.charAt(0)==' ') c = c.substring(1);
287
- if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
288
- }
289
- return "";
290
- }
291
-
292
- //Add ACE to Editor
293
- var container = jQuery('#wpr_custom_css');
294
- container.width( container.parent().width() ).height( 200 );
295
-
296
- var editor = ace.edit( "wpr_custom_css" );
297
-
298
- container.css('width', 'auto');
299
- editor.setValue(container.siblings('textarea').val());
300
- editor.setTheme("ace/theme/chrome");
301
- editor.getSession().setMode('ace/mode/css');
302
- editor.setShowPrintMargin(false);
303
- editor.setHighlightActiveLine(false);
304
- editor.gotoLine(1);
305
- editor.session.setUseWorker(false);
306
-
307
-
308
- editor.getSession().on('change', function(e) {
309
- $(editor.container).siblings('textarea').val(editor.getValue());
310
- });
311
-
312
-
313
- function createIconpicker() {
314
- var iconPicker = $('.wpr-icon-picker').fontIconPicker({
315
- theme: 'fip-bootstrap'
316
- }),icomoon_json_icons = [],
317
- icomoon_json_search = [];
318
- // Get the JSON file
319
- $.ajax({
320
- url: wprOption.options_path + '/icons/selection.json',
321
- type: 'GET',
322
- dataType: 'json'
323
- })
324
- .done(function(response) {
325
- // Get the class prefix
326
- var classPrefix = response.preferences.fontPref.prefix;
327
-
328
- $.each(response.icons, function(i, v) {
329
- // Set the source
330
- icomoon_json_icons.push( classPrefix + v.properties.name );
331
-
332
- // Create and set the search source
333
- if ( v.icon && v.icon.tags && v.icon.tags.length ) {
334
- icomoon_json_search.push( v.properties.name + ' ' + v.icon.tags.join(' ') );
335
- } else {
336
- icomoon_json_search.push( v.properties.name );
337
- }
338
- });
339
-
340
- setTimeout(function() {
341
- // Set new fonts
342
- iconPicker.setIcons(icomoon_json_icons, icomoon_json_search);
343
-
344
- }, 1000);
345
- })
346
- .fail(function() {
347
- // Show error message and enable
348
- alert('Failed to load the icons, Please check file permission.');
349
- });
350
- }
351
- createIconpicker();
352
-
353
- $.exitIntent('enable');
354
-
355
- $(document).bind('exitintent', function() {
356
- $check_cookie = wprmenu_getCookie('wprmenu_live_preview');
357
-
358
- if( $check_cookie !== 'yes' )
359
- return;
360
-
361
- const swalWithBootstrapButtons = Swal.mixin({
362
- confirmButtonClass: 'btn btn-primary',
363
- cancelButtonClass: 'btn btn-secondary',
364
- buttonsStyling: false,
365
- })
366
-
367
- swalWithBootstrapButtons({
368
- title: '<strong>'+wprOption.navigating_away+'</strong>',
369
- type: 'info',
370
- html: wprOption.confirm_message,
371
- showCloseButton: true,
372
- showCancelButton: true,
373
- focusConfirm: false,
374
- confirmButtonText:'Save Changes',
375
- cancelButtonText: 'Don\'t Save Changes'
376
- }).then((result) => {
377
- if (result.value) {
378
- $.ajax({
379
- type : 'POST',
380
- url : wprOption.ajax_url,
381
- nonce : wprOption.nonce,
382
- data : 'action=wpr_get_transient_from_data',
383
- success : function(response) {
384
- response = $.parseJSON(response);
385
-
386
- if( response.status == 'success' ) {
387
- wprmenu_setCookie('wprmenu_live_preview', '', 1);
388
-
389
- swalWithBootstrapButtons(
390
- 'Options Saved!',
391
- 'The options has been saved. Please reload this page by doing click on the button below. ',
392
- 'success'
393
- ).then(function () {
394
- location.reload();
395
- }).catch(swal.noop);
396
- }
397
- else {
398
- Swal({
399
- type : 'error',
400
- title : wprOption.import_error_title,
401
- text : wprOption.import_error,
402
- });
403
- }
404
- }
405
- });
406
- } else if (
407
- result.dismiss === Swal.DismissReason.cancel
408
- ) {
409
- swalWithBootstrapButtons(
410
- 'Options not saved',
411
- 'The recent changes are reverted back',
412
- 'error'
413
- )
414
- }
415
- })
416
- });
417
-
418
- //Hide top and bottom options when push menu is activated
419
- var MenuSlideStyle = $( "input[name='wprmenu_options[slide_type]']:checked" ).val();
420
- if( MenuSlideStyle == 'bodyslide' ) {
421
- $( 'label[for="wprmenu_options-position-top"]' ).css( 'display', 'none' );
422
- $( 'label[for="wprmenu_options-position-bottom"]' ).css( 'display', 'none' );
423
- }
424
-
425
- $( '#section-slide_type input' ).on( 'change', function() {
426
- var SlideType = $( 'input[name="wprmenu_options[slide_type]"]:checked' ).val();
427
-
428
- if ( SlideType == 'bodyslide' ) {
429
- $( 'label[for="wprmenu_options-position-top"]' ).css( 'display', 'none' );
430
- $( 'label[for="wprmenu_options-position-bottom"]' ).css( 'display', 'none' );
431
- }
432
- else {
433
- $( 'label[for="wprmenu_options-position-top"]' ).css( 'display', 'block' );
434
- $( 'label[for="wprmenu_options-position-bottom"]' ).css( 'display', 'block' );
435
- }
436
- });
437
-
438
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/templates/default-menu-bar.php CHANGED
@@ -14,8 +14,8 @@ $logo_link = isset( $data['logo_link'] ) ? $data['logo_link'] : '';
14
  $bar_logo = isset( $data['bar_logo'] ) ? $data['bar_logo'] : '';
15
 
16
  ?>
17
- <div id="wprmenu_bar" class="wprmenu_bar <?php echo $slide_type . ' '. $position; ?>">
18
- <div class="hamburger <?php echo $menu_icon_animation; ?>">
19
  <span class="hamburger-box">
20
  <span class="hamburger-inner"></span>
21
  </span>
@@ -24,15 +24,15 @@ $bar_logo = isset( $data['bar_logo'] ) ? $data['bar_logo'] : '';
24
  <?php
25
  if( $this->option( 'bar_logo' ) == ''
26
  && $logo_link !== '' ) : ?>
27
- <a href="<?php echo $logo_link; ?>">
28
- <?php echo $menu_title; ?>
29
  </a>
30
  <?php else: ?>
31
- <?php echo $menu_title; ?>
32
  <?php endif; ?>
33
  <?php
34
  if( $this->option('bar_logo') != '' ) :
35
- echo '<a href="'.$logo_link.'"><img class="bar_logo" alt="logo" src="'.$this->option('bar_logo').'"/></a>';
36
  endif;
37
  ?>
38
  </div>
14
  $bar_logo = isset( $data['bar_logo'] ) ? $data['bar_logo'] : '';
15
 
16
  ?>
17
+ <div id="wprmenu_bar" class="wprmenu_bar <?php echo esc_html( $slide_type . ' '. $position ); ?>">
18
+ <div class="hamburger <?php echo esc_html( $menu_icon_animation ); ?>">
19
  <span class="hamburger-box">
20
  <span class="hamburger-inner"></span>
21
  </span>
24
  <?php
25
  if( $this->option( 'bar_logo' ) == ''
26
  && $logo_link !== '' ) : ?>
27
+ <a href="<?php echo esc_url( $logo_link ); ?>">
28
+ <?php echo esc_html( $menu_title ); ?>
29
  </a>
30
  <?php else: ?>
31
+ <?php echo esc_html( $menu_title ); ?>
32
  <?php endif; ?>
33
  <?php
34
  if( $this->option('bar_logo') != '' ) :
35
+ echo '<a href="'. esc_url( $logo_link ).'"><img class="bar_logo" alt="logo" src="' . esc_url( $this->option('bar_logo') ) . '"/></a>';
36
  endif;
37
  ?>
38
  </div>
inc/templates/menu-elements.php CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) || exit;
10
  <ul id="wprmenu_menu_ul">
11
  <?php
12
  if ( $this->option( 'content_before_menu_element' ) !== '' ) :
13
- $content_before_menu_elements = preg_replace( '/\\\\/', '', $this->option( 'content_before_menu_element' ) );
14
  ?>
15
  <li class="wprm_before_menu_content"><?php echo apply_filters( 'wpr_content_before_menu_element', $content_before_menu_element ); ?></li>
16
  <?php endif; ?>
10
  <ul id="wprmenu_menu_ul">
11
  <?php
12
  if ( $this->option( 'content_before_menu_element' ) !== '' ) :
13
+ $content_before_menu_element = preg_replace( '/\\\\/', '', $this->option( 'content_before_menu_element' ) );
14
  ?>
15
  <li class="wprm_before_menu_content"><?php echo apply_filters( 'wpr_content_before_menu_element', $content_before_menu_element ); ?></li>
16
  <?php endif; ?>
inc/templates/menu-title.php CHANGED
@@ -10,8 +10,8 @@ $menu_title = isset( $data['menu_title'] ) ? $data['menu_title'] : '';
10
  $bar_logo = isset( $data['bar_logo'] ) ? $data['bar_logo'] : '';
11
  ?>
12
  <div class="menu_title">
13
- <?php echo $menu_title; ?>
14
- <?php if ( $bar_logo ) : ?>
15
- <img class="bar_logo" alt="logo" src="<?php echo $bar_logo; ?>"/>'
16
  <?php endif; ?>
17
  </div>
10
  $bar_logo = isset( $data['bar_logo'] ) ? $data['bar_logo'] : '';
11
  ?>
12
  <div class="menu_title">
13
+ <?php echo esc_html( $menu_title ); ?>
14
+ <?php if ( !empty( $bar_logo ) ) : ?>
15
+ <img class="bar_logo" alt="logo" src="<?php echo esc_url( $bar_logo ); ?>"/>'
16
  <?php endif; ?>
17
  </div>
inc/templates/search-form.php CHANGED
@@ -12,7 +12,7 @@ $unique_id = esc_attr( uniqid( 'search-form-' ) );
12
  ?>
13
  <form role="search" method="get" class="wpr-search-form" action="<?php echo esc_url( home_url( '/' ) ) ?>">
14
  <label for="<?php echo $unique_id; ?>"></label>
15
- <input type="search" class="wpr-search-field" placeholder="<?php echo $search_placeholder; ?>" value="" name="s" title="Search for:">
16
  <button type="submit" class="wpr_submit">
17
  <i class="wpr-icon-search"></i>
18
  </button>
12
  ?>
13
  <form role="search" method="get" class="wpr-search-form" action="<?php echo esc_url( home_url( '/' ) ) ?>">
14
  <label for="<?php echo $unique_id; ?>"></label>
15
+ <input type="search" class="wpr-search-field" placeholder="<?php echo esc_html( $search_placeholder ); ?>" value="" name="s" title="<?php echo esc_html( $search_placeholder ); ?>">
16
  <button type="submit" class="wpr_submit">
17
  <i class="wpr-icon-search"></i>
18
  </button>
inc/wprmclass.php DELETED
@@ -1,673 +0,0 @@
1
- <?php
2
- class WP_Responsive_Menu {
3
-
4
- protected $options = '';
5
-
6
- public $translatables = array(
7
- 'search_box_text',
8
- 'bar_title'
9
- );
10
-
11
- /**
12
- * Bootstraps the class and hooks required actions & filters.
13
- */
14
- public function __construct() {
15
- add_action( 'wp_enqueue_scripts', array( $this, 'wprm_enque_scripts' ) );
16
- add_action( 'wp_footer', array( $this, 'wprmenu_menu' ) );
17
-
18
- //Load wp responsive menu settings
19
- $this->options = get_option( 'wprmenu_options' );
20
-
21
- add_action( 'plugins_loaded', array($this, 'wprmenu_register_strings'));
22
-
23
- add_action( 'wp_ajax_wpr_live_update', array($this, 'wpr_live_update'));
24
-
25
- add_action( 'wp_footer', array($this, 'wpr_custom_css') );
26
-
27
- add_action( 'wp_ajax_wprmenu_import_data', array($this, 'wprmenu_import_data') );
28
-
29
- add_action( 'wp_ajax_wpr_get_transient_from_data', array($this, 'wpr_get_transient_from_data') );
30
- }
31
-
32
- public function option( $option ){
33
- if( isset($_COOKIE['wprmenu_live_preview'])
34
- && $_COOKIE['wprmenu_live_preview'] == 'yes' ) {
35
- $check_transient = get_transient('wpr_live_settings');
36
-
37
- if( $check_transient ) {
38
- if( isset( $check_transient[$option] )
39
- && $check_transient[$option] != '' ) {
40
- return $check_transient[$option];
41
- }
42
- }
43
- }
44
- else {
45
- if( isset( $this->options[$option] ) && $this->options[$option] != '' )
46
- return $this->options[$option];
47
- return '';
48
- }
49
- }
50
-
51
- public function wprmenu_register_strings() {
52
- if( is_admin() ) :
53
- if( function_exists('pll_register_string') ) :
54
- pll_register_string('search_box_text', $this->option('search_box_text'), 'WP Responsive Menu');
55
- pll_register_string('bar_title', $this->option('bar_title'), 'WP Responsive Menu');
56
- endif;
57
- endif;
58
- }
59
-
60
- function hex2rgba($color, $opacity = false) {
61
- $default = 'rgb(0,0,0)';
62
-
63
- //Return default if no color provided
64
- if(empty($color))
65
- return $default;
66
-
67
- //Sanitize $color if "#" is provided
68
- if ($color[0] == '#' ) {
69
- $color = substr( $color, 1 );
70
- }
71
-
72
- //Check if color has 6 or 3 characters and get values
73
- if (strlen($color) == 6) {
74
- $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
75
- } elseif ( strlen( $color ) == 3 ) {
76
- $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
77
- } else {
78
- return $default;
79
- }
80
-
81
- //Convert hexadec to rgb
82
- $rgb = array_map('hexdec', $hex);
83
-
84
- //Check if opacity is set(rgba or rgb)
85
- if($opacity){
86
- if(abs($opacity) > 1)
87
- $opacity = 1.0;
88
- $output = 'rgba('.implode(",",$rgb).','.$opacity.')';
89
- } else {
90
- $output = 'rgb('.implode(",",$rgb).')';
91
- }
92
-
93
- //Return rgb(a) color string
94
- return $output;
95
- }
96
-
97
- /**
98
- *
99
- * Added inline style to the responsive menu
100
- *
101
- */
102
- public function inlineCss() {
103
- $inlinecss = '';
104
- if( $this->option('enabled') ) :
105
- $from_width = $this->option('from_width') != '' ? $this->option('from_width') : '768';
106
- $inlinecss .= '@media only screen and ( max-width: '.$from_width.'px ) {';
107
- $how_wide = $this->option('how_wide') != '' ? $this->option('how_wide') : '40';
108
- $menu_max_width = $this->option('menu_max_width');
109
-
110
- $border_top_color = $this->hex2rgba($this->option("menu_border_top"), $this->option("menu_border_top_opacity"));
111
-
112
- $border_bottom_color = $this->hex2rgba($this->option("menu_border_bottom"), $this->option("menu_border_bottom_opacity"));
113
- $menu_title_font = $this->option('menu_title_size') == '' ? '20' : $this->option('menu_title_size');
114
-
115
- $inlinecss .= 'html body div.wprm-wrapper {
116
- overflow: scroll;
117
- }';
118
-
119
- //manu background image
120
- if( $this->option('menu_bg') != '' ) :
121
- $inlinecss .= '#mg-wprm-wrap {
122
- background-image: url( '.$this->option("menu_bg").');
123
- background-size: '.$this->option("menu_bg_size").';
124
- background-repeat: '.$this->option("menu_bg_rep").';
125
- }';
126
- endif;
127
-
128
- if( $this->option('enable_overlay') == '1' ) :
129
- $overlay_bg_color = $this->hex2rgba($this->option("menu_bg_overlay_color"), $this->option("menu_background_overlay_opacity"));
130
- $inlinecss .= 'html body div.wprm-overlay{ background: '.$overlay_bg_color .' }';
131
- endif;
132
-
133
- if( $this->option('menu_border_bottom_show') == 'yes' ):
134
- $inlinecss .= '
135
- #mg-wprm-wrap ul li {
136
- border-top: solid 1px '.$border_top_color.';
137
- border-bottom: solid 1px '.$border_bottom_color.';
138
- }
139
- ';
140
- endif;
141
-
142
- if( $this->option('menu_bar_bg') != '' ) :
143
- $inlinecss .= '
144
- #wprmenu_bar {
145
- background-image: url( '.$this->option("menu_bar_bg").' );
146
- background-size: '.$this->option("menu_bar_bg_size").' ;
147
- background-repeat: '.$this->option("menu_bar_bg_rep").';
148
- }
149
- ';
150
- endif;
151
- if( $menu_title_font > 26 )
152
- $inlinecss .= '#wprmenu_bar .menu_title a{ top: 0; }';
153
- $inlinecss .= '
154
- #wprmenu_bar {
155
- background-color: '.$this->option("bar_bgd").';
156
- }
157
-
158
- html body div#mg-wprm-wrap .wpr_submit .icon.icon-search {
159
- color: '.$this->option("search_icon_color").';
160
- }
161
- #wprmenu_bar .menu_title, #wprmenu_bar .wprmenu_icon_menu {
162
- color: '.$this->option("bar_color").';
163
- }
164
- #wprmenu_bar .menu_title {
165
- font-size: '.$menu_title_font.'px;
166
- font-weight: '.$this->option('menu_title_weight').';
167
- }
168
- #mg-wprm-wrap li.menu-item a {
169
- font-size: '.$this->option('menu_font_size').'px;
170
- text-transform: '.$this->option('menu_font_text_type').';
171
- font-weight: '.$this->option('menu_font_weight').';
172
- }
173
- #mg-wprm-wrap li.menu-item-has-children ul.sub-menu a {
174
- font-size: '.$this->option('sub_menu_font_size').'px;
175
- text-transform: '.$this->option('sub_menu_font_text_type').';
176
- font-weight: '.$this->option('sub_menu_font_weight').';
177
- }
178
- #mg-wprm-wrap li.current-menu-item > a {
179
- background: '.$this->option('active_menu_bg_color').';
180
- }
181
- #mg-wprm-wrap li.current-menu-item > a,
182
- #mg-wprm-wrap li.current-menu-item span.wprmenu_icon{
183
- color: '.$this->option('active_menu_color').' !important;
184
- }
185
- #mg-wprm-wrap {
186
- background-color: '.$this->option("menu_bgd").';
187
- }
188
- .cbp-spmenu-push-toright {
189
- left: '.$how_wide.'% ;
190
- }
191
- .cbp-spmenu-push-toright .mm-slideout {
192
- left:'.$how_wide.'% ;
193
- }
194
- .cbp-spmenu-push-toleft {
195
- left: -'.$how_wide.'% ;
196
- }
197
- #mg-wprm-wrap.cbp-spmenu-right,
198
- #mg-wprm-wrap.cbp-spmenu-left,
199
- #mg-wprm-wrap.cbp-spmenu-right.custom,
200
- #mg-wprm-wrap.cbp-spmenu-left.custom,
201
- .cbp-spmenu-vertical {
202
- width: '.$how_wide.'%;
203
- max-width: '.$menu_max_width.'px;
204
- }
205
- #mg-wprm-wrap ul#wprmenu_menu_ul li.menu-item a,
206
- div#mg-wprm-wrap ul li span.wprmenu_icon {
207
- color: '.$this->option("menu_color").' !important;
208
- }
209
- #mg-wprm-wrap ul#wprmenu_menu_ul li.menu-item a:hover {
210
- background: '.$this->option("menu_textovrbgd").';
211
- color: '.$this->option("menu_color_hover").' !important;
212
- }
213
- div#mg-wprm-wrap ul>li:hover>span.wprmenu_icon {
214
- color: '.$this->option("menu_color_hover").' !important;
215
- }
216
- .wprmenu_bar .hamburger-inner, .wprmenu_bar .hamburger-inner::before, .wprmenu_bar .hamburger-inner::after {
217
- background: '.$this->option("menu_icon_color").';
218
- }
219
- .wprmenu_bar .hamburger:hover .hamburger-inner, .wprmenu_bar .hamburger:hover .hamburger-inner::before,
220
- .wprmenu_bar .hamburger:hover .hamburger-inner::after {
221
- background: '.$this->option("menu_icon_hover_color").';
222
- }
223
- ';
224
-
225
- if( $this->option('menu_symbol_pos') == 'left' ) :
226
- $inlinecss .= 'div.wprmenu_bar div.hamburger{padding-right: 6px !important;}';
227
- endif;
228
-
229
- if( $this->option("menu_border_bottom_show") == 'no' ):
230
- $inlinecss .= '
231
- #wprmenu_menu, #wprmenu_menu ul, #wprmenu_menu li, .wprmenu_no_border_bottom {
232
- border-bottom:none;
233
- }
234
- #wprmenu_menu.wprmenu_levels ul li ul {
235
- border-top:none;
236
- }
237
- ';
238
- endif;
239
-
240
- $inlinecss .= '
241
- #wprmenu_menu.left {
242
- width:'.$how_wide.'%;
243
- left: -'.$how_wide.'%;
244
- right: auto;
245
- }
246
- #wprmenu_menu.right {
247
- width:'.$how_wide.'%;
248
- right: -'.$how_wide.'%;
249
- left: auto;
250
- }
251
- ';
252
-
253
- if( $this->option("menu_symbol_pos") == 'right' ) :
254
- $inlinecss .= '
255
- .wprmenu_bar .hamburger {
256
- float: '.$this->option("menu_symbol_pos").';
257
- }
258
- .wprmenu_bar #custom_menu_icon.hamburger {
259
- top: '.$this->option("custom_menu_top").'px;
260
- right: '.$this->option("custom_menu_left").'px;
261
- float: right;
262
- background-color: '.$this->option("custom_menu_bg_color").';
263
- }
264
- ';
265
- endif;
266
-
267
- if( $this->option('menu_icon_type') == 'default' ) :
268
- $menu_padding = $this->option("header_menu_height");
269
- $menu_padding = intval($menu_padding);
270
-
271
- if( $menu_padding > 50 ) {
272
- $menu_padding = $menu_padding - 27;
273
- $menu_padding = $menu_padding / 2;
274
- $top_position = $menu_padding + 30;
275
-
276
- $inlinecss .= 'html body div#wprmenu_bar {
277
- padding-top: '.$menu_padding.'px;
278
- padding-bottom: '.$menu_padding.'px;
279
- }';
280
-
281
- if( $this->option('menu_type') == 'default' ) {
282
- $inlinecss .= '.wprmenu_bar div.wpr_search form {
283
- top: '.$top_position.'px;
284
- }';
285
- }
286
- }
287
-
288
- $inlinecss .= 'html body div#wprmenu_bar {
289
- height : '.$this->option("header_menu_height").'px;
290
- }';
291
- endif;
292
-
293
- if( $this->option('menu_type') == 'default' ) :
294
- $inlinecss .= '#mg-wprm-wrap.cbp-spmenu-left, #mg-wprm-wrap.cbp-spmenu-right, #mg-widgetmenu-wrap.cbp-spmenu-widget-left, #mg-widgetmenu-wrap.cbp-spmenu-widget-right {
295
- top: '.$this->option("header_menu_height").'px !important;
296
- }';
297
- endif;
298
-
299
- if( $this->option("menu_symbol_pos") == 'left' ) :
300
- $inlinecss .= '
301
- .wprmenu_bar .hamburger {
302
- float: '.$this->option("menu_symbol_pos").';
303
- }
304
- .wprmenu_bar #custom_menu_icon.hamburger {
305
- top: '.$this->option("custom_menu_top").'px;
306
- left: '.$this->option("custom_menu_left").'px;
307
- float: left !important;
308
- background-color: '.$this->option("custom_menu_bg_color").';
309
- }
310
- ';
311
- endif;
312
- if( $this->option('hide') != '' ):
313
- $inlinecss .= $this->option('hide').'{ display: none !important; }';
314
- endif;
315
- $inlinecss .= '.custMenu #custom_menu_icon {
316
- display: block;
317
- }';
318
- if( $this->option("menu_type") != 'custom' ) :
319
- $inlinecss .= 'html { padding-top: 42px !important; }';
320
- endif;
321
- $inlinecss .= '#wprmenu_bar,#mg-wprm-wrap { display: block; }
322
- div#wpadminbar { position: fixed; }';
323
-
324
- $inlinecss .= '}';
325
- endif;
326
- return $inlinecss;
327
-
328
- }
329
-
330
- /**
331
- *
332
- * Add necessary js and css for our wp responsive menu
333
- *
334
- * @since 1.0.2
335
- * @param blank
336
- * @return array
337
- */
338
- public function wprm_enque_scripts() {
339
- //hamburger menu icon style
340
- wp_enqueue_style( 'hamburger.css' , plugins_url().'/wp-responsive-menu/css/wpr-hamburger.css', array(), '1.0' );
341
- //menu css
342
- wp_enqueue_style( 'wprmenu.css' , plugins_url().'/wp-responsive-menu/css/wprmenu.css', array(), '1.0' );
343
-
344
- //menu css
345
- wp_enqueue_style( 'wpr_icons', plugins_url().'/wp-responsive-menu/inc/icons/style.css', array(), '1.0' );
346
-
347
- //inline css
348
- wp_add_inline_style( 'wprmenu.css', $this->inlineCss() );
349
-
350
- //mordenizer js
351
- wp_enqueue_script( 'modernizr', plugins_url(). '/wp-responsive-menu/js/modernizr.custom.js', array( 'jquery' ), '1.0' );
352
-
353
- //touchswipe js
354
- wp_enqueue_script( 'touchSwipe', plugins_url(). '/wp-responsive-menu/js/jquery.touchSwipe.min.js', array( 'jquery' ), '1.0' );
355
-
356
- //wprmenu js
357
- wp_enqueue_script('wprmenu.js', plugins_url( '/wp-responsive-menu/js/wprmenu.js'), array( 'jquery', 'touchSwipe' ), '1.0' );
358
-
359
- $wpr_options = array(
360
- 'zooming' => $this->option('zooming'),
361
- 'from_width' => $this->option('from_width'),
362
- 'push_width' => $this->option('menu_max_width'),
363
- 'menu_width' => $this->option('how_wide'),
364
- 'parent_click' => $this->option('parent_click'),
365
- 'swipe' => $this->option('swipe'),
366
- 'enable_overlay' => $this->option('enable_overlay'),
367
- );
368
- //Localize necessary variables
369
- wp_localize_script( 'wprmenu.js', 'wprmenu', $wpr_options );
370
- }
371
-
372
- /**
373
- *
374
- * WordPress deafult search form
375
- *
376
- * @since 3.0.4
377
- * @param blank
378
- * @return html
379
- */
380
- public function wpr_search_form() {
381
- $search_placeholder = $this->option('search_box_text');
382
- $search_placeholder = function_exists('pll__') ? pll__($search_placeholder) : $search_placeholder;
383
- $unique_id = esc_attr( uniqid( 'search-form-' ) );
384
- return '<form role="search" method="get" class="wpr-search-form" action="' . site_url() . '"><label for="'.$unique_id.'"></label><input type="search" class="wpr-search-field" placeholder="' . $search_placeholder . '" value="" name="s" title="Search for:"><button type="submit" class="wpr_submit"><i class="wpr-icon-search"></i></button></form>';
385
- }
386
-
387
- /**
388
- *
389
- * Outputs Responsive Menu Html
390
- *
391
- * @since 1.0
392
- * @param empty
393
- * @return html
394
- */
395
- public function wprmenu_menu() {
396
- if( $this->option('enabled') ) :
397
- $openDirection = $this->option('position');
398
-
399
- $menu_title = $this->option('bar_title');
400
- $menu_title = function_exists('pll__') ? pll__($menu_title) : $menu_title;
401
-
402
- $menu_icon_animation = $this->option('menu_icon_animation') != '' ? $this->option('menu_icon_animation') : 'hamburger--slider';
403
- ?>
404
-
405
- <div class="wprm-wrapper">
406
- <?php
407
- if( $this->option('enable_overlay') == '1' ) : ?>
408
- <div class="wprm-overlay"></div>
409
- <?php endif; ?>
410
-
411
- <?php
412
- if( $this->option('menu_type') == 'custom' ): ?>
413
- <div class="wprmenu_bar custMenu <?php echo $this->option('slide_type'); echo ' '.$this->option('position'); ?>">
414
- <div id="custom_menu_icon" class="hamburger <?php echo $menu_icon_animation; ?>">
415
- <span class="hamburger-box">
416
- <span class="hamburger-inner"></span>
417
- </span>
418
- </div>
419
- </div>
420
- <?php else: ?>
421
- <div id="wprmenu_bar" class="wprmenu_bar <?php echo $this->option('slide_type'); echo ' '.$this->option('position'); ?>">
422
-
423
- <div class="hamburger <?php echo $menu_icon_animation; ?>">
424
- <span class="hamburger-box">
425
- <span class="hamburger-inner"></span>
426
- </span>
427
- </div>
428
- <div class="menu_title">
429
- <?php
430
- if( $this->option('bar_logo') == '' && $this->option('logo_link') !== '' ) : ?>
431
- <a href="<?php echo $this->option('logo_link'); ?>"><?php echo $menu_title; ?></a>
432
- <?php else: ?>
433
- <?php echo $menu_title; ?>
434
- <?php endif; ?>
435
- <?php
436
- $logo_link = $this->option('logo_link') != '' ? $this->option('logo_link') : get_site_url();
437
- if( $this->option('bar_logo') != '' ) :
438
- echo '<a href="'.$logo_link.'"><img class="bar_logo" alt="logo" src="'.$this->option('bar_logo').'"/></a>';
439
- endif;
440
- ?>
441
- </div>
442
- </div>
443
- <?php endif; ?>
444
-
445
- <div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-<?php echo $openDirection; ?> <?php echo $this->option('menu_type'); ?> " id="mg-wprm-wrap">
446
- <?php if( $this->option('menu_type') == 'custom' ): ?>
447
- <div class="menu_title">
448
- <?php echo $menu_title; ?>
449
- <?php if( $this->option('bar_logo') ) echo '<img class="bar_logo" alt="logo" src="'.$this->option('bar_logo').'"/>' ?>
450
- </div>
451
- <?php endif; ?>
452
-
453
- <?php
454
- /**
455
- *
456
- * After Menu Header Hook
457
- *
458
- * @since 3.1
459
- */
460
- do_action('wpr_after_menu_bar');
461
- ?>
462
-
463
- <ul id="wprmenu_menu_ul">
464
-
465
-
466
- <?php
467
- /* Content Before Menu */
468
- if( $this->option('content_before_menu_element') !== '' ) {
469
- $content_before_menu_elements = preg_replace('/\\\\/', '', $this->option('content_before_menu_element'));
470
-
471
- echo '<li class="wprm_before_menu_content">'. $content_before_menu_elements . '</li>';
472
- }
473
- ?>
474
-
475
-
476
- <?php
477
- $search_position = $this->option('order_menu_items') != '' ? $this->option('order_menu_items') : 'Menu,Search,Social';
478
- $search_position = explode(',', $search_position);
479
- foreach( $search_position as $key => $menu_element ) :
480
- if( $menu_element == 'Menu' ) :
481
- $menus = get_terms( 'nav_menu',array( 'hide_empty'=>false ) );
482
- if( $menus ) : foreach( $menus as $m ) :
483
- if( $m->term_id == $this->option('menu') ) $menu = $m;
484
- endforeach; endif;
485
-
486
- if( is_object( $menu ) ) :
487
- wp_nav_menu( array( 'menu'=>$menu->name,'container'=>false,'items_wrap'=>'%3$s' ) );
488
- endif;
489
- endif;
490
-
491
- if( $menu_element == 'Search' ) :
492
- if( $this->option('search_box_menu_block') != '' && $this->option('search_box_menu_block') == 1 ) :
493
- ?>
494
- <li>
495
- <div class="wpr_search search_top">
496
- <?php echo $this->wpr_search_form(); ?>
497
- </div>
498
- </li>
499
- <?php
500
- endif;
501
- endif;
502
- ?>
503
- <?php
504
- endforeach;
505
- ?>
506
-
507
- <?php
508
- /* After Menu Element */
509
- if( $this->option('content_after_menu_element') !== '' ) {
510
- $content_after_menu_element = preg_replace('/\\\\/', '', $this->option('content_after_menu_element'));
511
-
512
- echo '<li class="wprm_after_menu_content">'. $content_after_menu_element . '</li>';
513
- }
514
- ?>
515
-
516
-
517
- </ul>
518
-
519
- <?php
520
- /**
521
- *
522
- * After Menu Container Hook
523
- *
524
- * @since 3.1
525
- */
526
- do_action('wpr_after_menu_container');
527
- ?>
528
-
529
- </div>
530
- </div>
531
- <?php
532
- endif;
533
- }
534
-
535
-
536
- /**
537
- *
538
- * Show custom css from the plugin settings
539
- *
540
- * @since 3.1
541
- * @param empty
542
- * @return string
543
- */
544
- public function wpr_custom_css() {
545
- $wpr_custom_css = $this->option('wpr_custom_css');
546
-
547
- if( !empty($wpr_custom_css) ) :
548
- ?>
549
- <style type="text/css">
550
- <?php
551
- echo '/* WPR Custom CSS */' . "\n";
552
- echo $wpr_custom_css . "\n";
553
- ?>
554
- </style>
555
- <?php
556
- endif;
557
- }
558
-
559
- /**
560
- *
561
- * Save settings into transient
562
- *
563
- * @since 3.1
564
- * @param empty
565
- * @return array
566
- */
567
- public function wpr_live_update() {
568
- if( isset($_POST['wprmenu_options']) ) {
569
- set_transient('wpr_live_settings', $_POST['wprmenu_options'], 60 * 60 * 24);
570
- }
571
- wp_die();
572
- }
573
-
574
- /**
575
- *
576
- * Get demo settings from the file
577
- *
578
- * @since 3.1
579
- * @param empty
580
- * @return json object
581
- */
582
- public function wprmenu_import_data() {
583
-
584
- $response = 'error';
585
- $menu = '';
586
-
587
- if( $this->option('menu') ) {
588
- $menu = $this->option('menu');
589
- }
590
-
591
- if( isset($_POST) ) {
592
- $settings_id = isset($_POST['settings_id']) ? $_POST['settings_id'] : '';
593
- $demo_type = isset($_POST['demo_type']) ? $_POST['demo_type'] : '';
594
-
595
- $demo_id = isset($_POST['demo_id']) ? $_POST['demo_id'] : '';
596
-
597
- if( $settings_id !== ''
598
- && $demo_type !== ''
599
- && $demo_id !== '' ) {
600
- $site_name = MG_WPRM_DEMO_SITE_URL;
601
- $remoteLink = $site_name.'/wp-json/wprmenu-server/v2/type='.$demo_type.'/demo_name='.$demo_id.'/settings_id='.$settings_id;
602
-
603
- $content = wp_remote_get($remoteLink);
604
-
605
- if( is_array($content)
606
- && isset($content['response'])
607
- && $content['response']['code'] == 200 ) {
608
-
609
- $content = $content['body'];
610
- $items = json_decode($content, true);
611
-
612
- if( is_array($items) ) {
613
- $items['menu'] = $menu;
614
- }
615
-
616
- $content = maybe_serialize($items);
617
-
618
- if( $content ) {
619
- $response = 'success';
620
-
621
- global $wpdb;
622
-
623
- $wpdb->update(
624
- $wpdb->prefix.'options',
625
- array(
626
- 'option_value' => $content,
627
- ),
628
- array(
629
- 'option_name' => 'wprmenu_options',
630
- )
631
- );
632
- }
633
- else {
634
- $response = 'error';
635
- }
636
- }
637
- else {
638
- $response = 'error';
639
- }
640
- }
641
- else {
642
- $response = 'error';
643
- }
644
- }
645
- else {
646
- $response = 'error';
647
- }
648
- echo json_encode( array('status' => $response) );
649
- wp_die();
650
- }
651
-
652
- /**
653
- *
654
- * Get settings from transient and save into options api
655
- *
656
- * @since 3.1
657
- * @param empty
658
- * @return json object
659
- */
660
- public function wpr_get_transient_from_data() {
661
- $response = 'error';
662
- $check_transient = get_transient('wpr_live_settings');
663
-
664
- if( $check_transient) {
665
- $content = maybe_serialize($check_transient);
666
- update_option('wprmenu_options', $check_transient);
667
- $response = 'success';
668
- }
669
-
670
- echo json_encode( array('status' => $response) );
671
- wp_die();
672
- }
673
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/wprmenu-loader.php CHANGED
@@ -19,7 +19,7 @@ final class WPR_Menu_Loader {
19
  *
20
  * @var string
21
  */
22
- public $version = '3.1.7';
23
 
24
 
25
  /**
19
  *
20
  * @var string
21
  */
22
+ public $version = '3.1.7.1';
23
 
24
 
25
  /**
inc/wprmenu-styles.php CHANGED
@@ -28,22 +28,8 @@ if ( ! class_exists('WPRMenu_Styles') ) {
28
  }
29
 
30
  public function wprmenu_option( $option ) {
31
-
32
- if ( isset($_COOKIE['wprmenu_live_preview'])
33
- && $_COOKIE['wprmenu_live_preview'] == 'yes' ) {
34
- $check_transient = get_transient('wpr_live_settings');
35
-
36
- if ( $check_transient ) {
37
- if ( isset( $check_transient[$option] )
38
- && $check_transient[$option] != '' ) {
39
- return $check_transient[$option];
40
- }
41
- }
42
- }
43
- else {
44
- if ( isset( $this->wprmenu_options[$option] ) && $this->wprmenu_options[$option] != '' )
45
- return $this->wprmenu_options[$option];
46
- }
47
  }
48
 
49
  public function generate_style() {
28
  }
29
 
30
  public function wprmenu_option( $option ) {
31
+ if ( isset( $this->wprmenu_options[$option] ) && $this->wprmenu_options[$option] != '' )
32
+ return $this->wprmenu_options[$option];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  public function generate_style() {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: WordPress Responsive Menu, Genesis responsive menu, Genesis Mobile Menu, T
4
  Requires at least: 3.0
5
  Requires PHP: 5.4
6
  Tested up to: 5.9
7
- Stable tag: 3.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -86,6 +86,11 @@ If you have any suggestions for a new plugin, feel free to email us at info@mag
86
 
87
  == ChangeLog ==
88
 
 
 
 
 
 
89
  = Version 3.1.7 =
90
 
91
  * Fixed security issues.
4
  Requires at least: 3.0
5
  Requires PHP: 5.4
6
  Tested up to: 5.9
7
+ Stable tag: 3.1.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
86
 
87
  == ChangeLog ==
88
 
89
+ = Version 3.1.7.1 =
90
+
91
+ * Security updates
92
+ * Code cleanup
93
+
94
  = Version 3.1.7 =
95
 
96
  * Fixed security issues.
wp-responsive-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  * Description: WP Responsive Menu is mobile menu plugin that lets you add a highly customizable responsive menu to any WordPress site in no time.
5
  * Plugin URI: http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
6
  * Author: MagniGenie
7
- * Version: 3.1.7
8
  * Author URI: http://magnigenie.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
9
  * Text Domain: wprmenu
10
  * Domain Path: /languages/
4
  * Description: WP Responsive Menu is mobile menu plugin that lets you add a highly customizable responsive menu to any WordPress site in no time.
5
  * Plugin URI: http://magnigenie.com/wp-responsive-menu-mobile-menu-plugin-wordpress?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
6
  * Author: MagniGenie
7
+ * Version: 3.1.7.1
8
  * Author URI: http://magnigenie.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
9
  * Text Domain: wprmenu
10
  * Domain Path: /languages/