Ejemplo n.º 1
1
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     /*
      * Check for evil IE
      * sry - no support for this in penguin land =;)
      */
     jimport('joomla.environment.browser');
     $browser = new JBrowser();
     if ($browser->getBrowser() == 'msie') {
         JFactory::getApplication()->enqueueMessage(jgettext('This extension is not compatible with MS internet explorer R'), 'warning');
     }
     //-- Check if we are on localhost - otherwise display a warning
     if (JComponentHelper::getParams('com_easycreator')->get('warn_livesite')) {
         $ip = getenv('REMOTE_ADDR');
         if ($ip && false == in_array($ip, array('127.0.0.1', '::1'))) {
             JFactory::getApplication()->enqueueMessage(jgettext('Please use this extension only in local development environments.'), 'warning');
             JFactory::getApplication()->enqueueMessage(sprintf(jgettext("See: <a href=\"%s\">docs.joomla.org/Setting up your workstation for Joomla! development</a>"), 'http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development'), 'warning');
             JFactory::getApplication()->enqueueMessage(jgettext('You may suppress this message in the configuration settings if you\'re shure'), 'warning');
         }
     }
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 2
0
 /**
  * Method to create the manifest file.
  *
  * @param EcrProjectBase $project The project.
  *
  * @return boolean true on success
  */
 public function create(EcrProjectBase $project)
 {
     if (!$project->type) {
         $this->setError(__METHOD__ . ' - Invalid project given');
         return false;
     }
     $this->project = $project;
     $this->manifest = new EcrXMLElement('<?xml version="1.0" encoding="utf-8" ?><extension />');
     if (false == $this->manifest instanceof EcrXMLElement) {
         $this->setError('Could not create XML builder');
         return false;
     }
     try {
         $this->setUp()->processCredits()->processInstall()->processUpdates()->processSite()->processAdmin()->processMedia()->processPackageModules()->processPackagePlugins()->processPackageElements()->processParameters();
     } catch (Exception $e) {
         EcrHtml::message($e);
         return false;
     }
     if ($this->project->isNew) {
         //--New project
         $path = JPath::clean($this->project->basepath . '/' . $this->project->getJoomlaManifestName());
     } else {
         //--Building project
         $path = JPath::clean($this->project->basepath . '/' . JFile::getName(EcrProjectHelper::findManifest($this->project)));
     }
     $xml = $this->formatXML();
     if (false == JFile::write($path, $xml)) {
         $this->setError('Could not save XML file!');
         return false;
     }
     return true;
 }
Ejemplo n.º 3
0
 /**
  * Get insert options.
  *
  * @return void|boolean false on error
  */
 public function getOptions()
 {
     $ecr_project = JFactory::getApplication()->input->get('ecr_project');
     $basePathDest = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . $ecr_project;
     if (JFile::exists($basePathDest . DS . 'CHANGELOG.php')) {
         EcrHtml::message(jgettext('This project already has a changelog'), 'error');
         return false;
     }
     EcrHtmlOptions::logging();
     EcrHtmlButton::submitParts();
 }
Ejemplo n.º 4
0
 /**
  * Standard display method.
  *
  * @param string $tpl The name of the template file to parse;
  *
  * @return void
  */
 public function display($tpl = null)
 {
     try {
         $this->form = $this->get('Form');
         $this->legacyTemplate = version_compare(ECR_JVERSION, '3.0') < 0 ? '25' : 'default';
         parent::display($tpl);
     } catch (Exception $e) {
         EcrHtml::message($e);
     }
     EcrHtml::formEnd();
 }
