PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.2.10
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.2.10
5.6.11 5.6.10 5.6.9 5.6.8 5.6.7 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 / bricks_helper.php
latepoint / lib / helpers Last commit date
activities_helper.php 1 year ago agent_helper.php 1 year ago analytics_helper.php 6 months ago auth_helper.php 6 months ago blocks_helper.php 1 year ago booking_helper.php 6 months ago bricks_helper.php 1 year ago bundles_helper.php 1 year ago calendar_helper.php 11 months ago carts_helper.php 1 year ago connector_helper.php 11 months ago csv_helper.php 6 months ago customer_helper.php 6 months ago customer_import_helper.php 6 months ago database_helper.php 11 months ago debug_helper.php 1 year ago defaults_helper.php 1 year ago elementor_helper.php 1 year ago email_helper.php 11 months ago encrypt_helper.php 1 year ago events_helper.php 11 months ago form_helper.php 6 months ago icalendar_helper.php 1 year ago image_helper.php 1 year ago invoices_helper.php 6 months ago license_helper.php 1 year ago location_helper.php 1 year ago marketing_systems_helper.php 1 year ago meeting_systems_helper.php 1 year ago menu_helper.php 11 months ago meta_helper.php 6 months ago migrations_helper.php 1 year ago money_helper.php 6 months ago notifications_helper.php 11 months ago nps_survey_helper.php 6 months ago order_intent_helper.php 11 months ago orders_helper.php 1 year ago otp_helper.php 11 months ago pages_helper.php 1 year ago params_helper.php 1 year ago payments_helper.php 1 year ago price_breakdown_helper.php 1 year ago process_jobs_helper.php 1 year ago processes_helper.php 1 year ago replacer_helper.php 1 year ago resource_helper.php 1 year ago roles_helper.php 8 months ago router_helper.php 1 year ago service_helper.php 1 year ago sessions_helper.php 6 months ago settings_helper.php 6 months ago short_links_systems_helper.php 11 months ago shortcodes_helper.php 11 months ago sms_helper.php 1 year ago steps_helper.php 6 months ago stripe_connect_helper.php 11 months ago styles_helper.php 11 months ago support_topics_helper.php 1 year ago time_helper.php 11 months ago timeline_helper.php 11 months ago transaction_helper.php 6 months ago transaction_intent_helper.php 1 year ago util_helper.php 8 months ago version_specific_updates_helper.php 11 months ago whatsapp_helper.php 1 year ago work_periods_helper.php 7 months ago wp_datetime.php 1 year ago wp_user_helper.php 1 year ago
bricks_helper.php
88 lines
1 <?php
2
3 class OsBricksHelper {
4
5 private static ?OsBricksHelper $_instance = null;
6 private string $min_php_version = '7.4';
7 private static array $data = [];
8
9 private array $widgets = [
10 'book_button',
11 'list_of_resources',
12 'customer_login',
13 'customer_dashboard',
14 'calendar',
15 'book_form',
16 ];
17
18 public static function init(): OsBricksHelper {
19 if ( is_null(self::$_instance)) {
20 self::$_instance = new self();
21 }
22
23 return self::$_instance;
24 }
25
26 public function __construct() {
27 if ($this->check_requirements()) {
28 self::set_data();
29 $this->register_widgets();
30 }
31 }
32
33
34 private function check_requirements(): bool {
35 if(!class_exists( '\Bricks\Elements' )){
36 return false;
37 }
38 if ( ! $this->check_php_version() ) {
39 add_action( 'admin_notices', [ $this, 'php_version_error' ] );
40 return false;
41 }
42 return true;
43 }
44
45 private function check_php_version(): bool {
46 return version_compare( PHP_VERSION, $this->min_php_version, '>=' );
47 }
48
49 private function php_version_error(): void {
50 $message = esc_html__( 'Theme requires PHP version', 'latepoint' ) . ' <strong>' . $this->min_php_version . '</strong> ' . esc_html__( 'or greater.', 'latepoint' );
51 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
52 }
53
54 private function register_widgets() {
55 foreach ( $this->widgets as $widget ) {
56 $path = LATEPOINT_ABSPATH . 'blocks/bricks/bricks_widget_' . $widget . '.php';
57 if ( file_exists( $path ) ) {
58 \Bricks\Elements::register_element( $path );
59 }
60 }
61 }
62
63 public static function get_data( $key = false) {
64 if (!$key) {
65 return self::$data;
66 }
67 if (!empty(self::$data[$key])) {
68 return self::$data[$key];
69 }
70 return [];
71 }
72
73 private function set_data() {
74 $localized_vars = OsBlockHelper::localized_vars_for_blocks();
75 self::$data['agents'] = array_column($localized_vars['agents'], 'name', 'id');
76 self::$data['services'] = array_column($localized_vars['services'], 'name', 'id');;
77 self::$data['locations'] = array_column($localized_vars['locations'], 'name', 'id');
78 self::$data['bundles'] = array_column($localized_vars['bundles'], 'name', 'id');
79 self::$data['location_categories'] = OsLocationHelper::get_location_categories();
80 self::$data['service_categories'] = array_column($localized_vars['service_categories'], 'name', 'id');
81 self::$data['selected_agents'] = array_column($localized_vars['selected_agents_options'], 'label', 'value');
82 self::$data['selected_services'] = array_column($localized_vars['selected_services_options'], 'label', 'value');
83 self::$data['selected_service_categories'] = array_column($localized_vars['selected_service_categories_options'], 'label', 'value');
84 self::$data['selected_locations'] = array_column($localized_vars['selected_locations_options'], 'label', 'value');
85 self::$data['selected_bundles'] = array_column($localized_vars['selected_bundles_options'], 'label', 'value');
86 }
87
88 }