Current File : /pages/54/47/d0016649/home/htdocs/cd24/wp-content/themes/en-vision/includes/theme/theme.setup.php |
<?php
/**
* Register Shortcode Groups
*/
if ( is_admin() ) {
cloudfw_register_shortcode_groups();
}
function cloudfw_register_shortcode_groups(){
if ( ! cloudfw_is_core_plugin_installed() ) {
return;
}
global $CloudFw_Shortcodes;
/** Register Shortcode Groups */
$CloudFw_Shortcodes->group_register( 'columns' , 5 , array( 'title' => esc_html__('Columns','envision') ) );
$CloudFw_Shortcodes->group_register( 'style' , 15, array( 'title' => esc_html__('Style Codes','envision') ) );
$CloudFw_Shortcodes->group_register( 'advanced', 25, array( 'title' => esc_html__('Advanced','envision') ) );
$CloudFw_Shortcodes->group_register( 'social' , 35, array( 'title' => esc_html__('Social Services','envision') ) );
/** Register Composer Groups */
$CloudFw_Shortcodes->composer_group_register( 'composer_layouts', 5, array( 'title' => esc_html__('Layouts','envision') ) );
$CloudFw_Shortcodes->composer_group_register( 'composer_widgets', 10, array( 'title' => esc_html__('Widgets','envision') ) );
$CloudFw_Shortcodes->composer_group_register( 'composer_post_list', 15, array( 'title' => esc_html__('Post Lists','envision') ) );
}
/**
* Load all environment units of the theme
* Hooks: wp_print_styles, wp_print_scripts, wp_head
*/
/** Css */
function cloudfw_load_css(){
$suffix = apply_filters( 'cloudfw_asset_suffix', defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min' );
$version = cloudfw_get_combined_version();
$is_child_theme = is_child_theme();
wp_register_style ('theme-frontend-style', TMP_CSS . 'style'. $suffix .'.css', NULL, $version);
wp_register_style ('theme-frontend-style-rtl', TMP_CSS . 'rtl'. $suffix .'.css', NULL, $version);
wp_register_style ('theme-bootstrap-responsive-1170', TMP_CSS . 'bootstrap-responsive-1170'. $suffix .'.css', NULL, $version);
wp_register_style ('theme-woocommerce', TMP_CSS . 'woocommerce'. $suffix .'.css', NULL, $version);
wp_register_style ('theme-bbpress', TMP_CSS . 'bbpress'. $suffix .'.css', NULL, $version);
wp_register_style ('theme-child-frontend-style', CHILD_TMP_URL . 'style.css', NULL, $version);
wp_register_style ('theme-child-frontend-style-rtl', CHILD_TMP_URL . 'rtl.css', NULL, $version);
wp_register_style ('theme-child-woocommerce', CHILD_TMP_URL . 'woocommerce.css', NULL, $version);
wp_register_style ('theme-child-bbpress', CHILD_TMP_URL . 'bbpress.css', NULL, $version);
wp_enqueue_style('theme-frontend-style');
if ( $is_child_theme ) {
wp_enqueue_style('theme-child-frontend-style');
}
if ( cloudfw_get_option('global', 'width') == '1170' ) {
wp_enqueue_style('theme-bootstrap-responsive-1170');
}
if ( cloudfw_woocommerce() ) {
if ( $is_child_theme && file_exists( get_stylesheet_directory().'/woocommerce.css' ) ) {
wp_enqueue_style('theme-child-woocommerce');
} else {
wp_enqueue_style('theme-woocommerce');
}
}
if ( cloudfw_bbpress() ) {
if ( $is_child_theme && file_exists( get_stylesheet_directory().'/bbpress.css' ) ) {
wp_enqueue_style('theme-child-bbpress');
} else {
wp_enqueue_style('theme-bbpress');
}
}
if ( is_rtl() ) {
wp_enqueue_style('theme-frontend-style-rtl');
if ( $is_child_theme ) {
wp_enqueue_style('theme-child-frontend-style-rtl');
}
}
do_action('cloudfw_css');
cloudfw_font_engine();
}
/** Javascripts */
function cloudfw_load_javascripts(){
$version = cloudfw_get_combined_version();
global $pagenow;
if ( isset($pagenow) && $pagenow == 'wp-login.php' ) {
do_action( 'cloudfw_head' );
}
$suffix = apply_filters( 'cloudfw_asset_suffix', defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min' );
cloudfw_render_js_options();
/** Core Scripts */
wp_register_script ('theme-app', TMP_JS . 'app'. $suffix .'.js', array( 'jquery' ), $version, true);
/** Scripts */
wp_register_script ('theme-woocommerce', TMP_JS . 'woocommerce'. $suffix .'.js', array( 'jquery' ), $version, true);
wp_register_script ('theme-flexslider', TMP_JS . 'jquery-flexslider'. $suffix .'.js', array( 'jquery' ), $version, true);
wp_register_script ('theme-isotope', TMP_JS . 'jquery-isotope'. $suffix .'.js', array( 'jquery' ), $version, true);
wp_register_script ('theme-masonry', TMP_JS . 'jquery-masonry'. $suffix .'.js', array( 'jquery' ), $version, true);
wp_register_script ('theme-packery', TMP_JS . 'packery-pkgd'. $suffix .'.js', array( 'jquery' ), $version, true);
wp_register_script ('theme-queryloader2', TMP_JS . 'queryloader2'. $suffix .'.js', array( 'jquery' ), $version, false);
wp_register_script ('theme-smoothscroll', TMP_JS . 'jquery-smoothscroll'. $suffix .'.js', array( 'jquery' ), $version, true);
/** Load Core Scripts */
wp_enqueue_script ('theme-app');
/** Do action: Javascript */
do_action('cloudfw_javascript');
if ( file_exists( TMP_JS_PATH.'woocommerce.js' ) && cloudfw_woocommerce() ) {
wp_enqueue_script('theme-woocommerce');
}
/** Load Comment Reply Script */
if (is_singular()) {
wp_enqueue_script('comment-reply');
}
}
/** Run the Environment Functions */
if ( ! is_admin() ) {
add_action('wp_print_styles', 'cloudfw_load_css', 1);
add_action('wp_print_scripts', 'cloudfw_load_javascripts', 1);
}
/**
* CloudFw Register Fonts
*
* @since 1.0
*/
/* System Fonts */
cloudfw_register_font('default', 'Helvetica, Arial, sans-serif', 'Helvetica, Arial');
cloudfw_register_font('default', 'Tahoma, Geneva, sans-serif', 'Tahoma');
cloudfw_register_font('default', '\'Trebuchet MS\', Helvetica, Arial, sans-serif', 'Trebuchet MS');
cloudfw_register_font('default', '\'Times New Roman\', Times, serif', 'Times New Roman');
cloudfw_register_font('default', 'Georgia, \'Times New Roman\', Times, serif', 'Georgia');
cloudfw_register_font('default', '\'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif', 'Lucida Sans Unicode');
cloudfw_register_font('default', 'Verdana, Geneva, sans-serif', 'Verdana');
cloudfw_register_font('default', '\'Courier New\', Courier, monospace', 'Courier New, Monospace');
/**
* CloudFw Social Services
*
* %1$s: URL
* %2$s: Title
*
* @hook: cloudfw_social_services
* @since 1.0
*/
function cloudfw_social_services() {
$social_services = array();
$social_services["facebook"] = array( "item_name" => "Facebook", "item_regex" => 'http://www.facebook.com/share.php?u=%1$s&t=%2$s' );
$social_services["twitter"] = array( "item_name" => "Twitter", "item_regex" => 'http://twitter.com/share?url=%1$s&text=%2$s' );
$social_services["friendfeed"] = array( "item_name" => "FriendFeed", "item_regex" => 'http://www.friendfeed.com/share?link=%1$s&title=%2$s' );
$social_services["digg"] = array( "item_name" => "Digg", "item_regex" => 'http://digg.com/submit?url=%1$s&title=%2$s' );
$social_services["tumblr"] = array( "item_name" => "Tumblr", "item_regex" => 'http://www.tumblr.com/share?u=%1$s&t=%2$s' );
$social_services["delicious"] = array( "item_name" => "Delicious", "item_regex" => 'http://delicious.com/post?url=%1$s&title=%2$s' );
$social_services["myspace"] = array( "item_name" => "Myspace", "item_regex" => 'http://www.myspace.com/Modules/PostTo/Pages/?u=%1$s&t=%2$s' );
$social_services["linkedin"] = array( "item_name" => "LinkedIn", "item_regex" => 'http://www.linkedin.com/shareArticle?mini=true&url=%1$s&title=%2$s' );
$social_services["mixx"] = array( "item_name" => "Mixx", "item_regex" => 'http://www.mixx.com/submit?page_url=%1$s&title=%2$s' );
$social_services["google"] = array( "item_name" => "Google", "item_regex" => 'http://www.google.com/bookmarks/mark?op=edit&bkmk=%1$s&title=%2$s' );
$social_services["netvibes"] = array( "item_name" => "Netvibes", "item_regex" => 'http://www.netvibes.com/share?url=%1$s&title=%2$s' );
$social_services["posterous"] = array( "item_name" => "Posterous", "item_regex" => 'http://posterous.com/share?linkto=%1$s&title=%2$s' );
$social_services["reddit"] = array( "item_name" => "Reddit", "item_regex" => 'http://reddit.com/submit?url=%1$s&title=%2$s' );
$social_services["stumbleupon"] = array( "item_name" => "Stumbleupon", "item_regex" => 'http://www.stumbleupon.com/submit?url=%1$s&title=%2$s' );
$social_services["technorati"] = array( "item_name" => "Technorati", "item_regex" => 'http://technorati.com/faves?add=%1$s' );
$social_services["yahoo-buzz"] = array( "item_name" => "Yahoo Buzz", "item_regex" => 'http://buzz.yahoo.com/submit/?submitUrl=%1$s&submitHeadline=%2$s' );
return apply_filters('cloudfw_social_services', $social_services);
}
/**
* CloudFw Register PreDefined Patterns
*
* [ID, Name, CSS Code, Group]
* @since 1.0
*/
cloudfw_register_skin_style(
'wood-texture', 'Wood Texture #1',
'background-image: url('.TMP_URL.'/lib/patterns/wood_texture.png); background-repeat: repeat', esc_html__('Textures','envision')
);
cloudfw_register_skin_style(
'escheresque-texture', 'Dark Pattern #1',
'background-image: url('.TMP_URL.'/lib/patterns/escheresque_ste.png); background-repeat: repeat', esc_html__('Textures','envision')
);
/**
* Add Homepage Link Into the Navigation Menu
*
* @since 1. 0
*
*/
if ( _check_onoff( cloudfw_get_option('global', 'homeitem') ) ) {
add_filter( 'wp_nav_menu_objects', 'cloudfw_add_homepage_item_to_nav_menu', 10, 2 );
}
function cloudfw_add_homepage_item_to_nav_menu( $items, $args = array() ){
if ( $args->theme_location == 'primary' && $args->depth == 0 ) {
$item_home = array(
'noconvert' => TRUE,
'ID' => 0,
'db_id' => 0,
'filter' => 'raw',
'menu_item_parent'
=> 0,
'object' => 'custom',
'type' => 'custom',
'type_label'=> 'Custom',
'title' => cloudfw_translate('home'),
'url' => __home_url(),
);
$item_home['classes'][] = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-home level-0 top-level-item';
if ( is_front_page() ) {
$item_home['classes'][] = 'current-menu-item';
}
if ( is_array( $items ) && !empty($items) ) {
array_unshift($items, (object) $item_home);
}
}
return $items;
}
/**
* Add Shortcode Support to Wdiget Texts
*
* @since 1.0
**/
add_filter('the_title', 'do_shortcode');
add_filter('widget_title', 'do_shortcode');
add_filter('widget_text', 'do_shortcode');