File Editor
Directories:
.. (Back)
open-graph
schema
twitter
Files:
aioseo-helper.php
asset-helper.php
attachment-cleanup-helper.php
author-archive-helper.php
blocks-helper.php
capability-helper.php
crawl-cleanup-helper.php
curl-helper.php
current-page-helper.php
date-helper.php
environment-helper.php
first-time-configuration-notice-helper.php
home-url-helper.php
image-helper.php
import-cursor-helper.php
import-helper.php
indexable-helper.php
indexable-to-postmeta-helper.php
indexing-helper.php
language-helper.php
meta-helper.php
notification-helper.php
options-helper.php
pagination-helper.php
permalink-helper.php
post-helper.php
post-type-helper.php
primary-term-helper.php
product-helper.php
redirect-helper.php
require-file-helper.php
robots-helper.php
robots-txt-helper.php
sanitization-helper.php
score-icon-helper.php
short-link-helper.php
site-helper.php
social-profiles-helper.php
string-helper.php
taxonomy-helper.php
url-helper.php
user-helper.php
wincher-helper.php
woocommerce-helper.php
wordpress-helper.php
wpdb-helper.php
Create New File
Create
Edit File: string-helper.php
<?php namespace Yoast\WP\SEO\Helpers; /** * A helper object for string operations. */ class String_Helper { /** * Strips all HTML tags including script and style. * * @param string $text The text to strip the tags from. * * @return string The processed string. */ public function strip_all_tags( $text ) { return \wp_strip_all_tags( $text ); } /** * Standardize whitespace in a string. * * Replace line breaks, carriage returns, tabs with a space, then remove double spaces. * * @param string $text Text input to standardize. * * @return string */ public function standardize_whitespace( $text ) { return \trim( \str_replace( ' ', ' ', \str_replace( [ "\t", "\n", "\r", "\f" ], ' ', $text ) ) ); } /** * First strip out registered and enclosing shortcodes using native WordPress strip_shortcodes function. * Then strip out the shortcodes with a filthy regex, because people don't properly register their shortcodes. * * @param string $text Input string that might contain shortcodes. * * @return string String without shortcodes. */ public function strip_shortcode( $text ) { return \preg_replace( '`\[[^\]]+\]`s', '', \strip_shortcodes( $text ) ); } }
Save Changes
Rename File
Rename