Skip to content

Commit

Permalink
Merge pull request #157 from strangerstudios/dev
Browse files Browse the repository at this point in the history
Sitewide Sales Version 1.4 Release
  • Loading branch information
andrewlimaza authored Nov 16, 2023
2 parents dd39e4c + cdaadf6 commit 8fdc69e
Show file tree
Hide file tree
Showing 28 changed files with 4,385 additions and 759 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/generate-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Generate Translations
on: workflow_dispatch
jobs:
generate-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: WordPress POT/PO/MO Generator
uses: strangerstudios/action-wp-pot-po-mo-generator@main
with:
generate_pot: 1
generate_po: 1
generate_mo: 1
generate_lang_packs: 1
merge_changes: 1
headers: '{"Report-Msgid-Bugs-To":"[email protected]","Last-Translator":"Stranger Studios <[email protected]>","Language-Team":"Stranger Studios <[email protected]>"}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/label-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Sync labels
on:
# You can run this with every type of event, but it's better to run it only when you actually need it.
workflow_dispatch:

jobs:
labels:
runs-on: ubuntu-latest

steps:
- uses: strangerstudios/label-sync@v2
with:
# If you want to use a source repo, you can put is name here (only the owner/repo format is accepted)
source-repo: strangerstudios/paid-memberships-pro

# If you want to delete any additional label, set this to true
delete-other-labels: true

#If you want the action just to show you the preview of the changes, without actually editing the labels, set this to tru
dry-run: false

# You can change the token used to change the labels, this is the default one
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# [Sitewide Sales](https://sitewidesales.com) #

### Welcome to the Sitewide Sales GitHub Repository
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/).
Sitewide Sales allows you to run Black Friday, Cyber Monday, or other flash sales on your WordPress-powered eCommerce or membership site.

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.

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.

Expand Down
135 changes: 135 additions & 0 deletions adminpages/report-csv.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php
//only admins can get this
if ( ! function_exists( "current_user_can" ) || ( ! current_user_can( "manage_options" ) ) ) {
die( __( "You do not have permissions to perform this action.", 'sitewide-sales' ) );
}

//get values from form
if(isset($_REQUEST['sitewide_sale'])) {
$id = intval($_REQUEST['sitewide_sale']);
$sitewide_sale = \Sitewide_Sales\classes\SWSales_Sitewide_Sale::get_sitewide_sale( $id );
$daily_revenue = $sitewide_sale->get_daily_sale_revenue();
$landing_page_post_id = $sitewide_sale->get_landing_page_post_id();

}

$headers = array();
$headers[] = "Content-Type: text/csv";
$headers[] = "Cache-Control: max-age=0, no-cache, no-store";
$headers[] = "Pragma: no-cache";
$headers[] = "Connection: close";

// Generate a filename based on the params.
$filename = $sitewide_sale->get_name() . "_" . date( "Y-m-d_H-i", current_time( 'timestamp' ) ) . ".csv";
$headers[] = "Content-Disposition: attachment; filename={$filename};";

$left_header= array (
"sale ID",
"sale name",
"landing page",
"start date",
"end date",
"banner reach",
"landing page visits",
"checkouts using coupon " . $sitewide_sale->get_coupon(),
"sale revenue",
"other new revenue",
"renewals",
"total revenue in period"
);

$csv_file_header_array = array_merge( $left_header, array_keys( $daily_revenue ) );

$dateformat = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );

// Generate a temporary file to store the data in.
$tmp_dir = apply_filters( 'swsales_report_csv_export_tmp_dir', sys_get_temp_dir() );

$filename = tempnam( $tmp_dir, 'sws_reportcsv_' );

// open in append mode
$csv_fh = fopen( $filename, 'a' );

//write the CSV header to the file
fputcsv( $csv_fh, $csv_file_header_array);

$csvoutput = array(
$id,
$sitewide_sale->get_name(),
get_permalink( $landing_page_post_id ),
$sitewide_sale->get_start_date(),
$sitewide_sale->get_end_date(),
$sitewide_sale->get_banner_impressions(),
$sitewide_sale->get_landing_page_visits(),
$sitewide_sale->get_checkout_conversions(),
$sitewide_sale->get_sale_revenue(),
$sitewide_sale->get_other_revenue(),
$sitewide_sale->get_renewal_revenue(),
$sitewide_sale->get_total_revenue()
);

$csvoutput = array_merge( $csvoutput, array_values( $daily_revenue ) );

fputcsv( $csv_fh, $csvoutput );

