Edit File by line
/home/barbar84/www/wp-inclu...
File: formatting.php
* @since 2.8.0
[4500] Fix | Delete
*
[4501] Fix | Delete
* @param string $text
[4502] Fix | Delete
* @return string
[4503] Fix | Delete
*/
[4504] Fix | Delete
function esc_html( $text ) {
[4505] Fix | Delete
$safe_text = wp_check_invalid_utf8( $text );
[4506] Fix | Delete
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
[4507] Fix | Delete
/**
[4508] Fix | Delete
* Filters a string cleaned and escaped for output in HTML.
[4509] Fix | Delete
*
[4510] Fix | Delete
* Text passed to esc_html() is stripped of invalid or special characters
[4511] Fix | Delete
* before output.
[4512] Fix | Delete
*
[4513] Fix | Delete
* @since 2.8.0
[4514] Fix | Delete
*
[4515] Fix | Delete
* @param string $safe_text The text after it has been escaped.
[4516] Fix | Delete
* @param string $text The text prior to being escaped.
[4517] Fix | Delete
*/
[4518] Fix | Delete
return apply_filters( 'esc_html', $safe_text, $text );
[4519] Fix | Delete
}
[4520] Fix | Delete
[4521] Fix | Delete
/**
[4522] Fix | Delete
* Escaping for HTML attributes.
[4523] Fix | Delete
*
[4524] Fix | Delete
* @since 2.8.0
[4525] Fix | Delete
*
[4526] Fix | Delete
* @param string $text
[4527] Fix | Delete
* @return string
[4528] Fix | Delete
*/
[4529] Fix | Delete
function esc_attr( $text ) {
[4530] Fix | Delete
$safe_text = wp_check_invalid_utf8( $text );
[4531] Fix | Delete
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
[4532] Fix | Delete
/**
[4533] Fix | Delete
* Filters a string cleaned and escaped for output in an HTML attribute.
[4534] Fix | Delete
*
[4535] Fix | Delete
* Text passed to esc_attr() is stripped of invalid or special characters
[4536] Fix | Delete
* before output.
[4537] Fix | Delete
*
[4538] Fix | Delete
* @since 2.0.6
[4539] Fix | Delete
*
[4540] Fix | Delete
* @param string $safe_text The text after it has been escaped.
[4541] Fix | Delete
* @param string $text The text prior to being escaped.
[4542] Fix | Delete
*/
[4543] Fix | Delete
return apply_filters( 'attribute_escape', $safe_text, $text );
[4544] Fix | Delete
}
[4545] Fix | Delete
[4546] Fix | Delete
/**
[4547] Fix | Delete
* Escaping for textarea values.
[4548] Fix | Delete
*
[4549] Fix | Delete
* @since 3.1.0
[4550] Fix | Delete
*
[4551] Fix | Delete
* @param string $text
[4552] Fix | Delete
* @return string
[4553] Fix | Delete
*/
[4554] Fix | Delete
function esc_textarea( $text ) {
[4555] Fix | Delete
$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
[4556] Fix | Delete
/**
[4557] Fix | Delete
* Filters a string cleaned and escaped for output in a textarea element.
[4558] Fix | Delete
*
[4559] Fix | Delete
* @since 3.1.0
[4560] Fix | Delete
*
[4561] Fix | Delete
* @param string $safe_text The text after it has been escaped.
[4562] Fix | Delete
* @param string $text The text prior to being escaped.
[4563] Fix | Delete
*/
[4564] Fix | Delete
return apply_filters( 'esc_textarea', $safe_text, $text );
[4565] Fix | Delete
}
[4566] Fix | Delete
[4567] Fix | Delete
/**
[4568] Fix | Delete
* Escaping for XML blocks.
[4569] Fix | Delete
*
[4570] Fix | Delete
* @since 5.5.0
[4571] Fix | Delete
*
[4572] Fix | Delete
* @param string $text Text to escape.
[4573] Fix | Delete
* @return string Escaped text.
[4574] Fix | Delete
*/
[4575] Fix | Delete
function esc_xml( $text ) {
[4576] Fix | Delete
$safe_text = wp_check_invalid_utf8( $text );
[4577] Fix | Delete
[4578] Fix | Delete
$cdata_regex = '\<\!\[CDATA\[.*?\]\]\>';
[4579] Fix | Delete
$regex = <<<EOF
[4580] Fix | Delete
/
[4581] Fix | Delete
(?=.*?{$cdata_regex}) # lookahead that will match anything followed by a CDATA Section
[4582] Fix | Delete
(?<non_cdata_followed_by_cdata>(.*?)) # the "anything" matched by the lookahead
[4583] Fix | Delete
(?<cdata>({$cdata_regex})) # the CDATA Section matched by the lookahead
[4584] Fix | Delete
[4585] Fix | Delete
| # alternative
[4586] Fix | Delete
[4587] Fix | Delete
(?<non_cdata>(.*)) # non-CDATA Section
[4588] Fix | Delete
/sx
[4589] Fix | Delete
EOF;
[4590] Fix | Delete
[4591] Fix | Delete
$safe_text = (string) preg_replace_callback(
[4592] Fix | Delete
$regex,
[4593] Fix | Delete
static function( $matches ) {
[4594] Fix | Delete
if ( ! $matches[0] ) {
[4595] Fix | Delete
return '';
[4596] Fix | Delete
}
[4597] Fix | Delete
[4598] Fix | Delete
if ( ! empty( $matches['non_cdata'] ) ) {
[4599] Fix | Delete
// escape HTML entities in the non-CDATA Section.
[4600] Fix | Delete
return _wp_specialchars( $matches['non_cdata'], ENT_XML1 );
[4601] Fix | Delete
}
[4602] Fix | Delete
[4603] Fix | Delete
// Return the CDATA Section unchanged, escape HTML entities in the rest.
[4604] Fix | Delete
return _wp_specialchars( $matches['non_cdata_followed_by_cdata'], ENT_XML1 ) . $matches['cdata'];
[4605] Fix | Delete
},
[4606] Fix | Delete
$safe_text
[4607] Fix | Delete
);
[4608] Fix | Delete
[4609] Fix | Delete
/**
[4610] Fix | Delete
* Filters a string cleaned and escaped for output in XML.
[4611] Fix | Delete
*
[4612] Fix | Delete
* Text passed to esc_xml() is stripped of invalid or special characters
[4613] Fix | Delete
* before output. HTML named character references are converted to their
[4614] Fix | Delete
* equivalent code points.
[4615] Fix | Delete
*
[4616] Fix | Delete
* @since 5.5.0
[4617] Fix | Delete
*
[4618] Fix | Delete
* @param string $safe_text The text after it has been escaped.
[4619] Fix | Delete
* @param string $text The text prior to being escaped.
[4620] Fix | Delete
*/
[4621] Fix | Delete
return apply_filters( 'esc_xml', $safe_text, $text );
[4622] Fix | Delete
}
[4623] Fix | Delete
[4624] Fix | Delete
/**
[4625] Fix | Delete
* Escape an HTML tag name.
[4626] Fix | Delete
*
[4627] Fix | Delete
* @since 2.5.0
[4628] Fix | Delete
*
[4629] Fix | Delete
* @param string $tag_name
[4630] Fix | Delete
* @return string
[4631] Fix | Delete
*/
[4632] Fix | Delete
function tag_escape( $tag_name ) {
[4633] Fix | Delete
$safe_tag = strtolower( preg_replace( '/[^a-zA-Z0-9_:]/', '', $tag_name ) );
[4634] Fix | Delete
/**
[4635] Fix | Delete
* Filters a string cleaned and escaped for output as an HTML tag.
[4636] Fix | Delete
*
[4637] Fix | Delete
* @since 2.8.0
[4638] Fix | Delete
*
[4639] Fix | Delete
* @param string $safe_tag The tag name after it has been escaped.
[4640] Fix | Delete
* @param string $tag_name The text before it was escaped.
[4641] Fix | Delete
*/
[4642] Fix | Delete
return apply_filters( 'tag_escape', $safe_tag, $tag_name );
[4643] Fix | Delete
}
[4644] Fix | Delete
[4645] Fix | Delete
/**
[4646] Fix | Delete
* Convert full URL paths to absolute paths.
[4647] Fix | Delete
*
[4648] Fix | Delete
* Removes the http or https protocols and the domain. Keeps the path '/' at the
[4649] Fix | Delete
* beginning, so it isn't a true relative link, but from the web root base.
[4650] Fix | Delete
*
[4651] Fix | Delete
* @since 2.1.0
[4652] Fix | Delete
* @since 4.1.0 Support was added for relative URLs.
[4653] Fix | Delete
*
[4654] Fix | Delete
* @param string $link Full URL path.
[4655] Fix | Delete
* @return string Absolute path.
[4656] Fix | Delete
*/
[4657] Fix | Delete
function wp_make_link_relative( $link ) {
[4658] Fix | Delete
return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link );
[4659] Fix | Delete
}
[4660] Fix | Delete
[4661] Fix | Delete
/**
[4662] Fix | Delete
* Sanitises various option values based on the nature of the option.
[4663] Fix | Delete
*
[4664] Fix | Delete
* This is basically a switch statement which will pass $value through a number
[4665] Fix | Delete
* of functions depending on the $option.
[4666] Fix | Delete
*
[4667] Fix | Delete
* @since 2.0.5
[4668] Fix | Delete
*
[4669] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[4670] Fix | Delete
*
[4671] Fix | Delete
* @param string $option The name of the option.
[4672] Fix | Delete
* @param string $value The unsanitised value.
[4673] Fix | Delete
* @return string Sanitized value.
[4674] Fix | Delete
*/
[4675] Fix | Delete
function sanitize_option( $option, $value ) {
[4676] Fix | Delete
global $wpdb;
[4677] Fix | Delete
[4678] Fix | Delete
$original_value = $value;
[4679] Fix | Delete
$error = '';
[4680] Fix | Delete
[4681] Fix | Delete
switch ( $option ) {
[4682] Fix | Delete
case 'admin_email':
[4683] Fix | Delete
case 'new_admin_email':
[4684] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4685] Fix | Delete
if ( is_wp_error( $value ) ) {
[4686] Fix | Delete
$error = $value->get_error_message();
[4687] Fix | Delete
} else {
[4688] Fix | Delete
$value = sanitize_email( $value );
[4689] Fix | Delete
if ( ! is_email( $value ) ) {
[4690] Fix | Delete
$error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
[4691] Fix | Delete
}
[4692] Fix | Delete
}
[4693] Fix | Delete
break;
[4694] Fix | Delete
[4695] Fix | Delete
case 'thumbnail_size_w':
[4696] Fix | Delete
case 'thumbnail_size_h':
[4697] Fix | Delete
case 'medium_size_w':
[4698] Fix | Delete
case 'medium_size_h':
[4699] Fix | Delete
case 'medium_large_size_w':
[4700] Fix | Delete
case 'medium_large_size_h':
[4701] Fix | Delete
case 'large_size_w':
[4702] Fix | Delete
case 'large_size_h':
[4703] Fix | Delete
case 'mailserver_port':
[4704] Fix | Delete
case 'comment_max_links':
[4705] Fix | Delete
case 'page_on_front':
[4706] Fix | Delete
case 'page_for_posts':
[4707] Fix | Delete
case 'rss_excerpt_length':
[4708] Fix | Delete
case 'default_category':
[4709] Fix | Delete
case 'default_email_category':
[4710] Fix | Delete
case 'default_link_category':
[4711] Fix | Delete
case 'close_comments_days_old':
[4712] Fix | Delete
case 'comments_per_page':
[4713] Fix | Delete
case 'thread_comments_depth':
[4714] Fix | Delete
case 'users_can_register':
[4715] Fix | Delete
case 'start_of_week':
[4716] Fix | Delete
case 'site_icon':
[4717] Fix | Delete
$value = absint( $value );
[4718] Fix | Delete
break;
[4719] Fix | Delete
[4720] Fix | Delete
case 'posts_per_page':
[4721] Fix | Delete
case 'posts_per_rss':
[4722] Fix | Delete
$value = (int) $value;
[4723] Fix | Delete
if ( empty( $value ) ) {
[4724] Fix | Delete
$value = 1;
[4725] Fix | Delete
}
[4726] Fix | Delete
if ( $value < -1 ) {
[4727] Fix | Delete
$value = abs( $value );
[4728] Fix | Delete
}
[4729] Fix | Delete
break;
[4730] Fix | Delete
[4731] Fix | Delete
case 'default_ping_status':
[4732] Fix | Delete
case 'default_comment_status':
[4733] Fix | Delete
// Options that if not there have 0 value but need to be something like "closed".
[4734] Fix | Delete
if ( '0' == $value || '' === $value ) {
[4735] Fix | Delete
$value = 'closed';
[4736] Fix | Delete
}
[4737] Fix | Delete
break;
[4738] Fix | Delete
[4739] Fix | Delete
case 'blogdescription':
[4740] Fix | Delete
case 'blogname':
[4741] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4742] Fix | Delete
if ( $value !== $original_value ) {
[4743] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', wp_encode_emoji( $original_value ) );
[4744] Fix | Delete
}
[4745] Fix | Delete
[4746] Fix | Delete
if ( is_wp_error( $value ) ) {
[4747] Fix | Delete
$error = $value->get_error_message();
[4748] Fix | Delete
} else {
[4749] Fix | Delete
$value = esc_html( $value );
[4750] Fix | Delete
}
[4751] Fix | Delete
break;
[4752] Fix | Delete
[4753] Fix | Delete
case 'blog_charset':
[4754] Fix | Delete
$value = preg_replace( '/[^a-zA-Z0-9_-]/', '', $value ); // Strips slashes.
[4755] Fix | Delete
break;
[4756] Fix | Delete
[4757] Fix | Delete
case 'blog_public':
[4758] Fix | Delete
// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
[4759] Fix | Delete
if ( null === $value ) {
[4760] Fix | Delete
$value = 1;
[4761] Fix | Delete
} else {
[4762] Fix | Delete
$value = (int) $value;
[4763] Fix | Delete
}
[4764] Fix | Delete
break;
[4765] Fix | Delete
[4766] Fix | Delete
case 'date_format':
[4767] Fix | Delete
case 'time_format':
[4768] Fix | Delete
case 'mailserver_url':
[4769] Fix | Delete
case 'mailserver_login':
[4770] Fix | Delete
case 'mailserver_pass':
[4771] Fix | Delete
case 'upload_path':
[4772] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4773] Fix | Delete
if ( is_wp_error( $value ) ) {
[4774] Fix | Delete
$error = $value->get_error_message();
[4775] Fix | Delete
} else {
[4776] Fix | Delete
$value = strip_tags( $value );
[4777] Fix | Delete
$value = wp_kses_data( $value );
[4778] Fix | Delete
}
[4779] Fix | Delete
break;
[4780] Fix | Delete
[4781] Fix | Delete
case 'ping_sites':
[4782] Fix | Delete
$value = explode( "\n", $value );
[4783] Fix | Delete
$value = array_filter( array_map( 'trim', $value ) );
[4784] Fix | Delete
$value = array_filter( array_map( 'esc_url_raw', $value ) );
[4785] Fix | Delete
$value = implode( "\n", $value );
[4786] Fix | Delete
break;
[4787] Fix | Delete
[4788] Fix | Delete
case 'gmt_offset':
[4789] Fix | Delete
$value = preg_replace( '/[^0-9:.-]/', '', $value ); // Strips slashes.
[4790] Fix | Delete
break;
[4791] Fix | Delete
[4792] Fix | Delete
case 'siteurl':
[4793] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4794] Fix | Delete
if ( is_wp_error( $value ) ) {
[4795] Fix | Delete
$error = $value->get_error_message();
[4796] Fix | Delete
} else {
[4797] Fix | Delete
if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
[4798] Fix | Delete
$value = esc_url_raw( $value );
[4799] Fix | Delete
} else {
[4800] Fix | Delete
$error = __( 'The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.' );
[4801] Fix | Delete
}
[4802] Fix | Delete
}
[4803] Fix | Delete
break;
[4804] Fix | Delete
[4805] Fix | Delete
case 'home':
[4806] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4807] Fix | Delete
if ( is_wp_error( $value ) ) {
[4808] Fix | Delete
$error = $value->get_error_message();
[4809] Fix | Delete
} else {
[4810] Fix | Delete
if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
[4811] Fix | Delete
$value = esc_url_raw( $value );
[4812] Fix | Delete
} else {
[4813] Fix | Delete
$error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
[4814] Fix | Delete
}
[4815] Fix | Delete
}
[4816] Fix | Delete
break;
[4817] Fix | Delete
[4818] Fix | Delete
case 'WPLANG':
[4819] Fix | Delete
$allowed = get_available_languages();
[4820] Fix | Delete
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
[4821] Fix | Delete
$allowed[] = WPLANG;
[4822] Fix | Delete
}
[4823] Fix | Delete
if ( ! in_array( $value, $allowed, true ) && ! empty( $value ) ) {
[4824] Fix | Delete
$value = get_option( $option );
[4825] Fix | Delete
}
[4826] Fix | Delete
break;
[4827] Fix | Delete
[4828] Fix | Delete
case 'illegal_names':
[4829] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4830] Fix | Delete
if ( is_wp_error( $value ) ) {
[4831] Fix | Delete
$error = $value->get_error_message();
[4832] Fix | Delete
} else {
[4833] Fix | Delete
if ( ! is_array( $value ) ) {
[4834] Fix | Delete
$value = explode( ' ', $value );
[4835] Fix | Delete
}
[4836] Fix | Delete
[4837] Fix | Delete
$value = array_values( array_filter( array_map( 'trim', $value ) ) );
[4838] Fix | Delete
[4839] Fix | Delete
if ( ! $value ) {
[4840] Fix | Delete
$value = '';
[4841] Fix | Delete
}
[4842] Fix | Delete
}
[4843] Fix | Delete
break;
[4844] Fix | Delete
[4845] Fix | Delete
case 'limited_email_domains':
[4846] Fix | Delete
case 'banned_email_domains':
[4847] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4848] Fix | Delete
if ( is_wp_error( $value ) ) {
[4849] Fix | Delete
$error = $value->get_error_message();
[4850] Fix | Delete
} else {
[4851] Fix | Delete
if ( ! is_array( $value ) ) {
[4852] Fix | Delete
$value = explode( "\n", $value );
[4853] Fix | Delete
}
[4854] Fix | Delete
[4855] Fix | Delete
$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
[4856] Fix | Delete
$value = array();
[4857] Fix | Delete
[4858] Fix | Delete
foreach ( $domains as $domain ) {
[4859] Fix | Delete
if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
[4860] Fix | Delete
$value[] = $domain;
[4861] Fix | Delete
}
[4862] Fix | Delete
}
[4863] Fix | Delete
if ( ! $value ) {
[4864] Fix | Delete
$value = '';
[4865] Fix | Delete
}
[4866] Fix | Delete
}
[4867] Fix | Delete
break;
[4868] Fix | Delete
[4869] Fix | Delete
case 'timezone_string':
[4870] Fix | Delete
$allowed_zones = timezone_identifiers_list();
[4871] Fix | Delete
if ( ! in_array( $value, $allowed_zones, true ) && ! empty( $value ) ) {
[4872] Fix | Delete
$error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
[4873] Fix | Delete
}
[4874] Fix | Delete
break;
[4875] Fix | Delete
[4876] Fix | Delete
case 'permalink_structure':
[4877] Fix | Delete
case 'category_base':
[4878] Fix | Delete
case 'tag_base':
[4879] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4880] Fix | Delete
if ( is_wp_error( $value ) ) {
[4881] Fix | Delete
$error = $value->get_error_message();
[4882] Fix | Delete
} else {
[4883] Fix | Delete
$value = esc_url_raw( $value );
[4884] Fix | Delete
$value = str_replace( 'http://', '', $value );
[4885] Fix | Delete
}
[4886] Fix | Delete
[4887] Fix | Delete
if ( 'permalink_structure' === $option && '' !== $value && ! preg_match( '/%[^\/%]+%/', $value ) ) {
[4888] Fix | Delete
$error = sprintf(
[4889] Fix | Delete
/* translators: %s: Documentation URL. */
[4890] Fix | Delete
__( 'A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>' ),
[4891] Fix | Delete
__( 'https://wordpress.org/support/article/using-permalinks/#choosing-your-permalink-structure' )
[4892] Fix | Delete
);
[4893] Fix | Delete
}
[4894] Fix | Delete
break;
[4895] Fix | Delete
[4896] Fix | Delete
case 'default_role':
[4897] Fix | Delete
if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
[4898] Fix | Delete
$value = 'subscriber';
[4899] Fix | Delete
}
[4900] Fix | Delete
break;
[4901] Fix | Delete
[4902] Fix | Delete
case 'moderation_keys':
[4903] Fix | Delete
case 'disallowed_keys':
[4904] Fix | Delete
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
[4905] Fix | Delete
if ( is_wp_error( $value ) ) {
[4906] Fix | Delete
$error = $value->get_error_message();
[4907] Fix | Delete
} else {
[4908] Fix | Delete
$value = explode( "\n", $value );
[4909] Fix | Delete
$value = array_filter( array_map( 'trim', $value ) );
[4910] Fix | Delete
$value = array_unique( $value );
[4911] Fix | Delete
$value = implode( "\n", $value );
[4912] Fix | Delete
}
[4913] Fix | Delete
break;
[4914] Fix | Delete
}
[4915] Fix | Delete
[4916] Fix | Delete
if ( ! empty( $error ) ) {
[4917] Fix | Delete
$value = get_option( $option );
[4918] Fix | Delete
if ( function_exists( 'add_settings_error' ) ) {
[4919] Fix | Delete
add_settings_error( $option, "invalid_{$option}", $error );
[4920] Fix | Delete
}
[4921] Fix | Delete
}
[4922] Fix | Delete
[4923] Fix | Delete
/**
[4924] Fix | Delete
* Filters an option value following sanitization.
[4925] Fix | Delete
*
[4926] Fix | Delete
* @since 2.3.0
[4927] Fix | Delete
* @since 4.3.0 Added the `$original_value` parameter.
[4928] Fix | Delete
*
[4929] Fix | Delete
* @param string $value The sanitized option value.
[4930] Fix | Delete
* @param string $option The option name.
[4931] Fix | Delete
* @param string $original_value The original value passed to the function.
[4932] Fix | Delete
*/
[4933] Fix | Delete
return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
[4934] Fix | Delete
}
[4935] Fix | Delete
[4936] Fix | Delete
/**
[4937] Fix | Delete
* Maps a function to all non-iterable elements of an array or an object.
[4938] Fix | Delete
*
[4939] Fix | Delete
* This is similar to `array_walk_recursive()` but acts upon objects too.
[4940] Fix | Delete
*
[4941] Fix | Delete
* @since 4.4.0
[4942] Fix | Delete
*
[4943] Fix | Delete
* @param mixed $value The array, object, or scalar.
[4944] Fix | Delete
* @param callable $callback The function to map onto $value.
[4945] Fix | Delete
* @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
[4946] Fix | Delete
*/
[4947] Fix | Delete
function map_deep( $value, $callback ) {
[4948] Fix | Delete
if ( is_array( $value ) ) {
[4949] Fix | Delete
foreach ( $value as $index => $item ) {
[4950] Fix | Delete
$value[ $index ] = map_deep( $item, $callback );
[4951] Fix | Delete
}
[4952] Fix | Delete
} elseif ( is_object( $value ) ) {
[4953] Fix | Delete
$object_vars = get_object_vars( $value );
[4954] Fix | Delete
foreach ( $object_vars as $property_name => $property_value ) {
[4955] Fix | Delete
$value->$property_name = map_deep( $property_value, $callback );
[4956] Fix | Delete
}
[4957] Fix | Delete
} else {
[4958] Fix | Delete
$value = call_user_func( $callback, $value );
[4959] Fix | Delete
}
[4960] Fix | Delete
[4961] Fix | Delete
return $value;
[4962] Fix | Delete
}
[4963] Fix | Delete
[4964] Fix | Delete
/**
[4965] Fix | Delete
* Parses a string into variables to be stored in an array.
[4966] Fix | Delete
*
[4967] Fix | Delete
* @since 2.2.1
[4968] Fix | Delete
*
[4969] Fix | Delete
* @param string $string The string to be parsed.
[4970] Fix | Delete
* @param array $array Variables will be stored in this array.
[4971] Fix | Delete
*/
[4972] Fix | Delete
function wp_parse_str( $string, &$array ) {
[4973] Fix | Delete
parse_str( $string, $array );
[4974] Fix | Delete
[4975] Fix | Delete
/**
[4976] Fix | Delete
* Filters the array of variables derived from a parsed string.
[4977] Fix | Delete
*
[4978] Fix | Delete
* @since 2.3.0
[4979] Fix | Delete
*
[4980] Fix | Delete
* @param array $array The array populated with variables.
[4981] Fix | Delete
*/
[4982] Fix | Delete
$array = apply_filters( 'wp_parse_str', $array );
[4983] Fix | Delete
}
[4984] Fix | Delete
[4985] Fix | Delete
/**
[4986] Fix | Delete
* Convert lone less than signs.
[4987] Fix | Delete
*
[4988] Fix | Delete
* KSES already converts lone greater than signs.
[4989] Fix | Delete
*
[4990] Fix | Delete
* @since 2.3.0
[4991] Fix | Delete
*
[4992] Fix | Delete
* @param string $text Text to be converted.
[4993] Fix | Delete
* @return string Converted text.
[4994] Fix | Delete
*/
[4995] Fix | Delete
function wp_pre_kses_less_than( $text ) {
[4996] Fix | Delete
return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text );
[4997] Fix | Delete
}
[4998] Fix | Delete
[4999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function