# booktics/1.0.29/core/assets/localize.php

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.29. 115 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.29/code/core/assets/localize.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.29/raw/core/assets/localize.php
- Modified: 2026-10-11T10:01:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/booktics/1.0.29/code/core/assets/localize.php#L10-L20`.

```php
<?php
namespace Booktics\Assets;

use Booktics\Admin\Theme_Mode;

if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Manage all localize data
 */
class Localize {

    /**
     * Get admin localize data
     *
     * @return  array Collection localize data
     */
    public static function get_admin() {
        $current_user = wp_get_current_user();
        $user_roles = [];
        if ( isset( $current_user->roles ) && is_array( $current_user->roles) ) {
            foreach( $current_user->roles as $role) {
                $user_roles[] = $role;
            }
        }

        $data = [
            'site_url'            => site_url(),
            'admin_url'           => admin_url(),
            'nonce'               => wp_create_nonce( 'wp_rest' ),
            'date_format'         => get_option( 'date_format' ),
            'date_format_string'  => date_i18n( get_option( 'date_format' ) ),
            'time_format'         => get_option( 'time_format' ),
            'time_format_string'  => date_i18n( get_option( 'time_format' ) ),
            'start_of_week'       => get_option( 'start_of_week', 0 ),
            'current_user_id'     => get_current_user_id(),
            'current_user_email'  => $current_user->user_email,
            'current_user_name'   => $current_user->display_name,
            'currency_list'       => booktics_get_currencies(),
            'bookticsPro'         => class_exists('BookticsPro'),
            'user_role'           => (array) $user_roles,
            'doc_links'           => self::get_doc_links(),
            'aisentic'            => self::get_aisentic_state(),
            'theme_mode'          => Theme_Mode::get_for_user(),
            'dark_mode_enabled'   => Theme_Mode::is_enabled(),
        ];

        return apply_filters( 'booktics_admin_localize', $data );
    }

    /**
     * Build a slug => doc_link map from the module registry.
     *
     * Single source of truth for documentation URLs: both the addon card
     * (PHP `doc_link`) and the React configure modals read from this list,
     * so a doc URL is only ever defined once in booktics_modules_list().
     *
     * @return array<string, string>
     */
    private static function get_doc_links() {
        $doc_links = [];

        foreach ( booktics_modules_list() as $module ) {
            if ( ! empty( $module['slug'] ) && ! empty( $module['doc_link'] ) ) {
                $doc_links[ $module['slug'] ] = $module['doc_link'];
            }
        }

        return $doc_links;
    }

    /**
     * Aisentic connection state for the admin UI.
     *
     * The identity comes from booktics_aisentic_identity() so the email rendered on
     * the consent copy is the same one the register action would send.
     *
     * @return array<string, mixed>
     */
    private static function get_aisentic_state() {
        $identity    = booktics_aisentic_identity();
        $integration = get_option( 'aisentic_integration_settings', [] );

        return [
            'name'                  => $identity['name'],
            'email'                 => $identity['email'],
            'site_url'              => $identity['site_url'],
            'active'                => class_exists( 'Aisentic\Init' ),
            'registered'            => booktics_aisentic_is_registered(),
            'supports_registration' => class_exists( 'Aisentic\Api\Services\Registration_Service' ),
            'connected'             => isset( $integration['booktics']['status'] )
                && 'connected' === $integration['booktics']['status'],
        ];
    }

    /**
     * Get frontend localize data
     *
     * @return  array Collection localize data
     */
    public static function get_frontend() {
        $data = [
            'site_url'            => site_url(),
            'nonce'               => wp_create_nonce( 'wp_rest' ),
            'date_format'         => get_option( 'date_format' ),
            'time_format'         => get_option( 'time_format' ),
            'current_user_id'     => get_current_user_id(),
            'start_of_week'       => get_option( 'start_of_week', 0 ),
            'locale_name'         => strtolower( str_replace( '_', '-', get_locale() ) ),
            'currency_list'       => booktics_get_currencies(),
        ];

        return apply_filters( 'booktics_frontend_localize', $data );
    }
}
```