Ejemplo n.º 5
0
 /**
  * Constructor.
  *
  * @param EcrProjectBase $project
  *
  * @throws DomainException
  */
 public function __construct(EcrProjectBase $project)
 {
     $this->project = $project;
     $comParams = JComponentHelper::getComponent('com_easycreator')->params;
     $this->localPath = $comParams->get('local_updateserver_dir');
     $this->serverUrl = $comParams->get('updateserver_url');
     $this->serverTitle = $comParams->get('updateserver_title');
     $this->releaseUrl = $comParams->get('updateserver_release_url') ?: $this->serverUrl;
     $this->developmentUrl = $comParams->get('updateserver_development_url') ?: $this->serverUrl;
     //-- Check the base directory
     if (false == JFolder::exists(ECRPATH_UPDATESERVER)) {
         if (false == JFolder::copy(JPATH_COMPONENT_ADMINISTRATOR . '/data/updateserver', ECRPATH_UPDATESERVER)) {
             throw new DomainException(sprintf('%s - Can not create the update server directory: %s', __METHOD__, ECRPATH_UPDATESERVER));
         }
         EcrHtml::message(sprintf(jgettext('The update server directory has been created in: %s'), ECRPATH_UPDATESERVER));
     }
     //-- Check the extension directory
     $base = ECRPATH_UPDATESERVER . '/' . $this->project->comName;
     if (false == JFolder::exists($base)) {
         if (false == JFolder::create($base)) {
             throw new DomainException(sprintf('%s - Can not create the extension update server directory: %s', __METHOD__, $base));
         }
         EcrHtml::message(sprintf(jgettext('The update server extension directory has been created in: %s'), $base));
         JFolder::create($base . '/release');
         JFolder::create($base . '/development');
         JFile::copy(ECRPATH_UPDATESERVER . '/index.html', $base . '/index.html');
         JFile::copy(ECRPATH_UPDATESERVER . '/template_extension.html', $base . '/template.html');
         JFile::copy(ECRPATH_UPDATESERVER . '/updateserver.css', $base . '/updateserver.css');
         JFile::copy(ECRPATH_UPDATESERVER . '/favicon.ico', $base . '/favicon.ico');
         /* @var SimpleXMLElement $xml */
         $xml = EcrProjectHelper::getXML('<updates/>', false);
         $xml->addChild('name', $this->project->name);
         $buffer = $xml->asFormattedXML();
         //-- @todo: The file name "extension.xml" is the J! default - customize.
         JFile::write($base . '/extension.xml', $buffer);
         JFile::write($base . '/development.xml', $buffer);
         $feed = new EcrProjectFeed();
         $feed->title = $this->serverTitle . ' - ' . $this->project->name . ' - Release Feed';
         $feed->link = $this->releaseUrl . '/release-feed.xml';
         $feed->id = $feed->link;
         $feed->author = 'XX-Author';
         $feed->updated = date(DATE_ATOM);
         $buffer = $feed->printPretty();
         JFile::write($base . '/release-feed.xml', $buffer);
         $feed->title = $this->serverTitle . ' - ' . $this->project->name . ' - Development Feed';
         $feed->link = $this->developmentUrl . '/development-feed.xml';
         $feed->id = $feed->link;
         $buffer = $feed->printPretty();
         JFile::write($base . '/development-feed.xml', $buffer);
         //-- Copy the Joomla! manifest
         JFile::copy($this->project->getJoomlaManifestPath() . '/' . $this->project->getJoomlaManifestName(), $base . '/manifest.xml');
         $this->update();
     }
 }
Ejemplo n.º 6
0
 /**
  * Standard display method.
  *
  * @param string $tpl The name of the template file to parse;
  *
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     switch (JFactory::getApplication()->input->get('task')) {
         case 'jhelp':
             $this->setLayout('jhelp');
             break;
         case 'help':
         default:
             break;
     }
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 7
0
 public function __get($what)
 {
     if (in_array($what, array())) {
         return $this->{$what};
     }
     if ('queryType' == $what) {
         if (isset($this->query->type)) {
             return $this->query->type;
         }
         return '';
     }
     EcrHtml::message(get_class($this) . ' - Undefined property: ' . $what, 'error');
 }
Ejemplo n.º 8
0
 /**
  * Get insert options.
  *
  * @return void|boolean false on error
  */
 public function getOptions()
 {
     // $project = EcrProjectHelper::getProject();
     $ecr_project = JFactory::getApplication()->input->get('ecr_project');
     $basePathDest = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . $ecr_project;
     if (JFile::exists($basePathDest . DS . 'install' . DS . 'script.php')) {
         EcrHtml::message(jgettext('This project already has an install file - consider removing it'), 'error');
         return false;
     }
     EcrHtmlOptions::logging();
     EcrHtmlButton::submitParts();
     return $this;
 }
Ejemplo n.º 9
0
 /**
  * Standard display method.
  *
  * @param null|string $tpl The name of the template file to parse;
  *
  * @throws Exception
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     $input = JFactory::getApplication()->input;
     ecrScript('stuffer');
     $this->ecr_project = $input->get('ecr_project');
     try {
         //-- Get the project
         $this->project = EcrProjectHelper::getProject();
         if ('package' == $this->project->type && !$this->project->creationDate) {
             //-- This is a hack to detect that a package has no install manifest :(
             throw new Exception(jgettext('Invalid project'));
         }
     } catch (Exception $e) {
         EcrHtml::message($e);
         EcrHtml::formEnd();
         return;
     }
     $task = $input->get('task', 'stuffer');
     $tmpl = $input->get('tmpl');
     //-- We are loosing the controller name when coming from other tasks - config :(
     $input->set('controller', 'stuffer');
     if ($task != 'display_snip' && $task != 'aj_reflection' && $tmpl != 'component') {
         //-- Draw h1 header
         //EcrHtml::header(jgettext('Configure'), $this->project, 'ecr_settings');
         //-- Draw the submenu if task is not for a raw view
         echo $this->displayBar($task);
     }
     if (in_array($task, get_class_methods($this))) {
         //-- Execute the task
         $this->{$task}();
         if ($task == 'display_snip') {
             //-- Raw view
             parent::display($tpl);
             return;
         }
     } else {
         if ($task) {
             echo 'UNDEFINED..' . $task . '<br />';
         }
         $this->stuffer();
     }
     $this->task = $task;
     $this->tmpl = $tmpl;
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 10
0
 /**
  * Register a Joomla! extension as an EasyCreator project.
  *
  * @return mixed Redirect on success | boolean false on error
  */
 public function register_project()
 {
     $input = JFactory::getApplication()->input;
     $builder = new EcrProjectBuilder();
     $type = $input->get('ecr_project_type');
     $name = $input->get('ecr_project_name');
     $scope = $input->get('ecr_project_scope');
     $project = $builder->registerProject($type, $name, $scope);
     if (false == $project) {
         //-- Error
         JFactory::getApplication()->enqueueMessage('Can not register project', 'error');
         $builder->printErrors();
         EcrHtml::formEnd();
         return false;
     }
     $ecr_project = JFile::stripExt($project->getEcrXmlFileName());
     $uri = 'index.php?option=com_easycreator&controller=stuffer&ecr_project=' . $ecr_project;
     $this->setRedirect($uri, jgettext('Your project has been registered'));
 }
