Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments to the promotion notices for Modula #1154

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Modula.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://wp-modula.com/
* Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
* Author: WPChill
* Version: 2.11.5
* Version: 2.11.6
* Author URI: https://www.wpchill.com/
* License: GPLv3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -47,7 +47,7 @@
* @since 2.0.2
*/

define( 'MODULA_LITE_VERSION', '2.11.5' );
define( 'MODULA_LITE_VERSION', '2.11.6' );
define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
defined( 'MODULA_PRO_STORE_URL' ) || define( 'MODULA_PRO_STORE_URL', 'https://wp-modula.com' );
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
== Changelog ==
= 2.11.6 - 06.12.2024 =
Changed: Adjustments to the promotion notices for Modula

= 2.11.5 - 05.12.2024 =
Fixed: Resolved infinite REST notification retries when the user lacks the manage_options capability.
Fixed: Addressed an undefined JavaScript error that occurred outside the Modula edit screen.
Expand Down
78 changes: 73 additions & 5 deletions includes/class-modula.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,25 @@ public function no_drag_classes( $classes ) {
* @since 2.7.9
*/
private function set_offer() {
$month = date( 'm' );
$timezone_string = get_option( 'timezone_string' );
$timezone = $timezone_string ? new DateTimeZone( $timezone_string ) : new DateTimeZone( 'UTC' );

if ( 11 == $month ) {
$now = new DateTime( 'now', $timezone );

$bf_start = new DateTime( '2024-11-01 00:00:00', $timezone );
$bf_end = new DateTime( '2024-12-09 10:00:00', $timezone );

$cym_start = new DateTime( '2024-12-09 10:01:00', $timezone );
$cym_end = new DateTime( '2024-12-13 16:00:00', $timezone );

if ( $now >= $bf_start && $now <= $bf_end ) {
add_filter( 'modula_upsell_buttons', array( $this, 'bf_buttons' ), 15, 2 );
add_action( 'admin_print_styles', array( $this, 'footer_bf_styles' ), 999 );
}
if ( 12 == $month ) {
add_filter( 'modula_upsell_buttons', array( $this, 'xmas_buttons' ), 15, 2 );
add_action( 'admin_print_styles', array( $this, 'footer_xmas_styles' ), 999 );

if ( $now >= $cym_start && $now <= $cym_end ) {
add_filter( 'modula_upsell_buttons', array( $this, 'cyber_m_buttons' ), 15, 2 );
add_action( 'admin_print_styles', array( $this, 'footer_cyber_m_styles' ), 999 );
}
}

Expand Down Expand Up @@ -641,6 +651,19 @@ public function xmas_buttons( $buttons, $campaign ) {
return $buttons;
}

/**
* Replaces upsells button with Cyber Monday text buttons
*
* @since 2.11.6
*/
public function cyber_m_buttons( $buttons, $campaign ) {
preg_match_all( '~<a(.*?)href="([^"]+)"(.*?)>~', $buttons, $matches );

$buttons = '<a target="_blank" href="' . esc_url( $matches[2][0] ) . '" class="button">' . esc_html__( 'Free vs Premium', 'modula-best-grid-gallery' ) . '</a>';
$buttons .= '<a target="_blank" href="' . esc_url( $matches[2][1] ) . '" style="margin-top:10px;" class="wpchill-cyber-m-upsell button">' . esc_html__( '25% OFF for Cyber Monday', 'modula-best-grid-gallery' ) . '</a>';
return $buttons;
}

/**
* Echoes Black Friday script to footer
*
Expand Down Expand Up @@ -686,6 +709,51 @@ public function footer_bf_styles() {
echo $css;
}

/**
* Echoes Cyber Monday script to footer
*
* @since 2.11.6
*/
public function footer_cyber_m_styles() {

$css = '<style>
.modula-upsell,
#poststuff .modula-upsell h2,
.modula-modal__overlay .modula-modal__frame,
.modula-settings-tab-upsell {
color: #fff;
background-color: #000;
}
.modula-upsell p,
.modula-upsell p.modula-upsell-description,
.modula-modal__overlay .modula-modal__frame h2,
.modula-settings-tab-upsell h3,
.modula-settings-tab-upsell p {
color: #fff;
}
.wpchill-cyber-m-upsell.button {
background-color: #2271b1;
border: none;
color: #fff;
font-weight: 600;
}
.wpchill-cyber-m-upsell.button:hover {
background-color: red;
border: none;
color: #fff;
font-weight: 600;
}
.modula-tooltip .modula-tooltip-content{
background-color: #fff;
color: #000;
}
.modula-settings-tab-upsell{
margin-top: 10px;
}
</style>';
echo $css;
}

/**
* Echoes Christmas style to footer
*
Expand Down
Loading
Loading