PluginProbe
WP Coder – Insert & Manage Code Snippets / 3.0
WP Coder – Insert & Manage Code Snippets v3.0
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 +22 -34 3.13.0 View file →
@@ -4,9 +4,9 @@
4 4
5 5 defined( 'ABSPATH' ) || exit;
6 6
7 7 use WP_List_Table;
8 -use WPCoder\WPCoder;
8 +use WPCoder\WOW_Plugin;
9 9
10 10 class ListTable extends WP_List_Table {
11 11
12 12 public $per_page = 30;
@@ -78,15 +78,15 @@
78 78 }
79 79
80 80 public function get_columns(): array {
81 81 return [
82 - 'cb' => '<input type="checkbox" />',
83 - 'title' => __( 'Title', 'wpcoder' ),
84 - 'code' => __( 'Shortcode', 'wpcoder' ),
85 - 'code-alt' => __( 'Alternative Shortcode', 'wpcoder' ),
86 - 'tag' => __( 'Tag', 'wpcoder' ),
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>',
82 + 'cb' => '<input type="checkbox" />',
83 + 'title' => __( 'Title', 'wpcoder' ),
84 + 'code' => __( 'Shortcode', 'wpcoder' ),
85 + 'code-alt' => __('Alternative Shortcode','wpcoder' ),
86 + 'tag' => __( 'Tag', 'wpcoder' ),
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>',
89 89 ];
90 90
91 91 }
92 92
@@ -106,10 +106,10 @@
106 106 $offset = $this->per_page * ( $paged - 1 );
107 107
108 108 $result = $this->get_results();
109 109
110 - $slug = WPCoder::SLUG;
111 - $shortcode = WPCoder::SHORTCODE;
110 + $slug = WOW_Plugin::SLUG;
111 + $shortcode = WOW_Plugin::SHORTCODE;
112 112
113 113 if ( empty( $result ) ) {
114 114 return $data;
115 115 }
@@ -114,9 +114,10 @@
114 114 return $data;
115 115 }
116 116
117 117 $main_link = add_query_arg( [
118 - 'page' => $slug . '-settings',
118 + 'page' => $slug,
119 + 'tab' => 'settings',
119 120 'action' => 'update'
120 121 ], admin_url( 'admin.php' ) );
121 122 foreach ( $result as $key => $value ) {
122 123
@@ -137,9 +138,9 @@
137 138
138 139 $tag = '';
139 140 if ( isset( $value->tag ) ) {
140 141 $tag_url = add_query_arg( [
141 - 'page' => WPCoder::SLUG,
142 + 'page' => WOW_Plugin::SLUG,
142 143 'tag' => $value->tag
143 144 ], admin_url( 'admin.php' ) );
144 145 $tag = '<a href="' . esc_url( $tag_url ) . '">' . esc_attr( $value->tag ) . '</a>';
145 146 }
@@ -145,15 +146,15 @@
145 146 }
146 147
147 148 $link = add_query_arg( [ 'id' => $value->id ], $main_link );
148 149 $data[] = array(
149 - 'ID' => $value->id,
150 - 'title' => '<a href="' . esc_url( $link ) . '">' . esc_attr( $title ) . '</a>',
151 - '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>',
152 - '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>',
153 - 'tag' => $tag,
154 - 'mode' => $mode,
155 - 'status' => $status,
150 + 'ID' => $value->id,
151 + 'title' => '<a href="' . esc_url( $link ) . '">' . esc_attr( $title ) . '</a>',
152 + 'code' => '[' . esc_attr( $shortcode ) . ' id="' . absint( $value->id ) . '"]',
153 + 'code-alt' => '[' . esc_attr($shortcode) . ' title="' . esc_attr($title) . '"]',
154 + 'tag' => $tag,
155 + 'mode' => $mode,
156 + 'status' => $status,
156 157 );
157 158 }
158 159
159 160 return $data;
@@ -195,9 +196,9 @@
195 196
196 197
197 198 $result = '';
198 199
199 - $table = $wpdb->prefix . WPCoder::PREFIX;
200 + $table = $wpdb->prefix . WOW_Plugin::PREFIX;
200 201
201 202 if ( empty( $search ) ) {
202 203 $result = $wpdb->get_results( "SELECT * FROM $table order by id desc" );
203 204 if ( ! empty( $tag_search ) ) {
@@ -249,17 +250,11 @@
249 250 if ( ! is_array( $ids ) ) {
250 251 $ids = [ $ids ];
251 252 }
252 253 if ( empty( $action ) ) {
253 - return false;
254 + return;
254 255 }
255 256
256 - $verify = $this->verify();
257 -
258 - if ( ! $verify ) {
259 - return false;
260 - }
261 -
262 257 foreach ( $ids as $id ) {
263 258 if ( 'delete' === $this->current_action() ) {
264 259 DBManager::delete( $id );
265 260 }
@@ -318,14 +313,7 @@
318 313
319 314 // Send final sort direction to usort
320 315 return ( $order === 'asc' ) ? $result : - $result;
321 316
322 - }
323 -
324 - private function verify() {
325 - $name = WPCoder::PREFIX . '_list_action';
326 - $nonce_action = WPCoder::PREFIX . '_nonce';
327 -
328 - return ! ( ! isset( $_POST[ $name ] ) || ! wp_verify_nonce( $_POST[ $name ], $nonce_action ) || ! current_user_can( 'unfiltered_html' ) );
329 317 }
330 318
331 319 }