Skip to content
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog #

## v2.8.1 (November 11, 2026) ##

- Fix: Security fixes.

## v2.8.0 (November 10, 2026) ##

- Feat: Videos can now have captions in several languages. In the video editor's Transcription tab, add, edit, replace or remove a caption file for any language and choose which one shows by default. Visitors pick a language from the player's subtitles menu. Needs a paid GoDAM plan.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Tested up to: 7.1

Requires PHP: 7.4

Stable tag: 2.8.0
Stable tag: 2.8.1

License: [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html)

Expand Down
20 changes: 2 additions & 18 deletions assets/src/css/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1205,22 +1205,15 @@ to ensure proper responsiveness and avoid layout issues.
}
}

/* Seasonal offer notice (Halloween 2026), shown on the Dashboard and Media Library. */
/* Seasonal offer notice (Black Friday 2026), shown on the Dashboard and Media Library. */
.rtgodam-offer-notice {
position: relative;
display: flex;
gap: 8px;
padding: 14px 44px 14px 0;
padding: 14px 44px 14px 16px;
border-left-color: #5d31ff;
overflow: hidden;

&__art {
flex: none;
width: 92px;
height: 104px;
margin-top: -14px;
}

&__body p {
margin: 0;
padding: 0;
Expand All @@ -1237,11 +1230,6 @@ to ensure proper responsiveness and avoid layout issues.
color: #5d31ff;
}

&__pumpkin {
width: 18px;
height: 18px;
}

.rtgodam-offer-notice__title {
font-size: 20px;
line-height: 1.25;
Expand Down Expand Up @@ -1363,9 +1351,5 @@ to ensure proper responsiveness and avoid layout issues.
& {
padding-left: 12px;
}

&__art {
display: none;
}
}
}
4 changes: 2 additions & 2 deletions godam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: GoDAM
* Plugin URI: https://godam.io
* Description: Seamlessly manage and deliver your media assets directly from the cloud-based media management. Store assets efficiently, stream them via a CDN, and enhance your website's performance and user experience. Featuring adaptive bit rate streaming, adding interactive layers in videos, and taking full advantage of a digital asset management solution within WordPress.
* Version: 2.8.0
* Version: 2.8.1
* Requires at least: 6.5
* Requires PHP: 7.4
* Text Domain: godam
Expand Down Expand Up @@ -43,7 +43,7 @@
/**
* The version of the plugin
*/
define( 'RTGODAM_VERSION', '2.8.0' );
define( 'RTGODAM_VERSION', '2.8.1' );
}

