Premium Addons Pro.', 'premium-addons-for-elementor' );
echo wp_kses_post( $message );
?>
get_id();
$timer_type = $settings['premium_countdown_type'];
$reset = '';
$is_edit_mode = \Elementor\Plugin::$instance->editor->is_edit_mode();
if ( 'evergreen' === $timer_type && 'yes' === $settings['premium_countdown_eve_reset'] ) {
$transient_name = 'premium_evergreen_reset_' . $id;
if ( false === get_transient( $transient_name ) ) {
delete_option( 'premium_countdown_evergreen_' . $id );
$reset = true;
$reset_hours = empty( $settings['premium_countdown_eve_reset_hours'] ) ? 0 : $settings['premium_countdown_eve_reset_hours'] * HOUR_IN_SECONDS;
$reset_min = empty( $settings['premium_countdown_eve_reset_min'] ) ? 0 : $settings['premium_countdown_eve_reset_min'] * MINUTE_IN_SECONDS;
$expire_time = $reset_hours + $reset_min;
if ( ! $is_edit_mode && 0 !== $expire_time ) {
set_transient( $transient_name, 'DEFAULT', $expire_time );
}
}
}
$target_date = 'evergreen' === $timer_type ? $this->get_evergreen_time() : str_replace( '-', '/', $settings['premium_countdown_date_time'] );
$event = $settings['expiration_type'];
$text = '';
if ( 'url' === $event ) {
$text = esc_url( $settings['expiration_url'] );
} elseif ( 'restart' === $event ) {
if ( $is_edit_mode ) {
$last_target = $target_date;
} else {
$last_target = get_option( 'pa_countdown_target' . $id, false );
}
if ( ! $last_target ) {
$last_target = $target_date;
}
$is_date_passed = strtotime( $last_target ) < time();
if ( $is_date_passed ) {
$current_time = new DateTime();
$current_time->modify( '+' . $settings['restart_days'] . ' day' );
$current_time->modify( '+' . $settings['restart_hours'] . ' hours' );
$current_time->modify( '+' . $settings['restart_minutes'] . ' minutes' );
$target_date = str_replace( '-', '/', $current_time->format( 'Y-m-d H:i:s' ) );
} else {
$target_date = $last_target;
}
update_option( 'pa_countdown_target' . $id, $target_date );
}
// Used to sync time with WordPress.
$sent_time = '';
if ( 'wp-time' === $settings['timezone'] ) {
$sent_time = str_replace( '-', '/', current_time( 'mysql' ) );
}
if ( 'flipping' !== $settings['style'] ) {
$formats = $settings['premium_countdown_units'];
$format = implode( '', $formats );
// Singular labels set up.
$y = ! empty( $settings['premium_countdown_year_singular'] ) ? $settings['premium_countdown_year_singular'] : 'Year';
$m = ! empty( $settings['premium_countdown_month_singular'] ) ? $settings['premium_countdown_month_singular'] : 'Month';
$w = 'Week';
$d = ! empty( $settings['premium_countdown_day_singular'] ) ? $settings['premium_countdown_day_singular'] : 'Day';
$h = ! empty( $settings['premium_countdown_hour_singular'] ) ? $settings['premium_countdown_hour_singular'] : 'Hour';
$mi = ! empty( $settings['premium_countdown_minute_singular'] ) ? $settings['premium_countdown_minute_singular'] : 'Minute';
$s = ! empty( $settings['premium_countdown_second_singular'] ) ? $settings['premium_countdown_second_singular'] : 'Second';
$label = $y . ',' . $m . ',' . $w . ',' . $d . ',' . $h . ',' . $mi . ',' . $s;
// Plural labels set up.
$ys = ! empty( $settings['premium_countdown_year_plural'] ) ? $settings['premium_countdown_year_plural'] : 'Years';
$ms = ! empty( $settings['premium_countdown_month_plural'] ) ? $settings['premium_countdown_month_plural'] : 'Months';
$ws = 'Weeks';
$ds = ! empty( $settings['premium_countdown_day_plural'] ) ? $settings['premium_countdown_day_plural'] : 'Days';
$hs = ! empty( $settings['premium_countdown_hour_plural'] ) ? $settings['premium_countdown_hour_plural'] : 'Hours';
$mis = ! empty( $settings['premium_countdown_minute_plural'] ) ? $settings['premium_countdown_minute_plural'] : 'Minutes';
$ss = ! empty( $settings['premium_countdown_second_plural'] ) ? $settings['premium_countdown_second_plural'] : 'Seconds';
$labels1 = $ys . ',' . $ms . ',' . $ws . ',' . $ds . ',' . $hs . ',' . $mis . ',' . $ss;
$countdown_settings = array(
// 'single' => esc_html( $label ),
// 'plural' => esc_html( $labels1 ),
'until' => $target_date,
'serverSync' => $sent_time,
'format' => $format,
'event' => $event,
'changeTo' => $settings['change_digits'],
'text' => $text,
'separator' => 'custom' !== $settings['premium_countdown_separator_text'] ? $settings['premium_countdown_separator_text'] : $settings['custom_separator'],
'timerType' => $timer_type,
'unitsPos' => $settings['unit_position'],
'reset' => $reset,
'style' => $settings['style'],
);
if ( 'featured' === $settings['style'] ) {
$countdown_settings['featuredUnit'] = $settings['featured_unit'];
}
$this->add_render_attribute( 'inner_counter', 'class', 'premium-addons__v-hidden' );
} else {
$countdown_settings = array(
'until' => $target_date,
'serverSync' => $sent_time,
'event' => $event,
'text' => $text,
'timerType' => $timer_type,
'separator' => 'custom' !== $settings['premium_countdown_separator_text'] ? $settings['premium_countdown_separator_text'] : $settings['custom_separator'],
'reset' => $reset,
'style' => $settings['style'],
'lang' => $settings['flip_language'],
);
}
$this->add_render_attribute(
'container',
array(
'class' => array( 'premium-countdown', 'premium-countdown-separator-' . esc_attr( $settings['premium_countdown_separator'] ) ),
'data-settings' => wp_json_encode( $countdown_settings ),
)
);
$this->add_render_attribute(
'inner_counter',
array(
'class' => array(
'countdown',
'premium-countdown-init',
'premium-countdown-' . $settings['style'],
),
)
);
?>
get_render_attribute_string( 'container' ) ); ?>>
get_render_attribute_string( 'inner_counter' ) ); ?>>
print_text_editor( $settings['expiration_text'] ); ?>