Skip to content

Commit

Permalink
Merge pull request #1308 from laterpay/develop
Browse files Browse the repository at this point in the history
Tag 2.6.4
  • Loading branch information
thrijith authored Sep 30, 2019
2 parents 91ee1d3 + a4d113e commit 3bae4e6
Show file tree
Hide file tree
Showing 26 changed files with 635 additions and 468 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "laterpay/laterpay-wordpress-plugin",
"description": "This is the official LaterPay plugin for selling digital content with WordPress",
"license": "MIT",
"version": "2.6.3",
"version": "2.6.4",
"config": {
"vendor-dir": "laterpay/vendor",
"secure-http": true
Expand Down
72 changes: 37 additions & 35 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var gulp = require('gulp'),
// OPTIONS -------------------------------------------------------------------------------------------------------------
var gulpKnownOptions = {
string: 'version',
default: { version: '2.6.3' }
default: { version: '2.6.4' }
};
var gulpOptions = minimist(process.argv.slice(2), gulpKnownOptions);
gulpOptions.svn = {};
Expand Down
13 changes: 9 additions & 4 deletions laterpay/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Contributors: laterpay, dominik-rodler, mihail-turalenka, avahura, ahryb
Donate link: https://laterpay.net
Tags: laterpay, accept micropayments, accept payments, access control, billing, buy now pay later, content monetization, creditcard, debitcard, free to read, laterpay for wordpress, laterpay payment, laterpay plugin, micropayments, monetize, paid content, pay button, pay per use, payments, paywall, PPU, sell digital content, sell digital goods, single sale, wordpress laterpay, Payments, Content Monetization, Paywall, Paid Content, Publisher, Blogger, conversion, paygate, monetization
Requires at least: 4.6
Tested up to: 5.2.2
Stable tag: 2.6.3
Tested up to: 5.2.3
Stable tag: 2.6.4
Author URI: https://laterpay.net
Plugin URI: https://github.com/laterpay/laterpay-wordpress-plugin
License: MIT
Expand Down Expand Up @@ -88,6 +88,11 @@ Yes!
6. The plugin provides a variety of advanced settings to customize the LaterPay plugin and adjust it to your needs.

== Changelog ==
= 2.6.4 ( September 30, 2019 ) =
* Add `laterpay_purchase_completed` hook.
* Update Dynamic Pricing to allow selection of days up to 366.
* Ensure pricing configurations allow for articles which only provide Time Pass and Subscription purchase options as well as articles which display all purchase options.

= 2.6.3 ( August 21, 2019 ) =
* Add option to disable LaterPay queries on home page under Settings > LaterPay > Technical.
* Add a check to verify credentials before adding purchase dialog on content.
Expand Down Expand Up @@ -664,8 +669,8 @@ KNOWN BUGS:

== Upgrade notice ==

= 2.6.3 ( August 21, 2019 ) =
Add option to disable content access check on home page, Add a check to verify credentials before adding purchase dialog on content and minor bug fixes with LaterPay functionality.
= 2.6.4 ( September 30, 2019 ) =
Add `laterpay_purchase_completed` hook, fix post pricing bugs, allow selection of upto 366 days in Dynamic Pricing and minor bug fixes with LaterPay functionality.

== Arbitrary section ==

Expand Down
12 changes: 5 additions & 7 deletions laterpay/application/Controller/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,12 +889,10 @@ public static function register_common_scripts( $page, $data_for_localize = [] )
$ga_data['update_highlights'] = get_option( 'lp_update_highlights', [] );

if ( ! empty( $ga_data['update_highlights']['version'] ) ) {
$version_update_number = $ga_data['update_highlights']['version'];
$ga_data['update_highlights']['version'] = '';
$ga_data['update_highlights']['notice'] = '';
$ga_data['update_highlights']['notice_link'] = '';
$ga_data['update_highlights']['notice_extra'] = '';
$ga_data['update_highlights_nonce'] = wp_create_nonce( 'update_highlights_nonce' );
$version_update_number = $ga_data['update_highlights']['version'];
$ga_data['update_highlights']['version'] = sprintf( esc_html__( 'Version %s Highlights:', 'laterpay' ), $version_update_number );
$ga_data['update_highlights']['notice'] = sprintf( esc_html__( 'Have you seen our Contextual Help? Click the Help box in the upper right corner of any page to get relevant information.', 'laterpay' ) );
$ga_data['update_highlights_nonce'] = wp_create_nonce( 'update_highlights_nonce' );
}

$data_for_localize['lp_instructional_info'] = [];
Expand All @@ -904,7 +902,7 @@ public static function register_common_scripts( $page, $data_for_localize = [] )
$tab_information = [
'appearance' => sprintf( __( '%sOptional%s Use the appearance tab to configure your payment button colors and how your pricing options are displayed.', 'laterpay' ), '<b>', '</b>' ),
'pricing' => sprintf( __( '%sREQUIRED%s Use this tab to configure your default prices. Prices can also be set for an individual post on the edit post page.', 'laterpay' ), '<b>', '</b>' ),
'advanced' => sprintf( __( '%sOptional%s Here we highlight advanced features & settings like contributions, selling downloadable content, and promoting your subscriptions. Scroll through to learn more!', 'laterpay' ), '<b>', '</b>' ),
'advanced' => sprintf( __( '%sOptional%s Here we highlight advanced features & settings like selling downloadable content and promoting your subscriptions. Scroll through to learn more!', 'laterpay' ), '<b>', '</b>' ),
];

$tab_information_status = get_option( 'lp_tabular_info' );
Expand Down
5 changes: 1 addition & 4 deletions laterpay/application/Controller/Admin/Post/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function add_data_to_posts_table( LaterPay_Core_Event $event ) {
$global_default_price = get_option( 'laterpay_global_price' );
$is_global_zero = ( floatval( 0.00 ) === (float) $global_default_price );

$is_price_zero = floatval( 0.00 ) === floatval( $price );
$post_price_type_one = ( 1 === $post_price_behaviour );
$is_time_pass_subscription_count_zero = ( ( 0 === count( $time_passes_list ) ) && ( 0 === count( $subscriptions_list ) ) );
$is_post_type_not_supported = ( ! in_array( get_post_type( $post_id ), (array) get_option( 'laterpay_enabled_post_types' ), true ) );
Expand All @@ -89,9 +88,7 @@ public function add_data_to_posts_table( LaterPay_Core_Event $event ) {

$is_global_price_type = LaterPay_Helper_Pricing::is_price_type_global( $post_price_type );

$is_price_zero_and_type_not_global = ( $is_price_zero && LaterPay_Helper_Pricing::is_price_type_not_global( $post_price_type ) );

if ( ( empty( $post_price_type ) || $is_global_price_type ) || ( $is_price_zero_and_type_not_global ) || ( $is_individual_free ) ) {
if ( ( empty( $post_price_type ) || $is_global_price_type ) || ( $is_individual_free ) ) {
esc_html_e( 'FREE', 'laterpay' );
} else {
/* translators: %1$s post price, %2$s currency code */
Expand Down
13 changes: 5 additions & 8 deletions laterpay/application/Controller/Frontend/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ public function modify_post_content( LaterPay_Core_Event $event ) {
// check, if user has admin rights
$user_has_unlimited_access = LaterPay_Helper_User::can( 'laterpay_has_full_access_to_content', $post );
$preview_post_as_visitor = LaterPay_Helper_User::preview_post_as_visitor( $post );
$post_price = LaterPay_Helper_Pricing::get_post_price( $post->ID );

// switch to 'admin' mode and load the correct content, if user can read post statistics
if ($user_has_unlimited_access && ! $preview_post_as_visitor ) {
Expand All @@ -490,7 +491,7 @@ public function modify_post_content( LaterPay_Core_Event $event ) {
$subscriptions_list = LaterPay_Helper_Subscription::get_subscriptions_list_by_post_id( $post->ID, null, true );

// Check if no individual post type is allowed.
if ( $post_price_type_one || LaterPay_Helper_Pricing::is_post_price_type_two_price_zero() ) {
if ( $post_price_type_one || ( LaterPay_Helper_Pricing::is_post_price_type_two_price_zero() && floatval( 0.00 ) === $post_price ) ) {

// Check if no timepass/subscription exists.
if ( ( 0 === count( $time_passes_list ) ) && ( 0 === count( $subscriptions_list ) ) ) {
Expand All @@ -500,15 +501,11 @@ public function modify_post_content( LaterPay_Core_Event $event ) {
}
} elseif ( 0 === $post_price_behaviour ) {

$post_price = LaterPay_Helper_Pricing::get_post_price( $post->ID );
$post_price_type = LaterPay_Helper_Pricing::get_post_price_type( $post->ID );
$is_price_zero = floatval( 0.00 ) === floatval( $post_price );

// If Global Default Price is FREE, then allow access.
$post_price_type = LaterPay_Helper_Pricing::get_post_price_type( $post->ID );
$is_global_price_type = LaterPay_Helper_Pricing::is_price_type_global( $post_price_type );

$is_price_zero_and_type_not_global = ( $is_price_zero && LaterPay_Helper_Pricing::is_price_type_not_global( $post_price_type ) );

if ( ( empty( $post_price_type ) || $is_global_price_type ) || $is_price_zero_and_type_not_global ) {
if ( empty( $post_price_type ) || $is_global_price_type ) {
$access = true;
}
}
Expand Down
8 changes: 6 additions & 2 deletions laterpay/application/Controller/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public function update_default_pricing_behaviour() {
return;
}

if ( false === get_option( 'laterpay_post_price_behaviour' ) ) {
if ( false === get_option( 'laterpay_post_price_behaviour' ) && version_compare( $current_version, '2.6.3', '<=' ) ) {
$only_timepass = (bool) get_option( 'laterpay_only_time_pass_purchases_allowed' );
$current_global_price = ( float) get_option( 'laterpay_global_price' );

Expand All @@ -535,6 +535,8 @@ public function update_default_pricing_behaviour() {
}

delete_option( 'laterpay_only_time_pass_purchases_allowed' );
} else {
update_option( 'laterpay_post_price_behaviour', 0 );
}
}

Expand Down Expand Up @@ -683,7 +685,9 @@ public function add_update_highlights() {

if ( ! empty( $current_version ) ) {

$update_highlights = [];
$update_highlights = [
'version' => '2.6.4',
];

update_option( 'lp_update_highlights', $update_highlights );
return;
Expand Down
8 changes: 3 additions & 5 deletions laterpay/application/Helper/Pricing.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ public static function is_purchasable( $post_id = null ) {

$is_global_price_type = LaterPay_Helper_Pricing::is_price_type_global( $post_price_type );

$is_price_zero_and_type_not_global = ( $is_price_zero && LaterPay_Helper_Pricing::is_price_type_not_global( $post_price_type ) );

if ( ( empty( $post_price_type ) || $is_global_price_type ) || ( $is_price_zero_and_type_not_global ) ) {
if ( empty( $post_price_type ) || $is_global_price_type ) {
return null;
}
} elseif ( $post_price_type_one ) {
Expand All @@ -101,8 +99,8 @@ public static function is_purchasable( $post_id = null ) {
return null;
}
} elseif ( 2 === $post_price_behaviour ) {
if ( ( ( $is_price_zero || self::is_post_price_type_two_price_zero() ) &&
$is_time_pass_subscription_count_zero ) || $is_post_type_not_supported ) {
if ( ( $is_price_zero && self::is_post_price_type_two_price_zero()
&& $is_time_pass_subscription_count_zero ) || $is_post_type_not_supported ) {
// returns null for this case
return null;
}
Expand Down
Loading

0 comments on commit 3bae4e6

Please sign in to comment.