Changeset 739242
- Timestamp:
- 07/11/2013 03:55:49 PM (12 years ago)
- Location:
- twiget/trunk
- Files:
-
- 8 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
twiget/trunk/css/twiget.css
r652292 r739242 1 .twiget-widget ul li { 2 border-bottom: 1px solid #E3E3E3; 3 padding: 6px 0; 1 #twiget-feed { 2 margin: auto; 3 padding: 5px 5px 5px 0px; 4 overflow:auto; 5 } 6 .twiget-article { 7 border-bottom: 1px solid #CCC; 8 float:left; 9 padding: 5px 0px; 10 } 11 #twiget-ajax-loading { 12 padding: 5px 0px; 13 text-align: center; 14 } 15 .twiget-pic { 16 float: left; 17 } 18 19 .twiget-pic img { 20 float: left; 21 border-radius: 5px; 22 border: none; 23 margin-right: 5px; 24 25 } 26 27 .twiget-status { 28 display: block; 29 } 30 31 .twiget-text { 32 padding: 3px 0; 33 float: left; 34 } 35 36 .twiget-time { 37 font-size: 10px; 38 float: left; 4 39 } 5 40 6 41 #twigetfollow { 7 margin-top: 10px;42 margin-top: 5px; 8 43 text-align: right; 9 44 } -
twiget/trunk/readme.txt
r652292 r739242 4 4 Tags: twitter, widget, tweets, twitter widget, sidebar 5 5 Requires at least: 2.5 6 Tested up to: 3. 56 Tested up to: 3.6 7 7 Stable tag: 1.0 8 8 License: GPLv3 … … 21 21 * Option to show followers count 22 22 * Option to open links in a new window 23 * Option to hide @replies23 * Option to show twitter client used. Eg: via Twitter for Android 24 24 * Linkified @usernames 25 25 * Linkified #hashtags 26 26 27 TwiGet is a clone of the Twitter Widget in the [Graphene Theme](http://w ordpress.org/extend/themes/graphene/) developed by [Syahir Hakim](http://www.khairul-syahir.com/). The plugin is developed by [Prasanna SP](http://www.prasannasp.net/).27 TwiGet is a clone of the Twitter Widget in the [Graphene Theme](http://www.graphene-theme.com/) developed by [Syahir Hakim](http://www.khairul-syahir.com/). The plugin is developed by [Prasanna SP](http://www.prasannasp.net/). 28 28 29 29 **Translation**: If you want to translate this plugin to your language, please find the twiget.pot file in /languages/ folder. … … 35 35 Visit [this page](http://www.prasannasp.net/wordpress-plugins/) for more **WordPress Plugins** by the developer. 36 36 37 This plugin uses Abraham's [twitteroauth library] (https://github.com/abraham/twitteroauth/). 38 37 39 == Installation == 38 40 39 41 1. Upload `twiget` folder to the `/wp-content/plugins/` directory 40 1. Activate the plugin through the 'Plugins' menu in WordPress 41 1. Go to Appearance --> Widgets and add TwiGet Twitter Widget to any of the widgetized areas 42 2. Activate the plugin through the 'Plugins' menu in WordPress 43 3. Go to Settings --> Twiget Settings and enter your twitter username, number of tweets to show and Twitter API Credentials 44 4. Go to Appearance --> Widgets and add TwiGet Twitter Widget to any of the widgetized areas 42 45 43 46 == Frequently asked questions == … … 47 50 Post your questions or report issue in the [support forum](http://forum.prasannasp.net/forum/plugin-support/twiget/). You can directly contact the developer using this [contact form](http://www.prasannasp.net/contact/). 48 51 49 = How to style the widget? =50 51 The widget is bundled with a stylesheet. If you want to use your own styles, dequeue `twiget-widget-css` and then style it using `.twiget-widget` css class. The follow @ button is wrapped in twigetfollow ID. So, use `#twigetfollow` in your Custom CSS to style it.52 53 Dequeuing bundled stylesheet:54 55 `wp_dequeue_style( 'twiget-widget-css' );`56 57 52 == Screenshots == 58 53 59 1. TwiGet Twitter Widget configuration 60 2. TwiGet Twitter Widget in twentytwelve theme 61 3. TwiGet Twitter Widget in Graphene Theme 54 1. TwiGet Twitter Widget with profile picture and username in Graphene Theme 55 2. TwiGet Twitter Widget without profile picture and username in Graphene Theme 56 3. TwiGet Twitter Widget in twentytwelve theme 57 4. Twiget Twitter Plugin Settings 58 5. TwiGet Twitter Widget configuration 62 59 63 60 == Changelog == 61 62 = 1.1 = 63 64 * Made the plugin compatible with Twitter API 1.1 65 * Added option to show profile picture, username, twitter client used along with each tweet 64 66 65 67 = 1.0 = -
twiget/trunk/twiget.php
r652292 r739242 2 2 /* 3 3 Plugin Name: TwiGet Twitter Widget 4 Plugin URI: http://www.prasannasp.net/wordpress-plugins/twiget -twitter-widget/4 Plugin URI: http://www.prasannasp.net/wordpress-plugins/twiget/ 5 5 Description: A widget to display the latest Twitter status updates. 6 6 Author: Prasanna SP 7 Version: 1. 07 Version: 1.1 8 8 Author URI: http://www.prasannasp.net/ 9 9 */ … … 30 30 31 31 function load_twiget_plugin_textdomain() { 32 load_plugin_textdomain( 'twiget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 32 load_plugin_textdomain( 'twiget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 33 33 } 34 34 add_action('plugins_loaded', 'load_twiget_plugin_textdomain'); 35 36 define( 'TWIGET_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 37 require_once TWIGET_PLUGIN_PATH . 'twiget-functions.php'; 38 require_once TWIGET_PLUGIN_PATH . 'twiget-options-form.php'; 35 39 36 40 /** 37 41 * Register custom Twitter widgets. 38 42 */ 39 global $twiget_username;40 global $twiget_tweetcount;41 $twiget_username = '';42 $twiget_tweetcount = 1;43 43 44 44 class Twiget_Twitter_Widget extends WP_Widget{ … … 53 53 // Create the widget 54 54 $this->WP_Widget( 'twiget-widget', 'TwiGet Twitter Widget', $widget_ops, $control_ops); 55 56 /* Enqueue the twitter script and css if widget is active */ 57 if ( is_active_widget( false, false, $this->id_base, true ) && ! is_admin() ) 58 wp_enqueue_script( 'twiget-widget-js', plugins_url( '/js/twitter.js' , __FILE__ ), array(), '', false ); 59 wp_enqueue_style( 'twiget-widget-css', plugins_url( '/css/twiget.css' , __FILE__ ), array(), '', false ); 55 60 56 } 61 57 62 58 function widget( $args, $instance ){ // This function displays the widget 63 59 extract( $args ); 64 65 // User selected settings 66 global $twiget_username; 67 global $twiget_tweetcount; 68 global $twiget_followercount; 69 global $twiget_hide_replies; 70 global $twiget_twitter_newwindow; 60 61 $twiget_options = get_option('twiget_options'); 62 $twiget_username = $twiget_options['user_name']; 63 if (isset($twiget_options['followers_count'])) { $followers_count = $twiget_options['followers_count']; } 71 64 72 65 $twiget_title = apply_filters( 'twiget_widget_title', empty($instance['twiget_title']) ? __( 'Latest tweets', 'twiget' ) : $instance['twiget_title'], $instance, $this->id_base); 73 $twiget_username = $instance['twiget_username']; 74 $twiget_tweetcount = $instance['twiget_tweetcount']; 75 $twiget_followercount = $instance['twiget_followercount']; 76 $twiget_hide_replies = ( array_key_exists( 'twiget_hide_replies', $instance ) ) ? $instance['twiget_hide_replies'] : false ; 77 $twiget_new_window = $instance['twiget_new_window']; 78 $twiget_twitter_newwindow = $twiget_new_window; 66 79 67 $wrapper_id = 'tweet-wrap-' . $args['widget_id']; 80 68 81 $twiget_follower_count_attr = ( $twiget_followercount ) ? 'data-show-count="true"' : 'data-show-count="false"'; 82 $hide_replies_attr = ( $twiget_hide_replies ) ? 'exclude_replies=true' : 'exclude_replies=false'; 83 69 $twiget_follower_count_attr = (isset($followers_count) == 1) ? 'data-show-count="true"' : 'data-show-count="false"'; 70 84 71 echo $args['before_widget'].$args['before_title'].$twiget_title.$args['after_title']; 85 72 ?> 86 <ul id="<?php echo $wrapper_id; ?>"> 87 <li><img src="<?php echo '' .plugins_url( '/images/ajax-loader.gif' , __FILE__ ). ''; ?>" width="16" height="16" alt="" /> <?php _e( 'Loading tweets...', 'twiget' ); ?></li> 88 </ul> 89 <p id="twigetfollow"> 90 <a href="https://twitter.com/<?php echo $twiget_username; ?>" class="twitter-follow-button" <?php echo $twiget_follower_count_attr; ?> data-width="100%" data-align="right"><?php printf( __( 'Follow %s', 'twiget' ), '@' . $twiget_username ); ?></a> 91 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> 92 </p> 93 94 <script src="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=<?php echo $twiget_username; ?>&count=<?php echo $twiget_tweetcount; ?>&page=1&include_rts=true&<?php echo $hide_replies_attr; ?>&include_entities=true&callback=twigetGetTweet" type="text/javascript"></script> 95 <script type="text/javascript"> 96 twigetTwitter( '<?php echo $wrapper_id; ?>', 97 { 98 <?php if ( $twiget_new_window ) echo 'newwindow: true,' ?> 99 id: '<?php echo $twiget_username; ?>', 100 count: <?php echo $twiget_tweetcount; ?> 101 }); 102 </script> 103 73 <div id="twiget-feed"></div> 74 <p id="twigetfollow"> 75 <a href="https://twitter.com/<?php echo $twiget_username; ?>" class="twitter-follow-button" <?php echo $twiget_follower_count_attr; ?> data-width="100%" data-align="right"><?php printf( __( 'Follow %s', 'twiget' ), '@' . $twiget_username ); ?></a> 76 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> 77 </p> 104 78 <?php do_action( 'twiget_twitter_widget' ); ?> 105 79 <?php echo $args['after_widget']; ?> … … 112 86 113 87 // Strip tags (if needed) and update the widget settings 114 $instance['twiget_username'] = strip_tags( $new_instance['twiget_username']);115 $instance['twiget_tweetcount'] = strip_tags( $new_instance['twiget_tweetcount']);116 88 $instance['twiget_title'] = strip_tags( $new_instance['twiget_title'] ); 117 $instance['twiget_followercount'] = ( isset( $new_instance['twiget_followercount'] ) ) ? true : false ;118 $instance['twiget_hide_replies'] = ( isset( $new_instance['twiget_hide_replies'] ) ) ? true : false ;119 $instance['twiget_new_window'] = ( isset( $new_instance['twiget_new_window'] ) ) ? true : false ;120 89 121 90 return $instance; … … 125 94 126 95 // Set up default widget settings 127 $defaults = array( 'twiget_username' => '', 128 'twiget_tweetcount' => 5, 129 'twiget_title' => __( 'Latest tweets', 'twiget' ), 130 'twiget_followercount' => false, 131 'twiget_hide_replies' => false, 132 'twiget_new_window' => false, 133 ); 96 $defaults = array( 'twiget_title' => __( 'Latest tweets', 'twiget' ) ); 134 97 $instance = wp_parse_args( (array) $instance, $defaults ); 135 98 ?> 136 99 <p> 137 <label for="<?php echo $this->get_field_id( 'twiget_title' ); ?>"><?php _e( ' Title:', 'twiget' ); ?></label>100 <label for="<?php echo $this->get_field_id( 'twiget_title' ); ?>"><?php _e( 'Widget Title:', 'twiget' ); ?></label> 138 101 <input id="<?php echo $this->get_field_id( 'twiget_title' ); ?>" type="text" name="<?php echo $this->get_field_name( 'twiget_title' ); ?>" value="<?php echo $instance['twiget_title']; ?>" class="widefat" /> 139 </p>140 <p>141 <label for="<?php echo $this->get_field_id( 'twiget_username' ); ?>"><?php _e( 'Twitter Username:', 'twiget' ); ?></label>142 <input id="<?php echo $this->get_field_id( 'twiget_username' ); ?>" type="text" name="<?php echo $this->get_field_name( 'twiget_username' ); ?>" value="<?php echo $instance['twiget_username']; ?>" class="widefat" />143 </p>144 <p>145 <label for="<?php echo $this->get_field_id( 'twiget_tweetcount' ); ?>"><?php _e( 'Number of tweets to display:', 'twiget' ); ?></label>146 <input id="<?php echo $this->get_field_id( 'twiget_tweetcount' ); ?>" type="text" name="<?php echo $this->get_field_name( 'twiget_tweetcount' ); ?>" value="<?php echo $instance['twiget_tweetcount']; ?>" size="1" />147 </p>148 <p>149 <label for="<?php echo $this->get_field_id( 'twiget_followercount' ); ?>"><?php _e( 'Show followers count', 'twiget' ); ?></label>150 <input id="<?php echo $this->get_field_id( 'twiget_followercount' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'twiget_followercount' ); ?>" value="true" <?php checked( $instance['twiget_followercount'] ); ?> />151 </p>152 <p>153 <label for="<?php echo $this->get_field_id( 'twiget_hide_replies' ); ?>"><?php _e( 'Hide @replies', 'twiget' ); ?></label>154 <input id="<?php echo $this->get_field_id( 'twiget_hide_replies' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'twiget_hide_replies' ); ?>" value="true" <?php checked( $instance['twiget_hide_replies'] ); ?> /><br />155 <span class="description"><?php $showtweetcount = $instance['twiget_tweetcount']; printf( __('Note: Selecting this sometimes result in showing less than %s tweets', 'twiget' ), $showtweetcount ); ?></span>156 </p>157 <p>158 <label for="<?php echo $this->get_field_id( 'twiget_new_window' ); ?>"><?php _e( 'Open links in new window', 'twiget' ); ?></label>159 <input id="<?php echo $this->get_field_id( 'twiget_new_window' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'twiget_new_window' ); ?>" value="true" <?php checked( $instance['twiget_new_window'] ); ?> />160 102 </p> 161 103 <?php 162 104 } 163 105 } 164 165 106 166 107 /** … … 173 114 add_action( 'widgets_init', 'twiget_load_widgets' ); 174 115 175 // Display a Support forum link on the main Plugins page 176 function twiget_plugin_action_links( $links, $file ) { 116 /* 117 ** Thanks David Gwyer for Plugin Options Starter Kit plugin! 118 */ 177 119 178 if ( $file == plugin_basename( __FILE__ ) ) { 179 $twiget_link = '<a href="http://forum.prasannasp.net/forum/plugin-support/twiget/" title="'.esc_attr__('TwiGet Twitter Widget support', 'twiget').'" target="_blank">'.__('Support', 'twiget').'</a>'; 120 // Delete options table entries ONLY when plugin deactivated AND deleted 121 function twiget_delete_plugin_options() { 122 delete_option('twiget_options'); 123 } 124 register_uninstall_hook(__FILE__, 'twiget_delete_plugin_options'); 180 125 181 array_unshift( $links, $twiget_link ); 126 // Define default option settings 127 function twiget_add_defaults() { 128 $tmp = get_option('twiget_options'); 129 if(($tmp['twiget_default_options_db']=='1')||(!is_array($tmp))) { 130 delete_option('twiget_options'); 131 $arr = array( "link_target" => "1", 132 "show_client" => "1", 133 "twiget_default_options_db" => "" 134 ); 135 update_option('twiget_options', $arr); 182 136 } 137 } 138 register_activation_hook(__FILE__, 'twiget_add_defaults'); 183 139 184 return $links; 140 // Init plugin options to white list our options 141 function twiget_init() { 142 register_setting( 'twiget_plugin_options', 'twiget_options', 'twiget_validate_options' ); 185 143 } 186 add_filter('plugin_action_links', 'twiget_plugin_action_links', 10, 2 ); 144 add_action('admin_init', 'twiget_init' ); 145 146 // Add menu page 147 function twiget_add_options_page() { 148 add_options_page('Twiget Twitter Plugin Settings', 'Twiget Settings', 'manage_options', __FILE__, 'twiget_render_form'); 149 } 150 add_action('admin_menu', 'twiget_add_options_page'); 151 152 // Sanitize and validate input. Accepts an array, return a sanitized array. 153 function twiget_validate_options($input) { 154 // strip html from textboxes 155 $input['user_name'] = wp_filter_nohtml_kses($input['user_name']); // Sanitize textbox input (strip html tags, and escape characters) 156 $input['tweet_count'] = wp_filter_nohtml_kses($input['tweet_count']); 157 $input['consumer_key'] = wp_filter_nohtml_kses($input['consumer_key']); 158 $input['consumer_secret'] = wp_filter_nohtml_kses($input['consumer_secret']); 159 $input['access_token'] = wp_filter_nohtml_kses($input['access_token']); 160 $input['access_token_secret'] = wp_filter_nohtml_kses($input['access_token_secret']); 161 return $input; 162 } 187 163 188 164 // Donate link on manage plugin page 189 165 function twiget_pluginspage_links( $links, $file ) { 190 166 191 $plugin = plugin_basename (__FILE__);167 $plugin = plugin_basename (__FILE__); 192 168 193 169 // create links … … 205 181 } 206 182 add_filter( 'plugin_row_meta', 'twiget_pluginspage_links', 10, 2 ); 207 ?> 183 184 // Display a Support forum link on the main Plugins page 185 function twiget_plugin_action_links( $links, $file ) { 186 187 if ( $file == plugin_basename( __FILE__ ) ) { 188 $twiget_link1 = '<a href="http://forum.prasannasp.net/forum/plugin-support/twiget/" title="'.esc_attr__('TwiGet Twitter Widget support', 'twiget').'" target="_blank">'.__('Support', 'twiget').'</a>'; 189 $twiget_link2 = '<a href="'.get_admin_url().'options-general.php?page=twiget/twiget.php">'.__('Settings', 'twiget').'</a>'; 190 191 array_unshift( $links, $twiget_link1, $twiget_link2 ); 192 } 193 194 return $links; 195 } 196 add_filter('plugin_action_links', 'twiget_plugin_action_links', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.