Files
2023-09-12 21:41:04 +02:00

464 lines
16 KiB
PHP

<?php
/*
* Team Section
* Author: Con
* Author URI: http://webitkurigram.com
* Version: 1.0
* ======================================================
*/
/**
* =======================================================
* KC Shortcode Map
* =======================================================
*/
add_action('init', 'em_feature_box');
if(!function_exists('em_feature_box')):
function em_feature_box(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'em_feature_box' => array(
'name' => __( 'EM Feature Box', 'cyber' ),
'title' => 'Feature Settings',
'icon' => 'kc-icon-feature-box',
'category' => 'cyber',
'wrapper_class' => 'clearfix',
'description' => __( 'Display Feature layout style.', 'cyber' ),
'params' => array(
'general' => array(
array(
'name' => 'icon',
'label' => __( 'Select Icon', 'kingcomposer' ),
'type' => 'icon_picker',
'description' => __( 'Select icon display in box', 'kingcomposer' ),
'value' => 'sl-rocket',
),
array(
'type' => 'text',
'name' => 'title',
'label' => __( 'Name', 'cyber' ),
'value' => 'Your Name',
'admin_label' => true
),
array(
'type' => 'textarea',
'name' => 'desc',
'label' => __( 'Description', 'cyber' ),
'value' => base64_encode('Lorem ipsum dolor sit amet, consecte tur adipisicing elit. Ipsa libero ab voluptatibus itaque quas in voluptas cyber.')
),
array(
'type' => 'radio_image',
'label' => __( 'Select Feature 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',
'3' => EM40_EXTENSION_URI . 'asstes/images/blog/layout3.jpg',
'4' => EM40_EXTENSION_URI . 'asstes/images/blog/layout4.jpg',
'5' => EM40_EXTENSION_URI . 'asstes/images/blog/layout4.jpg',
'6' => EM40_EXTENSION_URI . 'asstes/images/blog/layout1.jpg',
'7' => EM40_EXTENSION_URI . 'asstes/images/blog/layout2.jpg',
),
'description' => __( 'Select Your Feature Style', 'cyber' ),
'value' => '1'
),
array(
'type' => 'text',
'name' => 'number',
'label' => __( 'Enter Number', 'cyber' ),
'value' => '01',
'admin_label' => true,
'relation' => array(
'parent' => 'layout',
'show_when' => array('5' )
)
),
array(
'name' => 'show_button',
'label' => __( 'Display Button', 'cyber' ),
'type' => 'toggle',
'value' => 'yes'
),
array(
'name' => 'button_text',
'label' => __( 'Text Button', 'cyber' ),
'type' => 'text',
'value' => __( 'Read More', 'cyber' ),
'relation' => array(
'parent' => 'show_button',
'show_when' => 'yes'
)
),
array(
'name' => 'button_link',
'label' => __( 'Link Button', 'cyber' ),
'type' => 'link',
'value' => '#',
'relation' => array(
'parent' => 'show_button',
'show_when' => 'yes'
)
),
array(
'name' => 'image',
'label' => __( 'Avatar Image', 'cyber' ),
'type' => 'attach_image',
'relation' => array(
'parent' => 'layout',
'show_when' => array('2','7' )
)
),
array(
'type' => 'text',
'label' => __( 'Image Size', 'cyber' ),
'name' => 'img_size',
'value' => 'full',
'description' => __(' Set the image size: "full", "thumbnail", "medium", "large" or other size ', 'cyber'),
'relation' => array(
'parent' => 'layout',
'show_when' => array( '2' )
)
),
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' => '.em-feature-title h2'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em-feature-title h2'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-feature-title h2'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-feature-title h2'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em-feature-title h2'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-feature-title h2'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-feature-title h2'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-feature-title h2'),
),
'Desc' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.em-feature-desc'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em-feature-desc'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-feature-desc'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-feature-desc'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em-feature-desc'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-feature-desc'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-feature-desc'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-feature-desc'),
),
'Icon' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.em_feature-icon i'),
array('property' => 'color', 'label' => 'Hover Color', 'selector' => '+:hover .em_feature-icon i'),
array('property' => 'background-color', 'label' => 'BG Color', 'selector' => '.em_feature-icon i'),
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover .em_feature-icon i'),
array('property' => 'border', 'label' => 'Border', 'selector' => '.em_feature-icon i'),
array('property' => 'border-color', 'label' => 'Hover Border', 'selector' => '+:hover .em_feature-icon i'),
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.em_feature-icon i'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em_feature-icon i'),
array('property' => 'height', 'label' => 'Height', 'selector' => '.em_feature-icon i,.em_feature-icon::before'),
array('property' => 'width', 'label' => 'Width', 'selector' => '.em_feature-icon i,.em_feature-icon::before'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em_feature-icon i'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em_feature-icon i'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em_feature-icon i')
),
'Button' => array(
array('property' => 'color', 'label' => 'Button Color', 'selector' => '.feature-btn > a'),
array('property' => 'color', 'label' => 'Button Hover Color', 'selector' => '.feature-btn > a:hover'),
array('property' => 'background-color', 'label' => 'Button BG Color', 'selector' => '.feature-btn > a,+ .style_two .feature-btn a'),
array('property' => 'background-color', 'label' => 'Button BG Hover Color', 'selector' => '.feature-btn > a:hover'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.feature-btn > a'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.feature-btn > a'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.feature-btn > a'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.feature-btn > a'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.feature-btn > a'),
array('property' => 'border', 'label' => 'Button Border', 'selector' => '.feature-btn > a'),
array('property' => 'border-color', 'label' => 'Button Border Color Hover', 'selector' => '.feature-btn > a:hover'),
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.feature-btn > a'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.feature-btn > a'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.feature-btn > a')
),
'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')
),
'Image' => array(
array('property' => 'border', 'label' => 'Border', 'selector' =>'.em-feature-thumb img'),
array('property' => 'border-color', 'label' => 'Border Color Hover','selector' =>'.em-feature-thumb img'),
array('property' => 'display', 'label' => 'Display','selector' =>'.em-feature-thumb img'),
array('property' => 'border-radius', 'label' => 'Border Radius','selector' =>'.em-feature-thumb img'),
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' =>'.em-feature-thumb img'),
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' =>'.em-feature-thumb img'),
array('property' => 'margin', 'label' => 'Margin', 'selector' =>'.em-feature-thumb img'),
array('property' => 'padding', 'label' => 'Padding', 'selector' =>'.em-feature-thumb img'),
)
)
)
)
),
'animate' => array(
array(
'name' => 'animate',
'type' => 'animate'
)
),
)
),
)// first array
); // End add map
endif;
}
endif;
/**
* =======================================================
* Register Shortcode team section
* =======================================================
*/
// [em_feature_box title="" desc="" icon=""]
if(!function_exists('em_feature_box_shortcode')){
function em_feature_box_shortcode($atts,$content){
ob_start();
$em_feature_box = shortcode_atts(array(
'icon' => '',
'title' => '',
'number' => '',
'desc' => '',
'show_button' => '',
'button_text' => '',
'button_link' => '',
'layout' => '1',
'image' => '',
'custom_css' => '',
'custom_class' => '',
),$atts);
extract( $em_feature_box );
//custom class
$wrap_class = apply_filters( 'kc-el-class', $atts );
if( !empty( $custom_class ) ):
$wrap_class[] = $custom_class;
endif;
$extra_class = implode( ' ', $wrap_class );
$data_title=$data_number=$data_desc=$data_button=$data_img=$img_size=$img_link="";
$size_array = array('full', 'medium', 'large', 'thumbnail');
if ( !empty( $title ) ) {
$data_title .= '<div class="em-feature-title"><h2>';
$data_title .= $title;
$data_title .= '</h2></div>';
}
if ( !empty( $number ) ) {
$data_number .= '<div class="em-feature-number"><h2>';
$data_number .= $number;
$data_number .= '</h2></div>';
}
if ( !empty( $desc ) ) {
$data_desc .= '<div class="em-feature-desc">';
$data_desc .= $desc;
$data_desc .= '</div>';
}
if ( $show_button == 'yes' ) {
if ( !empty( $button_link ) ) {
$button_link_text = explode( '|', $button_link );
$button_link = $button_link_text[0];
}
if( empty($button_text) )
$button_text = __( '', 'cyber' );
$data_button .= '<div class="feature-btn">';
$data_button .= '<a href="'. $button_link .'">'. $button_text .'<i class="fa fa-angle-right"></i></a>';
$data_button .= '</div>';
}
if ( !empty( $image ) ) {
if( in_array( $img_size, $size_array ) ){
$image_data = wp_get_attachment_image_src( $image, $img_size );
$img_link = $image_data[0];
}else{
$image_full_width = wp_get_attachment_image_src( $image, 'full' );
$img_link = kc_tools::createImageSize( $image_full_width[0], $img_size );
}
}
switch($layout){
case'7':
?>
<div class="em-feature feature-style-seven <?php echo esc_attr( $extra_class ); ?>">
<div class="em-feature-thumb">
<img src="<?php echo $img_link; ?>" alt="">
</div>
<div class="em_content_text">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
case'6':
?>
<div class="em-feature style-six <?php echo esc_attr( $extra_class ); ?>">
<div class="em_content_text">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
</div>
<?php echo $data_button;?>
</div>
<?php
break;
case'5':
?>
<div class="em-feature style-five <?php echo esc_attr( $extra_class ); ?>">
<div class="em_content_text">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
</div>
<?php if( !empty( $icon ) ){ ?>
<div class="em_feature-icon">
<span><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
</div>
<?php } ?>
<?php echo $data_button;?>
<?php echo $data_number;?>
</div>
<?php
break;
case'4':
?>
<div class="em-feature style-four <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em_feature-icon">
<span><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
</div>
<?php } ?>
<div class="em_content_text">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
</div>
</div>
<?php
break;
case'3':
?>
<div class="em-feature style-three <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em_feature-icon">
<span><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
</div>
<?php } ?>
<div class="em_content_text">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
case'2':
?>
<div class="em-feature feature-style-two <?php echo esc_attr( $extra_class ); ?>">
<div class="em-feature-thumb">
<img src="<?php echo $img_link; ?>" alt="">
</div>
<div class="em_content_text">
<?php if( !empty( $icon ) ){ ?>
<div class="em_feature-icon">
<span><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
</div>
<?php } ?>
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
default:
?>
<div class="em-feature default-style <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em_feature-icon">
<span><i class="<?php echo esc_attr( $icon ); ?>"></i></span>
</div>
<?php } ?>
<div class="em_content_text">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
}
return ob_get_clean();
}
add_shortcode('em_feature_box' ,'em_feature_box_shortcode');
}