| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
$plan_required = FrmFormsHelper::get_plan_required( $template ); |
| 7 |
$args['plan_required'] = $plan_required; |
| 8 |
$stripped_template_name = preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] ); |
| 9 |
|
| 10 |
if ( ! empty( $template['custom'] ) ) { |
| 11 |
$preview_base = admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' ); |
| 12 |
$preview_end = ''; |
| 13 |
} else { |
| 14 |
$preview_base = 'https://sandbox.formidableforms.com/demos/wp-json/frm/v2/forms/'; |
| 15 |
$preview_end = '?return=html'; |
| 16 |
} |
| 17 |
?><li |
| 18 |
class="frm-selectable <?php echo ! empty( $searchable ) ? 'frm-searchable-template' : ''; ?> <?php echo $plan_required ? 'frm-locked-template frm-' . esc_attr( $plan_required ) . '-template' : ''; ?>" |
| 19 |
aria-label="<?php echo esc_attr( $stripped_template_name ); ?>" |
| 20 |
<?php |
| 21 |
if ( 'free' === $plan_required ) { |
| 22 |
echo 'data-key="' . esc_attr( $template['key'] ) . '" '; |
| 23 |
} elseif ( ! empty( $template['custom'] ) ) { |
| 24 |
echo 'data-formid="' . absint( $template['id'] ) . '" '; |
| 25 |
echo 'data-custom="1" '; |
| 26 |
echo 'data-href="' . esc_url( $template['url'] ) . '" '; |
| 27 |
} elseif ( ! $plan_required ) { |
| 28 |
$link = FrmFormsHelper::get_template_install_link( $template, $args ); |
| 29 |
echo 'data-rel="' . esc_url( $link['url'] ) . '" '; |
| 30 |
} |
| 31 |
?> |
| 32 |
data-preview="<?php echo esc_url( $preview_base . $template['key'] . $preview_end ); ?>" |
| 33 |
> |
| 34 |
<div class="frm-featured-form"> |
| 35 |
<?php |
| 36 |
if ( $render_icon ) { |
| 37 |
?><div class="frm-category-icon" role="button"> |
| 38 |
<?php FrmFormsHelper::template_icon( $template['categories'] ); ?> |
| 39 |
</div><?php |
| 40 |
} |
| 41 |
?><div> |
| 42 |
<h3 role="button"> |
| 43 |
<?php if ( $plan_required ) { ?> |
| 44 |
<svg class="frmsvg"> |
| 45 |
<use xlink:href="#frm_lock_simple"></use> |
| 46 |
</svg> |
| 47 |
<?php } ?> |
| 48 |
<?php echo esc_html( $stripped_template_name ); ?> |
| 49 |
<?php |
| 50 |
$template_is_new = strtotime( $template['released'] ) > strtotime( '-10 days' ); |
| 51 |
if ( $template_is_new && empty( $template['custom'] ) ) { |
| 52 |
FrmAppHelper::show_pill_text(); |
| 53 |
} |
| 54 |
?> |
| 55 |
<?php if ( $plan_required ) { ?> |
| 56 |
<span class="frm-plan-required-tag"> |
| 57 |
<?php |
| 58 |
echo esc_html( $plan_required ); |
| 59 |
if ( ! in_array( $plan_required, array( 'free', 'Elite' ), true ) ) { |
| 60 |
echo esc_html( ' +' ); |
| 61 |
} |
| 62 |
?> |
| 63 |
</span> |
| 64 |
<?php } ?> |
| 65 |
</h3> |
| 66 |
<p role="button"><?php echo $template['description'] ? esc_html( $template['description'] ) : '<i>' . esc_html__( 'No description', 'formidable' ) . '</i>'; ?></p> |
| 67 |
</div> |
| 68 |
</div> |
| 69 |
</li><?php |
| 70 |
|