PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.1.21
Responsive Menu – Create Mobile-Friendly Menu v3.1.21
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
← All changes | app/Controllers/AdminController.php +11 -60 4.1.23.1.21 View file →
@@ -65,25 +65,12 @@
65 65 *
66 66 * @author Peter Featherstone <peter@featherstone.me>
67 67 *
68 68 * @since 3.0
69 - * @param bool $valid_nonce Is the form nonce valid or not.
70 69 *
71 70 * @return string Output HTML from rendered view.
72 71 */
73 - public function rebuild( $valid_nonce ) {
74 -
75 - // Check form nonce is valid or not.
76 - if ( ! $valid_nonce ) {
77 - return $this->view->render(
78 - 'admin/main.html.twig',
79 - [
80 - 'options' => $this->manager->all(),
81 - 'alert' => [ 'danger' => 'CSRF token not valid' ]
82 - ]
83 - );
84 - }
85 -
72 + public function rebuild() {
86 73 update_option('responsive_menu_version', '2.8.9');
87 74
88 75 return $this->view->render(
89 76 'admin/main.html.twig',
@@ -105,27 +92,15 @@
105 92 * @author Peter Featherstone <peter@featherstone.me>
106 93 *
107 94 * @since 3.1.16
108 95 *
109 - * @param string $theme The theme name to apply
110 - * @param bool $valid_nonce Is the form nonce valid or not.
96 + * @param string $theme The theme name to apply
111 97 *
112 98 * @return string Output HTML from rendered view.
113 99 */
114 - public function apply_theme( $theme, $valid_nonce ) {
100 + public function apply_theme($theme) {
115 101 $options = $this->manager->all();
116 102
117 - // Check form nonce is valid or not.
118 - if ( ! $valid_nonce ) {
119 - return $this->view->render(
120 - 'admin/main.html.twig',
121 - [
122 - 'options' => $options,
123 - 'alert' => [ 'danger' => 'CSRF token not valid' ]
124 - ]
125 - );
126 - }
127 -
128 103 $upload_folder = wp_upload_dir()['basedir'];
129 104 $theme_folder = $upload_folder . '/responsive-menu-themes/';
130 105 $options_file_location = $theme_folder . $theme . '/options.json';
131 106
@@ -158,19 +133,14 @@
158 133 * @author Peter Featherstone <peter@featherstone.me>
159 134 *
160 135 * @since 3.1.16
161 136 *
162 - * @param string $theme The theme file location to unzip
163 - * @param bool $valid_nonce Is the form nonce valid or not.
137 + * @param string $theme The theme file location to unzip
164 138 *
165 139 * @return string Output HTML from rendered view.
166 140 */
167 - public function import_theme( $theme, $valid_nonce ) {
168 -
169 - // Check nonce is valid or not.
170 - if ( ! $valid_nonce ):
171 - $alert = [ 'danger' => 'CSRF token not valid' ];
172 - elseif ( ! empty( $theme ) ):
141 + public function import_theme($theme) {
142 + if($theme):
173 143 WP_Filesystem();
174 144 $upload_folder = wp_upload_dir()['basedir'] . '/responsive-menu-themes';
175 145
176 146 $unzipfile = unzip_file($theme, $upload_folder);
@@ -258,25 +228,12 @@
258 228 *
259 229 * @since 3.0
260 230 *
261 231 * @param array $default_options An array of the default options.
262 - * @param bool $valid_nonce Is the form nonce valid or not.
263 232 *
264 233 * @return string Output HTML from rendered view.
265 234 */
266 - public function reset($default_options, $valid_nonce ) {
267 -
268 - // Check form nonce is valid or not.
269 - if ( ! $valid_nonce ) {
270 - return $this->view->render(
271 - 'admin/main.html.twig',
272 - [
273 - 'options' => $this->manager->all(),
274 - 'alert' => [ 'danger' => 'CSRF token not valid' ]
275 - ]
276 - );
277 - }
278 -
235 + public function reset($default_options) {
279 236 try {
280 237 $options = $this->manager->updateOptions($default_options);
281 238 $task = new UpdateOptionsTask;
282 239 $task->run($options, $this->view);
@@ -305,21 +262,15 @@
305 262 *
306 263 * @since 3.0
307 264 *
308 265 * @param array $imported_options An array of the imported options.
309 - * @param bool $valid_nonce Is the form nonce valid or not.
310 266 *
311 267 * @return string Output HTML from rendered view.
312 268 */
313 - public function import( $imported_options, $valid_nonce ) {
269 + public function import($imported_options) {
314 270 $errors = [];
271 + if(!empty($imported_options)):
315 272
316 - // Check nonce is valid or not.
317 - if ( ! $valid_nonce ) {
318 - $alert = [ 'danger' => 'CSRF token not valid' ];
319 - $options = $this->manager->all();
320 - } elseif( ! empty( $imported_options ) ) {
321 -
322 273 $validator = new Validator();
323 274 if($validator->validate($imported_options)):
324 275 try {
325 276 unset($imported_options['button_click_trigger']);
@@ -338,13 +289,13 @@
338 289 $alert = ['danger' => $errors];
339 290
340 291 endif;
341 292
342 - } else {
293 + else:
343 294 $options = $this->manager->all();
344 295 $alert = ['danger' => 'No import file selected'];
345 296
346 - }
297 + endif;
347 298
348 299 return $this->view->render(
349 300 'admin/main.html.twig',
350 301 [