PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.3.4
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.3.4
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 2.3.4, at includes/admin/class-components.php

190 lines 4.7 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 esc_html__( 'Created at', 'sellkit' ),
82 ];
83
84 foreach ( $posts as $post ) {
85 $author_id = get_post_field( 'post_author', $post->ID );
86 $columns['values'][ "post_{$post->ID}" ] = [
87 [
88 'name' => get_the_author_meta( 'display_name', $author_id ),
89 'param' => 'author__in',
90 'type' => 'search',
91 'value' => $author_id,
92 ],
93 get_the_date( 'Y/m/d h:i A', $post->ID ),
94 ];
95 }
96
97 return $columns;
98 }
99
100 /**
101 * Modify discount list table columns.
102 *
103 * @since 1.1.0
104 * @param array $columns Columns.
105 * @param array $posts Posts.
106 */
107 public function modify_discount_list_table_columns( $columns, $posts ) {
108 $columns['labels'] = [
109 __( 'Author', 'sellkit' ),
110 __( 'Created at', 'sellkit' ),
111 ];
112
113 foreach ( $posts as $post ) {
114 $author_id = get_post_field( 'post_author', $post->ID );
115 $columns['values'][ "post_{$post->ID}" ] = [
116 [
117 'name' => get_the_author_meta( 'display_name', $author_id ),
118 'param' => 'author__in',
119 'type' => 'search',
120 'value' => $author_id,
121 ],
122 get_the_date( 'Y/m/d h:i A', $post->ID ),
123 ];
124 }
125
126 return $columns;
127 }
128
129 /**
130 * Modify alert list table columns.
131 *
132 * @since 1.1.0
133 * @param array $columns Columns.
134 * @param array $posts Posts.
135 */
136 public function modify_alert_list_table_columns( $columns, $posts ) {
137 $columns['labels'] = [
138 esc_html__( 'Author', 'sellkit' ),
139 esc_html__( 'Created at', 'sellkit' ),
140 ];
141
142 foreach ( $posts as $post ) {
143 $author_id = get_post_field( 'post_author', $post->ID );
144 $columns['values'][ "post_{$post->ID}" ] = [
145 [
146 'name' => get_the_author_meta( 'display_name', $author_id ),
147 'param' => 'author__in',
148 'type' => 'search',
149 'value' => $author_id,
150 ],
151 get_the_date( 'Y/m/d h:i A', $post->ID ),
152 ];
153 }
154
155 return $columns;
156 }
157
158
159 /**
160 * Modify discount list table columns.
161 *
162 * @since 1.1.0
163 * @param array $columns Columns.
164 * @param array $posts Posts.
165 */
166 public function modify_funnel_list_table_columns( $columns, $posts ) {
167 $columns['labels'] = [
168 __( 'Author', 'sellkit' ),
169 __( 'Created at', 'sellkit' ),
170 ];
171
172 foreach ( $posts as $post ) {
173 $author_id = get_post_field( 'post_author', $post->ID );
174 $columns['values'][ "post_{$post->ID}" ] = [
175 [
176 'name' => get_the_author_meta( 'display_name', $author_id ),
177 'param' => 'author__in',
178 'type' => 'search',
179 'value' => $author_id,
180 ],
181 get_the_date( 'Y/m/d h:i A', $post->ID ),
182 ];
183 }
184
185 return $columns;
186 }
187 }
188
189 Sellkit_Admin_Components::get_instance();
190