Skip to content

Commit

Permalink
Updates to 6.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Woo committed Feb 11, 2025
1 parent 9663c5f commit 21548cf
Show file tree
Hide file tree
Showing 154 changed files with 1,877 additions and 1,460 deletions.
21 changes: 21 additions & 0 deletions admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static function init() {
add_action( 'current_screen', [ $self, 'screen_options' ] );
add_filter( 'set-screen-option', [ $self, 'handle_save_screen_option' ], 10, 3 );

add_action( 'before_delete_post', [ $self, 'flush_group_caches' ], 8 );
add_action( 'wp_trash_post', [ $self, 'flush_group_caches' ] );
add_action( 'untrash_post', [ $self, 'flush_group_caches' ] );

if ( aw_request( 'action' ) === 'automatewoo-settings' ) {
add_action( 'wp_loaded', [ $self, 'save_settings' ] );
}
Expand Down Expand Up @@ -1076,4 +1080,21 @@ public static function get_marketplace_subscriptions_tab_url() {
admin_url( 'admin.php' )
);
}

/**
* Flush group caches for specific post types.
*
* @since 6.1.6
*
* @param int $post_id
*/
public static function flush_group_caches( int $post_id ) {
$post_type = get_post_type( $post_id );

switch ( $post_type ) {
case 'shop_coupon':
Cache::flush_group( 'coupons' );
break;
}
}
}
8 changes: 4 additions & 4 deletions admin/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,17 +450,17 @@ static function send_test_email() {
if ( $result instanceof WP_Error ) {
wp_send_json_error(
[
/* translators: %s: Error message */
/* translators: %s: The error message. */
'message' => sprintf( __( 'Error: %s', 'automatewoo' ), $result->get_error_message() ),
]
);
}

wp_send_json_success([
'message' => sprintf(
__( 'Success! %s email%s sent.', 'automatewoo' ),
count($to),
count($to) == 1 ? '' : 's'
/* translators: %s: Number of emails sent. */
_n( 'Success! %s email sent', 'Success! %s emails sent', count( $to ), 'automatewoo' ),
count( $to )
)
]);
}
Expand Down
2 changes: 1 addition & 1 deletion admin/assets/css/aw-main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/assets/css/aw-main.css.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion admin/controllers/carts.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private function output_list_table() {

$sidebar_content = '<p>' .
sprintf(
/* translators: %s: Amount of days after which carts will be deleted. */
__( 'Currently active carts are shown here which includes any cart that has not been cleared at purchase or emptied by its owner. Carts are automatically deleted %s days after their last update.', 'automatewoo' ),
AW()->options()->clear_inactive_carts_after
)
Expand Down Expand Up @@ -90,4 +91,4 @@ private function action_bulk_edit( $action ) {
}
}

