if (strlen($current_song)<2) { $result->status = 1; } else { $result->status = 0; $result->mount = $params->get('point'); $result->listeners = $current_listeners + $params->get('fake'); $result->listfake = $current_listeners + $params->get('fake'); $result->cur_song = $current_song; } return $result;
if ($file = file_get_contents($addr)) { preg_match_all('#(\<td class=\"streamdata\"[^\>]*\>).+?(\<\/td\>)#is',$file , $matches,PREG_PATTERN_ORDER ); $stream_title = strip_tags("{$matches[0][0]}"); $stream_description = strip_tags("{$matches[0][1]}"); $content_type = strip_tags("{$matches[0][2]}") ; $mount_started = strip_tags("{$matches[0][3]}") ; $bitrate = strip_tags("{$matches[0][4]}") ; $current_listeners = strip_tags("{$matches[0][5]}") ; $peak_listeners = strip_tags("{$matches[0][6]}") ; $stream_genre = strip_tags("{$matches[0][7]}") ; $current_song = strip_tags("{$matches[0][8]}") ; }
<div align = "center" class="icecast<?php echo $params->get('moduleclass_sfx'); ?>"> <script type="text/javascript">var siteroot = "<?php echo $baseurl ?>";</script> # Адрес радиостанции <span class='icecast_title' style='display:none'><?php echo $module->id ?></span> <a href="<?php echo $host ?>" target="_blank"><b><?php echo $ice2_station ?></b></a><p> <div class="icacast-song"><?php echo JText::_( 'PLAYING' );?> # Надпись сейчас играет <p /><p class="icecast-song"><?php echo $item->cur_song?></div> # текущая песня <?php echo JText::_( 'CLICK' );?> <div class="icacast-play"> <a href="ht*tp://<?php echo $link?>"> <img src="<?php echo $baseurl?>/media/mod_icecast/play.png" title="<?php echo JText::_( 'ALT_IMG' );?>" alt="<?php echo JText::_( 'ALT_IMG' );?>"></a> </div> <div class="icacast-list"><?php echo JText::_( 'PEOPLE' );?> <b class="icecast-listeners"><?php echo $item->listfake ?></b></div> # Количество людей вместе с фейковыми <div class="icacast-bitrate"><?php echo JText::_( 'BITRATE' );?> <b><?php echo $bitrate?></b> <?php echo JText::_( 'KBPS' );?></div> </div>
<div align = "center" class="icecast<?php echo $params->get('moduleclass_sfx'); ?>"> <p class="icecast-song"><?php echo $item->stream_description?></div></p><p> <div class="icacast-song"><?php echo JText::_( 'PLAYING' );?> # Надпись сейчас играет <p /><p class="icecast-song"><?php echo $item->cur_song?></div> # текущая песня <?php echo JText::_( 'CLICK' );?> <div class="icacast-play"> <a href="ht*tp://<?php echo $link?>"> <img src="<?php echo $baseurl?>/media/mod_icecast/play.png" title="<?php echo JText::_( 'ALT_IMG' );?>" alt="<?php echo JText::_( 'ALT_IMG' );?>"></a> </div> <div class="icacast-list"><?php echo JText::_( 'PEOPLE' );?> <b class="icecast-listeners"><?php echo $item->listeners ?></b></div> # Количество людей вместе с фейковыми <div class="icacast-bitrate"><?php echo JText::_( 'BITRATE' );?> <b><?php echo $bitrate?></b> <?php echo JText::_( 'KBPS' );?></div> </div>
if (strlen($current_song)<2) { $result->status = 1; } else { $result->status = 0; $result->mount = $params->get('point'); $result->listeners = $current_listeners; $result->listfake = $current_listeners + $params->get('fake'); $result->cur_song = $current_song; $result->stream_description = $stream_description; } return $result;
IceCastUpdater = new Class({ title: '', el: Class.empty, active: false, initialize: function(id, el) { this.id = id; this.el = el; this.update.periodical(5000, this); }, update: function() { var t = this; if (this.active) return; this.active = true; var myAjax = new Ajax(siteroot + '/modules/mod_icecast/ajax.php?id=' + this.id + '&ts=' + $time(), { method: 'get', onComplete: function(response) { t.active = false; var result = Json.evaluate(response); $ES('.icecast-song', t.el).setText(result.title); $ES('.icecast-listeners', t.el).setText(result.listeners); } }).request(); } }); window.addEvent('domready', function() { $$('.icecast_title').each(function(el) { new IceCastUpdater(el.getText(), el.getParent()); }); });
<?php /** * ICECAST - A Joomla internet radio statistic module * @version 1.0.9 * @package mod_icecast.zip * @copyright (C) 2010 by sli */ /* * Поскольку этот скрипт является отдельной точкой входа, * инициализируем фреймворк так же, как это сделано в /index.php */ define( '_JEXEC', 1 ); define('JPATH_BASE', dirname(dirname(dirname(__FILE__))) ); define( 'DS', DIRECTORY_SEPARATOR ); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); $mainframe =& JFactory::getApplication('site'); $mainframe->initialise(); // Подключаем хелпер require_once(dirname(__FILE__).DS.'helper.php'); jimport('joomla.application.module.helper'); function paramsById($id) { $db = JFactory::getDBO(); $db->setQuery('SELECT params FROM #__modules WHERE id = '. $db->quote($id)); return new JParameter($db->loadResult()); } $data = ModHelperIceCast::getParams(paramsById(JRequest::getInt('id'))); if (!isset($data->listeners)) { $data->listeners = 0; $data->cur_song = 'n/a'; } echo '{listeners: ', $data->listeners, ', title: "', str_replace('"', '\'\'', $data->cur_song), '"}'; ?>
if (!isset($data->listeners)) { $data->listeners = 0; $data->cur_song = 'n/a'; } echo '{listeners: ', $data->listeners, ', title: "', str_replace('"', '\'\'', $data->cur_song), '"}';
update: function() { var t = this; if (this.active) return; this.active = true; var myAjax = new Ajax(siteroot + '/modules/mod_icecast/ajax.php?id=' + this.id + '&ts=' + $time(), { method: 'get', onComplete: function(response) { t.active = false; var result = Json.evaluate(response); $ES('.icecast-song', t.el).setText(result.title); $ES('.icecast-listeners', t.el).setText(result.listeners); $ES('.icecast-description', t.el).setText(result.description); }
if (!isset($data->listeners)) { $data->listeners = 0; $data->cur_song = 'n/a'; $data->description = 'n/a'; } echo '{listeners: ', $data->listeners, ', ''description: ', $data->description, ', title: "', str_replace('"', '\'\'', $data->cur_song), '"}';