Skip to content

Commit

Permalink
Merge pull request reinhardfuehricht#1 from reinhardfuehricht/master
Browse files Browse the repository at this point in the history
Merge upstream
  • Loading branch information
josefglatz committed Feb 19, 2016
2 parents bf27144 + e8777c3 commit ff37278
Show file tree
Hide file tree
Showing 100 changed files with 535 additions and 595 deletions.
5 changes: 2 additions & 3 deletions Classes/Ajax/RemoveFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public function main()
if (!$found) {
foreach ($files as $key => &$fileInfo) {
if (!strcmp($fileInfo['name'], $this->uploadedFileName)) {
$found = TRUE;
unset($sessionFiles[$field][$key]);
if (file_exists($uploadPath . $fileInfo['name'])) {
unlink($uploadPath . $fileInfo['name']);
Expand All @@ -76,7 +75,7 @@ public function main()

// Add the content to or Result Box: #formResult
if (is_array($sessionFiles) && !empty($sessionFiles[$field])) {
$markers = array();
$markers = [];
$view = $this->componentManager->getComponent('View\\Form');
$view->setSettings($this->settings);
$view->fillFileMarkers($markers);
Expand Down Expand Up @@ -118,7 +117,7 @@ protected function init()
}

$this->settings = $this->globals->getSession()->get('settings');
$this->langFiles = $this->utilityFuncs->readLanguageFiles(array(), $this->settings);
$this->langFiles = $this->utilityFuncs->readLanguageFiles([], $this->settings);

//init ajax
if ($this->settings['ajax.']) {
Expand Down
3 changes: 1 addition & 2 deletions Classes/Ajax/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Submit
public function main()
{
$this->init();
$content = '';

$settings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_formhandler_pi1.'];
$settings['usePredef'] = $this->globals->getSession()->get('predef');
Expand Down Expand Up @@ -78,7 +77,7 @@ protected function init()
}

$this->settings = $this->globals->getSession()->get('settings');
$this->langFiles = $this->utilityFuncs->readLanguageFiles(array(), $this->settings);
$this->langFiles = $this->utilityFuncs->readLanguageFiles([], $this->settings);

//init ajax
if ($this->settings['ajax.']) {
Expand Down
14 changes: 7 additions & 7 deletions Classes/Ajax/Validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ public function main()
$this->globals->setSession($this->componentManager->getComponent($sessionClass));
}
$validator = $this->componentManager->getComponent('\Typoheads\Formhandler\Validator\Ajax');
$errors = array();
$errors = [];
$valid = $validator->validateAjax($this->fieldname, $this->value, $errors);
$this->settings = $this->globals->getSession()->get('settings');
$content = '';

if ($valid) {
$content = $this->utilityFuncs->getSingle($this->settings['ajax.']['config.'], 'ok');
if (strlen($content) === 0) {
$content = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('formhandler') . 'Resources/Public/Images/ok.png' . '" />';
} else {
$gp = array(
$gp = [
$_GET['field'] => $_GET['value']
);
];
$view = $this->initView($content);
$content = $view->render($gp, $errors);
}
Expand All @@ -64,9 +64,9 @@ public function main()
$content = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('formhandler') . 'Resources/Public/Images/notok.png' . '" />';
} else {
$view = $this->initView($content);
$gp = array(
$gp = [
$_GET['field'] => $_GET['value']
);
];
$content = $view->render($gp, $errors);
}
$content = '<span class="error">' . $content . '</span>';
Expand Down Expand Up @@ -106,7 +106,7 @@ protected function initView($content)
{
$viewClass = '\Typoheads\Formhandler\View\AjaxValidation';
$view = $this->componentManager->getComponent($viewClass);
$view->setLangFiles($this->utilityFuncs->readLanguageFiles(array(), $this->settings));
$view->setLangFiles($this->utilityFuncs->readLanguageFiles([], $this->settings));
$view->setSettings($this->settings);
$templateName = 'AJAX';
$template = str_replace('###fieldname###', htmlspecialchars($_GET['field']), $content);
Expand Down
18 changes: 9 additions & 9 deletions Classes/AjaxHandler/JQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public function initAjax()
}
$this->submitButtonSelector = str_replace('"', '\"', $this->submitButtonSelector);

$this->validationStatusClasses = array(
$this->validationStatusClasses = [
'base' => 'formhandler-validation-status',
'valid' => 'form-valid',
'invalid' => 'form-invalid'
);
];
if (is_array($settings['ajax.']['config.']['validationStatusClasses.'])) {
if ($settings['ajax.']['config.']['validationStatusClasses.']['base']) {
$this->validationStatusClasses['base'] = $this->utilityFuncs->getSingle($settings['ajax.']['config.']['validationStatusClasses.'], 'base');
Expand Down Expand Up @@ -129,10 +129,10 @@ function submitButtonClick_' . $this->globals->getRandomID() . '(el) {
el.attr("disabled", "disabled");
';

$params = array(
$params = [
'eID' => 'formhandler-ajaxsubmit',
'uid' => intval($this->globals->getCObj()->data['uid'])
);
];
$url = $this->utilityFuncs->getAjaxUrl($params);
$js .= '
var requestURL = "' . $url . '";
Expand Down Expand Up @@ -242,11 +242,11 @@ public function fillAjaxMarkers(&$markers)
if ($this->globals->getFormValuesPrefix()) {
$fieldname = $this->globals->getFormValuesPrefix() . '[' . $fieldname . ']';
}
$params = array(
$params = [
'eID' => 'formhandler',
'field' => $replacedFieldname,
'value' => ''
);
];
$url = $this->utilityFuncs->getAjaxUrl($params);

$markers['###validate_' . $replacedFieldname . '###'] = '
Expand Down Expand Up @@ -351,15 +351,15 @@ function attachValidationEvents_' . $this->globals->getRandomID() . '() {
* @param string $text The link text to be used
* @param string $field The field name of the form field
* @param string $uploadedFileName The name of the file to be deleted
* @return void
* @return string
*/
public function getFileRemovalLink($text, $field, $uploadedFileName)
{
$params = array(
$params = [
'eID' => 'formhandler-removefile',
'field' => $field,
'uploadedFileName' => $uploadedFileName
);
];
$url = $this->utilityFuncs->getAjaxUrl($params);
$js = '
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function main($content, $setup)
$controller->setTemplateFile($templateFile);
}
if (strlen($langFile) > 0) {
$controller->setLangFiles(array($langFile));
$controller->setLangFiles([$langFile]);
}
if (strlen($predef) > 0) {
$controller->setPredefined($predef);
Expand Down
Loading

0 comments on commit ff37278

Please sign in to comment.