PluginProbe
Borderless – Addons and Templates for Elementor / 1.2.5
Borderless – Addons and Templates for Elementor v1.2.5
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / wpbakery / paramns / icon-manager-param.php

icon-manager-param.php in Borderless – Addons and Templates for Elementor 1.2.5, at modules/wpbakery/paramns/icon-manager-param.php

129 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if(!class_exists('Icon_Manager_Param')) {
3 class Icon_Manager_Param {
4 function __construct() {
5
6 add_action( 'admin_enqueue_scripts', array( $this, 'icon_fonts_styles' ) );
7
8 $GLOBALS['pid']=0;
9 $id=null;
10 $pcnt=null;
11 if(defined('WPB_VC_VERSION') && version_compare(WPB_VC_VERSION, 4.8) >= 0) {
12 if(function_exists('vc_add_shortcode_param'))
13 {
14 vc_add_shortcode_param('iconmanager', array($this,'iconmanager'));
15 }
16 }
17 else {
18 if(function_exists('add_shortcode_param'))
19 {
20 add_shortcode_param('iconmanager', array($this,'iconmanager'));
21 }
22 }
23 }
24
25 function iconmanager($settings, $value)
26 {
27 $GLOBALS['pid'] = $GLOBALS['pid'] + 1;
28 $pcnt=$GLOBALS['pid'];
29
30 $Borderless_IF = new Borderless_IF;
31 $font_manager = $Borderless_IF->get_font_manager($pcnt);
32 $dependency = '';
33
34 $params = parse_url($_SERVER['HTTP_REFERER']);
35 $vc_is_inline = false;
36 if(isset($params['query'])){
37 parse_str($params['query'],$params);
38 $vc_is_inline = isset($params['vc_action']) ? true : false;
39 }
40
41 $output = '<div class="my_param_block">'
42 .'<input name="'.esc_attr($settings['param_name']).'"
43 class="wpb_txt_icon_value wpb_vc_param_value wpb-textinput '.esc_attr($settings['param_name']).'
44 '.esc_attr($settings['type']).'_field" type="hidden"
45
46 value="'.esc_attr($value).'" ' . $dependency . ' id="'.esc_attr($pcnt).'"/>'
47 .'</div>';
48 if($vc_is_inline){
49 $output .= '<script type="text/javascript">
50 var val=jQuery("#'.esc_attr($pcnt).'").val();
51 //alert("yes");
52 var val=jQuery("#'.esc_attr($pcnt).'").val();
53 var pmid="'.esc_attr($pcnt).'";
54 var pmid="'.esc_attr($pcnt).'";
55 var val=jQuery("#'.esc_attr($pcnt).'").val();
56 if(val==""){
57 val="none";
58 }
59 if(val=="icon_color="){
60 val="none";
61 }
62
63 jQuery(".preview-icon-'.esc_attr($pcnt).'").html("<i class="+val+"></i>");
64
65 jQuery(".icon-list-'.esc_attr($pcnt).' li[data-icons=\'"+ val+"\']").addClass("selected");
66
67 jQuery(".icons-list li").click(function() {
68
69 var id=jQuery(this).attr("id");
70 //alert(id);
71 jQuery(this).attr("class","selected").siblings().removeAttr("class");
72 var icon = jQuery(this).attr("data-icons");
73
74 jQuery("#"+id).val(icon);
75 jQuery(".preview-icon-"+id).html("<i class=\'"+icon+"\'></i>");
76 });
77
78 </script>';
79 } else {
80
81
82 $output .= '<script type="text/javascript">
83
84
85 jQuery(document).ready(function(){
86 var pmid="'.esc_attr($pcnt).'";
87 var val=jQuery("#'.esc_attr($pcnt).'").val();
88 if(val==""){
89 val="none";
90 }
91 if(val=="icon_color="){
92 val="none";
93 }
94
95 jQuery(".preview-icon-'.esc_attr($pcnt).'").html("<i class="+val+"></i>");
96
97 jQuery(".icon-list-'.esc_attr($pcnt).' li[data-icons=\'"+ val+"\']").addClass("selected");
98 });
99 jQuery(".icons-list li").click(function() {
100 var id=jQuery(this).attr("id");
101 //alert(id);
102 jQuery(this).attr("class","selected").siblings().removeAttr("class");
103 var icon = jQuery(this).attr("data-icons");
104
105 jQuery("#"+id).val(icon);
106 jQuery(".preview-icon-"+id).html("<i class=\'"+icon+"\'></i>");
107 });
108 </script>';
109 }
110 $output .= '<div class="icon-manager-section" data-old-icon-value="'.esc_attr($pcnt).'">'.$font_manager.'</div>';
111 return $output;
112 }
113
114 public function icon_fonts_styles( $hook ) {
115 wp_register_style( 'borderless_wpbakery_icon_fonts', BORDERLESS__URL . 'assets/styles/wpbakery-icon-fonts.css', null, BORDERLESS__VERSION );
116
117 if ( 'post.php' == $hook || 'post-new.php' == $hook ) {
118 wp_enqueue_style( 'borderless_wpbakery_icon_fonts' );
119 }
120 }
121
122 }
123 }
124
125 if(class_exists('Icon_Manager_Param'))
126 {
127 $Icon_Manager_Param = new Icon_Manager_Param();
128 }
129