Exemplo n.º 1
0
jimport('joomla.filesystem.file');
JHtml::_('behavior.framework');
JHTML::_('behavior.tooltip');
// Global constants
require JPATH_COMPONENT . '/includes/defines.php';
try {
    // Global functions
    require JPATH_COMPONENT . '/includes/loader.php';
} catch (Exception $e) {
    JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
    return;
}
/**
 * EasyCreator Version
 */
define('ECR_VERSION', EcrProjectHelper::parseXMLInstallFile(JPATH_COMPONENT_ADMINISTRATOR . DS . 'easycreator.xml')->version);
/**
 * Check the Joomla! version
 *
 * @Joomla!-version-check
 */
switch (ECR_JVERSION) {
    case '1.5':
    case '1.6':
    case '1.7':
        JFactory::getApplication()->enqueueMessage(sprintf(jgettext('EasyCreator %1$s is not compatible with Joomla! %2$s - Sorry.'), ECR_VERSION, ECR_JVERSION), 'error');
        return;
        break;
    case '2.5':
        //-- @Joomla!-compat 2.5
        ecrStylesheet('bootstrap');
Exemplo n.º 2
0
 /**
  * Read the Joomla! XML setup file.
  *
  * @return boolean
  */
 private function readJoomlaXml()
 {
     $fileName = EcrProjectHelper::findManifest($this);
     if (!$fileName) {
         $this->isValid = false;
         return false;
     }
     $data = EcrProjectHelper::parseXMLInstallFile(JPATH_ROOT . DS . $fileName);
     if (!$data) {
         return false;
     }
     $this->method = (string) $data->attributes()->method;
     foreach ($data as $key => $value) {
         $this->{$key} = (string) $value;
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * Register an existing project.
  *
  * @param string $type  Project type
  * @param string $name  Project name
  * @param string $scope Project scope e.g. admin, site
  *
  * @return EcrProjectBase on success | false on error
  */
 public function registerProject($type, $name, $scope = '')
 {
     //--Get component parameters
     $comParams = JComponentHelper::getParams('com_easycreator');
     //-- Setup logging
     $options = array();
     $opts = array('logging', 'hotlogging', 'files', 'profile');
     foreach ($opts as $o) {
         if ($comParams->get($o)) {
             $options[] = $o;
         }
     }
     $options['fileName'] = date('ymd_Hi') . '_register.log';
     $this->logger = EcrLogger::getInstance('ecr', $options);
     if (false == array_key_exists($type, EcrProjectHelper::getProjectTypes())) {
         JFactory::getApplication()->enqueueMessage(sprintf(jgettext('The project type %s is not defined yet'), $type), 'error');
         $this->setError(sprintf(jgettext('The project type %s is not defined yet'), $type));
         return false;
     }
     $project = EcrProjectHelper::newProject($type);
     $project->comName = $name;
     $project->scope = $scope;
     foreach (EcrEasycreator::$packFormats as $name => $ext) {
         if ($comParams->get($name)) {
             $project->buildOpts[$name] = '1';
         }
     }
     for ($i = 1; $i < 5; $i++) {
         $project->buildOpts['custom_name_' . $i] = $comParams->get('custom_name_' . $i);
     }
     //-- Set the Joomla! compatibility version to the version we are actually running on
     $project->JCompat = ECR_JVERSION;
     $xmlPath = EcrProjectHelper::findManifest($project);
     if (false == $xmlPath) {
         JFactory::getApplication()->enqueueMessage(jgettext('No manifest file found'), 'error');
         $this->setError(jgettext('No manifest file found'));
         return false;
     }
     $data = EcrProjectHelper::parseXMLInstallFile(JPATH_ROOT . DS . $xmlPath);
     $project->name = $data->name;
     $this->logger->log('Registering: ' . $project->type . ' - ' . $project->name . '<br />' . 'aka "' . $project->comName . '"<br />scope: ' . $project->scope);
     $pXml = $project->update();
     if (false == $pXml) {
         $this->logger->log('', 'Unable to create EasyCreator manifest');
         $this->logger->writeLog();
         return false;
     } else {
         $this->logger->log('EasyCreator manifest created');
         $this->logger->logFileWrite('', '', $pXml);
     }
     $this->logger->log('FINISHED');
     $this->logger->writeLog();
     return $project;
 }