| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly ?> |
| 2 |
<div class="usk-modal-overlay" id="ultimate-builder-kit-builder-modal" style="display: none"> |
| 3 |
<div id="ultimate-builder-kit-builder-modal-wrapper"> |
| 4 |
<div class="usk-template-modal-header"> |
| 5 |
<div class="usk-modal-logo-wrap"> |
| 6 |
<img class="usk-modal-logo" src="<?php echo esc_attr( BDTUSK_ADM_ASSETS_URL . '/images/logo.svg' ) ?>" |
| 7 |
alt=""> |
| 8 |
<span class="usk-logo-text"><?php esc_html_e( 'New Template', 'ultimate-store-kit' ); ?></span> |
| 9 |
</div> |
| 10 |
<div class="usk-modal-close-button"> |
| 11 |
<a href="javascript:void(0)"> |
| 12 |
<span class="dashicons dashicons-no-alt"></span> |
| 13 |
</a> |
| 14 |
</div> |
| 15 |
</div> |
| 16 |
<div class="usk-template-modal-main-wrap"> |
| 17 |
<div class="usk-modal-content-wrap"> |
| 18 |
<h3 class="usk-modal-title"> |
| 19 |
<?php |
| 20 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- usk_ / BDTUSK_ / ultimate-store-kit- are this plugin's established public prefixes. Ultimate Store Kit Pro calls into these names, as does third-party integration code, so renaming them is a breaking change. Plugin Check only recognises prefixes derived verbatim from the slug and so reports them as unprefixed. |
| 21 |
|
| 22 |
echo wp_kses( |
| 23 |
sprintf( |
| 24 |
/* translators: 1: Opening span tag, 2: Closing span tag. */ |
| 25 |
__( 'Templates Help You %1$sWork Efficiently%2$s', 'ultimate-store-kit' ), |
| 26 |
'<span>', |
| 27 |
'</span>' |
| 28 |
), |
| 29 |
[ |
| 30 |
'span' => [], |
| 31 |
] |
| 32 |
); |
| 33 |
?> |
| 34 |
</h3> |
| 35 |
<div class="usk-modal-desc"> |
| 36 |
<?php esc_html_e( 'Use templates to create the different pieces of your site, and reuse them with one click whenever needed.', 'ultimate-store-kit' ); ?> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
<div class="usk-modal-form-wrap"> |
| 40 |
<form class="usk-modal-form" method="post"> |
| 41 |
<input type="hidden" name="template_id" value="" class="template_id" /> |
| 42 |
<input type="hidden" name="nonce" value="<?php echo esc_attr(wp_create_nonce('usk-builder')); ?>" /> |
| 43 |
<div class="usk-form-title"><?php esc_html_e( 'Choose Template Type', 'ultimate-store-kit' ); ?></div> |
| 44 |
<label for="template_type"><?php esc_html_e( 'Select the type of template you want to work on', 'ultimate-store-kit' ); ?></label> |
| 45 |
<select name="template_type" id="template_type"> |
| 46 |
<option value=""><?php esc_html_e( 'select', 'ultimate-store-kit' ); ?></option> |
| 47 |
<?php |
| 48 |
|
| 49 |
$templates = \UltimateStoreKit\Includes\Builder\Builder_Template_Helper::templateForSelectDropdown(); |
| 50 |
$separator = \UltimateStoreKit\Includes\Builder\Builder_Template_Helper::separator(); |
| 51 |
|
| 52 |
// It is single |
| 53 |
if ( count( $templates ) == 1 ) { |
| 54 |
$templateKey = array_key_last( $templates ); |
| 55 |
$template = $templates[ $templateKey ]; |
| 56 |
foreach ( $template as $key => $item ) : |
| 57 |
$selectValue = "{$templateKey}{$separator}{$key}"; |
| 58 |
?> |
| 59 |
<option value="<?php echo esc_attr( $selectValue ) ?>"><?php echo esc_attr( $item ) ?></option> |
| 60 |
<?php |
| 61 |
endforeach; |
| 62 |
} |
| 63 |
|
| 64 |
if ( count( $templates ) > 1 ) { |
| 65 |
foreach ( $templates as $keys => $items ) : |
| 66 |
$label = ucwords( str_replace( [ '-', '_' ], [ ' ' ], $keys ) ); |
| 67 |
if ( is_array( $items ) ) { |
| 68 |
?> |
| 69 |
<optgroup label="<?php echo esc_attr( $label ) ?>"><?php |
| 70 |
foreach ( $items as $key => $item ) : |
| 71 |
$itemValue = "{$keys}{$separator}{$key}" |
| 72 |
?> |
| 73 |
<option value="<?php echo esc_attr( $itemValue ) ?>"><?php echo esc_attr( $item ) ?></option> |
| 74 |
<?php |
| 75 |
endforeach; |
| 76 |
?> |
| 77 |
</optgroup> |
| 78 |
<?php |
| 79 |
} |
| 80 |
endforeach; |
| 81 |
} |
| 82 |
?> |
| 83 |
</select> |
| 84 |
<label for="fname"><?php esc_html_e( 'Name your template', 'ultimate-store-kit' ); ?></label> |
| 85 |
<input type="text" name="template_name" id="template_name" placeholder="<?php echo esc_attr__( 'Enter template name', 'ultimate-store-kit' ); ?>"> |
| 86 |
<div class="usk-template-status-switcher-wrap"> |
| 87 |
<input type="hidden" name="template_status" id="usk_template_status" value="1"> |
| 88 |
<div class="usk-template-status-switcher usk-active" id="usk_template_status_switcher" role="switch" aria-checked="true" tabindex="0"> |
| 89 |
<span class="usk-switcher-slider"></span> |
| 90 |
</div> |
| 91 |
<span class="usk-switcher-status-text"><?php esc_html_e( 'Active', 'ultimate-store-kit' ); ?></span> |
| 92 |
</div> |
| 93 |
<input class="usk-modal-submit-btn" type="submit" value="<?php echo esc_attr__( 'Create Template', 'ultimate-store-kit' ); ?>"> |
| 94 |
</form> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
|
| 100 |
<style> |
| 101 |
.input-error { |
| 102 |
border: 1px solid red !important; |
| 103 |
} |
| 104 |
</style> |
| 105 |
|