PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 3.0
Admin Columns v3.0
7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Column / ActionColumnHelper.php
codepress-admin-columns / classes / Column Last commit date
Comment 9 years ago Link 9 years ago Media 9 years ago Post 9 years ago User 9 years ago ActionColumnHelper.php 9 years ago Actions.php 9 years ago AjaxValue.php 9 years ago CustomField.php 9 years ago Meta.php 9 years ago Placeholder.php 9 years ago Taxonomy.php 9 years ago UsedByMenu.php 9 years ago WooCommercePlaceholder.php 9 years ago
ActionColumnHelper.php
79 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * Holds all the row actions buttons for each content type (e.g. post, comment, user and media).
9 * WP_List_Table does not have a method for retrieving row actions. This class uses their filters to fetch the actions.
10 * For example usage see the AC_Column_Actions class.
11 *
12 * Class AC_Column_ActionColumnHelper
13 */
14 class AC_Column_ActionColumnHelper {
15
16 private $actions;
17
18 /**
19 * @since 2.5
20 */
21 private static $_instance = null;
22
23 /**
24 * @since 2.5
25 */
26 public static function instance() {
27 if ( null === self::$_instance ) {
28 self::$_instance = new self();
29 }
30
31 return self::$_instance;
32 }
33
34 private function __construct() {
35 add_filter( 'comment_row_actions', array( $this, 'set_comment' ), 10, 2 );
36 add_filter( 'page_row_actions', array( $this, 'set_post' ), 10, 2 );
37 add_filter( 'post_row_actions', array( $this, 'set_post' ), 10, 2 );
38 add_filter( 'media_row_actions', array( $this, 'set_media' ), 10, 2 );
39 add_filter( 'user_row_actions', array( $this, 'set_user' ), 10, 2 );
40 }
41
42 public function set_comment( $actions, $comment ) {
43 $this->actions[ 'comment' ][ $comment->ID ] = $actions;
44
45 return $actions;
46 }
47
48 public function set_post( $actions, $post ) {
49 $this->actions[ 'post' ][ $post->ID ] = $actions;
50
51 return $actions;
52 }
53
54 public function set_media( $actions, $post ) {
55 $this->actions[ 'media' ][ $post->ID ] = $actions;
56
57 return $actions;
58 }
59
60 public function set_user( $actions, $user ) {
61 $this->actions[ 'user' ][ $user->ID ] = $actions;
62
63 return $actions;
64 }
65
66 /**
67 * Retrieve row actions like 'edit, trash, spam' etc.
68 *
69 * @param string $type
70 * @param int $id Object ID
71 *
72 * @return array|false Array with actions
73 */
74 public function get( $type, $id ) {
75 return isset( $this->actions[ $type ][ $id ] ) ? $this->actions[ $type ][ $id ] : array();
76 }
77
78 }
79