HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/MvAlphen/va-bo.nl/wwwroot/wp-content/plugins/hattan-plugin/modules/VC_InfoBox.php
<?php

if(!class_exists('VC_InfoBox')){
  class VC_InfoBox extends VC_Module{
      private $shortcode_name = 'studiothemes_infobox';
      function __construct() {
          add_action( 'admin_init', array( $this, 'studiothemes_shortcode_init' ) );
          parent::__construct($this->shortcode_name);
          add_shortcode( $this->shortcode_name, array( $this, 'studiothemes_shortcode' ) );

      }
   
     function studiothemes_shortcode_init() {
          $icons= getIconArray();
          if(function_exists('vc_map')){
            vc_map(array(
              "name" => "InfoBox",
              "base" => $this->shortcode_name,
              "category" => 'by Studio Themes',
              "icon" => "",
              "params" => array(
                array(
                  "type" => "dropdown",
                  "holder" => "",
                  "class" => "",
                  "heading" => __("Type InfoBox",'hattan-plugin'),
                  "param_name" => "type_infobox",
                  "value" => array(
                    __("InboBox 1",'hattan-plugin') => "infobox1",
                    __("InfoBox 2",'hattan-plugin') => "infobox2",
                    __("InfoBox 3",'hattan-plugin') => "infobox3",
                    __("InfoBox 4",'hattan-plugin') => "infobox4",
                    __("InfoBox 5",'hattan-plugin') => "infobox5",
                    __("InfoBox 6",'hattan-plugin') => "infobox6",
                    __("InfoBox 7",'hattan-plugin') => "infobox7",
                  ),
                  "description" => ""
                ),
                  array(
                      'type' => 'dropdown',
                      'heading' => __( 'Icon library', 'js_composer' ),
                      'value' => array(
                          __( 'Font Awesome', 'js_composer' ) => 'fontawesome',
                          __( 'Open Iconic', 'js_composer' ) => 'openiconic',
                          __( 'Typicons', 'js_composer' ) => 'typicons',
                          __( 'Entypo', 'js_composer' ) => 'entypo',
                          __( 'Linecons', 'js_composer' ) => 'linecons',
                          __( 'Line-Style', 'js_composer' ) => 'linestyle'
                      ),
                      'admin_label' => true,
                      'param_name' => 'type',
                      'description' => __( 'Select icon library.', 'js_composer' ),
                  ),
                  array(
                      'type' => 'iconpicker',
                      'heading' => __( 'Icon', 'js_composer' ),
                      'param_name' => 'icon_fontawesome',
                      'value' => 'fa fa-adjust', // default value to backend editor admin_label
                      'settings' => array(
                          'emptyIcon' => false, // default true, display an "EMPTY" icon?
                          'iconsPerPage' => 4000, // default 100, how many icons per/page to display, we use (big number) to display all icons in single page
                      ),
                      'dependency' => array(
                          'element' => 'type',
                          'value' => 'fontawesome',
                      ),
                      'description' => __( 'Select icon from library.', 'js_composer' ),
                  ),
                  array(
                      'type' => 'iconpicker',
                      'heading' => __( 'Icon', 'js_composer' ),
                      'param_name' => 'icon_openiconic',
                      'value' => 'vc-oi vc-oi-dial', // default value to backend editor admin_label
                      'settings' => array(
                          'emptyIcon' => false, // default true, display an "EMPTY" icon?
                          'type' => 'openiconic',
                          'iconsPerPage' => 4000, // default 100, how many icons per/page to display
                      ),
                      'dependency' => array(
                          'element' => 'type',
                          'value' => 'openiconic',
                      ),
                      'description' => __( 'Select icon from library.', 'js_composer' ),
                  ),
                  array(
                      'type' => 'iconpicker',
                      'heading' => __( 'Icon', 'js_composer' ),
                      'param_name' => 'icon_typicons',
                      'value' => 'typcn typcn-adjust-brightness', // default value to backend editor admin_label
                      'settings' => array(
                          'emptyIcon' => false, // default true, display an "EMPTY" icon?
                          'type' => 'typicons',
                          'iconsPerPage' => 4000, // default 100, how many icons per/page to display
                      ),
                      'dependency' => array(
                          'element' => 'type',
                          'value' => 'typicons',
                      ),
                      'description' => __( 'Select icon from library.', 'js_composer' ),
                  ),
                  array(
                      'type' => 'iconpicker',
                      'heading' => __( 'Icon', 'js_composer' ),
                      'param_name' => 'icon_entypo',
                      'value' => 'entypo-icon entypo-icon-note', // default value to backend editor admin_label
                      'settings' => array(
                          'emptyIcon' => false, // default true, display an "EMPTY" icon?
                          'type' => 'entypo',
                          'iconsPerPage' => 4000, // default 100, how many icons per/page to display
                      ),
                      'dependency' => array(
                          'element' => 'type',
                          'value' => 'entypo',
                      ),
                  ),
                  array(
                      'type' => 'iconpicker',
                      'heading' => __( 'Icon', 'js_composer' ),
                      'param_name' => 'icon_linecons',
                      'value' => 'vc_li vc_li-heart', // default value to backend editor admin_label
                      'settings' => array(
                          'emptyIcon' => false, // default true, display an "EMPTY" icon?
                          'type' => 'linecons',
                          'iconsPerPage' => 4000, // default 100, how many icons per/page to display
                      ),
                      'dependency' => array(
                          'element' => 'type',
                          'value' => 'linecons',
                      ),
                      'description' => __( 'Select icon from library.', 'js_composer' ),
                  ),
                  array(
                      "type" => "dropdown",
                      "heading" => __("Line-Style", 'hattan-plugin'),
                      "param_name" => "icon_linestyle",
                      "value" => $icons,
                      "dependency" => array('element' => "type", 'value' => array('linestyle')),
                      "description" => __("Visit the <a href='http://fontawesome.io/icons/'>Icons List</a> and grab the name of the icon you want to display. Ex: fa-car", 'hattan-plugin')
                  ),
                array(
                   "type" => "textfield",
                   "heading" => __("Number", 'hattan-plugin'),
                   "param_name" => "number",
                   "value" => "2",
                   "dependency" => array('element' => "type_infobox", 'value' => 'infobox6'),
                   "description" => ""
                 ),
                  array(
                    "type" => "colorpicker",
                    "holder" => "",
                    "class" => "",
                    "heading" => __("Icon,Number or Border Color",'hattan-plugin'),
                    "param_name" => "icon_border_color",
                    "description" => "",
                    "dependency" => array('element' => "type_infobox", 'value' => array('infobox2','infobox3','infobox4')),
                    "group" => __("Style",'hattan-plugin')

                  ),
                  array(
                    "type" => "textfield",
                    "holder" => "",
                    "class" => "",
                    "heading" => __("Title",'hattan-plugin'),
                    "param_name" => "title",
                    "value" => "",
                    "description" => ""
                  ),
                  array(
                      "type" => "colorpicker",
                      "holder" => "",
                      "class" => "",
                      "heading" => __("Title Color",'hattan-plugin'),
                      "param_name" => "title_color",
                      "description" => "",
                      "group" => __("Style",'hattan-plugin')
                  ),
                  array(
                    "type" => "textarea",
                    "holder" => "",
                    "class" => "",
                    "heading" => __("Description",'hattan-plugin'),
                    "param_name" => "description",
                    "value" => "",
                    "description" => ""
                  ),
                  array(
                      "type" => "colorpicker",
                      "holder" => "",
                      "class" => "",
                      "heading" => __("Description Color",'hattan-plugin'),
                      "param_name" => "description_color",
                      "description" => "",
                      "group" => __("Style",'hattan-plugin')
                  ))
                  ));
          }
          
      }
      /*
      Shortcode logic how it should be rendered
      */
       function studiothemes_shortcode($atts, $content = null) {
            $type_infobox  = $icon = $type = $icon_fontawesome = $icon_openiconic = $icon_entypo = $icon_typicons = $icon_linecons = $icon_linestyle = $number = $icon_border_color = $title = $title_color = $description = $description_color = $css_animation = $html = "";
           $args = array(
              'type_infobox' => 'infobox1',
              'type'=>'fontawesome',
              'icon_fontawesome'=>'fa fa-adjust',
              'icon_openiconic'=>'vc-oi vc-oi-dial',
              'icon_typicons'=>'typcn typcn-adjust-brightness',
              'icon_entypo'=>'entypo-icon entypo-icon-note',
              'icon_linecons'=>'vc_li vc_li-heart',
              'icon_linestyle'=>'',
              'number' => '2',
              'icon_border_color' => '',
              'title' => '',
              'title_color' => '',
              'description' => '',
              'description_color' => '',
              'css_animation' => ''
          );

          extract(shortcode_atts($args, $atts));

           vc_icon_element_fonts_enqueue( $type );
           $icon = parent::setIcon($type,$icon_fontawesome,$icon_openiconic,$icon_typicons,$icon_entypo,$icon_linecons,$icon_linestyle);
          
          if($type_infobox == "infobox1"){ //infbox1
             $html .="<div class=\"contact-info-3\">";
              if($icon != "")
              {
                  $html .="<div ".parent::buildStyle($icon_border_color,"","",$icon_border_color)."><i class='".$icon."'></i></div>";
              }
              if($title!="")
              {
                  $html .="<strong ".parent::buildStyle($title_color).">".$title."</strong>";
              }
              if($description!="")
              {
                  $html .="<span ".parent::buildStyle($description_color).">".do_shortcode($description)."</span>";
              }
              $html .="</div>";
          }
          elseif ($type_infobox == "infobox2") { //infobox2
              $html .="<div class='infobox-3'>";
              $html .="<header>";
              if($icon != "")
              {
                  $html .="<i".parent::buildStyle($icon_border_color,"","",$icon_border_color)." class='".$icon."'></i>";
              }
              if($title!="")
              {
                  $html .="<h4 ".parent::buildStyle($title_color).">".$title."</h4>";
              }
              $html .="</header>";
              if($description!="")
              {
                  $html .="<p ".parent::buildStyle($description_color).">".do_shortcode($description)."</p>";
              }
              $html .="</div>";
          }
          elseif($type_infobox == "infobox3") {
              $html .="<article class=\"infobox-1\"><header>";
                            if($title!="")
              {
                  $html .="<h5 ".parent::buildStyle().">".$title."</h5>";
              }
              $html .= "</header>";
              if($icon != "")
              {
                  $html .="<div ".parent::buildStyle($icon_border_color,"","",$icon_border_color)."><i class='".$icon."'></i></div>";
              }
              if($description!="")
              {
                  $html .="<p ".parent::buildStyle($description_color).">".do_shortcode($description)."</p>";
              }
              $html .="</article>";
          }
          elseif($type_infobox == "infobox4") {
              $html .="<article class=\"infobox-4\"><header>";
              if($icon != "")
              {
                  $html .="<div ".parent::buildStyle($icon_border_color,"","",$icon_border_color)."><i class='".$icon."'></i></div>";
              }
              if($title!="")
              {
                  $html .="<h5 ".parent::buildStyle().">".$title."</h5>";
              }
              $html .= "</header>";
              if($description!="")
              {
                  $html .="<p ".parent::buildStyle($description_color).">".do_shortcode($description)."</p>";
              }
              $html .="</article>";
          }elseif($type_infobox == "infobox5") {
            $html .="<div class=\"contact-info-1\">";
            $html .="<div ".parent::buildStyle($icon_border_color,"","",$icon_border_color)."><i class='".$icon."'></i></div>";
            $html .="<div ".parent::buildStyle().">".$title."</div>";
            $html .="</div>";
          }elseif($type_infobox == "infobox6") {
            $html .="<article class=\"infobox-6\"><header>";
              if($number != "")
              {
                  $html .="<div ".parent::buildStyle($icon_border_color,"","",$icon_border_color).">".$number."</div>";
              }
              if($title!="")
              {
                  $html .="<h6 ".parent::buildStyle($title_color).">".$title."</h6>";
              }
              $html .= "</header>";
              if($description!="")
              {
                  $html .="<p ".parent::buildStyle($description_color).">".do_shortcode($description)."</p>";
              }
              $html .="<hr>";
              $html .="</article>";
          }elseif($type_infobox == 'infobox7'){
            $html .="<article class=\"infobox-7\"><header>";
            if($title!="")
            {
                $html .="<h5 ".parent::buildStyle($title_color).">".$title."</h5>";
            }                    
            $html .= "</header>";                        
            if($icon != "")
            {
                $html .="<i class='".$icon."'".parent::buildStyle("","",$icon_border_color,"")."></i>";
            }                    
                                
            if($description!="")
            {
                $html .="<p ".parent::buildStyle($description_color).">".do_shortcode($description)."</p>";
            }           
            $html .="</article>";
          }
          
          return parent::add_div_animation($html,$css_animation);
    }
    
  }
  // Finally initialize code
  new VC_InfoBox();
}