Skip to content

Commit 8fdc69e

Browse files
authored
Merge pull request #157 from strangerstudios/dev
Sitewide Sales Version 1.4 Release
2 parents dd39e4c + cdaadf6 commit 8fdc69e

28 files changed

+4385
-759
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Generate Translations
2+
on: workflow_dispatch
3+
jobs:
4+
generate-translations:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- name: WordPress POT/PO/MO Generator
9+
uses: strangerstudios/action-wp-pot-po-mo-generator@main
10+
with:
11+
generate_pot: 1
12+
generate_po: 1
13+
generate_mo: 1
14+
generate_lang_packs: 1
15+
merge_changes: 1
16+
headers: '{"Report-Msgid-Bugs-To":"info@strangerstudios.com","Last-Translator":"Stranger Studios <info@strangerstudios.com>","Language-Team":"Stranger Studios <info@strangerstudios.com>"}'
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/label-sync.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Sync labels
2+
on:
3+
# You can run this with every type of event, but it's better to run it only when you actually need it.
4+
workflow_dispatch:
5+
6+
jobs:
7+
labels:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: strangerstudios/label-sync@v2
12+
with:
13+
# If you want to use a source repo, you can put is name here (only the owner/repo format is accepted)
14+
source-repo: strangerstudios/paid-memberships-pro
15+
16+
# If you want to delete any additional label, set this to true
17+
delete-other-labels: true
18+
19+
#If you want the action just to show you the preview of the changes, without actually editing the labels, set this to tru
20+
dry-run: false
21+
22+
# You can change the token used to change the labels, this is the default one
23+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# [Sitewide Sales](https://sitewidesales.com) #
44

