| Server IP : 69.39.225.240 / Your IP : 216.73.216.138 Web Server : Apache System : Linux bronze7.serverhost.net 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : reademotions ( 1074) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/reademotions/www/wp-content/plugins/bb-plugin/classes/ |
Upload File : |
<?php
/**
* Class that handles showing admin pointers.
*
* @since 1.10.3
*/
final class FLBuilderAdminPointers {
/**
* @since 1.10.3
* @var array $pointers
*/
static private $pointers = array();
/**
* Initialize.
*
* @since 1.10.3
* @return void
*/
static public function init() {
add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_scripts' );
}
/**
* Register a pointer.
*
* @since 1.10.3
* @param array $pointer
* @return void
*/
static public function register_pointer( $pointer ) {
self::$pointers[] = $pointer;
}
/**
* Enqueue scripts for showing pointers.
*
* @since 1.10.3
* @return void
*/
static public function enqueue_scripts() {
$pointers = array();
foreach ( self::$pointers as $pointer ) {
if ( ! current_user_can( $pointer['cap'] ) || self::is_dismissed( $pointer['id'] ) ) {
continue;
}
$pointers[] = $pointer;
}
if ( empty( $pointers ) ) {
return;
}
wp_enqueue_style( 'wp-pointer' );
wp_enqueue_script( 'wp-pointer' );
wp_enqueue_script(
'fl-builder-admin-pointers',
FL_BUILDER_URL . 'js/fl-builder-admin-pointers.js',
array( 'jquery', 'wp-pointer' ),
FL_BUILDER_VERSION,
true
);
wp_localize_script( 'fl-builder-admin-pointers', 'FLBuilderAdminPointersConfig', array(
'pointers' => $pointers,
'ajaxurl' => admin_url( 'admin-ajax.php' ),
) );
}
/**
* Check if a pointer has been dismissed by the current user.
*
* @since 1.10.3
* @param string $pointer_id
* @return bool
*/
static private function is_dismissed( $pointer_id ) {
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
return in_array( $pointer_id, $dismissed );
}
}
FLBuilderAdminPointers::init();