Skip to content

Commit

Permalink
Merged in COMDEVNL-1814 (pull request #42)
Browse files Browse the repository at this point in the history
COMDEVNL-1814 -- Fix OCMod errors in OC 1.5

Approved-by: Henk-Roel van Zijl <[email protected]>
Approved-by: Maxim Janssens <[email protected]>
  • Loading branch information
maximj committed Feb 8, 2019
2 parents 5bb6f10 + c6d3d2f commit 5ca0036
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"license": "BSD-2-Clause",
"require": {
"php": ">=5.4.0",
"php": ">=5.6.0",
"ext-curl": "*",
"ext-openssl": "*"
},
Expand Down
2 changes: 0 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ them ready-made into your OpenCart webshop with this powerful plugin.
- PayPal
- SEPA Direct Debits
- SEPA Bank Transfer
- Bitcoin
- iDeal
- Bancontact
- Paysafecard
Expand Down Expand Up @@ -71,7 +70,6 @@ Contact Mollie: [www.mollie.com/nl/about](https://www.mollie.com/nl/about) — i
+ [More info on SOFORT Banking via Mollie](https://www.mollie.com/payments/sofort/)
+ [More info on SEPA Bank transfer via Mollie](https://www.mollie.com/payments/banktransfer/)
+ [More info on SEPA Direct debit via Mollie](https://www.mollie.com/payments/directdebit/)
+ [More info on Bitcoin via Mollie](https://www.mollie.com/payments/bitcoin/)
+ [More info on PayPal via Mollie](https://www.mollie.com/payments/paypal/)
+ [More info on Belfius Direct Net via Mollie](https://www.mollie.com/payments/belfiusdirectnet/)
+ [More info on paysafecard via Mollie](https://www.mollie.com/payments/paysafecard/)
Expand Down
58 changes: 32 additions & 26 deletions system/comercia/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ function library($library)
$bestOption = $this->findBestOption($libDir, $library, "php");
if (!class_exists($className)) {
if (class_exists("VQMod")) {
@include_once(\VQMod::modCheck(modification($libDir . $bestOption["name"] . ".php"), $libDir . $bestOption["name"] . ".php"));
@include_once(\VQMod::modCheck($this->modification($libDir . $bestOption["name"] . ".php"), $libDir . $bestOption["name"] . ".php"));
} else {
@include_once(modification($libDir . $bestOption["name"] . ".php"));
@include_once($this->modification($libDir . $bestOption["name"] . ".php"));
}
}

Expand Down Expand Up @@ -108,9 +108,9 @@ function model($model)
$className = $route["class"];
if (!class_exists($className)) {
if (class_exists("VQMod")) {
@include_once(\VQMod::modCheck(modification($modelDir . $route["file"] . ".php"), $modelDir . $route["file"] . ".php"));
@include_once(\VQMod::modCheck($this->modification($modelDir . $route["file"] . ".php"), $modelDir . $route["file"] . ".php"));
} else {
@include_once(modification($modelDir . $route["file"] . ".php"));
@include_once($this->modification($modelDir . $route["file"] . ".php"));
}
}

Expand All @@ -119,8 +119,8 @@ function model($model)
//Check for events
if(Util::version()->isMinimal("2.2")) {
$result = new \Proxy();
$r = new \ReflectionMethod('Loader', 'callback');

$r = new \ReflectionMethod('Loader', 'callback');
$r->setAccessible(true);

foreach (get_class_methods($className) as $method) {
Expand All @@ -129,7 +129,7 @@ function model($model)
} else {
$result = new $className(Util::registry());
}

Util::registry()->set(Util::stringHelper()->ccToUnderline($className), $result);
return $result;
}
Expand Down Expand Up @@ -234,9 +234,9 @@ function view($view, $data = array())
}
$fakeControllerFile = __DIR__ . "/fakeController.php";
if (class_exists("VQMod")) {
require_once(\VQMod::modCheck(modification($fakeControllerFile), $fakeControllerFile));
require_once(\VQMod::modCheck($this->modification($fakeControllerFile), $fakeControllerFile));
} else {
require_once(modification($fakeControllerFile));
require_once($this->modification($fakeControllerFile));
}
$controller = new FakeController($registry);
$result = $controller->getView($view, $data);
Expand Down Expand Up @@ -326,9 +326,9 @@ function controller($controller)
$className = $route["class"];
if (!class_exists($className)) {
if (class_exists("VQMod")) {
@include_once(\VQMod::modCheck(modification($controllerDir . $route["file"] . ".php"), $controllerDir . $route["file"] . ".php"));
@include_once(\VQMod::modCheck($this->modification($controllerDir . $route["file"] . ".php"), $controllerDir . $route["file"] . ".php"));
} else {
@include_once(modification($controllerDir . $route["file"] . ".php"));
@include_once($this->modification($controllerDir . $route["file"] . ".php"));
}
}

Expand Down Expand Up @@ -368,12 +368,16 @@ private function rewriteModel($model)
"" => "sale/custom_field",
"2.1" => "customer/custom_field"
],
[
"" => "sale/customer_group",
"2.1" => "customer/customer_group"
],
[
"" => "setting/extension",
"2.0" => "extension/extension",
"3.0" => "setting/extension"
],
[
[
"" => "extension/event",
"3.0" => "setting/event"
]
Expand All @@ -393,23 +397,25 @@ private function rewriteLanguage($model)
]
);
}
// Modification Override

// Modification Override
function modification($filename) {
if (defined('DIR_CATALOG')) {
$file = DIR_MODIFICATION . 'admin/' . substr($filename, strlen(DIR_APPLICATION));
} elseif (defined('DIR_OPENCART')) {
$file = DIR_MODIFICATION . 'install/' . substr($filename, strlen(DIR_APPLICATION));
} else {
$file = DIR_MODIFICATION . 'catalog/' . substr($filename, strlen(DIR_APPLICATION));
}
if (Util::version()->isMinimal(2.0)) {
if (defined('DIR_CATALOG')) {
$file = DIR_MODIFICATION . 'admin/' . substr($filename, strlen(DIR_APPLICATION));
} elseif (defined('DIR_OPENCART')) {
$file = DIR_MODIFICATION . 'install/' . substr($filename, strlen(DIR_APPLICATION));
} else {
$file = DIR_MODIFICATION . 'catalog/' . substr($filename, strlen(DIR_APPLICATION));
}

if (substr($filename, 0, strlen(DIR_SYSTEM)) == DIR_SYSTEM) {
$file = DIR_MODIFICATION . 'system/' . substr($filename, strlen(DIR_SYSTEM));
}
if (substr($filename, 0, strlen(DIR_SYSTEM)) == DIR_SYSTEM) {
$file = DIR_MODIFICATION . 'system/' . substr($filename, strlen(DIR_SYSTEM));
}

if (is_file($file)) {
return $file;
if (is_file($file)) {
return $file;
}
}

return $filename;
Expand Down

0 comments on commit 5ca0036

Please sign in to comment.