示例#1
0
function themify_theme_enqueue_scripts()
{
    ///////////////////
    //Enqueue styles
    ///////////////////
    //Themify base styling
    wp_enqueue_style('theme-style', get_stylesheet_uri(), array(), wp_get_theme()->display('Version'));
    //Themify Media Queries CSS
    wp_enqueue_style('themify-media-queries', THEME_URI . '/media-queries.css');
    ///////////////////
    //Enqueue scripts
    ///////////////////
    //Themify internal scripts
    wp_enqueue_script('theme-script', THEME_URI . '/js/themify.script.js', array('jquery'), false, true);
    //Inject variable values in gallery script
    wp_localize_script('theme-script', 'themifyScript', array('lightbox' => themify_lightbox_vars_init(), 'lightboxContext' => apply_filters('themify_lightbox_context', '#pagewrap'), 'isTouch' => themify_is_touch() ? 'true' : 'false'));
    //WordPress internal script to move the comment box to the right place when replying to a user
    if (is_single() || is_page()) {
        wp_enqueue_script('comment-reply');
    }
}
 /**
  * Load interface js and css
  *
  * @since 2.1.9
  */
 function load_frontend_interface()
 {
     // Builder main styles
     $this->load_main_styles();
     // Charts
     wp_enqueue_script('themify-easy-pie-chart');
     // Waypoints
     wp_enqueue_script('theme-waypoints');
     // load only when editing and login
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         wp_enqueue_style('themify-builder-main', THEMIFY_BUILDER_URI . '/css/themify-builder-main.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-builder-admin-ui', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('google-fonts-builder', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Open+Sans:400,300,600|Montserrat');
         wp_enqueue_style('colorpicker', THEMIFY_URI . '/css/jquery.minicolors.css');
         // from themify framework
         // Icon picker
         wp_enqueue_script('themify-font-icons-js', THEMIFY_URI . '/js/themify.font-icons-select.js', array('jquery'), THEMIFY_VERSION, true);
         do_action('themify_builder_admin_enqueue', $this);
     }
     // lib scripts
     if (!wp_script_is('themify-carousel-js')) {
         wp_enqueue_script('themify-carousel-js');
         // grab from themify framework
     }
     // Check if BigVideo.js is loaded, if it's not, load it after loading Video.js
     // which is set as dependency under the handler 'themify-videojs-js'
     if (!wp_script_is('themify-bigvideo-js')) {
         wp_enqueue_script('themify-bigvideo-js');
     }
     // Check if scroll highlight is loaded. If it's not, load it.
     $this->load_scroll_highlight();
     // module scripts
     wp_register_script('themify-builder-module-plugins-js', THEMIFY_BUILDER_URI . "/js/themify.builder.module.plugins.js", array('jquery'), THEMIFY_VERSION, true);
     wp_enqueue_script('themify-builder-module-plugins-js');
     wp_register_script('themify-builder-script-js', THEMIFY_BUILDER_URI . "/js/themify.builder.script.js", array('jquery', 'theme-waypoints'), THEMIFY_VERSION, true);
     wp_enqueue_script('themify-builder-script-js');
     wp_localize_script('themify-builder-script-js', 'tbLocalScript', apply_filters('themify_builder_script_vars', array('isTouch' => themify_is_touch() ? true : false, 'isAnimationActive' => Themify_Builder_Model::is_animation_active(), 'isParallaxActive' => Themify_Builder_Model::is_parallax_active(), 'animationInviewSelectors' => self::$inview_selectors, 'createAnimationSelectors' => self::$new_selectors, 'backgroundSlider' => array('autoplay' => 5000, 'speed' => 2000), 'animationOffset' => 100, 'videoPoster' => THEMIFY_BUILDER_URI . '/img/blank.png')));
     // Main module scripts
     $this->load_main_scripts();
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         if (class_exists('Jetpack_VideoPress')) {
             // Load this so submit_button() is available in VideoPress' print_media_templates().
             require_once ABSPATH . 'wp-admin/includes/template.php';
         }
         $enqueue_scripts = array('underscore', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-effects-core', 'media-upload', 'jquery-ui-dialog', 'wpdialogs', 'wpdialogs-popup', 'wplink', 'word-count', 'editor', 'quicktags', 'wp-fullscreen', 'admin-widgets', 'colorpicker-js', 'themify-builder-google-webfont', 'themify-builder-front-ui-js');
         // For editor
         wp_enqueue_style('buttons');
         // is mobile version
         if ($this->isMobile()) {
             wp_register_script('themify-builder-mobile-ui-js', THEMIFY_BUILDER_URI . "/js/jquery.ui.touch-punch.js", array('jquery'), THEMIFY_VERSION, true);
             wp_enqueue_script('jquery-ui-mouse');
             wp_enqueue_script('themify-builder-mobile-ui-js');
         }
         foreach ($enqueue_scripts as $script) {
             switch ($script) {
                 case 'admin-widgets':
                     wp_enqueue_script($script, admin_url('/js/widgets.min.js'), array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'));
                     break;
                 case 'colorpicker-js':
                     wp_enqueue_script($script, THEMIFY_URI . '/js/jquery.minicolors.js', array('jquery'));
                     // grab from themify framework
                     break;
                 case 'themify-builder-google-webfont':
                     //wp_enqueue_script( $script, themify_https_esc( 'http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js' ) );
                     break;
                 case 'themify-builder-front-ui-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.front.ui.js", array('jquery', 'jquery-ui-tabs'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     $gutterClass = Themify_Builder_Model::get_grid_settings('gutter_class');
                     wp_localize_script($script, 'themifyBuilder', apply_filters('themify_builder_ajax_front_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'tfb_load_nonce' => wp_create_nonce('tfb_load_nonce'), 'tfb_url' => THEMIFY_BUILDER_URI, 'post_ID' => get_the_ID(), 'dropPlaceHolder' => __('drop module here', 'themify'), 'draggerTitleMiddle' => __('Drag left/right to change columns', 'themify'), 'draggerTitleLast' => __('Drag left to add columns', 'themify'), 'moduleDeleteConfirm' => __('Press OK to remove this module', 'themify'), 'toggleOn' => __('Turn On Builder', 'themify'), 'toggleOff' => __('Turn Off Builder', 'themify'), 'confirm_on_turn_off' => __('Do you want to save the changes made to this page?', 'themify'), 'confirm_on_duplicate_page' => __('Save the Builder before duplicating this page?', 'themify'), 'confirm_on_unload' => __('You have unsaved data.', 'themify'), 'textImportBuilder' => __('Import From', 'themify'), 'textRowStyling' => __('Row Styling', 'themify'), 'importFileConfirm' => __('This import will override all current Builder data. Press OK to continue', 'themify'), 'confirm_template_selected' => __('This will replace your current Builder layout with the Template', 'themify'), 'load_layout_title' => __('Layouts', 'themify'), 'save_as_layout_title' => __('Save as Layout', 'themify'), 'confirm_delete_layout' => __('Are you sure want to delete this layout ?', 'themify'), 'isThemifyTheme' => $this->is_themify_theme() ? 'true' : 'false', 'gutterClass' => $gutterClass, 'subRowDeleteConfirm' => __('Press OK to remove this sub row', 'themify'))));
                     wp_localize_script($script, 'themify_builder_plupload_init', $this->get_builder_plupload_init());
                     break;
                 default:
                     wp_enqueue_script($script);
                     break;
             }
         }
     }
 }
示例#3
0
/**
 * Add different CSS classes to body tag.
 * Outputs:
 * 		skin name
 * 		layout
 * @param Array
 * @return Array
 * @since 1.2.2
 */
function themify_body_classes($classes)
{
    global $themify;
    // Add skin name
    if ($skin = themify_is_theme_skin()) {
        $skin_dir = explode('/', $skin);
        $classes[] = 'skin-' . $skin_dir[sizeof($skin_dir) - 2];
    } else {
        $classes[] = 'skin-default';
    }
    // Browser classes
    global $is_gecko, $is_opera, $is_iphone, $is_IE, $is_winIE, $is_macIE;
    $is_android = $is_webkit = $is_ie10 = $is_ie9 = $is_ie8 = $is_ie7 = false;
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'android')) {
            $is_android = true;
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'webkit')) {
            $is_webkit = true;
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 10')) {
            $is_ie10 = true;
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9')) {
            $is_ie9 = true;
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8')) {
            $is_ie8 = true;
        }
        if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7')) {
            $is_ie7 = true;
        }
    }
    $browsers = array('gecko' => $is_gecko, 'opera' => $is_opera, 'iphone' => $is_iphone, 'android' => $is_android, 'webkit' => $is_webkit, 'ie' => $is_IE, 'iewin' => $is_winIE, 'iemac' => $is_macIE, 'ie10' => $is_ie10, 'ie9' => $is_ie9, 'ie8' => $is_ie8, 'ie7' => $is_ie7);
    $is_not_ie = true;
    foreach ($browsers as $browser => $state) {
        if ($state) {
            $classes[] = $browser;
            if (stripos($browser, 'ie') !== false) {
                $is_not_ie = false;
            }
        }
    }
    if ($is_not_ie) {
        $classes[] = 'not-ie';
    }
    // Add default layout and post layout
    $layout = themify_get('setting-default_layout');
    $post_layout = themify_get('setting-default_post_layout');
    // Set content width
    if (is_search()) {
        $classes[] = 'default_width';
    } elseif (is_singular()) {
        $classes[] = themify_check('content_width') ? themify_get('content_width') : 'default_width';
    }
    // It's a page
    if (is_page()) {
        // It's a page
        $layout = themify_get('page_layout') != 'default' && themify_check('page_layout') ? themify_get('page_layout') : themify_get('setting-default_page_layout');
    }
    if (themify_is_query_page()) {
        $classes[] = 'query-page';
        $classes[] = isset($themify->query_post_type) ? 'query-' . $themify->query_post_type : 'query-post';
    }
    // It's a post
    if (is_single()) {
        $layout = themify_get('layout') != 'default' && themify_check('layout') ? themify_get('layout') : themify_get('setting-default_page_post_layout');
    }
    // It's a singular view (post, page, portfolio, any custom post type)
    if (is_singular()) {
        // Post requires password
        if (post_password_required(get_the_ID())) {
            $classes[] = 'entry-password-required';
        }
    }
    // If still empty, set default
    if (apply_filters('themify_default_layout_condition', '' == $layout)) {
        $layout = apply_filters('themify_default_layout', 'sidebar1');
    }
    $classes[] = $layout;
    // non-homepage pages
    if (!(is_home() || is_front_page())) {
        $classes[] = 'no-home';
    }
    // if the page is being displayed in lightbox
    if (isset($_GET['iframe']) && $_GET['iframe'] == 'true') {
        $classes[] = 'lightboxed';
    }
    // Set post layout for blog, archive or a query category page
    $post_query_category = isset($themify->query_category) ? $themify->query_category : themify_get('query_category');
    if (is_home() || is_archive() || '' != $post_query_category || is_search()) {
        $post_layout = $themify->post_layout;
        if (apply_filters('themify_default_post_layout_condition', '' == $post_layout)) {
            $post_layout = apply_filters('themify_default_post_layout', 'list-post');
        }
        $classes[] = $post_layout;
    }
    $classes[] = themify_is_touch() ? 'touch' : 'no-touch';
    return apply_filters('themify_body_classes', $classes);
}
/**
 * Disable Parallax header on mobile devices
 * @param bool $bool 
 * @return bool
 */
