OwlCyberSecurity - MANAGER
Edit File: pricing-table-item.php
<?php namespace MuseaCore\CPT\Shortcodes\PricingTable; use MuseaCore\Lib; class PricingTableItem implements Lib\ShortcodeInterface { private $base; function __construct() { $this->base = 'eltdf_pricing_table_item'; add_action( 'vc_before_init', array( $this, 'vcMap' ) ); } public function getBase() { return $this->base; } public function vcMap() { if ( function_exists( 'vc_map' ) ) { vc_map( array( 'name' => esc_html__( 'Pricing Table Item', 'musea-core' ), 'base' => $this->base, 'icon' => 'icon-wpb-pricing-table-item extended-custom-icon', 'category' => esc_html__( 'by MUSEA', 'musea-core' ), 'allowed_container_element' => 'vc_row', 'as_child' => array( 'only' => 'eltdf_pricing_table' ), 'params' => array( array( 'type' => 'textfield', 'param_name' => 'custom_class', 'heading' => esc_html__( 'Custom CSS Class', 'musea-core' ), 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS', 'musea-core' ) ), array( 'type' => 'dropdown', 'param_name' => 'set_active_item', 'heading' => esc_html__( 'Set Item As Active', 'musea-core' ), 'value' => array_flip( musea_elated_get_yes_no_select_array( false ) ), 'save_always' => true ), array( 'type' => 'colorpicker', 'param_name' => 'content_background_color', 'heading' => esc_html__( 'Content Background Color', 'musea-core' ) ), array( 'type' => 'textfield', 'param_name' => 'title', 'heading' => esc_html__( 'Title', 'musea-core' ), 'value' => esc_html__( 'Basic Plan', 'musea-core' ), 'save_always' => true ), array( 'type' => 'colorpicker', 'param_name' => 'title_color', 'heading' => esc_html__( 'Title Color', 'musea-core' ), 'dependency' => array( 'element' => 'title', 'not_empty' => true ) ), array( 'type' => 'colorpicker', 'param_name' => 'title_border_color', 'heading' => esc_html__( 'Title Bottom Border Color', 'musea-core' ), 'dependency' => array( 'element' => 'title', 'not_empty' => true ) ), array( 'type' => 'textfield', 'param_name' => 'price', 'heading' => esc_html__( 'Price', 'musea-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'price_color', 'heading' => esc_html__( 'Price Color', 'musea-core' ), 'dependency' => array( 'element' => 'price', 'not_empty' => true ) ), array( 'type' => 'textfield', 'param_name' => 'currency', 'heading' => esc_html__( 'Currency', 'musea-core' ), 'description' => esc_html__( 'Default mark is $', 'musea-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'currency_color', 'heading' => esc_html__( 'Currency Color', 'musea-core' ), 'dependency' => array( 'element' => 'currency', 'not_empty' => true ) ), array( 'type' => 'textfield', 'param_name' => 'price_period', 'heading' => esc_html__( 'Price Period', 'musea-core' ) ), array( 'type' => 'colorpicker', 'param_name' => 'price_period_color', 'heading' => esc_html__( 'Price Period Color', 'musea-core' ), 'dependency' => array( 'element' => 'price_period', 'not_empty' => true ) ), array( 'type' => 'textfield', 'param_name' => 'button_text', 'heading' => esc_html__( 'Button Text', 'musea-core' ), 'value' => esc_html__( 'BUY NOW', 'musea-core' ), 'save_always' => true ), array( 'type' => 'textfield', 'param_name' => 'link', 'heading' => esc_html__( 'Button Link', 'musea-core' ), 'dependency' => array( 'element' => 'button_text', 'not_empty' => true ) ), array( 'type' => 'dropdown', 'param_name' => 'target', 'heading' => esc_html__( 'Link Target', 'musea-core' ), 'value' => array_flip( musea_elated_get_link_target_array() ), 'save_always' => true ), array( 'type' => 'dropdown', 'param_name' => 'button_type', 'heading' => esc_html__( 'Button Type', 'musea-core' ), 'value' => array( esc_html__( 'Solid', 'musea-core' ) => 'solid', esc_html__( 'Outline', 'musea-core' ) => 'outline', esc_html__( 'Outline', 'musea-core' ) => 'outline-slit' ), 'save_always' => true, 'dependency' => array( 'element' => 'button_text', 'not_empty' => true ) ), array( 'type' => 'textarea_html', 'param_name' => 'content', 'heading' => esc_html__( 'Content', 'musea-core' ), 'value' => '<li>content content content</li><li>content content content</li><li>content content content</li>' ) ) ) ); } } public function render( $atts, $content = null ) { $args = array( 'custom_class' => '', 'set_active_item' => 'no', 'content_background_color' => '', 'title' => '', 'title_color' => '', 'title_border_color' => '', 'price' => '100', 'price_color' => '', 'currency' => '$', 'currency_color' => '', 'price_period' => '', 'price_period_color' => '', 'button_text' => '', 'link' => '', 'target' => '', 'button_type' => 'outline' ); $params = shortcode_atts( $args, $atts ); $params['content'] = preg_replace( '#^<\/p>|<p>$#', '', $content ); // delete p tag before and after content $params['holder_classes'] = $this->getHolderClasses( $params ); $params['holder_styles'] = $this->getHolderStyles( $params ); $params['title_styles'] = $this->getTitleStyles( $params ); $params['price_styles'] = $this->getPriceStyles( $params ); $params['currency_styles'] = $this->getCurrencyStyles( $params ); $params['price_period_styles'] = $this->getPricePeriodStyles( $params ); $params['button_type'] = ! empty( $params['button_type'] ) ? $params['button_type'] : $args['button_type']; $html = musea_core_get_shortcode_module_template_part( 'templates/pricing-table-template', 'pricing-table', '', $params ); return $html; } private function getHolderClasses( $params ) { $holderClasses = array(); $holderClasses[] = ! empty( $params['custom_class'] ) ? esc_attr( $params['custom_class'] ) : ''; $holderClasses[] = $params['set_active_item'] === 'yes' ? 'eltdf-pt-active-item' : ''; return implode( ' ', $holderClasses ); } private function getHolderStyles( $params ) { $itemStyle = array(); if ( ! empty( $params['content_background_color'] ) ) { $itemStyle[] = 'background-color: ' . $params['content_background_color']; } return implode( ';', $itemStyle ); } private function getTitleStyles( $params ) { $itemStyle = array(); if ( ! empty( $params['title_color'] ) ) { $itemStyle[] = 'color: ' . $params['title_color']; } if ( ! empty( $params['title_border_color'] ) ) { $itemStyle[] = 'border-color: ' . $params['title_border_color']; } return implode( ';', $itemStyle ); } private function getPriceStyles( $params ) { $itemStyle = array(); if ( ! empty( $params['price_color'] ) ) { $itemStyle[] = 'color: ' . $params['price_color']; } return implode( ';', $itemStyle ); } private function getCurrencyStyles( $params ) { $itemStyle = array(); if ( ! empty( $params['currency_color'] ) ) { $itemStyle[] = 'color: ' . $params['currency_color']; } return implode( ';', $itemStyle ); } private function getPricePeriodStyles( $params ) { $itemStyle = array(); if ( ! empty( $params['price_period_color'] ) ) { $itemStyle[] = 'color: ' . $params['price_period_color']; } return implode( ';', $itemStyle ); } }