Modularización de GKACHELE SaaS
This commit is contained in:
867
wp-content/themes/abiz/core/core.php
Normal file
867
wp-content/themes/abiz/core/core.php
Normal file
@@ -0,0 +1,867 @@
|
||||
<?php
|
||||
// Includes files
|
||||
require_once get_template_directory() . '/core/theme-menu/class-bootstrap-navwalker.php';
|
||||
require_once get_template_directory() . '/core/custom-header.php';
|
||||
require_once get_template_directory() . '/core/customizer/abiz-default-options.php';
|
||||
require_once get_template_directory() . '/core/customizer/customizer.php';
|
||||
require get_template_directory() . '/core/customizer/customizer-repeater/inc/customizer.php';
|
||||
|
||||
// Register Google fonts
|
||||
function abiz_site_get_google_font()
|
||||
{
|
||||
|
||||
$font_families = array('Source+Sans+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900');
|
||||
|
||||
$fonts_url = add_query_arg( array(
|
||||
'family' => implode( '&family=', $font_families ),
|
||||
'display' => 'swap',
|
||||
), 'https://fonts.googleapis.com/css2' );
|
||||
|
||||
require_once get_theme_file_path( 'core/wptt-webfont-loader.php' );
|
||||
|
||||
return wptt_get_webfont_url( esc_url_raw( $fonts_url ) );
|
||||
}
|
||||
|
||||
// Enqueue scripts and styles.
|
||||
add_action( 'wp_enqueue_scripts', 'abiz_theme_scripts' );
|
||||
function abiz_theme_scripts() {
|
||||
|
||||
// Styles
|
||||
wp_enqueue_style(
|
||||
'bootstrap-min',
|
||||
get_template_directory_uri().'/assets/css/bootstrap.min.css'
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'owl-carousel-min',
|
||||
get_template_directory_uri().'/assets/css/owl.carousel.min.css'
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'all-css',
|
||||
get_template_directory_uri().'/assets/css/all.min.css'
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'animate',
|
||||
get_template_directory_uri().'/assets/css/animate.min.css'
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'abiz-main',
|
||||
get_template_directory_uri() . '/assets/css/main.css'
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'abiz-media-query',
|
||||
get_template_directory_uri() . '/assets/css/responsive.css'
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'abiz-fonts',
|
||||
abiz_site_get_google_font() ,
|
||||
array() ,
|
||||
null
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'abiz-style',
|
||||
get_stylesheet_uri()
|
||||
);
|
||||
|
||||
$output_style = '';
|
||||
// Page Header
|
||||
$page_header_img_opacity = get_theme_mod('page_header_img_opacity', abiz_get_default_option( 'page_header_img_opacity' ));
|
||||
$page_header_bg_color = get_theme_mod('page_header_bg_color', abiz_get_default_option( 'page_header_bg_color' ));
|
||||
|
||||
if (has_header_image())
|
||||
{
|
||||
$output_style .= ".breadcrumb-area:after {
|
||||
background-color: " . esc_attr($page_header_bg_color) . ";
|
||||
opacity: " . esc_attr($page_header_img_opacity) . ";
|
||||
}\n";
|
||||
}
|
||||
|
||||
// Logo Style
|
||||
$logo_size = get_theme_mod('logo_size', abiz_get_default_option( 'logo_size' ));
|
||||
$site_ttl_font_size = get_theme_mod('site_ttl_font_size', abiz_get_default_option( 'site_ttl_font_size' ));
|
||||
$site_desc_font_size = get_theme_mod('site_desc_font_size', abiz_get_default_option( 'site_desc_font_size' ));
|
||||
$output_style .= ".logo img, .mobile-logo img {max-width: " . esc_attr($logo_size) . "px;}\n";
|
||||
$output_style .= ".site-title {font-size: " . esc_attr($site_ttl_font_size) . "px;}\n";
|
||||
$output_style .= ".site-description {font-size: " . esc_attr($site_desc_font_size) . "px;}\n";
|
||||
|
||||
// Typography Body
|
||||
$abiz_body_font_size = get_theme_mod('abiz_body_font_size',abiz_get_default_option( 'abiz_body_font_size' ));
|
||||
$abiz_body_font_weight = get_theme_mod('abiz_body_font_weight','inherit');
|
||||
$abiz_body_text_transform = get_theme_mod('abiz_body_text_transform','inherit');
|
||||
$abiz_body_font_style = get_theme_mod('abiz_body_font_style','inherit');
|
||||
$abiz_body_txt_decoration = get_theme_mod('abiz_body_txt_decoration','none');
|
||||
$output_style .=" body{
|
||||
font-size: " .esc_attr($abiz_body_font_size). "px;
|
||||
font-weight: " .esc_attr($abiz_body_font_weight). ";
|
||||
text-transform: " .esc_attr($abiz_body_text_transform). ";
|
||||
font-style: " .esc_attr($abiz_body_font_style). ";
|
||||
text-decoration: " .esc_attr($abiz_body_txt_decoration). ";
|
||||
}\n";
|
||||
|
||||
wp_add_inline_style(
|
||||
'abiz-style',
|
||||
$output_style
|
||||
);
|
||||
|
||||
// Scripts
|
||||
wp_enqueue_script( 'jquery' );
|
||||
|
||||
wp_enqueue_script(
|
||||
'bootstrap',
|
||||
get_template_directory_uri() . '/assets/js/bootstrap.min.js',
|
||||
array('jquery'),
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'owl-carousel',
|
||||
get_template_directory_uri() . '/assets/js/owl.carousel.min.js',
|
||||
array('jquery'),
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'wow-min',
|
||||
get_template_directory_uri() . '/assets/js/wow.min.js',
|
||||
array('jquery'),
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'marquee',
|
||||
get_template_directory_uri() . '/assets/js/jquery.marquee.js',
|
||||
array( 'jquery' ),
|
||||
'1.0',
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'abiz-custom-js',
|
||||
get_template_directory_uri() . '/assets/js/custom.js',
|
||||
array('jquery'),
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_enqueue_scripts', 'abiz_theme_admin_scripts' );
|
||||
function abiz_theme_admin_scripts() {
|
||||
wp_enqueue_style(
|
||||
'abiz-admin-style',
|
||||
ABIZ_THEME_CORE_URI . '/customizer/assets/css/admin.css'
|
||||
);
|
||||
wp_enqueue_script(
|
||||
'abiz-admin-script',
|
||||
ABIZ_THEME_CORE_URI . '/customizer/assets/js/admin-script.js',
|
||||
array( 'jquery' ), '',
|
||||
true
|
||||
);
|
||||
wp_localize_script(
|
||||
'abiz-admin-script',
|
||||
'abiz_ajax_object',
|
||||
array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
|
||||
);
|
||||
}
|
||||
|
||||
// Register widget area
|
||||
add_action( 'widgets_init', 'abiz_widgets_init' );
|
||||
function abiz_widgets_init() {
|
||||
|
||||
// Sidebar Widget
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => __( 'Main Sidebar Widget', 'abiz' ),
|
||||
'id' => 'sidebar-primary',
|
||||
'description' => __( 'Main Sidebar Widget', 'abiz' ),
|
||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5>',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer Sidebar 1
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => __( 'Footer Sidebar 1', 'abiz' ),
|
||||
'id' => 'footer-sidebar-1',
|
||||
'description' => __( 'The Footer Widget Area 1', 'abiz' ),
|
||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5><div class="widget_seperator"><span class="bg-primary"></span><span class="bg-white"></span><span class="bg-white"></span></div>',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer Sidebar 2
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => __( 'Footer Sidebar 2', 'abiz' ),
|
||||
'id' => 'footer-sidebar-2',
|
||||
'description' => __( 'The Footer Widget Area 2', 'abiz' ),
|
||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5><div class="widget_seperator"><span class="bg-primary"></span><span class="bg-white"></span><span class="bg-white"></span></div>',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer Sidebar 3
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => __( 'Footer Sidebar 3', 'abiz' ),
|
||||
'id' => 'footer-sidebar-3',
|
||||
'description' => __( 'The Footer Widget Area 3', 'abiz' ),
|
||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5><div class="widget_seperator"><span class="bg-primary"></span><span class="bg-white"></span><span class="bg-white"></span></div>',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer Sidebar 4
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => __( 'Footer Sidebar 4', 'abiz' ),
|
||||
'id' => 'footer-sidebar-4',
|
||||
'description' => __( 'The Footer Widget Area 4', 'abiz' ),
|
||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5><div class="widget_seperator"><span class="bg-primary"></span><span class="bg-white"></span><span class="bg-white"></span></div>',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// WooCommerce Sidebar
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => __( 'WooCommerce Sidebar', 'abiz' ),
|
||||
'id' => 'sidebar-woocommerce',
|
||||
'description' => __( 'This Widget area for WooCommerce Widget', 'abiz' ),
|
||||
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</aside>',
|
||||
'before_title' => '<h5 class="widget-title">',
|
||||
'after_title' => '</h5>',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Function that returns if the menu is sticky
|
||||
if (!function_exists('abiz_site_header_sticky')):
|
||||
function abiz_site_header_sticky()
|
||||
{
|
||||
$enable_hdr_sticky = get_theme_mod('enable_hdr_sticky', abiz_get_default_option( 'enable_hdr_sticky' ));
|
||||
|
||||
if ($enable_hdr_sticky == '1'): return 'is-sticky-on'; endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
// Abiz Section Header
|
||||
if (!function_exists('abiz_section_header')):
|
||||
function abiz_section_header($title, $subtitle, $description)
|
||||
{
|
||||
if (!empty($title) || !empty($subtitle) || !empty($description)): ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-12 mx-lg-auto mb-5 text-center">
|
||||
<div class="theme-main-heading wow fadeInUp">
|
||||
<?php if (!empty($title)): ?><span class="title"><span class="htdot"></span><?php echo wp_kses_post($title); ?><span class="htdot"></span></span><?php endif; ?>
|
||||
|
||||
<?php if (!empty($subtitle)): ?><h2 class="subtitle"><?php echo wp_kses_post($subtitle); ?></h2><?php endif; ?>
|
||||
|
||||
<?php if (!empty($description)): ?><p class="content"><?php echo wp_kses_post($description); ?></p><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('abiz_section_header_white')):
|
||||
function abiz_section_header_white($title, $subtitle, $description)
|
||||
{
|
||||
if (!empty($title) || !empty($subtitle) || !empty($description)): ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-12 mx-lg-auto mb-5 text-center">
|
||||
<div class="theme-main-heading theme-white-heading wow fadeInUp">
|
||||
<?php if (!empty($title)): ?><span class="title"><span class="htdot"></span><?php echo wp_kses_post($title); ?><span class="htdot"></span></span><?php endif; ?>
|
||||
|
||||
<?php if (!empty($subtitle)): ?><h2 class="subtitle"><?php echo wp_kses_post($subtitle); ?></h2><?php endif; ?>
|
||||
|
||||
<?php if (!empty($description)): ?><p class="content"><?php echo wp_kses_post($description); ?></p><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
// Adds custom classes to the array of body classes.
|
||||
add_filter('body_class', 'abiz_get_body_classes');
|
||||
function abiz_get_body_classes($classes)
|
||||
{
|
||||
// Adds a class of group-blog to blogs with more than 1 published author.
|
||||
if (is_multi_author()) {$classes[] = 'group-blog';}
|
||||
|
||||
// Adds a class of hfeed to non-singular pages.
|
||||
if (!is_singular()){$classes[] = 'hfeed';}
|
||||
|
||||
$classes[] = 'heading-design-2';
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
|
||||
// Top Header
|
||||
if (!function_exists('abiz_top_header')){
|
||||
function abiz_top_header(){
|
||||
$enable_top_hdr = get_theme_mod('enable_top_hdr',abiz_get_default_option( 'enable_top_hdr' ));
|
||||
$enable_hdr_info1 = get_theme_mod('enable_hdr_info1',abiz_get_default_option( 'enable_hdr_info1' ));
|
||||
$hdr_info1_icon = get_theme_mod('hdr_info1_icon',abiz_get_default_option( 'hdr_info1_icon' ));
|
||||
$hdr_info1_title = get_theme_mod('hdr_info1_title',abiz_get_default_option( 'hdr_info1_title' ));
|
||||
$hdr_info1_link = get_theme_mod('hdr_info1_link',abiz_get_default_option( 'hdr_info1_link' ));
|
||||
|
||||
$enable_hdr_info2 = get_theme_mod('enable_hdr_info2',abiz_get_default_option( 'enable_hdr_info2' ));
|
||||
$hdr_info2_icon = get_theme_mod('hdr_info2_icon',abiz_get_default_option( 'hdr_info2_icon' ));
|
||||
$hdr_info2_title = get_theme_mod('hdr_info2_title',abiz_get_default_option( 'hdr_info2_title' ));
|
||||
$hdr_info2_link = get_theme_mod('hdr_info2_link',abiz_get_default_option( 'hdr_info2_link' ));
|
||||
|
||||
$enable_hdr_info3 = get_theme_mod('enable_hdr_info3',abiz_get_default_option( 'enable_hdr_info3' ));
|
||||
$hdr_info3_icon = get_theme_mod('hdr_info3_icon',abiz_get_default_option( 'hdr_info3_icon' ));
|
||||
$hdr_info3_title = get_theme_mod('hdr_info3_title',abiz_get_default_option( 'hdr_info3_title' ));
|
||||
$hdr_info3_link = get_theme_mod('hdr_info3_link',abiz_get_default_option( 'hdr_info3_link' ));
|
||||
|
||||
$enable_social_icon = get_theme_mod('enable_social_icon',abiz_get_default_option( 'enable_social_icon' ));
|
||||
$hdr_social_icons = get_theme_mod('hdr_social_icons',abiz_get_default_option( 'hdr_social_icons' ));
|
||||
if($enable_top_hdr=='1'): ?>
|
||||
<div id="above-header" class="above-header d-lg-block wow fadeInDown">
|
||||
<div class="header-widget d-flex align-items-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-12 mb-lg-0 mb-4">
|
||||
<div class="widget-left text-lg-left text-center">
|
||||
<?php if($enable_hdr_info1=='1'): ?>
|
||||
<aside class="widget widget-contact info1">
|
||||
<div class="contact-area">
|
||||
<?php if(!empty($hdr_info1_icon)): ?>
|
||||
<div class="contact-icon">
|
||||
<div class="contact-corn"><i class="<?php echo esc_attr($hdr_info1_icon); ?>"></i></div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php if(!empty($hdr_info1_title)): ?>
|
||||
<div class="contact-info">
|
||||
<h6 class="title"><a href="<?php echo esc_url($hdr_info1_link); ?>"><?php echo wp_kses_post($hdr_info1_title); ?></a></h6>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($enable_hdr_info2=='1'): ?>
|
||||
<aside class="widget widget-contact info2">
|
||||
<div class="contact-area">
|
||||
<?php if(!empty($hdr_info2_icon)): ?>
|
||||
<div class="contact-icon">
|
||||
<div class="contact-corn"><i class="<?php echo esc_attr($hdr_info2_icon); ?>"></i></div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php if(!empty($hdr_info2_title)): ?>
|
||||
<div class="contact-info">
|
||||
<h6 class="title"><a href="<?php echo esc_url($hdr_info2_link); ?>"><?php echo wp_kses_post($hdr_info2_title); ?></a></h6>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-12 mb-lg-0 mb-4">
|
||||
<div class="widget-right justify-content-lg-end justify-content-center text-lg-right text-center">
|
||||
<?php if($enable_hdr_info3=='1'): ?>
|
||||
<aside class="widget widget-contact info3">
|
||||
<div class="contact-area">
|
||||
<?php if(!empty($hdr_info3_icon)): ?>
|
||||
<div class="contact-icon">
|
||||
<div class="contact-corn"><i class="<?php echo esc_attr($hdr_info3_icon); ?>"></i></div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php if(!empty($hdr_info3_title)): ?>
|
||||
<div class="contact-info">
|
||||
<h6 class="title"><a href="<?php echo esc_url($hdr_info3_link); ?>"><?php echo wp_kses_post($hdr_info3_title); ?></a></h6>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($enable_social_icon=='1'): ?>
|
||||
<aside class="widget widget_social_widget third">
|
||||
<ul>
|
||||
<?php
|
||||
$social_icons = json_decode($hdr_social_icons);
|
||||
if( $social_icons!='' )
|
||||
{
|
||||
foreach($social_icons as $social_item){
|
||||
$social_icon = ! empty( $social_item->icon_value ) ? apply_filters( 'abiz_translate_single_string', $social_item->icon_value, 'Header section' ) : '';
|
||||
$social_link = ! empty( $social_item->link ) ? apply_filters( 'abiz_translate_single_string', $social_item->link, 'Header section' ) : '';
|
||||
?>
|
||||
<li><a href="<?php echo esc_url( $social_link ); ?>"><i class="<?php echo esc_attr( $social_icon ); ?>"></i></a></li>
|
||||
<?php }} ?>
|
||||
</ul>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;
|
||||
}}
|
||||
|
||||
/**
|
||||
* Add WooCommerce Cart Icon With Cart Count
|
||||
*/
|
||||
add_filter('woocommerce_add_to_cart_fragments', 'abiz_woo_add_to_cart_fragment');
|
||||
function abiz_woo_add_to_cart_fragment($fragments)
|
||||
{
|
||||
|
||||
ob_start();
|
||||
$count = WC()
|
||||
->cart->cart_contents_count;
|
||||
?>
|
||||
<button type="button" class="cart-icon-wrap header-cart"><i class="fa fa-shopping-bag"></i>
|
||||
<?php
|
||||
if ($count > 0)
|
||||
{
|
||||
?>
|
||||
<span><?php echo esc_html($count); ?></span>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<span><?php esc_html_e('0','abiz'); ?></span>
|
||||
<?php
|
||||
}
|
||||
?></button><?php
|
||||
$fragments['.cart-icon-wrap'] = ob_get_clean();
|
||||
|
||||
return $fragments;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_show_admin_notice', function ( $show, $notice ) {
|
||||
if ( 'template_files' === $notice ) { return false; }
|
||||
return $show;
|
||||
}, 10, 2 );
|
||||
|
||||
// Page Title
|
||||
if (!function_exists('abiz_page_title'))
|
||||
{
|
||||
function abiz_page_title()
|
||||
{
|
||||
|
||||
if (is_home() || is_front_page()): single_post_title();
|
||||
|
||||
elseif (is_day()): printf(__('Daily Archives: %s', 'abiz') , get_the_date());
|
||||
|
||||
elseif (is_month()): printf(__('Monthly Archives: %s', 'abiz') , (get_the_date('F Y')));
|
||||
|
||||
elseif (is_year()): printf(__('Yearly Archives: %s', 'abiz') , (get_the_date('Y')));
|
||||
|
||||
elseif (is_category()): printf(__('Category Archives: %s', 'abiz') , (single_cat_title('', false)));
|
||||
|
||||
elseif (is_tag()): printf(__('Tag Archives: %s', 'abiz') , (single_tag_title('', false)));
|
||||
|
||||
elseif (is_404()): printf(__('Error 404', 'abiz'));
|
||||
|
||||
elseif (is_author()): printf(__('Author: %s', 'abiz') , (get_the_author('', false)));
|
||||
|
||||
elseif (class_exists('woocommerce')):
|
||||
|
||||
if (is_shop()) { woocommerce_page_title(); }
|
||||
elseif (is_tax('product_cat')){ printf(__('Product Category : %s', 'abiz') , (single_term_title('', false))); }
|
||||
elseif (is_cart()){ the_title(); }
|
||||
elseif (is_checkout()) { the_title();}
|
||||
else { the_title();}
|
||||
else: the_title();
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
// Page Header
|
||||
function abiz_page_header()
|
||||
{
|
||||
global $post;
|
||||
|
||||
echo '<li><a href="' . esc_url(home_url()) . '">' . esc_html_e('Home','abiz') . '</a> ' . ' / ';
|
||||
|
||||
if (is_category())
|
||||
{
|
||||
$thisCat = get_category(get_query_var('cat') , false);
|
||||
if ($thisCat->parent != 0) echo get_category_parents($thisCat->parent, true, ' ' . ' ');
|
||||
echo '<li class="active">' . esc_html__('Archive by category', 'abiz') . ' "' . esc_html(single_cat_title('', false)) . '"' . '</li>';
|
||||
|
||||
}
|
||||
|
||||
elseif (is_search())
|
||||
{
|
||||
echo '<li class="active">' . esc_html__('Search results for ', 'abiz') . ' "' . esc_html(get_search_query()) . '"' . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_day())
|
||||
{
|
||||
echo '<a href="' . esc_url(get_year_link(get_the_time('Y'))) . '">' . esc_html(get_the_time('Y')) . '</a> ' . ' / ';
|
||||
echo '<a href="' . esc_url(get_month_link(get_the_time('Y') , get_the_time('m'))) . '">' . esc_html(get_the_time('F')) . '</a> ' . ' / ';
|
||||
echo '<li class="active">' . esc_html(get_the_time('d')) . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_month())
|
||||
{
|
||||
echo '<a href="' . esc_url(get_year_link(get_the_time('Y'))) . '">' . esc_html(get_the_time('Y')) . '</a>  / ';
|
||||
echo '<li class="active">' . esc_html(get_the_time('F')) . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_year())
|
||||
{
|
||||
echo '<li class="active">' . esc_html(get_the_time('Y')) . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_single() && !is_attachment())
|
||||
{
|
||||
if (get_post_type() != 'post')
|
||||
{
|
||||
if (class_exists('WooCommerce'))
|
||||
{
|
||||
echo '   ' . '<li class="active">' . wp_kses_post(get_the_title()) . '</li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$post_type = get_post_type_object(get_post_type());
|
||||
$slug = $post_type->rewrite;
|
||||
echo '<a href="' . esc_url(home_url()) . '/' . $slug['slug'] . '/">' . $post_type
|
||||
->labels->singular_name . '</a>';
|
||||
echo '  / ' . '<li class="active">' . wp_kses_post(get_the_title()) . '</li>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$cat = get_the_category();
|
||||
$cat = $cat[0];
|
||||
$cats = get_category_parents($cat, true, '  / ');
|
||||
$cats = preg_replace("#^(.+)\s\s$#", "$1", $cats);
|
||||
echo $cats;
|
||||
echo '<li class="active">' . esc_html(get_the_title()) . '</li>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404())
|
||||
{
|
||||
if (class_exists('WooCommerce'))
|
||||
{
|
||||
if (is_shop())
|
||||
{
|
||||
$thisshop = woocommerce_page_title();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$post_type = get_post_type_object(get_post_type());
|
||||
echo '<li class="active">' . $post_type
|
||||
->labels->singular_name . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404())
|
||||
{
|
||||
$post_type = get_post_type_object(get_post_type());
|
||||
echo '<li class="active">' . $post_type
|
||||
->labels->singular_name . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_attachment())
|
||||
{
|
||||
$parent = get_post($post->post_parent);
|
||||
$cat = get_the_category($parent->ID);
|
||||
if (!empty($cat))
|
||||
{
|
||||
$cat = $cat[0];
|
||||
echo get_category_parents($cat, true, '  / ');
|
||||
}
|
||||
echo '<a href="' . esc_url(get_permalink($parent)) . '">' . $parent->post_title . '</a>';
|
||||
echo '<li class="active">' . esc_html(get_the_title()) . '</li>';
|
||||
|
||||
}
|
||||
|
||||
elseif (is_page() && !$post->post_parent)
|
||||
{
|
||||
echo '<li class="active">' . esc_html(get_the_title()) . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_page() && $post->post_parent)
|
||||
{
|
||||
$parent_id = $post->post_parent;
|
||||
$breadcrumbs = array();
|
||||
while ($parent_id)
|
||||
{
|
||||
$page = get_page($parent_id);
|
||||
$breadcrumbs[] = '<a href="' . esc_url(get_permalink($page->ID)) . '">' . esc_html(get_the_title($page->ID)) . '</a>' . ' / ';
|
||||
$parent_id = $page->post_parent;
|
||||
}
|
||||
|
||||
$breadcrumbs = array_reverse($breadcrumbs);
|
||||
for ($i = 0;$i < count($breadcrumbs);$i++)
|
||||
{
|
||||
echo $breadcrumbs[$i];
|
||||
if ($i != count($breadcrumbs) - 1) echo ' / ';
|
||||
}
|
||||
echo '<li class="active">' . esc_html(get_the_title()) . '</li>';
|
||||
|
||||
}
|
||||
elseif (is_tag())
|
||||
{
|
||||
echo '<li class="active">' . esc_html__('Posts tagged ', 'abiz') . ' "' . esc_html(single_tag_title('', false)) . '"' . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_author())
|
||||
{
|
||||
global $author;
|
||||
$userdata = get_userdata($author);
|
||||
echo '<li class="active">' . esc_html__('Articles posted by ', 'abiz') . '' . $userdata->display_name . '</li>';
|
||||
}
|
||||
|
||||
elseif (is_404())
|
||||
{
|
||||
echo '<li class="active">' . esc_html__('Error 404 ', 'abiz') . '</li>';
|
||||
}
|
||||
|
||||
if (get_query_var('paged'))
|
||||
{
|
||||
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) echo '';
|
||||
echo ' ( ' . esc_html__('Page', 'abiz') . '' . esc_html(get_query_var('paged')) . ' )';
|
||||
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) echo '';
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
|
||||
// Excerpt Length
|
||||
function abiz_blog_excerpt_length( $length ) {
|
||||
$blog_excerpt_length = get_theme_mod( 'blog_excerpt_length', abiz_get_default_option( 'blog_excerpt_length' ));
|
||||
if( $blog_excerpt_length == 1000 ) {
|
||||
return 9999;
|
||||
}
|
||||
return esc_html( $blog_excerpt_length );
|
||||
}
|
||||
add_filter( 'excerpt_length', 'abiz_blog_excerpt_length', 999 );
|
||||
|
||||
|
||||
// Excerpt Text
|
||||
function abiz_blog_excerpt_after_text( $more ) {
|
||||
$blog_excerpt_after_text = get_theme_mod( 'blog_excerpt_after_text', abiz_get_default_option( 'blog_excerpt_after_text' ));
|
||||
return $blog_excerpt_after_text;
|
||||
}
|
||||
add_filter( 'excerpt_more', 'abiz_blog_excerpt_after_text' );
|
||||
|
||||
|
||||
// Blog Excerpt Button
|
||||
if ( ! function_exists( 'abiz_blog_excerpt_button' ) ) :
|
||||
function abiz_blog_excerpt_button() {
|
||||
$enable_blog_excerpt_btn = get_theme_mod( 'enable_blog_excerpt_btn', abiz_get_default_option( 'enable_blog_excerpt_btn' ));
|
||||
$blog_excerpt_btn_label = get_theme_mod( 'blog_excerpt_btn_label', abiz_get_default_option( 'blog_excerpt_btn_label' ));
|
||||
if ( $enable_blog_excerpt_btn == '1' ):
|
||||
?>
|
||||
<a href="<?php echo esc_url(get_the_permalink()); ?>" class="more-link"><?php echo wp_kses_post($blog_excerpt_btn_label); ?></a>
|
||||
<?php endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Social Icon
|
||||
*/
|
||||
function abiz_get_social_icon_default()
|
||||
{
|
||||
return apply_filters('abiz_get_social_icon_default', json_encode(array(
|
||||
array(
|
||||
'icon_value' => esc_html__('fab fa-facebook', 'abiz') ,
|
||||
'link' => esc_html__('#', 'abiz') ,
|
||||
'id' => 'customizer_repeater_header_social_001',
|
||||
) ,
|
||||
array(
|
||||
'icon_value' => esc_html__('fab fa-x-twitter', 'abiz') ,
|
||||
'link' => esc_html__('#', 'abiz') ,
|
||||
'id' => 'customizer_repeater_header_social_003',
|
||||
) ,
|
||||
array(
|
||||
'icon_value' => esc_html__('fab fa-instagram', 'abiz') ,
|
||||
'link' => esc_html__('#', 'abiz') ,
|
||||
'id' => 'customizer_repeater_header_social_004',
|
||||
) ,
|
||||
array(
|
||||
'icon_value' => esc_html__('fab fa-tiktok', 'abiz') ,
|
||||
'link' => esc_html__('#', 'abiz') ,
|
||||
'id' => 'customizer_repeater_header_social_005',
|
||||
) ,
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Footer Top Default
|
||||
*/
|
||||
function abiz_footer_top_default()
|
||||
{
|
||||
return apply_filters('abiz_footer_top_default', json_encode(array(
|
||||
array(
|
||||
'icon_value' => 'fas fa-envelope',
|
||||
'title' => esc_html__('Email Us 24/7', 'abiz') ,
|
||||
'subtitle' => esc_html__('info@example.com', 'abiz') ,
|
||||
'link' => 'mailto:info@example.com',
|
||||
'id' => 'customizer_repeater_footer_top_001'
|
||||
) ,
|
||||
array(
|
||||
'icon_value' => 'fas fa-question',
|
||||
'title' => esc_html__('Have Questions?', 'abiz') ,
|
||||
'subtitle' => esc_html__('Contact Us', 'abiz') ,
|
||||
'id' => 'customizer_repeater_footer_top_002',
|
||||
) ,
|
||||
array(
|
||||
'icon_value' => 'fas fa-phone',
|
||||
'title' => esc_html__('Call Us 24/7', 'abiz') ,
|
||||
'subtitle' => esc_html__('+123 456 7890', 'abiz') ,
|
||||
'link' => 'tell:+123 456 7890',
|
||||
'id' => 'customizer_repeater_footer_top_003',
|
||||
) ,
|
||||
array(
|
||||
'icon_value' => 'far fa-clock',
|
||||
'title' => esc_html__('Opening Hours', 'abiz') ,
|
||||
'subtitle' => esc_html__('Mon-Sat: 10- 6 Pm', 'abiz') ,
|
||||
'id' => 'customizer_repeater_footer_top_004',
|
||||
) ,
|
||||
)));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Get Started Notice
|
||||
*******************************************************************************/
|
||||
|
||||
add_action( 'wp_ajax_abiz_dismissed_notice_handler', 'abiz_ajax_notice_handler' );
|
||||
|
||||
/**
|
||||
* AJAX handler to store the state of dismissible notices.
|
||||
*/
|
||||
function abiz_ajax_notice_handler() {
|
||||
if ( isset( $_POST['type'] ) ) {
|
||||
// Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice)
|
||||
$type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
|
||||
// Store it in the options table
|
||||
update_option( 'dismissed-' . $type, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
function abiz_deprecated_hook_admin_notice() {
|
||||
// Check if it's been dismissed...
|
||||
if ( ! get_option('dismissed-get_started', FALSE ) ) {
|
||||
// Added the class "notice-get-started-class" so jQuery pick it up and pass via AJAX,
|
||||
// and added "data-notice" attribute in order to track multiple / different notices
|
||||
// multiple dismissible notice states ?>
|
||||
<div class="updated notice notice-get-started-class is-dismissible" data-notice="get_started">
|
||||
<div class="abiz-getting-started-notice clearfix">
|
||||
<div class="abiz-theme-screenshot">
|
||||
<img src="<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/screenshot.png" class="screenshot" alt="<?php esc_attr_e( 'Theme Screenshot', 'abiz' ); ?>" />
|
||||
</div><!-- /.abiz-theme-screenshot -->
|
||||
<div class="abiz-theme-notice-content">
|
||||
<h2 class="abiz-notice-h2">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: welcome page link starting html tag, 2: welcome page link ending html tag. */
|
||||
esc_html__( 'Welcome! Thank you for choosing %1$s!', 'abiz' ), '<strong>'. wp_get_theme()->get('Name'). '</strong>' );
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<p class="plugin-install-notice"><?php echo sprintf(__('Install and activate <strong>Daddy Plus</strong> plugin for taking full advantage of all the features this theme has to offer.', 'abiz')) ?></p>
|
||||
|
||||
<a class="abiz-btn-get-started button button-primary button-hero abiz-button-padding" href="#" data-name="" data-slug="">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: welcome page link starting html tag, 2: welcome page link ending html tag. */
|
||||
esc_html__( 'Get started with %1$s', 'abiz' ), '<strong>'. wp_get_theme()->get('Name'). '</strong>' );
|
||||
?>
|
||||
|
||||
</a><span class="abiz-push-down">
|
||||
<?php
|
||||
/* translators: %1$s: Anchor link start %2$s: Anchor link end */
|
||||
printf(
|
||||
'or %1$sCustomize theme%2$s</a></span>',
|
||||
'<a target="_blank" href="' . esc_url( admin_url( 'customize.php' ) ) . '">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</div><!-- /.abiz-theme-notice-content -->
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
|
||||
add_action( 'admin_notices', 'abiz_deprecated_hook_admin_notice' );
|
||||
|
||||
/*******************************************************************************
|
||||
* Plugin Installer
|
||||
*******************************************************************************/
|
||||
|
||||
add_action( 'wp_ajax_install_act_plugin', 'abiz_admin_install_plugin' );
|
||||
|
||||
function abiz_admin_install_plugin() {
|
||||
/**
|
||||
* Install Plugin.
|
||||
*/
|
||||
include_once ABSPATH . '/wp-admin/includes/file.php';
|
||||
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
|
||||
if ( ! file_exists( WP_PLUGIN_DIR . '/daddy-plus' ) ) {
|
||||
$api = plugins_api( 'plugin_information', array(
|
||||
'slug' => sanitize_key( wp_unslash( 'daddy-plus' ) ),
|
||||
'fields' => array(
|
||||
'sections' => false,
|
||||
),
|
||||
) );
|
||||
|
||||
$skin = new WP_Ajax_Upgrader_Skin();
|
||||
$upgrader = new Plugin_Upgrader( $skin );
|
||||
$result = $upgrader->install( $api->download_link );
|
||||
}
|
||||
|
||||
// Activate plugin.
|
||||
if ( current_user_can( 'activate_plugin' ) ) {
|
||||
$result = activate_plugin( 'daddy-plus/daddy-plus.php' );
|
||||
}
|
||||
}
|
||||
38
wp-content/themes/abiz/core/custom-header.php
Normal file
38
wp-content/themes/abiz/core/custom-header.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
function abiz_custom_header_setup()
|
||||
{
|
||||
$header_image = get_template_directory_uri() . '/assets/images/bg/breadcrumbg.jpg';
|
||||
add_theme_support('custom-header', apply_filters('abiz_custom_header_args', array(
|
||||
'default-image' => $header_image,
|
||||
'default-text-color' => '000',
|
||||
'width' => 2000,
|
||||
'height' => 200,
|
||||
'flex-height' => true,
|
||||
'wp-head-callback' => 'abiz_header_style',
|
||||
)));
|
||||
}
|
||||
add_action('after_setup_theme', 'abiz_custom_header_setup');
|
||||
|
||||
if (!function_exists('abiz_header_style')):
|
||||
function abiz_header_style()
|
||||
{
|
||||
$header_text_color = get_header_textcolor();
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
<?php if (!display_header_text()): ?>
|
||||
.site-title,
|
||||
.site-description {
|
||||
position: absolute;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
}
|
||||
<?php else:?>
|
||||
h4.site-title,
|
||||
p.site-description {
|
||||
color: #<?php echo esc_attr($header_text_color); ?>;
|
||||
}
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// Checkbox sanitization
|
||||
function abiz_sanitize_checkbox( $checked ) {
|
||||
// Boolean check.
|
||||
return ( ( isset( $checked ) && true == $checked ) ? true : false );
|
||||
}
|
||||
|
||||
// HTML sanitization
|
||||
function abiz_sanitize_html( $html ) {
|
||||
return wp_kses_post( force_balance_tags( $html ) );
|
||||
}
|
||||
|
||||
|
||||
// Number sanitization
|
||||
function abiz_sanitize_number_absint( $number, $setting ) {
|
||||
// Ensure $number is an absolute integer (whole number, zero or greater).
|
||||
$number = absint( $number );
|
||||
|
||||
// If the input is an absolute integer, return it; otherwise, return the default
|
||||
return ( $number ? $number : $setting->default );
|
||||
}
|
||||
|
||||
// Select sanitization callback example.
|
||||
function abiz_sanitize_select( $input, $setting ) {
|
||||
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
|
||||
// URL sanitization
|
||||
function abiz_sanitize_url( $url ) {
|
||||
return esc_url_raw( $url );
|
||||
}
|
||||
|
||||
|
||||
// Sanitization Text
|
||||
function abiz_sanitize_text( $text ) {
|
||||
return wp_filter_post_kses( $text );
|
||||
}
|
||||
|
||||
// Sanitize Sortable control.
|
||||
function abiz_sanitize_sortable( $val, $setting ) {
|
||||
if ( is_string( $val ) || is_numeric( $val ) ) {
|
||||
return array(
|
||||
esc_attr( $val ),
|
||||
);
|
||||
}
|
||||
$sanitized_value = array();
|
||||
foreach ( $val as $item ) {
|
||||
if ( isset( $setting->manager->get_control( $setting->id )->choices[ $item ] ) ) {
|
||||
$sanitized_value[] = esc_attr( $item );
|
||||
}
|
||||
}
|
||||
return $sanitized_value;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Get default option by passing option id
|
||||
*/
|
||||
if ( !function_exists( 'abiz_get_default_option' ) ):
|
||||
function abiz_get_default_option( $option ) {
|
||||
|
||||
|
||||
if ( empty( $option ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$abiz_default_options = array(
|
||||
'logo_size' => '150',
|
||||
'site_ttl_font_size' => '30',
|
||||
'site_desc_font_size' => '14',
|
||||
'enable_top_hdr' => '1',
|
||||
'enable_top_hdr' => '1',
|
||||
'enable_hdr_info1' => '1',
|
||||
'hdr_info1_icon' => 'fas fa-envelope',
|
||||
'hdr_info1_title' => __('info@example.com', 'abiz'),
|
||||
'hdr_info1_link' => '#',
|
||||
'enable_hdr_info2' => '1',
|
||||
'hdr_info2_icon' => 'fas fa-phone',
|
||||
'hdr_info2_title' => __('+123 456 7890', 'abiz'),
|
||||
'hdr_info2_link' => '#',
|
||||
'enable_hdr_info3' => '1',
|
||||
'hdr_info3_icon' => 'fas fa-location-arrow',
|
||||
'hdr_info3_title' => __('California, TX 70240', 'abiz'),
|
||||
'hdr_info3_link' => '#',
|
||||
'enable_social_icon' => '1',
|
||||
'hdr_social_icons' => abiz_get_social_icon_default(),
|
||||
'enable_cart' => '1',
|
||||
'enable_nav_search' => '1',
|
||||
'enable_account' => '1',
|
||||
'enable_hdr_btn' => '1',
|
||||
'hdr_btn_label' => __('Get in Touch', 'abiz'),
|
||||
'hdr_btn_link' => '#',
|
||||
'enable_hdr_sticky' => '1',
|
||||
'enable_scroller' => '1',
|
||||
'top_scroller_icon' => 'fas fa-angle-up',
|
||||
'enable_page_header' => '1',
|
||||
'page_header_img_opacity' => '0.75',
|
||||
'page_header_bg_color' => '#e11c09',
|
||||
'blog_archive_ordering' => array(
|
||||
'meta',
|
||||
'title',
|
||||
'content',
|
||||
),
|
||||
'enable_blog_excerpt' => '1',
|
||||
'blog_excerpt_length' => '40',
|
||||
'blog_excerpt_after_text' => '…',
|
||||
'enable_blog_excerpt_btn' => '1',
|
||||
'blog_excerpt_btn_label' => __('Read More', 'abiz'),
|
||||
'enable_top_footer' => '1',
|
||||
'footer_top_info' => abiz_footer_top_default(),
|
||||
'footer_copyright' => wp_kses_post(sprintf( __( 'Copyright © {current_year}. Created by %s. Powered by %s.', 'abiz' ), '<a href="#" target="_blank" rel="noopener">Themes Daddy</a>', '<a href="https://www.wordpress.org" target="_blank" rel="noopener">WordPress</a>' )),
|
||||
'abiz_body_font_size' => '16',
|
||||
);
|
||||
|
||||
|
||||
|
||||
$abiz_default_options = apply_filters( 'abiz_modify_default_options', $abiz_default_options );
|
||||
|
||||
if ( isset( $abiz_default_options[$option] ) ) {
|
||||
return $abiz_default_options[$option];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
?>
|
||||
961
wp-content/themes/abiz/core/customizer/abiz-general.php
Normal file
961
wp-content/themes/abiz/core/customizer/abiz-general.php
Normal file
@@ -0,0 +1,961 @@
|
||||
<?php
|
||||
function abiz_general_customize($wp_customize)
|
||||
{
|
||||
$selective_refresh = isset($wp_customize->selective_refresh) ? 'postMessage' : 'refresh';
|
||||
|
||||
/*=========================================
|
||||
Site Identity
|
||||
=========================================*/
|
||||
$wp_customize->add_setting('logo_size', array(
|
||||
'default' => abiz_get_default_option( 'logo_size' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => 'postMessage',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('logo_size', array(
|
||||
'label' => __('Logo Size', 'abiz') ,
|
||||
'section' => 'title_tagline',
|
||||
'type' => 'number',
|
||||
));
|
||||
|
||||
// Site Title//
|
||||
$wp_customize->add_setting('site_ttl_font_size', array(
|
||||
'default' => abiz_get_default_option( 'site_ttl_font_size' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => 'postMessage',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('site_ttl_font_size', array(
|
||||
'label' => __('Site Title Font Size', 'abiz') ,
|
||||
'section' => 'title_tagline',
|
||||
'type' => 'number',
|
||||
));
|
||||
|
||||
// Site Description Font Size//
|
||||
$wp_customize->add_setting('site_desc_font_size', array(
|
||||
'default' => abiz_get_default_option( 'site_desc_font_size' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => 'postMessage',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('site_desc_font_size', array(
|
||||
'label' => __('Site Description Font Size', 'abiz') ,
|
||||
'section' => 'title_tagline',
|
||||
'type' => 'number',
|
||||
));
|
||||
|
||||
|
||||
/*=========================================
|
||||
Top Header Section
|
||||
=========================================*/
|
||||
/*=========================================
|
||||
Setting
|
||||
=========================================*/
|
||||
$wp_customize->add_setting('top_hdr_set', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('top_hdr_set', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Setting', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 1,
|
||||
));
|
||||
|
||||
// Enable / Disable
|
||||
$wp_customize->add_setting('enable_top_hdr', array(
|
||||
'default' => abiz_get_default_option( 'enable_top_hdr' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_top_hdr', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 2,
|
||||
|
||||
)));
|
||||
|
||||
/*=========================================
|
||||
Info 1
|
||||
=========================================*/
|
||||
$wp_customize->add_setting('hdr_info1_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info1_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Info 1', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 2,
|
||||
));
|
||||
|
||||
// hide/show
|
||||
$wp_customize->add_setting('enable_hdr_info1', array(
|
||||
'default' => abiz_get_default_option( 'enable_hdr_info1' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_hdr_info1', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 2,
|
||||
|
||||
)));
|
||||
|
||||
// icon //
|
||||
$wp_customize->add_setting('hdr_info1_icon', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info1_icon' ),
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info1_icon', array(
|
||||
'label' => __('Icon', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
// title //
|
||||
$wp_customize->add_setting('hdr_info1_title', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info1_title' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => $selective_refresh,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info1_title', array(
|
||||
'label' => __('Title', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
// Link //
|
||||
$wp_customize->add_setting('hdr_info1_link', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info1_link' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_url',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info1_link', array(
|
||||
'label' => __('Link', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
/*=========================================
|
||||
Info 2
|
||||
=========================================*/
|
||||
$wp_customize->add_setting('hdr_info2_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info2_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Info 2', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 4,
|
||||
));
|
||||
|
||||
// hide/show
|
||||
$wp_customize->add_setting('enable_hdr_info2', array(
|
||||
'default' => abiz_get_default_option( 'enable_hdr_info2' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_hdr_info2', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 5,
|
||||
|
||||
)));
|
||||
|
||||
// icon //
|
||||
$wp_customize->add_setting('hdr_info2_icon', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info2_icon' ),
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info2_icon', array(
|
||||
'label' => __('Icon', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 6,
|
||||
));
|
||||
|
||||
// title //
|
||||
$wp_customize->add_setting('hdr_info2_title', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info2_title' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => $selective_refresh,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info2_title', array(
|
||||
'label' => __('Title', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 7,
|
||||
));
|
||||
|
||||
// Link //
|
||||
$wp_customize->add_setting('hdr_info2_link', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info2_link' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_url',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info2_link', array(
|
||||
'label' => __('Link', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 8,
|
||||
));
|
||||
|
||||
/*=========================================
|
||||
Info 3
|
||||
=========================================*/
|
||||
$wp_customize->add_setting('hdr_info3_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info3_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Info 3', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 9,
|
||||
));
|
||||
|
||||
// hide/show
|
||||
$wp_customize->add_setting('enable_hdr_info3', array(
|
||||
'default' => abiz_get_default_option( 'enable_hdr_info3' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_hdr_info3', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 10,
|
||||
|
||||
)));
|
||||
|
||||
// icon //
|
||||
$wp_customize->add_setting('hdr_info3_icon', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info3_icon' ),
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info3_icon', array(
|
||||
'label' => __('Icon', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 11,
|
||||
));
|
||||
|
||||
|
||||
// title //
|
||||
$wp_customize->add_setting('hdr_info3_title', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info3_title' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => $selective_refresh,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info3_title', array(
|
||||
'label' => __('Title', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 12,
|
||||
));
|
||||
|
||||
// Link //
|
||||
$wp_customize->add_setting('hdr_info3_link', array(
|
||||
'default' => abiz_get_default_option( 'hdr_info3_link' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_url',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_info3_link', array(
|
||||
'label' => __('Link', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'type' => 'text',
|
||||
'priority' => 13,
|
||||
));
|
||||
|
||||
/*=========================================
|
||||
Social
|
||||
=========================================*/
|
||||
$wp_customize->add_setting('hdr_social_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_social_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Social Icon', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 15,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('enable_social_icon', array(
|
||||
'default' => abiz_get_default_option( 'enable_social_icon' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_social_icon', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'top_header',
|
||||
'priority' => 16,
|
||||
|
||||
)));
|
||||
|
||||
/**
|
||||
* Customizer Repeater
|
||||
*/
|
||||
$wp_customize->add_setting('hdr_social_icons', array(
|
||||
'default' => abiz_get_default_option( 'hdr_social_icons' ),
|
||||
'sanitize_callback' => 'abiz_repeater_sanitize',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new ABIZ_Repeater($wp_customize, 'hdr_social_icons', array(
|
||||
'label' => esc_html__('Social Icons', 'abiz') ,
|
||||
'priority' => 17,
|
||||
'section' => 'top_header',
|
||||
'customizer_repeater_icon_control' => true,
|
||||
'customizer_repeater_link_control' => true,
|
||||
)));
|
||||
|
||||
// Upgrade
|
||||
if (class_exists('Daddy_Plus_Customize_Upgrade_Control'))
|
||||
{
|
||||
$wp_customize->add_setting('abiz_social_icon_upgrade',array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Daddy_Plus_Customize_Upgrade_Control($wp_customize,
|
||||
'abiz_social_icon_upgrade',
|
||||
array(
|
||||
'label' => __( 'Social Icons', 'abiz' ),
|
||||
'section' => 'top_header',
|
||||
'priority' => 17,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
/*=========================================
|
||||
Header Navigation
|
||||
=========================================*/
|
||||
// Cart
|
||||
$wp_customize->add_setting('hdr_nav_cart', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_nav_cart', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Cart', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 2,
|
||||
));
|
||||
|
||||
// hide/show
|
||||
$wp_customize->add_setting('enable_cart', array(
|
||||
'default' => abiz_get_default_option( 'enable_cart' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_cart', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 2,
|
||||
|
||||
)));
|
||||
|
||||
// Account
|
||||
$wp_customize->add_setting('hdr_nav_account', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_nav_account', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Account', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
// hide/show
|
||||
$wp_customize->add_setting('enable_account', array(
|
||||
'default' => abiz_get_default_option( 'enable_account' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_account', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 3,
|
||||
|
||||
)));
|
||||
|
||||
// Search
|
||||
$wp_customize->add_setting('hdr_nav_search_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_nav_search_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Search', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
// hide/show
|
||||
$wp_customize->add_setting('enable_nav_search', array(
|
||||
'default' => abiz_get_default_option( 'enable_nav_search' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_nav_search', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 3,
|
||||
|
||||
)));
|
||||
|
||||
// Header Button
|
||||
$wp_customize->add_setting('abv_hdr_btn_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('abv_hdr_btn_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Button', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 18,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('enable_hdr_btn', array(
|
||||
'default' => abiz_get_default_option( 'enable_hdr_btn' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_hdr_btn', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 19,
|
||||
|
||||
)));
|
||||
|
||||
// Button Label //
|
||||
$wp_customize->add_setting('hdr_btn_label', array(
|
||||
'default' => abiz_get_default_option( 'hdr_btn_label' ),
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => $selective_refresh,
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_btn_label', array(
|
||||
'label' => __('Label', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'type' => 'text',
|
||||
'priority' => 21,
|
||||
));
|
||||
|
||||
// Button URL //
|
||||
$wp_customize->add_setting('hdr_btn_link', array(
|
||||
'default' => abiz_get_default_option( 'hdr_btn_link' ),
|
||||
'sanitize_callback' => 'abiz_sanitize_url',
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('hdr_btn_link', array(
|
||||
'label' => __('Link', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'type' => 'text',
|
||||
'priority' => 22,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('hdr_btn_target', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'hdr_btn_target', array(
|
||||
'label' => __('Open in New Tab ?', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 23,
|
||||
|
||||
)));
|
||||
|
||||
/*=========================================
|
||||
Sticky Header
|
||||
=========================================*/
|
||||
// Heading
|
||||
$wp_customize->add_setting('sticky_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text'
|
||||
));
|
||||
|
||||
$wp_customize->add_control('sticky_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Sticky Header', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 23,
|
||||
));
|
||||
$wp_customize->add_setting('enable_hdr_sticky', array(
|
||||
'default' => abiz_get_default_option( 'enable_hdr_sticky' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_hdr_sticky', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'header_nav',
|
||||
'priority' => 24,
|
||||
|
||||
)));
|
||||
|
||||
/*=========================================
|
||||
Scroller
|
||||
=========================================*/
|
||||
// Head
|
||||
$wp_customize->add_setting('top_scroller_settings', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text'
|
||||
));
|
||||
|
||||
$wp_customize->add_control('top_scroller_settings', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Top Scroller Setting', 'abiz') ,
|
||||
'section' => 'top_scroller'
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('enable_scroller', array(
|
||||
'default' => abiz_get_default_option( 'enable_scroller' ),
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_scroller', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'top_scroller'
|
||||
|
||||
)));
|
||||
|
||||
// Scroller icon //
|
||||
$wp_customize->add_setting('top_scroller_icon', array(
|
||||
'default' => abiz_get_default_option( 'top_scroller_icon' ),
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'capability' => 'edit_theme_options',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('top_scroller_icon', array(
|
||||
'label' => __('Scroller Icon', 'abiz') ,
|
||||
'section' => 'top_scroller',
|
||||
'type' => 'text'
|
||||
));
|
||||
|
||||
/*=========================================
|
||||
Page Header
|
||||
=========================================*/
|
||||
// Heading
|
||||
$wp_customize->add_setting('header_image_set', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('header_image_set', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Page Header', 'abiz') ,
|
||||
'section' => 'header_image',
|
||||
'priority' => 1,
|
||||
));
|
||||
|
||||
// Enable / Disable
|
||||
$wp_customize->add_setting('enable_page_header', array(
|
||||
'default' => abiz_get_default_option( 'enable_page_header' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_page_header', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'header_image',
|
||||
'priority' => 2,
|
||||
|
||||
)));
|
||||
|
||||
// Image Opacity //
|
||||
$wp_customize->add_setting('page_header_img_opacity', array(
|
||||
'default' => abiz_get_default_option( 'page_header_img_opacity' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'priority' => 11,
|
||||
));
|
||||
$wp_customize->add_control('page_header_img_opacity', array(
|
||||
'label' => __('Opacity', 'abiz') ,
|
||||
'section' => 'header_image',
|
||||
'type' => 'number',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('page_header_bg_color', array(
|
||||
'default' => abiz_get_default_option( 'page_header_bg_color' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'sanitize_hex_color',
|
||||
'priority' => 12,
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'page_header_bg_color', array(
|
||||
'label' => __('Overlay Color', 'abiz') ,
|
||||
'section' => 'header_image',
|
||||
)));
|
||||
|
||||
/*=========================================
|
||||
Blog
|
||||
=========================================*/
|
||||
// Head //
|
||||
$wp_customize->add_setting('blog_general_head', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
'priority' => 1,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('blog_general_head', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Blog/Archive/Single', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
));
|
||||
|
||||
$wp_customize->add_setting('blog_archive_ordering', array(
|
||||
'default' => abiz_get_default_option( 'blog_archive_ordering' ),
|
||||
'sanitize_callback' => 'abiz_sanitize_sortable',
|
||||
'priority' => 2,
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Control_Sortable($wp_customize, 'blog_archive_ordering', array(
|
||||
'label' => __('Drag & Drop post items to re-arrange the order and also hide and show items as per the need by clicking on the eye icon.', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
'choices' => array(
|
||||
'title' => __('Title', 'abiz') ,
|
||||
'meta' => __('Meta', 'abiz') ,
|
||||
'content' => __('Content', 'abiz') ,
|
||||
) ,
|
||||
)));
|
||||
|
||||
// Enable / Disable
|
||||
$wp_customize->add_setting('enable_blog_excerpt', array(
|
||||
'default' => abiz_get_default_option( 'enable_blog_excerpt' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_blog_excerpt', array(
|
||||
'label' => __('Enable / Disable Blog Excerpt ?', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
)));
|
||||
|
||||
// Excerpt Length
|
||||
$wp_customize->add_setting('blog_excerpt_length', array(
|
||||
'default' => abiz_get_default_option( 'blog_excerpt_length' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('blog_excerpt_length', array(
|
||||
'label' => __('Blog Excerpt Length', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
'type' => 'number',
|
||||
));
|
||||
|
||||
// Excerpt Text //
|
||||
$wp_customize->add_setting('blog_excerpt_after_text', array(
|
||||
'default' => abiz_get_default_option( 'blog_excerpt_after_text' ),
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('blog_excerpt_after_text', array(
|
||||
'label' => __('Blog Excerpt Text', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
'type' => 'text'
|
||||
));
|
||||
|
||||
// Enable / Disable
|
||||
$wp_customize->add_setting('enable_blog_excerpt_btn', array(
|
||||
'default' => abiz_get_default_option( 'enable_blog_excerpt_btn' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
'priority' => 3,
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_blog_excerpt_btn', array(
|
||||
'label' => __('Enable / Disable Blog Excerpt Button ?', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
)));
|
||||
|
||||
// Button Label //
|
||||
$wp_customize->add_setting('blog_excerpt_btn_label', array(
|
||||
'default' => abiz_get_default_option( 'blog_excerpt_btn_label' ),
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'capability' => 'edit_theme_options',
|
||||
'priority' => 5,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('blog_excerpt_btn_label', array(
|
||||
'label' => __('Blog Excerpt Button Label', 'abiz') ,
|
||||
'section' => 'blog_general',
|
||||
'type' => 'text'
|
||||
));
|
||||
|
||||
|
||||
|
||||
/*=========================================
|
||||
Footer
|
||||
=========================================*/
|
||||
/*=========================================
|
||||
Footer Top
|
||||
=========================================*/
|
||||
// Head //
|
||||
$wp_customize->add_setting('footer_top_heading', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
'priority' => 1,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('footer_top_heading', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Footer Top', 'abiz') ,
|
||||
'section' => 'footer_section',
|
||||
));
|
||||
|
||||
// Enable / Disable
|
||||
$wp_customize->add_setting('enable_top_footer', array(
|
||||
'default' => abiz_get_default_option( 'enable_top_footer' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_checkbox',
|
||||
'priority' => 2,
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Customize_Toggle_Control($wp_customize, 'enable_top_footer', array(
|
||||
'label' => __('Enable / Disable ?', 'abiz') ,
|
||||
'section' => 'footer_section',
|
||||
|
||||
)));
|
||||
|
||||
// Footer Top Info
|
||||
$wp_customize->add_setting('footer_top_info', array(
|
||||
'sanitize_callback' => 'abiz_repeater_sanitize',
|
||||
'transport' => $selective_refresh,
|
||||
'priority' => 8,
|
||||
'default' => abiz_get_default_option( 'footer_top_info' ),
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Abiz_Repeater($wp_customize, 'footer_top_info', array(
|
||||
'label' => esc_html__('Contact', 'abiz') ,
|
||||
'section' => 'footer_section',
|
||||
'add_field_label' => esc_html__('Add New Contact', 'abiz') ,
|
||||
'item_name' => esc_html__('Contact', 'abiz') ,
|
||||
'customizer_repeater_icon_control' => true,
|
||||
'customizer_repeater_title_control' => true,
|
||||
'customizer_repeater_subtitle_control' => true,
|
||||
'customizer_repeater_link_control' => true,
|
||||
)));
|
||||
|
||||
// Upgrade
|
||||
if (class_exists('Daddy_Plus_Customize_Upgrade_Control'))
|
||||
{
|
||||
$wp_customize->add_setting('abiz_footer_top_info_upgrade',array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'priority' => 8
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new Daddy_Plus_Customize_Upgrade_Control($wp_customize,
|
||||
'abiz_footer_top_info_upgrade',
|
||||
array(
|
||||
'label' => __( 'Info', 'abiz' ),
|
||||
'section' => 'footer_section'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*=========================================
|
||||
Footer Copyright
|
||||
=========================================*/
|
||||
// Head
|
||||
$wp_customize->add_setting('footer_copy_settings', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
'priority' => 12,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('footer_copy_settings', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Footer Copyright', 'abiz') ,
|
||||
'section' => 'footer_section',
|
||||
));
|
||||
|
||||
// Footer Copyright
|
||||
$wp_customize->add_setting('footer_copyright', array(
|
||||
'default' => abiz_get_default_option( 'footer_copyright' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'priority' => 16,
|
||||
));
|
||||
|
||||
$wp_customize->add_control('footer_copyright', array(
|
||||
'label' => __('Copyright', 'abiz') ,
|
||||
'section' => 'footer_section',
|
||||
'type' => 'textarea',
|
||||
'transport' => $selective_refresh,
|
||||
));
|
||||
|
||||
/*=========================================
|
||||
Abiz Typography
|
||||
=========================================*/
|
||||
// Head
|
||||
$wp_customize->add_setting('abiz_body_font_family_settings', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text'
|
||||
));
|
||||
|
||||
$wp_customize->add_control('abiz_body_font_family_settings', array(
|
||||
'type' => 'hidden',
|
||||
'label' => __('Body Typography Setting', 'abiz') ,
|
||||
'section' => 'abiz_typography',
|
||||
'priority' => 1,
|
||||
));
|
||||
|
||||
// Body Font Size //
|
||||
$wp_customize->add_setting('abiz_body_font_size', array(
|
||||
'default' => abiz_get_default_option( 'abiz_body_font_size' ),
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_html',
|
||||
'transport' => 'postMessage',
|
||||
));
|
||||
|
||||
$wp_customize->add_control('abiz_body_font_size', array(
|
||||
'label' => __('Font Size', 'abiz') ,
|
||||
'section' => 'abiz_typography',
|
||||
'type' => 'number',
|
||||
'priority' => 1,
|
||||
));
|
||||
|
||||
// Body Font weight //
|
||||
$wp_customize->add_setting('abiz_body_font_weight', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => 'inherit',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'abiz_sanitize_select',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'abiz_body_font_weight', array(
|
||||
'label' => __('Weight', 'abiz') ,
|
||||
'section' => 'abiz_typography',
|
||||
'type' => 'select',
|
||||
'priority' => 5,
|
||||
'choices' => array(
|
||||
'inherit' => __('Default', 'abiz') ,
|
||||
'100' => __('Thin: 100', 'abiz') ,
|
||||
'200' => __('Light: 200', 'abiz') ,
|
||||
'300' => __('Book: 300', 'abiz') ,
|
||||
'400' => __('Normal: 400', 'abiz') ,
|
||||
'500' => __('Medium: 500', 'abiz') ,
|
||||
'600' => __('Semibold: 600', 'abiz') ,
|
||||
'700' => __('Bold: 700', 'abiz') ,
|
||||
'800' => __('Extra Bold: 800', 'abiz') ,
|
||||
'900' => __('Black: 900', 'abiz') ,
|
||||
) ,
|
||||
)));
|
||||
|
||||
// Body Font style //
|
||||
$wp_customize->add_setting('abiz_body_font_style', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => 'inherit',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'abiz_sanitize_select',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'abiz_body_font_style', array(
|
||||
'label' => __('Font Style', 'abiz') ,
|
||||
'section' => 'abiz_typography',
|
||||
'type' => 'select',
|
||||
'priority' => 6,
|
||||
'choices' => array(
|
||||
'inherit' => __('Inherit', 'abiz') ,
|
||||
'normal' => __('Normal', 'abiz') ,
|
||||
'italic' => __('Italic', 'abiz') ,
|
||||
'oblique' => __('oblique', 'abiz') ,
|
||||
) ,
|
||||
)));
|
||||
// Body Text Transform //
|
||||
$wp_customize->add_setting('abiz_body_text_transform', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => 'inherit',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'abiz_sanitize_select',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'abiz_body_text_transform', array(
|
||||
'label' => __('Transform', 'abiz') ,
|
||||
'section' => 'abiz_typography',
|
||||
'type' => 'select',
|
||||
'priority' => 7,
|
||||
'choices' => array(
|
||||
'inherit' => __('Default', 'abiz') ,
|
||||
'uppercase' => __('Uppercase', 'abiz') ,
|
||||
'lowercase' => __('Lowercase', 'abiz') ,
|
||||
'capitalize' => __('Capitalize', 'abiz') ,
|
||||
) ,
|
||||
)));
|
||||
|
||||
// Body Text Decoration //
|
||||
$wp_customize->add_setting('abiz_body_txt_decoration', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => 'inherit',
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'abiz_sanitize_select',
|
||||
));
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'abiz_body_txt_decoration', array(
|
||||
'label' => __('Text Decoration', 'abiz') ,
|
||||
'section' => 'abiz_typography',
|
||||
'type' => 'select',
|
||||
'priority' => 8,
|
||||
'choices' => array(
|
||||
'inherit' => __('Inherit', 'abiz') ,
|
||||
'underline' => __('Underline', 'abiz') ,
|
||||
'overline' => __('Overline', 'abiz') ,
|
||||
'line-through' => __('Line Through', 'abiz') ,
|
||||
'none' => __('None', 'abiz') ,
|
||||
) ,
|
||||
)));
|
||||
}
|
||||
add_action('customize_register', 'abiz_general_customize');
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Register customizer panels and sections.
|
||||
*
|
||||
* @package Abiz
|
||||
*/
|
||||
function abiz_panel_section_register( $wp_customize ) {
|
||||
// Section: Upgrade
|
||||
$wp_customize->add_section('abiz_upgrade_premium',array(
|
||||
'priority' => 1,
|
||||
'title' => __('Upgrade to Pro','abiz'),
|
||||
));
|
||||
|
||||
// Section: Top Bar
|
||||
$wp_customize->add_section('top_header',array(
|
||||
'priority' => 1,
|
||||
'title' => __('Top Bar Setting','abiz'),
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
|
||||
// Section: Menu Bar
|
||||
$wp_customize->add_section('header_nav',array(
|
||||
'priority' => 1,
|
||||
'title' => __('Menu Bar Setting','abiz'),
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
|
||||
// Panel: General
|
||||
$wp_customize->add_panel('abiz_general', array(
|
||||
'priority' => 31,
|
||||
'title' => esc_html__( 'General Options', 'abiz' ),
|
||||
));
|
||||
|
||||
// Section: Page Header
|
||||
$wp_customize->add_section('header_image', array(
|
||||
'title' => esc_html__( 'Page Header Setting', 'abiz' ),
|
||||
'priority' => 1,
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
|
||||
// Section: Top Scroller
|
||||
$wp_customize->add_section('top_scroller', array(
|
||||
'title' => esc_html__( 'Top Scroller Setting', 'abiz' ),
|
||||
'priority' => 4,
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
|
||||
// Section: Blog
|
||||
$wp_customize->add_section( 'blog_general',array(
|
||||
'priority' => 34,
|
||||
'capability' => 'edit_theme_options',
|
||||
'title' => __('Blog Setting', 'abiz'),
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
|
||||
// Section: Footer
|
||||
$wp_customize->add_section('footer_section',array(
|
||||
'priority' => 34,
|
||||
'capability' => 'edit_theme_options',
|
||||
'title' => __('Footer Setting', 'abiz'),
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
|
||||
// Section: Typography
|
||||
$wp_customize->add_section('abiz_typography',array(
|
||||
'priority' => 1,
|
||||
'title' => __('Body Typography Setting','abiz'),
|
||||
'panel' => 'abiz_general',
|
||||
));
|
||||
}
|
||||
add_action( 'customize_register', 'abiz_panel_section_register' );
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
function abiz_selective_refresh( $wp_customize ) {
|
||||
// hdr_info1_title
|
||||
$wp_customize->selective_refresh->add_partial( 'hdr_info1_title', array(
|
||||
'selector' => '.above-header .info1 h6',
|
||||
'settings' => 'hdr_info1_title',
|
||||
'render_callback' => 'abiz_hdr_info1_title_render_callback',
|
||||
) );
|
||||
|
||||
// hdr_info2_title
|
||||
$wp_customize->selective_refresh->add_partial( 'hdr_info2_title', array(
|
||||
'selector' => '.main-header .info2 h6',
|
||||
'settings' => 'hdr_info2_title',
|
||||
'render_callback' => 'abiz_hdr_info2_title_render_callback',
|
||||
) );
|
||||
|
||||
// hdr_info3_title
|
||||
$wp_customize->selective_refresh->add_partial( 'hdr_info3_title', array(
|
||||
'selector' => '.main-header .info3 h6',
|
||||
'settings' => 'hdr_info3_title',
|
||||
'render_callback' => 'abiz_hdr_info3_title_render_callback',
|
||||
) );
|
||||
|
||||
// hdr_btn_label
|
||||
$wp_customize->selective_refresh->add_partial( 'hdr_btn_label', array(
|
||||
'selector' => '.main-navigation .button-area a',
|
||||
'settings' => 'hdr_btn_label',
|
||||
'render_callback' => 'abiz_hdr_btn_label_render_callback',
|
||||
) );
|
||||
|
||||
// footer_top_info
|
||||
$wp_customize->selective_refresh->add_partial( 'footer_top_info', array(
|
||||
'selector' => '.footer-top .row'
|
||||
) );
|
||||
|
||||
// footer_copyright
|
||||
$wp_customize->selective_refresh->add_partial( 'footer_copyright', array(
|
||||
'selector' => '.footer-copyright .copyright-text',
|
||||
'settings' => 'footer_copyright',
|
||||
'render_callback' => 'abiz_footer_copyright_render_callback',
|
||||
) );
|
||||
}
|
||||
add_action( 'customize_register', 'abiz_selective_refresh' );
|
||||
|
||||
|
||||
|
||||
// hdr_info1_title
|
||||
function abiz_hdr_info1_title_render_callback() {
|
||||
return get_theme_mod( 'hdr_info1_title' );
|
||||
}
|
||||
|
||||
// hdr_info2_title
|
||||
function abiz_hdr_info2_title_render_callback() {
|
||||
return get_theme_mod( 'hdr_info2_title' );
|
||||
}
|
||||
|
||||
// hdr_info3_title
|
||||
function abiz_hdr_info3_title_render_callback() {
|
||||
return get_theme_mod( 'hdr_info3_title' );
|
||||
}
|
||||
|
||||
// hdr_btn_label
|
||||
function abiz_hdr_btn_label_render_callback() {
|
||||
return get_theme_mod( 'hdr_btn_label' );
|
||||
}
|
||||
|
||||
// footer_copyright
|
||||
function abiz_footer_copyright_render_callback() {
|
||||
return get_theme_mod( 'footer_copyright' );
|
||||
}
|
||||
42
wp-content/themes/abiz/core/customizer/assets/css/admin.css
Normal file
42
wp-content/themes/abiz/core/customizer/assets/css/admin.css
Normal file
@@ -0,0 +1,42 @@
|
||||
.abiz-getting-started-notice {
|
||||
padding: 20px 10px;
|
||||
display: -webkit-flex;
|
||||
display: -moz-flex;
|
||||
display: -ms-flex;
|
||||
display: -o-flex;
|
||||
display: flex;
|
||||
-ms-align-items: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.abiz-theme-screenshot img {
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.abiz-theme-notice-content {
|
||||
width: 70%;
|
||||
display: block;
|
||||
vertical-align: top;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
h2.abiz-notice-h2 {
|
||||
margin: 0 0 10px;
|
||||
font-weight: 400;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.abiz-push-down {
|
||||
padding-top: 15px;
|
||||
display: inline-block;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.abiz-button-padding.updating-message::before {
|
||||
margin-top: 12px;
|
||||
}
|
||||
209
wp-content/themes/abiz/core/customizer/assets/css/controls.css
Normal file
209
wp-content/themes/abiz/core/customizer/assets/css/controls.css
Normal file
@@ -0,0 +1,209 @@
|
||||
.customize-control-abiz-sortable ul.ui-sortable li {
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #333;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.customize-control-abiz-sortable ul.ui-sortable li .dashicons.dashicons-menu {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.customize-control-abiz-sortable ul.ui-sortable li .dashicons.visibility {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.customize-control-abiz-sortable ul.ui-sortable li.invisible {
|
||||
color: #aaa;
|
||||
border: 1px dashed #aaa;
|
||||
}
|
||||
|
||||
.customize-control-abiz-sortable ul.ui-sortable li.invisible .dashicons.visibility {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.customize-control-hidden {
|
||||
display: block;
|
||||
padding: 13px 12px;
|
||||
color:#fff;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
line-height: 1;
|
||||
margin: 0 -12px;
|
||||
margin-bottom: 12px;
|
||||
border-width: 1px 0;
|
||||
border-style: solid;
|
||||
border-color: #dddddd;
|
||||
background-color: #13a1dc;
|
||||
}
|
||||
|
||||
.customize-control-hidden label {
|
||||
margin-bottom: 0;
|
||||
line-height: 1;
|
||||
font-size: 15px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
||||
/* Control: Switch. */
|
||||
.customize-control-abiz-toggle {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle label {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle label .customize-control-title {
|
||||
width: calc(100% - 55px);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle label .description {
|
||||
-webkit-box-ordinal-group: 100;
|
||||
-ms-flex-order: 99;
|
||||
order: 99;
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle .switch {
|
||||
border: 1px solid #b4b9be;
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 12px;
|
||||
border-radius: 8px;
|
||||
background: #b4b9be;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
top: 4px;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-transition: background 350ms ease;
|
||||
transition: background 350ms ease;
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle .switch::after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -3px;
|
||||
-webkit-transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
background: #999;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
-webkit-transform: translate3d(0, -50%, 0);
|
||||
transform: translate3d(0, -50%, 0);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle .switch::before {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -3px;
|
||||
-webkit-transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
-webkit-transform: translate3d(0, -50%, 0) scale(0);
|
||||
transform: translate3d(0, -50%, 0) scale(0);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle .switch:active::before {
|
||||
-webkit-transform: translate3d(0, -50%, 0) scale(3);
|
||||
transform: translate3d(0, -50%, 0) scale(3);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle input:checked + .switch::before {
|
||||
background: rgba(0, 115, 170, 0.075);
|
||||
-webkit-transform: translate3d(100%, -50%, 0) scale(1);
|
||||
transform: translate3d(100%, -50%, 0) scale(1);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle input:checked + .switch::after {
|
||||
background: #13a1dc;
|
||||
-webkit-transform: translate3d(100%, -50%, 0);
|
||||
transform: translate3d(100%, -50%, 0);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle input:checked + .switch:active::before {
|
||||
background: rgba(0, 115, 170, 0.075);
|
||||
-webkit-transform: translate3d(100%, -50%, 0) scale(3);
|
||||
transform: translate3d(100%, -50%, 0) scale(3);
|
||||
}
|
||||
|
||||
.customize-control-abiz-toggle input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Upsale */
|
||||
.premium-info ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.premium-info ul li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.premium-info ul li a, .up-to-pro {
|
||||
font-family: 'Noto Sans', sans-serif;
|
||||
font-weight: bold;
|
||||
padding: 12px 10px;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #ffffff;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
letter-spacing: 1px;
|
||||
overflow: hidden;
|
||||
-webkit-transition: .3s;
|
||||
transition: .3s;
|
||||
background: #009efa; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(to right, #233fe7, #009efa); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #233fe7, #009efa);/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
z-index: 2;
|
||||
}
|
||||
.premium-info ul li a:hover, .premium-info ul li a:focus,
|
||||
.up-to-pro:hover, .up-to-pro:focus {
|
||||
transform: translateY(-3px);
|
||||
color: #fff;
|
||||
box-shadow: 0 0.5rem 1.875rem rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.up-to-pro {
|
||||
padding: 9px 58px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.premium-info ul li a i{
|
||||
font-size: 15px;
|
||||
margin-top: 1px;
|
||||
margin-right: 7px;
|
||||
}
|
||||
.premium-info .upgrade-to-pro, .up-to-pro{
|
||||
background: #ff5d00;
|
||||
}
|
||||
li#accordion-section-abiz_upgrade_premium .accordion-section-title:after {
|
||||
content: "\f174" !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
li#accordion-section-abiz_upgrade_premium .accordion-section-title,
|
||||
li#accordion-section-abiz_upgrade_premium .accordion-section-title:hover,
|
||||
li#accordion-section-abiz_upgrade_premium .accordion-section-title button:hover,
|
||||
li#accordion-section-abiz_upgrade_premium .accordion-section-title button:focus {
|
||||
color: #ffffff !important;
|
||||
border-left: none;
|
||||
background: #009efa; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(to right, #233fe7, #009efa) !important; /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #233fe7, #009efa) !important;/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
( function( $ ){
|
||||
$( document ).ready( function(){
|
||||
$( '.abiz-btn-get-started' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
$( this ).html( 'Processing.. Please wait' ).addClass( 'updating-message' );
|
||||
$.post( abiz_ajax_object.ajax_url, { 'action' : 'install_act_plugin' }, function( response ){
|
||||
location.href = 'customize.php';
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
$( document ).on( 'click', '.notice-get-started-class .notice-dismiss', function () {
|
||||
// Read the "data-notice" information to track which notice
|
||||
// is being dismissed and send it via AJAX
|
||||
var type = $( this ).closest( '.notice-get-started-class' ).data( 'notice' );
|
||||
// Make an AJAX call
|
||||
$.ajax( ajaxurl,
|
||||
{
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'abiz_dismissed_notice_handler',
|
||||
type: type,
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}( jQuery ) )
|
||||
86
wp-content/themes/abiz/core/customizer/assets/js/controls.js
vendored
Normal file
86
wp-content/themes/abiz/core/customizer/assets/js/controls.js
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* sortable
|
||||
*/
|
||||
wp.customize.controlConstructor['abiz-sortable'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this;
|
||||
|
||||
// Set the sortable container.
|
||||
control.sortableContainer = control.container.find( 'ul.sortable' ).first();
|
||||
|
||||
// Init sortable.
|
||||
control.sortableContainer.sortable({
|
||||
|
||||
// Update value when we stop sorting.
|
||||
stop: function() {
|
||||
control.updateValue();
|
||||
}
|
||||
}).disableSelection().find( 'li' ).each( function() {
|
||||
|
||||
// Enable/disable options when we click on the eye of Thundera.
|
||||
jQuery( this ).find( 'i.visibility' ).click( function() {
|
||||
jQuery( this ).toggleClass( 'dashicons-visibility-faint' ).parents( 'li:eq(0)' ).toggleClass( 'invisible' );
|
||||
});
|
||||
}).click( function() {
|
||||
|
||||
// Update value on click.
|
||||
control.updateValue();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the sorting list
|
||||
*/
|
||||
updateValue: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
newValue = [];
|
||||
|
||||
this.sortableContainer.find( 'li' ).each( function() {
|
||||
if ( ! jQuery( this ).is( '.invisible' ) ) {
|
||||
newValue.push( jQuery( this ).data( 'value' ) );
|
||||
}
|
||||
});
|
||||
|
||||
control.setting.set( newValue );
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Control: Toggle.
|
||||
*/
|
||||
wp.customize.controlConstructor['abiz-toggle'] = wp.customize.Control.extend( {
|
||||
// When we're finished loading continue processing
|
||||
ready: function () {
|
||||
'use strict';
|
||||
|
||||
var control = this;
|
||||
|
||||
// Init the control.
|
||||
if (
|
||||
!_.isUndefined( window.abizControlLoader ) &&
|
||||
_.isFunction( abizControlLoader )
|
||||
) {
|
||||
abizControlLoader( control );
|
||||
} else {
|
||||
control.initAbizControl();
|
||||
}
|
||||
},
|
||||
|
||||
initAbizControl: function () {
|
||||
var control = this,
|
||||
checkboxValue = control.setting._value;
|
||||
|
||||
// Save the value
|
||||
this.container.on( 'change', 'input', function () {
|
||||
checkboxValue = jQuery( this ).is( ':checked' ) ? true : false;
|
||||
control.setting.set( checkboxValue );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
@@ -0,0 +1,38 @@
|
||||
function abizshomesettingsscroll(section_id) {
|
||||
var scroll_section_id = "slider-section";
|
||||
|
||||
var $contents = jQuery('#customize-preview iframe').contents();
|
||||
|
||||
switch (section_id) {
|
||||
case 'accordion-section-info_section_set':
|
||||
scroll_section_id = "info-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-service_section_set':
|
||||
scroll_section_id = "service-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-marquee_section_set':
|
||||
scroll_section_id = "abiz-marquee-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-features2_section_set':
|
||||
scroll_section_id = "abiz-features-section-2";
|
||||
break;
|
||||
|
||||
case 'accordion-section-blog_section_set':
|
||||
scroll_section_id = "abiz-blog-section";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($contents.find('#' + scroll_section_id).length > 0) {
|
||||
$contents.find("html, body").animate({
|
||||
scrollTop: $contents.find("#" + scroll_section_id).offset().top
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
jQuery('body').on('click', '#sub-accordion-panel-abiz_frontpage_sections .control-subsection .accordion-section-title', function(event) {
|
||||
var section_id = jQuery(this).parent('.control-subsection').attr('id');
|
||||
abizshomesettingsscroll(section_id);
|
||||
});
|
||||
259
wp-content/themes/abiz/core/customizer/assets/js/customizer.js
Normal file
259
wp-content/themes/abiz/core/customizer/assets/js/customizer.js
Normal file
@@ -0,0 +1,259 @@
|
||||
/**
|
||||
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
(function($) {
|
||||
// Site title and description.
|
||||
wp.customize('blogname', function(value) {
|
||||
value.bind(function(to) {
|
||||
$('.site-title').text(to);
|
||||
});
|
||||
});
|
||||
wp.customize('blogdescription', function(value) {
|
||||
value.bind(function(to) {
|
||||
$('.site-description').text(to);
|
||||
});
|
||||
});
|
||||
|
||||
// Header text color.
|
||||
wp.customize('header_textcolor', function(value) {
|
||||
value.bind(function(to) {
|
||||
if ('blank' === to) {
|
||||
$('.site-title, .site-description').css({
|
||||
'clip': 'rect(1px, 1px, 1px, 1px)',
|
||||
'position': 'absolute'
|
||||
});
|
||||
} else {
|
||||
$('.site-title, .site-description').css({
|
||||
'clip': 'auto',
|
||||
'position': 'relative'
|
||||
});
|
||||
$('.site-title, .site-description').css({
|
||||
'color': to
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function($) {
|
||||
$('input[data-input-type]').on('input change', function() {
|
||||
var val = $(this).val();
|
||||
$(this).prev('.cs-range-value').html(val);
|
||||
$(this).val(val);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
// logo_size
|
||||
wp.customize('logo_size', function(value) {
|
||||
value.bind(function(logo_size) {
|
||||
jQuery('.logo img, .mobile-logo img').css('max-width', logo_size + 'px');
|
||||
});
|
||||
});
|
||||
|
||||
// site_ttl_font_size
|
||||
wp.customize('site_ttl_font_size', function(value) {
|
||||
value.bind(function(site_ttl_font_size) {
|
||||
jQuery('h4.site-title').css('font-size', site_ttl_font_size + 'px');
|
||||
});
|
||||
});
|
||||
|
||||
// site_desc_font_size
|
||||
wp.customize('site_desc_font_size', function(value) {
|
||||
value.bind(function(site_desc_font_size) {
|
||||
jQuery('.site-description').css('font-size', site_desc_font_size + 'px');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//hdr_info1_title
|
||||
wp.customize(
|
||||
'hdr_info1_title',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.above-header .info1 h6').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//hdr_info2_title
|
||||
wp.customize(
|
||||
'hdr_info2_title',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.main-header .info2 h6').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//hdr_info3_title
|
||||
wp.customize(
|
||||
'hdr_info3_title',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.main-header .info3 h6').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//hdr_btn_label
|
||||
wp.customize(
|
||||
'hdr_btn_label',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.main-navigation .button-area a').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//service_ttl
|
||||
wp.customize(
|
||||
'service_ttl',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-service-main .theme-main-heading .title').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//service_subttl
|
||||
wp.customize(
|
||||
'service_subttl',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-service-main .theme-main-heading h2').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//service_desc
|
||||
wp.customize(
|
||||
'service_desc',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-service-main .theme-main-heading p').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//features2_ttl
|
||||
wp.customize(
|
||||
'features2_ttl',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-features-section-2 .theme-main-heading .title').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//features2_subttl
|
||||
wp.customize(
|
||||
'features2_subttl',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-features-section-2 .theme-main-heading h2').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//features2_desc
|
||||
wp.customize(
|
||||
'features2_desc',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-features-section-2 .theme-main-heading p').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//blog_ttl
|
||||
wp.customize(
|
||||
'blog_ttl',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-blog-main .theme-main-heading .title').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//blog_subttl
|
||||
wp.customize(
|
||||
'blog_subttl',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-blog-main .theme-main-heading h2').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//blog_desc
|
||||
wp.customize(
|
||||
'blog_desc',
|
||||
function(value) {
|
||||
value.bind(
|
||||
function(newval) {
|
||||
$('.abiz-blog-main .theme-main-heading p').text(newval);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// font size
|
||||
wp.customize('abiz_body_font_size', function(value) {
|
||||
value.bind(function(abiz_body_font_size) {
|
||||
jQuery('body').css('font-size', abiz_body_font_size + 'px');
|
||||
});
|
||||
});
|
||||
|
||||
// font weight
|
||||
wp.customize('abiz_body_font_weight', function(value) {
|
||||
value.bind(function(font_weight) {
|
||||
jQuery('body').css('font-weight', font_weight);
|
||||
});
|
||||
});
|
||||
|
||||
// font style
|
||||
wp.customize('abiz_body_font_style', function(value) {
|
||||
value.bind(function(font_style) {
|
||||
jQuery('body').css('font-style', font_style);
|
||||
});
|
||||
});
|
||||
|
||||
// Text Decoration
|
||||
wp.customize('abiz_body_txt_decoration', function(value) {
|
||||
value.bind(function(decoration) {
|
||||
jQuery('body, a').css('text-decoration', decoration);
|
||||
});
|
||||
});
|
||||
|
||||
// text tranform
|
||||
wp.customize('abiz_body_text_transform', function(value) {
|
||||
value.bind(function(text_tranform) {
|
||||
jQuery('body').css('text-transform', text_tranform);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Base control class.
|
||||
*
|
||||
* @package Abiz
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Abiz_Customize_Base_Control
|
||||
*/
|
||||
class Abiz_Customize_Base_Control extends WP_Customize_Control {
|
||||
|
||||
/**
|
||||
* Enqueue scripts all controls.
|
||||
*/
|
||||
public function enqueue() {
|
||||
|
||||
// Main scripts.
|
||||
wp_enqueue_script(
|
||||
'abiz-controls',
|
||||
ABIZ_THEME_CORE_URI . '/customizer/assets/js/controls.js',
|
||||
array(
|
||||
'jquery',
|
||||
'customize-base',
|
||||
'jquery-ui-button',
|
||||
'jquery-ui-sortable',
|
||||
),
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_style( 'abiz-controls', ABIZ_THEME_CORE_URI . '/customizer/assets/css/controls.css' );
|
||||
wp_enqueue_style( 'all-css', ABIZ_THEME_URI . '/assets/css/all.min.css' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
$this->json['default'] = $this->setting->default;
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
}
|
||||
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['value'] = maybe_unserialize( $this->value() );
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['inputAttrs'] = '';
|
||||
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
$this->json['inputAttrs'] = maybe_serialize( $this->input_attrs() );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of translation strings.
|
||||
*
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function l10n() {
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if ( ! class_exists( 'WP_Customize_Control' ) )
|
||||
return NULL;
|
||||
class Abiz_Category_Dropdown_Custom_Control extends WP_Customize_Control
|
||||
{
|
||||
private $cats = false;
|
||||
|
||||
public function __construct($manager, $id, $args = array(), $options = array())
|
||||
{
|
||||
$this->cats = get_categories($options);
|
||||
|
||||
parent::__construct( $manager, $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the content of the category dropdown
|
||||
*
|
||||
* @return HTML
|
||||
*/
|
||||
public function render_content()
|
||||
{
|
||||
if(!empty($this->cats))
|
||||
{
|
||||
?>
|
||||
<label>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<select <?php $this->link(); ?>>
|
||||
<?php
|
||||
foreach ( $this->cats as $cat )
|
||||
{
|
||||
printf('<option value="%s">%s</option>', $cat->term_id, $cat->name);
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: sortable
|
||||
*/
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
/**
|
||||
* Sortable control (uses checkboxes).
|
||||
*/
|
||||
class Abiz_Control_Sortable extends Abiz_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'abiz-sortable';
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
parent::to_json();
|
||||
|
||||
$this->json['default'] = $this->setting->default;
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
}
|
||||
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['value'] = maybe_unserialize( $this->value() );
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['inputAttrs'] = '';
|
||||
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
$this->json['inputAttrs'] = maybe_serialize( $this->input_attrs() );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
<label class='abiz-sortable'>
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
|
||||
<ul class="sortable">
|
||||
<# _.each( data.value, function( choiceID ) { #>
|
||||
<li {{{ data.inputAttrs }}} class='abiz-sortable-item' data-value='{{ choiceID }}'>
|
||||
<i class='dashicons dashicons-menu'></i>
|
||||
<i class="dashicons dashicons-visibility visibility"></i>
|
||||
{{{ data.choices[ choiceID ] }}}
|
||||
</li>
|
||||
<# }); #>
|
||||
<# _.each( data.choices, function( choiceLabel, choiceID ) { #>
|
||||
<# if ( -1 === data.value.indexOf( choiceID ) ) { #>
|
||||
<li {{{ data.inputAttrs }}} class='abiz-sortable-item invisible' data-value='{{ choiceID }}'>
|
||||
<i class='dashicons dashicons-menu'></i>
|
||||
<i class="dashicons dashicons-visibility visibility"></i>
|
||||
{{{ data.choices[ choiceID ] }}}
|
||||
</li>
|
||||
<# } #>
|
||||
<# }); #>
|
||||
</ul>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control's content.
|
||||
*
|
||||
* @see WP_Customize_Control::render_content()
|
||||
*/
|
||||
protected function render_content() {}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Customize Toggle control class.
|
||||
*
|
||||
* @package abiz
|
||||
*
|
||||
* @see WP_Customize_Control
|
||||
* @access public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Abiz_Customize_Toggle_Control
|
||||
*/
|
||||
class Abiz_Customize_Toggle_Control extends Abiz_Customize_Base_Control {
|
||||
|
||||
/**
|
||||
* Customize control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'abiz-toggle';
|
||||
|
||||
/**
|
||||
* Renders the Underscore template for this control.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<label for="toggle_{{ data.id }}">
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<input class="screen-reader-text" {{{ data.inputAttrs }}} name="toggle_{{ data.id }}"
|
||||
id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( true === data.value ) { #> checked<# } #> hidden />
|
||||
<span class="switch"></span>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render content is still called, so be sure to override it with an empty function in your subclass as well.
|
||||
*/
|
||||
protected function render_content() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* Upgrade to pro options
|
||||
*/
|
||||
|
||||
function abiz_upgrade_pro_options( $wp_customize ) {
|
||||
class Abiz_WP_Button_Customize_Control extends WP_Customize_Control {
|
||||
public $type = 'abiz_upgrade_premium';
|
||||
|
||||
function render_content() {
|
||||
?>
|
||||
<div class="premium-info">
|
||||
<ul>
|
||||
<!--li><a class="documentation" href="#" target="_blank"><i class="dashicons dashicons-visibility"></i><?php //_e( 'View Documentation','abiz' ); ?> </a></li-->
|
||||
|
||||
<li><a class="support" href="https://themesdaddy.com/support/" target="_blank"><i class="dashicons dashicons-lightbulb"></i><?php _e( 'Need Support ?','abiz' ); ?> </a></li>
|
||||
|
||||
<li><a class="free-pro" href="https://demo.themesdaddy.com/abiz-pro/" target="_blank"><i class="dashicons dashicons-visibility"></i><?php _e( 'Premium Demo','abiz' ); ?> </a></li>
|
||||
|
||||
<li><a class="upgrade-to-pro" href="https://themesdaddy.com/themes/abiz-pro/" target="_blank"><i class="dashicons dashicons-update-alt"></i><?php _e( 'Upgrade to Pro','abiz' ); ?> </a></li>
|
||||
|
||||
<li><a class="show-love" href="https://wordpress.org/support/theme/abiz/reviews/#new-post" target="_blank"><i class="dashicons dashicons-smiley"></i><?php _e( 'Share a Good Review','abiz' ); ?> </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'premium_info_buttons',
|
||||
array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'abiz_sanitize_text',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Abiz_WP_Button_Customize_Control( $wp_customize, 'premium_info_buttons', array(
|
||||
'section' => 'abiz_upgrade_premium',
|
||||
))
|
||||
);
|
||||
}
|
||||
add_action( 'customize_register', 'abiz_upgrade_pro_options' );
|
||||
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
class abiz_Customizer_Notify_Section extends WP_Customize_Section {
|
||||
|
||||
public $type = 'abiz-customizer-notify-section';
|
||||
|
||||
public $recommended_actions = '';
|
||||
|
||||
public $recommended_plugins = '';
|
||||
|
||||
public $total_actions = '';
|
||||
|
||||
public $plugin_text = '';
|
||||
|
||||
public $dismiss_button = '';
|
||||
|
||||
|
||||
public function check_active( $slug ) {
|
||||
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug . '.php' ) ) {
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
$needs = is_plugin_active( $slug . '/' . $slug . '.php' ) ? 'deactivate' : 'activate';
|
||||
|
||||
return array(
|
||||
'status' => is_plugin_active( $slug . '/' . $slug . '.php' ),
|
||||
'needs' => $needs,
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status' => false,
|
||||
'needs' => 'install',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function create_action_link( $state, $slug ) {
|
||||
switch ( $state ) {
|
||||
case 'install':
|
||||
return wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'install-plugin',
|
||||
'plugin' => $slug,
|
||||
),
|
||||
network_admin_url( 'update.php' )
|
||||
),
|
||||
'install-plugin_' . $slug
|
||||
);
|
||||
break;
|
||||
case 'deactivate':
|
||||
return add_query_arg(
|
||||
array(
|
||||
'action' => 'deactivate',
|
||||
'plugin' => rawurlencode( $slug . '/' . $slug . '.php' ),
|
||||
'plugin_status' => 'all',
|
||||
'paged' => '1',
|
||||
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . $slug . '/' . $slug . '.php' ),
|
||||
), network_admin_url( 'plugins.php' )
|
||||
);
|
||||
break;
|
||||
case 'activate':
|
||||
return add_query_arg(
|
||||
array(
|
||||
'action' => 'activate',
|
||||
'plugin' => rawurlencode( $slug . '/' . $slug . '.php' ),
|
||||
'plugin_status' => 'all',
|
||||
'paged' => '1',
|
||||
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $slug . '/' . $slug . '.php' ),
|
||||
), network_admin_url( 'plugins.php' )
|
||||
);
|
||||
break;
|
||||
}// End switch().
|
||||
}
|
||||
|
||||
|
||||
public function call_plugin_api( $slug ) {
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
|
||||
$call_api = get_transient( 'abiz_cust_notify_plugin_info_' . $slug );
|
||||
if ( false === $call_api ) {
|
||||
$call_api = plugins_api(
|
||||
'plugin_information', array(
|
||||
'slug' => $slug,
|
||||
'fields' => array(
|
||||
'downloaded' => false,
|
||||
'rating' => false,
|
||||
'description' => false,
|
||||
'short_description' => true,
|
||||
'donate_link' => false,
|
||||
'tags' => false,
|
||||
'sections' => false,
|
||||
'homepage' => false,
|
||||
'added' => false,
|
||||
'last_updated' => false,
|
||||
'compatibility' => false,
|
||||
'tested' => false,
|
||||
'requires' => false,
|
||||
'downloadlink' => false,
|
||||
'icons' => false,
|
||||
),
|
||||
)
|
||||
);
|
||||
set_transient( 'abiz_cust_notify_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $call_api;
|
||||
}
|
||||
|
||||
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
global $abiz_customizer_notify_recommended_actions;
|
||||
global $abiz_customizer_notify_recommended_plugins;
|
||||
|
||||
global $install_button_label;
|
||||
global $activate_button_label;
|
||||
global $abiz_deactivate_button_label;
|
||||
|
||||
$formatted_array = array();
|
||||
$abiz_customizer_notify_show_recommended_actions = get_option( 'abiz_customizer_notify_show' );
|
||||
foreach ( $abiz_customizer_notify_recommended_actions as $key => $abiz_lite_customizer_notify_recommended_action ) {
|
||||
if ( $abiz_customizer_notify_show_recommended_actions[ $abiz_lite_customizer_notify_recommended_action['id'] ] === false ) {
|
||||
continue;
|
||||
}
|
||||
if ( $abiz_lite_customizer_notify_recommended_action['check'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$abiz_lite_customizer_notify_recommended_action['index'] = $key + 1;
|
||||
|
||||
if ( isset( $abiz_lite_customizer_notify_recommended_action['plugin_slug'] ) ) {
|
||||
$active = $this->check_active( $abiz_customizer_notify_recommended_action['plugin_slug'] );
|
||||
$abiz_lite_customizer_notify_recommended_action['url'] = $this->create_action_link( $active['needs'], $abiz_lite_customizer_notify_recommended_action['plugin_slug'] );
|
||||
if ( $active['needs'] !== 'install' && $active['status'] ) {
|
||||
$abiz_lite_customizer_notify_recommended_action['class'] = 'active';
|
||||
} else {
|
||||
$abiz_lite_customizer_notify_recommended_action['class'] = '';
|
||||
}
|
||||
|
||||
switch ( $active['needs'] ) {
|
||||
case 'install':
|
||||
$abiz_lite_customizer_notify_recommended_action['button_class'] = 'install-now button';
|
||||
$abiz_lite_customizer_notify_recommended_action['button_label'] = $install_button_label;
|
||||
break;
|
||||
case 'activate':
|
||||
$abiz_lite_customizer_notify_recommended_action['button_class'] = 'activate-now button button-primary';
|
||||
$abiz_lite_customizer_notify_recommended_action['button_label'] = $activate_button_label;
|
||||
break;
|
||||
case 'deactivate':
|
||||
$abiz_lite_customizer_notify_recommended_action['button_class'] = 'deactivate-now button';
|
||||
$abiz_lite_customizer_notify_recommended_action['button_label'] = $abiz_deactivate_button_label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$formatted_array[] = $abiz_lite_customizer_notify_recommended_action;
|
||||
}// End foreach().
|
||||
|
||||
$customize_plugins = array();
|
||||
|
||||
$abiz_lite_customizer_notify_show_recommended_plugins = get_option( 'abiz_customizer_notify_show_recommended_plugins' );
|
||||
|
||||
foreach ( $abiz_customizer_notify_recommended_plugins as $slug => $abiz_plugin_opt ) {
|
||||
|
||||
if ( ! $abiz_plugin_opt['recommended'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $abiz_lite_customizer_notify_show_recommended_plugins[ $slug ] ) && $abiz_lite_customizer_notify_show_recommended_plugins[ $slug ] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$active = $this->check_active( $slug );
|
||||
|
||||
if ( ! empty( $active['needs'] ) && ( $active['needs'] == 'deactivate' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ti_customizer_notify_recommended_plugin['url'] = $this->create_action_link( $active['needs'], $slug );
|
||||
if ( $active['needs'] !== 'install' && $active['status'] ) {
|
||||
$ti_customizer_notify_recommended_plugin['class'] = 'active';
|
||||
} else {
|
||||
$ti_customizer_notify_recommended_plugin['class'] = '';
|
||||
}
|
||||
|
||||
switch ( $active['needs'] ) {
|
||||
case 'install':
|
||||
$ti_customizer_notify_recommended_plugin['button_class'] = 'install-now button';
|
||||
$ti_customizer_notify_recommended_plugin['button_label'] = $install_button_label;
|
||||
break;
|
||||
case 'activate':
|
||||
$ti_customizer_notify_recommended_plugin['button_class'] = 'activate-now button button-primary';
|
||||
$ti_customizer_notify_recommended_plugin['button_label'] = $activate_button_label;
|
||||
break;
|
||||
case 'deactivate':
|
||||
$ti_customizer_notify_recommended_plugin['button_class'] = 'deactivate-now button';
|
||||
$ti_customizer_notify_recommended_plugin['button_label'] = $abiz_deactivate_button_label;
|
||||
break;
|
||||
}
|
||||
$abiz_info = $this->call_plugin_api( $slug );
|
||||
$ti_customizer_notify_recommended_plugin['id'] = $slug;
|
||||
$ti_customizer_notify_recommended_plugin['plugin_slug'] = $slug;
|
||||
|
||||
if ( ! empty( $abiz_plugin_opt['description'] ) ) {
|
||||
$ti_customizer_notify_recommended_plugin['description'] = $abiz_plugin_opt['description'];
|
||||
} else {
|
||||
$ti_customizer_notify_recommended_plugin['description'] = $abiz_info->short_description;
|
||||
}
|
||||
|
||||
$ti_customizer_notify_recommended_plugin['title'] = $abiz_info->name;
|
||||
|
||||
$customize_plugins[] = $ti_customizer_notify_recommended_plugin;
|
||||
|
||||
}// End foreach().
|
||||
|
||||
$json['recommended_actions'] = $formatted_array;
|
||||
$json['recommended_plugins'] = $customize_plugins;
|
||||
$json['total_actions'] = count( $abiz_customizer_notify_recommended_actions );
|
||||
$json['plugin_text'] = $this->plugin_text;
|
||||
$json['dismiss_button'] = $this->dismiss_button;
|
||||
return $json;
|
||||
|
||||
}
|
||||
|
||||
protected function render_template() {
|
||||
?>
|
||||
<# if( data.recommended_actions.length > 0 || data.recommended_plugins.length > 0 ){ #>
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
|
||||
<h3 class="accordion-section-title">
|
||||
<span class="section-title" data-plugin_text="{{ data.plugin_text }}">
|
||||
<# if( data.recommended_actions.length > 0 ){ #>
|
||||
{{ data.title }}
|
||||
<# }else{ #>
|
||||
<# if( data.recommended_plugins.length > 0 ){ #>
|
||||
{{ data.plugin_text }}
|
||||
<# }#>
|
||||
<# } #>
|
||||
</span>
|
||||
<# if( data.recommended_actions.length > 0 ){ #>
|
||||
<span class="abiz-customizer-plugin-notify-actions-count">
|
||||
<span class="current-index">{{ data.recommended_actions[0].index }}</span>
|
||||
{{ data.total_actions }}
|
||||
</span>
|
||||
<# } #>
|
||||
</h3>
|
||||
<div class="abiz-theme-recomended-actions_container" id="plugin-filter">
|
||||
<# if( data.recommended_actions.length > 0 ){ #>
|
||||
<# for (action in data.recommended_actions) { #>
|
||||
<div class="abiz-recommeded-actions-container epsilon-required-actions" data-index="{{ data.recommended_actions[action].index }}">
|
||||
<# if( !data.recommended_actions[action].check ){ #>
|
||||
<div class="abiz-epsilon-recommeded-actions">
|
||||
<p class="title">{{ data.recommended_actions[action].title }}</p>
|
||||
<span data-action="dismiss" class="dashicons dashicons-no abiz-customizer-notify-dismiss-recommended-action" id="{{ data.recommended_actions[action].id }}"></span>
|
||||
<div class="description">{{{ data.recommended_actions[action].description }}}</div>
|
||||
<# if( data.recommended_actions[action].plugin_slug ){ #>
|
||||
<div class="custom-action">
|
||||
<p class="plugin-card-{{ data.recommended_actions[action].plugin_slug }} action_button {{ data.recommended_actions[action].class }}">
|
||||
<a data-slug="{{ data.recommended_actions[action].plugin_slug }}" class="{{ data.recommended_actions[action].button_class }}" href="{{ data.recommended_actions[action].url }}">{{ data.recommended_actions[action].button_label }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<# } #>
|
||||
<# if( data.recommended_actions[action].help ){ #>
|
||||
<div class="custom-action">{{{ data.recommended_actions[action].help }}}</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
<# } #>
|
||||
|
||||
<# if( data.recommended_plugins.length > 0 ){ #>
|
||||
<# for (action in data.recommended_plugins) { #>
|
||||
<div class="abiz-recommeded-actions-container epsilon-recommended-plugins" data-index="{{ data.recommended_plugins[action].index }}">
|
||||
<# if( !data.recommended_plugins[action].check ){ #>
|
||||
<div class="abiz-epsilon-recommeded-actions">
|
||||
<p class="title">{{ data.recommended_plugins[action].title }}</p>
|
||||
<span data-action="dismiss" class="dashicons dashicons-no abiz-customizer-notify-dismiss-button-recommended-plugin" id="{{ data.recommended_plugins[action].id }}"></span>
|
||||
<div class="description">{{{ data.recommended_plugins[action].description }}}</div>
|
||||
<# if( data.recommended_plugins[action].plugin_slug ){ #>
|
||||
<div class="custom-action">
|
||||
<p class="plugin-card-{{ data.recommended_plugins[action].plugin_slug }} action_button {{ data.recommended_plugins[action].class }}">
|
||||
<a data-slug="{{ data.recommended_plugins[action].plugin_slug }}" class="{{ data.recommended_plugins[action].button_class }}" href="{{ data.recommended_plugins[action].url }}">{{ data.recommended_plugins[action].button_label }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<# } #>
|
||||
<# if( data.recommended_plugins[action].help ){ #>
|
||||
<div class="custom-action">{{{ data.recommended_plugins[action].help }}}</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
<# } #>
|
||||
</div>
|
||||
</li>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
class abiz_Customizer_Notify {
|
||||
|
||||
private $recommended_actions;
|
||||
|
||||
|
||||
private $recommended_plugins;
|
||||
|
||||
|
||||
private static $instance;
|
||||
|
||||
|
||||
private $recommended_actions_title;
|
||||
|
||||
|
||||
private $recommended_plugins_title;
|
||||
|
||||
|
||||
private $dismiss_button;
|
||||
|
||||
|
||||
private $install_button_label;
|
||||
|
||||
|
||||
private $activate_button_label;
|
||||
|
||||
|
||||
private $abiz_deactivate_button_label;
|
||||
|
||||
private $config;
|
||||
|
||||
public static function init( $config ) {
|
||||
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof abiz_Customizer_Notify ) ) {
|
||||
self::$instance = new abiz_Customizer_Notify();
|
||||
if ( ! empty( $config ) && is_array( $config ) ) {
|
||||
self::$instance->config = $config;
|
||||
self::$instance->setup_config();
|
||||
self::$instance->setup_actions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function setup_config() {
|
||||
|
||||
global $abiz_customizer_notify_recommended_plugins;
|
||||
global $abiz_customizer_notify_recommended_actions;
|
||||
|
||||
global $install_button_label;
|
||||
global $activate_button_label;
|
||||
global $abiz_deactivate_button_label;
|
||||
|
||||
$this->recommended_actions = isset( $this->config['recommended_actions'] ) ? $this->config['recommended_actions'] : array();
|
||||
$this->recommended_plugins = isset( $this->config['recommended_plugins'] ) ? $this->config['recommended_plugins'] : array();
|
||||
|
||||
$this->recommended_actions_title = isset( $this->config['recommended_actions_title'] ) ? $this->config['recommended_actions_title'] : '';
|
||||
$this->recommended_plugins_title = isset( $this->config['recommended_plugins_title'] ) ? $this->config['recommended_plugins_title'] : '';
|
||||
$this->dismiss_button = isset( $this->config['dismiss_button'] ) ? $this->config['dismiss_button'] : '';
|
||||
|
||||
$abiz_customizer_notify_recommended_plugins = array();
|
||||
$abiz_customizer_notify_recommended_actions = array();
|
||||
|
||||
if ( isset( $this->recommended_plugins ) ) {
|
||||
$abiz_customizer_notify_recommended_plugins = $this->recommended_plugins;
|
||||
}
|
||||
|
||||
if ( isset( $this->recommended_actions ) ) {
|
||||
$abiz_customizer_notify_recommended_actions = $this->recommended_actions;
|
||||
}
|
||||
|
||||
$install_button_label = isset( $this->config['install_button_label'] ) ? $this->config['install_button_label'] : '';
|
||||
$activate_button_label = isset( $this->config['activate_button_label'] ) ? $this->config['activate_button_label'] : '';
|
||||
$abiz_deactivate_button_label = isset( $this->config['abiz_deactivate_button_label'] ) ? $this->config['abiz_deactivate_button_label'] : '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function setup_actions() {
|
||||
|
||||
// Register the section.
|
||||
add_action( 'customize_register', array( $this, 'abiz_plugin_notification_customize_register' ) );
|
||||
|
||||
// Enqueue scripts and styles.
|
||||
add_action( 'customize_controls_enqueue_scripts', array( $this, 'abiz_customizer_notify_scripts_for_customizer' ), 0 );
|
||||
|
||||
/* ajax callback for dismissable recommended actions */
|
||||
add_action( 'wp_ajax_abiz_customizer_notify_dismiss_action', array( $this, 'abiz_customizer_notify_dismiss_recommended_action_callback' ) );
|
||||
|
||||
add_action( 'wp_ajax_abiz_customizer_notify_dismiss_recommended_plugins', array( $this, 'abiz_customizer_notify_dismiss_recommended_plugins_callback' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function abiz_customizer_notify_scripts_for_customizer() {
|
||||
|
||||
wp_enqueue_style( 'abiz-customizer-notify-css', get_template_directory_uri() . '/core/customizer/customizer-notice/css/abiz-customizer-notify.css', array() );
|
||||
|
||||
wp_enqueue_style( 'plugin-install' );
|
||||
wp_enqueue_script( 'plugin-install' );
|
||||
wp_add_inline_script( 'plugin-install', 'var pagenow = "customizer";' );
|
||||
|
||||
wp_enqueue_script( 'updates' );
|
||||
|
||||
wp_enqueue_script( 'abiz-customizer-notify-js', get_template_directory_uri() . '/core/customizer/customizer-notice/js/abiz-customizer-notify.js', array( 'customize-controls' ) );
|
||||
wp_localize_script(
|
||||
'abiz-customizer-notify-js',
|
||||
'abizCustomizercompanionObject',
|
||||
array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'template_directory' => get_template_directory_uri(),
|
||||
'base_path' => admin_url(),
|
||||
'activating_string' => __( 'Activating', 'abiz' ),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function abiz_plugin_notification_customize_register( $wp_customize ) {
|
||||
|
||||
require_once get_template_directory() . '/core/customizer/customizer-notice/abiz-customizer-notify-section.php';
|
||||
|
||||
$wp_customize->register_section_type( 'abiz_Customizer_Notify_Section' );
|
||||
|
||||
$wp_customize->add_section(
|
||||
new abiz_Customizer_Notify_Section(
|
||||
$wp_customize,
|
||||
'abiz-customizer-notify-section',
|
||||
array(
|
||||
'title' => $this->recommended_actions_title,
|
||||
'plugin_text' => $this->recommended_plugins_title,
|
||||
'dismiss_button' => $this->dismiss_button,
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function abiz_customizer_notify_dismiss_recommended_action_callback() {
|
||||
|
||||
global $abiz_customizer_notify_recommended_actions;
|
||||
|
||||
$action_id = ( isset( $_GET['id'] ) ) ? $_GET['id'] : 0;
|
||||
|
||||
echo esc_html($action_id);
|
||||
|
||||
if ( ! empty( $action_id ) ) {
|
||||
|
||||
if ( get_option( 'abiz_customizer_notify_show' ) ) {
|
||||
|
||||
$abiz_customizer_notify_show_recommended_actions = get_option( 'abiz_customizer_notify_show' );
|
||||
switch ( $_GET['todo'] ) {
|
||||
case 'add':
|
||||
$abiz_customizer_notify_show_recommended_actions[ $action_id ] = true;
|
||||
break;
|
||||
case 'dismiss':
|
||||
$abiz_customizer_notify_show_recommended_actions[ $action_id ] = false;
|
||||
break;
|
||||
}
|
||||
update_option( 'abiz_customizer_notify_show', $abiz_customizer_notify_show_recommended_actions );
|
||||
|
||||
} else {
|
||||
$abiz_customizer_notify_show_recommended_actions = array();
|
||||
if ( ! empty( $abiz_customizer_notify_recommended_actions ) ) {
|
||||
foreach ( $abiz_customizer_notify_recommended_actions as $abiz_lite_customizer_notify_recommended_action ) {
|
||||
if ( $abiz_lite_customizer_notify_recommended_action['id'] == $action_id ) {
|
||||
$abiz_customizer_notify_show_recommended_actions[ $abiz_lite_customizer_notify_recommended_action['id'] ] = false;
|
||||
} else {
|
||||
$abiz_customizer_notify_show_recommended_actions[ $abiz_lite_customizer_notify_recommended_action['id'] ] = true;
|
||||
}
|
||||
}
|
||||
update_option( 'abiz_customizer_notify_show', $abiz_customizer_notify_show_recommended_actions );
|
||||
}
|
||||
}
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
public function abiz_customizer_notify_dismiss_recommended_plugins_callback() {
|
||||
|
||||
$action_id = ( isset( $_GET['id'] ) ) ? $_GET['id'] : 0;
|
||||
|
||||
echo esc_html($action_id);
|
||||
|
||||
if ( ! empty( $action_id ) ) {
|
||||
|
||||
$abiz_lite_customizer_notify_show_recommended_plugins = get_option( 'abiz_customizer_notify_show_recommended_plugins' );
|
||||
|
||||
switch ( $_GET['todo'] ) {
|
||||
case 'add':
|
||||
$abiz_lite_customizer_notify_show_recommended_plugins[ $action_id ] = false;
|
||||
break;
|
||||
case 'dismiss':
|
||||
$abiz_lite_customizer_notify_show_recommended_plugins[ $action_id ] = true;
|
||||
break;
|
||||
}
|
||||
update_option( 'abiz_customizer_notify_show_recommended_plugins', $abiz_lite_customizer_notify_show_recommended_plugins );
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
.abiz-customizer-plugin-notify-actions-count {
|
||||
display: inline-block;
|
||||
z-index: 26;
|
||||
margin: 1px 0 0 2px;
|
||||
padding: 0 6px;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
background-color: #d54e21;
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
line-height: 17px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
div.abiz-theme-recomended-actions_container {
|
||||
margin-bottom: 2em;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container p.succes {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions p.title {
|
||||
margin-bottom: 0;
|
||||
color: #555d66;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions div.description {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions .custom-action {
|
||||
margin-top: 1em;
|
||||
padding-top: 1em;
|
||||
border-top: 1px solid #fafafa;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions .custom-action p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .abiz-recommeded-actions-container:not(:first-child) {
|
||||
overflow: hidden;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .abiz-recommeded-actions-container:first-child {
|
||||
height: auto;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .abiz-recommeded-actions-container {
|
||||
-webkit-transition: opacity 2s;
|
||||
/* Safari */
|
||||
transition: opacity 2s;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.abiz-customizer-plugin-notify-actions-count.complete {
|
||||
background-color: #79ba49;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container #demo_content .button {
|
||||
display: block;
|
||||
margin-bottom: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .succes a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .succes a.social {
|
||||
width: 49%;
|
||||
margin-bottom: 1em;
|
||||
padding-top: 4px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .succes a.social span,
|
||||
.abiz-theme-recomended-actions_container .succes span {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.abiz-theme-recomended-actions_container .succes {
|
||||
padding-top: 4px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.abiz-customizer-notify-dismiss-button-recommended-plugin,
|
||||
.abiz-customizer-notify-dismiss-recommended-action {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
border-radius: 50%;
|
||||
color: #d54e21;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.abiz-customizer-notify-dismiss-recommended-action,
|
||||
.abiz-epsilon-recommeded-actions .abiz-customizer-notify-dismiss-button-recommended-plugin {
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions #temp_load {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
}
|
||||
|
||||
.abiz-epsilon-recommeded-actions #temp_load img {
|
||||
margin: 0 auto;
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Customizer notification system
|
||||
*/
|
||||
(function (api) {
|
||||
|
||||
api.sectionConstructor['abiz-customizer-notify-section'] = api.Section.extend(
|
||||
{
|
||||
|
||||
// No events for this type of section.
|
||||
attachEvents: function () {
|
||||
},
|
||||
|
||||
// Always make the section active.
|
||||
isContextuallyActive: function () {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})( wp.customize );
|
||||
|
||||
jQuery( document ).ready(
|
||||
function () {
|
||||
|
||||
jQuery( '.abiz-customizer-notify-dismiss-recommended-action' ).click(
|
||||
function () {
|
||||
|
||||
var id = jQuery( this ).attr( 'id' ),
|
||||
action = jQuery( this ).attr( 'data-action' );
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'GET',
|
||||
data: {action: 'abiz_customizer_notify_dismiss_action', id: id, todo: action},
|
||||
dataType: 'html',
|
||||
url: abizCustomizercompanionObject.ajaxurl,
|
||||
beforeSend: function () {
|
||||
jQuery( '#' + id ).parent().append( '<div id="temp_load" style="text-align:center"><img src="' + abizCustomizercompanionObject.base_path + '/images/spinner-2x.gif" /></div>' );
|
||||
},
|
||||
success: function (data) {
|
||||
var container = jQuery( '#' + data ).parent().parent();
|
||||
var index = container.next().data( 'index' );
|
||||
var recommended_sction = jQuery( '#accordion-section-ti_customizer_notify_recomended_actions' );
|
||||
var actions_count = recommended_sction.find( '.abiz-customizer-plugin-notify-actions-count' );
|
||||
var section_title = recommended_sction.find( '.section-title' );
|
||||
jQuery( '.abiz-customizer-plugin-notify-actions-count .current-index' ).text( index );
|
||||
container.slideToggle().remove();
|
||||
if (jQuery( '.abiz-theme-recomended-actions_container > .epsilon-recommended-actions' ).length === 0) {
|
||||
|
||||
actions_count.remove();
|
||||
|
||||
if (jQuery( '.abiz-theme-recomended-actions_container > .epsilon-recommended-plugins' ).length === 0) {
|
||||
jQuery( '.control-section-ti-customizer-notify-recomended-actions' ).remove();
|
||||
} else {
|
||||
section_title.text( section_title.data( 'plugin_text' ) );
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
jQuery( '.abiz-customizer-notify-dismiss-button-recommended-plugin' ).click(
|
||||
function () {
|
||||
var id = jQuery( this ).attr( 'id' ),
|
||||
action = jQuery( this ).attr( 'data-action' );
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'GET',
|
||||
data: {action: 'abiz_customizer_notify_dismiss_recommended_plugins', id: id, todo: action},
|
||||
dataType: 'html',
|
||||
url: abizCustomizercompanionObject.ajaxurl,
|
||||
beforeSend: function () {
|
||||
jQuery( '#' + id ).parent().append( '<div id="temp_load" style="text-align:center"><img src="' + abizCustomizercompanionObject.base_path + '/images/spinner-2x.gif" /></div>' );
|
||||
},
|
||||
success: function (data) {
|
||||
var container = jQuery( '#' + data ).parent().parent();
|
||||
var index = container.next().data( 'index' );
|
||||
jQuery( '.abiz-customizer-plugin-notify-actions-count .current-index' ).text( index );
|
||||
container.slideToggle().remove();
|
||||
|
||||
if (jQuery( '.abiz-theme-recomended-actions_container > .epsilon-recommended-plugins' ).length === 0) {
|
||||
jQuery( '.control-section-ti-customizer-notify-recomended-section' ).remove();
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Remove activate button and replace with activation in progress button.
|
||||
jQuery( document ).on(
|
||||
'DOMNodeInserted','.activate-now', function () {
|
||||
var activateButton = jQuery( '.activate-now' );
|
||||
if (activateButton.length) {
|
||||
var url = jQuery( activateButton ).attr( 'href' );
|
||||
if (typeof url !== 'undefined') {
|
||||
// Request plugin activation.
|
||||
jQuery.ajax(
|
||||
{
|
||||
beforeSend: function () {
|
||||
jQuery( activateButton ).replaceWith( '<a class="button updating-message">' + abizCustomizercompanionObject.activating_string + '...</a>' );
|
||||
},
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function () {
|
||||
// Reload the page.
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Remove activate button and replace with activation in progress button.
|
||||
*
|
||||
* @package abiz
|
||||
*/
|
||||
|
||||
|
||||
jQuery( document ).ready(
|
||||
function ($) {
|
||||
$( 'body' ).on(
|
||||
'click', ' .abiz-install-plugin ', function () {
|
||||
var slug = $( this ).attr( 'data-slug' );
|
||||
|
||||
wp.updates.installPlugin(
|
||||
{
|
||||
slug: slug
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$( '.activate-now' ).on(
|
||||
'click', function (e) {
|
||||
|
||||
var activateButton = $( this );
|
||||
e.preventDefault();
|
||||
if ($( activateButton ).length) {
|
||||
var url = $( activateButton ).attr( 'href' );
|
||||
|
||||
if (typeof url !== 'undefined') {
|
||||
// Request plugin activation.
|
||||
$.ajax(
|
||||
{
|
||||
beforeSend: function () {
|
||||
$( activateButton ).replaceWith( '<a class="button updating-message">'+"activating"+'...</a>' );
|
||||
},
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function () {
|
||||
// Reload the page.
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,849 @@
|
||||
<?php if ( ! class_exists( 'WP_Customize_Control' ) ) {
|
||||
return null;
|
||||
}
|
||||
class ABIZ_Repeater extends WP_Customize_Control {
|
||||
|
||||
public $id;
|
||||
private $boxtitle = array();
|
||||
private $add_field_label = array();
|
||||
private $customizer_repeater_title_control = false;
|
||||
private $customizer_repeater_subtitle_control = false;
|
||||
private $customizer_repeater_subtitle2_control = false;
|
||||
private $customizer_repeater_button_text_control = false;
|
||||
private $customizer_repeater_link_control = false;
|
||||
private $customizer_repeater_align_control = false;
|
||||
private $customizer_repeater_video_url_control = false;
|
||||
private $customizer_repeater_image_control = false;
|
||||
private $customizer_repeater_icon_control = false;
|
||||
private $customizer_repeater_color_control = false;
|
||||
private $customizer_repeater_text_control = false;
|
||||
public $customizer_repeater_text2_control = false;
|
||||
public $customizer_repeater_button2_control = false;
|
||||
public $customizer_repeater_link2_control = false;
|
||||
public $customizer_repeater_btn3_control = false;
|
||||
public $customizer_repeater_link3_control = false;
|
||||
private $customizer_repeater_designation_control = false;
|
||||
private $customizer_repeater_shortcode_control = false;
|
||||
private $customizer_repeater_repeater_control = false;
|
||||
private $customizer_repeater_checkbox_control = false;
|
||||
|
||||
private $customizer_icon_container = '';
|
||||
private $allowed_html = array();
|
||||
|
||||
|
||||
/*Class constructor*/
|
||||
public function __construct( $manager, $id, $args = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
/*Get options from customizer.php*/
|
||||
$this->add_field_label = esc_html__( 'Add new field', 'abiz' );
|
||||
if ( ! empty( $args['add_field_label'] ) ) {
|
||||
$this->add_field_label = $args['add_field_label'];
|
||||
}
|
||||
|
||||
$this->boxtitle = esc_html__( 'Customizer Repeater', 'abiz' );
|
||||
if ( ! empty ( $args['item_name'] ) ) {
|
||||
$this->boxtitle = $args['item_name'];
|
||||
} elseif ( ! empty( $this->label ) ) {
|
||||
$this->boxtitle = $this->label;
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_image_control'] ) ) {
|
||||
$this->customizer_repeater_image_control = $args['customizer_repeater_image_control'];
|
||||
}
|
||||
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_icon_control'] ) ) {
|
||||
$this->customizer_repeater_icon_control = $args['customizer_repeater_icon_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_color_control'] ) ) {
|
||||
$this->customizer_repeater_color_control = $args['customizer_repeater_color_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_title_control'] ) ) {
|
||||
$this->customizer_repeater_title_control = $args['customizer_repeater_title_control'];
|
||||
}
|
||||
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_subtitle_control'] ) ) {
|
||||
$this->customizer_repeater_subtitle_control = $args['customizer_repeater_subtitle_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_subtitle2_control'] ) ) {
|
||||
$this->customizer_repeater_subtitle2_control = $args['customizer_repeater_subtitle2_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_btn3_control'] ) ) {
|
||||
$this->customizer_repeater_btn3_control = $args['customizer_repeater_btn3_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_text_control'] ) ) {
|
||||
$this->customizer_repeater_text_control = $args['customizer_repeater_text_control'];
|
||||
}
|
||||
if ( ! empty( $args['customizer_repeater_text2_control'] ) ) {
|
||||
$this->customizer_repeater_text2_control = $args['customizer_repeater_text2_control'];
|
||||
}
|
||||
if ( ! empty( $args['customizer_repeater_button2_control'] ) ) {
|
||||
$this->customizer_repeater_button2_control = $args['customizer_repeater_button2_control'];
|
||||
}
|
||||
if ( ! empty( $args['customizer_repeater_link2_control'] ) ) {
|
||||
$this->customizer_repeater_link2_control = $args['customizer_repeater_link2_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_link3_control'] ) ) {
|
||||
$this->customizer_repeater_link3_control = $args['customizer_repeater_link3_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_designation_control'] ) ) {
|
||||
$this->customizer_repeater_designation_control = $args['customizer_repeater_designation_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_button_text_control'] ) ) {
|
||||
$this->customizer_repeater_button_text_control = $args['customizer_repeater_button_text_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_link_control'] ) ) {
|
||||
$this->customizer_repeater_link_control = $args['customizer_repeater_link_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_checkbox_control'] ) ) {
|
||||
$this->customizer_repeater_checkbox_control = $args['customizer_repeater_checkbox_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_video_url_control'] ) ) {
|
||||
$this->customizer_repeater_video_url_control = $args['customizer_repeater_video_url_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_align_control'] ) ) {
|
||||
$this->customizer_repeater_align_control = $args['customizer_repeater_align_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_shortcode_control'] ) ) {
|
||||
$this->customizer_repeater_shortcode_control = $args['customizer_repeater_shortcode_control'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['customizer_repeater_repeater_control'] ) ) {
|
||||
$this->customizer_repeater_repeater_control = $args['customizer_repeater_repeater_control'];
|
||||
}
|
||||
|
||||
|
||||
if ( ! empty( $id ) ) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
if ( file_exists( get_template_directory() . '/core/customizer/customizer-repeater/inc/icons.php' ) ) {
|
||||
$this->customizer_icon_container = 'core/customizer/customizer-repeater/inc/icons';
|
||||
}
|
||||
|
||||
$allowed_array1 = wp_kses_allowed_html( 'post' );
|
||||
$allowed_array2 = array(
|
||||
'input' => array(
|
||||
'type' => array(),
|
||||
'class' => array(),
|
||||
'placeholder' => array()
|
||||
)
|
||||
);
|
||||
|
||||
$this->allowed_html = array_merge( $allowed_array1, $allowed_array2 );
|
||||
}
|
||||
|
||||
/*Enqueue resources for the control*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'all-css', get_template_directory_uri() . '/assets/css/all.min.css', array(), 999 );
|
||||
|
||||
wp_enqueue_style( 'abiz_customizer-repeater-admin-stylesheet', get_template_directory_uri() . '/core/customizer/customizer-repeater/css/admin-style.css', array(), 999 );
|
||||
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
|
||||
wp_enqueue_script( 'abiz_customizer-repeater-script', get_template_directory_uri() . '/core/customizer/customizer-repeater/js/customizer_repeater.js', array('jquery', 'jquery-ui-draggable', 'wp-color-picker' ), 999, true );
|
||||
|
||||
wp_enqueue_script( 'abiz_customizer-repeater-fontawesome-iconpicker', get_template_directory_uri() . '/core/customizer/customizer-repeater/js/fontawesome-iconpicker.js', array( 'jquery' ), 999, true );
|
||||
|
||||
wp_enqueue_style( 'abiz_customizer-repeater-fontawesome-iconpicker-script', get_template_directory_uri() . '/core/customizer/customizer-repeater/css/fontawesome-iconpicker.min.css', array(), 999 );
|
||||
}
|
||||
|
||||
public function render_content() {
|
||||
|
||||
/*Get default options*/
|
||||
$this_default = json_decode( $this->setting->default );
|
||||
|
||||
/*Get values (json format)*/
|
||||
$values = $this->value();
|
||||
|
||||
/*Decode values*/
|
||||
$json = json_decode( $values );
|
||||
|
||||
if ( ! is_array( $json ) ) {
|
||||
$json = array( $values );
|
||||
} ?>
|
||||
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<div class="customizer-repeater-general-control-repeater customizer-repeater-general-control-droppable">
|
||||
<?php
|
||||
if ( ( count( $json ) == 1 && '' === $json[0] ) || empty( $json ) ) {
|
||||
if ( ! empty( $this_default ) ) {
|
||||
$this->iterate_array( $this_default ); ?>
|
||||
<input type="hidden"
|
||||
id="customizer-repeater-<?php echo esc_attr( $this->id ); ?>-colector" <?php esc_attr( $this->link() ); ?>
|
||||
class="customizer-repeater-colector"
|
||||
value="<?php echo esc_textarea( json_encode( $this_default ) ); ?>"/>
|
||||
<?php
|
||||
} else {
|
||||
$this->iterate_array(); ?>
|
||||
<input type="hidden"
|
||||
id="customizer-repeater-<?php echo esc_attr( $this->id ); ?>-colector" <?php esc_attr( $this->link() ); ?>
|
||||
class="customizer-repeater-colector"/>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
$this->iterate_array( $json ); ?>
|
||||
<input type="hidden" id="customizer-repeater-<?php echo esc_attr( $this->id ); ?>-colector" <?php esc_attr( $this->link() ); ?>
|
||||
class="customizer-repeater-colector" value="<?php echo esc_textarea( $this->value() ); ?>"/>
|
||||
<?php
|
||||
} ?>
|
||||
</div>
|
||||
<button type="button" class="button add_field customizer-repeater-new-field">
|
||||
<?php echo esc_html( $this->add_field_label ); ?>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function iterate_array($array = array()){
|
||||
/*Counter that helps checking if the box is first and should have the delete button disabled*/
|
||||
$it = 0;
|
||||
if(!empty($array)){
|
||||
$exist_service=count($array);
|
||||
|
||||
$abiz_del_btn_id=$this->boxtitle;
|
||||
|
||||
global $abiz_limit;
|
||||
global $abiz_type_with_id;
|
||||
echo sprintf("<input type='hidden' value='$exist_service' id='exist_abiz_$abiz_del_btn_id'/>");
|
||||
foreach($array as $icon){
|
||||
if($it<4)
|
||||
{
|
||||
$abiz_limit="abiz_limit";
|
||||
$abiz_type_with_id='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$abiz_limit="abiz_overlimit";
|
||||
$abiz_type_with_id=$abiz_del_btn_id."_".$it;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div class="customizer-repeater-general-control-repeater-container customizer-repeater-draggable">
|
||||
<div class="customizer-repeater-customize-control-title">
|
||||
<?php echo esc_html( $this->boxtitle ) ?>
|
||||
</div>
|
||||
<div class="customizer-repeater-box-content-hidden">
|
||||
<?php
|
||||
$choice = $image_url = $icon_value = $title = $subtitle = $subtitle2 = $text = $text2 = $link2 = $button_second = $link = $btn3 = $link3 = $designation = $align = $button = $open_new_tab = $shortcode = $repeater = $color = $video_url = '';
|
||||
if(!empty($icon->id)){
|
||||
$id = $icon->id;
|
||||
}
|
||||
if(!empty($icon->choice)){
|
||||
$choice = $icon->choice;
|
||||
}
|
||||
if(!empty($icon->image_url)){
|
||||
$image_url = $icon->image_url;
|
||||
}
|
||||
if(!empty($icon->icon_value)){
|
||||
$icon_value = $icon->icon_value;
|
||||
}
|
||||
if(!empty($icon->color)){
|
||||
$color = $icon->color;
|
||||
}
|
||||
if(!empty($icon->title)){
|
||||
$title = $icon->title;
|
||||
}
|
||||
|
||||
if(!empty($icon->align)){
|
||||
$align = $icon->align;
|
||||
}
|
||||
|
||||
if(!empty($icon->designation)){
|
||||
$designation = $icon->designation;
|
||||
}
|
||||
|
||||
if(!empty($icon->subtitle)){
|
||||
$subtitle = $icon->subtitle;
|
||||
}
|
||||
|
||||
if(!empty($icon->subtitle2)){
|
||||
$subtitle2 = $icon->subtitle2;
|
||||
}
|
||||
|
||||
if(!empty($icon->text)){
|
||||
$text = $icon->text;
|
||||
}
|
||||
if(!empty($icon->text2)){
|
||||
$text2 = $icon->text2;
|
||||
}
|
||||
|
||||
if(!empty($icon->button_second)){
|
||||
$button_second = $icon->button_second;
|
||||
}
|
||||
|
||||
if(!empty($icon->link2)){
|
||||
$link2 = $icon->link2;
|
||||
}
|
||||
|
||||
if(!empty($icon->btn3)){
|
||||
$btn3 = $icon->btn3;
|
||||
}
|
||||
|
||||
if(!empty($icon->link3)){
|
||||
$link3 = $icon->link3;
|
||||
}
|
||||
|
||||
if(!empty($icon->video_url)){
|
||||
$video_url = $icon->video_url;
|
||||
}
|
||||
|
||||
if(!empty($icon->button)){
|
||||
$button = $icon->button_text;
|
||||
}
|
||||
if(!empty($icon->link)){
|
||||
$link = $icon->link;
|
||||
}
|
||||
if(!empty($icon->shortcode)){
|
||||
$shortcode = $icon->shortcode;
|
||||
}
|
||||
|
||||
if(!empty($icon->social_repeater)){
|
||||
$repeater = $icon->social_repeater;
|
||||
}
|
||||
|
||||
if(!empty($icon->open_new_tab)){
|
||||
$open_new_tab = $icon->open_new_tab;
|
||||
}
|
||||
|
||||
|
||||
if($this->customizer_repeater_title_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Title','abiz' ), $this->id, 'customizer_repeater_title_control' ),
|
||||
'class' => 'customizer-repeater-title-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_title_control' ),
|
||||
), $title);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_subtitle_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Subtitle','abiz' ), $this->id, 'customizer_repeater_subtitle_control' ),
|
||||
'class' => 'customizer-repeater-subtitle-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_subtitle_control' ),
|
||||
), $subtitle);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_subtitle2_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Subtitle 2','abiz' ), $this->id, 'customizer_repeater_subtitle2_control' ),
|
||||
'class' => 'customizer-repeater-subtitle2-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_subtitle2_control' ),
|
||||
), $subtitle2);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_text_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Description','abiz' ), $this->id, 'customizer_repeater_text_control' ),
|
||||
'class' => 'customizer-repeater-text-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_text_control' ),
|
||||
), $text);
|
||||
}
|
||||
if($this->customizer_repeater_text2_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Button Label','abiz' ), $this->id, 'customizer_repeater_text2_control' ),
|
||||
'class' => 'customizer-repeater-text2-control '."$abiz_limit".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_text2_control' ),
|
||||
), $text2);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_link_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Link','abiz' ), $this->id, 'customizer_repeater_link_control' ),
|
||||
'class' => 'customizer-repeater-link-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link_control' ),
|
||||
), $link);
|
||||
}
|
||||
|
||||
|
||||
if($this->customizer_repeater_button2_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Button Label second','abiz' ), $this->id, 'customizer_repeater_button2_control' ),
|
||||
'class' => 'customizer-repeater-button2-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_button2_control' ),
|
||||
), $button_second);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_link2_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'link','abiz' ), $this->id, 'customizer_repeater_link2_control' ),
|
||||
'class' => 'customizer-repeater-link2-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
//'sanitize_callback' => 'esc_url_raw',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link2_control' ),
|
||||
), $link2);
|
||||
}
|
||||
if($this->customizer_repeater_button_text_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__('Button Text',
|
||||
'abiz'), $this->id, 'customizer_repeater_button_text_control'),
|
||||
'class' => 'customizer-repeater-button-text-control '."$abiz_limit".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '' , $this->id,
|
||||
'customizer_repeater_button_text_control'),
|
||||
), $button);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($this->customizer_repeater_btn3_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Button Label Third','abiz' ), $this->id, 'customizer_repeater_btn3_control' ),
|
||||
'class' => 'customizer-repeater-btn3-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_btn3_control' ),
|
||||
), $btn3);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_link3_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'link','abiz' ), $this->id, 'customizer_repeater_link3_control' ),
|
||||
'class' => 'customizer-repeater-link3-control '."$abiz_limit".' '."$abiz_type_with_id".'',
|
||||
//'sanitize_callback' => 'esc_url_raw',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link3_control' ),
|
||||
), $link3);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_checkbox_control == true){
|
||||
$this->testimonila_check($open_new_tab);
|
||||
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_video_url_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__('Video Url',
|
||||
'abiz'), $this->id, 'customizer_repeater_video_url_control'),
|
||||
'class' => 'customizer-repeater-video-url-control',
|
||||
'type' => apply_filters('abiz_customizer_repeater_video_url_control', 'textarea', $this->id, 'customizer_repeater_video_url_control' ),
|
||||
), $video_url);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_align_control == true){
|
||||
$this->align($align);
|
||||
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_image_control == true && $this->customizer_repeater_icon_control == true) {
|
||||
$this->icon_type_choice( $choice,$abiz_limit );
|
||||
}
|
||||
if($this->customizer_repeater_image_control == true){
|
||||
$this->image_control($image_url, $choice, $abiz_limit, $it+1, $abiz_del_btn_id);
|
||||
}
|
||||
if($this->customizer_repeater_icon_control == true){
|
||||
$this->icon_picker_control($icon_value, $choice);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($this->customizer_repeater_color_control == true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Color','abiz' ), $this->id, 'customizer_repeater_color_control' ),
|
||||
'class' => 'customizer-repeater-color-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', 'color', $this->id, 'customizer_repeater_color_control' ),
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
), $color);
|
||||
}
|
||||
|
||||
|
||||
if($this->customizer_repeater_shortcode_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Shortcode','abiz' ), $this->id, 'customizer_repeater_shortcode_control' ),
|
||||
'class' => 'customizer-repeater-shortcode-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_shortcode_control' ),
|
||||
), $shortcode);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_designation_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Designation','abiz' ), $this->id, 'customizer_repeater_designation_control' ),
|
||||
'class' => 'customizer-repeater-designation-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_designation_control' ),
|
||||
), $designation);
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_repeater_control==true){
|
||||
$this->repeater_control($repeater, $abiz_limit, $abiz_type_with_id);
|
||||
} ?>
|
||||
|
||||
<input type="hidden" class="social-repeater-box-id" value="<?php if ( ! empty( $id ) ) {
|
||||
echo esc_attr( $id );
|
||||
} ?>">
|
||||
<button type="button" class="social-repeater-general-control-remove-field" <?php if ( $it == 0 ) {
|
||||
echo esc_attr('style=display:none;');
|
||||
} ?>>
|
||||
<?php printf( __( 'Delete %s', 'abiz' ), $this->boxtitle ); ?>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$it++;
|
||||
}
|
||||
} else { ?>
|
||||
<div class="customizer-repeater-general-control-repeater-container">
|
||||
<div class="customizer-repeater-customize-control-title">
|
||||
<?php echo esc_html( $this->boxtitle ) ?>
|
||||
</div>
|
||||
<div class="customizer-repeater-box-content-hidden">
|
||||
<?php
|
||||
if ( $this->customizer_repeater_image_control == true && $this->customizer_repeater_icon_control == true ) {
|
||||
$this->icon_type_choice();
|
||||
}
|
||||
if ( $this->customizer_repeater_image_control == true ) {
|
||||
$this->image_control();
|
||||
}
|
||||
if ( $this->customizer_repeater_icon_control == true ) {
|
||||
$this->icon_picker_control();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->customizer_repeater_color_control==true){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Color','abiz' ), $this->id, 'customizer_repeater_color_control' ),
|
||||
'class' => 'customizer-repeater-color-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', 'color', $this->id, 'customizer_repeater_color_control' ),
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
) );
|
||||
}
|
||||
if ( $this->customizer_repeater_title_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Title','abiz' ), $this->id, 'customizer_repeater_title_control' ),
|
||||
'class' => 'customizer-repeater-title-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_title_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_subtitle_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Subtitle','abiz' ), $this->id, 'customizer_repeater_subtitle_control' ),
|
||||
'class' => 'customizer-repeater-subtitle-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_subtitle_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_subtitle2_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Subtitle 2','abiz' ), $this->id, 'customizer_repeater_subtitle2_control' ),
|
||||
'class' => 'customizer-repeater-subtitle-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_subtitle2_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
if ( $this->customizer_repeater_text_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Description','abiz' ), $this->id, 'customizer_repeater_text_control' ),
|
||||
'class' => 'customizer-repeater-text-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_text_control' ),
|
||||
) );
|
||||
}
|
||||
if ( $this->customizer_repeater_text2_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Button Label','abiz' ), $this->id, 'customizer_repeater_text2_control' ),
|
||||
'class' => 'customizer-repeater-text2-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_text2_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_button2_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Button Label Second','abiz' ), $this->id, 'customizer_repeater_button2_control' ),
|
||||
'class' => 'customizer-repeater-button2-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_button2_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_link2_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'link','abiz' ), $this->id, 'customizer_repeater_link2_control' ),
|
||||
'class' => 'customizer-repeater-link2-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link2_control' ),
|
||||
) );
|
||||
}
|
||||
if($this->customizer_repeater_button_text_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__('Button Text',
|
||||
'abiz'), $this->id, 'customizer_repeater_button_text_control'),
|
||||
'class' => 'customizer-repeater-button-text-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '' , $this->id,
|
||||
'customizer_repeater_button_text_control'),
|
||||
));
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_link_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Link','abiz' ), $this->id, 'customizer_repeater_link_control' ),
|
||||
'class' => 'customizer-repeater-link-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_btn3_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Button Label 3','abiz' ), $this->id, 'customizer_repeater_btn3_control' ),
|
||||
'class' => 'customizer-repeater-btn3-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_btn3_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $this->customizer_repeater_link3_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'link','abiz' ), $this->id, 'customizer_repeater_link3_control' ),
|
||||
'class' => 'customizer-repeater-link3-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link3_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_checkbox_control == true){
|
||||
$this->testimonila_check();
|
||||
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_video_url_control){
|
||||
$this->input_control(array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__('Video Url',
|
||||
'abiz'), $this->id, 'customizer_repeater_video_url_control'),
|
||||
'class' => 'customizer-repeater-video-url-control',
|
||||
'type' => apply_filters('abiz_customizer_repeater_video_url_control', 'textarea', $this->id, 'customizer_repeater_video_url_control' ),
|
||||
));
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_align_control == true){
|
||||
$this->align($align);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( $this->customizer_repeater_shortcode_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Shortcode','abiz' ), $this->id, 'customizer_repeater_shortcode_control' ),
|
||||
'class' => 'customizer-repeater-shortcode-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', '', $this->id, 'customizer_repeater_shortcode_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
if ( $this->customizer_repeater_designation_control == true ) {
|
||||
$this->input_control( array(
|
||||
'label' => apply_filters('abiz_repeater_input_labels_filter', esc_html__( 'Designation','abiz' ), $this->id, 'customizer_repeater_designation_control' ),
|
||||
'class' => 'customizer-repeater-designation-control',
|
||||
'type' => apply_filters('abiz_repeater_input_types_filter', 'textarea', $this->id, 'customizer_repeater_designation_control' ),
|
||||
) );
|
||||
}
|
||||
|
||||
if($this->customizer_repeater_repeater_control==true){
|
||||
$this->repeater_control();
|
||||
} ?>
|
||||
<input type="hidden" class="social-repeater-box-id">
|
||||
<button type="button" class="social-repeater-general-control-remove-field button" style="display:none;">
|
||||
<?php esc_html_e( 'Delete field', 'abiz' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
private function input_control( $options, $value='' ){
|
||||
//print_r($options);
|
||||
?>
|
||||
<span class="customize-control-title <?php echo esc_html( $options['label'] ); ?>"
|
||||
<?php if($options['class']== 'customizer-repeater-video-url-control') {echo esc_attr('style="display:none;"'); }?>
|
||||
|
||||
><?php echo esc_html( $options['label'] ); ?></span>
|
||||
<?php
|
||||
if( !empty($options['type']) ){
|
||||
switch ($options['type']) {
|
||||
case 'textarea':?>
|
||||
<textarea class="<?php echo esc_attr( $options['class'] ); ?>" placeholder="<?php echo esc_attr( $options['label'] ); ?>"><?php echo ( !empty($options['sanitize_callback']) ? call_user_func_array( $options['sanitize_callback'], array( $value ) ) : esc_attr($value) ); ?></textarea>
|
||||
<?php
|
||||
break;
|
||||
case 'color': ?>
|
||||
<input type="text" value="<?php echo ( !empty($options['sanitize_callback']) ? call_user_func_array( $options['sanitize_callback'], array( $value ) ) : esc_attr($value) ); ?>" class="<?php echo esc_attr($options['class']); ?>" />
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
} else { ?>
|
||||
<input type="text" value="<?php echo ( !empty($options['sanitize_callback']) ? call_user_func_array( $options['sanitize_callback'], array( $value ) ) : esc_attr($value) ); ?>" class="<?php echo esc_attr($options['class']); ?>" placeholder="<?php echo esc_attr( $options['label'] ); ?>"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function testimonila_check($value='no', $class='', $abiz_type_with_id=''){
|
||||
?>
|
||||
<div class="customize-control-title">
|
||||
<?php esc_html_e('Open link in new tab:','abiz'); ?>
|
||||
<span class="switch">
|
||||
<input type="checkbox" name="custom_checkbox" value="yes" <?php if($value=='yes'){echo esc_attr('checked');}?> class="customizer-repeater-checkbox <?php echo esc_attr($class);?> <?php echo esc_attr($abiz_type_with_id);?>">
|
||||
</span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function icon_picker_control($value = '', $show = '', $class=''){ ?>
|
||||
<div class="social-repeater-general-control-icon" <?php if( $show === 'customizer_repeater_image' || $show === 'customizer_repeater_none' ) { echo esc_attr('style="display:none;"'); } ?>>
|
||||
<span class="customize-control-title">
|
||||
<?php esc_html_e('Icon','abiz'); ?>
|
||||
</span>
|
||||
<span class="description customize-control-description">
|
||||
<?php
|
||||
echo sprintf(
|
||||
esc_html__( 'Note: Some icons may not be displayed here. You can see the full list of icons at %1$s.', 'abiz' ),
|
||||
sprintf( '<a href="http://fontawesome.io/icons/" rel="nofollow">%s</a>', esc_html__( 'http://fontawesome.io/icons/', 'abiz' ) )
|
||||
); ?>
|
||||
</span>
|
||||
<div class="input-group icp-container">
|
||||
<input data-placement="bottomRight" class="icp icp-auto" value="<?php if(!empty($value)) { echo esc_attr( $value );} ?>" type="text">
|
||||
<span class="input-group-addon">
|
||||
<i class="<?php echo esc_attr($value); ?>"></i>
|
||||
</span>
|
||||
</div>
|
||||
<?php get_template_part( $this->customizer_icon_container ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function image_control($value = '', $show = '', $class='', $auto='', $sections=''){
|
||||
if($auto==1)
|
||||
{
|
||||
$auto="one";
|
||||
}
|
||||
|
||||
if($auto==2)
|
||||
{
|
||||
$auto="two";
|
||||
}
|
||||
if($auto==3)
|
||||
{
|
||||
$auto="three";
|
||||
}
|
||||
if($auto==4)
|
||||
{
|
||||
$auto="four";
|
||||
}
|
||||
?>
|
||||
<div class="customizer-repeater-image-control" <?php if( $show === 'customizer_repeater_icon' || $show === 'customizer_repeater_none' ) { echo esc_attr('style="display:none;"'); } ?>>
|
||||
<span class="customize-control-title">
|
||||
<?php esc_html_e('Image','abiz')?>
|
||||
</span>
|
||||
<input type="text" class="widefat custom-media-url <?php if($class="abiz_overlimit") { echo esc_attr('abiz-uploading-img');}?> <?php echo esc_attr($auto);?>" value="<?php echo esc_attr( $value ); ?>">
|
||||
<input type="button" class="button button-secondary customizer-repeater-custom-media-button <?php if($class="abiz_overlimit") { echo esc_attr('abiz-uploading-img-btn');}?> <?php echo esc_attr($auto);?>" value="<?php esc_attr_e( 'Upload Image','abiz' ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function align($value='left'){?>
|
||||
|
||||
<span class="customize-control-title">
|
||||
<?php esc_html_e('Align','abiz'); ?>
|
||||
</span>
|
||||
<select class="customizer-repeater-align">
|
||||
<option value="left" <?php selected($value,'left');?>>
|
||||
<?php esc_html_e('Left','abiz') ?>
|
||||
</option>
|
||||
|
||||
<option value="right" <?php selected($value,'right');?>>
|
||||
<?php esc_html_e('Right','abiz') ?>
|
||||
</option>
|
||||
|
||||
<option value="center" <?php selected($value,'center');?>>
|
||||
<?php esc_html_e('Center','abiz') ?>
|
||||
</option>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
private function icon_type_choice($value='customizer_repeater_icon', $abiz_limit=''){ ?>
|
||||
<span class="customize-control-title">
|
||||
<?php esc_html_e('Image type','abiz');?>
|
||||
</span>
|
||||
<select class="customizer-repeater-image-choice <?php echo esc_attr($abiz_limit);?>">
|
||||
<option value="customizer_repeater_icon" <?php selected($value,'customizer_repeater_icon');?>><?php esc_html_e('Icon','abiz'); ?></option>
|
||||
<option value="customizer_repeater_image" <?php selected($value,'customizer_repeater_image');?>><?php esc_html_e('Image','abiz'); ?></option>
|
||||
<option value="customizer_repeater_none" <?php selected($value,'customizer_repeater_none');?>><?php esc_html_e('None','abiz'); ?></option>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function repeater_control($value = '', $abiz_limit='', $abiz_type_with_id=''){
|
||||
$social_repeater = array();
|
||||
$show_del = 0; ?>
|
||||
<span class="customize-control-title"><?php esc_html_e( 'Social icons', 'abiz' ); ?></span>
|
||||
<?php
|
||||
if(!empty($value)) {
|
||||
$social_repeater = json_decode( html_entity_decode( $value ), true );
|
||||
}
|
||||
if ( ( count( $social_repeater ) == 1 && '' === $social_repeater[0] ) || empty( $social_repeater ) ) { ?>
|
||||
<div class="customizer-repeater-social-repeater">
|
||||
<div class="customizer-repeater-social-repeater-container">
|
||||
<div class="customizer-repeater-rc input-group icp-container">
|
||||
<input data-placement="bottomRight" class="icp icp-auto" value="<?php if(!empty($value)) { echo esc_attr( $value ); } ?>" type="text">
|
||||
<span class="input-group-addon"></span>
|
||||
</div>
|
||||
<?php get_template_part( $this->customizer_icon_container ); ?>
|
||||
<input type="text" class="customizer-repeater-social-repeater-link team_linkdata_<?php echo $abiz_limit;?> <?php echo esc_attr($abiz_type_with_id);?>"
|
||||
placeholder="<?php esc_attr_e( 'Link', 'abiz' ); ?>">
|
||||
<input type="hidden" class="customizer-repeater-social-repeater-id" value="">
|
||||
<button class="social-repeater-remove-social-item" style="display:none">
|
||||
<?php esc_html_e( 'Remove Icon', 'abiz' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" id="social-repeater-socials-repeater-colector" class="social-repeater-socials-repeater-colector" value=""/>
|
||||
</div>
|
||||
<button class="social-repeater-add-social-item button-secondary "><?php esc_html_e( 'Add Icon', 'abiz' ); ?></button>
|
||||
<?php
|
||||
} else { ?>
|
||||
<div class="customizer-repeater-social-repeater">
|
||||
<?php
|
||||
foreach ( $social_repeater as $social_icon ) {
|
||||
$show_del ++; ?>
|
||||
<div class="customizer-repeater-social-repeater-container">
|
||||
<div class="customizer-repeater-rc input-group icp-container">
|
||||
<input data-placement="bottomRight" class="icp icp-auto team_data_<?php echo esc_attr($abiz_limit);?> <?php echo esc_attr($abiz_type_with_id);?>" value="<?php if( !empty($social_icon['icon']) ) { echo esc_attr( $social_icon['icon'] ); } ?>" type="text">
|
||||
<span class="input-group-addon"><i class="<?php echo esc_attr( $social_icon['icon'] ); ?>"></i></span>
|
||||
</div>
|
||||
<?php get_template_part( $this->customizer_icon_container ); ?>
|
||||
<input type="text" class="customizer-repeater-social-repeater-link"
|
||||
placeholder="<?php esc_attr_e( 'Link', 'abiz' ); ?>"
|
||||
value="<?php if ( ! empty( $social_icon['link'] ) ) {
|
||||
echo esc_url( $social_icon['link'] );
|
||||
} ?>">
|
||||
<input type="hidden" class="customizer-repeater-social-repeater-id"
|
||||
value="<?php if ( ! empty( $social_icon['id'] ) ) {
|
||||
echo esc_attr( $social_icon['id'] );
|
||||
} ?>">
|
||||
<button class="social-repeater-remove-social-item"
|
||||
style="<?php if ( $show_del == 1 ) {
|
||||
echo esc_attr("display:none");
|
||||
} ?>"><?php esc_html_e( 'Remove Icon', 'abiz' ); ?></button>
|
||||
</div>
|
||||
<?php
|
||||
} ?>
|
||||
<input type="hidden" id="social-repeater-socials-repeater-colector"
|
||||
class="social-repeater-socials-repeater-colector"
|
||||
value="<?php echo esc_textarea( html_entity_decode( $value ) ); ?>" />
|
||||
</div>
|
||||
<button class="social-repeater-add-social-item button-secondary <?php echo esc_attr($abiz_limit);?> <?php echo esc_attr($abiz_type_with_id);?>"><?php esc_html_e( 'Add Icon', 'abiz' ); ?></button>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
.customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customizer-repeater-customize-control-title {
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
font-size: 1em;
|
||||
line-height: 1;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #23282d;
|
||||
border: 1px solid #e5e5e5;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.customizer-repeater-customize-control-title:hover {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.customizer-repeater-customize-control-title:after {
|
||||
content: "\f140";
|
||||
font-family: dashicons;
|
||||
font-size: 20px;
|
||||
height: 13px;
|
||||
bottom: 3px;
|
||||
position: relative;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.customizer-repeater-customize-control-title.repeater-expanded:after {
|
||||
content: "\f142";
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden {
|
||||
border: 1px solid #e5e5e5;
|
||||
border-top: none;
|
||||
padding: 1px 10px 10px;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden > div {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden .customize-control-title {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
font-weight: normal;
|
||||
margin-bottom: 0;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden .customize-control-title:after {
|
||||
content: ":";
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden span.description {
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.customizer-repeater-general-control-repeater-container, .customizer-repeater-general-control-repeater_container {
|
||||
border: 1px solid #e5e5e5;
|
||||
border-top: none;
|
||||
margin-bottom: 12px;
|
||||
width: 100%;
|
||||
float: left;
|
||||
background: #fff;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden .wp-picker-container, .customizer-repeater-box-content-hidden .wp-picker-container .wp-color-result, .icp-container {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden input:not(.icp, .wp-color-picker),
|
||||
.customizer-repeater-box-content-hidden textarea,
|
||||
.customizer-repeater-box-content-hidden .wp-picker-container {
|
||||
margin-bottom: 1em !important;
|
||||
}
|
||||
|
||||
.social-repeater-general-control-remove-field {
|
||||
cursor: pointer;
|
||||
color: #a00;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.social-repeater-general-control-remove-field:hover {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden .wp-picker-holder {
|
||||
position: relative;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden .wp-picker-input-wrap {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden .wp-picker-container .iris-picker {
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
button.customizer-repeater-new-field {
|
||||
float: right;
|
||||
}
|
||||
|
||||
button.customizer-repeater-new-field:before {
|
||||
content: "\f132";
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
left: -2px;
|
||||
top: -1px;
|
||||
font: 400 20px/1 dashicons;
|
||||
vertical-align: middle;
|
||||
-webkit-transition: all .2s;
|
||||
transition: all .2s;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden > div.customizer-repeater-social-repeater {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.customizer-repeater-general-control-repeater-container .customizer-repeater-icon-control {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#customizer-repeater-new-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customize-control-widget_form .widget-control-save {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.customizer-repeater-image-control .customizer-repeater-custom-media-button {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.customizer-icons {
|
||||
display: inline-block;
|
||||
padding: 0 10px 0 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.social-repeater-remove-social-item {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
color: #a00;
|
||||
border: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.social-repeater-remove-social-item:hover {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.customizer-repeater-social-repeater > .customizer-repeater-social-repeater-container:not(:first-child) {
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.icp-container {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.button-secondary.social-repeater-add-social-item:before {
|
||||
content: "\f132";
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
left: -2px;
|
||||
top: -1px;
|
||||
font: 400 20px/1 dashicons;
|
||||
vertical-align: middle;
|
||||
-webkit-transition: all .2s;
|
||||
transition: all .2s;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.button-secondary.social-repeater-add-social-item {
|
||||
vertical-align: text-top;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.customizer-repeater-box-content-hidden textarea {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
.iconpicker .iconpicker-items,
|
||||
.iconpicker .iconpicker-items:after,
|
||||
.iconpicker-popover .popover-footer:after,
|
||||
.iconpicker:after {
|
||||
clear: both
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover {
|
||||
position: absolute;
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
background: #e5e5e5;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
margin-left: -10px;
|
||||
width: 254px
|
||||
}
|
||||
|
||||
.iconpicker,
|
||||
.iconpicker-popover.popover.iconpicker-visible {
|
||||
display: block
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover .popover-title {
|
||||
padding: 5px;
|
||||
font-size: 5px;
|
||||
line-height: 16px;
|
||||
border-bottom: 1px solid #ebebeb;
|
||||
background-color: #e5e5e5
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search {
|
||||
margin: 0 0 2px
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover .popover-title-text~input[type=search].iconpicker-search {
|
||||
margin-top: 14px
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover .popover-content {
|
||||
padding: 0;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover>.arrow,
|
||||
.iconpicker-popover.popover>.arrow:after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid
|
||||
}
|
||||
|
||||
.iconpicker *,
|
||||
.icp-container {
|
||||
position: relative
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover>.arrow {
|
||||
border-width: 11px
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover>.arrow:after {
|
||||
border-width: 10px;
|
||||
content: ""
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover.bottomLeft>.arrow {
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #e5e5e5;
|
||||
top: -11px
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover.bottomLeft>.arrow:after {
|
||||
content: " ";
|
||||
top: 1px;
|
||||
margin-left: -10px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #e5e5e5
|
||||
}
|
||||
|
||||
.iconpicker-popover.popover.bottomLeft>.arrow {
|
||||
left: 14px;
|
||||
margin-left: 0
|
||||
}
|
||||
|
||||
.iconpicker,
|
||||
.iconpicker .iconpicker-items {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
overflow: hidden
|
||||
}
|
||||
|
||||
.iconpicker {
|
||||
text-align: left;
|
||||
text-shadow: none;
|
||||
line-height: 0
|
||||
}
|
||||
|
||||
.iconpicker .iconpicker-items:after,
|
||||
.iconpicker .iconpicker-items:before,
|
||||
.iconpicker:after,
|
||||
.iconpicker:before {
|
||||
content: " ";
|
||||
display: table
|
||||
}
|
||||
|
||||
.iconpicker * {
|
||||
box-sizing: content-box
|
||||
}
|
||||
|
||||
.iconpicker .iconpicker-items {
|
||||
float: none;
|
||||
padding: 5px 0 0 5px;
|
||||
background: #fff;
|
||||
overflow-y: auto;
|
||||
min-height: 55px;
|
||||
max-height: 275px
|
||||
}
|
||||
|
||||
.iconpicker .iconpicker-items i {
|
||||
float: left;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
margin: 0 7px 7px 0;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
color: #444;
|
||||
box-shadow: 0 0 0 1px #ddd;
|
||||
transition: transform .2s ease
|
||||
}
|
||||
|
||||
.iconpicker .iconpicker-items i:nth-child(6n) {
|
||||
margin-right: 0
|
||||
}
|
||||
|
||||
.iconpicker .iconpicker-items i:hover {
|
||||
transform: scale(1.4);
|
||||
color: #008ec2;
|
||||
box-shadow: none
|
||||
}
|
||||
|
||||
.icp {
|
||||
padding-left: 30px
|
||||
}
|
||||
|
||||
.icp-container .input-group-addon {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 5px;
|
||||
padding: 3px
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.iconpicker .iconpicker-items,.iconpicker .iconpicker-items:after,.iconpicker-popover .popover-footer:after,.iconpicker:after{clear:both}.iconpicker-popover.popover{position:absolute;padding:1px;text-align:left;background:#e5e5e5;z-index:999;display:none;margin-left:-10px;width:254px}.iconpicker,.iconpicker-popover.popover.iconpicker-visible{display:block}.iconpicker-popover.popover .popover-title{padding:5px;font-size:5px;line-height:16px;border-bottom:1px solid #ebebeb;background-color:#e5e5e5}.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search{margin:0 0 2px}.iconpicker-popover.popover .popover-title-text~input[type=search].iconpicker-search{margin-top:14px}.iconpicker-popover.popover .popover-content{padding:0;text-align:center}.iconpicker-popover.popover>.arrow,.iconpicker-popover.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.iconpicker *,.icp-container{position:relative}.iconpicker-popover.popover>.arrow{border-width:11px}.iconpicker-popover.popover>.arrow:after{border-width:10px;content:""}.iconpicker-popover.popover.bottomLeft>.arrow{border-top-width:0;border-bottom-color:#e5e5e5;top:-11px}.iconpicker-popover.popover.bottomLeft>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#e5e5e5}.iconpicker-popover.popover.bottomLeft>.arrow{left:14px;margin-left:0}.iconpicker,.iconpicker .iconpicker-items{position:relative;margin:0;overflow:hidden}.iconpicker{text-align:left;text-shadow:none;line-height:0}.iconpicker .iconpicker-items:after,.iconpicker .iconpicker-items:before,.iconpicker:after,.iconpicker:before{content:" ";display:table}.iconpicker *{box-sizing:content-box}.iconpicker .iconpicker-items{float:none;padding:5px 0 0 5px;background:#fff;overflow-y:auto;min-height:55px;max-height:275px}.iconpicker .iconpicker-items i{float:left;width:32px;height:32px;line-height:32px;margin:0 7px 7px 0;text-align:center;cursor:pointer;border-radius:3px;font-size:18px;color:#444;box-shadow:0 0 0 1px #ddd;transition:transform .2s ease}.iconpicker .iconpicker-items i:nth-child(6n){margin-right:0}.iconpicker .iconpicker-items i:hover{transform:scale(1.4);color:#008ec2;box-shadow:none}.icp{padding-left:30px !important}.icp-container .input-group-addon{position:absolute;top:1px;left:5px;padding:3px}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
function abiz_repeater_register( $wp_customize ) {
|
||||
|
||||
require_once ABIZ_THEME_CORE_DIR . '/customizer/customizer-repeater/class/customizer-repeater-control.php';
|
||||
|
||||
}
|
||||
add_action( 'customize_register', 'abiz_repeater_register' );
|
||||
|
||||
function abiz_repeater_sanitize($input){
|
||||
$input_decoded = json_decode($input,true);
|
||||
|
||||
if(!empty($input_decoded)) {
|
||||
foreach ($input_decoded as $boxk => $box ){
|
||||
foreach ($box as $key => $value){
|
||||
|
||||
switch ( $key ) {
|
||||
case 'icon_value':
|
||||
$input_decoded[$boxk][$key] = wp_kses_post( force_balance_tags( $value ) );
|
||||
break;
|
||||
|
||||
case 'link':
|
||||
$input_decoded[$boxk][$key] = esc_url_raw( $value );
|
||||
break;
|
||||
|
||||
default:
|
||||
$input_decoded[$boxk][$key] = wp_kses_post( force_balance_tags( $value ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return json_encode($input_decoded);
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<div class="iconpicker-popover popover bottomLeft">
|
||||
<div class="arrow"></div>
|
||||
<div class="popover-title">
|
||||
<input type="search" class="form-control iconpicker-search" placeholder="Type to filter">
|
||||
</div>
|
||||
<div class="popover-content">
|
||||
<div class="iconpicker">
|
||||
<div class="iconpicker-items">
|
||||
<i data-type="iconpicker-item" title=".fa-behance" class="fab fa-behance" data-icon=""></i>
|
||||
<i data-type="iconpicker-item" title=".fa-behance-square" class="fab fa-behance-square"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-facebook-f" class="fab fa-facebook-f"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-facebook-square" class="fab fa-facebook-square"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-google-plus-g" class="fab fa-google-plus-g"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-google-plus-square" class="fab fa-google-plus-square"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-linkedin-in" class="fab fa-linkedin-in"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-linkedin" class="fab fa-linkedin"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-twitter" class="fab fa-twitter"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-twitter-square" class="fab fa-twitter-square"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-vimeo-v" class="fab fa-vimeo-v"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-vimeo-square" class="fab fa-vimeo-square"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-youtube" class="fab fa-youtube"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-youtube-square" class="fab fa-youtube-square"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-ambulance" class="fas fa-ambulance"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-american-sign-language-interpreting" class="fas fa-american-sign-language-interpreting"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-anchor" class="fas fa-anchor"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-android" class="fab fa-android"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-apple" class="fab fa-apple"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-archive" class="fas fa-archive"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-chart-area" class="fas fa-chart-area"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-asterisk" class="fas fa-asterisk"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-car" class="fas fa-car"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-balance-scale" class="fas fa-balance-scale"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-ban" class="fas fa-ban"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-university" class="fas fa-university"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-bicycle" class="fas fa-bicycle"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-birthday-cake" class="fas fa-birthday-cake"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-btc" class="fab fa-btc"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-black-tie" class="fab fa-black-tie"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-bookmark" class="fas fa-bookmark"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-briefcase" class="fas fa-briefcase"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-bus" class="fas fa-bus"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-taxi" class="fas fa-taxi"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-camera" class="fas fa-camera"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-check" class="fas fa-check"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-child" class="fas fa-child"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-code" class="fas fa-code"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-coffee" class="fas fa-coffee"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-cog" class="fas fa-cog"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-comment-dots" class="fas fa-comment-dots"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-cube" class="fas fa-cube"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-dollar-sign" class="fas fa-dollar-sign"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-gem" class="far fa-gem"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-envelope" class="fas fa-envelope"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-female" class="fas fa-female"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-fire-extinguisher" class="fas fa-fire-extinguisher"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-glass-martini" class="fas fa-glass-martini"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-globe" class="fas fa-globe"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-graduation-cap" class="fas fa-graduation-cap"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-heartbeat" class="fas fa-heartbeat"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-heart" class="fas fa-heart"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-bed" class="fas fa-bed"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-hourglass" class="fas fa-hourglass"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-home" class="fas fa-home"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-gavel" class="fas fa-gavel"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-lock" class="fas fa-lock"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-map-signs" class="fas fa-map-signs"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-paint-brush" class="fas fa-paint-brush"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-plane" class="fas fa-plane"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-rocket" class="fas fa-rocket"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-puzzle-piece" class="fas fa-puzzle-piece"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-shield-alt" class="fas fa-shield-alt"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-tag" class="fas fa-tag"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-times" class="fas fa-times"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-unlock" class="fas fa-unlock"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-user" class="fas fa-user"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-user-md" class="fas fa-user-md"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-video" class="fas fa-video"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-wordpress" class="fab fa-wordpress"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-wrench" class="fas fa-wrench"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-chart-line" class="fas fa-chart-line"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-chart-area" class="fas fa-chart-area"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-signal" class="fas fa-signal"></i>
|
||||
<i data-type="iconpicker-item" title=".fa-500px" class="fab fa-500px"></i>
|
||||
</div> <!-- /.iconpicker-items -->
|
||||
</div> <!-- /.iconpicker -->
|
||||
</div> <!-- /.popover-content -->
|
||||
</div> <!-- /.iconpicker-popover -->
|
||||
@@ -0,0 +1,584 @@
|
||||
/* global jQuery */
|
||||
/* global wp */
|
||||
function abiz_media_upload(button_class) {
|
||||
'use strict';
|
||||
jQuery('body').on('click', button_class, function () {
|
||||
var button_id = '#' + jQuery(this).attr('id');
|
||||
var display_field = jQuery(this).parent().children('input:text');
|
||||
var _custom_media = true;
|
||||
|
||||
wp.media.editor.send.attachment = function (props, attachment) {
|
||||
|
||||
if (_custom_media) {
|
||||
if (typeof display_field !== 'undefined') {
|
||||
switch (props.size) {
|
||||
case 'full':
|
||||
display_field.val(attachment.sizes.full.url);
|
||||
display_field.trigger('change');
|
||||
break;
|
||||
case 'medium':
|
||||
display_field.val(attachment.sizes.medium.url);
|
||||
display_field.trigger('change');
|
||||
break;
|
||||
case 'thumbnail':
|
||||
display_field.val(attachment.sizes.thumbnail.url);
|
||||
display_field.trigger('change');
|
||||
break;
|
||||
default:
|
||||
display_field.val(attachment.url);
|
||||
display_field.trigger('change');
|
||||
}
|
||||
}
|
||||
_custom_media = false;
|
||||
} else {
|
||||
return wp.media.editor.send.attachment(button_id, [props, attachment]);
|
||||
}
|
||||
};
|
||||
wp.media.editor.open(button_class);
|
||||
window.send_to_editor = function (html) {
|
||||
|
||||
};
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/********************************************
|
||||
*** Generate unique id ***
|
||||
*********************************************/
|
||||
function abiz_customizer_repeater_uniqid(prefix, more_entropy) {
|
||||
'use strict';
|
||||
if (typeof prefix === 'undefined') {
|
||||
prefix = '';
|
||||
}
|
||||
|
||||
var retId;
|
||||
var php_js;
|
||||
var formatSeed = function (seed, reqWidth) {
|
||||
seed = parseInt(seed, 10)
|
||||
.toString(16); // to hex str
|
||||
if (reqWidth < seed.length) { // so long we split
|
||||
return seed.slice(seed.length - reqWidth);
|
||||
}
|
||||
if (reqWidth > seed.length) { // so short we pad
|
||||
return new Array(1 + (reqWidth - seed.length))
|
||||
.join('0') + seed;
|
||||
}
|
||||
return seed;
|
||||
};
|
||||
|
||||
// BEGIN REDUNDANT
|
||||
if (!php_js) {
|
||||
php_js = {};
|
||||
}
|
||||
// END REDUNDANT
|
||||
if (!php_js.uniqidSeed) { // init seed with big random int
|
||||
php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
|
||||
}
|
||||
php_js.uniqidSeed++;
|
||||
|
||||
retId = prefix; // start with prefix, add current milliseconds hex string
|
||||
retId += formatSeed(parseInt(new Date()
|
||||
.getTime() / 1000, 10), 8);
|
||||
retId += formatSeed(php_js.uniqidSeed, 5); // add seed hex string
|
||||
if (more_entropy) {
|
||||
// for more entropy we add a float lower to 10
|
||||
retId += (Math.random() * 10)
|
||||
.toFixed(8)
|
||||
.toString();
|
||||
}
|
||||
|
||||
return retId;
|
||||
}
|
||||
|
||||
|
||||
/********************************************
|
||||
*** General Repeater ***
|
||||
*********************************************/
|
||||
function abiz_customizer_repeater_refresh_social_icons(th) {
|
||||
'use strict';
|
||||
var icons_repeater_values = [];
|
||||
th.find('.customizer-repeater-social-repeater-container').each(function () {
|
||||
var icon = jQuery(this).find('.icp').val();
|
||||
var link = jQuery(this).find('.customizer-repeater-social-repeater-link').val();
|
||||
var id = jQuery(this).find('.customizer-repeater-social-repeater-id').val();
|
||||
|
||||
if (!id) {
|
||||
id = 'customizer-repeater-social-repeater-' + abiz_customizer_repeater_uniqid();
|
||||
jQuery(this).find('.customizer-repeater-social-repeater-id').val(id);
|
||||
}
|
||||
|
||||
if (icon !== '' && link !== '') {
|
||||
icons_repeater_values.push({
|
||||
'icon': icon,
|
||||
'link': link,
|
||||
'id': id
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
th.find('.social-repeater-socials-repeater-colector').val(JSON.stringify(icons_repeater_values));
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
}
|
||||
|
||||
|
||||
function abiz_customizer_repeater_refresh_general_control_values() {
|
||||
'use strict';
|
||||
jQuery('.customizer-repeater-general-control-repeater').each(function () {
|
||||
var values = [];
|
||||
var th = jQuery(this);
|
||||
th.find('.customizer-repeater-general-control-repeater-container').each(function () {
|
||||
|
||||
var icon_value = jQuery(this).find('.icp').val();
|
||||
var text = jQuery(this).find('.customizer-repeater-text-control').val();
|
||||
var link = jQuery(this).find('.customizer-repeater-link-control').val();
|
||||
var text2 = jQuery(this).find('.customizer-repeater-text2-control').val();
|
||||
var link2 = jQuery(this).find('.customizer-repeater-link2-control').val();
|
||||
var link3 = jQuery(this).find('.customizer-repeater-link3-control').val();
|
||||
var color = jQuery(this).find('input.customizer-repeater-color-control').val();
|
||||
var color2 = jQuery(this).find('input.customizer-repeater-color2-control').val();
|
||||
var image_url = jQuery(this).find('.custom-media-url').val();
|
||||
var choice = jQuery(this).find('.customizer-repeater-image-choice').val();
|
||||
var title = jQuery(this).find('.customizer-repeater-title-control').val();
|
||||
var subtitle = jQuery(this).find('.customizer-repeater-subtitle-control').val();
|
||||
var subtitle2 = jQuery(this).find('.customizer-repeater-subtitle2-control').val();
|
||||
var btn3 = jQuery(this).find('.customizer-repeater-btn3-control').val();
|
||||
var button_second = jQuery(this).find('.customizer-repeater-button2-control').val();
|
||||
var align = jQuery(this).find('.customizer-repeater-align').val();
|
||||
var open_new_tab = jQuery(this).find('.customizer-repeater-checkbox').attr("checked") ? 'yes' : 'no';
|
||||
var id = jQuery(this).find('.social-repeater-box-id').val();
|
||||
if (!id) {
|
||||
id = 'social-repeater-' + abiz_customizer_repeater_uniqid();
|
||||
jQuery(this).find('.social-repeater-box-id').val(id);
|
||||
}
|
||||
var social_repeater = jQuery(this).find('.social-repeater-socials-repeater-colector').val();
|
||||
var shortcode = jQuery(this).find('.customizer-repeater-shortcode-control').val();
|
||||
|
||||
if (text !== '' || image_url !== '' || title !== '' || subtitle !== '' || subtitle2 !== '' || btn3 !== '' || icon_value !== '' || link !== '' || choice !== '' || social_repeater !== '' || shortcode !== '' || align !== '' || color !== '') {
|
||||
values.push({
|
||||
'icon_value': (choice === 'customizer_repeater_none' ? '' : icon_value),
|
||||
'color': color,
|
||||
'color2': color2,
|
||||
'text': abizescapeHtml(text),
|
||||
'link': link,
|
||||
'text2': abizescapeHtml(text2),
|
||||
'button_second': abizescapeHtml(button_second),
|
||||
'link2': link2,
|
||||
'link3': link3,
|
||||
'image_url': (choice === 'customizer_repeater_none' ? '' : image_url),
|
||||
'choice': choice,
|
||||
'title': abizescapeHtml(title),
|
||||
'subtitle': abizescapeHtml(subtitle),
|
||||
'subtitle2': abizescapeHtml(subtitle2),
|
||||
'btn3': abizescapeHtml(btn3),
|
||||
'align': abizescapeHtml(align),
|
||||
'open_new_tab' : open_new_tab,
|
||||
'social_repeater': abizescapeHtml(social_repeater),
|
||||
'id': id,
|
||||
'shortcode': abizescapeHtml(shortcode)
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
th.find('.customizer-repeater-colector').val(JSON.stringify(values));
|
||||
th.find('.customizer-repeater-colector').trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
'use strict';
|
||||
var abiz_theme_controls = jQuery('#customize-theme-controls');
|
||||
abiz_theme_controls.on('click', '.customizer-repeater-customize-control-title', function () {
|
||||
jQuery(this).next().slideToggle('medium', function () {
|
||||
if (jQuery(this).is(':visible')){
|
||||
jQuery(this).prev().addClass('repeater-expanded');
|
||||
jQuery(this).css('display', 'block');
|
||||
} else {
|
||||
jQuery(this).prev().removeClass('repeater-expanded');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('change', '.icp',function(){
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
return false;
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('change','.customizer-repeater-align', function(){
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('change', '.customizer-repeater-image-choice', function () {
|
||||
if (jQuery(this).val() === 'customizer_repeater_image') {
|
||||
jQuery(this).parent().parent().find('.social-repeater-general-control-icon').hide();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-image-control').show();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-color-control').prev().prev().hide();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-color-control').hide();
|
||||
|
||||
}
|
||||
if (jQuery(this).val() === 'customizer_repeater_icon') {
|
||||
jQuery(this).parent().parent().find('.social-repeater-general-control-icon').show();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-image-control').hide();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-color-control').prev().prev().show();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-color-control').show();
|
||||
}
|
||||
if (jQuery(this).val() === 'customizer_repeater_none') {
|
||||
jQuery(this).parent().parent().find('.social-repeater-general-control-icon').hide();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-image-control').hide();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-color-control').prev().prev().hide();
|
||||
jQuery(this).parent().parent().find('.customizer-repeater-color-control').hide();
|
||||
}
|
||||
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
return false;
|
||||
});
|
||||
abiz_media_upload('.customizer-repeater-custom-media-button');
|
||||
jQuery('.custom-media-url').on('change', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
return false;
|
||||
});
|
||||
|
||||
var color_options = {
|
||||
change: function(event, ui){
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This adds a new box to repeater
|
||||
*
|
||||
*/
|
||||
abiz_theme_controls.on('click', '.customizer-repeater-new-field', function () {
|
||||
// Usable For Free Theme Only
|
||||
var parentid = jQuery(this).parent().attr("id");
|
||||
|
||||
if(parentid == 'customize-control-hdr_social_icons')
|
||||
{
|
||||
var numItems = jQuery("#customize-control-hdr_social_icons .customizer-repeater-general-control-repeater-container").length
|
||||
if(numItems >= 4){
|
||||
jQuery( "#customize-control-abiz_social_icon_upgrade .flixita-upgrade-pro-message" ).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(parentid == 'customize-control-footer_top_info')
|
||||
{
|
||||
var numItems = jQuery("#customize-control-footer_top_info .customizer-repeater-general-control-repeater-container").length
|
||||
if(numItems >= 4){
|
||||
jQuery( "#customize-control-abiz_footer_top_info_upgrade .flixita-upgrade-pro-message" ).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(parentid == 'customize-control-slider')
|
||||
{
|
||||
var numItems = jQuery("#customize-control-slider .customizer-repeater-general-control-repeater-container").length
|
||||
if(numItems >= 3){
|
||||
jQuery( "#customize-control-abiz_slider_upgrade .flixita-upgrade-pro-message" ).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(parentid == 'customize-control-info_data')
|
||||
{
|
||||
var numItems = jQuery("#customize-control-info_data .customizer-repeater-general-control-repeater-container").length
|
||||
if(numItems >= 4){
|
||||
jQuery( "#customize-control-abiz_info_upgrade .flixita-upgrade-pro-message" ).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(parentid == 'customize-control-service_data')
|
||||
{
|
||||
var numItems = jQuery("#customize-control-service_data .customizer-repeater-general-control-repeater-container").length
|
||||
if(numItems >= 4){
|
||||
jQuery( "#customize-control-abiz_service_upgrade .flixita-upgrade-pro-message" ).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(parentid == 'customize-control-features2_data')
|
||||
{
|
||||
var numItems = jQuery("#customize-control-features2_data .customizer-repeater-general-control-repeater-container").length
|
||||
if(numItems >= 8){
|
||||
jQuery( "#customize-control-abiz_features_upgrade .flixita-upgrade-pro-message" ).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var th = jQuery(this).parent();
|
||||
var id = 'customizer-repeater-' + abiz_customizer_repeater_uniqid();
|
||||
|
||||
if (typeof th !== 'undefined') {
|
||||
/* Clone the first box*/
|
||||
var field = th.find('.customizer-repeater-general-control-repeater-container:first').clone( true, true );
|
||||
|
||||
if (typeof field !== 'undefined') {
|
||||
/*Set the default value for choice between image and icon to icon*/
|
||||
field.find('.customizer-repeater-image-choice').val('customizer_repeater_icon');
|
||||
|
||||
/*Show icon selector*/
|
||||
field.find('.social-repeater-general-control-icon').show();
|
||||
|
||||
/*Hide image selector*/
|
||||
if (field.find('.social-repeater-general-control-icon').length > 0) {
|
||||
field.find('.customizer-repeater-image-control').hide();
|
||||
}
|
||||
|
||||
/*Show delete box button because it's not the first box*/
|
||||
field.find('.social-repeater-general-control-remove-field').show();
|
||||
|
||||
/* Empty control for icon */
|
||||
field.find('.input-group-addon').find('.fa').attr('class', 'fa');
|
||||
|
||||
|
||||
/*Remove all repeater fields except first one*/
|
||||
|
||||
field.find('.customizer-repeater-social-repeater').find('.customizer-repeater-social-repeater-container').not(':first').remove();
|
||||
field.find('.customizer-repeater-social-repeater-link').val('');
|
||||
field.find('.social-repeater-socials-repeater-colector').val('');
|
||||
|
||||
/*Remove value from icon field*/
|
||||
field.find('.icp').val('');
|
||||
|
||||
/*Remove value from text field*/
|
||||
field.find('.customizer-repeater-text-control').val('');
|
||||
|
||||
/*Remove value from link field*/
|
||||
field.find('.customizer-repeater-link-control').val('');
|
||||
|
||||
/*Remove value from text field*/
|
||||
field.find('.customizer-repeater-text2-control').val('');
|
||||
|
||||
/*Remove value from button field*/
|
||||
field.find('.customizer-repeater-button2-control').val('');
|
||||
|
||||
/*Remove value from link field*/
|
||||
field.find('.customizer-repeater-link2-control').val('');
|
||||
|
||||
/*Remove value from link field*/
|
||||
field.find('.customizer-repeater-link3-control').val('');
|
||||
|
||||
/*Set the default value in slide align*/
|
||||
field.find('.customizer-repeater-align').val('left');
|
||||
|
||||
/*Set the default value in checkbox*/
|
||||
field.find('.customizer-repeater-checkbox').val('');
|
||||
|
||||
/*Set box id*/
|
||||
field.find('.social-repeater-box-id').val(id);
|
||||
|
||||
/*Remove value from media field*/
|
||||
field.find('.custom-media-url').val('');
|
||||
|
||||
/*Remove value from title field*/
|
||||
field.find('.customizer-repeater-title-control').val('');
|
||||
|
||||
|
||||
/*Remove value from color field*/
|
||||
field.find('div.customizer-repeater-color-control .wp-picker-container').replaceWith('<input type="text" class="customizer-repeater-color-control ' + id + '">');
|
||||
field.find('input.customizer-repeater-color-control').wpColorPicker(color_options);
|
||||
|
||||
|
||||
field.find('div.customizer-repeater-color2-control .wp-picker-container').replaceWith('<input type="text" class="customizer-repeater-color2-control ' + id + '">');
|
||||
field.find('input.customizer-repeater-color2-control').wpColorPicker(color_options);
|
||||
|
||||
// field.find('.customize-control-notifications-container').remove();
|
||||
|
||||
|
||||
/*Remove value from subtitle field*/
|
||||
field.find('.customizer-repeater-subtitle-control').val('');
|
||||
|
||||
/*Remove value from subtitle field*/
|
||||
field.find('.customizer-repeater-subtitle2-control').val('');
|
||||
|
||||
|
||||
/*Remove value from subtitle field*/
|
||||
field.find('.customizer-repeater-btn3-control').val('');
|
||||
|
||||
/*Remove value from shortcode field*/
|
||||
field.find('.customizer-repeater-shortcode-control').val('');
|
||||
|
||||
/*Append new box*/
|
||||
th.find('.customizer-repeater-general-control-repeater-container:first').parent().append(field);
|
||||
|
||||
/*Refresh values*/
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
abiz_theme_controls.on('click', '.social-repeater-general-control-remove-field', function () {
|
||||
if (typeof jQuery(this).parent() !== 'undefined') {
|
||||
jQuery(this).parent().hide(500, function(){
|
||||
var main_social_items = jQuery("#customize-control-hdr_social_icons .customizer-repeater-general-control-repeater-container").length
|
||||
if(main_social_items <= 4){
|
||||
jQuery( "#customize-control-abiz_social_icon_upgrade .flixita-upgrade-pro-message" ).hide();
|
||||
}
|
||||
|
||||
var main_footer_top_items = jQuery("#customize-control-footer_top_info .customizer-repeater-general-control-repeater-container").length
|
||||
if(main_footer_top_items <= 4){
|
||||
jQuery( "#customize-control-abiz_footer_top_info_upgrade .flixita-upgrade-pro-message" ).hide();
|
||||
}
|
||||
|
||||
var main_slider_items = jQuery("#customize-control-slider .customizer-repeater-general-control-repeater-container").length
|
||||
if(main_slider_items <= 3){
|
||||
jQuery( "#customize-control-abiz_slider_upgrade .flixita-upgrade-pro-message" ).hide();
|
||||
}
|
||||
|
||||
var main_info_items = jQuery("#customize-control-info_data .customizer-repeater-general-control-repeater-container").length
|
||||
if(main_info_items <= 4){
|
||||
jQuery( "#customize-control-abiz_info_upgrade .flixita-upgrade-pro-message" ).hide();
|
||||
}
|
||||
|
||||
var main_service_items = jQuery("#customize-control-service_data .customizer-repeater-general-control-repeater-container").length
|
||||
if(main_service_items <= 4){
|
||||
jQuery( "#customize-control-abiz_service_upgrade .flixita-upgrade-pro-message" ).hide();
|
||||
}
|
||||
|
||||
var main_features_items = jQuery("#customize-control-features2_data .customizer-repeater-general-control-repeater-container").length
|
||||
if(main_features_items <= 8){
|
||||
jQuery( "#customize-control-abiz_features_upgrade .flixita-upgrade-pro-message" ).hide();
|
||||
}
|
||||
|
||||
jQuery(this).parent().remove();
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-title-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
jQuery('input.customizer-repeater-color-control').wpColorPicker(color_options);
|
||||
jQuery('input.customizer-repeater-color2-control').wpColorPicker(color_options);
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-subtitle-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-subtitle2-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-btn3-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-shortcode-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-text-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-link-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-text2-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-button2-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-link2-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-link3-control', function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('change','.customizer-repeater-checkbox', function(){
|
||||
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
});
|
||||
|
||||
/*Drag and drop to change icons order*/
|
||||
|
||||
jQuery('.customizer-repeater-general-control-droppable').sortable({
|
||||
axis: 'y',
|
||||
update: function () {
|
||||
abiz_customizer_repeater_refresh_general_control_values();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*----------------- Socials Repeater ---------------------*/
|
||||
abiz_theme_controls.on('click', '.social-repeater-add-social-item', function (event) {
|
||||
event.preventDefault();
|
||||
var th = jQuery(this).parent();
|
||||
var id = 'customizer-repeater-social-repeater-' + abiz_customizer_repeater_uniqid();
|
||||
if (typeof th !== 'undefined') {
|
||||
var field = th.find('.customizer-repeater-social-repeater-container:first').clone( true, true );
|
||||
if (typeof field !== 'undefined') {
|
||||
field.find( '.icp' ).val('');
|
||||
field.find( '.input-group-addon' ).find('.fa').attr('class','fa');
|
||||
field.find('.social-repeater-remove-social-item').show();
|
||||
field.find('.customizer-repeater-social-repeater-link').val('');
|
||||
field.find('.customizer-repeater-social-repeater-id').val(id);
|
||||
th.find('.customizer-repeater-social-repeater-container:first').parent().append(field);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('click', '.social-repeater-remove-social-item', function (event) {
|
||||
event.preventDefault();
|
||||
var th = jQuery(this).parent();
|
||||
var repeater = jQuery(this).parent().parent();
|
||||
th.remove();
|
||||
abiz_customizer_repeater_refresh_social_icons(repeater);
|
||||
return false;
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('keyup', '.customizer-repeater-social-repeater-link', function (event) {
|
||||
event.preventDefault();
|
||||
var repeater = jQuery(this).parent().parent();
|
||||
abiz_customizer_repeater_refresh_social_icons(repeater);
|
||||
return false;
|
||||
});
|
||||
|
||||
abiz_theme_controls.on('change', '.customizer-repeater-social-repeater-container .icp', function (event) {
|
||||
event.preventDefault();
|
||||
var repeater = jQuery(this).parent().parent().parent();
|
||||
abiz_customizer_repeater_refresh_social_icons(repeater);
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var abizentityMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
'\'': ''',
|
||||
'/': '/'
|
||||
};
|
||||
|
||||
function abizescapeHtml(string) {
|
||||
'use strict';
|
||||
//noinspection JSUnresolvedFunction
|
||||
string = String(string).replace(new RegExp('\r?\n', 'g'), '<br />');
|
||||
string = String(string).replace(/\\/g, '\');
|
||||
return String(string).replace(/[&<>"'\/]/g, function (s) {
|
||||
return abizentityMap[s];
|
||||
});
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
wp.abizcustomizerRepeater = {
|
||||
|
||||
init: function () {
|
||||
$('.iconpicker-items>i').on('click', function () {
|
||||
var iconClass = $(this).attr('class');
|
||||
var classInput = $(this).parents('.iconpicker-popover').prev().find('.icp');
|
||||
classInput.val(iconClass);
|
||||
classInput.attr('value', iconClass);
|
||||
|
||||
var iconPreview = classInput.next('.input-group-addon');
|
||||
var iconElement = '<i class="'.concat(iconClass, '"><\/i>');
|
||||
iconPreview.empty();
|
||||
iconPreview.append(iconElement);
|
||||
|
||||
var th = $(this).parent().parent().parent();
|
||||
classInput.trigger('change');
|
||||
abiz_customizer_repeater_refresh_social_icons(th);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
search: function ($searchField) {
|
||||
var itemsList = $searchField.parent().next().find('.iconpicker-items');
|
||||
var searchTerm = $searchField.val().toLowerCase();
|
||||
if (searchTerm.length > 0) {
|
||||
itemsList.children().each(function () {
|
||||
if ($(this).filter('[title*='.concat(searchTerm)).length > 0 || searchTerm.length < 1) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
itemsList.children().show();
|
||||
}
|
||||
},
|
||||
iconPickerToggle: function ($input) {
|
||||
var iconPicker = $input.parent().next();
|
||||
iconPicker.addClass('iconpicker-visible');
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
wp.abizcustomizerRepeater.init();
|
||||
|
||||
$('.iconpicker-search').on('keyup', function () {
|
||||
wp.abizcustomizerRepeater.search($(this));
|
||||
});
|
||||
|
||||
$('.icp-auto').on('click', function () {
|
||||
wp.abizcustomizerRepeater.iconPickerToggle($(this));
|
||||
});
|
||||
|
||||
$(document).mouseup( function (e) {
|
||||
var container = $('.iconpicker-popover');
|
||||
|
||||
if (!container.is(e.target)
|
||||
&& container.has(e.target).length === 0)
|
||||
{
|
||||
container.removeClass('iconpicker-visible');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
1
wp-content/themes/abiz/core/customizer/customizer-repeater/js/fontawesome-iconpicker.min.js
vendored
Normal file
1
wp-content/themes/abiz/core/customizer/customizer-repeater/js/fontawesome-iconpicker.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e){"use strict";wp.abizcustomizerRepeater={init:function(){e(".iconpicker-items>i").on("click",function(){var i=e(this).attr("class").slice(3),t=e(this).parents(".iconpicker-popover").prev().find(".icp");t.val(i),t.attr("value",i);var n=t.next(".input-group-addon"),c='<i class="fa '.concat(i,'"></i>');n.empty(),n.append(c);var r=e(this).parent().parent().parent();return t.trigger("change"),abiz_customizer_repeater_refresh_social_icons(r),!1})},search:function(i){var t=i.parent().next().find(".iconpicker-items"),n=i.val().toLowerCase();n.length>0?t.children().each(function(){e(this).filter("[title*=".concat(n)).length>0||n.length<1?e(this).show():e(this).hide()}):t.children().show()},iconPickerToggle:function(e){e.parent().next().addClass("iconpicker-visible")}},e(document).ready(function(){wp.abizcustomizerRepeater.init(),e(".iconpicker-search").on("keyup",function(){wp.abizcustomizerRepeater.search(e(this))}),e(".icp-auto").on("click",function(){wp.abizcustomizerRepeater.iconPickerToggle(e(this))}),e(document).mouseup(function(i){var t=e(".iconpicker-popover");t.is(i.target)||0!==t.has(i.target).length||t.removeClass("iconpicker-visible")})})}(jQuery);
|
||||
104
wp-content/themes/abiz/core/customizer/customizer.php
Normal file
104
wp-content/themes/abiz/core/customizer/customizer.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* Abiz Theme Customizer.
|
||||
*
|
||||
* @package Abiz
|
||||
*/
|
||||
|
||||
function abiz_customizer_register($wp_customize)
|
||||
{
|
||||
|
||||
$wp_customize->get_setting('blogname')->transport = 'postMessage';
|
||||
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
|
||||
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
|
||||
$wp_customize->get_setting('background_color')->transport = 'postMessage';
|
||||
$wp_customize->get_setting('custom_logo')->transport = 'refresh';
|
||||
|
||||
/**
|
||||
* Register controls
|
||||
*/
|
||||
$wp_customize->register_control_type('Abiz_Control_Sortable');
|
||||
$wp_customize->register_control_type('Abiz_Customize_Toggle_Control');
|
||||
|
||||
// Control
|
||||
require ABIZ_THEME_CONTROL_DIR . '/customize-base-control.php';
|
||||
require ABIZ_THEME_CONTROL_DIR . '/customize-control-sortable.php';
|
||||
require ABIZ_THEME_CONTROL_DIR . '/customize-category-control.php';
|
||||
require ABIZ_THEME_CONTROL_DIR . '/customize-toggle-control.php';
|
||||
|
||||
// Sainitization
|
||||
require ABIZ_THEME_CORE_DIR . '/customizer/abiz-customize-sanitization.php';
|
||||
}
|
||||
add_action('customize_register','abiz_customizer_register');
|
||||
|
||||
|
||||
function abiz_customizer_script()
|
||||
{
|
||||
wp_enqueue_script('abiz-customizer-section', ABIZ_THEME_CORE_URI . '/customizer/assets/js/customizer-section.js', array(
|
||||
"jquery"
|
||||
) , '', true);
|
||||
}
|
||||
add_action('customize_controls_enqueue_scripts','abiz_customizer_script');
|
||||
|
||||
// customizer settings.
|
||||
function abiz_customizer_settings()
|
||||
{
|
||||
/*
|
||||
* Customizer Notifications
|
||||
*/
|
||||
require get_template_directory() . '/core/customizer/customizer-notice/abiz-customizer-notify.php';
|
||||
|
||||
$abiz_config_customizer = array(
|
||||
'recommended_plugins' => array(
|
||||
'daddy-plus' => array(
|
||||
'recommended' => true,
|
||||
'description' => sprintf(
|
||||
/* translators: %s: plugin name */
|
||||
esc_html__( 'Recommended Plugin: If you want to show all the features and business sections of the FrontPage. please install and activate %s plugin', 'abiz' ),
|
||||
'<strong>Daddy Plus</strong>'
|
||||
),
|
||||
),
|
||||
),
|
||||
'recommended_actions' => array(),
|
||||
'recommended_actions_title' => esc_html__( 'Recommended Actions', 'abiz' ),
|
||||
'recommended_plugins_title' => esc_html__( 'Add More Features', 'abiz' ),
|
||||
'install_button_label' => esc_html__( 'Install and Activate', 'abiz' ),
|
||||
'activate_button_label' => esc_html__( 'Activate', 'abiz' ),
|
||||
'abiz_deactivate_button_label' => esc_html__( 'Deactivate', 'abiz' ),
|
||||
);
|
||||
abiz_Customizer_Notify::init( apply_filters( 'abiz_customizer_notify_array', $abiz_config_customizer ) );
|
||||
|
||||
$settings = array(
|
||||
'panels-and-sections',
|
||||
'selective-refresh-and-partial',
|
||||
'general'
|
||||
);
|
||||
|
||||
foreach ($settings as $setting)
|
||||
{
|
||||
$feature_file = get_theme_file_path('/core/customizer/abiz-' . $setting . '.php');
|
||||
require $feature_file;
|
||||
}
|
||||
|
||||
require ABIZ_THEME_CONTROL_DIR . '/customize-upgrade-control.php';
|
||||
}
|
||||
add_action('after_setup_theme','abiz_customizer_settings');
|
||||
|
||||
|
||||
/**
|
||||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function abiz_customize_preview_js()
|
||||
{
|
||||
wp_enqueue_script('abiz-customizer-preview', ABIZ_THEME_CORE_URI . '/customizer/assets/js/customizer.js', array(
|
||||
'customize-preview'
|
||||
) , '20151215', true);
|
||||
}
|
||||
add_action('customize_preview_init','abiz_customize_preview_js');
|
||||
|
||||
|
||||
//recommended plugin section function.
|
||||
function abiz_recommended_plugin_section( $manager ) {
|
||||
// Register custom section types.
|
||||
$manager->register_section_type( 'abiz_Customize_Recommended_Plugin_Section' );
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Name: abiz_bootstrap_navwalker
|
||||
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
|
||||
* Description: A custom WordPress nav walker class to implement the Bootstrap 3 navigation style in a custom theme
|
||||
* using the WordPress built in menu manager. Version: 2.0.4 Author: Edward McIntyre - @twittem License: GPL-2.0+
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*/
|
||||
class abiz_bootstrap_navwalker extends Walker_Nav_Menu {
|
||||
|
||||
/**
|
||||
* @see Walker::start_lvl()
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
* @param int $depth Depth of page. Used for padding.
|
||||
*/
|
||||
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||
|
||||
$indent = str_repeat( "\t", $depth );
|
||||
// Default class to add to the file.
|
||||
$classes = array( 'dropdown-menu' );
|
||||
/**
|
||||
* Filters the CSS class(es) applied to a menu list element.
|
||||
*/
|
||||
$class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
|
||||
|
||||
$output .= "\n{$indent}<span class='mobile-collapsed d-lg-none'><button type='button' class='fa fa-chevron-right' aria-label='Mobile Collapsed'></button></span><ul$class_names role=\"menu\">\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Walker::start_el()
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
* @param object $item Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param int $current_page Menu item ID.
|
||||
* @param object $args
|
||||
*/
|
||||
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
||||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||
|
||||
/**
|
||||
* Dividers, Headers or Disabled
|
||||
* =============================
|
||||
* Determine whether the item is a Divider, Header, Disabled or regular
|
||||
* menu item. To prevent errors we use the strcasecmp() function to so a
|
||||
* comparison that is not case sensitive. The strcasecmp() function returns
|
||||
* a 0 if the strings are equal.
|
||||
*/
|
||||
if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) {
|
||||
$output .= $indent . '<li role="presentation" class="divider">';
|
||||
} else if ( strcasecmp( $item->title, 'divider' ) == 0 && $depth === 1 ) {
|
||||
$output .= $indent . '<li role="presentation" class="divider">';
|
||||
} else if ( strcasecmp( $item->attr_title, 'dropdown-header' ) == 0 && $depth === 1 ) {
|
||||
$output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );
|
||||
} else if ( strcasecmp( $item->attr_title, 'disabled' ) == 0 ) {
|
||||
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
|
||||
$class_names = $value = '';
|
||||
|
||||
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
||||
$classes[] = 'menu-item-' . $item->ID;
|
||||
|
||||
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
|
||||
|
||||
if ( $args->has_children ) {
|
||||
$class_names .= ' dropdown';
|
||||
}
|
||||
|
||||
if ( in_array( 'current-menu-item', $classes ) OR in_array( 'current-menu-ancestor', $classes ) ){
|
||||
$class_names .= ' active';
|
||||
}
|
||||
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args );
|
||||
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||
|
||||
$output .= $indent . '<li' . $id . $value . $class_names . '>';
|
||||
|
||||
$atts = array();
|
||||
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : $item->title;
|
||||
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
||||
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
|
||||
|
||||
// If item has_children add atts to a.
|
||||
if ( isset( $args->has_children ) && $args->has_children && 0 === $depth && $args->depth > 1 ) {
|
||||
$atts['href'] = '#';
|
||||
$atts['data-toggle'] = 'dropdown';
|
||||
$atts['aria-haspopup'] = 'true';
|
||||
$atts['aria-expanded'] = 'false';
|
||||
$atts['class'] = 'dropdown-toggle nav-link';
|
||||
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
|
||||
} else {
|
||||
$atts['href'] = ! empty( $item->url ) ? $item->url : '#';
|
||||
// For items in dropdowns use .dropdown-item instead of .nav-link.
|
||||
if ( $depth > 0 ) {
|
||||
$atts['class'] = 'dropdown-item';
|
||||
} else {
|
||||
$atts['class'] = 'nav-link';
|
||||
}
|
||||
}
|
||||
|
||||
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
|
||||
|
||||
$attributes = '';
|
||||
foreach ( $atts as $attr => $value ) {
|
||||
if ( ! empty( $value ) ) {
|
||||
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
|
||||
$attributes .= ' ' . $attr . '="' . $value . '"';
|
||||
}
|
||||
}
|
||||
|
||||
$item_output = $args->before;
|
||||
|
||||
/*
|
||||
* Glyphicons
|
||||
* ===========
|
||||
* Since the the menu item is NOT a Divider or Header we check the see
|
||||
* if there is a value in the attr_title property. If the attr_title
|
||||
* property is NOT null we apply it as the class name for the glyphicon.
|
||||
*/
|
||||
if ( ! empty( $item->attr_title ) ) {
|
||||
$item_output .= '<a' . $attributes . '><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> ';
|
||||
} elseif($depth === 0) {
|
||||
$item_output .= '<a class="nav-link"' . $attributes . '>';
|
||||
}else{
|
||||
$item_output .= '<a class="dropdown-item"' . $attributes . '>';
|
||||
}
|
||||
|
||||
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
|
||||
$item_output .= ( $args->has_children && 0 === $depth ) ? ' </a>' : '</a>';
|
||||
$item_output .= $args->after;
|
||||
|
||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverse elements to create list from elements.
|
||||
*
|
||||
* Display one element if the element doesn't have any children otherwise,
|
||||
* display the element and its children. Will only traverse up to the max
|
||||
* depth and no ignore elements under that depth.
|
||||
*
|
||||
* This method shouldn't be called directly, use the walk() method instead.
|
||||
*
|
||||
* @see Walker::start_el()
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param object $element Data object
|
||||
* @param array $children_elements List of elements to continue traversing.
|
||||
* @param int $max_depth Max depth to traverse.
|
||||
* @param int $depth Depth of current element.
|
||||
* @param array $args
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
*
|
||||
* @return null Null on failure with no changes to parameters.
|
||||
*/
|
||||
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
|
||||
if ( ! $element ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id_field = $this->db_fields['id'];
|
||||
|
||||
// Display this element.
|
||||
if ( is_object( $args[0] ) ) {
|
||||
$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
|
||||
}
|
||||
|
||||
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu Fallback
|
||||
* =============
|
||||
* If this function is assigned to the wp_nav_menu's fallback_cb variable
|
||||
* and a manu has not been assigned to the theme location in the WordPress
|
||||
* menu manager the function with display nothing to a non-logged in user,
|
||||
* and will add a link to the WordPress menu manager if logged in as an admin.
|
||||
*
|
||||
* @param array $args passed from the wp_nav_menu function.
|
||||
*
|
||||
*/
|
||||
public static function fallback( $args ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
|
||||
extract( $args );
|
||||
|
||||
$fb_output = NULL;
|
||||
|
||||
if ( $container ) {
|
||||
$fb_output = '<' . $container;
|
||||
|
||||
if ( $container_id ) {
|
||||
$fb_output .= ' id="' . $container_id . '"';
|
||||
}
|
||||
|
||||
if ( $container_class ) {
|
||||
$fb_output .= ' class="' . $container_class . '"';
|
||||
}
|
||||
|
||||
$fb_output .= '>';
|
||||
}
|
||||
|
||||
$fb_output .= '<ul';
|
||||
|
||||
if ( $menu_id ) {
|
||||
$fb_output .= ' id="' . $menu_id . '"';
|
||||
}
|
||||
|
||||
if ( $menu_class ) {
|
||||
$fb_output .= ' class="' . $menu_class . '"';
|
||||
}
|
||||
|
||||
$fb_output .= '>';
|
||||
$fb_output .= '<li class="menu-item active"><a class="nav-link add-menu" href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '">' . esc_html__( 'Add a menu', 'abiz' ) . '</a></li>';
|
||||
$fb_output .= '</ul>';
|
||||
|
||||
if ( $container ) {
|
||||
$fb_output .= '</' . $container . '>';
|
||||
}
|
||||
|
||||
echo $fb_output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function abiz_bootstrap_page_menu_args( $args ) {
|
||||
if ( ! isset( $args['show_home'] ) )
|
||||
$args['show_home'] = true;
|
||||
return $args;
|
||||
}
|
||||
add_filter( 'wp_page_menu_args', 'abiz_bootstrap_page_menu_args' );
|
||||
function abiz_bootstrap_fallback_page_menu( $args = array() ) {
|
||||
$defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
$args = apply_filters( 'wp_page_menu_args', $args );
|
||||
$menu = '';
|
||||
$list_args = $args;
|
||||
// Show Home in the menu
|
||||
if ( ! empty($args['show_home']) ) {
|
||||
if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
|
||||
$text = 'Home';
|
||||
else
|
||||
$text = $args['show_home'];
|
||||
$class = '';
|
||||
if ( is_front_page() && !is_paged() )
|
||||
{
|
||||
$class = 'class="nav-item menu-item active"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$class = 'class="nav-item menu-item "';
|
||||
}
|
||||
$menu .= '<li ' . $class . '><a class="nav-link " href="' . esc_url(home_url( '/' )) . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
|
||||
// If the front page is a page, add it to the exclude list
|
||||
if (get_option('show_on_front') == 'page') {
|
||||
if ( !empty( $list_args['exclude'] ) ) {
|
||||
$list_args['exclude'] .= ',';
|
||||
} else {
|
||||
$list_args['exclude'] = '';
|
||||
}
|
||||
$list_args['exclude'] .= get_option('page_on_front');
|
||||
}
|
||||
}
|
||||
$list_args['echo'] = false;
|
||||
$list_args['title_li'] = '';
|
||||
$list_args['walker'] = new abiz_bootstrap_walker_page_menu;
|
||||
$menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
|
||||
if ( $menu )
|
||||
$menu = '<ul class="'. esc_attr($args['menu_class']) .'">' . $menu . '</ul>';
|
||||
|
||||
$menu = $menu . "\n";
|
||||
$menu = apply_filters( 'wp_page_menu', $menu, $args );
|
||||
if ( $args['echo'] )
|
||||
echo $menu;
|
||||
else
|
||||
return $menu;
|
||||
}
|
||||
class abiz_bootstrap_walker_page_menu extends Walker_Page{
|
||||
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "\n$indent<span class='mobile-collapsed d-lg-none'><button type='button' class='fa fa-chevron-right' aria-label='Mobile Collapsed'></button></span><ul class='dropdown-menu default'>\n";
|
||||
}
|
||||
function start_el( &$output, $page, $depth=0, $args = array(), $current_page = 0 )
|
||||
{
|
||||
if ( $depth )
|
||||
$indent = str_repeat("\t", $depth);
|
||||
else
|
||||
$indent = '';
|
||||
|
||||
if($depth === 0)
|
||||
{
|
||||
$child_class='nav-link';
|
||||
}
|
||||
else if($depth > 0)
|
||||
{
|
||||
$child_class='dropdown-item';
|
||||
}
|
||||
else
|
||||
{
|
||||
$child_class='';
|
||||
}
|
||||
extract($args, EXTR_SKIP);
|
||||
if($has_children){
|
||||
$css_class = array('menu-item page_item dropdown menu-item-has-children', 'page-item-'.$page->ID);
|
||||
}else{
|
||||
$css_class = array('menu-item page_item', 'page-item-'.$page->ID);
|
||||
}
|
||||
if ( !empty($current_page) ) {
|
||||
$_current_page = get_post( $current_page );
|
||||
if ( in_array( $page->ID, $_current_page->ancestors ) )
|
||||
$css_class[] = 'current_page_ancestor';
|
||||
if ( $page->ID == $current_page )
|
||||
$css_class[] = 'nav-item active';
|
||||
elseif ( $_current_page && $page->ID == $_current_page->post_parent )
|
||||
$css_class[] = 'current_page_parent';
|
||||
} elseif ( $page->ID == get_option('page_for_posts') ) {
|
||||
$css_class[] = 'current_page_parent';
|
||||
}
|
||||
$css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
|
||||
$output .= $indent . '<li class="nav-item ' . $css_class . '"><a class="' . $child_class . '" href="' . esc_url(get_permalink($page->ID)) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
|
||||
if ( !empty($show_date) ) {
|
||||
if ( 'modified' == $show_date )
|
||||
$time = $page->post_modified;
|
||||
else
|
||||
$time = $page->post_date;
|
||||
$output .= " " . mysql2date($date_format, $time);
|
||||
}
|
||||
}
|
||||
}
|
||||
697
wp-content/themes/abiz/core/wptt-webfont-loader.php
Normal file
697
wp-content/themes/abiz/core/wptt-webfont-loader.php
Normal file
@@ -0,0 +1,697 @@
|
||||
<?php
|
||||
/**
|
||||
* Download webfonts locally.
|
||||
*
|
||||
* @package wptt/font-loader
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'WPTT_WebFont_Loader' ) ) {
|
||||
/**
|
||||
* Download webfonts locally.
|
||||
*/
|
||||
class WPTT_WebFont_Loader {
|
||||
|
||||
/**
|
||||
* The font-format.
|
||||
*
|
||||
* Use "woff" or "woff2".
|
||||
* This will change the user-agent user to make the request.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $font_format = 'woff2';
|
||||
|
||||
/**
|
||||
* The remote URL.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $remote_url;
|
||||
|
||||
/**
|
||||
* Base path.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $base_path;
|
||||
|
||||
/**
|
||||
* Base URL.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $base_url;
|
||||
|
||||
/**
|
||||
* Subfolder name.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $subfolder_name;
|
||||
|
||||
/**
|
||||
* The fonts folder.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $fonts_folder;
|
||||
|
||||
/**
|
||||
* The local stylesheet's path.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $local_stylesheet_path;
|
||||
|
||||
/**
|
||||
* The local stylesheet's URL.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $local_stylesheet_url;
|
||||
|
||||
/**
|
||||
* The remote CSS.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $remote_styles;
|
||||
|
||||
/**
|
||||
* The final CSS.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $css;
|
||||
|
||||
/**
|
||||
* Cleanup routine frequency.
|
||||
*/
|
||||
const CLEANUP_FREQUENCY = 'monthly';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Get a new instance of the object for a new URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @param string $url The remote URL.
|
||||
*/
|
||||
public function __construct( $url = '' ) {
|
||||
$this->remote_url = $url;
|
||||
|
||||
// Add a cleanup routine.
|
||||
$this->schedule_cleanup();
|
||||
add_action( 'delete_fonts_folder', array( $this, 'delete_fonts_folder' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local URL which contains the styles.
|
||||
*
|
||||
* Fallback to the remote URL if we were unable to write the file locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_url() {
|
||||
|
||||
// Check if the local stylesheet exists.
|
||||
if ( $this->local_file_exists() ) {
|
||||
|
||||
// Attempt to update the stylesheet. Return the local URL on success.
|
||||
if ( $this->write_stylesheet() ) {
|
||||
return $this->get_local_stylesheet_url();
|
||||
}
|
||||
}
|
||||
|
||||
// If the local file exists, return its URL, with a fallback to the remote URL.
|
||||
return file_exists( $this->get_local_stylesheet_path() )
|
||||
? $this->get_local_stylesheet_url()
|
||||
: $this->remote_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local stylesheet URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_stylesheet_url() {
|
||||
if ( ! $this->local_stylesheet_url ) {
|
||||
$this->local_stylesheet_url = str_replace(
|
||||
$this->get_base_path(),
|
||||
$this->get_base_url(),
|
||||
$this->get_local_stylesheet_path()
|
||||
);
|
||||
}
|
||||
return $this->local_stylesheet_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get styles with fonts downloaded locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_styles() {
|
||||
|
||||
// If we already have the local file, return its contents.
|
||||
$local_stylesheet_contents = $this->get_local_stylesheet_contents();
|
||||
if ( $local_stylesheet_contents ) {
|
||||
return $local_stylesheet_contents;
|
||||
}
|
||||
|
||||
// Get the remote URL contents.
|
||||
$this->remote_styles = $this->get_remote_url_contents();
|
||||
|
||||
// Get an array of locally-hosted files.
|
||||
$files = $this->get_local_files_from_css();
|
||||
|
||||
// Convert paths to URLs.
|
||||
foreach ( $files as $remote => $local ) {
|
||||
$files[ $remote ] = str_replace(
|
||||
$this->get_base_path(),
|
||||
$this->get_base_url(),
|
||||
$local
|
||||
);
|
||||
}
|
||||
|
||||
$this->css = str_replace(
|
||||
array_keys( $files ),
|
||||
array_values( $files ),
|
||||
$this->remote_styles
|
||||
);
|
||||
|
||||
$this->write_stylesheet();
|
||||
|
||||
return $this->css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get local stylesheet contents.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string|false Returns the remote URL contents.
|
||||
*/
|
||||
public function get_local_stylesheet_contents() {
|
||||
$local_path = $this->get_local_stylesheet_path();
|
||||
|
||||
// Check if the local stylesheet exists.
|
||||
if ( $this->local_file_exists() ) {
|
||||
|
||||
// Attempt to update the stylesheet. Return false on fail.
|
||||
if ( ! $this->write_stylesheet() ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include $local_path;
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remote file contents.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return string Returns the remote URL contents.
|
||||
*/
|
||||
public function get_remote_url_contents() {
|
||||
|
||||
/**
|
||||
* The user-agent we want to use.
|
||||
*
|
||||
* The default user-agent is the only one compatible with woff (not woff2)
|
||||
* which also supports unicode ranges.
|
||||
*/
|
||||
$user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8';
|
||||
|
||||
// Switch to a user-agent supporting woff2 if we don't need to support IE.
|
||||
if ( 'woff2' === $this->font_format ) {
|
||||
$user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0';
|
||||
}
|
||||
|
||||
// Get the response.
|
||||
$response = wp_remote_get( $this->remote_url, array( 'user-agent' => $user_agent ) );
|
||||
|
||||
// Early exit if there was an error.
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get the CSS from our response.
|
||||
$contents = wp_remote_retrieve_body( $response );
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download files mentioned in our CSS locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return array Returns an array of remote URLs and their local counterparts.
|
||||
*/
|
||||
public function get_local_files_from_css() {
|
||||
$font_files = $this->get_remote_files_from_css();
|
||||
$stored = get_site_option( 'downloaded_font_files', array() );
|
||||
$change = false; // If in the end this is true, we need to update the cache option.
|
||||
|
||||
if ( ! defined( 'FS_CHMOD_DIR' ) ) {
|
||||
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
|
||||
}
|
||||
|
||||
// If the fonts folder don't exist, create it.
|
||||
if ( ! file_exists( $this->get_fonts_folder() ) ) {
|
||||
$this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
foreach ( $font_files as $font_family => $files ) {
|
||||
|
||||
// The folder path for this font-family.
|
||||
$folder_path = $this->get_fonts_folder() . '/' . $font_family;
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $folder_path ) ) {
|
||||
$this->get_filesystem()->mkdir( $folder_path, FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
foreach ( $files as $url ) {
|
||||
|
||||
// Get the filename.
|
||||
$filename = basename( wp_parse_url( $url, PHP_URL_PATH ) );
|
||||
$font_path = $folder_path . '/' . $filename;
|
||||
|
||||
// Check if the file already exists.
|
||||
if ( file_exists( $font_path ) ) {
|
||||
|
||||
// Skip if already cached.
|
||||
if ( isset( $stored[ $url ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add file to the cache and change the $changed var to indicate we need to update the option.
|
||||
$stored[ $url ] = $font_path;
|
||||
$change = true;
|
||||
|
||||
// Since the file exists we don't need to proceed with downloading it.
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we got this far, we need to download the file.
|
||||
*/
|
||||
|
||||
// require file.php if the download_url function doesn't exist.
|
||||
if ( ! function_exists( 'download_url' ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
}
|
||||
|
||||
// Download file to temporary location.
|
||||
$tmp_path = download_url( $url );
|
||||
|
||||
// Make sure there were no errors.
|
||||
if ( is_wp_error( $tmp_path ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move temp file to final destination.
|
||||
$success = $this->get_filesystem()->move( $tmp_path, $font_path, true );
|
||||
if ( $success ) {
|
||||
$stored[ $url ] = $font_path;
|
||||
$change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there were changes, update the option.
|
||||
if ( $change ) {
|
||||
|
||||
// Cleanup the option and then save it.
|
||||
foreach ( $stored as $url => $path ) {
|
||||
if ( ! file_exists( $path ) ) {
|
||||
unset( $stored[ $url ] );
|
||||
}
|
||||
}
|
||||
update_site_option( 'downloaded_font_files', $stored );
|
||||
}
|
||||
|
||||
return $stored;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font files from the CSS.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return array Returns an array of font-families and the font-files used.
|
||||
*/
|
||||
public function get_remote_files_from_css() {
|
||||
|
||||
$font_faces = explode( '@font-face', $this->remote_styles );
|
||||
|
||||
$result = array();
|
||||
|
||||
// Loop all our font-face declarations.
|
||||
foreach ( $font_faces as $font_face ) {
|
||||
|
||||
// Make sure we only process styles inside this declaration.
|
||||
$style = explode( '}', $font_face )[0];
|
||||
|
||||
// Sanity check.
|
||||
if ( false === strpos( $style, 'font-family' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get an array of our font-families.
|
||||
preg_match_all( '/font-family.*?\;/', $style, $matched_font_families );
|
||||
|
||||
// Get an array of our font-files.
|
||||
preg_match_all( '/url\(.*?\)/i', $style, $matched_font_files );
|
||||
|
||||
// Get the font-family name.
|
||||
$font_family = 'unknown';
|
||||
if ( isset( $matched_font_families[0] ) && isset( $matched_font_families[0][0] ) ) {
|
||||
$font_family = rtrim( ltrim( $matched_font_families[0][0], 'font-family:' ), ';' );
|
||||
$font_family = trim( str_replace( array( "'", ';' ), '', $font_family ) );
|
||||
$font_family = sanitize_key( strtolower( str_replace( ' ', '-', $font_family ) ) );
|
||||
}
|
||||
|
||||
// Make sure the font-family is set in our array.
|
||||
if ( ! isset( $result[ $font_family ] ) ) {
|
||||
$result[ $font_family ] = array();
|
||||
}
|
||||
|
||||
// Get files for this font-family and add them to the array.
|
||||
foreach ( $matched_font_files as $match ) {
|
||||
|
||||
// Sanity check.
|
||||
if ( ! isset( $match[0] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the file URL.
|
||||
$font_family_url = rtrim( ltrim( $match[0], 'url(' ), ')' );
|
||||
|
||||
// Make sure to convert relative URLs to absolute.
|
||||
$font_family_url = $this->get_absolute_path( $font_family_url );
|
||||
|
||||
$result[ $font_family ][] = $font_family_url;
|
||||
}
|
||||
|
||||
// Make sure we have unique items.
|
||||
// We're using array_flip here instead of array_unique for improved performance.
|
||||
$result[ $font_family ] = array_flip( array_flip( $result[ $font_family ] ) );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the CSS to the filesystem.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @return string|false Returns the absolute path of the file on success, or false on fail.
|
||||
*/
|
||||
protected function write_stylesheet() {
|
||||
$file_path = $this->get_local_stylesheet_path();
|
||||
$filesystem = $this->get_filesystem();
|
||||
|
||||
if ( ! defined( 'FS_CHMOD_DIR' ) ) {
|
||||
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
|
||||
}
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $this->get_fonts_folder() ) ) {
|
||||
$this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
// If the file doesn't exist, create it. Return false if it can not be created.
|
||||
if ( ! $filesystem->exists( $file_path ) && ! $filesystem->touch( $file_path ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we got this far, we need to write the file.
|
||||
// Get the CSS.
|
||||
if ( ! $this->css ) {
|
||||
$this->get_styles();
|
||||
}
|
||||
|
||||
// Put the contents in the file. Return false if that fails.
|
||||
if ( ! $filesystem->put_contents( $file_path, $this->css ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stylesheet path.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_stylesheet_path() {
|
||||
if ( ! $this->local_stylesheet_path ) {
|
||||
$this->local_stylesheet_path = $this->get_fonts_folder() . '/' . $this->get_local_stylesheet_filename() . '.css';
|
||||
}
|
||||
return $this->local_stylesheet_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local stylesheet filename.
|
||||
*
|
||||
* This is a hash, generated from the site-URL, the wp-content path and the URL.
|
||||
* This way we can avoid issues with sites changing their URL, or the wp-content path etc.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_stylesheet_filename() {
|
||||
return md5( $this->get_base_url() . $this->get_base_path() . $this->remote_url . $this->font_format );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the font-format to be used.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @param string $format The format to be used. Use "woff" or "woff2".
|
||||
* @return void
|
||||
*/
|
||||
public function set_font_format( $format = 'woff2' ) {
|
||||
$this->font_format = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the local stylesheet exists.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return bool
|
||||
*/
|
||||
public function local_file_exists() {
|
||||
return ( ! file_exists( $this->get_local_stylesheet_path() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base path.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_base_path() {
|
||||
if ( ! $this->base_path ) {
|
||||
$this->base_path = apply_filters( 'wptt_get_local_fonts_base_path', $this->get_filesystem()->wp_content_dir() );
|
||||
}
|
||||
return $this->base_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_base_url() {
|
||||
if ( ! $this->base_url ) {
|
||||
$this->base_url = apply_filters( 'wptt_get_local_fonts_base_url', content_url() );
|
||||
}
|
||||
return $this->base_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subfolder name.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_subfolder_name() {
|
||||
if ( ! $this->subfolder_name ) {
|
||||
$this->subfolder_name = apply_filters( 'wptt_get_local_fonts_subfolder_name', 'fonts' );
|
||||
}
|
||||
return $this->subfolder_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the folder for fonts.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function get_fonts_folder() {
|
||||
if ( ! $this->fonts_folder ) {
|
||||
$this->fonts_folder = $this->get_base_path();
|
||||
if ( $this->get_subfolder_name() ) {
|
||||
$this->fonts_folder .= '/' . $this->get_subfolder_name();
|
||||
}
|
||||
}
|
||||
return $this->fonts_folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule a cleanup.
|
||||
*
|
||||
* Deletes the fonts files on a regular basis.
|
||||
* This way font files will get updated regularly,
|
||||
* and we avoid edge cases where unused files remain in the server.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return void
|
||||
*/
|
||||
public function schedule_cleanup() {
|
||||
if ( ! is_multisite() || ( is_multisite() && is_main_site() ) ) {
|
||||
if ( ! wp_next_scheduled( 'delete_fonts_folder' ) && ! wp_installing() ) {
|
||||
wp_schedule_event( time(), self::CLEANUP_FREQUENCY, 'delete_fonts_folder' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the fonts folder.
|
||||
*
|
||||
* This runs as part of a cleanup routine.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return bool
|
||||
*/
|
||||
public function delete_fonts_folder() {
|
||||
return $this->get_filesystem()->delete( $this->get_fonts_folder(), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesystem.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0.0
|
||||
* @return \WP_Filesystem_Base
|
||||
*/
|
||||
protected function get_filesystem() {
|
||||
global $wp_filesystem;
|
||||
|
||||
// If the filesystem has not been instantiated yet, do it here.
|
||||
if ( ! $wp_filesystem ) {
|
||||
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
}
|
||||
WP_Filesystem();
|
||||
}
|
||||
return $wp_filesystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an absolute URL from a relative URL.
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param string $url The URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_absolute_path( $url ) {
|
||||
|
||||
// If dealing with a root-relative URL.
|
||||
if ( 0 === stripos( $url, '/' ) ) {
|
||||
$parsed_url = parse_url( $this->remote_url );
|
||||
return $parsed_url['scheme'] . '://' . $parsed_url['hostname'] . $url;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wptt_get_webfont_styles' ) ) {
|
||||
/**
|
||||
* Get styles for a webfont.
|
||||
*
|
||||
* This will get the CSS from the remote API,
|
||||
* download any fonts it contains,
|
||||
* replace references to remote URLs with locally-downloaded assets,
|
||||
* and finally return the resulting CSS.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $url The URL of the remote webfont.
|
||||
* @param string $format The font-format. If you need to support IE, change this to "woff".
|
||||
*
|
||||
* @return string Returns the CSS.
|
||||
*/
|
||||
function wptt_get_webfont_styles( $url, $format = 'woff2' ) {
|
||||
$font = new WPTT_WebFont_Loader( $url );
|
||||
$font->set_font_format( $format );
|
||||
return $font->get_styles();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wptt_get_webfont_url' ) ) {
|
||||
/**
|
||||
* Get a stylesheet URL for a webfont.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @param string $url The URL of the remote webfont.
|
||||
* @param string $format The font-format. If you need to support IE, change this to "woff".
|
||||
*
|
||||
* @return string Returns the CSS.
|
||||
*/
|
||||
function wptt_get_webfont_url( $url, $format = 'woff2' ) {
|
||||
$font = new WPTT_WebFont_Loader( $url );
|
||||
$font->set_font_format( $format );
|
||||
return $font->get_url();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user