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

474 lines
17 KiB
PHP

<?php
/*
* Team Section
* Author: EM40
* Author URI: http://raytheme.com
* Version: 1.0
*/
/**
* =======================================================
* KC Shortcode Map
* =======================================================
*/
add_action('init', 'em_service_box');
if(!function_exists('em_service_box')):
function em_service_box(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'em_service_box' => array(
'name' => __( 'EM service Box', 'cyber' ),
'title' => 'service Settings',
'icon' => 'kc-icon-feature-box',
'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',
'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/layout4.jpg',
),
'description' => __( 'When select style 2 that time, set column and set gutter not work', 'cyber' ),
'value' => '1'
),
array(
'name' => 'icon',
'label' => __( 'Select Icon', 'cyber' ),
'type' => 'icon_picker',
'description' => __( 'Select icon display in box', 'cyber' ),
'value' => 'sl-rocket',
),
array(
'name' => 'siconealign',
'label' => __( 'Icon position', 'cyber' ),
'type' => 'select',
'options' => array(
'sleft' => __( 'Icon Left', 'cyber' ),
'sright' => __( 'Icon Right', 'cyber' ),
'smiddle' => __( 'Icon Middle', 'cyber' ),
),
'value' => 'smiddle',
'relation' => array(
'parent' => 'layout',
'show_when' => array( '1' )
)
),
array(
'type' => 'text',
'name' => 'title',
'label' => __( 'Name', 'cyber' ),
'value' => 'Your Service Name',
'admin_label' => true
),
array(
'type' => 'text',
'name' => 'numeric_title',
'label' => __( 'Enter Of Number', 'cyber' ),
'value' => '01',
'admin_label' => true
),
array(
'type' => 'textarea',
'name' => 'desc',
'label' => __( 'Description', 'cyber' ),
'value' => base64_encode('Lorem ipsum dolor sit amet, consec anglse sicing elite sombar, sed do incididunt ut labore')
),
array(
'name' => 'my_text',
'label' => 'Service Feature',
'type' => 'editor', // USAGE TEXTAREA_HTML TYPE
'value' => base64_encode( 'DEFAULT-CONTENT' ), // remove this if you do not need a default content
'description' => 'Type Service Feature Here',
'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( '4' )
)
),
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( '4' )
)
),
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-service-title h2'),
array('property' => 'color', 'label' => 'Hover Color', 'selector' => '.em-service-title h2:hover'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em-service-title h2'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-service-title h2'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-service-title h2'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em-service-title h2'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-service-title h2'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-service-title h2'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-service-title h2'),
),
'Desc' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.em-service-desc'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em-service-desc'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-service-desc'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-service-desc'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em-service-desc'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-service-desc'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-service-desc'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-service-desc'),
),
'Icon' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.em-service-icon i'),
array('property' => 'color', 'label' => 'Hover Color', 'selector' => '+:hover .em-service-icon i'),
array('property' => 'background-color', 'label' => 'Background Color', 'selector' => '.em-service-icon i'),
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover .em-service-icon i'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-service-icon i'),
array('property' => 'height', 'label' => 'Height', 'selector' => '.em-service-icon i'),
array('property' => 'width', 'label' => 'Width', 'selector' => '.em-service-icon i'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-service-icon i'),
array('property' => 'border', 'label' => 'Border', 'selector' => '.content-icon i'),
array('property' => 'border-color', 'label' => 'Hover Border', 'selector' => '+:hover .em-service-icon i'),
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.em-service-icon i'),
array('property' => 'border-radius', 'label' => 'Border Radius Hover', 'selector' => '+:hover .em-service-icon i'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-service-icon i'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-service-icon i')
),
'Button' => array(
array('property' => 'color', 'label' => 'Button Color', 'selector' => '.service-btn > a'),
array('property' => 'color', 'label' => 'Button Hover Color', 'selector' => '.service-btn > a:hover'),
array('property' => 'background-color', 'label' => 'Button BG Color', 'selector' => '.service-btn > a'),
array('property' => 'background-color', 'label' => 'Button BG Hover Color', 'selector' => '.service-btn > a:hover'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.service-btn > a'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.service-btn > a'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.service-btn > a'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.service-btn > a'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.service-btn > a'),
array('property' => 'border', 'label' => 'Button Border', 'selector' => '.service-btn > a'),
array('property' => 'border-color', 'label' => 'Button Border Color Hover', 'selector' => '.service-btn > a:hover'),
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.service-btn > a'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.service-btn > a'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.service-btn > a')
),
'Box' => array(
array('property' => 'background'),
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover'),
array('property' => 'background-color', 'label' => 'BG Color Hover Style 3', 'selector' => '+:hover .em-service-inner'),
array('property' => 'text-align', 'label' => 'Box Text Align'),
array('property' => 'border', 'label' => 'Border'),
array('property' => 'border-color', 'label' => 'Border Color Hover', 'selector' => '+.em-service:hover'),
array('property' => 'display', 'label' => 'Display'),
array('property' => 'border-radius', 'label' => 'Border Radius'),
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' => '+.em-service'),
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '+.em-service:hover'),
array('property' => 'margin', 'label' => 'Margin'),
array('property' => 'padding', 'label' => 'Padding'),
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '+.em-service:hover')
)
)
)
)
),
'animate' => array(
array(
'name' => 'animate',
'type' => 'animate'
)
),
)
),
)// first array
); // End add map
endif;
}
endif;
/**
* =======================================================
* Register Shortcode team section
* =======================================================
*/
// [em_service_box title="" desc="" icon=""]
if(!function_exists('em_service_box_shortcode')){
function em_service_box_shortcode($atts,$content){
ob_start();
$em_service_box = shortcode_atts(array(
'layout' => '1',
'siconealign' => '1',
'icon' => '',
'title' => '',
'desc' => '',
'my_text' => '',
'numeric_title' => '',
'show_button' => '',
'button_text' => '',
'button_link' => '',
'image' => '',
'custom_css' => '',
'custom_class' => '',
),$atts);
extract( $em_service_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_desc=$data_my_text=$data_numeric_title=$data_button=$data_img=$img_size=$img_link="";
$size_array = array('full', 'medium', 'large', 'thumbnail');
if ( !empty( $title ) ) {
$data_title .= '<div class="em-service-title"><h2>';
$data_title .= $title;
$data_title .= '</h2></div>';
}
if ( !empty( $desc ) ) {
$data_desc .= '<div class="em-service-desc"><p>';
$data_desc .= $desc;
$data_desc .= '</p></div>';
}
if ( !empty( $my_text ) ) {
$data_my_text .= '<div class="em-service-feature">';
$data_my_text .= $my_text;
$data_my_text .= '</div>';
}
if ( !empty( $numeric_title ) ) {
$data_numeric_title .= '<div class="em-service-number"><span>';
$data_numeric_title .= $numeric_title;
$data_numeric_title .= '</span></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="service-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 );
}
}
?>
<?php
switch ( $layout ) {
case '6':
?>
<div class="em-service service-style-six <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em-service-icon">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<div class="em_service_content">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
case '5':
?>
<div class="em-service service-style-five <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em-service-icon">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<div class="em_service_content">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_my_text; ?>
<?php echo $data_button;?>
<?php echo $data_numeric_title;?>
</div>
</div>
<?php
break;
case '2':
?>
<div class="em-service service-style-two <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em-service-icon">
<?php echo $data_numeric_title;?>
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<div class="em_service_content">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
case '4':
?>
<div class="em-service style_4 <?php echo esc_attr( $extra_class ); ?>">
<div class="em-service-thumb">
<img src="<?php echo $img_link; ?>" alt="">
</div>
<div class="em_service_content">
<div class="em_single_service_text">
<div class="service_top_text">
<?php echo $data_title; ?>
</div>
<div class="em-service-inner">
<?php echo $data_desc; ?>
</div>
<?php echo $data_button;?>
</div>
</div>
</div>
<?php
break;
case '3':
?>
<div class="em-service service-style-three <?php echo esc_attr( $extra_class ); ?>">
<?php if( !empty( $icon ) ){ ?>
<div class="em-service-icon">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<div class="em_service_content">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
<?php
break;
default:
?>
<div class="em-service2 <?php echo esc_attr( $siconealign ); ?> <?php echo esc_attr( $extra_class ); ?>">
<div class="em_service_content ">
<div class="em_single_service_text">
<div class="service_top_text">
<?php if( !empty( $icon ) ){ ?>
<div class="em-service-icon">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
</div>
<div class="em-service-inner">
<?php echo $data_title; ?>
<?php echo $data_desc; ?>
<?php echo $data_button;?>
</div>
</div>
</div>
</div>
<?php
break;
}
return ob_get_clean();
}
add_shortcode('em_service_box' ,'em_service_box_shortcode');
}