Ejemplo n.º 11
0
 /**
  * Standard display method.
  *
  * @param null|string $tpl The name of the template file to parse;
  *
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     ecrLoadMedia('ziper');
     $task = JFactory::getApplication()->input->get('task');
     try {
         $this->project = EcrProjectHelper::getProject();
         $this->preset = $this->project->presets['default'];
     } catch (Exception $e) {
         EcrHtml::message($e);
         EcrHtml::formEnd();
         return;
     }
     if (in_array($task, get_class_methods($this))) {
         $this->{$task}();
     }
     //-- Draw the submenu
     echo $this->displayBar();
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 12
0
 /**
  * Save the configuration.
  *
  * @throws Exception
  * @return void
  */
 public function save_config()
 {
     try {
         $component = JComponentHelper::getComponent('com_easycreator');
         $table = JTable::getInstance('extension');
         $table->load($component->id);
         $params = JFactory::getApplication()->input->get('params', array(), 'array');
         if (!$table->bind(array('params' => $params)) || !$table->check() || !$table->store()) {
             throw new Exception($table->getError());
         }
         $ecr_project = JFactory::getApplication()->input->get('ecr_project');
         $adds = '';
         if (strpos($ecr_project, 'ecr') !== 0) {
             $adds = $ecr_project ? '&view=stuffer&ecr_project=' . $ecr_project : '';
         }
         $this->setRedirect('index.php?option=com_easycreator' . $adds, jgettext('Configuration has been saved'));
     } catch (Exception $e) {
         EcrHtml::message($e);
         EcrHtml::formEnd();
     }
 }
Ejemplo n.º 13
0
 /**
  * Standard display method.
  *
  * @param null|string $tpl The name of the template file to parse;
  *
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     $input = JFactory::getApplication()->input;
     $task = $input->get('task');
     $this->builder = new EcrProjectBuilder();
     ecrLoadMedia('wizard');
     $params = JComponentHelper::getParams('com_easycreator');
     $this->templateList = EcrProjectTemplateHelper::getTemplateList();
     $tplType = $input->get('tpl_type');
     $tplFolder = $input->get('tpl_name');
     $desc = isset($this->templateList[$tplType][$tplFolder]) ? $this->templateList[$tplType][$tplFolder]->description : '';
     $project = EcrProjectHelper::newProject('empty');
     $project->type = $input->get('tpl_type');
     $project->tplName = $input->get('tpl_name');
     $project->version = $input->getString('version', '1.0');
     $project->description = $input->getString('description', $desc);
     $project->listPostfix = $input->get('list_postfix', 'List');
     $project->JCompat = $input->getString('jcompat');
     //-- Sanitize project name
     $project->name = $input->get('com_name');
     $disallows = array('_');
     $project->name = str_replace($disallows, '', $project->name);
     //-- Credits
     $s = $input->getString('author');
     $project->author = $s ? $s : $params->get('cred_author');
     $s = $input->getString('authorEmail');
     $project->authorEmail = $s ? $s : $params->get('cred_author_email');
     $s = $input->getString('authorUrl');
     $project->authorUrl = $s ? $s : $params->get('cred_author_url');
     $s = $input->getString('license');
     $project->license = $s ? $s : $params->get('cred_license');
     $s = $input->getString('copyright');
     $project->copyright = $s ? $s : $params->get('cred_copyright');
     $this->project = $project;
     if ($task && method_exists($this, $task)) {
         $this->{$task}();
     }
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 14
0
 /**
  * Standard display method.
  *
  * @param string $tpl The name of the template file to parse;
  *
  * @return void
  */
 public function display($tpl = null)
 {
     $task = JFactory::getApplication()->input->get('task');
     echo $this->displayBar();
     if (in_array($task, get_class_methods($this))) {
         //-- Execute the task
         $this->{$task}();
     } else {
         if ($task) {
             echo 'UNDEFINED..' . $task . '<br />';
         }
     }
     if ($task == 'tplinstall') {
         //-- We end our form first, cause another one follows
         echo '<input type="hidden" name="com_type" /><input type="hidden" name="template" />';
         EcrHtml::formEnd(false);
         parent::display($tpl);
     } else {
         parent::display($tpl);
         EcrHtml::formEnd();
     }
 }
