Skip to content

Commit

Permalink
Fixed compatibility with PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Dec 23, 2015
1 parent e5f0fb1 commit 49acaa4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
* @author Martin Auswöger <martin@madeyourday.co>
*/

// Backwards compatibility for Contao < 3.5.1
if (!class_exists('StringUtil') && class_exists('String')) {
class_alias('String', 'StringUtil');
}

$GLOBALS['TL_HOOKS']['executePostActions'][] = array('MadeYourDay\\Contao\\ThemeAssistant', 'executePostActionsHook');

$GLOBALS['BE_MOD']['design']['rocksolid_theme_assistant'] = array(
Expand Down
4 changes: 2 additions & 2 deletions src/MadeYourDay/Contao/ThemeAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public function onsubmitCallback(\DataContainer $dc)
$file = \FilesModel::findByPk($value);
}
else {
$file = \FilesModel::findByUuid(\String::uuidToBin($value));
$file = \FilesModel::findByUuid(\StringUtil::uuidToBin($value));
}
}
if ($file) {
Expand All @@ -563,7 +563,7 @@ public function onsubmitCallback(\DataContainer $dc)
$file = \FilesModel::findByPk($value);
}
else {
$file = \FilesModel::findByUuid(\String::uuidToBin($value));
$file = \FilesModel::findByUuid(\StringUtil::uuidToBin($value));
}
}
if ($file) {
Expand Down
6 changes: 3 additions & 3 deletions src/MadeYourDay/Contao/ThemeAssistantDataContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($strTable, $arrModule = array())
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onload_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
}
}
}
Expand Down Expand Up @@ -315,7 +315,7 @@ public function edit()
foreach ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['load_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->varValue = $this->$callback[0]->$callback[1]($this->varValue, $this);
$this->varValue = $this->{$callback[0]}->{$callback[1]}($this->varValue, $this);
}
}
}
Expand Down Expand Up @@ -372,7 +372,7 @@ public function edit()
if (is_array($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'])) {
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
}
}

Expand Down

0 comments on commit 49acaa4

Please sign in to comment.