about-widget.php
9 years ago
accordion.php
9 years ago
attachment-url.php
9 years ago
audio.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
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
9 years ago
latest-posts-slider.php
9 years ago
quote.php
9 years ago
recent-posts-widget.php
9 years ago
recent-posts.php
9 years ago
sample-element.php
9 years ago
search.php
9 years ago
socials-list.php
9 years ago
tabs.php
9 years ago
text.php
9 years ago
video.php
9 years ago
text.php
273 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Text element |
| 4 | * |
| 5 | * |
| 6 | * @package auxin-elements |
| 7 | * @license LICENSE.txt |
| 8 | * @author |
| 9 | * @link https://bitbucket.org/averta/ |
| 10 | * @copyright (c) 2010-2016 |
| 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 | 'category' => THEME_NAME, |
| 27 | 'group' => '', |
| 28 | 'admin_enqueue_js' => '', |
| 29 | 'admin_enqueue_css' => '', |
| 30 | 'front_enqueue_js' => '', |
| 31 | 'front_enqueue_css' => '', |
| 32 | 'icon' => 'auxin-element auxin-text', |
| 33 | 'custom_markup' => '', |
| 34 | 'js_view' => '', |
| 35 | 'html_template' => '', |
| 36 | 'deprecated' => '', |
| 37 | 'content_element' => false, |
| 38 | 'as_parent' => '', |
| 39 | 'as_child' => '', |
| 40 | 'params' => array( |
| 41 | array( |
| 42 | 'param_name' => 'title', |
| 43 | 'type' => 'textfield', |
| 44 | 'value' => '', |
| 45 | 'def_value' => '', |
| 46 | 'holder' => 'textfield', |
| 47 | 'class' => 'title', |
| 48 | 'heading' => __('Title','auxin-elements'), |
| 49 | 'description' => '', |
| 50 | 'admin_label' => true, |
| 51 | 'dependency' => '', |
| 52 | 'weight' => '', |
| 53 | 'group' => '' , |
| 54 | 'edit_field_class' => '' |
| 55 | ), |
| 56 | array( |
| 57 | 'param_name' => 'title_link', |
| 58 | 'type' => 'textfield', |
| 59 | 'value' => '', |
| 60 | 'def_value' => '', |
| 61 | 'holder' => 'textfield', |
| 62 | 'class' => 'title_link', |
| 63 | 'heading' => __('Title Link','auxin-elements'), |
| 64 | 'description' => '', |
| 65 | 'admin_label' => true, |
| 66 | 'dependency' => '', |
| 67 | 'weight' => '', |
| 68 | 'group' => '' , |
| 69 | 'edit_field_class' => '' |
| 70 | ), |
| 71 | array( |
| 72 | 'param_name' => 'text_align', |
| 73 | 'type' => 'aux_visual_select', |
| 74 | 'def_value' => 'top', |
| 75 | 'choices' => array( |
| 76 | '' => array( |
| 77 | 'label' => __('Theme Default', 'auxin-elements'), |
| 78 | 'css_class' => 'axiAdminIcon-default', |
| 79 | ), |
| 80 | 'left' => array( |
| 81 | 'label' => __('Left', 'auxin-elements'), |
| 82 | 'css_class' => 'axiAdminIcon-text-align-left', |
| 83 | ), |
| 84 | 'center' => array( |
| 85 | 'label' => __('Center', 'auxin-elements'), |
| 86 | 'css_class' => 'axiAdminIcon-text-align-center' |
| 87 | ), |
| 88 | 'right' => array( |
| 89 | 'label' => __('Center', 'auxin-elements'), |
| 90 | 'css_class' => 'axiAdminIcon-text-align-right' |
| 91 | ) |
| 92 | ), |
| 93 | 'holder' => 'dropdown', |
| 94 | 'class' => 'text_align', |
| 95 | 'heading' => __('Text Align','auxin-elements'), |
| 96 | 'description' => '', |
| 97 | 'admin_label' => true, |
| 98 | 'dependency' => '', |
| 99 | 'weight' => '', |
| 100 | 'group' => '' , |
| 101 | 'edit_field_class' => '' |
| 102 | ), |
| 103 | array( |
| 104 | 'param_name' => 'icon', |
| 105 | 'type' => 'iconpicker', |
| 106 | 'value' => '', |
| 107 | 'def_value' => '', |
| 108 | 'holder' => 'textfield', |
| 109 | 'class' => 'iconpicker', |
| 110 | 'heading' => __('Icon','auxin-elements'), |
| 111 | 'description' => __('Please choose an icon from avaialable icons.', 'auxin-elements'), |
| 112 | 'admin_label' => true, |
| 113 | 'dependency' => '', |
| 114 | 'weight' => '', |
| 115 | 'group' => '' , |
| 116 | 'edit_field_class' => '' |
| 117 | ), |
| 118 | array( |
| 119 | 'param_name' => 'icon_color', |
| 120 | 'type' => 'colorpicker', |
| 121 | 'def_value' => '#888', |
| 122 | 'value' => '#888', |
| 123 | 'holder' => '', |
| 124 | 'class' => 'icon_color', |
| 125 | 'heading' => __('Icon Color','auxin-elements'), |
| 126 | 'description' => __('Choose a color for icon.','auxin-elements'), |
| 127 | 'admin_label' => true, |
| 128 | 'dependency' => '', |
| 129 | 'weight' => '', |
| 130 | 'group' => '' , |
| 131 | 'edit_field_class' => '' |
| 132 | ), |
| 133 | array( |
| 134 | 'param_name' => 'image', |
| 135 | 'type' => 'attach_image', |
| 136 | 'def_value' => '', |
| 137 | 'value' => '', |
| 138 | 'holder' => '', |
| 139 | 'class' => 'image', |
| 140 | 'heading' => __('Image','auxin-elements'), |
| 141 | 'description' => '', |
| 142 | 'admin_label' => true, |
| 143 | 'dependency' => '', |
| 144 | 'weight' => '', |
| 145 | 'group' => '' , |
| 146 | 'edit_field_class' => '' |
| 147 | ), |
| 148 | array( |
| 149 | 'param_name' => 'image_position', |
| 150 | 'type' => 'aux_visual_select', |
| 151 | 'def_value' => 'top', |
| 152 | 'choices' => array( |
| 153 | 'top' => array( |
| 154 | 'label' => __('White Space', 'auxin-elements'), |
| 155 | 'image' => AUX_URL . 'images/visual-select/column-icon-top.svg' |
| 156 | ), |
| 157 | 'left' => array( |
| 158 | 'label' => __('Solid', 'auxin-elements'), |
| 159 | 'image' => AUX_URL . 'images/visual-select/column-icon-left.svg' |
| 160 | ), |
| 161 | 'right' => array( |
| 162 | 'label' => __('Dashed', 'auxin-elements'), |
| 163 | 'image' => AUX_URL . 'images/visual-select/column-icon-right.svg' |
| 164 | ) |
| 165 | ), |
| 166 | 'holder' => 'dropdown', |
| 167 | 'class' => 'image_position', |
| 168 | 'heading' => __('Image or icon position','auxin-elements'), |
| 169 | 'description' => '', |
| 170 | 'admin_label' => true, |
| 171 | 'dependency' => '', |
| 172 | 'weight' => '', |
| 173 | 'group' => '' , |
| 174 | 'edit_field_class' => '' |
| 175 | ), |
| 176 | array( |
| 177 | 'param_name' => 'content', |
| 178 | 'type' => 'textarea_html', |
| 179 | 'value' => '', |
| 180 | 'def_value' => '', |
| 181 | 'holder' => 'div', |
| 182 | 'class' => 'content', |
| 183 | 'heading' => __('Content','auxin-elements'), |
| 184 | 'description' => '', |
| 185 | 'admin_label' => true, |
| 186 | 'dependency' => '', |
| 187 | 'weight' => '', |
| 188 | 'group' => '' , |
| 189 | 'edit_field_class' => '' |
| 190 | ), |
| 191 | array( |
| 192 | 'param_name' => 'extra_classes', |
| 193 | 'type' => 'textfield', |
| 194 | 'value' => '', |
| 195 | 'def_value' => '', |
| 196 | 'holder' => 'textfield', |
| 197 | 'class' => 'extra_classes', |
| 198 | 'heading' => __('Extra class name','auxin-elements'), |
| 199 | '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'), |
| 200 | 'admin_label' => true, |
| 201 | 'dependency' => '', |
| 202 | 'weight' => '', |
| 203 | 'group' => '' , |
| 204 | 'edit_field_class' => '' |
| 205 | ) |
| 206 | ) |
| 207 | ); |
| 208 | |
| 209 | return $master_array; |
| 210 | } |
| 211 | |
| 212 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_text_master_array', 10, 1 ); |
| 213 | |
| 214 | // This is the widget call back in fact the front end out put of this widget comes from this function |
| 215 | function auxin_widget_column_callback( $atts, $shortcode_content = null ){ |
| 216 | |
| 217 | // Defining default attributes |
| 218 | $default_atts = array( |
| 219 | 'title' => '', // section title |
| 220 | 'title_link' => '', // the link on title |
| 221 | 'content' => '', // the link on title |
| 222 | 'text_align' => '', |
| 223 | 'icon' => '', // icon on column side |
| 224 | 'icon_color' => '#888', |
| 225 | 'image' => '', // image on column side |
| 226 | 'image_position' => 'top', // top,left,right |
| 227 | |
| 228 | 'extra_classes' => '', // custom css class names for this element |
| 229 | 'custom_el_id' => '', // custom id attribute for this element |
| 230 | 'base_class' => 'aux-widget-text' // base class name for container |
| 231 | ); |
| 232 | |
| 233 | $result = auxin_get_widget_scafold( $atts, $default_atts ); |
| 234 | extract( $result['parsed_atts'] ); |
| 235 | |
| 236 | $icon = $icon == 'none' ? '' : $icon; |
| 237 | $icon_color = empty( $icon_color ) ? '' : 'style="color:'.$icon_color.' !important;"'; |
| 238 | $text_align = empty( $text_align ) ? '' : ' aux-text-align-' . $text_align; |
| 239 | $content = empty( $content ) ? $shortcode_content : $content; |
| 240 | |
| 241 | if( ! empty( $image ) && is_numeric( $image ) ) { |
| 242 | $image = auxin_get_the_resized_attachment( $image ); |
| 243 | } |
| 244 | |
| 245 | ob_start(); |
| 246 | |
| 247 | // widget header ------------------------------ |
| 248 | echo $result['widget_header']; |
| 249 | ?> |
| 250 | <div class="aux-shape-<?php echo esc_attr( $image_position ) . $text_align . ' ' . $extra_classes; ?>"> |
| 251 | <?php if( ! empty( $icon ) && empty( $image ) ) { ?> |
| 252 | <span class="aux-col-icon <?php echo $icon; ?>" <?php echo $icon_color; ?> > </span> |
| 253 | <?php } elseif( !empty( $image ) ) { |
| 254 | echo $image; |
| 255 | } if( ! empty( $title ) && empty( $title_link ) ) { ?> |
| 256 | <h4 class="col-title"><?php echo $title; ?></h4> |
| 257 | <?php } elseif( ! empty( $title ) && ! empty( $title_link ) ) { ?> |
| 258 | <h4 class="col-title"><a href="<?php echo $title_link; ?>"><?php echo $title; ?></a></h4> |
| 259 | <?php } if( ! empty( $content ) ) { ?> |
| 260 | <div class="entry-content"> |
| 261 | <?php $encoding_flag = defined('ENT_HTML401') ? ENT_HTML401 : ENT_QUOTES; ?> |
| 262 | <p><?php echo do_shortcode( html_entity_decode( $content, $encoding_flag, 'UTF-8') ); ?></p> |
| 263 | </div> |
| 264 | <?php } ?> |
| 265 | </div> |
| 266 | |
| 267 | <?php |
| 268 | // widget footer ------------------------------ |
| 269 | echo $result['widget_footer']; |
| 270 | |
| 271 | return ob_get_clean(); |
| 272 | } |
| 273 |