Files
doitinpoland.com/wp-content/plugins/em-helper-plugin/includes/shortcodes/em_counter.php
2023-09-12 21:41:04 +02:00

345 lines
11 KiB
PHP

<?php
/*
* em counter Section
* Author: EM40
* Author URI: http://raytheme.com
* Version: 1.0
*/
/**
* =======================================================
* KC Shortcode Map
* =======================================================
*/
add_action('init', 'em_counter');
if(!function_exists('em_counter')):
function em_counter(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'em_counter' => array(
'name' => __( 'EM counter Box', 'cyber' ),
'title' => 'counter Settings',
'icon' => 'fa-youtube-play',
'category' => 'cyber',
'wrapper_class' => 'clearfix',
'description' => __( 'Display Service style.', 'cyber' ),
'params' => array(
'general' => array(
array(
'type' => 'radio_image',
'label' => __( 'Select blog Style', 'cyber' ),
'name' => 'layout',
'admin_label' => true,
'options' => array(
'1' => EM40_EXTENSION_URI . 'asstes/images/blog/layout1.jpg',
'2' => EM40_EXTENSION_URI . 'asstes/images/blog/layout2.jpg',
),
'description' => __( 'select your style', 'cyber' ),
'value' => '1'
),
array(
'name' => 'title_icon',
'type' => 'toggle',
'label' => esc_html__( 'Set Icon', 'cyber' ),
'value' => 'no',
'description' => esc_html__( 'you can show icon after your heading.', 'cyber' )
),
array(
'type' => 'icon_picker',
'name' => 'icon',
'label' => esc_html__( 'Icon', 'cyber' ),
'value' => 'sl-rocket',
'description' => esc_html__( 'Select icon display on front side', 'cyber' ),
'relation' => array(
'parent' => 'title_icon',
'show_when' => 'yes'
)
),
array(
'type' => 'text',
'name' => 'number',
'label' => __( 'Number', 'cyber' ),
'value' => '3250',
'admin_label' => true
),
array(
'type' => 'text',
'name' => 'sing',
'label' => __( 'Symbol', 'cyber' ),
'value' => '+',
'admin_label' => true
),
array(
'type' => 'text',
'name' => 'title',
'label' => __( 'Name', 'cyber' ),
'value' => 'Happy Client',
'admin_label' => true
),
array(
'type' => 'text',
'label' => __( 'Custom class', 'cyber' ),
'name' => 'custom_class',
'description' => __( 'Enter extra custom class', 'cyber' )
)
),
'styling' => array(
array(
'name' => 'css_custom',
'type' => 'css',
'options' => array(
array(
"screens" => "any,1024,999,767,479",
'Title' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.counter_title h4'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.counter_title h4'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.counter_title h4'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.counter_title h4'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.counter_title h4'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.counter_title h4'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.countr_text > h1'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.countr_text > h1'),
),
'Number' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.countr_text > h1'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.countr_text > h1'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.countr_text > h1'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.countr_text > h1'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.countr_text > h1'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.countr_text > h1'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.countr_text > h1'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.countr_text > h1'),
),
'Symbol' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.countr_text > h3'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.countr_text > h3'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.countr_text > h3'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.countr_text > h3'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.countr_text > h3'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.countr_text > h3'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.countr_text > h3'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.countr_text > h3'),
),
'Icon' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.counter_icon i'),
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '.counter_icon i:hover'),
array('property' => 'background-color', 'label' => 'BG Color', 'selector' => '.counter_icon i'),
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '.counter_icon i:hover'),
array('property' => 'border-color', 'label' => 'Border Color', 'selector' => '.counter_icon i'),
array('property' => 'border-color', 'label' => 'Border Color Hover', 'selector' => '.counter_icon i:hover'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.counter_icon i'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.counter_icon i'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.counter_icon i'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.counter_icon i'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.counter_icon i'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.counter_icon i'),
),
'Circle Bg' => array(
array('property' => 'background-color', 'label' => 'BG Color', 'selector' => '.countr_text > h1::after'),
),
'Dot Bg' => array(
array('property' => 'border-color', 'label' => 'Border Color', 'selector' => '.counter_icon::before'),
),
'Box' => array(
array('property' => 'background'),
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover'),
array('property' => 'text-align', 'label' => 'Box Text Align'),
array('property' => 'border', 'label' => 'Border'),
array('property' => 'border-color', 'label' => 'Border Color Hover'),
array('property' => 'display', 'label' => 'Display'),
array('property' => 'border-radius', 'label' => 'Border Radius'),
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' => '+.em-feature'),
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '+.em-feature:hover'),
array('property' => 'margin', 'label' => 'Margin'),
array('property' => 'padding', 'label' => 'Padding'),
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '+.em-feature:hover')
)
)
)
)
),
'animate' => array(
array(
'name' => 'animate',
'type' => 'animate'
)
),
)
),
)// first array
); // End add map
endif;
}
endif;
/**
* =======================================================
* Register Shortcode team section
* =======================================================
*/
// [em_counter title="" desc="" icon=""]
if(!function_exists('em_counter_shortcode')){
function em_counter_shortcode($atts,$content){
ob_start();
$em_counter = shortcode_atts(array(
'layout' => '1',
'title' => '',
'title_icon' => '',
'icon' => '',
'number' => '',
'sing' => '',
'custom_css' => '',
'custom_class' => '',
),$atts);
extract( $em_counter );
//custom class
$wrap_class = apply_filters( 'kc-el-class', $atts );
if( !empty( $custom_class ) ):
$wrap_class[] = $custom_class;
endif;
$extra_class = implode( ' ', $wrap_class );
switch ( $layout ) {
case '2':
?>
<div class="single_counter single_counter2 <?php echo esc_attr( $extra_class ); ?>">
<div class="single_counter_inner">
<?php if( $title_icon == 'yes' && !empty( $icon ) ){ ?>
<div class="counter_icon counter_icon2">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<div class="countr_text countr_text2">
<?php if( !empty( $number ) ){ ?>
<h1><?php echo esc_attr( $number ); ?></h1>
<?php } ?>
<?php if( !empty( $sing ) ){ ?>
<h3><?php echo esc_attr( $sing ); ?></h3>
<?php } ?>
</div>
<div class="counter_title counter_title2">
<?php if ( !empty( $title ) ) {?>
<h4>
<?php echo $title; ?>
</h4>
<?php }?>
</div>
</div>
</div>
<?php
break;
default:
?>
<div class="single_counter default_style <?php echo esc_attr( $extra_class ); ?>">
<div class="single_counter_inner">
<?php if( $title_icon == 'yes' && !empty( $icon ) ){ ?>
<div class="counter_icon">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<div class="countr_text">
<?php if( !empty( $number ) ){ ?>
<h1><?php echo esc_attr( $number ); ?></h1>
<?php } ?>
<?php if( !empty( $sing ) ){ ?>
<h3><?php echo esc_attr( $sing ); ?></h3>
<?php } ?>
</div>
<div class="counter_title">
<?php if ( !empty( $title ) ) {?>
<h4>
<?php echo $title; ?>
</h4>
<?php }?>
</div>
</div>
</div>
<?php
break;
}
return ob_get_clean();
}
add_shortcode('em_counter','em_counter_shortcode');
}