예제 #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
    /**
     * Wizard
     * Displays the project information introduced so far.
     *
     * @param \EcrProjectBase  $project
     * @param array            $formFieldNames fields already displayed
     */
    public static function displayResult(EcrProjectBase $project, $formFieldNames = array())
    {
        ?>
    <div class="ecr_result">
        <h3><?php 
        echo jgettext('Your extension so far');
        ?>
</h3>

        <?php 
        echo self::displayRow(jgettext('Type'), 'type', 'tpl_type', $project, $formFieldNames);
        echo self::displayRow(jgettext('Template'), 'tplName', 'tpl_name', $project, $formFieldNames);
        echo self::displayRow(jgettext('JVersion'), 'JCompat', 'jcompat', $project, $formFieldNames);
        echo '<div style="background-color: #fff; border: 1px solid gray; padding-left: 0.5em;">';
        $info = EcrProjectTemplateHelper::getTemplateInfo($project->type, $project->tplName);
        echo $info ? $info->description : '';
        echo '</div>';
        echo '<div class=extension" style="background-color: #ffff99; padding: 1em; font-size: 1.2em;">';
        echo self::displayRow(jgettext('Name'), 'name', 'com_name', $project, $formFieldNames);
        echo self::displayRow(jgettext('Version'), 'version', 'version', $project, $formFieldNames);
        echo self::displayRow(jgettext('Description'), 'description', 'description', $project, $formFieldNames);
        echo '</div>';
        echo '<div class="credits" style="background-color: #ffc;">';
        echo self::displayRow(jgettext('Author'), 'author', 'author', $project, $formFieldNames);
        echo self::displayRow(jgettext('Author e-mail'), 'authorEmail', 'authorEmail', $project, $formFieldNames);
        echo self::displayRow(jgettext('Author URL'), 'authorUrl', 'authorUrl', $project, $formFieldNames);
        echo self::displayRow(jgettext('License'), 'license', 'license', $project, $formFieldNames);
        echo self::displayRow(jgettext('Copyright (C)'), 'copyright', 'copyright', $project, $formFieldNames);
        echo self::displayRow(jgettext('List postfix'), 'listPostfix', 'list_postfix', $project, $formFieldNames);
        echo '</div>';
        ?>
</div>
    <?php 
    }
예제 #3
0
 /**
  * @param        $format
  * @param string $type
  *
  * @return string
  */
 public function format($format, $type = 'new')
 {
     $ret = '';
     $ret .= '<span class="img icon16-' . $type . '">';
     switch ($type) {
         case 'edit':
             $ret .= jgettext('Edit');
             break;
         case 'add':
             $ret .= jgettext('New');
             break;
         default:
             break;
     }
     //switch
     $ret .= '</span>';
     switch ($format) {
         case 'erm':
             $ret .= '<div style="color: blue; font-weight: bold; text-align:center;">' . ucfirst($this->group) . ' - ' . $this->title . '</div>';
             $ret .= '<div style="color: orange; font-weight: bold;">' . $this->description . '</div>';
             break;
         default:
             return sprintf(jgettext('Undefined format: %s'), $format);
             break;
     }
     //switch
     return $ret;
 }
예제 #4
0
 /**
  * Displays available options with input fields.
  *
  * @param EcrProjectBase $project The project
  *
  * @return string HTML
  */
 public function displayOptions(EcrProjectBase $project)
 {
     $html = array();
     $html[] = '<label for="class_prefix">' . jgettext('Class prefix') . '</label>';
     $html[] = '<input type="text" id="class_prefix" name="class_prefix" />';
     return implode(NL, $html);
 }
예제 #5
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  * @since   11.1
  */
 protected function getInput()
 {
     //-- Initialize variables.
     $html = array();
     //-- Initialize some field attributes.
     $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"';
     //-- Start the radio field output.
     $html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
     //-- Get the field options.
     $options = $this->getOptions();
     //-- Build the radio field output.
     foreach ($options as $i => $option) {
         //-- Initialize some option attributes.
         $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : '';
         $class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
         $disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
         //-- Initialize some JavaScript option attributes.
         $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
         $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';
         $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . jgettext($option->text) . '</label>';
     }
     //foreach
     //-- End the radio field output.
     $html[] = '</fieldset>';
     return implode("\n", $html);
 }
