function getYoutubeGallery($galleryparams, $count, $byId) { $result = ''; $opt = explode(',', $galleryparams); if (count($opt) < 2) { return '<p>YoutubeGallery Theme Not Set</p>'; } $db = JFactory::getDBO(); if ($byId) { $listid = (int) $opt[0]; $themeid = (int) $opt[1]; $query_list = 'SELECT * FROM #__youtubegallery_videolists WHERE id=' . $listid . ' LIMIT 1'; $query_theme = 'SELECT * FROM #__youtubegallery_themes WHERE id=' . $themeid . ' LIMIT 1'; } else { $listname = trim($opt[0]); $themename = trim($opt[1]); $query_list = 'SELECT * FROM #__youtubegallery_videolists WHERE listname="' . $listname . '" LIMIT 1'; $query_theme = 'SELECT * FROM #__youtubegallery_themes WHERE themename="' . $themename . '" LIMIT 1'; } //Video List data $db->setQuery($query_list); if (!$db->query()) { die($db->stderr()); } $videolist_rows = $db->loadObjectList(); if (count($videolist_rows) == 0) { return '<p>Video list not found</p>'; } $videolist_row = $videolist_rows[0]; //Theme data $db->setQuery($query_theme); if (!$db->query()) { die($db->stderr()); } $theme_rows = $db->loadObjectList(); if (count($theme_rows) == 0) { return '<p>Theme not found</p>'; } $theme_row = $theme_rows[0]; $custom_itemid = 0; if (isset($opt[2])) { $custom_itemid = (int) $opt[2]; } $misc = new YouTubeGalleryMisc(); $misc->videolist_row = $videolist_row; $misc->theme_row = $theme_row; $total_number_of_rows = 0; $misc->update_playlist(); $videoid = JRequest::getVar('videoid'); if (!isset($videoid)) { $video = JRequest::getVar('video'); if (isset($video)) { $videoid = YouTubeGalleryMisc::getVideoIDbyAlias($video); } } if ($theme_row->playvideo == 1 and $videoid != '') { $theme_row->autoplay = 1; } $videoid_new = $videoid; $videolist = $misc->getVideoList_FromCache_From_Table($videoid_new, $total_number_of_rows); if ($videoid == '') { if ($theme_row->playvideo == 1 and $videoid_new != '') { $videoid = $videoid_new; } } $renderer = new YouTubeGalleryRenderer(); $result .= $renderer->render($videolist, $videolist_row, $theme_row, $total_number_of_rows, $videoid, $custom_itemid); return $result; }
if ($video != '') { $videoid = YouTubeGalleryMisc::getVideoIDbyAlias($video); } } if ($misc->theme_row->playvideo == 1 and $videoid != '') { $misc->theme_row->autoplay = 1; } $videoid_new = $videoid; $videolist = $misc->getVideoList_FromCache_From_Table($videoid_new, $total_number_of_rows); if ($videoid == '') { if ($misc->theme_row->playvideo == 1 and $videoid_new != '') { $videoid = $videoid_new; } } $custom_itemid = (int) $params->get('customitemid'); $renderer = new YouTubeGalleryRenderer(); $gallerymodule = $renderer->render($videolist, $misc->videolist_row, $misc->theme_row, $total_number_of_rows, $videoid, $custom_itemid); if ($params->get('allowcontentplugins')) { $o = new stdClass(); $o->text = $gallerymodule; $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $r = $dispatcher->trigger('onContentPrepare', array('com_content.article', &$o, &$params_, 0)); $gallerymodule = $o->text; } $align = $params->get('galleryalign'); switch ($align) { case 'left': $youtubegallerycode .= '<div style="float:left;position:relative;">' . $gallerymodule . '</div>'; break; case 'center':
<?php /** * YouTubeGallery Joomla! 1.5 Native Component * @version 4.2.1 * @author DesignCompass Corp <*****@*****.**> * @link http://www.joomlaboat.com * @GNU General Public License **/ // no direct access defined('_JEXEC') or die('Restricted access'); $params =& JComponentHelper::getParams('com_youtubegallery'); require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'render.php'; $renderer = new YouTubeGalleryRenderer(); $renderedcontent = $renderer->render($this->Model->gallery_list, $this->Model->misc->videolist_row, $this->Model->misc->theme_row, $this->Model->total_number_of_rows, $this->Model->videoid); if ($params->get('allowcontentplugins')) { $o = new stdClass(); $o->text = $renderedcontent; $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $params_ = null; $r = $dispatcher->trigger('onPrepareContent', array(&$o, $params_, 0)); $renderedcontent = $o->text; } $align = $params->get('align'); switch ($align) { case 'left': echo '<div style="float:left;">' . $renderedcontent . '</div>'; break; case 'center': echo '<div style="width:' . $this->Model->misc->theme_row->width . 'px;margin-left:auto;margin-right:auto;">' . $renderedcontent . '</div>';
/** * Get the message * @return actual youtube galley code */ public function getYoutubeGalleryCode() { require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; $errorreporting = (bool) YouTubeGalleryMisc::getSettingValue('errorreporting'); if ($errorreporting) { error_reporting(E_ALL); } else { error_reporting(0); } jimport('joomla.version'); $version = new JVersion(); $JoomlaVersionRelease = $version->RELEASE; $result = ''; $app = JFactory::getApplication(); $params = $app->getParams(); if (!isset($this->youtubegallerycode)) { if (JRequest::getInt('listid')) { //Shadow Box $listid = (int) JRequest::getInt('listid'); //Get Theme $m_themeid = (int) JRequest::getInt('mobilethemeid'); if ($m_themeid != 0) { if (YouTubeGalleryMisc::check_user_agent('mobile')) { $themeid = $m_themeid; } else { $themeid = (int) JRequest::getInt('themeid'); } } else { $themeid = (int) JRequest::getInt('themeid'); } } else { $listid = (int) $params->get('listid'); //Get Theme $m_themeid = (int) $params->get('mobilethemeid'); if ($m_themeid != 0) { if (YouTubeGalleryMisc::check_user_agent('mobile')) { $themeid = $m_themeid; } else { $themeid = (int) $params->get('themeid'); } } else { $themeid = (int) $params->get('themeid'); } } if ($listid != 0 and $themeid != 0) { $videoid = JRequest::getCmd('videoid'); require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'render.php'; $misc = new YouTubeGalleryMisc(); if (!$misc->getVideoListTableRow($listid)) { return '<p>No video found</p>'; } if (!$misc->getThemeTableRow($themeid)) { return '<p>No video found</p>'; } $renderer = new YouTubeGalleryRenderer(); $total_number_of_rows = 0; $misc->update_playlist(); if ($misc->theme_row->playvideo == 1 and $videoid != '') { $misc->theme_row->autoplay = 1; } $videoid_new = $videoid; $videolist = $misc->getVideoList_FromCache_From_Table($videoid_new, $total_number_of_rows); if ($videoid == '') { if ($videoid_new != '') { JRequest::setVar('videoid', $videoid_new); } if ($misc->theme_row->playvideo == 1 and $videoid_new != '') { $videoid = $videoid_new; } } $gallerymodule = $renderer->render($videolist, $misc->videolist_row, $misc->theme_row, $total_number_of_rows, $videoid); $align = $params->get('align'); switch ($align) { case 'left': $this->youtubegallerycode = '<div style="float:left;">' . $gallerymodule . '</div>'; break; case 'center': if ((int) $misc->theme_row->width > 0) { $this->youtubegallerycode = '<div style="width:' . $misc->theme_row->width . 'px;margin: 0 auto;">' . $gallerymodule . '</div>'; } else { $this->youtubegallerycode = $gallerymodule; } break; case 'right': $this->youtubegallerycode = '<div style="float:right;">' . $gallerymodule . '</div>'; break; default: $this->youtubegallerycode = $gallerymodule; break; } } elseif ($listid == 0 and $themeid != 0) { $this->youtubegallerycode = '<p>Youtube Gallery: List not selected.</p>'; } elseif ($themeid == 0 and $listid != 0) { $this->youtubegallerycode = '<p>Youtube Gallery: Theme not selected.</p>'; } else { $this->youtubegallerycode = '<p>Youtube Gallery: List and Theme not selected.</p>'; } } if ($params->get('allowcontentplugins')) { $o = new stdClass(); $o->text = $this->youtubegallerycode; $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $r = $dispatcher->trigger('onContentPrepare', array('com_content.article', &$o, &$params_, 0)); $this->youtubegallerycode = $o->text; } $result .= $this->youtubegallerycode; return $result; }