PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.6.6
LatePoint – Calendar Booking Plugin for Appointments and Events v5.6.6
5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / helpers / meta_helper.php
latepoint / lib / helpers Last commit date
activities_helper.php 3 months ago agent_helper.php 3 months ago analytics_helper.php 1 week ago auth_helper.php 5 days ago blocks_helper.php 2 weeks ago booking_helper.php 4 days ago bricks_helper.php 3 months ago bundles_helper.php 4 days ago calendar_helper.php 2 days ago carts_helper.php 3 months ago connector_helper.php 3 months ago csv_helper.php 3 months ago customer_helper.php 1 month ago customer_import_helper.php 1 month ago database_helper.php 1 week ago debug_helper.php 3 months ago defaults_helper.php 3 months ago elementor_helper.php 3 months ago email_helper.php 3 months ago encrypt_helper.php 3 months ago events_helper.php 3 months ago form_helper.php 3 months ago icalendar_helper.php 3 months ago image_helper.php 3 months ago invoices_helper.php 2 weeks ago license_helper.php 3 months ago location_helper.php 3 months ago marketing_systems_helper.php 3 months ago meeting_systems_helper.php 3 months ago menu_helper.php 2 weeks ago meta_helper.php 3 months ago migrations_helper.php 3 months ago money_helper.php 3 months ago notifications_helper.php 3 months ago nps_survey_helper.php 3 months ago order_intent_helper.php 2 months ago orders_helper.php 3 months ago otp_helper.php 3 months ago pages_helper.php 3 months ago params_helper.php 3 months ago payments_helper.php 2 months ago plugin_version_update_helper.php 2 months ago price_breakdown_helper.php 3 months ago process_jobs_helper.php 3 months ago processes_helper.php 3 months ago razorpay_connect_helper.php 1 week ago replacer_helper.php 3 months ago resource_helper.php 4 days ago roles_helper.php 2 weeks ago router_helper.php 3 months ago service_helper.php 3 months ago sessions_helper.php 3 months ago settings_helper.php 1 week ago short_links_systems_helper.php 3 months ago shortcodes_helper.php 2 weeks ago sms_helper.php 3 months ago steps_helper.php 1 week ago stripe_connect_helper.php 1 week ago styles_helper.php 3 months ago support_topics_helper.php 3 months ago time_helper.php 2 months ago timeline_helper.php 2 months ago transaction_helper.php 1 month ago transaction_intent_helper.php 3 months ago util_helper.php 1 month ago version_specific_updates_helper.php 3 months ago whatsapp_helper.php 1 month ago work_periods_helper.php 3 months ago wp_datetime.php 3 months ago wp_user_helper.php 3 months ago
meta_helper.php
131 lines
1 <?php
2
3 class OsMetaHelper {
4
5 function __construct() {
6 }
7
8 public static function get_service_meta_by_key( $meta_key, $service_id, $default = false ) {
9 $meta = new OsServiceMetaModel();
10 return $meta->get_by_key( $meta_key, $service_id, $default );
11 }
12
13 public static function save_service_meta_by_key( $meta_key, $meta_value, $service_id ) {
14 $meta = new OsServiceMetaModel();
15 return $meta->save_by_key( $meta_key, $meta_value, $service_id );
16 }
17
18 public static function delete_service_meta_by_key( $meta_key, $service_id ) {
19 $meta = new OsServiceMetaModel();
20 return $meta->delete_by_key( $meta_key, $service_id );
21 }
22
23
24 public static function get_agent_meta_by_key( $meta_key, $agent_id, $default = false ) {
25 $meta = new OsAgentMetaModel();
26 return $meta->get_by_key( $meta_key, $agent_id, $default );
27 }
28
29 public static function save_agent_meta_by_key( $meta_key, $meta_value, $agent_id ) {
30 $meta = new OsAgentMetaModel();
31 return $meta->save_by_key( $meta_key, $meta_value, $agent_id );
32 }
33
34 public static function delete_agent_meta_by_key( $meta_key, $agent_id ) {
35 $meta = new OsAgentMetaModel();
36 return $meta->delete_by_key( $meta_key, $agent_id );
37 }
38
39
40
41 public static function get_booking_metas( $booking_id, $default = [] ) {
42 $meta = new OsBookingMetaModel();
43 return $meta->get_by_object_id( $booking_id, $default );
44 }
45
46 public static function get_booking_meta_by_key( $meta_key, $booking_id, $default = false ) {
47 $meta = new OsBookingMetaModel();
48 return $meta->get_by_key( $meta_key, $booking_id, $default );
49 }
50
51 public static function save_booking_meta_by_key( $meta_key, $meta_value, $booking_id ) {
52 $meta = new OsBookingMetaModel();
53 return $meta->save_by_key( $meta_key, $meta_value, $booking_id );
54 }
55
56 public static function delete_booking_meta( $meta_key, $booking_id ) {
57 if ( empty( $meta_key ) || empty( $booking_id ) ) {
58 return;
59 }
60 $booking_meta_model = new OsBookingMetaModel();
61 $booking_meta_model->delete_by_key( $meta_key, $booking_id );
62 }
63
64
65 public static function get_customer_metas( $customer_id, $default = [] ) {
66 $meta = new OsCustomerMetaModel();
67 return $meta->get_by_object_id( $customer_id, $default );
68 }
69
70 public static function get_customer_meta_by_key( $meta_key, $customer_id, $default = false ) {
71 $meta = new OsCustomerMetaModel();
72 return $meta->get_by_key( $meta_key, $customer_id, $default );
73 }
74
75 public static function save_customer_meta_by_key( $meta_key, $meta_value, $customer_id ) {
76 $meta = new OsCustomerMetaModel();
77 return $meta->save_by_key( $meta_key, $meta_value, $customer_id );
78 }
79
80 public static function delete_customer_meta_by_key( $meta_key, $customer_id ) {
81 $meta = new OsCustomerMetaModel();
82 return $meta->delete_by_key( $meta_key, $customer_id );
83 }
84
85 /**
86 * Get Customers By Filter
87 * @param $filters
88 * @return array
89 */
90 public static function get_customers_by_filter( $filters ): array {
91 $meta = new OsCustomerMetaModel();
92 $where = [];
93 foreach ( $filters as $filter_key => $filter_value ) {
94 $where['OR'][] = [
95 'AND' => [
96 'meta_key' => $filter_key,
97 'meta_value LIKE' => '%' . esc_sql( $filter_value ) . '%',
98 ],
99 ];
100 }
101 $customers = $meta->select( 'object_id' )
102 ->where( $where )
103 ->group_by( 'object_id' )
104 ->having( 'COUNT(DISTINCT meta_key)=' . count( $filters ) )
105 ->get_results();
106
107 return array_column( $customers, 'object_id' );
108 }
109
110 public static function get_booking_id_by_meta_value( $meta_key, $meta_value ) {
111 $meta = new OsBookingMetaModel();
112 return $meta->get_object_id_by_value( $meta_key, $meta_value );
113 }
114
115 public static function get_order_id_by_meta_value( $meta_key, $meta_value ) {
116 $meta = new OsOrderMetaModel();
117 return $meta->get_object_id_by_value( $meta_key, $meta_value );
118 }
119
120 public static function get_order_meta_by_key( $meta_key, $order_id, $default = false ) {
121 $meta = new OsOrderMetaModel();
122 return $meta->get_by_key( $meta_key, $order_id, $default );
123 }
124
125 public static function save_order_meta_by_key( $meta_key, $meta_value, $order_id ) {
126 $meta = new OsOrderMetaModel();
127 return $meta->save_by_key( $meta_key, $meta_value, $order_id );
128 }
129 }
130 ?>
131