예제 #6
0
 /**
  * Method to get the field label markup.
  *
  * @return  string  The field label markup.
  * @since   11.1
  */
 protected function getLabel()
 {
     //-- Initialise variables.
     $label = '';
     if ($this->hidden) {
         return $label;
     }
     //-- Get the label text from the XML element, defaulting to the element name.
     $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
     $text = $this->translateLabel ? jgettext($text) : $text;
     //-- Build the class for the label.
     $class = !empty($this->description) ? 'hasTip' : '';
     $class = $this->required == true ? $class . ' required' : $class;
     //-- Add the opening label tag and main attributes attributes.
     $label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"';
     //-- If a description is specified, use it to build a tooltip.
     if (!empty($this->description)) {
         $description = $this->translateDescription ? jgettext($this->description) : $this->description;
         $label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . $description, ENT_COMPAT, 'UTF-8') . '"';
     }
     //-- Add the label text and closing tag.
     if ($this->required) {
         $label .= '>' . $text . '<span class="star">&#160;*</span></label>';
     } else {
         $label .= '>' . $text . '</label>';
     }
     return $label;
 }
예제 #7
0
 /**
  * Draw a submit button
  *
  * @param array $requireds required field names separated by komma
  */
 public static function autoCode($requireds = array())
 {
     $requireds = (array) $requireds;
     $requireds = implode(',', $requireds);
     echo '<br />';
     echo '<div class="btn" onclick="updateAutoCode(\'' . $requireds . '\');">' . '<i class="img icon16-ecr_save"></i>' . jgettext('Save') . '</div>';
 }
예제 #8
0
    /**
     * Prints a debug backtrace
     *
     * @access public
     * @static
     */
    public static function backtrace()
    {
        // disabled ?
        //
        if (!krumo::_debug()) {
            return false;
        }
        // render it
        //
        ?>
<div class="krumo-title"><?php 
        echo jgettext('Backtrace');
        ?>
</div>
        <?php 
        $ts = debug_backtrace();
        $traces = array();
        foreach ($ts as $trace) {
            $t = array();
            foreach ($trace as $key => $value) {
                if ($key == 'file') {
                    $value = str_replace(JPATH_BASE . DS, '', $value);
                }
                $t[$key] = $value;
            }
            //foreach;
            $traces[] = $t;
        }
        //foreach
        return krumo::dump($traces);
    }
예제 #9
0
/**
 * Checks an extension with a given MD5 checksum file.
 *
 * @param string $path Path to md5 file
 * @param array $extensionPaths Indexed array: First folder in md5 file path as key - extension path as value
 *
 * @return array Array of errors
 */
function checkMD5File($path, $extensionPaths)
{
    jimport('joomla.filesystem.file');
    $lines = explode("\n", JFile::read($path));
    $errors = array();
    $errors[0] = 0;
    //counter..
    foreach ($lines as $line) {
        if (!trim($line)) {
            continue;
        }
        list($md5, $file) = explode(' ', $line);
        $parts = explode(DS, $file);
        if (!array_key_exists($parts[0], $extensionPaths)) {
            continue;
        }
        $path = $extensionPaths[$parts[0]] . DS . substr($file, strlen($parts[0]) + 1);
        echo JDEBUG ? $path . '...' : '';
        $errors[0]++;
        if (!JFile::exists($path)) {
            $errors[] = sprintf(jgettext('File not found: %s'), $path);
            echo JDEBUG ? 'not found<br />' : '';
            continue;
        }
        if (md5_file($path) != $md5) {
            $errors[] = sprintf(jgettext('MD5 check failed on file: %s'), $path);
            echo JDEBUG ? 'md5 check failed<br />' : '';
            continue;
        }
        echo JDEBUG ? 'OK<br />' : '';
    }
    //foreach
    return $errors;
}
예제 #10
0
 /**
  * Info about the thing.
  *
  * @return EcrProjectTemplateInfo
  */
 public function info()
 {
     $info = new EcrProjectTemplateInfo();
     $info->group = ucfirst($this->group);
     $info->title = 'Simple View 2.5';
     $info->description = jgettext('A simple, empty, view');
     return $info;
 }
예제 #11
0
 /**
  * Info about the thing.
  *
  * @return EcrProjectTemplateInfo
  */
 public function info()
 {
     $info = new EcrProjectTemplateInfo();
     $info->group = ucfirst($this->group);
     $info->title = 'Simple 3L';
     $info->description = jgettext('A simple, empty, model') . ' - J! 3.0 Legacy';
     return $info;
 }