return new Carts();
return new Carts();
6 changes: 5 additions & 1 deletion admin/controllers/logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ private function action_rerun() {
if ( $new_log ) {
$this->add_message(
__( 'Workflow was successfully re-run.', 'automatewoo' ),
sprintf( __( 'Created log #%d.', 'automatewoo' ), $new_log->get_id() )
sprintf(
/* translators: %d: Log ID. */
__( 'Created log #%d.', 'automatewoo' ),
$new_log->get_id()
)
);
}
else {
Expand Down
7 changes: 4 additions & 3 deletions admin/controllers/opt-ins.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ private function output_list_table() {
}

$sidebar_content .= ' ' . sprintf(
__( 'More information on opt-ins and opt-outs is available <%s>in the documentation.<%s>', 'automatewoo' ),
'a href="' . Admin::get_docs_link('unsubscribes', 'unsubscribes-list' ) . '" target="_blank"',
'/a'
/* translators: %1$s documentation link start, %2$s documentation link end. */
__( 'More information on opt-ins and opt-outs is available %1$sin the documentation%2$s.', 'automatewoo' ),
'<a href="' . Admin::get_docs_link( 'unsubscribes', 'unsubscribes-list' ) . '" target="_blank">',
'</a>'
);

$this->output_view( 'page-table-with-sidebar', [
Expand Down
23 changes: 17 additions & 6 deletions admin/controllers/queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,25 @@ private function output_list_table() {
$table->nonce_action = $this->get_nonce_action();

$sidebar_content = '<p>' . sprintf(
__( 'Workflows that are not set to run immediately will be added to this queue. The queue is checked every two minutes so actual run times will vary slightly. <%s>Read more&hellip;<%s>', 'automatewoo' ),
'a href="' . Admin::get_docs_link( 'queue', 'queue-list' ) . '" target="_blank"',
'/a'
) . '</p>';
/* translators: %1$s read more link start, %2$s read more link end. */
__( 'Workflows that are not set to run immediately will be added to this queue. The queue is checked every two minutes so actual run times will vary slightly. %1$sRead more&hellip;%2$s', 'automatewoo' ),
'<a href="' . Admin::get_docs_link( 'queue', 'queue-list' ) . '" target="_blank">',
'</a>'
) . '</p>';

try {
$deletion_job = AW()->job_service()->get_job( 'delete_failed_queued_workflows' );
$sidebar_content .= '<p>' . sprintf( __( 'Failed queue items will be deleted after %d days', 'automatewoo' ), $deletion_job->get_deletion_period() ) . '</p>';
$deletion_job = AW()->job_service()->get_job( 'delete_failed_queued_workflows' );
$deletion_period = $deletion_job->get_deletion_period();
$sidebar_content .= '<p>' . sprintf(
/* translators: %d Number of days to trigger deletion of failed queue items. */
_n(
'Failed queue items will be deleted after %d day',
'Failed queue items will be deleted after %d days',
$deletion_period,
'automatewoo'
),
$deletion_period
) . '</p>';
} catch ( JobException $e ) {
Logger::error( 'jobs', $e->getMessage() );
}
Expand Down
17 changes: 12 additions & 5 deletions admin/controllers/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ function output_messages() {
$analytics_link = '<a href="' . esc_url( $this->get_corresponding_analytics_url() ) . '">' . __( 'Analytics', 'automatewoo' ) . '</a>';

// Show the warning.
echo $this->format_notice( [
'main' => __( 'This reports page is deprecated.', 'automatewoo' ),
'extra' => sprintf( __( 'All reports were migrated to %1s. This page will be removed once High Performance Order Storage is enabled in WooCommerce.', 'automatewoo' ), $analytics_link ),
'class' => '',
], 'warning' );
echo $this->format_notice(
[
'main' => __( 'This reports page is deprecated.', 'automatewoo' ),
'extra' => sprintf(
/* translators: %s Analytics link, to migrated reports. */
__( 'All reports were migrated to %s. This page will be removed once High Performance Order Storage is enabled in WooCommerce.', 'automatewoo' ),
$analytics_link
),
'class' => '',
],
'warning'
);

// Show other messages.
parent::output_messages();
Expand Down
39 changes: 22 additions & 17 deletions admin/coupons-list.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use AutomateWoo\Cache;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand Down Expand Up @@ -74,25 +76,28 @@ public function filter_counts( $counts, $type ) {


/**
* Get the post count
* Get the count of published AutomateWoo generated coupons.
*
* @return int The post count
* @return int Coupon count.
*/
public function get_count() {
$coupons = get_posts(
[
'post_type' => 'shop_coupon',
'fields' => 'ids',
'posts_per_page' => -1,
'meta_query' => [
[
'key' => '_is_aw_coupon',
'value' => '1',
],
],
]
);
return count( $coupons );
public function get_count(): int {
global $wpdb;

$count = Cache::get( 'coupon_count', 'coupons' );
if ( false === $count ) {
$count = $wpdb->get_var(
"SELECT DISTINCT COUNT(*) FROM `{$wpdb->posts}` AS posts
INNER JOIN `{$wpdb->postmeta}` AS meta ON posts.ID = meta.post_id
WHERE meta.meta_key = '_is_aw_coupon'
AND meta_value = '1'
AND posts.post_type = 'shop_coupon'
AND posts.post_status = 'publish'"
);
}

Cache::set( 'coupon_count', (int) $count, 'coupons' );

return (int) $count;
}


Expand Down
20 changes: 14 additions & 6 deletions admin/reports/conversions.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,23 @@ function get_chart_legend() {
$legend = [];

$legend[] = [
'title' => sprintf( __( '%s converted order value', 'automatewoo' ), '<strong>' . wc_price($this->conversion_total_value) . '</strong>' ),
'color' => $this->chart_colours['conversion_value'],
'highlight_series' => 1
'title' => sprintf(
/* translators: %s Conversion total price. */
__( '%s converted order value', 'automatewoo' ),
'<strong>' . wc_price( $this->conversion_total_value ) . '</strong>'
),
'color' => $this->chart_colours['conversion_value'],
'highlight_series' => 1,
];

$legend[] = [
'title' => sprintf( __( '%s converted orders', 'automatewoo' ), '<strong>' . $this->conversion_total_orders . '</strong>' ),
'color' => $this->chart_colours['conversion_number'],
'highlight_series' => 0
'title' => sprintf(
/* translators: %s Number of converted orders. */
__( '%s converted orders', 'automatewoo' ),
'<strong>' . $this->conversion_total_orders . '</strong>'
),
'color' => $this->chart_colours['conversion_number'],
'highlight_series' => 0,
];

return $legend;
Expand Down
54 changes: 37 additions & 17 deletions admin/reports/email-tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,35 +145,55 @@ function get_chart_legend() {
$legend = [];

$legend[] = array(
'title' => sprintf( __( '%s trackable messages sent', 'automatewoo' ), '<strong>' . $this->logs_count . '</strong>' ),
'color' => $this->chart_colours['runs'],
'highlight_series' => 1
'title' => sprintf(
/* translators: %s Amount of trackable messages sent. */
__( '%s trackable messages sent', 'automatewoo' ),
'<strong>' . $this->logs_count . '</strong>'
),
'color' => $this->chart_colours['runs'],
'highlight_series' => 1,
);

$legend[] = array(
'title' => sprintf( __( '%s unique opens', 'automatewoo' ), '<strong>' . $this->opens_count . '</strong>' ),
'color' => $this->chart_colours['opens'],
'placeholder' => __( 'This value represents unique opens.', 'automatewoo' ),
'highlight_series' => 4
'title' => sprintf(
/* translators: %s Number of unique opens. */
__( '%s unique opens', 'automatewoo' ),
'<strong>' . $this->opens_count . '</strong>'
),
'color' => $this->chart_colours['opens'],
'placeholder' => __( 'This value represents unique opens.', 'automatewoo' ),
'highlight_series' => 4,
);

$legend[] = array(
'title' => sprintf( __( '%s unique clicks', 'automatewoo' ), '<strong>' . $this->unique_clicks_count . '</strong>' ),
'color' => $this->chart_colours['unique_clicks'],
'highlight_series' => 2
'title' => sprintf(
/* translators: %s Number of unique clicks. */
__( '%s unique clicks', 'automatewoo' ),
'<strong>' . $this->unique_clicks_count . '</strong>'
),
'color' => $this->chart_colours['unique_clicks'],
'highlight_series' => 2,
);

$legend[] = array(
'title' => sprintf( __( '%s clicks', 'automatewoo' ), '<strong>' . $this->clicks_count . '</strong>' ),
'color' => $this->chart_colours['clicks'],
'highlight_series' => 3
'title' => sprintf(
/* translators: %s Number of clicks. */
__( '%s clicks', 'automatewoo' ),
'<strong>' . $this->clicks_count . '</strong>'
),
'color' => $this->chart_colours['clicks'],
'highlight_series' => 3,
);

$legend[] = array(
'title' => sprintf( __( '%s unsubscribes', 'automatewoo' ), '<strong>' . $this->unsubscribes_count . '</strong>' ),
'color' => $this->chart_colours['unsubscribes'],
'placeholder' => __( 'Unsubscribes are recorded against each workflow so users can unsubscribe to individual workflows.', 'automatewoo' ),
'highlight_series' => 0
'title' => sprintf(
/* translators: %s Number of unsubscribed users. */
__( '%s unsubscribes', 'automatewoo' ),
'<strong>' . $this->unsubscribes_count . '</strong>'
),
'color' => $this->chart_colours['unsubscribes'],
'placeholder' => __( 'Unsubscribes are recorded against each workflow so users can unsubscribe to individual workflows.', 'automatewoo' ),
'highlight_series' => 0,
);

return $legend;
Expand Down
10 changes: 7 additions & 3 deletions admin/reports/runs-by-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ function get_chart_legend() {
$legend = [];

$legend[] = [
'title' => sprintf( __( '%s workflows have run for the selected period', 'automatewoo' ), '<strong>' . $this->logs_count . '</strong>' ),
'color' => $this->chart_colours['runs'],
'highlight_series' => 0
'title' => sprintf(
/* translators: %s Number of workflows that have run for the selected period. */
__( '%s workflows have run for the selected period', 'automatewoo' ),
'<strong>' . $this->logs_count . '</strong>'
),
'color' => $this->chart_colours['runs'],
'highlight_series' => 0,
];

return $legend;
Expand Down
4 changes: 2 additions & 2 deletions automatewoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: AutomateWoo
* Plugin URI: https://automatewoo.com
* Description: Powerful marketing automation for your WooCommerce store.
* Version: 6.1.5
* Version: 6.1.6
* Author: WooCommerce
* Author URI: https://woocommerce.com
* License: GPLv3
Expand Down Expand Up @@ -37,7 +37,7 @@
defined( 'ABSPATH' ) || exit;

define( 'AUTOMATEWOO_SLUG', 'automatewoo' );
define( 'AUTOMATEWOO_VERSION', '6.1.5' ); // WRCS: DEFINED_VERSION.
define( 'AUTOMATEWOO_VERSION', '6.1.6' ); // WRCS: DEFINED_VERSION.
define( 'AUTOMATEWOO_FILE', __FILE__ );
define( 'AUTOMATEWOO_PATH', __DIR__ );
define( 'AUTOMATEWOO_MIN_PHP_VER', '7.4.0' );
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
*** AutomateWoo Changelog ***

2025-02-11 - version 6.1.6
* Fix - Add translator comments to assist in translations.
* Fix - Cache coupon count and use a direct SQL query to count the totals.
* Tweak - Add flush_group to the cache helper class.
* Tweak - Highlight the OR condition for rule groups.
* Tweak - PHPCS fixes for variable classes.

2025-01-15 - version 6.1.5
* Dev - Fix Points and rewards integration tests.
* Dev - Improve abandoned cart E2E tests.
Expand Down
7 changes: 4 additions & 3 deletions includes/Actions/Custom_Function.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class Action_Custom_Function extends Action {
function load_admin_details() {
$this->title = __( 'Custom Function', 'automatewoo' );
$this->description = sprintf(
__( 'This action can be used by developers to trigger custom code from a workflow. <%s>View documentation<%s>.', 'automatewoo' ),
'a href="' . Admin::get_docs_link( 'actions/custom-functions/' ) . '"',
'/a'
/* translators: %1$s documentation link start, %2$s documentation link end. */
__( 'This action can be used by developers to trigger custom code from a workflow. %1$sView documentation%2$s.', 'automatewoo' ),
'<a href="' . Admin::get_docs_link( 'actions/custom-functions/' ) . '">',
'</a>'
);
}

Expand Down
10 changes: 6 additions & 4 deletions includes/Actions/Send_SMS_Twilio.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ function load_admin_details() {
$this->description = __( 'It is recommended to include an unsubscribe link by using the variable {{ customer.unsubscribe_url }} in the SMS body.', 'automatewoo' );

if ( AW()->options()->bitly_api && AW()->options()->bitly_shorten_sms_links ) {
$bitly_text = __( 'Links in the SMS body will be shortened with the <%1$s>Bitly integration<%2$s>.', 'automatewoo' );
/* translators: %1$s Bitly integration link start, %2$s Bitly integration link end. */
$bitly_text = __( 'Links in the SMS body will be shortened with the %1$sBitly integration%2$s.', 'automatewoo' );
} else {
$bitly_text = __( 'To shorten links in the SMS body the <%1$s>Bitly integration<%2$s> must be enabled.', 'automatewoo' );
/* translators: %1$s Bitly integration link start, %2$s Bitly integration link end. */
$bitly_text = __( 'To shorten links in the SMS body the %1$sBitly integration%2$s must be enabled.', 'automatewoo' );
}

$this->description .= sprintf(
' ' . $bitly_text,
'a href="' . Admin::page_url( 'settings-bitly' ) . '" target="_blank"',
'/a'
'<a href="' . Admin::page_url( 'settings-bitly' ) . '" target="_blank">',
'</a>'
);
}

Expand Down
Loading

0 comments on commit 21548cf

Please sign in to comment.