Perform additional plugin variable check for "tx_dlf[page]"
Remove obsolete tx_dlf_plugin->checkPIvars
This commit is contained in:
parent
6a9cb66af0
commit
024377a413
|
@ -65,29 +65,6 @@ abstract class tx_dlf_plugin extends tslib_pibase {
|
|||
*/
|
||||
protected $template = '';
|
||||
|
||||
/**
|
||||
* Checks $this->piVars array for common required fields and sets some default values
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param boolean $dontSetDefaults: If TRUE only checks for required fields are performed
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE when required fields are missing
|
||||
*/
|
||||
protected function checkPIvars($dontSetDefaults = FALSE) {
|
||||
|
||||
if (!$dontSetDefaults) {
|
||||
|
||||
// Set default values for some fields if not set.
|
||||
$this->piVars['page'] = (!empty($this->piVars['page']) ? max(intval($this->piVars['page']), 1) : 1);
|
||||
|
||||
}
|
||||
|
||||
// Check for required fields.
|
||||
return !empty($this->piVars['id']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* All the needed configuration values are stored in class variables
|
||||
* Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php
|
||||
|
@ -179,8 +156,8 @@ abstract class tx_dlf_plugin extends tslib_pibase {
|
|||
*/
|
||||
protected function loadDocument() {
|
||||
|
||||
// Check for required fields.
|
||||
if ($this->checkPIvars(TRUE)) {
|
||||
// Check for required variable.
|
||||
if (!empty($this->piVars['id'])) {
|
||||
|
||||
// Should we exclude documents from other pages than $this->conf['pages']?
|
||||
$pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0);
|
||||
|
@ -196,7 +173,7 @@ abstract class tx_dlf_plugin extends tslib_pibase {
|
|||
|
||||
} else {
|
||||
|
||||
trigger_error('Required parameters are not set', E_USER_ERROR);
|
||||
trigger_error('No UID given for document', E_USER_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ class tx_dlf_navigation extends tx_dlf_plugin {
|
|||
|
||||
} else {
|
||||
|
||||
$this->piVars['page'] = min($this->piVars['page'], $this->doc->numPages);
|
||||
// Set default values for page if not set.
|
||||
$this->piVars['page'] = t3lib_div::intInRange($this->piVars['page'], 1, $this->doc->numPages, 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,8 @@ class tx_dlf_pageview extends tx_dlf_plugin {
|
|||
|
||||
} else {
|
||||
|
||||
$this->piVars['page'] = min($this->piVars['page'], $this->doc->numPages);
|
||||
// Set default values for page if not set.
|
||||
$this->piVars['page'] = t3lib_div::intInRange($this->piVars['page'], 1, $this->doc->numPages, 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -169,9 +169,15 @@ class tx_dlf_toc extends tx_dlf_plugin {
|
|||
|
||||
}
|
||||
|
||||
// Quit without doing anything if required piVars are not set.
|
||||
if (!$this->checkPIvars()) {
|
||||
// Check for required variable.
|
||||
if (!empty($this->piVars['id'])) {
|
||||
|
||||
// Set default values for page if not set.
|
||||
$this->piVars['page'] = (!empty($this->piVars['page']) ? max(intval($this->piVars['page']), 1) : 1);
|
||||
|
||||
} else {
|
||||
|
||||
// Quit without doing anything.
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ class tx_dlf_toolbox extends tx_dlf_plugin {
|
|||
// Turn cache off.
|
||||
$this->setCache(FALSE);
|
||||
|
||||
// Quit without doing anything if required piVars are not set.
|
||||
if (!$this->checkPIvars(TRUE)) {
|
||||
// Quit without doing anything if required variable is not set.
|
||||
if (empty($this->piVars['id'])) {
|
||||
|
||||
return $content;
|
||||
|
||||
|
|
Loading…
Reference in New Issue