Ejemplo n.º 1
0
 /**
  * Get the message
  * @return actual youtube galley code
  */
 public function getYoutubeGalleryCode()
 {
     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
             //alteracao projeto portal padrao
             $listid = JRequest::getInt('listid');
             $themeid = JRequest::getInt('themeid');
             //fim alteracao projeto portal padrao
         } else {
             $listid = (int) $params->get('listid');
             $themeid = (int) $params->get('themeid');
         }
         if ($listid != 0 and $themeid != 0) {
             $videoid = JRequest::getVar('videoid');
             require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
             //alteracao projeto portal padrao
             require_once JPATH_SITE . DS . 'templates' . DS . 'padraogoverno01' . DS . 'html' . DS . 'mod_youtubegallery' . DS . '_render.php';
             // require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'render.php');
             //fim alteracao projeto portal padrao
             $misc = new YouTubeGalleryMisc();
             if (!$misc->getVideoListTableRow($listid)) {
                 //alteracao projeto portal padrao
                 return '<p>Nenhum v&iacute;deo encontrado.</p>';
             }
             //fim alteracao projeto portal padrao
             if (!$misc->getThemeTableRow($themeid)) {
                 //alteracao projeto portal padrao
                 return '<p>Nenhum v&iacute;deo encontrado.</p>';
             }
             //fim alteracao projeto portal padrao
             //alteracao projeto portal padrao
             // $renderer= new YouTubeGalleryRenderer;
             $renderer = new YouTubeGalleryRendererPortal();
             //fim alteracao projeto portal padrao
             $total_number_of_rows = 0;
             $misc->update_playlist();
             //if($misc->theme_row->openinnewwindow==4)
             //		$videoid=''; //Hot Video Switch
             //else
             $videoid = JRequest::getVar('videoid');
             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');
             //alteracao projeto portal padrao
             $this->youtubegallerycode = $gallerymodule;
             /*
                                             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;
             	
                                             }
             */
             //fim alteracao projeto portal padrao
         } 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;
 }
 $youtubegallerycode = '';
 $total_number_of_rows = 0;
 $misc->update_playlist();
 $videoid = JRequest::getCmd('videoid', '');
 if (!isset($videoid) or $videoid == '') {
     $video = JRequest::getVar('video', '');
     $video = preg_replace('/[^a-zA-Z0-9-_]+/', '', $video);
     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;
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }