PluginProbe
Float menu – awesome floating side menu / 6.1
Float menu – awesome floating side menu v6.1
7.2.5 trunk 2.1 2.2 3.0.1 3.1 3.2.2 3.3.1 3.5 3.5.1 3.5.2 3.5.3. 3.5.4 4.0 4.1 4.1.1 4.2 4.3 4.3.1 4.3.2 5.0 5.0.1 5.0.2 5.0.3 5.1 All 57 releases
← All changes | classes/Admin/Dashboard.php +16 -39 trunk6.1 View file →
@@ -12,10 +12,8 @@
12 12 */
13 13
14 14 namespace FloatMenuLite\Admin;
15 15
16 -defined( 'ABSPATH' ) || exit;
17 -
18 16 use FloatMenuLite\WOWP_Plugin;
19 17
20 18 class Dashboard {
21 19
@@ -41,10 +39,9 @@
41 39
42 40 public static function footer_text( $footer_text ) {
43 41 global $pagenow;
44 42
45 - // No nonce verification is required as this is a read-only operation to check the current admin page.
46 - if ( $pagenow === 'admin.php' && ( isset( $_GET['page'] ) && $_GET['page'] === WOWP_Plugin::SLUG ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
43 + if ( $pagenow === 'admin.php' && ( isset( $_GET['page'] ) && $_GET['page'] === WOWP_Plugin::SLUG ) ) {
47 44 $text = sprintf(
48 45 /* translators: 1: Rating link (URL), 2: Plugin name */
49 46 __( 'Thank you for using <b>%2$s</b>! Please <a href="%1$s" target="_blank">rate us</a>', 'float-menu' ),
50 47 esc_url( WOWP_Plugin::info( 'rating' ) ),
@@ -62,9 +59,9 @@
62 59 $page = 'wow-plugins_page_' . WOWP_Plugin::SLUG;
63 60 if ( $page !== $hook ) {
64 61 return;
65 62 }
66 - do_action( WOWP_Plugin::PREFIX . '_admin_load_assets' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
63 + do_action( WOWP_Plugin::PREFIX . '_admin_load_assets' );
67 64
68 65 $slug = WOWP_Plugin::SLUG;
69 66 $version = WOWP_Plugin::info( 'version' );
70 67 $assets_url = WOWP_Plugin::url() . 'admin/assets/';
@@ -75,9 +72,8 @@
75 72 foreach ( $styles as $key => $style ) {
76 73 $name = $style['file'];
77 74 $file = $key . '.' . $name;
78 75 wp_enqueue_style( $slug . '-admin-' . $name, $assets_url . 'css/' . $file . '.css', null, $version );
79 - wp_style_add_data($slug . '-admin-' . $name, 'rtl', 'replace');
80 76 }
81 77 }
82 78
83 79 $scripts = DashboardHelper::get_files( 'assets/js' );
@@ -85,16 +81,8 @@
85 81 foreach ( $scripts as $key => $script ) {
86 82 $name = $script['file'];
87 83 $file = $key . '.' . $name;
88 84 wp_enqueue_script( $slug . '-admin-' . $name, $assets_url . 'js/' . $file . '.js', [ 'jquery' ], $version, true );
89 - if ( $name === 'general' ) {
90 - wp_localize_script( $slug . '-admin-' . $name, 'wowp_ajax_object', array(
91 - 'url' => admin_url( 'admin-ajax.php' ),
92 - 'security' => wp_create_nonce( WOWP_Plugin::PREFIX . '_settings' ),
93 - 'action' => WOWP_Plugin::PREFIX . '_ajax_settings',
94 - 'prefix' => WOWP_Plugin::PREFIX,
95 - ) );
96 - }
97 85 }
98 86 }
99 87
100 88
@@ -118,9 +106,8 @@
118 106 self::include_pages();
119 107 echo '</div>';
120 108 }
121 109
122 - // phpcs:disable PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
123 110 public static function header(): void {
124 111 $logo_url = self::logo_url();
125 112 ?>
126 113 <div class="wpie-header-wrapper">
@@ -132,26 +119,23 @@
132 119 <img src="<?php echo esc_url( $logo_url ); ?>"
133 120 alt="<?php echo esc_attr( WOWP_Plugin::info( 'name' ) ); ?> logo">
134 121 </div>
135 122 <?php endif; ?>
136 - <h1>
137 - <?php echo esc_html( WOWP_Plugin::info( 'name' ) ); ?>
138 - <sup class="wpie-version"><?php echo esc_html( WOWP_Plugin::info( 'version' ) ); ?></sup>
123 + <h1><?php echo esc_html( WOWP_Plugin::info( 'name' ) ); ?> <sup
124 + class="wpie-version"><?php echo esc_html( WOWP_Plugin::info( 'version' ) ); ?></sup>
139 125 </h1>
140 - <a href="<?php echo esc_url( Link::add_new_item() ); ?>" class="button button-primary">
141 - <?php esc_html_e( 'Add New', 'float-menu' ); ?>
126 + <a href="<?php echo esc_url( Link::add_new_item() ); ?>"
127 + class="button button-primary"><?php esc_html_e( 'Add New', 'float-menu' ); ?>
142 128 </a>
143 - <?php do_action( WOWP_Plugin::PREFIX . '_admin_after_button' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound ?>
144 - <?php do_action( WOWP_Plugin::PREFIX . '_admin_header_links' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound ?>
129 + <?php do_action( WOWP_Plugin::PREFIX . '_admin_header_links' ); ?>
145 130 </div>
146 131 </div>
147 132 </div>
148 133 <?php
134 +
149 135 }
150 136
151 - // phpcs:enable
152 137
153 -
154 138 public static function logo_url(): string {
155 139 $logo_url = WOWP_Plugin::url() . 'admin/assets/img/plugin-logo.png';
156 140 if ( filter_var( $logo_url, FILTER_VALIDATE_URL ) !== false ) {
157 141 return $logo_url;
@@ -162,32 +146,25 @@
162 146
163 147 public static function menu(): void {
164 148 $pages = DashboardHelper::get_files( 'pages' );
165 149
166 - $pages = apply_filters(WOWP_Plugin::PREFIX. '_admin_pages_menu', $pages); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
167 -
168 150 $current_page = self::get_current_page();
169 151
170 - //No nonce checking is required as this is just reading the parameters.
171 - $action = ( isset( $_REQUEST["action"] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST["action"] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
152 + $action = ( isset( $_REQUEST["action"] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST["action"] ) ) : '';
172 153
173 154 echo '<h2 class="nav-tab-wrapper wpie-nav-tab-wrapper">';
174 155 foreach ( $pages as $key => $page ) {
175 - $class = ( $page['file'] === $current_page ) ? ' nav-tab-active wowp-page-' .$page['file'] : ' wowp-page-' . $page['file'];
156 + $class = ( $page['file'] === $current_page ) ? ' nav-tab-active' : '';
176 157 $id = '';
177 158
178 - if ( $action === 'update' && $page['file'] === 'settings' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
179 - $id = ( isset( $_REQUEST["id"] ) ) ? absint( $_REQUEST["id"] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
159 + if ( $action === 'update' && $page['file'] === 'settings' ) {
160 + $id = ( isset( $_REQUEST["id"] ) ) ? absint( $_REQUEST["id"] ) : '';
180 161 $page['name'] = __( 'Update', 'float-menu' ) . ' #' . $id;
181 162 } elseif ( $page['file'] === 'settings' && ( $action !== 'new' && $action !== 'duplicate' ) ) {
182 163 continue;
183 164 }
184 - if($page['file'] === 'pro') {
185 - echo '<a class="nav-tab' . esc_attr( $class ) . '" href="' . esc_url( Link::menu( $page['file'], $action, $id ) ) . '"><span class="wpie-icon wpie_icon-rocket"></span>' . esc_html( $page['name'] ) . '</a>';
186 - } else {
187 - echo '<a class="nav-tab' . esc_attr( $class ) . '" href="' . esc_url( Link::menu( $page['file'], $action, $id ) ) . '">' . esc_html( $page['name'] ) . '</a>';
188 - }
189 165
166 + echo '<a class="nav-tab' . esc_attr( $class ) . '" href="' . esc_url( Link::menu( $page['file'], $action, $id ) ) . '">' . esc_html( $page['name'] ) . '</a>';
190 167 }
191 168 echo '</h2>';
192 169 }
193 170
@@ -193,10 +170,9 @@
193 170
194 171 public static function get_current_page(): string {
195 172 $default = DashboardHelper::first_file( 'pages' );
196 173
197 - // Nonce verification is not required as the “tab” parameter is read-only.
198 - return ( isset( $_REQUEST["tab"] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST["tab"] ) ) : $default; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
174 + return ( isset( $_REQUEST["tab"] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST["tab"] ) ) : $default;
199 175 }
200 176
201 177 public static function include_pages(): void {
202 178 $current_page = self::get_current_page();
@@ -207,10 +183,11 @@
207 183 $current = DashboardHelper::search_value( $pages, $current_page ) ? $current_page : $default;
208 184
209 185 $file = DashboardHelper::get_file( $current, 'pages' );
210 186
187 +
211 188 if ( $file !== false ) {
212 - $file = apply_filters( WOWP_Plugin::PREFIX . '_admin_filter_file', $file, $current ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
189 + $file = apply_filters( WOWP_Plugin::PREFIX . '_admin_filter_file', $file, $current );
213 190
214 191 $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/' . $file;
215 192
216 193 if ( file_exists( $page_path ) ) {