| 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/test21.chuangfenglink.xyz/wp-content/themes/dt-the7/inc/ |
Upload File : |
<?php
/**
* The7 less gradient class.
*
* @package The7
*/
defined( 'ABSPATH' ) || exit;
/**
* Class The7_Less_Gradient
*/
class The7_Less_Gradient {
/**
* @var array
*/
protected $color_stops = array();
/**
* @var string
*/
protected $angle = '';
/**
* The7_Less_Gradient constructor.
*
* @param string $gradient
*/
public function __construct( $gradient ) {
if ( ! $gradient ) {
return;
}
$grad_parts = explode( '|', $gradient );
$this->angle = array_shift( $grad_parts );
foreach ( $grad_parts as $color_stop ) {
$this->color_stops[] = $this->new_color_stop( $color_stop );
}
}
/**
* @return string
*/
public function __toString() {
return $this->get_string();
}
/**
* Return string representation of gradient.
*
* @return string
*/
public function get_string() {
if ( empty( $this->color_stops ) ) {
return '';
}
return $this->angle . ', ' . implode( ', ', $this->color_stops );
}
/**
* Return $pos color stop.
*
* @param int $pos
*
* @return The7_Less_Gradient_Color_Stop_Interface
*/
public function get_color_stop( $pos ) {
-- $pos;
return array_key_exists( $pos, $this->color_stops ) ? $this->color_stops[ $pos ] : $this->new_color_stop( '' );
}
/**
* Return the last color stop.
*
* @return The7_Less_Gradient_Color_Stop
*/
public function get_last_color_stop() {
reset( $this->color_stops );
$last_color_stop = end( $this->color_stops );
return $last_color_stop ? $last_color_stop : $this->new_color_stop( '' );
}
/**
* Set gradient opacity.
*
* @param mixed $val
*
* @return The7_Less_Gradient $this
*/
public function with_opacity( $val ) {
if ( in_array( $val, array( null, false, '' ), true ) ) {
return $this;
}
$clone = clone $this;
$clone->color_stops = array();
foreach ( $this->color_stops as $color_stop ) {
$clone->color_stops[] = $color_stop->with_opacity( $val );
}
return $clone;
}
/**
* Set gradient angle.
*
* @param string $angle
*
* @return The7_Less_Gradient $this
*/
public function with_angle( $angle ) {
if ( in_array( $angle, array( null, false, '' ), true ) ) {
return $this;
}
$clone = clone $this;
$clone->angle = $angle;
return $clone;
}
/**
* Create new color stop object.
*
* @param string $str
*
* @return The7_Less_Gradient_Color_Stop
*/
protected function new_color_stop( $str ) {
return new The7_Less_Gradient_Color_Stop( $str );
}
}