Changeset 415823
- Timestamp:
- 07/27/2011 07:54:42 AM (15 years ago)
- Location:
- social-counters/trunk
- Files:
-
- 3 added
- 4 edited
-
counters/bitacoras.php (added)
-
counters/facebook.php (modified) (2 diffs)
-
counters/twitter.php (modified) (3 diffs)
-
images/en/bitacoras.gif (added)
-
images/es/bitacoras.gif (added)
-
readme.txt (modified) (2 diffs)
-
social-counters.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
social-counters/trunk/counters/facebook.php
r391639 r415823 46 46 $post_url = urlencode($post_url); 47 47 48 $url_request = 'http://api.facebook.com/restserver.php?format=json&method=links.getStats&urls={url}'; 48 //$url_request = 'http://api.facebook.com/restserver.php?format=json&method=links.getStats&urls={url}'; 49 $url_request = 'http://graph.facebook.com/?id={url}'; 49 50 $url_request = str_replace('{url}', $post_url, $url_request); 50 51 … … 53 54 if ( !empty($data) ) { 54 55 $data = json_decode($data); 55 if ( sizeof($data) == 1 ) { 56 $shared_counter = $data[0]->total_count; 57 } 56 if ( isset($data->shares) ) 57 $shared_counter = $data->shares; 58 58 } 59 59 } -
social-counters/trunk/counters/twitter.php
r391639 r415823 36 36 $share_counter_meta = get_post_meta($_post->ID, '_shared_counter_twitter_v2', true); 37 37 38 if ( !is_single() && $share_counter_meta !== false ) {38 if ( !is_single() && !empty($share_counter_meta) && $share_counter_meta !== false ) { 39 39 40 40 $shared_counter = $share_counter_meta; … … 46 46 47 47 // Search in TWEETMEME 48 $url_request_params = '?url={url}'; 49 $url_request_params = str_replace('{url}', $post_url, $url_request_params); 50 51 $url_request = 'http://api.tweetmeme.com/url_info.php'; 52 $url_request .= $url_request_params; 53 $data = wp_remote_retrieve_body(wp_remote_get($url_request)); 54 55 $url_request_params = ''; 56 if ( !empty($data) ) { 57 $data = unserialize($data); 58 59 if ( isset($data['status']) && $data['status'] == 'failure' ) { 60 $shared_counter = '<em title="'. $data['comment'] .'">0</em>'; 61 }else{ 62 $shared_counter = $data['story']['url_count']; 63 } 64 } 48 // $shared_counter = social_counters__twitter__tweetmeme($post_url, $shared_counter); 49 // Search in TWITTER 50 $shared_counter = social_counters__twitter__twitter($post_url, $shared_counter); 65 51 66 52 if ( $share_counter_meta ) { … … 128 114 } 129 115 add_action('social_counter__wp_head', 'social_counter__wp_head__twitter'); 116 117 118 119 120 // Twitter Counter Systems!! 121 122 function social_counters__twitter__tweetmeme( $post_url = '', $shared_counter = 0 ) { 123 124 if ( !empty($post_url) ) { 125 126 $url_request_params = '?url={url}'; 127 $url_request_params = str_replace('{url}', $post_url, $url_request_params); 128 129 $url_request = 'http://api.tweetmeme.com/url_info.php'; 130 $url_request .= $url_request_params; 131 132 $data = wp_remote_retrieve_body(wp_remote_get($url_request)); 133 134 $url_request_params = ''; 135 if ( !empty($data) ) { 136 $data = unserialize($data); 137 138 if ( isset($data['status']) && $data['status'] == 'failure' ) { 139 $shared_counter = '<em title="'. $data['comment'] .'">0</em>'; 140 }else{ 141 $shared_counter = $data['story']['url_count']; 142 } 143 } 144 145 } 146 147 return $shared_counter; 148 } 149 150 function social_counters__twitter__twitter( $post_url = '', $shared_counter = 0 ) { 151 152 if ( !empty($post_url) ) { 153 154 $url_request_params = '?url={url}'; 155 $url_request_params = str_replace('{url}', $post_url, $url_request_params); 156 157 $url_request = 'http://urls.api.twitter.com/1/urls/count.json'; 158 $url_request .= $url_request_params; 159 160 $data = wp_remote_retrieve_body(wp_remote_get($url_request)); 161 162 $url_request_params = ''; 163 if ( !empty($data) ) { 164 $data = unserialize($data); 165 166 if ( isset($data['count']) ) 167 $shared_counter = $data['count']; 168 } 169 170 } 171 172 return $shared_counter; 173 } -
social-counters/trunk/readme.txt
r391639 r415823 4 4 Requires at least: 2.9 5 5 Tested up to: 3.1.2 6 Stable tag: 2.1. 06 Stable tag: 2.1.1 7 7 8 8 It allows to place social sharing links with counters (if available) to the most popular social networks: Menéame,Twitter,Facebook,... … … 52 52 == Changelog == 53 53 54 = 2.1.1 = 55 * Changed counter system on Twitter, now used Twitter itself, not Tweetmeme 56 * Fixed Facebook counter, now uses the Graph API. 57 54 58 = 2.1.0 = 55 59 * Added param to send post object to functions "the_" (postparam). -
social-counters/trunk/social-counters.php
r391639 r415823 4 4 Plugin URI: http://blogestudio.com/plugin/social-counters/ 5 5 Description: Get Counters from Social Webs 6 Version: 2.1. 06 Version: 2.1.1 7 7 Author: Alejandro Carravedo (Blogestudio) 8 8 Author URI: http://blogestudio.com 9 9 10 10 11 1.1.0 - Solucionado error con la cache de contador … … 21 22 2.1.0 - Anadido parametro para enviar el objecto POST a las funciones "the_" (postparam). 22 23 - Cambiado sistema de "share" en Twitter 24 25 2.1.1 - Cambiado sistema de contador en Twitter, ahora se usa el propio Twitter, no TweetMeMe 26 - Reparado contador de Facebook, ahora funciona con el Graph API, han quitado de sopetón los datos del REST API. 27 23 28 24 29 *** Configuraciones *** … … 62 67 require_once('counters/twitter.php'); 63 68 require_once('counters/facebook.php'); 69 //require_once('counters/bitacoras.php'); 64 70 65 71
Note: See TracChangeset
for help on using the changeset viewer.