PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
← All changes | includes/builder/builder-template-helper.php +32 -9 2.0.23.1.4 View file →
@@ -1,8 +1,12 @@
1 1 <?php
2 2
3 3 namespace UltimateStoreKit\Includes\Builder;
4 4
5 +if (! defined('ABSPATH')) {
6 + exit; // Exit if accessed directly
7 +}
8 +
5 9 class Builder_Template_Helper {
6 10
7 11 public static function isTemplateEditMode() {
8 12 if ( get_post_type() == Meta::POST_TYPE ) {
@@ -8,8 +12,9 @@
8 12 if ( get_post_type() == Meta::POST_TYPE ) {
9 13 return true;
10 14 }
11 15
16 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only check on whether a builder template is being edited.
12 17 if ( isset( $_REQUEST[ Meta::POST_TYPE ] ) ) {
13 18 return true;
14 19 }
15 20 }
@@ -22,14 +27,17 @@
22 27 $shop_item = [
23 28 'shop' => 'Shop Page',
24 29 'archive' => 'Archive Page',
25 30 'single' => 'Single Page',
31 + 'category' => 'Category Page',
32 + 'tag' => 'Tag Page',
26 33 'cart' => 'Cart Page',
27 34 'checkout' => 'Checkout',
28 - 'order-received' => 'Order Received',
35 + 'order-received' => 'Order Received (Thank You Page)',
29 36 ];
30 37
31 38 $my_account = [
39 + 'login' => 'Login & Register',
32 40 'myaccount' => 'Dashboard',
33 41 'orders' => 'Orders',
34 42 'downloads' => 'Downloads',
35 43 'edit-address' => 'Address',
@@ -37,12 +45,30 @@
37 45 'wishlist' => 'Wishlist',
38 46 'logout' => 'Customer Logout',
39 47 ];
40 48
49 + // Endpoints that belong to the order/checkout flow rather than the
50 + // authenticated account area. Everything else from WC()->query is treated
51 + // as an account screen so the dropdown grouping matches the routing in
52 + // Builder_Integration::setFrontendTemplate(), which looks endpoint
53 + // templates up under the `account` post-type group.
54 + $order_flow_endpoints = apply_filters(
55 + 'ultimate_store_kit_builder_order_flow_endpoints',
56 + [ 'order-pay', 'order-received' ]
57 + );
58 +
41 59 if ( $wcItems = WC()->query->get_query_vars() ) {
42 - array_walk( $wcItems, function ($item, $key) use (&$shop_item) {
43 - $shop_item[ $key ] = ucwords( str_replace( '-', ' ', $key ) );
44 - } );
60 + foreach ( $wcItems as $key => $item ) {
61 + $label = ucwords( str_replace( '-', ' ', $key ) );
62 + if ( in_array( $key, $order_flow_endpoints, true ) ) {
63 + // Keep hand-written labels (e.g. order-received) intact.
64 + if ( ! isset( $shop_item[ $key ] ) ) {
65 + $shop_item[ $key ] = $label;
66 + }
67 + } else {
68 + $my_account[ $key ] = $label;
69 + }
70 + }
45 71 }
46 72
47 73 $product = [
48 74 'product' => $shop_item,
@@ -104,18 +130,15 @@
104 130 }
105 131
106 132 $separator = static::separator();
107 133 $template = strtolower( "{$postType}{$separator}{$slug}" );
108 - $enabledTemplate = strtolower( Meta::TEMPLATE_ID . $template );
109 -
110 134 /**
111 135 * important area for debugging
112 136 */
113 137
114 - return get_option( $enabledTemplate );
138 + return Meta::get_template_option( $template );
115 139 }
116 140
117 141 public static function getTemplateId( $templateType ) {
118 - $metaIndex = strtolower( Meta::TEMPLATE_ID . $templateType );
119 - return intval( get_option( $metaIndex ) );
142 + return intval( Meta::get_template_option( $templateType ) );
120 143 }
121 144 }