| Server IP : 198.38.94.67 / Your IP : 216.73.217.142 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/azfilmst/goldendunesfilmfestival.com/wp-content/plugins/pt-mirel-addons/include/ |
Upload File : |
<?php
/**
* TypeKit Ajax
*/
if (!function_exists('typekit_ajax')) {
function typekit_ajax($id = '') {
if (!empty($_POST['id'])) {
$id = $_POST['id'];
} elseif (!$id) {
return false;
}
if (class_exists('Typekit')) {
$typekit = new Typekit();
$fonts_array = $typekit->get($id);
$typekit_html = '';
$font_weight_change_array = array(
'search' => array('n1', 'i1', 'n2', 'i2', 'n3', 'i3', 'n4', 'i4', 'n5', 'i5', 'n6', 'i6', 'n7', 'i7', 'n8', 'i8', 'n9', 'i9'),
'replace' => array('Thin', 'Thin Italic', 'ExtraLight', 'ExtraLight Italic', 'Light', 'Light Italic', 'Regular', 'Italic', 'Medium', 'Medium Italic', 'SemiBold', 'SemiBold Italic', 'Bold', 'Bold Italic', 'ExtraBold', 'ExtraBold Italic', 'Ultra', 'Ultra Italic'),
);
if (is_array($fonts_array)) {
$typekit_html .= '<link rel="stylesheet" href="https://use.typekit.net/' . strip_tags($id) . '.css">';
$typekit_html .= '<div class="redux-typekit-block">';
foreach ($fonts_array['kit']['families'] as $font) {
$typekit_html .= '<div class="item">';
$typekit_html .= '<div class="label"><strong>' . esc_html__('Font Family:', 'pt-addons') . '</strong> ' . strip_tags($font['name']) . '</div>';
$typekit_html .= '<div class="value"><strong>' . esc_html__('Font Weights:', 'pt-addons') . '</strong> ' . strip_tags(str_replace($font_weight_change_array['search'], $font_weight_change_array['replace'], implode(', ', $font['variations']))) . '</div>';
$typekit_html .= '<div class="font-example" style="font-family: \'' . esc_attr($font['slug']) . '\'">' . esc_html__('The quick brown fox jumps over the lazy dog', 'pt-addons') . '</div>';
$typekit_html .= '</div>';
}
$typekit_html .= '</div>';
} else {
$typekit_html .= '<div>' . esc_html__('Nothing Found', 'pt-addons') . '</div>';
}
echo wp_kses($typekit_html, array(
'link' => array(
'rel' => true,
'href' => true,
),
'div' => array(
'class' => true,
),
'strong' => array(
'class' => true,
),
));
}
}
add_action('wp_ajax_typekit_ajax', 'typekit_ajax');
add_action('wp_ajax_nopriv_typekit_ajax', 'typekit_ajax');
}
/**
* Custom Head Script
*/
if (!function_exists('yprm_custom_head_script')) {
function yprm_custom_head_script() {
if (function_exists('yprm_get_theme_setting') && !empty(yprm_get_theme_setting('code_in_head'))) {
echo yprm_get_theme_setting('code_in_head');
}
}
add_action( 'wp_head', 'yprm_custom_head_script', 500 );
}
/**
* Custom Footer Script
*/
if (!function_exists('yprm_custom_footer_script')) {
function yprm_custom_footer_script() {
if (function_exists('yprm_get_theme_setting') && !empty(yprm_get_theme_setting('code_before_body'))) {
echo yprm_get_theme_setting('code_before_body');
}
}
add_action( 'wp_footer', 'yprm_custom_footer_script', 500 );
}
/**
* Add Mime Types
*/
function yprm_enable_extended_upload($mime_types = array()) {
$mime_types['eot'] = 'application/vnd.ms-fontobject';
$mime_types['ttf'] = 'font/sfnt';
$mime_types['woff'] = 'application/font-woff';
return $mime_types;
}
add_filter('upload_mimes', 'yprm_enable_extended_upload');
/**
* Add Elementor Fonts Group
*/
if(!function_exists('yprm_add_fonts_groups_elementor')) {
function yprm_add_fonts_groups_elementor( $font_groups ) {
$font_groups = array( 'mirel_fonts' => esc_html__( 'Mirel Fonts' ) ) + $font_groups;
return $font_groups;
}
add_filter( 'elementor/fonts/groups', 'yprm_add_fonts_groups_elementor');
}
/**
* Add Fonts To Elementor
*/
if(!function_exists('yprm_add_fonts_elementor')) {
function yprm_add_fonts_elementor( $additional_fonts ) {
global $mirel_theme;
if ( ! isset( $mirel_theme['custom_fonts'] ) ) {
return $additional_fonts;
}
$fonts_array = (object) array_reverse(json_decode('['.$mirel_theme['custom_fonts']['fonts'].']'));
foreach ($fonts_array as $font) {
$value = $font->family;
if($font->type == 'typekit') {
$value = $font->slug;
}
$additional_fonts = array( $value => 'mirel_fonts' ) + $additional_fonts;
}
return $additional_fonts;
}
add_filter('elementor/fonts/additional_fonts', 'yprm_add_fonts_elementor');
}
/**
* Page Accent Color
*/
if(!function_exists('yprm_accent_color') && function_exists('get_field') && function_exists('yprm_accent_color_array')) {
function yprm_accent_color() {
$color = get_field('accent_color');
$class_array = yprm_accent_color_array();
if(!$color) return false;
$css_code = '';
foreach($class_array as $proprety => $class) {
if(!$class) continue;
$css_code .= "$class {
$proprety: $color;
}";
}
do_action('yprm_inline_css', $css_code);
}
add_action('wp_head', 'yprm_accent_color');
}
/**
* Page Footer Custom Colors
*/
if(!function_exists('yprm_page_footer_custom_colors') && function_exists('get_field')) {
function yprm_page_footer_custom_colors() {
$bg = get_field('footer_bg_color');
$color = get_field('footer_text_color');
$css = '';
if(!$bg && !$color) return false;
if($bg) {
$css .= 'background-color: '.$bg.';';
}
if($color) {
$css .= 'color: '.$color.';';
}
$css = '.site-footer {'.$css.'}';
do_action('yprm_inline_css', $css);
}
add_action('wp_head', 'yprm_page_footer_custom_colors');
}
/**
* Maintenance Mode
*/
if(!function_exists('yprm_maintenance_mode')) {
function yprm_maintenance_mode() {
global $mirel_theme;
if(
isset($mirel_theme['maintenance_mode']) &&
$mirel_theme['maintenance_mode'] == 'true' &&
!is_admin() &&
$GLOBALS['pagenow'] !== 'wp-login.php' &&
(!current_user_can('edit_themes') || !is_user_logged_in()) ||
isset($_GET['maintenance_mode_test'])
) {
require_once YPRM_PLUGINS_URL. '/include/maintenance-mode.php';
exit();
}
}
add_action('init', 'yprm_maintenance_mode');
}
/**
* Add Fonts To Tiny MCE
*/
if (!function_exists('yprm_tiny_mce_add_fonts')) {
function yprm_tiny_mce_add_fonts($init) {
global $mirel_theme;
$fonts_array = (object) array_reverse(json_decode('['.$mirel_theme['custom_fonts']['fonts'].']'));
if(!isset($init['font_formats'])) {
$init['font_formats'] = 'Andale Monos=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
}
foreach ($fonts_array as $font) {
$value = $font->family;
if($font->type == 'typekit') {
$value = $font->slug;
}
$init['font_formats'] = $font->family.'='.$value.';'.$init['font_formats'];
}
return $init;
}
add_filter('tiny_mce_before_init', 'yprm_tiny_mce_add_fonts');
}
/**
* Render Action
*/
if(!function_exists('yprm_render_header')) {
function yprm_render_header($id = 0) {
if(!$id || !class_exists('YPRM_Build_Header')) return false;
$header = new YPRM_Build_Header($id);
echo $header->render();
}
add_action('render_header', 'yprm_render_header');
}
/**
* Remove Admin Login Header
*/
if(!function_exists('yprm_remove_admin_login_header')) {
function yprm_remove_admin_login_header() {
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('get_header', 'yprm_remove_admin_login_header');
}
/**
* Elementor Add Icons
*/
function yprm_mirel_icons() {
return [
['mirel-icon-box' => 'box'],
['mirel-icon-clipboard' => 'clipboard'],
['mirel-icon-customer-service' => 'customer service'],
['mirel-icon-device' => 'device'],
['mirel-icon-diagram' => 'diagram'],
['mirel-icon-digital-marketing' => 'digital marketing'],
['mirel-icon-doc' => 'doc'],
['mirel-icon-download' => 'download'],
['mirel-icon-email' => 'email'],
['mirel-icon-like-2' => 'like'],
['mirel-icon-maximize-size-option' => 'maximize size option'],
['mirel-icon-passion' => 'passion'],
['mirel-icon-price-tag' => 'price tag'],
['mirel-icon-questions' => 'questions'],
['mirel-icon-refresh' => 'refresh'],
['mirel-icon-user' => 'user'],
['mirel-icon-apps' => 'apps'],
['mirel-icon-left-arrow' => 'left arrow'],
['mirel-icon-right-arrow' => 'right arrow'],
['mirel-icon-left-arrow-2' => 'left arrow'],
['mirel-icon-right-arrow-2' => 'right arrow'],
['mirel-icon-left-arrow-3' => 'left arrow'],
['mirel-icon-right-arrow-3' => 'right arrow'],
['mirel-icon-left-arrow-4' => 'left arrow'],
['mirel-icon-right-arrow-4' => 'right arrow'],
['mirel-icon-like' => 'like'],
['mirel-icon-like-filled' => 'like filled'],
['mirel-icon-search' => 'search'],
['mirel-icon-share-social-outline' => 'share social outline'],
['mirel-icon-plus' => 'plus'],
['mirel-icon-expand' => 'expand'],
['mirel-icon-shopping-cart' => 'shopping cart'],
['mirel-icon-phone-receiver-silhouette' => 'phone receiver silhouette'],
['mirel-icon-location' => 'location'],
['mirel-icon-menu' => 'menu'],
['mirel-icon-twitter' => 'twitter'],
['mirel-icon-link' => 'link'],
['mirel-icon-translate' => 'translate'],
['mirel-icon-close' => 'close'],
['mirel-icon-arrow-undo-outline' => 'arrow undo outline'],
['mirel-icon-checklists' => 'checklists'],
['mirel-icon-layers' => 'layers'],
['mirel-icon-portfolio' => 'portfolio'],
['mirel-icon-speed' => 'speed'],
['mirel-icon-translation' => 'translation'],
['mirel-icon-open-padlock' => 'open padlock'],
['mirel-icon-youtube' => 'youtube'],
['mirel-icon-calendar' => 'calendar'],
['mirel-icon-star' => 'star']
];
}
if(!function_exists('yprm_site_preloader')) {
function yprm_site_preloader() {
if(yprm_get_theme_setting('preloader_show') != 'true' || yprm_get_theme_setting('preloader_type') != 'word' || yprm_get_theme_setting('preloader_word') == '' ) return false;
?>
<script>
document.body.classList.remove('no-js')
</script>
<div class="preloader-block">
<div class="preloader-inner-block">
<div class="preloader-folding-word">
<?php echo yprm_get_theme_setting('preloader_word'); ?>
</div>
<div class="snippet" data-title=".dot-flashing">
<div class="stage">
<div class="dot-flashing"></div>
</div>
</div>
</div>
</div>
<?php
}
add_action('wp_body_open', 'yprm_site_preloader');
}
/* Hooks Product Variable Button */
function yprm_variable_add_to_cart() {
global $product;
wp_deregister_script( 'wc-add-to-cart-variation' );
wp_register_script( 'wc-add-to-cart-variation', get_template_directory_uri().'/js/add-to-cart-variation.js', array( 'jquery', 'wp-util' ), WC_VERSION, true );
wp_enqueue_script( 'wc-add-to-cart-variation' );
$get_variations = count( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
wc_get_template(
'single-product/add-to-cart/variable.php',
array(
'available_variations' => $get_variations ? $product->get_available_variations() : false,
'attributes' => $product->get_variation_attributes(),
'selected_attributes' => $product->get_default_attributes(),
)
);
}
add_action( 'woocommerce_variable_add_to_cart', 'yprm_variable_add_to_cart', 30 );
/* END Hooks Product Variable Button */