diff --git a/composer.json b/composer.json index 199fd9f7..7a01a5e8 100644 --- a/composer.json +++ b/composer.json @@ -165,6 +165,9 @@ "mpdf/psr-log-aware-trait": [ "patches/mpdf-psr-log-aware-trait-void-return.patch", "patches/mpdf-mpdf-psr-log-aware-trait-void-return.patch" + ], + "mpdf/psr-http-message-shim": [ + "patches/mpdf-psr-http-message-shim-php8-compat.patch" ] }, "installer-paths": { diff --git a/inc/admin-pages/class-email-list-admin-page.php b/inc/admin-pages/class-email-list-admin-page.php index 38b219cc..b21aa45c 100644 --- a/inc/admin-pages/class-email-list-admin-page.php +++ b/inc/admin-pages/class-email-list-admin-page.php @@ -242,13 +242,13 @@ public function handle_send_new_test_modal() { } $from = [ - 'name' => wu_get_setting('from_name'), - 'email' => wu_get_setting('from_email'), + 'name' => wu_get_setting('from_name', ''), + 'email' => wu_get_setting('from_email', ''), ]; $to = [ [ - 'name' => wu_get_setting('from_name'), + 'name' => wu_get_setting('from_name', ''), 'email' => $send_to, ], ]; diff --git a/inc/admin-pages/class-top-admin-nav-menu.php b/inc/admin-pages/class-top-admin-nav-menu.php index bbe0de41..5524a90a 100644 --- a/inc/admin-pages/class-top-admin-nav-menu.php +++ b/inc/admin-pages/class-top-admin-nav-menu.php @@ -191,10 +191,11 @@ public function add_top_bar_menus($wp_admin_bar): void { } /* - * Add the settings sub-menus. + * Add the settings sub-menus using the lightweight section names + * to avoid triggering the full default_sections() field registration. */ if (current_user_can('wu_read_settings')) { - $settings_tabs = Settings::get_instance()->get_sections(); + $settings_tabs = Settings::get_instance()->get_section_names(); $addon_tabs = []; diff --git a/inc/checkout/class-checkout.php b/inc/checkout/class-checkout.php index adbede11..b2c8f238 100644 --- a/inc/checkout/class-checkout.php +++ b/inc/checkout/class-checkout.php @@ -942,7 +942,7 @@ public function process_order() { $this->membership->set_date_trial_end(gmdate('Y-m-d 23:59:59', $this->order->get_billing_start_date())); $this->membership->set_date_expiration(gmdate('Y-m-d 23:59:59', $this->order->get_billing_start_date())); - if (wu_get_setting('allow_trial_without_payment_method') && $this->customer->get_email_verification() !== 'pending') { + if (wu_get_setting('allow_trial_without_payment_method', false) && $this->customer->get_email_verification() !== 'pending') { /* * In this particular case, we need to set the status to trialing here as we will not update the membership after and then, publish the site. */ diff --git a/inc/checkout/class-legacy-checkout.php b/inc/checkout/class-legacy-checkout.php index 992b6381..98725870 100644 --- a/inc/checkout/class-legacy-checkout.php +++ b/inc/checkout/class-legacy-checkout.php @@ -321,7 +321,7 @@ public function check_geolocation(): void { $this->session->set('geolocation', $location); - $allowed_countries = wu_get_setting('allowed_countries'); + $allowed_countries = wu_get_setting('allowed_countries', []); if (isset($location['country']) && $location['country'] && $allowed_countries) { if ( ! in_array($location['country'], $allowed_countries, true)) { @@ -754,7 +754,7 @@ public function sort_steps_and_fields($a, $b) { public function form_fields($current_plan = false, $step = 'plan', $freq = false): void { /** Select the default frequency */ - $freq = $freq ?: wu_get_setting('default_pricing_option'); + $freq = $freq ?: wu_get_setting('default_pricing_option', 1); ?> diff --git a/inc/checkout/signup-fields/class-signup-field-payment.php b/inc/checkout/signup-fields/class-signup-field-payment.php index ad0b35dc..b1b87787 100644 --- a/inc/checkout/signup-fields/class-signup-field-payment.php +++ b/inc/checkout/signup-fields/class-signup-field-payment.php @@ -184,7 +184,7 @@ public function to_fields_array($attributes) { * Checks if we need to add the * auto renew field. */ - if ( ! wu_get_setting('force_auto_renew', 1)) { + if ( ! wu_get_setting('force_auto_renew', true)) { $auto_renewable_gateways = Gateway_Manager::get_instance()->get_auto_renewable_gateways(); $fields['auto_renew'] = [ diff --git a/inc/checkout/signup-fields/class-signup-field-template-selection.php b/inc/checkout/signup-fields/class-signup-field-template-selection.php index 8ce1d9a9..47a7c5bb 100644 --- a/inc/checkout/signup-fields/class-signup-field-template-selection.php +++ b/inc/checkout/signup-fields/class-signup-field-template-selection.php @@ -328,7 +328,7 @@ public function to_fields_array($attributes) { $customer_sites = []; - if (wu_get_setting('allow_own_site_as_template')) { + if (wu_get_setting('allow_own_site_as_template', false)) { $customer = wu_get_current_customer(); if ($customer) { diff --git a/inc/class-dashboard-widgets.php b/inc/class-dashboard-widgets.php index a4e9d80d..dd14447a 100644 --- a/inc/class-dashboard-widgets.php +++ b/inc/class-dashboard-widgets.php @@ -157,14 +157,14 @@ public function register_widgets(): void { /* * Maintenance Mode Widget */ - if (wu_get_setting('maintenance_mode')) { + if (wu_get_setting('maintenance_mode', false)) { \WP_Ultimo\UI\Site_Maintenance_Element::get_instance()->as_metabox($screen->id, 'side'); } /* * Domain Mapping Widget */ - if (wu_get_setting('enable_domain_mapping') && wu_get_setting('custom_domains')) { + if (wu_get_setting('enable_domain_mapping', false) && wu_get_setting('custom_domains', false)) { \WP_Ultimo\UI\Domain_Mapping_Element::get_instance()->as_metabox($screen->id, 'side'); } } diff --git a/inc/class-maintenance-mode.php b/inc/class-maintenance-mode.php index defa048d..1c70c437 100644 --- a/inc/class-maintenance-mode.php +++ b/inc/class-maintenance-mode.php @@ -32,7 +32,7 @@ public function init(): void { add_action('init', [$this, 'add_settings']); - if (wu_get_setting('maintenance_mode')) { + if (wu_get_setting('maintenance_mode', false)) { $this->hooks(); } } diff --git a/inc/class-settings.php b/inc/class-settings.php index aa5de165..1abfe424 100644 --- a/inc/class-settings.php +++ b/inc/class-settings.php @@ -204,7 +204,14 @@ public function get_setting($setting, $default_value = false) { _doing_it_wrong(esc_html($setting), esc_html__('Dashes are no longer supported when registering a setting. You should change it to underscores in later versions.', 'ultimate-multisite'), '2.0.0'); } - $setting_value = $settings[ $setting ] ?? $default_value; + if (isset($settings[ $setting ])) { + $setting_value = $settings[ $setting ]; + } elseif (false !== $default_value) { + $setting_value = $default_value; + } else { + $defaults = static::get_setting_defaults(); + $setting_value = $defaults[ $setting ] ?? false; + } return apply_filters('wu_get_setting', $setting_value, $setting, $default_value, $settings); } @@ -518,15 +525,6 @@ function ($fields) use ($field_slug, $atts) { }, $priority ); - - $settings = $this->get_all(); - - /* - * Makes sure we install the default value if it is not set yet. - */ - if (isset($atts['default']) && null !== $atts['default'] && ! isset($settings[ $field_slug ])) { - $this->save_setting($field_slug, $atts['default']); - } } /** @@ -1832,6 +1830,200 @@ public function default_sections(): void { do_action('wu_settings_other'); } + /** + * Returns a flat map of setting keys to their default values. + * + * This is used as a lightweight fallback in get_setting() so that + * default_sections() (which is expensive) does not need to run on + * every page load. + * + * @since 2.5.0 + * @return array + */ + public static function get_setting_defaults(): array { + + return [ + // General + 'company_name' => '', + 'company_logo' => '', + 'company_email' => '', + 'company_address' => '', + 'company_country' => 'US', + 'currency_symbol' => 'USD', + 'currency_position' => '%s %v', + 'decimal_separator' => '.', + 'thousand_separator' => ',', + 'precision' => '2', + 'enable_error_reporting' => 0, + 'enable_beta_updates' => 0, + + // Login & Registration + 'enable_registration' => 1, + 'enable_email_verification' => 'free_only', + 'enable_custom_login_page' => 0, + 'default_login_page' => 0, + 'obfuscate_original_login_url' => 0, + 'subsite_custom_login_logo' => 0, + 'force_publish_sites_sync' => 0, + 'minimum_password_strength' => 'medium', + 'default_role' => 'administrator', + 'add_users_to_main_site' => 0, + 'main_site_default_role' => 'subscriber', + + // Memberships + 'block_frontend' => 0, + 'block_frontend_grace_period' => 0, + 'enable_multiple_memberships' => 0, + 'enable_multiple_sites' => 0, + 'block_sites_on_downgrade' => 'none', + 'move_posts_on_downgrade' => 'none', + 'emulated_post_types' => [], + + // Sites + 'enable_visits_limiting' => 1, + 'enable_screenshot_generator' => 1, + 'menu_items_plugin' => 1, + 'add_new_users' => 1, + 'allow_template_switching' => 1, + 'allow_own_site_as_template' => 0, + 'copy_media' => 1, + 'stop_template_indexing' => 0, + + // Payment Gateways + 'force_auto_renew' => 1, + 'allow_trial_without_payment_method' => 0, + 'attach_invoice_pdf' => 1, + 'invoice_numbering_scheme' => 'reference_code', + 'next_invoice_number' => '1', + 'invoice_prefix' => '', + + // Emails (registered via hooks but commonly queried) + 'from_name' => '', + 'from_email' => '', + + // Domain Mapping (registered via hooks but commonly queried) + 'enable_domain_mapping' => false, + 'custom_domains' => false, + 'domain_mapping_instructions' => '', + + // SSO (registered via hooks) + 'enable_sso' => 1, + + // Other + 'hide_tours' => 0, + 'disable_image_zoom' => 0, + 'error_logging_level' => 'default', + 'security_mode' => 0, + 'uninstall_wipe_tables' => 0, + + // Whitelabel (registered via hooks) + 'rename_site_plural' => '', + 'rename_site_singular' => '', + 'rename_wordpress' => '', + + // Maintenance mode (registered via hooks) + 'maintenance_mode' => false, + + // Notifications + 'hide_notifications_subsites' => false, + + // Taxes + 'enable_taxes' => false, + + // Checkout-related + 'default_pricing_option' => 1, + 'allowed_countries' => [], + 'trial' => 0, + + // Manual gateway + 'manual_payment_instructions' => '', + + // Event manager + 'saving_type' => [], + + // Jumper + 'jumper_custom_links' => '', + + // Limits + 'limits_and_quotas' => [], + + // Legacy pricing toggles + 'enable_price_3' => true, + 'enable_price_12' => true, + ]; + } + + /** + * Returns a lightweight list of section slugs and titles for use + * in the admin bar and other places that don't need full field definitions. + * + * This avoids triggering default_sections() and all the expensive + * field registration that comes with it. + * + * @since 2.5.0 + * @return array + */ + public function get_section_names(): array { + + $core_sections = [ + 'general' => [ + 'title' => __('General', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-cog', + ], + 'login-and-registration' => [ + 'title' => __('Login & Registration', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-key', + ], + 'memberships' => [ + 'title' => __('Memberships', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-infinity', + ], + 'sites' => [ + 'title' => __('Sites', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-browser', + ], + 'payment-gateways' => [ + 'title' => __('Payments', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-credit-card', + ], + 'emails' => [ + 'title' => __('Emails', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-email', + ], + 'domain-mapping' => [ + 'title' => __('Domain Mapping', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-link', + ], + 'sso' => [ + 'title' => __('Single Sign-On', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-add-user', + ], + 'integrations' => [ + 'title' => __('Integrations', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-power-plug', + ], + 'import-export' => [ + 'title' => __('Import/Export', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-download', + 'order' => 995, + ], + 'other' => [ + 'title' => __('Other Options', 'ultimate-multisite'), + 'icon' => 'dashicons-wu-switch', + 'order' => 1000, + ], + ]; + + /** + * Allows addons to register their section names without triggering + * the full field registration in default_sections(). + * + * @since 2.5.0 + * @param array $sections Section slug => array with 'title', 'icon', and optionally 'addon' => true. + */ + return apply_filters('wu_settings_section_names', $core_sections); + } + /** * Tries to determine the location of the company based on the admin IP. * diff --git a/inc/class-whitelabel.php b/inc/class-whitelabel.php index 71511db2..726e3e96 100644 --- a/inc/class-whitelabel.php +++ b/inc/class-whitelabel.php @@ -88,9 +88,9 @@ public function hooks(): void { add_action('network_admin_menu', [$this, 'remove_sites_admin_menu']); } - if (wu_get_setting('rename_site_plural') || - wu_get_setting('rename_site_singular') || - wu_get_setting('rename_wordpress') + if (wu_get_setting('rename_site_plural', '') || + wu_get_setting('rename_site_singular', '') || + wu_get_setting('rename_wordpress', '') ) { $this->allowed_domains = apply_filters( 'wu_replace_text_allowed_domains', @@ -102,21 +102,21 @@ public function hooks(): void { ); $search_and_replace = []; - $site_plural = wu_get_setting('rename_site_plural'); + $site_plural = wu_get_setting('rename_site_plural', ''); if ($site_plural) { $search_and_replace['sites'] = strtolower((string) $site_plural); $search_and_replace['Sites'] = ucfirst((string) $site_plural); } - $site_singular = wu_get_setting('rename_site_singular'); + $site_singular = wu_get_setting('rename_site_singular', ''); if ($site_singular) { $search_and_replace['site'] = strtolower((string) $site_singular); $search_and_replace['Site'] = ucfirst((string) $site_singular); } - $wordpress = wu_get_setting('rename_wordpress'); + $wordpress = wu_get_setting('rename_wordpress', ''); if ($wordpress) { $search_and_replace['wordpress'] = strtolower((string) $wordpress); diff --git a/inc/deprecated/deprecated.php b/inc/deprecated/deprecated.php index 388f6d4c..c4c19035 100644 --- a/inc/deprecated/deprecated.php +++ b/inc/deprecated/deprecated.php @@ -271,8 +271,8 @@ public function send_mail($to, $subject, $content, $html = true, $shortcodes = [ _deprecated_function(__METHOD__, '2.0.0', 'wu_send_mail()'); $from = [ - 'name' => wu_get_setting('from_name'), - 'email' => wu_get_setting('from_email'), + 'name' => wu_get_setting('from_name', ''), + 'email' => wu_get_setting('from_email', ''), ]; /* diff --git a/inc/functions/settings.php b/inc/functions/settings.php index fc559285..f30536ba 100644 --- a/inc/functions/settings.php +++ b/inc/functions/settings.php @@ -173,7 +173,7 @@ function wu_get_network_logo($size = 'full') { */ function wu_get_network_logo_attachement_id() { - $settings_logo = wu_get_setting('company_logo'); + $settings_logo = wu_get_setting('company_logo', ''); if ($settings_logo) { return $settings_logo; diff --git a/inc/gateways/class-manual-gateway.php b/inc/gateways/class-manual-gateway.php index 07b591a4..623ef28b 100644 --- a/inc/gateways/class-manual-gateway.php +++ b/inc/gateways/class-manual-gateway.php @@ -400,7 +400,7 @@ public function add_payment_instructions_block($payment, $membership, $customer)
- +
diff --git a/inc/helpers/class-sender.php b/inc/helpers/class-sender.php index 8d49a6f2..5c0e3f92 100644 --- a/inc/helpers/class-sender.php +++ b/inc/helpers/class-sender.php @@ -33,8 +33,8 @@ public static function parse_args($args = []) { $default_args = [ 'from' => [ - 'name' => wu_get_setting('from_name'), - 'email' => wu_get_setting('from_email'), + 'name' => wu_get_setting('from_name', ''), + 'email' => wu_get_setting('from_email', ''), ], 'content' => '', 'subject' => '', @@ -63,8 +63,8 @@ public static function send_mail($from = [], $to = [], $args = []) { if ( ! $from) { $from = [ - 'email' => wu_get_setting('from_email'), - 'name' => wu_get_setting('from_name'), + 'email' => wu_get_setting('from_email', ''), + 'name' => wu_get_setting('from_name', ''), ]; } diff --git a/inc/helpers/validation-rules/class-site-template.php b/inc/helpers/validation-rules/class-site-template.php index 1d4ef7c5..a28135f6 100644 --- a/inc/helpers/validation-rules/class-site-template.php +++ b/inc/helpers/validation-rules/class-site-template.php @@ -62,7 +62,7 @@ public function check($template_id) : bool { // phpcs:ignore } if ($site->get_type() === Site_Type::CUSTOMER_OWNED) { - if (! wu_get_setting('allow_own_site_as_template')) { + if (! wu_get_setting('allow_own_site_as_template', false)) { $this->message = __('You can not use your sites as template', 'ultimate-multisite'); return false; diff --git a/inc/installers/class-default-content-installer.php b/inc/installers/class-default-content-installer.php index 92a8b792..ed7b6fae 100644 --- a/inc/installers/class-default-content-installer.php +++ b/inc/installers/class-default-content-installer.php @@ -125,7 +125,7 @@ protected function done_creating_emails() { */ protected function done_creating_login_page() { - $page_id = wu_get_setting('default_login_page'); + $page_id = wu_get_setting('default_login_page', 0); if ( ! $page_id) { return false; diff --git a/inc/managers/class-customer-manager.php b/inc/managers/class-customer-manager.php index c4c25463..1d2f604e 100644 --- a/inc/managers/class-customer-manager.php +++ b/inc/managers/class-customer-manager.php @@ -337,7 +337,7 @@ public function maybe_verify_email_address(): void { */ public function maybe_add_to_main_site($customer, $checkout): void { - if ( ! wu_get_setting('add_users_to_main_site')) { + if ( ! wu_get_setting('add_users_to_main_site', false)) { return; } diff --git a/inc/managers/class-domain-manager.php b/inc/managers/class-domain-manager.php index 9d6a3d8d..80a89053 100644 --- a/inc/managers/class-domain-manager.php +++ b/inc/managers/class-domain-manager.php @@ -581,7 +581,7 @@ public function get_domain_mapping_instructions() { global $current_site; - $instructions = wu_get_setting('domain_mapping_instructions'); + $instructions = wu_get_setting('domain_mapping_instructions', ''); if ( ! $instructions) { $instructions = $this->default_domain_mapping_instructions(); diff --git a/inc/managers/class-email-manager.php b/inc/managers/class-email-manager.php index 852a8f75..6857829a 100644 --- a/inc/managers/class-email-manager.php +++ b/inc/managers/class-email-manager.php @@ -104,8 +104,8 @@ public function send_system_email($slug, $payload): void { ); $original_from = [ - 'name' => wu_get_setting('from_name'), - 'email' => wu_get_setting('from_email'), + 'name' => wu_get_setting('from_name', ''), + 'email' => wu_get_setting('from_email', ''), ]; if (empty($all_emails)) { diff --git a/inc/managers/class-notification-manager.php b/inc/managers/class-notification-manager.php index bd777905..c9a548c8 100644 --- a/inc/managers/class-notification-manager.php +++ b/inc/managers/class-notification-manager.php @@ -54,7 +54,7 @@ public function init(): void { */ public function hide_notifications_subsites(): void { - if ( ! wu_get_setting('hide_notifications_subsites')) { + if ( ! wu_get_setting('hide_notifications_subsites', false)) { return; } diff --git a/inc/tax/class-dashboard-taxes-tab.php b/inc/tax/class-dashboard-taxes-tab.php index 727bab61..e0981585 100644 --- a/inc/tax/class-dashboard-taxes-tab.php +++ b/inc/tax/class-dashboard-taxes-tab.php @@ -46,7 +46,7 @@ public function __construct() { */ protected function is_enabled() { - return wu_get_setting('enable_taxes'); + return wu_get_setting('enable_taxes', false); } /** diff --git a/inc/tax/class-tax.php b/inc/tax/class-tax.php index f786c69a..322f0bd9 100644 --- a/inc/tax/class-tax.php +++ b/inc/tax/class-tax.php @@ -370,7 +370,7 @@ public function render_taxes_side_panel(): void { } }); });', - wp_json_encode(wu_get_setting('enable_taxes')) + wp_json_encode(wu_get_setting('enable_taxes', false)) ); wp_add_inline_script('wu-vue', $inline_script); diff --git a/inc/traits/trait-wp-ultimo-plan-deprecated.php b/inc/traits/trait-wp-ultimo-plan-deprecated.php index 6b3d5e36..4e4dea48 100644 --- a/inc/traits/trait-wp-ultimo-plan-deprecated.php +++ b/inc/traits/trait-wp-ultimo-plan-deprecated.php @@ -196,7 +196,7 @@ public function get_pricing_table_lines() { * Site, Disk Space and Trial * Gets the Disk Space and Sites to be displayed on the pricing table options */ - if (wu_get_setting('enable_multiple_sites') && $this->should_display_quota_on_pricing_tables('sites')) { + if (wu_get_setting('enable_multiple_sites', false) && $this->should_display_quota_on_pricing_tables('sites')) { $is_unlimited = (int) $this->get_limitations()->sites->get_limit() === 0 || ! $this->get_limitations()->sites->is_enabled(); $value = $is_unlimited ? __('Unlimited', 'ultimate-multisite') : $this->get_limitations()->sites->get_limit(); @@ -232,7 +232,7 @@ public function get_pricing_table_lines() { /** * Display Trial, if some */ - $trial_days = wu_get_setting('trial'); + $trial_days = wu_get_setting('trial', 0); $trial_days_plan = $this->get_trial_duration(); if ($trial_days > 0 || $trial_days_plan) { diff --git a/inc/ui/class-domain-mapping-element.php b/inc/ui/class-domain-mapping-element.php index fea0c0f6..93fe6a36 100644 --- a/inc/ui/class-domain-mapping-element.php +++ b/inc/ui/class-domain-mapping-element.php @@ -221,7 +221,7 @@ public function init(): void { $maybe_limit_domain_mapping = $this->site->get_limitations()->domain_mapping->is_enabled(); } - if ( ! $this->site || ! wu_get_setting('enable_domain_mapping') || ! wu_get_setting('custom_domains') || ! $maybe_limit_domain_mapping) { + if ( ! $this->site || ! wu_get_setting('enable_domain_mapping', false) || ! wu_get_setting('custom_domains', false) || ! $maybe_limit_domain_mapping) { $this->set_display(false); } diff --git a/inc/ui/class-jumper.php b/inc/ui/class-jumper.php index db15aa42..298201b5 100644 --- a/inc/ui/class-jumper.php +++ b/inc/ui/class-jumper.php @@ -156,7 +156,7 @@ public function get_user_custom_links() { $treated_lines = []; - $saved_links = wu_get_setting('jumper_custom_links'); + $saved_links = wu_get_setting('jumper_custom_links', ''); $lines = explode(PHP_EOL, (string) $saved_links); diff --git a/inc/ui/class-limits-element.php b/inc/ui/class-limits-element.php index 89d6f20d..35b882dc 100644 --- a/inc/ui/class-limits-element.php +++ b/inc/ui/class-limits-element.php @@ -266,7 +266,7 @@ public function output($atts, $content = null): void { */ $post_types = apply_filters('wu_get_post_types', $post_types); - $items_to_display = wu_get_setting('limits_and_quotas'); + $items_to_display = wu_get_setting('limits_and_quotas', []); $atts['site'] = $this->site; $atts['post_types'] = $post_types; diff --git a/patches/mpdf-psr-http-message-shim-php8-compat.patch b/patches/mpdf-psr-http-message-shim-php8-compat.patch new file mode 100644 index 00000000..02774511 --- /dev/null +++ b/patches/mpdf-psr-http-message-shim-php8-compat.patch @@ -0,0 +1,137 @@ +--- a/vendor/mpdf/psr-http-message-shim/src/Request.php ++++ b/vendor/mpdf/psr-http-message-shim/src/Request.php +@@ -66,7 +66,7 @@ class Request implements \Psr\Http\Message\RequestInterface + } + } + +- public function getRequestTarget() ++ public function getRequestTarget(): string + { + if ($this->requestTarget !== null) { + return $this->requestTarget; +@@ -83,7 +83,7 @@ class Request implements \Psr\Http\Message\RequestInterface + return $target; + } + +- public function withRequestTarget($requestTarget) ++ public function withRequestTarget(string $requestTarget): \Psr\Http\Message\RequestInterface + { + if (preg_match('#\s#', $requestTarget)) { + throw new \InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); +@@ -95,11 +95,11 @@ class Request implements \Psr\Http\Message\RequestInterface + return $new; + } + +- public function getMethod() ++ public function getMethod(): string + { + return $this->method; + } + +- public function withMethod($method) ++ public function withMethod(string $method): \Psr\Http\Message\RequestInterface + { + $new = clone $this; + $new->method = $method; +@@ -107,11 +107,11 @@ class Request implements \Psr\Http\Message\RequestInterface + return $new; + } + +- public function getUri() ++ public function getUri(): \Psr\Http\Message\UriInterface + { + return $this->uri; + } + +- public function withUri(UriInterface $uri, $preserveHost = false) ++ public function withUri(\Psr\Http\Message\UriInterface $uri, bool $preserveHost = false): \Psr\Http\Message\RequestInterface + { + if ($uri === $this->uri) { + return $this; +@@ -152,11 +152,11 @@ class Request implements \Psr\Http\Message\RequestInterface + $this->headers = [$header => [$host]] + $this->headers; + } + +- public function getProtocolVersion() ++ public function getProtocolVersion(): string + { + return $this->protocol; + } + +- public function withProtocolVersion($version) ++ public function withProtocolVersion(string $version): \Psr\Http\Message\MessageInterface + { + if ($this->protocol === $version) { + return $this; +@@ -168,15 +168,15 @@ class Request implements \Psr\Http\Message\RequestInterface + return $new; + } + +- public function getHeaders() ++ public function getHeaders(): array + { + return $this->headers; + } + +- public function hasHeader($header) ++ public function hasHeader(string $header): bool + { + return isset($this->headerNames[strtolower($header)]); + } + +- public function getHeader($header) ++ public function getHeader(string $header): array + { + $header = strtolower($header); + +@@ -192,11 +192,11 @@ class Request implements \Psr\Http\Message\RequestInterface + return $this->headers[$header]; + } + +- public function getHeaderLine($header) ++ public function getHeaderLine(string $header): string + { + return implode(', ', $this->getHeader($header)); + } + +- public function withHeader($header, $value) ++ public function withHeader(string $header, $value): \Psr\Http\Message\MessageInterface + { + if (!is_array($value)) { + $value = [$value]; +@@ -216,7 +216,7 @@ class Request implements \Psr\Http\Message\RequestInterface + return $new; + } + +- public function withAddedHeader($header, $value) ++ public function withAddedHeader(string $header, $value): \Psr\Http\Message\MessageInterface + { + if (!is_array($value)) { + $value = [$value]; +@@ -237,7 +237,7 @@ class Request implements \Psr\Http\Message\RequestInterface + return $new; + } + +- public function withoutHeader($header) ++ public function withoutHeader(string $header): \Psr\Http\Message\MessageInterface + { + $normalized = strtolower($header); + +@@ -253,7 +253,7 @@ class Request implements \Psr\Http\Message\RequestInterface + return $new; + } + +- public function getBody() ++ public function getBody(): \Psr\Http\Message\StreamInterface + { + if (!$this->stream) { + $this->stream = Stream::create(''); +@@ -263,7 +263,7 @@ class Request implements \Psr\Http\Message\RequestInterface + return $this->stream; + } + +- public function withBody(StreamInterface $body) ++ public function withBody(\Psr\Http\Message\StreamInterface $body): \Psr\Http\Message\MessageInterface + { + if ($body === $this->stream) { + return $this; diff --git a/views/broadcast/emails/base.php b/views/broadcast/emails/base.php index 78d21ef6..612d2221 100644 --- a/views/broadcast/emails/base.php +++ b/views/broadcast/emails/base.php @@ -93,7 +93,7 @@

-
+
get_new_site_url() : wu_get_registration_url(); +$add_new_url = wu_get_setting('enable_multiple_sites', false) ? $element->get_new_site_url() : wu_get_registration_url(); // Redirect back to this page after create the site $add_new_url = add_query_arg( @@ -16,7 +16,7 @@ $add_new_url ); -$show_add_new = wu_get_setting('enable_multiple_sites') || wu_get_setting('enable_multiple_memberships'); +$show_add_new = wu_get_setting('enable_multiple_sites', false) || wu_get_setting('enable_multiple_memberships', false); $show_add_new = apply_filters('wp_ultimo_my_sites_show_add_new', $show_add_new);