D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
public_html
/
a3legalservices.site
/
wp-content
/
themes
/
aeen
/
inc
/
Filename :
scripts.php
back
Copy
<?php /** * @author RadiusTheme * @since 1.0 * @version 1.1 */ namespace radiustheme\aeen; use radiustheme\aeen\inc\RDTheme; use radiustheme\aeen\inc\Helper; use \WP_Query; use Elementor\Plugin; class Scripts { public $aeen = AEEN_THEME_PREFIX; public $version = AEEN_THEME_VERSION; public function __construct() { add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ), 12 ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 15 ); add_action( 'wp_enqueue_scripts', array( $this, 'aeen_enqueue_high_priority_scripts' ), 1500 ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_conditional_scripts' ), 1 ); add_action( 'template_include', array( $this, 'under_construction_mode_enable'), 999 ); } /** * Maintenance Mode */ public function under_construction_mode_enable( $template ) { $new_template = locate_template( array( 'construction.php' ) ); if ( Helper::is_under_construction_mode() && '' != $new_template ) { return $new_template; } else { return $template; } } public function fonts_url() { $fonts_url = ''; $subsets = 'latin'; $bodyFont = 'Lato'; $bodyFW = '400'; $menuFont = 'Lato'; $menuFontW = '700'; $hFont = 'Lora'; $hFontW = '700'; $h1Font = ''; $h2Font = ''; $h3Font = ''; $h4Font = ''; $h5Font = ''; $h6Font = ''; // Body Font $body_font = json_decode( RDTheme::$options['typo_body'], true ); if ($body_font['font'] == 'Inherit') { $bodyFont = 'Lato'; } else { $bodyFont = $body_font['font']; } $bodyFontW = $body_font['regularweight']; // Menu Font $menu_font = json_decode( RDTheme::$options['typo_menu'], true ); if ($menu_font['font'] == 'Inherit') { $menuFont = 'Lato'; } else { $menuFont = $menu_font['font']; } $menuFontW = $menu_font['regularweight']; // Heading Font Settings $h_font = json_decode( RDTheme::$options['typo_heading'], true ); if ($h_font['font'] == 'Inherit') { $hFont = 'Lora'; } else { $hFont = $h_font['font']; } $hFontW = $h_font['regularweight']; $h1_font = json_decode( RDTheme::$options['typo_h1'], true ); $h2_font = json_decode( RDTheme::$options['typo_h2'], true ); $h3_font = json_decode( RDTheme::$options['typo_h3'], true ); $h4_font = json_decode( RDTheme::$options['typo_h4'], true ); $h5_font = json_decode( RDTheme::$options['typo_h5'], true ); $h6_font = json_decode( RDTheme::$options['typo_h6'], true ); if ( 'off' !== _x( 'on', 'Google font: on or off', 'aeen' ) ) { if (!empty($h1_font['font'])) { if ($h1_font['font'] == 'Inherit') { $h1Font = $hFont; $h1FontW = $hFontW; } else { $h1Font = $h2_font['font']; $h1FontW = $h1_font['regularweight']; } } if (!empty($h2_font['font'])) { if ($h2_font['font'] == 'Inherit') { $h2Font = $hFont; $h2FontW = $hFontW; } else { $h2Font = $h2_font['font']; $h2FontW = $h2_font['regularweight']; } } if (!empty($h3_font['font'])) { if ($h3_font['font'] == 'Inherit') { $h3Font = $hFont; $h3FontW = $hFontW; } else { $h3Font = $h3_font['font']; $h3FontW = $h3_font['regularweight']; } } if (!empty($h4_font['font'])) { if ($h4_font['font'] == 'Inherit') { $h4Font = $hFont; $h4FontW = $hFontW; } else { $h4Font = $h4_font['font']; $h4FontW = $h4_font['regularweight']; } } if (!empty($h5_font['font'])) { if ($h5_font['font'] == 'Inherit') { $h5Font = $hFont; $h5FontW = $hFontW; } else { $h5Font = $h5_font['font']; $h5FontW = $h5_font['regularweight']; } } if (!empty($h6_font['font'])) { if ($h6_font['font'] == 'Inherit') { $h6Font = $hFont; $h6FontW = $hFontW; } else { $h6Font = $h6_font['font']; $h6FontW = $h6_font['regularweight']; } } $check_families = array(); $font_families = array(); // Body Font if ( 'off' !== $bodyFont ) $font_families[] = $bodyFont.':300,400,700,'.$bodyFW; $check_families[] = $bodyFont; // Menu Font if ( 'off' !== $menuFont ) if ( !in_array( $menuFont, $check_families ) ) { $font_families[] = $menuFont.':300,400,'.$menuFontW; $check_families[] = $menuFont; } // Heading Font if ( 'off' !== $hFont ) if (!in_array( $hFont, $check_families )) { $font_families[] = $hFont.':400,500,600,'.$hFontW; $check_families[] = $hFont; } // Heading 1 Font if (!empty($h1_font['font'])) { if ( 'off' !== $h1Font ) if (!in_array( $h1Font, $check_families )) { $font_families[] = $h1Font.':'.$h1FontW; $check_families[] = $h1Font; } } // Heading 2 Font if (!empty($h2_font['font'])) { if ( 'off' !== $h2Font ) if (!in_array( $h2Font, $check_families )) { $font_families[] = $h2Font.':'.$h2FontW; $check_families[] = $h2Font; } } // Heading 3 Font if (!empty($h3_font['font'])) { if ( 'off' !== $h3Font ) if (!in_array( $h3Font, $check_families )) { $font_families[] = $h3Font.':'.$h3FontW; $check_families[] = $h3Font; } } // Heading 4 Font if (!empty($h4_font['font'])) { if ( 'off' !== $h4Font ) if (!in_array( $h4Font, $check_families )) { $font_families[] = $h4Font.':'.$h4FontW; $check_families[] = $h4Font; } } // Heading 5 Font if (!empty($h5_font['font'])) { if ( 'off' !== $h5Font ) if (!in_array( $h5Font, $check_families )) { $font_families[] = $h5Font.':'.$h5FontW; $check_families[] = $h5Font; } } // Heading 6 Font if (!empty($h6_font['font'])) { if ( 'off' !== $h6Font ) if (!in_array( $h6Font, $check_families )) { $font_families[] = $h6Font.':'.$h6FontW; $check_families[] = $h6Font; } } $final_fonts = array_unique( $font_families ); $query_args = array( 'family' => urlencode( implode( '|', $final_fonts ) ), 'display' => urlencode( 'fallback' ), ); $fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" ); } return esc_url_raw( $fonts_url ); } public function aeen_get_maybe_rtl( $filename ){ $file = get_template_directory_uri() . '/assets/'; if ( is_rtl() ) { return $file . 'rtl-css/' . $filename; } else { return $file . 'css/' . $filename; } } public function aeen_enqueue_high_priority_scripts(){ if ( is_rtl() ) { wp_enqueue_style( 'rtlcss', Helper::get_css( 'rtl' ), array(), $this->version ); } } public function register_scripts(){ /* Deregister */ wp_deregister_style( 'font-awesome' ); wp_deregister_style( 'elementor-waypoints' ); /* = CSS ======================================================================*/ // Bootstrap css wp_register_style( 'bootstrap', Helper::get_css( 'bootstrap.min' ), array(), $this->version ); // FontAwesome css wp_register_style( 'font-awesome', Helper::get_css( 'all.min' ), array(), $this->version ); // Flat Icon css wp_register_style( 'flaticon', Helper::get_css( 'flaticon' ), array(), $this->version ); // Animate css wp_register_style( 'animate', Helper::get_css( 'animate' ), array(), $this->version ); // Magnific wp_register_style( 'magnific-popup', Helper::get_css( 'magnific-popup' ), array(), $this->version ); //Owl Carousel wp_register_style( 'owl-carousel', Helper::get_css( 'owl.carousel.min' ), array(), $this->version ); wp_register_style( 'owl-theme', Helper::get_css( 'owl.theme.default.min' ), array(), $this->version ); // Slick css wp_register_style( 'slick', Helper::get_css( 'slick' ), array(), $this->version ); wp_register_style( 'slick-theme', Helper::get_css( 'slick-theme' ), array(), $this->version ); // Main Theme Style wp_register_style( 'aeen-style', $this->aeen_get_maybe_rtl( 'style.css' ), array(), $this->version ); /* = JS ======================================================================*/ // Popper wp_register_script( 'popper', Helper::get_js( 'popper.min' ), array( 'jquery' ), $this->version, true ); // Bootstrap wp_register_script( 'bootstrap', Helper::get_js( 'bootstrap.min' ), array( 'jquery' ), $this->version, true ); // Parallax Scroll wp_register_script( 'parallax-scroll', Helper::get_js( 'jquery.parallax-scroll' ), array( 'jquery' ), $this->version, true ); // Owl Carousel wp_register_script( 'owl-carousel', Helper::get_js( 'owl.carousel.min' ), array( 'jquery' ), $this->version, true ); // Counter Up wp_register_script( 'jquery-counterup', Helper::get_js( 'jquery.counterup.min' ), array( 'jquery' ), $this->version, true ); // Waypoints wp_register_script( 'jquery-waypoints', Helper::get_js( 'jquery.waypoints.min' ), array( 'jquery' ), $this->version, true ); // Isotop For Filtering wp_register_script( 'isotope-pkgd', Helper::get_js( 'isotope.pkgd.min' ), array( 'jquery', 'imagesloaded' ), $this->version, true ); // Parallaxie wp_register_script( 'parallaxie', Helper::get_js( 'parallaxie' ), array( 'jquery' ), $this->version, true ); // Wow wp_register_script( 'wow', Helper::get_js( 'wow.min' ), array( 'jquery' ), $this->version, true ); // Tilt For Image Shaking wp_register_script( 'tilt-jquery', Helper::get_js( 'tilt.jquery.min' ), array( 'jquery' ), $this->version, true ); // Magnific Popup wp_register_script( 'jquery-magnific-popup', Helper::get_js( 'jquery.magnific-popup.min' ), array( 'jquery' ), $this->version, true );// Slick For Slider wp_register_script( 'slick', Helper::get_js( 'slick.min' ), array( 'jquery' ), $this->version, true ); // Theia Sticky Sidebar wp_register_script( 'theia-sticky', Helper::get_js( 'theia-sticky-sidebar' ), array( 'jquery' ), $this->version, true ); // Main js wp_register_script( 'aeen-main', Helper::get_js( 'main' ), array( 'jquery' ), $this->version, true ); } public function enqueue_scripts() { /*CSS*/ $this->elementor_scripts(); wp_enqueue_style( 'aeen-gfonts', $this->fonts_url(), array(), $this->version ); wp_enqueue_style( 'bootstrap' ); wp_enqueue_style( 'font-awesome' ); wp_enqueue_style( 'flaticon' ); wp_enqueue_style( 'animate' ); wp_enqueue_style( 'magnific-popup' ); wp_enqueue_style( 'owl-carousel' ); $this->conditional_scripts(); // Conditional Scripts wp_enqueue_style( 'aeen-style' ); $this->dynamic_style(); // Dynamic style /*JS*/ wp_enqueue_script( 'popper' ); wp_enqueue_script( 'bootstrap' ); wp_enqueue_script( 'imagesloaded' ); wp_enqueue_script( 'parallax-scroll' ); wp_enqueue_script( 'owl-carousel' ); wp_enqueue_script( 'jquery-counterup' ); wp_enqueue_script( 'jquery-waypoints' ); wp_enqueue_script( 'parallaxie' ); wp_enqueue_script( 'wow' ); wp_enqueue_script( 'tilt-jquery' ); wp_enqueue_script( 'jquery-magnific-popup' ); wp_enqueue_script( 'slick' ); wp_enqueue_script( 'theia-sticky' ); wp_enqueue_script( 'isotope-pkgd' ); wp_enqueue_script( 'aeen-main' ); $this->localized_scripts(); // Localization // Dynamic style if ( Helper::is_under_construction_mode() ) { wp_enqueue_script('jquery-countdown'); } } private function conditional_scripts(){ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } public function admin_conditional_scripts(){ wp_enqueue_style( 'aeen-gfonts', $this->fonts_url(), array(), $this->version ); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_style('wp-color-picker'); } private function localized_scripts(){ $adminajax = esc_url( admin_url('admin-ajax.php') ); $localize_data = array( 'ajaxurl' => $adminajax, 'hasAdminBar' => is_admin_bar_showing() ? 1 : 0, 'headerStyle' => RDTheme::$header_style, 'ajaxURL' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce( 'aeen-nonce' ), 'rtl' => is_rtl() ? 'true' : 'false' ); wp_localize_script( 'aeen-main', 'AeenObj', $localize_data ); } public function elementor_scripts() { if ( !did_action( 'elementor/loaded' ) ) { return; } if ( Plugin::$instance->preview->is_preview_mode() ) { wp_enqueue_style( 'bootstrap'); wp_enqueue_script( 'bootstrap' ); wp_enqueue_style( 'owl-carousel'); wp_enqueue_style( 'owl-theme'); wp_enqueue_style( 'slick'); wp_enqueue_script( 'owl-carousel' ); wp_enqueue_script( 'slick' ); } } private function dynamic_style(){ $dynamic_css = $this->template_style(); ob_start(); Helper::requires( 'dynamic-style.php' ); $dynamic_css .= ob_get_clean(); $dynamic_css = $this->minified_css( $dynamic_css ); wp_register_style( $this->aeen . '-dynamic', false ); wp_enqueue_style( $this->aeen . '-dynamic' ); wp_add_inline_style( $this->aeen . '-dynamic', $dynamic_css ); } private function minified_css( $css ) { /* remove comments */ $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css ); /* remove tabs, spaces, newlines, etc. */ $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), ' ', $css ); return $css; } private function template_style(){ $style = ''; if ( is_single() ) { if ( RDTheme::$bgtype === 'bgimg' ) { $opacity = RDTheme::$overlayopacity/100; $style .= '.single .inner-page-banner { background-image: url(' . RDTheme::$bgimg . ')}'; $style .= '.single .inner-page-banner:after { background-color: ' . RDTheme::$bgimgoverlay . '}'; $style .= '.single .inner-page-banner:after { opacity: ' . $opacity . '}'; } else { if ( !empty( RDTheme::$bgcolor ) ) { $style .= '.single .inner-page-banner:after { background-color: ' . RDTheme::$bgcolor . '}'; } } } else { if ( RDTheme::$bgtype === 'bgimg' ) { $opacity = RDTheme::$overlayopacity/100; $style .= '.inner-page-banner { background-image: url(' . RDTheme::$bgimg . ')}'; $style .= '.inner-page-banner:after { background-color: ' . RDTheme::$bgimgoverlay . '}'; $style .= '.inner-page-banner:after { opacity: ' . $opacity . '}'; } else { $style .= '.inner-page-banner:after { background-color: ' . RDTheme::$bgcolor . '}'; } } if ( RDTheme::$inner_padding_top) { $style .= '.entry-banner .inner-page-banner {padding-top:'. RDTheme::$inner_padding_top . 'px;}'; } if ( RDTheme::$inner_padding_bottom) { $style .= '.entry-banner .inner-page-banner {padding-bottom:'. RDTheme::$inner_padding_bottom . 'px;}'; } return $style; } } new Scripts;