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 | v4.0.0/inc/classes/class-plugin.php +19 -4 4.1.6 → 4.7.4 View file →
@@ -45,9 +45,16 @@
45 45 */
46 46 protected function setup_hooks() {
47 47 add_action( 'plugins_loaded', array( $this, 'rmp_load_plugin_text_domain' ) );
48 48 add_action( 'admin_notices', array( $this, 'rmp_deactivate_paid_version_notice' ) );
49 - add_action( 'admin_notices', array( $this, 'rmp_upgrade_pro_admin_notice' ) );
49 +
50 + //Hiding upgrade to pro notice for v3 users
51 + global $wpdb;
52 + $table_name = $wpdb->prefix . 'responsive_menu';
53 + $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
54 + if ( ! $wpdb->get_var( $query ) == $table_name ) {
55 + add_action( 'admin_notices', array( $this, 'rmp_upgrade_pro_admin_notice' ) );
56 + }
50 57 add_action( 'plugin_action_links_' . plugin_basename( RMP_PLUGIN_FILE ), array( $this, 'rmp_upgrade_pro_plugin_link' ) );
51 58 add_action( 'wp_ajax_rmp_upgrade_admin_notice_dismiss', array( $this, 'rmp_upgrade_pro_notice_dismiss' ) );
52 59 add_action( 'admin_notices', array( $this, 'no_menu_admin_notice' ) );
53 60
@@ -70,9 +77,13 @@
70 77
71 78 // Check post type.
72 79 $post_type = get_post_type();
73 80 if ( empty( $post_type ) && ! empty( $_GET['post_type'] ) ) {
74 - $post_type = intval( $_GET['post_type'] );
81 + // A post type is a slug, not a number: intval() made this always 0.
82 + // is_scalar() because ?post_type[]=x would otherwise reach strtolower( array ).
83 + $post_type = is_scalar( $_GET['post_type'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
84 + ? sanitize_key( wp_unslash( $_GET['post_type'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
85 + : '';
75 86 }
76 87
77 88 if ( 'rmp_menu' !== $post_type || ! empty( $_GET['page'] ) ) {
78 89 return;
@@ -127,9 +138,13 @@
127 138 */
128 139 public function rmp_upgrade_pro_admin_notice() {
129 140 $post_type = get_post_type();
130 141 if ( empty( $post_type ) && ! empty( $_GET['post_type'] ) ) {
131 - $post_type = intval( $_GET['post_type'] );
142 + // A post type is a slug, not a number: intval() made this always 0.
143 + // is_scalar() because ?post_type[]=x would otherwise reach strtolower( array ).
144 + $post_type = is_scalar( $_GET['post_type'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
145 + ? sanitize_key( wp_unslash( $_GET['post_type'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
146 + : '';
132 147 }
133 148
134 149 if ( 'rmp_menu' !== $post_type ) {
135 150 return;
@@ -214,9 +229,9 @@
214 229 public function has_support( $hook ) {
215 230
216 231 // Check wp footer option is enabled.
217 232 $option_manager = Option_Manager::get_instance();
218 - if ( 'wp_body_open' == $hook && 'on' == $option_manager->get_global_option( 'rmp_wp_footer_hook' ) ) {
233 + if ( 'wp_body_open' === $hook && 'on' === $option_manager->get_global_option( 'rmp_wp_footer_hook' ) ) {
219 234 return false;
220 235 }
221 236
222 237 // Check wp core support wp_body_open hook or not.