PluginProbe
Responsive Menu – Mobile Menu & Hamburger Menu Builder / 4.7.4
Responsive Menu – Mobile Menu & Hamburger Menu Builder v4.7.4
4.7.4 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 All 91 releases
← All changes | review-banner-class.php +31 -44 4.1.5 → 4.7.4 View file →
@@ -6,8 +6,9 @@
6 6 * @since 4.1.3
7 7 */
8 8 class RM_Review_Message {
9 9
10 +
10 11 /**
11 12 * Variable to hold how many results needed to show message
12 13 *
13 14 * @since 4.1.3
@@ -20,9 +21,9 @@
20 21 * Adds the notice check to init and then check to display message
21 22 *
22 23 * @since 4.1.3
23 24 */
24 - function __construct() {
25 + public function __construct() {
25 26 $this->add_hooks();
26 27 }
27 28
28 29 /**
@@ -29,11 +30,11 @@
29 30 * Adds check message to admin_init hook
30 31 *
31 32 * @since 4.1.3
32 33 */
33 - public function add_hooks() {
34 - add_action( 'admin_init', array( $this, 'check_message_display' ) );
35 - }
34 + public function add_hooks() {
35 + add_action( 'admin_init', array( $this, 'check_message_display' ) );
36 + }
36 37
37 38 /**
38 39 * Checks if message should be displayed
39 40 *
@@ -41,9 +42,9 @@
41 42 */
42 43 public function check_message_display() {
43 44 $this->admin_notice_check();
44 45 $this->trigger = $this->check_message_trigger();
45 - if ( $this->trigger !== -1 ) {
46 + if ( -1 !== $this->trigger ) {
46 47 $amount = $this->check_results_amount();
47 48 if ( $amount >= $this->trigger ) {
48 49 add_action( 'admin_notices', array( $this, 'display_admin_message' ) );
49 50 }
@@ -58,9 +59,9 @@
58 59 */
59 60 public function check_message_trigger() {
60 61 $trigger = get_option( 'rm_review_message_trigger' );
61 62 if ( empty( $trigger ) || is_null( $trigger ) ) {
62 - add_option('rm_review_message_trigger', 1 );
63 + add_option( 'rm_review_message_trigger', 1 );
63 64 return 1;
64 65 }
65 66 return intval( $trigger );
66 67 }
@@ -71,10 +72,12 @@
71 72 * @return int The amount of menus
72 73 */
73 74 public function check_results_amount() {
74 75 global $wpdb;
75 - $amount = $wpdb->get_var("SELECT COUNT(*) FROM `". $wpdb->prefix ."posts`
76 - WHERE post_type = 'rmp_menu'");
76 + $amount = $wpdb->get_var(
77 + 'SELECT COUNT(*) FROM `' . $wpdb->prefix . "posts`
78 + WHERE post_type = 'rmp_menu'"
79 + );
77 80 return $amount;
78 81 }
79 82
80 83 /**
@@ -80,38 +83,22 @@
80 83 /**
81 84 * Displays the message
82 85 *
83 86 * Displays the message asking for review
84 - *
85 - *
86 87 */
87 88 public function display_admin_message() {
88 - $already_url = esc_url( add_query_arg( 'rm_review_notice_check', 'already_did' ) );
89 - $nope_url = esc_url( add_query_arg( 'rm_review_notice_check', 'remove_message' ) );
90 - echo "<div class='updated'><br />";
91 - echo sprintf( esc_html__('Greetings! I just noticed that you have created %d Menus. That is
92 - awesome! Could you please help me out by giving this plugin a 5-star rating on WordPress? This
93 - will help us by helping other users discover this plugin. %s', 'responsive-menu-pro'),
94 - $this->check_results_amount(),
95 - '<br /><strong><em>~ RM Team</em></strong><br /><br />'
96 - );
97 - echo sprintf('<a target="%s" href="%s" class="%s">%s</a> ',
98 - esc_attr( "_blank" ),
99 - esc_url( "https://wordpress.org/support/plugin/responsive-menu/reviews/#new-topic-0"),
100 - esc_attr( "button-primary" ),
101 - esc_html__( 'Yeah, you deserve it!', 'responsive-menu-pro' )
102 - );
103 - echo sprintf('<a href="%s" class="%s">%s</a> ',
104 - $already_url,
105 - esc_attr( "button-secondary" ),
106 - esc_html__( 'I already did!', 'responsive-menu-pro' )
107 - );
108 - echo sprintf('<a href="%s" class="%s">%s</a> ',
109 - $nope_url,
110 - esc_attr( "button-secondary" ),
111 - esc_html__( 'No, this plugin is not good enough', 'responsive-menu-pro' )
112 - );
113 - echo "<br /><br /></div>";
89 + ?>
90 + <div class='updated'><br />
91 + <?php
92 + /* translators: %d: Result count */
93 + echo sprintf( esc_html__( 'Greetings! I just noticed that you have created %d Menus. That is awesome! Could you please help me out by giving this plugin a 5-star rating on WordPress? This will help us by helping other users discover this plugin.', 'responsive-menu' ), esc_html( $this->check_results_amount() ) );
94 + ?>
95 + <br/><strong><em>~ <?php esc_html_e( 'RM Team', 'responsive-menu' ); ?></em></strong><br/><br/>
96 + <a target="_blank" rel="noopener" href="https://wordpress.org/support/plugin/responsive-menu/reviews/#new-topic-0" class="button-primary"><?php esc_html_e( 'Yeah, you deserve it!', 'responsive-menu' ); ?></a>
97 + <a href="<?php echo esc_url( add_query_arg( 'rm_review_notice_check', 'already_did' ) ); ?>" class="button-secondary"><?php esc_html_e( 'I already did!', 'responsive-menu' ); ?></a>
98 + <a href="<?php echo esc_url( add_query_arg( 'rm_review_notice_check', 'remove_message' ) ); ?>" class="button-secondary"><?php esc_html_e( 'No, this plugin is not good enough', 'responsive-menu' ); ?></a>
99 + <br /><br /></div>
100 + <?php
114 101 }
115 102
116 103 /**
117 104 * Checks if a link in the admin message has been clicked
@@ -118,25 +105,25 @@
118 105 *
119 106 * @since 4.1.3
120 107 */
121 108 public function admin_notice_check() {
122 - if ( isset( $_GET["rm_review_notice_check"] ) && $_GET["rm_review_notice_check"] == 'remove_message' ) {
123 - $this->trigger = $this->check_message_trigger();
109 + if ( isset( $_GET['rm_review_notice_check'] ) && 'remove_message' === $_GET['rm_review_notice_check'] ) {
110 + $this->trigger = $this->check_message_trigger();
124 111 $update_trigger = -1;
125 - if ( $this->trigger === -1 ) {
112 + if ( -1 === $this->trigger ) {
126 113 exit;
127 - } else if ( $this->trigger === 1 ) {
114 + } elseif ( 1 === $this->trigger ) {
128 115 $update_trigger = 5;
129 - } else if ( $this->trigger === 5 ) {
116 + } elseif ( 5 === $this->trigger ) {
130 117 $update_trigger = 10;
131 - } else if ( $this->trigger === 10 ) {
118 + } elseif ( 10 === $this->trigger ) {
132 119 $update_trigger = -1;
133 120 }
134 121 update_option( 'rm_review_message_trigger', $update_trigger );
135 122 }
136 - if ( isset( $_GET["rm_review_notice_check"] ) && $_GET["rm_review_notice_check"] == 'already_did' ) {
123 + if ( isset( $_GET['rm_review_notice_check'] ) && 'already_did' === $_GET['rm_review_notice_check'] ) {
137 124 update_option( 'rm_review_message_trigger', -1 );
138 125 }
139 126 }
140 127 }
141 128
142 -$rm_review_message = new RM_Review_Message();
129 +$rm_review_message = new RM_Review_Message();