Ejemplo n.º 15
0
 /**
  * Edit AutoCode.
  *
  * @return void
  */
 public function edit()
 {
     $input = JFactory::getApplication()->input;
     try {
         //-- Get the project
         $project = EcrProjectHelper::getProject();
     } catch (Exception $e) {
         EcrHtml::message($e);
         return;
     }
     //try
     $group = $input->get('group');
     $part = $input->get('part');
     $element = $input->get('element');
     $scope = $input->get('scope');
     $key = "{$scope}.{$group}.{$part}.{$element}";
     $AutoCode = EcrProjectHelper::getAutoCode($key);
     if (!$AutoCode) {
         echo '<h4 style="color: red;">AutoCode not found</h4>';
         echo $key;
         return;
     }
     if (!method_exists($AutoCode, 'edit')) {
         echo '<h4 style="color: red;">EDIT function not found</h4>';
         echo $key;
         return;
     }
     if (!isset($project->autoCodes[$AutoCode->getKey()])) {
         echo '<h4 style="color: red;">AutoCode not found in project</h4>';
         echo $AutoCode->getKey();
         return;
     }
     echo '<div style="color: blue; font-weight: bold; text-align:center;">' . ucfirst($group) . ' - ' . ucfirst($part) . '</div>';
     //-- Additional request vars
     echo '<input type="hidden" name="group" value="' . $group . '" />';
     echo '<input type="hidden" name="part" value="' . $part . '" />';
     echo $AutoCode->edit($project->autoCodes[$AutoCode->getKey()]);
     return;
 }
Ejemplo n.º 16
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     //-- @Joomla!-version-check
     switch (ECR_JVERSION) {
         case '2.5':
             $this->reservedNames = array('cms', 'joomla', 'phpmailer', 'phputf8', 'simplepie');
             break;
         case '3.0':
         case '3.1':
             $this->reservedNames = array('cms', 'compat', 'joomla', 'legacy', 'phpmailer', 'phputf8', 'simplepie');
             break;
         case '3.2':
         case '3.3':
             $this->reservedNames = array('cms', 'compat', 'fof', 'framework', 'idna_convert', 'joomla', 'legacy', 'phpmailer', 'phputf8', 'simplepie');
             break;
         case '3.4':
             $this->reservedNames = array('cms', 'compat', 'fof', 'framework', 'idna_convert', 'joomla', 'legacy', 'phpmailer', 'phputf8', 'simplepie', 'vendor');
             break;
         default:
             EcrHtml::message(__METHOD__ . ' - Unknown J! version');
             break;
     }
 }
Ejemplo n.º 17
0
 /**
  * Standard display method.
  *
  * @param string $tpl The name of the template file to parse;
  *
  * @return void
  */
 public function display($tpl = null)
 {
     $response = array();
     //-- Get the project
     try {
         $project = EcrProjectHelper::getProject();
     } catch (Exception $e) {
         $response['status'] = 0;
         $response['text'] = $e->getMessage();
         EcrHtml::formEnd();
         return;
     }
     //try
     $this->matrix = new EcrProjectMatrix($project, 'pcharts');
     $response['status'] = 1;
     $files = array();
     $size = array();
     $lines = array();
     foreach ($this->matrix->projectData as $type => $data) {
         $files[] = $data['files'];
         $size[] = $data['size'];
         if (isset($data['lines'])) {
             $lines[] = $data['lines'];
         }
     }
     //foreach
     $response['files'] = implode(',', $files);
     $response['size'] = implode(',', $size);
     $response['lines'] = implode(',', $lines);
     $response['labels'] = implode(',', array_keys($this->matrix->projectData));
     ob_start();
     parent::display();
     $response['table'] = ob_get_contents();
     ob_end_clean();
     $response['text'] = 'Hi U';
     echo json_encode($response);
 }
