Changeset 769469
- Timestamp:
- 09/10/2013 12:02:38 AM (13 years ago)
- Location:
- ix-show-latest-youtube/trunk
- Files:
-
- 4 edited
-
loader.php (modified) (1 diff)
-
plugin/Ix_ShowLatestYt.php (modified) (7 diffs)
-
plugin/admin/options-page.phtml (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ix-show-latest-youtube/trunk/loader.php
r768073 r769469 4 4 Description: Provides a shortcode and a template tag to embed the lates video or current live stream of a specified YouTube channel. 5 5 Author: Ixiter IT - Peter Liebetrau <peter.liebetrau@ixiter.com> 6 Version: 2. 1.16 Version: 2.2 7 7 Plugin-Uri: http://ixiter.it/ix-show-latest-youtube 8 8 Author-Uri: https://plus.google.com/u/0/102408750978338972864/about -
ix-show-latest-youtube/trunk/plugin/Ix_ShowLatestYt.php
r768074 r769469 6 6 * @package Ixiter WordPress Plugins 7 7 * @subpackage IX Show Latest YouTube 8 * @version 2. 1.18 * @version 2.2 9 9 * @author Peter Liebetrau <ixiter@ixiter.com> 10 10 * @license GPL 3 or greater … … 23 23 'autoplay' => '0', // no autoplay by default 24 24 'count_of_videos' => '1', // Embed one latest video by default 25 'no_live_message' => '' // displayed when no live broadcasting available, when set. 25 26 ); 26 27 private $options = array(); … … 93 94 } 94 95 95 public function get_options() {96 public function get_options() { 96 97 return $this->options; 97 98 } … … 107 108 public function show_latest($atts) { 108 109 extract(shortcode_atts(array( 109 'ytid' => $this->options['ytid'], 110 'width' => $this->options['width'], 111 'height' => $this->options['height'], 112 'autoplay' => $this->options['autoplay'], 113 'count_of_videos' => $this->options['count_of_videos'], 114 ), $atts) 110 'ytid' => $this->options['ytid'], 111 'width' => $this->options['width'], 112 'height' => $this->options['height'], 113 'autoplay' => $this->options['autoplay'], 114 'count_of_videos' => $this->options['count_of_videos'], 115 'no_live_message' => $this->options['no_live_message'], 116 ), $atts) 115 117 ); 116 118 $html = ''; … … 139 141 } 140 142 } else { 141 $feedUrl = 'http://gdata.youtube.com/feeds/users/' . $ytid . '/uploads?alt=json&max-results=' . $count_of_videos; 142 $feed = json_decode(file_get_contents($feedUrl)); 143 //ix_dump($feed); 144 if (isset($feed->feed->entry)) { 145 $loop = 0; 146 foreach ($feed->feed->entry as $key => $value) { 147 $autoplay = $loop > 0 ? false : $autoplay; 148 $loop++; 143 if ($this->options['no_live_message'] == '') { 144 $feedUrl = 'http://gdata.youtube.com/feeds/users/' . $ytid . '/uploads?alt=json&max-results=' . $count_of_videos; 145 $feed = json_decode(file_get_contents($feedUrl)); 146 //ix_dump($feed); 147 if (isset($feed->feed->entry)) { 148 $loop = 0; 149 foreach ($feed->feed->entry as $key => $value) { 150 $autoplay = $loop > 0 ? false : $autoplay; 151 $loop++; 149 152 $videoFeedUrl = $value->id->$t; 150 153 $uriParts = explode('/', $videoFeedUrl); 151 154 $videoId = $uriParts[count($uriParts) - 1]; 152 155 $html .= $this->embedIframe($videoId, $width, $height, false); 156 } 157 } else { 158 $html .= sprintf(__('No more videos found for channel %s'), $this->options['ytid']); 153 159 } 154 160 } else { 155 $html .= sprintf(__('No more videos found for channel %s'), $this->options['ytid']); 156 } 157 } 158 $feed = @file_get_contents($feedUrl); 161 $html .= ' 162 <div style="width:'.$width.'px; height:'.$height.'px; background-color:black;"> 163 <span style="display:block; width:80%; margin:0 auto; padding-top:50px; color:#f0f0f0; text-align:center;">'.$no_live_message.'</span> 164 </div> 165 '; 166 } 167 } 159 168 160 169 return $html; … … 193 202 // BEGIN: Template Tags 194 203 195 function ix_show_latest_yt($ytid = '', $width = '', $height = '', $autoplay = '', $count_of_videos = '' ) {204 function ix_show_latest_yt($ytid = '', $width = '', $height = '', $autoplay = '', $count_of_videos = '', $no_live_message = '') { 196 205 $options = Ix_ShowLatestYt::get_instance()->get_options(); 197 206 $ytid = empty($ytid) ? $options['ytid'] : $ytid; … … 201 210 $count_of_videos = empty($count_of_videos) ? $options['count_of_videos'] : $count_of_videos; 202 211 203 echo Ix_ShowLatestYt::get_instance()->show_latest(compact('ytid', 'width', 'height', 'autoplay', 'count_of_videos' ));212 echo Ix_ShowLatestYt::get_instance()->show_latest(compact('ytid', 'width', 'height', 'autoplay', 'count_of_videos', 'no_live_message')); 204 213 } 205 214 -
ix-show-latest-youtube/trunk/plugin/admin/options-page.phtml
r696650 r769469 32 32 <p class="ix_form_element_description"><?php _e('If checked, video starts automatically.', $textdomain) ?></p> 33 33 </dd> 34 34 35 35 <dt class="ix_form_element_label"><label for="count_of_videos"><?php _e('Count of latest videos') ?></label></dt> 36 36 <dd class="ix_form_element"> 37 37 <input type="text" name="count_of_videos" value="<?php echo $count_of_videos; ?>" /> 38 38 <p class="ix_form_element_description"><?php _e('Number of latest videos you want to embed. If autoplay ist set, only the first video will autoplay.', $textdomain) ?></p> 39 </dd> 40 41 <dt class="ix_form_element_label"><label for="no_live_message"><?php _e('Show message if not broadcasting', $textdomain) ?></label></dt> 42 <dd class="ix_form_element"> 43 <input type="text" name="no_live_message" value="<?php echo $no_live_message; ?>" /> 44 <p class="ix_form_element_description"><?php _e('If a message is set, it will be displayed in case there is no live video, instead of showing the latest video.', $textdomain) ?></p> 39 45 </dd> 40 46 … … 48 54 <p><?php _e('If you want to use other values, you can set them with the shortcode or template tag.', $textdomain); ?></p> 49 55 <h4>Shortcode</h4> 50 <code>[ix_show_latest_yt ytid="youtubeid" width="###" height="###" autoplay="on/off" count_of_videos="#" ]</code>56 <code>[ix_show_latest_yt ytid="youtubeid" width="###" height="###" autoplay="on/off" count_of_videos="#" no_live_message="some text"]</code> 51 57 <p class="ix_description"><?php _e('The shortcode is available in posts, pages and text widgets. The count and order of parameters dont matter. Empty values will be overwritten by the default options.', $textdomain); ?></p> 52 58 <h4>Template Tag</h4> 53 <code><?php ix_show_latest_yt($ytid, $width, $height, $autoplay, $count_of_videos ); ?></code>59 <code><?php ix_show_latest_yt($ytid, $width, $height, $autoplay, $count_of_videos, $no_live_message); ?></code> 54 60 <p class="ix_description"><?php _e('The template tag is available in your theme template files and plugins. The count of parameters depends on their positions. The order matters! Empty values will be overwritten by the default options.', $textdomain); ?></p> 55 61 -
ix-show-latest-youtube/trunk/readme.txt
r768073 r769469 5 5 Requires at least: 3.4 6 6 Tested up to: 3.5.1 7 Stable tag: 2. 1.17 Stable tag: 2.2 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 34 34 35 35 == Changelog == 36 37 = 2.2 = 38 * September, 10th 2013 39 * No live message feature added 36 40 37 41 = 2.1.1 =
Note: See TracChangeset
for help on using the changeset viewer.