PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.28
Booktics – Appointment Booking Calendar for Service Businesses v1.0.28
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
← All changes | core/assets/localize.php +53 -0 1.0.20 → 1.0.28 View file →
@@ -1,7 +1,9 @@
1 1 <?php
2 2 namespace Booktics\Assets;
3 3
4 +use Booktics\Admin\Theme_Mode;
5 +
4 6 if ( ! defined( 'ABSPATH' ) ) exit;
5 7
6 8 /**
7 9 * Manage all localize data
@@ -31,14 +33,65 @@
31 33 'time_format' => get_option( 'time_format' ),
32 34 'time_format_string' => date_i18n( get_option( 'time_format' ) ),
33 35 'start_of_week' => get_option( 'start_of_week', 0 ),
34 36 'current_user_id' => get_current_user_id(),
37 + 'current_user_email' => $current_user->user_email,
38 + 'current_user_name' => $current_user->display_name,
35 39 'currency_list' => booktics_get_currencies(),
36 40 'bookticsPro' => class_exists('BookticsPro'),
37 41 'user_role' => (array) $user_roles,
42 + 'doc_links' => self::get_doc_links(),
43 + 'aisentic' => self::get_aisentic_state(),
44 + 'theme_mode' => Theme_Mode::get_for_user(),
45 + 'dark_mode_enabled' => Theme_Mode::is_enabled(),
38 46 ];
39 47
40 48 return apply_filters( 'booktics_admin_localize', $data );
49 + }
50 +
51 + /**
52 + * Build a slug => doc_link map from the module registry.
53 + *
54 + * Single source of truth for documentation URLs: both the addon card
55 + * (PHP `doc_link`) and the React configure modals read from this list,
56 + * so a doc URL is only ever defined once in booktics_modules_list().
57 + *
58 + * @return array<string, string>
59 + */
60 + private static function get_doc_links() {
61 + $doc_links = [];
62 +
63 + foreach ( booktics_modules_list() as $module ) {
64 + if ( ! empty( $module['slug'] ) && ! empty( $module['doc_link'] ) ) {
65 + $doc_links[ $module['slug'] ] = $module['doc_link'];
66 + }
67 + }
68 +
69 + return $doc_links;
70 + }
71 +
72 + /**
73 + * Aisentic connection state for the admin UI.
74 + *
75 + * The identity comes from booktics_aisentic_identity() so the email rendered on
76 + * the consent copy is the same one the register action would send.
77 + *
78 + * @return array<string, mixed>
79 + */
80 + private static function get_aisentic_state() {
81 + $identity = booktics_aisentic_identity();
82 + $integration = get_option( 'aisentic_integration_settings', [] );
83 +
84 + return [
85 + 'name' => $identity['name'],
86 + 'email' => $identity['email'],
87 + 'site_url' => $identity['site_url'],
88 + 'active' => class_exists( 'Aisentic\Init' ),
89 + 'registered' => booktics_aisentic_is_registered(),
90 + 'supports_registration' => class_exists( 'Aisentic\Api\Services\Registration_Service' ),
91 + 'connected' => isset( $integration['booktics']['status'] )
92 + && 'connected' === $integration['booktics']['status'],
93 + ];
41 94 }
42 95
43 96 /**
44 97 * Get frontend localize data