PATH:
home
/
letacommog
/
aperobusiness
/
wp-content
/
themes
/
deep
/
inc
/
core
/
elementor
/
widgets
<?php namespace Elementor; class Webnus_Element_Widgets_Twitter_Feed extends \Elementor\Widget_Base { /** * Retrieve Twitter Feed widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'twitter_feed'; } /** * Retrieve Twitter Feed widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return esc_html__( 'Webnus Twitter Feed', 'deep' ); } /** * Retrieve Twitter Feed widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'ti-twitter'; } /** * Set widget category. * * @since 1.0.0 * @access public * * @return array Widget category. */ public function get_categories() { return [ 'webnus' ]; } /** * Register Twitter Feed widget controls. * * * @since 1.0.0 * @access protected */ protected function _register_controls() { // Content Tab $this->start_controls_section( 'content_section', [ 'label' => esc_html__( 'Feed Settings', 'deep' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); // Twitter Username $this->add_control( 'username', //param_name [ 'label' => esc_html__( 'Twitter Username', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'profile id/username', 'deep' ), ] ); // Feed Count $this->add_control( 'count', [ 'label' => esc_html__( 'Feed Count', 'deep' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, 'min' => 1, 'max' => 32, 'step' => 1, ] ); // Access Token $this->add_control( 'access_token', //param_name [ 'label' => esc_html__( 'Access Token', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'TOKEN...', 'deep' ), ] ); // Access Token Secret $this->add_control( 'access_token_secret', //param_name [ 'label' => esc_html__( 'Access Token Secret', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'TOKEN SECRET...', 'deep' ), ] ); // Consumer Key $this->add_control( 'consumer_key', //param_name [ 'label' => esc_html__( 'Consumer Key', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'Consumer...', 'deep' ), ] ); // Consumer Secret $this->add_control( 'consumer_secret', //param_name [ 'label' => esc_html__( 'Consumer Secret', 'deep' ), //heading 'type' => Controls_Manager::TEXT, //type 'placeholder' => esc_html__( 'Consumer Secret...', '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 Twitter Feed widget output on the frontend. * * * @since 1.0.0 * @access protected */ protected function render() { ob_start(); $settings = $this->get_settings_for_display(); $username = $settings[ 'username' ]; $count = $settings[ 'count' ]; $access_token = $settings[ 'access_token' ]; $access_token_secret = $settings[ 'access_token_secret' ]; $consumer_key = $settings[ 'consumer_key' ]; $consumer_secret = $settings[ 'consumer_secret' ]; // Class & ID $shortcodeclass = $settings['shortcodeclass'] ? $settings['shortcodeclass'] : ''; $shortcodeid = $settings['shortcodeid'] ? ' id="' . $settings['shortcodeid'] . '"' : ''; ?> <section class="wn-wrap-tweets-carousel ' . $shortcodeclass . '" ' . $shortcodeid . '> <div class="wn-tweets-carousel"> <i class="wn-fab wn-fa-twitter colorf"></i> <?php require_once DEEP_CORE_DIR . 'helper-classes/twitter-api.php'; /** Set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => $access_token, 'oauth_access_token_secret' => $access_token_secret, 'consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret ); $url = "https://api.twitter.com/1.1/statuses/user_timeline.json"; $requestMethod = "GET"; $getfield = "?screen_name=$username&count=$count"; $twitter = new \TwitterAPIExchange($settings); $tweets = json_decode($twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(),$assoc = TRUE); if( isset( $tweets['errors'][0]['message'] ) && $tweets['errors'][0]['message'] != '' ) : echo ' <h3>' . esc_html__( 'Sorry, there was a problem.', 'deep' ) . '</h3> <p>' . esc_html__( 'Twitter returned the following error message:', 'deep' ) . '</p> <p><em>' . $tweets['errors'][0]['message'] . '</em></p>'; else : if ( $count > 1 ) { echo '<div class="tweets-owl-carousel owl-carousel owl-theme">'; } if ( isset( $tweets ) ) { foreach( $tweets as $tweet ) : // Convert attags to twitter profiles in <a> links $tweet['text'] = preg_replace("/@([A-Za-z0-9\/\.]*)/", "<a href=\"http://www.twitter.com/$1\">@$1</a>", $tweet['text']); // Formatting Twitter’s Date/Time $tweet['created_at'] = date("l M j \- g:ia",strtotime($tweet['created_at'])); echo '<p>' . $tweet['text'] . '</p>'; endforeach; } if ( $count > 1 ) { echo '</div>'; } deep_call_template( 'social.php' ); endif; ?> </div> </section> <?php $out = ob_get_contents(); ob_end_clean(); $out = str_replace('<p></p>','',$out); $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]