| @@ -33,45 +33,66 @@ | ||
| 33 | 33 | 'css_animation' => '' |
| 34 | 34 | ), $atts ) ); |
| 35 | 35 | $output = ''; |
| 36 | 36 | |
| 37 | + // Assets. | |
| 38 | + wp_enqueue_style( | |
| 39 | + 'borderless-wpbakery-style', | |
| 40 | + BORDERLESS__STYLES . 'wpbakery.min.css', | |
| 41 | + false, | |
| 42 | + BORDERLESS__VERSION | |
| 43 | + ); | |
| 44 | + wp_enqueue_script( | |
| 45 | + 'borderless-appear-script', | |
| 46 | + BORDERLESS__LIB . 'appear.js', array('jquery'), | |
| 47 | + '1.0.0', | |
| 48 | + true | |
| 49 | + ); | |
| 50 | + wp_enqueue_script( | |
| 51 | + 'borderless-countto-script', | |
| 52 | + BORDERLESS__LIB . 'countto.js', array('jquery'), | |
| 53 | + '1.2.0', | |
| 54 | + true | |
| 55 | + ); | |
| 56 | + wp_enqueue_script( | |
| 57 | + 'borderless-wpbakery-script', | |
| 58 | + BORDERLESS__SCRIPTS . 'borderless-wpbakery.min.js', array('jquery'), | |
| 59 | + BORDERLESS__VERSION, | |
| 60 | + true | |
| 61 | + ); | |
| 37 | 62 | |
| 38 | 63 | // Retrieve data from the database. |
| 39 | 64 | $options = get_option( 'borderless' ); |
| 40 | 65 | |
| 41 | - | |
| 42 | 66 | // Set default values |
| 43 | - $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color | |
| 44 | - $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color | |
| 45 | - $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color | |
| 46 | - $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color | |
| 47 | - | |
| 67 | + $borderless_primary_color = isset( $options['primary_color'] ) ? esc_attr( $options['primary_color'] ) : '#3379fc'; //Primary Color | |
| 68 | + $borderless_secondary_color = isset( $options['secondary_color'] ) ? esc_attr( $options['secondary_color'] ) : '#3379fc'; //Secondary Color | |
| 69 | + $borderless_text_color = isset( $options['text_color'] ) ? esc_attr( $options['text_color'] ) : ''; //Text Color | |
| 70 | + $borderless_accent_color = isset( $options['accent_color'] ) ? esc_attr( $options['accent_color'] ) : '#3379fc'; //Accent Color | |
| 48 | 71 | |
| 49 | 72 | // Default Extra Class, CSS and CSS animation |
| 50 | - $css = isset( $atts['css'] ) ? $atts['css'] : ''; | |
| 51 | - $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; | |
| 52 | - $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; | |
| 73 | + $css = isset( $atts['css'] ) ? esc_attr( $atts['css'] ) : ''; | |
| 74 | + $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $atts['el_id'] ) . '"' : ''; | |
| 75 | + $el_class = isset( $atts['el_class'] ) ? esc_attr( $atts['el_class'] ) : ''; | |
| 53 | 76 | if ( '' !== $css_animation ) { |
| 54 | 77 | wp_enqueue_script( 'waypoints' ); |
| 55 | - $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; | |
| 78 | + $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation ); | |
| 56 | 79 | } |
| 57 | 80 | $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 58 | 81 | $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 59 | 82 | |
| 83 | + // Set custom values | |
| 84 | + $title_color = esc_attr( $title_color ?: $borderless_primary_color ); //Title Color | |
| 85 | + $icon_color = esc_attr( $icon_color ?: $borderless_primary_color ); //Icon Color | |
| 60 | 86 | |
| 61 | - // Set custom values | |
| 62 | - $title_color = $title_color ?: $borderless_primary_color; //Title Color | |
| 63 | - $icon_color = $icon_color ?: $borderless_primary_color; //Icon Color | |
| 64 | - | |
| 65 | - | |
| 66 | 87 | // Output |
| 67 | - $output .= '<div '.$el_id.' class="borderless-wpbakery-counter text-center '.$css_class.'">'; | |
| 68 | - if($checkicon == 'icon') { | |
| 69 | - $output .= '<div class="borderless-wpbakery-counter-icon"><i style="font-size:'.$icon_size.'; line-height:'.$icon_line_height.'; color:'.$icon_color.';" class="'.$icon.'"></i></div>'; | |
| 88 | + $output .= '<div '.$el_id.' class="borderless-wpbakery-counter text-center '.esc_attr( $css_class ).'">'; | |
| 89 | + if ( $checkicon == 'icon' ) { | |
| 90 | + $output .= '<div class="borderless-wpbakery-counter-icon"><i style="font-size:'.esc_attr( $icon_size ).'; line-height:'.esc_attr( $icon_line_height ).'; color:'.esc_attr( $icon_color ).';" class="'.esc_attr( $icon ).'"></i></div>'; | |
| 70 | 91 | } |
| 71 | - $output .= '<div class="borderless-wpbakery-counter-paramns" style="font-size:'.$counter_size.'; line-height:'.$counter_line_height.'; color:'.$counter_color.';" value="'.$value.'" value-speed="'.$value_speed.'" value-interval="'.$value_interval.'"></div>'; | |
| 72 | - if($title != ''){ | |
| 73 | - $output .= '<'.$title_tag.' style="font-size:'.$title_size.'; line-height:'.$title_line_height.'; color:'.$title_color.';" class="borderless-wpbakery-counter-title">'.$title.'</'.$title_tag.'>'; | |
| 92 | + $output .= '<div class="borderless-wpbakery-counter-paramns" style="font-size:'.esc_attr( $counter_size ).'; line-height:'.esc_attr( $counter_line_height ).'; color:'.esc_attr( $counter_color ).';" value="'.esc_attr( $value ).'" value-speed="'.esc_attr( $value_speed ).'" value-interval="'.esc_attr( $value_interval ).'"></div>'; | |
| 93 | + if ( $title != '' ) { | |
| 94 | + $output .= '<'.esc_attr( $title_tag ).' style="font-size:'.esc_attr( $title_size ).'; line-height:'.esc_attr( $title_line_height ).'; color:'.$title_color.';" class="borderless-wpbakery-counter-title">'.esc_html( $title ).'</'.esc_attr( $title_tag ).'>'; | |
| 74 | 95 | } |
| 75 | 96 | $output .= '</div>'; |
| 76 | 97 | |
| 77 | 98 | return $output; |
| @@ -85,9 +106,8 @@ | ||
| 85 | 106 | 'show_settings_on_create' => true, |
| 86 | 107 | 'category' => __( 'Borderless', 'borderless' ), |
| 87 | 108 | 'description' => __( 'Your milestones and achievements', 'borderless' ), |
| 88 | 109 | 'params' => array( |
| 89 | - | |
| 90 | 110 | array( |
| 91 | 111 | 'type' => 'textfield', |
| 92 | 112 | 'heading' => __( 'Title', 'borderless' ), |
| 93 | 113 | 'param_name' => 'title', |
| @@ -92,9 +112,8 @@ | ||
| 92 | 112 | 'heading' => __( 'Title', 'borderless' ), |
| 93 | 113 | 'param_name' => 'title', |
| 94 | 114 | 'description' => __( 'Enter the title here.', 'borderless' ), |
| 95 | 115 | ), |
| 96 | - | |
| 97 | 116 | array( |
| 98 | 117 | 'type' => 'textfield', |
| 99 | 118 | 'heading' => __( 'Counter Value', 'borderless' ), |
| 100 | 119 | 'param_name' => 'value', |
| @@ -99,9 +118,8 @@ | ||
| 99 | 118 | 'heading' => __( 'Counter Value', 'borderless' ), |
| 100 | 119 | 'param_name' => 'value', |
| 101 | 120 | 'description' => __( 'Enter number for counter without any special character.', 'borderless' ), |
| 102 | 121 | ), |
| 103 | - | |
| 104 | 122 | array( |
| 105 | 123 | 'type' => 'textfield', |
| 106 | 124 | 'heading' => __( 'Counter Value Speed', 'borderless' ), |
| 107 | 125 | 'param_name' => 'value_speed', |
| @@ -106,9 +124,8 @@ | ||
| 106 | 124 | 'heading' => __( 'Counter Value Speed', 'borderless' ), |
| 107 | 125 | 'param_name' => 'value_speed', |
| 108 | 126 | 'description' => __( 'Enter number for counter without any special character.', 'borderless' ), |
| 109 | 127 | ), |
| 110 | - | |
| 111 | 128 | array( |
| 112 | 129 | 'type' => 'textfield', |
| 113 | 130 | 'heading' => __( 'Counter Value Interval', 'borderless' ), |
| 114 | 131 | 'param_name' => 'value_interval', |
| @@ -113,9 +130,8 @@ | ||
| 113 | 130 | 'heading' => __( 'Counter Value Interval', 'borderless' ), |
| 114 | 131 | 'param_name' => 'value_interval', |
| 115 | 132 | 'description' => __( 'Enter number for counter without any special character.', 'borderless' ), |
| 116 | 133 | ), |
| 117 | - | |
| 118 | 134 | array( |
| 119 | 135 | 'type' => 'dropdown', |
| 120 | 136 | 'heading' => __( 'Icon library', 'borderless' ), |
| 121 | 137 | 'param_name' => 'checkicon', |
| @@ -124,9 +140,8 @@ | ||
| 124 | 140 | __( 'Yes', 'borderless' ) => 'icon', |
| 125 | 141 | ), |
| 126 | 142 | 'description' => __( 'Enable Icon Library.', 'borderless' ), |
| 127 | 143 | ), |
| 128 | - | |
| 129 | 144 | array( |
| 130 | 145 | 'type' => 'iconmanager', |
| 131 | 146 | 'heading' => __( 'Icon', 'borderless' ), |
| 132 | 147 | 'param_name' => 'icon', |
| @@ -135,9 +150,8 @@ | ||
| 135 | 150 | 'element' => 'checkicon', |
| 136 | 151 | 'value' => array( 'icon' ), |
| 137 | 152 | ), |
| 138 | 153 | ), |
| 139 | - | |
| 140 | 154 | array( |
| 141 | 155 | 'type' => 'dropdown', |
| 142 | 156 | 'heading' => __( 'Title Tag', 'borderless' ), |
| 143 | 157 | 'param_name' => 'title_tag', |
| @@ -153,9 +167,8 @@ | ||
| 153 | 167 | __( 'div', 'borderless' ) => 'div', |
| 154 | 168 | ), |
| 155 | 169 | 'description' => __( 'Select title tag.', 'borderless' ), |
| 156 | 170 | ), |
| 157 | - | |
| 158 | 171 | array( |
| 159 | 172 | 'type' => 'textfield', |
| 160 | 173 | 'heading' => __( 'Title Font Size', 'borderless' ), |
| 161 | 174 | 'param_name' => 'title_size', |
| @@ -161,9 +174,8 @@ | ||
| 161 | 174 | 'param_name' => 'title_size', |
| 162 | 175 | 'description' => __( 'Enter font size.', 'borderless' ), |
| 163 | 176 | 'group' => 'Typography', |
| 164 | 177 | ), |
| 165 | - | |
| 166 | 178 | array( |
| 167 | 179 | 'type' => 'textfield', |
| 168 | 180 | 'heading' => __( 'Title Line Height', 'borderless' ), |
| 169 | 181 | 'param_name' => 'title_line_height', |
| @@ -169,9 +181,8 @@ | ||
| 169 | 181 | 'param_name' => 'title_line_height', |
| 170 | 182 | 'description' => __( 'Enter line height.', 'borderless' ), |
| 171 | 183 | 'group' => 'Typography', |
| 172 | 184 | ), |
| 173 | - | |
| 174 | 185 | array( |
| 175 | 186 | 'type' => 'colorpicker', |
| 176 | 187 | 'heading' => __( 'Title Color', 'borderless' ), |
| 177 | 188 | 'param_name' => 'title_color', |
| @@ -177,9 +188,8 @@ | ||
| 177 | 188 | 'param_name' => 'title_color', |
| 178 | 189 | 'description' => __( 'Select custom color for the title.', 'borderless' ), |
| 179 | 190 | 'group' => 'Typography', |
| 180 | 191 | ), |
| 181 | - | |
| 182 | 192 | array( |
| 183 | 193 | 'type' => 'textfield', |
| 184 | 194 | 'heading' => __( 'Counter Size', 'borderless' ), |
| 185 | 195 | 'param_name' => 'counter_size', |
| @@ -185,9 +195,8 @@ | ||
| 185 | 195 | 'param_name' => 'counter_size', |
| 186 | 196 | 'description' => __( 'Enter font size.', 'borderless' ), |
| 187 | 197 | 'group' => 'Typography', |
| 188 | 198 | ), |
| 189 | - | |
| 190 | 199 | array( |
| 191 | 200 | 'type' => 'textfield', |
| 192 | 201 | 'heading' => __( 'Counter Line Height', 'borderless' ), |
| 193 | 202 | 'param_name' => 'counter_line_height', |
| @@ -193,9 +202,8 @@ | ||
| 193 | 202 | 'param_name' => 'counter_line_height', |
| 194 | 203 | 'description' => __( 'Enter line height.', 'borderless' ), |
| 195 | 204 | 'group' => 'Typography', |
| 196 | 205 | ), |
| 197 | - | |
| 198 | 206 | array( |
| 199 | 207 | 'type' => 'colorpicker', |
| 200 | 208 | 'heading' => __( 'Counter Color', 'borderless' ), |
| 201 | 209 | 'param_name' => 'counter_color', |
| @@ -201,9 +209,8 @@ | ||
| 201 | 209 | 'param_name' => 'counter_color', |
| 202 | 210 | 'description' => __( 'Select custom color for the number.', 'borderless' ), |
| 203 | 211 | 'group' => 'Typography', |
| 204 | 212 | ), |
| 205 | - | |
| 206 | 213 | array( |
| 207 | 214 | 'type' => 'textfield', |
| 208 | 215 | 'heading' => __( 'Icon Size', 'borderless' ), |
| 209 | 216 | 'param_name' => 'icon_size', |
| @@ -213,9 +220,8 @@ | ||
| 213 | 220 | 'element' => 'checkicon', |
| 214 | 221 | 'value' => array( 'icon' ), |
| 215 | 222 | ), |
| 216 | 223 | ), |
| 217 | - | |
| 218 | 224 | array( |
| 219 | 225 | 'type' => 'textfield', |
| 220 | 226 | 'heading' => __( 'Icon Line Height', 'borderless' ), |
| 221 | 227 | 'param_name' => 'icon_line_height', |
| @@ -225,9 +231,8 @@ | ||
| 225 | 231 | 'element' => 'checkicon', |
| 226 | 232 | 'value' => array( 'icon' ), |
| 227 | 233 | ), |
| 228 | 234 | ), |
| 229 | - | |
| 230 | 235 | array( |
| 231 | 236 | 'type' => 'colorpicker', |
| 232 | 237 | 'heading' => __( 'Icon Color', 'borderless' ), |
| 233 | 238 | 'param_name' => 'icon_color', |
| @@ -237,12 +242,10 @@ | ||
| 237 | 242 | 'element' => 'checkicon', |
| 238 | 243 | 'value' => array( 'icon' ), |
| 239 | 244 | ), |
| 240 | 245 | ), |
| 241 | - | |
| 242 | 246 | // Animation |
| 243 | 247 | vc_map_add_css_animation(), |
| 244 | - | |
| 245 | 248 | array( |
| 246 | 249 | 'type' => 'el_id', |
| 247 | 250 | 'heading' => __( 'Element ID', 'borderless' ), |
| 248 | 251 | 'param_name' => 'el_id', |
| @@ -247,9 +250,8 @@ | ||
| 247 | 250 | 'heading' => __( 'Element ID', 'borderless' ), |
| 248 | 251 | 'param_name' => 'el_id', |
| 249 | 252 | 'description' => sprintf( __( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'borderless' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ), |
| 250 | 253 | ), |
| 251 | - | |
| 252 | 254 | array( |
| 253 | 255 | 'type' => 'textfield', |
| 254 | 256 | 'heading' => __( 'Extra class name', 'borderless' ), |
| 255 | 257 | 'param_name' => 'el_class', |
| @@ -254,9 +256,8 @@ | ||
| 254 | 256 | 'heading' => __( 'Extra class name', 'borderless' ), |
| 255 | 257 | 'param_name' => 'el_class', |
| 256 | 258 | 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ), |
| 257 | 259 | ), |
| 258 | - | |
| 259 | 260 | array( |
| 260 | 261 | 'type' => 'css_editor', |
| 261 | 262 | 'heading' => __( 'CSS box', 'borderless' ), |
| 262 | 263 | 'param_name' => 'css', |