| Server IP : 108.167.142.43 / Your IP : 216.73.217.58 Web Server : Apache System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64 User : delarice ( 2406) PHP Version : 8.3.36 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home2/delarice/www/wp-content/plugins/elementor/modules/atomic-widgets/styles/ |
Upload File : |
<?php
namespace Elementor\Modules\AtomicWidgets\Styles;
class Style_States {
const HOVER = 'hover';
const ACTIVE = 'active';
const FOCUS = 'focus';
const FOCUS_VISIBLE = 'focus-visible';
const CHECKED = 'checked';
const SELECTED = 'e--selected';
const DISABLED = 'e--disabled';
const PLAYING = 'e--playing';
const PAUSED = 'e--paused';
private static function get_pseudo_states(): array {
return [
self::HOVER,
self::ACTIVE,
self::FOCUS,
self::FOCUS_VISIBLE,
self::CHECKED,
];
}
private static function get_class_states(): array {
return [
self::SELECTED,
self::DISABLED,
self::PLAYING,
self::PAUSED,
];
}
private static function get_additional_states_map(): array {
return [
self::HOVER => [ self::FOCUS_VISIBLE ],
];
}
public static function get_selector_with_state( string $base_selector, string $state ): string {
$additional_states = self::get_additional_states( $state );
$all_states = [ $state, ...$additional_states ];
foreach ( $all_states as $current_state ) {
$selector_strings[] = $base_selector . self::get_state_selector( $current_state );
}
return implode( ',', $selector_strings );
}
public static function get_additional_states( string $state ): array {
return self::get_additional_states_map()[ $state ] ?? [];
}
public static function get_state_selector( string $state ): string {
if ( self::is_class_state( $state ) ) {
return '.' . $state;
}
if ( self::is_pseudo_state( $state ) ) {
return ':' . $state;
}
return $state;
}
public static function get_valid_states(): array {
return [
...array_filter( self::get_pseudo_states(), function ( $state ) {
return ! in_array( $state, self::get_additional_states_map()[ $state ] ?? [], true );
} ),
...self::get_class_states(),
null,
];
}
public static function is_pseudo_state( string $state ): bool {
return in_array( $state, self::get_pseudo_states(), true );
}
public static function is_class_state( string $state ): bool {
return in_array( $state, self::get_class_states(), true );
}
public static function is_valid_state( $state ): bool {
if ( null === $state ) {
return true;
}
return is_string( $state ) && in_array( $state, self::get_valid_states(), true );
}
public static function get_class_states_map(): array {
return [
'selected' => [
'name' => 'selected',
'value' => self::SELECTED,
],
'disabled' => [
'name' => 'disabled',
'value' => self::DISABLED,
],
'playing' => [
'name' => 'playing',
'value' => self::PLAYING,
],
'paused' => [
'name' => 'paused',
'value' => self::PAUSED,
],
];
}
public static function get_pseudo_states_map(): array {
return [
'checked' => [
'name' => 'checked',
'value' => self::CHECKED,
],
];
}
}