Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
}
[4000] Fix | Delete
[4001] Fix | Delete
// Check the element type, so that we're only recursing if we really have to.
[4002] Fix | Delete
if ( is_array( $el ) || is_object( $el ) ) {
[4003] Fix | Delete
$output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 );
[4004] Fix | Delete
} elseif ( is_string( $el ) ) {
[4005] Fix | Delete
$output[ $clean_id ] = _wp_json_convert_string( $el );
[4006] Fix | Delete
} else {
[4007] Fix | Delete
$output[ $clean_id ] = $el;
[4008] Fix | Delete
}
[4009] Fix | Delete
}
[4010] Fix | Delete
} elseif ( is_object( $data ) ) {
[4011] Fix | Delete
$output = new stdClass;
[4012] Fix | Delete
foreach ( $data as $id => $el ) {
[4013] Fix | Delete
if ( is_string( $id ) ) {
[4014] Fix | Delete
$clean_id = _wp_json_convert_string( $id );
[4015] Fix | Delete
} else {
[4016] Fix | Delete
$clean_id = $id;
[4017] Fix | Delete
}
[4018] Fix | Delete
[4019] Fix | Delete
if ( is_array( $el ) || is_object( $el ) ) {
[4020] Fix | Delete
$output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 );
[4021] Fix | Delete
} elseif ( is_string( $el ) ) {
[4022] Fix | Delete
$output->$clean_id = _wp_json_convert_string( $el );
[4023] Fix | Delete
} else {
[4024] Fix | Delete
$output->$clean_id = $el;
[4025] Fix | Delete
}
[4026] Fix | Delete
}
[4027] Fix | Delete
} elseif ( is_string( $data ) ) {
[4028] Fix | Delete
return _wp_json_convert_string( $data );
[4029] Fix | Delete
} else {
[4030] Fix | Delete
return $data;
[4031] Fix | Delete
}
[4032] Fix | Delete
[4033] Fix | Delete
return $output;
[4034] Fix | Delete
}
[4035] Fix | Delete
[4036] Fix | Delete
/**
[4037] Fix | Delete
* Convert a string to UTF-8, so that it can be safely encoded to JSON.
[4038] Fix | Delete
*
[4039] Fix | Delete
* @ignore
[4040] Fix | Delete
* @since 4.1.0
[4041] Fix | Delete
* @access private
[4042] Fix | Delete
*
[4043] Fix | Delete
* @see _wp_json_sanity_check()
[4044] Fix | Delete
*
[4045] Fix | Delete
* @param string $string The string which is to be converted.
[4046] Fix | Delete
* @return string The checked string.
[4047] Fix | Delete
*/
[4048] Fix | Delete
function _wp_json_convert_string( $string ) {
[4049] Fix | Delete
static $use_mb = null;
[4050] Fix | Delete
if ( is_null( $use_mb ) ) {
[4051] Fix | Delete
$use_mb = function_exists( 'mb_convert_encoding' );
[4052] Fix | Delete
}
[4053] Fix | Delete
[4054] Fix | Delete
if ( $use_mb ) {
[4055] Fix | Delete
$encoding = mb_detect_encoding( $string, mb_detect_order(), true );
[4056] Fix | Delete
if ( $encoding ) {
[4057] Fix | Delete
return mb_convert_encoding( $string, 'UTF-8', $encoding );
[4058] Fix | Delete
} else {
[4059] Fix | Delete
return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
[4060] Fix | Delete
}
[4061] Fix | Delete
} else {
[4062] Fix | Delete
return wp_check_invalid_utf8( $string, true );
[4063] Fix | Delete
}
[4064] Fix | Delete
}
[4065] Fix | Delete
[4066] Fix | Delete
/**
[4067] Fix | Delete
* Prepares response data to be serialized to JSON.
[4068] Fix | Delete
*
[4069] Fix | Delete
* This supports the JsonSerializable interface for PHP 5.2-5.3 as well.
[4070] Fix | Delete
*
[4071] Fix | Delete
* @ignore
[4072] Fix | Delete
* @since 4.4.0
[4073] Fix | Delete
* @deprecated 5.3.0 This function is no longer needed as support for PHP 5.2-5.3
[4074] Fix | Delete
* has been dropped.
[4075] Fix | Delete
* @access private
[4076] Fix | Delete
*
[4077] Fix | Delete
* @param mixed $data Native representation.
[4078] Fix | Delete
* @return bool|int|float|null|string|array Data ready for `json_encode()`.
[4079] Fix | Delete
*/
[4080] Fix | Delete
function _wp_json_prepare_data( $data ) {
[4081] Fix | Delete
_deprecated_function( __FUNCTION__, '5.3.0' );
[4082] Fix | Delete
return $data;
[4083] Fix | Delete
}
[4084] Fix | Delete
[4085] Fix | Delete
/**
[4086] Fix | Delete
* Send a JSON response back to an Ajax request.
[4087] Fix | Delete
*
[4088] Fix | Delete
* @since 3.5.0
[4089] Fix | Delete
* @since 4.7.0 The `$status_code` parameter was added.
[4090] Fix | Delete
* @since 5.6.0 The `$options` parameter was added.
[4091] Fix | Delete
*
[4092] Fix | Delete
* @param mixed $response Variable (usually an array or object) to encode as JSON,
[4093] Fix | Delete
* then print and die.
[4094] Fix | Delete
* @param int $status_code Optional. The HTTP status code to output. Default null.
[4095] Fix | Delete
* @param int $options Optional. Options to be passed to json_encode(). Default 0.
[4096] Fix | Delete
*/
[4097] Fix | Delete
function wp_send_json( $response, $status_code = null, $options = 0 ) {
[4098] Fix | Delete
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
[4099] Fix | Delete
_doing_it_wrong(
[4100] Fix | Delete
__FUNCTION__,
[4101] Fix | Delete
sprintf(
[4102] Fix | Delete
/* translators: 1: WP_REST_Response, 2: WP_Error */
[4103] Fix | Delete
__( 'Return a %1$s or %2$s object from your callback when using the REST API.' ),
[4104] Fix | Delete
'WP_REST_Response',
[4105] Fix | Delete
'WP_Error'
[4106] Fix | Delete
),
[4107] Fix | Delete
'5.5.0'
[4108] Fix | Delete
);
[4109] Fix | Delete
}
[4110] Fix | Delete
[4111] Fix | Delete
if ( ! headers_sent() ) {
[4112] Fix | Delete
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
[4113] Fix | Delete
if ( null !== $status_code ) {
[4114] Fix | Delete
status_header( $status_code );
[4115] Fix | Delete
}
[4116] Fix | Delete
}
[4117] Fix | Delete
[4118] Fix | Delete
echo wp_json_encode( $response, $options );
[4119] Fix | Delete
[4120] Fix | Delete
if ( wp_doing_ajax() ) {
[4121] Fix | Delete
wp_die(
[4122] Fix | Delete
'',
[4123] Fix | Delete
'',
[4124] Fix | Delete
array(
[4125] Fix | Delete
'response' => null,
[4126] Fix | Delete
)
[4127] Fix | Delete
);
[4128] Fix | Delete
} else {
[4129] Fix | Delete
die;
[4130] Fix | Delete
}
[4131] Fix | Delete
}
[4132] Fix | Delete
[4133] Fix | Delete
/**
[4134] Fix | Delete
* Send a JSON response back to an Ajax request, indicating success.
[4135] Fix | Delete
*
[4136] Fix | Delete
* @since 3.5.0
[4137] Fix | Delete
* @since 4.7.0 The `$status_code` parameter was added.
[4138] Fix | Delete
* @since 5.6.0 The `$options` parameter was added.
[4139] Fix | Delete
*
[4140] Fix | Delete
* @param mixed $data Optional. Data to encode as JSON, then print and die. Default null.
[4141] Fix | Delete
* @param int $status_code Optional. The HTTP status code to output. Default null.
[4142] Fix | Delete
* @param int $options Optional. Options to be passed to json_encode(). Default 0.
[4143] Fix | Delete
*/
[4144] Fix | Delete
function wp_send_json_success( $data = null, $status_code = null, $options = 0 ) {
[4145] Fix | Delete
$response = array( 'success' => true );
[4146] Fix | Delete
[4147] Fix | Delete
if ( isset( $data ) ) {
[4148] Fix | Delete
$response['data'] = $data;
[4149] Fix | Delete
}
[4150] Fix | Delete
[4151] Fix | Delete
wp_send_json( $response, $status_code, $options );
[4152] Fix | Delete
}
[4153] Fix | Delete
[4154] Fix | Delete
/**
[4155] Fix | Delete
* Send a JSON response back to an Ajax request, indicating failure.
[4156] Fix | Delete
*
[4157] Fix | Delete
* If the `$data` parameter is a WP_Error object, the errors
[4158] Fix | Delete
* within the object are processed and output as an array of error
[4159] Fix | Delete
* codes and corresponding messages. All other types are output
[4160] Fix | Delete
* without further processing.
[4161] Fix | Delete
*
[4162] Fix | Delete
* @since 3.5.0
[4163] Fix | Delete
* @since 4.1.0 The `$data` parameter is now processed if a WP_Error object is passed in.
[4164] Fix | Delete
* @since 4.7.0 The `$status_code` parameter was added.
[4165] Fix | Delete
* @since 5.6.0 The `$options` parameter was added.
[4166] Fix | Delete
*
[4167] Fix | Delete
* @param mixed $data Optional. Data to encode as JSON, then print and die. Default null.
[4168] Fix | Delete
* @param int $status_code Optional. The HTTP status code to output. Default null.
[4169] Fix | Delete
* @param int $options Optional. Options to be passed to json_encode(). Default 0.
[4170] Fix | Delete
*/
[4171] Fix | Delete
function wp_send_json_error( $data = null, $status_code = null, $options = 0 ) {
[4172] Fix | Delete
$response = array( 'success' => false );
[4173] Fix | Delete
[4174] Fix | Delete
if ( isset( $data ) ) {
[4175] Fix | Delete
if ( is_wp_error( $data ) ) {
[4176] Fix | Delete
$result = array();
[4177] Fix | Delete
foreach ( $data->errors as $code => $messages ) {
[4178] Fix | Delete
foreach ( $messages as $message ) {
[4179] Fix | Delete
$result[] = array(
[4180] Fix | Delete
'code' => $code,
[4181] Fix | Delete
'message' => $message,
[4182] Fix | Delete
);
[4183] Fix | Delete
}
[4184] Fix | Delete
}
[4185] Fix | Delete
[4186] Fix | Delete
$response['data'] = $result;
[4187] Fix | Delete
} else {
[4188] Fix | Delete
$response['data'] = $data;
[4189] Fix | Delete
}
[4190] Fix | Delete
}
[4191] Fix | Delete
[4192] Fix | Delete
wp_send_json( $response, $status_code, $options );
[4193] Fix | Delete
}
[4194] Fix | Delete
[4195] Fix | Delete
/**
[4196] Fix | Delete
* Checks that a JSONP callback is a valid JavaScript callback name.
[4197] Fix | Delete
*
[4198] Fix | Delete
* Only allows alphanumeric characters and the dot character in callback
[4199] Fix | Delete
* function names. This helps to mitigate XSS attacks caused by directly
[4200] Fix | Delete
* outputting user input.
[4201] Fix | Delete
*
[4202] Fix | Delete
* @since 4.6.0
[4203] Fix | Delete
*
[4204] Fix | Delete
* @param string $callback Supplied JSONP callback function name.
[4205] Fix | Delete
* @return bool Whether the callback function name is valid.
[4206] Fix | Delete
*/
[4207] Fix | Delete
function wp_check_jsonp_callback( $callback ) {
[4208] Fix | Delete
if ( ! is_string( $callback ) ) {
[4209] Fix | Delete
return false;
[4210] Fix | Delete
}
[4211] Fix | Delete
[4212] Fix | Delete
preg_replace( '/[^\w\.]/', '', $callback, -1, $illegal_char_count );
[4213] Fix | Delete
[4214] Fix | Delete
return 0 === $illegal_char_count;
[4215] Fix | Delete
}
[4216] Fix | Delete
[4217] Fix | Delete
/**
[4218] Fix | Delete
* Retrieve the WordPress home page URL.
[4219] Fix | Delete
*
[4220] Fix | Delete
* If the constant named 'WP_HOME' exists, then it will be used and returned
[4221] Fix | Delete
* by the function. This can be used to counter the redirection on your local
[4222] Fix | Delete
* development environment.
[4223] Fix | Delete
*
[4224] Fix | Delete
* @since 2.2.0
[4225] Fix | Delete
* @access private
[4226] Fix | Delete
*
[4227] Fix | Delete
* @see WP_HOME
[4228] Fix | Delete
*
[4229] Fix | Delete
* @param string $url URL for the home location.
[4230] Fix | Delete
* @return string Homepage location.
[4231] Fix | Delete
*/
[4232] Fix | Delete
function _config_wp_home( $url = '' ) {
[4233] Fix | Delete
if ( defined( 'WP_HOME' ) ) {
[4234] Fix | Delete
return untrailingslashit( WP_HOME );
[4235] Fix | Delete
}
[4236] Fix | Delete
return $url;
[4237] Fix | Delete
}
[4238] Fix | Delete
[4239] Fix | Delete
/**
[4240] Fix | Delete
* Retrieve the WordPress site URL.
[4241] Fix | Delete
*
[4242] Fix | Delete
* If the constant named 'WP_SITEURL' is defined, then the value in that
[4243] Fix | Delete
* constant will always be returned. This can be used for debugging a site
[4244] Fix | Delete
* on your localhost while not having to change the database to your URL.
[4245] Fix | Delete
*
[4246] Fix | Delete
* @since 2.2.0
[4247] Fix | Delete
* @access private
[4248] Fix | Delete
*
[4249] Fix | Delete
* @see WP_SITEURL
[4250] Fix | Delete
*
[4251] Fix | Delete
* @param string $url URL to set the WordPress site location.
[4252] Fix | Delete
* @return string The WordPress Site URL.
[4253] Fix | Delete
*/
[4254] Fix | Delete
function _config_wp_siteurl( $url = '' ) {
[4255] Fix | Delete
if ( defined( 'WP_SITEURL' ) ) {
[4256] Fix | Delete
return untrailingslashit( WP_SITEURL );
[4257] Fix | Delete
}
[4258] Fix | Delete
return $url;
[4259] Fix | Delete
}
[4260] Fix | Delete
[4261] Fix | Delete
/**
[4262] Fix | Delete
* Delete the fresh site option.
[4263] Fix | Delete
*
[4264] Fix | Delete
* @since 4.7.0
[4265] Fix | Delete
* @access private
[4266] Fix | Delete
*/
[4267] Fix | Delete
function _delete_option_fresh_site() {
[4268] Fix | Delete
update_option( 'fresh_site', '0' );
[4269] Fix | Delete
}
[4270] Fix | Delete
[4271] Fix | Delete
/**
[4272] Fix | Delete
* Set the localized direction for MCE plugin.
[4273] Fix | Delete
*
[4274] Fix | Delete
* Will only set the direction to 'rtl', if the WordPress locale has
[4275] Fix | Delete
* the text direction set to 'rtl'.
[4276] Fix | Delete
*
[4277] Fix | Delete
* Fills in the 'directionality' setting, enables the 'directionality'
[4278] Fix | Delete
* plugin, and adds the 'ltr' button to 'toolbar1', formerly
[4279] Fix | Delete
* 'theme_advanced_buttons1' array keys. These keys are then returned
[4280] Fix | Delete
* in the $mce_init (TinyMCE settings) array.
[4281] Fix | Delete
*
[4282] Fix | Delete
* @since 2.1.0
[4283] Fix | Delete
* @access private
[4284] Fix | Delete
*
[4285] Fix | Delete
* @param array $mce_init MCE settings array.
[4286] Fix | Delete
* @return array Direction set for 'rtl', if needed by locale.
[4287] Fix | Delete
*/
[4288] Fix | Delete
function _mce_set_direction( $mce_init ) {
[4289] Fix | Delete
if ( is_rtl() ) {
[4290] Fix | Delete
$mce_init['directionality'] = 'rtl';
[4291] Fix | Delete
$mce_init['rtl_ui'] = true;
[4292] Fix | Delete
[4293] Fix | Delete
if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
[4294] Fix | Delete
$mce_init['plugins'] .= ',directionality';
[4295] Fix | Delete
}
[4296] Fix | Delete
[4297] Fix | Delete
if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
[4298] Fix | Delete
$mce_init['toolbar1'] .= ',ltr';
[4299] Fix | Delete
}
[4300] Fix | Delete
}
[4301] Fix | Delete
[4302] Fix | Delete
return $mce_init;
[4303] Fix | Delete
}
[4304] Fix | Delete
[4305] Fix | Delete
[4306] Fix | Delete
/**
[4307] Fix | Delete
* Convert smiley code to the icon graphic file equivalent.
[4308] Fix | Delete
*
[4309] Fix | Delete
* You can turn off smilies, by going to the write setting screen and unchecking
[4310] Fix | Delete
* the box, or by setting 'use_smilies' option to false or removing the option.
[4311] Fix | Delete
*
[4312] Fix | Delete
* Plugins may override the default smiley list by setting the $wpsmiliestrans
[4313] Fix | Delete
* to an array, with the key the code the blogger types in and the value the
[4314] Fix | Delete
* image file.
[4315] Fix | Delete
*
[4316] Fix | Delete
* The $wp_smiliessearch global is for the regular expression and is set each
[4317] Fix | Delete
* time the function is called.
[4318] Fix | Delete
*
[4319] Fix | Delete
* The full list of smilies can be found in the function and won't be listed in
[4320] Fix | Delete
* the description. Probably should create a Codex page for it, so that it is
[4321] Fix | Delete
* available.
[4322] Fix | Delete
*
[4323] Fix | Delete
* @global array $wpsmiliestrans
[4324] Fix | Delete
* @global array $wp_smiliessearch
[4325] Fix | Delete
*
[4326] Fix | Delete
* @since 2.2.0
[4327] Fix | Delete
*/
[4328] Fix | Delete
function smilies_init() {
[4329] Fix | Delete
global $wpsmiliestrans, $wp_smiliessearch;
[4330] Fix | Delete
[4331] Fix | Delete
// Don't bother setting up smilies if they are disabled.
[4332] Fix | Delete
if ( ! get_option( 'use_smilies' ) ) {
[4333] Fix | Delete
return;
[4334] Fix | Delete
}
[4335] Fix | Delete
[4336] Fix | Delete
if ( ! isset( $wpsmiliestrans ) ) {
[4337] Fix | Delete
$wpsmiliestrans = array(
[4338] Fix | Delete
':mrgreen:' => 'mrgreen.png',
[4339] Fix | Delete
':neutral:' => "\xf0\x9f\x98\x90",
[4340] Fix | Delete
':twisted:' => "\xf0\x9f\x98\x88",
[4341] Fix | Delete
':arrow:' => "\xe2\x9e\xa1",
[4342] Fix | Delete
':shock:' => "\xf0\x9f\x98\xaf",
[4343] Fix | Delete
':smile:' => "\xf0\x9f\x99\x82",
[4344] Fix | Delete
':???:' => "\xf0\x9f\x98\x95",
[4345] Fix | Delete
':cool:' => "\xf0\x9f\x98\x8e",
[4346] Fix | Delete
':evil:' => "\xf0\x9f\x91\xbf",
[4347] Fix | Delete
':grin:' => "\xf0\x9f\x98\x80",
[4348] Fix | Delete
':idea:' => "\xf0\x9f\x92\xa1",
[4349] Fix | Delete
':oops:' => "\xf0\x9f\x98\xb3",
[4350] Fix | Delete
':razz:' => "\xf0\x9f\x98\x9b",
[4351] Fix | Delete
':roll:' => "\xf0\x9f\x99\x84",
[4352] Fix | Delete
':wink:' => "\xf0\x9f\x98\x89",
[4353] Fix | Delete
':cry:' => "\xf0\x9f\x98\xa5",
[4354] Fix | Delete
':eek:' => "\xf0\x9f\x98\xae",
[4355] Fix | Delete
':lol:' => "\xf0\x9f\x98\x86",
[4356] Fix | Delete
':mad:' => "\xf0\x9f\x98\xa1",
[4357] Fix | Delete
':sad:' => "\xf0\x9f\x99\x81",
[4358] Fix | Delete
'8-)' => "\xf0\x9f\x98\x8e",
[4359] Fix | Delete
'8-O' => "\xf0\x9f\x98\xaf",
[4360] Fix | Delete
':-(' => "\xf0\x9f\x99\x81",
[4361] Fix | Delete
':-)' => "\xf0\x9f\x99\x82",
[4362] Fix | Delete
':-?' => "\xf0\x9f\x98\x95",
[4363] Fix | Delete
':-D' => "\xf0\x9f\x98\x80",
[4364] Fix | Delete
':-P' => "\xf0\x9f\x98\x9b",
[4365] Fix | Delete
':-o' => "\xf0\x9f\x98\xae",
[4366] Fix | Delete
':-x' => "\xf0\x9f\x98\xa1",
[4367] Fix | Delete
':-|' => "\xf0\x9f\x98\x90",
[4368] Fix | Delete
';-)' => "\xf0\x9f\x98\x89",
[4369] Fix | Delete
// This one transformation breaks regular text with frequency.
[4370] Fix | Delete
// '8)' => "\xf0\x9f\x98\x8e",
[4371] Fix | Delete
'8O' => "\xf0\x9f\x98\xaf",
[4372] Fix | Delete
':(' => "\xf0\x9f\x99\x81",
[4373] Fix | Delete
':)' => "\xf0\x9f\x99\x82",
[4374] Fix | Delete
':?' => "\xf0\x9f\x98\x95",
[4375] Fix | Delete
':D' => "\xf0\x9f\x98\x80",
[4376] Fix | Delete
':P' => "\xf0\x9f\x98\x9b",
[4377] Fix | Delete
':o' => "\xf0\x9f\x98\xae",
[4378] Fix | Delete
':x' => "\xf0\x9f\x98\xa1",
[4379] Fix | Delete
':|' => "\xf0\x9f\x98\x90",
[4380] Fix | Delete
';)' => "\xf0\x9f\x98\x89",
[4381] Fix | Delete
':!:' => "\xe2\x9d\x97",
[4382] Fix | Delete
':?:' => "\xe2\x9d\x93",
[4383] Fix | Delete
);
[4384] Fix | Delete
}
[4385] Fix | Delete
[4386] Fix | Delete
/**
[4387] Fix | Delete
* Filters all the smilies.
[4388] Fix | Delete
*
[4389] Fix | Delete
* This filter must be added before `smilies_init` is run, as
[4390] Fix | Delete
* it is normally only run once to setup the smilies regex.
[4391] Fix | Delete
*
[4392] Fix | Delete
* @since 4.7.0
[4393] Fix | Delete
*
[4394] Fix | Delete
* @param string[] $wpsmiliestrans List of the smilies' hexadecimal representations, keyed by their smily code.
[4395] Fix | Delete
*/
[4396] Fix | Delete
$wpsmiliestrans = apply_filters( 'smilies', $wpsmiliestrans );
[4397] Fix | Delete
[4398] Fix | Delete
if ( count( $wpsmiliestrans ) == 0 ) {
[4399] Fix | Delete
return;
[4400] Fix | Delete
}
[4401] Fix | Delete
[4402] Fix | Delete
/*
[4403] Fix | Delete
* NOTE: we sort the smilies in reverse key order. This is to make sure
[4404] Fix | Delete
* we match the longest possible smilie (:???: vs :?) as the regular
[4405] Fix | Delete
* expression used below is first-match
[4406] Fix | Delete
*/
[4407] Fix | Delete
krsort( $wpsmiliestrans );
[4408] Fix | Delete
[4409] Fix | Delete
$spaces = wp_spaces_regexp();
[4410] Fix | Delete
[4411] Fix | Delete
// Begin first "subpattern".
[4412] Fix | Delete
$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
[4413] Fix | Delete
[4414] Fix | Delete
$subchar = '';
[4415] Fix | Delete
foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
[4416] Fix | Delete
$firstchar = substr( $smiley, 0, 1 );
[4417] Fix | Delete
$rest = substr( $smiley, 1 );
[4418] Fix | Delete
[4419] Fix | Delete
// New subpattern?
[4420] Fix | Delete
if ( $firstchar != $subchar ) {
[4421] Fix | Delete
if ( '' !== $subchar ) {
[4422] Fix | Delete
$wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern".
[4423] Fix | Delete
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern".
[4424] Fix | Delete
}
[4425] Fix | Delete
$subchar = $firstchar;
[4426] Fix | Delete
$wp_smiliessearch .= preg_quote( $firstchar, '/' ) . '(?:';
[4427] Fix | Delete
} else {
[4428] Fix | Delete
$wp_smiliessearch .= '|';
[4429] Fix | Delete
}
[4430] Fix | Delete
$wp_smiliessearch .= preg_quote( $rest, '/' );
[4431] Fix | Delete
}
[4432] Fix | Delete
[4433] Fix | Delete
$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
[4434] Fix | Delete
[4435] Fix | Delete
}
[4436] Fix | Delete
[4437] Fix | Delete
/**
[4438] Fix | Delete
* Merges user defined arguments into defaults array.
[4439] Fix | Delete
*
[4440] Fix | Delete
* This function is used throughout WordPress to allow for both string or array
[4441] Fix | Delete
* to be merged into another array.
[4442] Fix | Delete
*
[4443] Fix | Delete
* @since 2.2.0
[4444] Fix | Delete
* @since 2.3.0 `$args` can now also be an object.
[4445] Fix | Delete
*
[4446] Fix | Delete
* @param string|array|object $args Value to merge with $defaults.
[4447] Fix | Delete
* @param array $defaults Optional. Array that serves as the defaults.
[4448] Fix | Delete
* Default empty array.
[4449] Fix | Delete
* @return array Merged user defined values with defaults.
[4450] Fix | Delete
*/
[4451] Fix | Delete
function wp_parse_args( $args, $defaults = array() ) {
[4452] Fix | Delete
if ( is_object( $args ) ) {
[4453] Fix | Delete
$parsed_args = get_object_vars( $args );
[4454] Fix | Delete
} elseif ( is_array( $args ) ) {
[4455] Fix | Delete
$parsed_args =& $args;
[4456] Fix | Delete
} else {
[4457] Fix | Delete
wp_parse_str( $args, $parsed_args );
[4458] Fix | Delete
}
[4459] Fix | Delete
[4460] Fix | Delete
if ( is_array( $defaults ) && $defaults ) {
[4461] Fix | Delete
return array_merge( $defaults, $parsed_args );
[4462] Fix | Delete
}
[4463] Fix | Delete
return $parsed_args;
[4464] Fix | Delete
}
[4465] Fix | Delete
[4466] Fix | Delete
/**
[4467] Fix | Delete
* Converts a comma- or space-separated list of scalar values to an array.
[4468] Fix | Delete
*
[4469] Fix | Delete
* @since 5.1.0
[4470] Fix | Delete
*
[4471] Fix | Delete
* @param array|string $list List of values.
[4472] Fix | Delete
* @return array Array of values.
[4473] Fix | Delete
*/
[4474] Fix | Delete
function wp_parse_list( $list ) {
[4475] Fix | Delete
if ( ! is_array( $list ) ) {
[4476] Fix | Delete
return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
[4477] Fix | Delete
}
[4478] Fix | Delete
[4479] Fix | Delete
return $list;
[4480] Fix | Delete
}
[4481] Fix | Delete
[4482] Fix | Delete
/**
[4483] Fix | Delete
* Cleans up an array, comma- or space-separated list of IDs.
[4484] Fix | Delete
*
[4485] Fix | Delete
* @since 3.0.0
[4486] Fix | Delete
*
[4487] Fix | Delete
* @param array|string $list List of IDs.
[4488] Fix | Delete
* @return int[] Sanitized array of IDs.
[4489] Fix | Delete
*/
[4490] Fix | Delete
function wp_parse_id_list( $list ) {
[4491] Fix | Delete
$list = wp_parse_list( $list );
[4492] Fix | Delete
[4493] Fix | Delete
return array_unique( array_map( 'absint', $list ) );
[4494] Fix | Delete
}
[4495] Fix | Delete
[4496] Fix | Delete
/**
[4497] Fix | Delete
* Cleans up an array, comma- or space-separated list of slugs.
[4498] Fix | Delete
*
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function