| @@ -1,33 +1,97 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Add-Ons list. | |
| 4 | - * | |
| 5 | - * @package Formidable | |
| 6 | - * | |
| 7 | - * @var array<string, array> $addons Available add-ons keyed by slug. | |
| 8 | - * @var string $view_path Absolute path to the views/addons/ directory, with trailing slash. | |
| 9 | - * @var string $request_addon_url URL for requesting a new add-on. | |
| 10 | - * @var string $license_type Current license type or empty string. | |
| 11 | - * @var string $pricing Upgrade URL used for CTAs. | |
| 12 | - */ | |
| 13 | - | |
| 14 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 16 | 4 | } |
| 17 | - | |
| 18 | -FrmAddonsHelper::show_upgrade_renew_cta(); | |
| 19 | -FrmAddonsHelper::get_reconnect_link(); | |
| 20 | 5 | ?> |
| 6 | +<div class="frm_wrap" id="frm-addons-page"> | |
| 7 | + <?php | |
| 8 | + FrmAppHelper::get_admin_header( | |
| 9 | + array( | |
| 10 | + 'label' => __( 'Formidable Add-Ons', 'formidable' ), | |
| 11 | + ) | |
| 12 | + ); | |
| 13 | + ?> | |
| 14 | + <div class="wrap"> | |
| 21 | 15 | |
| 22 | -<ul id="frm-addons-list" class="frm-list-grid-layout frm-mb-xs"> | |
| 23 | 16 | <?php |
| 24 | - foreach ( $addons as $slug => $addon ) { | |
| 25 | - require $view_path . 'addon.php'; | |
| 17 | + include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); | |
| 18 | + | |
| 19 | + FrmAppHelper::show_search_box( | |
| 20 | + array( | |
| 21 | + 'input_id' => 'addon', | |
| 22 | + 'placeholder' => __( 'Search Add-ons', 'formidable' ), | |
| 23 | + 'tosearch' => 'frm-card', | |
| 24 | + ) | |
| 25 | + ); | |
| 26 | + | |
| 27 | + if ( FrmAppHelper::pro_is_connected() ) { | |
| 28 | + ?> | |
| 29 | + <p class="alignleft"> | |
| 30 | + <?php esc_html_e( 'Missing add-ons?', 'formidable' ); ?> | |
| 31 | + <a href="#" id="frm_reconnect_link" class="frm-show-authorized" data-refresh="1"> | |
| 32 | + <?php esc_html_e( 'Check now for a recent upgrade or renewal', 'formidable' ); ?> | |
| 33 | + </a> | |
| 34 | + </p> | |
| 35 | + <?php | |
| 36 | + } else { | |
| 37 | + FrmSettingsController::license_box(); | |
| 26 | 38 | } |
| 27 | 39 | ?> |
| 28 | -</ul> | |
| 40 | + <div class="clear"></div> | |
| 29 | 41 | |
| 30 | -<div class="frm-addons-request-addon frm-py-2xs frm-mt-xs"> | |
| 31 | - <span><?php esc_html_e( 'Not finding what you need?', 'formidable' ); ?></span> | |
| 32 | - <a class="frm-font-semibold" href="<?php echo esc_url( $request_addon_url ); ?>" target="_blank"><?php esc_html_e( 'Request Add-On', 'formidable' ); ?></a> | |
| 42 | + <div id="the-list" class="frm-addons"> | |
| 43 | + <?php foreach ( $addons as $slug => $addon ) { ?> | |
| 44 | + <div class="frm-card plugin-card-<?php echo esc_attr( $slug ); ?> frm-no-thumb frm-addon-<?php echo esc_attr( $addon['status']['type'] ); ?>"> | |
| 45 | + <div class="plugin-card-top"> | |
| 46 | + <?php if ( strtotime( $addon['released'] ) > strtotime( '-90 days' ) ) { ?> | |
| 47 | + <div class="frm_ribbon"> | |
| 48 | + <span>New</span> | |
| 49 | + </div> | |
| 50 | + <?php } ?> | |
| 51 | + <h2> | |
| 52 | + <?php echo esc_html( $addon['title'] ); ?> | |
| 53 | + </h2> | |
| 54 | + <p> | |
| 55 | + <?php | |
| 56 | + echo FrmAppHelper::kses( $addon['excerpt'], array( 'a' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 57 | + | |
| 58 | + $show_docs = isset( $addon['docs'] ) && ! empty( $addon['docs'] ) && $addon['installed']; | |
| 59 | + ?> | |
| 60 | + <?php if ( $show_docs ) { ?> | |
| 61 | + <br/><a href="<?php echo esc_url( $addon['docs'] ); ?>" target="_blank" aria-label="<?php esc_attr_e( 'View Docs', 'formidable' ); ?>"> | |
| 62 | + <?php esc_html_e( 'View Docs', 'formidable' ); ?> | |
| 63 | + </a> | |
| 64 | + <?php } ?> | |
| 65 | + </p> | |
| 66 | + <?php | |
| 67 | + $plan_required = FrmFormsHelper::get_plan_required( $addon ); | |
| 68 | + if ( ! $show_docs ) { | |
| 69 | + FrmFormsHelper::show_plan_required( $plan_required, $pricing . '&utm_content=' . $addon['slug'] ); | |
| 70 | + } | |
| 71 | + ?> | |
| 72 | + </div> | |
| 73 | + <div class="plugin-card-bottom"> | |
| 74 | + <span class="addon-status"> | |
| 75 | + <?php | |
| 76 | + printf( | |
| 77 | + /* translators: %s: Status name */ | |
| 78 | + esc_html__( 'Status: %s', 'formidable' ), | |
| 79 | + '<span class="addon-status-label">' . esc_html( $addon['status']['label'] ) . '</span>' | |
| 80 | + ); | |
| 81 | + ?> | |
| 82 | + </span> | |
| 83 | + <?php | |
| 84 | + $passing = array( | |
| 85 | + 'addon' => $addon, | |
| 86 | + 'license_type' => ! empty( $license_type ) ? $license_type : false, | |
| 87 | + 'plan_required' => 'plan_required', | |
| 88 | + 'upgrade_link' => $pricing, | |
| 89 | + ); | |
| 90 | + FrmAddonsController::show_conditional_action_button( $passing ); | |
| 91 | + ?> | |
| 92 | + </div> | |
| 93 | + </div> | |
| 94 | + <?php } ?> | |
| 95 | + </div> | |
| 96 | +</div> | |
| 33 | 97 | </div> |