//flush the buffer
wp_cache_flush();

swsales_transmit_report_data( $csv_fh, $filename, $headers );


function swsales_transmit_report_data( $csv_fh, $filename, $headers = array() ) {

//close the temp file
fclose( $csv_fh );

if ( version_compare( phpversion(), '5.3.0', '>' ) ) {

//make sure we get the right file size
clearstatcache( true, $filename );
} else {
// for any PHP version prior to v5.3.0
clearstatcache();
}

//did we accidentally send errors/warnings to browser?
if ( headers_sent() ) {
echo str_repeat( '-', 75 ) . "<br/>\n";
echo 'Please open a support case and paste in the warnings/errors you see above this text to\n ';
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';
echo str_repeat( "=", 75 ) . "<br/>\n";
echo file_get_contents( $filename );
echo str_repeat( "=", 75 ) . "<br/>\n";
}

//transmission
if ( ! empty( $headers ) ) {
//set the download size
$headers[] = "Content-Length: " . filesize( $filename );

//set headers
foreach ( $headers as $header ) {
header( $header . "\r\n" );
}

// disable compression for the duration of file download
if ( ini_get( 'zlib.output_compression' ) ) {
ini_set( 'zlib.output_compression', 'Off' );
}

if( function_exists( 'fpassthru' ) ) {
// use fpassthru to output the csv
$csv_fh = fopen( $filename, 'rb' );
fpassthru( $csv_fh );
fclose( $csv_fh );
} else {
// use readfile() if fpassthru() is disabled (like on Flywheel Hosted)
readfile( $filename );
}

// remove the temp file
unlink( $filename );
}

exit;
}
21 changes: 4 additions & 17 deletions classes/class-swsales-about.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,12 @@ public static function show_about_page() { ?>
'strong' => array(),
'em' => array(), );
?>
<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>
<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>
<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>
<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>
<h2><?php esc_html_e( 'Getting Started', 'sitewide-sales' ); ?></h2>
<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' ); ?>" />
<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>
<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>
<ul class="ul-disc">
<li><?php esc_html_e( 'What is the main purpose for your sale?', 'sitewide-sales' ); ?></li>
<li><?php esc_html_e( 'What date will your sale begin?', 'sitewide-sales' ); ?></li>
<li><?php esc_html_e( 'When will your sale end?', 'sitewide-sales' ); ?></li>
<li><?php esc_html_e( 'If you\'re running a sale on products, which products will your discount apply for?', 'sitewide-sales' ); ?></li>
<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>
<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>
</ul>

<h2><?php esc_html_e( "We're here to help make your sale a measurable success.", 'sitewide-sales' ); ?></h2>

<?php
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>';
?>
<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>

<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>

Expand Down
9 changes: 5 additions & 4 deletions classes/class-swsales-landing-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ public static function the_content( $content ) {
// Load the sale.
$sitewide_sale = new SWSales_Sitewide_Sale();
$sale_found = $sitewide_sale->load_sitewide_sale( $sitewide_sale_id );
// The ID we have isn't a Sitewide Sale CPT, return the content.
if ( ! $sale_found ) {
$landing_template = $sitewide_sale->get_landing_page_template();

// 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.
if ( ! $sale_found || $landing_template == '0' ) {
return $content;
}

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

// Build the return string.
$r .= '<div class="swsales-landing-page-content swsales-landing-page-content-' . $sale_period . '">';
$r .= '<div class="swsales-landing-page-content swsales-landing-page-content-' . esc_attr( $sale_period ) . '">';
$r .= $content;
$r .= '</div>';

// Template specific filter only if we have a return string to adjust.
$landing_template = $sitewide_sale->get_landing_page_template();
if ( ! empty( $landing_template ) ) {
$r = apply_filters( 'swsales_landing_page_content_' . $landing_template, $r, $sitewide_sale );
}
Expand Down
4 changes: 2 additions & 2 deletions classes/class-swsales-license.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static function add_license_page() {
if ( swsales_license_is_valid( $key, NULL ) ) {
$span_color = '#33FF00';
} else {
$span_color = '#FF3333';
$span_color = '#FCD34D';
}
add_submenu_page(
'edit.php?post_type=sitewide_sale',
Expand Down Expand Up @@ -80,7 +80,7 @@ public static function show_license_page() {
<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>
<?php } else { ?>
<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>
<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>
<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>
<?php } ?>
</p>

Expand Down
Loading

0 comments on commit 8fdc69e

Please sign in to comment.