function renderAllVideos(&$row, &$params, $page = 0) { // API jimport('joomla.filesystem.file'); $app = JFactory::getApplication(); $document = JFactory::getDocument(); // Assign paths $sitePath = JPATH_SITE; $siteUrl = JURI::root(true); if (version_compare(JVERSION, '2.5.0', 'ge')) { $pluginLivePath = $siteUrl . '/plugins/content/' . $this->plg_name . '/' . $this->plg_name; } else { $pluginLivePath = $siteUrl . '/plugins/content/' . $this->plg_name; } // Check if plugin is enabled if (JPluginHelper::isEnabled('content', $this->plg_name) == false) { return; } // Load the plugin language file the proper way JPlugin::loadLanguage('plg_content_' . $this->plg_name, JPATH_ADMINISTRATOR); // Includes require_once dirname(__FILE__) . DS . $this->plg_name . DS . 'includes' . DS . 'helper.php'; require dirname(__FILE__) . DS . $this->plg_name . DS . 'includes' . DS . 'sources.php'; // Simple performance check to determine whether plugin should process further $grabTags = strtolower(implode(array_keys($tagReplace), "|")); if (preg_match("#{(" . $grabTags . ")}#is", $row->text) == false) { return; } // ----------------------------------- Get plugin parameters ----------------------------------- // Get plugin info $plugin = JPluginHelper::getPlugin('content', $this->plg_name); // Control external parameters and set variable for controlling plugin layout within modules if (!$params) { $params = class_exists('JParameter') ? new JParameter(null) : new JRegistry(null); } $parsedInModule = $params->get('parsedInModule'); $pluginParams = class_exists('JParameter') ? new JParameter($plugin->params) : new JRegistry($plugin->params); /* Video Parameters */ $playerTemplate = $params->get('playerTemplate') ? $params->get('playerTemplate') : $pluginParams->get('playerTemplate', 'Responsive'); $vfolder = $params->get('vfolder') ? $params->get('vfolder') : $pluginParams->get('vfolder', 'images/stories/videos'); $vwidth = $params->get('vwidth') ? $params->get('vwidth') : $pluginParams->get('vwidth', 400); $vheight = $params->get('vheight') ? $params->get('vheight') : $pluginParams->get('vheight', 300); $transparency = $pluginParams->get('transparency', 'transparent'); $background = $pluginParams->get('background', '#010101'); $backgroundQT = $pluginParams->get('backgroundQT', 'black'); $controls = $pluginParams->get('controls', 1); /* Audio Parameters */ $afolder = $pluginParams->get('afolder', 'images/stories/audio'); $awidth = $params->get('awidth') ? $params->get('awidth') : $pluginParams->get('awidth', 480); $aheight = $params->get('aheight') ? $params->get('aheight') : $pluginParams->get('aheight', 24); $abackground = $pluginParams->get('abackground', '#010101'); $afrontcolor = $pluginParams->get('afrontcolor', '#FFFFFF'); $alightcolor = $pluginParams->get('alightcolor', '#00ADE3'); $allowAudioDownloading = $pluginParams->get('allowAudioDownloading', 0); /* Global Parameters */ $autoplay = $params->get('autoplay') ? $params->get('autoplay') : $pluginParams->get('autoplay', 0); $loop = $params->get('loop') ? $params->get('loop') : $pluginParams->get('loop', 0); /* Performance Parameters */ $gzipScripts = $pluginParams->get('gzipScripts', 0); /* Advanced */ $jwPlayerLoading = $pluginParams->get('jwPlayerLoading', 'local'); // local | cdn $jwPlayerAPIKey = $pluginParams->get('jwPlayerAPIKey', 'plXkZcoHeQXVlRo0nD6AUscwEXmFJCmIpGL3kw=='); $jwPlayerCDNUrl = $pluginParams->get('jwPlayerCDNUrl', 'http://jwpsrv.com/library/n9Po9gncEeOKaBIxOUCPzg.js'); // Variable cleanups for K2 if (JRequest::getCmd('format') == 'raw') { $this->plg_copyrights_start = ''; $this->plg_copyrights_end = ''; } // Assign the AllVideos helper class $AllVideosHelper = new AllVideosHelper(); // ----------------------------------- Render the output ----------------------------------- // Append head includes only when the document is in HTML mode if (JRequest::getCmd('format') == 'html' || JRequest::getCmd('format') == '') { // CSS $avCSS = $AllVideosHelper->getTemplatePath($this->plg_name, 'css/template.css', $playerTemplate); $avCSS = $avCSS->http; $document->addStyleSheet($avCSS); // JS if (version_compare(JVERSION, '2.5.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } if ($gzipScripts) { $document->addScript($pluginLivePath . '/includes/js/jwp.js.php?v=4.7.0'); } else { $document->addScript($pluginLivePath . '/includes/js/behaviour.js?v=4.7.0'); $document->addScript($pluginLivePath . '/includes/js/wmvplayer/silverlight.js?v=4.7.0'); $document->addScript($pluginLivePath . '/includes/js/wmvplayer/wmvplayer.js?v=4.7.0'); $document->addScript($pluginLivePath . '/includes/js/quicktimeplayer/ac_quicktime.js?v=4.7.0'); } if ($jwPlayerLoading == 'local') { $document->addScript($pluginLivePath . '/includes/js/jwplayer/jwplayer.js?v=4.7.0'); $document->addScriptDeclaration(' /* JW Player API Key */ jwplayer.key="' . $jwPlayerAPIKey . '"; '); } else { $document->addScript($jwPlayerCDNUrl); } } // Loop throught the found tags $tagReplace = array_change_key_case($tagReplace, CASE_LOWER); foreach ($tagReplace as $plg_tag => $value) { $cloned_plg_tag = $plg_tag; $plg_tag = strtolower($plg_tag); // expression to search for $regex = "#{" . $plg_tag . "}.*?{/" . $plg_tag . "}#is"; // process tags if (preg_match_all($regex, $row->text, $matches, PREG_PATTERN_ORDER)) { // start the replace loop foreach ($matches[0] as $key => $match) { $tagcontent = preg_replace("/{.+?}/", "", $match); $tagcontent = str_replace(array('"', '\'', '`'), array('"', ''', '`'), $tagcontent); // Address potential XSS attacks $tagparams = explode('|', $tagcontent); $tagsource = trim(strip_tags($tagparams[0])); // Prepare the HTML $output = new JObject(); // Width/height/source folder split per media type if (in_array($plg_tag, array('mp3', 'mp3remote', 'aac', 'aacremote', 'm4a', 'm4aremote', 'ogg', 'oggremote', 'wma', 'wmaremote', 'soundcloud'))) { $final_awidth = @$tagparams[1] ? $tagparams[1] : $awidth; $final_aheight = @$tagparams[2] ? $tagparams[2] : $aheight; $output->playerWidth = $final_awidth; $output->playerHeight = $final_aheight; $output->folder = $afolder; if ($plg_tag == 'soundcloud') { if (strpos($tagsource, '/sets/') !== false) { $output->mediaTypeClass = ' avSoundCloudSet'; } else { $output->mediaTypeClass = ' avSoundCloudSong'; } $output->mediaType = ''; } else { $output->mediaTypeClass = ' avAudio'; $output->mediaType = 'audio'; } if (in_array($plg_tag, array('mp3', 'aac', 'm4a', 'ogg', 'wma'))) { $output->source = "{$siteUrl}/{$afolder}/{$tagsource}.{$plg_tag}"; } elseif (in_array($plg_tag, array('mp3remote', 'aacremote', 'm4aremote', 'oggremote', 'wmaremote'))) { $output->source = $tagsource; } else { $output->source = ''; } } else { $final_vwidth = @$tagparams[1] ? $tagparams[1] : $vwidth; $final_vheight = @$tagparams[2] ? $tagparams[2] : $vheight; $output->playerWidth = $final_vwidth; $output->playerHeight = $final_vheight; $output->folder = $vfolder; $output->mediaType = 'video'; $output->mediaTypeClass = ' avVideo'; } // Autoplay $final_autoplay = @$tagparams[3] ? $tagparams[3] : $autoplay; $final_autoplay = $final_autoplay ? 'true' : 'false'; // Loop $final_loop = @$tagparams[4] ? $tagparams[4] : $loop; $final_loop = $final_loop ? 'true' : 'false'; // Special treatment for specific video providers if ($plg_tag == "dailymotion") { $tagsource = preg_replace("~(http|https):(.+?)dailymotion.com\\/video\\/~s", "", $tagsource); $tagsourceDailymotion = explode('_', $tagsource); $tagsource = $tagsourceDailymotion[0]; if ($final_autoplay == 'true') { if (strpos($tagsource, '?') !== false) { $tagsource = $tagsource . '&autoplay=1'; } else { $tagsource = $tagsource . '?autoplay=1'; } } } if ($plg_tag == "ku6") { $tagsource = str_replace('.html', '', $tagsource); } if ($plg_tag == "metacafe" && substr($tagsource, -1, 1) == '/') { $tagsource = substr($tagsource, 0, -1); } if ($plg_tag == "sevenload") { $tagsource = parse_url($tagsource); $tagsource = explode('-', $tagsource['query']); $tagsource = array_reverse($tagsource); $tagsource = $tagsource[0]; } if ($plg_tag == "sohu") { $tagsource = parse_url($tagsource); $tagsource = explode('/', $tagsource['query']); $tagsource = array_reverse($tagsource); $tagsource = str_replace('.shtml', '', $tagsource[0]); } if ($plg_tag == "vidiac") { $tagsourceVidiac = explode(';', $tagsource); $tagsource = $tagsourceVidiac[0]; } if ($plg_tag == "vimeo") { $tagsource = preg_replace("~(http|https):(.+?)vimeo.com\\/~s", "", $tagsource); if (strpos($tagsource, '?') !== false) { $tagsource = $tagsource . '&portrait=0'; } else { $tagsource = $tagsource . '?portrait=0'; } if ($final_autoplay == 'true') { $tagsource = $tagsource . '&autoplay=1'; } if ($final_loop == 'true') { $tagsource = $tagsource . '&loop=1'; } } if ($plg_tag == "vine") { if (strpos($tagsource, 'http') === false) { $tagsource = 'https://vine.co/v/' . $tagsource; } } if ($plg_tag == "yfrog") { $tagsource = preg_replace("~(http|https):(.+?)yfrog.com\\/~s", "", $tagsource); } if ($plg_tag == "youmaker") { $tagsourceYoumaker = explode('-', str_replace('.html', '', $tagsource)); $tagsource = $tagsourceYoumaker[1]; } if ($plg_tag == "youku") { $tagsource = str_replace('.html', '', $tagsource); $tagsource = substr($tagsource, 3); } if ($plg_tag == "youtube") { // Check the presence of fully pasted URLs if (strpos($tagsource, 'youtube.com') !== false || strpos($tagsource, 'youtu.be') !== false) { $ytQuery = parse_url($tagsource, PHP_URL_QUERY); $ytQuery = str_replace('&', '&', $ytQuery); } else { $ytQuery = $tagsource; } // Process string if (strpos($ytQuery, '&') !== false) { $ytQuery = explode('&', $ytQuery); $ytParams = array(); foreach ($ytQuery as $ytParam) { $ytParam = explode('=', $ytParam); $ytParams[$ytParam[0]] = $ytParam[1]; } if (array_key_exists('v', $ytParams)) { $tagsource = $ytParams['v']; } elseif (array_key_exists('list', $ytParams)) { $tagsource = 'videoseries?list=' . $ytParams['list']; } } elseif (strpos($ytQuery, '=') !== false) { $ytQuery = explode('=', $ytQuery); $ytParams = array(); $ytParams[$ytQuery[0]] = $ytQuery[1]; if (array_key_exists('v', $ytParams)) { $tagsource = $ytParams['v']; } elseif (array_key_exists('list', $ytParams)) { $tagsource = 'videoseries?list=' . $ytParams['list']; } } else { if (substr($tagsource, 0, 2) == "PL") { $tagsource = 'videoseries?list=' . $tagsource; } } if (strpos($tagsource, '?') !== false) { $tagsource = $tagsource . '&rel=0&fs=1&wmode=transparent'; } else { $tagsource = $tagsource . '?rel=0&fs=1&wmode=transparent'; } // Additional playback parameters if ($final_autoplay == 'true') { $tagsource = $tagsource . '&autoplay=1'; } if ($final_loop == 'true') { $tagsource = $tagsource . '&loop=1'; } } // Poster frame $posterFramePath = $sitePath . DS . str_replace('/', DS, $vfolder); if (JFile::exists($posterFramePath . DS . $tagsource . '.jpg')) { $output->posterFrame = $siteUrl . '/' . $vfolder . '/' . $tagsource . '.jpg'; } elseif (JFile::exists($posterFramePath . DS . $tagsource . '.png')) { $output->posterFrame = $siteUrl . '/' . $vfolder . '/' . $tagsource . '.png'; } elseif (JFile::exists($posterFramePath . DS . $tagsource . '.gif')) { $output->posterFrame = $siteUrl . '/' . $vfolder . '/' . $tagsource . '.gif'; } else { $output->posterFrame = ''; } // Poster frame (remote) $output->posterFrameRemote = substr($tagsource, 0, -3) . 'jpg'; // Set a unique ID $output->playerID = 'AVPlayerID_' . $key . '_' . md5($tagsource); // Placeholder elements $findAVparams = array("{SOURCE}", "{SOURCEID}", "{FOLDER}", "{WIDTH}", "{HEIGHT}", "{PLAYER_AUTOPLAY}", "{PLAYER_LOOP}", "{PLAYER_TRANSPARENCY}", "{PLAYER_BACKGROUND}", "{PLAYER_BACKGROUNDQT}", "{JWPLAYER_CONTROLS}", "{SITEURL}", "{SITEURL_ABS}", "{FILE_EXT}", "{PLUGIN_PATH}", "{PLAYER_POSTER_FRAME}", "{PLAYER_POSTER_FRAME_REMOTE}", "{PLAYER_ABACKGROUND}", "{PLAYER_AFRONTCOLOR}", "{PLAYER_ALIGHTCOLOR}"); // Replacement elements $replaceAVparams = array($tagsource, $output->playerID, $output->folder, $output->playerWidth, $output->playerHeight, $final_autoplay, $final_loop, $transparency, $background, $backgroundQT, $controls, $siteUrl, substr(JURI::root(false), 0, -1), $plg_tag, $pluginLivePath, $output->posterFrame, $output->posterFrameRemote, $abackground, $afrontcolor, $alightcolor); // Do the element replace $output->player = JFilterOutput::ampReplace(str_replace($findAVparams, $replaceAVparams, $tagReplace[$cloned_plg_tag])); // Fetch the template ob_start(); $getTemplatePath = $AllVideosHelper->getTemplatePath($this->plg_name, 'default.php', $playerTemplate); $getTemplatePath = $getTemplatePath->file; include $getTemplatePath; $getTemplate = $this->plg_copyrights_start . ob_get_contents() . $this->plg_copyrights_end; ob_end_clean(); // Output $row->text = preg_replace("#{" . $plg_tag . "}" . preg_quote($tagcontent) . "{/" . $plg_tag . "}#is", $getTemplate, $row->text); } // End second foreach } // End if } // End first foreach }
function renderAllVideos(&$row, &$params, $page = 0) { // API jimport('joomla.filesystem.file'); $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Assign paths $sitePath = JPATH_SITE; $siteUrl = JURI::root(true); if (version_compare(JVERSION, '1.6.0', 'ge')) { $pluginLivePath = JURI::root(true) . '/plugins/content/' . $this->plg_name . '/' . $this->plg_name; } else { $pluginLivePath = JURI::root(true) . '/plugins/content/' . $this->plg_name; } // Check if plugin is enabled if (JPluginHelper::isEnabled('content', $this->plg_name) == false) { return; } // Load the plugin language file the proper way JPlugin::loadLanguage('plg_content_' . $this->plg_name, JPATH_ADMINISTRATOR); // Includes require_once dirname(__FILE__) . DS . $this->plg_name . DS . 'includes' . DS . 'helper.php'; require dirname(__FILE__) . DS . $this->plg_name . DS . 'includes' . DS . 'sources.php'; // Simple performance check to determine whether plugin should process further $grabTags = str_replace("(", "", str_replace(")", "", implode(array_keys($tagReplace), "|"))); if (preg_match("#{(" . $grabTags . ")}#s", $row->text) == false) { return; } // ----------------------------------- Get plugin parameters ----------------------------------- // Outside Parameters if (!$params) { $params = new JParameter(null); } $plugin =& JPluginHelper::getPlugin('content', $this->plg_name); $pluginParams = new JParameter($plugin->params); /* Preset Parameters */ $template = 'Classic'; $skin = 'bekle'; /* Video Parameters */ $vfolder = $params->get('vfolder') ? $params->get('vfolder') : $pluginParams->get('vfolder', 'images/stories/videos'); $vwidth = $params->get('vwidth') ? $params->get('vwidth') : $pluginParams->get('vwidth', 400); $vheight = $params->get('vheight') ? $params->get('vheight') : $pluginParams->get('vheight', 300); $transparency = $pluginParams->get('transparency', 'transparent'); $background = $pluginParams->get('background', '#010101'); $backgroundQT = $pluginParams->get('backgroundQT', 'black'); $controlBarLocation = $pluginParams->get('controlBarLocation', 'bottom'); /* Audio Parameters */ $afolder = $pluginParams->get('afolder', 'images/stories/audio'); $awidth = $params->get('awidth') ? $params->get('awidth') : $pluginParams->get('awidth', 480); $aheight = $params->get('aheight') ? $params->get('aheight') : $pluginParams->get('aheight', 24); $abackground = $pluginParams->get('abackground', '#010101'); $afrontcolor = $pluginParams->get('afrontcolor', '#FFFFFF'); $alightcolor = $pluginParams->get('alightcolor', '#00ADE3'); $allowAudioDownloading = $pluginParams->get('allowAudioDownloading', 0); /* Global Parameters */ $autoplay = $params->get('autoplay') ? $params->get('autoplay') : $pluginParams->get('autoplay', 0); /* Performance Parameters */ $gzipScripts = $pluginParams->get('gzipScripts', 0); // Variable cleanups for K2 if (JRequest::getCmd('format') == 'raw') { $this->plg_copyrights_start = ''; $this->plg_copyrights_end = ''; } // ----------------------------------- Render the output ----------------------------------- // Append head includes only when the document is in HTML mode if (JRequest::getCmd('format') == 'html' || JRequest::getCmd('format') == '') { // CSS $avCSS = AllVideosHelper::getTemplatePath($this->plg_name, 'css/template.css', $template); $avCSS = $avCSS->http; $document->addStyleSheet($avCSS); // JS if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } if ($gzipScripts) { $document->addScript($pluginLivePath . '/includes/js/jw_allvideos.js.php'); } else { $document->addScript($pluginLivePath . '/includes/js/behaviour.js'); $document->addScript($pluginLivePath . '/includes/js/mediaplayer/jwplayer.js'); $document->addScript($pluginLivePath . '/includes/js/wmvplayer/silverlight.js'); $document->addScript($pluginLivePath . '/includes/js/wmvplayer/wmvplayer.js'); $document->addScript($pluginLivePath . '/includes/js/quicktimeplayer/AC_QuickTime.js'); } } // Loop throught the found tags foreach ($tagReplace as $plg_tag => $value) { // expression to search for $regex = "#{" . $plg_tag . "}.*?{/" . $plg_tag . "}#s"; // process tags if (preg_match_all($regex, $row->text, $matches, PREG_PATTERN_ORDER)) { // start the replace loop foreach ($matches[0] as $key => $match) { $tagcontent = preg_replace("/{.+?}/", "", $match); $tagparams = explode('|', $tagcontent); $tagsource = trim(strip_tags($tagparams[0])); // Prepare the HTML $output = new JObject(); // Width/height/source folder split per media type if (in_array($plg_tag, array('mp3', 'mp3remote', 'aac', 'aacremote', 'm4a', 'm4aremote', 'ogg', 'oggremote', 'wma', 'wmaremote', 'soundcloud'))) { $final_awidth = @$tagparams[1] ? $tagparams[1] : $awidth; $final_aheight = @$tagparams[2] ? $tagparams[2] : $aheight; $output->playerWidth = $final_awidth; $output->playerHeight = $final_aheight; $output->folder = $afolder; $output->mediaTypeClass = ' avAudio'; if ($plg_tag != 'soundcloud') { $output->mediaType = 'audio'; } if (in_array($plg_tag, array('mp3', 'aac', 'm4a', 'ogg', 'wma'))) { $output->source = "{$siteUrl}/{$afolder}/{$tagsource}.{$plg_tag}"; } elseif (in_array($plg_tag, array('mp3remote', 'aacremote', 'm4aremote', 'oggremote', 'wmaremote'))) { $output->source = $tagsource; } else { $output->source = ''; } } else { $final_vwidth = @$tagparams[1] ? $tagparams[1] : $vwidth; $final_vheight = @$tagparams[2] ? $tagparams[2] : $vheight; $output->playerWidth = $final_vwidth; $output->playerHeight = $final_vheight; $output->folder = $vfolder; $output->mediaType = 'video'; $output->mediaTypeClass = ' avVideo'; } // Autoplay $final_autoplay = @$tagparams[3] ? $tagparams[3] : $autoplay; $final_autoplay = $final_autoplay ? 'true' : 'false'; // Special treatment for specific video providers if ($plg_tag == "dailymotion") { $tagsource = preg_replace("~(http|https):(.+?)dailymotion.com\\/video\\/~s", "", $tagsource); $tagsourceDailymotion = explode('_', $tagsource); $tagsource = $tagsourceDailymotion[0]; if ($final_autoplay == 'true') { if (strpos($tagsource, '?') !== false) { $tagsource = $tagsource . '&autoPlay=1'; } else { $tagsource = $tagsource . '?autoPlay=1'; } } } if ($plg_tag == "ku6") { $tagsource = str_replace('.html', '', $tagsource); } if ($plg_tag == "metacafe" && substr($tagsource, -1, 1) == '/') { $tagsource = substr($tagsource, 0, -1); } if ($plg_tag == "twitvid") { $tagsource = preg_replace("~(http|https):(.+?)twitvid.com\\/~s", "", $tagsource); if ($final_autoplay == 'true') { $tagsource = $tagsource . '&autoplay=1'; } } if ($plg_tag == "vidiac") { $tagsourceVidiac = explode(';', $tagsource); $tagsource = $tagsourceVidiac[0]; } if ($plg_tag == "vimeo") { $tagsource = preg_replace("~(http|https):(.+?)vimeo.com\\/~s", "", $tagsource); if (strpos($tagsource, '?') !== false) { $tagsource = $tagsource . '&portrait=0'; } else { $tagsource = $tagsource . '?portrait=0'; } if ($final_autoplay == 'true') { $tagsource = $tagsource . '&autoplay=1'; } } if ($plg_tag == "yahoo") { $tagsourceYahoo = explode('-', str_replace('.html', '', $tagsource)); $tagsourceYahoo = array_reverse($tagsourceYahoo); $tagsource = $tagsourceYahoo[0]; } if ($plg_tag == "yfrog") { $tagsource = preg_replace("~(http|https):(.+?)yfrog.com\\/~s", "", $tagsource); } if ($plg_tag == "youmaker") { $tagsourceYoumaker = explode('-', str_replace('.html', '', $tagsource)); $tagsource = $tagsourceYoumaker[1]; } if ($plg_tag == "youku") { $tagsource = str_replace('.html', '', $tagsource); $tagsource = substr($tagsource, 3); } if ($plg_tag == "youtube") { $tagsource = preg_replace("~(http|https):(.+?)youtube.com\\/watch\\?v=~s", "", $tagsource); $tagsourceYoutube = explode('&', $tagsource); $tagsource = $tagsourceYoutube[0]; if (strpos($tagsource, '?') !== false) { $tagsource = $tagsource . '&rel=0&fs=1&wmode=transparent'; } else { $tagsource = $tagsource . '?rel=0&fs=1&wmode=transparent'; } if ($final_autoplay == 'true') { $tagsource = $tagsource . '&autoplay=1'; } } // Poster frame $posterFramePath = $sitePath . DS . str_replace('/', DS, $vfolder); if (JFile::exists($posterFramePath . DS . $tagsource . '.jpg')) { $output->posterFrame = $siteUrl . '/' . $vfolder . '/' . $tagsource . '.jpg'; } elseif (JFile::exists($posterFramePath . DS . $tagsource . '.png')) { $output->posterFrame = $siteUrl . '/' . $vfolder . '/' . $tagsource . '.png'; } elseif (JFile::exists($posterFramePath . DS . $tagsource . '.gif')) { $output->posterFrame = $siteUrl . '/' . $vfolder . '/' . $tagsource . '.gif'; } else { $output->posterFrame = ''; } // Set a unique ID $output->playerID = 'AVPlayerID_' . substr(md5($tagsource), 1, 8) . '_' . rand(); // Placeholder elements $findAVparams = array("{SOURCE}", "{SOURCEID}", "{FOLDER}", "{WIDTH}", "{HEIGHT}", "{PLAYER_AUTOPLAY}", "{PLAYER_TRANSPARENCY}", "{PLAYER_BACKGROUND}", "{PLAYER_BACKGROUNDQT}", "{PLAYER_CONTROLBAR}", "{SITEURL}", "{FILE_EXT}", "{PLUGIN_PATH}", "{PLAYER_POSTER_FRAME}", "{PLAYER_SKIN}", "{PLAYER_ABACKGROUND}", "{PLAYER_AFRONTCOLOR}", "{PLAYER_ALIGHTCOLOR}"); // Replacement elements $replaceAVparams = array($tagsource, $output->playerID, $output->folder, $output->playerWidth, $output->playerHeight, $final_autoplay, $transparency, $background, $backgroundQT, $controlBarLocation, $siteUrl, $plg_tag, $pluginLivePath, $output->posterFrame, $skin, $abackground, $afrontcolor, $alightcolor); // Do the element replace $output->player = JFilterOutput::ampReplace(str_replace($findAVparams, $replaceAVparams, $tagReplace[$plg_tag])); // Fetch the template ob_start(); $getTemplatePath = AllVideosHelper::getTemplatePath($this->plg_name, 'default.php', $template); $getTemplatePath = $getTemplatePath->file; include $getTemplatePath; $getTemplate = $this->plg_copyrights_start . ob_get_contents() . $this->plg_copyrights_end; ob_end_clean(); // Output $row->text = preg_replace("#{" . $plg_tag . "}" . preg_quote($tagcontent) . "{/" . $plg_tag . "}#s", $getTemplate, $row->text); } // End second foreach } // End if } // End first foreach }
function renderMedia($tagOrder) { $option = JRequest::getVar('option', '', '', 'string'); include_once JPATH_ROOT . DS . 'components' . DS . $option . DS . 'assets' . DS . 'players' . DS . 'sources.php'; include_once JPATH_ROOT . DS . 'components' . DS . $option . DS . 'assets' . DS . 'players' . DS . 'helper.php'; $live_site = JURI::root(); $user = JFactory::getUser(); $user_id = $user->get('id'); $paramsC = JComponentHelper::getParams(KISS_COMPONENT_JDIR); foreach ($tagReplace as $plg_tag => $value) { // expression to search for $regex = "#{" . $plg_tag . "}(.*?){/" . $plg_tag . "}#s"; // process tags if (preg_match_all($regex, $tagOrder, $matches, PREG_PATTERN_ORDER) > 0) { // start the replace loop foreach ($matches[0] as $key => $match) { $tagcontent = preg_replace("/{.+?}/", "", $match); $tagparams = explode('|', $tagcontent); $tagsource = trim(strip_tags($tagparams[0])); $final_vwidth = @$tagparams[1] ? $tagparams[1] : $paramsC->get('med_width'); $final_vheight = @$tagparams[2] ? $tagparams[2] : $paramsC->get('med_height'); $final_autoplay = @$tagparams[3] ? $tagparams[3] : $paramsC->get('med_autoplay'); $final_transparency = @$tagparams[4] ? $tagparams[4] : $paramsC->get('med_transparency'); $final_background = @$tagparams[5] ? $tagparams[5] : $paramsC->get('med_background'); $final_backgroundqt = @$tagparams[6] ? $tagparams[6] : $paramsC->get('med_backgroundQT'); $final_controlbar = @$tagparams[7] ? $tagparams[7] : $paramsC->get('med_controlbar'); // source elements $findAVparams = array("{SOURCE}", "{SOURCEID}", "{FOLDER}", "{WIDTH}", "{HEIGHT}", "{AUTOPLAY}", "{TRANSPARENCY}", "{BACKGROUND}", "{BACKGROUNDQT}", "{CONTROLBAR}", "{SITEURL}"); // special treatment if ($plg_tag == "yahoo") { $tagsourceyahoo = explode('/', $tagsource); $tagsource = 'id=' . $tagsourceyahoo[1] . '&vid=' . $tagsourceyahoo[0]; } if ($plg_tag == "youku") { $tagsource = substr($tagsource, 3); } // Prepare the HTML $output = new JObject(); // replacement elements if (in_array($plg_tag, array("mp3", "mp3remote", "wma", "wmaremote"))) { $afolder = self::getImageDirforUser($user_id, 0) . "videos"; $transparency = $paramsC->get('med_transparency'); $background = $paramsC->get('med_background'); $backgroundQT = $paramsC->get('med_backgroundQT'); $controlBarLocation = $paramsC->get('med_controlbar'); $replaceAVparams = array($tagsource, substr(md5($tagsource), 1, 8), $afolder, $awidth, $aheight, $final_autoplay, $transparency, $background, $backgroundQT, $controlBarLocation, $live_site); $output->playerWidth = $awidth; $output->playerHeight = $aheight; } else { $vfolder = self::getImageDirforUser($user_id, 0) . "videos"; $transparency = $paramsC->get('med_transparency'); $background = $paramsC->get('med_background'); $backgroundQT = $paramsC->get('med_backgroundQT'); $controlBarLocation = $paramsC->get('med_controlbar'); $replaceAVparams = array($tagsource, substr(md5($tagsource), 1, 8), $vfolder, $final_vwidth, $final_vheight, $final_autoplay, $transparency, $background, $backgroundQT, $controlBarLocation, $live_site); $output->playerWidth = $final_vwidth; $output->playerHeight = $final_vheight; } $output->playerID = 'AVPlayerID_' . substr(md5($tagsource), 1, 8); $output->player = JFilterOutput::ampReplace(str_replace($findAVparams, $replaceAVparams, $tagReplace[$plg_tag])); $output->playerEmbedHTML = preg_replace("#(\r|\t|\n|)#s", "", htmlentities($output->player, ENT_QUOTES)); // Download button if (isset($downloadLink) && $downloadLink) { if (in_array($plg_tag, array("flv", "swf", "wmv", "mov", "mp4", "3gp", "divx"))) { $output->downloadLink = $live_site . 'components' . DS . $option . DS . 'players' . DS . 'download.php?file=' . $vfolder . DS . $tagsource; //.'.'.$plg_tag; } elseif (in_array($plg_tag, array("mp3", "wma"))) { $output->downloadLink = $live_site . 'components' . DS . $option . DS . 'players' . DS . 'download.php?file=' . $afolder . DS . $tagsource; //.'.'.$plg_tag; } else { $output->downloadLink = ''; } } else { $output->downloadLink = ''; } // Lightbox popup if (isset($lightboxLink) && $lightboxLink && !in_array($plg_tag, array("mp3", "mp3remote", "wma", "wmaremote"))) { // video formats only $output->lightboxLink = '#' . $output->playerID; } else { $output->lightboxLink = ''; } // Embed form if (isset($embedForm) && $embedForm && !in_array($plg_tag, array("wmv", "wmvremote", "wma", "wmaremote"))) { // no Windows Media formats $output->embedLink = 'embed_' . $output->playerID; } else { $output->embedLink = ''; } // Fetch the template ob_start(); if (!isset($plg_name)) { $plg_name = null; } $getTemplatePath = AllVideosHelper::getTemplatePath($plg_name, 'default.php'); $getTemplatePath = $getTemplatePath->file; include $getTemplatePath; $getTemplate = "<!-- Video Player Start -->" . ob_get_contents() . "<!-- Video Player End -->"; ob_end_clean(); // Do the replace $retval = preg_replace("#{" . $plg_tag . "}" . preg_quote($tagcontent) . "{/" . $plg_tag . "}#s", $getTemplate, $tagOrder); return $retval; } // end foreach } // end if } // END ALLVIDEOS LOOP }