関数
AmazonPay::initializeApp()
説明 説明
NOTE: usces’ main() function is called in an init hook of priority 10. Therefore, if class files which need the usces global are initialized before 10, everything from usces will be null.
ファイル: src/AmazonPay.php
public function initializeApp() {
$opts = $this->getActingOpts();
if ($opts['use_quickpay'] === 'on') {
(new Views\CartPage\Factory())->getInstance($this);
}
// we only call init here to enqueue styles before template load
(new Views\CartErrorPage\CartErrorPage())->init();
(new Views\MemberEditPage\MemberEditPage($this))->init();
(new Views\MemberLoginPage\MemberLoginPage($this))->init();
// initialize last so that hooks are registered before exit
$this->restRoutes = new Routing\RestRoutes($this);
$this->redirectRoutes = new Routing\RedirectRoutes($this);
// listen for route matches
$this->restRoutes->dispatcher->listen();
// PRIORITY MUST BE LOWER THAN 2
add_filter('usces_filter_template_redirect', function ($bool) {
$this->redirectRoutes->dispatcher->listen();
return $bool;
}, 1, 1);
}