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
facebook.php
249 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Divider element |
| 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 | |
| 13 | function auxin_get_facebook_master_array( $master_array ) { |
| 14 | |
| 15 | $master_array['aux_facebook'] = array( |
| 16 | 'name' => __('Custom Facebook Feed', 'auxin-elements' ), |
| 17 | 'auxin_output_callback' => 'auxin_widget_facebook_callback', |
| 18 | 'base' => 'aux_facebook', |
| 19 | 'description' => __('It uses Custom Facebook Feed plugin.', 'auxin-elements'), |
| 20 | 'class' => 'aux-widget-facebook', |
| 21 | 'show_settings_on_create' => true, |
| 22 | 'weight' => 1, |
| 23 | 'is_widget' => true, |
| 24 | 'is_shortcode' => true, |
| 25 | 'category' => THEME_NAME, |
| 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-facebook', |
| 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' => __('Page ID', 'auxin-elements'), |
| 42 | 'description' => sprintf(__('ID of your Facebook Page or Group. Use %sthis tool%s to help you in finding this.', 'auxin-elements'), '<a target="_blank" href="https://lookup-id.com/">','</a>'), |
| 43 | 'param_name' => 'id', |
| 44 | 'type' => 'textfield', |
| 45 | 'value' => '', |
| 46 | 'def_value' => '', |
| 47 | 'holder' => 'textfield', |
| 48 | 'class' => 'id', |
| 49 | 'admin_label' => false, |
| 50 | 'dependency' => '', |
| 51 | 'weight' => '', |
| 52 | 'group' => '' , |
| 53 | 'edit_field_class' => '' |
| 54 | ), |
| 55 | array( |
| 56 | 'heading' => __('Page type', 'auxin-elements'), |
| 57 | 'description' => __('Specifies whether to display posts from a page or group.','auxin-elements'), |
| 58 | 'param_name' => 'pagetype', |
| 59 | 'type' => 'dropdown', |
| 60 | 'value' => array( |
| 61 | 'page' => __('Page' , 'auxin-elements'), |
| 62 | 'group' => __('Group', 'auxin-elements') |
| 63 | ), |
| 64 | 'def_value' => 'page', |
| 65 | 'holder' => '', |
| 66 | 'class' => 'pagetype', |
| 67 | 'admin_label' => true, |
| 68 | 'dependency' => '', |
| 69 | 'weight' => '', |
| 70 | 'group' => '' , |
| 71 | 'edit_field_class' => '' |
| 72 | ), |
| 73 | array( |
| 74 | 'heading' => __('Number of posts', 'auxin-elements'), |
| 75 | 'description' => __('The number of posts you wish to display.', 'auxin-elements'), |
| 76 | 'param_name' => 'num', |
| 77 | 'type' => 'textfield', |
| 78 | 'value' => '', |
| 79 | 'def_value' => '', |
| 80 | 'holder' => 'textfield', |
| 81 | 'class' => 'num', |
| 82 | 'admin_label' => false, |
| 83 | 'dependency' => '', |
| 84 | 'weight' => '', |
| 85 | 'group' => '' , |
| 86 | 'edit_field_class' => '' |
| 87 | ), |
| 88 | array( |
| 89 | 'heading' => __('Display posts by others', 'auxin-elements'), |
| 90 | 'description' => __('Specifies to display posts by only the page owner, anyone who posts on your page, or only others who post on your page.', 'auxin-elements'), |
| 91 | 'param_name' => 'showpostsby', |
| 92 | 'type' => 'dropdown', |
| 93 | 'value' => array( |
| 94 | 'me' => __('Only the page owner' , 'auxin-elements'), |
| 95 | 'others' => __('Page owner and other people', 'auxin-elements'), |
| 96 | 'onlyothers' => __('Only other people', 'auxin-elements') |
| 97 | ), |
| 98 | 'def_value' => 'me', |
| 99 | 'holder' => '', |
| 100 | 'class' => 'showpostsby', |
| 101 | 'admin_label' => true, |
| 102 | 'dependency' => '', |
| 103 | 'weight' => '', |
| 104 | 'group' => '' , |
| 105 | 'edit_field_class' => '' |
| 106 | ), |
| 107 | array( |
| 108 | 'heading' => __('Post text length', 'auxin-elements'), |
| 109 | 'description' => __('The maximum character length of the post text.', 'auxin-elements'), |
| 110 | 'param_name' => 'textlength', |
| 111 | 'type' => 'textfield', |
| 112 | 'value' => '', |
| 113 | 'class' => 'textlength', |
| 114 | 'admin_label' => false, |
| 115 | 'dependency' => '', |
| 116 | 'weight' => '', |
| 117 | 'group' => '' , |
| 118 | 'edit_field_class' => '' |
| 119 | ), |
| 120 | array( |
| 121 | 'heading' => __('Display post author', 'auxin-elements'), |
| 122 | 'description' => __('Enable it to display name and avatar of the post author.', 'auxin-elements'), |
| 123 | 'param_name' => 'showauthor', |
| 124 | 'type' => 'aux_switch', |
| 125 | 'value' => '1', |
| 126 | 'class' => 'showauthor', |
| 127 | 'admin_label' => false, |
| 128 | 'dependency' => '', |
| 129 | 'weight' => '', |
| 130 | 'group' => '' , |
| 131 | 'edit_field_class' => '' |
| 132 | ), |
| 133 | array( |
| 134 | 'heading' => __('Display the feed header', 'auxin-elements'), |
| 135 | 'description' => __('Enable it to display a customizable header at the top of the feed.', 'auxin-elements'), |
| 136 | 'param_name' => 'showheader', |
| 137 | 'type' => 'aux_switch', |
| 138 | 'value' => '0', |
| 139 | 'class' => 'showheader', |
| 140 | 'admin_label' => false, |
| 141 | 'dependency' => '', |
| 142 | 'weight' => '', |
| 143 | 'group' => '' , |
| 144 | 'edit_field_class' => '' |
| 145 | ), |
| 146 | array( |
| 147 | 'heading' => __('Ajax', 'auxin-elements'), |
| 148 | 'description' => __('Enable it for being loaded via Ajax.', 'auxin-elements'), |
| 149 | 'param_name' => 'ajax', |
| 150 | 'type' => 'aux_switch', |
| 151 | 'value' => '1', |
| 152 | 'class' => 'ajax', |
| 153 | 'admin_label' => false, |
| 154 | 'dependency' => '', |
| 155 | 'weight' => '', |
| 156 | 'group' => '' , |
| 157 | 'edit_field_class' => '' |
| 158 | ), |
| 159 | array( |
| 160 | 'heading' => __('Extra class name','auxin-elements' ), |
| 161 | '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' ), |
| 162 | 'param_name' => 'extra_classes', |
| 163 | 'type' => 'textfield', |
| 164 | 'value' => '', |
| 165 | 'def_value' => '', |
| 166 | 'holder' => 'textfield', |
| 167 | 'class' => 'extra_classes', |
| 168 | 'admin_label' => true, |
| 169 | 'dependency' => '', |
| 170 | 'weight' => '', |
| 171 | 'group' => __( 'Extras', 'auxin-elements' ), |
| 172 | 'edit_field_class' => '' |
| 173 | ) |
| 174 | ) |
| 175 | ); |
| 176 | |
| 177 | return $master_array; |
| 178 | } |
| 179 | |
| 180 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_facebook_master_array', 10, 1 ); |
| 181 | |
| 182 | function auxin_widget_facebook_callback( $atts, $shortcode_content = null ){ |
| 183 | |
| 184 | $default_atts = array( |
| 185 | 'id' => '', |
| 186 | 'pagetype' => 'page', |
| 187 | 'num' => '', |
| 188 | 'showpostsby' => 'me', |
| 189 | 'textlength' => '', |
| 190 | 'showauthor' => '1', |
| 191 | 'showheader' => '0', |
| 192 | 'ajax' => '1', |
| 193 | 'extra_classes' => '', |
| 194 | 'custom_el_id' => '', |
| 195 | 'base_class' => 'aux-widget-facebook' |
| 196 | ); |
| 197 | |
| 198 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 199 | extract( $result['parsed_atts'] ); |
| 200 | |
| 201 | $facebook_shortcode = ""; |
| 202 | |
| 203 | ob_start(); |
| 204 | |
| 205 | $pagetype = 'pagetype="' . $pagetype . '"'; |
| 206 | $showpostsby = 'showpostsby="' . $showpostsby . '"'; |
| 207 | if( ! empty( $id ) ) { |
| 208 | $id = 'id="' . $id . '"'; |
| 209 | } |
| 210 | if( ! empty( $num ) ) { |
| 211 | $num = 'num="' . $num . '"'; |
| 212 | } |
| 213 | if( ! empty( $textlength ) ) { |
| 214 | $textlength = 'textlength="' . $textlength . '"'; |
| 215 | } |
| 216 | if( ! empty( $extra_classes ) ) { |
| 217 | $extra_classes = 'class="' . $extra_classes . '"'; |
| 218 | } |
| 219 | |
| 220 | if( empty( $showauthor ) ){ |
| 221 | $showauthor = "false"; |
| 222 | } else { |
| 223 | $showauthor = "ture"; |
| 224 | } |
| 225 | $showauthor = 'showauthor="' . $showauthor .'"'; |
| 226 | |
| 227 | if( empty( $showheader ) ){ |
| 228 | $showheader = "false"; |
| 229 | } else { |
| 230 | $showheader = "ture"; |
| 231 | } |
| 232 | $showheader = 'showheader="' . $showheader .'"'; |
| 233 | |
| 234 | if( empty( $ajax ) ){ |
| 235 | $ajax = "false"; |
| 236 | } else { |
| 237 | $ajax = "ture"; |
| 238 | } |
| 239 | $ajax = 'ajax="' . $ajax .'"'; |
| 240 | |
| 241 | $facebook_shortcode = '[custom-facebook-feed ' . $id . ' ' . $num . ' ' . $textlength . ' ' . $pagetype . ' ' . $showpostsby . ' ' . $showauthor . ' ' . $ajax . ' ' . $extra_classes . ' ' . $showheader .']'; |
| 242 | |
| 243 | echo do_shortcode( $facebook_shortcode ); |
| 244 | |
| 245 | return ob_get_clean(); |
| 246 | |
| 247 | } |
| 248 | |
| 249 |