| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/ |
Upload File : |
<?php
/**
* @package The7
*/
defined( 'ABSPATH' ) || exit;
class The7_Web_Font implements The7_Web_Font_Interface {
/**
* @var string
*/
protected $family = '';
/**
* @var string
*/
protected $subset = '';
/**
* @var array
*/
protected $weight = array();
/**
* @param string $font
*/
public function __construct( $font = '' ) {
// Replace & coz db value is sanitized with esc_attr().
$font = str_replace( '&', '&', $font );
$font_parts = explode( '&', $font );
if ( ! empty( $font_parts[1] ) ) {
$this->subset = str_replace( 'subset=', '', $font_parts[1] );
}
$font_parts = explode( ':', $font_parts[0] );
if ( isset( $font_parts[1] ) ) {
$this->weight = explode( ',', $font_parts[1] );
$this->weight = array_map( 'trim', $this->weight );
sort( $this->weight );
}
if ( '' !== $font_parts[0] ) {
$this->family = $font_parts[0];
}
}
/**
* @return string
*/
public function __toString() {
$variations = join( ',', $this->get_weight() );
$subset = $this->get_subset();
$variations .= ( $subset ? "&subset={$subset}" : '' );
$web_font = $this->get_family();
if ( $variations ) {
$web_font .= ':' . $variations;
}
return $web_font;
}
/**
* @return string
*/
public function get_family() {
return $this->family;
}
/**
* @return string
*/
public function get_subset() {
return $this->subset;
}
/**
* @param string $subset
*/
public function set_subset( $subset ) {
$this->subset = $subset;
}
/**
* @return array
*/
public function get_weight() {
return $this->weight;
}
/**
* @param array $weight
*/
public function set_weight( $weight ) {
$this->weight = (array) $weight;
sort( $this->weight );
}
/**
* @param string $weight
*/
public function add_weight( $weight ) {
if ( ! in_array( $weight, $this->weight ) ) {
$this->weight[] = $weight;
sort( $this->weight );
}
}
}