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