This commit is contained in:
Prospress Inc
2019-05-31 09:16:48 +02:00
committed by Remco Tolsma
parent 8ba2071408
commit 98a2ef42f7
49 changed files with 531 additions and 4029 deletions

View File

@@ -1,5 +1,30 @@
*** WooCommerce Subscriptions Changelog ***
2019.05.30 - version 2.5.6
* Fix: Exclude core order properties from the meta copied from the subscription to early renewal orders. #PR3331
* Tweak: Add the 'is-active' class to My Account > My Subscription menu item when user is on View Subscription page. PR#3328
2019.05.13 - version 2.5.5
* New: Add support for admin users to re-display the staging site notice if it was previously hidden. PR#3321
* Fix: Revert a fix released in 2.5.4 which attempted to implement a workaround for SiteGround's staging sites. PR#3323 reverts: PR#3285
2019.05.08 - version 2.5.4
* Fix: Don't save empty product sale date ranges. Fixes an issue where the sale price appears in 1970 after a timezone offset change. PR#3283
* Fix: Validate subscription coupon types for non subscription and non-signup fee products. Fixes an issue where subscription coupons limited to 1 use never apply to some mixed carts. PR#3280
* Fix: Fix the PHP warnings that occur on the WP Dashboard page caused by incorrect use of args in a sprintf string. PR#3290
* Fix: Maintain any cart coupons when emptying the cart because of the store's mixed checkout settings. PR#3291
* Fix: Fix fatal errors when calling wcs_get_objects_property with a non-object parameter. PR#3308
* Fix: Use the raw SERVER_ADMIN variable to generate site URL on SiteGround sites. This fixes issues where SiteGround hosted staging sites weren't being recognized as staging sites due to SiteGround's special handling of the site url stored in the DB. PR#3285
* Fix: Don't check subscription limitation purchasability on admin screens. PR#3311
* Fix: Pass the 4th param to callbacks on woocommerce_checkout_create_order_shipping_item. PR#3317
* Fix: Remove order-specific e-mail actions from "Subscription actions" drop-down. PR#3299
* Fix: Add the item subtotal tax when manually renewing where the prices included tax. Fixes an issue where if the store's tax rates change, customers renewing manually may get a strange item price. PR#3286
* Tweak: Keep renewal orders "created_via" meta as "subscription" when paid via the checkout. PR#3301
* Tweak: Remove cancelled PayPal Reference Transactions Billing Agreements from manual, non-PayPal, and ended subscriptions. Fixes an issue where a cancelled subscription is reactivated and attempts to use a cancelled billing agreement. PR#3263
* Tweak: Increase the WC tested version to 3.6.0. PR#3313
* Tweak: Update Action Scheduler to 2.2.4. PR#3312
* New: Add a filter to allow 3rd parties to disable auto-switching. PR#3316
2019.03.20 - version 2.5.3
* New: Update Action Scheduler to version 2.2.1. PR#3266
* Fix: Display the subscription status names (rather than the raw status) in the edit subscription related orders table. PR#3272

View File

