PluginProbe
QuadMenu – Mega Menu / 3.3.8
QuadMenu – Mega Menu v3.3.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / redux / ReduxCore / inc / welcome / welcome.php

welcome.php in QuadMenu – Mega Menu 3.3.8, at redux/ReduxCore/inc/welcome/welcome.php

595 lines 17.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6
7 class ReduxLegacy_Welcome {
8
9 /**
10 * @var string The capability users should have to view the page
11 */
12 public $minimum_capability = 'manage_options';
13 public $display_version = '';
14 public $redux_loaded = false;
15
16 /**
17 * Get things started
18 *
19 * @since 1.4
20 */
21 public function __construct() {
22
23 add_action( 'redux/loaded', array( $this, 'init' ) );
24
25 add_action( 'wp_ajax_redux_support_hash', array( $this, 'support_hash' ) );
26 }
27
28 public function init() {
29
30 if ( $this->redux_loaded ) {
31 return;
32 }
33 $this->redux_loaded = true;
34 add_action( 'admin_menu', array( $this, 'admin_menus' ) );
35
36 if ( isset( $_GET['page'] ) ) {
37 if ( substr( $_GET['page'], 0, 6 ) == 'redux-' ) {
38 $version = explode( '.', ReduxFrameworkLegacy::$_version );
39 $this->display_version = $version[0] . '.' . $version[1];
40 add_filter( 'admin_footer_text', array( $this, 'change_wp_footer' ) );
41 add_action( 'admin_head', array( $this, 'admin_head' ) );
42 } else {
43 $this->check_version();
44 }
45 } else {
46 $this->check_version();
47 }
48 update_option( 'redux_version_upgraded_from', ReduxFrameworkLegacy::$_version );
49 }
50
51
52 public function check_version() {
53 global $pagenow;
54
55 if ( $pagenow == 'admin-ajax.php' || ( $GLOBALS['pagenow'] == 'customize' && isset( $_GET['theme'] ) && ! empty( $_GET['theme'] ) ) ) {
56 return;
57 }
58
59 $saveVer = ReduxLegacy_Helpers::major_version( get_option( 'redux_version_upgraded_from' ) );
60 $curVer = ReduxLegacy_Helpers::major_version( ReduxFrameworkLegacy::$_version );
61 $compare = false;
62
63 if ( ReduxLegacy_Helpers::isLocalHost() ) {
64 $compare = true;
65 } elseif ( class_exists( 'ReduxFrameworkPlugin' ) ) {
66 $compare = true;
67 } else {
68 $redux = ReduxFrameworkInstancesLegacy::get_all_instances();
69
70 if ( is_array( $redux ) ) {
71 foreach ( $redux as $panel ) {
72 if ( $panel->args['dev_mode'] == 1 ) {
73 $compare = true;
74 break;
75 }
76 }
77 }
78 }
79
80 if ( $compare ) {
81 $redirect = false;
82 if ( empty( $saveVer ) ) {
83 $redirect = true; // First time
84 }
85 // Removing redirect except for the first time with the plugin installed. :) Less annoying until we actually use this page.
86 // else if ( version_compare( $curVer, $saveVer, '>' ) ) {
87 // $redirect = true; // Previous version
88 // }
89 if ( $redirect && ! defined( 'WP_TESTS_DOMAIN' ) && ReduxFrameworkLegacy::$_as_plugin ) {
90 add_action( 'init', array( $this, 'do_redirect' ) );
91 }
92 }
93 }
94
95 public function do_redirect() {
96 if ( ! defined( 'WP_CLI' ) ) {
97 wp_redirect( admin_url( 'tools.php?page=redux-about' ) );
98 exit();
99 }
100 }
101
102 public function change_wp_footer() {
103 echo __( 'If you like <strong>Redux</strong> please leave us a <a href="https://wordpress.org/support/view/plugin-reviews/redux-framework?filter=5#postform" target="_blank" class="redux-rating-link" data-rated="Thanks :)">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating. A huge thank you from Redux in advance!', 'redux-framework' );
104 }
105
106 public function support_hash() {
107
108 if ( ! wp_verify_nonce( $_POST['nonce'], 'redux-support-hash' ) ) {
109 die();
110 }
111
112 $data = get_option( 'redux_support_hash' );
113 $data = wp_parse_args(
114 $data,
115 array(
116 'check' => '',
117 'identifier' => '',
118 )
119 );
120 $generate_hash = true;
121 $system_info = ReduxLegacy_Helpers::compileSystemStatus();
122 $newHash = md5( json_encode( $system_info ) );
123 $return = array();
124 if ( $newHash == $data['check'] ) {
125 unset( $generate_hash );
126 }
127
128 $post_data = array(
129 'hash' => md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] ),
130 'site' => esc_url( home_url( '/' ) ),
131 'tracking' => ReduxLegacy_Helpers::getTrackingObject(),
132 'system_status' => $system_info,
133 );
134 // $post_data = json_encode( $post_data );
135 $post_data = serialize( $post_data );
136
137 if ( isset( $generate_hash ) && $generate_hash ) {
138
139 $data['check'] = $newHash;
140 $data['identifier'] = '';
141 $response = wp_remote_post(
142 'http://support.redux.io/v1/',
143 array(
144 'method' => 'POST',
145 'timeout' => 65,
146 'redirection' => 5,
147 'httpversion' => '1.0',
148 'blocking' => true,
149 'compress' => true,
150 'headers' => array(),
151 'body' => array(
152 'data' => $post_data,
153 'serialize' => 1,
154 ),
155 )
156 );
157
158 if ( is_wp_error( $response ) ) {
159 echo json_encode(
160 array(
161 'status' => 'error',
162 'message' => $response->get_error_message(),
163 )
164 );
165 die( 1 );
166 } else {
167 $response_code = wp_remote_retrieve_response_code( $response );
168 if ( $response_code == 200 ) {
169 $response = wp_remote_retrieve_body( $response );
170 $return = json_decode( $response, true );
171 if ( isset( $return['identifier'] ) ) {
172 $data['identifier'] = $return['identifier'];
173 update_option( 'redux_support_hash', $data );
174 }
175 } else {
176 $response = wp_remote_retrieve_body( $response );
177 echo json_encode(
178 array(
179 'status' => 'error',
180 'message' => $response,
181 )
182 );
183 }
184 }
185 }
186
187 if ( ! empty( $data['identifier'] ) ) {
188 $return['status'] = 'success';
189 $return['identifier'] = $data['identifier'];
190 } else {
191 $return['status'] = 'error';
192 $return['message'] = esc_html__( 'Support hash could not be generated. Please try again later.', 'redux-framework' );
193 }
194
195 echo json_encode( $return );
196
197 die( 1 );
198 }
199
200 /**
201 * Register the Dashboard Pages which are later hidden but these pages
202 * are used to render the Welcome and Credits pages.
203 *
204 * @access public
205 * @since 1.4
206 * @return void
207 */
208 public function admin_menus() {
209
210 $page = 'add_management_page';
211
212 // About Page
213 $page(
214 esc_html__( 'Welcome to Redux Framework', 'redux-framework' ),
215 esc_html__( 'Redux Framework', 'redux-framework' ),
216 $this->minimum_capability,
217 'redux-about',
218 array(
219 $this,
220 'about_screen',
221 )
222 );
223
224 // Changelog Page
225 $page(
226 esc_html__( 'Redux Framework Changelog', 'redux-framework' ),
227 esc_html__( 'Redux Framework Changelog', 'redux-framework' ),
228 $this->minimum_capability,
229 'redux-changelog',
230 array(
231 $this,
232 'changelog_screen',
233 )
234 );
235
236 // Support Page
237 $page(
238 esc_html__( 'Get Support', 'redux-framework' ),
239 esc_html__( 'Get Support', 'redux-framework' ),
240 $this->minimum_capability,
241 'redux-support',
242 array(
243 $this,
244 'get_support',
245 )
246 );
247
248 // Support Page
249 $page(
250 esc_html__( 'Redux Extensions', 'redux-framework' ),
251 esc_html__( 'Redux Extensions', 'redux-framework' ),
252 $this->minimum_capability,
253 'redux-extensions',
254 array(
255 $this,
256 'redux_extensions',
257 )
258 );
259
260 // Credits Page
261 $page(
262 esc_html__( 'The people that develop Redux Framework', 'redux-framework' ),
263 esc_html__( 'The people that develop Redux Framework', 'redux-framework' ),
264 $this->minimum_capability,
265 'redux-credits',
266 array(
267 $this,
268 'credits_screen',
269 )
270 );
271
272 // Status Page
273 $page(
274 esc_html__( 'Redux Framework Status', 'redux-framework' ),
275 esc_html__( 'Redux Framework Status', 'redux-framework' ),
276 $this->minimum_capability,
277 'redux-status',
278 array(
279 $this,
280 'status_screen',
281 )
282 );
283
284 // remove_submenu_page( 'tools.php', 'redux-about' );
285 remove_submenu_page( 'tools.php', 'redux-status' );
286 remove_submenu_page( 'tools.php', 'redux-changelog' );
287 remove_submenu_page( 'tools.php', 'redux-getting-started' );
288 remove_submenu_page( 'tools.php', 'redux-credits' );
289 remove_submenu_page( 'tools.php', 'redux-support' );
290 remove_submenu_page( 'tools.php', 'redux-extensions' );
291 }
292
293 /**
294 * Hide Individual Dashboard Pages
295 *
296 * @access public
297 * @since 1.4
298 * @return void
299 */
300 public function admin_head() {
301
302 // Badge for welcome page
303 // $badge_url = ReduxFrameworkLegacy::$_url . 'assets/images/redux-badge.png';
304 ?>
305
306 <script
307 id="redux-qtip-js"
308 src='<?php echo esc_url( ReduxFrameworkLegacy::$_url ); ?>assets/js/vendor/qtip/jquery.qtip.js'>
309 </script>
310
311 <script
312 id="redux-welcome-admin-js"
313 src='<?php echo esc_url( ReduxFrameworkLegacy::$_url ); ?>inc/welcome/js/redux-welcome-admin.js'>
314 </script>
315
316 <?php
317 if ( isset( $_GET['page'] ) && $_GET['page'] == 'redux-support' ) :
318 ?>
319 <script
320 id="jquery-easing"
321 src='<?php echo esc_url( ReduxFrameworkLegacy::$_url ); ?>inc/welcome/js/jquery.easing.min.js'>
322 </script>
323 <?php endif; ?>
324
325 <link rel='stylesheet' id='redux-qtip-css'
326 href='<?php echo esc_url( ReduxFrameworkLegacy::$_url ); ?>assets/css/vendor/qtip/jquery.qtip.css'
327 type='text/css' media='all'/>
328
329 <link rel='stylesheet' id='elusive-icons'
330 href='<?php echo esc_url( ReduxFrameworkLegacy::$_url ); ?>assets/css/vendor/elusive-icons/elusive-icons.css'
331 type='text/css' media='all'/>
332
333 <link rel='stylesheet' id='redux-welcome-css'
334 href='<?php echo esc_url( ReduxFrameworkLegacy::$_url ); ?>inc/welcome/css/redux-welcome.css'
335 type='text/css' media='all'/>
336 <style type="text/css">
337 .redux-badge:before {
338 <?php echo is_rtl() ? 'right' : 'left'; ?> : 0;
339 }
340
341 .about-wrap .redux-badge {
342 <?php echo is_rtl() ? 'left' : 'right'; ?> : 0;
343 }
344
345 .about-wrap .feature-rest div {
346 padding- <?php echo is_rtl() ? 'left' : 'right'; ?>: 100px;
347 }
348
349 .about-wrap .feature-rest div.last-feature {
350 padding- <?php echo is_rtl() ? 'right' : 'left'; ?>: 100px;
351 padding- <?php echo is_rtl() ? 'left' : 'right'; ?>: 0;
352 }
353
354 .about-wrap .feature-rest div.icon:before {
355 margin: <?php echo is_rtl() ? '0 -100px 0 0' : '0 0 0 -100px'; ?>;
356 }
357 </style>
358 <?php
359 }
360
361 /**
362 * Navigation tabs
363 *
364 * @access public
365 * @since 1.9
366 * @return void
367 */
368 public function tabs() {
369 $selected = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : 'redux-about';
370 $nonce = wp_create_nonce( 'redux-support-hash' );
371 ?>
372 <input type="hidden" id="redux_support_nonce" value="<?php echo esc_attr( $nonce ); ?>"/>
373 <h2 class="nav-tab-wrapper">
374 <a class="nav-tab <?php echo $selected == 'redux-about' ? 'nav-tab-active' : ''; ?>"
375 href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'redux-about' ), 'tools.php' ) ) ); ?>">
376 <?php esc_attr_e( "What's New", 'redux-framework' ); ?>
377 </a> <a class="nav-tab <?php echo $selected == 'redux-extensions' ? 'nav-tab-active' : ''; ?>"
378 href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'redux-extensions' ), 'tools.php' ) ) ); ?>">
379 <?php esc_attr_e( 'Extensions', 'redux-framework' ); ?>
380 </a> <a class="nav-tab <?php echo $selected == 'redux-changelog' ? 'nav-tab-active' : ''; ?>"
381 href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'redux-changelog' ), 'tools.php' ) ) ); ?>">
382 <?php esc_attr_e( 'Changelog', 'redux-framework' ); ?>
383 </a> <a class="nav-tab <?php echo $selected == 'redux-credits' ? 'nav-tab-active' : ''; ?>"
384 href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'redux-credits' ), 'tools.php' ) ) ); ?>">
385 <?php _e( 'Credits', 'redux-framework' ); ?>
386 </a> <a class="nav-tab <?php echo $selected == 'redux-support' ? 'nav-tab-active' : ''; ?>"
387 href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'redux-support' ), 'tools.php' ) ) ); ?>">
388 <?php esc_attr_e( 'Support', 'redux-framework' ); ?>
389 </a> <a class="nav-tab <?php echo $selected == 'redux-status' ? 'nav-tab-active' : ''; ?>"
390 href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'redux-status' ), 'tools.php' ) ) ); ?>">
391 <?php esc_attr_e( 'Status', 'redux-framework' ); ?>
392 </a>
393 </h2>
394 <?php
395 }
396
397 /**
398 * Render About Screen
399 *
400 * @access public
401 * @since 1.4
402 * @return void
403 */
404 public function about_screen() {
405 // Stupid hack for WordPress alerts and warnings
406 echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
407
408 require_once 'views/about.php';
409 }
410
411 /**
412 * Render Changelog Screen
413 *
414 * @access public
415 * @since 2.0.3
416 * @return void
417 */
418 public function changelog_screen() {
419 // Stupid hack for WordPress alerts and warnings
420 echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
421
422 require_once 'views/changelog.php';
423 }
424
425 /**
426 * Render Changelog Screen
427 *
428 * @access public
429 * @since 2.0.3
430 * @return void
431 */
432 public function redux_extensions() {
433 // Stupid hack for WordPress alerts and warnings
434 echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
435
436 require_once 'views/extensions.php';
437 }
438
439
440 /**
441 * Render Get Support Screen
442 *
443 * @access public
444 * @since 1.9
445 * @return void
446 */
447 public function get_support() {
448 // Stupid hack for WordPress alerts and warnings
449 echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
450
451 require_once 'views/support.php';
452 }
453
454 /**
455 * Render Credits Screen
456 *
457 * @access public
458 * @since 1.4
459 * @return void
460 */
461 public function credits_screen() {
462 // Stupid hack for WordPress alerts and warnings
463 echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
464
465 require_once 'views/credits.php';
466 }
467
468 /**
469 * Render Status Report Screen
470 *
471 * @access public
472 * @since 1.4
473 * @return void
474 */
475 public function status_screen() {
476 // Stupid hack for WordPress alerts and warnings
477 echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
478
479 require_once 'views/status_report.php';
480 }
481
482 /**
483 * Parse the Redux readme.txt file
484 *
485 * @since 2.0.3
486 * @return string $readme HTML formatted readme file
487 */
488 public function parse_readme() {
489 if ( file_exists( ReduxFrameworkLegacy::$_dir . 'inc/fields/raw/parsedown.php' ) ) {
490 require_once ReduxFrameworkLegacy::$_dir . 'inc/fields/raw/parsedown.php';
491 $Parsedown = new Parsedown();
492 $data = @wp_remote_get( ReduxFrameworkLegacy::$_url . '../CHANGELOG.md' );
493 if ( isset( $data ) && ! empty( $data ) ) {
494 $data = @wp_remote_retrieve_body( $data );
495 return $Parsedown->text( trim( str_replace( '# Redux Framework Changelog', '', $data ) ) );
496 }
497 }
498
499 return '<script src="' . 'http://gist-it.appspot.com/https://github.com/ReduxFrameworkLegacy/redux-framework/blob/master/CHANGELOG.md?slice=2:0&footer=0">// <![CDATA[// ]]></script>';
500 }
501
502 public function actions() {
503 ?>
504 <p class="redux-actions">
505 <a href="http://docs.ReduxFrameworkLegacy.com/" class="docs button button-primary">Docs</a>
506 <a href="http://wordpress.org/plugins/redux-framework/" class="review-us button button-primary"
507 target="_blank">Review Us</a>
508 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MMFMHWUPKHKPW"
509 class="review-us button button-primary" target="_blank">Donate</a>
510 <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://ReduxFrameworkLegacy.com"
511 data-text="Reduce your dev time! Redux is the most powerful option framework for WordPress on the web"
512 data-via="ReduxFrameworkLegacy" data-size="large" data-hashtags="Redux">Tweet</a>
513 <script>!function( d, s, id ) {
514 var js, fjs = d.getElementsByTagName( s )[0], p = /^http:/.test( d.location ) ? 'http' : 'https';
515 if ( !d.getElementById( id ) ) {
516 js = d.createElement( s );
517 js.id = id;
518 js.src = p + '://platform.twitter.com/widgets.js';
519 fjs.parentNode.insertBefore( js, fjs );
520 }
521 }( document, 'script', 'twitter-wjs' );</script>
522 </p>
523 <?php
524 }
525
526 /**
527 * Render Contributors List
528 *
529 * @since 1.4
530 * @uses Redux_Welcome::get_contributors()
531 * @return string $contributor_list HTML formatted list of all the contributors for Redux
532 */
533 public function contributors() {
534 $contributors = $this->get_contributors();
535
536 if ( empty( $contributors ) ) {
537 return '';
538 }
539
540 $contributor_list = '<ul class="wp-people-group">';
541
542 foreach ( $contributors as $contributor ) {
543 $contributor_list .= '<li class="wp-person">';
544 $contributor_list .= sprintf(
545 '<a href="%s" title="%s" target="_blank">',
546 esc_url( 'https://github.com/' . $contributor->login ),
547 esc_html( sprintf( __( 'View %s', 'redux-framework' ), esc_html( $contributor->login ) ) )
548 );
549 $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
550 $contributor_list .= '</a>';
551 $contributor_list .= sprintf( '<a class="web" href="%s" target="_blank">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
552 $contributor_list .= '</a>';
553 $contributor_list .= '</li>';
554 }
555
556 $contributor_list .= '</ul>';
557
558 return $contributor_list;
559 }
560
561 /**
562 * Retreive list of contributors from GitHub.
563 *
564 * @access public
565 * @since 1.4
566 * @return array $contributors List of contributors
567 */
568 public function get_contributors() {
569 $contributors = get_transient( 'redux_contributors' );
570
571 if ( false !== $contributors ) {
572 return $contributors;
573 }
574
575 $response = wp_remote_get( 'https://api.github.com/repos/ReduxFrameworkLegacy/redux-framework/contributors', array( 'sslverify' => false ) );
576
577 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
578 return array();
579 }
580
581 $contributors = json_decode( wp_remote_retrieve_body( $response ) );
582
583 if ( ! is_array( $contributors ) ) {
584 return array();
585 }
586
587 set_transient( 'redux_contributors', $contributors, 3600 );
588
589 return $contributors;
590 }
591 }
592
593 new ReduxLegacy_Welcome();
594
595