예제 #12
0
 /**
  * draws a checkbox
  * select if a backup version should be saved
  *
  * @return string
  */
 public static function versioned()
 {
     $params = JComponentHelper::getParams('com_easycreator');
     $save_versioned = JFactory::getApplication()->input->getInt('save_versioned', $params->get('save_versioned'));
     $checked = $save_versioned ? ' checked="checked"' : '';
     $html = '<input type="checkbox" name="save_versioned" id="save_versioned" value="1"' . $checked . '>' . '<label class="inline" for="save_versioned">' . jgettext('Save versioned') . '</label>';
     return $html;
 }
예제 #13
0
    /**
     * Context menu
     */
    public static function display()
    {
        $input = JFactory::getApplication()->input;
        //--Add css and javascript
        ecrLoadMedia('contextmenu');
        $ajaxLink = 'index.php?option=com_easycreator';
        $ajaxLink .= '&controller=ajax&tmpl=component';
        $ajaxLink .= '&old_task=' . $input->get('task');
        $ajaxLink .= '&old_controller=' . $input->get('controller');
        $ajaxLink .= '&ecr_project=' . $input->get('ecr_project');
        ?>
    <script type="text/javascript">
        SimpleContextMenu.setup({'preventDefault' : true, 'preventForms' : false});
        SimpleContextMenu.attach('pft-file', 'CM1');
        SimpleContextMenu.attach('pft-directory', 'CM2');
    </script>

    <!-- Context menu files -->
    <?php 
        $menuEntries = array(array(jgettext('New folder'), 'new_folder', 'add'), array(jgettext('New file'), 'new_file', 'add'), array(jgettext('Rename'), 'rename_file', 'rename'), array(jgettext('Delete'), 'delete_file', 'delete'));
        ?>
    <ul id="CM1" class="SimpleContextMenu">
        <li class="title"><?php 
        echo jgettext('File');
        ?>
</li>
        <?php 
        foreach ($menuEntries as $menuEntry) {
            self::addEntry($ajaxLink, $menuEntry[0], $menuEntry[1], $menuEntry[2]);
        }
        //foreach
        ?>
    </ul>

    <!-- Context menu folders -->
    <?php 
        $menuEntries = array(array(jgettext('New folder'), 'new_folder', 'add'), array(jgettext('New file'), 'new_file', 'add'), array(jgettext('Rename'), 'rename_folder', 'rename'), array(jgettext('Delete'), 'delete_folder', 'delete'));
        ?>
    <ul id="CM2" class="SimpleContextMenu">
        <li class="title"><?php 
        echo jgettext('Folder');
        ?>
</li>
        <?php 
        foreach ($menuEntries as $menuEntry) {
            self::addEntry($ajaxLink, $menuEntry[0], $menuEntry[1], $menuEntry[2]);
        }
        //foreach
        ?>
    </ul>

    <input
        type="hidden" name="act_folder" id="act_folder"/>
    <input
        type="hidden" name="act_file" id="act_file"/>
    <?php 
    }
예제 #14
0
 /**
  * Get the input fields
  *
  * @param int $cnt A counter value.
  *
  * @return string
  */
 public function getFields($cnt)
 {
     $html = array();
     $html[] = '<label class="inline" for="fields_' . $cnt . '_releaseState">' . jgettext('Release state') . '</label>';
     $html[] = EcrHtmlSelect::releaseStates(array('name' => 'fields[' . $cnt . '][releaseState]', 'id' => 'fields_' . $cnt . '_releaseState', 'selected' => $this->releaseState));
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, 'abort', jgettext('Abort on failure'));
     $html[] = EcrHtmlSelect::yesno('fields[' . $cnt . '][abort]', $this->abort);
     return implode("\n", $html);
 }
예제 #15
0
 /**
  * Get the input fields
  *
  * @param int $cnt A counter value.
  *
  * @return string
  */
 public function getFields($cnt)
 {
     $html = array();
     $html[] = $this->getLabel($cnt, 'script', jgettext('Path'));
     $html[] = $this->getInput($cnt, 'script', $this->script);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, '', jgettext('Abort on failure'));
     $html[] = EcrHtmlSelect::yesno('fields[' . $cnt . '][abort]', $this->abort);
     return implode("\n", $html);
 }
