PATH:
home
/
letacommog
/
aperobusiness
/
wp-content
/
themes
/
deep
/
inc
/
core
/
elementor
/
widgets
<?php namespace Elementor; class Webnus_Element_Widgets_Instagram extends \Elementor\Widget_Base { /** * Retrieve Alert widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'instagram'; } /** * Retrieve Alert widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return esc_html__( 'Webnus Instagram', 'deep' ); } /** * Retrieve Alert widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'fa fa-instagram'; } /** * Set widget category. * * @since 1.0.0 * @access public * * @return array Widget category. */ public function get_categories() { return [ 'webnus' ]; } /** * enqueue JS * * @since 1.0.0 * @access public * */ public function get_script_depends() { return [ 'instagram' ]; } /** * Register Alert widget controls. * * * @since 1.0.0 * @access protected */ protected function _register_controls() { // Content Tab $this->start_controls_section( 'content_section', [ 'label' => esc_html__( 'General', 'deep' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); // Select Type $this->add_control( 'type', //param_name [ 'label' => esc_html__( 'Type', 'deep' ), //heading 'type' => Controls_Manager::SELECT, //type 'default' => 'default', 'options' => [ 'default' => esc_html__( 'Default', 'deep' ), 'carousel' => esc_html__( 'Carousel', 'deep' ), 'grid' => esc_html__( 'Grid', 'deep' ), ], ] ); // Access Token $this->add_control( 'token', //param_name [ 'label' => esc_html__( 'Access Token', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'Type your token here', 'deep' ), ] ); // Username $this->add_control( 'username', //param_name [ 'label' => esc_html__( 'Username', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'Type your username here', 'deep' ), ] ); // Number of posts $this->add_control( 'postnumber', [ 'label' => esc_html__( 'Number Of Post', 'your-plugin' ), 'type' => Controls_Manager::NUMBER, 'default' => 9, 'min' => 1, 'max' => 30, 'step' => 1, ] ); // Size $this->add_control( 'size', //param_name [ 'label' => esc_html__( 'Image Size', 'deep' ), //heading 'type' => Controls_Manager::SELECT, //type 'default' => 'thumbnail', 'options' => [ 'thumbnail' => esc_html__( '150 * 150 px', 'deep' ), 'low_resolution' => esc_html__( '320 * 320 px', 'deep' ), 'standard_resolution' => esc_html__( '480 * 480 px', 'deep' ), ], ] ); $this->end_controls_section(); // Class & ID Tab $this->start_controls_section( 'classid_section', [ 'label' => __( 'Class & ID', 'deep' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'shortcodeclass', [ 'label' => esc_html__( 'Extra Class', 'deep' ), 'type' => Controls_Manager::TEXT, ] ); $this->add_control( 'shortcodeid', [ 'label' => esc_html__( 'ID', 'deep' ), 'type' => Controls_Manager::TEXT, ] ); $this->end_controls_section(); // Custom css tab $this->start_controls_section( 'custom_css_section', [ 'label' => __( 'Custom CSS', 'deep' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'custom_css', [ 'label' => __( 'Custom CSS', 'deep' ), 'type' => \Elementor\Controls_Manager::CODE, 'language' => 'css', 'rows' => 20, 'show_label' => true, ] ); $this->end_controls_section(); } /** * Render Alert widget output on the frontend. * * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $type = $settings['type']; $token = $settings['token']; $username = $settings['username']; $postnumber = $settings['postnumber']; $size = $settings['size']; $count = !empty($postnumber) ? $postnumber : '9'; $insta_user = $username ? $username : ''; $size = $size ? $size : 'thumbnail'; // Class & ID $shortcodeclass = $settings['shortcodeclass'] ? $settings['shortcodeclass'] : ''; $shortcodeid = $settings['shortcodeid'] ? ' id="' . $settings['shortcodeid'] . '"' : ''; $out = ''; $out .= '<section class="footer-instagram-bar ' . $shortcodeclass . '" ' . $shortcodeid . '>'; /* Follow Text*/ $out .= '<div class="container"> <div class="row"> <div class="footer-instagram-text"> <h6>' /*. bloginfo('name')*/ . esc_html__( 'Follow on Instagram', 'deep' ) . '</h6> </div> </div> </div>'; /* Feed */ echo '<div class="instagram-feed ' . $type . '">'; $base_url = "https://api.instagram.com/v1/users/self/media/recent?access_token=" . $token . "&count=" . $count; $raw_content = wp_remote_get(esc_url_raw($base_url)); if(!is_wp_error($raw_content)){ $raw_content = $raw_content['body']; $json_insta = json_decode($raw_content); if (isset($json_insta->data[0])){ $id = $json_insta->data[0]->id; } switch ( $type ) : case 'default': if(!empty($id)){ $url = "https://api.instagram.com/v1/users/self/media/recent?access_token=" . $token . "&count=" . $count; $raw_content = wp_remote_get(esc_url_raw($url)); $output = ''; if(!is_wp_error($raw_content)){ $output .= '<ul>'; $raw_content = $raw_content['body']; $json_insta = json_decode($raw_content); if (isset($json_insta->data[0])){ foreach($json_insta->data as $data){ $output .= '<li><a href="'.esc_url($data->link).'" target="_blank"><img alt="" src="'.esc_url($data->images->$size->url).'"/></a></li>'; } } $output .= '</ul>'; echo '' . $output; } } break; case 'carousel': if(!empty($id)){ $url = "https://api.instagram.com/v1/users/self/media/recent?access_token=" . $token . "&count=" . $count; $raw_content = wp_remote_get(esc_url_raw($url)); $output = ''; if(!is_wp_error($raw_content)){ $output .= '<div class="instagram-wrap"><div class="owl-carousel-instagram owl-carousel owl-theme" data-instagram_count="1">'; $raw_content = $raw_content['body']; $json_insta = json_decode($raw_content); if (isset($json_insta->data[0])){ foreach($json_insta->data as $data){ $output .= '<a href="'.esc_url($data->link).'" target="_blank"><img alt="" src="'.esc_url($data->images->$size->url).'"/></a>'; } } $output .= '</div></div>'; echo '' . $output; } echo '<div class="instagram-text"><i class="wn-fab wn-fa-instagram"></i> Follow us <a href="http://instagram.com/' . $insta_user . '">@' . $insta_user . '</a></div>'; } break; case 'grid': if(!empty($id)){ $url = "https://api.instagram.com/v1/users/self/media/recent?access_token=" . $token . "&count=" . $count; $raw_content = wp_remote_get(esc_url_raw($url)); $output = ''; if(!is_wp_error($raw_content)){ $output .= '<ul>'; $raw_content = $raw_content['body']; $json_insta = json_decode($raw_content); if (isset($json_insta->data[0])){ foreach($json_insta->data as $data){ $output .= '<li><a href="'.esc_url($data->link).'" target="_blank"><img width="'.esc_attr($data->images->$size->width).'" height="'.esc_attr($data->images->$size->height).'" src="'.esc_url($data->images->$size->url).'"/></a></li>'; } } $output .= '</ul>'; echo '' . $output; } } break; endswitch; } else esc_html_e('An error has occoured...','deep'); echo '<div class="clear"></div>'; echo '</div>'; $out .= '</section>'; $custom_css = $settings['custom_css']; if ( $custom_css != '' ) { echo '<style>'. $custom_css .'</style>'; } echo $out; } }
[+]
..
[-] our-client.php
[edit]
[-] icons.php
[edit]
[-] collection.php
[edit]
[-] testimonial-tab.php
[edit]
[-] teaserbox.php
[edit]
[-] instagram.php
[edit]
[-] our-team.php
[edit]
[-] content-carousel.php
[edit]
[-] videoteaser.php
[edit]
[-] like-view-share.php
[edit]
[-] courses-instructors.php
[edit]
[-] widget-flickr.php
[edit]
[-] reservation.php
[edit]
[-] list.php
[edit]
[-] road-map.php
[edit]
[-] max-counter.php
[edit]
[-] magazine.php
[edit]
[-] prayer-wall-items.php
[edit]
[-] facebook-button.php
[edit]
[-] icon-divider.php
[edit]
[-] featured-products.php
[edit]
[-] review-items.php
[edit]
[-] iconbox.php
[edit]
[-] widget-googleplus.php
[edit]
[-] content-slider.php
[edit]
[-] service-carousel.php
[edit]
[-] contact-form.php
[edit]
[-] twitter-feed.php
[edit]
[-] blog.php
[edit]
[-] process-carousel.php
[edit]
[-] course-category.php
[edit]
[-] virtual-coins.php
[edit]
[-] speakers.php
[edit]
[-] the-grid.php
[edit]
[-] custom-menu.php
[edit]
[-] widget-youtube.php
[edit]
[-] testimonial.php
[edit]
[-] callout.php
[edit]
[-] testimonial-slider.php
[edit]
[-] category-tab.php
[edit]
[-] testimonial-carousel.php
[edit]
[-] button.php
[edit]
[-] facebook-comments.php
[edit]
[-] widget-login.php
[edit]
[-] subscribe.php
[edit]
[-] googlemap.php
[edit]
[-] widget-social-icon.php
[edit]
[-] postslider.php
[edit]
[-] alert.php
[edit]
[-] video-play-button.php
[edit]
[-] quote.php
[edit]
[-] donate.php
[edit]
[-] dropcap.php
[edit]
[-] before-after-image.php
[edit]
[-] pricing-tables.php
[edit]
[-] facebook-page.php
[edit]
[-] shop-products.php
[edit]
[-] single-goal.php
[edit]
[-] info-box.php
[edit]
[-] latestfromblog.php
[edit]
[-] goals.php
[edit]
[-] revolution-slider.php
[edit]
[-] widget-subscribe.php
[edit]
[-] tablepress.php
[edit]
[-] tab-content.php
[edit]
[-] schedule.php
[edit]
[-] sermon-category.php
[edit]
[-] pricing-plan.php
[edit]
[-] tabs.php
[edit]
[-] widget-latest-posts.php
[edit]
[-] distance.php
[edit]
[-] widget-popular-posts.php
[edit]
[-] recipes.php
[edit]
[-] causes.php
[edit]
[-] widget-testimonial.php
[edit]
[-] widget-about.php
[edit]
[-] special-offers.php
[edit]
[-] tooltip.php
[edit]
[-] food-menu.php
[edit]
[-] wp-hotel-booking.php
[edit]
[-] widget-tab.php
[edit]
[-] courses.php
[edit]
[-] login.php
[edit]
[-] post-from-blog.php
[edit]
[-] socials.php
[edit]
[-] line.php
[edit]
[-] gallery.php
[edit]
[-] faq.php
[edit]
[-] piecharts.php
[edit]
[-] image-hotspot.php
[edit]
[-] link.php
[edit]
[-] prayer-wall-form.php
[edit]
[-] rooms.php
[edit]
[-] countdown.php
[edit]
[-] portfolio-carousel.php
[edit]
[-] facebook-embed.php
[edit]
[-] single-cause.php
[edit]
[-] review-form.php
[edit]
[-] buy-process.php
[edit]
[-] sermons.php
[edit]
[-] widget-facebook.php
[edit]
[-] single-sermon.php
[edit]
[-] single-course.php
[edit]
[-] image-carousel.php
[edit]
[-] toggle-box.php
[edit]
[-] our-process.php
[edit]
[-] svg.php
[edit]
[-] w-title.php
[edit]
[-] block-quote.php
[edit]