diff options
author | Thomas Lange <code@nerdmind.de> | 2018-01-28 02:37:44 +0100 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2018-01-28 02:37:44 +0100 |
commit | fbe375107d96be9488b7072c8687a1acc3ba2fa6 (patch) | |
tree | ce9cac1e57bca6816f3d10fc0b96d9ae99ff0598 /include | |
parent | c6bd37658cdae7e1dcd3ff4664c7e8a84a77bba7 (diff) | |
download | bigpipe-fbe375107d96be9488b7072c8687a1acc3ba2fa6.tar.gz bigpipe-fbe375107d96be9488b7072c8687a1acc3ba2fa6.tar.xz bigpipe-fbe375107d96be9488b7072c8687a1acc3ba2fa6.zip |
Remove superflous function calls from two methods
This commit removes the superflous function calls "removeLineBreaksAndTabs" from the "Pagelet::getStructure()" and "Item::addPhaseDoneJS()" method. If it bothers you when some properties of the JSON-encoded pagelet object contain line breaks and tabs (visible as "\r", "\n" and "\t"), then you'll need to remove them before you pass the string of javascript code to the corresponding methods:
* $Pagelet->addJSCode(removeLineBreaksAndTabs($javascript_code));
* $Pagelet->addPhaseDoneJS(0, removeLineBreaksAndTabs($javascript_code));
Diffstat (limited to 'include')
-rw-r--r-- | include/classes/BigPipe/Item.php | 2 | ||||
-rw-r--r-- | include/classes/BigPipe/Pagelet.php | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/classes/BigPipe/Item.php b/include/classes/BigPipe/Item.php index 9c66eb9..cf62237 100644 --- a/include/classes/BigPipe/Item.php +++ b/include/classes/BigPipe/Item.php @@ -37,7 +37,7 @@ abstract class Item { # Attach a PhaseDoneJS callback #=============================================================================== public function addPhaseDoneJS($phase, $callback) { - return $this->phaseDoneJS[$phase][] = removeLineBreaksAndTabs($callback); + return $this->phaseDoneJS[$phase][] = $callback; } } ?>
\ No newline at end of file diff --git a/include/classes/BigPipe/Pagelet.php b/include/classes/BigPipe/Pagelet.php index 441c520..9e145fd 100644 --- a/include/classes/BigPipe/Pagelet.php +++ b/include/classes/BigPipe/Pagelet.php @@ -141,7 +141,7 @@ class Pagelet extends Item { Resource::TYPE_STYLESHEET => $stylesheets ?? [], Resource::TYPE_JAVASCRIPT => $javascripts ?? [] ], - 'CODE' => removeLineBreaksAndTabs($this->getJSCode()), + 'CODE' => $this->getJSCode(), 'PHASE' => $this->getPhaseDoneJS() ]; } |