AAAAadministrator/components/com_admirorgallery/views/imagemanager/scripts/imgManager-render-folder.php 0000604 00000043255 15137346410 0033630 0 ustar 00 home/academiac/www enqueueMessage(JText::_("AG_CANNOT_CREATE_FOLDER") . " " . $newFolderName, 'error');
}
function ag_render_caption($ag_lang_name, $ag_lang_tag, $ag_lang_content) {
return '
' . $ag_lang_name . ' / ' . $ag_lang_tag . '
';
}
$ag_preview_content = '';
$ag_preview_content.='
' . "\n";
$ag_preview_content.='
' . JText::_('AG_CURRENT_FOLDER') . '
' . $this->_renderBreadcrumb($ag_itemURL, $ag_starting_folder, $ag_folderName, $ag_fileName) . '
|
' . JText::_('AG_OPERATION_WITH_SELECTED_ITEMS') . '
|
|
|
' . JText::_('AG_EDIT_FOLDER_CAPTIONS') . '
' . "\n";
// Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
$ag_pathWithStripExt = JPATH_SITE . $ag_folderName . '/' . JFile::stripExt($ag_fileName);
$ag_XML_path = $ag_pathWithStripExt . ".XML";
if (JFIle::exists($ag_pathWithStripExt . ".xml")) {
$ag_XML_path = $ag_pathWithStripExt . ".xml";
}
// Load if XML exists
if (file_exists($ag_XML_path)) {
$ag_XML_xml = JFactory::getXMLParser('simple');
$ag_XML_xml->loadFile($ag_XML_path);
if ($ag_XML_xml->document->thumb[0]) {
$ag_XML_thumb = $ag_XML_xml->document->thumb[0]->data();
}
if ($ag_XML_xml->document->captions[0]) {
$ag_XML_captions = $ag_XML_xml->document->captions[0];
}
}
$ag_matchCheck = Array("default");
// GET DEFAULT LABEL
$ag_XML_caption_content = "";
if (!empty($ag_XML_captions->caption)) {
foreach ($ag_XML_captions->caption as $ag_imgXML_caption) {
if (strtolower($ag_imgXML_caption->attributes('lang')) == "default") {
$ag_XML_caption_content = $ag_imgXML_caption->data();
}
}
}
$ag_preview_content.= ag_render_caption("Default", "default", $ag_XML_caption_content);
// GET LABELS ON SITE LANGUAGES
$ag_lang_available = JLanguage::getKnownLanguages(JPATH_SITE);
if (!empty($ag_lang_available)) {
foreach ($ag_lang_available as $ag_lang) {
$ag_XML_caption_content = "";
if (!empty($ag_XML_captions->caption)) {
foreach ($ag_XML_captions->caption as $ag_imgXML_caption) {
if (strtolower($ag_imgXML_caption->attributes('lang')) == strtolower($ag_lang["tag"])) {
$ag_XML_caption_content = $ag_imgXML_caption->data();
$ag_matchCheck[] = strtolower($ag_lang["tag"]);
}
}
}
$ag_preview_content.= ag_render_caption($ag_lang["name"], $ag_lang["tag"], $ag_XML_caption_content);
}
}
if (!empty($ag_XML_captions->caption)) {
foreach ($ag_XML_captions->caption as $ag_imgXML_caption) {
$ag_imgXML_caption_attr = $ag_imgXML_caption->attributes('lang');
if (!is_numeric(array_search(strtolower($ag_imgXML_caption_attr), $ag_matchCheck))) {
$ag_preview_content.= ag_render_caption($ag_imgXML_caption_attr, $ag_imgXML_caption_attr, $ag_imgXML_caption->data());
}
}
}
$ag_preview_content.='
';
// RENDER FOLDERS
// CREATED SORTED ARRAY OF FOLDERS
$ag_files = JFolder::folders(JPATH_SITE . $ag_itemURL);
if (!empty($ag_files)) {
$ag_folders_priority = Array();
$ag_folders_noPriority = Array();
$ag_folders = Array();
foreach ($ag_files as $key => $value) {
$ag_folderName = $ag_itemURL;
$ag_fileName = basename($value);
// Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
$ag_pathWithStripExt = JPATH_SITE . $ag_folderName . JFile::stripExt($ag_fileName);
$ag_XML_path = $ag_pathWithStripExt . ".XML";
if (JFIle::exists($ag_pathWithStripExt . ".xml")) {
$ag_XML_path = $ag_pathWithStripExt . ".xml";
}
if (file_exists($ag_XML_path)) {
$ag_XML_xml = JFactory::getXMLParser('simple');
$ag_XML_xml->loadFile($ag_XML_path);
$ag_XML_priority = $ag_XML_xml->document->priority[0]->data();
}
if (!empty($ag_XML_priority) && file_exists($ag_XML_path)) {
$ag_folders_priority[$value] = $ag_XML_priority; // PRIORITIES IMAGES
} else {
$ag_folders_noPriority[] = $value; // NON PRIORITIES IMAGES
}
}
}
if (!empty($ag_folders_priority)) {
asort($ag_folders_priority);
foreach ($ag_folders_priority as $key => $value) {
$ag_folders[] = $key;
}
}
if (!empty($ag_folders_noPriority)) {
natcasesort($ag_folders_noPriority);
foreach ($ag_folders_noPriority as $key => $value) {
$ag_folders[] = $value;
}
}
if (!empty($ag_folders)) {
foreach ($ag_folders as $key => $value) {
$ag_hasXML = "";
$ag_hasThumb = "";
// Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
$ag_pathWithStripExt = JPATH_SITE . $ag_itemURL . JFile::stripExt(basename($value));
$ag_XML_path = $ag_pathWithStripExt . ".xml";
if (JFIle::exists($ag_pathWithStripExt . ".XML")) {
$ag_XML_path = $ag_pathWithStripExt . ".XML";
}
$ag_XML_visible = "AG_VISIBLE";
$ag_XML_priority = "";
if (file_exists($ag_XML_path)) {
$ag_hasXML = '
';
$ag_XML_xml = JFactory::getXMLParser('simple');
$ag_XML_xml = simplexml_load_file($ag_XML_path);
if (isset($ag_XML_xml->priority)) {
$ag_XML_priority = $ag_XML_xml->priority;
}
if (isset($ag_XML_xml->visible)) {
if ((string) $ag_XML_xml->visible == "false") {
$ag_XML_visible = "AG_HIDDEN";
}
}
}
$ag_preview_content.='
';
}
}
// RENDER IMAGES
// CREATED SORTED ARRAY OF IMAGES
$ag_files = JFolder::files(JPATH_SITE . $ag_itemURL);
$ag_ext_valid = array("jpg", "jpeg", "gif", "png"); // SET VALID IMAGE EXTENSION
if (!empty($ag_files)) {
$ag_images_priority = Array();
$ag_images_noPriority = Array();
$ag_images = Array();
foreach ($ag_files as $key => $value) {
if (is_numeric(array_search(strtolower(JFile::getExt(basename($value))), $ag_ext_valid))) {
$ag_folderName = $ag_itemURL;
$ag_fileName = basename($value);
// Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
$ag_pathWithStripExt = JPATH_SITE . $ag_folderName . JFile::stripExt($ag_fileName);
$ag_XML_path = $ag_pathWithStripExt . ".XML";
if (JFIle::exists($ag_pathWithStripExt . ".xml")) {
$ag_XML_path = $ag_pathWithStripExt . ".xml";
}
if (file_exists($ag_XML_path)) {
$ag_XML_xml = JFactory::getXMLParser('simple');
$ag_XML_xml->loadFile($ag_XML_path);
$ag_XML_priority = $ag_XML_xml->document->priority[0]->data();
}
if (!empty($ag_XML_priority) && file_exists($ag_XML_path)) {
$ag_images_priority[$value] = $ag_XML_priority; // PRIORITIES IMAGES
} else {
$ag_images_noPriority[] = $value; // NON PRIORITIES IMAGES
}
}
}
}
if (!empty($ag_images_priority)) {
asort($ag_images_priority);
foreach ($ag_images_priority as $key => $value) {
$ag_images[] = $key;
}
}
if (!empty($ag_images_noPriority)) {
natcasesort($ag_images_noPriority);
foreach ($ag_images_noPriority as $key => $value) {
$ag_images[] = $value;
}
}
if (!empty($ag_images)) {
foreach ($ag_images as $key => $value) {
$ag_hasXML = "";
$ag_hasThumb = "";
// Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
$ag_pathWithStripExt = JPATH_SITE . $ag_itemURL . JFile::stripExt(basename($value));
$ag_XML_path = $ag_pathWithStripExt . ".xml";
if (JFIle::exists($ag_pathWithStripExt . ".XML")) {
$ag_XML_path = $ag_pathWithStripExt . ".XML";
}
$ag_XML_visible = "AG_VISIBLE";
$ag_XML_priority = "";
if (file_exists($ag_XML_path)) {
$ag_hasXML = '
';
$ag_XML_xml = JFactory::getXMLParser('simple');
$ag_XML_xml = simplexml_load_file($ag_XML_path);
if (isset($ag_XML_xml->priority)) {
$ag_XML_priority = $ag_XML_xml->priority;
}
if (isset($ag_XML_xml->visible)) {
if ((string) $ag_XML_xml->visible == "false") {
$ag_XML_visible = "AG_HIDDEN";
}
}
}
if (file_exists(JPATH_SITE . "/plugins/content/admirorgallery/admirorgallery/thumbs/" . basename($ag_folderName) . "/" . basename($value))) {
$ag_hasThumb = '
';
}
agHelper::ag_createThumb(JPATH_SITE . $ag_itemURL . $value, $thumbsFolderPhysicalPath . DS . $value, 145, 80, "none");
$AG_thumb_checked = "";
if ($ag_XML_thumb == $value) {
$AG_thumb_checked = " CHECKED";
}
$ag_preview_content.='
';
}
}
if (empty($ag_folders) && empty($ag_images)) {
$ag_preview_content.= JText::_('AG_NO_FOLDERS_OR_IMAGES_FOUND_IN_CURRENT_FOLDER');
}
$AG_folderDroplist = "";
$ag_preview_content.='
';
?>