• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 5066322038

pending completion
5066322038

push

github

GitHub
Merge pull request #20316 from Yoast/JRF/ghactions-run-more-selectively

2550 of 29012 relevant lines covered (8.79%)

0.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/helpers/string-helper.php
1
<?php
2

3
namespace Yoast\WP\SEO\Helpers;
4

5
/**
6
 * A helper object for string operations.
7
 */
8
class String_Helper {
9

10
        /**
11
         * Strips all HTML tags including script and style.
12
         *
13
         * @param string $text The text to strip the tags from.
14
         *
15
         * @return string The processed string.
16
         */
17
        public function strip_all_tags( $text ) {
18
                return \wp_strip_all_tags( $text );
×
19
        }
20

21
        /**
22
         * Standardize whitespace in a string.
23
         *
24
         * Replace line breaks, carriage returns, tabs with a space, then remove double spaces.
25
         *
26
         * @param string $text Text input to standardize.
27
         *
28
         * @return string
29
         */
30
        public function standardize_whitespace( $text ) {
31
                return \trim( \str_replace( '  ', ' ', \str_replace( [ "\t", "\n", "\r", "\f" ], ' ', $text ) ) );
×
32
        }
33

34
        /**
35
         * First strip out registered and enclosing shortcodes using native WordPress strip_shortcodes function.
36
         * Then strip out the shortcodes with a filthy regex, because people don't properly register their shortcodes.
37
         *
38
         * @param string $text Input string that might contain shortcodes.
39
         *
40
         * @return string String without shortcodes.
41
         */
42
        public function strip_shortcode( $text ) {
43
                return \preg_replace( '`\[[^\]]+\]`s', '', \strip_shortcodes( $text ) );
×
44
        }
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc