about-widget.php
9 years ago
accordion-api.php
9 years ago
accordion.php
9 years ago
attachment-url.php
9 years ago
audio.php
9 years ago
before-after.php
9 years ago
button.php
9 years ago
code.php
9 years ago
contact-box.php
9 years ago
contact-form.php
9 years ago
divider.php
9 years ago
dropcap.php
9 years ago
facebook.php
9 years ago
flickr.php
9 years ago
gallery.php
9 years ago
gmap.php
9 years ago
highlight.php
9 years ago
image.php
9 years ago
instagram-feed.php
9 years ago
latest-items.php
10 years ago
latest-posts-slider.php
9 years ago
popular-posts-widget.php
9 years ago
quote.php
9 years ago
recent-posts-grid-carousel.php
9 years ago
recent-posts-land-style.php
9 years ago
recent-posts-masonry.php
9 years ago
recent-posts-tiles.php
9 years ago
recent-posts-timeline.php
9 years ago
recent-posts-widget.php
9 years ago
recent-posts.php
9 years ago
related-posts.php
9 years ago
sample-element.php
9 years ago
search.php
9 years ago
slider.php
9 years ago
socials-list.php
9 years ago
tabs-api.php
9 years ago
tabs.php
9 years ago
text.php
9 years ago
touch-slider.php
9 years ago
video.php
9 years ago
text.php
465 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Text element |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author |
| 9 | * @link http://averta.net/phlox/ |
| 10 | * @copyright (c) 2010-2017 |
| 11 | */ |
| 12 | function auxin_get_text_master_array( $master_array ) { |
| 13 | |
| 14 | $master_array['aux_text'] = array( |
| 15 | 'name' => __('[Phlox] Text', 'auxin-elements'), |
| 16 | 'auxin_output_callback' => 'auxin_widget_column_callback', |
| 17 | 'base' => 'aux_text', |
| 18 | 'description' => __('Simple text block.', 'auxin-elements'), |
| 19 | 'class' => 'aux-widget-text', |
| 20 | 'show_settings_on_create' => true, |
| 21 | 'weight' => 1, |
| 22 | 'is_widget' => false, |
| 23 | 'is_shortcode' => true, |
| 24 | 'is_so' => true, |
| 25 | 'is_vc' => true, |
| 26 | 'so_api' => true, |
| 27 | 'category' => THEME_NAME, |
| 28 | 'group' => '', |
| 29 | 'admin_enqueue_js' => '', |
| 30 | 'admin_enqueue_css' => '', |
| 31 | 'front_enqueue_js' => '', |
| 32 | 'front_enqueue_css' => '', |
| 33 | 'icon' => 'auxin-element auxin-text', |
| 34 | 'custom_markup' => '', |
| 35 | 'js_view' => '', |
| 36 | 'html_template' => '', |
| 37 | 'deprecated' => '', |
| 38 | 'content_element' => false, |
| 39 | 'as_parent' => '', |
| 40 | 'as_child' => '', |
| 41 | 'params' => array( |
| 42 | array( |
| 43 | 'heading' => __('Title','auxin-elements'), |
| 44 | 'description' => __('Text title, leave it empty if you don`t need title.', 'auxin-elements'), |
| 45 | 'param_name' => 'title', |
| 46 | 'type' => 'textfield', |
| 47 | 'value' => '', |
| 48 | 'def_value' => '', |
| 49 | 'holder' => 'textfield', |
| 50 | 'class' => 'title', |
| 51 | 'description' => '', |
| 52 | 'admin_label' => true, |
| 53 | 'dependency' => '', |
| 54 | 'weight' => '', |
| 55 | 'group' => '' , |
| 56 | 'edit_field_class' => '' |
| 57 | ), |
| 58 | array( |
| 59 | 'heading' => __('Title link','auxin-elements'), |
| 60 | 'description' => '', |
| 61 | 'param_name' => 'title_link', |
| 62 | 'type' => 'textfield', |
| 63 | 'value' => '', |
| 64 | 'def_value' => '', |
| 65 | 'holder' => 'textfield', |
| 66 | 'class' => 'title_link', |
| 67 | 'admin_label' => true, |
| 68 | 'dependency' => '', |
| 69 | 'weight' => '', |
| 70 | 'group' => '' , |
| 71 | 'edit_field_class' => '' |
| 72 | ), |
| 73 | array( |
| 74 | 'heading' => __('Text align','auxin-elements'), |
| 75 | 'description' => '', |
| 76 | 'param_name' => 'text_align', |
| 77 | 'type' => 'aux_visual_select', |
| 78 | 'def_value' => 'top', |
| 79 | 'choices' => array( |
| 80 | '' => array( |
| 81 | 'label' => __('Theme Default', 'auxin-elements'), |
| 82 | 'css_class' => 'axiAdminIcon-default', |
| 83 | ), |
| 84 | 'left' => array( |
| 85 | 'label' => __('Left', 'auxin-elements'), |
| 86 | 'css_class' => 'axiAdminIcon-text-align-left', |
| 87 | ), |
| 88 | 'center' => array( |
| 89 | 'label' => __('Center', 'auxin-elements'), |
| 90 | 'css_class' => 'axiAdminIcon-text-align-center' |
| 91 | ), |
| 92 | 'right' => array( |
| 93 | 'label' => __('Center', 'auxin-elements'), |
| 94 | 'css_class' => 'axiAdminIcon-text-align-right' |
| 95 | ) |
| 96 | ), |
| 97 | 'holder' => 'dropdown', |
| 98 | 'class' => 'text_align', |
| 99 | 'admin_label' => true, |
| 100 | 'dependency' => '', |
| 101 | 'weight' => '', |
| 102 | 'group' => '' , |
| 103 | 'edit_field_class' => '' |
| 104 | ), |
| 105 | array( |
| 106 | 'heading' => __('Text color scheme','auxin-elements'), |
| 107 | 'description' => '', |
| 108 | 'param_name' => 'text_color_mode', |
| 109 | 'type' => 'dropdown', |
| 110 | 'def_value' => 'inherit', |
| 111 | 'value' => array ( |
| 112 | 'inherit' => __( 'Inherit' , 'auxin-elements' ), |
| 113 | 'light' => __( 'Light' , 'auxin-elements' ), |
| 114 | 'dark' => __( 'Dark' , 'auxin-elements' ) |
| 115 | ), |
| 116 | 'holder' => 'dropdown', |
| 117 | 'class' => 'text_color_mode', |
| 118 | 'admin_label' => true, |
| 119 | 'dependency' => '', |
| 120 | 'weight' => '', |
| 121 | 'group' => '' , |
| 122 | 'edit_field_class' => '' |
| 123 | ), |
| 124 | array( |
| 125 | 'heading' => __('Wrapper style','auxin-elements'), |
| 126 | 'description' => '', |
| 127 | 'param_name' => 'wrapper_style', |
| 128 | 'type' => 'aux_visual_select', |
| 129 | 'def_value' => 'simple', |
| 130 | 'choices' => array( |
| 131 | 'simple' => array( |
| 132 | 'label' => __('Simple', 'auxin-elements'), |
| 133 | 'image' => AUX_URL . 'images/visual-select/text-normal.svg' |
| 134 | ), |
| 135 | 'outline' => array( |
| 136 | 'label' => __('Outlined', 'auxin-elements'), |
| 137 | 'image' => AUX_URL . 'images/visual-select/text-outline.svg' |
| 138 | ), |
| 139 | 'box' => array( |
| 140 | 'label' => __('Boxed', 'auxin-elements'), |
| 141 | 'image' => AUX_URL . 'images/visual-select/text-boxed.svg' |
| 142 | ) |
| 143 | ), |
| 144 | 'holder' => 'dropdown', |
| 145 | 'class' => 'wrapper_style', |
| 146 | 'admin_label' => true, |
| 147 | 'dependency' => '', |
| 148 | 'weight' => '', |
| 149 | 'group' => '' , |
| 150 | 'edit_field_class' => '' |
| 151 | ), |
| 152 | array( |
| 153 | 'heading' => __('Block background color','auxin-elements'), |
| 154 | 'description' => __('Choose a background color for this block.','auxin-elements'), |
| 155 | 'param_name' => 'wrapper_bg_color', |
| 156 | 'type' => 'colorpicker', |
| 157 | 'def_value' => '', |
| 158 | 'value' => '', |
| 159 | 'holder' => '', |
| 160 | 'class' => 'wrapper_bg_color', |
| 161 | 'admin_label' => true, |
| 162 | 'dependency' => '', |
| 163 | 'weight' => '', |
| 164 | 'group' => '' , |
| 165 | 'edit_field_class' => '' |
| 166 | ), |
| 167 | array( |
| 168 | 'heading' => __('Icon', 'auxin-elements' ), |
| 169 | 'description' => __('Please choose an icon from avaialable icons.', 'auxin-elements'), |
| 170 | 'param_name' => 'icon', |
| 171 | 'type' => 'iconpicker', |
| 172 | 'value' => '', |
| 173 | 'def_value' => '', |
| 174 | 'holder' => 'textfield', |
| 175 | 'class' => 'iconpicker', |
| 176 | 'admin_label' => true, |
| 177 | 'dependency' => '', |
| 178 | 'weight' => '', |
| 179 | 'group' => '' , |
| 180 | 'edit_field_class' => '' |
| 181 | ), |
| 182 | array( |
| 183 | 'heading' => __('Icon color','auxin-elements'), |
| 184 | 'description' => __('Choose a color for icon.','auxin-elements'), |
| 185 | 'param_name' => 'icon_color', |
| 186 | 'type' => 'colorpicker', |
| 187 | 'def_value' => '#888', |
| 188 | 'value' => '#888', |
| 189 | 'holder' => '', |
| 190 | 'class' => 'icon_color', |
| 191 | 'admin_label' => true, |
| 192 | 'dependency' => '', |
| 193 | 'weight' => '', |
| 194 | 'group' => '' , |
| 195 | 'edit_field_class' => '' |
| 196 | ), |
| 197 | array( |
| 198 | 'heading' => __('Icon size','auxin-elements'), |
| 199 | 'description' => '', |
| 200 | 'param_name' => 'icon_size', |
| 201 | 'type' => 'dropdown', |
| 202 | 'def_value' => 'large', |
| 203 | 'value' => array ( |
| 204 | 'small' => __( 'Small' , 'auxin-elements' ), |
| 205 | 'medium' => __( 'Medium' , 'auxin-elements' ), |
| 206 | 'large' => __( 'Large' , 'auxin-elements' ), |
| 207 | 'x-large' => __( 'X-Large' , 'auxin-elements' ) |
| 208 | ), |
| 209 | 'holder' => 'dropdown', |
| 210 | 'class' => 'icon_size', |
| 211 | 'admin_label' => true, |
| 212 | 'dependency' => '', |
| 213 | 'weight' => '', |
| 214 | 'group' => '' , |
| 215 | 'edit_field_class' => '' |
| 216 | ), |
| 217 | array( |
| 218 | 'heading' => __('Icon background shape','auxin-elements'), |
| 219 | 'description' => '', |
| 220 | 'param_name' => 'icon_shape', |
| 221 | 'type' => 'aux_visual_select', |
| 222 | 'def_value' => 'circle', |
| 223 | 'choices' => array( |
| 224 | 'circle' => array( |
| 225 | 'label' => __('Circle', 'auxin-elements'), |
| 226 | 'image' => AUX_URL . 'images/visual-select/icon-style-circle.svg' |
| 227 | ), |
| 228 | 'semi-circle' => array( |
| 229 | 'label' => __('Semi-circle', 'auxin-elements'), |
| 230 | 'image' => AUX_URL . 'images/visual-select/icon-style-semi-circle.svg' |
| 231 | ), |
| 232 | 'round-rect' => array( |
| 233 | 'label' => __('Round Rectangle', 'auxin-elements'), |
| 234 | 'image' => AUX_URL . 'images/visual-select/icon-style-round-rectangle.svg' |
| 235 | ), |
| 236 | 'cross-rect' => array( |
| 237 | 'label' => __('Cross Rectangle', 'auxin-elements'), |
| 238 | 'image' => AUX_URL . 'images/visual-select/icon-style-cross-rectangle.svg' |
| 239 | ), |
| 240 | 'rect' => array( |
| 241 | 'label' => __('Rectangle', 'auxin-elements'), |
| 242 | 'image' => AUX_URL . 'images/visual-select/icon-style-rectangle.svg' |
| 243 | ) |
| 244 | ), |
| 245 | 'holder' => 'dropdown', |
| 246 | 'class' => 'icon_shape', |
| 247 | 'admin_label' => true, |
| 248 | 'dependency' => '', |
| 249 | 'weight' => '', |
| 250 | 'group' => '' , |
| 251 | 'edit_field_class' => '' |
| 252 | ), |
| 253 | array( |
| 254 | 'heading' => __('Icon background color','auxin-elements'), |
| 255 | 'description' => __('Choose a color for background of icon.','auxin-elements'), |
| 256 | 'param_name' => 'icon_bg_color', |
| 257 | 'type' => 'colorpicker', |
| 258 | 'def_value' => '', |
| 259 | 'value' => '', |
| 260 | 'holder' => '', |
| 261 | 'class' => 'icon_bg_color', |
| 262 | 'admin_label' => true, |
| 263 | 'dependency' => '', |
| 264 | 'weight' => '', |
| 265 | 'group' => '' , |
| 266 | 'edit_field_class' => '' |
| 267 | ), |
| 268 | array( |
| 269 | 'heading' => __( 'Icon outline color', 'auxin-elements' ), |
| 270 | 'description' => __( 'Choose a color for the border around the icon.', 'auxin-elements' ), |
| 271 | 'param_name' => 'icon_border_color', |
| 272 | 'type' => 'colorpicker', |
| 273 | 'def_value' => '', |
| 274 | 'value' => '', |
| 275 | 'holder' => '', |
| 276 | 'class' => 'icon_border_color', |
| 277 | 'admin_label' => true, |
| 278 | 'dependency' => '', |
| 279 | 'weight' => '', |
| 280 | 'group' => '' , |
| 281 | 'edit_field_class' => '' |
| 282 | ), |
| 283 | array( |
| 284 | 'heading' => __('Image','auxin-elements'), |
| 285 | 'description' => '', |
| 286 | 'param_name' => 'image', |
| 287 | 'type' => 'attach_image', |
| 288 | 'def_value' => '', |
| 289 | 'value' => '', |
| 290 | 'holder' => '', |
| 291 | 'class' => 'image', |
| 292 | 'admin_label' => true, |
| 293 | 'dependency' => '', |
| 294 | 'weight' => '', |
| 295 | 'group' => '' , |
| 296 | 'edit_field_class' => '' |
| 297 | ), |
| 298 | array( |
| 299 | 'heading' => __('Image or icon position','auxin-elements'), |
| 300 | 'description' => '', |
| 301 | 'param_name' => 'image_position', |
| 302 | 'type' => 'aux_visual_select', |
| 303 | 'def_value' => 'top', |
| 304 | 'choices' => array( |
| 305 | 'top' => array( |
| 306 | 'label' => __('White Space', 'auxin-elements'), |
| 307 | 'image' => AUX_URL . 'images/visual-select/column-icon-top.svg' |
| 308 | ), |
| 309 | 'left' => array( |
| 310 | 'label' => __('Solid', 'auxin-elements'), |
| 311 | 'image' => AUX_URL . 'images/visual-select/column-icon-left.svg' |
| 312 | ), |
| 313 | 'right' => array( |
| 314 | 'label' => __('Dashed', 'auxin-elements'), |
| 315 | 'image' => AUX_URL . 'images/visual-select/column-icon-right.svg' |
| 316 | ) |
| 317 | ), |
| 318 | 'holder' => 'dropdown', |
| 319 | 'class' => 'image_position', |
| 320 | 'admin_label' => true, |
| 321 | 'dependency' => '', |
| 322 | 'weight' => '', |
| 323 | 'group' => '' , |
| 324 | 'edit_field_class' => '' |
| 325 | ), |
| 326 | array( |
| 327 | 'heading' => __('Content','auxin-elements'), |
| 328 | 'description' => __('Enter a text as a text content.','auxin-elements'), |
| 329 | 'param_name' => 'content', |
| 330 | 'type' => 'textarea_html', |
| 331 | 'value' => '', |
| 332 | 'def_value' => '', |
| 333 | 'holder' => 'div', |
| 334 | 'class' => 'content', |
| 335 | 'admin_label' => true, |
| 336 | 'dependency' => '', |
| 337 | 'weight' => '', |
| 338 | 'group' => '' , |
| 339 | 'edit_field_class' => '' |
| 340 | ), |
| 341 | array( |
| 342 | 'heading' => __('Extra class name','auxin-elements'), |
| 343 | 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements'), |
| 344 | 'param_name' => 'extra_classes', |
| 345 | 'type' => 'textfield', |
| 346 | 'value' => '', |
| 347 | 'def_value' => '', |
| 348 | 'holder' => 'textfield', |
| 349 | 'class' => 'extra_classes', |
| 350 | 'admin_label' => true, |
| 351 | 'dependency' => '', |
| 352 | 'weight' => '', |
| 353 | 'group' => '' , |
| 354 | 'edit_field_class' => '' |
| 355 | ) |
| 356 | ) |
| 357 | ); |
| 358 | |
| 359 | return $master_array; |
| 360 | } |
| 361 | |
| 362 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_text_master_array', 10, 1 ); |
| 363 | |
| 364 | // This is the widget call back in fact the front end out put of this widget comes from this function |
| 365 | function auxin_widget_column_callback( $atts, $shortcode_content = null ){ |
| 366 | |
| 367 | // Defining default attributes |
| 368 | $default_atts = array( |
| 369 | 'title' => '', // section title |
| 370 | 'title_link' => '', // the link on title |
| 371 | 'content' => '', // the link on title |
| 372 | 'text_align' => '', // left, right, center |
| 373 | 'text_color_mode' => 'inherit', // inherit, dark, light |
| 374 | |
| 375 | 'wrapper_style' => '', // box, outline, |
| 376 | 'wrapper_bg_color' => '', // box, outline, |
| 377 | |
| 378 | 'icon' => '', // icon on column side |
| 379 | 'icon_color' => '#888', |
| 380 | 'icon_size' => 'large', // small, medium, large, x-large |
| 381 | 'icon_shape' => 'circle', // circle, semi-circle, round-rect, rect, hexa, |
| 382 | 'icon_bg_color' => '', // empty mean inherit, |
| 383 | 'icon_border_color' => '', // color or 'icon' (same color as icon) |
| 384 | |
| 385 | 'image' => '', // image on column side |
| 386 | 'image_position' => 'top', // top,left,right |
| 387 | |
| 388 | 'extra_classes' => '', // custom css class names for this element |
| 389 | 'custom_el_id' => '', // custom id attribute for this element |
| 390 | 'base_class' => 'aux-widget-text' // base class name for container |
| 391 | ); |
| 392 | |
| 393 | if( ! empty( $atts['wrapper_style'] ) ){ |
| 394 | $atts['extra_classes'] .= ' aux-wrap-style-' . esc_attr( $atts['wrapper_style'] ); |
| 395 | } else if( ! empty( $default_atts['wrapper_style'] ) ){ |
| 396 | $atts['extra_classes'] .= ' aux-wrap-style-' . esc_attr( $default_atts['wrapper_style'] ); |
| 397 | } |
| 398 | //axpp( $default_atts['extra_classes'] ); |
| 399 | $result = auxin_get_widget_scafold( $atts, $default_atts ); |
| 400 | extract( $result['parsed_atts'] ); |
| 401 | |
| 402 | $icon_border_color = 'icon' == $icon_border_color ? $icon_color : $icon_border_color; |
| 403 | $content = empty( $content ) ? $shortcode_content : $content; |
| 404 | |
| 405 | $main_inline_style = empty( $wrapper_bg_color ) ? '' : 'background-color:'.$wrapper_bg_color.' !important;'; |
| 406 | $main_inline_style .= empty( $main_inline_style ) ? '' : ' style="'.$main_inline_style.'";'; |
| 407 | $main_classes = 'aux-text-inner aux-ico-pos-'. ( $image_position ? esc_attr( $image_position ) : 'top' ); |
| 408 | $main_classes .= empty( $text_align ) ? '' : ' aux-text-align-' . esc_attr( $text_align ); |
| 409 | $main_classes .= empty( $text_color_mode ) || 'inherit' == $text_color_mode ? '' : ' aux-text-color-'. esc_attr( $text_color_mode ); |
| 410 | |
| 411 | $icon_box_inline_style = empty( $icon_bg_color ) ? '' : 'background-color:'.$icon_bg_color.' !important;'; |
| 412 | $icon_box_inline_style .= empty( $icon_border_color ) ? '' : 'border-color:'.$icon_border_color.';'; |
| 413 | $icon_box_inline_style .= empty( $icon_box_inline_style ) ? '' : ' style="'.$icon_box_inline_style.'";'; |
| 414 | $icon_box_classes = 'aux-ico-' . esc_attr( $icon_size ); |
| 415 | $icon_box_classes .= ' aux-ico-shape-' . esc_attr( $icon_shape ); |
| 416 | |
| 417 | $icon_classes = empty( $icon ) || $icon == 'none' ? '' : esc_attr( $icon ); |
| 418 | $icon_inline_style = empty( $icon_color ) ? '' : 'style="color:'.$icon_color.' !important;"'; |
| 419 | |
| 420 | $icon_border_style_tag = ''; |
| 421 | if( ! empty( $icon_border_color ) && 'cross-rect' == $icon_shape ){ |
| 422 | $icon_uid = uniqid( 'auxt' ); |
| 423 | $icon_box_inline_style .= ' id="'. $icon_uid .'"'; |
| 424 | $icon_border_style_tag = "<style>#$icon_uid:before,#$icon_uid:after{border-color:$icon_border_color;}</style>"; |
| 425 | } |
| 426 | |
| 427 | |
| 428 | if( ! empty( $image ) && is_numeric( $image ) ) { |
| 429 | $image = auxin_get_the_resized_attachment( $image ); |
| 430 | } |
| 431 | |
| 432 | ob_start(); |
| 433 | |
| 434 | // widget header ------------------------------ |
| 435 | echo $result['widget_header']; |
| 436 | ?> |
| 437 | <div class="<?php echo $main_classes; ?>" <?php echo $main_inline_style; ?>> |
| 438 | <?php if( ! empty( $icon ) && empty( $image ) ) { ?> |
| 439 | <div class="aux-ico-box <?php echo $icon_box_classes; ?>" <?php echo $icon_box_inline_style; ?>> |
| 440 | <?php echo $icon_border_style_tag; ?> |
| 441 | <span class="aux-ico <?php echo $icon_classes; ?>" <?php echo $icon_inline_style; ?> > </span> |
| 442 | </div> |
| 443 | <?php |
| 444 | } elseif( !empty( $image ) ) { |
| 445 | echo $image; |
| 446 | } if( ! empty( $title ) && empty( $title_link ) ) { |
| 447 | ?> |
| 448 | <h4 class="col-title"><?php echo $title; ?></h4> |
| 449 | <?php } elseif( ! empty( $title ) && ! empty( $title_link ) ) { ?> |
| 450 | <h4 class="col-title"><a href="<?php echo $title_link; ?>"><?php echo $title; ?></a></h4> |
| 451 | <?php } if( ! empty( $content ) ) { ?> |
| 452 | <div class="entry-content"> |
| 453 | <?php $encoding_flag = defined('ENT_HTML401') ? ENT_HTML401 : ENT_QUOTES; ?> |
| 454 | <p><?php echo do_shortcode( html_entity_decode( $content, $encoding_flag, 'UTF-8') ); ?></p> |
| 455 | </div> |
| 456 | <?php } ?> |
| 457 | </div> |
| 458 | |
| 459 | <?php |
| 460 | // widget footer ------------------------------ |
| 461 | echo $result['widget_footer']; |
| 462 | |
| 463 | return ob_get_clean(); |
| 464 | } |
| 465 |