Ejemplo n.º 18
0
 /**
  * Standard display method.
  *
  * @param null|string $tpl The name of the template file to parse;
  *
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     ecrStylesheet('deploy');
     ecrScript('deploy', 'php2js', 'pollrequest');
     $task = JFactory::getApplication()->input->get('task');
     try {
         $this->project = EcrProjectHelper::getProject();
     } catch (Exception $e) {
         EcrHtml::message($e);
         EcrHtml::formEnd();
         return;
     }
     //-- Draw h1 header
     //EcrHtml::header(jgettext('Deploy'), $this->project, 'ecr_deploy');
     if (in_array($task, get_class_methods($this))) {
         //-- Execute the task
         $this->{$task}();
         $this->setLayout($task);
     }
     //-- Draw the submenu
     echo $this->displayBar();
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 19
0
 /**
  * Get a list of known core projects.
  *
  * @param string $scope The scope - admin or site.
  *
  * @return array
  */
 public function getCoreProjects($scope)
 {
     $projects = array();
     switch ($scope) {
         case 'admin':
             //-- @Joomla!-version-check
             switch (ECR_JVERSION) {
                 case '2.5':
                     $projects = array('bluestork', 'hathor', 'system');
                     break;
                 case '3.0':
                 case '3.1':
                 case '3.2':
                 case '3.3':
                 case '3.4':
                     $projects = array('isis', 'hathor', 'system');
                     break;
                 default:
                     EcrHtml::message(__METHOD__ . ' - Unsupported JVersion');
                     break;
             }
             break;
         case 'site':
             //-- @Joomla!-version-check
             switch (ECR_JVERSION) {
                 case '2.5':
                     $projects = array('atomic', 'beez_20', 'beez5', 'system');
                     break;
                 case '3.0':
                 case '3.1':
                 case '3.2':
                 case '3.3':
                 case '3.4':
                     $projects = array('beez3', 'protostar', 'system');
                     if ('3.2' == ECR_JVERSION) {
                         $projects[] = 'booone';
                     }
                     break;
                 default:
                     EcrHtml::message(__METHOD__ . ' - Unsupported JVersion');
                     break;
             }
             break;
         default:
             EcrHtml::message(__METHOD__ . ' - Unknown scope: ' . $scope);
             return array();
             break;
     }
     return $projects;
 }
Ejemplo n.º 20
0
}
?>
                </ul>
                <hr />
                <h4><?php 
echo jgettext('Custom variables');
?>
</h4>
                <?php 
echo jgettext('Custom variables may be defined in every template using the file options.php');
?>
            </div>
        </td>
        <td>
            <?php 
EcrHtml::prepareFileEdit();
?>
        </td>
    </tr>
</table>

<input type="hidden" name="com_type" value="<?php 
echo $this->com_type;
?>
"/>
<input type="hidden" name="template" value="<?php 
echo $this->template;
?>
"/>
<input type="hidden" name="old_task" value="templates"/>
<input type="hidden" name="old_controller" value="templates"/>
Ejemplo n.º 21
0
 /**
  * Standard display method.
  *
  * @param string $tpl The name of the template file to parse;
  *
  * @return void
  */
 public function display($tpl = null)
 {
     $this->logFiles = JFolder::files(ECRPATH_LOGS, 'log');
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 22
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @throws Exception
  * @return  void
  */
 public function display($tpl = null)
 {
     $input = JFactory::getApplication()->input;
     $task = $input->get('task');
     $this->hideLangs = $input->get('hide_langs', array(), 'array');
     $this->scope = $input->get('scope');
     try {
         $this->project = EcrProjectHelper::getProject();
         if ('ini' != $this->project->langFormat && !class_exists('g11nExtensionHelper')) {
             throw new Exception(sprintf('The g11n library must be available to process %s language files.', $this->project->langFormat));
         }
         if ('ini' != $this->project->langFormat) {
             //-- Here goes g11n =;)
             echo $this->displayBarG11n($task);
         } else {
             if ('' == $this->scope) {
                 $this->scope = 'site';
                 if ($this->project->type == 'plugin') {
                     //-- @todo special treatment for plugins
                     $this->scope = 'admin';
                 }
             }
             if (0 == count($this->project->langs)) {
                 $this->easyLanguage = false;
             } else {
                 $this->easyLanguage = new EcrLanguage($this->project, $this->scope, $this->hideLangs);
                 if ($input->get('tmpl') != 'component') {
                     //--draw selector
                     echo $this->displayBar($task);
                 }
             }
         }
         /**
          * Handle the 'task' value -> call a function
          * Softly exit on undefined
          */
         if (in_array($task, get_class_methods($this))) {
             //--Execute the task
             $this->{$task}();
         } else {
             if ($task) {
                 echo 'UNDEFINED: ' . $task . '<br />';
                 EcrHtml::formEnd();
                 return;
             }
         }
     } catch (Exception $e) {
         EcrHtml::message($e);
         EcrHtml::formEnd();
         return;
     }
     //try
     parent::display($tpl);
     EcrHtml::formEnd();
 }
Ejemplo n.º 23
0
 /**
  * Display the check results.
  *
  * @param JObject $file A file object
  *
  * @return void
  */
 public static function displayResults(stdClass $file)
 {
     //--Check if file exists
     if ($file->exists) {
         echo '<span class="img icon16-check_ok hasTip" title="' . jgettext('Found') . '"/>';
     } else {
         echo '<span class="img icon16-check_fail hasTip" title="' . jgettext('Not found') . '" />';
         EcrHtmlButton::createLanguageFile($file->lang, $file->scope);
         return;
     }
     //--Check if file is UTF-8 encoded
     if ($file->isUFT8) {
         if ($file->isUFT8 == 'NOT CHECKED') {
             echo '<span class="img icon16-yellowled hasTip" title="' . jgettext('Not checked for UTF-8') . '" />';
         } else {
             echo '<span class="img icon16-check_ok hasTip" title="' . jgettext('UTF-8') . '" />';
         }
     } else {
         EcrHtml::message(array(jgettext('File is not UTF-8 encoded'), $file->name), 'error');
     }
     //--Detect BOM
     if ($file->hasBOM) {
         if ($file->hasBOM == 'NOT CHECKED') {
             echo '<span class="img icon16-yellowled hasTip" title="' . jgettext('Not checked for BOM') . '" />';
         } else {
             EcrHtmlButton::removeBOM($file->fileName);
         }
     } else {
         echo '<span class="img icon16-check_ok hasTip" title="' . jgettext('No BOM') . '" />';
     }
 }
Ejemplo n.º 24
0
        echo EcrHtml::idt('+') . '<ul>';
        $ltr = $t;
    }
    echo EcrHtml::idt('+') . '<li class="pft-directory"><div>' . $cName . '</div>';
    echo EcrHtml::idt('+') . '<ul>';
    $ms = $cl[2];
    natcasesort($ms);
    echo EcrHtml::idt() . '<li class="pft-file ext-joo" onclick="changeFrame(' . "'{$cName}', 'NULL', '{$cl['0']}'" . ');" style="font-weight: bold;">' . $cName . '</li>';
    foreach ($ms as $m) {
        echo EcrHtml::idt() . '<li class="pft-file ext-joo" onclick="changeFrame(' . "'{$cName}', '{$m}', '{$cl['0']}'" . ');">' . $m . '</li>';
    }
    echo EcrHtml::idt('-') . '</ul>';
    echo EcrHtml::idt('-') . '</li>';
}
echo EcrHtml::idt('-') . '</ul>';
echo EcrHtml::idt('-') . '</li>';
?>

                            </ul>
                        </li>
                    </ul>
                </div>

                <div style="border: 1px solid orange; padding: 0.5em; background-color: #eee;">
                    <strong><?php 
