PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.2.8
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.2.8
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / views / part-upsell.php

part-upsell.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.2.8, at views/part-upsell.php

110 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Imagify\User\User;
4
5 defined( 'ABSPATH' ) || exit;
6
7 $imagify_user = new User();
8 $unconsumed_quota = $imagify_user ? $imagify_user->get_percent_unconsumed_quota() : 0;
9 $infinite = $imagify_user->is_infinite();
10 $upgrade = '';
11 $price = '';
12 $upgrade_link = '';
13 $user_id = get_current_user_id();
14 $notices = get_user_meta( $user_id, '_imagify_ignore_notices', true );
15 $notices = $notices && is_array( $notices ) ? array_flip( $notices ) : [];
16 $api_key_valid = Imagify_Requirements::is_api_key_valid();
17
18 if (
19 $imagify_user->is_free()
20 &&
21 $api_key_valid
22 &&
23 $unconsumed_quota > 20
24 ) {
25 ?>
26 <div class="imagify-col-content imagify-block-secondary imagify-mt2">
27 <div class="best-plan<?php echo $api_key_valid ? '' : ' hidden'; ?>">
28 <h3 class="imagify-user-best-plan-title">
29 <?php esc_html_e( 'Unlock Imagify\'s full potential', 'imagify' ); ?>
30 </h3>
31 <p><?php esc_html_e( 'Expand your image quota and eliminate upload limits.', 'imagify' ); ?></p>
32 <button data-nonce="<?php echo esc_attr( 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 imagify-upsell-cta imagify-get-pricing-modal">
33 <span class="button-text"><?php esc_html_e( 'Upgrade Now', 'imagify' ); ?></span>
34 <svg class="imagify-svg-icon" width="23px" height="23px">
35 <use href="#imagify_arrow_long_right"></use>
36 </svg>
37 </button>
38 </div>
39 </div><!-- .imagify-col-content -->
40 <?php
41 }
42
43 if (
44 Imagify_Requirements::is_api_key_valid()
45 &&
46 ! $infinite
47 &&
48 ! isset( $notices['upsell-banner'] )
49 &&
50 $unconsumed_quota <= 20
51 ) {
52 ?>
53 <div class="imagify-col-content imagify-upsell">
54 <div class="imagify-flex imagify-vcenter">
55 <span class="imagify-meteo-icon imagify-noshrink"><?php echo $this->get_quota_icon(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
56 <div class="imagify-space-left imagify-full-width">
57 <p>
58 <?php
59 printf(
60 /* translators: %s is a data quota. */
61 esc_html__( 'You have %s space credit left', 'imagify' ),
62 '<span class="imagify-unconsumed-percent">' . esc_html( $this->get_quota_percent() ) . '%</span>'
63 );
64 ?>
65 </p>
66
67 <div class="<?php echo esc_attr( $this->get_quota_class() ); ?>">
68 <div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo esc_attr( $this->get_quota_percent() ) . '%'; ?>;"></div>
69 </div>
70 </div>
71 </div>
72 <?php
73 if ( $imagify_user->is_free() ) {
74 $upgrade = esc_html__( 'Upgrade your plan now for more!', 'imagify' );
75 $price = esc_html__( 'From $5.99/month only, keep going with image optimization!', 'imagify' );
76 $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/?utm_source=plugin&utm_medium=upsell_banner';
77 } elseif ( $imagify_user->is_growth() ) {
78 $upgrade = esc_html__( 'Upgrade your plan now to keep optimizing your images.', 'imagify' );
79
80 if ( $imagify_user->is_monthly ) {
81 $price = esc_html__( 'For $11.99/month only, choose unlimited image optimization!', 'imagify' );
82 $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/plan_switch/?label=infinite&payment_plan=1&utm_source=plugin&utm_medium=upsell_banner';
83 } else {
84 $price = esc_html__( 'For $9.99/month only, choose unlimited image optimization!', 'imagify' );
85 $upgrade_link = IMAGIFY_APP_DOMAIN . '/subscription/plan_switch/?label=infinite&payment_plan=2&utm_source=plugin&utm_medium=upsell_banner';
86 }
87 }
88 ?>
89 <p><?php echo $upgrade; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
90 <p><?php echo $price; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
91
92 <a href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener noreferrer" class="imagify-upsell-button imagify-full-width imagify-upsell-cta">
93 <?php esc_html_e( 'Upgrade now', 'imagify' ); ?>
94 <svg class="imagify-svg-icon" width="23px" height="23px">
95 <use href="#imagify_arrow_long_right"></use>
96 </svg>
97 </a>
98 <a href="<?php echo esc_url( get_imagify_admin_url( 'dismiss-notice', 'upsell-banner' ) ); ?>" class="imagify-notice-dismiss notice-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>
99 </div><!-- .imagify-col-content -->
100 <?php
101 }
102 ?>
103
104 <svg style="display: none;">
105 <symbol id="imagify_arrow_long_right" viewBox="0 0 512.00 512.00">
106 <path d="M313.941 216H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h301.941v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971V216z" fill="currentColor"/>
107 </symbol>
108 </svg>
109
110