352 lines
16 KiB
PHP
352 lines
16 KiB
PHP
<?php
|
|
|
|
/**
|
|
* =======================================================
|
|
* KC Shortcode Map
|
|
* =======================================================
|
|
*/
|
|
|
|
add_action('init', 'cyber_table_area');
|
|
|
|
if(!function_exists('cyber_table_area')):
|
|
function cyber_table_area(){
|
|
|
|
if(function_exists('kc_add_map')):
|
|
kc_add_map(
|
|
array(
|
|
'cyber_pricing_table' => array(
|
|
|
|
'name' => esc_html__('EM Pricing Table', 'cyber'),
|
|
'description' => esc_html__('cyber pricing table', 'cyber'),
|
|
'icon' => 'kc-icon-pricing',
|
|
'category' => 'cyber',
|
|
'params' => array(
|
|
|
|
|
|
|
|
'General' => array(
|
|
array(
|
|
'name' => 'title',
|
|
'label' => esc_html__('Title','cyber'),
|
|
'type' => 'text',
|
|
'value' => 'Premium'
|
|
),
|
|
array(
|
|
'name' => 'currency',
|
|
'label' => esc_html__('currency','cyber'),
|
|
'type' => 'text',
|
|
'value' => '$'
|
|
),
|
|
array(
|
|
'name' => 'price',
|
|
'label' => esc_html__('Price','cyber'),
|
|
'type' => 'text',
|
|
'value' => '99'
|
|
),
|
|
|
|
array(
|
|
'name' => 'per_month',
|
|
'label' => esc_html__('Time','cyber'),
|
|
'type' => 'text',
|
|
'value' => '/ month'
|
|
),
|
|
array(
|
|
'type' => 'toggle',
|
|
'label' => esc_html__( 'Set Image', 'cyber' ),
|
|
'name' => 'show_img',
|
|
'value' => 'no',
|
|
'description' => esc_html__( 'set pricing top image.', 'cyber' )
|
|
),
|
|
|
|
array(
|
|
'type' => 'attach_image',
|
|
'name' => 'image',
|
|
'label' => esc_html__( 'Image', 'cyber' ),
|
|
'description' => esc_html__( 'bg image for top', 'cyber' ),
|
|
'relation' => array(
|
|
'parent' => 'show_img',
|
|
'show_when' => 'yes'
|
|
)
|
|
),
|
|
array(
|
|
'name' => 'pricing_table_attributes',
|
|
'label' => esc_html__('Attributes:','cyber'),
|
|
'description' => esc_html__('Insert tag <strong> when you want highlight text.
|
|
Example: <strong>Free Hosting</strong> Support','cyber'),
|
|
'type' => 'textarea',
|
|
'value' => base64_encode("30 days trial Features\r\nSynced to cloud database\r\n10 hours of support\r\nSocial media integration\r\nUnlimited Features")
|
|
),
|
|
array(
|
|
'name' => 'show_button',
|
|
'label' => esc_html__( 'Display Button', 'cyber' ),
|
|
'type' => 'toggle',
|
|
'value' => 'yes',
|
|
),
|
|
array(
|
|
'name' => 'button_text',
|
|
'label' => esc_html__('Button Text','cyber'),
|
|
'type' => 'text',
|
|
'value' => 'Purchase',
|
|
'relation' => array(
|
|
'parent' => 'show_button',
|
|
'show_when' => 'yes'
|
|
),
|
|
),
|
|
array(
|
|
'name' => 'button_link',
|
|
'label' => esc_html__('Button Link','cyber'),
|
|
'type' => 'link',
|
|
'value' => '#',
|
|
'relation' => array(
|
|
'parent' => 'show_button',
|
|
'show_when' => 'yes'
|
|
),
|
|
),
|
|
array(
|
|
'name' => 'show_active',
|
|
'type' => 'toggle',
|
|
'label' => esc_html__( 'Show/Hide Active', 'cyber' ),
|
|
'value' => 'no',
|
|
'description' => esc_html__( 'If you set yes, It will be set Highlight.', 'cyber' )
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'label' => __( 'Custom class', 'cyber' ),
|
|
'name' => 'custom_class',
|
|
'description' => __( 'Enter extra custom class', 'cyber' )
|
|
)
|
|
), // content
|
|
'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' => '.pricing_title h3'),
|
|
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '+:hover .pricing_title h3'),
|
|
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.pricing_title h3'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.pricing_title h3'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.pricing_title h3'),
|
|
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.pricing_title h3'),
|
|
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.pricing_title h3'),
|
|
array('property' => 'text-align', 'label' => 'Text Align', 'selector' => '.pricing_title'),
|
|
array('property' => 'background-color', 'label' => 'Bg Color', 'selector' => '.pricing_title'),
|
|
array('property' => 'background-color', 'label' => 'Bg Color Hover', 'selector' => '+.pricing_title'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.pricing_title'),
|
|
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.pricing_title'),
|
|
),
|
|
|
|
'Offer' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.pricing_title h4'),
|
|
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '+:hover .pricing_title h4'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.pricing_title h4'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.pricing_title h4'),
|
|
),
|
|
'Price' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.price_item span.tk'),
|
|
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '+:hover .price_item span.tk'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.price_item span.tk'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.price_item span.tk'),
|
|
array('property' => 'background-color', 'label' => 'Price Circle Bg Price', 'selector' => '.price_item_inner'),
|
|
array('property' => 'background-color', 'label' => 'Price Circle Bg Price Hover', 'selector' => '+:hover .price_item_inner'),
|
|
array('property' => 'background-color', 'label' => 'Price Bg Price', 'selector' => '.price_item'),
|
|
array('property' => 'background-color', 'label' => 'Price Bg Price Hover', 'selector' => '+:hover .price_item'),
|
|
array('property' => 'border', 'label' => 'Price Border', 'selector' => '+.price_item'),
|
|
array('property' => 'border-color', 'label' => 'Price Border Hover', 'selector' => '+:hover .price_item'),
|
|
array('property' => 'padding', 'label' => 'Price', 'selector' => '.price_item'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.price_item'),
|
|
array('property' => 'padding', 'label' => 'Price padding', 'selector' => '.price_item'),
|
|
),
|
|
'Price Heade' => array(
|
|
array('property' => 'background-color', 'label' => 'Price Circle Bg Price', 'selector' => '.price_item_inner_center'),
|
|
array('property' => 'background-color', 'label' => 'Price Circle Bg Price Hover', 'selector' => '+:hover .price_item_inner_center'),
|
|
),
|
|
|
|
|
|
'Currency' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.price_item span.curencyp'),
|
|
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '+:hover .price_item span.curencyp'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.price_item span.curencyp'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.price_item span.curencyp'),
|
|
),
|
|
'Duration' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.price_item span'),
|
|
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '+:hover .price_item span'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.price_item span'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.price_item span'),
|
|
),
|
|
'Attributes' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.featur ul li'),
|
|
array('property' => 'color', 'label' => 'Color Hover', 'selector' => '+:hover .featur ul li'),
|
|
array('property' => 'background-color', 'label' => 'Background Color', 'selector' => '.featur ul'),
|
|
array('property' => 'background-color', 'label' => 'Background Color 2', 'des' => 'Background color line highlight', 'selector' => '.featur ul li:nth-of-type(2n+1)'),
|
|
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.featur ul li'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.featur ul li'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.featur ul li'),
|
|
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.featur ul li'),
|
|
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.featur ul li'),
|
|
array('property' => 'text-align', 'label' => 'Text Align', 'selector' => '.featur ul li'),
|
|
array('property' => 'border', 'label' => 'Border', 'selector' => '.featur ul li'),
|
|
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.featur ul li'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.featur ul li:last-child,.featur ul li:first-child'),
|
|
array('property' => 'margin', 'label' => 'Icon Spacing', 'selector' => '.featur ul li i'),
|
|
),
|
|
'Button' => array(
|
|
array('property' => 'color', 'label' => 'Text Color', 'selector' => '.order_now a'),
|
|
array('property' => 'color', 'label' => 'Text Hover Color', 'selector' => '.order_now a:hover'),
|
|
array('property' => 'background-color', 'label' => 'Button BG Color', 'selector' => '.order_now a'),
|
|
array('property' => 'background-color', 'label' => 'Button BG Hover Color', 'selector' => '+:hover .order_now a'),
|
|
array('property' => 'border', 'label' => 'Button Border', 'selector' => '.order_now a'),
|
|
array('property' => 'border-color', 'label' => 'Button Border Color Hover', 'selector' => '.order_now a:hover'),
|
|
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.order_now a'),
|
|
array('property' => 'background-color', 'label' => 'Wrapper Button BG Color', 'selector' => '.order_now'),
|
|
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.order_now a'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.order_now a'),
|
|
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.order_now a'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.order_now a'),
|
|
array('property' => 'text-align', 'label' => 'Button Align', 'selector' => '.order_now'),
|
|
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.order_now a'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.order_now a'),
|
|
),
|
|
'Boxes' => array(
|
|
array('property' => 'background'),
|
|
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover'),
|
|
array('property' => 'background-color', 'label' => 'Price BG Color', 'selector' => '+ .price_item_inner_center'),
|
|
array('property' => 'background-color', 'label' => 'Price BG Hover Color', 'selector' => '+:hover .price_item_inner_center'),
|
|
array('property' => 'display', 'label' => 'Display'),
|
|
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' => '+.kc-pricing-tables'),
|
|
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '+:hover'),
|
|
array('property' => 'border', 'label' => 'Border'),
|
|
array('property' => 'border-color', 'label' => 'Border Color Hover', 'selector' => '+:hover'),
|
|
array('property' => 'border-radius', 'label' => 'Border Radius'),
|
|
array('property' => 'border-radius', 'label' => 'Border Radius Hover', 'selector' => '+:hover'),
|
|
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '+:hover'),
|
|
array('property' => 'margin', 'label' => 'Margin'),
|
|
array('property' => 'padding', 'label' => 'Padding'),
|
|
)
|
|
)
|
|
)
|
|
)
|
|
),
|
|
'animate' => array(
|
|
array(
|
|
'name' => 'animate',
|
|
'type' => 'animate'
|
|
)
|
|
),
|
|
|
|
)// Params
|
|
|
|
)// end shortcode key
|
|
)// first array
|
|
); // End add map
|
|
endif;
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* =======================================================
|
|
* Register Shortcode
|
|
* =======================================================
|
|
*/
|
|
|
|
|
|
function cyber_table_section($atts,$content){
|
|
ob_start();
|
|
$cyber_shortcode_atts = shortcode_atts(array(
|
|
'title' => '',
|
|
'currency' => '',
|
|
'price' => '',
|
|
'per_month' => '',
|
|
'pricing_table_attributes' => '',
|
|
'show_button' => '',
|
|
'button_text' => '',
|
|
'button_link' => '',
|
|
'show_img' => '',
|
|
'image' => '',
|
|
'show_active' => '',
|
|
'custom_css' => '',
|
|
),$atts);
|
|
extract($cyber_shortcode_atts);
|
|
|
|
//custom class
|
|
$wrap_class = apply_filters( 'kc-el-class', $atts );
|
|
if( !empty( $custom_class ) ):
|
|
$wrap_class[] = $custom_class;
|
|
endif;
|
|
$extra_class = implode( ' ', $wrap_class );
|
|
$images = wp_get_attachment_image_src( $image, 'full');
|
|
?>
|
|
|
|
<div class="<?php echo $extra_class; ?> single_pricing <?php if($show_active=='yes'){echo esc_attr('active');}?>">
|
|
<div class="pricing_content">
|
|
<?php if( $show_img == 'yes' && !empty( $images ) ){ ?>
|
|
<div class="pricing_img">
|
|
<img src="<?php echo esc_url( $images[0] ); ?>" alt="" />
|
|
</div>
|
|
|
|
<?php } ?>
|
|
<div class="pricing_head">
|
|
<?php if($title){?>
|
|
<div class="pricing_title">
|
|
<h3><?php echo esc_html( $title ); ?></h3>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="pricing_body">
|
|
|
|
<?php
|
|
$attributes = explode("\n", $pricing_table_attributes);
|
|
if($attributes):
|
|
?>
|
|
|
|
<div class="featur">
|
|
<ul>
|
|
<?php
|
|
foreach ($attributes as $key => $value) :
|
|
?>
|
|
<li><?php echo $value; ?></li>
|
|
<?php endforeach;?>
|
|
</ul>
|
|
</div>
|
|
<?php endif;?>
|
|
|
|
<div class="price_item">
|
|
<div class="price_item_inner">
|
|
<div class="price_item_inner_center">
|
|
<?php if($currency){?>
|
|
<span class="curencyp"><?php echo esc_html__( $currency); ?></span>
|
|
<?php } ?>
|
|
<?php if($price){?>
|
|
<span class="tk"><?php echo esc_html__( $price ); ?></span>
|
|
<?php } ?>
|
|
<?php if($per_month){?>
|
|
<span class="monthp">
|
|
<span class="month_inner">
|
|
<span class="bootmp"><?php echo esc_html__( $per_month ); ?></span>
|
|
</span>
|
|
</span>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php if($button_link){?>
|
|
<div class="pricing_bottom">
|
|
<div class="order_now">
|
|
<a href="<?php echo $button_link; ?>" class="singinp">
|
|
<?php echo $button_text; ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
return ob_get_clean();
|
|
}
|
|
add_shortcode('cyber_pricing_table','cyber_table_section');
|