WordPress.org

Forums

liveTV Bundle
[resolved] Problem in the Page-livestreams.php (11 posts)

  1. Gabriel Cunha
    Member
    Posted 2 years ago #

    Well,

    I'm gonna show the problem with pics, because I don't know what to write for this.
    http://prntscr.com/fe3mh
    http://prntscr.com/fe3oq

    The website URL it's that.
    http://www.vti-gaming.com.br/stream

    PS: When I use the new version of that plugin, the widget bar in the right, go to down the page. If possible to show what's the line to repair on the Code it's better than make a desnecessary update.
    I think the problem stay on page-fronted/page-livestream.php

    http://wordpress.org/extend/plugins/livetv-bundle/

  2. KwarK
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    Sorry for the delay my mail client has some problem.

    You may try to change the "echo $page" by a "return $page" in this file and @ ~line 1031.

    Regularly the plugin works great with echo and in some case with some theme and some plugin activate the plugin work great only with return.

    I don't known why but normally this changes works. Currently, after an update, you may change this manually.

  3. Gabriel Cunha
    Member
    Posted 2 years ago #

    Ok, thx Kwark.

    I will try to do this change and I report here!!

    =D

  4. Gabriel Cunha
    Member
    Posted 2 years ago #

    Well, after that the problem is resolved, but I need to deactivatede my sidebar because his going break my page, have another code to fix this, something about width of the plugin box in the same page?

  5. KwarK
    Member
    Plugin Author

    Posted 2 years ago #

    make some search on variable $widthView and looks @ its #comment for the zone "view" (the zone where user show a live stream).

    And for the thumbnails zone under the "show", its in the css.

    For your sidebar, hit F12 on your site to show the elements because I'm not a seer.

  6. Gabriel Cunha
    Member
    Posted 2 years ago #

    Well I activate the sidebar for you look the problem because I don't understand what you say to do.

    If you discover the local code problem say to me for fix
    Edit:
    Well I discover another problem same that the first but the same error occurs when I click in the thumb for watch the stream, showing a lot of same streams in the page.

  7. Gabriel Cunha
    Member
    Posted 2 years ago #

    Well... Now I updated the plugin but the continues... I tried to put "return $page;" in the same local but erro has finished but the side bar changed the local... I try to fixbut I don't have success =(

  8. KwarK
    Member
    Plugin Author

    Posted 2 years ago #

    <?php
    /*
    	Copyright 2012  Laurent (KwarK) Bertrand  (email : kwark@allwebtuts.net)
    
    	Please consider a small donation for my work. Behind each code, there is a geek who has to eat.
    	Thank you for my futur bundle...pizza-cola. Bundle vs bundle, it's a good deal, no ?
    	Small pizza donation @ http://kwark.allwebtuts.net
    
    	You can not remove this comments such as my informations.
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    // disallow direct access to file
    if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
    	wp_die(__('Sorry, but you cannot access this page directly.', 'livetv'));
    }
    
    // Make shortcode to display livestreams list
    add_shortcode( 'LivesOnline', 'livetv_add_livestreams_shorcode' );
    
    function livetv_add_livestreams_shorcode()
    {
    	global $livetv_plugin_url;
    
    	//General admin options First
    	$visibility = get_option('livetv_visibility');
    	$message = get_option('livetv_message');
    	$general_width = get_option('livetv_width');
    	$general_height = get_option('livetv_height');
    	$registration = get_option('livetv_registration');
    	$titleh3 = get_option('livetv_h3');
    	$general_color = get_option('livetv_color');
    	$livetv_view_offline = get_option('livetv_view_offline');
    
    	//Cheat for permalink
    	$livetv_current_url = get_permalink();
    	$current_url = preg_match('#\?#', $livetv_current_url);
    	if($current_url)
    	{
    		$livetv_current_url .= '&';
    	}
    	else
    	{
    		$livetv_current_url .= '?';
    	}
    
    	//Cheat for css widget_off and the html caching
    	if($livetv_view_offline == 'widget_off')
    	{
    		$live_offline_class = 'hide-on-page';
    	}
    
    	//OK lets go
    	if(isset($_REQUEST['liveview']) && $_REQUEST['liveview'] != "offline" && isset($_REQUEST['mode']) && $_REQUEST['mode'] != "" && isset($_REQUEST['type']) && $_REQUEST['type'] != "")
    	{
    		if ($visibility == "members only" && is_user_logged_in() || $visibility == "public")
    		{
    			global $wpdb, $livetv_plugin_irc_activate;
    
    			//General script livestream - single view
    			wp_enqueue_script('livetv-beautiful-effect');
    			wp_enqueue_script('livetv-effect-draggable');
    
    			$viewmode = esc_attr($_REQUEST['mode']);
    			$channelKey = esc_attr($_REQUEST['liveview']);
    			$channelType = esc_attr($_REQUEST['type']);
    
    			if($channelType == 'justin' && $general_color == 'light')
    			{
    				$switchimage = '-black';
    			} //Cheat for image twitch. Bad result for white on white
    
    			$result = $wpdb->get_results($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value=%s", $channelKey));
    
    			$livetv_direct = explode('_', $result[0]->meta_key);
    
    			$userName = get_user_by('id', $livetv_direct[1]);
    			$userName = $userName->display_name;
    			$channelName = $channelKey;
    
    			//IRC datas
    			$livetv_irc_format = get_option('livetv_irc');
    
    			$sitename = preg_replace(array('# #','#%20#', '#-#'), array('','',''), strtolower(get_bloginfo('name')));
    			$username = preg_replace(array('# #','#%20#', '#-#'), array('','',''), $userName);
    
    			switch ($livetv_irc_format):
    
    					case 'sitename':
    						$livetv_irc = ''.$sitename.'';
    					break;
    
    					case 'sitename_channelName':
    						$livetv_irc = ''.$sitename.'.'.$channelName.'';
    					break;
    
    					case 'sitename_userName':
    						$livetv_irc = ''.$sitename.'.'.$username.'';
    					break;
    
    					case 'channelName':
    						$livetv_irc = ''.$channelName.'';
    					break;	
    
    					case 'userName':
    						$livetv_irc = ''.$username.'';
    					break;
    
    					case 'sitename_userName_channelName':
    						$livetv_irc = ''.$sitename.'.'.$username.'.'.$channelName.'';
    					break;
    
    					case 'sitename_channelName_userName':
    						$livetv_irc = ''.$sitename.'.'.$channelName.'.'.$username.'';
    					break;
    
    					default:
    						$livetv_irc = ''.$channelName.'';
    					break;
    
    			endswitch;
    			//End IRC datas
    
    			//Start view mode
    			if($viewmode == 'normal' || $viewmode == 'full')
    			{
    				if($viewmode == 'full')
    				{
    					wp_enqueue_style('livetv-hook');
    
    					$modeView = 'Large';
    					$classView = 'full';
    					$widthView = '100%';
    					$heightView = '590'; //Fetch to the reason
    					$widthIRC = '100%';
    					$heightIRC = '301';
    
    					//Start ENGLOBE container to fix css for f*in themes. </div> @ line ~1075
    					$content_top .= '<div style="width:100%; height:auto; margin:0 auto; padding:0;">';
    
    				}
    
    				if($viewmode == 'normal')
    				{
    					$modeView = 'Medium';
    					$classView = 'full'; //Full because is the same with css with 100% value to fit to the container, but for futur...
    					$widthView = $general_width;
    					$heightView = $general_height;
    					$heightIRC = '301';
    					$widthIRC = $widthView - 6; //Due to border
    
    					//Start ENGLOBE container to fix css for f*in themes. </div> @ line ~1075
    					$content_top .= '<div style="width:'.$general_width.'px; height:auto; margin:0 auto; padding:0;">';
    				}
    
    				//Main container video
    				$content_top .= '<div id="'.$classView.'-view-content" class="'.$classView.'-view-content">';
    
    					//H2
    					if($titleh3 == 'txt')
    					{
    						$content_top .= '<h2 class="livetv">'.$modeView.' view '.$channelType.' - Channel '.$channelName.' by '.$userName.'</h2>';
    					}
    					if($titleh3 == 'img')
    					{
    						$content_top .= '<h2 class="livetv-h2"><img class="bubble" src="'.$livetv_plugin_url.'images/thumblist-title-'.$channelType.''.$switchimage.'.png" title="'.$channelType.' channel '.$modeView.' mode. Channel '.$channelName.' by '.$userName.'" /></h2>';
    					}
    
    					//Do current video
    					$content_top .= do_shortcode('[livestream type="'.$channelType.'" channel="'.$channelName.'" width="'.$widthView.'" height="'.$heightView.'"]');
    					//End do current video
    
    				//End Main container video
    				$content_top .= '</div>';
    
    				if($livetv_plugin_irc_activate)
    				{
    					//Container	share + IRC
    					$content_top .= '<div id="'.$classView.'-view-switcher" class="'.$classView.'-view-switcher">';
    
    						//First slide (IRC)
    						$content_top .= '<div id="'.$classView.'-view-irc">';
    
    							$content_top .= '<h4 class="livetv-nxt">';
    
    							if($titleh3 == 'img')
    							{
    								$infoimg = __('Switch to share zone ?', 'livetv');
    								$livetv_title = '<img class="bubble" src="'.$livetv_plugin_url.'images/qnet.png" title="'.$infoimg.'" />';
    							}
    							if($titleh3 == 'txt')
    							{
    								$livetv_title = 'IRC '.$userName.'';
    							}
    							$content_top .= ''.$livetv_title.'';
    							$content_top .= '</h4>';
    
    							//do current IRC chan
    							$chat_type = get_option('livetv_irc_' . $channelType);
    
    							if($chat_type == 'quakenet')
    							{
    								$content_top .= do_shortcode('[liveTVChat type="quakenet" channel="'.$livetv_irc.'" width="'.$widthIRC.'" height="'.$heightIRC.'"]');
    							}
    							else
    							{
    								//Cheating to debug own3d chat
    								if($chat_type == 'own3d')
    								{
    									//Cheating for own3d, that's works
    									$channelName =  'admin_' . $channelName;
    								}
    
    								$content_top .= do_shortcode('[liveTVChat type="'.$chat_type.'" channel="'.$channelName.'" width="'.$widthIRC.'" height="'.$heightIRC.'"]');
    							}
    						//End First slide (IRC)
    						$content_top .= '</div>';
    
    						//Second slide (share)
    						$content_top .= '<div id="'.$classView.'-view-irc">';
    
    							$content_top .= '<ul id="container-sub-live">';
    
    								$content_top .= '<h4 class="livetv-nxt">'; //h4 because h3 is the do_shortcode
    
    									if($titleh3 == 'img')
    									{
    										$infoimg = __('Return to chat IRC ?', 'livetv');
    										$temp = '<img class="bubble" src="'.$livetv_plugin_url.'images/info.png" title="'.$infoimg.'" />';
    									}
    
    									if($titleh3 == 'txt')
    									{
    										$temp = __('Share live', 'livetv');
    									}
    
    									$content_top .= ''.$temp.'';
    
    								$content_top .= '</h4>';
    
    								$content_top .= '<li id="livetv-recent-posts" class="livetv-widget-container" style="text-align:center;">';
    
    									$content_top .= '<h5 class="widget-title">Share '.$userName.'</h5>';
    
    										$content_top .= '
    <ul>';
    
    											//Facebook
    											$content_top .= '<div class="facebook-share-button"><iframe
    								src="http://www.facebook.com/plugins/like.php?href='.get_permalink($post->ID).'&layout=button_count&show_faces=false&width=85&action=like&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:85px; height:21px;" allowTransparency="true"></iframe></div>';
    
    											//Twitter
    											$content_top .= '<a href="http://twitter.com/share">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>';
    
    											if($viewmode == 'normal')
    											{
    												$content_top .= '<div class="clear"></div>';
    											}
    
    											//Google+
    											$content_top .= '<div class="gplusone"><script src="http://apis.google.com/js/plusone.js" type="text/javascript"></script><g:plusone size="medium"></g:plusone></div>';
    
    											//Messenger
    											$content_top .= '<a href="#">ID).'/\', \'Windows Live\', \'width=550, height=450, top=230, right=450, left=450\'); return false;" title="Messenger live share">Messenger</a>';
    
    											//General social pages
    											$general_join_facebook = get_option('livetv_facebook');
    											$general_join_twitter = get_option('livetv_twitter');
    
    											$content_top .= '<div class="clear"> </div>';
    
    											if($general_join_facebook)
    											{
    												$txtfacebook = __('Join us on Facebook', 'livetv');
    												$content_top .= '<h4 class="share-social"><a href="'.esc_url($general_join_facebook, array('http', 'https')).'"><img class="bubble" src="' . $livetv_plugin_url . 'images/facebook.png" title="'.$txtfacebook.'" /></a></h4>';
    											}
    
    											if($general_join_twitter)
    											{
    												$txttwitter = __('Join us on Twitter', 'livetv');
    												$content_top .= '<h4 class="share-social"><a href="'.esc_url($general_join_twitter, array('http', 'https')).'"><img class="bubble" src="' . $livetv_plugin_url . 'images/twitter.png" title="'.$txttwitter.'" /></a></h4>';
    											}
    
    										$content_top .= '</ul>
    ';
    
    								$content_top .= '';
    
    								//Last news
    								$content_top .= '<li id="livetv-recent-posts" class="livetv-widget-container">';
    
    									$content_top .= '<h5 class="widget-title">';
    									$content_top .= __('Latest news', 'livetv');
    									$content_top .= '</h5>';
    
    									$content_top .= '
    <ul>';
    
    											$args = array( 'numberposts' => '9', 'post_status' => 'publish');
    											$posts = get_posts( $args );
    
    											foreach ($posts as $posted)
    											{
    												$content_top .= '<li class="news-single"><a>ID ) . '" title="' . esc_attr( $posted->post_title ) . '">';
    												$limit = 62;
    												if($viewmode == 'normal'){$limit = 40;}
    												$title = esc_attr($posted->post_title,'', false);
    												$trunk = trunc($title, $limit);
    												$content_top .= $trunk;
    												$content_top .= '…</a>';
    											}
    
    									$content_top .= '</ul>
    ';
    
    								$content_top .= '';
    
    							$content_top .= '';
    
    						//End Second slider (share)
    						$content_top .= '</div>';
    
    					//End Container share + IRC
    					$content_top .= '</div>';
    				}//End if plugin_irc_activate
    			}
    			//End view mode
    		}
    		else
    		{
    			$content_top .= '<div style="width:100%; height:auto; margin:0 auto; padding:0;"><div class="livetv-info"><a href="'.esc_url($registration, array('http', 'https')).'">'.esc_html($message).'</a></div>';
    		}
    	}
    	else
    	{
    		//Start ENGLOBE container to fix css for f*in themes. </div> @ line ~1075
    		$content_top .= '<div style="width:100%; height:auto; margin:0 auto; padding:0;">';
    	}
    	if(isset($_REQUEST['liveview']) && $_REQUEST['liveview'] === "offline")
    	{
    		$content_top .= '<div class="livetv-info"><a href="#">Sorry, live stream offline</a></div>';
    	}
    
    	//Now loop of thumbnails
    	$page_builded = "";
    
    	global $blog_id, $livetv_plugin_path;
    
    	$livetv_pagination_limit = get_option('livetv_pagination_limit');
    	$livetv_width_thumbnails = get_option('livetv_width_thumbnails');
    	$livetv_height_thumbnails = get_option('livetv_height_thumbnails');
    
    	if(!$livetv_width_thumbnails){$livetv_width_thumbnails = '170';}
    	if(!$livetv_height_thumbnails){$livetv_height_thumbnails = '100';}
    	if($livetv_pagination_limit)
    	{
    		wp_enqueue_script('livetv-pagination');
    	?>
    	<script type="text/javascript">
    		/* when document is ready */
    		jQuery(document).ready(function($){
    
    			$("div.livetv-holder-own3d").jPages({
    				containerID  : "livetv-container-own3d",
    				perPage      : <?php echo esc_html($livetv_pagination_limit); ?>,
    				first        : 'first',
    				last         : 'last',
    				previous	 : 'previous',
    				next	     : 'next'
    			});
    
    			$("div.livetv-holder-twitch").jPages({
    				containerID  : "livetv-container-twitch",
    				perPage      : <?php echo esc_html($livetv_pagination_limit); ?>,
    				first        : 'first',
    				last         : 'last',
    				previous	 : 'previous',
    				next	     : 'next'
    			});
    
    			$("div.livetv-holder-justin").jPages({
    				containerID  : "livetv-container-justin",
    				perPage      : <?php echo esc_html($livetv_pagination_limit); ?>,
    				first        : 'first',
    				last         : 'last',
    				previous	 : 'previous',
    				next	     : 'next'
    			});
    		});
         </script>
        <?php
    	}
    
    	$editable_roles = get_roles();
    	$types = explode('_', get_option('livetv_types_order'));
    	$button = get_option('livetv_disable_normal');
    	/*var_dump($types);*/
    
    	//Start cache
    	$cachetime = get_option('livetv_cache');
    	$livetv_span_color = get_option('livetv_span_color');
    	$livetv_span_color = '#'.$livetv_span_color;
    
    	$cache = $livetv_plugin_path . 'cache/temp_'.$blog_id.'_live.html';
    
    	$expire = time() - ($cachetime * 60); //-60; // valable X minutes
    
    	if(file_exists($cache) && filemtime($cache) > $expire)
    	{
    		$page_builded .= $content_top;
    		$page_builded .= file_get_contents($cache);
    		$page_builded .= $content_bottom;
    		return $page_builded;
    	}
    	else
    	{
    		ob_start(); //start buffer
    
    		foreach($types as $keyType => $valueType)
    		{
    
    			switch($valueType):
    
    				case 'own3d': //Own3d thumbnails loop
    
    						$content = "";
    
    						//Start general container own3d
    						$content .= '<div id="minithumb-own3d-content">';
    
    						if($titleh3 == 'txt')
    						{
    							$content .= '<h3>'.__('Own3d channels', 'livetv').'</h3>';
    						}
    
    						//H3
    						if($titleh3 == 'img')
    						{
    							$content .= '<h3><img class="bubble" src="'.$livetv_plugin_url.'images/thumblist-title-own3d.png" title="'.__('own3d channels', 'livetv').'" /></h3>';
    						}
    						//End H3
    
    						$count = 0;
    
    						//Pagination buttons
    						$content .= '<div class="livetv-holder-own3d"></div>';
    						//End pagination buttons
    
    						//Start pagination container
    						$content .= '<ul id="livetv-container-own3d">';
    
    						global $wpdb;
    
    						$meta_key = 'live_%_own3d_%';
    						$thumbs = $wpdb->get_results($wpdb->prepare("SELECT user_id, meta_key, meta_value FROM $wpdb->usermeta WHERE meta_key LIKE %s", $meta_key));
    						/*var_dump($thumbs);*/
    
    						foreach($thumbs as $keythumb => $valuethumb)
    						{
    							$userID = $valuethumb->user_id;
    							$userInfo = get_userdata( $userID );
    							$userName = $userInfo->display_name;
    							$channelName = $valuethumb->meta_value;
    							$channelKey = $channelName;
    
    							$live_now = false;
    							$own3d = 'http://api.own3d.tv/liveCheck.php?live_id=' . $channelName .'';
    							$xml = simplexml_load_file($own3d);
    							/*var_dump($xml);*/
    							$is_live = $xml->xpath('/own3dReply/liveEvent/isLive');
    							$live_viewers = $xml->xpath('/own3dReply/liveEvent/liveViewers');
    							$live_duration = $xml->xpath('/own3dReply/liveEvent/liveDuration');
    							$live_stamp = $live_duration[0];
    							$live_now = $is_live[0];
    							$live_until = (time() - $live_stamp);
    
    							if($live_now == 'true')
    							{
    								$count = $count + 1;
    
    								//Start square
    								$content .= '<li style="width:'.$livetv_width_thumbnails.'px">';
                                    $content .= '<span class="minithumb-own3d" style="opacity:1">';
    
    									//splash own3d image when online
    									$content .= '<span class="minithumb-own3d-splash"><img class="bubble" src="'.$livetv_plugin_url.'images/mini-own3d.png" alt="mask" title="'.__('Online since', 'livetv'). ' ' . date('d-m-Y H:i', $live_until) . '" /></span>';
    									//End splash
    
    									//thumbnail from own3d
    									$content .= '<span class="minithumb-own3d-thumb"><a href="'. esc_url('' . $livetv_current_url . 'liveview='.$channelKey.'&mode=normal&type=own3d', array('http', 'https')).'"><img style="width:'.$livetv_width_thumbnails.'px; height:'.$livetv_height_thumbnails.'px; height:'.$livetv_height_thumbnails.'px" class="bubble" src="http://img.hw.own3d.tv/live/live_tn_'.$channelName.'_.jpg" title="'. __('Channel by', 'livetv').' '.$userName.' '.__('from own3d', 'livetv').'" alt="own3d thumbnail" /></a></span>';
    									//End thumbnail
    
    									//Start info
    									$content .= '<span class="minithumb-own3d-info" style="color:'.$livetv_span_color.'">';
    
    										//Viewers
    										$content .= '<span class="w-viewers">'. __('Viewers:', 'livetv').' '. $live_viewers[0] . '</span>';
    										//End viewers
    
    										//Channel
    										$content .= '<span class="w-channel">'. __('channel:', 'livetv'). ' ' . $channelName . '</span>';
    										//End channel
    
    										//Button
    										$content .= '<span class="w-view">';
    
    											//Button normal
    											if($button == 'off')
    											{
    												$content .= '<a href="'.esc_url('' . $livetv_current_url . 'liveview='.$channelKey.'&mode=normal&type=own3d', array('http', 'https')).'" title="'.__('Swtich to normal view', 'livetv').'">'.__('Normal', 'livetv').'</a>';
    											}
    											//End button normal
    
    											//Button large
    											$content .=' <a href="'.esc_url('' . $livetv_current_url . 'liveview='.$channelKey.'&mode=full&type=own3d', array('http', 'https')).'" title="'. __('Swtich to Large view', 'livetv').'">'.__('Large', 'livetv').'</a></span><span class="w-live">'.__('Live!', 'livetv').' ' . date('d-m-Y H:i', $live_until) . '';
    											//End button large
    
    										//End button
    										$content .= '</span>';
    
    									//End infos
    									$content .= '</span>';
    
    							//End square
    							$content .= '</span>';
    							$content .= '';
    							}
    
    							if($livetv_view_offline == 'on' && $live_now == 'false' || $livetv_view_offline == 'widget_off' && $live_now == 'false')
    							{
    								$channelKey = 'offline';
    
    								//Start square
    								$content .= '<li class="offline" style="width:'.$livetv_width_thumbnails.'px">';
                                    $content .= '<span class="minithumb-own3d offline">';
    
    									//splash own3d image when online
    									$content .= '<span class="minithumb-own3d-splash"><img class="bubble" alt="mask" src="'.$livetv_plugin_url.'images/offline.png" title="'.__('own3d channel offline', 'livetv'). '" /></span>';
    									//End splash
    
    									//thumbnail from own3d
    									$content .= '<span class="minithumb-own3d-thumb"><a href="'. esc_url('' . $livetv_current_url . 'liveview='.$channelKey.'&mode=normal&type=own3d', array('http', 'https')).'"><img style="width:'.$livetv_width_thumbnails.'px; height:'.$livetv_height_thumbnails.'px; height:'.$livetv_height_thumbnails.'px" class="bubble" src="http://img.hw.own3d.tv/live/live_tn_'.$channelName.'_.jpg" title="'. __('Channel by', 'livetv').' '.$userName.' '.__('from own3d', 'livetv').'" alt="own3d thumbnail" /></a></span>';
    									//End thumbnail
    
    									//Start info
    									$content .= '<span class="minithumb-own3d-info" style="color:'.$livetv_span_color.'">';
    
    										//Viewers
    										$content .= '<span class="w-off-viewers">'. __('Viewers: offline', 'livetv').'</span>';
    										//End viewers
    
    										//Channel
    										$content .= '<span class="w-off-channel">'. __('channel:', 'livetv'). ' ' . $userName . '</span>';
    										//End channel
    
    										//Button
    										$content .= '<span class="w-off-view">';
    
    											//Button normal
    											if($button == 'off')
    											{
    												$content .= '<a href="'.esc_url('' . $livetv_current_url . 'liveview='.$channelKey.'&mode=normal&type=own3d', array('http', 'https')).'" title="'.__('Swtich to normal view', 'livetv').'">'.__('Normal', 'livetv').'</a>';
    											}
    											//End button normal
    
    											//Button large
    											$content .=' <a href="'.esc_url('' . $livetv_current_url . 'liveview='.$channelKey.'&mode=full&type=own3d', array('http', 'https')).'" title="'. __('Swtich to Large view', 'livetv').'">'.__('Large', 'livetv').'</a></span><span class="w-off-live">'.__('Live: Offline', 'livetv').'';
    											//End button large
    
    										//End button
    										$content .= '</span>';
    
    									//End infos
    									$content .= '</span>';
    
    								//End square
    								$content .= '</span>';
    								$content .= '';
    							}
    						}
    
    						//End pagination container
    						$content .= '';
    
    						//No live streaml online alert
    						if($count == 0)
    						{
    							if($livetv_view_offline == 'off' || $livetv_view_offline == 'widget_off')
    							{
    								$content .= '<p class="'.$live_offline_class.'">'.__('Currently no live stream online', 'livetv').'</p>';
    							}
    
    						}
    						//End alert
    
    						//End general container own3d
    						$content .= '</div>';
    
    						echo $content;
    
    				break;
    
    				case 'twitch': //Twitch thumbnails loop
    
    						$content = "";
    
    						//Start general container own3d
    						$content .= '<div id="minithumb-twitch-content">';
    
    						if($titleh3 == 'txt')
    						{
    							$content .= '<h3>'.__('Twitch channels', 'livetv').'</h3>';
    						}
    
    						//H3
    						if($titleh3 == 'img')
    						{
    							$content .= '<h3><img class="bubble" src="'.$livetv_plugin_url.'images/thumblist-title-twitch.png" title="'.__('twitch channels', 'livetv').'" /></h3>';
    						}
    						//End H3
    
    						$count = 0;
    						$counter = 0;
    
    						//Pagination buttons
    						$content .= '<div class="livetv-holder-twitch"></div>';
    						//End pagination buttons
    
    						//Start pagination container
    						$content .= '<ul id="livetv-container-twitch">';
    
    						global $wpdb;
    
    						$meta_key = 'live_%_twitch_%';
    						$thumbs = $wpdb->get_results($wpdb->prepare("SELECT user_id, meta_key, meta_value FROM $wpdb->usermeta WHERE meta_key LIKE %s", $meta_key));
    						/*var_dump($thumbs);*/
    						$userNames = array();
    						$base_url = "";
    						$base_url .= 'http://api.justin.tv/api/stream/list.json?channel=';
    
    						foreach($thumbs as $keythumb => $valuethumb)
    						{
    							$counter = $counter + 1;
    							$userID = $valuethumb->user_id;
    							$userInfo = get_userdata( $userID );
    							$userNames[] = $userInfo->display_name;
    
    							$base_url .= $valuethumb->meta_value;
    							$base_url .= ',';
    						}
    						$base_url = preg_replace('#,$#', '', $base_url);
    						$json_file = file_get_contents($base_url, 0, null, null);
    						$json_array = json_decode($json_file, true);
    						/*var_dump($json_file);*/
    
    						for($i = 0; $i < $counter; $i++)
    						{
    							$live_now = 'false';
    
    							$userName = esc_html($userNames[$i]);
    
    							if(!empty($json_array[$i]['name']))
    							{
    								$live_now = 'true';
    							}
    
    							$live_name = esc_html(preg_replace('#live_user_#', '', $json_array[$i]['name']));
    
    							if(!$live_name)
    							{
    								$live_name = esc_html('offline');
    							}
    
    							$live_title = esc_html($json_array[$i]['channel']['title']);
    							$live_status = esc_html($json_array[$i]['channel']['status']);
    							$live_game = esc_html($json_array[$i]['meta_game']);
    							$live_thumb = esc_html($json_array[$i]['channel']['screen_cap_url_medium']);
    							$live_count = esc_html($json_array[$i]['channel_count']);
    							$live_until = strtotime(esc_html($json_array[$i]['up_time']));
    
    							if($live_now == 'true')
    							{
    								$count = $count + 1;
    
    								//Start square
    								$content .= '<li style="width:'.$livetv_width_thumbnails.'px">';
                                    $content .= '<span class="minithumb-twitch" style="opacity:1">';
    
    									//splash twitch image when online
    									$content .= '<span class="minithumb-twitch-splash"><img class="bubble" src="'.$livetv_plugin_url.'images/mini-twitch.png" alt="mask" title="'.__('Online since', 'livetv'). ' ' . date('d-m-Y H:i', $live_until) . '';
    
    									if($live_game)
    									{
    										$content .= ' '. __('on game', 'livetv').' '.$live_game.'';
    									}
    									$content .= '" /></span>';
    									//End splash
    
    									//thumbnail from twitch
    									$content .= '<span class="minithumb-twitch-thumb"><a href="'. esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=twitch', array('http', 'https')).'"><img style="width:'.$livetv_width_thumbnails.'px; height:'.$livetv_height_thumbnails.'px; height:'.$livetv_height_thumbnails.'px" class="bubble" src="'.$live_thumb.'" title="' . $live_game . ' | ' . $live_title . ' | ' . $live_status . '" alt="twitch thumbnail" /></a></span>';
    									//End thumbnail
    
    									//Start info
    									$content .= '<span class="minithumb-twitch-info" style="color:'.$livetv_span_color.'">';
    
    										//Viewers
    										$content .= '<span class="w-viewers">'. __('Viewers:', 'livetv').' '. $live_count . '</span>';
    										//End viewers
    
    										//Channel
    										$content .= '<span class="w-channel">'. __('channel:', 'livetv'). ' ' . $live_name . '</span>';
    										//End channel
    
    										//Button
    										$content .= '<span class="w-view">';
    
    											//Button normal
    											if($button == 'off')
    											{
    												$content .= '<a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=twitch', array('http', 'https')).'" title="'.__('Swtich to normal view', 'livetv').'">'.__('Normal', 'livetv').'</a>';
    											}
    											//End button normal
    
    											//Button large
    											$content .=' <a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=full&type=twitch', array('http', 'https')).'" title="'. __('Swtich to Large view', 'livetv').'">'.__('Large', 'livetv').'</a></span><span class="w-live">'.__('Live!', 'livetv').' ' . date('d-m-Y H:i', $live_until) . '';
    											//End button large
    
    										//End button
    										$content .= '</span>';
    
    									//End infos
    									$content .= '</span>';
    
    							//End square
    							$content .= '</span>';
    							$content .= '';
    							}
    
    							if($livetv_view_offline == 'on' && $live_now == 'false' || $livetv_view_offline == 'widget_off' && $live_now == 'false')
    							{
    								//Start square
    								$content .= '<li class="offline" style="width:'.$livetv_width_thumbnails.'px">';
                                    $content .= '<span class="minithumb-twitch offline">';
    
    									//splash twitch image when online
    									$content .= '<span class="minithumb-twitch-splash"><img class="bubble" alt="mask" src="'.$livetv_plugin_url.'images/offline.png" title="'.__('twitch channel offline', 'livetv'). '" /></span>';
    									//End splash
    
    									//thumbnail from twitch
    									$content .= '<span class="minithumb-twitch-thumb"><a href="'. esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=twitch', array('http', 'https')).'"><img style="width:'.$livetv_width_thumbnails.'px; height:'.$livetv_height_thumbnails.'px; height:'.$livetv_height_thumbnails.'px" class="bubble" src="'.$livetv_plugin_url.'images/thumblist-mask-offline.png" title="'. __('Channel by', 'livetv').' '.$userName.' '.__('from twitch', 'livetv').'" alt="twitch thumbnail" /></a></span>';
    									//End thumbnail
    
    									//Start info
    									$content .= '<span class="minithumb-twitch-info" style="color:'.$livetv_span_color.'">';
    
    										//Viewers
    										$content .= '<span class="w-off-viewers">'. __('Viewers: offline', 'livetv').'</span>';
    										//End viewers
    
    										//Channel
    										$content .= '<span class="w-off-channel">'. __('channel:', 'livetv'). ' ' . $userName . '</span>';
    										//End channel
    
    										//Button
    										$content .= '<span class="w-off-view">';
    
    											//Button normal
    											if($button == 'off')
    											{
    												$content .= '<a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=twitch', array('http', 'https')).'" title="'.__('Swtich to normal view', 'livetv').'">'.__('Normal', 'livetv').'</a>';
    											}
    											//End button normal
    
    											//Button large
    											$content .=' <a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=full&type=twitch', array('http', 'https')).'" title="'. __('Swtich to Large view', 'livetv').'">'.__('Large', 'livetv').'</a></span><span class="w-off-live">'.__('Live: Offline', 'livetv').'';
    											//End button large
    
    										//End button
    										$content .= '</span>';
    
    									//End infos
    									$content .= '</span>';
    
    								//End square
    								$content .= '</span>';
    								$content .= '';
    							}
    						}
    
    						//End pagination container
    						$content .= '';
    
    						//No live streaml online alert
    						if($count == '0')
    						{
    							if($livetv_view_offline == 'off' || $livetv_view_offline == 'widget_off')
    							{
    								$content .= '<p class="'.$live_offline_class.'">'.__('Currently no live stream online', 'livetv').'</p>';
    							}
    						}
    						//End alert
    
    						//End general container own3d
    						$content .= '</div>';
    
    						echo $content;
    
    				break;
    
    				case 'justin': //Justin thumbnails loop
    
    						$content = "";
    
    						//Start general container own3d
    						$content .= '<div id="minithumb-justin-content">';
    
    						if($titleh3 == 'txt')
    						{
    							$content .= '<h3>'.__('Justin channels', 'livetv').'</h3>';
    						}
    
    						//H3
    						if($titleh3 == 'img')
    						{
    							if($general_color = 'light')
    							{
    								$justinlight = '-black'; //Poor white on white icon
    							}
    							$content .= '<h3><img class="bubble" src="'.$livetv_plugin_url.'images/thumblist-title-justin'.$justinlight.'.png" title="'.__('justin channels', 'livetv').'" /></h3>';
    						}
    						//End H3
    
    						$count = 0;
    						$counter = 0;
    
    						//Pagination buttons
    						$content .= '<div class="livetv-holder-justin"></div>';
    						//End pagination buttons
    
    						//Start pagination container
    						$content .= '<ul id="livetv-container-justin">';
    
    						global $wpdb;
    
    						$meta_key = 'live_%_justin_%';
    						$thumbs = $wpdb->get_results($wpdb->prepare("SELECT user_id, meta_key, meta_value FROM $wpdb->usermeta WHERE meta_key LIKE %s", $meta_key));
    						/*var_dump($thumbs);*/
    						$userNames = array();
    						$base_url = "";
    						$base_url .= 'http://api.justin.tv/api/stream/list.json?channel=';
    
    						foreach($thumbs as $keythumb => $valuethumb)
    						{
    							$counter = $counter + 1;
    							$userID = $valuethumb->user_id;
    							$userInfo = get_userdata( $userID );
    							$userNames[] = $userInfo->display_name;
    
    							$base_url .= $valuethumb->meta_value;
    							$base_url .= ',';
    						}
    						$base_url = preg_replace('#,$#', '', $base_url);
    						$json_file = file_get_contents($base_url, 0, null, null);
    						$json_array = json_decode($json_file, true);
    						/*var_dump($json_file);*/
    
    						for($i = 0; $i < $counter; $i++)
    						{
    							$live_now = 'false';
    
    							$userName = esc_html($userNames[$i]);
    
    							if(!empty($json_array[$i]['name']))
    							{
    								$live_now = 'true';
    							}
    
    							$live_name = esc_html(preg_replace('#live_user_#', '', $json_array[$i]['name']));
    
    							if(!$live_name)
    							{
    								$live_name = esc_html('offline');
    							}
    
    							$live_title = esc_html($json_array[$i]['channel']['title']);
    							$live_status = esc_html($json_array[$i]['channel']['status']);
    							$live_game = esc_html($json_array[$i]['meta_game']);
    							$live_thumb = esc_html($json_array[$i]['channel']['screen_cap_url_medium']);
    							$live_count = esc_html($json_array[$i]['channel_count']);
    							$live_until = strtotime(esc_html($json_array[$i]['up_time']));
    
    							if($live_now == 'true')
    							{
    								$count = $count + 1;
    
    								//Start square
    								$content .= '<li style="width:'.$livetv_width_thumbnails.'px">';
                                    $content .= '<span class="minithumb-justin" style="opacity:1">';
    
    									//splash justin image when online
    									$content .= '<span class="minithumb-justin-splash"><img class="bubble" src="'.$livetv_plugin_url.'images/mini-justin.png" alt="mask" title="'.__('Online since', 'livetv'). ' ' . date('d-m-Y H:i', $live_until) . '';
    
    									if($live_game)
    									{
    										$content .= ' '. __('on game', 'livetv').' '.$live_game.'';
    									}
    									$content .= '" /></span>';
    									//End splash
    
    									//thumbnail from justin
    									$content .= '<span class="minithumb-justin-thumb"><a href="'. esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=justin', array('http', 'https')).'"><img style="width:'.$livetv_width_thumbnails.'px; height:'.$livetv_height_thumbnails.'px; height:'.$livetv_height_thumbnails.'px" class="bubble" src="'.$live_thumb.'" title="' . $live_game . ' | ' . $live_title . ' | ' . $live_status . '" alt="justin thumbnail" /></a></span>';
    									//End thumbnail
    
    									//Start info
    									$content .= '<span class="minithumb-justin-info" style="color:'.$livetv_span_color.'">';
    
    										//Viewers
    										$content .= '<span class="w-viewers">'. __('Viewers:', 'livetv').' '. $live_count . '</span>';
    										//End viewers
    
    										//Channel
    										$content .= '<span class="w-channel">'. __('channel:', 'livetv'). ' ' . $live_name . '</span>';
    										//End channel
    
    										//Button
    										$content .= '<span class="w-view">';
    
    											//Button normal
    											if($button == 'off')
    											{
    												$content .= '<a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=justin', array('http', 'https')).'" title="'.__('Swtich to normal view', 'livetv').'">'.__('Normal', 'livetv').'</a>';
    											}
    											//End button normal
    
    											//Button large
    											$content .=' <a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=full&type=justin', array('http', 'https')).'" title="'. __('Swtich to Large view', 'livetv').'">'.__('Large', 'livetv').'</a></span><span class="w-live">'.__('Live!', 'livetv').' ' . date('d-m-Y H:i', $live_until) . '';
    											//End button large
    
    										//End button
    										$content .= '</span>';
    
    									//End infos
    									$content .= '</span>';
    
    							//End square
    							$content .= '</span>';
    							$content .= '';
    							}
    
    							if($livetv_view_offline == 'on' && $live_now == 'false' || $livetv_view_offline == 'widget_off' && $live_now == 'false')
    							{
    								//Start square
    								$content .= '<li class="offline" style="width:'.$livetv_width_thumbnails.'px">';
                                    $content .= '<span class="minithumb-justin offline">';
    
    									//splash justin image when online
    									$content .= '<span class="minithumb-justin-splash"><img class="bubble" alt="mask" src="'.$livetv_plugin_url.'images/offline.png" title="'.__('justin channel offline', 'livetv'). '" /></span>';
    									//End splash
    
    									//thumbnail from justin
    									$content .= '<span class="minithumb-justin-thumb"><a href="'. esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=justin', array('http', 'https')).'"><img style="width:'.$livetv_width_thumbnails.'px; height:'.$livetv_height_thumbnails.'px; height:'.$livetv_height_thumbnails.'px" class="bubble" src="'.$livetv_plugin_url.'images/thumblist-mask-offline.png" title="'. __('Channel by', 'livetv').' '.$userName.' '.__('from justin', 'livetv').'" alt="justin thumbnail" /></a></span>';
    									//End thumbnail
    
    									//Start info
    									$content .= '<span class="minithumb-justin-info" style="color:'.$livetv_span_color.'">';
    
    										//Viewers
    										$content .= '<span class="w-off-viewers">'. __('Viewers: offline', 'livetv').'</span>';
    										//End viewers
    
    										//Channel
    										$content .= '<span class="w-off-channel">'. __('channel:', 'livetv'). ' ' . $userName . '</span>';
    										//End channel
    
    										//Button
    										$content .= '<span class="w-off-view">';
    
    											//Button normal
    											if($button == 'off')
    											{
    												$content .= '<a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=normal&type=justin', array('http', 'https')).'" title="'.__('Swtich to normal view', 'livetv').'">'.__('Normal', 'livetv').'</a>';
    											}
    											//End button normal
    
    											//Button large
    											$content .=' <a href="'.esc_url('' . $livetv_current_url . 'liveview='.$live_name.'&mode=full&type=justin', array('http', 'https')).'" title="'. __('Swtich to Large view', 'livetv').'">'.__('Large', 'livetv').'</a></span><span class="w-off-live">'.__('Live: Offline', 'livetv').'';
    											//End button large
    
    										//End button
    										$content .= '</span>';
    
    									//End infos
    									$content .= '</span>';
    
    								//End square
    								$content .= '</span>';
    								$content .= '';
    							}
    						}
    						//End pagination container
    						$content .= '';
    
    						//No live streaml online alert
    						if($count == '0')
    						{
    							if($livetv_view_offline == 'off' || $livetv_view_offline == 'widget_off')
    							{
    								$content .= '<p class="'.$live_offline_class.'">'.__('Currently no live stream online', 'livetv').'</p>';
    							}
    						}
    						//End alert
    
    						//End general container own3d
    						$content .= '</div>';
    
    						echo $content;
    
    				break;
    
    				default:
    
    					$live_now = false;
    
    				break;
    
    			endswitch;
    
    		}
    
    		$page = "";
    		//Clean buffer and ending file
    		$page = ob_get_contents();
    
    		ob_end_clean();
    
    		file_put_contents($cache, $page);
    
    		$content_bottom = '</div>'; //Ending F* theme
    
    		$livetv_list_display = get_option('livetv_list_display');
    
    		if($livetv_list_display == 'off')
    		{
    			if(!isset($_REQUEST['liveview']))
    			{
    				$page_builded .= $content_top;
    				$page_builded .= $page;
    				$page_builded .= $content_bottom; //Ending F* theme
    				return $page_builded;
    			}
    			else
    			{
    				$page_builded .= $content_top;
    				$page_builded .= $content_bottom; //Ending F* theme
    				return $page_builded;
    			}
    		}
    		else
    		{
    			$page_builded .= $content_top;
    			$page_builded .= $page;
    			$page_builded .= $content_bottom; //Ending F* theme
    			return $page_builded;
    		}
    	}
    }
    ?>
  9. KwarK
    Member
    Plugin Author

    Posted 2 years ago #

    Try this code in page-frontend/page-livestream.php and tell me how the plugin work. If this code work great, I think I don't understand something with the [shortcode] wordpress and the necessary "return" value but if it works for all users, it's the most important and I makes the update.

    For me on livetv.allwebtuts.net, it's work correctly and any echo values is in use.

    It's a rapid code and some new stuffs are added for the next update but to try is sufficient

  10. KwarK
    Member
    Plugin Author

    Posted 2 years ago #

    If it's moderate (past code too long here on wordpress.org), you have a pastebin here http://pastebin.com/cnWiPQCF (at the bottom you have a ctrl-A, ctrl-C option to copy correctly the code)

  11. Gabriel Cunha
    Member
    Posted 2 years ago #

    Well, In your last uptade(1.3.0) don't have any error, but depends of the update of WP plataform.

    Well thank you for your atention with my problem !!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • liveTV Bundle
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.