55
### Welcome to the Sitewide Sales GitHub Repository
6-
Sitewide Sales allows you to run Black Friday, Cyber Monday, or other flash sales on your WordPress-powered eCommerce or membership site. The plugin offers modules for [WooCommerce](https://woocommerce.com), [Paid Memberships Pro](https://www.paidmembershipspro.com), [Easy Digital Downloads](https://easydigitaldownloads.com/).
6+
Sitewide Sales allows you to run Black Friday, Cyber Monday, or other flash sales on your WordPress-powered eCommerce or membership site.
7+
8+
This plugin offers modules for [WooCommerce](https://sitewidesales.com/modules/woocommerce/), [Paid Memberships Pro](https://sitewidesales.com/modules/paid-memberships-pro/), and [Easy Digital Downloads](https://sitewidesales.com/modules/easy-digital-downloads/). You can also use the [Custom sale module](https://sitewidesales.com/modules/custom-module/) to track any banner > landing page > conversion workflow. New integrations will be built as requested.
79

810
Let Sitewide Sales handle your sale banners, notification bars, landing pages, and reporting. Running a sale like this used to require three or more separate plugins. Now you can run your sale with a single tool. At the same time, the Sitewide Sales plugin is flexible enough that you can use specific banner and landing page plugins if wanted.
911

adminpages/report-csv.php

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?php
2+
//only admins can get this
3+
if ( ! function_exists( "current_user_can" ) || ( ! current_user_can( "manage_options" ) ) ) {
4+
die( __( "You do not have permissions to perform this action.", 'sitewide-sales' ) );
5+
}
6+
7+
//get values from form
8+
if(isset($_REQUEST['sitewide_sale'])) {
9+
$id = intval($_REQUEST['sitewide_sale']);
10+
$sitewide_sale = \Sitewide_Sales\classes\SWSales_Sitewide_Sale::get_sitewide_sale( $id );
11+
$daily_revenue = $sitewide_sale->get_daily_sale_revenue();
12+
$landing_page_post_id = $sitewide_sale->get_landing_page_post_id();
13+
14+
}
15+
16+
$headers = array();
17+
$headers[] = "Content-Type: text/csv";
18+
$headers[] = "Cache-Control: max-age=0, no-cache, no-store";
19+
$headers[] = "Pragma: no-cache";
20+
$headers[] = "Connection: close";
21+
22+
// Generate a filename based on the params.
23+
$filename = $sitewide_sale->get_name() . "_" . date( "Y-m-d_H-i", current_time( 'timestamp' ) ) . ".csv";
24+
$headers[] = "Content-Disposition: attachment; filename={$filename};";
25+
26+
$left_header= array (
27+
"sale ID",
28+
"sale name",
29+
"landing page",
30+
"start date",
31+
"end date",
32+
"banner reach",
33+
"landing page visits",
34+
"checkouts using coupon " . $sitewide_sale->get_coupon(),
35+
"sale revenue",
36+
"other new revenue",
37+
"renewals",
38+
"total revenue in period"
39+
);
40+
41+
$csv_file_header_array = array_merge( $left_header, array_keys( $daily_revenue ) );
42+
43+
$dateformat = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
44+
45+
// Generate a temporary file to store the data in.
46+
$tmp_dir = apply_filters( 'swsales_report_csv_export_tmp_dir', sys_get_temp_dir() );
47+
48+
$filename = tempnam( $tmp_dir, 'sws_reportcsv_' );
49+
50+
// open in append mode
51+
$csv_fh = fopen( $filename, 'a' );
52+
53+
//write the CSV header to the file
54+
fputcsv( $csv_fh, $csv_file_header_array);
55+
56+
$csvoutput = array(
57+
$id,
58+
$sitewide_sale->get_name(),
59+
get_permalink( $landing_page_post_id ),
60+
$sitewide_sale->get_start_date(),
61+
$sitewide_sale->get_end_date(),
62+
$sitewide_sale->get_banner_impressions(),
63+
$sitewide_sale->get_landing_page_visits(),
64+
$sitewide_sale->get_checkout_conversions(),
65+
$sitewide_sale->get_sale_revenue(),
66+
$sitewide_sale->get_other_revenue(),
67+
$sitewide_sale->get_renewal_revenue(),
68+
$sitewide_sale->get_total_revenue()
69+
);
70+
71+
$csvoutput = array_merge( $csvoutput, array_values( $daily_revenue ) );
72+
73+
fputcsv( $csv_fh, $csvoutput );
74+
75+
//flush the buffer
76+
wp_cache_flush();
77+
78+
swsales_transmit_report_data( $csv_fh, $filename, $headers );
79+
80+
81+
function swsales_transmit_report_data( $csv_fh, $filename, $headers = array() ) {
82+
83+
//close the temp file
84+
fclose( $csv_fh );
85+
86+
if ( version_compare( phpversion(), '5.3.0', '>' ) ) {
87+
88+
//make sure we get the right file size
89+
clearstatcache( true, $filename );
90+
} else {
91+
// for any PHP version prior to v5.3.0
92+
clearstatcache();
93+
}
94+
95+
//did we accidentally send errors/warnings to browser?
96+
if ( headers_sent() ) {
97+
echo str_repeat( '-', 75 ) . "<br/>\n";
98+
echo 'Please open a support case and paste in the warnings/errors you see above this text to\n ';
99+
echo '<a href="https://sitewidesales.com/support/?utm_source=plugin&utm_medium=swsales-report-csv&utm_campaign=support" target="_blank">Sitewide Sales support</a><br/>\n';
100+
echo str_repeat( "=", 75 ) . "<br/>\n";
101+
echo file_get_contents( $filename );
102+
echo str_repeat( "=", 75 ) . "<br/>\n";
103+
}
104+
105+
//transmission
106+
if ( ! empty( $headers ) ) {
107+
//set the download size
108+
$headers[] = "Content-Length: " . filesize( $filename );
109+
110+
//set headers
111+
foreach ( $headers as $header ) {
112+
header( $header . "\r\n" );
113+
}
114+
115+
// disable compression for the duration of file download
116+
if ( ini_get( 'zlib.output_compression' ) ) {
117+
ini_set( 'zlib.output_compression', 'Off' );
118+
}
119+
120+
if( function_exists( 'fpassthru' ) ) {
121+
// use fpassthru to output the csv
122+
$csv_fh = fopen( $filename, 'rb' );
123+
fpassthru( $csv_fh );
124+
fclose( $csv_fh );
125+
} else {
126+
// use readfile() if fpassthru() is disabled (like on Flywheel Hosted)
127+
readfile( $filename );
128+
}
129+
130+
// remove the temp file
131+
unlink( $filename );
132+
}
133+
134+
exit;
135+
}

classes/class-swsales-about.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,12 @@ public static function show_about_page() { ?>
3838
'strong' => array(),
3939
'em' => array(), );
4040
?>
41-
<p><?php echo sprintf( wp_kses( __( 'Sitewide Sales helps you run Black Friday, Cyber Monday, or other flash sales on your WordPress-powered eCommerce or membership site. We currently offer integration for <a href="%s" title="Paid Memberships Pro" target="_blank">Paid Memberships Pro</a>, <a href="%s" title="WooCommerce" target="_blank">WooCommerce</a>, and <a href="%s" title="Easy Digital Downloads" target="_blank">Easy Digital Downloads</a>.', 'sitewide-sales' ), $allowed_html ), 'https://www.paidmembershipspro.com/?utm_source=sitewide-sales&utm_medium=about&utm_campaign=homepage', 'https://woocommerce.com', 'https://easydigitaldownloads.com' ); ?></p>
41+
<p><?php esc_html_e( 'Sitewide Sales helps you run Black Friday, Cyber Monday, or other flash sales on your WordPress-powered eCommerce or membership site.', 'sitewide-sales' ); ?></p>
42+
<p><?php echo sprintf( wp_kses( __( 'We currently offer integration for <a href="%s" title="Paid Memberships Pro" target="_blank">Paid Memberships Pro</a>, <a href="%s" title="WooCommerce" target="_blank">WooCommerce</a>, and <a href="%s" title="Easy Digital Downloads" target="_blank">Easy Digital Downloads</a>.', 'sitewide-sales' ), $allowed_html ), 'https://sitewidesales.com/modules/paid-memberships-pro/?utm_source=sitewide-sales&utm_medium=about&utm_campaign=module-pmpro', 'https://sitewidesales.com/modules/woocommerce/?utm_source=sitewide-sales&utm_medium=about&utm_campaign=module-wc', 'https://sitewidesales.com/modules/easy-digital-downloads/?utm_source=sitewide-sales&utm_medium=about&utm_campaign=module-edd' ); ?></p>
43+
<p><?php echo sprintf( wp_kses( __( 'There is also a <a href="%s" title="Custom Module" target="_blank">custom module</a> you can use to track performance with any other platforms you choose.', 'sitewide-sales' ), $allowed_html ), 'https://sitewidesales.com/modules/custom-module/?utm_source=sitewide-sales&utm_medium=about&utm_campaign=module-custom' ); ?></p>
4244
<h2><?php esc_html_e( 'Getting Started', 'sitewide-sales' ); ?></h2>
43-
<img class="sitewide_sales_icon alignright" src="<?php echo esc_url( plugins_url( 'images/Sitewide-Sales_icon.png', SWSALES_BASENAME ) ); ?>" border="0" alt="<?php esc_attr_e( 'Sitewide Sales(c) - All Rights Reserved', 'sitewide-sales' ); ?>" />
4445
<p><?php echo wp_kses( __( 'This plugin handles your banners, notification bars, landing pages, and reporting. Running a sale like this used to require three or more separate plugins. Now you can run your sale with a single tool. At the same time, the Sitewide Sales plugin is flexible enough that you can use specific banner and landing page plugins if wanted.', 'sitewide-sales' ), $allowed_html ); ?></p>
45-
<p><?php echo wp_kses( __( 'Before you get started, take some time thinking about the sale you will set up. This important first step will help you run a structured, well designed sale and will significantly cut down on the setup time. Some things to consider include:', 'sitewide-sales' ), $allowed_html ); ?></p>
46-
<ul class="ul-disc">
47-
<li><?php esc_html_e( 'What is the main purpose for your sale?', 'sitewide-sales' ); ?></li>
48-
<li><?php esc_html_e( 'What date will your sale begin?', 'sitewide-sales' ); ?></li>
49-
<li><?php esc_html_e( 'When will your sale end?', 'sitewide-sales' ); ?></li>
50-
<li><?php esc_html_e( 'If you\'re running a sale on products, which products will your discount apply for?', 'sitewide-sales' ); ?></li>
51-
<li><?php esc_html_e( 'If you\'re running a sale on membership, which existing members (if any) do you want to know about the sale?', 'sitewide-sales' ); ?></li>
52-
<li><?php esc_html_e( 'What general look and feel do you want to use as part of the marketing surrounding your sale?', 'sitewide-sales' ); ?></li>
53-
</ul>
54-
55-
<h2><?php esc_html_e( "We're here to help make your sale a measurable success.", 'sitewide-sales' ); ?></h2>
56-
57-
<?php
58-
echo '<p>' . wp_kses( __( 'Check out the Sitewide Sales documentation site for additional setup instructions, sample landing page and banner content, as well as developer documentation to further extend the templates, reporting, and integration options.', 'sitewide-sales' ), $allowed_html ) . '</p>';
59-
?>
46+
<p><?php esc_html_e( 'Check out the Sitewide Sales documentation site for additional setup instructions, sample landing page and banner content, as well as developer documentation to further extend the templates, reporting, and integration options.', 'sitewide-sales' ); ?></p>
6047

6148
<p><a href="https://sitewidesales.com/documentation/?utm_source=plugin&utm_medium=swsales-about&utm_campaign=documentation" target="_blank" title="<?php esc_attr_e( 'Documentation', 'sitewide-sales' ); ?>"><?php esc_html_e( 'Documentation', 'sitewide-sales' ); ?></a> | <a href="https://sitewidesales.com/support/?utm_source=plugin&utm_medium=swsales-about&utm_campaign=support" target="_blank" title="<?php esc_attr_e( 'View Support Options &raquo;', 'sitewide-sales' ); ?>"><?php esc_html_e( 'View Support Options &raquo;', 'sitewide-sales' ); ?></a></p>
6249

classes/class-swsales-landing-pages.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ public static function the_content( $content ) {
204204
// Load the sale.
205205
$sitewide_sale = new SWSales_Sitewide_Sale();
206206
$sale_found = $sitewide_sale->load_sitewide_sale( $sitewide_sale_id );
207-
// The ID we have isn't a Sitewide Sale CPT, return the content.
208-
if ( ! $sale_found ) {
207+
$landing_template = $sitewide_sale->get_landing_page_template();
208+
209+
// The ID we have isn't a Sitewide Sale CPT, or if we're not using a template we can return the content as they're most likely using blocks or a custom solution.
210+
if ( ! $sale_found || $landing_template == '0' ) {
209211
return $content;
210212
}
211213

@@ -221,12 +223,11 @@ public static function the_content( $content ) {
221223
$r = '';
222224

223225
// Build the return string.
224-
$r .= '<div class="swsales-landing-page-content swsales-landing-page-content-' . $sale_period . '">';
226+
$r .= '<div class="swsales-landing-page-content swsales-landing-page-content-' . esc_attr( $sale_period ) . '">';
225227
$r .= $content;
226228
$r .= '</div>';
227229

228230
// Template specific filter only if we have a return string to adjust.
229-
$landing_template = $sitewide_sale->get_landing_page_template();
230231
if ( ! empty( $landing_template ) ) {
231232
$r = apply_filters( 'swsales_landing_page_content_' . $landing_template, $r, $sitewide_sale );
232233
}

classes/class-swsales-license.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static function add_license_page() {
1616
if ( swsales_license_is_valid( $key, NULL ) ) {
1717
$span_color = '#33FF00';
1818
} else {
19-
$span_color = '#FF3333';
19+
$span_color = '#FCD34D';
2020
}
2121
add_submenu_page(
2222
'edit.php?post_type=sitewide_sale',
@@ -80,7 +80,7 @@ public static function show_license_page() {
8080
<a class="button button-hero" href="https://sitewidesales.com/pricing/?utm_source=plugin&utm_medium=swsales-license&utm_campaign=swsales-checkout&utm_content=view-license-details" target="_blank"><?php echo esc_html( 'View Support License Details', 'sitewide-sales' ); ?></a>
8181
<?php } else { ?>
8282
<a class="button button-primary button-hero" href="https://www.strangerstudios.com/login/?redirect_to=%2Faccount%2F%3Futm_source%3Dplugin%26utm_medium%swsales-license%26utm_campaign%3Daccount%26utm_content%3Dview-account" target="_blank"><?php echo esc_html( 'Manage My Account', 'sitewide-sales' ); ?></a>
83-
<a class="button button-hero" href="https://www.strangerstudios.com/login/?redirect_to=%2Fnew-ticket%2F%3Futm_source%3Dplugin%26utm_medium%3Dswsales-license%26utm_campaign%3Dsupport%26utm_content%3Dsupport" target="_blank"><?php echo esc_html( 'Open Support Ticket', 'sitewide-sales' ); ?></a>
83+
<a class="button button-hero" href="https://www.strangerstudios.com/login/?redirect_to=%2Fwordpress-plugins%2Fsitewide-sales%2Fsupport%2F%3Futm_source%3Dplugin%26utm_medium%3Dswsales-license%26utm_campaign%3Dsupport%26utm_content%3Dsupport" target="_blank"><?php echo esc_html( 'Open Support Ticket', 'sitewide-sales' ); ?></a>
8484
<?php } ?>
8585
</p>
8686

0 commit comments

Comments
 (0)