| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 3 | 3 | ?> |
| 4 | 4 | <div class="wrap imagify-settings imagify-bulk"> |
| 5 | 5 | |
| 6 | 6 | <?php $this->print_template( 'part-bulk-optimization-header' ); ?> |
| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | </div> |
| 41 | 41 | |
| 42 | 42 | <p><?php esc_html_e( 'Optimized size', 'imagify' ); ?></p> |
| 43 | 43 | <div class="imagify-bar-primary base-transparent right-outside-number"> |
| 44 | - <div id="imagify-optimized-bar" class="imagify-progress" style="width: <?php echo max( 100 - $data['optimized_percent'], 0 ); ?>%"><span class="imagify-barnb"><?php echo esc_html( $data['optimized_human'] ); ?></span></div> | |
| 44 | + <div id="imagify-optimized-bar" class="imagify-progress" style="width: <?php echo esc_attr( max( 100 - $data['optimized_percent'], 0 ) ); ?>%"><span class="imagify-barnb"><?php echo esc_html( $data['optimized_human'] ); ?></span></div> | |
| 45 | 45 | </div> |
| 46 | 46 | |
| 47 | 47 | </div> |
| 48 | 48 | |
| @@ -84,10 +84,13 @@ | ||
| 84 | 84 | |
| 85 | 85 | <div class="imagify-col imagify-account-info-col"> |
| 86 | 86 | |
| 87 | 87 | <?php |
| 88 | - if ( ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || ! IMAGIFY_HIDDEN_ACCOUNT ) && Imagify_Requirements::is_api_key_valid() ) { | |
| 89 | - $user = new Imagify_User(); | |
| 88 | + if ( | |
| 89 | + ( ! defined( 'IMAGIFY_HIDDEN_ACCOUNT' ) || ! IMAGIFY_HIDDEN_ACCOUNT ) | |
| 90 | + && | |
| 91 | + Imagify_Requirements::is_api_key_valid() | |
| 92 | + ) { | |
| 90 | 93 | ?> |
| 91 | 94 | <div class="imagify-options-title"> |
| 92 | 95 | <div class="imagify-th-titles imagify-flex imagify-vcenter"> |
| 93 | 96 | <span class="dashicons dashicons-admin-users"></span> |
| @@ -94,71 +97,13 @@ | ||
| 94 | 97 | <p class="imagify-meteo-title"> |
| 95 | 98 | <?php esc_html_e( 'Your Account', 'imagify' ); ?> |
| 96 | 99 | </p> |
| 97 | 100 | </div> |
| 98 | - <a href="<?php echo esc_url( imagify_get_external_url( 'subscription' ) ); ?>" target="_blank"><?php _e( 'View your profile', 'imagify' ); ?></a> | |
| 99 | - | |
| 100 | - <p class="imagify-meteo-subs"> | |
| 101 | - <span class="screen-reader-text"><?php _e( 'Your subscription:', 'imagify' ); ?></span> | |
| 102 | - <strong class="imagify-user-plan imagify-user-plan-label"><?php echo $user->plan_label; ?></strong> | |
| 103 | - </p> | |
| 101 | + <a href="<?php echo esc_url( imagify_get_external_url( 'subscription' ) ); ?>" target="_blank"><?php esc_html_e( 'View your profile', 'imagify' ); ?></a> | |
| 104 | 102 | </div> |
| 103 | + <?php $this->print_template( 'part-upsell' ); ?> | |
| 104 | + <?php } ?> | |
| 105 | 105 | |
| 106 | - <?php if ( $user && 1 === $user->plan_id ) { ?> | |
| 107 | - <div class="imagify-col-content"> | |
| 108 | - <div class="imagify-flex imagify-vcenter"> | |
| 109 | - <span class="imagify-meteo-icon imagify-noshrink"><?php echo $this->get_quota_icon(); ?></span> | |
| 110 | - <div class="imagify-space-left imagify-full-width"> | |
| 111 | - | |
| 112 | - <p> | |
| 113 | - <?php | |
| 114 | - printf( | |
| 115 | - /* translators: %s is a data quota. */ | |
| 116 | - __( 'You have %s space credit left', 'imagify' ), | |
| 117 | - '<span class="imagify-unconsumed-percent">' . $this->get_quota_percent() . '%</span>' | |
| 118 | - ); | |
| 119 | - ?> | |
| 120 | - </p> | |
| 121 | - | |
| 122 | - <div class="<?php echo $this->get_quota_class(); ?>"> | |
| 123 | - <div class="imagify-unconsumed-bar imagify-progress" style="width: <?php echo $this->get_quota_percent() . '%'; ?>;"></div> | |
| 124 | - </div> | |
| 125 | - </div> | |
| 126 | - </div> | |
| 127 | - <?php | |
| 128 | - /** | |
| 129 | - * Filter whether the plan chooser section is displayed. | |
| 130 | - * | |
| 131 | - * @param $show_new bool Default to true: display the section. | |
| 132 | - */ | |
| 133 | - if ( apply_filters( 'imagify_show_new_to_imagify', true ) ) { | |
| 134 | - ?> | |
| 135 | - <div class="imagify-block-secondary"> | |
| 136 | - <p class="imagify-section-title imagify-h3-like"> | |
| 137 | - <?php | |
| 138 | - if ( ! $this->get_quota_percent() ) { | |
| 139 | - esc_html_e( 'Oops, It\'s Over!', 'imagify' ); | |
| 140 | - } elseif ( $this->get_quota_percent() <= 20 ) { | |
| 141 | - esc_html_e( 'Oops, It\'s almost over!', 'imagify' ); | |
| 142 | - } else { | |
| 143 | - esc_html_e( 'You\'re new to Imagify?', 'imagify' ); | |
| 144 | - } | |
| 145 | - ?> | |
| 146 | - </p> | |
| 147 | - <p><?php esc_html_e( 'Let us help you by analyzing your existing images and determine the best plan for you.', 'imagify' ); ?></p> | |
| 148 | - | |
| 149 | - <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"> | |
| 150 | - <i class="dashicons dashicons-dashboard" aria-hidden="true"></i> | |
| 151 | - <span class="button-text"><?php _e( 'What plan do I need?', 'imagify' ); ?></span> | |
| 152 | - </button> | |
| 153 | - </div> | |
| 154 | - <?php | |
| 155 | - } | |
| 156 | - ?> | |
| 157 | - </div><!-- .imagify-col-content --> | |
| 158 | - <?php } // End if(). ?> | |
| 159 | - <?php } // End if(). ?> | |
| 160 | - | |
| 161 | 106 | </div><!-- .imagify-account-info-col --> |
| 162 | 107 | |
| 163 | 108 | </div><!-- .imagify-columns --> |
| 164 | 109 | |
| @@ -166,9 +111,8 @@ | ||
| 166 | 111 | $this->print_template( 'part-bulk-optimization-success' ); |
| 167 | 112 | |
| 168 | 113 | $this->print_template( 'part-bulk-optimization-table', $data ); |
| 169 | 114 | |
| 170 | - // New Feature! | |
| 171 | 115 | if ( ! empty( $data['no-custom-folders'] ) ) { |
| 172 | 116 | $this->print_template( 'part-bulk-optimization-newbie' ); |
| 173 | 117 | } |
| 174 | 118 | ?> |
| @@ -176,12 +120,32 @@ | ||
| 176 | 120 | <div class="imagify-bulk-submit imagify-flex imagify-vcenter"> |
| 177 | 121 | <div class="imagify-pr2"> |
| 178 | 122 | <p> |
| 179 | 123 | <?php wp_nonce_field( 'imagify-bulk-optimize', 'imagifybulkuploadnonce' ); ?> |
| 180 | - <button id="imagify-bulk-action" type="button" class="button button-primary"> | |
| 181 | - <span class="dashicons dashicons-admin-generic"></span> | |
| 182 | - <span class="button-text"><?php _e( 'Imagif’em all', 'imagify' ); ?></span> | |
| 124 | + <?php | |
| 125 | + $disabled = ''; | |
| 126 | + $class = ''; | |
| 127 | + $stop_hidden = 'hidden'; | |
| 128 | + | |
| 129 | + if ( | |
| 130 | + false !== get_transient( 'imagify_wp_optimize_running' ) | |
| 131 | + || | |
| 132 | + false !== get_transient( 'imagify_custom-folders_optimize_running' ) | |
| 133 | + ) { | |
| 134 | + $disabled = 'disabled="disabled"'; | |
| 135 | + $class = 'rotate'; | |
| 136 | + $stop_hidden = ''; | |
| 137 | + } | |
| 138 | + | |
| 139 | + ?> | |
| 140 | + <button id="imagify-bulk-action" type="button" class="button button-primary" <?php echo $disabled; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 141 | + <span class="dashicons dashicons-admin-generic <?php echo esc_attr( $class ); ?>"></span> | |
| 142 | + <span class="button-text"><?php esc_html_e( 'Imagif’em all', 'imagify' ); ?></span> | |
| 183 | 143 | </button> |
| 144 | + <button id="imagify-bulk-stop" type="button" class="button button-primary <?php echo esc_attr( $stop_hidden ); ?>" aria-hidden="<?php echo esc_attr( $stop_hidden ? 'true' : 'false' ); ?>"> | |
| 145 | + <span class="dashicons dashicons-no-alt"></span> | |
| 146 | + <span class="button-text"><?php esc_html_e( 'Stop the optimization', 'imagify' ); ?></span> | |
| 147 | + </button> | |
| 184 | 148 | </p> |
| 185 | 149 | </div> |
| 186 | 150 | <?php if ( ! is_wp_error( get_imagify_max_image_size() ) ) { ?> |
| 187 | 151 | <p> |
| @@ -197,10 +161,8 @@ | ||
| 197 | 161 | </div><!-- .imagify-bulk-submit --> |
| 198 | 162 | </div><!-- .imagify-settings-section --> |
| 199 | 163 | |
| 200 | 164 | <?php |
| 201 | - $this->print_template( 'modal-payment' ); | |
| 202 | - | |
| 203 | 165 | if ( Imagify_Requirements::is_api_key_valid() ) { |
| 204 | 166 | $display_infos = get_transient( 'imagify_bulk_optimization_infos' ); |
| 205 | 167 | |
| 206 | 168 | ?> |
| @@ -212,13 +174,16 @@ | ||
| 212 | 174 | if ( ! $display_infos ) { |
| 213 | 175 | ?> |
| 214 | 176 | <script type="text/html" id="tmpl-imagify-bulk-infos"> |
| 215 | 177 | <?php |
| 216 | - $this->print_template( 'part-bulk-optimization-infos', array( | |
| 217 | - 'quota' => $data['unconsumed_quota'], | |
| 218 | - 'quota_class' => $data['quota_class'], | |
| 219 | - 'library' => ! empty( $data['groups']['library'] ), | |
| 220 | - ) ); | |
| 178 | + $this->print_template( | |
| 179 | + 'part-bulk-optimization-infos', | |
| 180 | + [ | |
| 181 | + 'quota' => $data['unconsumed_quota'], | |
| 182 | + 'quota_class' => $data['quota_class'], | |
| 183 | + 'library' => ! empty( $data['groups']['library'] ), | |
| 184 | + ] | |
| 185 | + ); | |
| 221 | 186 | ?> |
| 222 | 187 | </script> |
| 223 | 188 | <?php |
| 224 | 189 | } |
| @@ -223,10 +188,5 @@ | ||
| 223 | 188 | <?php |
| 224 | 189 | } |
| 225 | 190 | } |
| 226 | 191 | ?> |
| 227 | - | |
| 228 | - <script type="text/html" id="tmpl-imagify-spinner"> | |
| 229 | - <?php $this->print_template( 'part-bulk-optimization-spinner' ); ?> | |
| 230 | - </script> | |
| 231 | 192 | </div> |
| 232 | -<?php | |