PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.89
WindPress – Tailwind CSS integration for WordPress v3.2.89
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
← All changes | src/Core/Cache.php +12 -2 3.2.813.2.89 View file →
@@ -32,9 +32,10 @@
32 32 public static function get_providers(): array
33 33 {
34 34 /**
35 35 * Register cache providers.
36 - * @param array $providers The list of cache providers. Each provider should have `id`, `name`, `description`, and `callback` keys.
36 + * Each provider should have `id`, `name`, `description`, and `callback` keys.
37 + * Providers supporting stable source identities opt in with `source_index` => 1.
37 38 */
38 39 return apply_filters('f!windpress/core/cache:compile.providers', []);
39 40 }
40 41 public static function get_cache_path(string $file_path = ''): string
@@ -87,9 +88,15 @@
87 88 throw new Exception(__('The callback should return an array', 'windpress'));
88 89 }
89 90 $_metadata = array_key_exists('metadata', $result) ? $result['metadata'] : [];
90 91 $_contents = array_key_exists('contents', $result) ? $result['contents'] : $result;
92 + if (!is_array($_metadata) || !is_array($_contents)) {
93 + throw new Exception(__('The provider metadata and contents must be arrays.', 'windpress'));
94 + }
91 95 $_contents = array_map(static function ($content) {
96 + if (!is_array($content) || !array_key_exists('content', $content)) {
97 + throw new Exception(__('A scan source is missing its content.', 'windpress'));
98 + }
92 99 $content_type = $content['type'] ?? null;
93 100 if (is_array($content['content']) || is_object($content['content'])) {
94 101 $content['content'] = wp_json_encode($content['content']);
95 102 $content['type'] = 'json';
@@ -99,9 +106,12 @@
99 106 if (json_last_error() === \JSON_ERROR_NONE && ($decoded !== null || $content['content'] === 'null')) {
100 107 $content['type'] = 'json';
101 108 }
102 109 }
103 - $content['content'] = is_string($content['content']) ? base64_encode($content['content']) : null;
110 + if (!is_string($content['content'])) {
111 + throw new Exception(__('A scan source could not be encoded as text.', 'windpress'));
112 + }
113 + $content['content'] = base64_encode($content['content']);
104 114 return $content;
105 115 }, $_contents);
106 116 } catch (\Throwable $throwable) {
107 117 throw $throwable;