Fix i18n deprecation notice for translating too early

This commit is contained in:
David Stone
2025-02-15 15:06:43 -07:00
parent 6d7e7cef66
commit eb29a438a5
26 changed files with 98 additions and 104 deletions

@@ -237,11 +237,14 @@ abstract class Base_Element {
add_action('wu_element_preview', [$this, 'setup_preview']);
// Init should be the correct time to call this to avoid the deprecated notice from I18N.
// But it doesn't work for some reason, fix later.
// add_action('init', function () {
do_action('wu_element_loaded', $this);
// } );
add_action(
'init',
function () {
do_action('wu_element_loaded', $this);
},
5,
0
);
if ($this->public) {
self::register_public_element($this);

@@ -570,7 +570,7 @@ class Checkout_Element extends Base_Element {
return sprintf(__('Checkout form %s contains no fields.', 'wp-ultimo'), $slug);
}
if ( ! $checkout_form->is_active() || ! wu_get_setting('enable_registration')) {
if ( ! $checkout_form->is_active() || ! wu_get_setting('enable_registration', true)) {
return sprintf('<p>%s</p>', __('Registration is not available at this time.', 'wp-ultimo'));
}

@@ -46,7 +46,7 @@ class Jumper {
*/
public function __construct() {
add_action('wp_ultimo_load', [$this, 'add_settings'], 20);
add_action('init', [$this, 'add_settings'], 20);
add_action('init', [$this, 'load_jumper']);
}

@@ -394,12 +394,13 @@ class Template_Previewer {
* @since 2.0.0
*
* @param string $setting The setting key.
* @param mixed $default Default value, if it is not found.
* @param mixed $default_value Default value, if it is not found.
*
* @return mixed
*/
public function get_setting($setting, $default = false) {
return wu_get_isset($this->get_settings(), $setting, $default);
public function get_setting($setting, $default_value = false) {
$settings = wu_get_option(self::KEY, []);
return wu_get_isset($settings, $setting, $default_value);
}
/**

@@ -392,7 +392,7 @@ class Thank_You_Element extends Base_Element {
/*
* Deal with conversion tracking
*/
$conversion_snippets = $atts['checkout_form']->get_conversion_snippets();
$conversion_snippets = $atts['checkout_form'] ? $atts['checkout_form']->get_conversion_snippets() : false;
if ( ! empty($conversion_snippets)) {
$product_ids = [];