Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
?>
|
||||
|
||||
<div class="imagify-admin-bar-quota">
|
||||
<div class="imagify-abq-row">
|
||||
<?php if ( $data['plan_with_quota'] ) : ?>
|
||||
<div class="imagify-meteo-icon"><?php echo $data['quota_icon']; ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="imagify-account">
|
||||
<p class="imagify-meteo-title"><?php esc_html_e( 'Account status', 'imagify' ); ?></p>
|
||||
<p class="imagify-meteo-subs"><?php esc_html_e( 'Your subscription:', 'imagify' ); ?> <strong class="imagify-user-plan"><?php echo $data['plan_label']; ?></strong></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $data['plan_with_quota'] ) : ?>
|
||||
<div class="imagify-abq-row">
|
||||
<div class="imagify-space-left">
|
||||
<p><?php
|
||||
printf(
|
||||
// translators: %s = percentage.
|
||||
__( 'You have %s space credit left', 'imagify' ), '<span class="imagify-unconsumed-percent">' . $data['unconsumed_quota'] . '%</span>' );
|
||||
?></p>
|
||||
<div class="<?php echo esc_attr( $data['quota_class'] ); ?>">
|
||||
<div style="width: <?php echo esc_attr( $data['unconsumed_quota'] ); ?>%;" class="imagify-unconsumed-bar imagify-progress"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( $data['plan_with_quota'] && $data['unconsumed_quota'] <= 20 ) : ?>
|
||||
<div class="imagify-upsell-admin-bar">
|
||||
<?php if ( $data['unconsumed_quota'] <= 20 ) : ?>
|
||||
<p><i class="dashicons dashicons-warning" aria-hidden="true"></i><strong><?php esc_html_e( 'Oops, It\'s almost over!', 'imagify' ); ?></strong></p>
|
||||
<?php elseif ( 0 === $data['unconsumed_quota'] ) : ?>
|
||||
<p><i class="dashicons dashicons-warning" aria-hidden="true"></i><strong><?php esc_html_e( 'Oops, It\'s Over!', 'imagify' ); ?></strong></p>
|
||||
<?php endif; ?>
|
||||
<p><?php echo $data['text']; ?></p>
|
||||
<p class="center txt-center text-center"><a class="imagify-upsell-admin-bar-button" href="<?php echo esc_url( $data['upgrade_link'] ); ?>" target="_blank"><?php echo $data['button_text']; ?></a></p>
|
||||
<a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'upsell-admin-bar' ) ); ?>" class="imagify-notice-dismiss imagify-upsell-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice', 'imagify' ); ?></span></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
$this->print_template( 'notice-header', array(
|
||||
'classes' => array( 'imagify-flex-notice-content', 'error' ),
|
||||
) );
|
||||
|
||||
$views = Imagify_Views::get_instance();
|
||||
?>
|
||||
<div class="imagify-notice-quota">
|
||||
<div class="imagify-flex imagify-vcenter">
|
||||
<span class="imagify-meteo-icon imagify-noshrink"><?php echo $views->get_quota_icon(); ?></span>
|
||||
<div class="imagify-space-left">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s is a data quota. */
|
||||
esc_html__( 'You have %s space credit left', 'imagify' ),
|
||||
'<span class="imagify-unconsumed-percent">' . $views->get_quota_percent() . '%</span>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<div class="<?php echo $views->get_quota_class(); ?>">
|
||||
<div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $views->get_quota_percent() . '%'; ?>;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<?php esc_html_e( 'You are running out of credit! Don’t forget to upgrade your Imagify’s account.', 'imagify' ); ?>
|
||||
</p>
|
||||
<div class="imagify-notice-quota-btn-container">
|
||||
<a target="_blank" class="button imagify-button imagify-button-secondary button-mini" href="<?php echo esc_url( imagify_get_external_url( 'subscription' ) ); ?>"><?php esc_html_e( 'See our plans', 'imagify' ); ?></a>
|
||||
</div>
|
||||
<?php
|
||||
$this->print_template( 'notice-footer', array(
|
||||
'dismissible' => 'almost-over-quota',
|
||||
) );
|
||||
@@ -15,7 +15,7 @@ foreach ( $notices as $type => $type_notices ) {
|
||||
?>
|
||||
<div class="<?php echo $type; ?> settings-error notice is-dismissible">
|
||||
<?php foreach ( $type_notices as $details ) { ?>
|
||||
<p><strong><?php echo $details['message']; ?></strong></p>
|
||||
<p><strong><?php echo wp_kses( $details['message'], [ 'code' => [] ] ); ?></strong></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Imagify\User\User;
|
||||
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
?>
|
||||
<div class="wrap imagify-settings imagify-bulk">
|
||||
@@ -85,8 +88,11 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
<div class="imagify-col imagify-account-info-col">
|
||||
|
||||
<?php
|
||||
if ( ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || ! IMAGIFY_HIDDEN_ACCOUNT ) && Imagify_Requirements::is_api_key_valid() ) {
|
||||
$user = new Imagify_User();
|
||||
if (
|
||||
( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || ! IMAGIFY_HIDDEN_ACCOUNT )
|
||||
&&
|
||||
Imagify_Requirements::is_api_key_valid()
|
||||
) {
|
||||
?>
|
||||
<div class="imagify-options-title">
|
||||
<div class="imagify-th-titles imagify-flex imagify-vcenter">
|
||||
@@ -97,60 +103,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
</div>
|
||||
<a href="<?php echo esc_url( imagify_get_external_url( 'subscription' ) ); ?>" target="_blank"><?php _e( 'View your profile', 'imagify' ); ?></a>
|
||||
</div>
|
||||
|
||||
<?php if ( $user && 1 === $user->plan_id ) { ?>
|
||||
<div class="imagify-col-content">
|
||||
<div class="imagify-flex imagify-vcenter">
|
||||
<span class="imagify-meteo-icon imagify-noshrink"><?php echo $this->get_quota_icon(); ?></span>
|
||||
<div class="imagify-space-left imagify-full-width">
|
||||
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s is a data quota. */
|
||||
__( 'You have %s space credit left', 'imagify' ),
|
||||
'<span class="imagify-unconsumed-percent">' . $this->get_quota_percent() . '%</span>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<div class="<?php echo $this->get_quota_class(); ?>">
|
||||
<div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $this->get_quota_percent() . '%'; ?>;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Filter whether the plan chooser section is displayed.
|
||||
*
|
||||
* @param $show_new bool Default to true: display the section.
|
||||
*/
|
||||
if ( apply_filters( 'imagify_show_new_to_imagify', true ) ) {
|
||||
?>
|
||||
<div class="imagify-block-secondary">
|
||||
<p class="imagify-section-title imagify-h3-like">
|
||||
<?php
|
||||
if ( ! $this->get_quota_percent() ) {
|
||||
esc_html_e( 'Oops, It\'s Over!', 'imagify' );
|
||||
} elseif ( $this->get_quota_percent() <= 20 ) {
|
||||
esc_html_e( 'Oops, It\'s almost over!', 'imagify' );
|
||||
} else {
|
||||
esc_html_e( 'You\'re new to Imagify?', 'imagify' );
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p><?php esc_html_e( 'Let us help you by analyzing your existing images and determine the best plan for you.', 'imagify' ); ?></p>
|
||||
|
||||
<button id="imagify-get-pricing-modal" data-nonce="<?php echo wp_create_nonce( 'imagify_get_pricing_' . get_current_user_id() ); ?>" data-target="#imagify-pricing-modal" type="button" class="imagify-modal-trigger imagify-button imagify-button-light imagify-button-big imagify-full-width">
|
||||
<i class="dashicons dashicons-dashboard" aria-hidden="true"></i>
|
||||
<span class="button-text"><?php _e( 'What plan do I need?', 'imagify' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div><!-- .imagify-col-content -->
|
||||
<?php } // End if(). ?>
|
||||
<?php $this->print_template( 'part-upsell' ); ?>
|
||||
<?php } // End if(). ?>
|
||||
|
||||
</div><!-- .imagify-account-info-col -->
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Imagify\User\User;
|
||||
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
if ( defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) && IMAGIFY_HIDDEN_ACCOUNT ) {
|
||||
@@ -12,9 +15,7 @@ if ( defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) && IMAGIFY_HIDDEN_ACCOUNT ) {
|
||||
}
|
||||
|
||||
if ( Imagify_Requirements::is_api_key_valid() ) {
|
||||
$user = imagify_get_cached_user();
|
||||
$unconsumed_quota = $user ? $user->get_percent_unconsumed_quota : false;
|
||||
$hidden_class = '';
|
||||
$user = imagify_get_cached_user();
|
||||
|
||||
if ( ! $user ) {
|
||||
// Lazyload user.
|
||||
@@ -23,51 +24,10 @@ if ( Imagify_Requirements::is_api_key_valid() ) {
|
||||
'_wpnonce' => wp_create_nonce( 'imagify_get_user_data' ),
|
||||
) );
|
||||
}
|
||||
} else {
|
||||
$hidden_class = ' hidden';
|
||||
}
|
||||
?>
|
||||
<div class="imagify-settings-section">
|
||||
|
||||
<?php
|
||||
$imagify_user = new Imagify_User();
|
||||
|
||||
if (
|
||||
$imagify_user->is_free()
|
||||
&&
|
||||
Imagify_Requirements::is_api_key_valid()
|
||||
) {
|
||||
?>
|
||||
<div class="imagify-col-content imagify-block-secondary imagify-mt2">
|
||||
<?php
|
||||
/**
|
||||
* Best plan.
|
||||
*/
|
||||
?>
|
||||
<div class="best-plan<?php echo $hidden_class; ?>">
|
||||
<h3 class="imagify-user-best-plan-title">
|
||||
<?php
|
||||
if ( $user && ! $unconsumed_quota ) {
|
||||
esc_html_e( 'Oops, It\'s Over!', 'imagify' );
|
||||
} elseif ( $user && $unconsumed_quota <= 20 ) {
|
||||
esc_html_e( 'Oops, It\'s almost over!', 'imagify' );
|
||||
} else {
|
||||
esc_html_e( 'You\'re new to Imagify?', 'imagify' );
|
||||
}
|
||||
?>
|
||||
</h3>
|
||||
|
||||
<p><?php esc_html_e( 'Let us help you by analyzing your existing images and determine the best plan for you.', 'imagify' ); ?></p>
|
||||
|
||||
<button id="imagify-get-pricing-modal" data-nonce="<?php echo wp_create_nonce( 'imagify_get_pricing_' . get_current_user_id() ); ?>" data-target="#imagify-pricing-modal" type="button" class="imagify-modal-trigger imagify-button imagify-button-light imagify-full-width">
|
||||
<i class="dashicons dashicons-dashboard" aria-hidden="true"></i>
|
||||
<span class="button-text"><?php esc_html_e( 'What plan do I need?', 'imagify' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- .imagify-col-content -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php $this->print_template( 'part-upsell' ); ?>
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'IMAGIFY_API_KEY' ) || ! IMAGIFY_API_KEY ) {
|
||||
|
||||
95
wp/wp-content/plugins/imagify/views/part-upsell.php
Normal file
95
wp/wp-content/plugins/imagify/views/part-upsell.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
use Imagify\User\User;
|
||||
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
$imagify_user = new User();
|
||||
$unconsumed_quota = $imagify_user ? $imagify_user->get_percent_unconsumed_quota() : 0;
|
||||
$infinite = $imagify_user->is_infinite();
|
||||
$upgrade = '';
|
||||
$price = '';
|
||||
$upgrade_link = '';
|
||||
$user_id = get_current_user_id();
|
||||
$notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
|
||||
$notices = $notices && is_array( $notices ) ? array_flip( $notices ) : [];
|
||||
$api_key_valid = Imagify_Requirements::is_api_key_valid();
|
||||
|
||||
if (
|
||||
$imagify_user->is_free()
|
||||
&&
|
||||
$api_key_valid
|
||||
&&
|
||||
$unconsumed_quota > 20
|
||||
) {
|
||||
?>
|
||||
<div class="imagify-col-content imagify-block-secondary imagify-mt2">
|
||||
<div class="best-plan<?php echo $api_key_valid ? '' : ' hidden'; ?>">
|
||||
<h3 class="imagify-user-best-plan-title">
|
||||
<?php esc_html_e( 'You\'re new to Imagify?', 'imagify' ); ?>
|
||||
</h3>
|
||||
<p><?php esc_html_e( 'Let us help you by analyzing your existing images and determine the best plan for you.', 'imagify' ); ?></p>
|
||||
<button id="imagify-get-pricing-modal" data-nonce="<?php echo wp_create_nonce( 'imagify_get_pricing_' . get_current_user_id() ); ?>" data-target="#imagify-pricing-modal" type="button" class="imagify-modal-trigger imagify-button imagify-button-light imagify-full-width">
|
||||
<i class="dashicons dashicons-dashboard" aria-hidden="true"></i>
|
||||
<span class="button-text"><?php esc_html_e( 'What plan do I need?', 'imagify' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- .imagify-col-content -->
|
||||
<?php
|
||||
}
|
||||
|
||||
if (
|
||||
Imagify_Requirements::is_api_key_valid()
|
||||
&&
|
||||
! $infinite
|
||||
&&
|
||||
! isset( $notices['upsell-banner'] )
|
||||
&&
|
||||
$unconsumed_quota <= 20
|
||||
) {
|
||||
?>
|
||||
<div class="imagify-col-content imagify-upsell">
|
||||
<div class="imagify-flex imagify-vcenter">
|
||||
<span class="imagify-meteo-icon imagify-noshrink"><?php echo $this->get_quota_icon(); ?></span>
|
||||
<div class="imagify-space-left imagify-full-width">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s is a data quota. */
|
||||
__( 'You have %s space credit left', 'imagify' ),
|
||||
'<span class="imagify-unconsumed-percent">' . $this->get_quota_percent() . '%</span>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<div class="<?php echo $this->get_quota_class(); ?>">
|
||||
<div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $this->get_quota_percent() . '%'; ?>;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ( $imagify_user->is_free() ) {
|
||||
$upgrade = esc_html__( 'Upgrade your plan now for more!', 'imagify' );
|
||||
$price = esc_html__( 'From $4.99/month only, keep going with image optimization!', 'imagify' );
|
||||
$upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/?utm_source=plugin&utm_medium=upsell_banner';
|
||||
} elseif ( $imagify_user->is_growth() ) {
|
||||
$upgrade = esc_html__( 'Upgrade your plan now to keep optimizing your images.', 'imagify' );
|
||||
|
||||
if ( $imagify_user->is_monthly ) {
|
||||
$price = esc_html__( 'For $9.99/month only, choose unlimited image optimization!', 'imagify' );
|
||||
$upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/plan_switch/?label=infinite&payment_plan=1&utm_source=plugin&utm_medium=upsell_banner';
|
||||
} else {
|
||||
$price = esc_html__( 'For $99.9/year only, choose unlimited image optimization!', 'imagify' );
|
||||
$upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/plan_switch/?label=infinite&payment_plan=2&utm_source=plugin&utm_medium=upsell_banner';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p><?php echo $upgrade; ?></p>
|
||||
<p><?php echo $price; ?></p>
|
||||
|
||||
<a href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener noreferrer" class="imagify-upsell-button"><span class="imagify-upsell-arrow"><?php esc_html_e( 'Upgrade now', 'imagify' ); ?></span></a>
|
||||
<a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'upsell-banner' ) ); ?>" class="imagify-notice-dismiss imagify-upsell-dismiss" title="<?php esc_attr_e( 'Dismiss this notice', 'imagify' ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice', 'imagify' ); ?></span></a>
|
||||
</div><!-- .imagify-col-content -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user