示例#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();
 }
示例#2
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();
 }
示例#3
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();
 }
示例#4
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();
 }
示例#5
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'));
 }
示例#6
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();
 }
示例#7
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();
     }
 }
示例#8
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();
 }
示例#9
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();
     }
 }
示例#10
0
 /**
  * Standard display method.
  *
  * @param string $tpl The name of the template file to parse;
  *
  * @throws Exception
  * @return mixed|void
  */
 public function display($tpl = null)
 {
     $input = JFactory::getApplication()->input;
     //-- Add javascript
     ecrScript('codeeye', 'pollrequest', 'logconsole');
     //-- Add css
     ecrStylesheet('codeeye');
     $this->ecr_project = $input->get('ecr_project');
     $this->task = $input->get('task');
     //--Get the project
     try {
         $this->project = EcrProjectHelper::getProject();
         if (0 == count($this->project->copies)) {
             throw new Exception(jgettext('No files found'));
         }
     } catch (Exception $e) {
         EcrHtml::message($e);
         EcrHtml::formEnd();
         return;
     }
     if (in_array($this->task, get_class_methods($this))) {
         //--Execute the task
         $this->{$this->task}();
         if ($this->task == 'display_snip') {
             //--Raw view
             parent::display($tpl);
             return;
         }
     } else {
         if ($this->task) {
             echo sprintf('UNDEFINED Task "%s" in %s', $this->task, __CLASS__) . '<br />';
         }
     }
     //--Draw the submenu
     echo $this->displayBar();
     parent::display($tpl);
     EcrHtml::formEnd();
 }
示例#11
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);
 }
示例#12
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();
 }
示例#13
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();
 }
示例#14
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();
 }
示例#15
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);
 }