addSubscriptionGeneralSettings(); $this->updateRegistrationForm(); $this->updateWelcomePage(); $this->updateProductDetailsPage(); $this->updateProfileMenu(); $this->updateCategoryPaginatePage(); $this->updateListingPaginatePage(); $this->updateBackendCustomerPage(); } public function addSubscriptionGeneralSettings() { if (isModuleActive('GeneralSetting')) { $path = module_path('GeneralSetting', 'Http/Controllers/GeneralSettingController.php'); if (file_exists($path)) { $content = file_get_contents($path); if (!preg_match("/updateOption\('customer_subscription'/", $content)) { $matches = null; preg_match("/if\(\\\$request->has\('pwa_app_name'\)[.\s\S]+?}/", $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " if (isModuleActive('Subscription')) { app(\Modules\Subscription\Http\Controllers\SettingController::class)->updateOption('customer_subscription', \$request->customer_subscription); } "; $code .= $snippet; $content = preg_replace("/if\(\\\$request->has\('pwa_app_name'\)[.\s\S]+?}/", $code, $content); file_put_contents($path, $content); } } } $path = module_path('GeneralSetting', 'Resources/views/page_components/general_settings.blade.php'); if (file_exists($path)) { $content = file_get_contents($path); if (!preg_match("/@include\('subscription::components\._customer_subscription_control'\)/", $content)) { $matches = null; preg_match('/[.\s\S]+pwa_app_name[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Subscription')) @include('subscription::components._customer_subscription_control') @endif "; $code .= $snippet; $content = preg_replace('/[.\s\S]+pwa_app_name[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content); file_put_contents($path, $content); } } } } } public function updateRegistrationForm() { $theme = app('theme'); if ($theme) { $theme_name = app('theme')->folder_path; $path = resource_path('views/frontend/amazy/auth/register.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match('/@include\(\'subscription::components\._stripe_form\'\)/', $content)) { $matches = null; preg_match('/sign_up_text[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Subscription') && isModuleActive('PaymentGateway')) @include('subscription::components._stripe_form') @endif "; $code .= $snippet; $content = preg_replace('/sign_up_text[.\s\S]+?<\/div>[.\s\S]+?<\/div>/', $code, $content); $update = true; } } if (!preg_match('/@include\(\'subscription::components\._register_button\'\)/', $content)) { $content_bak = $content; $matches = null; preg_match('/@if\(env\(\'NOCAPTCHA_FOR_REG\'\)[.\s\S]+?@endif[.\s\S]+?@endif[.\s\S]+?<\/div>/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @endif "; $code .= $snippet; $content = preg_replace('/@if\(env\(\'NOCAPTCHA_FOR_REG\'\)[.\s\S]+?@endif[.\s\S]+?@endif[.\s\S]+?<\/div>/', $code, $content); $has_post_snippet = true; } $matches = null; preg_match('/@if\(env\(\'NOCAPTCHA_FOR_REG\'\)[.\s\S]+?@endif[.\s\S]+?@endif/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Subscription') && isModuleActive('PaymentGateway')) @include('subscription::components._register_button') @else "; $code .= $snippet; $content = preg_replace('/@if\(env\(\'NOCAPTCHA_FOR_REG\'\)[.\s\S]+?@endif[.\s\S]+?@endif/', $code, $content); $has_pre_snippet = true; } if ($has_pre_snippet && $has_post_snippet) { $update = true; } else { $content = $content_bak; } } if (!preg_match('/@include\(\'subscription::components\._plan_select_field\'\)/', $content)) { $matches = null; preg_match('/[.\s\S]+password_confirmation[.\s\S]+?<\/div>/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Subscription') && isModuleActive('PaymentGateway')) @include('subscription::components._plan_select_field') @endif "; $code .= $snippet; $content = preg_replace('/[.\s\S]+password_confirmation[.\s\S]+?<\/div>/', $code, $content); $update = true; } } if (!preg_match('/@include\(\'subscription::components\._form_head\'\)/', $content)) { $matches = null; preg_match('/