PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.4
Kubio AI Page Builder v2.8.4
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / full-site-editing / class-templates-list-table.php
kubio / lib / full-site-editing Last commit date
block-templates.php 1 year ago class-templates-list-table.php 2 years ago default-template-types.php 7 months ago full-site-editing.php 1 year ago get-block-templates.php 1 year ago template-loader.php 1 year ago template-parts.php 1 month ago templates.php 1 month ago
class-templates-list-table.php
153 lines
1 <?php
2
3 class KubioWPTemplateListTable extends \WP_Posts_List_Table {
4
5
6 protected function handle_row_actions( $item, $column_name, $primary ) {
7
8 if ( $primary !== $column_name ) {
9 return '';
10 }
11
12 $post = $item;
13 $can_edit_post = current_user_can( 'edit_post', $post->ID );
14 $actions = array();
15 $title = _draft_or_post_title();
16
17 if ( $can_edit_post && 'trash' !== $post->post_status ) {
18 $actions['edit'] = sprintf(
19 '<a href="%s" aria-label="%s">%s</a>',
20 $this->kubio_get_edit_post_link( $post ),
21 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
22 esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
23 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
24 __( 'Edit' )
25 );
26
27 if ( 'wp_block' !== $post->post_type ) {
28 $actions['inline hide-if-no-js'] = sprintf(
29 '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
30 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
31 esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
32 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
33 __( 'Quick&nbsp;Edit' )
34 );
35 }
36 }
37
38 if ( current_user_can( 'delete_post', $post->ID ) ) {
39 if ( 'trash' === $post->post_status ) {
40 $actions['untrash'] = sprintf(
41 '<a href="%s" aria-label="%s">%s</a>',
42 wp_nonce_url( admin_url( sprintf( 'post.php?post=%d' . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
43 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
44 esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $title ) ),
45 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
46 __( 'Restore' )
47 );
48 } elseif ( EMPTY_TRASH_DAYS ) {
49 $actions['trash'] = sprintf(
50 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
51 $this->kubio_get_delete_post_link( $post->ID ),
52 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
53 esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $title ) ),
54 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
55 _x( 'Trash', 'verb' )
56 );
57 }
58
59 if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
60 $actions['delete'] = sprintf(
61 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
62 $this->kubio_get_delete_post_link( $post->ID, '', true ),
63 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
64 esc_attr( sprintf( __( 'Delete &#8220;%s&#8221; permanently' ), $title ) ),
65 // phpcs:ignore WordPress.WP.I18n.MissingArgDomain, WordPress.WP.I18n.MissingTranslatorsComment
66 __( 'Delete Permanently' )
67 );
68 }
69 }
70
71 if ( is_post_type_hierarchical( $post->post_type ) ) {
72
73 /**
74 * Filters the array of row action links on the Pages list table.
75 *
76 * The filter is evaluated only for hierarchical post types.
77 *
78 * @since 2.8.0
79 *
80 * @param string[] $actions An array of row action links. Defaults are
81 * 'Edit', 'Quick Edit', 'Restore', 'Trash',
82 * 'Delete Permanently', 'Preview', and 'View'.
83 * @param WP_Post $post The post object.
84 */
85 $actions = apply_filters( 'page_row_actions', $actions, $post );
86 } else {
87
88 /**
89 * Filters the array of row action links on the Posts list table.
90 *
91 * The filter is evaluated only for non-hierarchical post types.
92 *
93 * @since 2.8.0
94 *
95 * @param string[] $actions An array of row action links. Defaults are
96 * 'Edit', 'Quick Edit', 'Restore', 'Trash',
97 * 'Delete Permanently', 'Preview', and 'View'.
98 * @param WP_Post $post The post object.
99 */
100 $actions = apply_filters( 'post_row_actions', $actions, $post );
101 }
102
103 return $this->row_actions( $actions );
104 }
105
106
107 private function kubio_get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) {
108 if ( ! empty( $deprecated ) ) {
109 _deprecated_argument( __FUNCTION__, '3.0.0' );
110 }
111
112 $post = get_post( $post );
113
114 if ( ! $post ) {
115 return;
116 }
117
118 $post_type_object = get_post_type_object( $post->post_type );
119
120 if ( ! $post_type_object ) {
121 return;
122 }
123
124 if ( ! current_user_can( 'delete_post', $post->ID ) ) {
125 return;
126 }
127
128 $action = ( $force_delete || ! EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
129
130 $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( 'post.php?post=%d', $post->ID ) ) );
131
132 /**
133 * Filters the post delete link.
134 *
135 * @since 2.9.0
136 *
137 * @param string $link The delete link.
138 * @param int $post_id Post ID.
139 * @param bool $force_delete Whether to bypass the Trash and force deletion. Default false.
140 */
141 return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
142 }
143
144 private function kubio_get_edit_post_link( $post ) {
145 if ( ! wp_is_block_theme() ) {
146 $action = '&action=edit';
147 return admin_url( sprintf( 'post.php?post=%d' . $action, $post->ID ) );
148 }
149
150 return get_edit_post_link( $post->ID );
151 }
152 }
153