kk Star Ratings - Version 5.3.1

Version Description

Download this release

Release Info

Developer bhittani
Plugin Icon 128x128 kk Star Ratings
Version 5.3.1
Comparing to
See all releases

Code changes from version 5.3.0 to 5.3.1

CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
 
 
 
 
 
 
 
 
 
 
8
  ## [5.3.0] - 2022-05-26
9
 
10
  ### Added
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
 
8
+ ## [5.3.1] - 2022-07-08
9
+
10
+ ### Fixed
11
+ - Backwards compatibility of `kksr_rate` and `kksr_vote` action hook.
12
+ - Refactored the way fingerprint (IP Address) is calculated.
13
+ - View templates now respect a view slug.
14
+ - Shortcode now accepts a custom class attribute.
15
+ - Touched CSS styles.
16
+
17
  ## [5.3.0] - 2022-05-26
18
 
19
  ### Added
index.php CHANGED
@@ -10,7 +10,7 @@
10
  * Author URI: http://bhittani.com
11
  * Text Domain: kk-star-ratings
12
  * Domain Path: /languages
13
- * Version: 5.3.0
14
  * License: GPLv2 or later
15
  */
16
 
10
  * Author URI: http://bhittani.com
11
  * Text Domain: kk-star-ratings
12
  * Domain Path: /languages
13
+ * Version: 5.3.1
14
  * License: GPLv2 or later
15
  */
16
 
languages/kk-star-ratings.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the kk Star Ratings plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: kk Star Ratings 5.3.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-05-26T13:12:56+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: kk-star-ratings\n"
2
  # This file is distributed under the same license as the kk Star Ratings plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: kk Star Ratings 5.3.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kk-star-ratings\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-07-08T11:07:45+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: kk-star-ratings\n"
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: star ratings, votings, rate posts, ajax ratings, infinite stars, unlimited
6
  Requires at least: 5.0
7
  Requires PHP: 7.2
8
  Tested up to: 6.0
9
- Stable tag: 5.3.0
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Requires at least: 5.0
7
  Requires PHP: 7.2
8
  Tested up to: 6.0
9
+ Stable tag: 5.3.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
src/core/actions/save.php CHANGED
@@ -23,6 +23,7 @@ function save(float $outOf5, int $id, string $slug, array $payload): void
23
  {
24
  $count = (int) filter('count', null, $id, $slug);
25
  $ratings = (float) filter('ratings', null, $id, $slug);
 
26
 
27
  // For safe keeping, ensure we have not already casted this vote.
28
  if ($count == ((int) $payload['count'] ?? 0)
@@ -41,7 +42,6 @@ function save(float $outOf5, int $id, string $slug, array $payload): void
41
  ]);
42
 
43
  // Legacy support...
44
- $legacySlug = $slug == 'default' ? '' : "_{$slug}";
45
 
46
  post_meta($id, [
47
  "casts{$legacySlug}" => $newCount, // < v5
@@ -50,4 +50,17 @@ function save(float $outOf5, int $id, string $slug, array $payload): void
50
  "avg{$legacySlug}" => $newRatings / $newCount, // < v3
51
  ]);
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
23
  {
24
  $count = (int) filter('count', null, $id, $slug);
25
  $ratings = (float) filter('ratings', null, $id, $slug);
26
+ $legacySlug = $slug == 'default' ? '' : "_{$slug}";
27
 
28
  // For safe keeping, ensure we have not already casted this vote.
29
  if ($count == ((int) $payload['count'] ?? 0)
42
  ]);
43
 
44
  // Legacy support...
 
45
 
46
  post_meta($id, [
47
  "casts{$legacySlug}" => $newCount, // < v5
50
  "avg{$legacySlug}" => $newRatings / $newCount, // < v3
51
  ]);
52
  }
53
+
54
+ // Backwards compatibility!
55
+ // Allow third-party code to continue relying
56
+ // on legacy/depecrated action hook.
57
+
58
+ // < v3
59
+ do_action('kksr_rate', $id, $outOf5, $fingerprint);
60
+
61
+ // v3 (replaced by v4)
62
+ // do_action('kksr_vote', $id, $outOf5, $fingerprint);
63
+
64
+ // < v5
65
+ do_action('kksr_vote', $outOf5, 5, $id, $legacySlug, $fingerprint);
66
  }
src/core/filters/fingerprint.php CHANGED
@@ -22,5 +22,13 @@ function fingerprint(?string $fingerprint, int $id, string $slug): string
22
  return $fingerprint;
23
  }
24
 
