PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / helpers / sanitization-helper.php

sanitization-helper.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.1, at src/helpers/sanitization-helper.php

40 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Helpers;
4
5 use WPSEO_Utils;
6
7 /**
8 * A helper object for sanitization.
9 */
10 class Sanitization_Helper {
11
12 /**
13 * Emulate the WP native sanitize_text_field function in a %%variable%% safe way.
14 *
15 * @codeCoverageIgnore We have to write test when this method contains own code.
16 *
17 * @param string $value String value to sanitize.
18 *
19 * @return string The sanitized string.
20 */
21 public function sanitize_text_field( $value ) {
22 return WPSEO_Utils::sanitize_text_field( $value );
23 }
24
25 /**
26 * Sanitize a url for saving to the database.
27 * Not to be confused with the old native WP function.
28 *
29 * @codeCoverageIgnore We have to write test when this method contains own code.
30 *
31 * @param string $value String URL value to sanitize.
32 * @param array $allowed_protocols Optional set of allowed protocols.
33 *
34 * @return string The sanitized URL.
35 */
36 public function sanitize_url( $value, $allowed_protocols = [ 'http', 'https' ] ) {
37 return WPSEO_Utils::sanitize_url( $value, $allowed_protocols );
38 }
39 }
40