Changeset 544204
- Timestamp:
- 05/14/2012 05:27:39 PM (14 years ago)
- Location:
- video-onclick
- Files:
-
- 10 added
- 2 edited
-
tags/0.4.1 (added)
-
tags/0.4.1/play_vimeo.jpg (added)
-
tags/0.4.1/play_youtube.jpg (added)
-
tags/0.4.1/readme.txt (added)
-
tags/0.4.1/video-onclick.js (added)
-
tags/0.4.1/video-onclick.php (added)
-
tags/0.4.1/vimeo-button.js (added)
-
tags/0.4.1/vimeo.png (added)
-
tags/0.4.1/youtube-button.js (added)
-
tags/0.4.1/youtube.png (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/video-onclick.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
video-onclick/trunk/readme.txt
r544004 r544204 3 3 Contributors: TIgor4eg 4 4 5 Donate link: http://tigor .me/donate/5 Donate link: http://tigors.net/en/en-donate/ 6 6 7 7 Tags: youtube, video, shortcode, mce, vimeo, google analytics … … 11 11 Tested up to: 3.2.1 12 12 13 Stable tag: 0.4 13 Stable tag: 0.4.1 14 14 15 15 … … 40 40 41 41 == Changelog == 42 = 0.4.1 = 43 * FIX: Error, if the video was not found 42 44 43 45 = 0.4 = -
video-onclick/trunk/video-onclick.php
r544008 r544204 131 131 { 132 132 // Cache is old or does not exist 133 134 135 $url = 'http://gdata.youtube.com/feeds/api/videos/'. $videoid; 136 137 $sxml = simplexml_load_file($url); 138 139 $media = $sxml->children('http://search.yahoo.com/mrss/'); 140 141 142 143 $group = $media->group; 144 145 146 foreach( $group->thumbnail as $thumb) { 147 148 if ($temp['width'] < $thumb->attributes()->width) { 133 $ch = curl_init(); 134 $url = 'http://gdata.youtube.com/feeds/api/videos/'. $videoid; 135 136 curl_setopt($ch, CURLOPT_URL, $url); 137 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 138 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); 139 140 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 141 142 $respond = curl_exec($ch); 143 144 if (200 == (int)curl_getinfo($ch, CURLINFO_HTTP_CODE)) 145 { 146 147 148 $sxml = new SimpleXMLElement($respond); 149 150 $media = $sxml->children('http://search.yahoo.com/mrss/'); 151 152 153 154 $group = $media->group; 155 156 157 foreach( $group->thumbnail as $thumb) { 158 159 if ($temp['width'] < $thumb->attributes()->width) { 149 160 $temp['url'] = (string)$thumb->attributes()->url; 150 161 $temp['width'] = $thumb->attributes()->width; 162 } 163 151 164 } 152 153 } 154 if ('' == $temp['url']) 155 { 156 165 if ('' == $temp['url']) 166 { 167 168 $return = plugins_url().'/video-onclick/play_youtube.jpg'; 169 } else { 170 171 $cache[$videoid]['time'] = time(); 172 $cache[$videoid]['url'] = $temp['url']; 173 174 175 update_option('video_onclick_cache', $cache); 176 177 $return = $temp['url']; 178 } 179 } else { 157 180 $return = plugins_url().'/video-onclick/play_youtube.jpg'; 158 } else {159 160 $cache[$videoid]['time'] = time();161 $cache[$videoid]['url'] = $temp['url'];162 163 164 update_option('video_onclick_cache', $cache);165 166 $return = $temp['url'];167 181 } 168 182
Note: See TracChangeset
for help on using the changeset viewer.