PluginProbe
WP Coder – Insert & Manage Code Snippets / 3.5
WP Coder – Insert & Manage Code Snippets v3.5
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
← All changes | classes/Dashboard/ListTable.php +51 -50 4.5.13.5 View file →
@@ -46,20 +46,20 @@
46 46 <?php
47 47 }
48 48
49 49 public function column_title( $item ): string {
50 - $title = ! empty( $item['title'] ) ? $item['title'] : __( 'Untitled', 'wp-coder' );
50 + $title = ! empty( $item['title'] ) ? $item['title'] : __( 'Untitled', 'wpcoder' );
51 51
52 52 $actions = [
53 53 'id' => 'ID: ' . $item['ID'],
54 54 'edit' => '<a href="' . esc_url( Link::edit( $item['ID'] ) ) . '">' . esc_attr__( 'Edit',
55 - 'wp-coder' ) . '</a>',
55 + 'wpcoder' ) . '</a>',
56 56 'duplicate' => '<a href="' . esc_url( Link::duplicate( $item['ID'] ) ) . '">' . esc_attr__( 'Duplicate',
57 - 'wp-coder' ) . '</a>',
57 + 'wpcoder' ) . '</a>',
58 58 'delete' => '<a href="' . esc_url( Link::remove( $item['ID'] ) ) . '" >' . esc_attr__( 'Delete',
59 - 'wp-coder' ) . '</a>',
59 + 'wpcoder' ) . '</a>',
60 60 'export' => '<a href="' . esc_url( Link::export( $item['ID'] ) ) . '" >' . esc_attr__( 'Export',
61 - 'wp-coder' ) . '</a>',
61 + 'wpcoder' ) . '</a>',
62 62 ];
63 63
64 64
65 65 return $title . $this->row_actions( $actions );
@@ -88,18 +88,18 @@
88 88
89 89 public function get_columns(): array {
90 90 return [
91 91 'cb' => '<input type="checkbox" />',
92 - 'title' => __( 'Title', 'wp-coder' ),
93 - 'code' => __( 'Shortcode', 'wp-coder' ),
94 - 'code-alt' => __( 'Alternative Shortcode', 'wp-coder' ),
95 - 'tag' => __( 'Tag', 'wp-coder' ),
92 + 'title' => __( 'Title', 'wpcoder' ),
93 + 'code' => __( 'Shortcode', 'wpcoder' ),
94 + 'code-alt' => __( 'Alternative Shortcode', 'wpcoder' ),
95 + 'tag' => __( 'Tag', 'wpcoder' ),
96 96 'mode' => __( 'Test mode',
97 - 'wp-coder' ) . '<sup class="wowp-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.',
98 - 'wp-coder' ) . '">ℹ</sup>',
97 + 'wpcoder' ) . '<sup class="has-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.',
98 + 'wpcoder' ) . '">ℹ</sup>',
99 99 'status' => __( 'Status',
100 - 'wp-coder' ) . '<sup class="wowp-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.',
101 - 'wp-coder' ) . '">ℹ</sup>',
100 + 'wpcoder' ) . '<sup class="has-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.',
101 + 'wpcoder' ) . '">ℹ</sup>',
102 102 ];
103 103 }
104 104
105 105 public function get_hidden_columns(): array {
@@ -139,24 +139,24 @@
139 139 $main_link = add_query_arg( $main_link_arg, admin_url( 'admin.php' ) );
140 140
141 141
142 142 foreach ( $result as $key => $value ) {
143 - $title = ! empty( $value->title ) ? $value->title : __( 'Untitled', 'wp-coder' );
144 - $tooltip_off = esc_attr__( 'Click for Deactivate.', 'wp-coder' );
145 - $tooltip_on = esc_attr__( 'Click for Activate.', 'wp-coder' );
143 + $title = ! empty( $value->title ) ? $value->title : __( 'UnTitle', 'wpcoder' );
144 + $tooltip_off = esc_attr__( 'Click for Deactivate.', 'wpcoder' );
145 + $tooltip_on = esc_attr__( 'Click for Activate.', 'wpcoder' );
146 146 $status_off = '<a href="' . esc_url( Link::activate_url( $value->id ) ) . '" class="wowp-toogle is-off" data-tooltip="' . esc_attr( $tooltip_on ) . '"><span>' . esc_attr__( 'OFF',
147 - 'wp-coder' ) . '</span></a>';
147 + 'wpcoder' ) . '</span></a>';
148 148 $status_on = '<a href="' . esc_url( Link::deactivate_url( $value->id ) ) . '" class="wowp-toogle is-on" data-tooltip="' . esc_attr( $tooltip_off ) . '"><span>' . esc_attr__( 'ON',
149 - 'wp-coder' ) . '</span></a>';
149 + 'wpcoder' ) . '</span></a>';
150 150 $status = ! empty( $value->status ) ? $status_off : $status_on;
151 151
152 - $mode_tooltip_off = esc_attr__( 'Click for OFF.', 'wp-coder' );
153 - $mode_tooltip_on = esc_attr__( 'Click for ON.', 'wp-coder' );
152 + $mode_tooltip_off = esc_attr__( 'Click for OFF.', 'wpcoder' );
153 + $mode_tooltip_on = esc_attr__( 'Click for ON.', 'wpcoder' );
154 154
155 155 $mode_off = '<a href="' . esc_url( Link::activate_mode( $value->id ) ) . '" class="wowp-toogle is-off" data-tooltip="' . esc_attr( $mode_tooltip_on ) . '"><span>' . esc_attr__( 'OFF',
156 - 'wp-coder' ) . '</span></a>';
156 + 'wpcoder' ) . '</span></a>';
157 157 $mode_on = '<a href="' . esc_url( Link::deactivate_mode( $value->id ) ) . '" class="wowp-toogle is-on" data-tooltip="' . esc_attr( $mode_tooltip_off ) . '"><span>' . esc_attr__( 'ON',
158 - 'wp-coder' ) . '</span></a>';
158 + 'wpcoder' ) . '</span></a>';
159 159
160 160 $mode = empty( $value->mode ) ? $mode_off : $mode_on;
161 161
162 162 $tag = '';
@@ -171,10 +171,10 @@
171 171 $link = add_query_arg( [ 'id' => $value->id ], $main_link );
172 172 $data[] = array(
173 173 'ID' => $value->id,
174 174 'title' => '<a href="' . esc_url( $link ) . '">' . esc_attr( $title ) . '</a>',
175 - 'code' => '<div class="wowp-field has-addon"><label for="shortcode" class="label is-addon"><span class="wowp-tooltip on-right is-pointer can-copy" data-tooltip="Copy"><span class="wowp-copy icon icon-copy"></span></span></label><input type="text" value="[' . esc_attr( $shortcode ) . ' id=&quot;' . absint( $value->id ) . '&quot;]" readonly="readonly"></div>',
176 - 'code-alt' => '<div class="wowp-field has-addon"><label for="shortcode" class="label is-addon"><span class="wowp-tooltip on-right is-pointer can-copy" data-tooltip="Copy"><span class="wowp-copy icon icon-copy"></span></span></label><input type="text" value="[' . esc_attr( $shortcode ) . ' title=&quot;' . esc_attr( $title ) . '&quot;]" readonly="readonly"></div>',
175 + 'code' => '<div class="wowp-input-group"><input type="text" value="[' . esc_attr( $shortcode ) . ' id=&quot;' . absint( $value->id ) . '&quot;]" readonly="readonly"><span class="wowp-copy codericon codericon-copy"></span></div>',
176 + 'code-alt' => '<div class="wowp-input-group"><input type="text" value="[' . esc_attr( $shortcode ) . ' title=&quot;' . esc_attr( $title ) . '&quot;]" readonly="readonly"><span class="wowp-copy codericon codericon-copy"></span></div>',
177 177 'tag' => $tag,
178 178 'mode' => $mode,
179 179 'status' => $status,
180 180 );
@@ -218,36 +218,38 @@
218 218
219 219 $result = '';
220 220
221 221 $table = $wpdb->prefix . WPCoder::PREFIX;
222 -// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
222 +
223 223 if ( empty( $search ) ) {
224 224 $result = $wpdb->get_results( "SELECT * FROM $table order by id desc" );
225 225 if ( ! empty( $tag_search ) ) {
226 - $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $table WHERE tag=%s order by id desc", $tag_search ));
226 + $result = $wpdb->get_results( "SELECT * FROM $table WHERE tag='$tag_search' order by id desc" );
227 227 }
228 - } elseif ( trim( $search ) === 'Untitled' ) {
228 + } elseif ( trim( $search ) === 'UnTitle' ) {
229 229 $result = $wpdb->get_results( "SELECT * FROM $table WHERE title='' order by id desc" );
230 230 if ( ! empty( $tag_search ) ) {
231 - $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $table WHERE title='' AND tag=%s order by id desc", $tag_search));
231 + $result = $wpdb->get_results( "SELECT * FROM $table WHERE title='' AND tag='$tag_search' order by id desc" );
232 232 }
233 233 } elseif ( is_numeric( $search ) ) {
234 - $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table WHERE id=%d", absint( $search ) ) );
234 + $query = $wpdb->prepare( "SELECT * FROM $table WHERE id=%d", absint( $search ) );
235 235 if ( ! empty( $tag_search ) ) {
236 - $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table WHERE id=%d AND tag=%s", absint( $search ),
237 - $tag_search ) );
236 + $query = $wpdb->prepare( "SELECT * FROM $table WHERE id=%d AND tag='%s'", absint( $search ),
237 + $tag_search );
238 238 }
239 + $result = $wpdb->get_results( $query );
239 240 } else {
240 - $wild = '%';
241 - $find = sanitize_text_field( $search );
242 - $like = $wild . $wpdb->esc_like( $find ) . $wild;
243 - $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table WHERE title LIKE %s order by id desc", $like ) );
241 + $wild = '%';
242 + $find = sanitize_text_field( $search );
243 + $like = $wild . $wpdb->esc_like( $find ) . $wild;
244 + $query = $wpdb->prepare( "SELECT * FROM $table WHERE title LIKE %s order by id desc", $like );
244 245 if ( ! empty( $tag_search ) ) {
245 - $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table WHERE title LIKE %s AND tag=%s order by id desc", $like, $tag_search ) );
246 + $query = $wpdb->prepare( "SELECT * FROM $table WHERE title LIKE %s AND tag='%s' order by id desc",
247 + $like, $tag_search );
246 248 }
249 + $result = $wpdb->get_results( $query );
247 250 }
248 251
249 -// phpcs:enable
250 252 return $result;
251 253 }
252 254
253 255
@@ -252,14 +254,13 @@
252 254
253 255
254 256 public function get_bulk_actions() {
255 257 $actions = [
256 - 'delete' => __( 'Delate', 'wp-coder' ),
257 - 'activate' => __( 'Activate', 'wp-coder' ),
258 - 'deactivate' => __( 'Deactivate', 'wp-coder' ),
259 - 'test_on' => __( 'Test mode ON', 'wp-coder' ),
260 - 'test_off' => __( 'Test mode OFF', 'wp-coder' ),
261 - 'export' => __( 'Export', 'wp-coder' ),
258 + 'delete' => __( 'Delate', 'wpcoder' ),
259 + 'activate' => __( 'Activate', 'wpcoder' ),
260 + 'deactivate' => __( 'Deactivate', 'wpcoder' ),
261 + 'test_on' => __( 'Test mode ON', 'wpcoder' ),
262 + 'test_off' => __( 'Test mode OFF', 'wpcoder' ),
262 263 ];
263 264
264 265 return $actions;
265 266 }
@@ -305,13 +306,13 @@
305 306
306 307 $tag_search = ( ! empty( $_REQUEST['tag'] ) ) ? sanitize_text_field( $_REQUEST ['tag'] ) : '';
307 308 $tag_search = ( $tag_search === 'all' ) ? '' : $tag_search;
308 309
309 - echo '<div class="alignleft actions"><label for="filter-by-tag" class="screen-reader-text">' . esc_attr__( 'Filter by tag',
310 - 'wp-coder' ) . '</label>';
310 + echo '<div class="alignleft actions"><label for="filter-by-tag" class="screen-reader-text">' . __( 'Filter by tag',
311 + 'wpcoder' ) . '</label>';
311 312 echo '<select name="tag" id="filter-by-tag">';
312 - echo '<option value="all"' . selected( 'all', $tag_search, false ) . '>' . esc_attr__( 'All',
313 - 'wp-coder' ) . '</option>';
313 + echo '<option value="all"' . selected( 'all', $tag_search, false ) . '>' . __( 'All',
314 + 'wpcoder' ) . '</option>';
314 315
315 316 if ( ! empty( $tags ) ) {
316 317 foreach ( $tags as $tag ) {
317 318 if ( empty( $tag['tag'] ) ) {
@@ -316,14 +317,14 @@
316 317 foreach ( $tags as $tag ) {
317 318 if ( empty( $tag['tag'] ) ) {
318 319 continue;
319 320 }
320 - echo '<option value="' . esc_attr( trim( $tag['tag'] ) ) . '"' . selected( $tag['tag'], $tag_search,
321 - false ) . '>' . esc_html( $tag['tag'] ) . '</option>';
321 + echo '<option value="' . trim( esc_attr( $tag['tag'] ) ) . '"' . selected( $tag['tag'], $tag_search,
322 + false ) . '>' . esc_attr( $tag['tag'] ) . '</option>';
322 323 }
323 324 }
324 325 echo '</select>';
325 - submit_button( __( 'Filter', 'wp-coder' ), 'secondary', 'action', false );
326 + submit_button( __( 'Filter', 'wpcoder' ), 'secondary', 'action', false );
326 327 echo '</div>';
327 328 }
328 329 }
329 330