PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / trunk
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster vtrunk
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / admin / class-components.php

class-components.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster trunk, at includes/admin/class-components.php

182 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || die();
4
5 /**
6 * Components class.
7 *
8 * @since 1.1.0
9 */
10 class Sellkit_Admin_Components {
11
12 /**
13 * Class instance.
14 *
15 * @since 1.1.0
16 * @var Sellkit_Admin_Components
17 */
18 private static $instance = null;
19
20 /**
21 * Get a class instance.
22 *
23 * @since 1.1.0
24 *
25 * @return Sellkit_Admin_Components Class instance.
26 */
27 public static function get_instance() {
28 if ( null === self::$instance ) {
29 self::$instance = new self();
30 }
31
32 return self::$instance;
33 }
34
35 /**
36 * Class constructor.
37 *
38 * @since 1.1.0
39 */
40 public function __construct() {
41 add_filter( 'sellkit_list_table_page_columns', [ $this, 'modify_page_list_table_columns' ], 10, 2 );
42 add_filter( 'sellkit_list_table_sellkit-coupons_columns', [ $this, 'modify_coupon_list_table_columns' ], 10, 2 );
43 add_filter( 'sellkit_list_table_sellkit-discount_columns', [ $this, 'modify_discount_list_table_columns' ], 10, 2 );
44 add_filter( 'sellkit_list_table_sellkit-alert_columns', [ $this, 'modify_alert_list_table_columns' ], 10, 2 );
45 add_filter( 'sellkit_list_table_sellkit-funnels_columns', [ $this, 'modify_funnel_list_table_columns' ], 10, 2 );
46 }
47
48 /**
49 * Modify page list table columns.
50 *
51 * @since 1.1.0
52 * @param array $columns Columns.
53 * @param array $posts Posts.
54 */
55 public function modify_page_list_table_columns( $columns, $posts ) {
56 $columns['labels'] = [
57 __( 'Header Type (Meta option)', 'sellkit' ),
58 __( 'Header Behavior (Meta option)', 'sellkit' ),
59 ];
60
61 foreach ( $posts as $post ) {
62 $columns['values'][ "post_{$post->ID}" ] = [
63 get_field( 'jupiterx_header_type', $post->ID ),
64 get_field( 'jupiterx_header_behavior', $post->ID ),
65 ];
66 }
67
68 return $columns;
69 }
70
71 /**
72 * Modify coupon list table columns.
73 *
74 * @since 1.1.0
75 * @param array $columns Columns.
76 * @param array $posts Posts.
77 */
78 public function modify_coupon_list_table_columns( $columns, $posts ) {
79 $columns['labels'] = [
80 esc_html__( 'Author', 'sellkit' ),
81 ];
82
83 foreach ( $posts as $post ) {
84 $author_id = get_post_field( 'post_author', $post->ID );
85 $columns['values'][ "post_{$post->ID}" ] = [
86 [
87 'name' => get_the_author_meta( 'display_name', $author_id ),
88 'param' => 'author__in',
89 'type' => 'search',
90 'value' => $author_id,
91 ],
92 ];
93 }
94
95 return $columns;
96 }
97
98 /**
99 * Modify discount list table columns.
100 *
101 * @since 1.1.0
102 * @param array $columns Columns.
103 * @param array $posts Posts.
104 */
105 public function modify_discount_list_table_columns( $columns, $posts ) {
106 $columns['labels'] = [
107 __( 'Author', 'sellkit' ),
108 ];
109
110 foreach ( $posts as $post ) {
111 $author_id = get_post_field( 'post_author', $post->ID );
112 $columns['values'][ "post_{$post->ID}" ] = [
113 [
114 'name' => get_the_author_meta( 'display_name', $author_id ),
115 'param' => 'author__in',
116 'type' => 'search',
117 'value' => $author_id,
118 ],
119 ];
120 }
121
122 return $columns;
123 }
124
125 /**
126 * Modify alert list table columns.
127 *
128 * @since 1.1.0
129 * @param array $columns Columns.
130 * @param array $posts Posts.
131 */
132 public function modify_alert_list_table_columns( $columns, $posts ) {
133 $columns['labels'] = [
134 esc_html__( 'Author', 'sellkit' ),
135 ];
136
137 foreach ( $posts as $post ) {
138 $author_id = get_post_field( 'post_author', $post->ID );
139 $columns['values'][ "post_{$post->ID}" ] = [
140 [
141 'name' => get_the_author_meta( 'display_name', $author_id ),
142 'param' => 'author__in',
143 'type' => 'search',
144 'value' => $author_id,
145 ],
146 ];
147 }
148
149 return $columns;
150 }
151
152
153 /**
154 * Modify discount list table columns.
155 *
156 * @since 1.1.0
157 * @param array $columns Columns.
158 * @param array $posts Posts.
159 */
160 public function modify_funnel_list_table_columns( $columns, $posts ) {
161 $columns['labels'] = [
162 __( 'Author', 'sellkit' ),
163 ];
164
165 foreach ( $posts as $post ) {
166 $author_id = get_post_field( 'post_author', $post->ID );
167 $columns['values'][ "post_{$post->ID}" ] = [
168 [
169 'name' => get_the_author_meta( 'display_name', $author_id ),
170 'param' => 'author__in',
171 'type' => 'search',
172 'value' => $author_id,
173 ],
174 ];
175 }
176
177 return $columns;
178 }
179 }
180
181 Sellkit_Admin_Components::get_instance();
182