Skip to content

Commit 3198de8

Browse files
committed
Use echo() format for direct output that doesn't use htmlentities to also allow using content filters (data-filter) in html templates.
1 parent 7f19fad commit 3198de8

15 files changed

+23
-22
lines changed

app/template/components/breadcrumb.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $breadcrumb = $current_component = $this->_component['breadcrumb'][$_breadcrumb_
1212

1313
$_pagination_count = $breadcrumb['count'] ?? 0;
1414
$_pagination_limit = isset($breadcrumb['limit']) ? $breadcrumb['limit'] : 5;
15-
15+
$index = 0;
1616
?>
1717

1818

@@ -21,7 +21,7 @@ $_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => []] : f
2121
$breadcrumb['breadcrumb'] = empty($breadcrumb['breadcrumb']) ? $_default : $breadcrumb['breadcrumb'];
2222

2323
if($breadcrumb && is_array($breadcrumb['breadcrumb'])) {
24-
foreach ($breadcrumb['breadcrumb'] as $index => $breadcrumb) {?>
24+
foreach ($breadcrumb['breadcrumb'] as $index => $breadcrumb) {$index++;?>
2525
2626
@item [data-v-breadcrumb-item-*]|innerText = $breadcrumb['@@__data-v-breadcrumb-item-(*)__@@']
2727

app/template/components/comments.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if($_comments && is_array($_comments)) {
2828
2929
@comment|id = <?php echo 'comment-' . $comment['comment_id'];?>
3030
31-
@comment [data-v-comment-content] = <?php echo $comment['content'];?>
31+
@comment [data-v-comment-content] = <?php echo($comment['content']);?>
3232
3333
@comment img[data-v-comment-*]|src = $comment['@@__data-v-comment-(*)__@@']
3434
@comment img[data-v-comment-*]|width = <?php echo $comment['size'] ?? '60';?>

app/template/components/menu.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ if (isset($this->_component['menu']) && isset($this->_component['menu'][$_menu_i
4242
4343
//catch all data attributes
4444
@category [data-v-menu-item-*]|innerText = $category['@@__data-v-menu-item-(*)__@@']
45-
@category [data-v-menu-item-content] = <?php echo $category['content'] ?? '';?>
45+
@category [data-v-menu-item-content] = <?php echo($category['content'] ?? '');?>
4646
4747
@category [data-v-menu-item-url]|href = <?php if (isset($category['url'])) echo Vvveb\System\Sites::url($category['url']);?>
4848
@category [data-v-menu-item-img]|src = $category['images'][0]
4949
5050
@category|append = <?php
51-
if ($category['children'] > 0 && $generate_menu) {
51+
if ($category['children'] > 0 && isset($generate_menu)) {
5252
$parents++;
5353
$generate_menu($category['menu_item_id'], $_categories);
5454
}

app/template/components/product.tpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $_pagination_limit = isset($product['limit']) ? $product['limit'] : 5;
3434
@product a[data-v-product-*]|href = $product['@@__data-v-product-(*)__@@']
3535

3636

37-
@product img[data-v-product-main-image]|src = <?php echo $product['image'];?>
37+
@product img[data-v-product-main-image]|src = <?php echo($product['image']);?>
3838
@product [data-v-product-main-image-background-image]|style = <?php echo 'background-image: url(\'' . $product['image'] . '\');';?>
3939
@product a[data-v-product-main-image]|href = <?php echo reset($product['images'])['image'];?>
4040

@@ -51,6 +51,8 @@ if($_images) {
5151
5252
@images [data-bs-slide-to]|data-bs-slide-to = <?php echo $i;?>
5353
@images img[data-v-product-image-src]|src = $_image['image']
54+
@images [data-v-product-image-src] = $_image['image']
55+
[data-v-product-image-src]@images = $_image['image']
5456
@images [data-v-product-image-background-image]|style = <?php echo 'background-image: url(\'' . $_image['image'] . '\');';?>
5557
@images a[data-v-product-image-src]|href = $_image['image']
5658
@images img[data-v-product-image-src]|data-v-id = $_image['product_image_id']

app/template/components/product/attributes.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if($attributes && is_array($attributes['attribute'])) {
3434

3535
@attribute|id = <?php echo 'attribute-' . $attribute['attribute_id'];?>
3636

37-
@attribute [data-v-attribute-content] = <?php echo $attribute['content'];?>
37+
@attribute [data-v-attribute-content] = <?php echo($attribute['content']);?>
3838

3939
@attribute img[data-v-attribute-*]|src = $attribute['@@__data-v-attribute-(*)__@@']
4040

app/template/components/product/manufacturers.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if($manufacturers && is_array($manufacturers['manufacturer'])) {
2525
2626
@manufacturer|id = <?php echo 'manufacturer-' . $manufacturer['manufacturer_id'];?>
2727
28-
@manufacturer [data-v-manufacturer-content] = <?php echo $manufacturer['content'];?>
28+
@manufacturer [data-v-manufacturer-content] = <?php echo($manufacturer['content']);?>
2929
3030
@manufacturer img[data-v-manufacturer-*]|src = $manufacturer['@@__data-v-manufacturer-(*)__@@']
3131

app/template/components/product/options.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if($options && is_array($options)) {
4848
4949
@option|id = <?php echo 'option-' . ($option['product_option_id'] ?? 0);?>
5050
51-
@option [data-v-option-content] = <?php echo $option['content'] ?? '';?>
51+
@option [data-v-option-content] = <?php echo($option['content'] ?? '');?>
5252
5353
@option img[data-v-option-*]|src = $option['@@__data-v-option-(*)__@@']
5454

app/template/components/product/vendors.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if($vendors && is_array($vendors['vendor'])) {
2525
2626
@vendor|id = <?php echo 'vendor-' . $vendor['vendor_id'];?>
2727
28-
@vendor [data-v-vendor-content] = <?php echo $vendor['content'];?>
28+
@vendor [data-v-vendor-content] = <?php echo($vendor['content']);?>
2929
3030
@vendor img[data-v-vendor-*]|src = $vendor['@@__data-v-vendor-(*)__@@']
3131

app/template/components/products.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ if ($_products) {
116116
//catch all data attributes
117117
@product [data-v-product-*]|innerText = $_product['@@__data-v-product-(*)__@@']
118118
//echo description directly to avoid htmlentities escape
119-
@product [data-v-product-content] = <?php echo $_product['content'];?>
119+
@product [data-v-product-content] = <?php echo($_product['content']);?>
120120

121121
@product|after = <?php
122122
}

app/template/components/questions.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if($questions && is_array($questions)) {
2828
2929
@question|id = <?php echo 'question-' . $question['product_question_id'];?>
3030
31-
@question [data-v-question-content] = <?php echo $question['content'];?>
31+
@question [data-v-question-content] = <?php echo($question['content']);?>
3232
3333
@question img[data-v-question-*]|src = $question['@@__data-v-question-(*)__@@']
3434
@question img[data-v-question-avatar]|width = <?php echo $question['size'] ?? '60';?>

app/template/components/user/wishlist.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
?>
2828

2929
@wishlist [data-v-wishlist-category] = <?php $_category = current($wishlist);echo $_category['category'];?>
30-
@wishlist [data-v-wishlist-count] = <?php echo $wishlist['count'] ?? ''?>
30+
@wishlist [data-v-wishlist-count] = <?php echo($wishlist['count'] ?? '')?>
3131
@wishlist [data-v-wishlist-manufacturer] = <?php $_manufacturer = current($wishlist);echo $_manufacturer['manufacturer'];?>
3232

3333

@@ -118,7 +118,7 @@ if ($_wishlist) {
118118
//catch all data attributes
119119
@product [data-v-product-*]|innerText = $_product['@@__data-v-product-(*)__@@']
120120
//echo description directly to avoid htmlentities escape
121-
@product [data-v-product-content] = <?php echo $_product['content'];?>
121+
@product [data-v-product-content] = <?php echo($_product['content']);?>
122122

123123
@product|after = <?php
124124
}

app/template/email/common.tpl

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
import(components.tpl)
2-
import(ifmacros.tpl)
3-
2+
import(ifmacros.tpl)

app/template/notifications.tpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (isset($this->errors) && is_array($this->errors)) {
1212
foreach ($list as $message) {
1313
?>
1414
15-
@error [data-v-notification-text] = <?php echo $message;?>
15+
@error [data-v-notification-text] = <?php echo($message);?>
1616
1717
@error|after = <?php
1818
}
@@ -34,7 +34,7 @@ if (isset($this->success) && is_array($this->success)) {
3434
foreach ($list as $message) {
3535
?>
3636
37-
@success [data-v-notification-text] = <?php echo $message;?>
37+
@success [data-v-notification-text] = <?php echo($message);?>
3838
3939
@success|after = <?php
4040
}
@@ -47,7 +47,7 @@ if (isset($this->success) && is_array($this->success)) {
4747
@info|before = <?php
4848
if (isset($this->info) && is_array($this->info)) foreach($this->info as $message) {?>
4949
50-
@info [data-v-notification-text] = <?php echo $message;?>
50+
@info [data-v-notification-text] = <?php echo($message);?>
5151
5252
@info|after = <?php
5353
}
@@ -66,7 +66,7 @@ if (isset($this->message) && is_array($this->message)) {
6666
foreach ($list as $message) {
6767
?>
6868
69-
@message [data-v-notification-text] = <?php echo $message;?>
69+
@message [data-v-notification-text] = <?php echo($message);?>
7070
7171
@message|after = <?php
7272
}

app/template/user/address/edit.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import(common.tpl)
22

3-
[data-v-user_address-*] = <?php echo $this->user_address['@@__data-v-user_address-(*)__@@'] ?? '';?>
3+
[data-v-user_address-*] = <?php echo($this->user_address['@@__data-v-user_address-(*)__@@'] ?? '');?>
44

55
[data-v-countries]|data-v-region-id = $this->user_address['region_id']
66

app/template/user/profile.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import(common.tpl)
22

3-
[data-v-user-*] = <?php echo $this->user['@@__data-v-user-(*)__@@'] ?? '';?>
3+
[data-v-user-*] = <?php echo($this->user['@@__data-v-user-(*)__@@'] ?? '');?>

0 commit comments

Comments
 (0)