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
divider.php
232 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Divider 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 | |
| 13 | function auxin_get_divider_master_array( $master_array ) { |
| 14 | |
| 15 | $master_array['aux_divider'] = array( |
| 16 | 'name' => __('[Phlox] Divider', 'auxin-elements' ), |
| 17 | 'auxin_output_callback' => 'auxin_widget_divider_callback', |
| 18 | 'base' => 'aux_divider', |
| 19 | 'description' => __('Horizontal seperator', 'auxin-elements'), |
| 20 | 'class' => 'aux-widget-divider', |
| 21 | 'show_settings_on_create' => true, |
| 22 | 'weight' => 1, |
| 23 | 'is_widget' => true, |
| 24 | 'is_shortcode' => true, |
| 25 | 'is_so' => true, |
| 26 | 'is_vc' => false, |
| 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-divider', |
| 34 | 'custom_markup' => '', |
| 35 | 'js_view' => '', |
| 36 | 'html_template' => '', |
| 37 | 'deprecated' => '', |
| 38 | 'content_element' => '', |
| 39 | 'as_parent' => '', |
| 40 | 'as_child' => '', |
| 41 | 'params' => array( |
| 42 | array( |
| 43 | 'param_name' => 'style', |
| 44 | 'type' => 'aux_visual_select', |
| 45 | 'std' => "solid", |
| 46 | 'holder' => 'dropdown', |
| 47 | 'class' => 'style', |
| 48 | 'heading' => __('Divider Style','auxin-elements'), |
| 49 | 'description' => '', |
| 50 | 'admin_label' => true, |
| 51 | 'dependency' => '', |
| 52 | 'weight' => '', |
| 53 | 'group' => '' , |
| 54 | 'edit_field_class' => '', |
| 55 | 'choices' => array( |
| 56 | 'white-space' => array( |
| 57 | 'label' => __('White Space', 'auxin-elements'), |
| 58 | 'image' => AUX_URL . 'images/visual-select/divider-white-space.svg' |
| 59 | ), |
| 60 | 'solid' => array( |
| 61 | 'label' => __('Solid', 'auxin-elements'), |
| 62 | 'image' => AUX_URL . 'images/visual-select/divider-solid.svg' |
| 63 | ), |
| 64 | 'dashed' => array( |
| 65 | 'label' => __('Dashed', 'auxin-elements'), |
| 66 | 'image' => AUX_URL . 'images/visual-select/divider-dashed.svg' |
| 67 | ), |
| 68 | 'circle-symbol' => array( |
| 69 | 'label' => __('Circle', 'auxin-elements'), |
| 70 | 'image' => AUX_URL . 'images/visual-select/divider-circle.svg' |
| 71 | ), |
| 72 | 'diamond-symbol' => array( |
| 73 | 'label' => __('Diamond', 'auxin-elements'), |
| 74 | 'image' => AUX_URL . 'images/visual-select/divider-diamond.svg' |
| 75 | ) |
| 76 | ) |
| 77 | ), |
| 78 | array( |
| 79 | 'param_name' => 'width', |
| 80 | 'type' => 'dropdown', |
| 81 | 'value' => array( |
| 82 | 'large' => __('Large', 'auxin-elements'), |
| 83 | 'medium' => __('Medium', 'auxin-elements'), |
| 84 | 'small' => __('Small', 'auxin-elements') |
| 85 | ), |
| 86 | 'std' => 'medium', |
| 87 | 'def_value' => 'medium', |
| 88 | 'holder' => 'textfield', |
| 89 | 'class' => 'width', |
| 90 | 'heading' => __('Width','auxin-elements'), |
| 91 | 'description' => __('Specifies the size of divider.', 'auxin-elements'), |
| 92 | 'admin_label' => true, |
| 93 | 'dependency' => array( |
| 94 | 'element' => 'style', |
| 95 | 'value' => array('solid', 'dashed', 'circle-symbol', 'diamond-symbol') |
| 96 | ), |
| 97 | 'weight' => '', |
| 98 | 'group' => '' , |
| 99 | 'edit_field_class' => '' |
| 100 | ), |
| 101 | array( |
| 102 | 'param_name' => 'margin_top', |
| 103 | 'type' => 'textfield', |
| 104 | 'value' => '', |
| 105 | 'def_value' => '', |
| 106 | 'holder' => 'textfield', |
| 107 | 'class' => 'margin_top', |
| 108 | 'heading' => __('Margin top (px)','auxin-elements'), |
| 109 | 'description' => __('Adds space above the divider in pixels.', 'auxin-elements'), |
| 110 | 'admin_label' => false, |
| 111 | 'dependency' => '', |
| 112 | 'weight' => '', |
| 113 | 'group' => '' , |
| 114 | 'edit_field_class' => '' |
| 115 | ), |
| 116 | array( |
| 117 | 'param_name' => 'margin_bottom', |
| 118 | 'type' => 'textfield', |
| 119 | 'value' => '', |
| 120 | 'def_value' => '', |
| 121 | 'holder' => 'textfield', |
| 122 | 'class' => 'margin_bottom', |
| 123 | 'heading' => __('Margin bottom (px)','auxin-elements'), |
| 124 | 'description' => __('Adds space below the devider in pixels.', 'auxin-elements'), |
| 125 | 'admin_label' => true, |
| 126 | 'dependency' => '', |
| 127 | 'weight' => '', |
| 128 | 'group' => '' , |
| 129 | 'edit_field_class' => '' |
| 130 | ), |
| 131 | array( |
| 132 | 'param_name' => 'extra_classes', |
| 133 | 'type' => 'textfield', |
| 134 | 'value' => '', |
| 135 | 'def_value' => '', |
| 136 | 'holder' => 'textfield', |
| 137 | 'class' => 'extra_classes', |
| 138 | 'heading' => __('Extra class name','auxin-elements'), |
| 139 | '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. you can add multiple CSS class by separating them with space.', 'auxin-elements'), |
| 140 | 'admin_label' => true, |
| 141 | 'dependency' => '', |
| 142 | 'weight' => '', |
| 143 | 'group' => '' , |
| 144 | 'edit_field_class' => '' |
| 145 | ) |
| 146 | ) |
| 147 | ); |
| 148 | |
| 149 | return $master_array; |
| 150 | } |
| 151 | |
| 152 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_divider_master_array', 10, 1 ); |
| 153 | |
| 154 | |
| 155 | |
| 156 | // This is the widget call back in fact the front end out put of this widget comes from this function |
| 157 | function auxin_widget_divider_callback( $atts, $shortcode_content = null ){ |
| 158 | |
| 159 | $default_atts = array( |
| 160 | 'title' => '', |
| 161 | 'size' => '', |
| 162 | 'style' => 'solid', |
| 163 | 'width' => 'large', |
| 164 | 'extra_classes' => '', |
| 165 | 'base_class' => '', |
| 166 | 'margin_bottom' => '', |
| 167 | 'margin_top' => '', |
| 168 | |
| 169 | 'extra_classes' => '', |
| 170 | 'custom_el_id' => '', |
| 171 | 'base_class' => 'aux-widget-divider' |
| 172 | ); |
| 173 | |
| 174 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 175 | extract( $result['parsed_atts'] ); |
| 176 | |
| 177 | $class_names = ""; |
| 178 | $inline_styles = ""; |
| 179 | |
| 180 | switch ($style) { |
| 181 | case 'solid': |
| 182 | $class_names = "aux-divider-center"; |
| 183 | break; |
| 184 | case 'dashed': |
| 185 | $class_names = "aux-divider-dashed"; |
| 186 | break; |
| 187 | case 'circle-symbol': |
| 188 | $class_names = "aux-divider-symbolic-circle"; |
| 189 | break; |
| 190 | case 'diamond-symbol': |
| 191 | $class_names = "aux-divider-symbolic-square"; |
| 192 | break; |
| 193 | case 'white-space': |
| 194 | $class_names = "aux-divider-space"; |
| 195 | break; |
| 196 | } |
| 197 | |
| 198 | switch ($width) { |
| 199 | case 'large': |
| 200 | $class_names .= ""; |
| 201 | break; |
| 202 | case 'medium': |
| 203 | $class_names .= " aux-divider-medium"; |
| 204 | |
| 205 | break; |
| 206 | case 'small': |
| 207 | $class_names .= " aux-divider-small"; |
| 208 | break; |
| 209 | } |
| 210 | |
| 211 | if( ! empty( $extra_classes ) ) { |
| 212 | $class_names .= " $extra_classes"; |
| 213 | } |
| 214 | |
| 215 | if( ! empty( $margin_top ) ) { |
| 216 | $margin_top = (int)$margin_top; |
| 217 | $inline_styles .= "margin-top: $margin_top" . "px;"; |
| 218 | } |
| 219 | |
| 220 | if( ! empty( $margin_bottom ) ) { |
| 221 | $margin_bottom = (int)$margin_bottom; |
| 222 | $inline_styles .= "margin-bottom:$margin_bottom" . "px;"; |
| 223 | } |
| 224 | |
| 225 | if( ! empty( $inline_styles ) ) { |
| 226 | $inline_styles = ' style="' . $inline_styles . '" '; |
| 227 | } |
| 228 | |
| 229 | return '<hr class="'. $class_names . '"' . $inline_styles . ' >'; |
| 230 | } |
| 231 | |
| 232 |