| Server IP : 62.72.47.131 / Your IP : 216.73.217.34 Web Server : Apache/2.4.66 (Debian) System : Linux 975cdb959a49 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : ( 501) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/elementor/modules/atomic-widgets/styles/ |
Upload File : |
<?php
namespace Elementor\Modules\AtomicWidgets\Styles;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
const FONTS_KEY_PREFIX = 'elementor_atomic_styles_fonts-';
class Style_Fonts {
private string $style_key;
public function __construct( string $style_key ) {
$this->style_key = $style_key;
}
public static function make( string $style_key ) {
return new static( $style_key );
}
public function add( string $font ) {
$style_fonts = $this->get_fonts();
if ( ! in_array( $font, $style_fonts, true ) ) {
$style_fonts[] = $font;
$this->update_fonts( $style_fonts );
}
}
public function get(): array {
return $this->get_fonts();
}
public function clear() {
$this->update_fonts( [] );
}
private function get_fonts(): array {
$style_fonts_key = $this->get_key();
return get_option( $style_fonts_key, [] );
}
private function update_fonts( array $fonts ) {
$style_fonts_key = $this->get_key();
if ( empty( $fonts ) ) {
delete_option( $style_fonts_key );
return;
}
update_option( $style_fonts_key, $fonts, false );
}
private function get_key(): string {
return FONTS_KEY_PREFIX . $this->style_key;
}
}