예제 #16
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();
 }
예제 #17
0
 /**
  * Method for getting the form from the model.
  *
  * @param   array    $data      Data for the form.
  * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
  *
  * @throws Exception
  *
  * @return JForm
  */
 public function getForm($data = array(), $loadData = true)
 {
     JLoader::import('models.fields.formfield', JPATH_COMPONENT);
     //-- Get the form.
     $form = $this->loadForm('com_easycreator.config', 'config', array('control' => 'params', 'load_data' => $loadData));
     if (empty($form)) {
         throw new Exception(jgettext('Unable to load the config form'));
     }
     $form->bind(JComponentHelper::getParams('com_easycreator'));
     return $form;
 }
예제 #18
0
 /**
  * Process custom options.
  *
  * @param EcrProjectBuilder $builder The Builder class.
  *
  * @return boolean True on sucess.
  */
 public function processOptions(EcrProjectBuilder $builder)
 {
     $ecr_folder_name = JFactory::getApplication()->input->get('ecr_folder_name');
     if (!$ecr_folder_name) {
         JFactory::getApplication()->enqueueMessage(jgettext('No folder given'), 'error');
         return false;
     }
     $builder->setScope($ecr_folder_name);
     $builder->replacements->ECR_COM_SCOPE = ucfirst($ecr_folder_name);
     return true;
 }
예제 #19
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();
     }
 }
예제 #20
0
 /**
  * Get the input fields
  *
  * @param int $cnt A counter value.
  *
  * @return string
  */
 public function getFields($cnt)
 {
     $html = array();
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_filedir">' . jgettext('File or directory') . '</label>';
     $html[] = '<input type="text" value="' . $this->filedir . '"' . ' name="fields[' . $cnt . '][filedir]" id="fields_' . $cnt . '_filedir">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_arguments">' . jgettext('Arguments') . '</label>';
     $html[] = '<input type="text" value="' . $this->arguments . '"' . ' name="fields[' . $cnt . '][arguments]" id="fields_' . $cnt . '_arguments">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_fThreshold">' . jgettext('Failure Threshold') . '</label>';
     $html[] = '<input type="text" class="span1" value="' . $this->failureThreshold . '"' . ' name="fields[' . $cnt . '][failureThreshold]" id="fields_' . $cnt . '_fThreshold">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_eThreshold">' . jgettext('Error Threshold') . '</label>';
     $html[] = '<input type="text" class="span1" value="' . $this->errorThreshold . '"' . ' name="fields[' . $cnt . '][errorThreshold]" id="fields_' . $cnt . '_eThreshold">';
     return implode("\n", $html);
 }
예제 #21
0
 /**
  * Draws a debug console "window".
  *
  * @static
  * @return string
  */
 public static function logConsole()
 {
     JFactory::getDocument()->addScriptDeclaration("window.addEvent('domready', function() {\n                document.id('ecrDebugBoxConsole').makeResizable({\n                    modifiers: {x: false, y: 'height'},\n                    limit: {y: [1, 600]},\n                    invert: true,\n                    handle: 'pollStatusGrip'\n                });\n            });");
     ecrStylesheet('logconsole');
     $html = array();
     $html[] = '<div id="ecrDebugBoxConsole">';
     $html[] = '   <div id="pollStatusGrip">&uArr;&dArr;</div>';
     $html[] = '   <div id="pollStatus">idle</div>';
     $html[] = '   <div class="debugTitle">' . jgettext('Log console') . '</div>';
     $html[] = '   <div id="ecrDebugBox"></div>';
     $html[] = '</div>';
     return implode(NL, $html);
 }
예제 #22
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;
 }
예제 #23
0
 /**
  * @throws Exception
  * @return mixed|void
  */
 protected function connect()
 {
     $credentials = new stdClass();
     /* @var JInput $input */
     $input = JFactory::getApplication()->input;
     $credentials->user = $input->get('user');
     $credentials->pass = $input->get('pass');
     $config = new JRegistry();
     $config->set('api.username', $credentials->user);
     $config->set('api.password', $credentials->pass);
     JLog::add('| ^^ ' . sprintf(jgettext('Connecting to %s ...'), 'GitHub'));
     $this->github = new EcrGithub($config);
     $this->credentials = $credentials;
 }