if ( ! defined( 'RTGODAM_API_BASE' ) ) {
Expand Down
135 changes: 71 additions & 64 deletions inc/classes/class-offer-notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
/**
* Seasonal offer notice shown in wp-admin to free and trial sites.
*
* The current campaign is the Halloween 2026 offer: 50% off the first payment
* with the code SPOOKY50, through November 9. The message names the
* integrations the site already uses, so a LifterLMS site reads about course
* videos and a WooCommerce store about shoppable video.
* Each campaign has fixed dates, a code and its own dismissal: today only the
* Black Friday and Cyber Monday 2026 offer (BFCM2026, November 13 to December 3).
* Nothing shows outside a campaign's dates, so nothing repeats next year. The
* message names the integrations the site already uses, so a LifterLMS site
* reads about course videos and a WooCommerce store about shoppable video.
*
* @package GoDAM
* @since 2.5.2
Expand All @@ -23,27 +24,31 @@
class Offer_Notice {

/**
* Option that stores the dismissal for this campaign only.
* The campaigns, in date order.
*
* A new key per campaign, so a site that dismissed an earlier offer still sees this one.
* `start` and `end` are the first and last moment the notice shows, in the site's time zone,
* matching the offer on godam.io. Each campaign has its own dismiss option, so a site that
* dismissed an earlier offer still sees the next one. `path` is the godam.io page the Claim
* button opens, and `utm` its tracking (`utm_content` is added per placement and message).
*
* @var string
*/
const DISMISS_OPTION = 'rtgodam_offer_halloween_2026_dismissed';

/**
* Last moment the notice shows, in the site's time zone. Matches the offer on godam.io.
*
* @var string
*/
const END_TIME = '2026-11-09 23:59:59';

/**
* Offer code.
* @since 2.8.1
*
* @var string
* @var array
*/
const CODE = 'SPOOKY50';
const CAMPAIGNS = array(
'bfcm-2026' => array(
'start' => '2026-11-13 00:00:00',
'end' => '2026-12-03 23:59:59',
'code' => 'BFCM2026',
'dismiss_option' => 'rtgodam_offer_bfcm_2026_dismissed',
'path' => '/pricing/',
'utm' => array(
'utm_source' => 'godam-plugin',
'utm_medium' => 'admin-notice',
'utm_campaign' => 'bfcm2026',
),
),
);

/**
* AJAX action and nonce action for dismissing the notice.
Expand All @@ -70,19 +75,34 @@ public static function should_show( $now = null, $user_data = null ) {
return false;
}

if ( get_option( self::DISMISS_OPTION, false ) ) {
$campaign = self::get_campaign( $now );
if ( ! $campaign || get_option( self::CAMPAIGNS[ $campaign ]['dismiss_option'], false ) ) {
return false;
}

return self::is_free_or_trial_site( $user_data );
}

/**
* The campaign running at the given moment, in the site's time zone.
*
* @since 2.8.1
*
* @param \DateTimeInterface|null $now The moment to check, now when null. Tests pass a fixed time.
*
* @return string|null A key of CAMPAIGNS, or null between and after campaigns.
*/
public static function get_campaign( $now = null ) {
$timezone = wp_timezone();
$now = $now ? $now : new \DateTime( 'now', $timezone );
$end_time = new \DateTime( self::END_TIME, $timezone );

if ( $now > $end_time ) {
return false;
foreach ( self::CAMPAIGNS as $key => $campaign ) {
if ( $now >= new \DateTime( $campaign['start'], $timezone ) && $now <= new \DateTime( $campaign['end'], $timezone ) ) {
return $key;
}
}

return self::is_free_or_trial_site( $user_data );
return null;
}

/**
Expand Down Expand Up @@ -229,52 +249,34 @@ public static function get_message( $integrations ) {
* @return void
*/
public static function render( $placement, $now = null, $user_data = null ) {
// Read the clock once, so a campaign that ends mid-request cannot pass should_show() and then be gone.
$now = $now ? $now : new \DateTime( 'now', wp_timezone() );

if ( ! self::should_show( $now, $user_data ) ) {
return;
}

$campaign_key = self::get_campaign( $now );
$campaign = self::CAMPAIGNS[ $campaign_key ];
$integrations = self::get_active_integrations();
$message = self::get_message( $integrations );
$chips = array_slice( array_unique( array_column( $integrations, 'name' ) ), 0, 3 );
$host = wp_parse_url( home_url(), PHP_URL_HOST );
$claim_url = add_query_arg(
array(
'utm_campaign' => 'halloween-2026',
'utm_source' => $host,
'utm_medium' => 'plugin',
'utm_content' => $placement . '-' . $message['key'],
),
RTGODAM_IO_API_BASE . '/pricing/'
);
$utm = $campaign['utm'];

$utm['utm_content'] = $placement . '-' . $message['key'];
$claim_url = add_query_arg( $utm, RTGODAM_IO_API_BASE . $campaign['path'] );
?>
<div class="notice rtgodam-offer-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( self::DISMISS_ACTION ) ); ?>">
<svg class="rtgodam-offer-notice__art" viewBox="0 0 92 104" width="92" height="104" aria-hidden="true" focusable="false">
<g stroke="#b9aee8" stroke-width="1" fill="none">
<path d="M0 0 L80 0"/><path d="M0 0 L70 40"/><path d="M0 0 L40 72"/><path d="M0 0 L0 90"/>
<path d="M18 0 Q20 12 12 14 Q6 18 0 18"/><path d="M38 0 Q42 22 28 30 Q14 36 0 38"/><path d="M58 0 Q62 32 42 46 Q22 56 0 58"/>
</g>
<line x1="62" y1="14" x2="62" y2="62" stroke="#787c82" stroke-width="1"/>
<g fill="#2b1a66"><ellipse cx="62" cy="70" rx="6.5" ry="7.5"/><circle cx="62" cy="60" r="4.5"/></g>
<g stroke="#2b1a66" stroke-width="1.5" fill="none" stroke-linecap="round"><path d="M57 65 l-7 -5 M56 70 l-8 0 M57 75 l-7 6 M67 65 l7 -5 M68 70 l8 0 M67 75 l7 6"/></g>
<circle cx="60.5" cy="59" r="1" fill="#fff"/><circle cx="63.5" cy="59" r="1" fill="#fff"/>
</svg>
<div class="rtgodam-offer-notice__body">
<p class="rtgodam-offer-notice__eyebrow">
<?php esc_html_e( 'Halloween offer', 'godam' ); ?>
<svg class="rtgodam-offer-notice__pumpkin" viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false">
<path d="M12 6c-1-2 0-4 2-4" stroke="#5d31ff" stroke-width="1.6" fill="none" stroke-linecap="round"/>
<ellipse cx="7.5" cy="14" rx="5" ry="7" fill="#7a57ff"/><ellipse cx="16.5" cy="14" rx="5" ry="7" fill="#7a57ff"/><ellipse cx="12" cy="14" rx="4" ry="7.5" fill="#5d31ff"/>
<path d="M8 12l2-2 1 2zM13 12l2-2 1 2zM8 16q4 3 8 0l-1.5 1-1.2-.8-1.3 1-1.3-1-1.2.8z" fill="#fff"/>
</svg>
<?php esc_html_e( 'Black Friday and Cyber Monday offer', 'godam' ); ?>
</p>
<p class="rtgodam-offer-notice__title">
<?php
/* translators: %s: the discount, shown in the accent colour, for example "Get 50% off". */
$title = esc_html__( 'Black Friday and Cyber Monday deal: %s GoDAM', 'godam' );
echo wp_kses(
sprintf(
/* translators: %s: the discount, shown in the accent colour, for example "Get 50% off". */
esc_html__( 'No tricks, just treats: %s GoDAM!', 'godam' ),
'<span>' . esc_html__( 'Get 50% off', 'godam' ) . '</span>'
),
sprintf( $title, '<span>' . esc_html__( 'Get 50% off', 'godam' ) . '</span>' ),
array( 'span' => array() )
);
?>
Expand All @@ -299,20 +301,20 @@ public static function render( $placement, $now = null, $user_data = null ) {
</a>
<?php
/* translators: %s: offer code. */
$copy_label = sprintf( __( 'Copy the code %s', 'godam' ), self::CODE );
$copy_label = sprintf( __( 'Copy the code %s', 'godam' ), $campaign['code'] );
?>
<span class="rtgodam-offer-notice__code-group">
<span class="rtgodam-offer-notice__code-label"><?php esc_html_e( 'Code', 'godam' ); ?></span>
<button type="button" class="rtgodam-offer-notice__copy" data-code="<?php echo esc_attr( self::CODE ); ?>" data-copied="<?php esc_attr_e( 'Copied', 'godam' ); ?>" aria-label="<?php echo esc_attr( $copy_label ); ?>">
<span class="rtgodam-offer-notice__copy-text"><?php echo esc_html( self::CODE ); ?></span>
<button type="button" class="rtgodam-offer-notice__copy" data-code="<?php echo esc_attr( $campaign['code'] ); ?>" data-copied="<?php esc_attr_e( 'Copied', 'godam' ); ?>" aria-label="<?php echo esc_attr( $copy_label ); ?>">
<span class="rtgodam-offer-notice__copy-text"><?php echo esc_html( $campaign['code'] ); ?></span>
<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false"><rect x="8" y="8" width="12" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>
</button>
</span>
<span class="screen-reader-text rtgodam-offer-notice__status" role="status" aria-live="polite" data-message="<?php esc_attr_e( 'Code copied', 'godam' ); ?>"></span>
</p>
<p class="rtgodam-offer-notice__ends">
<span class="dashicons dashicons-calendar-alt" aria-hidden="true"></span>
<?php esc_html_e( 'Through November 9. Don\'t let this treat disappear!', 'godam' ); ?>
<?php esc_html_e( 'Ends December 3 at 11:59 p.m. 50% off your first month or year on any plan.', 'godam' ); ?>
</p>
</div>
<button type="button" class="notice-dismiss rtgodam-offer-notice__dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this offer', 'godam' ); ?></span></button>
Expand All @@ -321,20 +323,25 @@ public static function render( $placement, $now = null, $user_data = null ) {
}

/**
* Save the dismissal for the whole site.
* Save the dismissal of the running campaign for the whole site.
*
* @since 2.5.2
*
* @param \DateTimeInterface|null $now The moment to check, now when empty. Tests pass a fixed time.
*
* @return void
*/
public static function dismiss() {
public static function dismiss( $now = null ) {
check_ajax_referer( self::DISMISS_ACTION, 'nonce' );

if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( array( 'message' => __( 'You are not allowed to dismiss this offer.', 'godam' ) ), 403 );
}

update_option( self::DISMISS_OPTION, time(), false );
$campaign = self::get_campaign( $now instanceof \DateTimeInterface ? $now : null );
if ( $campaign ) {
update_option( self::CAMPAIGNS[ $campaign ]['dismiss_option'], time(), false );
}

wp_send_json_success();
}
Expand Down
Loading
Loading