@@ -467,8 +467,8 @@ class WC_Subscriptions_Admin {
$site_offset = get_option( 'gmt_offset' ) * 3600;
// Save the timestamps in UTC time, the way WC does it.
$date_from = ( isset( $_POST['_sale_price_dates_from'] ) ) ? wcs_date_to_time( $_POST['_sale_price_dates_from'] ) - $site_offset : '';
$date_to = ( isset( $_POST['_sale_price_dates_to'] ) ) ? wcs_date_to_time( $_POST['_sale_price_dates_to'] ) - $site_offset : '';
$date_from = ( ! empty( $_POST['_sale_price_dates_from'] ) ) ? wcs_date_to_time( $_POST['_sale_price_dates_from'] ) - $site_offset : '';
$date_to = ( ! empty( $_POST['_sale_price_dates_to'] ) ) ? wcs_date_to_time( $_POST['_sale_price_dates_to'] ) - $site_offset : '';
$now = gmdate( 'U' );

View File

@@ -43,7 +43,9 @@ class WCS_Admin_Meta_Boxes {
add_action( 'woocommerce_order_action_wcs_create_pending_renewal', __CLASS__ . '::create_pending_renewal_action_request', 10, 1 );
add_action( 'woocommerce_order_action_wcs_create_pending_parent', __CLASS__ . '::create_pending_parent_action_request', 10, 1 );
if ( WC_Subscriptions::is_woocommerce_pre( '3.2' ) ) {
add_filter( 'woocommerce_resend_order_emails_available', __CLASS__ . '::remove_order_email_actions', 0, 1 );
}
add_action( 'woocommerce_order_action_wcs_retry_renewal_payment', __CLASS__ . '::process_retry_renewal_payment_action_request', 10, 1 );
}
@@ -147,8 +149,12 @@ class WCS_Admin_Meta_Boxes {
public static function add_subscription_actions( $actions ) {
global $theorder;
if ( wcs_is_subscription( $theorder ) && ! $theorder->has_status( wcs_get_subscription_ended_statuses() ) ) {
if ( wcs_is_subscription( $theorder ) ) {
if ( ! WC_Subscriptions::is_woocommerce_pre( '3.2' ) ) {
unset( $actions['send_order_details'], $actions['send_order_details_admin'] );
}
if ( ! $theorder->has_status( wcs_get_subscription_ended_statuses() ) ) {
if ( $theorder->payment_method_supports( 'subscription_date_changes' ) && $theorder->has_status( 'active' ) ) {
$actions['wcs_process_renewal'] = esc_html__( 'Process renewal', 'woocommerce-subscriptions' );
}
@@ -158,6 +164,7 @@ class WCS_Admin_Meta_Boxes {
} else {
$actions['wcs_create_pending_parent'] = esc_html__( 'Create pending parent order', 'woocommerce-subscriptions' );
}
}
} else if ( self::can_renewal_order_be_retried( $theorder ) ) {
$actions['wcs_retry_renewal_payment'] = esc_html__( 'Retry Renewal Payment', 'woocommerce-subscriptions' );
}

View File

@@ -209,7 +209,7 @@ class WCS_Report_Dashboard {
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-reports&tab=subscriptions&report=subscription_events_by_date&range=month' ) ); ?>">
<?php
// translators: 1$: count, 2$ and 3$ are opening and closing strong tags, respectively.
echo wp_kses_post( sprintf( _n( '%2$s%$1s signup%3$s subscription signups this month', '%2$s%1$s signups%3$s subscription signups this month', $report_data->signup_count, 'woocommerce-subscriptions' ), $report_data->signup_count, '<strong>', '</strong>' ) );
echo wp_kses_post( sprintf( _n( '%2$s%1$s signup%3$s subscription signups this month', '%2$s%1$s signups%3$s subscription signups this month', $report_data->signup_count, 'woocommerce-subscriptions' ), $report_data->signup_count, '<strong>', '</strong>' ) );
?>
</a>
</li>

View File

@@ -301,8 +301,8 @@ class WC_Subscriptions_Checkout {
$item->save(); // We need the item ID for old hooks, this can be removed once support for WC < 3.0 is dropped
wc_do_deprecated_action( 'woocommerce_subscriptions_add_recurring_shipping_order_item', array( $subscription->get_id(), $item->get_id(), $package_key ), '2.2.0', 'CRUD and woocommerce_checkout_create_subscription_shipping_item action instead' );
do_action( 'woocommerce_checkout_create_order_shipping_item', $item, $package_key, $package ); // WC 3.0+ will also trigger the deprecated 'woocommerce_add_shipping_order_item' hook
do_action( 'woocommerce_checkout_create_subscription_shipping_item', $item, $package_key, $package );
do_action( 'woocommerce_checkout_create_order_shipping_item', $item, $package_key, $package, $subscription ); // WC 3.0+ will also trigger the deprecated 'woocommerce_add_shipping_order_item' hook
do_action( 'woocommerce_checkout_create_subscription_shipping_item', $item, $package_key, $package, $subscription );
}
}
}

View File

@@ -40,6 +40,16 @@ class WC_Subscriptions_Coupon {
'recurring_percent' => 1,
);
/**
* Subscription sign up fee coupon types.
*
* @var array
*/
private static $sign_up_fee_coupons = array(
'sign_up_fee_percent' => 1,
'sign_up_fee' => 1,
);
/**
* Virtual renewal coupon types.
*
@@ -84,6 +94,8 @@ class WC_Subscriptions_Coupon {
// Hook recurring coupon functionality.
add_action( 'plugins_loaded', array( __CLASS__, 'maybe_add_recurring_coupon_hooks' ) );
add_filter( 'woocommerce_coupon_is_valid_for_product', array( __CLASS__, 'validate_subscription_coupon_for_product' ), 10, 3 );
}
/**
@@ -1196,6 +1208,41 @@ class WC_Subscriptions_Coupon {
return $price;
}
/**
* Validates a subscription coupon's use for a given product.
*
* @since 2.5.4
*
* @param bool $is_valid Whether the coupon is valid for the product.
* @param WC_Product $product The product object.
* @param WC_Coupon $coupon The coupon object.
*
* @return bool Whether the coupon is valid for the product.
*/
public static function validate_subscription_coupon_for_product( $is_valid, $product, $coupon ) {
// Exit early if the coupon is already invalid.
if ( ! $is_valid ) {
return $is_valid;
}
$coupon_type = $coupon->get_discount_type();
$is_recurring_coupon = isset( self::$recurring_coupons[ $coupon_type ] );
$is_sign_up_fee_coupon = isset( self::$sign_up_fee_coupons[ $coupon_type ] );
// Recurring and sign up fee coupons are not valid for non-subscription products.
if ( ( $is_recurring_coupon || $is_sign_up_fee_coupon ) && ! WC_Subscriptions_Product::is_subscription( $product ) ) {
$is_valid = false;
}
// Sign up fee coupons are not valid for products without a sign up fee.
if ( $is_sign_up_fee_coupon && 0 === WC_Subscriptions_Product::get_sign_up_fee( $product ) ) {
$is_valid = false;
}
return $is_valid;
}
/**
* Store how much discount each coupon grants.
*

View File

@@ -260,7 +260,7 @@ class WC_Subscriptions_Switcher {
}
}
if ( self::can_item_be_switched_by_user( $item, $subscription ) ) {
if ( apply_filters( 'wcs_initiate_auto_switch', self::can_item_be_switched_by_user( $item, $subscription ), $item, $subscription ) ) {
wp_redirect( add_query_arg( 'auto-switch', 'true', self::get_switch_url( $item_id, $item, $subscription ) ) );
exit;
}

View File

@@ -63,6 +63,9 @@ class WCS_Cart_Renewal {
// Apply renewal discounts as pseudo coupons
add_action( 'woocommerce_setup_cart_for_subscription_renewal', array( $this, 'setup_discounts' ) );
// Work around WC changing the "created_via" meta to "checkout" regardless of its previous value during checkout.
add_action( 'woocommerce_checkout_create_order', array( $this, 'maybe_preserve_order_created_via' ), 0, 1 );
}
/**
@@ -403,16 +406,8 @@ class WCS_Cart_Renewal {
$price = $item_to_renew['line_subtotal'];
if ( $_product->is_taxable() && wc_prices_include_tax() ) {
if ( apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ) {
$base_tax_rates = WC_Tax::get_base_tax_rates( wcs_get_objects_property( $_product, 'tax_class' ) );
} else {
$base_tax_rates = WC_Tax::get_rates( wcs_get_objects_property( $_product, 'tax_class' ) );
}
$base_taxes_on_item = WC_Tax::calc_tax( $price, $base_tax_rates, false, false );
$price += array_sum( $base_taxes_on_item );
if ( $_product->is_taxable() && $subscription->get_prices_include_tax() ) {
$price += $item_to_renew['subtotal_tax'];
}
$_product->set_price( $price / $item_to_renew['qty'] );
@@ -1383,6 +1378,21 @@ class WCS_Cart_Renewal {
}
}
/**
* Makes sure a renewal order's "created via" meta is not changed to "checkout" by WC during checkout.
*
* @param WC_Order $order
* @since 2.5.4
*/
public function maybe_preserve_order_created_via( $order ) {
$changes = $order->get_changes();
$current_data = $order->get_data();
if ( isset( $changes['created_via'], $current_data['created_via'] ) && 'subscription' === $current_data['created_via'] && 'checkout' === $changes['created_via'] && wcs_order_contains_renewal( $order ) ) {
$order->set_created_via( 'subscription' );
}
}
/* Deprecated */
/**

View File

@@ -19,14 +19,13 @@ class WCS_Limiter {
// Add limiting subscriptions options on edit product page
add_action( 'woocommerce_product_options_advanced', __CLASS__ . '::admin_edit_product_fields' );
// Only attach limited subscription purchasability logic on the front end.
if ( ! is_admin() ) {
add_filter( 'woocommerce_subscription_is_purchasable', __CLASS__ . '::is_purchasable_switch', 12, 2 );
add_filter( 'woocommerce_subscription_variation_is_purchasable', __CLASS__ . '::is_purchasable_switch', 12, 2 );
add_filter( 'woocommerce_subscription_is_purchasable', __CLASS__ . '::is_purchasable_renewal', 12, 2 );
add_filter( 'woocommerce_subscription_variation_is_purchasable', __CLASS__ . '::is_purchasable_renewal', 12, 2 );
}
}
/**
@@ -215,7 +214,7 @@ class WCS_Limiter {
$is_purchasable = true;
// Restoring cart from session, so need to check the cart in the session (wcs_cart_contains_renewal() only checks the cart)
} elseif ( WC()->session->cart ) {
} elseif ( ! empty( WC()->session->cart ) ) {
foreach ( WC()->session->cart as $cart_item_key => $cart_item ) {
if ( $product->get_id() == $cart_item['product_id'] && ( isset( $cart_item['subscription_renewal'] ) || isset( $cart_item['subscription_resubscribe'] ) ) ) {
$is_purchasable = true;

View File

@@ -31,6 +31,7 @@ class WCS_Query extends WC_Query {
add_filter( 'woocommerce_get_endpoint_url', array( $this, 'maybe_redirect_to_only_subscription' ), 10, 2 );
add_action( 'woocommerce_account_subscriptions_endpoint', array( $this, 'endpoint_content' ) );
add_filter( 'woocommerce_account_menu_item_classes', array( $this, 'maybe_add_active_class' ), 10, 2 );
}
$this->init_query_vars();
@@ -136,7 +137,7 @@ class WCS_Query extends WC_Query {
return $menu_items;
}
if ( 1 == count( wcs_get_users_subscriptions() ) && apply_filters( 'wcs_my_account_redirect_to_single_subscription', true ) ) {
if ( 1 === count( wcs_get_users_subscriptions() ) && apply_filters( 'wcs_my_account_redirect_to_single_subscription', true ) ) {
$label = __( 'My Subscription', 'woocommerce-subscriptions' );
} else {
$label = __( 'Subscriptions', 'woocommerce-subscriptions' );
@@ -356,4 +357,21 @@ class WCS_Query extends WC_Query {
public function add_wcs_query_vars( $query_vars ) {
return array_merge( $query_vars, $this->query_vars );
}
/**
* Adds `is-active` class to Subscriptions label when we're viewing a single Subscription.
*
* @param array $classes The classes present in the current endpoint.
* @param string $endpoint The endpoint/label we're filtering.
*
* @return array
* @since 2.5.6
*/
public function maybe_add_active_class( $classes, $endpoint ) {
if ( ! isset( $classes['is-active'] ) && 'subscriptions' === $endpoint && wcs_is_view_subscription_page() ) {
$classes[] = 'is-active';
}
return $classes;
}
}

View File

@@ -14,6 +14,7 @@ class WCS_Staging {
public static function init() {
add_action( 'woocommerce_generated_manual_renewal_order', array( __CLASS__, 'maybe_record_staging_site_renewal' ) );
add_filter( 'woocommerce_register_post_type_subscription', array( __CLASS__, 'maybe_add_menu_badge' ) );
add_action( 'wp_loaded', array( __CLASS__, 'maybe_reset_admin_notice' ) );
}
/**
@@ -54,4 +55,16 @@ class WCS_Staging {
return $subscription_order_type_data;
}
/**
* Handles admin requests to redisplay the staging site admin notice.
*
* @since 2.5.5
*/
public static function maybe_reset_admin_notice() {
if ( isset( $_REQUEST['wcs_display_staging_notice'] ) && is_admin() && current_user_can( 'manage_options' ) ) {
delete_option( 'wcs_ignore_duplicate_siteurl_notice' );
wp_safe_redirect( remove_query_arg( array( 'wcs_display_staging_notice' ) ) );
}
}
}

View File

@@ -158,16 +158,17 @@ class WCS_Cart_Early_Renewal extends WCS_Cart_Renewal {
* @since 2.5.2
*/
public function copy_subscription_meta_to_order( $order ) {
$cart_item = $this->cart_contains();
if ( ! $cart_item ) {
return;
}
if ( $this->cart_contains() ) {
// Get the subscription.
$subscription = wcs_get_subscription( $cart_item[ $this->cart_item_key ]['subscription_id'] );
$subscription = $this->get_order();
// Copy all meta from subscription to new renewal order
if ( $subscription ) {
// Copy all meta, excluding core properties (totals etc), from the subscription to new renewal order
add_filter( 'wcs_renewal_order_meta', array( $this, 'exclude_core_order_meta_properties' ) );
wcs_copy_order_meta( $subscription, $order, 'renewal_order' );
remove_filter( 'wcs_renewal_order_meta', array( $this, 'exclude_core_order_meta_properties' ) );
}
}
}
/**
@@ -415,4 +416,65 @@ class WCS_Cart_Early_Renewal extends WCS_Cart_Renewal {
}
}
}
/**
* Excludes core order meta properties from the meta copied from the subscription.
*
* Attached to the dynamic hook 'wcs_renewal_order_meta' which is triggered by wcs_copy_order_meta
* when copying meta from the subscription to the early renewal order.
*
* @since 2.5.6
*
* @param array $order_meta The meta keys and values to copy from the subscription to the early renewal order.
* @return array The subscription meta to copy to the early renewal order.
*/
public function exclude_core_order_meta_properties( $order_meta ) {
// Additional meta keys to exclude. These are in addition to the meta keys already excluded by wcs_copy_order_meta().
$excluded_meta_keys = array(
'_customer_user' => 1,
'_order_currency' => 1,
'_prices_include_tax' => 1,
'_order_version' => 1,
'_shipping_first_name' => 1,
'_shipping_last_name' => 1,
'_shipping_company' => 1,
'_shipping_address_1' => 1,
'_shipping_address_2' => 1,
'_shipping_city' => 1,
'_shipping_state' => 1,
'_shipping_postcode' => 1,
'_shipping_country' => 1,
'_shipping_address_index' => 1,
'_billing_first_name' => 1,
'_billing_last_name' => 1,
'_billing_company' => 1,
'_billing_address_1' => 1,
'_billing_address_2' => 1,
'_billing_city' => 1,
'_billing_state' => 1,
'_billing_postcode' => 1,
'_billing_country' => 1,
'_billing_email' => 1,
'_billing_phone' => 1,
'_billing_address_index' => 1,
'is_vat_exempt' => 1,
'_customer_ip_address' => 1,
'_customer_user_agent' => 1,
'_cart_discount' => 1,
'_cart_discount_tax' => 1,
'_order_shipping' => 1,
'_order_shipping_tax' => 1,
'_order_tax' => 1,
'_order_total' => 1,
);
foreach ( $order_meta as $index => $meta ) {
if ( isset( $excluded_meta_keys[ $meta['meta_key'] ] ) ) {
unset( $order_meta[ $index ] );
}
}
return $order_meta;
}
}

View File

@@ -174,18 +174,16 @@ class WC_Subscriptions_Payment_Gateways {
/**
* Fire a gateway specific hook for when a subscription renewal payment is due.
*
* @param WC_Order $renewal_order The renewal order to trigger the payment gateway hook for.
* @since 2.1.0
*/
public static function trigger_gateway_renewal_payment_hook( $renewal_order ) {
$renewal_order_payment_method = wcs_get_objects_property( $renewal_order, 'payment_method' );
if ( ! empty( $renewal_order ) && $renewal_order->get_total() > 0 && ! empty( $renewal_order_payment_method ) ) {
if ( ! empty( $renewal_order ) && $renewal_order->get_total() > 0 && $renewal_order->get_payment_method() ) {
// Make sure gateways are setup
WC()->payment_gateways();
do_action( 'woocommerce_scheduled_subscription_payment_' . $renewal_order_payment_method, $renewal_order->get_total(), $renewal_order );
do_action( 'woocommerce_scheduled_subscription_payment_' . $renewal_order->get_payment_method(), $renewal_order->get_total(), $renewal_order );
}
}

View File

@@ -30,6 +30,13 @@ class WCS_PayPal {
/** @var Array cache of PayPal Standard settings in WooCommerce */
protected static $paypal_settings;
/**
* An internal cache of subscription IDs with a specific PayPal Standard Profile ID or Reference Transaction Billing Agreement.
*
* @var int[][]
*/
protected static $subscriptions_by_paypal_id = array();
/**
* Main PayPal Instance, ensures only one instance is/can be loaded
*
@@ -688,4 +695,41 @@ class WCS_PayPal {
return $available_gateways;
}
/**
* Gets subscriptions with a given paypal subscription id.
*
* @since 2.5.4
* @param string $paypal_id The PayPal Standard Profile ID or PayPal Reference Transactions Billing Agreement.
* @param string $return Optional. The type to return. Can be 'ids' to return subscription IDs or 'objects' to return WC_Subscription objects. Default 'ids'.
* @return WC_Subscription[]|int[] Subscriptions (objects or IDs) with the PayPal Profile ID or Billing Agreement stored in meta.
*/
public static function get_subscriptions_by_paypal_id( $paypal_id, $return = 'ids' ) {
if ( ! isset( self::$subscriptions_by_paypal_id[ $paypal_id ] ) ) {
$subscription_ids = get_posts( array(
'posts_per_page' => -1,
'post_type' => 'shop_subscription',
'post_status' => 'any',
'fields' => 'ids',
'meta_query' => array(
array(
'key' => '_paypal_subscription_id',
'compare' => '=',
'value' => $paypal_id,
),
),
) );
self::$subscriptions_by_paypal_id[ $paypal_id ] = array_combine( $subscription_ids, $subscription_ids );
}
if ( 'objects' === $return ) {
$subscriptions = array_filter( array_map( 'wcs_get_subscription', self::$subscriptions_by_paypal_id[ $paypal_id ] ) );
} else {
$subscriptions = self::$subscriptions_by_paypal_id[ $paypal_id ];
}
return $subscriptions;
}
}

View File

@@ -248,35 +248,39 @@ class WCS_PayPal_Admin {
* @param WC_Subscription $subscription
*/
public static function profile_link( $subscription ) {
if ( wcs_is_subscription( $subscription ) && ! $subscription->is_manual() && 'paypal' == $subscription->get_payment_method() ) {
if ( ! wcs_is_subscription( $subscription ) || $subscription->is_manual() || 'paypal' != $subscription->get_payment_method() ) {
return;
}
$paypal_profile_id = wcs_get_paypal_id( $subscription );
if ( ! empty( $paypal_profile_id ) ) {
if ( empty( $paypal_profile_id ) ) {
return;
}
$url = '';
$domain = WCS_PayPal::get_option( 'testmode' ) === 'yes' ? 'sandbox.paypal' : 'paypal';
if ( false === wcs_is_paypal_profile_a( $paypal_profile_id, 'billing_agreement' ) ) {
// Standard subscription
$url = 'https://www.paypal.com/?cmd=_profile-recurring-payments&encrypted_profile_id=' . $paypal_profile_id;
$url = "https://www.{$domain}.com/?cmd=_profile-recurring-payments&encrypted_profile_id={$paypal_profile_id}";
} elseif ( wcs_is_paypal_profile_a( $paypal_profile_id, 'billing_agreement' ) ) {
// Reference Transaction subscription
$url = 'https://www.paypal.com/?cmd=_profile-merchant-pull&encrypted_profile_id=' . $paypal_profile_id . '&mp_id=' . $paypal_profile_id . '&return_to=merchant&flag_flow=merchant';
$url = "https://www.{$domain}.com/?cmd=_profile-merchant-pull&encrypted_profile_id={$paypal_profile_id}&mp_id={$paypal_profile_id}&return_to=merchant&flag_flow=merchant";
}
echo '<div class="address">';
echo '<p class="paypal_subscription_info"><strong>';
echo esc_html( __( 'PayPal Subscription ID:', 'woocommerce-subscriptions' ) );
echo '</strong>';
if ( ! empty( $url ) ) {
echo '<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $paypal_profile_id ) . '</a>';
} else {
echo esc_html( $paypal_profile_id );
}
echo '</p></div>';
}
}
echo '</p></div>';
}
/**

View File

@@ -51,6 +51,7 @@ class WCS_PayPal_Reference_Transaction_IPN_Handler extends WCS_PayPal_Standard_I
case 'mp_cancel':
$this->cancel_subscriptions( $transaction_details['mp_id'] );
$this->remove_billing_agreement_from_subscriptions( $transaction_details['mp_id'] );
break;
case 'merch_pmt' :
@@ -84,50 +85,44 @@ class WCS_PayPal_Reference_Transaction_IPN_Handler extends WCS_PayPal_Standard_I
}
/**
* Find all subscription with a given billing agreement ID and cancel them becasue that billing agreement has been
* Find all subscription with a given billing agreement ID and cancel them because that billing agreement has been
* cancelled at PayPal, and therefore, no future payments can be charged.
*
* @since 2.0
*/
protected function cancel_subscriptions( $billing_agreement_id ) {
$subscription_ids = get_posts( array(
'posts_per_page' => -1,
'post_type' => 'shop_subscription',
'post_status' => 'any',
'fields' => 'ids',
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => '_paypal_subscription_id',
'compare' => '=',
'value' => $billing_agreement_id,
),
),
) );
if ( empty( $subscription_ids ) ) {
return;
}
$note = esc_html__( 'Billing agreement cancelled at PayPal.', 'woocommerce-subscriptions' );
foreach ( $subscription_ids as $subscription_id ) {
$subscription = wcs_get_subscription( $subscription_id );
// Only cancel valid subscriptions using PayPal as the payment method that have not yet been ended
if ( false == $subscription || $subscription->is_manual() || 'paypal' != $subscription->get_payment_method() || $subscription->has_status( wcs_get_subscription_ended_statuses() ) ) {
continue;
}
foreach ( WCS_PayPal::get_subscriptions_by_paypal_id( $billing_agreement_id, 'objects' ) as $subscription ) {
$is_paypal_subscription = ! $subscription->is_manual() && 'paypal' === $subscription->get_payment_method();
// Cancel PayPal subscriptions which haven't ended yet.
if ( $is_paypal_subscription && ! $subscription->has_status( wcs_get_subscription_ended_statuses() ) ) {
try {
$subscription->cancel_order( $note );
WC_Gateway_Paypal::log( sprintf( 'Subscription %s Cancelled: %s', $subscription_id, $note ) );
WC_Gateway_Paypal::log( sprintf( 'Subscription %s Cancelled: %s', $subscription->get_id(), $note ) );
} catch ( Exception $e ) {
WC_Gateway_Paypal::log( sprintf( 'Unable to cancel subscription %s: %s', $subscription_id, $e->getMessage() ) );
WC_Gateway_Paypal::log( sprintf( 'Unable to cancel subscription %s: %s', $subscription->get_id(), $e->getMessage() ) );
}
}
}
}
/**
* Removes a billing agreement from all subscriptions.
*
* @since 2.5.4
* @param string $billing_agreement_id The billing agreement to remove.
*/
protected function remove_billing_agreement_from_subscriptions( $billing_agreement_id ) {
foreach ( WCS_PayPal::get_subscriptions_by_paypal_id( $billing_agreement_id, 'objects' ) as $subscription ) {
if ( 'paypal' === $subscription->get_payment_method() ) {
$subscription->set_payment_method();
}
$subscription->delete_meta_data( '_paypal_subscription_id' );
$subscription->update_meta_data( '_cancelled_paypal_billing_agreement', $billing_agreement_id );
$subscription->save();
}
}
}

View File

@@ -1,14 +1,14 @@
<?php
/*
* Plugin Name: Action Scheduler
* Plugin URI: https://github.com/prospress/action-scheduler
* Plugin URI: https://actionscheduler.org
* Description: A robust scheduling library for use in WordPress plugins.
* Author: Prospress
* Author URI: http://prospress.com/
* Version: 2.2.1
* Version: 2.2.4
* License: GPLv3
*
* Copyright 2018 Prospress, Inc. (email : freedoms@prospress.com)
* Copyright 2019 Prospress, Inc. (email : freedoms@prospress.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,21 +25,21 @@
*
*/
if ( ! function_exists( 'action_scheduler_register_2_dot_2_dot_1' ) ) {
if ( ! function_exists( 'action_scheduler_register_2_dot_2_dot_4' ) ) {
if ( ! class_exists( 'ActionScheduler_Versions' ) ) {
require_once( 'classes/ActionScheduler_Versions.php' );
add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 );
}
add_action( 'plugins_loaded', 'action_scheduler_register_2_dot_2_dot_1', 0, 0 );
add_action( 'plugins_loaded', 'action_scheduler_register_2_dot_2_dot_4', 0, 0 );
function action_scheduler_register_2_dot_2_dot_1() {
function action_scheduler_register_2_dot_2_dot_4() {
$versions = ActionScheduler_Versions::instance();
$versions->register( '2.2.1', 'action_scheduler_initialize_2_dot_2_dot_1' );
$versions->register( '2.2.4', 'action_scheduler_initialize_2_dot_2_dot_4' );
}
function action_scheduler_initialize_2_dot_2_dot_1() {
function action_scheduler_initialize_2_dot_2_dot_4() {
require_once( 'classes/ActionScheduler.php' );
ActionScheduler::init( __FILE__ );
}

View File

@@ -40,7 +40,7 @@ class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated {
public function system_status_report() {
$table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
$table->print();
$table->render();
}
/**

View File

@@ -112,11 +112,7 @@ class ActionScheduler_WPCLI_QueueRunner extends ActionScheduler_Abstract_QueueRu
$this->process_action( $action_id );
$this->progress_bar->tick();
// Free up memory after every 50 items
if ( 0 === $this->progress_bar->current() % 50 ) {
$this->stop_the_insanity();
}
$this->maybe_stop_the_insanity();
}
$completed = $this->progress_bar->current();
@@ -207,4 +203,15 @@ class ActionScheduler_WPCLI_QueueRunner extends ActionScheduler_Abstract_QueueRu
call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important
}
}
/**
* Maybe trigger the stop_the_insanity() method to free up memory.
*/
protected function maybe_stop_the_insanity() {
// The value returned by progress_bar->current() might be padded. Remove padding, and convert to int.
$current_iteration = intval( trim( $this->progress_bar->current() ) );
if ( 0 === $current_iteration % 50 ) {
$this->stop_the_insanity();
}
}
}

View File

@@ -21,7 +21,7 @@ class ActionScheduler_wcSystemStatus {
*
* Helpful to identify issues, like a clogged queue.
*/
public function print() {
public function render() {
$action_counts = $this->store->action_counts();
$status_labels = $this->store->get_status_labels();
$oldest_and_newest = $this->get_oldest_and_newest( array_keys( $status_labels ) );
@@ -126,4 +126,22 @@ class ActionScheduler_wcSystemStatus {
<?php
}
/**
* is triggered when invoking inaccessible methods in an object context.
*
* @param $name string
* @param $arguments array
*
* @return mixed
* @link https://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods
*/
public function __call( $name, $arguments ) {
switch ( $name ) {
case 'print':
_deprecated_function( __CLASS__ . '::print()', '2.2.4', __CLASS__ . '::render()' );
return call_user_func_array( array( $this, 'render' ), $arguments );
}
return null;
}
}

View File

@@ -132,11 +132,7 @@ class ActionScheduler_wpPostStore extends ActionScheduler_Store {
protected function make_action_from_post( $post ) {
$hook = $post->post_title;
$args = json_decode( $post->post_content, true );
// Handle args that do not decode properly.
if ( JSON_ERROR_NONE !== json_last_error() || ! is_array( $args ) ) {
throw ActionScheduler_InvalidActionException::from_decoding_args( $post->ID );
}
$this->validate_args( $args, $post->ID );
$schedule = get_post_meta( $post->ID, self::SCHEDULE_META_KEY, true );
if ( empty( $schedule ) || ! is_a( $schedule, 'ActionScheduler_Schedule' ) ) {
@@ -788,4 +784,24 @@ class ActionScheduler_wpPostStore extends ActionScheduler_Store {
$taxonomy_registrar = new ActionScheduler_wpPostStore_TaxonomyRegistrar();
$taxonomy_registrar->register();
}
/**
* Validate that we could decode action arguments.
*
* @param mixed $args The decoded arguments.
* @param int $action_id The action ID.
*
* @throws ActionScheduler_InvalidActionException When the decoded arguments are invalid.
*/
private function validate_args( $args, $action_id ) {
// Ensure we have an array of args.
if ( ! is_array( $args ) ) {
throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id );
}
// Validate JSON decoding if possible.
if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) {
throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id );
}
}
}

View File

@@ -6,6 +6,6 @@
"minimum-stability": "dev",
"require": {},
"require-dev": {
"wp-cli/wp-cli": "^1.3"
"wp-cli/wp-cli": "1.5.1"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
actionscheduler.org

View File

@@ -1,7 +0,0 @@
title: Action Scheduler - Job Queue for WordPress
description: A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins - no server access required.
theme: jekyll-theme-hacker
permalink: /:slug/
plugins:
- jekyll-seo-tag
- jekyll-sitemap

View File

@@ -1,57 +0,0 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#63c0f5">
<meta name="msapplication-TileColor" content="#151515">
<meta name="theme-color" content="#ffffff">
{% seo %}
</head>
<body>
<header>
<div class="container">
<p><a href="/usage/">Usage</a> | <a href="/admin/">Admin</a> | <a href="/wp-cli/">WP-CLI</a> | <a href="/perf/">Background Processing at Scale</a> | <a href="/api/">API</a> | <a href="/faq/">FAQ</a>
<h1><a href="/">action-scheduler</a></h1>
<h2>A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins - no server access required.</h2>
</div>
</header>
<div class="container">
<section id="main_content">
{{ content }}
</section>
</div>
<footer>
<div class="container">
<p><a href="/usage/">Usage</a> | <a href="/admin/">Admin</a> | <a href="/wp-cli/">WP-CLI</a> | <a href="/perf/">Background Processing at Scale</a> | <a href="/api/">API</a> | <a href="/faq/">FAQ</a>
<p class="footer-image">
<a href="https://prospress.com"><img src="http://pic.pros.pr/eb8dcec9bd54/prospress-hacker-green-logo.png" width="120"></a>
</p>
</div>
</footer>
{% if site.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
</body>
</html>

View File

@@ -1,22 +0,0 @@
---
description: Learn how to administer background jobs with the Action Scheduler job queue for WordPress.
---
# Scheduled Actions Administration Screen
Action Scheduler has a built in administration screen for monitoring, debugging and manually triggering scheduled actions.
The administration interface is accesible through both:
1. **Tools > Scheduled Actions**
1. **WooCommerce > Status > Scheduled Actions**, when WooCommerce is installed.
Among other tasks, from the admin screen you can:
* run a pending action
* view the scheduled actions with a specific status, like the all actions which have failed or are in-progress (https://cldup.com/NNTwE88Xl8.png).
* view the log entries for a specific action to find out why it failed.
* sort scheduled actions by hook name, scheduled date, claim ID or group name.
Still have questions? Check out the [FAQ](/faq).
![](https://cldup.com/5BA2BNB1sw.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,179 +0,0 @@
---
description: Reference guide for background processing functions provided by the Action Scheduler job queue for WordPress.
---
# API Reference
Action Scheduler provides a range of functions for scheduling hooks to run at some time in the future on one or more occassions.
To understand the scheduling functoins, it can help to think of them as extensions to WordPress' `do_action()` function that add the ability to delay and repeat when the hook will be triggered.
## WP-Cron APIs vs. Action Scheduler APIs
The Action Scheduler API functions are designed to mirror the WordPress [WP-Cron API functions](http://codex.wordpress.org/Category:WP-Cron_Functions).
Functions return similar values and accept similar arguments to their WP-Cron counterparts. The notable differences are:
* `as_schedule_single_action()` & `as_schedule_recurring_action()` will return the post ID of the scheduled action rather than boolean indicating whether the event was scheduled
* `as_schedule_recurring_action()` takes an interval in seconds as the recurring interval rather than an arbitrary string
* `as_schedule_single_action()` & `as_schedule_recurring_action()` can accept a `$group` parameter to group different actions for the one plugin together.
* the `wp_` prefix is substituted with `as_` and the term `event` is replaced with `action`
## API Function Availability
As mentioned in the [Usage - Load Order](/usage/#load-order) section, Action Scheduler will initialize itself on the `'init'` hook with priority `1`. While API functions are loaded prior to this and call be called, they should not be called until after `'init'` with priority `1`, because each component, like the data store, has not yet been initialized.
Do not use Action Scheduler API functions prior to `'init'` hook with priority `1`. Doing so could lead to unexpected results, like data being stored in the incorrect location.
## Function Reference / `as_schedule_single_action()`
### Description
Schedule an action to run one time.
### Usage
```php
as_schedule_single_action( $timestamp, $hook, $args, $group )
````
### Parameters
- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_.
- **$hook** (string)(required) Name of the action hook. Default: _none_.
- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_.
- **$group** (array) The group to assign this job to. Default: _''_.
### Return value
(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table.
## Function Reference / `as_schedule_recurring_action()`
### Description
Schedule an action to run repeatedly with a specified interval in seconds.
### Usage
```php
as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group )
````
### Parameters
- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_.
- **$interval_in_seconds** (integer)(required) How long to wait between runs. Default: _none_.
- **$hook** (string)(required) Name of the action hook. Default: _none_.
- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_.
- **$group** (array) The group to assign this job to. Default: _''_.
### Return value
(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table.
## Function Reference / `as_schedule_cron_action()`
### Description
Schedule an action that recurs on a cron-like schedule.
### Usage
```php
as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group )
````
### Parameters
- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_.
- **$schedule** (string)(required) $schedule A cron-link schedule string, see http://en.wikipedia.org/wiki/Cron. Default: _none_.
- **$hook** (string)(required) Name of the action hook. Default: _none_.
- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_.
- **$group** (array) The group to assign this job to. Default: _''_.
### Return value
(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table.
## Function Reference / `as_unschedule_action()`
### Description
Cancel the next occurrence of a job.
### Usage
```php
as_unschedule_action( $hook, $args, $group )
````
### Parameters
- **$hook** (string)(required) Name of the action hook. Default: _none_.
- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_.
- **$group** (array) The group to assign this job to. Default: _''_.
### Return value
(null)
## Function Reference / `as_next_scheduled_action()`
### Description
Returns the next timestamp for a scheduled action.
### Usage
```php
as_next_scheduled_action( $hook, $args, $group )
````
### Parameters
- **$hook** (string)(required) Name of the action hook. Default: _none_.
- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_.
- **$group** (array) The group to assign this job to. Default: _''_.
### Return value
(integer|boolean) The timestamp for the next occurrence, or false if nothing was found.
## Function Reference / `as_get_scheduled_actions()`
### Description
Find scheduled actions.
### Usage
```php
as_get_scheduled_actions( $args, $return_format )
````
### Parameters
- **$args** (array) Arguments to search and filter results by. Possible arguments, with their default values:
* `'hook' => ''` - the name of the action that will be triggered
* `'args' => NULL` - the args array that will be passed with the action
* `'date' => NULL` - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime().
* `'date_compare' => '<=`' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '='
* `'modified' => NULL` - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime().
* `'modified_compare' => '<='` - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '='
* `'group' => ''` - the group the action belongs to
* `'status' => ''` - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING
* `'claimed' => NULL` - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID
* `'per_page' => 5` - Number of results to return
* `'offset' => 0`
* `'orderby' => 'date'` - accepted values are 'hook', 'group', 'modified', or 'date'
* `'order' => 'ASC'`
- **$return_format** (string) The format in which to return the scheduled actions: 'OBJECT', 'ARRAY_A', or 'ids'. Default: _'OBJECT'_.
### Return value
(array) Array of the actions matching the criteria specified with `$args`.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -1,32 +0,0 @@
---
---
@import "{{ site.theme }}";
a {
text-shadow: none;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
header h1 a {
color: #b5e853;
}
.container {
max-width: 700px;
}
footer {
margin-top: 6em;
padding: 1.6em 0;
border-top: 1px dashed #b5e853;
}
.footer-image {
text-align: center;
padding-top: 1em;
}

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#151515</TileColor>
</tile>
</msapplication>
</browserconfig>

View File

@@ -1,101 +0,0 @@
## FAQ
### Is it safe to release Action Scheduler in my plugin? Won't its functions conflict with another copy of the library?
Action Scheduler is designed to be used and released in plugins. It avoids redeclaring public API functions when more than one copy of the library is being loaded by different plugins. It will also load only the most recent version of itself (by checking registered versions after all plugins are loaded on the `'plugins_loaded'` hook).
To use it in your plugin, simply require the `action-scheduler/action-scheduler.php` file. Action Scheduler will take care of the rest.
### I don't want to use WP-Cron. Does Action Scheduler depend on WP-Cron?
By default, Action Scheduler is initiated by WP-Cron. However, it has no dependency on the WP-Cron system. You can initiate the Action Scheduler queue in other ways with just one or two lines of code.
For example, you can start a queue directly by calling:
```php
ActionScheduler::runner()->run();
```
Or trigger the `'action_scheduler_run_queue'` hook and let Action Scheduler do it for you:
```php
do_action( 'action_scheduler_run_queue' );
```
Further customization can be done by extending the `ActionScheduler_Abstract_QueueRunner` class to create a custom Queue Runner. For an example of a customized queue runner, see the [`ActionScheduler_WPCLI_QueueRunner`](https://github.com/Prospress/action-scheduler/blob/master/classes/ActionScheduler_WPCLI_QueueRunner.php), which is used when running WP CLI.
Want to create some other method for initiating Action Scheduler? [Open a new issue](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it.
### I don't want to use WP-Cron, ever. Does Action Scheduler replace WP-Cron?
By default, Action Scheduler is designed to work alongside WP-Cron and not change any of its behaviour. This helps avoid unexpectedly overriding WP-Cron on sites installing your plugin, which may have nothing to do with WP-Cron.
However, we can understand why you might want to replace WP-Cron completely in environments within you control, especially as it gets you the advantages of Action Scheduler. This should be possible without too much code.
You could use the `'schedule_event'` hook in WordPress to use Action Scheduler for only newly scheduled WP-Cron jobs and map the `$event` param to Action Scheduler API functions.
Alternatively, you can use a combination of the `'pre_update_option_cron'` and `'pre_option_cron'` hooks to override all new and previously scheduled WP-Cron jobs (similar to the way [Cavalcade](https://github.com/humanmade/Cavalcade) does it).
If you'd like to create a plugin to do this automatically and want to share your work with others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it.
### Eww gross, Custom Post Types! That's _so_ 2010. Can I use a different storage scheme?
Of course! Action Scheduler data storage is completely swappable, and always has been.
You can store scheduled actions in custom tables in the WordPress site's database. Some sites using it already are. You can actually store them anywhere for that matter, like in a remote storage service from Amazon Web Services.
To implement a custom store:
1. extend the abstract `ActionScheduler_Store` class, being careful to implement each of its methods
2. attach a callback to `'action_scheduler_store_class'` to tell Action Scheduler your class is the one which should be used to manage storage, e.g.
```
function eg_define_custom_store( $existing_storage_class ) {
return 'My_Radical_Action_Scheduler_Store';
}
add_filter( 'action_scheduler_store_class', 'eg_define_custom_store', 10, 1 );
```
Take a look at the `ActionScheduler_wpPostStore` class for an example implementation of `ActionScheduler_Store`.
If you'd like to create a plugin to do this automatically and release it publicly to help others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it.
> Note: we're also moving Action Scheduler itself to use [custom tables for better scalability](https://github.com/Prospress/action-scheduler/issues/77).
### Can I use a different storage scheme just for logging?
Of course! Action Scheduler's logger is completely swappable, and always has been. You can also customise where logs are stored, and the storage mechanism.
To implement a custom logger:
1. extend the abstract `ActionScheduler_Logger` class, being careful to implement each of its methods
2. attach a callback to `'action_scheduler_logger_class'` to tell Action Scheduler your class is the one which should be used to manage logging, e.g.
```
function eg_define_custom_logger( $existing_storage_class ) {
return 'My_Radical_Action_Scheduler_Logger';
}
add_filter( 'action_scheduler_logger_class', 'eg_define_custom_logger', 10, 1 );
```
Take a look at the `ActionScheduler_wpCommentLogger` class for an example implementation of `ActionScheduler_Logger`.
### I want to run Action Scheduler only on a dedicated application server in my cluster. Can I do that?
Wow, now you're really asking the tough questions. In theory, yes, this is possible. The `ActionScheduler_QueueRunner` class, which is responsible for running queues, is swappable via the `'action_scheduler_queue_runner_class'` filter.
Because of this, you can effectively customise queue running however you need. Whether that means tweaking minor things, like not using WP-Cron at all to initiate queues by overriding `ActionScheduler_QueueRunner::init()`, or completely changing how and where queues are run, by overriding `ActionScheduler_QueueRunner::run()`.
### Is Action Scheduler safe to use on my production site?
Yes, absolutely! Action Scheduler is actively used on tens of thousands of production sites already. Right now it's responsible for scheduling everything from emails to payments.
In fact, every month, Action Scheduler processes millions of payments as part of the [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/) extension.
It requires no setup, and won't override any WordPress APIs (unless you want it to).
### How does Action Scheduler work on WordPress Multisite?
Action Scheduler is designed to manage the scheduled actions on a single site. It has no special handling for running queues across multiple sites in a multisite network. That said, because it's storage and Queue Runner are completely swappable, it would be possible to write multisite handling classes to use with it.
If you'd like to create a multisite plugin to do this and release it publicly to help others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1 +0,0 @@
google-site-verification: google14ef723abb376cd3.html

View File

@@ -1,68 +0,0 @@
---
title: Action Scheduler - Background Processing Job Queue for WordPress
---
## WordPress Job Queue with Background Processing
Action Scheduler is a library for triggering a WordPress hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occassions.
Think of it like an extension to `do_action()` which adds the ability to delay and repeat a hook.
It just so happens, this functionality also creates a robust job queue for background processing large queues of tasks in WordPress. With the additional of logging and an [administration interface](/admin/), that also provide tracability on your tasks processed in the background.
### Battle-Tested Background Processing
Every month, Action Scheduler processes millions of payments for [Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/), webhooks for [WooCommerce](https://wordpress.org/plugins/woocommerce/), as well as emails and other events for a range of other plugins.
It's been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, in 10 concurrent queues at a rate of over 10,000 actions / hour without negatively impacting normal site operations.
This is all possible on infrastructure and WordPress sites outside the control of the plugin author.
Action Scheduler is specifically designed for distribution in WordPress plugins (and themes) - no server access required. If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help.
### How it Works
Action Scheduler uses a WordPress [custom post type](http://codex.wordpress.org/Post_Types), creatively named `scheduled-action`, to store the hook name, arguments and scheduled date for an action that should be triggered at some time in the future.
The scheduler will attempt to run every minute by attaching itself as a callback to the `'action_scheduler_run_schedule'` hook, which is scheduled using WordPress's built-in [WP-Cron](http://codex.wordpress.org/Function_Reference/wp_cron) system.
When triggered, Action Scheduler will check for posts of the `scheduled-action` type that have a `post_date` at or before this point in time i.e. actions scheduled to run now or at sometime in the past.
### Batch Processing Background Jobs
If there are actions to be processed, Action Scheduler will stake a unique claim for a batch of 20 actions and begin processing that batch. The PHP process spawned to run the batch will then continue processing batches of 20 actions until it times out or exhausts available memory.
If your site has a large number of actions scheduled to run at the same time, Action Scheduler will process more than one batch at a time. Specifically, when the `'action_scheduler_run_schedule'` hook is triggered approximately one minute after the first batch began processing, a new PHP process will stake a new claim to a batch of actions which were not claimed by the previous process. It will then begin to process that batch.
This will continue until all actions are processed using a maximum of 5 concurrent queues.
### Housekeeping
Before processing a batch, the scheduler will remove any existing claims on actions which have been sitting in a queue for more than five minutes.
Action Scheduler will also trash any actions which were completed more than a month ago.
If an action runs for more than 5 minutes, Action Scheduler will assume the action has timed out and will mark it as failed. However, if all callbacks attached to the action were to successfully complete sometime after that 5 minute timeout, its status would later be updated to completed.
### Traceable Background Processing
Did your background job run?
Never be left wondering with Action Scheduler's built-in record keeping.
All events for each action are logged in the [comments table](http://codex.wordpress.org/Database_Description#Table_Overview) and displayed in the [administration interface](/admin/).
The events logged by default include when an action:
* is created
* starts
* completes
* fails
If it fails with an error that can be recorded, that error will be recorded in the log and visible in administration interface, making it possible to trace what went wrong at some point in the past on a site you didn't have access to in the past.
Actions can also be grouped together using a custom taxonomy named `action-group`.
## Credits
Developed and maintained by [Prospress](http://prospress.com/) in collaboration with [Flightless](https://flightless.us/).
Collaboration is cool. We'd love to work with you to improve Action Scheduler. [Pull Requests](https://github.com/prospress/action-scheduler/pulls) welcome.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -1,127 +0,0 @@
---
title: WordPress Background Processing at Scale - Action Scheduler Job Queue
description: Learn how to do WordPress background processing at scale by tuning the Action Scheduler job queue's default WP Cron runner.
---
# Background Processing at Scale
Action Scheduler's default processing is designed to work reliably across all different hosting environments. In order to achieve that, the default processing thresholds are very conservative.
Specifically, Action Scheduler will only process actions until:
* 90% of available memory is used
* processing another 3 actions would exceed 30 seconds of total request time, based on the average processing time for the current batch
On sites with large queues, this can result in very slow processing time.
While using [WP CLI to process queues](/wp-cli/) is the best approach to increasing processing speed, on occasion, that is not a viable option. In these cases, it's also possible to increase the processing thresholds in Action Scheduler to increase the rate at which actions are processed by the default WP Cron queue runner.
## Increasing Time Limit
By default, Action Scheduler will only process actions for a maximum of 30 seconds. This time limit minimises the risk of a script timeout on unknown hosting environments, some of which enforce 30 second timeouts.
If you know your host supports longer than this time limit for web requests, you can increase this time limit. This allows more actions to be processed in each request and reduces the lag between processing each queue, greating speeding up the processing rate of scheduled actions.
For example, the following snippet will increase the timelimit to 2 minutes (120 seconds):
```php
function eg_increase_time_limit( $time_limit ) {
return 120;
}
add_filter( 'action_scheduler_queue_runner_time_limit', 'eg_increase_time_limit' );
```
Some of the known host time limits are:
* 60 second on WP Engine
* 120 seconds on Pantheon
* 120 seconds on SiteGround
## Increasing Batch Size
By default, Action Scheduler will claim a batch of 25 actions. This small batch size is because the default time limit is only 30 seconds; however, if you know your actions are processing very quickly, e.g. taking microseconds not seconds, or that you have more than 30 second available to process each batch, increasing the batch size can improve performance.
This is because claiming a batch has some overhead, so the less often a batch needs to be claimed, the faster actions can be processed.
For example, to increase the batch size to 100, we can use the following function:
```php
function eg_increase_action_scheduler_batch_size( $batch_size ) {
return 100;
}
add_filter( 'action_scheduler_queue_runner_batch_size', 'eg_increase_action_scheduler_batch_size' );
```
## Increasing Concurrent Batches
By default, Action Scheduler will run up to 5 concurrent batches of actions. This is to prevent consuming all the available connections or processes on your webserver.
However, your server may allow a large number of connection, for example, because it has a high value for Apache's `MaxClients` setting or PHP-FPM's `pm.max_children` setting.
If this is the case, you can use the `'action_scheduler_queue_runner_concurrent_batches'` filter to increase the number of conncurrent batches allowed, and therefore speed up processing large numbers of actions scheduled to be processed simultaneously.
For example, to increase the allowed number of concurrent queues to 10, we can use the following code:
```php
function eg_increase_action_scheduler_concurrent_batches( $concurrent_batches ) {
return 10;
}
add_filter( 'action_scheduler_queue_runner_concurrent_batches', 'eg_increase_action_scheduler_concurrent_batches' );
```
## Increasing Initialisation Rate of Runners
By default, Action scheduler initiates at most, one queue runner every time the `'action_scheduler_run_queue'` action is triggered by WP Cron.
Because this action is only triggered at most once every minute, if a queue is only allowed to process for one minute, then there will never be more than one queue processing actions, greatly reducing the processing rate.
To handle larger queues on more powerful servers, it's a good idea to initiate additional queue runners whenever the `'action_scheduler_run_queue'` action is run.
That can be done by initiated additional secure requests to our server via loopback requests.
The code below demonstrates how to create 5 loopback requests each time a queue begins
```php
/**
* Trigger 5 additional loopback requests with unique URL params.
*/
function eg_request_additional_runners() {
// allow self-signed SSL certificates
add_filter( 'https_local_ssl_verify', '__return_false', 100 );
for ( $i = 0; $i < 5; $i++ ) {
$response = wp_remote_post( admin_url( 'admin-ajax.php' ), array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => false,
'headers' => array(),
'body' => array(
'action' => 'eg_create_additional_runners',
'instance' => $i,
'eg_nonce' => wp_create_nonce( 'eg_additional_runner_' . $i ),
),
'cookies' => array(),
) );
}
}
add_action( 'action_scheduler_run_queue', 'eg_request_additional_runners', 0 );
/**
* Handle requests initiated by eg_request_additional_runners() and start a queue runner if the request is valid.
*/
function eg_create_additional_runners() {
if ( isset( $_POST['eg_nonce'] ) && isset( $_POST['instance'] ) && wp_verify_nonce( $_POST['eg_nonce'], 'eg_additional_runner_' . $_POST['instance'] ) ) {
ActionScheduler_QueueRunner::instance()->run();
}
wp_die();
}
add_action( 'wp_ajax_nopriv_eg_create_additional_runners', 'eg_create_additional_runners', 0 );
```
## High Volume Plugin
It's not necessary to add all of this code yourself, the folks at [Prospress](https://prospress.com) have created a handy plugin to get access to each of these increases - the [Action Scheduler - High Volume](https://github.com/prospress/action-scheduler-high-volume) plugin.

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="312.000000pt" height="312.000000pt" viewBox="0 0 312.000000 312.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.11, written by Peter Selinger 2001-2013
</metadata>
<g transform="translate(0.000000,312.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M1837 2924 c-1 -1 -54 -5 -117 -8 -63 -4 -128 -9 -145 -11 -16 -2
-46 -6 -65 -9 -19 -3 -57 -8 -85 -11 -27 -3 -70 -10 -95 -16 -25 -5 -58 -11
-75 -13 -98 -13 -360 -73 -565 -130 -236 -65 -584 -172 -609 -187 -105 -67 24
-294 221 -387 77 -37 152 -61 206 -65 16 -1 22 -8 22 -23 0 -34 35 -107 70
-147 62 -71 161 -119 265 -130 34 -4 40 -8 46 -33 25 -122 151 -205 301 -198
122 5 254 44 270 80 6 13 8 27 5 30 -3 4 -41 1 -84 -5 -119 -18 -155 -19 -217
-9 -74 11 -123 47 -132 94 -7 40 -4 46 28 49 94 12 238 52 260 72 35 32 23 46
-34 38 -29 -4 -62 -9 -73 -11 -45 -10 -255 -11 -320 -2 -81 11 -154 40 -185
73 -24 26 -52 97 -42 106 4 4 45 9 92 12 93 7 90 6 269 43 69 14 134 30 145
36 29 15 56 39 56 50 0 10 -74 3 -144 -12 -22 -5 -144 -8 -270 -6 -251 3 -327
15 -443 71 -47 23 -133 97 -133 115 0 6 150 49 225 64 11 3 83 20 160 39 77
19 154 38 170 41 17 4 39 8 50 10 11 3 56 12 100 21 98 21 104 22 146 29 19 3
43 7 54 10 28 5 94 16 130 20 17 3 44 7 60 10 17 2 50 7 75 11 41 5 87 11 150
20 111 16 452 23 509 11 14 -3 47 -8 75 -11 28 -3 78 -13 111 -21 365 -92 513
-289 509 -679 -1 -102 -35 -265 -56 -265 -5 0 -7 -4 -4 -9 3 -4 -12 -41 -33
-81 -144 -277 -468 -551 -794 -671 -107 -39 -317 -88 -317 -73 0 2 50 118 111
257 61 138 131 299 156 357 25 58 49 114 54 125 5 11 52 119 104 240 90 208
94 221 84 255 -19 58 -67 147 -99 183 -33 38 -86 65 -99 51 -5 -5 -23 -43 -41
-84 -50 -116 -179 -408 -211 -478 -16 -35 -29 -65 -29 -67 0 -2 -18 -43 -40
-90 -22 -47 -40 -88 -40 -90 0 -4 -92 -211 -156 -353 -13 -29 -24 -55 -24 -57
0 -2 -15 -37 -34 -77 -18 -40 -46 -102 -61 -138 -16 -36 -45 -102 -67 -148
-21 -46 -38 -85 -38 -87 0 -2 -34 -81 -76 -175 -55 -124 -74 -178 -70 -196 16
-62 116 -134 207 -148 36 -5 37 -5 63 53 14 32 51 112 82 177 31 66 74 160 96
209 22 50 43 93 47 98 7 7 19 10 82 21 19 3 44 8 55 10 12 2 38 7 57 10 480
76 883 299 1117 618 100 135 202 363 224 498 1 8 5 35 9 60 16 95 13 216 -7
340 -10 59 -60 190 -97 252 -45 76 -151 190 -219 235 -127 85 -324 159 -475
179 -27 3 -53 8 -56 9 -12 8 -344 25 -352 19z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,19 +0,0 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@@ -1,123 +0,0 @@
---
description: Learn how to use the Action Scheduler background processing job queue for WordPress in your WordPress plugin.
---
# Usage
Using Action Scheduler requires:
1. installing the library
1. scheduling and action
1. attaching a callback to that action
## Scheduling an Action
To schedule an action, call the [API function](/api/) for the desired schedule type passing in the required parameters.
The example code below shows everything needed to schedule a function to run at midnight, if it's not already scheduled:
```php
require_once( plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php' );
/**
* Schedule an action with the hook 'eg_midnight_log' to run at midnight each day
* so that our callback is run then.
*/
function eg_log_action_data() {
if ( false === as_next_scheduled_action( 'eg_midnight_log' ) ) {
as_schedule_recurring_action( strtotime( 'midnight tonight' ), DAY_IN_SECONDS, 'eg_midnight_log' );
}
}
add_action( 'init', 'eg_log_action_data' );
/**
* A callback to run when the 'eg_midnight_log' scheduled action is run.
*/
function eg_log_action_data() {
error_log( 'It is just after midnight on ' . date( 'Y-m-d' ) );
}
add_action( 'eg_midnight_log', 'eg_log_action_data' );
```
For more details on all available API functions, and the data they accept, refer to the [API Reference](/api/).
## Installation
There are two ways to install Action Scheduler:
1. regular WordPress plugin; or
1. a library within your plugin's codebase.
### Usage as a Plugin
Action Scheduler includes the necessary file headers to be used as a standard WordPress plugin.
To install it as a plugin:
1. Download the .zip archive of the latest [stable release](https://github.com/Prospress/action-scheduler/releases)
1. Go to the **Plugins > Add New > Upload** administration screen on your WordPress site
1. Select the archive file you just downloaded
1. Click **Install Now**
1. Click **Activate**
Or clone the Git repository into your site's `wp-content/plugins` folder.
Using Action Scheduler as a plugin can be handy for developing against newer versions, rather than having to update the subtree in your codebase. **When installed as a plugin, Action Scheduler does not provide any user interfaces for scheduling actions**. The only way to interact with Action Scheduler is via code.
### Usage as a Library
To use Action Scheduler as a library:
1. include the Action Scheduler codebase
1. load the library by including the `action-scheduler.php` file
Using a [subtree in your plugin, theme or site's Git repository](https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree) to include Action Scheduler is the recommended method. Composer can also be used.
To include Action Scheduler as a git subtree:
#### Step 1. Add the Repository as a Remote
```
git remote add -f subtree-action-scheduler https://github.com/Prospress/action-scheduler.git
```
Adding the subtree as a remote allows us to refer to it in short from via the name `subtree-action-scheduler`, instead of the full GitHub URL.
#### Step 2. Add the Repo as a Subtree
```
git subtree add --prefix libraries/action-scheduler subtree-action-scheduler master --squash
```
This will add the `master` branch of Action Scheduler to your repository in the folder `libraries/action-scheduler`.
You can change the `--prefix` to change where the code is included. Or change the `master` branch to a tag, like `2.1.0` to include only a stable version.
#### Step 3. Update the Subtree
To update Action Scheduler to a new version, use the commands:
```
git fetch subtree-action-scheduler master
git subtree pull --prefix libraries/action-scheduler subtree-action-scheduler master --squash
```
### Loading Action Scheduler
Regardless of how it is installed, to load Action Scheduler, you only need to include the `action-scheduler.php` file, e.g.
```php
<?php
require_once( plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php' );
```
There is no need to call any functions or do else to initialize Action Scheduler.
When the `action-scheduler.php` file is included, Action Scheduler will register the version in that file and then load the most recent version of itself on the site. It will also load the most recent version of [all API functions](https://github.com/prospress/action-scheduler#api-functions).
### Load Order
Action Scheduler will register its version on `'plugins_loaded'` with priority `0` - after all other plugin codebases has been loaded. Therefore **the `action-scheduler.php` file must be included before `'plugins_loaded'` priority `0`**.
It is recommended to load it _when the file including it is included_. However, if you need to load it on a hook, then the hook must occur before `'plugins_loaded'`, or you can use `'plugins_loaded'` with negative priority, like `-10`.
Action Scheduler will later initialize itself on `'init'` with priority `1`. Action Scheduler APIs should not be used until after `'init'` with priority `1`.

View File

@@ -1,73 +0,0 @@
---
description: Learn how to do WordPress background processing at scale with WP CLI and the Action Scheduler job queue.
---
# WP CLI
Action Scheduler has custom [WP CLI](http://wp-cli.org) commands available for processing actions.
For large sites, WP CLI is a much better choice for running queues of actions than the default WP Cron runner. These are some common cases where WP CLI is a better option:
* long-running tasks - Tasks that take a significant amount of time to run
* large queues - A large number of tasks will naturally take a longer time
* other plugins with extensive WP Cron usage - WP Cron's limited resources are spread across more tasks
With a regular web request, you may have to deal with script timeouts enforced by hosts, or other restraints that make it more challenging to run Action Scheduler tasks. Utilizing WP CLI to run commands directly on the server give you more freedom. This means that you typically don't have the same constraints of a normal web request.
If you choose to utilize WP CLI exclusively, you can disable the normal WP CLI queue runner by installing the [Action Scheduler - Disable Default Queue Runner](https://github.com/Prospress/action-scheduler-disable-default-runner) plugin. Note that if you do this, you **must** run Action Scheduler via WP CLI or another method, otherwise no scheduled actions will be processed.
## Commands
These are the commands available to use with Action Scheduler:
* `action-scheduler run`
Options:
* `--batch-size` - This is the number of actions to run in a single batch. The default is `100`.
* `--batches` - This is the number of batches to run. Using 0 means that batches will continue running until there are no more actions to run.
* `--hooks` - Process only actions with specific hook or hooks, like `'woocommerce_scheduled_subscription_payment'`. By default, actions with any hook will be processed. Define multiple hooks as a comma separated string (without spaces), e.g. `--hooks=woocommerce_scheduled_subscription_trial_end,woocommerce_scheduled_subscription_payment,woocommerce_scheduled_subscription_expiration`
* `--group` - Process only actions in a specific group, like `'woocommerce-memberships'`. By default, actions in any group (or no group) will be processed.
* `--force` - By default, Action Scheduler limits the number of concurrent batches that can be run at once to ensure the server does not get overwhelmed. Using the `--force` flag overrides this behavior to force the WP CLI queue to run.
The best way to get a full list of commands and their available options is to use WP CLI itself. This can be done by running `wp action-scheduler` to list all Action Scheduler commands, or by including the `--help` flag with any of the individual commands. This will provide all relevant parameters and flags for the command.
## Cautionary Note on Action Dependencies when using `--group` or `--hooks` Options
The `--group` and `--hooks` options should be used with caution if you have an implicit dependency between scheduled actions based on their schedule.
For example, consider two scheduled actions for the same subscription:
* `scheduled_payment` scheduled for `2015-11-13 00:00:00` and
* `scheduled_expiration` scheduled for `2015-11-13 00:01:00`.
Under normal conditions, Action Scheduler will ensure the `scheduled_payment` action is run before the `scheduled_expiration` action. Becuase that's how they are scheduled.
However, when using the `--hooks` option, the `scheduled_payment` and `scheduled_expiration` actions will be processed in separate queues. As a result, this dependency is not guaranteed.
For example, consider a site with both:
* 100,000 `scheduled_payment` actions, scheduled for `2015-11-13 00:00:00`
* 100 `scheduled_expiration` actions, scheduled for `2015-11-13 00:01:00`
If two queue runners are running alongside each other with each runner dedicated to just one of these hooks, the queue runner handling expiration hooks will complete the processing of the expiration hooks more quickly than the queue runner handling all the payment actions.
**Because of this, the `--group` and `--hooks` options should be used with caution to avoid processing actions with an implicit dependency based on their schedule in separate queues.**
## Improving Performance with `--group` or `--hooks`
Being able to run queues for specific hooks or groups of actions is valuable at scale. Why? Because it means you can restrict the concurrency for similar actions.
For example, let's say you have 300,000 actions queued up comprised of:
* 100,000 renewals payments
* 100,000 email notifications
* 100,000 membership status updates
Action Scheduler's default WP Cron queue runner will process them all together. e.g. when it claims a batch of actions, some may be emails, some membership updates and some renewals.
When you add concurrency to that, you can end up with issues. For example, if you have 3 queues running, they may all be attempting to process similar actions at the same time, which can lead to querying the same database tables with similar queries. Depending on the code/queries running, this can lead to database locks or other issues.
If you can batch based on each action's group, then you can improve performance by processing like actions consecutively, but still processing the full set of actions concurrently.
For example, if one queue is created to process emails, another to process membership updates, and another to process renewal payments, then the same queries won't be run at the same time, and 3 separate queues will be able to run more efficiently.
The WP CLI runner can achieve this using the `--group` option.

View File

@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -63,8 +63,13 @@ function wcs_help_tip( $tip, $allow_html = false ) {
* @return mixed
*/
function wcs_get_objects_property( $object, $property, $single = 'single', $default = null ) {
$prefixed_key = wcs_maybe_prefix_key( $property );
$value = ! is_null( $default ) ? $default : ( ( 'single' === $single ) ? null : array() );
if ( ! is_object( $object ) ) {
return $value;
}
$prefixed_key = wcs_maybe_prefix_key( $property );
$property_function_map = array(
'order_version' => 'version',
'order_currency' => 'currency',

View File

@@ -2,10 +2,10 @@
# This file is distributed under the same license as the WooCommerce Subscriptions package.
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Subscriptions 2.5.3\n"
"Project-Id-Version: WooCommerce Subscriptions 2.5.6\n"
"Report-Msgid-Bugs-To: "
"https://github.com/Prospress/woocommerce-subscriptions/issues\n"
"POT-Creation-Date: 2019-03-20 06:30:32+00:00\n"
"POT-Creation-Date: 2019-05-30 20:02:46+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -223,8 +223,8 @@ msgstr ""
#: includes/admin/class-wcs-admin-reports.php:46
#: includes/admin/class-wcs-admin-system-status.php:56
#: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:688
#: includes/class-wcs-query.php:115 includes/class-wcs-query.php:142
#: includes/class-wcs-query.php:296
#: includes/class-wcs-query.php:116 includes/class-wcs-query.php:143
#: includes/class-wcs-query.php:297
#: includes/privacy/class-wcs-privacy-exporters.php:51
#: woocommerce-subscriptions.php:254 woocommerce-subscriptions.php:267
msgid "Subscriptions"
@@ -253,7 +253,7 @@ msgstr ""
#: includes/class-wc-product-subscription.php:72
#: includes/class-wc-product-variable-subscription.php:73
#: includes/class-wc-subscriptions-product.php:99
#: woocommerce-subscriptions.php:578
#: woocommerce-subscriptions.php:580
msgid "Sign Up Now"
msgstr ""
@@ -406,7 +406,7 @@ msgstr ""
#: includes/admin/class-wc-subscriptions-admin.php:1321
#: includes/upgrades/templates/wcs-about-2-0.php:35
#: includes/upgrades/templates/wcs-about.php:34
#: woocommerce-subscriptions.php:1110
#: woocommerce-subscriptions.php:1112
msgid "Settings"
msgstr ""
@@ -502,38 +502,38 @@ msgstr ""
msgid "Note that purchasing a subscription still requires an account."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:63
#: includes/admin/class-wcs-admin-meta-boxes.php:67
#: includes/admin/class-wcs-admin-meta-boxes.php:65
#: includes/admin/class-wcs-admin-meta-boxes.php:69
#: templates/myaccount/related-orders.php:15
msgid "Related Orders"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:107
#: includes/admin/class-wcs-admin-meta-boxes.php:109
msgid "Please enter a start date in the past."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:108
#: includes/admin/class-wcs-admin-meta-boxes.php:110
msgid "Please enter a date at least one hour into the future."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:109
#: includes/admin/class-wcs-admin-meta-boxes.php:111
msgid "Please enter a date after the trial end."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:110
#: includes/admin/class-wcs-admin-meta-boxes.php:111
#: includes/admin/class-wcs-admin-meta-boxes.php:112
#: includes/admin/class-wcs-admin-meta-boxes.php:113
msgid "Please enter a date after the start date."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:112
#: includes/admin/class-wcs-admin-meta-boxes.php:114
msgid "Please enter a date before the next payment."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:113
#: includes/admin/class-wcs-admin-meta-boxes.php:115
msgid "Please enter a date after the next payment."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:114
#: includes/admin/class-wcs-admin-meta-boxes.php:116
msgid ""
"Are you sure you want to process a renewal?\n"
"\n"
@@ -541,7 +541,7 @@ msgid ""
"are enabled)."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:124
#: includes/admin/class-wcs-admin-meta-boxes.php:126
msgid ""
"Are you sure you want to retry payment for this renewal order?\n"
"\n"
@@ -549,31 +549,31 @@ msgid ""
"emails are enabled)."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:153
#: includes/admin/class-wcs-admin-meta-boxes.php:159
msgid "Process renewal"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:157
#: includes/admin/class-wcs-admin-meta-boxes.php:163
msgid "Create pending renewal order"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:159
#: includes/admin/class-wcs-admin-meta-boxes.php:165
msgid "Create pending parent order"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:162
#: includes/admin/class-wcs-admin-meta-boxes.php:169
msgid "Retry Renewal Payment"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:176
#: includes/admin/class-wcs-admin-meta-boxes.php:183
msgid "Process renewal order action requested by admin."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:200
#: includes/admin/class-wcs-admin-meta-boxes.php:207
msgid "Create pending renewal order requested by admin action."
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:229
#: includes/admin/class-wcs-admin-meta-boxes.php:236
msgid "Create pending parent order requested by admin action."
msgstr ""
@@ -1062,7 +1062,7 @@ msgstr[1] ""
#: includes/admin/reports/class-wcs-report-dashboard.php:212
#. translators: 1$: count, 2$ and 3$ are opening and closing strong tags,
#. respectively.
msgid "%2$s%$1s signup%3$s subscription signups this month"
msgid "%2$s%1$s signup%3$s subscription signups this month"
msgid_plural "%2$s%1$s signups%3$s subscription signups this month"
msgstr[0] ""
msgstr[1] ""
@@ -1858,7 +1858,7 @@ msgid "That doesn't appear to be one of your subscriptions."
msgstr ""
#: includes/class-wc-subscriptions-change-payment-gateway.php:254
#: includes/class-wcs-query.php:252
#: includes/class-wcs-query.php:253
msgid "The payment method can not be changed for that subscription."
msgstr ""
@@ -1911,118 +1911,118 @@ msgstr ""
msgid "Error %d: Unable to create order. Please try again."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:151
#: includes/class-wc-subscriptions-coupon.php:163
msgid "Sign Up Fee Discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:152
#: includes/class-wc-subscriptions-coupon.php:164
msgid "Sign Up Fee % Discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:153
#: includes/class-wc-subscriptions-coupon.php:165
msgid "Recurring Product Discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:154
#: includes/class-wc-subscriptions-coupon.php:166
msgid "Recurring Product % Discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:444
#: includes/class-wc-subscriptions-coupon.php:456
msgid ""
"Sorry, this coupon is only valid for an initial payment and the cart does "
"not require an initial payment."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:450
#: includes/class-wc-subscriptions-coupon.php:462
msgid "Sorry, this coupon is only valid for new subscriptions."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:455
#: includes/class-wc-subscriptions-coupon.php:467
msgid "Sorry, this coupon is only valid for subscription products."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:461
#: includes/class-wc-subscriptions-coupon.php:473
#. translators: 1$: coupon code that is being removed
msgid "Sorry, the \"%1$s\" coupon is only valid for renewals."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:466
#: includes/class-wc-subscriptions-coupon.php:478
msgid ""
"Sorry, this coupon is only valid for subscription products with a sign-up "
"fee."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:492
#: includes/class-wc-subscriptions-coupon.php:504
msgid ""
"Sorry, recurring coupons can only be applied to subscriptions or "
"subscription orders."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:496
#: includes/class-wc-subscriptions-coupon.php:508
#. translators: placeholder is coupon code
msgid ""
"Sorry, \"%s\" can only be applied to subscription parent orders which "
"contain a product with signup fees."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:499
#: includes/class-wc-subscriptions-coupon.php:511
msgid "Sorry, only recurring coupons can be applied to subscriptions."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:681
#: includes/class-wc-subscriptions-coupon.php:693
msgid "Renewal % discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:682
#: includes/class-wc-subscriptions-coupon.php:694
msgid "Renewal product discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:683
#: includes/class-wc-subscriptions-coupon.php:695
msgid "Renewal cart discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:684
#: includes/class-wc-subscriptions-coupon.php:696
msgid "Initial payment discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:701
#: includes/class-wc-subscriptions-coupon.php:713
msgid "Renewal Discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:704
#: includes/class-wc-subscriptions-coupon.php:716
msgid "Discount"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:920
#: includes/class-wc-subscriptions-coupon.php:932
msgid ""
"Sorry, it seems there are no available payment methods which support the "
"recurring coupon you are using. Please contact us if you require assistance "
"or wish to make alternate arrangements."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:935
#: includes/class-wc-subscriptions-coupon.php:947
msgid "Active for x payments"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:936
#: includes/class-wc-subscriptions-coupon.php:948
msgid "Unlimited payments"
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:937
#: includes/class-wc-subscriptions-coupon.php:949
msgid ""
"Coupon will be limited to the given number of payments. It will then be "
"automatically removed from the subscription. \"Payments\" also includes the "
"initial subscription payment."
msgstr ""
#: includes/class-wc-subscriptions-coupon.php:1069
#: includes/class-wc-subscriptions-coupon.php:1081
#. translators: %d refers to the number of payments the coupon can be used for.
msgid "Active for %d payment"
msgid_plural "Active for %d payments"
msgstr[0] ""
msgstr[1] ""
#: includes/class-wc-subscriptions-coupon.php:1073
#: includes/class-wc-subscriptions-coupon.php:1085
msgid "Active for unlimited payments"
msgstr ""
@@ -2031,7 +2031,7 @@ msgid "Error: Unable to create renewal order with note \"%s\""
msgstr ""
#: includes/class-wc-subscriptions-manager.php:168
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:211
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:209
msgid "Subscription doesn't exist in scheduled action: %d"
msgstr ""
@@ -2533,33 +2533,33 @@ msgid "Weekly"
msgstr ""
#: includes/class-wcs-cart-initial-payment.php:59
#: includes/class-wcs-cart-renewal.php:188
#: includes/class-wcs-cart-renewal.php:191
msgid "That doesn't appear to be your order."
msgstr ""
#: includes/class-wcs-cart-renewal.php:204
#: includes/class-wcs-cart-renewal.php:207
msgid ""
"This order can no longer be paid because the corresponding subscription "
"does not require payment at this time."
msgstr ""
#: includes/class-wcs-cart-renewal.php:221
#: includes/class-wcs-cart-renewal.php:224
msgid "Complete checkout to renew your subscription."
msgstr ""
#: includes/class-wcs-cart-renewal.php:302
#: includes/class-wcs-cart-renewal.php:305
#. translators: placeholder is an item name
msgid ""
"The %s product has been deleted and can no longer be renewed. Please choose "
"a new product or contact us for assistance."
msgstr ""
#: includes/class-wcs-cart-renewal.php:336
#: includes/class-wcs-cart-renewal.php:339
#. translators: %s is subscription's number
msgid "Subscription #%s has not been added to the cart."
msgstr ""
#: includes/class-wcs-cart-renewal.php:371
#: includes/class-wcs-cart-renewal.php:374
msgid ""
"We couldn't find the original subscription for an item in your cart. The "
"item was removed."
@@ -2569,7 +2569,7 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
#: includes/class-wcs-cart-renewal.php:378
#: includes/class-wcs-cart-renewal.php:381
msgid ""
"We couldn't find the original renewal order for an item in your cart. The "
"item was removed."
@@ -2579,7 +2579,7 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
#: includes/class-wcs-cart-renewal.php:653
#: includes/class-wcs-cart-renewal.php:648
msgid "All linked subscription items have been removed from the cart."
msgstr ""
@@ -2619,26 +2619,26 @@ msgstr ""
msgid "Learn more"
msgstr ""
#: includes/class-wcs-limiter.php:45
#: includes/class-wcs-limiter.php:44
msgid "Limit subscription"
msgstr ""
#: includes/class-wcs-limiter.php:47
#: includes/class-wcs-limiter.php:46
#. translators: placeholders are opening and closing link tags
msgid ""
"Only allow a customer to have one subscription to this product. %sLearn "
"more%s."
msgstr ""
#: includes/class-wcs-limiter.php:49
#: includes/class-wcs-limiter.php:48
msgid "Do not limit"
msgstr ""
#: includes/class-wcs-limiter.php:50
#: includes/class-wcs-limiter.php:49
msgid "Limit to one active subscription"
msgstr ""
#: includes/class-wcs-limiter.php:51
#: includes/class-wcs-limiter.php:50
msgid "Limit to one of any status"
msgstr ""
@@ -2698,31 +2698,31 @@ msgid ""
"\"delete\". Updates are done on post meta directly."
msgstr ""
#: includes/class-wcs-query.php:113
#: includes/class-wcs-query.php:114
msgid "Subscriptions (page %d)"
msgstr ""
#: includes/class-wcs-query.php:140
#: includes/class-wcs-query.php:141
msgid "My Subscription"
msgstr ""
#: includes/class-wcs-query.php:297
#: includes/class-wcs-query.php:298
msgid "Endpoint for the My Account &rarr; Subscriptions page"
msgstr ""
#: includes/class-wcs-query.php:305
#: includes/class-wcs-query.php:306
msgid "View subscription"
msgstr ""
#: includes/class-wcs-query.php:306
#: includes/class-wcs-query.php:307
msgid "Endpoint for the My Account &rarr; View Subscription page"
msgstr ""
#: includes/class-wcs-query.php:314
#: includes/class-wcs-query.php:315
msgid "Subscription payment method"
msgstr ""
#: includes/class-wcs-query.php:315
#: includes/class-wcs-query.php:316
msgid "Endpoint for the My Account &rarr; Change Subscription Payment Method page"
msgstr ""
@@ -2761,13 +2761,13 @@ msgid ""
"subscriptions with no payment method in common."
msgstr ""
#: includes/class-wcs-staging.php:37
#: includes/class-wcs-staging.php:38
msgid ""
"Payment processing skipped - renewal order created on %sstaging site%s "
"under staging site lock. Live site is at %s"
msgstr ""
#: includes/class-wcs-staging.php:52
#: includes/class-wcs-staging.php:53
msgid "staging"
msgstr ""
@@ -2876,23 +2876,23 @@ msgstr ""
msgid "Complete checkout to renew now."
msgstr ""
#: includes/early-renewal/class-wcs-cart-early-renewal.php:247
#: includes/early-renewal/class-wcs-cart-early-renewal.php:248
#. translators: placeholder contains a link to the order's edit screen.
msgid "Customer successfully renewed early with order %s."
msgstr ""
#: includes/early-renewal/class-wcs-cart-early-renewal.php:250
#: includes/early-renewal/class-wcs-cart-early-renewal.php:251
#. translators: placeholder contains a link to the order's edit screen.
msgid ""
"Failed to update subscription dates after customer renewed early with order "
"%s."
msgstr ""
#: includes/early-renewal/class-wcs-cart-early-renewal.php:338
#: includes/early-renewal/class-wcs-cart-early-renewal.php:339
msgid "Order %s created to record early renewal."
msgstr ""
#: includes/early-renewal/class-wcs-cart-early-renewal.php:393
#: includes/early-renewal/class-wcs-cart-early-renewal.php:394
msgid "Cancel"
msgstr ""
@@ -3157,47 +3157,47 @@ msgid ""
"alternate arrangements."
msgstr ""
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:268
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:266
msgid "Supported features:"
msgstr ""
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:271
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:269
msgid "Subscription features:"
msgstr ""
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:275
#: includes/gateways/class-wc-subscriptions-payment-gateways.php:273
msgid "Change payment features:"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:213
#: includes/gateways/paypal/class-wcs-paypal.php:220
msgid "Unable to find order for PayPal billing agreement."
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:275
#: includes/gateways/paypal/class-wcs-paypal.php:282
msgid "An error occurred, please try again or try an alternate form of payment."
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:379
#: includes/gateways/paypal/class-wcs-paypal.php:386
#. translators: placeholders are PayPal API error code and PayPal API error
#. message
msgid "PayPal API error: (%d) %s"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:384
#: includes/gateways/paypal/class-wcs-paypal.php:391
#. translators: placeholder is PayPal transaction status message
msgid "PayPal Transaction Held: %s"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:396
#: includes/gateways/paypal/class-wcs-paypal.php:403
#. translators: placeholder is PayPal transaction status message
msgid "PayPal payment declined: %s"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:400
#: includes/gateways/paypal/class-wcs-paypal.php:407
msgid "PayPal payment approved (ID: %s)"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:453
#: includes/gateways/paypal/class-wcs-paypal.php:460
msgid ""
"Are you sure you want to change the payment method from PayPal standard?\n"
"\n"
@@ -3262,15 +3262,15 @@ msgstr ""
msgid "Open a ticket"
msgstr ""
#: includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php:269
#: includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php:274
msgid "PayPal Subscription ID:"
msgstr ""
#: includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php:296
#: includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php:300
msgid "Enable PayPal Standard for Subscriptions"
msgstr ""
#: includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php:304
#: includes/gateways/paypal/includes/admin/class-wcs-paypal-admin.php:308
#. translators: Placeholders are the opening and closing link tags.
msgid ""
"Before enabling PayPal Standard for Subscriptions, please note, when using "
@@ -3298,7 +3298,7 @@ msgstr ""
msgid "expected clearing date %s"
msgstr ""
#: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-ipn-handler.php:114
#: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-ipn-handler.php:94
msgid "Billing agreement cancelled at PayPal."
msgstr ""
@@ -4950,47 +4950,47 @@ msgstr ""
msgid "Would you like to add a payment method now?"
msgstr ""
#: woocommerce-subscriptions.php:493
#: woocommerce-subscriptions.php:495
msgid ""
"A subscription renewal has been removed from your cart. Multiple "
"subscriptions can not be purchased at the same time."
msgstr ""
#: woocommerce-subscriptions.php:499
#: woocommerce-subscriptions.php:501
msgid ""
"A subscription has been removed from your cart. Due to payment gateway "
"restrictions, different subscription products can not be purchased at the "
"same time."
msgstr ""
#: woocommerce-subscriptions.php:505
#: woocommerce-subscriptions.php:507
msgid ""
"A subscription has been removed from your cart. Products and subscriptions "
"can not be purchased at the same time."
msgstr ""
#: woocommerce-subscriptions.php:647 woocommerce-subscriptions.php:664
#: woocommerce-subscriptions.php:649 woocommerce-subscriptions.php:666
#. translators: placeholder is a number, this is for the teens
#. translators: placeholder is a number, numbers ending in 4-9, 0
msgid "%sth"
msgstr ""
#: woocommerce-subscriptions.php:652
#: woocommerce-subscriptions.php:654
#. translators: placeholder is a number, numbers ending in 1
msgid "%sst"
msgstr ""
#: woocommerce-subscriptions.php:656
#: woocommerce-subscriptions.php:658
#. translators: placeholder is a number, numbers ending in 2
msgid "%snd"
msgstr ""
#: woocommerce-subscriptions.php:660
#: woocommerce-subscriptions.php:662
#. translators: placeholder is a number, numbers ending in 3
msgid "%srd"
msgstr ""
#: woocommerce-subscriptions.php:690
#: woocommerce-subscriptions.php:692
#. translators: 1$-2$: opening and closing <strong> tags, 3$-4$: link tags,
#. takes to woocommerce plugin on wp.org, 5$-6$: opening and closing link tags,
#. leads to plugins.php in admin
@@ -5000,7 +5000,7 @@ msgid ""
"%5$sinstall & activate WooCommerce &raquo;%6$s"
msgstr ""
#: woocommerce-subscriptions.php:693
#: woocommerce-subscriptions.php:695
#. translators: 1$-2$: opening and closing <strong> tags, 3$: minimum supported
#. WooCommerce version, 4$-5$: opening and closing link tags, leads to plugin
#. admin
@@ -5010,11 +5010,11 @@ msgid ""
"WooCommerce to version %3$s or newer &raquo;%5$s"
msgstr ""
#: woocommerce-subscriptions.php:724
#: woocommerce-subscriptions.php:726
msgid "Variable Subscription"
msgstr ""
#: woocommerce-subscriptions.php:820
#: woocommerce-subscriptions.php:822
msgid ""
"%1$sWarning!%2$s We can see the %1$sWooCommerce Subscriptions Early "
"Renewal%2$s plugin is active. Version %3$s of %1$sWooCommerce "
@@ -5023,11 +5023,11 @@ msgid ""
"avoid any conflicts."
msgstr ""
#: woocommerce-subscriptions.php:823
#: woocommerce-subscriptions.php:825
msgid "Installed Plugins"
msgstr ""
#: woocommerce-subscriptions.php:892
#: woocommerce-subscriptions.php:894
#. translators: 1$-2$: opening and closing <strong> tags. 3$-4$: opening and
#. closing link tags for learn more. Leads to duplicate site article on docs.
#. 5$-6$: Opening and closing link to production URL. 7$: Production URL .
@@ -5039,19 +5039,19 @@ msgid ""
"the site's URL. %3$sLearn more &raquo;%4$s."
msgstr ""
#: woocommerce-subscriptions.php:901
#: woocommerce-subscriptions.php:903
msgid "Quit nagging me (but don't enable automatic payments)"
msgstr ""
#: woocommerce-subscriptions.php:906
#: woocommerce-subscriptions.php:908
msgid "Enable automatic payments"
msgstr ""
#: woocommerce-subscriptions.php:1112
#: woocommerce-subscriptions.php:1114
msgid "Support"
msgstr ""
#: woocommerce-subscriptions.php:1195
#: woocommerce-subscriptions.php:1197
#. translators: placeholders are opening and closing tags. Leads to docs on
#. version 2
msgid ""
@@ -5062,14 +5062,14 @@ msgid ""
"2.0 &raquo;%s"
msgstr ""
#: woocommerce-subscriptions.php:1210
#: woocommerce-subscriptions.php:1212
msgid ""
"Warning! You are running version %s of WooCommerce Subscriptions plugin "
"code but your database has been upgraded to Subscriptions version 2.0. This "
"will cause major problems on your store."
msgstr ""
#: woocommerce-subscriptions.php:1211
#: woocommerce-subscriptions.php:1213
msgid ""
"Please upgrade the WooCommerce Subscriptions plugin to version 2.0 or newer "
"immediately. If you need assistance, after upgrading to Subscriptions v2.0, "
@@ -5183,12 +5183,12 @@ msgctxt "refers to live site"
msgid "Live"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:57
#: includes/admin/class-wcs-admin-meta-boxes.php:59
msgctxt "meta box title"
msgid "Subscription Data"
msgstr ""
#: includes/admin/class-wcs-admin-meta-boxes.php:59
#: includes/admin/class-wcs-admin-meta-boxes.php:61
msgctxt "meta box title"
msgid "Schedule"
msgstr ""
@@ -5356,8 +5356,8 @@ msgstr ""
#: includes/admin/meta-boxes/views/html-related-orders-row.php:19
#: includes/class-wc-subscriptions-renewal-order.php:157
#: includes/early-renewal/class-wcs-cart-early-renewal.php:240
#: includes/early-renewal/class-wcs-cart-early-renewal.php:337
#: includes/early-renewal/class-wcs-cart-early-renewal.php:241
#: includes/early-renewal/class-wcs-cart-early-renewal.php:338
#: templates/myaccount/my-subscriptions.php:38
#: templates/myaccount/related-orders.php:44
#: templates/myaccount/related-subscriptions.php:32
@@ -5367,7 +5367,7 @@ msgstr ""
#: includes/class-wc-subscriptions-addresses.php:206
#: includes/class-wc-subscriptions-change-payment-gateway.php:776
#: includes/class-wcs-query.php:109
#: includes/class-wcs-query.php:110
msgctxt "hash before order number"
msgid "Subscription #%s"
msgstr ""
@@ -5524,7 +5524,7 @@ msgid "Subscription renewal payment retry:"
msgstr ""
#: includes/early-renewal/class-wcs-cart-early-renewal.php:150
#: includes/early-renewal/class-wcs-cart-early-renewal.php:197
#: includes/early-renewal/class-wcs-cart-early-renewal.php:198
msgctxt "used in order note as reason for why subscription status changed"
msgid "Customer requested to renew early:"
msgstr ""
@@ -5743,7 +5743,7 @@ msgctxt "input field placeholder for day field for annual subscriptions"
msgid "Day"
msgstr ""
#: includes/class-wcs-cart-renewal.php:682
#: includes/class-wcs-cart-renewal.php:677
msgctxt ""
"Used in WooCommerce by removed item notification: \"_All linked "
"subscription items were_ removed. Undo?\" Filter for item title."
@@ -5945,7 +5945,7 @@ msgctxt "default email subject for suspended emails sent to the admin"
msgid "[%s] Subscription Suspended"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:355
#: includes/gateways/paypal/class-wcs-paypal.php:362
#: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php:208
#: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php:315
#: includes/gateways/paypal/includes/class-wcs-paypal-reference-transaction-api-request.php:326
@@ -5960,7 +5960,7 @@ msgctxt ""
msgid "#"
msgstr ""
#: includes/gateways/paypal/class-wcs-paypal.php:619
#: includes/gateways/paypal/class-wcs-paypal.php:626
msgctxt ""
"used in User Agent data sent to PayPal to help identify where a payment "
"came from"
@@ -6088,7 +6088,7 @@ msgid "2.5"
msgstr ""
#: includes/upgrades/templates/wcs-about-2-0.php:36
#: woocommerce-subscriptions.php:1111
#: woocommerce-subscriptions.php:1113
msgctxt "short for documents"
msgid "Docs"
msgstr ""

View File

@@ -5,10 +5,10 @@
* Description: Sell products and services with recurring payments in your WooCommerce Store.
* Author: Prospress Inc.
* Author URI: https://prospress.com/
* Version: 2.5.3
* Version: 2.5.6
*
* WC requires at least: 3.0
* WC tested up to: 3.5
* WC tested up to: 3.6
* Woo: 27147:6115e6d7e297b623a169fdcf5728b224
*
* Copyright 2017 Prospress, Inc. (email : freedoms@prospress.com)
@@ -113,7 +113,7 @@ class WC_Subscriptions {
public static $plugin_file = __FILE__;
public static $version = '2.5.3';
public static $version = '2.5.6';
public static $wc_minimum_supported_version = '3.0';
@@ -484,7 +484,9 @@ class WC_Subscriptions {
// If the product is sold individually or if the cart doesn't already contain this product, empty the cart.
if ( ( $product && $product->is_sold_individually() ) || ! WC()->cart->find_product_in_cart( $cart_item_id ) ) {
$coupons = WC()->cart->get_applied_coupons();
WC()->cart->empty_cart();
WC()->cart->set_applied_coupons( $coupons );
}
} elseif ( $is_subscription && wcs_cart_contains_renewal() && ! $multiple_subscriptions_possible && ! $manual_renewals_enabled ) {