Prep Plugin for release on WordPress.org (#23)

* Update translation text domain
* Escape everything that should be escaped.
* Add nonce checks where needed.
* Sanitize all inputs.
* Apply Code style changes across the codebase.
* Correct many deprecation notices.
* Optimize load order of many filters.
* Add Proper Build script
* Use emojii flags
* Fix i18n deprecation  notice for translating too early
* Put all scripts in footer and load async
This commit is contained in:
David Stone
2025-04-14 11:36:46 -06:00
committed by GitHub
parent a31cfcb565
commit d88e50df38
1087 changed files with 12586 additions and 18535 deletions

View File

@@ -317,11 +317,11 @@ class Membership extends Base_Model {
*
* @since 2.0.0
*
* @param object $object Std object with model parameters.
* @param object $object_model Std object with model parameters.
*/
public function __construct($object = null) {
public function __construct($object_model = null) {
parent::__construct($object);
parent::__construct($object_model);
$this->_gateway_info = [
'gateway' => $this->get_gateway(),
@@ -670,7 +670,7 @@ class Membership extends Base_Model {
public function swap($order) {
if ( ! is_a($order, Cart::class)) {
return new \WP_Error('invalid-date', __('Swap Cart is invalid.', 'wp-ultimo'));
return new \WP_Error('invalid-date', __('Swap Cart is invalid.', 'wp-multisite-waas'));
}
// clear the current addons.
@@ -743,11 +743,11 @@ class Membership extends Base_Model {
}
if ( ! wu_validate_date($schedule_date)) {
return new \WP_Error('invalid-date', __('Schedule date is invalid.', 'wp-ultimo'));
return new \WP_Error('invalid-date', __('Schedule date is invalid.', 'wp-multisite-waas'));
}
if ( ! is_a($order, Cart::class)) {
return new \WP_Error('invalid-date', __('Swap Cart is invalid.', 'wp-ultimo'));
return new \WP_Error('invalid-date', __('Swap Cart is invalid.', 'wp-multisite-waas'));
}
$date_instance = wu_date($schedule_date);
@@ -831,7 +831,7 @@ class Membership extends Base_Model {
$description = sprintf(
// translators: %1$s the duration, and %2$s the duration unit (day, week, month, etc)
_n('every %2$s', 'every %1$s %2$s', $this->get_duration(), 'wp-ultimo'), // phpcs:ignore
_n('every %2$s', 'every %1$s %2$s', $this->get_duration(), 'wp-multisite-waas'), // phpcs:ignore
$this->get_duration(),
wu_get_translatable_string(($this->get_duration() <= 1 ? $this->get_duration_unit() : $this->get_duration_unit() . 's'))
);
@@ -847,12 +847,12 @@ class Membership extends Base_Model {
public function get_times_billed_description(): string {
// translators: times billed / subscription duration in cycles. e.g. 1/12 cycles
$description = __('%1$s / %2$s cycles', 'wp-ultimo');
$description = __('%1$s / %2$s cycles', 'wp-multisite-waas');
if ($this->is_forever_recurring()) {
// translators: the place holder is the number of times the membership was billed.
$description = __('%1$s / until cancelled', 'wp-ultimo');
$description = __('%1$s / until cancelled', 'wp-multisite-waas');
}
return sprintf($description, $this->get_times_billed(), $this->get_billing_cycles());
@@ -872,7 +872,7 @@ class Membership extends Base_Model {
$message = sprintf(
// translators: %1$s is the formatted price, %2$s the duration, and %3$s the duration unit (day, week, month, etc)
_n('%1$s every %3$s', '%1$s every %2$s %3$s', $duration, 'wp-ultimo'), // phpcs:ignore
_n('%1$s every %3$s', '%1$s every %2$s %3$s', $duration, 'wp-multisite-waas'), // phpcs:ignore
wu_format_currency($this->get_amount(), $this->get_currency()),
$duration,
wu_get_translatable_string($duration <= 1 ? $this->get_duration_unit() : $this->get_duration_unit() . 's')
@@ -883,7 +883,7 @@ class Membership extends Base_Model {
if ( ! $this->is_forever_recurring()) {
$billing_cycles_message = sprintf(
// translators: %s is the number of billing cycles.
_n('for %s cycle', 'for %s cycles', $this->get_billing_cycles(), 'wp-ultimo'),
_n('for %s cycle', 'for %s cycles', $this->get_billing_cycles(), 'wp-multisite-waas'),
$this->get_billing_cycles()
);
@@ -892,13 +892,13 @@ class Membership extends Base_Model {
} else {
$pricing['subscription'] = sprintf(
// translators: %1$s is the formatted price of the product
__('%1$s one time payment', 'wp-ultimo'),
__('%1$s one time payment', 'wp-multisite-waas'),
wu_format_currency($this->get_initial_amount(), $this->get_currency())
);
}
if ($this->is_free()) {
$pricing['subscription'] = __('Free!', 'wp-ultimo');
$pricing['subscription'] = __('Free!', 'wp-multisite-waas');
}
return implode(' + ', $pricing);