about-widget.php
6 years ago
accordion-widget.php
6 years ago
accordion.php
6 years ago
attachment-url.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
code.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
dropcap.php
6 years ago
facebook.php
6 years ago
flickr.php
6 years ago
gallery.php
6 years ago
general-element-fields.php
6 years ago
gmap.php
6 years ago
highlight.php
6 years ago
image.php
6 years ago
instagram-feed.php
6 years ago
latest-items.php
8 years ago
latest-posts-slider.php
6 years ago
popular-posts-widget.php
6 years ago
quote.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-posts-widget.php
6 years ago
recent-products.php
6 years ago
related-posts.php
8 years ago
sample-element.php
6 years ago
search.php
6 years ago
socials-list.php
6 years ago
staff.php
6 years ago
tab-widget.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
quote.php
287 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Quote element |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2020 averta |
| 11 | */ |
| 12 | function auxin_get_quote_master_array( $master_array ) { |
| 13 | |
| 14 | $master_array['aux_quote'] = array( |
| 15 | 'name' => __("Quote", 'auxin-elements' ), |
| 16 | 'auxin_output_callback' => 'auxin_widget_quote_callback', |
| 17 | 'base' => 'aux_quote', |
| 18 | 'description' => __('Blockquote and introduction paragraph', 'auxin-elements' ), |
| 19 | 'class' => 'aux-widget-quote', |
| 20 | 'show_settings_on_create' => true, |
| 21 | 'weight' => 1, |
| 22 | 'category' => THEME_NAME, |
| 23 | 'is_so' => true, |
| 24 | 'is_widget' => true, |
| 25 | 'is_shortcode' => true, |
| 26 | 'group' => '', |
| 27 | 'admin_enqueue_js' => '', |
| 28 | 'admin_enqueue_css' => '', |
| 29 | 'front_enqueue_js' => '', |
| 30 | 'front_enqueue_css' => '', |
| 31 | 'icon' => 'aux-element aux-pb-icons-quote', |
| 32 | 'custom_markup' => '', |
| 33 | 'js_view' => '', |
| 34 | 'html_template' => '', |
| 35 | 'deprecated' => '', |
| 36 | 'content_element' => '', |
| 37 | 'as_parent' => '', |
| 38 | 'as_child' => '', |
| 39 | 'params' => array( |
| 40 | array( |
| 41 | 'heading' => __('Quote text','auxin-elements' ), |
| 42 | 'description' => __('Enter a text as a quote.','auxin-elements' ), |
| 43 | 'param_name' => 'content', |
| 44 | 'type' => 'textarea_html', |
| 45 | 'value' => '', |
| 46 | 'holder' => '', |
| 47 | 'class' => 'content', |
| 48 | 'admin_label' => false, |
| 49 | 'dependency' => '', |
| 50 | 'weight' => '', |
| 51 | 'group' => '' , |
| 52 | 'edit_field_class' => '' |
| 53 | ), |
| 54 | array( |
| 55 | 'heading' => __('Blockqoute style','auxin-elements' ), |
| 56 | 'description' => '', |
| 57 | 'param_name' => 'type', |
| 58 | 'type' => 'aux_visual_select', |
| 59 | 'def_value' => 'blockquote-normal', |
| 60 | 'choices' => array( |
| 61 | 'quote-normal' => array( |
| 62 | 'label' => __('Quote Normal', 'auxin-elements'), |
| 63 | 'image' => AUXIN_URL . 'images/visual-select/blockquote-normal-1.svg' |
| 64 | ), |
| 65 | 'blockquote-normal' => array( |
| 66 | 'label' => __('Blockquote Normal', 'auxin-elements'), |
| 67 | 'image' => AUXIN_URL . 'images/visual-select/blockquote-normal.svg' |
| 68 | ), |
| 69 | 'blockquote-bordered' => array( |
| 70 | 'label' => __('Blockquote Bordered', 'auxin-elements'), |
| 71 | 'image' => AUXIN_URL . 'images/visual-select/blockquote-bordered.svg' |
| 72 | ), |
| 73 | 'intro-normal' => array( |
| 74 | 'label' => __('Intro', 'auxin-elements'), |
| 75 | 'image' => AUXIN_URL . 'images/visual-select/quote-intro-normal.svg' |
| 76 | ), |
| 77 | 'intro-hero' => array( |
| 78 | 'label' => __('Intro Hero', 'auxin-elements'), |
| 79 | 'image' => AUXIN_URL . 'images/visual-select/quote-intro-hero.svg' |
| 80 | ), |
| 81 | 'intro-splitter' => array( |
| 82 | 'label' => __('Intro with Splitter', 'auxin-elements'), |
| 83 | 'image' => AUXIN_URL . 'images/visual-select/quote-intro-splitter.svg' |
| 84 | ), |
| 85 | 'pullquote-normal' => array( |
| 86 | 'label' => __('Pullquote Normal', 'auxin-elements'), |
| 87 | 'image' => AUXIN_URL . 'images/visual-select/pullquote-normal.svg' |
| 88 | ), |
| 89 | 'pullquote-colorized' => array( |
| 90 | 'label' => __('Pullquote Colorized', 'auxin-elements'), |
| 91 | 'image' => AUXIN_URL . 'images/visual-select/pullquote-colorized.svg' |
| 92 | ) |
| 93 | ), |
| 94 | 'holder' => '', |
| 95 | 'class' => 'type', |
| 96 | 'admin_label' => true, |
| 97 | 'dependency' => '', |
| 98 | 'weight' => '', |
| 99 | 'group' => '' , |
| 100 | 'edit_field_class' => '' |
| 101 | ), |
| 102 | array( |
| 103 | 'heading' => __('Text alignment','auxin-elements' ), |
| 104 | 'description' => '', |
| 105 | 'param_name' => 'text_align', |
| 106 | 'type' => 'dropdown', |
| 107 | 'def_value' => 'none', |
| 108 | 'value' => array( |
| 109 | 'none' => __('Default', 'auxin-elements' ), |
| 110 | 'left' => __('Left' , 'auxin-elements' ), |
| 111 | 'right' => __('Right' , 'auxin-elements' ), |
| 112 | 'center' => __('Center' , 'auxin-elements' ) |
| 113 | ), |
| 114 | 'holder' => '', |
| 115 | 'class' => 'type', |
| 116 | 'admin_label' => false, |
| 117 | 'dependency' => '', |
| 118 | 'weight' => '', |
| 119 | 'group' => '' , |
| 120 | 'edit_field_class' => '' |
| 121 | ), |
| 122 | // array( |
| 123 | // 'param_name' => 'float', |
| 124 | // 'type' => 'dropdown', |
| 125 | // 'def_value' => 'none', |
| 126 | // 'value' => array( |
| 127 | // 'none' => __('Default', 'auxin-elements' ), |
| 128 | // 'left' =>__('Left' , 'auxin-elements' ), |
| 129 | // 'right' => __('Right' , 'auxin-elements' ) |
| 130 | // ), |
| 131 | // 'holder' => 'dropdown', |
| 132 | // 'class' => 'type', |
| 133 | // 'heading' => __('Block alignment','auxin-elements' ), |
| 134 | // 'description' => '', |
| 135 | // 'admin_label' => true, |
| 136 | // 'dependency' => '', |
| 137 | // 'weight' => '', |
| 138 | // 'group' => '' , |
| 139 | // 'edit_field_class' => '' |
| 140 | // ), |
| 141 | array( |
| 142 | 'heading' => __('Insert quote symbol', 'auxin-elements'), |
| 143 | 'description' => '', |
| 144 | 'param_name' => 'quote_symbol', |
| 145 | 'type' => 'aux_switch', |
| 146 | 'value' => '1', |
| 147 | 'holder' => '', |
| 148 | 'class' => 'showheader', |
| 149 | 'admin_label' => false, |
| 150 | 'dependency' => '', |
| 151 | 'weight' => '', |
| 152 | 'group' => '' , |
| 153 | 'edit_field_class' => '' |
| 154 | ), |
| 155 | array( |
| 156 | 'heading' => __('Extra class name','auxin-elements' ), |
| 157 | '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' ), |
| 158 | 'param_name' => 'extra_classes', |
| 159 | 'type' => 'textfield', |
| 160 | 'value' => '', |
| 161 | 'def_value' => '', |
| 162 | 'holder' => '', |
| 163 | 'class' => 'extra_classes', |
| 164 | 'admin_label' => false, |
| 165 | 'dependency' => '', |
| 166 | 'weight' => '', |
| 167 | 'group' => '' , |
| 168 | 'edit_field_class' => '' |
| 169 | ) |
| 170 | |
| 171 | ) |
| 172 | ); |
| 173 | |
| 174 | return $master_array; |
| 175 | } |
| 176 | |
| 177 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_quote_master_array', 10, 1 ); |
| 178 | |
| 179 | function auxin_widget_quote_callback( $atts, $shortcode_content = null ){ |
| 180 | |
| 181 | /** |
| 182 | * type: |
| 183 | * intro-hero |
| 184 | * intro-normal |
| 185 | * intro-splitter |
| 186 | * |
| 187 | * pullquote-normal |
| 188 | * pullquote-colorized |
| 189 | * |
| 190 | * quote-normal |
| 191 | * quote-big |
| 192 | * |
| 193 | * blockquote-normal |
| 194 | * blockquote-bordered |
| 195 | * |
| 196 | * text-align: |
| 197 | * center |
| 198 | * right |
| 199 | * left |
| 200 | * |
| 201 | * float: |
| 202 | * none |
| 203 | * left |
| 204 | * right |
| 205 | */ |
| 206 | |
| 207 | // Defining default attributes |
| 208 | $default_atts = array( |
| 209 | 'content' => '', |
| 210 | |
| 211 | 'indent' => '', // custom values: yes, no |
| 212 | 'type' => 'blockquote-normal', |
| 213 | 'text_align' => '', |
| 214 | 'float' => '', |
| 215 | 'quote_symbol' => '1', |
| 216 | 'css' => '', |
| 217 | |
| 218 | 'extra_classes' => '', // custom css class names for this element |
| 219 | 'custom_el_id' => '', // custom id attribute for this element |
| 220 | 'base_class' => 'aux-widget-quote' // base class name for container |
| 221 | ); |
| 222 | |
| 223 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 224 | extract( $result['parsed_atts'] ); |
| 225 | |
| 226 | ob_start(); |
| 227 | |
| 228 | // widget header ------------------------------ |
| 229 | echo $result['widget_header']; |
| 230 | |
| 231 | // widget custom output ----------------------- |
| 232 | |
| 233 | $classes_list = array( 'aux-elem-quote' ); |
| 234 | |
| 235 | $classes_list[] = 'aux-' . $type; |
| 236 | |
| 237 | if( ! empty( $text_align ) && 'none'!== $text_align ){ |
| 238 | $classes_list[] = 'aux-text-align-' . $text_align; |
| 239 | } |
| 240 | |
| 241 | if( ! empty( $float ) ){ |
| 242 | $classes_list[] = 'aux-float-' . $float; |
| 243 | } |
| 244 | |
| 245 | if( auxin_is_true( $quote_symbol ) ){ |
| 246 | //$classes_list[] = 'aux-quote-letter'; |
| 247 | $classes_list[] = 'aux-quote-symbol'; |
| 248 | } |
| 249 | |
| 250 | if( !empty($extra_classes) ){ |
| 251 | $classes_list[] = $extra_classes; |
| 252 | } |
| 253 | |
| 254 | $classes = implode( ' ', $classes_list ); |
| 255 | $shortcode_content = auxin_do_cleanup_shortcode( $shortcode_content ); |
| 256 | $shortcode_content = empty( $shortcode_content ) ? auxin_do_cleanup_shortcode( $content ) : $shortcode_content; |
| 257 | |
| 258 | switch ( $type ) { |
| 259 | case 'intro-hero': |
| 260 | case 'intro-normal': |
| 261 | case 'intro-splitter': |
| 262 | echo sprintf( '<p class="%s">%s</p>', $classes, $shortcode_content ); |
| 263 | break; |
| 264 | |
| 265 | case 'pullquote-normal': |
| 266 | case 'pullquote-colorized': |
| 267 | echo sprintf( '<blockquote class="%s"><p>%s</p></blockquote>', $classes, $shortcode_content ); |
| 268 | break; |
| 269 | |
| 270 | case 'quote-normal': |
| 271 | case 'quote-big': |
| 272 | echo sprintf( '<blockquote class="%s"><p>%s</p></blockquote>', $classes, $shortcode_content ); |
| 273 | break; |
| 274 | |
| 275 | case 'blockquote-normal': |
| 276 | case 'blockquote-bordered': |
| 277 | default: |
| 278 | echo sprintf( '<blockquote class="%s"><p>%s</p></blockquote>', $classes, $shortcode_content ); |
| 279 | break; |
| 280 | } |
| 281 | |
| 282 | // widget footer ------------------------------ |
| 283 | echo $result['widget_footer']; |
| 284 | |
| 285 | return ob_get_clean(); |
| 286 | } |
| 287 |