Changeset 2788
- Timestamp:
- 03/24/2016 06:25:24 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r2776 r2788 154 154 printf( '<a href="%s">%s</a>', esc_url( 'https://wordpress.org/support/plugin/' . $post->post_name ), $link_text ); 155 155 } 156 157 /** 158 * Generates and displays row action links. 159 * 160 * @access protected 161 * 162 * @param object $post Post being acted upon. 163 * @param string $column_name Current column name. 164 * @param string $primary Primary column name. 165 * @return string Row actions output for posts. 166 */ 167 protected function handle_row_actions( $post, $column_name, $primary ) { 168 if ( $primary !== $column_name ) { 169 return ''; 170 } 171 172 $post_type_object = get_post_type_object( $post->post_type ); 173 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 174 $actions = array(); 175 $title = _draft_or_post_title(); 176 177 if ( $can_edit_post && 'trash' != $post->post_status ) { 178 $actions['edit'] = sprintf( 179 '<a href="%s" aria-label="%s">%s</a>', 180 get_edit_post_link( $post->ID ), 181 /* translators: %s: post title */ 182 esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), 183 __( 'Edit' ) 184 ); 185 186 if ( current_user_can( 'plugin_edit_others', $post->ID ) ) { 187 $actions['inline hide-if-no-js'] = sprintf( 188 '<a href="#" class="editinline" aria-label="%s">%s</a>', 189 /* translators: %s: post title */ 190 esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), 191 __( 'Quick Edit' ) 192 ); 193 } else { 194 wp_dequeue_script( 'inline-edit-post' ); 195 } 196 } 197 198 if ( current_user_can( 'delete_post', $post->ID ) ) { 199 if ( 'trash' === $post->post_status ) { 200 $actions['untrash'] = sprintf( 201 '<a href="%s" aria-label="%s">%s</a>', 202 wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ), 203 /* translators: %s: post title */ 204 esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ), 205 __( 'Restore' ) 206 ); 207 } elseif ( EMPTY_TRASH_DAYS ) { 208 $actions['trash'] = sprintf( 209 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 210 get_delete_post_link( $post->ID ), 211 /* translators: %s: post title */ 212 esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ), 213 _x( 'Trash', 'verb' ) 214 ); 215 } 216 if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) { 217 $actions['delete'] = sprintf( 218 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 219 get_delete_post_link( $post->ID, '', true ), 220 /* translators: %s: post title */ 221 esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ), 222 __( 'Delete Permanently' ) 223 ); 224 } 225 } 226 227 if ( is_post_type_viewable( $post_type_object ) ) { 228 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 229 if ( $can_edit_post ) { 230 $preview_link = get_preview_post_link( $post ); 231 $actions['view'] = sprintf( 232 '<a href="%s" rel="permalink" aria-label="%s">%s</a>', 233 esc_url( $preview_link ), 234 /* translators: %s: post title */ 235 esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), 236 __( 'Preview' ) 237 ); 238 } 239 } elseif ( 'trash' != $post->post_status ) { 240 $actions['view'] = sprintf( 241 '<a href="%s" rel="permalink" aria-label="%s">%s</a>', 242 get_permalink( $post->ID ), 243 /* translators: %s: post title */ 244 esc_attr( sprintf( __( 'View “%s”' ), $title ) ), 245 __( 'View' ) 246 ); 247 } 248 } 249 250 if ( is_post_type_hierarchical( $post->post_type ) ) { 251 252 /** 253 * Filter the array of row action links on the Pages list table. 254 * 255 * The filter is evaluated only for hierarchical post types. 256 * 257 * @param array $actions An array of row action links. Defaults are 258 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 259 * 'Delete Permanently', 'Preview', and 'View'. 260 * @param WP_Post $post The post object. 261 */ 262 $actions = apply_filters( 'page_row_actions', $actions, $post ); 263 } else { 264 265 /** 266 * Filter the array of row action links on the Posts list table. 267 * 268 * The filter is evaluated only for non-hierarchical post types. 269 * 270 * @param array $actions An array of row action links. Defaults are 271 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 272 * 'Delete Permanently', 'Preview', and 'View'. 273 * @param WP_Post $post The post object. 274 */ 275 $actions = apply_filters( 'post_row_actions', $actions, $post ); 276 } 277 278 return $this->row_actions( $actions ); 279 } 156 280 }
Note: See TracChangeset
for help on using the changeset viewer.