/** * Get geshi code types. * * @return array|null */ public function getCodeTypes() { if (!$this->config->highlightcode) { return null; } $paths = array( JPATH_ROOT.'/plugins/content/geshiall/geshi/geshi', JPATH_ROOT.'/plugins/content/geshi/geshi/geshi' ); foreach ($paths as $path) { if (!is_dir($path)) { continue; } $files = KunenaFolder::files($path, ".php"); $options = array(); $options[] = JHTML::_('select.option', '', JText::_('COM_KUNENA_EDITOR_CODE_TYPE')); foreach ($files as $file) { $options[] = JHTML::_('select.option', substr($file,0,-4), substr($file,0,-4)); } $list = JHTML::_('select.genericlist', $options, 'kcodetype', 'class="kbutton form-control"' , 'value', 'text', '-1' ); return $list; } return null; }
/** * @return array */ function getAllImagesInGallery() { $path = JPATH_ROOT . '/media/kunena/avatars/gallery'; $galleryFolders = KunenaFolder::folders($path); $files_list = array(); $defaultGallery = KunenaFolder::files($path); $newdefaultGallery = array(); foreach ($defaultGallery as $image) { if ($image != 'index.html') { $newdefaultGallery[] = $image; } } $files_list['default'] = json_encode($newdefaultGallery); foreach ($galleryFolders as $folder) { $tmp = KunenaFolder::files($path . '/' . $folder); $newgalleryFolders = array(); foreach ($tmp as $img) { if ($img != 'index.html') { $newgalleryFolders[] = $img; } } $files_list[$folder] = json_encode($newgalleryFolders); } return $files_list; }
function getCodeTypes() { if (!$this->config->highlightcode) { return null; } $paths = array(JPATH_ROOT . '/plugins/content/geshiall/geshi/geshi', JPATH_ROOT . '/plugins/content/geshi/geshi/geshi'); foreach ($paths as $path) { if (!is_dir($path)) { continue; } $files = KunenaFolder::files($path, ".php"); $options = array(); $options[] = JHTML::_('select.option', '', JText::_('COM_KUNENA_EDITOR_CODE_TYPE')); foreach ($files as $file) { $options[] = JHTML::_('select.option', substr($file, 0, -4), substr($file, 0, -4)); } $javascript = "document.id('helpbox').set('value', '" . JText::_('COM_KUNENA_EDITOR_HELPLINE_CODETYPE', true) . "')"; $list = JHTML::_('select.genericlist', $options, 'kcodetype"', 'class="kbutton" onmouseover="' . $javascript . '"', 'value', 'text', '-1'); return $list; } return null; }
/** * Tries to find the extension manifest file and returns version * * @param $path $path Path to extension directory * * @return string Version number */ public function findExtensionVersion($path) { if (is_file($path)) { // Make array from the xml file $xmlfiles = array($path); } elseif (is_dir($path)) { // Get an array of all the XML files from the directory $xmlfiles = KunenaFolder::files($path, '\\.xml$', 1, true); } $version = null; if (!empty($xmlfiles)) { $installer = JInstaller::getInstance(); foreach ($xmlfiles as $file) { // Is it a valid Joomla installation manifest file? $manifest = $installer->isManifest($file); $newversion = $manifest ? (string) $manifest->version[0] : null; // We check all files just in case if there are more than one manifest file if (version_compare($newversion, $version, '>')) { $version = $newversion; } } } return $version; }
/** * Get files from selected gallery. * * @param string $path Absolute path for the gallery. * * @return array */ protected function getGallery($path) { return KunenaFolder::files($path, $this->imageFilter); }