PluginProbe
WP Coder – Insert & Manage Code Snippets / 3.4
WP Coder – Insert & Manage Code Snippets v3.4
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 +25 -45 3.53.4 View file →
@@ -32,34 +32,25 @@
32 32 echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
33 33 }
34 34 ?>
35 35 <p class="search-box">
36 - <label class="screen-reader-text" for="<?php
37 - echo esc_attr( $input_id ) ?>"><?php
38 - echo esc_attr( $text ); ?>
36 + <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ) ?>"><?php echo esc_attr( $text ); ?>
39 37 :</label>
40 - <input type="search" id="<?php
41 - echo esc_attr( $input_id ) ?>" name="s" value="<?php
42 - _admin_search_query(); ?>"/>
43 - <?php
44 - submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
38 + <input type="search" id="<?php echo esc_attr( $input_id ) ?>" name="s"
39 + value="<?php _admin_search_query(); ?>"/>
40 + <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
45 41 </p>
46 42 <?php
47 43 }
48 44
49 45 public function column_title( $item ): string {
50 - $title = ! empty( $item['title'] ) ? $item['title'] : __( 'Untitled', 'wpcoder' );
51 -
46 + $title = ! empty( $item['title'] ) ? $item['title'] : __( 'Untitled', 'side-menu' );
52 47 $actions = [
53 48 'id' => 'ID: ' . $item['ID'],
54 - 'edit' => '<a href="' . esc_url( Link::edit( $item['ID'] ) ) . '">' . esc_attr__( 'Edit',
55 - 'wpcoder' ) . '</a>',
56 - 'duplicate' => '<a href="' . esc_url( Link::duplicate( $item['ID'] ) ) . '">' . esc_attr__( 'Duplicate',
57 - 'wpcoder' ) . '</a>',
58 - 'delete' => '<a href="' . esc_url( Link::remove( $item['ID'] ) ) . '" >' . esc_attr__( 'Delete',
59 - 'wpcoder' ) . '</a>',
60 - 'export' => '<a href="' . esc_url( Link::export( $item['ID'] ) ) . '" >' . esc_attr__( 'Export',
61 - 'wpcoder' ) . '</a>',
49 + 'edit' => '<a href="' . esc_url( Link::edit( $item['ID'] ) ) . '">' . esc_attr__( 'Edit', 'wpcoder' ) . '</a>',
50 + 'duplicate' => '<a href="' . esc_url( Link::duplicate( $item['ID'] ) ) . '">' . esc_attr__( 'Duplicate', 'wpcoder' ) . '</a>',
51 + 'delete' => '<a href="' . esc_url( Link::remove( $item['ID'] ) ) . '" >' . esc_attr__( 'Delete', 'wpcoder' ) . '</a>',
52 + 'export' => '<a href="' . esc_url( Link::export( $item['ID'] ) ) . '" >' . esc_attr__( 'Export', 'wpcoder' ) . '</a>',
62 53 ];
63 54
64 55
65 56 return $title . $this->row_actions( $actions );
@@ -92,15 +83,12 @@
92 83 'title' => __( 'Title', 'wpcoder' ),
93 84 'code' => __( 'Shortcode', 'wpcoder' ),
94 85 'code-alt' => __( 'Alternative Shortcode', 'wpcoder' ),
95 86 'tag' => __( 'Tag', 'wpcoder' ),
96 - 'mode' => __( 'Test mode',
97 - 'wpcoder' ) . '<sup class="has-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.',
98 - 'wpcoder' ) . '">ℹ</sup>',
99 - 'status' => __( 'Status',
100 - 'wpcoder' ) . '<sup class="has-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.',
101 - 'wpcoder' ) . '">ℹ</sup>',
87 + 'mode' => __( 'Test mode', 'wpcoder' ) . '<sup class="has-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.', 'wpcoder' ) . '">ℹ</sup>',
88 + 'status' => __( 'Status', 'wpcoder' ) . '<sup class="has-tooltip" data-tooltip="' . __( 'The item will only be displayed for administrators.', 'wpcoder' ) . '">ℹ</sup>',
102 89 ];
90 +
103 91 }
104 92
105 93 public function get_hidden_columns(): array {
106 94 return [];
@@ -124,39 +112,27 @@
124 112
125 113 if ( empty( $result ) ) {
126 114 return $data;
127 115 }
128 - $paged = $_GET['paged'] ?? '';
129 116
130 - $main_link_arg = [
117 + $main_link = add_query_arg( [
131 118 'page' => $slug . '-settings',
132 119 'action' => 'update'
133 - ];
120 + ], admin_url( 'admin.php' ) );
121 + foreach ( $result as $key => $value ) {
134 122
135 - if ( ! empty( $paged ) ) {
136 - $main_link_arg['wpcoder-page'] = absint( $paged );
137 - }
138 -
139 - $main_link = add_query_arg( $main_link_arg, admin_url( 'admin.php' ) );
140 -
141 -
142 - foreach ( $result as $key => $value ) {
143 123 $title = ! empty( $value->title ) ? $value->title : __( 'UnTitle', 'wpcoder' );
144 124 $tooltip_off = esc_attr__( 'Click for Deactivate.', 'wpcoder' );
145 125 $tooltip_on = esc_attr__( 'Click for Activate.', 'wpcoder' );
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 - 'wpcoder' ) . '</span></a>';
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 - 'wpcoder' ) . '</span></a>';
126 + $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', 'wpcoder' ) . '</span></a>';
127 + $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', 'wpcoder' ) . '</span></a>';
150 128 $status = ! empty( $value->status ) ? $status_off : $status_on;
151 129
152 130 $mode_tooltip_off = esc_attr__( 'Click for OFF.', 'wpcoder' );
153 131 $mode_tooltip_on = esc_attr__( 'Click for ON.', 'wpcoder' );
154 132
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 - 'wpcoder' ) . '</span></a>';
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 - 'wpcoder' ) . '</span></a>';
133 + $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', 'wpcoder' ) . '</span></a>';
134 + $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', 'wpcoder' ) . '</span></a>';
159 135
160 136 $mode = empty( $value->mode ) ? $mode_off : $mode_on;
161 137
162 138 $tag = '';
@@ -180,8 +156,10 @@
180 156 );
181 157 }
182 158
183 159 return $data;
160 +
161 +
184 162 }
185 163
186 164 public function column_cb( $item ) {
187 165 return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'ID', $item['ID'] );
@@ -297,12 +275,14 @@
297 275 if ( 'test_off' === $this->current_action() ) {
298 276 Settings::deactivate_mode( $id );
299 277 }
300 278 }
279 +
301 280 }
302 281
303 282 protected function extra_tablenav( $which ) {
304 283 if ( 'top' === $which ) {
284 +
305 285 $tags = DBManager::get_tags_from_table();
306 286
307 287 $tag_search = ( ! empty( $_REQUEST['tag'] ) ) ? sanitize_text_field( $_REQUEST ['tag'] ) : '';
308 288 $tag_search = ( $tag_search === 'all' ) ? '' : $tag_search;
@@ -337,8 +317,9 @@
337 317 $result = strnatcmp( $a[ $orderby ], $b[ $orderby ] );
338 318
339 319 // Send final sort direction to usort
340 320 return ( $order === 'asc' ) ? $result : - $result;
321 +
341 322 }
342 323
343 324 private function verify() {
344 325 $name = WPCoder::PREFIX . '_list_action';
@@ -343,9 +324,8 @@
343 324 private function verify() {
344 325 $name = WPCoder::PREFIX . '_list_action';
345 326 $nonce_action = WPCoder::PREFIX . '_nonce';
346 327
347 - return ! ( ! isset( $_POST[ $name ] ) || ! wp_verify_nonce( $_POST[ $name ],
348 - $nonce_action ) || ! current_user_can( 'unfiltered_html' ) );
328 + return ! ( ! isset( $_POST[ $name ] ) || ! wp_verify_nonce( $_POST[ $name ], $nonce_action ) || ! current_user_can( 'unfiltered_html' ) );
349 329 }
350 330
351 331 }