plugin-info
10 years ago
account.php
10 years ago
add-ons.php
10 years ago
admin-notice.php
10 years ago
all-admin-notice.php
10 years ago
checkout.php
10 years ago
connect.php
10 years ago
contact.php
10 years ago
deactivation-feedback-modal.php
10 years ago
debug.php
10 years ago
email.php
10 years ago
firewall-issues-js.php
10 years ago
pending-activation.php
10 years ago
plugin-icon.php
10 years ago
powered-by.php
10 years ago
pricing.php
10 years ago
sticky-admin-notice-js.php
10 years ago
add-ons.php
113 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 6 | * @since 1.0.3 |
| 7 | */ |
| 8 | |
| 9 | $slug = $VARS['slug']; |
| 10 | /** |
| 11 | * @var Freemius |
| 12 | */ |
| 13 | $fs = freemius( $slug ); |
| 14 | |
| 15 | $open_addon_slug = fs_request_get( 'slug' ); |
| 16 | |
| 17 | $open_addon = false; |
| 18 | |
| 19 | /** |
| 20 | * @var FS_Plugin[] |
| 21 | */ |
| 22 | $addons = $fs->get_addons(); |
| 23 | ?> |
| 24 | <div id="fs_addons" class="wrap"> |
| 25 | <h2><?php printf( __fs( 'add-ons-for-x' ), $fs->get_plugin_name() ) ?></h2> |
| 26 | |
| 27 | <div id="poststuff"> |
| 28 | <ul class="fs-cards-list"> |
| 29 | <?php foreach ( $addons as $addon ) : ?> |
| 30 | <?php |
| 31 | $open_addon = ( $open_addon || ( $open_addon_slug === $addon->slug ) ); |
| 32 | |
| 33 | $price = 0; |
| 34 | $plans_result = $fs->get_api_site_or_plugin_scope()->get( "/addons/{$addon->id}/plans.json" ); |
| 35 | if ( ! isset( $plans_result->error ) ) { |
| 36 | $plans = $plans_result->plans; |
| 37 | if ( is_array( $plans ) && 0 < count( $plans ) ) { |
| 38 | $plan = $plans[0]; |
| 39 | $pricing_result = $fs->get_api_site_or_plugin_scope()->get( "/addons/{$addon->id}/plans/{$plan->id}/pricing.json" ); |
| 40 | if ( ! isset( $pricing_result->error ) ) { |
| 41 | // Update plan's pricing. |
| 42 | $plan->pricing = $pricing_result->pricing; |
| 43 | |
| 44 | if ( is_array( $plan->pricing ) && 0 < count( $plan->pricing ) ) { |
| 45 | $min_price = 999999; |
| 46 | foreach ( $plan->pricing as $pricing ) { |
| 47 | if ( ! is_null( $pricing->annual_price ) && $pricing->annual_price > 0 ) { |
| 48 | $min_price = min( $min_price, $pricing->annual_price ); |
| 49 | } else if ( ! is_null( $pricing->monthly_price ) && $pricing->monthly_price > 0 ) { |
| 50 | $min_price = min( $min_price, 12 * $pricing->monthly_price ); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | if ( $min_price < 999999 ) { |
| 55 | $price = $min_price; |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | ?> |
| 62 | <li class="fs-card" data-slug="<?php echo $addon->slug ?>"> |
| 63 | <?php |
| 64 | echo sprintf( '<a href="%s" class="thickbox fs-overlay" aria-label="%s" data-title="%s"></a>', |
| 65 | esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug . |
| 66 | '&TB_iframe=true&width=600&height=550' ) ), |
| 67 | esc_attr( sprintf( __fs( 'more-information-about-x' ), $addon->title ) ), |
| 68 | esc_attr( $addon->title ) |
| 69 | ); |
| 70 | ?> |
| 71 | <?php |
| 72 | if ( is_null( $addon->info ) ) { |
| 73 | $addon->info = new stdClass(); |
| 74 | } |
| 75 | if ( ! isset( $addon->info->card_banner_url ) ) { |
| 76 | $addon->info->card_banner_url = '//dashboard.freemius.com/assets/img/marketing/blueprint-300x100.jpg'; |
| 77 | } |
| 78 | if ( ! isset( $addon->info->short_description ) ) { |
| 79 | $addon->info->short_description = 'What\'s the one thing your add-on does really, really well?'; |
| 80 | } |
| 81 | ?> |
| 82 | <div class="fs-inner"> |
| 83 | <ul> |
| 84 | <li class="fs-card-banner" |
| 85 | style="background-image: url('<?php echo $addon->info->card_banner_url ?>');"></li> |
| 86 | <li class="fs-title"><?php echo $addon->title ?></li> |
| 87 | <li class="fs-offer"> |
| 88 | <span |
| 89 | class="fs-price"><?php echo ( 0 == $price ) ? __fs( 'free' ) : '$' . number_format( $price, 2 ) ?></span> |
| 90 | </li> |
| 91 | <li class="fs-description"><?php echo ! empty( $addon->info->short_description ) ? $addon->info->short_description : 'SHORT DESCRIPTION' ?></li> |
| 92 | </ul> |
| 93 | </div> |
| 94 | </li> |
| 95 | <?php endforeach ?> |
| 96 | </ul> |
| 97 | </div> |
| 98 | </div> |
| 99 | <?php if ( $open_addon ) : ?> |
| 100 | <script type="text/javascript"> |
| 101 | (function ($) { |
| 102 | var interval = setInterval(function () { |
| 103 | // Open add-on information page. |
| 104 | $('.fs-card[data-slug=<?php echo $open_addon_slug ?>] a').click(); |
| 105 | if ($('#TB_iframeContent').length > 0) { |
| 106 | clearInterval(interval); |
| 107 | interval = null; |
| 108 | } |
| 109 | }, 200); |
| 110 | })(jQuery); |
| 111 | </script> |
| 112 | <?php endif ?> |
| 113 | <?php fs_require_template( 'powered-by.php' ) ?> |