diff --git a/Classes/Ajax/RemoveFile.php b/Classes/Ajax/RemoveFile.php index 132caf11..93c2e08a 100644 --- a/Classes/Ajax/RemoveFile.php +++ b/Classes/Ajax/RemoveFile.php @@ -85,8 +85,6 @@ public function main() /** * Initialize the class. Read GET parameters - * - * @return void */ protected function init() { @@ -125,4 +123,4 @@ protected function init() $ajaxHandler->initAjax(); } } -} \ No newline at end of file +} diff --git a/Classes/Ajax/Submit.php b/Classes/Ajax/Submit.php index 1de53d6f..4ef403a3 100644 --- a/Classes/Ajax/Submit.php +++ b/Classes/Ajax/Submit.php @@ -51,8 +51,6 @@ public function main() /** * Initialize the class. Read GET parameters - * - * @return void */ protected function init() { diff --git a/Classes/Ajax/Validate.php b/Classes/Ajax/Validate.php index 0480874d..77ae926e 100644 --- a/Classes/Ajax/Validate.php +++ b/Classes/Ajax/Validate.php @@ -25,11 +25,10 @@ class Validate /** * @var array */ - protected $templates = array( + protected $templates = [ 'spanSuccess' => '%s', 'spanError' => '%s', - ); - + ]; /** * Main method of the class. @@ -87,8 +86,6 @@ public function main() /** * Initialize the class. Read GET parameters - * - * @return void */ protected function init() { diff --git a/Classes/AjaxHandler/AbstractAjaxHandler.php b/Classes/AjaxHandler/AbstractAjaxHandler.php index a8899242..4d2b4936 100644 --- a/Classes/AjaxHandler/AbstractAjaxHandler.php +++ b/Classes/AjaxHandler/AbstractAjaxHandler.php @@ -24,8 +24,6 @@ abstract class AbstractAjaxHandler extends \Typoheads\Formhandler\Component\Abst /** * Initialize AJAX stuff - * - * @return void */ abstract public function initAjax(); @@ -33,7 +31,6 @@ abstract public function initAjax(); * Initialize the AjaxHandler * * @param array $settings The settings of the AjaxHandler - * @return void */ public function init($settings) { @@ -46,7 +43,6 @@ public function init($settings) * The view passes the marker array by reference. * * @param array &$markers Reference to the marker array - * @return void */ abstract public function fillAjaxMarkers(&$markers); @@ -56,7 +52,6 @@ abstract public function fillAjaxMarkers(&$markers); * @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 */ abstract public function getFileRemovalLink($text, $field, $uploadedFileName); } diff --git a/Classes/AjaxHandler/JQuery.php b/Classes/AjaxHandler/JQuery.php index 067468aa..8e6a5f1b 100644 --- a/Classes/AjaxHandler/JQuery.php +++ b/Classes/AjaxHandler/JQuery.php @@ -24,24 +24,21 @@ class JQuery extends \Typoheads\Formhandler\AjaxHandler\AbstractAjaxHandler /** * @var array */ - protected $templates = array( + protected $templates = [ 'spanLoading'=>'', 'spanResult'=>'%s', 'aRemoveLink'=>'%s', - ); + ]; /** * Position of JS generated by AjaxHandler_JQuery (head|footer) * - * @access protected * @var string */ protected $jsPosition; /** * Initialize AJAX stuff - * - * @return void */ public function initAjax() { @@ -108,7 +105,6 @@ public function initAjax() * The view passes the marker array by reference. * * @param array &$markers Reference to the marker array - * @return void */ public function fillAjaxMarkers(&$markers) { @@ -203,20 +199,20 @@ protected function getJavascriptFormInit($formSelector, $submitButtonSelector, $ { return '(function( $ ) { $(function() { - $("'.$formSelector.'").formhandler({ - pageID: "'.$GLOBALS['TSFE']->id.'", - contentID: "'.$this->cObj->data['uid'].'", - randomID: "'.$this->globals->getRandomID().'", - formValuesPrefix: "'.$this->globals->getFormValuesPrefix().'", - lang: "'.$GLOBALS['TSFE']->sys_language_uid.'", - submitButtonSelector: "'.$submitButtonSelector.'", - ajaxSubmit: '.($isAjaxSubmit ? "true" : "false").', - autoDisableSubmitButton: '.($autoDisableSubmitButton ? "true" : "false").', - validateFields: [\''.implode("','", $validateFields).'\'], + $("' . $formSelector . '").formhandler({ + pageID: "' . $GLOBALS['TSFE']->id . '", + contentID: "' . $this->cObj->data['uid'] . '", + randomID: "' . $this->globals->getRandomID() . '", + formValuesPrefix: "' . $this->globals->getFormValuesPrefix() . '", + lang: "' . $GLOBALS['TSFE']->sys_language_uid . '", + submitButtonSelector: "' . $submitButtonSelector . '", + ajaxSubmit: ' . ($isAjaxSubmit ? 'true' : 'false') . ', + autoDisableSubmitButton: ' . ($autoDisableSubmitButton ? 'true' : 'false') . ', + validateFields: [\'' . implode("','", $validateFields) . '\'], validationStatusClasses: { - base: "'.$this->validationStatusClasses['base'].'", - valid: "'.$this->validationStatusClasses['valid'].'", - invalid: "'.$this->validationStatusClasses['invalid'].'" + base: "' . $this->validationStatusClasses['base'] . '", + valid: "' . $this->validationStatusClasses['valid'] . '", + invalid: "' . $this->validationStatusClasses['invalid'] . '" } }); }); diff --git a/Classes/Component/AbstractClass.php b/Classes/Component/AbstractClass.php index feab905f..a06fcc46 100644 --- a/Classes/Component/AbstractClass.php +++ b/Classes/Component/AbstractClass.php @@ -25,7 +25,6 @@ abstract class AbstractClass /** * The Formhandler component manager * - * @access protected * @var \Typoheads\Formhandler\Component\Manager */ protected $componentManager; @@ -33,7 +32,6 @@ abstract class AbstractClass /** * The global Formhandler configuration * - * @access protected * @var \Typoheads\Formhandler\Controller\Configuration */ protected $configuration; @@ -41,7 +39,6 @@ abstract class AbstractClass /** * The global Formhandler values * - * @access protected * @var \Typoheads\Formhandler\Utility\Globals */ protected $globals; @@ -49,7 +46,6 @@ abstract class AbstractClass /** * The Formhandler utility methods * - * @access protected * @var \Typoheads\Formhandler\Utility\GeneralUtility */ protected $utilityFuncs; @@ -57,7 +53,6 @@ abstract class AbstractClass /** * The cObj * - * @access protected * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */ protected $cObj; @@ -67,13 +62,12 @@ abstract class AbstractClass * * @param \Typoheads\Formhandler\Component\Manager $componentManager * @param \Typoheads\Formhandler\Controller\Configuration $configuration - * @return void */ public function __construct( \Typoheads\Formhandler\Component\Manager $componentManager, - \Typoheads\Formhandler\Controller\Configuration $configuration, - \Typoheads\Formhandler\Utility\Globals $globals, - \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs + \Typoheads\Formhandler\Controller\Configuration $configuration, + \Typoheads\Formhandler\Utility\Globals $globals, + \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs ) { $this->componentManager = $componentManager; $this->configuration = $configuration; diff --git a/Classes/Component/AbstractComponent.php b/Classes/Component/AbstractComponent.php index ab96660c..788f228f 100644 --- a/Classes/Component/AbstractComponent.php +++ b/Classes/Component/AbstractComponent.php @@ -25,7 +25,6 @@ abstract class AbstractComponent extends AbstractClass /** * The GET/POST parameters * - * @access protected * @var array */ protected $gp; @@ -33,7 +32,6 @@ abstract class AbstractComponent extends AbstractClass /** * Settings * - * @access protected * @var array */ protected $settings; @@ -43,8 +41,6 @@ abstract class AbstractComponent extends AbstractClass * * @param array $gp GET and POST variable array * @param array $settings Typoscript configuration for the component (component.1.config.*) - * - * @return void */ public function init($gp, $settings) { diff --git a/Classes/Component/Manager.php b/Classes/Component/Manager.php index b77e9a6d..3c1cf428 100644 --- a/Classes/Component/Manager.php +++ b/Classes/Component/Manager.php @@ -29,7 +29,6 @@ class Manager implements SingletonInterface /** * The global Formhandler values * - * @access protected * @var \Typoheads\Formhandler\Utility\Globals */ protected $globals; @@ -37,7 +36,6 @@ class Manager implements SingletonInterface /** * The global Formhandler values * - * @access protected * @var \Typoheads\Formhandler\Utility\GeneralUtility */ protected $utilityFuncs; diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php index dc197a24..289a37a6 100644 --- a/Classes/Controller/AbstractController.php +++ b/Classes/Controller/AbstractController.php @@ -25,7 +25,6 @@ abstract class AbstractController extends AbstractClass /** * The content returned by the controller * - * @access protected * @var Content */ protected $content; @@ -33,7 +32,6 @@ abstract class AbstractController extends AbstractClass /** * The key of a possibly selected predefined form * - * @access protected * @var string */ protected $predefined; @@ -41,7 +39,6 @@ abstract class AbstractController extends AbstractClass /** * The template file to be used. Only if template file was defined via plugin record * - * @access protected * @var string */ protected $templateFile; @@ -49,7 +46,6 @@ abstract class AbstractController extends AbstractClass /** * Array of configured translation files * - * @access protected * @var array */ protected $langFiles; @@ -58,7 +54,6 @@ abstract class AbstractController extends AbstractClass * Sets the content attribute of the controller * * @param Content $content - * @return void */ public function setContent($content) { @@ -79,7 +74,6 @@ public function getContent() * Sets the internal attribute "predefined" * * @param string $key - * @return void */ public function setPredefined($key) { @@ -90,7 +84,6 @@ public function setPredefined($key) * Sets the internal attribute "langFile" * * @param array $langFiles - * @return void */ public function setLangFiles($langFiles) { @@ -100,7 +93,6 @@ public function setLangFiles($langFiles) /** * Sets the template file attribute to $template * @param string $template - * @return void */ public function setTemplateFile($template) { diff --git a/Classes/Controller/Configuration.php b/Classes/Controller/Configuration.php index a343a89b..d847547b 100644 --- a/Classes/Controller/Configuration.php +++ b/Classes/Controller/Configuration.php @@ -31,15 +31,12 @@ class Configuration implements \ArrayAccess /** * The TS setup * - * @access protected * @var array */ protected $setup; /** * The constructor reading the TS setup into the according attribute - * - * @return void */ public function __construct() { @@ -60,7 +57,6 @@ public function __construct() * Merges the values of $setup with plugin.[xxx].settings * * @param array $setup - * @return void */ public function merge($setup) { diff --git a/Classes/Controller/Content.php b/Classes/Controller/Content.php index d1a28cb2..672ec2d8 100644 --- a/Classes/Controller/Content.php +++ b/Classes/Controller/Content.php @@ -23,15 +23,12 @@ class Content /** * The actual content * - * @access protected * @var string */ protected $content; /** * The constructor settings the internal attribute "content" - * - * @return void */ public function __construct($content) { @@ -42,7 +39,6 @@ public function __construct($content) * Sets the internal attribute "content" * * @param string $content - * @return void */ public function setContent($content) { diff --git a/Classes/Controller/Dispatcher.php b/Classes/Controller/Dispatcher.php index 8fa4862f..63babf01 100644 --- a/Classes/Controller/Dispatcher.php +++ b/Classes/Controller/Dispatcher.php @@ -24,7 +24,6 @@ class Dispatcher extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * Compontent Manager * - * @access protected * @var \Typoheads\Formhandler\Component\Manager */ protected $componentManager; @@ -32,7 +31,6 @@ class Dispatcher extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The global Formhandler values * - * @access protected * @var \Typoheads\Formhandler\Utility\Globals */ protected $globals; @@ -40,7 +38,6 @@ class Dispatcher extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The Formhandler utility functions * - * @access protected * @var \Typoheads\Formhandler\Utility\GeneralUtility */ protected $utilityFuncs; diff --git a/Classes/Controller/Form.php b/Classes/Controller/Form.php index fe76e25e..02fbde84 100644 --- a/Classes/Controller/Form.php +++ b/Classes/Controller/Form.php @@ -23,7 +23,6 @@ class Form extends AbstractController /** * The current GET/POST parameters of the form * - * @access protected * @var array */ protected $gp; @@ -31,7 +30,6 @@ class Form extends AbstractController /** * Contains all errors occurred while validation * - * @access protected * @var array */ protected $errors; @@ -39,7 +37,6 @@ class Form extends AbstractController /** * Holds the prefix value of all parameters of this form. * - * @access protected * @var string */ protected $formValuesPrefix; @@ -47,15 +44,13 @@ class Form extends AbstractController /** * Flag indicating if the form got submitted * - * @access protected - * @var boolean + * @var bool */ protected $submitted; /** * The settings array * - * @access protected * @var array */ protected $settings; @@ -63,15 +58,13 @@ class Form extends AbstractController /** * Flag indicating if debug mode is on * - * @access protected - * @var boolean + * @var bool */ protected $debugMode; /** * The view object * - * @access protected * @var misc */ protected $view; @@ -79,32 +72,28 @@ class Form extends AbstractController /** * The current step of the form * - * @access protected - * @var integer + * @var int */ protected $currentStep; /** * The last step of the form * - * @access protected - * @var integer + * @var int */ protected $lastStep; /** * Total steps of the form * - * @access protected - * @var integer + * @var int */ protected $totalSteps; /** * Flag indicating if form is finished (no more steps) * - * @access protected - * @var boolean + * @var bool */ protected $finished; @@ -145,9 +134,8 @@ public function process() if (!$this->submitted) { return $this->processNotSubmitted(); - } else { - return $this->processSubmitted(); } + return $this->processSubmitted(); } /** @@ -366,26 +354,22 @@ protected function processSubmitted() //if no more steps if ($this->finished) { return $this->processFinished(); - } else { - return $this->view->render($this->gp, $this->errors); } - } else { - $this->templateFile = $this->utilityFuncs->readTemplateFile($this->templateFile, $this->settings); - $this->globals->setTemplateCode($this->templateFile); - $this->langFiles = $this->utilityFuncs->readLanguageFiles($this->langFiles, $this->settings); - $this->globals->setLangFiles($this->langFiles); - - $this->view->setLangFiles($this->langFiles); - $this->view->setSettings($this->settings); - $this->setViewSubpart($this->currentStep); - return $this->processNotValid(); + return $this->view->render($this->gp, $this->errors); } + $this->templateFile = $this->utilityFuncs->readTemplateFile($this->templateFile, $this->settings); + $this->globals->setTemplateCode($this->templateFile); + $this->langFiles = $this->utilityFuncs->readLanguageFiles($this->langFiles, $this->settings); + $this->globals->setLangFiles($this->langFiles); + + $this->view->setLangFiles($this->langFiles); + $this->view->setSettings($this->settings); + $this->setViewSubpart($this->currentStep); + return $this->processNotValid(); } /** * Validate if the error checks have all been set correctly. - * - * @return void */ protected function validateErrorCheckConfig() { @@ -533,10 +517,9 @@ protected function processFinished() if (intval($this->utilityFuncs->getSingle($tsConfig['config.'], 'returns')) === 1) { $this->globals->getSession()->set('finished', true); return $finisher->process(); - } else { - $this->gp = $finisher->process(); - $this->globals->setGP($this->gp); } + $this->gp = $finisher->process(); + $this->globals->setGP($this->gp); } } else { $this->utilityFuncs->throwException('classesarray_error'); @@ -587,8 +570,6 @@ protected function processNotSubmitted() /** * Stores file names of uploaded files into the internal GET/POST parameters storage ($this->gp) so that they can be used later on in "value markers", userFuncs, ... - * - * @return void */ protected function storeFileNamesInGP() { @@ -631,8 +612,6 @@ protected function addDefaultComponentConfig($conf) /** * Adds a mandatory component to the classes array - * - * @return void */ protected function addFormhandlerClass(&$classesArray, $className) { @@ -657,11 +636,8 @@ protected function addFormhandlerClass(&$classesArray, $className) } } - /** * Removes files from the internal file storage - * - * @return void */ protected function processFileRemoval() { @@ -710,8 +686,6 @@ protected function processFileRemoval() /** * Processes uploaded files, moves them to a temporary upload folder, renames them if they already exist and * stores the information in user session - * - * @return void */ protected function processFiles() { @@ -797,7 +771,7 @@ protected function processFiles() $uploadedUrl = rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), '/'); $uploadedUrl .= '/' . trim($uploadFolder, '/') . '/'; $uploadedUrl .= trim($uploadedFileName, '/'); - + $tmp['uploaded_url'] = $uploadedUrl; $tmp['size'] = $files['size'][$field][$idx]; if (is_array($files['type'][$field][$idx])) { @@ -833,7 +807,6 @@ protected function processFiles() * Stores the current GET/POST parameters in SESSION * * @param array &$settings Reference to the settings array to get information about checkboxes and radiobuttons. - * @return void */ protected function storeGPinSession() { @@ -871,8 +844,6 @@ protected function storeGPinSession() /** * Resets the values in session to have a clean form - * - * @return void */ protected function reset($gp = []) { @@ -899,8 +870,6 @@ protected function reset($gp = []) /** * Searches for current step and sets $this->currentStep according - * - * @return void */ protected function findCurrentStep() { @@ -976,8 +945,6 @@ protected function findCurrentStep() /** * Validates the Formhandler config. * E.g. If email addresses were set in flexform then Finisher_Mail must exist in the TS configuration. - * - * @return void */ public function validateConfig() { @@ -1016,7 +983,6 @@ public function validateConfig() * Method to parse a conditions block of the TS setting "if" * * @param array $settings The settings of this form - * @return void */ protected function parseConditionsBlock($settings) { @@ -1051,8 +1017,6 @@ protected function parseConditionsBlock($settings) /** * Method to parse all conditions set in the TS setting "if" - * - * @return void */ protected function parseConditions() { @@ -1078,8 +1042,6 @@ protected function parseConditions() /** * Init method for the controller. * This method sets internal values, initializes the ajax handler and the session. - * - * @return void */ protected function init() { @@ -1208,7 +1170,7 @@ protected function init() /** * Checks if the form has been submitted * - * @return boolean + * @return bool */ protected function isFormSubmitted() { @@ -1230,7 +1192,6 @@ protected function isFormSubmitted() * Sets the template of the view. * * @param int The current step - * @return void */ protected function setViewSubpart($step) { @@ -1255,8 +1216,6 @@ protected function setViewSubpart($step) /** * Stores some settings of the form into the session - * - * @return void */ protected function storeSettingsInSession() { @@ -1278,7 +1237,6 @@ protected function storeSettingsInSession() * Loads form settings for a given step * * @param int $step The step to load the settings for - * @return void */ protected function loadSettingsForStep($step) { @@ -1292,8 +1250,6 @@ protected function loadSettingsForStep($step) /** * Sets the current and last step of the form - * - * @return void */ protected function getStepInformation() { @@ -1335,8 +1291,6 @@ protected function getStepInformation() /** * Merges the current GET/POST parameters with the stored ones in SESSION - * - * @return void */ protected function mergeGPWithSession() { @@ -1407,8 +1361,6 @@ protected function runClasses($classesArray) /** * Read stylesheet file(s) set in TypoScript. If set add to header data - * - * @return void */ protected function addCSS() { @@ -1434,8 +1386,6 @@ protected function addCSS() /** * Read JavaScript file(s) set in TypoScript. If set add to header data - * - * @return void */ protected function addJS() { @@ -1459,8 +1409,6 @@ protected function addJS() /** * Read JavaScript file(s) set in TypoScript. If set add to footer data - * - * @return void */ protected function addJSFooter() { @@ -1486,7 +1434,7 @@ protected function addJSFooter() * Find out if submitted form was valid. If one of the values in the given array $valid is false the submission was not valid. * * @param $validArr Array with the return values of each validator - * @return boolean + * @return bool */ protected function isValid($validArr) { @@ -1534,8 +1482,6 @@ protected function handleCheckBoxFields() /** * Initializes the debuggers set in TS. - * - * @return void */ protected function initializeDebuggers() { diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 85917a76..3baa3a99 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -22,7 +22,6 @@ class ModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle /** * The request arguments * - * @access protected * @var array */ protected $gp; @@ -30,7 +29,6 @@ class ModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle /** * The Formhandler component manager * - * @access protected * @var \Typoheads\Formhandler\Component\Manager */ protected $componentManager; @@ -38,8 +36,7 @@ class ModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle /** * The Formhandler utility funcs * - * @access protected - * @var \\Typoheads\Formhandler\Utility\GeneralUtility + * @var \Typoheads\Formhandler\Utility\GeneralUtility */ protected $utilityFuncs; @@ -56,7 +53,6 @@ class ModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle /** * init all actions - * @return void */ public function initializeAction() { @@ -90,7 +86,6 @@ public function initializeAction() /** * Displays log data - * @return void */ public function indexAction(\Typoheads\Formhandler\Domain\Model\Demand $demand = null) { @@ -126,7 +121,6 @@ public function viewAction(\Typoheads\Formhandler\Domain\Model\LogData $logDataR * Displays fields selector * @param string uids to export * @param string export file type (PDF || CSV) - * @return void */ public function selectFieldsAction($logDataUids = null, $filetype = '') { @@ -191,7 +185,6 @@ public function selectFieldsAction($logDataUids = null, $filetype = '') * @param string uids to export * @param array fields to export * @param string export file type (PDF || CSV) - * @return void */ public function exportAction($logDataUids = null, array $fields, $filetype = '') { diff --git a/Classes/Debugger/AbstractDebugger.php b/Classes/Debugger/AbstractDebugger.php index c57b6e8b..83905efd 100644 --- a/Classes/Debugger/AbstractDebugger.php +++ b/Classes/Debugger/AbstractDebugger.php @@ -38,7 +38,6 @@ public function process() * @param string $message The message to log * @param int $severity The severity of the message (1,2,3) * @param array $data Additional data to log - * @return void */ public function addToDebugLog($message = '', $severity = 1, array $data = []) { diff --git a/Classes/Debugger/DevLog.php b/Classes/Debugger/DevLog.php index 07eb4456..76f607e0 100644 --- a/Classes/Debugger/DevLog.php +++ b/Classes/Debugger/DevLog.php @@ -22,8 +22,6 @@ class DevLog extends AbstractDebugger /** * Inserts the messages to the devlog - * - * @return void */ public function outputDebugLog() { diff --git a/Classes/Debugger/PrintToScreen.php b/Classes/Debugger/PrintToScreen.php index 91b63ddd..48c37195 100644 --- a/Classes/Debugger/PrintToScreen.php +++ b/Classes/Debugger/PrintToScreen.php @@ -22,8 +22,6 @@ class PrintToScreen extends AbstractDebugger /** * Prints the messages to the screen - * - * @return void */ public function outputDebugLog() { @@ -49,8 +47,6 @@ public function outputDebugLog() /** * Sets default config for the debugger. - * - * @return void */ public function validateConfig() { diff --git a/Classes/Domain/Model/Demand.php b/Classes/Domain/Model/Demand.php index 393bc0bf..4a9d1d4a 100644 --- a/Classes/Domain/Model/Demand.php +++ b/Classes/Domain/Model/Demand.php @@ -108,7 +108,6 @@ public function getStartTimestamp() * Set calculated start timestamp from query constraints * * @param int $timestamp - * @return void */ public function setStartTimestamp($timestamp) { @@ -129,7 +128,6 @@ public function getEndTimestamp() * Set calculated end timestamp from query constraints * * @param int $timestamp - * @return void */ public function setEndTimestamp($timestamp) { diff --git a/Classes/Domain/Model/LogData.php b/Classes/Domain/Model/LogData.php index 6a00bff4..cda3a3f9 100644 --- a/Classes/Domain/Model/LogData.php +++ b/Classes/Domain/Model/LogData.php @@ -16,7 +16,6 @@ /** * Model for log data - * */ class LogData extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { diff --git a/Classes/Domain/Repository/LogDataRepository.php b/Classes/Domain/Repository/LogDataRepository.php index 428d274e..03b8bc13 100644 --- a/Classes/Domain/Repository/LogDataRepository.php +++ b/Classes/Domain/Repository/LogDataRepository.php @@ -16,15 +16,12 @@ /** * Repository for \Typoheads\Formhandler\Domain\Model\LogData - * */ class LogDataRepository extends \TYPO3\CMS\Extbase\Persistence\Repository { /** * Initializes the repository. - * - * @return void */ public function initializeObject() { @@ -41,7 +38,7 @@ public function initializeObject() */ public function findByUids($uids) { - $uidArray = explode(",", $uids); + $uidArray = explode(',', $uids); $query = $this->createQuery(); $uidConstraints = []; foreach ($uidArray as $key => $value) { @@ -81,8 +78,7 @@ public function findDemanded(\Typoheads\Formhandler\Domain\Model\Demand $demand if (count($constraints) > 0) { $query->matching($query->logicalAnd($constraints)); return $query->execute(); - } else { - return $this->findAll(); } + return $this->findAll(); } } diff --git a/Classes/Finisher/AutoDB.php b/Classes/Finisher/AutoDB.php index d3363176..e2aef548 100644 --- a/Classes/Finisher/AutoDB.php +++ b/Classes/Finisher/AutoDB.php @@ -158,9 +158,9 @@ protected function createTable() $res = $this->db->sql_query("SHOW TABLES LIKE '" . $this->table . "'"); if (!$this->db->sql_num_rows($res)) { - $query = "CREATE TABLE `" . $this->table . "` ( - `" . $this->key . "` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY - )"; + $query = 'CREATE TABLE `' . $this->table . '` ( + `' . $this->key . '` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY + )'; $this->db->sql_query($query); $this->utilityFuncs->debugMessage('sql_request', [$query]); $dbFields = [$this->key]; diff --git a/Classes/Finisher/DB.php b/Classes/Finisher/DB.php index 195280bc..c03aeeb2 100644 --- a/Classes/Finisher/DB.php +++ b/Classes/Finisher/DB.php @@ -61,7 +61,6 @@ class DB extends AbstractFinisher /** * The name of the table to put the values into. * - * @access protected * @var string */ protected $table; @@ -69,7 +68,6 @@ class DB extends AbstractFinisher /** * The field in the table holding the primary key. * - * @access protected * @var string */ protected $key; @@ -77,8 +75,7 @@ class DB extends AbstractFinisher /** * A flag to indicate if to insert the record or to update an existing one * - * @access protected - * @var boolean + * @var bool */ protected $doUpdate; @@ -141,7 +138,7 @@ public function process() * Method to query the database making an insert or update statement using the given fields. * * @param array &$queryFields Array holding the query fields - * @return boolean Success flag + * @return bool Success flag */ protected function save(&$queryFields) { @@ -206,8 +203,6 @@ protected function doUpdate($uid, $queryFields, $andWhere) /** * Inits the finisher mapping settings values to internal attributes. - * - * @return void */ public function init($gp, $settings) { diff --git a/Classes/Finisher/DifferentDB.php b/Classes/Finisher/DifferentDB.php index a6871ff5..5c984c77 100644 --- a/Classes/Finisher/DifferentDB.php +++ b/Classes/Finisher/DifferentDB.php @@ -40,7 +40,6 @@ class DifferentDB extends DB /** * The name of the database driver to use. * - * @access protected * @var string */ protected $driver; @@ -48,7 +47,6 @@ class DifferentDB extends DB /** * The name of the database host. * - * @access protected * @var string */ protected $host; @@ -56,15 +54,13 @@ class DifferentDB extends DB /** * The port the database listens. * - * @access protected - * @var integer + * @var int */ protected $port; /** * The name of the database. * - * @access protected * @var string */ protected $db; @@ -72,7 +68,6 @@ class DifferentDB extends DB /** * The username to use. * - * @access protected * @var string */ protected $user; @@ -86,7 +81,6 @@ class DifferentDB extends DB /** * The password to use. * - * @access protected * @var string */ protected $password; @@ -94,7 +88,6 @@ class DifferentDB extends DB /** * The connection object. * - * @access protected * @var \ADOConnection */ protected $connection; @@ -145,7 +138,7 @@ protected function doUpdate($uid, $queryFields, $andWhere) protected function doesRecordExist($uid, $andWhere) { $exists = false; - + if ($uid) { $uid = $GLOBALS['TYPO3_DB']->fullQuoteStr($uid, $this->table); $andWhere = $this->utilityFuncs->prepareAndWhereString($andWhere); @@ -153,7 +146,7 @@ protected function doesRecordExist($uid, $andWhere) /** @var \ADORecordSet $rs */ $rs = $this->connection->Execute($query); - + if ($rs->RecordCount() > 0) { $exists = true; } @@ -177,7 +170,6 @@ protected function getInsertedUid() * Inits the finisher mapping settings values to internal attributes. * * @see \Typoheads\Formhandler\Finisher\DB::init - * @return void */ public function init($gp, $settings) { diff --git a/Classes/Finisher/Mail.php b/Classes/Finisher/Mail.php index 75ff8b58..53a217d7 100644 --- a/Classes/Finisher/Mail.php +++ b/Classes/Finisher/Mail.php @@ -160,7 +160,6 @@ protected function parseTemplate($mode, $suffix) * Sends mail according to given type. * * @param string $type (admin|user) - * @return void */ protected function sendMail($type) { @@ -498,7 +497,6 @@ protected function parseEmbedFilesList($settings) * Substitutes markers like ###LLL:langKey### in given TypoScript settings array. * * @param array &$settings The E-Mail settings - * @return void */ protected function fillLangMarkersInSettings(&$settings) { @@ -529,7 +527,6 @@ protected function getSettings() * * @param array The GET/POST values * @param array The TypoScript configuration - * @return void */ public function init($gp, $tsConfig) { diff --git a/Classes/Finisher/Redirect.php b/Classes/Finisher/Redirect.php index 7c09ad58..10c789bd 100644 --- a/Classes/Finisher/Redirect.php +++ b/Classes/Finisher/Redirect.php @@ -51,7 +51,6 @@ public function process() * * @param array The GET/POST values * @param array The TypoScript configuration - * @return void */ public function init($gp, $tsConfig) { diff --git a/Classes/Finisher/SetLanguage.php b/Classes/Finisher/SetLanguage.php index a9a72365..3816a2c9 100644 --- a/Classes/Finisher/SetLanguage.php +++ b/Classes/Finisher/SetLanguage.php @@ -46,7 +46,6 @@ public function process() /** * Method to define whether the config is valid or not. If no, display a warning on the frontend. * The default value is true. This up to the finisher to overload this method - * */ public function validateConfig() { diff --git a/Classes/Finisher/StoreGP.php b/Classes/Finisher/StoreGP.php index d64b92e2..25c1be10 100644 --- a/Classes/Finisher/StoreGP.php +++ b/Classes/Finisher/StoreGP.php @@ -44,8 +44,6 @@ public function process() /** * Stores the GP in session. - * - * @return void */ protected function storeUserGPinSession() { @@ -61,8 +59,6 @@ protected function storeUserGPinSession() /** * Stores $this->gp parameters in SESSION * actually only needed for finisher_submittedok - * - * @return void */ protected function updateSession() { diff --git a/Classes/Finisher/StoreUploadedFiles.php b/Classes/Finisher/StoreUploadedFiles.php index 3dd7f57e..ab3fafa4 100644 --- a/Classes/Finisher/StoreUploadedFiles.php +++ b/Classes/Finisher/StoreUploadedFiles.php @@ -65,8 +65,6 @@ public function process() * plugin.Tx_Formhandler.settings.finishers.1.config.finishedUploadFolder = uploads/formhandler/finishedFiles/ * plugin.Tx_Formhandler.settings.finishers.1.config.renameScheme = [filename]_[md5]_[time] * - * - * @return void */ protected function moveUploadedFiles() { diff --git a/Classes/Generator/BackendCsv.php b/Classes/Generator/BackendCsv.php index b882ed1e..eac61473 100644 --- a/Classes/Generator/BackendCsv.php +++ b/Classes/Generator/BackendCsv.php @@ -24,7 +24,6 @@ class BackendCsv extends \Typoheads\Formhandler\Component\AbstractComponent /** * The internal CSV object * - * @access protected * @var export2CSV */ protected $csv; @@ -63,7 +62,6 @@ public function init($gp, $settings) * @param array $records The records to export to CSV * @param array $exportParams A list of fields to export. If not set all fields are exported * @see Tx_Formhandler_Controller_Backend::generateCSV() - * @return void */ public function process() { diff --git a/Classes/Generator/BackendTcPdf.php b/Classes/Generator/BackendTcPdf.php index 32409cfb..4a438e8c 100644 --- a/Classes/Generator/BackendTcPdf.php +++ b/Classes/Generator/BackendTcPdf.php @@ -24,7 +24,6 @@ class BackendTcPdf extends \Typoheads\Formhandler\Component\AbstractComponent /** * The internal PDF object * - * @access protected * @var Tx_Formhandler_Template_TCPDF */ protected $pdf; @@ -64,7 +63,6 @@ public function init($gp, $settings) } /** - * @return void */ public function process() { @@ -182,7 +180,6 @@ public function process() * Sets the template code for the PDF * * @param string $templateCode The template code - * @return void */ public function setTemplateCode($templateCode) { diff --git a/Classes/Generator/Csv.php b/Classes/Generator/Csv.php index 20e45ed5..610fc35d 100644 --- a/Classes/Generator/Csv.php +++ b/Classes/Generator/Csv.php @@ -91,21 +91,19 @@ public function process() $csv->save($filename, $data, false, $fields); if (intval($this->settings['returnFileName']) === 1) { return $filename; - } else { - if (!is_array($this->gp['generator-csv-generated-files'])) { - $this->gp['generator-csv-generated-files'] = []; - } - $this->gp['generator-csv-generated-files'][] = $filename; - return $this->gp; } - } else { - $fileName = 'formhandler.csv'; - if ($this->settings['outputFileName']) { - $fileName = $this->utilityFuncs->getSingle($this->settings, 'outputFileName'); + if (!is_array($this->gp['generator-csv-generated-files'])) { + $this->gp['generator-csv-generated-files'] = []; } - $csv->output($fileName, $data, $fields); - die(); + $this->gp['generator-csv-generated-files'][] = $filename; + return $this->gp; + } + $fileName = 'formhandler.csv'; + if ($this->settings['outputFileName']) { + $fileName = $this->utilityFuncs->getSingle($this->settings, 'outputFileName'); } + $csv->output($fileName, $data, $fields); + die(); } /* (non-PHPdoc) diff --git a/Classes/Generator/File.php b/Classes/Generator/File.php index 8fa2d7cd..c4f722be 100644 --- a/Classes/Generator/File.php +++ b/Classes/Generator/File.php @@ -22,8 +22,6 @@ class File extends AbstractGenerator /** * Renders the XML file. - * - * @return void */ public function process() { @@ -61,7 +59,7 @@ public function process() } $view->setComponentSettings($this->settings); - $content = $view->render($this->gp, array()); + $content = $view->render($this->gp, []); $returns = $this->settings['returnFileName']; $contentType = $this->utilityFuncs->getSingle($this->settings, 'contentType'); @@ -80,19 +78,18 @@ public function process() header('Content-type: ' . $contentType); header('Location: ' . $downloadpath); exit; - } else { - header('Content-type: ' . $contentType); - header('Content-Disposition: attachment; filename="' . $this->filenameOnly . '"'); - echo $content; - exit; } + header('Content-type: ' . $contentType); + header('Content-Disposition: attachment; filename="' . $this->filenameOnly . '"'); + echo $content; + exit; } protected function getComponentLinkParams($linkGP) { $prefix = $this->globals->getFormValuesPrefix(); - $tempParams = array('action' => 'file'); - $params = array(); + $tempParams = ['action' => 'file']; + $params = []; if ($prefix) { $params[$prefix] = $tempParams; diff --git a/Classes/Generator/PdfGenerator.php b/Classes/Generator/PdfGenerator.php index 1b09eb4b..e2465153 100644 --- a/Classes/Generator/PdfGenerator.php +++ b/Classes/Generator/PdfGenerator.php @@ -22,8 +22,6 @@ class PdfGenerator extends AbstractGenerator /** * Renders the PDF. - * - * @return void */ public function process() { diff --git a/Classes/Generator/TcPdf.php b/Classes/Generator/TcPdf.php index 680df441..6501b5ea 100644 --- a/Classes/Generator/TcPdf.php +++ b/Classes/Generator/TcPdf.php @@ -82,14 +82,13 @@ public function process() $downloadpath = str_replace($this->utilityFuncs->getDocumentRoot(), '', $downloadpath); header('Location: ' . $downloadpath); exit; - } else { - $fileName = 'formhandler.pdf'; - if ($this->settings['outputFileName']) { - $fileName = $this->utilityFuncs->getSingle($this->settings, 'outputFileName'); - } - $this->pdf->Output($fileName, 'D'); - exit; } + $fileName = 'formhandler.pdf'; + if ($this->settings['outputFileName']) { + $fileName = $this->utilityFuncs->getSingle($this->settings, 'outputFileName'); + } + $this->pdf->Output($fileName, 'D'); + exit; } /* (non-PHPdoc) diff --git a/Classes/Interceptor/AbstractInterceptor.php b/Classes/Interceptor/AbstractInterceptor.php index d639801c..6957fac9 100644 --- a/Classes/Interceptor/AbstractInterceptor.php +++ b/Classes/Interceptor/AbstractInterceptor.php @@ -24,8 +24,7 @@ abstract class AbstractInterceptor extends \Typoheads\Formhandler\Component\Abst /** * Logs an action of an interceptor, e.g. if Interceptor_IPBlocking blocked a request. * - * @param boolean $markAsSpam Indicates if this was a blocked SPAM attempt. Will be highlighted in the backend module. - * @return void + * @param bool $markAsSpam Indicates if this was a blocked SPAM attempt. Will be highlighted in the backend module. */ protected function log($markAsSpam = false) { diff --git a/Classes/Interceptor/AntiSpamFormTime.php b/Classes/Interceptor/AntiSpamFormTime.php index 3fe96b44..cb3851c6 100644 --- a/Classes/Interceptor/AntiSpamFormTime.php +++ b/Classes/Interceptor/AntiSpamFormTime.php @@ -48,31 +48,30 @@ public function process() $this->globals->getSession()->reset(); $this->utilityFuncs->doRedirectBasedOnSettings($this->settings, $this->gp); return 'Lousy spammer!'; - } else { + } - //set view - $viewClass = '\Typoheads\Formhandler\View\AntiSpam'; - if ($this->settings['view']) { - $viewClass = $this->utilityFuncs->getSingle($this->settings, 'view'); - } - $viewClass = $this->utilityFuncs->prepareClassName($viewClass); - $view = $this->componentManager->getComponent($viewClass); - $view->setLangFiles($this->globals->getLangFiles()); - $view->setPredefined($this->predefined); + //set view + $viewClass = '\Typoheads\Formhandler\View\AntiSpam'; + if ($this->settings['view']) { + $viewClass = $this->utilityFuncs->getSingle($this->settings, 'view'); + } + $viewClass = $this->utilityFuncs->prepareClassName($viewClass); + $view = $this->componentManager->getComponent($viewClass); + $view->setLangFiles($this->globals->getLangFiles()); + $view->setPredefined($this->predefined); - $templateCode = $this->globals->getTemplateCode(); - if ($this->settings['templateFile']) { - $templateCode = $this->utilityFuncs->readTemplateFile(false, $this->settings); - } - $view->setTemplate($templateCode, 'ANTISPAM'); - if (!$view->hasTemplate()) { - $this->utilityFuncs->throwException('spam_detected'); - return 'Lousy spammer!'; - } - $content = $view->render($this->gp, []); - $this->globals->getSession()->reset(); - return $content; + $templateCode = $this->globals->getTemplateCode(); + if ($this->settings['templateFile']) { + $templateCode = $this->utilityFuncs->readTemplateFile(false, $this->settings); + } + $view->setTemplate($templateCode, 'ANTISPAM'); + if (!$view->hasTemplate()) { + $this->utilityFuncs->throwException('spam_detected'); + return 'Lousy spammer!'; } + $content = $view->render($this->gp, []); + $this->globals->getSession()->reset(); + return $content; } return $this->gp; } @@ -80,7 +79,7 @@ public function process() /** * Performs checks if the submitted form should be treated as Spam. * - * @return boolean + * @return bool */ protected function doCheck() { diff --git a/Classes/Interceptor/IPBlocking.php b/Classes/Interceptor/IPBlocking.php index a8029d5d..98bfacd4 100644 --- a/Classes/Interceptor/IPBlocking.php +++ b/Classes/Interceptor/IPBlocking.php @@ -50,7 +50,6 @@ class IPBlocking extends AbstractInterceptor /** * The table where the form submissions are logged * - * @access protected * @var string */ protected $logTable = 'tx_formhandler_log'; @@ -87,8 +86,7 @@ public function process() * @param int Timebase value * @param string Timebase unit (seconds|minutes|hours|days) * @param int maximum amount of submissions in given time base. - * @param boolean add IP address to where clause - * @return void + * @param bool add IP address to where clause */ private function check($value, $unit, $maxValue, $addIPToWhere = true) { @@ -150,7 +148,6 @@ private function check($value, $unit, $maxValue, $addIPToWhere = true) * * @param string (ip|global) Defines the message sent * @param array The select rows of log table - * @return void */ private function sendReport($type, $rows) { diff --git a/Classes/Interceptor/ParseValues.php b/Classes/Interceptor/ParseValues.php index 1b72ba4a..8d4615e9 100644 --- a/Classes/Interceptor/ParseValues.php +++ b/Classes/Interceptor/ParseValues.php @@ -39,7 +39,6 @@ public function process() /** * parses the given field values from strings to floats * - * @return void * @param array $fields */ protected function parseFloats($fields) diff --git a/Classes/Interceptor/RemoveXSS.php b/Classes/Interceptor/RemoveXSS.php index c73f8ad5..5e337539 100644 --- a/Classes/Interceptor/RemoveXSS.php +++ b/Classes/Interceptor/RemoveXSS.php @@ -127,7 +127,7 @@ public function sanitizeValues($values) * * @author hmdker * @param string - * @return boolean is UTF-8 + * @return bool is UTF-8 */ protected function isUTF8($str) { @@ -137,7 +137,8 @@ protected function isUTF8($str) if ($c > 128) { if (($c >= 254)) { return false; - } elseif ($c >= 252) { + } + if ($c >= 252) { $bits = 6; } elseif ($c >= 248) { $bits = 5; diff --git a/Classes/Mailer/AbstractMailer.php b/Classes/Mailer/AbstractMailer.php index d5344e0d..5be14cae 100644 --- a/Classes/Mailer/AbstractMailer.php +++ b/Classes/Mailer/AbstractMailer.php @@ -22,8 +22,6 @@ abstract class AbstractMailer extends \Typoheads\Formhandler\Component\AbstractC /** * Not needed for this type of component - * - * @return void */ public function process() { diff --git a/Classes/Mailer/MailerInterface.php b/Classes/Mailer/MailerInterface.php index 971fc287..bbdd43cc 100644 --- a/Classes/Mailer/MailerInterface.php +++ b/Classes/Mailer/MailerInterface.php @@ -8,7 +8,7 @@ interface MailerInterface * Sends the email to the given reccipients * * @param array $recipients - * @return boolean Sent successfully? + * @return bool Sent successfully? */ public function send($recipients); @@ -16,7 +16,6 @@ public function send($recipients); * Set the HTML content of the email * * @param string $html The HTML content - * @return void */ public function setHTML($html); @@ -24,7 +23,6 @@ public function setHTML($html); * Set the plain text content of the email * * @param string $plain The plain text content - * @return void */ public function setPlain($plain); @@ -32,7 +30,6 @@ public function setPlain($plain); * Set the subject of the email * * @param string $value The subject - * @return void */ public function setSubject($value); @@ -41,7 +38,6 @@ public function setSubject($value); * * @param string $email The email address * @param string $name The name - * @return void */ public function setSender($email, $name); @@ -50,7 +46,6 @@ public function setSender($email, $name); * * @param string $email The email address * @param string $name The name - * @return void */ public function setReplyTo($email, $name); @@ -59,7 +54,6 @@ public function setReplyTo($email, $name); * * @param string $email The email address * @param string $name The name - * @return void */ public function addCc($email, $name); @@ -68,7 +62,6 @@ public function addCc($email, $name); * * @param string $email The email address * @param string $name The name - * @return void */ public function addBcc($email, $name); @@ -76,7 +69,6 @@ public function addBcc($email, $name); * Set the return path of the email * * @param string $value The return path - * @return void */ public function setReturnPath($value); @@ -84,7 +76,6 @@ public function setReturnPath($value); * Add an email header * * @param string $value The header - * @return void */ public function addHeader($value); @@ -92,7 +83,6 @@ public function addHeader($value); * Add an attachment to the email * * @param string $value The file name - * @return void */ public function addAttachment($value); @@ -156,7 +146,6 @@ public function getReturnPath(); * Embeds an image to the email content * * @param string $image The image path - * @return void */ public function embed($image); } diff --git a/Classes/Mailer/TYPO3Mailer.php b/Classes/Mailer/TYPO3Mailer.php index 3b6dc6f3..03580363 100644 --- a/Classes/Mailer/TYPO3Mailer.php +++ b/Classes/Mailer/TYPO3Mailer.php @@ -51,9 +51,9 @@ class TYPO3Mailer extends AbstractMailer implements MailerInterface */ public function __construct( \Typoheads\Formhandler\Component\Manager $componentManager, - \Typoheads\Formhandler\Controller\Configuration $configuration, - \Typoheads\Formhandler\Utility\Globals $globals, - \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs + \Typoheads\Formhandler\Controller\Configuration $configuration, + \Typoheads\Formhandler\Utility\Globals $globals, + \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs ) { parent::__construct($componentManager, $configuration, $globals, $utilityFuncs); $this->emailObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Mail\MailMessage'); @@ -192,9 +192,8 @@ public function getHTML() { if (isset($this->htmlMimePart)) { return $this->htmlMimePart->getBody(); - } else { - return ''; } + return ''; } /* (non-PHPdoc) @@ -204,9 +203,8 @@ public function getPlain() { if (isset($this->plainMimePart)) { return $this->plainMimePart->getBody(); - } else { - return ''; } + return ''; } /* (non-PHPdoc) diff --git a/Classes/PreProcessor/ClearSession.php b/Classes/PreProcessor/ClearSession.php index c3277150..f51fec63 100644 --- a/Classes/PreProcessor/ClearSession.php +++ b/Classes/PreProcessor/ClearSession.php @@ -21,7 +21,6 @@ * * preProcessors.1.class = Tx_Formhandler_PreProcessor_ClearSession * - * */ class ClearSession extends AbstractPreProcessor { diff --git a/Classes/PreProcessor/ClearTempFiles.php b/Classes/PreProcessor/ClearTempFiles.php index 9759846f..68a4a9e5 100644 --- a/Classes/PreProcessor/ClearTempFiles.php +++ b/Classes/PreProcessor/ClearTempFiles.php @@ -49,9 +49,8 @@ public function process() * Deletes all files older than a specific time in a temporary upload folder. * Settings for the threshold time and the folder are made in TypoScript. * - * @param integer $olderThanValue Delete files older than this value. + * @param int $olderThanValue Delete files older than this value. * @param string $olderThanUnit The unit for $olderThan. May be seconds|minutes|hours|days - * @return void */ protected function clearTempFiles($olderThanValue, $olderThanUnit) { diff --git a/Classes/PreProcessor/LoadDB.php b/Classes/PreProcessor/LoadDB.php index a5b7d66d..35290875 100644 --- a/Classes/PreProcessor/LoadDB.php +++ b/Classes/PreProcessor/LoadDB.php @@ -47,26 +47,23 @@ * * @author Mathias Bolt Lesniak, LiliO Design */ - class LoadDB extends AbstractPreProcessor { /** - * @var Array $data as associative array. Row data from DB. - * @access protected + * @var array $data as associative array. Row data from DB. */ protected $data; /** - * @var Array $files as associative array. - * @access protected + * @var array $files as associative array. */ protected $files; /** * Main method called by the controller * - * @return Array GP + * @return array GP */ public function process() { @@ -90,7 +87,6 @@ public function process() /** * Loads data from DB intto the GP Array * - * @return void * @param array $settings */ protected function loadDBToGP($settings) @@ -109,8 +105,7 @@ protected function loadDBToGP($settings) /** * Loads DB data into the Session. Used only for step 2+. * - * @return void - * @param Array $settings + * @param array $settings * @param int $step */ protected function loadDBToSession($settings, $step) @@ -195,8 +190,8 @@ protected function parseValue($fieldname, $settings) /** * Loads data from DB * - * @return Array of row data - * @param Array $settings + * @return array of row data + * @param array $settings * @param int $step */ protected function loadDB($settings) @@ -213,7 +208,8 @@ protected function loadDB($settings) $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $GLOBALS['TYPO3_DB']->sql_free_result($res); return $row; - } elseif ($rowCount > 0) { + } + if ($rowCount > 0) { $this->utilityFuncs->debugMessage('sql_too_many_rows', [$rowCount], 3); } return []; @@ -242,7 +238,7 @@ protected function exec_getQuery($table, $conf) $quotes = '|\"|\`|\''; //if pidInList is not set in TypoScript remove it from the where clause. if (!isset($conf['pidInList']) || strlen($conf['pidInList']) === 0) { - $queryParts['WHERE'] = preg_replace('/([^ ]+\.('.$quotes.')pid('.$quotes.') IN \([^ ]+\) AND )/i', '', $queryParts['WHERE']); + $queryParts['WHERE'] = preg_replace('/([^ ]+\.(' . $quotes . ')pid(' . $quotes . ') IN \([^ ]+\) AND )/i', '', $queryParts['WHERE']); } return $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); } diff --git a/Classes/PreProcessor/LoadDefaultValues.php b/Classes/PreProcessor/LoadDefaultValues.php index 2d5012d3..2e98f36c 100644 --- a/Classes/PreProcessor/LoadDefaultValues.php +++ b/Classes/PreProcessor/LoadDefaultValues.php @@ -40,7 +40,6 @@ * * @author Johannes Feustel */ - class LoadDefaultValues extends AbstractPreProcessor { public function process() @@ -61,7 +60,6 @@ public function process() * adapted from class tx_thmailformplus_pi1 * Loads the default values to the GP Array * - * @return void * @param array $settings */ public function loadDefaultValuesToGP($settings) @@ -74,8 +72,7 @@ public function loadDefaultValuesToGP($settings) /** * loads the Default Setting in the Session. Used only for step 2+. * - * @return void - * @param Array $settings + * @param array $settings * @param int $step */ private function loadDefaultValuesToSession($settings, $step) @@ -90,7 +87,6 @@ private function loadDefaultValuesToSession($settings, $step) /** * Recursive method to set the GP values * - * @return void * @param array $fields * @param array &$currentLevelGP */ diff --git a/Classes/Session/AbstractSession.php b/Classes/Session/AbstractSession.php index 394f1833..848e16c6 100644 --- a/Classes/Session/AbstractSession.php +++ b/Classes/Session/AbstractSession.php @@ -23,15 +23,12 @@ abstract class AbstractSession extends \Typoheads\Formhandler\Component\Abstract /** * An indicator if a session was already started * - * @access protected - * @var boolean + * @var bool */ protected $started = false; /** * Starts a new session - * - * @return void */ public function start() { @@ -53,7 +50,6 @@ public function start() * * @param string $key The key * @param string $value The value to set - * @return void */ abstract public function set($key, $value); @@ -61,7 +57,6 @@ abstract public function set($key, $value); * Sets multiple keys at once * * @param array $values key value pairs - * @return void */ abstract public function setMultiple($values); @@ -76,14 +71,12 @@ abstract public function get($key); /** * Checks if a session exists * - * @return boolean + * @return bool */ abstract public function exists(); /** * Resets all session values - * - * @return void */ abstract public function reset(); @@ -105,8 +98,6 @@ protected function getOldSessionThreshold() * * @param array $gp GET and POST variable array * @param array $settings Typoscript configuration for the component (component.1.config.*) - * - * @return void */ public function init($gp, $settings) { diff --git a/Classes/Utility/GeneralUtility.php b/Classes/Utility/GeneralUtility.php index 2d086886..1e36df9d 100644 --- a/Classes/Utility/GeneralUtility.php +++ b/Classes/Utility/GeneralUtility.php @@ -13,9 +13,9 @@ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * * Public License for more details. * * */ +use TYPO3\CMS\Core\Crypto\Random; use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\MathUtility; -use \TYPO3\CMS\Core\Crypto\Random; /** * A class providing helper functions for Formhandler @@ -41,7 +41,7 @@ public static function getMergedGP() if (is_array($gp[$prefix])) { $gp = $gp[$prefix]; } else { - $gp = array(); + $gp = []; } } @@ -110,7 +110,6 @@ public static function substituteMarkerArray($content, $markContentArray) } /** - * * Returns the first subpart encapsulated in the marker, $marker (possibly present in $content as a HTML comment) * * @param string Content with subpart wrapped in fx. "###CONTENT_PART###" inside. @@ -204,7 +203,6 @@ public static function readTemplateFile($templateFile, &$settings) * @param array $langFiles * @param array $settings * @return array - */ public static function readLanguageFiles($langFiles, &$settings) { @@ -268,7 +266,7 @@ public static function getSingle($arr, $key) public static function isValidCObject($str) { - return ( + return $str === 'CASE' || $str === 'CLEARGIF' || $str === 'COA' || $str === 'COA_INT' || $str === 'COLUMNS' || $str === 'CONTENT' || $str === 'CTABLE' || $str === 'EDITPANEL' || $str === 'FILE' || $str === 'FILES' || $str === 'FLUIDTEMPLATE' || $str === 'FORM' || @@ -277,7 +275,7 @@ public static function isValidCObject($str) $str === 'MULTIMEDIA' || $str === 'OTABLE' || $str === 'QTOBJECT' || $str === 'RECORDS' || $str === 'RESTORE_REGISTER' || $str === 'SEARCHRESULT' || $str === 'SVG' || $str === 'SWFOBJECT' || $str === 'TEMPLATE' || $str === 'TEXT' || $str === 'USER' || $str === 'USER_INT' - ); + ; } public static function getPreparedClassName($settingsArray, $defaultClassName = '') @@ -293,8 +291,7 @@ public static function getPreparedClassName($settingsArray, $defaultClassName = * Redirects to a specified page or URL. * * @param mixed $redirect Page id or URL to redirect to - * @param boolean $correctRedirectUrl replace & with & in URL - * @return void + * @param bool $correctRedirectUrl replace & with & in URL */ public static function doRedirect($redirect, $correctRedirectUrl, $additionalParams = [], $headerStatusCode = '') { @@ -345,7 +342,6 @@ public static function doRedirect($redirect, $correctRedirectUrl, $additionalPar * @param array $settings Array containing the redirect settings * @param array $gp Array with GET/POST parameters * @param string $redirectPageSetting Name of the Typoscript setting which holds the redirect page. - * @return void */ public static function doRedirectBasedOnSettings($settings, $gp, $redirectPageSetting = 'redirectPage') { @@ -372,9 +368,8 @@ public static function doRedirectBasedOnSettings($settings, $gp, $redirectPageSe } self::doRedirect($redirectPage, $correctRedirectUrl, $additionalParams, $headerStatusCode); exit(); - } else { - self::debugMessage('No redirectPage set.'); } + self::debugMessage('No redirectPage set.'); } /** @@ -407,7 +402,6 @@ public static function pi_getFFvalue($T3FlexForm_array, $fieldName, $sheet = 'sD * @param array Array where each value points to a key in the FlexForms content - the input array will have the value returned pointed to by these keys. All integer keys will not take their integer counterparts, but rather traverse the current position in the array an return element number X (whether this is right behavior is not settled yet...) * @param string Value for outermost key, typ. "vDEF" depending on language. * @return mixed The value, typ. string. - * @access private * @see pi_getFFvalue() */ public static function pi_getFFvalueFromSheetArray($sheetArray, $fieldNameArr, $value) @@ -565,7 +559,6 @@ public static function getFilledLangMarkers(&$template, $langFiles) * @param array $printfArgs If the messsage contains placeholders for usage with printf, pass the replacement values in this array. * @param int $severity The severity of the message. Valid values are 1,2 and 3 (1= info, 2 = warning, 3 = error) * @param array $data Additional debug data (e.g. the array of GET/POST values) - * @return void */ public static function debugMessage($key, array $printfArgs = [], $severity = 1, array $data = []) { @@ -609,21 +602,19 @@ public static function debugMailContent($emailObj) * Manages the exception throwing * * @param string $key Key in language file - * @return void */ public static function throwException($key) { $message = self::getExceptionMessage($key); if (strlen($message) == 0) { throw new \Exception($key); - } else { - if (func_num_args() > 1) { - $args = func_get_args(); - array_shift($args); - $message = vsprintf($message, $args); - } - throw new \Exception($message); } + if (func_num_args() > 1) { + $args = func_get_args(); + array_shift($args); + $message = vsprintf($message, $args); + } + throw new \Exception($message); } /** @@ -958,11 +949,11 @@ public static function convertBytes($value) { if (is_numeric($value)) { return $value; - } else { - $value_length = strlen($value); - $qty = substr($value, 0, $value_length - 1); - $unit = strtolower(substr($value, $value_length - 1)); - switch ($unit) { + } + $value_length = strlen($value); + $qty = substr($value, 0, $value_length - 1); + $unit = strtolower(substr($value, $value_length - 1)); + switch ($unit) { case 'k': $qty *= 1024; break; @@ -973,19 +964,18 @@ public static function convertBytes($value) $qty *= 1073741824; break; } - return $qty; - } + return $qty; } /** * Check if a given string is a file path or contains parsed HTML template data * * @param string $templateFile - * @return boolean + * @return bool */ public static function isTemplateFilePath($templateFile) { - return (stristr($templateFile, '###TEMPLATE_') === false); + return stristr($templateFile, '###TEMPLATE_') === false; } /** diff --git a/Classes/Utility/TcaUtility.php b/Classes/Utility/TcaUtility.php index 59522ede..9fd82dd4 100644 --- a/Classes/Utility/TcaUtility.php +++ b/Classes/Utility/TcaUtility.php @@ -24,7 +24,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - /** * UserFunc for rendering of log entry */ @@ -73,13 +72,13 @@ public function addFields_predefinedJS($config) $divId = $GLOBALS['SOBE']->tceforms->dynNestedStack[0][1]; if (!$divId) { - $divId = "DIV.c-tablayer"; + $divId = 'DIV.c-tablayer'; } else { - $divId .= "-DIV"; + $divId .= '-DIV'; } $js .= "var uid = '" . $uid . "'\n"; $js .= "var flexformBoxId = '" . $divId . "'\n"; - $js .= "var newRecord = " . $newRecord . "\n"; + $js .= 'var newRecord = ' . $newRecord . "\n"; $js .= file_get_contents(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('formhandler') . 'Resources/Public/JavaScript/addFields_predefinedJS.js'); $js .= "/*]]>*/\n"; $js .= "\n"; @@ -117,7 +116,7 @@ public function addFields_predefined($config) $predef = []; - # no config available + // no config available if (!is_array($ts['plugin.']['Tx_Formhandler.']['settings.']['predef.']) || count($ts['plugin.']['Tx_Formhandler.']['settings.']['predef.']) === 0) { $optionList[] = [ 0 => $GLOBALS['LANG']->sL('LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:be_missing_config'), @@ -126,7 +125,7 @@ public function addFields_predefined($config) return $config['items'] = array_merge($config['items'], $optionList); } - # for each view + // for each view foreach ($ts['plugin.']['Tx_Formhandler.']['settings.']['predef.'] as $key => $view) { if (is_array($view)) { $beName = $view['name']; diff --git a/Classes/Utility/TemplateTCPDF.php b/Classes/Utility/TemplateTCPDF.php index 07fd505b..0279fdcd 100644 --- a/Classes/Utility/TemplateTCPDF.php +++ b/Classes/Utility/TemplateTCPDF.php @@ -23,7 +23,6 @@ class TemplateTCPDF extends \TCPDF /** * Path to language file * - * @access protected * @var string */ protected $sysLangFile; @@ -31,7 +30,6 @@ class TemplateTCPDF extends \TCPDF /** * Text for the header * - * @access protected * @var string */ protected $headerText; @@ -39,7 +37,6 @@ class TemplateTCPDF extends \TCPDF /** * Text for the footer * - * @access protected * @var string */ protected $footerText; @@ -52,8 +49,6 @@ public function __construct() /** * Generates the header of the page - * - * @return void */ public function Header() { @@ -78,8 +73,6 @@ public function Header() /** * Generates the footer - * - * @return void */ public function Footer() { diff --git a/Classes/Validator/AbstractValidator.php b/Classes/Validator/AbstractValidator.php index ca1173bd..c42cda0a 100644 --- a/Classes/Validator/AbstractValidator.php +++ b/Classes/Validator/AbstractValidator.php @@ -24,7 +24,7 @@ abstract class AbstractValidator extends \Typoheads\Formhandler\Component\Abstra * Validates the submitted values using given settings * * @param array $errors Reference to the errors array to store the errors occurred - * @return boolean + * @return bool */ abstract public function validate(&$errors); diff --git a/Classes/Validator/Ajax.php b/Classes/Validator/Ajax.php index ffc25a0b..fe49fce9 100644 --- a/Classes/Validator/Ajax.php +++ b/Classes/Validator/Ajax.php @@ -22,7 +22,6 @@ class Ajax extends AbstractValidator /** * Array holding the configured validators * - * @access protected * @var array */ protected $validators; @@ -38,7 +37,7 @@ public function validate(&$errors) * Validates the submitted values using given settings * * @param array &$errors Reference to the errors array to store the errors occurred - * @return boolean + * @return bool */ public function validateAjax($field, $gp, &$errors) { diff --git a/Classes/Validator/DefaultValidator.php b/Classes/Validator/DefaultValidator.php index cf104f7c..256193c9 100644 --- a/Classes/Validator/DefaultValidator.php +++ b/Classes/Validator/DefaultValidator.php @@ -46,7 +46,6 @@ class DefaultValidator extends AbstractValidator * * @param array The GET/POST values * @param array The TypoScript configuration - * @return void */ public function init($gp, $tsConfig) { @@ -72,7 +71,7 @@ public function init($gp, $tsConfig) * Validates the submitted values using given settings * * @param array &$errors Reference to the errors array to store the errors occurred - * @return boolean + * @return bool */ public function validate(&$errors) { diff --git a/Classes/Validator/ErrorCheck/MinLength.php b/Classes/Validator/ErrorCheck/MinLength.php index 3689b1aa..9f667f12 100644 --- a/Classes/Validator/ErrorCheck/MinLength.php +++ b/Classes/Validator/ErrorCheck/MinLength.php @@ -31,7 +31,7 @@ public function check() $min = $this->utilityFuncs->getSingle($this->settings['params'], 'value'); if (isset($this->gp[$this->formFieldName]) && mb_strlen(trim($this->gp[$this->formFieldName]), $GLOBALS['TSFE']->renderCharset) > 0 && - intVal($min) > 0 && + intval($min) > 0 && mb_strlen(trim($this->gp[$this->formFieldName]), $GLOBALS['TSFE']->renderCharset) < intval($min) ) { $checkFailed = $this->getCheckFailed(); diff --git a/Classes/View/AbstractView.php b/Classes/View/AbstractView.php index e9b658ba..f1910c81 100644 --- a/Classes/View/AbstractView.php +++ b/Classes/View/AbstractView.php @@ -25,7 +25,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The prefix id * - * @access public * @var string */ public $prefixId = 'Tx_Formhandler'; @@ -33,7 +32,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The extension key * - * @access public * @var string */ public $extKey = 'formhandler'; @@ -41,7 +39,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The cObj for link generation in FE * - * @access public * @var tslib_cObj */ public $cObj; @@ -54,7 +51,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The piVars * - * @access public * @var array */ public $piVars; @@ -62,7 +58,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The Formhandler component manager * - * @access protected * @var \Typoheads\Formhandler\Component\Manager */ protected $componentManager; @@ -70,7 +65,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The global Formhandler configuration * - * @access protected * @var \Typoheads\Formhandler\Controller\Configuration */ protected $configuration; @@ -78,7 +72,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The global Formhandler values * - * @access protected * @var \Typoheads\Formhandler\Utility\Globals */ protected $globals; @@ -86,7 +79,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The Formhandler utility methods * - * @access protected * @var \Typoheads\Formhandler\Utility\GeneralUtility */ protected $utilityFuncs; @@ -94,7 +86,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The model of the view * - * @access protected * @var misc */ protected $model; @@ -102,7 +93,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The subparts array * - * @access protected * @var array */ protected $subparts; @@ -110,7 +100,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The template code * - * @access protected * @var string */ protected $template; @@ -118,7 +107,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * An array of translation file names * - * @access protected * @var array */ protected $langFiles; @@ -126,7 +114,6 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin /** * The get/post parameters * - * @access protected * @var array */ protected $gp; @@ -138,13 +125,12 @@ abstract class AbstractView extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin * * @param \Typoheads\Formhandler\Component\Manager $componentManager * @param \Typoheads\Formhandler\Controller\Configuration $configuration - * @return void */ public function __construct( \Typoheads\Formhandler\Component\Manager $componentManager, - \Typoheads\Formhandler\Controller\Configuration $configuration, - \Typoheads\Formhandler\Utility\Globals $globals, - \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs + \Typoheads\Formhandler\Controller\Configuration $configuration, + \Typoheads\Formhandler\Utility\Globals $globals, + \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs ) { parent::__construct(); $this->componentManager = $componentManager; @@ -161,7 +147,6 @@ public function __construct( * Sets the internal attribute "langFiles" * * @param array $langFiles The files array - * @return void */ public function setLangFiles($langFiles) { @@ -172,7 +157,6 @@ public function setLangFiles($langFiles) * Sets the settings * * @param string $settings The settings - * @return void */ public function setSettings($settings) { @@ -196,7 +180,6 @@ public function getComponentSettings() * Sets the key of the chosen predefined form * * @param string $key The key of the predefined form - * @return void */ public function setPredefined($key) { @@ -207,7 +190,6 @@ public function setPredefined($key) * Sets the model of the view * * @param misc $model - * @return void */ public function setModel($model) { @@ -229,8 +211,7 @@ public function getModel() * * @param string $templateCode The whole template code of a template file * @param string $templateName Name of a subpart containing the template code to work with - * @param boolean $forceTemplate Not needed - * @return void + * @param bool $forceTemplate Not needed */ public function setTemplate($templateCode, $templateName, $forceTemplate = false) { @@ -241,7 +222,7 @@ public function setTemplate($templateCode, $templateName, $forceTemplate = false /** * Returns false if the view doesn't have template code. * - * @return boolean + * @return bool */ public function hasTemplate() { @@ -261,7 +242,6 @@ abstract public function render($gp, $errors); /** * Overwrite this method to extend the initialization of the View * - * @return void * @author Jochen Rau */ protected function initializeView() diff --git a/Classes/View/File.php b/Classes/View/File.php index 2b61f10e..b85212af 100644 --- a/Classes/View/File.php +++ b/Classes/View/File.php @@ -6,7 +6,7 @@ class File extends Form public function render($gp, $errors) { $this->settings['disableWrapInBaseClass'] = 1; - $content = parent::render($gp, array()); + $content = parent::render($gp, []); return trim($content); } } diff --git a/Classes/View/Form.php b/Classes/View/Form.php index ae58eaf7..24a870bc 100644 --- a/Classes/View/Form.php +++ b/Classes/View/Form.php @@ -23,7 +23,6 @@ class Form extends AbstractView /** * An array of fields to do not encode for output * - * @access protected * @var array */ protected $disableEncodingFields; @@ -147,8 +146,6 @@ public function render($gp, $errors) /** * Reads the translation file entered in TS setup. - * - * @return void */ protected function readMasterTemplates() { @@ -231,8 +228,6 @@ protected function replaceMarkersFromMaster() /** * Copies the subparts ###FORM_STARTBLOCK### and ###FORM_ENDBLOCK### and stored them in session. * This is needed to replace the markers ###FORM_STARTBLOCK### and ###FORM_ENDBLOCK### in the next steps. - * - * @return void */ protected function storeStartEndBlock() { @@ -337,7 +332,7 @@ protected function handleIssetSubpartCondition($condition) protected function handleHasTranslationSubpartCondition($condition) { $translation = $this->utilityFuncs->getTranslatedMessage($this->langFiles, $condition); - return (strlen($translation) > 0); + return strlen($translation) > 0; } protected function handleIfSubpartCondition($condition) @@ -347,8 +342,6 @@ protected function handleIfSubpartCondition($condition) /** * Fills the markers ###FORM_STARTBLOCK### and ###FORM_ENDBLOCK### with the stored values from session. - * - * @return void */ protected function fillStartEndBlock() { @@ -374,8 +367,6 @@ protected function parseSettings() * ###selected_[fieldname]_[value]### * ###checked_[fieldname]_[value]### * in $this->template - * - * @return void */ protected function fillSelectedMarkers() { @@ -395,8 +386,6 @@ protected function fillSelectedMarkers() /** * Substitutes default markers in $this->template. - * - * @return void */ protected function fillDefaultMarkers() { @@ -626,7 +615,6 @@ protected function fillDefaultMarkers() * Fills the markers for the supported captcha extensions. * * @param array &$markers Reference to the markers array - * @return void */ protected function fillCaptchaMarkers(&$markers) { @@ -667,12 +655,11 @@ protected function fillCaptchaMarkers(&$markers) * Fills the markers ###FEUSER_[property]### with the data from $GLOBALS["TSFE"]->fe_user->user. * * @param array &$markers Reference to the markers array - * @return void */ protected function fillFEUserMarkers(&$markers) { - if (is_array($GLOBALS["TSFE"]->fe_user->user)) { - foreach ($GLOBALS["TSFE"]->fe_user->user as $k => $v) { + if (is_array($GLOBALS['TSFE']->fe_user->user)) { + foreach ($GLOBALS['TSFE']->fe_user->user as $k => $v) { $markers['###FEUSER_' . strtoupper($k) . '###'] = $v; $markers['###FEUSER_' . strtolower($k) . '###'] = $v; $markers['###feuser_' . strtoupper($k) . '###'] = $v; @@ -695,7 +682,6 @@ protected function fillFEUserMarkers(&$markers) * ###total_uploadedFiles### * * @param array &$markers Reference to the markers array - * @return void */ public function fillFileMarkers(&$markers) { @@ -928,7 +914,6 @@ protected function getThumbnail(&$imgConf, &$fileInfo) * in $this->template * * @param array $errors - * @return void */ protected function fillIsErrorMarkers($errors) { @@ -960,7 +945,6 @@ protected function fillIsErrorMarkers($errors) * in $this->template * * @param array $errors - * @return void */ protected function fillIsSuccessMarkers($errors) { @@ -987,8 +971,6 @@ protected function fillIsSuccessMarkers($errors) * ###error_[fieldname]### * ###ERROR### * in $this->template - * - * @return void */ protected function fillErrorMarkers(&$errors) { @@ -1067,8 +1049,6 @@ protected function fillErrorMarkers(&$errors) /** * Substitutes markers defined in TypoScript in $this->template - * - * @return void */ protected function fillTypoScriptMarkers() { @@ -1090,8 +1070,6 @@ protected function fillTypoScriptMarkers() * ###[fieldname]### * ###[FIELDNAME]### * in $this->template - * - * @return void */ protected function fillValueMarkers() { @@ -1182,8 +1160,6 @@ protected function getSelectedMarkers($values, $level = 0, $prefix = 'selected_' * Substitutes markers * ###LLL:[languageKey]### * in $this->template - * - * @return void */ protected function fillLangMarkers() { @@ -1221,8 +1197,8 @@ protected function fillLangMarkers() * * * @author Johannes Feustel - * @param integer $currentStep current step (begins with 1) - * @param integer $lastStep last step + * @param int $currentStep current step (begins with 1) + * @param int $lastStep last step * @param string $buttonNameBack name attribute of the back button * @param string $buttonNameFwd name attribute of the forward button * @return string HTML code diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 307ee877..ec097549 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -1,9 +1,9 @@ - [ - 'title' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log', - 'label' => 'uid', - 'default_sortby' => 'ORDER BY crdate DESC', - 'crdate' => 'crdate', - 'tstamp' => 'tstamp', - 'delete' => 'deleted', - 'iconfile' => 'EXT:formhandler/ext_icon.gif', - 'adminOnly' => 1 - ], - 'interface' => [ - 'showRecordFieldList' => 'crdate,ip,params,is_spam,key_hash' - ], - 'columns' => [ - 'crdate' => [ - 'exclude' => 1, - 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.submission_date', - 'config' => [ - 'type' => 'input', - 'size' => '10', - 'max' => '20', - 'eval' => 'datetime', - 'checkbox' => '0', - 'default' => '0' - ] - ], - 'ip' => [ - 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.ip', - 'config' => [ - 'type' => 'input' - ] - ], - 'params' => [ - 'exclude' => 1, - 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.params', - 'config' => [ - 'type' => 'user', - 'userFunc' => 'Typoheads\Formhandler\Utility\TcaUtility->getParams' - ] - ], - 'is_spam' => [ - 'exclude' => 1, - 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.is_spam', - 'config' => [ - 'type' => 'check' - ] - ], - 'uid' => [ - 'label' => '', - 'config' => [ - 'type' => 'none' - ] - ], - 'pid' => [ - 'label' => '', - 'config' => [ - 'type' => 'none' - ] - ], - 'tstamp' => [ - 'label' => '', - 'config' => [ - 'type' => 'none' - ] - ], - 'key_hash' => [ - 'label' => '', - 'config' => [ - 'type' => 'none' - ] - ], - 'unique_hash' => [ - 'label' => '', - 'config' => [ - 'type' => 'none' - ] - ] - ], - 'types' => [ - '0' => [ - 'showitem' => 'crdate,ip,params,is_spam' - ] - ] -]; + [ + 'title' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log', + 'label' => 'uid', + 'default_sortby' => 'ORDER BY crdate DESC', + 'crdate' => 'crdate', + 'tstamp' => 'tstamp', + 'delete' => 'deleted', + 'iconfile' => 'EXT:formhandler/ext_icon.gif', + 'adminOnly' => 1 + ], + 'interface' => [ + 'showRecordFieldList' => 'crdate,ip,params,is_spam,key_hash' + ], + 'columns' => [ + 'crdate' => [ + 'exclude' => 1, + 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.submission_date', + 'config' => [ + 'type' => 'input', + 'size' => '10', + 'max' => '20', + 'eval' => 'datetime', + 'checkbox' => '0', + 'default' => '0' + ] + ], + 'ip' => [ + 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.ip', + 'config' => [ + 'type' => 'input' + ] + ], + 'params' => [ + 'exclude' => 1, + 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.params', + 'config' => [ + 'type' => 'user', + 'userFunc' => 'Typoheads\Formhandler\Utility\TcaUtility->getParams' + ] + ], + 'is_spam' => [ + 'exclude' => 1, + 'label' => 'LLL:EXT:formhandler/Resources/Private/Language/locallang_db.xml:tx_formhandler_log.is_spam', + 'config' => [ + 'type' => 'check' + ] + ], + 'uid' => [ + 'label' => '', + 'config' => [ + 'type' => 'none' + ] + ], + 'pid' => [ + 'label' => '', + 'config' => [ + 'type' => 'none' + ] + ], + 'tstamp' => [ + 'label' => '', + 'config' => [ + 'type' => 'none' + ] + ], + 'key_hash' => [ + 'label' => '', + 'config' => [ + 'type' => 'none' + ] + ], + 'unique_hash' => [ + 'label' => '', + 'config' => [ + 'type' => 'none' + ] + ] + ], + 'types' => [ + '0' => [ + 'showitem' => 'crdate,ip,params,is_spam' + ] + ] +]; diff --git a/Resources/PHP/filtreatment/Filtreatment.php b/Resources/PHP/filtreatment/Filtreatment.php index 7eeed978..f2e3b8da 100644 --- a/Resources/PHP/filtreatment/Filtreatment.php +++ b/Resources/PHP/filtreatment/Filtreatment.php @@ -1,145 +1,149 @@ -Google - * - * Note: Normally urldecode() would be easier but it removes plus signs - * - */ - $str = preg_replace("/%u0([a-z0-9]{3})/i", "&#x\\1;", $str); - $str = preg_replace("/%([a-z0-9]{2})/i", "&#x\\1;", $str); - - /* - * Convert character entities to ASCII - * - * This permits our tests below to work reliably. - * We only convert entities that are within tags since - * these are the ones that will pose security problems. - * - */ - if (preg_match_all("/<(.+?)>/si", $str, $matches)) { - for ($i = 0; $i < count($matches['0']); $i++) { - $str = str_replace($matches['1'][$i], - html_entity_decode($matches['1'][$i], ENT_COMPAT, $charset), $str); - } - } - - /* - * Convert all tabs to spaces - * - * This prevents strings like this: ja vascript - * Note: we deal with spaces between characters later. - * - */ - $str = preg_replace("#\t+#", " ", $str); - - /* - * Makes PHP tags safe - * - * Note: XML tags are inadvertently replaced too: - * - * '), array('<?php', '<?PHP', '<?', '?>'), $str); - - /* - * Compact any exploded words - * - * This corrects words like: j a v a s c r i p t - * These words are compacted back to their correct state. - * - */ - $words = array('javascript', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window'); - foreach ($words as $word) { - $temp = ''; - for ($i = 0; $i < strlen($word); $i++) { - $temp .= substr($word, $i, 1)."\s*"; - } - - $temp = substr($temp, 0, -3); - $str = preg_replace('#'.$temp.'#s', $word, $str); - $str = preg_replace('#'.ucfirst($temp).'#s', ucfirst($word), $str); - } - - /* - * Remove disallowed Javascript in links or img tags - */ - $str = preg_replace("#.*?#si", "", $str); - $str = preg_replace("##si","", $str); - $str = preg_replace("#<(script|xss).*?\>#si", "", $str); - - /* - * Remove JavaScript Event Handlers - * - * Note: This code is a little blunt. It removes - * the event handler and anything up to the closing >, - * but it's unlikely to be a problem. - * - */ - $str = preg_replace('#(<[^>]+.*?)(onabort|onactivate|onafterprint|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint| +Google + * + * Note: Normally urldecode() would be easier but it removes plus signs + * + */ + $str = preg_replace('/%u0([a-z0-9]{3})/i', '&#x\\1;', $str); + $str = preg_replace('/%([a-z0-9]{2})/i', '&#x\\1;', $str); + + /* + * Convert character entities to ASCII + * + * This permits our tests below to work reliably. + * We only convert entities that are within tags since + * these are the ones that will pose security problems. + * + */ + if (preg_match_all('/<(.+?)>/si', $str, $matches)) { + for ($i = 0; $i < count($matches['0']); $i++) { + $str = str_replace( + $matches['1'][$i], + html_entity_decode($matches['1'][$i], ENT_COMPAT, $charset), + $str + ); + } + } + + /* + * Convert all tabs to spaces + * + * This prevents strings like this: ja vascript + * Note: we deal with spaces between characters later. + * + */ + $str = preg_replace("#\t+#", ' ', $str); + + /* + * Makes PHP tags safe + * + * Note: XML tags are inadvertently replaced too: + * + * '], ['<?php', '<?PHP', '<?', '?>'], $str); + + /* + * Compact any exploded words + * + * This corrects words like: j a v a s c r i p t + * These words are compacted back to their correct state. + * + */ + $words = ['javascript', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window']; + foreach ($words as $word) { + $temp = ''; + for ($i = 0; $i < strlen($word); $i++) { + $temp .= substr($word, $i, 1) . "\s*"; + } + + $temp = substr($temp, 0, -3); + $str = preg_replace('#' . $temp . '#s', $word, $str); + $str = preg_replace('#' . ucfirst($temp) . '#s', ucfirst($word), $str); + } + + /* + * Remove disallowed Javascript in links or img tags + */ + $str = preg_replace("#.*?#si", '', $str); + $str = preg_replace("##si", '', $str); + $str = preg_replace("#<(script|xss).*?\>#si", '', $str); + + /* + * Remove JavaScript Event Handlers + * + * Note: This code is a little blunt. It removes + * the event handler and anything up to the closing >, + * but it's unlikely to be a problem. + * + */ + $str = preg_replace('#(<[^>]+.*?)(onabort|onactivate|onafterprint|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint| onbeforeunload|onbeforeupdate|onblur|onbounce|oncanplay|oncanplaythrough|oncellchange|onchange| onclick|oncontextmenu|oncontrolselect|oncopy|oncuechange|oncut|ondataavailable|ondatasetchanged| ondatasetcomplete|ondblclick|ondeactivate|ondrag|ondragend|ondragenter|ondragleave|ondragover| @@ -152,61 +156,57 @@ public function ft_xss($str, $charset = 'ISO-8859-1') { onpropertychange|onratechange|onreadystatechange|onredo|onreset|onresize|onresizeend| onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onseeked|onseeking| onselect|onselectionchange|onselectstart|onshow|onstalled|onstart|onstop|onstorage|onsubmit| - onsuspend|ontimeupdate|onundo|onunload|onvolumechange|onwaiting)[^>]*>#iU',"\\1>",$str); - - /* - * Sanitize naughty HTML elements - * - * If a tag containing any of the words in the list - * below is found, the tag gets converted to entities. - * - * So this: - * Becomes: <blink> - * - */ - $str = preg_replace('#<(/*\s*)(alert|applet|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|iframe|input|layer|link|meta|object|plaintext|style|script|textarea|title|xml|xss)([^>]*)>#is', "<\\1\\2\\3>", $str); - - /* - * Sanitize naughty scripting elements - * - * Similar to above, only instead of looking for - * tags it looks for PHP and JavaScript commands - * that are disallowed. Rather than removing the - * code, it simply converts the parenthesis to entities - * rendering the code un-executable. - * - * For example: eval('some code') - * Becomes: eval('some code') - * - */ - $str = preg_replace('#(alert|cmd|passthru|eval|exec|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', "\\1\\2(\\3)", $str); - - /* - * Final clean up - * - * This adds a bit of extra precaution in case - * something got through the above filters - * - */ - - $bad = array( - 'document.cookie' => '', - 'document.write' => '', - 'window.location' => '', - "javascript\s*:" => '', - "Redirect\s+302" => '', - '' => '-->' - ); - - foreach ($bad as $key => $val) { - $str = preg_replace("#".$key."#i", $val, $str); - } - - return $str; - - } - -} // class - -?> \ No newline at end of file + onsuspend|ontimeupdate|onundo|onunload|onvolumechange|onwaiting)[^>]*>#iU', '\\1>', $str); + + /* + * Sanitize naughty HTML elements + * + * If a tag containing any of the words in the list + * below is found, the tag gets converted to entities. + * + * So this: + * Becomes: <blink> + * + */ + $str = preg_replace('#<(/*\s*)(alert|applet|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|iframe|input|layer|link|meta|object|plaintext|style|script|textarea|title|xml|xss)([^>]*)>#is', '<\\1\\2\\3>', $str); + + /* + * Sanitize naughty scripting elements + * + * Similar to above, only instead of looking for + * tags it looks for PHP and JavaScript commands + * that are disallowed. Rather than removing the + * code, it simply converts the parenthesis to entities + * rendering the code un-executable. + * + * For example: eval('some code') + * Becomes: eval('some code') + * + */ + $str = preg_replace('#(alert|cmd|passthru|eval|exec|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', '\\1\\2(\\3)', $str); + + /* + * Final clean up + * + * This adds a bit of extra precaution in case + * something got through the above filters + * + */ + + $bad = [ + 'document.cookie' => '', + 'document.write' => '', + 'window.location' => '', + "javascript\s*:" => '', + "Redirect\s+302" => '', + '' => '-->' + ]; + + foreach ($bad as $key => $val) { + $str = preg_replace('#' . $key . '#i', $val, $str); + } + + return $str; + } +} // class diff --git a/ext_emconf.php b/ext_emconf.php index e130e81c..44da118c 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,6 +1,6 @@ 'Formhandler', 'description' => 'The swiss army knife for all kinds of mailforms, completely new written using the MVC concept. Result: Flexibility, Flexibility, Flexibility :-).', 'category' => 'plugin', @@ -10,12 +10,12 @@ 'author' => 'Dev-Team Typoheads', 'author_email' => 'dev@typoheads.at', 'author_company' => 'Typoheads GmbH', - 'constraints' => array( - 'depends' => array( + 'constraints' => [ + 'depends' => [ 'typo3' => '9.5.0-9.5.99', 'typo3db_legacy' => '' - ), - ), + ], + ], 'uploadfolder' => false, 'createDirs' => null -); +]; diff --git a/ext_tables.php b/ext_tables.php index 5cffe4f6..b772b7d1 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,32 +1,31 @@ - 'index, view, selectFields, export' - ], - [ - 'access' => 'user,group', - 'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/moduleicon.gif', - 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml' - ] - ); -} - -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_formhandler_log'); - - -// REGISTER ICONS FOR USE IN BACKEND WIZARD -$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); -$iconRegistry->registerIcon( - 'formhandlerElement', - \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, - ['source' => 'EXT:formhandler/ext_icon.gif'] -); \ No newline at end of file + 'index, view, selectFields, export' + ], + [ + 'access' => 'user,group', + 'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/moduleicon.gif', + 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_mod.xml' + ] + ); +} + +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_formhandler_log'); + +// REGISTER ICONS FOR USE IN BACKEND WIZARD +$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); +$iconRegistry->registerIcon( + 'formhandlerElement', + \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, + ['source' => 'EXT:formhandler/ext_icon.gif'] +); diff --git a/pi1/class.tx_formhandler_pi1.php b/pi1/class.tx_formhandler_pi1.php index f81319b0..99284d16 100644 --- a/pi1/class.tx_formhandler_pi1.php +++ b/pi1/class.tx_formhandler_pi1.php @@ -1,48 +1,47 @@ - - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -/** - * Plugin 'Formhandler' for the 'formhandler' extension. - * - */ -class tx_formhandler_pi1 extends TYPO3\CMS\Frontend\Plugin\AbstractPlugin -{ - var $prefixId = 'tx_formhandler_pi1'; - var $scriptRelPath = 'pi1/class.tx_formhandler_pi1.php'; - var $extKey = 'formhandler'; - - /** - * The main method of the PlugIn - * - * @param string $content : The PlugIn content - * @param array $conf : The PlugIn configuration - * @return The content that is displayed on the website - */ - public function main($content, $conf) - { - $dispatcher = new \Typoheads\Formhandler\Controller\Dispatcher(); - $dispatcher->cObj = &$this->cObj; - return $dispatcher->main($content, $conf); - } -} \ No newline at end of file + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Plugin 'Formhandler' for the 'formhandler' extension. + */ +class tx_formhandler_pi1 extends TYPO3\CMS\Frontend\Plugin\AbstractPlugin +{ + public $prefixId = 'tx_formhandler_pi1'; + public $scriptRelPath = 'pi1/class.tx_formhandler_pi1.php'; + public $extKey = 'formhandler'; + + /** + * The main method of the PlugIn + * + * @param string $content : The PlugIn content + * @param array $conf : The PlugIn configuration + * @return The content that is displayed on the website + */ + public function main($content, $conf) + { + $dispatcher = new \Typoheads\Formhandler\Controller\Dispatcher(); + $dispatcher->cObj = &$this->cObj; + return $dispatcher->main($content, $conf); + } +}