conditions
6 years ago
notices
6 years ago
ad-conditions-string-operators.php
7 years ago
ad-group-edit.php
7 years ago
ad-group-list-ads.php
7 years ago
ad-group-list-form-row.php
6 years ago
ad-group-list-header.php
7 years ago
ad-group-list-row.php
7 years ago
ad-group.php
6 years ago
ad-info-after-textarea.php
7 years ago
ad-info-bottom.php
6 years ago
ad-info-top.php
7 years ago
ad-info.php
7 years ago
ad-list-details-column.php
7 years ago
ad-list-filters.php
6 years ago
ad-list-no-ads.php
6 years ago
ad-list-shortcode-column.php
7 years ago
ad-list-timing-column.php
7 years ago
ad-main-metabox.php
6 years ago
ad-output-metabox.php
6 years ago
ad-parameters-metabox.php
6 years ago
ad-parameters-size.php
6 years ago
ad-submitbox-meta.php
7 years ago
checks.php
6 years ago
feedback-disable.php
6 years ago
gadsense-dashboard.php
6 years ago
index.php
7 years ago
overview-addons-line.php
7 years ago
overview-notice-row.php
6 years ago
overview-notices.php
6 years ago
overview-widget.php
6 years ago
overview.php
6 years ago
pitch-bundle.php
7 years ago
pitch-pro-tab.php
7 years ago
pitch-tracking.php
7 years ago
placement-form.php
6 years ago
placement-injection-top.php
6 years ago
placements-ad-label-position.php
7 years ago
placements-ad-label.php
7 years ago
placements-content-index.php
7 years ago
placements-item.php
6 years ago
placements.php
6 years ago
post-ad-settings-metabox.php
6 years ago
setting-disable-post-types.php
6 years ago
setting-license.php
6 years ago
setting-target.php
7 years ago
settings-disable-ads.php
6 years ago
settings.php
6 years ago
support-callout.php
6 years ago
support.php
7 years ago
setting-license.php
77 lines
| 1 | <?php |
| 2 | $errortext = false; |
| 3 | $expires = Advanced_Ads_Admin_Licenses::get_instance()->get_license_expires( $options_slug ); |
| 4 | $expired = false; |
| 5 | $expired_error = __( 'Your license expired.', 'advanced-ads' ); |
| 6 | |
| 7 | ob_start(); |
| 8 | ?> |
| 9 | <button type="button" class="button-secondary advads-license-activate" |
| 10 | data-addon="<?php echo $index; ?>" |
| 11 | data-pluginname="<?php echo $plugin_name; ?>" |
| 12 | data-optionslug="<?php echo $options_slug; ?>" |
| 13 | name="advads_license_activate"><?php _e( 'Update expiry date', 'advanced-ads' ); ?></button> |
| 14 | <?php |
| 15 | $update_button = ob_get_clean(); |
| 16 | |
| 17 | $license_key_for_expired_link = $license_key ? $license_key : "%LICENSE_KEY%"; |
| 18 | $expired_error .= $expired_renew_link = ' ' . sprintf( __( 'Click on %2$s if you renewed it or have a subscription or <a href="%1$s" class="advads-renewal-link" target="_blank">renew your license</a>.', 'advanced-ads' ), ADVADS_URL . 'checkout/?edd_license_key=' . esc_attr( $license_key_for_expired_link ) . '#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses', $update_button ); |
| 19 | if ( 'lifetime' !== $expires ) { |
| 20 | $expires_time = strtotime( $expires ); |
| 21 | $days_left = ( $expires_time - time() ) / DAY_IN_SECONDS; |
| 22 | } |
| 23 | if ( 'lifetime' === $expires ) { |
| 24 | // do nothing |
| 25 | } elseif ( $expired && $days_left <= 0 ) { |
| 26 | $plugin_url = isset( $plugin_url ) ? $plugin_url : ADVADS_URL; |
| 27 | $errortext = $expired_error; |
| 28 | $expired = true; |
| 29 | } elseif ( 0 < $days_left && 31 > $days_left ) { |
| 30 | $errortext = sprintf( __( '(%d days left)', 'advanced-ads' ), $days_left ); |
| 31 | } |
| 32 | $show_active = ( $license_status !== false && $license_status == 'valid' && ! $expired ) ? true : false; |
| 33 | ?> |
| 34 | <input type="text" class="regular-text advads-license-key" placeholder="<?php _e( 'License key', 'advanced-ads' ); ?>" |
| 35 | name="<?php echo ADVADS_SLUG . '-licenses'; ?>[<?php echo $index; ?>]" |
| 36 | value="<?php echo esc_attr( $license_key ); ?>" |
| 37 | <?php |
| 38 | if ( $license_status !== false && $license_status == 'valid' && ! $expired ) : |
| 39 | ?> |
| 40 | readonly="readonly"<?php endif; ?>/> |
| 41 | |
| 42 | <button type="button" class="button-secondary advads-license-deactivate" |
| 43 | <?php |
| 44 | if ( $license_status !== 'valid' ) { |
| 45 | echo ' style="display: none;" '; |
| 46 | } |
| 47 | ?> |
| 48 | data-addon="<?php echo $index; ?>" |
| 49 | data-pluginname="<?php echo $plugin_name; ?>" |
| 50 | data-optionslug="<?php echo $options_slug; ?>" |
| 51 | name="advads_license_activate"><?php _e( 'Deactivate License', 'advanced-ads' ); ?></button> |
| 52 | |
| 53 | <button type="button" class="button-primary advads-license-activate" |
| 54 | data-addon="<?php echo $index; ?>" |
| 55 | data-pluginname="<?php echo $plugin_name; ?>" |
| 56 | data-optionslug="<?php echo $options_slug; ?>" |
| 57 | name="advads_license_activate"><?php echo ( $license_status === 'valid' && ! $expired ) ? __( 'Update License', 'advanced-ads' ) : __( 'Activate License', 'advanced-ads' ); ?></button> |
| 58 | <?php |
| 59 | if ( '' === trim( $license_key ) ) { |
| 60 | $errortext = __( 'Please enter a valid license key', 'advanced-ads' ); |
| 61 | } elseif ( ! $expired && ! $errortext ) { |
| 62 | $errortext = ( $license_status == 'invalid' ) ? __( 'License key invalid', 'advanced-ads' ) : ''; |
| 63 | } |
| 64 | ?> |
| 65 | |
| 66 | <span class="advads-license-activate-active" <?php |
| 67 | if ( ! $show_active ) { |
| 68 | echo 'style="display: none;"'; |
| 69 | } |
| 70 | ?>><?php _e( 'active', 'advanced-ads' ); ?></span> |
| 71 | <span class="advads-license-activate-error" <?php |
| 72 | if ( ! $errortext ) { |
| 73 | echo 'style="display: none;"'; |
| 74 | } ?>><?php echo $errortext; ?></span> |
| 75 | <span class="advads-license-expired-error advads-error-message" |
| 76 | style="display: none;"><?php echo $expired_error; ?></span> |
| 77 |