??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/pyan.co.uk/wp-content/plugins/latepoint/lib/abilities/class-latepoint-abilities.php
⬅ Kembali
<?php
/**
* LatePoint Abilities — Main loader & hook wiring.
*
* Registers the LatePoint category and all abilities with the WordPress
* Abilities API (requires WordPress 6.9+). The guarded loader in latepoint.php
* ensures this file is only included when the API is available.
*
* @package LatePoint\Abilities
* @since 5.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class LatePointAbilities {
/** @var string[] Config class map: module slug => class name */
private static array $config_modules = [
'bookings' => 'LatePointAbilitiesBookings',
'customers' => 'LatePointAbilitiesCustomers',
'services' => 'LatePointAbilitiesServices',
'agents' => 'LatePointAbilitiesAgents',
'orders' => 'LatePointAbilitiesOrders',
'locations' => 'LatePointAbilitiesLocations',
'calendar' => 'LatePointAbilitiesCalendar',
'analytics' => 'LatePointAbilitiesAnalytics',
'activities' => 'LatePointAbilitiesActivities',
];
/**
* Boot: include module files and wire hooks.
*/
public static function init(): void {
self::include_modules();
// Reset LatePoint's current user on every request to ensure it reflects the latest WP user state.
// This is crucial for accurate permission checks in abilities, especially when user roles or capabilities have changed during the request lifecycle.
add_action( 'set_current_user', [ OsAuthHelper::class, 'reset_current_user' ], 1 );
add_action( 'wp_abilities_api_categories_init', [ __CLASS__, 'register_category' ] );
add_action( 'wp_abilities_api_init', [ __CLASS__, 'register_all' ] );
}
/**
* Include abstract base and all config module files.
*/
private static function include_modules(): void {
$base = LATEPOINT_ABSPATH . 'lib/abilities/';
require_once $base . 'abstract-ability.php';
foreach ( array_keys( self::$config_modules ) as $slug ) {
require_once $base . 'configs/class-latepoint-abilities-' . $slug . '.php';
}
}
/**
* Register the top-level LatePoint category.
*/
public static function register_category(): void {
wp_register_ability_category(
'latepoint',
[
'label' => OsSettingsHelper::get_brand_name(),
'description' => __( 'Appointment scheduling — bookings, customers, services, and staff.', 'latepoint' ),
]
);
}
/**
* Register all abilities from every module.
*
* Read-only abilities register whenever the master toggle is on.
* Mutating abilities require the write toggle; destructive ones
* require the delete toggle.
*/
public static function register_all(): void {
$allow_write = OsSettingsHelper::is_on( 'latepoint_abilities_api_edit' );
$allow_delete = OsSettingsHelper::is_on( 'latepoint_abilities_api_delete' );
foreach ( self::$config_modules as $class ) {
foreach ( $class::get_abilities() as $ability ) {
if ( $ability->is_destructive() && ! $allow_delete ) {
continue;
}
if ( ! $ability->is_read_only() && ! $ability->is_destructive() && ! $allow_write ) {
continue;
}
wp_register_ability( $ability->get_id(), $ability->to_definition() );
}
}
}
}
LatePointAbilities::init();
Nama
Tipe
Ukuran
Diubah
Aksi
📁 activities
dir
—
2026-06-16 10:03
📁 agents
dir
—
2026-06-16 10:03
📁 analytics
dir
—
2026-06-16 10:03
📁 bookings
dir
—
2026-06-16 10:03
📁 calendar
dir
—
2026-06-16 10:03
📁 configs
dir
—
2026-06-16 10:03
📁 customers
dir
—
2026-06-16 10:03
📁 locations
dir
—
2026-06-16 10:03
📁 orders
dir
—
2026-06-16 10:03
📁 services
dir
—
2026-06-16 10:03
🐘 abstract-ability.php
php
3.2 KB
2026-05-14 14:27
🐘 class-latepoint-abilities.php
php
3.1 KB
2026-06-15 12:21