PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 3.3.6
Strong Testimonials v3.3.6
3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / admin / challenge / class-wpmtst-challenge-modal.php
strong-testimonials / admin / challenge Last commit date
class-wpmtst-challenge-modal.php 1 year ago
class-wpmtst-challenge-modal.php
105 lines
1 <?php
2 /**
3 * Challenge main class
4 *
5 * @since 2.6.8
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13
14 class WPMTST_Challenge_Modal {
15
16
17 public function __construct() {
18
19 if ( is_admin() && $this->show_challenge() && 1 == get_option( 'wpmtst-challenge', 1 ) ) {
20 add_action( 'admin_footer', array( $this, 'challenge_render' ), 99 );
21 add_action( 'admin_enqueue_scripts', array( $this, 'challenge_scripts' ) );
22 add_action( 'wp_ajax_wpmtst_challenge_hide', array( $this, 'wpmtst_challenge_hide' ) );
23 }
24 }
25
26 public function challenge_render() {
27
28 $new_gallery_url = add_query_arg(
29 array(
30 'post_type' => 'wpm-testimonial',
31 ),
32 admin_url( 'post-new.php' )
33 );
34
35 ?>
36 <div class="wpmtst-challenge-wrap">
37 <div class="wpmtst-challenge-header">
38 <span id="wpmtst-challenge-close" class="dashicons dashicons-no-alt"></span>
39 <p><?php echo wp_kses_post( __( 'Start enjoying <strong>Strong Testimonials</strong> by adding your first testimonial.', 'strong-testimonials' ) ); ?></p>
40 </div>
41 <div class="wpmtst-challenge-list">
42 <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Primul lucru din lista', 'strong-testimonials' ); ?></p>
43 <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 2-lea lucru din lista', 'strong-testimonials' ); ?></p>
44 <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 3-lea lucru din lista', 'strong-testimonials' ); ?></p>
45 <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 4-lea lucru din lista', 'strong-testimonials' ); ?></p>
46 <p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 5-lea lucru din lista', 'strong-testimonials' ); ?></p>
47 </div>
48 <div class="wpmtst-challenge-footer">
49 <img src="<?php echo esc_url( WPMTST_URL . 'admin/img/mascot.png' ); ?>" class="wpmtst-challenge-logo"/>
50 <div>
51 <h3>Strong Testimonials</h3>
52 <p><span class="wpmtst-challenge-time">5:00</span> remaining.</p>
53 </div>
54 </div>
55 <div class="wpmtst-challenge-footer-button">
56 <a id="wpmtst-challenge-button" href="<?php echo esc_url( $new_gallery_url ); ?>" class="wpmtst-btn wpmtst-challenge-btn"><?php esc_html_e( 'Create First Gallery', 'strong-testimonials' ); ?></a>
57 </div>
58
59 </div>
60 <?php
61 }
62
63 public function challenge_scripts( $hook ) {
64
65 wp_enqueue_style( 'wpmtst-challenge-style', WPMTST_URL . 'assets/css/challenge.css', array(), true );
66 wp_enqueue_script( 'wpmtst-challenge-script', WPMTST_URL . 'assets/js/challenge.js', array( 'jquery' ), '1.0.0', true );
67 $args = array(
68 'ajaxurl' => admin_url( 'admin-ajax.php' ),
69 'nonce' => wp_create_nonce( 'wpmtst-challenge' ),
70 );
71 wp_localize_script( 'wpmtst-challenge-script', 'wpmtstChallenge', $args );
72 }
73
74 public function show_challenge() {
75 $args = array(
76 'numberposts' => 1,
77 'post_status' => 'any, trash',
78 'post_type' => 'wpm-testimonial',
79 );
80
81 if ( ! isset( $_GET['post_type'] ) || 'wpm-testimonial' !== $_GET['post_type'] ) {
82 return false;
83 }
84
85 if ( empty( get_posts( $args ) ) ) {
86 return true;
87 }
88
89 return false;
90 }
91 public function wpmtst_challenge_hide() {
92
93 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'wpmtst-challenge' ) ) {
94 wp_send_json_error();
95 die();
96 }
97
98 update_option( 'wpmtst-challenge', 0 );
99 wp_send_json_success();
100 wp_die();
101 }
102 }
103 new WPMTST_Challenge_Modal();
104 ?>
105