echo jgettext('So many empty pages on the wiki ?');
?>
</strong>
                    <ul style="list-style: none; padding-left: 0.5em;">
                        <li class="img icon16-joomla">
                            <a href="http://docs.joomla.org/API_Reference_Project" class="external">Help
Ejemplo n.º 25
0
 /**
  * Get a list of known core projects.
  *
  * @param string $scope The scope - admin or site.
  *
  * @return array
  */
 public function getCoreProjects($scope)
 {
     $projects = array();
     //-- @Joomla!-version-check
     switch (ECR_JVERSION) {
         case '2.5':
             switch ($scope) {
                 case 'authentication':
                     $projects = array('gmail', 'joomla', 'ldap');
                     break;
                 case 'captcha':
                     $projects = array('recaptcha');
                     break;
                 case 'content':
                     $projects = array('emailcloak', 'geshi', 'joomla', 'loadmodule', 'pagebreak', 'pagenavigation', 'vote', 'finder');
                     break;
                 case 'editors':
                     $projects = array('none', 'tinymce', 'codemirror');
                     break;
                 case 'editors-xtd':
                     $projects = array('article', 'image', 'pagebreak', 'readmore');
                     break;
                 case 'extension':
                     $projects = array('joomla');
                     break;
                 case 'finder':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
                     break;
                 case 'quickicon':
                     $projects = array('extensionupdate', 'joomlaupdate');
                     break;
                 case 'search':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
                     break;
                 case 'system':
                     $projects = array('cache', 'debug', 'finder', 'highlight', 'languagefilter', 'languagecode', 'log', 'logout', 'p3p', 'redirect', 'remember', 'sef');
                     break;
                 case 'user':
                     $projects = array('contactcreator', 'joomla', 'profile');
                     break;
                 default:
                     EcrHtml::message(sprintf(jgettext('%s - Unknown scope: %s'), __METHOD__, $scope), 'error');
                     break;
             }
             //switch
             break;
         case '3.0':
         case '3.1':
             switch ($scope) {
                 case 'authentication':
                     $projects = array('gmail', 'joomla', 'ldap');
                     break;
                 case 'captcha':
                     $projects = array('recaptcha');
                     break;
                 case 'content':
                     $projects = array('emailcloak', 'geshi', 'joomla', 'loadmodule', 'pagebreak', 'pagenavigation', 'vote', 'finder');
                     break;
                 case 'editors':
                     $projects = array('none', 'tinymce', 'codemirror');
                     break;
                 case 'editors-xtd':
                     $projects = array('article', 'image', 'pagebreak', 'readmore');
                     break;
                 case 'extension':
                     $projects = array('joomla');
                     break;
                 case 'finder':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
                     break;
                 case 'quickicon':
                     $projects = array('extensionupdate', 'joomlaupdate');
                     break;
                 case 'search':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
                     break;
                 case 'system':
                     $projects = array('cache', 'debug', 'finder', 'highlight', 'languagefilter', 'languagecode', 'log', 'logout', 'p3p', 'redirect', 'remember', 'sef');
                     break;
                 case 'user':
                     $projects = array('contactcreator', 'joomla', 'profile');
                     break;
                 default:
                     EcrHtml::message(sprintf(jgettext('%s - Unknown scope: %s'), __METHOD__, $scope), 'error');
                     break;
             }
             //switch
             break;
         case '3.2':
             switch ($scope) {
                 case 'authentication':
                     $projects = array('gmail', 'joomla', 'ldap', 'cookie');
                     break;
                 case 'captcha':
                     $projects = array('recaptcha');
                     break;
                 case 'content':
                     $projects = array('emailcloak', 'finder', 'joomla', 'loadmodule', 'pagebreak', 'pagenavigation', 'vote');
                     break;
                 case 'editors':
                     $projects = array('none', 'tinymce', 'codemirror');
                     break;
                 case 'editors-xtd':
                     $projects = array('article', 'image', 'pagebreak', 'readmore');
                     break;
                 case 'extension':
                     $projects = array('joomla');
                     break;
                 case 'finder':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks', 'tags');
                     break;
                 case 'quickicon':
                     $projects = array('extensionupdate', 'joomlaupdate');
                     break;
                 case 'search':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
                     break;
                 case 'system':
                     $projects = array('cache', 'debug', 'highlight', 'languagefilter', 'languagecode', 'log', 'logout', 'p3p', 'redirect', 'remember', 'sef');
                     break;
                 case 'user':
                     $projects = array('contactcreator', 'joomla', 'profile');
                     break;
                 case 'twofactorauth':
                     $projects = array('totp', 'yubikey');
                     break;
                 default:
                     EcrHtml::message(sprintf(jgettext('%s - Unknown scope: %s'), __METHOD__, $scope), 'error');
                     break;
             }
             break;
         case '3.3':
         case '3.4':
             switch ($scope) {
                 case 'authentication':
                     $projects = array('gmail', 'joomla', 'ldap', 'cookie');
                     break;
                 case 'captcha':
                     $projects = array('recaptcha');
                     break;
                 case 'content':
                     $projects = array('contact', 'emailcloak', 'finder', 'joomla', 'loadmodule', 'pagebreak', 'pagenavigation', 'vote');
                     break;
                 case 'editors':
                     $projects = array('none', 'tinymce', 'codemirror');
                     break;
                 case 'editors-xtd':
                     $projects = array('article', 'image', 'pagebreak', 'readmore');
                     break;
                 case 'extension':
                     $projects = array('joomla');
                     break;
                 case 'finder':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks', 'tags');
                     break;
                 case 'quickicon':
                     $projects = array('extensionupdate', 'joomlaupdate');
                     break;
                 case 'search':
                     $projects = array('categories', 'contacts', 'content', 'newsfeeds', 'tags', 'weblinks');
                     break;
                 case 'system':
                     $projects = array('cache', 'debug', 'highlight', 'languagefilter', 'languagecode', 'log', 'logout', 'p3p', 'redirect', 'remember', 'sef');
                     break;
                 case 'user':
                     $projects = array('contactcreator', 'joomla', 'profile');
                     break;
                 case 'twofactorauth':
                     $projects = array('totp', 'yubikey');
                     break;
                 case 'installer':
                     $projects = array('webinstaller');
                     break;
                 default:
                     EcrHtml::message(sprintf(jgettext('%s - Unknown scope: %s'), __METHOD__, $scope), 'error');
                     break;
             }
             //switch
             break;
         default:
             JFactory::getApplication()->enqueueMessage(__METHOD__ . ' - Unknown J! version', 'error');
             return array();
     }
     //switch
     return $projects;
 }