예제 #24
0
 /**
  * Constructor.
  *
  * @param JObject $options Converting options
  * @param EcrProjectBase $project The project
  */
 public function __construct(JObject $options, EcrProjectBase $project)
 {
     $this->cleanRegEx = "/JText::_\\(\\s*\\'(.*)\\'\\s*\\)|JText::_\\(\\s*\"(.*)\"\\s*\\)" . "|JText::sprintf\\(\\s*\"(.*)\"|JText::sprintf\\(\\s*\\'(.*)\\'" . "|JText::printf\\(\\s*\\'(.*)\\'|JText::printf\\(\\s*\"(.*)\"/iU";
     if ($options instanceof JObject) {
         $this->options = $options;
     } else {
         JFactory::getApplication()->enqueueMessage(jgettext('Invalid options for lanuage converter'), 'error');
         $this->options = new JObject();
     }
     if ($this->options->get('add_prefix')) {
         $prefix = $project->extensionPrefix ? $project->extensionPrefix : $project->comName . '_';
         if ($this->options->get('convert_all_caps')) {
             $prefix = strtoupper($tprefix);
         }
         $this->prefix = $prefix;
     }
 }
예제 #25
0
 /**
  * Get the input fields
  *
  * @param int $cnt A counter value.
  *
  * @return string
  */
 public function getFields($cnt)
 {
     $js = array();
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $js));
     $html[] = $this->getLabel($cnt, 'dboxKey', jgettext('Dropbox Key'));
     $html[] = $this->getInput($cnt, 'dboxKey', $this->dboxKey);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, 'dboxSecret', jgettext('Dropbox Secret'));
     $html[] = $this->getInput($cnt, 'dboxSecret', $this->dboxSecret);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, '', jgettext('Abort on failure'));
     $html[] = EcrHtmlSelect::yesno('fields[' . $cnt . '][abort]', $this->abort);
     $html[] = '<br />';
     $link = JRoute::_('&option=com_easycreator&controller=stuffer&task=checkdropbox' . '&key=' . $this->dboxKey . '&seqret=' . $this->dboxSecret);
     $html[] = '<strong>Note</strong> Be sure to <a target="_blank" href="' . $link . '">Register the app</a>';
     return implode("\n", $html);
 }
예제 #26
0
 /**
  * Get the input fields
  *
  * @param int $cnt A counter value.
  *
  * @return string
  */
 public function getFields($cnt)
 {
     $html = array();
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_standard">' . jgettext('Coding Standard') . '</label>';
     $html[] = '<input type="text" value="' . $this->standard . '"' . ' name="fields[' . $cnt . '][standard]" id="fields_' . $cnt . '_standard">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_extensions">' . jgettext('Extensions') . '</label>';
     $html[] = '<input type="text" value="' . $this->extensions . '"' . ' name="fields[' . $cnt . '][extensions]" id="fields_' . $cnt . '_extensions">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_arguments">' . jgettext('Arguments') . '</label>';
     $html[] = '<input type="text" value="' . $this->arguments . '"' . ' name="fields[' . $cnt . '][arguments]" id="fields_' . $cnt . '_arguments">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_ignore">' . jgettext('Ignore') . '</label>';
     $html[] = '<input type="text" value="' . $this->ignore . '"' . ' name="fields[' . $cnt . '][ignore]" id="fields_' . $cnt . '_ignore">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_wThreshold">' . jgettext('Warning Threshold') . '</label>';
     $html[] = '<input type="text" class="span1" value="' . $this->warningThreshold . '"' . ' name="fields[' . $cnt . '][warningThreshold]" id="fields_' . $cnt . '_wThreshold">' . '<br />';
     $html[] = '<label class="inline2" for="fields_' . $cnt . '_eThreshold">' . jgettext('Error Threshold') . '</label>';
     $html[] = '<input type="text" class="span1" value="' . $this->errorThreshold . '"' . ' name="fields[' . $cnt . '][errorThreshold]" id="fields_' . $cnt . '_eThreshold">';
     return implode("\n", $html);
 }
