about-widget.php
5 months ago
accordion-widget.php
1 month ago
accordion.php
5 months ago
attachment-url.php
5 months ago
audio.php
5 months ago
before-after.php
5 months ago
button.php
5 months ago
code.php
5 months ago
contact-box.php
5 months ago
contact-form.php
5 months ago
custom-list.php
5 months ago
divider.php
5 months ago
dropcap.php
5 months ago
facebook.php
5 months ago
flickr.php
5 months ago
gallery.php
5 months ago
gmap.php
5 months ago
highlight.php
5 months ago
image.php
5 months ago
instagram-feed.php
5 months ago
latest-posts-slider.php
5 months ago
popular-posts-widget.php
5 months ago
products-grid.php
5 months ago
quote.php
5 months ago
recent-posts-grid-carousel.php
5 months ago
recent-posts-land-style.php
5 months ago
recent-posts-masonry.php
5 months ago
recent-posts-tiles-carousel.php
5 months ago
recent-posts-tiles.php
5 months ago
recent-posts-timeline.php
5 months ago
recent-posts-widget.php
5 months ago
recent-products.php
5 months ago
related-posts.php
8 years ago
sample-element.php
5 months ago
search.php
5 months ago
socials-list.php
5 months ago
staff.php
5 months ago
tab-widget.php
5 months ago
tabs.php
5 months ago
testimonial.php
5 months ago
text.php
5 months ago
touch-slider.php
5 months ago
video.php
5 months ago
highlight.php
149 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Hightlight text |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2026 averta |
| 11 | */ |
| 12 | function auxin_get_highlight_master_array( $master_array ) { |
| 13 | |
| 14 | $master_array['aux_highlight'] = array( |
| 15 | 'name' => __("Highlight", 'auxin-elements' ), |
| 16 | 'auxin_output_callback' => 'auxin_widget_highlight_callback', |
| 17 | 'base' => 'aux_highlight', |
| 18 | 'description' => __('Highlighted Text', 'auxin-elements' ), |
| 19 | 'class' => 'auxin-widget-highlight', |
| 20 | 'show_settings_on_create' => true, |
| 21 | 'weight' => 1, |
| 22 | 'is_widget' => false, |
| 23 | 'is_shortcode' => true, |
| 24 | 'category' => THEME_NAME, |
| 25 | 'group' => '', |
| 26 | 'admin_enqueue_js' => '', |
| 27 | 'admin_enqueue_css' => '', |
| 28 | 'front_enqueue_js' => '', |
| 29 | 'front_enqueue_css' => '', |
| 30 | 'icon' => '', |
| 31 | 'custom_markup' => '', |
| 32 | 'js_view' => '', |
| 33 | 'html_template' => '', |
| 34 | 'deprecated' => '', |
| 35 | 'content_element' => '', |
| 36 | 'as_parent' => '', |
| 37 | 'as_child' => '', |
| 38 | 'params' => array( |
| 39 | array( |
| 40 | 'heading' => __('Divider style','auxin-elements' ), |
| 41 | 'description' => __('The style of divider.','auxin-elements' ), |
| 42 | 'param_name' => 'style', |
| 43 | 'type' => 'aux_visual_select', |
| 44 | 'std' => "aux-highlight-red", |
| 45 | 'holder' => 'dropdown', |
| 46 | 'class' => 'style', |
| 47 | 'admin_label' => true, |
| 48 | 'dependency' => '', |
| 49 | 'weight' => '', |
| 50 | 'group' => '' , |
| 51 | 'edit_field_class' => '', |
| 52 | 'choices' => array( |
| 53 | 'aux-highlight-red' => array( |
| 54 | 'label' => __('Red', 'auxin-elements' ), |
| 55 | 'css_class' => 'axiAdminIcon-none', |
| 56 | 'image' => '' |
| 57 | ), |
| 58 | 'aux-highlight-blue' => array( |
| 59 | 'label' => __('Blue', 'auxin-elements' ), |
| 60 | 'css_class' => 'axiAdminIcon-repeat-y', |
| 61 | 'image' => '' |
| 62 | ), |
| 63 | 'aux-highlight-yellow' => array( |
| 64 | 'label' => __('Yellow', 'auxin-elements' ), |
| 65 | 'css_class' => 'axiAdminIcon-repeat-x', |
| 66 | 'image' => '' |
| 67 | ), |
| 68 | 'aux-highlight-green' => array( |
| 69 | 'label' => __('Green', 'auxin-elements' ), |
| 70 | 'css_class' => 'axiAdminIcon-repeat-y', |
| 71 | 'image' => '' |
| 72 | ) |
| 73 | ) |
| 74 | ), |
| 75 | array( |
| 76 | 'heading' => __('Content','auxin-elements' ), |
| 77 | 'description' => __('Enter the text to be highlighted.', 'auxin-elements' ), |
| 78 | 'param_name' => 'content', |
| 79 | 'type' => 'textarea_html', |
| 80 | 'value' => '', |
| 81 | 'def_value' => '', |
| 82 | 'holder' => 'div', |
| 83 | 'class' => 'content', |
| 84 | 'admin_label' => true, |
| 85 | 'dependency' => '', |
| 86 | 'weight' => '', |
| 87 | 'group' => '' , |
| 88 | 'edit_field_class' => '' |
| 89 | ), |
| 90 | |
| 91 | array( |
| 92 | 'heading' => __('Extra class name','auxin-elements' ), |
| 93 | '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' ), |
| 94 | 'param_name' => 'extra_classes', |
| 95 | 'type' => 'textfield', |
| 96 | 'value' => '', |
| 97 | 'def_value' => '', |
| 98 | 'holder' => 'textfield', |
| 99 | 'class' => 'extra_classes', |
| 100 | 'admin_label' => true, |
| 101 | 'dependency' => '', |
| 102 | 'weight' => '', |
| 103 | 'group' => '' , |
| 104 | 'edit_field_class' => '' |
| 105 | ) |
| 106 | ) |
| 107 | ); |
| 108 | |
| 109 | return $master_array; |
| 110 | } |
| 111 | |
| 112 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_highlight_master_array', 10, 1 ); |
| 113 | |
| 114 | |
| 115 | |
| 116 | /** |
| 117 | * The front-end output of this element is returned by the following function |
| 118 | * |
| 119 | * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above. |
| 120 | * @param string $shortcode_content The shorcode content |
| 121 | * @return string The output of element markup |
| 122 | */ |
| 123 | function auxin_widget_highlight_callback( $atts, $shortcode_content = null ){ |
| 124 | |
| 125 | // Defining default attributes |
| 126 | $default_atts = array( |
| 127 | 'title' => '', // header title |
| 128 | 'content' => '', // header title |
| 129 | 'style' => 'aux-highlight-red', |
| 130 | |
| 131 | 'extra_classes' => '', // custom css class names for this element |
| 132 | 'custom_el_id' => '', // custom id attribute for this element |
| 133 | 'base_class' => 'auxin-widget-highlight' // base class name for container |
| 134 | ); |
| 135 | |
| 136 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 137 | extract( $result['parsed_atts'] ); |
| 138 | |
| 139 | ob_start(); |
| 140 | |
| 141 | if( ! empty( $extra_classes ) ) { |
| 142 | $style .= " $extra_classes"; |
| 143 | } |
| 144 | |
| 145 | echo '<span class="aux-highlight ' . esc_attr( $style ) . '">' . esc_html( $content ) . '</span>'; |
| 146 | |
| 147 | return ob_get_clean(); |
| 148 | } |
| 149 |