%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/shaban/laviva/wp-content/plugins/levelup-core/inc/classes/
Upload File :
Create Path :
Current File : /var/www/html/shaban/laviva/wp-content/plugins/levelup-core/inc/classes/page-transition.php

<?php


class Levelup_Page_Transition {

    protected static $instance = null;

    protected $page_in_transition;
    protected $page_out_transition;
    protected $page_in_duration = 1500;
    protected $page_out_duration = 800;
    protected $show_loading = true;
    protected $loading_color;
    protected $is_image = false;
    protected $image;

    public function __construct() {
        global $levelup_options;

        $this->page_in_transition  = $levelup_options['transition-page-in'];
        $this->page_out_transition = $levelup_options['transition-page-out'];
        $page_in_duration  = $levelup_options['transition-in-duration'];
        $page_out_duration = $levelup_options['transition-out-duration'];
        $show_loading      = $levelup_options['transition-layout-loading'] ? true : false;
        $this->image       = array_key_exists('transition-image', $levelup_options) ? $levelup_options['transition-image'] : false;
        $this->is_image    = $this->image ? true : false;


        if ( ! empty( $page_in_duration ) ) $this->page_in_duration   = $page_in_duration;
        if ( ! empty( $page_out_duration ) ) $this->page_out_duration = $page_out_duration;
        if ( ! empty( $show_loading ) ) $this->show_loading = $show_loading;

        if ( is_admin() ) {
        } elseif ( ! empty( $this->page_in_transition ) || ! empty( $this->page_out_transition ) ) {
            add_filter( 'wp_headers', array( $this, 'add_ie_compatible_header' ) );
            add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ), 1000 );
            add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
            add_action( 'wp_head', array( $this, 'head_scripts' ) );
            add_action( 'wp_footer', array( $this, 'footer_scripts' ) );
            add_filter( 'body_class', array( $this, 'body_class_names' ), 100 );
            if ( $this->show_loading ) {
                add_action( 'wp_head', array( $this, 'head_styles' ) );
            }
        }
    }

    public static function get_instance() {

        if ( null == self::$instance ) {
            self::$instance = new self;
        }

        return self::$instance;
    }

    public function add_ie_compatible_header( $headers ) {
        if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
            $headers['X-UA-Compatible'] = 'IE=edge,chrome=1';
        }
        return $headers;
    }

    public function enqueue_styles() {
        wp_enqueue_style( 'animsition', LEVELUP_THEME_TEMPLATE_URL . '/assets/vendor/animsition/css/animsition.css', array() );
    }

    public function enqueue_scripts() {
        wp_enqueue_script( 'animsition_script', LEVELUP_THEME_TEMPLATE_URL . '/assets/vendor/animsition/js/jquery.animsition.min.js', array( 'jquery' ) );
    }

    public function body_class_names( $classes ) {
        return $classes;
    }

    public function head_styles() {
        ?>
        <style type="text/css">
            <?php if ( empty( $this->page_in_transition ) ) { ?>
            .animsition{opacity: 1;}
            <?php } ?>

            <?php if ( $this->is_image ): ?>
            .animsition-loading-image {
                position: fixed;
                top: 0;
                z-index: 100;
                width: 100%;
                height: 100%;
                background: url(<?php echo esc_url( $this->image['url'] );?>) center center no-repeat;

                -webkit-animation-fill-mode: both;
                -o-animation-fill-mode: both;
                animation-fill-mode: both;
            }
            <?php endif; ?>
        </style>
    <?php
    }

    public function head_scripts() {
        ?>
        <script type="text/javascript">
            jQuery( document ).ready( function($) {
                $('.animsition').animsition({
                    inClass : '<?php echo esc_attr( $this->page_in_transition ); ?>',
                    outClass : '<?php echo esc_attr( $this->page_out_transition ); ?>',
                    inDuration : <?php echo esc_attr( $this->page_in_duration ); ?>,
                    outDuration : <?php echo esc_attr( $this->page_out_duration ); ?>,
                    loading : <?php echo $this->show_loading ? 'true' : 'false'; ?>,
                    <?php if($this->is_image): ?>loadingClass: 'animsition-loading-image',<?php endif;?>
                    touchSupport: false,
                    linkElement: '.animsition-link, a[href]:not([target="_blank"]):not([href^="<?php echo esc_url( $this->get_current_url() );?>#"]):not([href^="#"]):not([href~="#"]):not([href*="javascript"]):not([href*=".jpg"]):not([href*=".jpeg"]):not([href*=".gif"]):not([href*=".png"]):not([href*=".mov"]):not([href*=".swf"]):not([href*=".mp4"]):not([href*=".flv"]):not([href*=".avi"]):not([href*=".mp3"]):not([href^="mailto:"]):not([href^="tel:"]):not([class="no-animation"]):not([class="comment-reply-link"]):not([id="toggle-nav"]):not(.add_to_cart_button):not(.remove)<?php if ( levelup_get_options( 'transition-exclude-extend' ) ) { echo levelup_sanitize_quote1( levelup_get_options('transition-exclude-extend') ); } ?>'
                });
            });
        </script>
    <?php
    }

    public function footer_scripts() {
    }

    public function get_current_url() {
        global $wp;
        if ( empty( $_SERVER['QUERY_STRING'] ) ) {
            $current_url = trailingslashit( home_url( $wp->request ) );
        } else {
            $current_url = add_query_arg( $_SERVER['QUERY_STRING'], '', trailingslashit( home_url( $wp->request ) ) );
        }
        return $current_url;
    }

}

Zerion Mini Shell 1.0