description.php
3 years ago
features.php
11 months ago
index.php
5 years ago
screenshots.php
3 years ago
features.php
113 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 |
| 6 | * @since 1.0.6 |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * @var array $VARS |
| 15 | * |
| 16 | * @var FS_Plugin $plugin |
| 17 | */ |
| 18 | $plugin = $VARS['plugin']; |
| 19 | |
| 20 | $plans = $VARS['plans']; |
| 21 | |
| 22 | $features_plan_map = array(); |
| 23 | foreach ( $plans as $plan ) { |
| 24 | if (!empty($plan->features) && is_array($plan->features)) { |
| 25 | foreach ( $plan->features as $feature ) { |
| 26 | if ( ! isset( $features_plan_map[ $feature->id ] ) ) { |
| 27 | $features_plan_map[ $feature->id ] = array( 'feature' => $feature, 'plans' => array() ); |
| 28 | } |
| 29 | |
| 30 | $features_plan_map[ $feature->id ]['plans'][ $plan->id ] = $feature; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | // Add support as a feature. |
| 35 | if ( ! empty( $plan->support_email ) || |
| 36 | ! empty( $plan->support_phone ) || |
| 37 | true === $plan->is_success_manager |
| 38 | ) { |
| 39 | if ( ! isset( $features_plan_map['support'] ) ) { |
| 40 | $support_feature = new stdClass(); |
| 41 | $support_feature->id = 'support'; |
| 42 | $support_feature->title = fs_text_inline( 'Support', $plugin->slug ); |
| 43 | $features_plan_map[ $support_feature->id ] = array( 'feature' => $support_feature, 'plans' => array() ); |
| 44 | } else { |
| 45 | $support_feature = $features_plan_map['support']['feature']; |
| 46 | } |
| 47 | |
| 48 | $features_plan_map[ $support_feature->id ]['plans'][ $plan->id ] = $support_feature; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Add updates as a feature for all plans. |
| 53 | $updates_feature = new stdClass(); |
| 54 | $updates_feature->id = 'updates'; |
| 55 | $updates_feature->title = fs_text_inline( 'Unlimited Updates', 'unlimited-updates', $plugin->slug ); |
| 56 | $features_plan_map[ $updates_feature->id ] = array( 'feature' => $updates_feature, 'plans' => array() ); |
| 57 | foreach ( $plans as $plan ) { |
| 58 | $features_plan_map[ $updates_feature->id ]['plans'][ $plan->id ] = $updates_feature; |
| 59 | } |
| 60 | ?> |
| 61 | <div class="fs-features"> |
| 62 | <table> |
| 63 | <thead> |
| 64 | <tr> |
| 65 | <th></th> |
| 66 | <?php foreach ( $plans as $plan ) : ?> |
| 67 | <th> |
| 68 | <?php echo $plan->title ?> |
| 69 | <span class="fs-price"><?php |
| 70 | if ( empty( $plan->pricing ) ) { |
| 71 | fs_esc_html_echo_inline( 'Free', 'free', $plugin->slug ); |
| 72 | } else { |
| 73 | foreach ( $plan->pricing as $pricing ) { |
| 74 | /** |
| 75 | * @var FS_Pricing $pricing |
| 76 | */ |
| 77 | if ( 1 == $pricing->licenses ) { |
| 78 | if ( $pricing->has_annual() ) { |
| 79 | echo "\${$pricing->annual_price} / " . fs_esc_html_x_inline( 'year', 'as annual period', 'year', $plugin->slug ); |
| 80 | } else if ( $pricing->has_monthly() ) { |
| 81 | echo "\${$pricing->monthly_price} / " . fs_esc_html_x_inline( 'mo', 'as monthly period', 'mo', $plugin->slug ); |
| 82 | } else { |
| 83 | echo "\${$pricing->lifetime_price}"; |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | ?></span> |
| 89 | </th> |
| 90 | <?php endforeach ?> |
| 91 | </tr> |
| 92 | </thead> |
| 93 | <tbody> |
| 94 | <?php $odd = true; |
| 95 | foreach ( $features_plan_map as $feature_id => $data ) : ?> |
| 96 | <tr class="fs-<?php echo $odd ? 'odd' : 'even' ?>"> |
| 97 | <td><?php echo esc_html( ucfirst( $data['feature']->title ) ) ?></td> |
| 98 | <?php foreach ( $plans as $plan ) : ?> |
| 99 | <td> |
| 100 | <?php if ( isset( $data['plans'][ $plan->id ] ) ) : ?> |
| 101 | <?php if ( ! empty( $data['plans'][ $plan->id ]->value ) ) : ?> |
| 102 | <b><?php echo esc_html( $data['plans'][ $plan->id ]->value ) ?></b> |
| 103 | <?php else : ?> |
| 104 | <i class="dashicons dashicons-yes"></i> |
| 105 | <?php endif ?> |
| 106 | <?php endif ?> |
| 107 | </td> |
| 108 | <?php endforeach ?> |
| 109 | </tr> |
| 110 | <?php $odd = ! $odd; endforeach ?> |
| 111 | </tbody> |
| 112 | </table> |
| 113 | </div> |