PluginProbe ʕ •ᴥ•ʔ
Custom Twitter Feeds – A Tweets Widget or X Feed Widget / 2.7.0
Custom Twitter Feeds – A Tweets Widget or X Feed Widget v2.7.0
2.8.0 2.7.0 2.6.1 2.6.0 1.0 1.0.1 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.2 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.4 1.4.1 1.5 1.5.1 1.6 1.6.1 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1 2.1.1 2.1.2 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.5.4 2.5.5 trunk
custom-twitter-feeds / inc / widget.php
custom-twitter-feeds / inc Last commit date
Admin 1 month ago Builder 1 month ago Integrations 1 month ago SmashTwitter 1 month ago UsageTracking 1 month ago V2 1 month ago blocks 1 month ago CTF_Display_Elements.php 1 month ago CTF_Feed.php 1 month ago CTF_Feed_Locator.php 1 month ago CTF_GDPR_Integrations.php 1 month ago CTF_Parse.php 1 month ago CTF_Settings.php 1 month ago CtfAdmin.php 1 month ago CtfCache.php 1 month ago CtfFeed.php 1 month ago CtfOauthConnect.php 1 month ago SB_Twitter_Cron_Updater.php 1 month ago admin-hooks.php 1 month ago ctf-functions.php 1 month ago notices.php 1 month ago widget.php 1 month ago
widget.php
64 lines
1 <?php
2 /**
3 * Class CtfWidget
4 *
5 * Creates a text widget with the custom-twitter-feeds shortcode inside
6 */
7
8 class CtfWidget extends WP_Widget
9 {
10 function __construct() {
11 parent::__construct(
12 'custom-twitter-feeds-widget',
13 __( 'Custom Twitter Feeds', 'custom-twitter-feeds' ),
14 array( 'description' => __( 'Display your Twitter feed', 'custom-twitter-feeds' ), )
15 );
16 }
17
18 public function widget( $args, $instance ) {
19
20 $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) : '';
21 $content = isset( $instance['content'] ) ? strip_tags( $instance['content'] ) : '[custom-twitter-feeds]';
22
23 echo $args['before_widget'];
24
25 if ( ! empty( $title ) ) {
26 echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
27 }
28
29 echo do_shortcode( $content );
30
31 echo $args['after_widget'];
32 }
33
34 public function form( $instance ) {
35
36 $title = isset( $instance['title'] ) ? $instance['title'] : '';
37 $content = isset ( $instance['content'] ) ? strip_tags( $instance['content'] ) : '[custom-twitter-feeds]';
38 ?>
39 <p>
40 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label>
41 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
42 </p>
43 <textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'content' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'content' ) ); ?>" rows="16"><?php echo strip_tags( $content ); ?></textarea>
44 <?php
45 }
46
47 public function update( $new_instance, $old_instance ) {
48 $instance = array();
49 $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
50 $instance['content'] = ( ! empty( $new_instance['content'] ) ) ? strip_tags( $new_instance['content'] ) : '';
51
52 return $instance;
53 }
54 }
55
56 // register and load the widget
57 function ctf_load_widget() {
58 register_widget( 'CtfWidget' );
59 }
60 add_action( 'widgets_init', 'ctf_load_widget' );
61
62 // allow shortcode in widgets
63 add_filter( 'widget_text', 'do_shortcode' );
64