PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / app / Shared / Services / Escaper.php

Escaper.php in Extendify 3.2.1, at app/Shared/Services/Escaper.php

38 lines 753 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The Sanitizer class
5 */
6
7 namespace Extendify\Shared\Services;
8
9 defined('ABSPATH') || die('No direct access.');
10
11 /**
12 * Class for escaping various data attributes.
13 */
14
15 class Escaper
16 {
17 /**
18 * This function will escape the attribute of a multidimensional array.
19 *
20 * @param array $array - The array we need to escape.
21 * @return array
22 */
23 public static function recursiveEscAttr($array): array
24 {
25 if (!is_array($array)) {
26 return (array) esc_attr($array);
27 }
28
29 return array_map(static function ($value) {
30 if (is_array($value)) {
31 return self::recursiveEscAttr($value);
32 }
33
34 return esc_attr($value);
35 }, $array);
36 }
37 }
38