예제 #27
0
 /**
  * Displays available options with input fields.
  *
  * @param EcrProjectBase $project The project
  *
  * @return string HTML
  */
 public function displayOptions(EcrProjectBase $project)
 {
     ecrScript('dbtables');
     ecrStylesheet('dbtables');
     if (false == in_array('mysql', $project->dbTypes)) {
         $project->dbTypes = array_merge(array('mysql'), $project->dbTypes);
     }
     $fields = array();
     $field = new EcrTableField();
     $field->name = 'catid';
     $field->label = 'Category id';
     $field->type = 'INT';
     $field->length = '11';
     $field->attributes = 'UNSIGNED';
     $field->null = 'NOT_NULL';
     $field->comment = 'Category ID';
     $fields[] = $field;
     $field = new EcrTableField();
     $field->name = 'checked_out';
     $field->label = 'Checked out';
     $field->type = 'INT';
     $field->length = '11';
     $field->attributes = 'UNSIGNED';
     $field->default = '0';
     $field->null = 'NOT_NULL';
     $fields[] = $field;
     $html = array();
     $html[] = '<script type="text/javascript">';
     $html[] = '//--Set object count to 3 - 0 is the standard field "id"';
     $html[] = '//-- 1 is "catid" and 2 is "checked_out"';
     $html[] = 'var obCount = 3;';
     $html[] = 'var obCountOrig = 3;';
     $html[] = '</script>';
     $html[] = '<h3>' . jgettext('Database support') . '</h3>';
     $html[] = EcrHtmlOptions::database($project);
     $html[] = '<h3>' . jgettext('User defined table fields') . '</h3>';
     $html[] = '<strong>' . sprintf(jgettext('Please define the fields for the table %s that will be created for your component.'), '"' . strtolower($project->name) . '"') . '</strong>';
     $html[] = EcrTableHelper::startDbEditor();
     foreach ($fields as $count => $field) {
         $html[] = EcrTableHelper::drawPredefinedRow($field, $count + 1);
     }
     $html[] = EcrTableHelper::endDbEditor();
     return implode(NL, $html);
 }
예제 #28
0
 /**
  * Draws a project selector.
  *
  * @return void
  */
 public static function projectSelector()
 {
     //--Get the project helper
     JLoader::import('helpers.projecthelper', JPATH_COMPONENT_ADMINISTRATOR);
     //--Get existing projects
     $projects = EcrProjectHelper::getProjectList();
     $selectedProject = JFactory::getApplication()->input->get('ecr_project');
     if (!isset($projects['component'])) {
         JFactory::getApplication()->enqueueMessage(jgettext('No projects found'), 'error');
         return;
     }
     echo jgettext('Registered projects');
     echo '<ol style="list-style-type: none; text-align: left;">';
     foreach ($projects['component'] as $project) {
         $selected = $project->comName == $selectedProject ? '_selected' : '';
         echo '<li class="ecr_button' . $selected . '" onclick="drawProject(\'' . $project->comName . '\');">' . $project->name . '</li>';
     }
     echo '</ol>';
 }
예제 #29
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  * @since   11.1
  */
 protected function getOptions()
 {
     //-- Initialize variables.
     $options = array();
     foreach ($this->element->children() as $option) {
         //-- Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         //-- Create a new option object based on the <option /> element.
         $tmp = JHtml::_('select.option', (string) $option['value'], jgettext((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         //-- Set some option attributes.
         $tmp->class = (string) $option['class'];
         //-- Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         //-- Add the option object to the result set.
         $options[] = $tmp;
     }
     //foreach
     reset($options);
     return $options;
 }
예제 #30
0
 /**
  * Get the input fields
  *
  * @param int $cnt A counter value.
  *
  * @return string
  */
 public function getFields($cnt)
 {
     $html = array();
     $html[] = $this->getLabel($cnt, 'host', jgettext('Host'));
     $html[] = $this->getInput($cnt, 'host', $this->host);
     $html[] = $this->getLabel($cnt, 'port', jgettext('Port'));
     $html[] = $this->getInput($cnt, 'port', $this->port, array('class' => 'span1'));
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, 'user', jgettext('User name'));
     $html[] = $this->getInput($cnt, 'user', $this->user);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, 'pass', jgettext('Password'));
     $html[] = $this->getInput($cnt, 'pass', $this->pass);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, 'folder', jgettext('Folder'));
     $html[] = $this->getInput($cnt, 'folder', $this->folder);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, 'files', jgettext('Files'));
     $html[] = $this->getInput($cnt, 'files', $this->files);
     $html[] = '<br />';
     $html[] = $this->getLabel($cnt, '', jgettext('Abort on failure'));
     $html[] = EcrHtmlSelect::yesno('fields[' . $cnt . '][abort]', $this->abort);
     return implode("\n", $html);
 }