function themify_disable_parallax_header_on_mobile($bool)
{
    if (themify_is_touch()) {
        $bool = false;
    }
    return $bool;
}
/**
 * Check whether element transition effect is ON or Off
 * @return boolean
 */
function themify_is_transition_active()
{
    // check if mobile exclude disabled OR disabled all transition
    if (themify_check('setting-transition_effect_mobile_exclude') && themify_is_touch() || themify_check('setting-transition_effect_all_disabled')) {
        return false;
    } else {
        return true;
    }
}
 /**
  * Load Touch Dropdown script for touch devices
  *
  * @since 1.9.1
  */
 function themify_enqueue_dropdown_script()
 {
     if (themify_is_touch()) {
         wp_enqueue_script('themify-dropdown', THEMIFY_URI . '/js/themify.dropdown.js', array('jquery'), THEMIFY_VERSION, true);
     }
 }
示例#7
0
/**
 * Enqueue Stylesheets and Scripts
 */
function themify_base_theme_enqueue_scripts()
{
    // Google Web Fonts embedding
    wp_enqueue_style('themify-google-fonts', themify_base_https_esc('http://fonts.googleapis.com/css') . '?family=Montserrat:400,700|Open+Sans:400,300&subset=latin,latin-ext');
    // Themify base styling
    wp_enqueue_style('themify-style', get_stylesheet_uri(), array(), wp_get_theme()->display('Version'));
    // Themify Media Queries CSS
    wp_enqueue_style('themify-media-queries', THEME_URI . '/media-queries.css');
    // Skin stylesheet
    $skin = themify_base_get('skin');
    if ($skin && 'default' != $skin) {
        wp_enqueue_style('themify-skin', THEME_URI . '/skins/' . $skin . '/style.css', array('themify-style'));
    }
    // Fontello Icon Fonts
    wp_enqueue_style('themify-fontello', THEME_URI . '/fontello/css/fontello.css');
    ///////////////////
    // Enqueue scripts
    ///////////////////
    // Themify internal scripts
    wp_enqueue_script('theme-script', THEME_URI . '/js/themify.script.js', array('jquery'), false, true);
    // Inject variable values in gallery script
    wp_localize_script('theme-script', 'themifyScript', apply_filters('themify_script_vars', array('lightbox' => themify_base_lightbox_vars_init(), 'lightboxContext' => apply_filters('themify_lightbox_context', '#pagewrap'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'html5placeholder' => 'yes')));
    // WordPress internal script to move the comment box to the right place when replying to a user
    if (is_single() || is_page()) {
        wp_enqueue_script('comment-reply');
    }
}
 /**
  * Check whether builder parallax is active
  * @return boolean
  */
 public static function is_parallax_active()
 {
     // check if mobile exclude disabled OR disabled all transition
     if (themify_check('setting-page_builder_parallax_mobile_exclude') && themify_is_touch() || themify_check('setting-page_builder_parallax_disabled')) {
         return false;
     } else {
         return true;
     }
 }
 /**
  * Load interface js and css
  *
  * @since 2.1.9
  */
 function load_frontend_interface()
 {
     // load only when editing and login
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         wp_enqueue_style('themify-builder-main', THEMIFY_BUILDER_URI . '/css/themify-builder-main.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-builder-admin-ui', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui.css', array(), THEMIFY_VERSION);
         if (is_rtl()) {
             wp_enqueue_style('themify-builder-admin-ui-rtl', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui-rtl.css', array('themify-builder-admin-ui'), THEMIFY_VERSION);
         }
         wp_enqueue_style('themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('google-fonts-builder', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Open+Sans:400,300,600|Montserrat');
         wp_enqueue_style('colorpicker', THEMIFY_URI . '/css/jquery.minicolors.css');
         // from themify framework
         // Icon picker
         wp_enqueue_script('themify-font-icons-js', THEMIFY_URI . '/js/themify.font-icons-select.js', array('jquery'), THEMIFY_VERSION, true);
         wp_localize_script('themify-font-icons-js', 'themifyIconPicker', array('icons_list' => THEMIFY_URI . '/fontawesome/list.html'));
         do_action('themify_builder_admin_enqueue', $this);
     }
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         if (class_exists('Jetpack_VideoPress')) {
             // Load this so submit_button() is available in VideoPress' print_media_templates().
             require_once ABSPATH . 'wp-admin/includes/template.php';
         }
         $enqueue_scripts = array('underscore', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-tooltip', 'jquery-effects-core', 'media-upload', 'jquery-ui-dialog', 'wpdialogs', 'wpdialogs-popup', 'wplink', 'word-count', 'editor', 'quicktags', 'wp-fullscreen', 'admin-widgets', 'colorpicker-js', 'themify-builder-google-webfont', 'themify-builder-undo-manager-js', 'themify-builder-common-js', 'themify-builder-front-ui-js', 'jss');
         // For editor
         wp_enqueue_style('buttons');
         // is mobile version
         if ($this->isMobile()) {
             wp_register_script('themify-builder-mobile-ui-js', THEMIFY_BUILDER_URI . "/js/jquery.ui.touch-punch.js", array('jquery'), THEMIFY_VERSION, true);
             wp_enqueue_script('jquery-ui-mouse');
             wp_enqueue_script('themify-builder-mobile-ui-js');
         }
         foreach ($enqueue_scripts as $script) {
             switch ($script) {
                 case 'admin-widgets':
                     wp_enqueue_script($script, admin_url('/js/widgets.min.js'), array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'));
                     break;
                 case 'colorpicker-js':
                     wp_enqueue_script($script, THEMIFY_URI . '/js/jquery.minicolors.js', array('jquery'));
                     // grab from themify framework
                     break;
                 case 'themify-builder-google-webfont':
                     wp_enqueue_script($script, themify_https_esc('http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'));
                     break;
                 case 'themify-builder-undo-manager-js':
                     wp_enqueue_script($script, THEMIFY_BUILDER_URI . '/js/undomanager.js', array('jquery'));
                     break;
                 case 'themify-builder-common-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.common.js", array('jquery'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     wp_localize_script('themify-builder-common-js', 'themifyBuilderCommon', apply_filters('themify_builder_common_vars', array('text_no_localStorage' => __("Your browser does not support this feature. Please use a modern browser such as Google Chrome or Safari.", 'themify'), 'text_confirm_data_paste' => __('This will overwrite the data. Ok to proceed?', 'themify'), 'text_alert_wrong_paste' => __('Error: Paste valid data only (paste row data to row, sub-row data to sub-row, module data to module).', 'themify'))));
                     break;
                 case 'jss':
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/jss.min.js", null, THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     break;
                 case 'themify-builder-front-ui-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.front.ui.js", array('jquery', 'jquery-ui-tabs', 'themify-builder-common-js', 'jss'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     $gutterClass = Themify_Builder_Model::get_grid_settings('gutter_class');
                     wp_localize_script($script, 'themifyBuilder', apply_filters('themify_builder_ajax_front_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'tfb_load_nonce' => wp_create_nonce('tfb_load_nonce'), 'tfb_url' => THEMIFY_BUILDER_URI, 'post_ID' => get_the_ID(), 'dropPlaceHolder' => __('drop module here', 'themify'), 'draggerTitleMiddle' => __('Drag left/right to change columns', 'themify'), 'draggerTitleLast' => __('Drag left to add columns', 'themify'), 'moduleDeleteConfirm' => __('Press OK to remove this module', 'themify'), 'rowDeleteConfirm' => __('Press OK to remove this row', 'themify'), 'toggleOn' => __('Turn On Builder', 'themify'), 'toggleOff' => __('Turn Off Builder', 'themify'), 'confirm_on_turn_off' => __('Do you want to save the changes made to this page?', 'themify'), 'confirm_on_duplicate_page' => __('Save the Builder before duplicating this page?', 'themify'), 'confirm_on_unload' => __('You have unsaved data.', 'themify'), 'isFrontend' => 'true', 'textImportBuilder' => __('Import From', 'themify'), 'textRowStyling' => __('Row Styling', 'themify'), 'textColumnStyling' => __('Column Styling', 'themify'), 'load_layout_title' => __('Layouts', 'themify'), 'save_as_layout_title' => __('Save as Layout', 'themify'), 'text_import_module_data' => __('Import Module'), 'text_export_module_data' => __('Export Module'), 'text_import_row_data' => __('Import Row'), 'text_export_row_data' => __('Export Row'), 'text_import_sub_row_data' => __('Import Sub-Row'), 'text_export_sub_row_data' => __('Export Sub-Row'), 'importFileConfirm' => __('This import will override all current Builder data. Press OK to continue', 'themify'), 'confirm_template_selected' => __('This will replace your current Builder layout with the Template', 'themify'), 'confirm_delete_layout' => __('Are you sure want to delete this layout ?', 'themify'), 'isThemifyTheme' => $this->is_themify_theme() ? 'true' : 'false', 'gutterClass' => $gutterClass, 'subRowDeleteConfirm' => __('Press OK to remove this sub row', 'themify'), 'disableShortcuts' => themify_check('setting-page_builder_disable_shortcuts'), 'webSafeFonts' => themify_get_web_safe_font_list(true))));
                     wp_localize_script($script, 'themify_builder_plupload_init', $this->get_builder_plupload_init());
                     break;
                 default:
                     wp_enqueue_script($script);
                     break;
             }
         }
     }
 }
/**
 * Enqueue Stylesheets and Scripts
 */
function themify_theme_enqueue_scripts()
{
    global $wp_query;
    $theme_version = wp_get_theme()->display('Version');
    // Themify base styling
    wp_enqueue_style('theme-style', get_stylesheet_uri(), array(), $theme_version);
    // Themify Media Queries CSS
    wp_enqueue_style('themify-media-queries', THEME_URI . '/media-queries.css');
    //Google Web Fonts embedding
    wp_enqueue_style('google-fonts', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Crete+Round|Vidaloka|Alice');
    // Themify Icons
    wp_enqueue_style('themify-icons', THEME_URI . '/themify/themify-icons/themify-icons.css', array(), $theme_version);
    // Enqueue scripts ////////////////////////////////////////////
    $scripts = array('isotope', 'infinitescroll', 'backstretch');
    foreach ($scripts as $js) {
        wp_enqueue_script('themify-' . $js, THEME_URI . '/js/' . $js . '.js', array('jquery'), false, true);
    }
    // Check scrolling and transition effect
    $scrollingEffect = true;
    $scrollingEffectType = themify_get('section_parallax_effect') != '' ? themify_get('section_parallax_effect') : 'effect2';
    $transitionEffect = true;
    if (themify_get('setting-scrolling_effect_mobile_exclude') != 'on' && themify_is_touch() || themify_check('setting-scrolling_effect_all_disabled')) {
        $scrollingEffect = false;
    }
    // check fly-in/fade-in animation
    if (themify_get('setting-transition_effect_mobile_exclude') != 'on' && themify_is_touch() || themify_check('setting-transition_effect_all_disabled')) {
        $transitionEffect = false;
    }
    // Initialize carousel
    wp_enqueue_script('themify-carousel-js');
    // Themify waypoints
    wp_enqueue_script('theme-waypoints', THEME_URI . '/js/waypoints.min.js', array('jquery'), false, true);
    // Themify Auto Iframe Height
    wp_enqueue_script('theme-auto-iframe-height', THEME_URI . '/js/jquery.iframe-auto-height.js', array('jquery'), false, true);
    // Fullscreen header video
    if (!wp_script_is('themify-bigvideo-js')) {
        wp_enqueue_script('themify-videojs-js', THEMIFY_URI . '/js/video.js', array('jquery'));
        wp_enqueue_script('themify-bigvideo-js', THEMIFY_URI . '/js/bigvideo.js', array('themify-videojs-js'));
    }
    // Themify internal scripts
    wp_enqueue_script('theme-script', THEME_URI . '/js/themify.script.js', array('jquery', 'themify-backstretch'), false, true);
    //Themify Gallery
    wp_enqueue_script('themify-gallery', THEMIFY_URI . '/js/themify.gallery.js', array('jquery'), false, true);
    // Get auto infinite scroll setting
    $autoinfinite = '';
    if (!themify_get('setting-autoinfinite')) {
        $autoinfinite = 'auto';
    }
    //Inject variable values in gallery script
    wp_localize_script('theme-script', 'themifyScript', array('lightbox' => themify_lightbox_vars_init(), 'lightboxContext' => apply_filters('themify_lightbox_context', '#pagewrap'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'loadingImg' => THEME_URI . '/images/loading.gif', 'maxPages' => $wp_query->max_num_pages, 'autoInfinite' => $autoinfinite, 'fixedHeader' => apply_filters('themify_fixed_header', true), 'ajaxurl' => admin_url('admin-ajax.php'), 'load_nonce' => wp_create_nonce('theme_load_nonce'), 'transitionEffect' => $transitionEffect, 'transitionSetup' => apply_filters('themify_transition_setup', array('selectors' => array('.section-post .section-content > .shortcode.list-posts', '.section-post .section-content > .shortcode.team', '.section-post .section-content > .shortcode.portfolio', '.section-post .section-content > .shortcode.highlight', '.section-post .module-portfolio', '.section-post .module-highlight', '.shortcode.col4-3', '.shortcode.col4-2', '.shortcode.col4-1', '.shortcode.col3-2', '.shortcode.col3-1', '.shortcode.col2-1', 'body:not(.query-section) .loops-wrapper.list-post', 'body:not(.query-section) .loops-wrapper.grid4', 'body:not(.query-section) .loops-wrapper.grid3', 'body:not(.query-section) .loops-wrapper.grid2', 'body:not(.query-section) .loops-wrapper.grid2-thumb'), 'effect' => themify_check('setting-transition_effect_fadein') ? 'fade-in' : 'fly-in')), 'scrollingEffect' => $scrollingEffect, 'scrollingEffectType' => $scrollingEffectType, 'scrollingEasing' => !themify_get('setting-scrolling_effect_easing') ? 'linear' : themify_get('setting-scrolling_effect_easing'), 'chart' => apply_filters('themify_chart_init_vars', array('trackColor' => 'rgba(0,0,0,.1)', 'scaleColor' => false, 'lineCap' => 'butt', 'rotate' => 0, 'size' => 175, 'lineWidth' => 3, 'animate' => 2000)), 'headerScroll' => apply_filters('themify_parallax_header_scroll', array('adjust' => 0, 'ratio' => -0.3))));
    // Collect page variables or use defaults
    $page_id = get_queried_object_id();
    if ($page_id != null) {
        $slider_play = get_post_meta($page_id, 'background_auto', true) ? get_post_meta($page_id, 'background_auto', true) : (themify_check('setting-footer_slider_auto') ? themify_get('setting-footer_slider_auto') : 'yes');
        $slider_autoplay = get_post_meta($page_id, 'background_autotimeout', true) ? get_post_meta($page_id, 'background_autotimeout', true) : (themify_check('setting-footer_slider_autotimeout') ? themify_get('setting-footer_slider_autotimeout') : 5);
        $slider_speed = get_post_meta($page_id, 'background_speed', true) ? get_post_meta($page_id, 'background_speed', true) : (themify_check('setting-footer_slider_speed') ? themify_get('setting-footer_slider_speed') : 500);
        $slider_wrap = get_post_meta($page_id, 'background_wrap', true) ? get_post_meta($page_id, 'background_wrap', true) : 'yes';
    } else {
        $slider_play = 'yes';
        $slider_autoplay = 5;
        $slider_speed = 500;
        $slider_wrap = 'yes';
    }
    // Header gallery
    wp_enqueue_script('gallery-script', THEME_URI . '/js/themify.gallery.js', array('jquery'), false, true);
    //Inject variable values in gallery script
    wp_localize_script('gallery-script', 'themifyVars', array('play' => $slider_play, 'autoplay' => $slider_autoplay, 'speed' => $slider_speed, 'wrap' => $slider_wrap));
    // Section slider
    wp_enqueue_script('slider-section', THEME_URI . '/js/themify.slidersection.js', array('jquery'), false, true);
    //Inject variable values in section slider script
    wp_localize_script('slider-section', 'themifySectionVars', array('play' => $slider_play, 'autoplay' => $slider_autoplay, 'speed' => $slider_speed, 'wrap' => $slider_wrap));
    // Easy pie chart
    wp_enqueue_script('themify-easy-pie-chart', THEME_URI . '/js/jquery.easy-pie-chart.js', array('jquery'), $theme_version, true);
    //WordPress internal script to move the comment box to the right place when replying to a user
    if (is_single() || is_page()) {
        wp_enqueue_script('comment-reply');
    }
}
示例#11
0
 /**
  * Checks user choice on retina images generation and display.
  *
  * @since 1.9.0
  *
  * @return bool
  */
 function themify_maybe_do_retina_size()
 {
     // Are we in desktop or mobile?
     if (themify_is_touch()) {
         // Mobile. Does user want to make/show retina images in mobile?
         if (themify_check('setting-enable_retina_mobile')) {
             return true;
         }
     } else {
         // Desktop. Does user want to make/show retina images in desktop?
         if (themify_check('setting-enable_retina_desktop')) {
             return true;
         }
     }
     return false;
 }
 /**
  * Load frontend js and css
  */
 function load_front_js_css()
 {
     wp_enqueue_style('themify-builder-style', THEMIFY_BUILDER_URI . '/css/themify-builder-style.css', array(), THEMIFY_VERSION);
     wp_enqueue_style('themify-animate', THEMIFY_BUILDER_URI . '/css/animate.min.css', array(), THEMIFY_VERSION);
     wp_register_script('themify-easy-pie-chart', THEMIFY_BUILDER_URI . '/js/jquery.easy-pie-chart.js', array('jquery'), THEMIFY_VERSION, true);
     // Themify waypoints
     wp_register_script('theme-waypoints', THEMIFY_URI . '/js/waypoints.min.js', array('jquery'), false, true);
     // load only when editing and login
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         wp_enqueue_style('themify-builder-admin-ui', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION);
         wp_enqueue_style('google-fonts-builder', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Open+Sans:400,300,600|Montserrat');
         wp_enqueue_style('colorpicker', THEMIFY_URI . '/css/jquery.minicolors.css');
         // from themify framework
         wp_enqueue_script('themify-easy-pie-chart');
         // Icon picker
         wp_enqueue_script('themify-font-icons-js', THEMIFY_URI . '/js/themify.font-icons-select.js', array('jquery'), THEMIFY_VERSION, true);
         add_action('wp_footer', 'themify_font_icons_dialog', 10);
         do_action('themify_builder_admin_enqueue', $this);
     }
     // lib scripts
     if (!wp_script_is('themify-carousel-js')) {
         wp_enqueue_script('themify-carousel-js', THEMIFY_URI . '/js/carousel.js', array('jquery'));
         // grab from themify framework
     }
     // Check if BigVideo.js is loaded, if it's not, load it after loading Video.js
     if (!wp_script_is('themify-bigvideo-js')) {
         wp_enqueue_script('themify-videojs-js', THEMIFY_URI . '/js/video.js', array('jquery'));
         wp_enqueue_script('themify-bigvideo-js', THEMIFY_URI . '/js/bigvideo.js', array('themify-videojs-js'));
     }
     // Check if scroll highlight is loaded. If it's not, load it.
     if (!wp_script_is('themify-scroll-highlight')) {
         wp_enqueue_script('themify-scroll-highlight', THEMIFY_BUILDER_URI . '/js/themify.scroll-highlight.js', array('jquery'));
     }
     // module scripts
     wp_register_script('themify-builder-module-plugins-js', THEMIFY_BUILDER_URI . "/js/themify.builder.module.plugins.js", array('jquery'), THEMIFY_VERSION, true);
     wp_enqueue_script('themify-builder-module-plugins-js');
     wp_register_script('themify-builder-script-js', THEMIFY_BUILDER_URI . "/js/themify.builder.script.js", array('jquery', 'theme-waypoints'), THEMIFY_VERSION, true);
     wp_enqueue_script('themify-builder-script-js');
     wp_localize_script('themify-builder-script-js', 'tbLocalScript', array('isTouch' => themify_is_touch() ? true : false, 'animationInviewSelectors' => apply_filters('themify_builder_animation_inview_selectors', array('.fly-in > .post', '.fly-in .row_inner > .tb-column', '.fade-in > .post', '.fade-in .row_inner > .tb-column', '.slide-up > .post', '.slide-up .row_inner > .tb-column', '.col4-1.fly-in', '.col4-2.fly-in, .col4-3.fly-in', '.col3-1.fly-in', '.col3-2.fly-in', '.col2-1.fly-in', '.col-full.fly-in', '.col4-1.fade-in', '.col4-2.fade-in', '.col4-3.fade-in', '.col3-1.fade-in', '.col3-2.fade-in', '.col2-1.fade-in', '.col-full.fade-in', '.col4-1.slide-up', '.col4-2.slide-up', '.col4-3.slide-up', '.col3-1.slide-up', '.col3-2.slide-up', '.col2-1.slide-up', '.col-full.slide-up'))));
     if (Themify_Builder_Model::is_frontend_editor_page()) {
         // load module panel frontend
         add_action('wp_footer', array(&$this, 'builder_module_panel_frontedit'), 10);
         if (function_exists('wp_enqueue_media')) {
             wp_enqueue_media();
         }
         if (class_exists('Jetpack_VideoPress')) {
             // Load this so submit_button() is available in VideoPress' print_media_templates().
             require_once ABSPATH . 'wp-admin/includes/template.php';
         }
         $enqueue_scripts = array('jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-effects-core', 'media-upload', 'jquery-ui-dialog', 'wpdialogs', 'wpdialogs-popup', 'wplink', 'editor', 'quicktags', 'admin-widgets', 'colorpicker-js', 'themify-builder-google-webfont', 'themify-builder-front-ui-js');
         // is mobile version
         if ($this->isMobile()) {
             wp_register_script('themify-builder-mobile-ui-js', THEMIFY_BUILDER_URI . "/js/jquery.ui.touch-punch.js", array('jquery'), THEMIFY_VERSION, true);
             wp_enqueue_script('jquery-ui-mouse');
             wp_enqueue_script('themify-builder-mobile-ui-js');
         }
         foreach ($enqueue_scripts as $script) {
             switch ($script) {
                 case 'admin-widgets':
                     wp_enqueue_script($script, admin_url('/js/widgets.min.js'), array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'));
                     break;
                 case 'colorpicker-js':
                     wp_enqueue_script($script, THEMIFY_URI . '/js/jquery.minicolors.js', array('jquery'));
                     // grab from themify framework
                     break;
                 case 'themify-builder-google-webfont':
                     wp_enqueue_script($script, themify_https_esc('http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'));
                     break;
                 case 'themify-builder-front-ui-js':
                     // front ui js
                     wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.front.ui.js", array('jquery', 'jquery-ui-tabs'), THEMIFY_VERSION, true);
                     wp_enqueue_script($script);
                     wp_localize_script($script, 'themifyBuilder', apply_filters('themify_builder_ajax_front_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'tfb_load_nonce' => wp_create_nonce('tfb_load_nonce'), 'tfb_url' => THEMIFY_BUILDER_URI, 'post_ID' => get_the_ID(), 'dropPlaceHolder' => __('drop module here', 'themify'), 'newRowTemplate' => $this->template_vars['rows']['content'], 'draggerTitleMiddle' => __('Drag left/right to change columns', 'themify'), 'draggerTitleLast' => __('Drag left to add columns', 'themify'), 'moduleDeleteConfirm' => __('Press OK to remove this module', 'themify'), 'toggleOn' => __('Turn On Builder', 'themify'), 'toggleOff' => __('Turn Off Builder', 'themify'), 'confirm_on_turn_off' => __('Do you want to save the changes made to this page?', 'themify'), 'confirm_on_duplicate_page' => __('Save the Builder before duplicating this page?', 'themify'), 'confirm_on_unload' => __('You have unsaved data.', 'themify'), 'textImportBuilder' => __('Import From', 'themify'), 'textRowStyling' => __('Row Styling', 'themify'), 'importFileConfirm' => __('This import will override all current Builder data. Press OK to continue', 'themify'), 'confirm_template_selected' => __('This will replace your current Builder layout with the Template', 'themify'), 'load_layout_title' => __('Layouts', 'themify'), 'save_as_layout_title' => __('Save as Layout', 'themify'), 'confirm_delete_layout' => __('Are you sure want to delete this layout ?', 'themify'), 'isThemifyTheme' => $this->is_themify_theme() ? 'true' : 'false')));
                     // Themify Shortcodes Editor Button: generate and send strings for JavaScript.
                     themify_wpeditor_button_send_vars('themify-builder-front-ui-js');
                     break;
                 default:
                     wp_enqueue_script($script);
                     break;
             }
         }
     }
 }