25
- return md5($_SERVER['REMOTE_ADDR']);
 
 
 
 
 
 
 
 
26
  }
22
  return $fingerprint;
23
  }
24
 
25
+ $ip = $_SERVER['REMOTE_ADDR'];
26
+
27
+ if ($httpClientIp = ($_SERVER['HTTP_CLIENT_IP'] ?? null)) {
28
+ $ip = $httpClientIp;
29
+ } elseif ($httpXForwardedFor = ($_SERVER['HTTP_X_FORWARDED_FOR'] ?? null)) {
30
+ $ip = $httpXForwardedFor;
31
+ }
32
+
33
+ return md5($ip);
34
  }
src/core/filters/okay.php CHANGED
@@ -51,7 +51,7 @@ function okay(?bool $okay, int $id, string $slug, array $payload): bool
51
  return false;
52
  }
53
 
54
- if ($reference == 'shortcode') {
55
  return true;
56
  }
57
 
51
  return false;
52
  }
53
 
54
+ if ($reference != 'auto') {
55
  return true;
56
  }
57
 
src/core/functions/response.php CHANGED
@@ -19,8 +19,8 @@ if (! defined('KK_STAR_RATINGS')) {
19
  function response(array $payload): string
20
  {
21
  $payload += array_fill_keys([
22
- 'align', 'count', 'id', 'readonly',
23
- 'score', 'slug', 'valign',
24
  ], '') + [
25
  'best' => option('stars'),
26
  'gap' => option('gap'),
@@ -44,6 +44,8 @@ function response(array $payload): string
44
  $payload['legend'] = str_replace('{score}', $payload['score'], $payload['legend']);
45
  $payload['legend'] = str_replace('{votes}', _n('vote', 'votes', $payload['count'], 'kk-star-ratings'), $payload['legend']);
46
 
 
 
47
  ob_start();
48
 
49
  action('markup', $payload);
19
  function response(array $payload): string
20
  {
21
  $payload += array_fill_keys([
22
+ 'align', 'class', 'count', 'id', 'readonly',
23
+ 'reference', 'score', 'slug', 'valign',
24
  ], '') + [
25
  'best' => option('stars'),
26
  'gap' => option('gap'),
44
  $payload['legend'] = str_replace('{score}', $payload['score'], $payload['legend']);
45
  $payload['legend'] = str_replace('{votes}', _n('vote', 'votes', $payload['count'], 'kk-star-ratings'), $payload['legend']);
46
 
47
+ $payload['font_factor'] = 1.25;
48
+
49
  ob_start();
50
 
51
  action('markup', $payload);
src/core/functions/view.php CHANGED
@@ -21,5 +21,5 @@ if (! defined('KK_STAR_RATINGS')) {
21
  /** @throws InvalidArgumentException If the template is not found */
22
  function view(string $path, array $payload = []): string
23
  {
24
- return base_view(kksr('core.views'), $path, $payload);
25
  }
21
  /** @throws InvalidArgumentException If the template is not found */
22
  function view(string $path, array $payload = []): string
23
  {
24
+ return base_view(null, kksr('core.views'), $path, $payload);
25
  }
src/core/public/css/kk-star-ratings.css CHANGED
@@ -4,10 +4,10 @@
4
  */
5
 
6
  .kk-star-ratings {
7
- display: -webkit-inline-box !important;
8
- display: -webkit-inline-flex !important;
9
- display: -ms-inline-flexbox !important;
10
- display: inline-flex !important;
11
  -webkit-box-align: center;
12
  -webkit-align-items: center;
13
  -ms-flex-align: center;
@@ -15,20 +15,19 @@
15
  /* vertical-align: text-top; */
16
  }
17
 
 
 
 
 
 
 
 
18
  .kk-star-ratings.kksr-valign-top {
19
  margin-bottom: 2rem;
20
- display: -webkit-box !important;
21
- display: -webkit-flex !important;
22
- display: -ms-flexbox !important;
23
- display: flex !important;
24
  }
25
 
26
  .kk-star-ratings.kksr-valign-bottom {
27
  margin-top: 2rem;
28
- display: -webkit-box !important;
29
- display: -webkit-flex !important;
30
- display: -ms-flexbox !important;
31
- display: flex !important;
32
  }
33
 
34
  .kk-star-ratings.kksr-align-left {
4
  */
5
 
6
  .kk-star-ratings {
7
+ display: -webkit-box;
8
+ display: -webkit-flex;
9
+ display: -ms-flexbox;
10
+ display: flex;
11
  -webkit-box-align: center;
12
  -webkit-align-items: center;
13
  -ms-flex-align: center;
15
  /* vertical-align: text-top; */
16
  }
17
 
18
+ .kk-star-ratings.kksr-shortcode {
19
+ display: -webkit-inline-box;
20
+ display: -webkit-inline-flex;
21
+ display: -ms-inline-flexbox;
22
+ display: inline-flex;
23
+ }
24
+
25
  .kk-star-ratings.kksr-valign-top {
26
  margin-bottom: 2rem;
 
 
 
 
27
  }
28
 
29
  .kk-star-ratings.kksr-valign-bottom {
30
  margin-top: 2rem;
 
 
 
 
31
  }
32
 
33
  .kk-star-ratings.kksr-align-left {
src/core/public/css/kk-star-ratings.min.css CHANGED
@@ -2,4 +2,4 @@
2
  * kk Star Ratings
3
  * @see https://github.com/kamalkhan/kk-star-ratings
4
  */
5
- .kk-star-ratings{display:-webkit-inline-box!important;display:-webkit-inline-flex!important;display:-ms-inline-flexbox!important;display:inline-flex!important;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.kk-star-ratings.kksr-valign-top{margin-bottom:2rem;display:-webkit-box!important;display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important}.kk-star-ratings.kksr-valign-bottom{margin-top:2rem;display:-webkit-box!important;display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important}.kk-star-ratings.kksr-align-left{-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start}.kk-star-ratings.kksr-align-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.kk-star-ratings.kksr-align-right{-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end}.kk-star-ratings .kksr-muted{opacity:.5}.kk-star-ratings .kksr-stars{position:relative}.kk-star-ratings .kksr-stars .kksr-stars-active,.kk-star-ratings .kksr-stars .kksr-stars-inactive{display:flex}.kk-star-ratings .kksr-stars .kksr-stars-active{overflow:hidden;position:absolute;top:0;left:0}.kk-star-ratings .kksr-stars .kksr-star{cursor:pointer;padding-right:0}.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star{cursor:default}.kk-star-ratings .kksr-stars .kksr-star .kksr-icon{transition:.3s all}.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-stars-active{width:0!important}.kk-star-ratings .kksr-stars .kksr-star .kksr-icon,.kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover~.kksr-star .kksr-icon{background-image:url(../svg/inactive.svg)}.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon{background-image:url(../svg/active.svg)}.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon,.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon{background-image:url(../svg/selected.svg)}.kk-star-ratings .kksr-legend{margin-left:.75rem;margin-right:.75rem}[dir=rtl] .kk-star-ratings .kksr-stars .kksr-stars-active{left:auto;right:0}
2
  * kk Star Ratings
3
  * @see https://github.com/kamalkhan/kk-star-ratings
4
  */
5
+ .kk-star-ratings {display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;}.kk-star-ratings.kksr-shortcode {display: -webkit-inline-box;display: -webkit-inline-flex;display: -ms-inline-flexbox;display: inline-flex;}.kk-star-ratings.kksr-valign-top {margin-bottom: 2rem;}.kk-star-ratings.kksr-valign-bottom {margin-top: 2rem;}.kk-star-ratings.kksr-align-left {-webkit-box-pack: flex-start;-webkit-justify-content: flex-start;-ms-flex-pack: flex-start;justify-content: flex-start;}.kk-star-ratings.kksr-align-center {-webkit-box-pack: center;-webkit-justify-content: center;-ms-flex-pack: center;justify-content: center;}.kk-star-ratings.kksr-align-right {-webkit-box-pack: flex-end;-webkit-justify-content: flex-end;-ms-flex-pack: flex-end;justify-content: flex-end;}.kk-star-ratings .kksr-muted {opacity: .5;}.kk-star-ratings .kksr-stars {position: relative;}.kk-star-ratings .kksr-stars .kksr-stars-active, .kk-star-ratings .kksr-stars .kksr-stars-inactive {display: flex;}.kk-star-ratings .kksr-stars .kksr-stars-active {overflow: hidden;position: absolute;top: 0;left: 0;}.kk-star-ratings .kksr-stars .kksr-star {cursor: pointer;padding-right: 0px;}.kk-star-ratings.kksr-disabled .kksr-stars .kksr-star {cursor: default;}.kk-star-ratings .kksr-stars .kksr-star .kksr-icon {transition: .3s all;}.kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-stars-active {width: 0 !important;}.kk-star-ratings .kksr-stars .kksr-star .kksr-icon, .kk-star-ratings:not(.kksr-disabled) .kksr-stars .kksr-star:hover ~ .kksr-star .kksr-icon {background-image: url("../svg/inactive.svg");}.kk-star-ratings .kksr-stars .kksr-stars-active .kksr-star .kksr-icon {background-image: url("../svg/active.svg");}.kk-star-ratings.kksr-disabled .kksr-stars .kksr-stars-active .kksr-star .kksr-icon, .kk-star-ratings:not(.kksr-disabled) .kksr-stars:hover .kksr-star .kksr-icon {background-image: url("../svg/selected.svg");}.kk-star-ratings .kksr-legend {margin-left: .75rem;margin-right: .75rem;}[dir="rtl"] .kk-star-ratings .kksr-stars .kksr-stars-active {left: auto;right: 0;}
src/core/views/markup/index.php CHANGED
@@ -5,10 +5,27 @@
5
  }
6
  ?>
7
 
8
- <div class="kk-star-ratings
9
- <?php echo $valign ? (' kksr-valign-'.esc_attr($valign)) : ''; ?>
10
- <?php echo $align ? (' kksr-align-'.esc_attr($align)) : ''; ?>
11
- <?php echo $readonly ? ' kksr-disabled' : ''; ?>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  data-payload="<?php echo esc_attr(json_encode(array_map('esc_attr', $__payload))); ?>">
13
  <?php echo $__view('markup/stars.php'); ?>
14
  <?php echo $__view('markup/legend.php'); ?>
5
  }
6
  ?>
7
 
8
+ <?php
9
+ $class = ['kk-star-ratings', $class ?? null];
10
+
11
+ if ($reference = (($reference ?? null) ?: null)) {
12
+ $class[] = "kksr-{$reference}";
13
+ }
14
+
15
+ if ($align = (($align ?? null) ?: null)) {
16
+ $class[] = "kksr-align-{$align}";
17
+ }
18
+
19
+ if ($valign = (($valign ?? null) ?: null)) {
20
+ $class[] = "kksr-valign-{$valign}";
21
+ }
22
+
23
+ if ($readonly = (($readonly ?? null) ?: null)) {
24
+ $class[] = 'kksr-disabled';
25
+ }
26
+ ?>
27
+
28
+ <div class="<?php echo implode(' ', array_filter(array_map('esc_attr', $class))); ?>"
29
  data-payload="<?php echo esc_attr(json_encode(array_map('esc_attr', $__payload))); ?>">
30
  <?php echo $__view('markup/stars.php'); ?>
31
  <?php echo $__view('markup/legend.php'); ?>
src/core/views/markup/legend.php CHANGED
@@ -5,7 +5,9 @@
5
  }
6
  ?>
7
 
8
- <div class="kksr-legend">
 
 
9
  <?php if ($count) { ?>
10
  <?php echo esc_html($legend); ?>
11
  <?php } else { ?>
5
  }
6
  ?>
7
 
8
+ <?php $font_factor = (float) ($font_factor ?? 1.25); ?>
9
+
10
+ <div class="kksr-legend" style="font-size: <?php echo $size / $font_factor; ?>px;">
11
  <?php if ($count) { ?>
12
  <?php echo esc_html($legend); ?>
13
  <?php } else { ?>
src/core/wp/shortcodes/kk-star-ratings.php CHANGED
@@ -24,7 +24,7 @@ if (! defined('KK_STAR_RATINGS')) {
24
  function kk_star_ratings($attrs, string $contents, string $tag): string
25
  {
26
  $defaults = array_fill_keys([
27
- 'align', 'best', 'count', 'gap', 'greet', 'id',
28
  'legend', 'readonly', 'score', 'size', 'slug', 'valign',
29
  ], '') + [
30
  'reference' => 'shortcode',
24
  function kk_star_ratings($attrs, string $contents, string $tag): string
25
  {
26
  $defaults = array_fill_keys([
27
+ 'align', 'best', 'class', 'count', 'gap', 'greet', 'id',
28
  'legend', 'readonly', 'score', 'size', 'slug', 'valign',
29
  ], '') + [
30
  'reference' => 'shortcode',
src/functions/block.php CHANGED
@@ -16,9 +16,9 @@ if (! defined('KK_STAR_RATINGS')) {
16
  exit();
17
  }
18
 
19
- function block(string $namespace, array $payload): void
20
  {
21
- $slug = 'block-'.$namespace;
22
 
23
  wp_register_script(
24
  $slug,
@@ -33,4 +33,6 @@ function block(string $namespace, array $payload): void
33
  'editor_script' => $slug,
34
  'render_callback' => $payload['block'] ?? null,
35
  ]));
 
 
36
  }
16
  exit();
17
  }
18
 
19
+ function block(string $namespace, array $payload, string $slug = null): string
20
  {
21
+ $slug = $slug ?: ($payload['slug'] ?? trim(preg_replace('/[^\w]+/', '_', $namespace), '_'));
22
 
23
  wp_register_script(
24
  $slug,
33
  'editor_script' => $slug,
34
  'render_callback' => $payload['block'] ?? null,
35
  ]));
36
+
37
+ return $slug;
38
  }
src/functions/view.php CHANGED
@@ -18,17 +18,45 @@ if (! defined('KK_STAR_RATINGS')) {
18
  exit();
19
  }
20
 
21
- function view(string $__base, string $__path, array $__payload = []): string
 
 
 
 
 
 
 
 
 
 
 
22
  {
23
- $resolve = function (string $base, string $path): string {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  if (is_file($path)) {
25
  return $path;
26
  }
27
 
28
  $path = ltrim($path, '\/');
29
- $directory = kksr('slug').'/'.basename(dirname($base));
30
- $parentTheme = get_template_directory().'/'.$directory.'/'.$path;
31
- $childTheme = get_stylesheet_directory().'/'.$directory.'/'.$path;
 
 
 
32
 
33
  if (is_file($childTheme)) {
34
  return $childTheme;
@@ -38,7 +66,7 @@ function view(string $__base, string $__path, array $__payload = []): string
38
  return $parentTheme;
39
  }
40
 
41
- $template = $base.'/'.$path;
42
 
43
  if (is_file($template)) {
44
  return $template;
@@ -47,13 +75,13 @@ function view(string $__base, string $__path, array $__payload = []): string
47
  throw new InvalidArgumentException("The template '{$path}' could not be located at '{$template}'");
48
  };
49
 
50
- $__view = function (string $path, array $payload = []) use ($__payload, $__base) {
51
- return view($__base, $path, array_merge($__payload, $payload));
52
  };
53
  $__kksr = 'kksr';
54
  $__base = rtrim($__base, '\/');
55
  $__dusk = kksr('functions.dusk_attr');
56
- $__template = $resolve($__base, $__path);
57
 
58
  unset($resolve);
59
 
18
  exit();
19
  }
20
 
21
+ /**
22
+ * Render a view template.
23
+ *
24
+ * Since 5.3.1, a slug is also accepted which would cause an error
25
+ * for third party code that relied on the previous definition.
26
+ * To mitigate the error, we check on the 4th parameter for null.
27
+ *
28
+ * @param string|array|null $pathOrPayload
29
+ *
30
+ * @throws InvalidArgumentException if the template can not be located
31
+ */
32
+ function view(?string $slugOrBase, string $baseOrPath, $pathOrPayload = null, array $payload = null): string
33
  {
34
+ $__slug = $slugOrBase;
35
+ $__base = $baseOrPath;
36
+ $__path = $pathOrPayload;
37
+ $__payload = $payload;
38
+
39
+ if (is_null($payload)) {
40
+ $__slug = null;
41
+ $__base = $slugOrBase;
42
+ $__path = $baseOrPath;
43
+ $__payload = $pathOrPayload;
44
+ }
45
+
46
+ unset($slugOrBase, $baseOrPath, $pathOrPayload, $payload);
47
+
48
+ $resolve = function (?string $slug, string $base, string $path): string {
49
  if (is_file($path)) {
50
  return $path;
51
  }
52
 
53
  $path = ltrim($path, '\/');
54
+ $directory = kksr('slug');
55
+ if ($slug && ($sanitizedSlug = ltrim(strip_prefix($slug, kksr('nick')), '-'))) {
56
+ $directory .= "/{$sanitizedSlug}";
57
+ }
58
+ $parentTheme = get_template_directory()."/{$directory}/{$path}";
59
+ $childTheme = get_stylesheet_directory()."/{$directory}/{$path}";
60
 
61
  if (is_file($childTheme)) {
62
  return $childTheme;
66
  return $parentTheme;
67
  }
68
 
69
+ $template = "{$base}/{$path}";
70
 
71
  if (is_file($template)) {
72
  return $template;
75
  throw new InvalidArgumentException("The template '{$path}' could not be located at '{$template}'");
76
  };
77
 
78
+ $__view = function (string $path, array $payload = []) use ($__payload, $__slug, $__base) {
79
+ return view($__slug, $__base, $path, array_merge($__payload, $payload));
80
  };
81
  $__kksr = 'kksr';
82
  $__base = rtrim($__base, '\/');
83
  $__dusk = kksr('functions.dusk_attr');
84
+ $__template = $resolve($__slug, $__base, $__path);
85
 
86
  unset($resolve);
87