Ejemplo n.º 26
0
 private function prepareUpdate()
 {
     jimport('joomla.filesystem.archive');
     $buildsPath = $this->project->getZipPath();
     if (!JFolder::exists($buildsPath)) {
         return false;
     }
     $folders = JFolder::folders($buildsPath);
     if (!$folders) {
         return false;
     }
     $tmpPath = '';
     $tmpPath .= JFactory::getConfig()->get('tmp_path');
     $tmpPath .= '/' . $this->project->comName . '_update_' . time();
     $this->log('Temp path is set to ' . $tmpPath);
     if (!JFolder::create($tmpPath)) {
         EcrHtml::message('Unable to create temp folder for update', 'error');
         $this->log('Can not create the temp folder ' . $tmpPath);
         return false;
     }
     foreach ($folders as $folder) {
         JFolder::create($tmpPath . '/' . $folder);
         $this->log('Processing version ' . $folder);
         $files = JFolder::files($buildsPath . '/' . $folder);
         if (!$files) {
             continue;
         }
         $this->log(sprintf('Found %d package(s) ', count($files)));
         if (1 == count($files)) {
             //-- Only one file found in folder - take it
             $source = $buildsPath . '/' . $folder . '/' . $files[0];
         } else {
             //-- @todo tmp solution for multiple file :-?
             //-- ===echo 'more files found....picking '.$files[0];
             //-- Temp
             $source = $buildsPath . '/' . $folder . '/' . $files[0];
         }
         $this->log('Processing package: ' . $source);
         $destination = $tmpPath . '/' . $folder;
         if (!JArchive::extract($source, $destination)) {
             EcrHtml::message(sprintf('Unable to extract the package %s to %s', $source, $destination), 'error');
             return false;
         }
     }
     //foreach
     $this->tmpPath = $tmpPath;
     return true;
 }
