/** * Method to get the field input markup. * * @return string The field input markup. */ function getInput() { t3import('core.admin.util'); $uri = str_replace(DS, "/", str_replace(JPATH_SITE, JURI::base(), dirname(__FILE__))); $uri = str_replace("/administrator", "", $uri); if (!defined('_JA_THEME')) { define('_JA_THEME', 1); $html = "<link href=\"{$uri}/assets/css/jathemesettings.css\" rel=\"stylesheet\" type=\"text/css\" />\n"; $html .= "<script type=\"text/javascript\" src=\"{$uri}/assets/js/jathemesettings.js\"></script>\n"; echo $html; } $objutil = new JAT3_AdminUtil(); $template = $objutil->template; $themes = $objutil->getThemes($template); $value = $this->value; $name = $this->fieldname; if ($value && $themes) { if ((!isset($themes['core']) || isset($themes['core']) && !in_array($value, $themes['core'])) && (!isset($themes['local']) || isset($themes['local']) && !in_array($value, $themes['local']))) { $value = isset($themes['local'][0]) ? $themes['local'][0] : $themes['core'][0]; } } $layout = dirname(__FILE__) . DS . 'tmpl' . DS . 'jathemesettings.php'; if (file_exists($layout)) { ob_start(); include $layout; $content = ob_get_clean(); return $content; } return ''; }
function fetchElement($name, $value, &$node, $control_name) { t3_import('core/admin/util'); if (!defined('_JA_THEME')) { define('_JA_THEME', 1); $uri = str_replace(DS, "/", str_replace(JPATH_SITE, JURI::base(), dirname(__FILE__))); $uri = str_replace("/administrator", "", $uri); JHTML::stylesheet('jathemesettings.css', $uri . "/assets/css/"); JHTML::script('jathemesettings.js', $uri . "/assets/js/"); } $objutil = new JAT3_AdminUtil(); $template = $objutil->get_active_template(); $themes = $objutil->getThemes($template); if ($value && $themes) { if ((!isset($themes['core']) || isset($themes['core']) && !in_array($value, $themes['core'])) && (!isset($themes['local']) || isset($themes['local']) && !in_array($value, $themes['local']))) { $value = isset($themes['local']) ? $themes['local'][0] : $themes['core'][0]; } } $layout = dirname(__FILE__) . DS . 'tmpl' . DS . 'jathemesettings.php'; if (file_exists($layout)) { ob_start(); require $layout; $content = ob_get_clean(); return $content; } return ''; }
function installTheme() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.archive'); jimport('joomla.filesystem.path'); $template = JRequest::getCmd('template'); $path = JPATH_SITE . DS . 'templates' . DS . $template; if (!$template || !JFolder::exists($path)) { ?> <script type="text/javascript"> window.document.errorUpload('<span class="err" style="color:red"><?php echo JText::_('Template not define.'); ?> </span>'); </script> <?php } global $mainframe; if (isset($_FILES['install_package']['name']) && $_FILES['install_package']['size'] > 0 && $_FILES['install_package']['tmp_name'] != '') { require_once dirname(__FILE__) . DS . 'admin' . DS . 'util.php'; $result = $this->_UploadTheme($template, $path); if (!is_array($result)) { ?> <script type="text/javascript"> window.parent.errorUpload('<span class="err" style="color:red"><?php echo $result; ?> </span>'); </script> <?php } else { $util = new JAT3_AdminUtil(); $themes = $util->getThemes($template); ?> <script type="text/javascript"> window.parent.stopUpload(<?php echo count($themes['local']); ?> , '<?php echo $result['name']; ?> ', '<?php echo @$result['version']; ?> ', '<?php echo @$result['creationdate']; ?> ', '<?php echo @$result['author']; ?> ', '<?php echo $template; ?> '); </script> <?php } exit; } else { ?> <script type="text/javascript"> window.parent.errorUpload('<span class="err" style="color:red"><?php echo JText::_('Uploaded file does not exist.'); ?> </span>'); </script> <?php exit; } }
} // Check if there aren't assgined page or isn't language if ($language != 'All' || !empty($pages)) { $arr_values[] = array($language, implode(', ', $pages), $profile); } } } } } $paramsFile = dirname(__FILE__) . DS . 'params.xml'; if (file_exists($paramsFile)) { /* For General Tab */ $paramsForm = JForm::getInstance('params', $paramsFile, array('control' => 'jform')); } /* For Themes Tab */ $themes = $obj->getThemes(); /* For Layouts Tab*/ $layouts = $obj->getLayouts(); /* Set tab default */ switch (JRequest::getCmd('tab')) { case 'profile': $numbertab = 2; break; case 'layout': $numbertab = 3; break; case 'theme': $numbertab = 4; break; case 'update': $numbertab = 5;