Prep Plugin for release on WordPress.org
Escape everything that should be escaped. Add nonce checks where needed. Sanitize all inputs. Apply Code style changes across the codebase. Correct many deprecation notices. Optimize load order of many filters.
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
* See more here: https://help.wpultimo.com/article/335-template-overrides.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @package WP_Ultimo/Views
|
||||
* @param array $products List of product objects.
|
||||
* @param string $name ID of the field.
|
||||
* @param string $label The field label.
|
||||
@ -23,7 +24,7 @@ if (isset($should_display) && ! $should_display) {
|
||||
<?php
|
||||
|
||||
return;
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$sites = array_map('wu_get_site', $sites ?? []);
|
||||
|
||||
@ -39,110 +40,114 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
<ul id="wu-site-template-filter" class="wu-bg-white wu-border-solid wu-border wu-border-gray-300 wu-shadow-sm wu-p-4 wu-flex wu-rounded wu-relative wu-m-0 wu-mb-4 wu-list-none">
|
||||
|
||||
<li class="wu-site-template-filter-all wu-mx-2 wu-my-0">
|
||||
<a
|
||||
href="#"
|
||||
data-category=""
|
||||
:class="$parent.template_category === '' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = ''"
|
||||
>
|
||||
<?php _e('All', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if ( ! empty($customer_sites)) : ?>
|
||||
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($customer_sites_category)); ?> wu-mx-2 wu-my-0">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($customer_sites_category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($customer_sites_category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($customer_sites_category); ?>'"
|
||||
><?php echo $customer_sites_category; ?></a>
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($categories) && $categories) : ?>
|
||||
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($category)); ?> wu-mx-2 wu-my-0">
|
||||
<li class="wu-site-template-filter-all wu-mx-2 wu-my-0">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($category); ?>'"
|
||||
><?php echo $category; ?></a>
|
||||
href="#"
|
||||
data-category=""
|
||||
:class="$parent.template_category === '' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = ''"
|
||||
>
|
||||
<?php esc_html_e('All', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php if ( ! empty($customer_sites)) : ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($customer_sites_category)); ?> wu-mx-2 wu-my-0">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($customer_sites_category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($customer_sites_category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($customer_sites_category); ?>'"
|
||||
><?php echo esc_html($customer_sites_category); ?></a>
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($categories) && $categories) : ?>
|
||||
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($category)); ?> wu-mx-2 wu-my-0">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($category); ?>'"
|
||||
>
|
||||
<?php echo esc_html($category); ?></a>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<div id="wu-site-template-container-grid" class="wu-grid wu-grid-cols-1 sm:wu-grid-cols-2 md:wu-grid-cols-<?php echo $cols ?? '3'; ?> wu-gap-4">
|
||||
|
||||
<?php foreach ($sites as $site_template) : ?>
|
||||
<div id="wu-site-template-container-grid" class="wu-grid wu-grid-cols-1 sm:wu-grid-cols-2 md:wu-grid-cols-<?php echo esc_attr($cols ?? '3'); ?> wu-gap-4">
|
||||
|
||||
<?php
|
||||
if ($site_template->get_type() !== 'site_template' && ! in_array($site_template->get_id(), $customer_sites, true)) {
|
||||
continue; }
|
||||
?>
|
||||
<?php foreach ($sites as $site_template) : ?>
|
||||
|
||||
<?php $is_template = $site_template->get_type() === 'site_template'; ?>
|
||||
<?php
|
||||
if ($site_template->get_type() !== 'site_template' && ! in_array($site_template->get_id(), $customer_sites, true)) {
|
||||
continue; }
|
||||
?>
|
||||
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
<?php $is_template = $site_template->get_type() === 'site_template'; ?>
|
||||
|
||||
<div
|
||||
id="wu-site-template-<?php echo esc_attr($site_template->get_id()); ?>"
|
||||
class="wu-bg-white wu-border-solid wu-border wu-border-gray-300 wu-shadow-sm wu-p-4 wu-rounded wu-relative"
|
||||
v-show="!$parent.template_category || <?php echo esc_attr(json_encode($categories)); ?>.join(',').indexOf($parent.template_category) > -1"
|
||||
v-cloak
|
||||
>
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
|
||||
<div class="wu-site-template-image-container wu-relative">
|
||||
<div
|
||||
id="wu-site-template-<?php echo esc_attr($site_template->get_id()); ?>"
|
||||
class="wu-bg-white wu-border-solid wu-border wu-border-gray-300 wu-shadow-sm wu-p-4 wu-rounded wu-relative"
|
||||
|
||||
v-show="!$parent.template_category || <?php echo esc_attr(wp_json_encode($categories)); ?>.join(',').indexOf($parent.template_category) > -1"
|
||||
v-cloak
|
||||
>
|
||||
|
||||
<div class="wu-site-template-image-container wu-relative">
|
||||
|
||||
<a
|
||||
title="<?php esc_attr_e('View Template Preview', 'wp-multisite-waas'); ?>"
|
||||
class="wu-site-template-selector wu-cursor-pointer wu-no-underline"
|
||||
<?php echo $is_template ? $site_template->get_preview_url_attrs() : sprintf('href="%s" target="_blank"', $site_template->get_active_site_url()); ?>
|
||||
<?php echo $is_template ? $site_template->get_preview_url_attrs() : sprintf('href="%s" target="_blank"', $site_template->get_active_site_url()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
>
|
||||
|
||||
<img class="wu-site-template-image wu-w-full wu-border-solid wu-border wu-border-gray-300 wu-mb-4 wu-bg-white" src="<?php echo esc_attr($site_template->get_featured_image()); ?>" alt="<?php echo $site_template->get_title(); ?>">
|
||||
|
||||
</a>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="wu-site-template-title wu-text-lg wu-font-semibold">
|
||||
<h3 class="wu-site-template-title wu-text-lg wu-font-semibold">
|
||||
|
||||
<?php echo $site_template->get_title(); ?>
|
||||
|
||||
</h3>
|
||||
<?php echo esc_html($site_template->get_title()); ?>
|
||||
|
||||
<p class="wu-site-template-description wu-text-sm">
|
||||
</h3>
|
||||
|
||||
<?php echo $site_template->get_description(); ?>
|
||||
<p class="wu-site-template-description wu-text-sm">
|
||||
|
||||
</p>
|
||||
|
||||
<div class="wu-mt-4">
|
||||
<?php echo esc_html($site_template->get_description()); ?>
|
||||
|
||||
<button v-on:click.prevent="$parent.template_id = <?php echo esc_attr($site_template->get_id()); ?>" type="button" class="wu-site-template-selector button btn button-primary btn-primary wu-w-full wu-text-center wu-cursor-pointer">
|
||||
</p>
|
||||
|
||||
<span v-if="$parent.template_id == <?php echo esc_attr($site_template->get_id()); ?>"><?php _e('Selected', 'wp-multisite-waas'); ?></span>
|
||||
<div class="wu-mt-4">
|
||||
|
||||
<span v-else><?php _e('Select', 'wp-multisite-waas'); ?></span>
|
||||
<button v-on:click.prevent="$parent.template_id = <?php echo esc_attr($site_template->get_id()); ?>" type="button" class="wu-site-template-selector button btn button-primary btn-primary wu-w-full wu-text-center wu-cursor-pointer">
|
||||
|
||||
</button>
|
||||
<span v-if="$parent.template_id == <?php echo esc_attr($site_template->get_id()); ?>"><?php esc_html_e('Selected', 'wp-multisite-waas'); ?></span>
|
||||
|
||||
</div>
|
||||
<span v-else><?php esc_html_e('Select', 'wp-multisite-waas'); ?></span>
|
||||
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -2,26 +2,28 @@
|
||||
/**
|
||||
* Template File: Basic Pricing Table.
|
||||
*
|
||||
* To see what methods are available on the product variable, @see inc/models/class-products.php.
|
||||
* To see what methods are available on the product variable, @param array $products List of product objects.
|
||||
*
|
||||
* @param string $name ID of the field.
|
||||
* @param string $label The field label.
|
||||
*
|
||||
* @see inc/models/class-products.php.
|
||||
*
|
||||
* This template can also be overridden using template overrides.
|
||||
* See more here: https://help.wpultimo.com/article/335-template-overrides.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @param array $products List of product objects.
|
||||
* @param string $name ID of the field.
|
||||
* @param string $label The field label.
|
||||
* @package WP_Ultimo/Views
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if ( ! $should_display) {
|
||||
if ( ! $should_display ) {
|
||||
echo '<div></div>';
|
||||
|
||||
return;
|
||||
} // end if;
|
||||
|
||||
}
|
||||
$sites = array_map('wu_get_site', $sites ?? []);
|
||||
|
||||
$categories ??= [];
|
||||
@ -32,234 +34,232 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
?>
|
||||
|
||||
<?php if (empty($sites)) : ?>
|
||||
<?php if ( empty($sites) ) : ?>
|
||||
|
||||
<div
|
||||
class="wu-text-center wu-bg-gray-100 wu-rounded wu-uppercase wu-font-semibold wu-text-xs wu-text-gray-700 wu-p-4"
|
||||
>
|
||||
|
||||
<?php _e('No Site Templates Found.', 'wp-multisite-waas'); ?>
|
||||
|
||||
</div>
|
||||
<div class="wu-text-center wu-bg-gray-100 wu-rounded wu-uppercase wu-font-semibold wu-text-xs wu-text-gray-700 wu-p-4">
|
||||
<?php esc_html_e('No Site Templates Found.', 'wp-multisite-waas'); ?>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="themes-php wu-styling">
|
||||
<div class="themes-php wu-styling">
|
||||
|
||||
<div class="wrap wu-template-selection">
|
||||
<div class="wrap wu-template-selection">
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Allow developers to hide the title.
|
||||
*/
|
||||
if (apply_filters('wu_step_template_display_header', true)) :
|
||||
/**
|
||||
* Allow developers to hide the title.
|
||||
*/
|
||||
if ( apply_filters('wu_step_template_display_header', true) ) :
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<h2>
|
||||
<h2>
|
||||
|
||||
<?php _e('Pick your Template', 'wp-multisite-waas'); ?>
|
||||
<?php esc_html_e('Pick your Template', 'wp-multisite-waas'); ?>
|
||||
|
||||
<span class="title-count theme-count">
|
||||
<span class="title-count theme-count">
|
||||
<?php echo count($sites); ?>
|
||||
</span>
|
||||
|
||||
<?php echo count($sites); ?>
|
||||
|
||||
</span>
|
||||
|
||||
</h2>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wp-filter">
|
||||
|
||||
<div class="wp-filter-responsive">
|
||||
|
||||
<h4><?php _e('Template Categories', 'wp-multisite-waas'); ?></h4>
|
||||
|
||||
<select class="">
|
||||
|
||||
<option value="">
|
||||
|
||||
<?php _e('All Templates', 'wp-multisite-waas'); ?>
|
||||
|
||||
</option>
|
||||
|
||||
<?php if ( ! empty($customer_sites)) : ?>
|
||||
|
||||
<option value="<?php echo esc_attr($customer_sites_category); ?>">
|
||||
|
||||
<?php echo $customer_sites_category; ?>
|
||||
|
||||
</option>
|
||||
</h2>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
<div class="wp-filter">
|
||||
|
||||
<option value="<?php echo esc_attr($category); ?>">
|
||||
|
||||
<?php echo $category; ?>
|
||||
|
||||
</option>
|
||||
<div class="wp-filter-responsive">
|
||||
|
||||
<?php endforeach; ?>
|
||||
<h4><?php esc_html_e('Template Categories', 'wp-multisite-waas'); ?></h4>
|
||||
|
||||
</select>
|
||||
<select class="">
|
||||
|
||||
</div>
|
||||
<option value="">
|
||||
|
||||
<ul class="filter-links wp-filter-template">
|
||||
<?php esc_html_e('All Templates', 'wp-multisite-waas'); ?>
|
||||
|
||||
<li class="selector-inactive">
|
||||
</option>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
data-category=""
|
||||
:class="$parent.template_category === '' ? 'current' : ''"
|
||||
v-on:click.prevent="$parent.template_category = ''"
|
||||
>
|
||||
|
||||
<?php _e('All Templates', 'wp-multisite-waas'); ?>
|
||||
|
||||
</a>
|
||||
<?php if ( ! empty($customer_sites) ) : ?>
|
||||
|
||||
</li>
|
||||
<option value="<?php echo esc_attr($customer_sites_category); ?>">
|
||||
|
||||
<?php if ( ! empty($customer_sites)) : ?>
|
||||
|
||||
<li class="selector-inactive">
|
||||
<?php echo esc_html($customer_sites_category); ?>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($customer_sites_category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($customer_sites_category); ?>' ? 'current' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($customer_sites_category); ?>'"
|
||||
>
|
||||
|
||||
<?php echo $customer_sites_category; ?>
|
||||
|
||||
</a>
|
||||
</option>
|
||||
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php foreach ( $categories as $category ) : ?>
|
||||
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
<option value="<?php echo esc_attr($category); ?>">
|
||||
|
||||
<li class="selector-inactive">
|
||||
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($category); ?>' ? 'current' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($category); ?>'"
|
||||
>
|
||||
|
||||
<?php echo $category; ?>
|
||||
|
||||
</a>
|
||||
<?php echo esc_html($category); ?>
|
||||
|
||||
</li>
|
||||
</option>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</ul>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="theme-browser rendered">
|
||||
<ul class="filter-links wp-filter-template">
|
||||
|
||||
<div class="wu-grid wu-grid-cols-1 sm:wu-grid-cols-2 md:wu-grid-cols-<?php echo $cols; ?> wu-gap-4 wp-clearfix">
|
||||
<li class="selector-inactive">
|
||||
|
||||
<?php $i = 0; foreach ($sites as $site) : ?>
|
||||
<a
|
||||
href="#"
|
||||
data-category=""
|
||||
:class="$parent.template_category === '' ? 'current' : ''"
|
||||
v-on:click.prevent="$parent.template_category = ''"
|
||||
>
|
||||
|
||||
<?php
|
||||
if ($site->get_type() !== 'site_template' && ! in_array($site->get_id(), $customer_sites, true)) {
|
||||
continue; }
|
||||
?>
|
||||
<?php esc_html_e('All Templates', 'wp-multisite-waas'); ?>
|
||||
|
||||
<?php $is_template = $site->get_type() === 'site_template'; ?>
|
||||
</a>
|
||||
|
||||
<?php $categories = array_merge($site->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
</li>
|
||||
|
||||
<div
|
||||
class="theme"
|
||||
tabindex="<?php echo $i; ?>"
|
||||
aria-describedby="<?php echo $site->get_id(); ?>-action <?php echo $site->get_id(); ?>-name"
|
||||
data-slug="<?php echo $site->get_id(); ?>"
|
||||
v-show="!$parent.template_category || <?php echo esc_attr(json_encode($categories)); ?>.join(',').indexOf($parent.template_category) > -1"
|
||||
v-cloak
|
||||
>
|
||||
<?php if ( ! empty($customer_sites) ) : ?>
|
||||
|
||||
<div class="theme-screenshot">
|
||||
<li class="selector-inactive">
|
||||
|
||||
<img
|
||||
src="<?php echo $site->get_featured_image(); ?>"
|
||||
alt="<?php echo $site->get_title(); ?>"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($customer_sites_category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($customer_sites_category); ?>' ? 'current' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($customer_sites_category); ?>'"
|
||||
>
|
||||
|
||||
|
||||
<?php echo esc_html($customer_sites_category); ?>
|
||||
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ( $categories as $category ) : ?>
|
||||
|
||||
<li class="selector-inactive">
|
||||
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($category); ?>' ? 'current' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($category); ?>'"
|
||||
>
|
||||
|
||||
|
||||
<?php echo esc_html($category); ?>
|
||||
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<a
|
||||
<?php echo $is_template ? $site->get_preview_url_attrs() : sprintf('href="%s" target="_blank"', $site->get_active_site_url()); ?>
|
||||
class="more-details"
|
||||
id="<?php echo $site->get_id(); ?>-action"
|
||||
>
|
||||
<div class="theme-browser rendered">
|
||||
|
||||
<?php $is_template ? _e('View Template', 'wp-multisite-waas') : _e('View Site', 'wp-multisite-waas'); ?>
|
||||
|
||||
</a>
|
||||
<div class="wu-grid wu-grid-cols-1 sm:wu-grid-cols-2 md:wu-grid-cols-<?php echo esc_attr($cols); ?> wu-gap-4 wp-clearfix">
|
||||
|
||||
<div class="wu-flex theme-name-header wu-items-center wu-relative">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $sites as $site ) :
|
||||
?>
|
||||
|
||||
<h2 class="theme-name wu-flex-grow wu-h-full" id="<?php echo $site->get_id(); ?>-name">
|
||||
<?php
|
||||
if ( $site->get_type() !== 'site_template' && ! in_array($site->get_id(), $customer_sites, true) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php echo $site->get_title(); ?>
|
||||
|
||||
</h2>
|
||||
<?php $is_template = $site->get_type() === 'site_template'; ?>
|
||||
|
||||
<div class="theme-actions wu-flex">
|
||||
<?php $categories = array_merge($site->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
|
||||
<button
|
||||
class="button button-primary"
|
||||
type="button"
|
||||
v-on:click.prevent="$parent.template_id = <?php echo esc_attr($site->get_id()); ?>"
|
||||
>
|
||||
<div
|
||||
class="theme"
|
||||
tabindex="<?php echo esc_attr($i); ?>"
|
||||
aria-describedby="<?php echo esc_attr($site->get_id()); ?>-action <?php echo esc_attr($site->get_id()); ?>-name"
|
||||
data-slug="<?php echo esc_attr($site->get_id()); ?>"
|
||||
v-show="!$parent.template_category || <?php echo esc_attr(wp_json_encode($categories)); ?>.join(',').indexOf($parent.template_category) > -1"
|
||||
v-cloak
|
||||
>
|
||||
|
||||
<span v-if="$parent.template_id == <?php echo esc_attr($site->get_id()); ?>"><?php _e('Selected', 'wp-multisite-waas'); ?></span>
|
||||
<div class="theme-screenshot">
|
||||
|
||||
<span v-else><?php _e('Select', 'wp-multisite-waas'); ?></span>
|
||||
<img
|
||||
src="<?php echo esc_url($site->get_featured_image()); ?>"
|
||||
alt="<?php echo esc_attr($site->get_title()); ?>"
|
||||
>
|
||||
</div>
|
||||
|
||||
</button>
|
||||
<a
|
||||
<?php echo $is_template ? $site->get_preview_url_attrs() : sprintf('href="%s" target="_blank"', $site->get_active_site_url()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
class="more-details"
|
||||
id="<?php echo esc_attr($site->get_id()); ?>-action"
|
||||
>
|
||||
<?php $is_template ? esc_html_e('View Template', 'wp-multisite-waas') : esc_html_e('View Site', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
|
||||
<div class="wu-flex theme-name-header wu-items-center wu-relative">
|
||||
|
||||
|
||||
<h2 class="theme-name wu-flex-grow wu-h-full"
|
||||
id="<?php echo esc_attr($site->get_id()); ?>-name">
|
||||
<?php echo esc_html($site->get_title()); ?>
|
||||
</h2>
|
||||
|
||||
<div class="theme-actions wu-flex">
|
||||
|
||||
<button
|
||||
class="button button-primary"
|
||||
type="button"
|
||||
v-on:click.prevent="$parent.template_id = <?php echo esc_attr($site->get_id()); ?>"
|
||||
>
|
||||
|
||||
<span v-if="$parent.template_id == <?php echo esc_attr($site->get_id()); ?>"><?php esc_html_e('Selected', 'wp-multisite-waas'); ?></span>
|
||||
|
||||
<span v-else><?php esc_html_e('Select', 'wp-multisite-waas'); ?></span>
|
||||
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
++$i;
|
||||
endforeach;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="theme-overlay"></div>
|
||||
|
||||
<?php
|
||||
|
||||
++$i;
|
||||
endforeach;
|
||||
|
||||
?>
|
||||
<p class="no-themes">
|
||||
<?php esc_html_e('No Templates Found', 'wp-multisite-waas'); ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="theme-overlay"></div>
|
||||
|
||||
<p class="no-themes">
|
||||
|
||||
<?php _e('No Templates Found', 'wp-multisite-waas'); ?>
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
@ -20,8 +20,7 @@ defined('ABSPATH') || exit;
|
||||
|
||||
if ( ! $should_display) {
|
||||
return;
|
||||
} // end if;
|
||||
|
||||
}
|
||||
$sites = array_map('wu_get_site', $sites ?? []);
|
||||
|
||||
$categories ??= [];
|
||||
@ -35,107 +34,103 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
<ul id="wu-site-template-filter">
|
||||
|
||||
<li class="wu-site-template-filter-all">
|
||||
<a
|
||||
href="#"
|
||||
data-category=""
|
||||
:class="$parent.template_category === '' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = ''"
|
||||
>
|
||||
<?php _e('All', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if ( ! empty($customer_sites)) : ?>
|
||||
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($customer_sites_category)); ?>">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($customer_sites_category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($customer_sites_category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($customer_sites_category); ?>'"
|
||||
><?php echo $customer_sites_category; ?></a>
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($categories) && $categories) : ?>
|
||||
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($category)); ?>">
|
||||
<li class="wu-site-template-filter-all">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($category); ?>'"
|
||||
><?php echo $category; ?></a>
|
||||
href="#"
|
||||
data-category=""
|
||||
:class="$parent.template_category === '' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = ''"
|
||||
>
|
||||
<?php esc_html_e('All', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php if ( ! empty($customer_sites)) : ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($customer_sites_category)); ?>">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($customer_sites_category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($customer_sites_category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($customer_sites_category); ?>'"
|
||||
>
|
||||
<?php echo esc_html($customer_sites_category); ?></a>
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($categories) && $categories) : ?>
|
||||
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
|
||||
<li class="wu-site-template-filter-<?php echo esc_attr(sanitize_title($category)); ?>">
|
||||
<a
|
||||
href="#"
|
||||
data-category="<?php echo esc_attr($category); ?>"
|
||||
:class="$parent.template_category === '<?php echo esc_attr($category); ?>' ? 'current wu-font-semibold' : ''"
|
||||
v-on:click.prevent="$parent.template_category = '<?php echo esc_attr($category); ?>'"
|
||||
>
|
||||
<?php echo esc_html($category); ?></a>
|
||||
</li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<div id="wu-site-template-container-grid">
|
||||
|
||||
<?php foreach ($sites as $site_template) : ?>
|
||||
<?php foreach ($sites as $site_template) : ?>
|
||||
|
||||
<?php
|
||||
if ($site_template->get_type() !== 'site_template' && ! in_array($site_template->get_id(), $customer_sites, true)) {
|
||||
continue; }
|
||||
?>
|
||||
<?php
|
||||
if ($site_template->get_type() !== 'site_template' && ! in_array($site_template->get_id(), $customer_sites, true)) {
|
||||
continue; }
|
||||
?>
|
||||
|
||||
<?php $is_template = $site_template->get_type() === 'site_template'; ?>
|
||||
<?php $is_template = $site_template->get_type() === 'site_template'; ?>
|
||||
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
|
||||
<div
|
||||
id="wu-site-template-<?php echo esc_attr($site_template->get_id()); ?>"
|
||||
v-show="!$parent.template_category || <?php echo esc_attr(json_encode($categories)); ?>.join(',').indexOf($parent.template_category) > -1"
|
||||
v-cloak
|
||||
>
|
||||
<div
|
||||
id="wu-site-template-<?php echo esc_attr($site_template->get_id()); ?>"
|
||||
v-show="!$parent.template_category || <?php echo esc_attr(wp_json_encode($categories)); ?>.join(',').indexOf($parent.template_category) > -1"
|
||||
v-cloak
|
||||
>
|
||||
|
||||
<img class="wu-site-template-image" src="<?php echo esc_attr($site_template->get_featured_image()); ?>" alt="<?php echo $site_template->get_title(); ?>">
|
||||
<img class="wu-site-template-image" src="<?php echo esc_attr($site_template->get_featured_image()); ?>" alt="<?php echo esc_attr($site_template->get_title()); ?>">
|
||||
|
||||
<h3 class="wu-site-template-title">
|
||||
<h3 class="wu-site-template-title">
|
||||
<?php echo esc_html($site_template->get_title()); ?>
|
||||
</h3>
|
||||
|
||||
<?php echo $site_template->get_title(); ?>
|
||||
<p class="wu-site-template-description">
|
||||
<?php echo esc_html($site_template->get_description()); ?>
|
||||
</p>
|
||||
|
||||
</h3>
|
||||
<div class="wu-site-template-preview-block">
|
||||
|
||||
<p class="wu-site-template-description">
|
||||
<a class="wu-site-template-selector" <?php echo $site_template->get_preview_url_attrs(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php esc_html_e('View Template Preview', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
|
||||
<?php echo $site_template->get_description(); ?>
|
||||
</div>
|
||||
|
||||
</p>
|
||||
<label for="wu-site-template-id-<?php echo esc_attr($site_template->get_id()); ?>">
|
||||
|
||||
<div class="wu-site-template-preview-block">
|
||||
<input id="wu-site-template-id-<?php echo esc_attr($site_template->get_id()); ?>" type="radio" name="template_id" v-model="$parent.template_id" value="<?php echo esc_attr($site_template->get_id()); ?>" />
|
||||
|
||||
<a class="wu-site-template-selector" <?php echo $site_template->get_preview_url_attrs(); ?>>
|
||||
<a class="wu-site-template-selector" @click.prevent="" href="#">
|
||||
|
||||
<?php _e('View Template Preview', 'wp-multisite-waas'); ?>
|
||||
<?php esc_html_e('Select this Template', 'wp-multisite-waas'); ?>
|
||||
|
||||
</a>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<label for="wu-site-template-id-<?php echo esc_attr($site_template->get_id()); ?>">
|
||||
</div>
|
||||
|
||||
<input id="wu-site-template-id-<?php echo esc_attr($site_template->get_id()); ?>" type="radio" name="template_id" v-model="$parent.template_id" value="<?php echo esc_attr($site_template->get_id()); ?>" />
|
||||
|
||||
<a class="wu-site-template-selector" @click.prevent="" href="#">
|
||||
|
||||
<?php _e('Select this Template', 'wp-multisite-waas'); ?>
|
||||
|
||||
</a>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user