Ejemplo n.º 27
0
/**
 * Loads EasyCreator Helpers.
 *
 * @param string $name Path in JLoader dot syntax.
 *
 * @deprecated - 2B replaced by the autoloader
 *
 * @return mixed [string path | boolean false on error]
 */
function ecrLoadHelper($name)
{
    static $helpers = array();
    if (isset($helpers[$name])) {
        return $helpers[$name];
    }
    if (!JFile::exists(JPATH_COMPONENT_ADMINISTRATOR . '/helpers/' . str_replace('.', '/', $name) . '.php')) {
        EcrHtml::message(sprintf(jgettext('Helper file not found : %s'), $name), 'error');
        $helpers[$name] = false;
        return $helpers[$name];
    }
    $helpers[$name] = JLoader::import('helpers.' . $name, JPATH_COMPONENT_ADMINISTRATOR);
    return $helpers[$name];
}
Ejemplo n.º 28
0
 /**
  * Gets the DTD for the extension type.
  *
  * @param string $jVersion Joomla! version
  *
  * @return mixed [array index array on success | false if not found]
  */
 public function getDTD($jVersion)
 {
     $dtd = false;
     //-- @Joomla!-version-check
     switch (ECR_JVERSION) {
         case '2.5':
         case '3.0':
         case '3.1':
         case '3.2':
         case '3.3':
         case '3.4':
             break;
         default:
             EcrHtml::message(__METHOD__ . ' - Unknown J! version');
             break;
     }
     return $dtd;
 }
Ejemplo n.º 29
0
 /**
  * DoIt
  *
  * @throws Exception
  * @return void
  */
 public function doExecute()
 {
     require JPATH_BASE . '/helpers/loader.php';
     require JPATH_BASE . '/includes/defines.php';
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     var_dump(getcwd());
     var_dump($this->input->args);
     // Known project types
     $types = EcrProjectHelper::getProjectTypes();
     // Known project "Tags" - short forms
     $tags = EcrProjectHelper::getProjectTypesTags();
     // Predefined actions
     $actions = $this->getActions();
     var_dump($actions);
     var_dump($tags);
     // @todo What do you want to do today ? =;)
     return;
     $this->input->set('ecr_project', 'wap_fuuuschubidu');
     $builder = new EcrProjectBuilder();
     $type = 'webapp';
     //getCmd('tpl_type');
     $name = 'mvc_1';
     //getCmd('tpl_name');
     $comName = 'wap_gugugugu';
     //getCmd('com_name');
     if (in_array($type, array('cliapp', 'webapp'))) {
         define('JPATH_SITE', __DIR__);
     }
     $newProject = $builder->build($type, $name, $comName);
     if (!$newProject) {
         //-- Error
         $this->out('An error happened while creating your project');
         //            JFactory::getApplication()->enqueueMessage(jgettext('An error happened while creating your project'), 'error');
         //          $builder->printErrors();
         $errors = $builder->getErrors();
         var_dump($errors);
         //EcrHtml::formEnd();
         return;
     }
     if ('test' == JFactory::getApplication()->input->get('ecr_test_mode')) {
         //-- Exiting in test mode
         echo '<h2>Exiting in test mode...</h2>';
         echo $builder->printLog();
         $builder->printErrors();
         EcrHtml::formEnd();
         return;
     }
     $ecr_project = JFile::stripExt($newProject->getEcrXmlFileName());
     //   $uri = 'index.php?option=com_easycreator&controller=stuffer&ecr_project='.$ecr_project;
     $this->out('Your project has been created');
     echo ECRPATH_DATA;
     $project = EcrProjectHelper::getProject();
     var_dump($project);
 }
Ejemplo n.º 30
0
 /**
  * Creates a test directory for UnitTests.
  *
  * @param string $type The type
  *
  * @return void
  */
 private function create_test_dir($type)
 {
     $input = JFactory::getApplication()->input;
     $ecr_project = $input->get('ecr_project');
     $input->set('view', 'codeeye');
     if (!$ecr_project) {
         EcrHtml::message(jgettext('No project selected'), 'error');
         return;
     }
     if (!JFolder::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . $ecr_project)) {
         EcrHtml::message(jgettext('Invalid project'), 'error');
         return;
     }
     if (!JFolder::create(JPATH_ADMINISTRATOR . DS . 'components' . DS . $ecr_project . DS . 'tests' . DS . $type)) {
         EcrHtml::message(jgettext('Unable to create tests directory'), 'error');
         return;
     }
     EcrHtml::message(jgettext('The tests directory has been created'));
 }