| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/old-website/wp-content/plugins/awesplash/includes/ |
Upload File : |
<?php
/**
* Helper functions file
*
* @package AweSplash
* @since 1.0.0
*/
/**
* Template file
*
* @since 1.0.0
*/
function awesplash_template( $slug, $data = array() ) {
if ( is_array( $data ) ) {
extract( $data );
}
include AWESPLASH_DIR . 'templates/' . $slug . '.php';
}
/**
* Get content of template file
*
* @since 1.0.0
*/
function awesplash_get_template( $slug, $data = array() ) {
ob_start();
awesplash_template( $slug, $data );
return ob_get_clean();
}
/**
* Format font
* @param array $typo Typo formated
* @return string
*/
function awesplash_get_format_font( $typo = array() ) {
$str = '';
if ( !empty( $typo['font-family'] ) ) {
$str .= $typo['font-family'];
if ( !empty( $typo['variants'] ) ) {
$str .= ':' . $typo['variants'];
}
}
return $str;
}
/**
* Merge font
* @param array $typos Key of thememod
* @return string Font url
*/
function awesplash_get_font_url( $typos = array() ) {
$fonts_url = '';
$fonts = array();
$subsets = array();
foreach ( $typos as $theme_mod ) {
$typo = ctoolkit\build_typography( get_theme_mod( $theme_mod ) );
if ( $format = awesplash_get_format_font( $typo ) ) {
$fonts[] = $format;
if ( !empty( $typo['subsets'] ) ) {
$subsets[] = $typo['subsets'];
}
}
}
if ( $fonts ) {
$subsets = array_unique( $subsets );
$query_args = array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( implode( ',', $subsets ) ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
/**
* Check age validate
*
* @param Datetime $date Age of user
* @return int Min Age
* @return bool
*/
function awesplash_age_is_validate( $date, $min_age ) {
$now = new DateTime();
$diff = $date->diff( $now );
if ( $diff->y < $min_age ) {
return false;
} else if ( ($diff->y == $min_age && $diff->m > 0) || ($diff->y == $min_age && $diff->d > 0) ) {
return false;
}
return true;
}
/**
*
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7
* @link https://gist.github.com/stephenharris/5532899
* @param str $hex Colour as hexadecimal (with or without hash);
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() )
* @return str Lightened/Darkend colour as hexadecimal (with hash);
*/
function awesplash_color_luminance( $hex, $percent ) {
// validate hex string
$hex = preg_replace( '/[^0-9a-f]/i', '', $hex );
$new_hex = '#';
if ( strlen( $hex ) < 6 ) {
$hex = $hex[0] + $hex[0] + $hex[1] + $hex[1] + $hex[2] + $hex[2];
}
// convert to decimal and change luminosity
for ( $i = 0; $i < 3; $i++ ) {
$dec = hexdec( substr( $hex, $i * 2, 2 ) );
$dec = min( max( 0, $dec + $dec * $percent ), 255 );
$new_hex .= str_pad( dechex( $dec ), 2, 0, STR_PAD_LEFT );
}
return $new_hex;
}
/**
* Sanitize heading effect
* @param string $value
* @return string Real value
*/
function awesplash_sanitize_heading_effect( $value ) {
$arr = array( 'clip', 'zoom', 'rotate' );
if ( !in_array( $value, $arr ) ) {
return 'clip';
}
return $value;
}
/**
* Sanitize background type
*
* @param string $value
* @return string Background type value
*/
function awesplash_sanitize_background_type( $value ) {
$arr = array( 'color', 'image', 'slider', 'video' );
if ( !in_array( $value, $arr ) ) {
return 'color';
}
return $value;
}
/**
* Sanitize slider effect
*
* @param string $value
* @return string
*/
function awesplash_sanitize_background_slider_effect( $value ) {
$arr = array( 'slide', 'fade' );
if ( !in_array( $value, $arr ) ) {
return 'slide';
}
return $value;
}
/**
* Get current url
*
* @since 1.0.2
*
* @return string URL
*/
function awesplash_get_current_url() {
global $wp;
return home_url( $wp->request );
}