Use new code style
This commit is contained in:
@ -28,17 +28,14 @@ trait Singleton {
|
||||
*/
|
||||
public static function get_instance() {
|
||||
|
||||
if (!static::$instance instanceof static) {
|
||||
|
||||
if ( ! static::$instance instanceof static) {
|
||||
static::$instance = new static();
|
||||
|
||||
static::$instance->init();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return static::$instance;
|
||||
|
||||
} // end get_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs only once, at the first instantiation of the Singleton.
|
||||
@ -49,8 +46,7 @@ trait Singleton {
|
||||
public function init() {
|
||||
|
||||
$this->has_parents() && method_exists(get_parent_class($this), 'init') && parent::init();
|
||||
|
||||
} // end init;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current class has parents.
|
||||
@ -61,7 +57,5 @@ trait Singleton {
|
||||
public function has_parents() {
|
||||
|
||||
return (bool) class_parents($this);
|
||||
|
||||
} // end has_parents;
|
||||
|
||||
} // end trait Singleton;
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,8 @@ trait WP_Ultimo_Coupon_Deprecated {
|
||||
*/
|
||||
_doing_it_wrong($key, __('Discount Code keys should not be set directly.', 'wp-ultimo'), '2.0.0');
|
||||
|
||||
$this->meta["wpu_{$key}"] = $value;
|
||||
|
||||
} // end __set;
|
||||
$this->meta[ "wpu_{$key}" ] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic getter to provide backwards compatibility for plans.
|
||||
@ -51,8 +50,7 @@ trait WP_Ultimo_Coupon_Deprecated {
|
||||
switch ($key) {
|
||||
default:
|
||||
$value = $this->get_meta('wpu_' . $key, false, true);
|
||||
|
||||
} // end switch;
|
||||
}
|
||||
|
||||
if ($value === null) {
|
||||
|
||||
@ -62,8 +60,7 @@ trait WP_Ultimo_Coupon_Deprecated {
|
||||
// throw new \Exception($message);
|
||||
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let developers know that this is not going to be supported in the future.
|
||||
@ -73,7 +70,5 @@ trait WP_Ultimo_Coupon_Deprecated {
|
||||
_doing_it_wrong($key, __('Discount Code keys should not be accessed directly', 'wp-ultimo'), '2.0.0');
|
||||
|
||||
return $value;
|
||||
|
||||
} // end __get;
|
||||
|
||||
} // end trait WP_Ultimo_Coupon_Deprecated;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ trait WP_Ultimo_Deprecated {
|
||||
_deprecated_function(__METHOD__, '2.0.0', 'wu_slugify($term)');
|
||||
|
||||
wu_slugify($term);
|
||||
|
||||
} // end slugfy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: WP_Ultimo->add_page_to_branding()
|
||||
@ -38,8 +37,7 @@ trait WP_Ultimo_Deprecated {
|
||||
public function add_page_to_branding() {
|
||||
|
||||
_deprecated_function(__METHOD__, '2.0.0');
|
||||
|
||||
} // end add_page_to_branding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a view file from the view folder.
|
||||
@ -56,8 +54,7 @@ trait WP_Ultimo_Deprecated {
|
||||
_deprecated_function(__METHOD__, '2.0.0', 'wu_get_template()');
|
||||
|
||||
wu_get_template($view, $vars);
|
||||
|
||||
} // end render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full path to the plugin folder
|
||||
@ -73,8 +70,7 @@ trait WP_Ultimo_Deprecated {
|
||||
_deprecated_function(__METHOD__, '2.0.0', 'wu_path()');
|
||||
|
||||
return wu_path($dir);
|
||||
|
||||
} // end path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: Add messages to be displayed as notices
|
||||
@ -95,12 +91,9 @@ trait WP_Ultimo_Deprecated {
|
||||
$ultimo = WP_Ultimo();
|
||||
|
||||
if (isset($ultimo->notices) && $ultimo->notices) {
|
||||
|
||||
$ultimo->notices->add($message, $type, $panel);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end add_message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: This function is here to make sure that the plugin is network active
|
||||
@ -116,8 +109,7 @@ trait WP_Ultimo_Deprecated {
|
||||
_deprecated_function(__METHOD__, '2.0.0', 'WP_Ultimo()->is_loaded()');
|
||||
|
||||
return WP_Ultimo()->is_loaded();
|
||||
|
||||
} // end check_before_run;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: enqueue_select2.
|
||||
@ -132,7 +124,5 @@ trait WP_Ultimo_Deprecated {
|
||||
wp_enqueue_style('wu-select2css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.css', false, '1.0', 'all');
|
||||
|
||||
wp_enqueue_script('wu-select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.js', array('jquery'), '1.0', true);
|
||||
|
||||
} // end enqueue_select2;
|
||||
|
||||
} // end trait WP_Ultimo_Deprecated;
|
||||
}
|
||||
}
|
||||
|
@ -36,44 +36,44 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
$value = null;
|
||||
|
||||
switch ($key) {
|
||||
case 'title':
|
||||
$value = $this->get_name();
|
||||
break;
|
||||
case 'id':
|
||||
case 'ID':
|
||||
$value = $this->get_id();
|
||||
break;
|
||||
case 'free':
|
||||
$value = $this->get_pricing_type() === 'free';
|
||||
break;
|
||||
case 'price_1':
|
||||
case 'price_3':
|
||||
case 'price_12':
|
||||
$value = 20;
|
||||
break;
|
||||
case 'top_deal':
|
||||
$value = $this->is_featured_plan();
|
||||
break;
|
||||
case 'feature_list':
|
||||
$value = $this->get_feature_list();
|
||||
break;
|
||||
case 'quotas':
|
||||
$value = array(
|
||||
// 'sites' => 300,
|
||||
'upload' => 1024 * 1024 * 1024,
|
||||
'visits' => 300,
|
||||
);
|
||||
break;
|
||||
case 'post':
|
||||
$value = (object) array(
|
||||
'ID' => $this->get_id(),
|
||||
'post_title' => $this->get_name(),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$value = $this->get_meta('wpu_' . $key, false, true);
|
||||
break;
|
||||
} // end switch;
|
||||
case 'title':
|
||||
$value = $this->get_name();
|
||||
break;
|
||||
case 'id':
|
||||
case 'ID':
|
||||
$value = $this->get_id();
|
||||
break;
|
||||
case 'free':
|
||||
$value = $this->get_pricing_type() === 'free';
|
||||
break;
|
||||
case 'price_1':
|
||||
case 'price_3':
|
||||
case 'price_12':
|
||||
$value = 20;
|
||||
break;
|
||||
case 'top_deal':
|
||||
$value = $this->is_featured_plan();
|
||||
break;
|
||||
case 'feature_list':
|
||||
$value = $this->get_feature_list();
|
||||
break;
|
||||
case 'quotas':
|
||||
$value = array(
|
||||
// 'sites' => 300,
|
||||
'upload' => 1024 * 1024 * 1024,
|
||||
'visits' => 300,
|
||||
);
|
||||
break;
|
||||
case 'post':
|
||||
$value = (object) array(
|
||||
'ID' => $this->get_id(),
|
||||
'post_title' => $this->get_name(),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$value = $this->get_meta('wpu_' . $key, false, true);
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let developers know that this is not going to be supported in the future.
|
||||
@ -83,8 +83,7 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
_doing_it_wrong($key, __('Product keys should not be accessed directly', 'wp-ultimo'), '2.0.0');
|
||||
|
||||
return $value;
|
||||
|
||||
} // end __get;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the featured status for this product.
|
||||
@ -95,14 +94,11 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
public function is_featured_plan() {
|
||||
|
||||
if ($this->featured_plan === null) {
|
||||
|
||||
$this->featured_plan = $this->get_meta('featured_plan', false);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return (bool) $this->featured_plan;
|
||||
|
||||
} // end is_featured_plan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the featured status for this product.
|
||||
@ -114,8 +110,7 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
public function set_featured_plan($featured_plan) {
|
||||
|
||||
$this->meta['featured_plan'] = $featured_plan;
|
||||
|
||||
} // end set_featured_plan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: Checks if a given plan is a contact us plan.
|
||||
@ -129,8 +124,7 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
_deprecated_function(__METHOD__, '2.0.0', 'get_pricing_type');
|
||||
|
||||
return $this->get_pricing_type() === 'contact_us';
|
||||
|
||||
} // end is_contact_us;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pricing table lines to be displayed on the pricing tables
|
||||
@ -147,20 +141,14 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
* @since 1.7.0
|
||||
*/
|
||||
if ($this->should_display_quota_on_pricing_tables('setup_fee', true)) {
|
||||
|
||||
if ($this->get_pricing_type() === 'contact_us') {
|
||||
|
||||
$pricing_table_lines['wu_product_contact_us'] = __('Contact Us to know more', 'wp-ultimo');
|
||||
|
||||
} else {
|
||||
|
||||
$pricing_table_lines['wu_product_setup_fee'] = $this->has_setup_fee()
|
||||
? sprintf(__('Setup Fee: %s', 'wp-ultimo'), "<strong class='pricing-table-setupfee' data-value='" . $this->get_setup_fee() . "'>" . wu_format_currency($this->get_setup_fee()) . '</strong>')
|
||||
: __('No Setup Fee', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -181,28 +169,25 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
if ($this->is_post_type_disabled($pt_slug)) {
|
||||
|
||||
// Translators: used as "No Posts" where a post type is disabled
|
||||
$pricing_table_lines['wu_product_limit_post_type_' . $pt_slug] = sprintf(__('No %s', 'wp-ultimo'), $post_type->labels->name);
|
||||
$pricing_table_lines[ 'wu_product_limit_post_type_' . $pt_slug ] = sprintf(__('No %s', 'wp-ultimo'), $post_type->labels->name);
|
||||
|
||||
continue;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the values
|
||||
*
|
||||
*
|
||||
* @var integer|string
|
||||
*/
|
||||
$is_unlimited = (int) $this->get_limitations()->post_types->{$pt_slug}->number === 0 || !$this->get_limitations()->post_types->is_enabled();
|
||||
$is_unlimited = (int) $this->get_limitations()->post_types->{$pt_slug}->number === 0 || ! $this->get_limitations()->post_types->is_enabled();
|
||||
$value = $is_unlimited ? __('Unlimited', 'wp-ultimo') : $this->get_limitations()->post_types->{$pt_slug}->number;
|
||||
|
||||
// Add Line
|
||||
$label = $value == 1 ? $post_type->labels->singular_name : $post_type->labels->name;
|
||||
|
||||
$pricing_table_lines['wu_product_limit_post_type_' . $pt_slug] = sprintf('%s %s', $value, $label);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
$pricing_table_lines[ 'wu_product_limit_post_type_' . $pt_slug ] = sprintf('%s %s', $value, $label);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -210,27 +195,23 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
* 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')) {
|
||||
|
||||
$is_unlimited = (int) $this->get_limitations()->sites->get_limit() === 0 || !$this->get_limitations()->sites->is_enabled();
|
||||
$is_unlimited = (int) $this->get_limitations()->sites->get_limit() === 0 || ! $this->get_limitations()->sites->is_enabled();
|
||||
$value = $is_unlimited ? __('Unlimited', 'wp-ultimo') : $this->get_limitations()->sites->get_limit();
|
||||
|
||||
// Add Line
|
||||
$pricing_table_lines['wu_product_limit_sites'] = sprintf('<strong>%s %s</strong>', $value, _n('Site', 'Sites', $this->get_limitations()->sites->get_limit(), 'wp-ultimo'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display DiskSpace
|
||||
*/
|
||||
if ($this->should_display_quota_on_pricing_tables('upload')) {
|
||||
|
||||
$is_unlimited = (int) $this->get_limitations()->disk_space->get_limit() === 0 || !$this->get_limitations()->disk_space->is_enabled();
|
||||
$is_unlimited = (int) $this->get_limitations()->disk_space->get_limit() === 0 || ! $this->get_limitations()->disk_space->is_enabled();
|
||||
$disk_space = $is_unlimited ? __('Unlimited', 'wp-ultimo') : size_format(absint($this->get_limitations()->disk_space->get_limit()) * 1024 * 1024);
|
||||
|
||||
// Add Line
|
||||
$pricing_table_lines['wu_product_limit_disk_space'] = !empty($disk_space) ? sprintf(__('%s <strong>Disk Space</strong>', 'wp-ultimo'), $disk_space) : false;
|
||||
|
||||
} // end if;
|
||||
$pricing_table_lines['wu_product_limit_disk_space'] = ! empty($disk_space) ? sprintf(__('%s <strong>Disk Space</strong>', 'wp-ultimo'), $disk_space) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits
|
||||
@ -238,14 +219,12 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
* @since 1.6.0
|
||||
*/
|
||||
if ($this->should_display_quota_on_pricing_tables('visits')) {
|
||||
|
||||
$is_unlimited = (int) $this->get_limitations()->visits->get_limit() === 0 || !$this->get_limitations()->visits->is_enabled();
|
||||
$is_unlimited = (int) $this->get_limitations()->visits->get_limit() === 0 || ! $this->get_limitations()->visits->is_enabled();
|
||||
$value = $is_unlimited ? __('Unlimited', 'wp-ultimo') : number_format($this->get_limitations()->visits->get_limit());
|
||||
|
||||
// Add Line
|
||||
$pricing_table_lines['wu_product_limit_visits'] = sprintf('%s %s', $value, _n('Visit per month', 'Visits per month', $this->get_limitations()->visits->get_limit(), 'wp-ultimo'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Trial, if some
|
||||
@ -254,12 +233,10 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
$trial_days_plan = $this->get_trial_duration();
|
||||
|
||||
if ($trial_days > 0 || $trial_days_plan) {
|
||||
|
||||
$trial_days = $trial_days_plan ? $trial_days_plan : $trial_days;
|
||||
|
||||
$pricing_table_lines['wu_product_trial'] = !$this->is_free() ? sprintf(__('%s day <strong>Free Trial</strong>', 'wp-ultimo'), $trial_days) : '-';
|
||||
|
||||
} // end if;
|
||||
$pricing_table_lines['wu_product_trial'] = ! $this->is_free() ? sprintf(__('%s day <strong>Free Trial</strong>', 'wp-ultimo'), $trial_days) : '-';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -271,23 +248,18 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
$custom_features = explode('<br />', nl2br($this->get_feature_list()));
|
||||
|
||||
foreach ($custom_features as $key => $custom_feature) {
|
||||
|
||||
if (trim($custom_feature) == '') {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$pricing_table_lines['wu_product_feature_' . $key] = sprintf('%s', trim($custom_feature));
|
||||
|
||||
} // end foreach;
|
||||
$pricing_table_lines[ 'wu_product_feature_' . $key ] = sprintf('%s', trim($custom_feature));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Lines, filterable
|
||||
*/
|
||||
return apply_filters("wu_get_pricing_table_lines_$this->id", $pricing_table_lines, $this);
|
||||
|
||||
} // end get_pricing_table_lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: A quota to get.
|
||||
@ -301,26 +273,17 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
public function get_quota($quota_name) {
|
||||
|
||||
if ($quota_name === 'visits') {
|
||||
|
||||
$limit = (float) $this->get_limitations()->visits->get_limit();
|
||||
|
||||
} elseif ($quota_name === 'disk_space') {
|
||||
|
||||
$limit = (float) $this->get_limitations()->disk_space->get_limit();
|
||||
|
||||
} elseif ($quota_name === 'sites') {
|
||||
|
||||
$limit = (float) $this->get_limitations()->sites->get_limit();
|
||||
|
||||
} else {
|
||||
|
||||
$limit = (float) $this->get_limitations()->post_types->{$quota_name}->number;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $limit;
|
||||
|
||||
} // end get_quota;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns wether or not we should display a given quota type in the Quotas and Limits widgets
|
||||
@ -336,21 +299,16 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
*/
|
||||
$elements = array();
|
||||
|
||||
if (!$elements) {
|
||||
|
||||
if ( ! $elements) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!isset( $elements[$quota_type] ) && $default) {
|
||||
|
||||
if ( ! isset($elements[ $quota_type ]) && $default) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
return isset( $elements[$quota_type] ) && $elements[$quota_type];
|
||||
|
||||
} // end should_display_quota_on_pricing_tables;
|
||||
return isset($elements[ $quota_type ]) && $elements[ $quota_type ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this plan allows unlimited extra users
|
||||
@ -361,8 +319,7 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
public function should_allow_unlimited_extra_users() {
|
||||
|
||||
return apply_filters('wu_plan_should_allow_unlimited_extra_users', (bool) $this->unlimited_extra_users, $this);
|
||||
|
||||
} // end should_allow_unlimited_extra_users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns wether or not we should display a given quota type in the Quotas and Limits widgets
|
||||
@ -373,9 +330,8 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
*/
|
||||
public function is_post_type_disabled($post_type) {
|
||||
|
||||
return !$this->get_limitations()->post_types->{$post_type}->enabled;
|
||||
|
||||
} // end is_post_type_disabled;
|
||||
return ! $this->get_limitations()->post_types->{$post_type}->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the post_type quotas
|
||||
@ -387,14 +343,20 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
|
||||
$quotas = $this->quotas;
|
||||
|
||||
return array_filter($quotas, fn($quota_name) => !in_array($quota_name, array(
|
||||
'sites',
|
||||
'attachment',
|
||||
'upload',
|
||||
'users',
|
||||
'visits',
|
||||
), true), ARRAY_FILTER_USE_KEY);
|
||||
|
||||
} // end get_post_type_quotas;
|
||||
|
||||
} // end trait WP_Ultimo_Plan_Deprecated;
|
||||
return array_filter(
|
||||
$quotas,
|
||||
fn($quota_name) => ! in_array(
|
||||
$quota_name,
|
||||
array(
|
||||
'sites',
|
||||
'attachment',
|
||||
'upload',
|
||||
'users',
|
||||
'visits',
|
||||
),
|
||||
true
|
||||
),
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -21,16 +21,13 @@ trait WP_Ultimo_Settings_Deprecated {
|
||||
* @return void
|
||||
*/
|
||||
public function handle_legacy_scripts() {
|
||||
/*
|
||||
* Mailchimp: Backwards compatibility.
|
||||
*/
|
||||
/*
|
||||
* Mailchimp: Backwards compatibility.
|
||||
*/
|
||||
if (wp_script_is('wu-mailchimp', 'registered')) {
|
||||
|
||||
wp_enqueue_script('wu-mailchimp');
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end handle_legacy_scripts;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle legacy hooks to support old versions of our add-ons.
|
||||
@ -42,22 +39,19 @@ trait WP_Ultimo_Settings_Deprecated {
|
||||
|
||||
$legacy_settings = array();
|
||||
|
||||
/*
|
||||
* Fetch Extra Sections
|
||||
*/
|
||||
/*
|
||||
* Fetch Extra Sections
|
||||
*/
|
||||
$sections = apply_filters_deprecated('wu_settings_sections', array(array()), '2.0.0', 'wu_register_settings_section()');
|
||||
|
||||
foreach ($sections as $section_key => $section) {
|
||||
|
||||
if ($section_key === 'activation') {
|
||||
|
||||
continue; // No activation stuff;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$legacy_settings = array_merge($legacy_settings, $section['fields']);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
$filters = array(
|
||||
'wu_settings_section_general',
|
||||
@ -71,34 +65,28 @@ trait WP_Ultimo_Settings_Deprecated {
|
||||
);
|
||||
|
||||
foreach ($filters as $filter) {
|
||||
|
||||
$message = __('Adding setting sections directly via filters is no longer supported.');
|
||||
|
||||
$legacy_settings = apply_filters_deprecated($filter, array($legacy_settings), '2.0.0', 'wu_register_settings_field()', $message);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
if ($legacy_settings) {
|
||||
|
||||
$this->add_section('other', array(
|
||||
'title' => __('Other', 'wp-ultimo'),
|
||||
'desc' => __('Other', 'wp-ultimo'),
|
||||
));
|
||||
$this->add_section(
|
||||
'other',
|
||||
array(
|
||||
'title' => __('Other', 'wp-ultimo'),
|
||||
'desc' => __('Other', 'wp-ultimo'),
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($legacy_settings as $setting_key => $setting) {
|
||||
|
||||
if (strpos((string) $setting_key, 'license_key_') !== false) {
|
||||
|
||||
continue; // Remove old license key fields
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$this->add_field('other', $setting_key, $setting);
|
||||
|
||||
} // end foreach;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end handle_legacy_filters;
|
||||
|
||||
} // end trait WP_Ultimo_Settings_Deprecated;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,13 +28,11 @@ trait WP_Ultimo_Site_Deprecated {
|
||||
$value = null;
|
||||
|
||||
switch ($key) {
|
||||
|
||||
case 'site_owner_id':
|
||||
$customer = $this->get_customer();
|
||||
$value = $customer ? $customer->get_user_id() : false;
|
||||
break;
|
||||
|
||||
} // end switch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let developers know that this is not going to be supported in the future.
|
||||
@ -44,8 +42,7 @@ trait WP_Ultimo_Site_Deprecated {
|
||||
_doing_it_wrong($key, __('Product keys should not be accessed directly', 'wp-ultimo'), '2.0.0');
|
||||
|
||||
return $value;
|
||||
|
||||
} // end __get;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated: get_subscription.
|
||||
@ -59,7 +56,5 @@ trait WP_Ultimo_Site_Deprecated {
|
||||
_deprecated_function(__CLASS__, '2.0.0', '\WP_Ultimo\Models\Site::get_membership()');
|
||||
|
||||
return $this->get_membership();
|
||||
|
||||
} // end get_subscription;
|
||||
|
||||
} // end trait WP_Ultimo_Site_Deprecated;
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,10 @@ trait WP_Ultimo_Subscription_Deprecated {
|
||||
$value = null;
|
||||
|
||||
switch ($key) {
|
||||
|
||||
case 'plan_id':
|
||||
$value = $this->get_plan_id();
|
||||
break;
|
||||
|
||||
} // end switch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let developers know that this is not going to be supported in the future.
|
||||
@ -43,7 +41,5 @@ trait WP_Ultimo_Subscription_Deprecated {
|
||||
_doing_it_wrong($key, __('Membership keys should not be accessed directly', 'wp-ultimo'), '2.0.0');
|
||||
|
||||
return $value;
|
||||
|
||||
} // end __get;
|
||||
|
||||
} // end trait WP_Ultimo_Subscription_Deprecated;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user