function display($tpl = null) { $app = JFactory::getApplication(); $document =& JFactory::getDocument(); $this->params =& $app->getParams(); // PLUGIN WINDOW - we get information from plugin $get = ''; $get['map'] = JRequest::getVar('map', '', 'get', 'string'); // Multibox $get['mapwidth'] = JRequest::getVar('mapwidth', '', 'get', 'string'); $get['mapheight'] = JRequest::getVar('mapheight', '', 'get', 'string'); $this->tmpl['enable_multibox'] = $this->params->get('enable_multibox', 0); $this->tmpl['enable_multibox_iframe'] = 0; if ($get['mapwidth'] != '') { // Seems we are in iframe $this->tmpl['enable_multibox_iframe'] = 1; } $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); // CSS JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css'); if ($this->tmpl['enablecustomcss'] == 1) { JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css'); PhocaGalleryRenderFront::displayCustomCSS($this->tmpl['customcss']); } // PARAMS - Open window parameters - modal popup box or standard popup window $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); // Plugin information if (isset($get['map']) && $get['map'] != '') { $this->tmpl['detailwindow'] = $get['map']; } // Close and Reload links (for different window types) $close = PhocaGalleryRenderFront::renderCloseReloadDetail($this->tmpl['detailwindow']); $detail_window_close = $close['detailwindowclose']; $detail_window_reload = $close['detailwindowreload']; // PARAMS - Display Description in Detail window - set the font color $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); $this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff'); $this->tmpl['pgl'] = PhocaGalleryRenderInfo::getPhocaIc((int) $this->params->get('display_phoca_info', 1)); $description_lightbox_font_color = $this->params->get('description_lightbox_font_color', '#ffffff'); $description_lightbox_bg_color = $this->params->get('description_lightbox_bg_color', '#000000'); $description_lightbox_font_size = $this->params->get('description_lightbox_font_size', 12); $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); if ($this->tmpl['gallerymetakey'] != '') { $document->setMetaData('keywords', $this->tmpl['gallerymetakey']); } if ($this->tmpl['gallerymetadesc'] != '') { $document->setMetaData('description', $this->tmpl['gallerymetadesc']); } // NO SCROLLBAR IN DETAIL WINDOW if ($this->tmpl['detailwindow'] == 7) { } else { $document->addCustomTag("<style type=\"text/css\"> \n" . " html,body, .contentpane{overflow:hidden;background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " center, table {background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff;padding:5px} \n" . " </style> \n"); } // PARAMS - Get image height and width $this->tmpl['largemapwidth'] = (int) $this->params->get('front_modal_box_width', 680) - 20; $this->tmpl['largemapheight'] = (int) $this->params->get('front_modal_box_height', 560) - 20; // Multibox if (isset($get['mapwidth']) && $get['mapwidth'] != '') { $this->tmpl['largemapwidth'] = $get['mapwidth']; } if (isset($get['mapheight']) && $get['mapheight'] != '') { $this->tmpl['largemapheight'] = $get['mapheight']; } // $this->tmpl['googlemapsapikey'] = $this->params->get( 'google_maps_api_key', '' ); // MODEL $model =& $this->getModel(); $map = $model->getData(); phocagalleryimport('phocagallery.image.imagefront'); if (!empty($map)) { if (isset($map->filename) && $map->filename != '') { $file_thumbnail = PhocaGalleryImageFront::displayCategoryImageOrNoImage($map->filename, 'small'); $map->thumbnail = $file_thumbnail; } else { $map->thumbnail = ''; } if (isset($map->latitude) && $map->latitude != '' && $map->latitude != 0 && isset($map->longitude) && $map->longitude != '' && $map->longitude != 0) { } else { $map->longitude = ''; $map->latitude = ''; $map->zoom = 2; $map->geotitle = ''; } } // Second try to get category data if (empty($map) || $map->longitude == '' && $map->latitude == '' && $map->geotitle == '') { $map = $model->getDataCategory(); if (!empty($map)) { if (isset($map->latitude) && $map->latitude != '' && $map->latitude != 0 && isset($map->longitude) && $map->longitude != '' && $map->longitude != 0) { $map->thumbnail = ''; if ($map->geotitle == '') { $map->geotitle = $map->title; } } else { $map->longitude = ''; $map->latitude = ''; $map->zoom = 2; $map->geotitle = ''; } } else { $map->longitude = ''; $map->latitude = ''; $map->zoom = 2; $map->geotitle = ''; $map->catslug = ''; } } // Back button $this->tmpl['backbutton'] = ''; if ($this->tmpl['detailwindow'] == 7) { phocagalleryimport('phocagallery.image.image'); $formatIcon =& PhocaGalleryImage::getFormatIcon(); $this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $map->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int')) . '"' . ' title="' . JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY') . '">' . JHtml::_('image', 'components/com_phocagallery/assets/images/icon-up-images.' . $formatIcon, JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY')) . '</a></div>'; } // ASIGN $this->assignRef('tmpl', $this->tmpl); $this->assignRef('map', $map); $this->_prepareDocument($map); parent::display($tpl); }
function display($tpl = null) { $app = JFactory::getApplication(); $document =& JFactory::getDocument(); $this->params = $app->getParams(); $user =& JFactory::getUser(); $var['slideshow'] = JRequest::getVar('phocaslideshow', 0, '', 'int'); $var['download'] = JRequest::getVar('phocadownload', 0, '', 'int'); $uri =& JFactory::getURI(); $this->tmpl['action'] = $uri->toString(); $path = PhocaGalleryPath::getPath(); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->authorisedLevels(), $neededAccessLevels); // Information from the plugin - window is displayed after plugin action $get = array(); $get['detail'] = JRequest::getVar('detail', '', 'get', 'string'); $get['buttons'] = JRequest::getVar('buttons', '', 'get', 'string'); $get['ratingimg'] = JRequest::getVar('ratingimg', '', 'get', 'string'); $this->tmpl['picasa_correct_width_l'] = (int) $this->params->get('large_image_width', 640); $this->tmpl['picasa_correct_height_l'] = (int) $this->params->get('large_image_height', 480); $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); $this->tmpl['enable_multibox'] = $this->params->get('enable_multibox', 0); $this->tmpl['multibox_height'] = (int) $this->params->get('multibox_height', 560); $this->tmpl['multibox_width'] = (int) $this->params->get('multibox_width', 980); $this->tmpl['multibox_map_height'] = (int) $this->params->get('multibox_map_height', 300); $this->tmpl['multibox_map_width'] = (int) $this->params->get('multibox_map_width', 280); $this->tmpl['multibox_height_overflow'] = (int) $this->tmpl['multibox_height'] - 10; //padding $this->tmpl['multibox_left_bgcolor'] = $this->params->get('multibox_left_bgcolor', '#000000'); $this->tmpl['multibox_right_bgcolor'] = $this->params->get('multibox_right_bgcolor', '#ffffff'); $this->tmpl['multibox_comments_width'] = $this->params->get('multibox_comments_width', 300); $this->tmpl['multibox_comments_height'] = $this->params->get('multibox_comments_height', 600); $this->tmpl['multibox_thubms_box_width'] = $this->params->get('multibox_thubms_box_width', 300); $this->tmpl['multibox_thubms_count'] = $this->params->get('multibox_thubms_count', 4); $this->tmpl['large_image_width'] = $this->params->get('large_image_width', 640); $this->tmpl['large_image_height'] = $this->params->get('large_image_height', 640); $this->tmpl['multibox_fixed_cols'] = $this->params->get('multibox_fixed_cols', 1); $this->tmpl['display_multibox'] = $this->params->get('display_multibox', array(1, 2)); // CSS JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css'); if ($this->tmpl['enablecustomcss'] == 1) { JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css'); PhocaGalleryRenderFront::displayCustomCSS($this->tmpl['customcss']); } // Plugin information $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); if (isset($get['detail']) && $get['detail'] != '') { $this->tmpl['detailwindow'] = $get['detail']; } // Plugin information $this->tmpl['detailbuttons'] = $this->params->get('detail_buttons', 1); if (isset($get['buttons']) && $get['buttons'] != '') { $this->tmpl['detailbuttons'] = $get['buttons']; } // Close and Reload links (for different window types) $close = PhocaGalleryRenderFront::renderCloseReloadDetail($this->tmpl['detailwindow']); $this->tmpl['detailwindowclose'] = $close['detailwindowclose']; $this->tmpl['detailwindowreload'] = $close['detailwindowreload']; $this->tmpl['displaydescriptiondetail'] = $this->params->get('display_description_detail', 0); $this->tmpl['displaytitleindescription'] = $this->params->get('display_title_description', 0); $this->tmpl['descriptiondetailheight'] = $this->params->get('description_detail_height', 16); $this->tmpl['fontsizedesc'] = $this->params->get('font_size_desc', 11); $this->tmpl['fontcolordesc'] = $this->params->get('font_color_desc', '#333333'); $this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff'); $this->tmpl['descriptionlightboxfontcolor'] = $this->params->get('description_lightbox_font_color', '#ffffff'); $this->tmpl['descriptionlightboxbgcolor'] = $this->params->get('description_lightbox_bg_color', '#000000'); $this->tmpl['descriptionlightboxfontsize'] = $this->params->get('description_lightbox_font_size', 12); $this->tmpl['displayratingimg'] = $this->params->get('display_rating_img', 0); $this->tmpl['displayicondownload'] = $this->params->get('display_icon_download', 0); $this->tmpl['externalcommentsystem'] = $this->params->get('external_comment_system', 0); $this->tmpl['largewidth'] = $this->params->get('large_image_width', 640); $this->tmpl['largeheight'] = $this->params->get('large_image_height', 480); $this->tmpl['boxlargewidth'] = $this->params->get('front_modal_box_width', 680); $this->tmpl['boxlargeheight'] = $this->params->get('front_modal_box_height', 560); $this->tmpl['slideshow_delay'] = $this->params->get('slideshow_delay', 3000); $this->tmpl['slideshow_pause'] = $this->params->get('slideshow_pause', 2500); $this->tmpl['slideshowrandom'] = $this->params->get('slideshow_random', 0); $this->tmpl['slideshow_description'] = $this->params->get('slideshow_description', 'peekaboo'); $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); $this->tmpl['altvalue'] = $this->params->get('alt_value', 1); $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); $this->tmpl['display_tags_links'] = $this->params->get('display_tags_links', 0); $this->tmpl['ytb_display'] = $this->params->get('ytb_display', 0); $paramsFb = PhocaGalleryFbSystem::getCommentsParams($this->params->get('fb_comment_user_id', '')); // Facebook $this->tmpl['fb_comment_app_id'] = isset($paramsFb['fb_comment_app_id']) ? $paramsFb['fb_comment_app_id'] : ''; $this->tmpl['fb_comment_width'] = isset($paramsFb['fb_comment_width']) ? $paramsFb['fb_comment_width'] : 550; $this->tmpl['fb_comment_lang'] = isset($paramsFb['fb_comment_lang']) ? $paramsFb['fb_comment_lang'] : 'en_US'; $this->tmpl['fb_comment_count'] = isset($paramsFb['fb_comment_count']) ? $paramsFb['fb_comment_count'] : ''; $oH = ''; if ($this->tmpl['enable_multibox'] == 1) { $this->tmpl['fb_comment_width'] = $this->tmpl['multibox_comments_width']; $oH = 'overflow:hidden;'; } // CSS JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css'); if ($this->tmpl['enablecustomcss'] == 1) { JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css'); if ($this->tmpl['customcss'] != '') { $document->addCustomTag("\n <style type=\"text/css\"> \n" . $this->escape(strip_tags($this->tmpl['customcss'])) . "\n </style> \n"); } } //Multibox displaying $this->tmpl['mb_title'] = PhocaGalleryUtils::isEnabledMultiboxFeature(1); $this->tmpl['mb_desc'] = PhocaGalleryUtils::isEnabledMultiboxFeature(2); $this->tmpl['mb_uploaded_by'] = PhocaGalleryUtils::isEnabledMultiboxFeature(3); $this->tmpl['mb_rating'] = PhocaGalleryUtils::isEnabledMultiboxFeature(4); $this->tmpl['mb_maps'] = PhocaGalleryUtils::isEnabledMultiboxFeature(5); $this->tmpl['mb_tags'] = PhocaGalleryUtils::isEnabledMultiboxFeature(6); $this->tmpl['mb_comments'] = PhocaGalleryUtils::isEnabledMultiboxFeature(7); $this->tmpl['mb_thumbs'] = PhocaGalleryUtils::isEnabledMultiboxFeature(8); // No bar in Detail View if ($this->tmpl['detailwindow'] == 7) { } else { $document->addCustomTag("<style type=\"text/css\"> \n" . " html, body, .contentpane, #all, #main {" . $oH . "background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";padding:0px !important;margin:0px !important; width: 100% !important; max-width: 100% !important;} \n" . " center, table {background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff;padding:5px} \n" . "body {min-width:100%} \n" . ".rt-container {width:100%} \n" . " </style> \n"); } // Download from the detail view which is not in the popupbox if ($var['download'] == 2) { $this->tmpl['displayicondownload'] = 2; } // Plugin Information if (isset($get['ratingimg']) && $get['ratingimg'] != '') { $this->tmpl['displayratingimg'] = $get['ratingimg']; } // Model $model =& $this->getModel(); $item = $model->getData(); //Multibox Thumbnails $this->tmpl['mb_thumbs_data'] = ''; if ($this->tmpl['mb_thumbs'] == 1) { // if we get item variable, we have rights to load the thumbnails, this is why we checking it if (isset($item->id) && isset($item->catid) && (int) $item->id > 0 && (int) $item->catid > 0) { $this->tmpl['mb_thumbs_data'] = $model->getThumbnails((int) $item->id, (int) $item->catid, (int) $item->ordering); } } // User Avatar $this->tmpl['useravatarimg'] = ''; $this->tmpl['useravatarmiddle'] = ''; $userAvatar = PhocaGalleryUser::getUserAvatar($item->userid); if ($userAvatar) { $pathAvatarAbs = $path->avatar_abs . 'thumbs' . DS . 'phoca_thumb_s_' . $userAvatar->avatar; $pathAvatarRel = $path->avatar_rel . 'thumbs/phoca_thumb_s_' . $userAvatar->avatar; if (JFile::exists($pathAvatarAbs)) { $sIH = $this->params->get('small_image_height', 50); $sIHR = @getImageSize($pathAvatarAbs); if (isset($sIHR[1])) { $sIH = $sIHR[1]; } if ((int) $sIH > 0) { $this->tmpl['useravatarmiddle'] = (int) $sIH / 2 - 10; } $this->tmpl['useravatarimg'] = '<img src="' . JURI::base(true) . '/' . $pathAvatarRel . '?imagesid=' . md5(uniqid(time())) . '" alt="" />'; } } // Access check - don't display the image if you have no access to this image (if user add own url) // USER RIGHT - ACCESS - - - - - - - - - - $rightDisplay = 0; if (!empty($item)) { $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $item->cataccessuserid, $item->cataccess, $user->authorisedLevels(), $user->get('id', 0), 0); } if ((int) $rightDisplay == 0) { echo $close['html']; //Some problem with cache - Joomla! return this message if there is no reason for do it. //$this->tmpl['pl'] = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); //$app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); exit; } // - - - - - - - - - - - - - - - - - - - - phocagalleryimport('phocagallery.image.image'); phocagalleryimport('phocagallery.render.renderdetailbutton'); // Javascript Slideshow buttons $detailButton = new PhocaGalleryRenderDetailButton(); if ($this->tmpl['enable_multibox'] == 1) { $detailButton->setType('multibox'); } $item->reloadbutton = $detailButton->getReload($item->catslug, $item->slug); $item->closebutton = $detailButton->getClose($item->catslug, $item->slug); $item->closetext = $detailButton->getCloseText($item->catslug, $item->slug); $item->nextbutton = $detailButton->getNext((int) $item->catid, (int) $item->id, (int) $item->ordering); $item->nextbuttonhref = $detailButton->getNext((int) $item->catid, (int) $item->id, (int) $item->ordering, 1); $item->prevbutton = $detailButton->getPrevious((int) $item->catid, (int) $item->id, (int) $item->ordering); $slideshowData = $detailButton->getJsSlideshow((int) $item->catid, (int) $item->id, (int) $var['slideshow'], $item->catslug, $item->slug); $item->slideshowbutton = $slideshowData['icons']; $item->slideshowfiles = $slideshowData['files']; $item->slideshow = $var['slideshow']; $item->download = $var['download']; // ALT VALUE $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $item->title, $item->description, $item->metadesc); $item->altvalue = $altValue; // Get file thumbnail or No Image $item->filenameno = $item->filename; $item->filename = PhocaGalleryFile::getTitleFromFile($item->filename, 1); $item->filesize = PhocaGalleryFile::getFileSize($item->filenameno); $realImageSize = ''; $extImage = PhocaGalleryImage::isExtImage($item->extid); if ($extImage) { $item->extl = $item->extl; $item->exto = $item->exto; $realImageSize = PhocaGalleryImage::getRealImageSize($item->extl, '', 1); $item->imagesize = PhocaGalleryImage::getImageSize($item->exto, 1, 1); if ($item->extw != '') { $extw = explode(',', $item->extw); $item->extw = $extw[0]; } $correctImageRes = PhocaGalleryPicasa::correctSizeWithRate($item->extw, $item->exth, $this->tmpl['picasa_correct_width_l'], $this->tmpl['picasa_correct_height_l']); $item->linkimage = JHtml::_('image', $item->extl, $item->altvalue, array('width' => $correctImageRes['width'], 'height' => $correctImageRes['height'], 'class' => 'pg-detail-image')); $item->realimagewidth = $correctImageRes['width']; $item->realimageheight = $correctImageRes['height']; } else { $item->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large'); $item->linkimage = JHtml::_('image', $item->linkthumbnailpath, $item->altvalue, array('class' => 'pg-detail-image')); $realImageSize = PhocaGalleryImage::getRealImageSize($item->filenameno); $item->imagesize = PhocaGalleryImage::getImageSize($item->filenameno, 1); if (isset($realImageSize['w']) && isset($realImageSize['h'])) { $item->realimagewidth = $realImageSize['w']; $item->realimageheight = $realImageSize['h']; } else { $item->realimagewidth = $this->tmpl['largewidth']; $item->realimageheight = $this->tmpl['largeheight']; } } // Add Statistics $model->hit(JRequest::getVar('id', '', '', 'int')); // R A T I N G // Only registered (VOTES + COMMENTS) $this->tmpl['notregisteredimg'] = true; $this->tmpl['usernameimg'] = ''; if ($access > 0) { $this->tmpl['notregisteredimg'] = false; $this->tmpl['usernameimg'] = $user->name; } // VOTES Statistics Img if ((int) $this->tmpl['displayratingimg'] == 1 || $this->tmpl['mb_rating']) { $this->tmpl['votescountimg'] = 0; $this->tmpl['votesaverageimg'] = 0; $this->tmpl['voteswidthimg'] = 0; $votesStatistics = PhocaGalleryRateImage::getVotesStatistics((int) $item->id); if (!empty($votesStatistics->count)) { $this->tmpl['votescountimg'] = $votesStatistics->count; } if (!empty($votesStatistics->average)) { $this->tmpl['votesaverageimg'] = $votesStatistics->average; if ($this->tmpl['votesaverageimg'] > 0) { $this->tmpl['votesaverageimg'] = round((double) $this->tmpl['votesaverageimg'] / 0.5) * 0.5; $this->tmpl['voteswidthimg'] = 22 * $this->tmpl['votesaverageimg']; } else { $this->tmpl['votesaverageimg'] = (int) 0; // not float displaying } } if ((int) $this->tmpl['votescountimg'] > 1) { $this->tmpl['votestextimg'] = 'COM_PHOCAGALLERY_VOTES'; } else { $this->tmpl['votestextimg'] = 'COM_PHOCAGALLERY_VOTE'; } // Already rated? $this->tmpl['alreadyratedimg'] = PhocaGalleryRateImage::checkUserVote((int) $item->id, (int) $user->id); } // Tags $this->tmpl['displaying_tags_output'] = ''; if ($this->tmpl['display_tags_links'] == 1 || $this->tmpl['display_tags_links'] == 3 || $this->tmpl['mb_tags']) { if ($this->tmpl['detailwindow'] == 7) { $this->tmpl['displaying_tags_output'] = PhocaGalleryTag::displayTags($item->id); } else { $this->tmpl['displaying_tags_output'] = PhocaGalleryTag::displayTags($item->id, 1); } } // Back button $this->tmpl['backbutton'] = ''; if ($this->tmpl['detailwindow'] == 7) { phocagalleryimport('phocagallery.image.image'); $formatIcon =& PhocaGalleryImage::getFormatIcon(); $this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $item->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int')) . '"' . ' title="' . JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY') . '">' . JHtml::_('image', 'components/com_phocagallery/assets/images/icon-up-images.' . $formatIcon, JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY')) . '</a></div>'; } // ASIGN $this->assignRef('tmpl', $this->tmpl); $this->assignRef('item', $item); $this->_prepareDocument($item); if ($this->tmpl['enable_multibox'] == 1) { if ($item->download > 0) { if ($this->tmpl['displayicondownload'] == 2) { $backLink = 'index.php?option=com_phocagallery&view=category&id=' . $item->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int'); phocagalleryimport('phocagallery.file.filedownload'); if (isset($item->exto) && $item->exto != '') { PhocaGalleryFileDownload::download($item, $backLink, 1); } else { PhocaGalleryFileDownload::download($item, $backLink); } exit; } else { parent::display('multibox'); //parent::display('download'); } } else { if (isset($item->videocode) && $item->videocode != '' && $item->videocode != '0') { $item->videocode = PhocaGalleryYoutube::displayVideo($item->videocode); } parent::display('multibox'); } } else { if (isset($item->videocode) && $item->videocode != '' && $item->videocode != '0') { $item->videocode = PhocaGalleryYoutube::displayVideo($item->videocode); if ($this->tmpl['detailwindow'] != 7 && $this->tmpl['ytb_display'] == 1) { $document->addCustomTag("<style type=\"text/css\"> \n" . " html, body, .contentpane, div#all, div#main, div#system-message-container {padding: 0px !important;margin: 0px !important;} \n" . " div#sbox-window {background-color:#fff;padding: 0px;margin: 0px;} \n" . " </style> \n"); } parent::display('video'); } else { parent::display('slideshowjs'); if ($item->slideshow == 1) { parent::display('slideshow'); } else { if ($item->download > 0) { if ($this->tmpl['displayicondownload'] == 2) { $backLink = 'index.php?option=com_phocagallery&view=category&id=' . $item->catslug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int'); phocagalleryimport('phocagallery.file.filedownload'); if (isset($item->exto) && $item->exto != '') { PhocaGalleryFileDownload::download($item, $backLink, 1); } else { PhocaGalleryFileDownload::download($item, $backLink); } exit; } else { parent::display('download'); } } else { parent::display($tpl); } } } } }
function display($tpl = null) { $app = JFactory::getApplication(); // PLUGIN WINDOW - we get information from plugin $get = ''; $get['info'] = $app->input->get('info', '', 'string'); $this->itemId = $app->input->get('Itemid', 0, 'int'); $document = JFactory::getDocument(); $this->params = $app->getParams(); $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); // CSS PhocaGalleryRenderFront::renderAllCSS(); // PARAMS - Open window parameters - modal popup box or standard popup window $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0); // Plugin information if (isset($get['info']) && $get['info'] != '') { $this->tmpl['detailwindow'] = $get['info']; } // Close and Reload links (for different window types) $close = PhocaGalleryRenderFront::renderCloseReloadDetail($this->tmpl['detailwindow']); $detail_window_close = $close['detailwindowclose']; $detail_window_reload = $close['detailwindowreload']; // PARAMS - Display Description in Detail window - set the font color $this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff'); $description_lightbox_font_color = $this->params->get('description_lightbox_font_color', '#ffffff'); $description_lightbox_bg_color = $this->params->get('description_lightbox_bg_color', '#000000'); $description_lightbox_font_size = $this->params->get('description_lightbox_font_size', 12); $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); // NO SCROLLBAR IN DETAIL WINDOW /* $document->addCustomTag( "<style type=\"text/css\"> \n" ." html,body, .contentpane{overflow:hidden;background:".$this->tmpl['detailwindowbackgroundcolor'].";} \n" ." center, table {background:".$this->tmpl['detailwindowbackgroundcolor'].";} \n" ." #sbox-window {background-color:#fff;padding:5px} \n" ." </style> \n"); */ // PARAMS - Get image height and width $this->tmpl['boxlargewidth'] = $this->params->get('front_modal_box_width', 680); $this->tmpl['boxlargeheight'] = $this->params->get('front_modal_box_height', 560); $front_popup_window_width = $this->tmpl['boxlargewidth']; //since version 2.2 $front_popup_window_height = $this->tmpl['boxlargeheight']; //since version 2.2 if ($this->tmpl['detailwindow'] == 1) { $this->tmpl['windowwidth'] = $front_popup_window_width; $this->tmpl['windowheight'] = $front_popup_window_height; } else { //modal popup window $this->tmpl['windowwidth'] = $this->tmpl['boxlargewidth']; $this->tmpl['windowheight'] = $this->tmpl['boxlargeheight']; } $this->tmpl['largemapwidth'] = (int) $this->tmpl['windowwidth'] - 20; $this->tmpl['largemapheight'] = (int) $this->tmpl['windowheight'] - 20; $this->tmpl['googlemapsapikey'] = $this->params->get('google_maps_api_key', ''); $this->tmpl['exifinformation'] = $this->params->get('exif_information', 'FILE.FileName,FILE.FileDateTime,FILE.FileSize,FILE.MimeType,COMPUTED.Height,COMPUTED.Width,COMPUTED.IsColor,COMPUTED.ApertureFNumber,IFD0.Make,IFD0.Model,IFD0.Orientation,IFD0.XResolution,IFD0.YResolution,IFD0.ResolutionUnit,IFD0.Software,IFD0.DateTime,IFD0.Exif_IFD_Pointer,IFD0.GPS_IFD_Pointer,EXIF.ExposureTime,EXIF.FNumber,EXIF.ExposureProgram,EXIF.ISOSpeedRatings,EXIF.ExifVersion,EXIF.DateTimeOriginal,EXIF.DateTimeDigitized,EXIF.ShutterSpeedValue,EXIF.ApertureValue,EXIF.ExposureBiasValue,EXIF.MaxApertureValue,EXIF.MeteringMode,EXIF.LightSource,EXIF.Flash,EXIF.FocalLength,EXIF.SubSecTimeOriginal,EXIF.SubSecTimeDigitized,EXIF.ColorSpace,EXIF.ExifImageWidth,EXIF.ExifImageLength,EXIF.SensingMethod,EXIF.CustomRendered,EXIF.ExposureMode,EXIF.WhiteBalance,EXIF.DigitalZoomRatio,EXIF.FocalLengthIn35mmFilm,EXIF.SceneCaptureType,EXIF.GainControl,EXIF.Contrast,EXIF.Saturation,EXIF.Sharpness,EXIF.SubjectDistanceRange,GPS.GPSLatitudeRef,GPS.GPSLatitude,GPS.GPSLongitudeRef,GPS.GPSLongitude,GPS.GPSAltitudeRef,GPS.GPSAltitude,GPS.GPSTimeStamp,GPS.GPSStatus,GPS.GPSMapDatum,GPS.GPSDateStamp'); // MODEL $model = $this->getModel(); $info = $model->getData(); // Back button $this->tmpl['backbutton'] = ''; if ($this->tmpl['detailwindow'] == 7) { phocagalleryimport('phocagallery.image.image'); $this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $info->catslug . '&Itemid=' . $app->input->get('Itemid', 0, 'int')) . '"' . ' title="' . JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY') . '">' . JHtml::_('image', 'media/com_phocagallery/images/icon-up-images.png', JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY')) . '</a></div>'; } // EXIF DATA $outputExif = ''; $originalFile = ''; $extImage = PhocaGalleryImage::isExtImage($info->extid); if ($extImage && isset($info->exto) && $info->exto != '') { $originalFile = $info->exto; } else { if (isset($info->filename)) { $originalFile = PhocaGalleryFile::getFileOriginal($info->filename); } } if ($originalFile != '' && function_exists('exif_read_data')) { $exif = @exif_read_data($originalFile, 'IFD0'); if ($exif === false) { $outputExif .= JText::_('COM_PHOCAGALLERY_NO_HEADER_DATA_FOUND'); } $setExif = $this->tmpl['exifinformation']; $setExifArray = explode(",", $setExif, 200); $exif = @exif_read_data($originalFile, 0, true); /* $infoOutput = ''; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { $infoOutput .= strtoupper($key.'.'.$name).'='.$name.'<br />'; $infoOutput .= $key.'.'.$name.';'; } }*/ $infoOutput = ''; $i = 0; foreach ($setExifArray as $ks => $vs) { if ($i % 2 == 0) { $class = 'class="first"'; } else { $class = 'class="second"'; } if ($vs != '') { $vsValues = explode(".", $vs, 2); if (isset($vsValues[0])) { $section = $vsValues[0]; } else { $section = ''; } if (isset($vsValues[1])) { $name = $vsValues[1]; } else { $name = ''; } if ($section != '' && $name != '') { if (isset($exif[$section][$name])) { switch ($name) { case 'FileDateTime': jimport('joomla.utilities.date'); $date = new JDate($exif[$section][$name]); $exifValue = $date->format('d/m/Y, H:m'); break; case 'FileSize': $exifValue = PhocaGalleryFile::getFileSizeReadable($exif[$section][$name]); break; case 'Height': case 'Width': case 'ExifImageWidth': case 'ExifImageLength': $exifValue = $exif[$section][$name] . ' px'; break; case 'IsColor': switch ((int) $exif[$section][$name]) { case 0: $exifValue = JText::_('COM_PHOCAGALLERY_NO'); break; default: $exifValue = JText::_('COM_PHOCAGALLERY_YES'); break; } break; case 'ResolutionUnit': switch ((int) $exif[$section][$name]) { case 2: $exifValue = JText::_('COM_PHOCAGALLERY_INCH'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_CM'); break; case 4: $exifValue = JText::_('COM_PHOCAGALLERY_MM'); break; case 5: $exifValue = JText::_('COM_PHOCAGALLERY_MICRO'); break; case 0: case 1: default: $exifValue = '?'; break; } break; case 'ExposureProgram': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_MANUAL'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_NORMAL_PROGRAM'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_APERTURE_PRIORITY'); break; case 4: $exifValue = JText::_('COM_PHOCAGALLERY_SHUTTER_PRIORITY'); break; case 5: $exifValue = JText::_('COM_PHOCAGALLERY_CREATIVE_PROGRAM'); break; case 6: $exifValue = JText::_('COM_PHOCAGALLERY_ACTION_PROGRAM'); break; case 7: $exifValue = JText::_('COM_PHOCAGALLERY_PORTRAIT_MODE'); break; case 8: $exifValue = JText::_('COM_PHOCAGALLERY_LANDSCAPE_MODE'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_NOT_DEFINED'); break; } break; case 'MeteringMode': switch ((int) $exif[$section][$name]) { case 0: $exifValue = JText::_('COM_PHOCAGALLERY_UNKNOWN'); break; case 1: $exifValue = JText::_('COM_PHOCAGALLERY_AVERAGE'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_CENTERWEIGHTEDAVERAGE'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_SPOT'); break; case 4: $exifValue = JText::_('COM_PHOCAGALLERY_MULTISPOT'); break; case 5: $exifValue = JText::_('COM_PHOCAGALLERY_PATTERN'); break; case 6: $exifValue = JText::_('COM_PHOCAGALLERY_PARTIAL'); break; case 255: default: $exifValue = JText::_('COM_PHOCAGALLERY_OTHER'); break; } break; case 'LightSource': switch ((int) $exif[$section][$name]) { case 0: $exifValue = JText::_('COM_PHOCAGALLERY_UNKNOWN'); break; case 1: $exifValue = JText::_('COM_PHOCAGALLERY_DAYLIGHT'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_FLUORESCENT'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_TUNGSTEN'); break; case 4: $exifValue = JText::_('COM_PHOCAGALLERY_FLASH'); break; case 9: $exifValue = JText::_('COM_PHOCAGALLERY_FINEWEATHER'); break; case 10: $exifValue = JText::_('COM_PHOCAGALLERY_CLOUDYWEATHER'); break; case 11: $exifValue = JText::_('COM_PHOCAGALLERY_SHADE'); break; case 12: $exifValue = JText::_('COM_PHOCAGALLERY_DAYLIGHTFLUORESCENT'); break; case 13: $exifValue = JText::_('COM_PHOCAGALLERY_DAYWHITEFLUORESCENT'); break; case 14: $exifValue = JText::_('COM_PHOCAGALLERY_COOLWHITEFLUORESCENT'); break; case 15: $exifValue = JText::_('COM_PHOCAGALLERY_WHITEFLUORESCENT'); break; case 17: $exifValue = JText::_('COM_PHOCAGALLERY_STANDARDLIGHTA'); break; case 18: $exifValue = JText::_('COM_PHOCAGALLERY_STANDARDLIGHTB'); break; case 19: $exifValue = JText::_('COM_PHOCAGALLERY_STANDARDLIGHTC'); break; case 20: $exifValue = JText::_('COM_PHOCAGALLERY_D55'); break; case 21: $exifValue = JText::_('COM_PHOCAGALLERY_D65'); break; case 22: $exifValue = JText::_('COM_PHOCAGALLERY_D75'); break; case 23: $exifValue = JText::_('COM_PHOCAGALLERY_D50'); break; case 24: $exifValue = JText::_('COM_PHOCAGALLERY_ISOSTUDIOTUNGSTEN'); break; case 255: default: $exifValue = JText::_('COM_PHOCAGALLERY_OTHERLIGHTSOURCE'); break; } break; case 'SensingMethod': switch ((int) $exif[$section][$name]) { case 2: $exifValue = JText::_('COM_PHOCAGALLERY_ONE-CHIP_COLOR_AREA_SENSOR'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_TWO-CHIP_COLOR_AREA_SENSOR'); break; case 4: $exifValue = JText::_('COM_PHOCAGALLERY_THREE-CHIP_COLOR_AREA_SENSOR'); break; case 5: $exifValue = JText::_('COM_PHOCAGALLERY_COLOR_SEQUENTIAL_AREA_SENSOR'); break; case 7: $exifValue = JText::_('COM_PHOCAGALLERY_TRILINEAR_SENSOR'); break; case 8: $exifValue = JText::_('COM_PHOCAGALLERY_COLOR_SEQUENTIAL_LINEAR_SENSOR'); break; case 1: default: $exifValue = JText::_('COM_PHOCAGALLERY_NOT_DEFINED'); break; } break; case 'CustomRendered': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_CUSTOM_PROCESS'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_NORMAL_PROCESS'); break; } break; case 'ExposureMode': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_MANUAL_EXPOSURE'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_AUTO_BRACKET'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_AUTO_EXPOSURE'); break; } break; case 'WhiteBalance': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_MANUAL_WHITE_BALANCE'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_AUTO_WHITE_BALANCE'); break; } break; case 'SceneCaptureType': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_LANDSCAPE'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_PORTRAIT'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_NIGHT_SCENE'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_STANDARD'); break; } break; case 'GainControl': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_LOW_GAIN_UP'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_HIGH_GAIN_UP'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_LOW_GAIN_UP'); break; case 4: $exifValue = JText::_('COM_PHOCAGALLERY_HIGH_GAIN_UP'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_NONE'); break; } break; case 'ColorSpace': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_SRGB'); break; case 'FFFF.H': $exifValue = JText::_('COM_PHOCAGALLERY_UNCALIBRATED'); break; case 0: default: $exifValue = '-'; break; } break; case 'Contrast': case 'Sharpness': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_SOFT'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_HARD'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_NORMAL'); break; } break; case 'Saturation': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_LOW_SATURATION'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_HIGH_SATURATION'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_NORMAL'); break; } break; case 'SubjectDistanceRange': switch ((int) $exif[$section][$name]) { case 1: $exifValue = JText::_('COM_PHOCAGALLERY_MACRO'); break; case 2: $exifValue = JText::_('COM_PHOCAGALLERY_CLOSE_VIEW'); break; case 3: $exifValue = JText::_('COM_PHOCAGALLERY_DISTANT_VIEW'); break; case 0: default: $exifValue = JText::_('COM_PHOCAGALLERY_UNKNOWN'); break; } break; case 'GPSLatitude': case 'GPSLongitude': $exifValue = ''; if (isset($exif[$section][$name][0])) { list($l, $r) = explode("/", $exif[$section][$name][0]); $d = $l / $r; $exifValue .= $d . '° '; } if (isset($exif[$section][$name][1])) { list($l, $r) = explode("/", $exif[$section][$name][1]); $m = $l / $r; if ($l % $r > 0) { $sNoInt = $l / $r; $sInt = $l / $r; $s = ($sNoInt - (int) $sInt) * 60; $exifValue .= (int) $m . '\' ' . $s . '" '; } else { $exifValue .= $m . '\' '; if (isset($exif[$section][$name][2])) { list($l, $r) = explode("/", $exif[$section][$name][2]); $s = $l / $r; $exifValue .= $s . '" '; } } } break; case 'GPSTimeStamp': $exifValue = ''; if (isset($exif[$section][$name][0])) { list($l, $r) = explode("/", $exif[$section][$name][0]); $h = $l / $r; $exifValue .= $h . ' h '; } if (isset($exif[$section][$name][1])) { list($l, $r) = explode("/", $exif[$section][$name][1]); $m = $l / $r; $exifValue .= $m . ' m '; } if (isset($exif[$section][$name][2])) { list($l, $r) = explode("/", $exif[$section][$name][2]); $s = $l / $r; $exifValue .= $s . ' s '; } break; case 'ExifVersion': if (is_numeric($exif[$section][$name])) { $exifValue = (int) $exif[$section][$name] / 100; } else { $exifValue = $exif[$section][$name]; } break; case 'FocalLength': if (isset($exif[$section][$name]) && $exif[$section][$name] != '') { $focalLength = explode('/', $exif[$section][$name]); if (isset($focalLength[0]) && (int) $focalLength[0] > 0 && isset($focalLength[1]) && (int) $focalLength[1] > 0) { $exifValue = (int) $focalLength[0] / (int) $focalLength[1]; $exifValue = $exifValue . ' mm'; } } break; case 'ExposureTime': if (isset($exif[$section][$name]) && $exif[$section][$name] != '') { $exposureTime = explode('/', $exif[$section][$name]); if (isset($exposureTime[0]) && (int) $exposureTime[0] > 0 && isset($exposureTime[1]) && (int) $exposureTime[1] > 1) { if ((int) $exposureTime[1] > (int) $exposureTime[0]) { $exifValue = (int) $exposureTime[1] / (int) $exposureTime[0]; $exifValue = '1/' . $exifValue . ' sec'; } } } break; /*case 'ShutterSpeedValue': if (isset($exif[$section][$name]) && $exif[$section][$name] != '') { $shutterSpeedValue = explode ('/', $exif[$section][$name]); if (isset($shutterSpeedValue[0]) && (int)$shutterSpeedValue[0] > 0 && isset($shutterSpeedValue[1]) && (int)$shutterSpeedValue[1] > 1 ) { if ((int)$shutterSpeedValue[1] > (int)$shutterSpeedValue[0]) { $exifValue = (int)$shutterSpeedValue[1] / (int)$shutterSpeedValue[0]; $exifValue = '1/'. $exifValue . ' sec'; } } } break;*/ /*case 'ShutterSpeedValue': if (isset($exif[$section][$name]) && $exif[$section][$name] != '') { $shutterSpeedValue = explode ('/', $exif[$section][$name]); if (isset($shutterSpeedValue[0]) && (int)$shutterSpeedValue[0] > 0 && isset($shutterSpeedValue[1]) && (int)$shutterSpeedValue[1] > 1 ) { if ((int)$shutterSpeedValue[1] > (int)$shutterSpeedValue[0]) { $exifValue = (int)$shutterSpeedValue[1] / (int)$shutterSpeedValue[0]; $exifValue = '1/'. $exifValue . ' sec'; } } } break;*/ default: $exifValue = $exif[$section][$name]; break; } $vs = str_replace('.', '_', $vs); $infoOutput .= '<tr ' . $class . '>' . '<td>' . JText::_('COM_PHOCAGALLERY_' . strtoupper($vs)) . '</td>' . '<td>' . $exifValue . '</td>' . '</tr>'; } } } $i++; } } // ASIGN $this->assignRef('tmpl', $this->tmpl); $this->assignRef('infooutput', $infoOutput); // $this->assignRef( 'infooutput', $infoOutput ); $this->_prepareDocument($info); parent::display($tpl); }