Skip to content

Commit

Permalink
Adjusted hooks and callbacks to be compatible with PHP7
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Dec 8, 2015
1 parent d0b80f8 commit 07e389e
Show file tree
Hide file tree
Showing 36 changed files with 75 additions and 72 deletions.
3 changes: 3 additions & 0 deletions system/modules/isotope/docs/CHANGELOG-2.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Isotope eCommerce Changelog
Version 2.3.3-stable (????-??-??)
---------------------------------

### Fixed
- Callbacks were not compatible with PHP7 (#1584)


Version 2.3.2-stable (2015-12-01)
---------------------------------
Expand Down
22 changes: 11 additions & 11 deletions system/modules/isotope/drivers/DC_ProductData.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function cut($blnDoNotRedirect = false)
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['oncut_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this);
}
Expand Down Expand Up @@ -587,7 +587,7 @@ public function edit($intID = false, $ajaxId = false)
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);
} elseif (is_callable($callback)) {
$this->varValue = call_user_func($callback, $this->varValue, $this);
}
Expand Down Expand Up @@ -682,7 +682,7 @@ public function edit($intID = false, $ajaxId = false)
foreach ($GLOBALS['TL_DCA'][$this->strTable]['edit']['buttons_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$arrButtons = $this->$callback[0]->$callback[1]($arrButtons, $this);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
} elseif (is_callable($callback)) {
$arrButtons = $callback($arrButtons, $this);
}
Expand Down Expand Up @@ -734,7 +734,7 @@ public function edit($intID = false, $ajaxId = false)
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this);
}
Expand All @@ -750,7 +750,7 @@ public function edit($intID = false, $ajaxId = false)
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this->strTable, $this->objActiveRecord->id, $this);
$this->{$callback[0]}->{$callback[1]}($this->strTable, $this->objActiveRecord->id, $this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this->strTable, $this->objActiveRecord->id, $this);
}
Expand Down Expand Up @@ -949,7 +949,7 @@ public function editAll($intId = false, $ajaxId = false)
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);
} elseif (is_callable($callback)) {
$this->varValue = call_user_func($callback, $this->varValue, $this);
}
Expand All @@ -975,7 +975,7 @@ public function editAll($intId = false, $ajaxId = false)
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this);
}
Expand All @@ -991,7 +991,7 @@ public function editAll($intId = false, $ajaxId = false)
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onversion_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this->strTable, $this->intId, $this);
$this->{$callback[0]}->{$callback[1]}($this->strTable, $this->intId, $this);
} elseif (is_callable($callback)) {
call_user_func($callback, $this->strTable, $this->intId, $this);
}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ public function overrideAll()
foreach ($GLOBALS['TL_DCA'][$this->strTable]['config']['onsubmit_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
}
elseif (is_callable($callback)) {
call_user_func($callback, $this);
Expand Down Expand Up @@ -1636,7 +1636,7 @@ protected function listView()
if (is_array($callback))
{
$this->import($callback[0]);
$arrButtons = $this->$callback[0]->$callback[1]($arrButtons, $this);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
}
elseif (is_callable($callback))
{
Expand Down Expand Up @@ -2092,7 +2092,7 @@ protected function parentView()
if (is_array($callback))
{
$this->import($callback[0]);
$arrButtons = $this->$callback[0]->$callback[1]($arrButtons, $this);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
}
elseif (is_callable($callback))
{
Expand Down
8 changes: 4 additions & 4 deletions system/modules/isotope/drivers/DC_TablePageId.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function cut($blnDoNotRedirect=false)
if (is_array($callback))
{
$this->import($callback[0]);
$this->$callback[0]->$callback[1]($this);
$this->{$callback[0]}->{$callback[1]}($this);
}
elseif (is_callable($callback))
{
Expand Down Expand Up @@ -472,7 +472,7 @@ protected function reviseTable()
if (is_array($callback))
{
$this->import($callback[0]);
$status = $this->$callback[0]->$callback[1]($this->strTable, $new_records[$this->strTable], $ptable, $ctable);
$status = $this->{$callback[0]}->{$callback[1]}($this->strTable, $new_records[$this->strTable], $ptable, $ctable);
}
elseif (is_callable($callback))
{
Expand Down Expand Up @@ -1007,7 +1007,7 @@ protected function parentView()
if (is_array($callback))
{
$this->import($callback[0]);
$arrButtons = $this->$callback[0]->$callback[1]($arrButtons, $this);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
}
elseif (is_callable($callback))
{
Expand Down Expand Up @@ -1425,7 +1425,7 @@ protected function listView()
if (is_array($callback))
{
$this->import($callback[0]);
$arrButtons = $this->$callback[0]->$callback[1]($arrButtons, $this);
$arrButtons = $this->{$callback[0]}->{$callback[1]}($arrButtons, $this);
}
elseif (is_callable($callback))
{
Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/library/Isotope/Automator.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function convertCurrencies($intId = 0)
) {
foreach ($GLOBALS['ISO_HOOKS']['convertCurrency'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$objCallback->$callback[1]($objConfigs->current());
$objCallback->{$callback[1]}($objConfigs->current());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function toggleVisibility($intId, $blnVisible)
foreach ($GLOBALS['TL_DCA']['tl_iso_attribute_option']['fields']['published']['save_callback'] as $callback) {
if (is_array($callback)) {
$this->import($callback[0]);
$blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this);
$blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $this);
} elseif (is_callable($callback)) {
$blnVisible = $callback($blnVisible, $this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function toggleVisibility($intId, $blnVisible)
if (is_array($GLOBALS['TL_DCA']['tl_iso_download']['fields']['published']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_iso_download']['fields']['published']['save_callback'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$blnVisible = $objCallback->$callback[1]($blnVisible, $this);
$blnVisible = $objCallback->{$callback[1]}($blnVisible, $this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getButtons()
if (isset($GLOBALS['ISO_HOOKS']['buttons']) && is_array($GLOBALS['ISO_HOOKS']['buttons'])) {
foreach ($GLOBALS['ISO_HOOKS']['buttons'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$arrButtons = $objCallback->$callback[1]($arrButtons);
$arrButtons = $objCallback->{$callback[1]}($arrButtons);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function toggleVisibility($intId, $blnVisible)
if (is_array($GLOBALS['TL_DCA']['tl_iso_payment']['fields']['enabled']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_iso_payment']['fields']['enabled']['save_callback'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$blnVisible = $objCallback->$callback[1]($blnVisible, $this);
$blnVisible = $objCallback->{$callback[1]}($blnVisible, $this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function importFromPath($strPath)
if (isset($GLOBALS['ISO_HOOKS']['addAssetImportRegexp']) && is_array($GLOBALS['ISO_HOOKS']['addAssetImportRegexp'])) {
foreach ($GLOBALS['ISO_HOOKS']['addAssetImportRegexp'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$arrPattern = $objCallback->$callback[1]($arrPattern, $objProducts);
$arrPattern = $objCallback->{$callback[1]}($arrPattern, $objProducts);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ protected function toggleVisibility($intId, $blnVisible)
if (is_array($GLOBALS['TL_DCA']['tl_iso_product']['fields']['published']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_iso_product']['fields']['published']['save_callback'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$blnVisible = $objCallback->$callback[1]($blnVisible, $this);
$blnVisible = $objCallback->{$callback[1]}($blnVisible, $this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function applyAdvancedFilters()
if (isset($GLOBALS['ISO_HOOKS']['applyAdvancedFilters']) && is_array($GLOBALS['ISO_HOOKS']['applyAdvancedFilters'])) {
foreach ($GLOBALS['ISO_HOOKS']['applyAdvancedFilters'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$arrReturn = $objCallback->$callback[1]($k);
$arrReturn = $objCallback->{$callback[1]}($k);

if (is_array($arrReturn)) {
$arrProducts = is_array($arrProducts) ? array_intersect($arrProducts, $arrReturn) : $arrReturn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static function getAllowedIds()
if (isset($GLOBALS['ISO_HOOKS']['getAllowedProductIds']) && is_array($GLOBALS['ISO_HOOKS']['getAllowedProductIds'])) {
foreach ($GLOBALS['ISO_HOOKS']['getAllowedProductIds'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$arrAllowed = $objCallback->$callback[1]();
$arrAllowed = $objCallback->{$callback[1]}();

if ($arrAllowed === false) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public function executeSaveHook($dc)
if (isset($GLOBALS['ISO_HOOKS']['saveCollection']) && is_array($GLOBALS['ISO_HOOKS']['saveCollection'])) {
foreach ($GLOBALS['ISO_HOOKS']['saveCollection'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$objCallback->$callback[1]($objOrder);
$objCallback->{$callback[1]}($objOrder);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function toggleVisibility($intId, $blnVisible)
if (is_array($GLOBALS['TL_DCA']['tl_iso_shipping']['fields']['enabled']['save_callback'])) {
foreach ($GLOBALS['TL_DCA']['tl_iso_shipping']['fields']['enabled']['save_callback'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$blnVisible = $objCallback->$callback[1]($blnVisible, $this);
$blnVisible = $objCallback->{$callback[1]}($blnVisible, $this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function getNotificationTokens(IsotopeProductCollection $objCollection)
) {
foreach ($GLOBALS['ISO_HOOKS']['getOrderConditionsValue'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$varValue = $objCallback->$callback[1]($strField, $varValue, $arrConfig, $this->objForm);
$varValue = $objCallback->{$callback[1]}($strField, $varValue, $arrConfig, $this->objForm);
}
}

Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/library/Isotope/Isotope.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static function calculatePrice(
if (isset($GLOBALS['ISO_HOOKS']['calculatePrice']) && is_array($GLOBALS['ISO_HOOKS']['calculatePrice'])) {
foreach ($GLOBALS['ISO_HOOKS']['calculatePrice'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$fltPrice = $objCallback->$callback[1]($fltPrice, $objSource, $strField, $intTaxClass, $arrOptions);
$fltPrice = $objCallback->{$callback[1]}($fltPrice, $objSource, $strField, $intTaxClass, $arrOptions);
}
}

Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/library/Isotope/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function getPriceDisplay()
// !HOOK: calculate price
if (isset($GLOBALS['ISO_HOOKS']['priceDisplay']) && is_array($GLOBALS['ISO_HOOKS']['priceDisplay'])) {
foreach ($GLOBALS['ISO_HOOKS']['priceDisplay'] as $callback) {
$format = \System::importStatic($callback[0])->$callback[1]($format, $this);
$format = \System::importStatic($callback[0])->{$callback[1]}($format, $this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected function generateTemplate(IsotopeProductCollection $objCollection, arr
// !HOOK: customize the document template
if (isset($GLOBALS['ISO_HOOKS']['generateDocumentTemplate']) && is_array($GLOBALS['ISO_HOOKS']['generateDocumentTemplate'])) {
foreach ($GLOBALS['ISO_HOOKS']['generateDocumentTemplate'] as $callback) {
\System::importStatic($callback[0])->$callback[1]($objTemplate, $objCollection, $this);
\System::importStatic($callback[0])->{$callback[1]}($objTemplate, $objCollection, $this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function isAvailableForCollection(IsotopeProductCollection $objCollection
if (isset($GLOBALS['ISO_HOOKS']['productIsAvailable']) && is_array($GLOBALS['ISO_HOOKS']['productIsAvailable'])) {
foreach ($GLOBALS['ISO_HOOKS']['productIsAvailable'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$available = $objCallback->$callback[1]($this, $objCollection);
$available = $objCallback->{$callback[1]}($this, $objCollection);

// If return value is boolean then we accept it as result
if (true === $available || false === $available) {
Expand Down Expand Up @@ -657,7 +657,7 @@ public function generate(array $arrConfig)
if (isset($GLOBALS['ISO_HOOKS']['buttons']) && is_array($GLOBALS['ISO_HOOKS']['buttons'])) {
foreach ($GLOBALS['ISO_HOOKS']['buttons'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$arrButtons = $objCallback->$callback[1]($arrButtons);
$arrButtons = $objCallback->{$callback[1]}($arrButtons);
}

$arrButtons = array_intersect_key($arrButtons, array_flip($arrConfig['buttons']));
Expand Down Expand Up @@ -700,7 +700,7 @@ public function generate(array $arrConfig)
if (isset($GLOBALS['ISO_HOOKS']['generateProduct']) && is_array($GLOBALS['ISO_HOOKS']['generateProduct'])) {
foreach ($GLOBALS['ISO_HOOKS']['generateProduct'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$objCallback->$callback[1]($objTemplate, $this);
$objCallback->{$callback[1]}($objTemplate, $this);
}
}

Expand Down Expand Up @@ -848,7 +848,7 @@ protected function generateProductOptionWidget($strField, &$arrVariantOptions, &
$objCallback = \System::importStatic($callback[0]);

try {
$varValue = $objCallback->$callback[1]($varValue, $this, $objWidget);
$varValue = $objCallback->{$callback[1]}($varValue, $this, $objWidget);
} catch (\Exception $e) {
$objWidget->class = 'error';
$objWidget->addError($e->getMessage());
Expand Down Expand Up @@ -915,7 +915,7 @@ protected function generateProductOptionWidget($strField, &$arrVariantOptions, &
if (is_array($arrData['wizard'])) {
foreach ($arrData['wizard'] as $callback) {
$objCallback = \System::importStatic($callback[0]);
$wizard .= $objCallback->$callback[1]($this);
$wizard .= $objCallback->{$callback[1]}($this);
}
}

Expand Down
Loading

0 comments on commit 07e389e

Please sign in to comment.