| @@ -1,89 +1,104 @@ | ||
| 1 | +<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly ?> | |
| 1 | 2 | <div class="usk-modal-overlay" id="ultimate-builder-kit-builder-modal" style="display: none"> |
| 2 | - <div id="ultimate-builder-kit-builder-modal-wrapper"> | |
| 3 | - <div class="usk-template-modal-header"> | |
| 4 | - <div class="usk-modal-logo-wrap"> | |
| 5 | - <img class="usk-modal-logo" src="<?php echo esc_attr(BDTUSK_ADM_ASSETS_URL . '/images/logo.svg') ?>" alt=""> | |
| 6 | - <span class="usk-logo-text">New Template</span> | |
| 7 | - </div> | |
| 8 | - <div class="usk-modal-close-button"> | |
| 9 | - <a href="javascript:void(0)"> | |
| 10 | - <i class="usk-icon-close"></i> | |
| 11 | - </a> | |
| 12 | - </div> | |
| 13 | - </div> | |
| 14 | - <div class="usk-template-modal-main-wrap"> | |
| 15 | - <div class="usk-modal-content-wrap"> | |
| 16 | - <h3 class="usk-modal-title">Templates Help You <span>Work Efficiently</span> | |
| 17 | - </h3> | |
| 18 | - <div class="usk-modal-desc">Use templates to create the | |
| 19 | - different pieces of your site, and reuse them | |
| 20 | - with one click whenever needed. | |
| 21 | - </div> | |
| 22 | - </div> | |
| 23 | - <div class="usk-modal-form-wrap"> | |
| 24 | - <form class="usk-modal-form" method="post"> | |
| 25 | - <input type="hidden" name="template_id" value="" class="template_id" /> | |
| 26 | - <div class="usk-form-title">Choose Template Type</div> | |
| 27 | - <label for="template_type">Select the type of template you want to work on</label> | |
| 28 | - <select name="template_type" id="template_type"> | |
| 29 | - <option value="">select</option> | |
| 30 | - <?php | |
| 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. | |
| 31 | 21 | |
| 32 | - $templates = \UltimateStoreKit\Includes\Builder\Builder_Template_Helper::templateForSelectDropdown(); | |
| 33 | - $separator = \UltimateStoreKit\Includes\Builder\Builder_Template_Helper::separator(); | |
| 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 | |
| 34 | 48 | |
| 35 | - print_r($separator); | |
| 49 | + $templates = \UltimateStoreKit\Includes\Builder\Builder_Template_Helper::templateForSelectDropdown(); | |
| 50 | + $separator = \UltimateStoreKit\Includes\Builder\Builder_Template_Helper::separator(); | |
| 36 | 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 | + } | |
| 37 | 63 | |
| 38 | - // It is single | |
| 39 | - if (count($templates) == 1) { | |
| 40 | - $templateKey = array_key_last($templates); | |
| 41 | - $template = $templates[$templateKey]; | |
| 42 | - foreach ($template as $key => $item) : | |
| 43 | - $selectValue = "{$templateKey}{$separator}{$key}"; | |
| 44 | - ?> | |
| 45 | - <option value="<?php echo esc_attr($selectValue) ?>"><?php echo esc_attr($item) ?></option> | |
| 46 | - <?php | |
| 47 | - endforeach; | |
| 48 | - } | |
| 49 | - | |
| 50 | - if (count($templates) > 1) { | |
| 51 | - foreach ($templates as $keys => $items) : | |
| 52 | - $label = ucwords(str_replace(['-', '_'], [' '], $keys)); | |
| 53 | - if (is_array($items)) { | |
| 54 | - ?> | |
| 55 | - <optgroup label="<?php echo esc_attr($label) ?>"><?php | |
| 56 | - foreach ($items as $key => $item) : | |
| 57 | - $itemValue = "{$keys}{$separator}{$key}" | |
| 58 | - ?> | |
| 59 | - <option value="<?php echo esc_attr($itemValue) ?>"><?php echo esc_attr($item) ?></option> | |
| 60 | - <?php | |
| 61 | - endforeach; | |
| 62 | - ?> | |
| 63 | - </optgroup> | |
| 64 | - <?php | |
| 65 | - } | |
| 66 | - endforeach; | |
| 67 | - } | |
| 68 | - ?> | |
| 69 | - </select> | |
| 70 | - <label for="fname">Name your template</label> | |
| 71 | - <input type="text" name="template_name" id="template_name" placeholder="Enter template name"> | |
| 72 | - <select name="template_status" id="template_status"> | |
| 73 | - <option value="">select</option> | |
| 74 | - <option value="1">Active</option> | |
| 75 | - <option value="0">Inactive</option> | |
| 76 | - </select> | |
| 77 | - <input class="usk-modal-submit-btn" type="submit" value="Create Template"> | |
| 78 | - </form> | |
| 79 | - </div> | |
| 80 | - </div> | |
| 81 | - </div> | |
| 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> | |
| 82 | 98 | </div> |
| 83 | -</div> | |
| 84 | 99 | |
| 85 | 100 | <style> |
| 86 | - .input-error { | |
| 87 | - border: 1px solid red !important; | |
| 88 | - } | |
| 89 | -</style> | |
| 101 | + .input-error { | |
| 102 | + border: 1px solid red !important; | |
| 103 | + } | |
| 104 | +</style> | |