Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: deprecated.php
[4500] Fix | Delete
// If we don't have a preset CSS variable, we'll assume it's a regular CSS value.
[4501] Fix | Delete
if ( ! str_contains( $style_value, "var:preset|{$css_property}|" ) ) {
[4502] Fix | Delete
return sprintf( '%s:%s;', $css_property, $style_value );
[4503] Fix | Delete
}
[4504] Fix | Delete
[4505] Fix | Delete
/*
[4506] Fix | Delete
* We have a preset CSS variable as the style.
[4507] Fix | Delete
* Get the style value from the string and return CSS style.
[4508] Fix | Delete
*/
[4509] Fix | Delete
$index_to_splice = strrpos( $style_value, '|' ) + 1;
[4510] Fix | Delete
$slug = substr( $style_value, $index_to_splice );
[4511] Fix | Delete
[4512] Fix | Delete
// Return the actual CSS inline style e.g. `text-decoration:var(--wp--preset--text-decoration--underline);`.
[4513] Fix | Delete
return sprintf( '%s:var(--wp--preset--%s--%s);', $css_property, $css_property, $slug );
[4514] Fix | Delete
}
[4515] Fix | Delete
[4516] Fix | Delete
/**
[4517] Fix | Delete
* Determines whether global terms are enabled.
[4518] Fix | Delete
*
[4519] Fix | Delete
* @since 3.0.0
[4520] Fix | Delete
* @since 6.1.0 This function now always returns false.
[4521] Fix | Delete
* @deprecated 6.1.0
[4522] Fix | Delete
*
[4523] Fix | Delete
* @return bool Always returns false.
[4524] Fix | Delete
*/
[4525] Fix | Delete
function global_terms_enabled() {
[4526] Fix | Delete
_deprecated_function( __FUNCTION__, '6.1.0' );
[4527] Fix | Delete
[4528] Fix | Delete
return false;
[4529] Fix | Delete
}
[4530] Fix | Delete
[4531] Fix | Delete
/**
[4532] Fix | Delete
* Filter the SQL clauses of an attachment query to include filenames.
[4533] Fix | Delete
*
[4534] Fix | Delete
* @since 4.7.0
[4535] Fix | Delete
* @deprecated 6.0.3
[4536] Fix | Delete
* @access private
[4537] Fix | Delete
*
[4538] Fix | Delete
* @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
[4539] Fix | Delete
* DISTINCT, fields (SELECT), and LIMITS clauses.
[4540] Fix | Delete
* @return array The unmodified clauses.
[4541] Fix | Delete
*/
[4542] Fix | Delete
function _filter_query_attachment_filenames( $clauses ) {
[4543] Fix | Delete
_deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
[4544] Fix | Delete
remove_filter( 'posts_clauses', __FUNCTION__ );
[4545] Fix | Delete
return $clauses;
[4546] Fix | Delete
}
[4547] Fix | Delete
[4548] Fix | Delete
/**
[4549] Fix | Delete
* Retrieves a page given its title.
[4550] Fix | Delete
*
[4551] Fix | Delete
* If more than one post uses the same title, the post with the smallest ID will be returned.
[4552] Fix | Delete
* Be careful: in case of more than one post having the same title, it will check the oldest
[4553] Fix | Delete
* publication date, not the smallest ID.
[4554] Fix | Delete
*
[4555] Fix | Delete
* Because this function uses the MySQL '=' comparison, $page_title will usually be matched
[4556] Fix | Delete
* as case-insensitive with default collation.
[4557] Fix | Delete
*
[4558] Fix | Delete
* @since 2.1.0
[4559] Fix | Delete
* @since 3.0.0 The `$post_type` parameter was added.
[4560] Fix | Delete
* @deprecated 6.2.0 Use WP_Query.
[4561] Fix | Delete
*
[4562] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[4563] Fix | Delete
*
[4564] Fix | Delete
* @param string $page_title Page title.
[4565] Fix | Delete
* @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
[4566] Fix | Delete
* correspond to a WP_Post object, an associative array, or a numeric array,
[4567] Fix | Delete
* respectively. Default OBJECT.
[4568] Fix | Delete
* @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
[4569] Fix | Delete
* @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
[4570] Fix | Delete
*/
[4571] Fix | Delete
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
[4572] Fix | Delete
_deprecated_function( __FUNCTION__, '6.2.0', 'WP_Query' );
[4573] Fix | Delete
global $wpdb;
[4574] Fix | Delete
[4575] Fix | Delete
if ( is_array( $post_type ) ) {
[4576] Fix | Delete
$post_type = esc_sql( $post_type );
[4577] Fix | Delete
$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
[4578] Fix | Delete
$sql = $wpdb->prepare(
[4579] Fix | Delete
"SELECT ID
[4580] Fix | Delete
FROM $wpdb->posts
[4581] Fix | Delete
WHERE post_title = %s
[4582] Fix | Delete
AND post_type IN ($post_type_in_string)",
[4583] Fix | Delete
$page_title
[4584] Fix | Delete
);
[4585] Fix | Delete
} else {
[4586] Fix | Delete
$sql = $wpdb->prepare(
[4587] Fix | Delete
"SELECT ID
[4588] Fix | Delete
FROM $wpdb->posts
[4589] Fix | Delete
WHERE post_title = %s
[4590] Fix | Delete
AND post_type = %s",
[4591] Fix | Delete
$page_title,
[4592] Fix | Delete
$post_type
[4593] Fix | Delete
);
[4594] Fix | Delete
}
[4595] Fix | Delete
[4596] Fix | Delete
$page = $wpdb->get_var( $sql );
[4597] Fix | Delete
[4598] Fix | Delete
if ( $page ) {
[4599] Fix | Delete
return get_post( $page, $output );
[4600] Fix | Delete
}
[4601] Fix | Delete
[4602] Fix | Delete
return null;
[4603] Fix | Delete
}
[4604] Fix | Delete
[4605] Fix | Delete
/**
[4606] Fix | Delete
* Returns the correct template for the site's home page.
[4607] Fix | Delete
*
[4608] Fix | Delete
* @access private
[4609] Fix | Delete
* @since 6.0.0
[4610] Fix | Delete
* @deprecated 6.2.0 Site Editor's server-side redirect for missing postType and postId
[4611] Fix | Delete
* query args is removed. Thus, this function is no longer used.
[4612] Fix | Delete
*
[4613] Fix | Delete
* @return array|null A template object, or null if none could be found.
[4614] Fix | Delete
*/
[4615] Fix | Delete
function _resolve_home_block_template() {
[4616] Fix | Delete
_deprecated_function( __FUNCTION__, '6.2.0' );
[4617] Fix | Delete
[4618] Fix | Delete
$show_on_front = get_option( 'show_on_front' );
[4619] Fix | Delete
$front_page_id = get_option( 'page_on_front' );
[4620] Fix | Delete
[4621] Fix | Delete
if ( 'page' === $show_on_front && $front_page_id ) {
[4622] Fix | Delete
return array(
[4623] Fix | Delete
'postType' => 'page',
[4624] Fix | Delete
'postId' => $front_page_id,
[4625] Fix | Delete
);
[4626] Fix | Delete
}
[4627] Fix | Delete
[4628] Fix | Delete
$hierarchy = array( 'front-page', 'home', 'index' );
[4629] Fix | Delete
$template = resolve_block_template( 'home', $hierarchy, '' );
[4630] Fix | Delete
[4631] Fix | Delete
if ( ! $template ) {
[4632] Fix | Delete
return null;
[4633] Fix | Delete
}
[4634] Fix | Delete
[4635] Fix | Delete
return array(
[4636] Fix | Delete
'postType' => 'wp_template',
[4637] Fix | Delete
'postId' => $template->id,
[4638] Fix | Delete
);
[4639] Fix | Delete
}
[4640] Fix | Delete
[4641] Fix | Delete
/**
[4642] Fix | Delete
* Displays the link to the Windows Live Writer manifest file.
[4643] Fix | Delete
*
[4644] Fix | Delete
* @link https://msdn.microsoft.com/en-us/library/bb463265.aspx
[4645] Fix | Delete
* @since 2.3.1
[4646] Fix | Delete
* @deprecated 6.3.0 WLW manifest is no longer in use and no longer included in core,
[4647] Fix | Delete
* so the output from this function is removed.
[4648] Fix | Delete
*/
[4649] Fix | Delete
function wlwmanifest_link() {
[4650] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0' );
[4651] Fix | Delete
}
[4652] Fix | Delete
[4653] Fix | Delete
/**
[4654] Fix | Delete
* Queues comments for metadata lazy-loading.
[4655] Fix | Delete
*
[4656] Fix | Delete
* @since 4.5.0
[4657] Fix | Delete
* @deprecated 6.3.0 Use wp_lazyload_comment_meta() instead.
[4658] Fix | Delete
*
[4659] Fix | Delete
* @param WP_Comment[] $comments Array of comment objects.
[4660] Fix | Delete
*/
[4661] Fix | Delete
function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
[4662] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0', 'wp_lazyload_comment_meta()' );
[4663] Fix | Delete
// Don't use `wp_list_pluck()` to avoid by-reference manipulation.
[4664] Fix | Delete
$comment_ids = array();
[4665] Fix | Delete
if ( is_array( $comments ) ) {
[4666] Fix | Delete
foreach ( $comments as $comment ) {
[4667] Fix | Delete
if ( $comment instanceof WP_Comment ) {
[4668] Fix | Delete
$comment_ids[] = $comment->comment_ID;
[4669] Fix | Delete
}
[4670] Fix | Delete
}
[4671] Fix | Delete
}
[4672] Fix | Delete
[4673] Fix | Delete
wp_lazyload_comment_meta( $comment_ids );
[4674] Fix | Delete
}
[4675] Fix | Delete
[4676] Fix | Delete
/**
[4677] Fix | Delete
* Gets the default value to use for a `loading` attribute on an element.
[4678] Fix | Delete
*
[4679] Fix | Delete
* This function should only be called for a tag and context if lazy-loading is generally enabled.
[4680] Fix | Delete
*
[4681] Fix | Delete
* The function usually returns 'lazy', but uses certain heuristics to guess whether the current element is likely to
[4682] Fix | Delete
* appear above the fold, in which case it returns a boolean `false`, which will lead to the `loading` attribute being
[4683] Fix | Delete
* omitted on the element. The purpose of this refinement is to avoid lazy-loading elements that are within the initial
[4684] Fix | Delete
* viewport, which can have a negative performance impact.
[4685] Fix | Delete
*
[4686] Fix | Delete
* Under the hood, the function uses {@see wp_increase_content_media_count()} every time it is called for an element
[4687] Fix | Delete
* within the main content. If the element is the very first content element, the `loading` attribute will be omitted.
[4688] Fix | Delete
* This default threshold of 3 content elements to omit the `loading` attribute for can be customized using the
[4689] Fix | Delete
* {@see 'wp_omit_loading_attr_threshold'} filter.
[4690] Fix | Delete
*
[4691] Fix | Delete
* @since 5.9.0
[4692] Fix | Delete
* @deprecated 6.3.0 Use wp_get_loading_optimization_attributes() instead.
[4693] Fix | Delete
* @see wp_get_loading_optimization_attributes()
[4694] Fix | Delete
*
[4695] Fix | Delete
* @global WP_Query $wp_query WordPress Query object.
[4696] Fix | Delete
*
[4697] Fix | Delete
* @param string $context Context for the element for which the `loading` attribute value is requested.
[4698] Fix | Delete
* @return string|bool The default `loading` attribute value. Either 'lazy', 'eager', or a boolean `false`, to indicate
[4699] Fix | Delete
* that the `loading` attribute should be skipped.
[4700] Fix | Delete
*/
[4701] Fix | Delete
function wp_get_loading_attr_default( $context ) {
[4702] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0', 'wp_get_loading_optimization_attributes()' );
[4703] Fix | Delete
global $wp_query;
[4704] Fix | Delete
[4705] Fix | Delete
// Skip lazy-loading for the overall block template, as it is handled more granularly.
[4706] Fix | Delete
if ( 'template' === $context ) {
[4707] Fix | Delete
return false;
[4708] Fix | Delete
}
[4709] Fix | Delete
[4710] Fix | Delete
/*
[4711] Fix | Delete
* Do not lazy-load images in the header block template part, as they are likely above the fold.
[4712] Fix | Delete
* For classic themes, this is handled in the condition below using the 'get_header' action.
[4713] Fix | Delete
*/
[4714] Fix | Delete
$header_area = WP_TEMPLATE_PART_AREA_HEADER;
[4715] Fix | Delete
if ( "template_part_{$header_area}" === $context ) {
[4716] Fix | Delete
return false;
[4717] Fix | Delete
}
[4718] Fix | Delete
[4719] Fix | Delete
// Special handling for programmatically created image tags.
[4720] Fix | Delete
if ( 'the_post_thumbnail' === $context || 'wp_get_attachment_image' === $context ) {
[4721] Fix | Delete
/*
[4722] Fix | Delete
* Skip programmatically created images within post content as they need to be handled together with the other
[4723] Fix | Delete
* images within the post content.
[4724] Fix | Delete
* Without this clause, they would already be counted below which skews the number and can result in the first
[4725] Fix | Delete
* post content image being lazy-loaded only because there are images elsewhere in the post content.
[4726] Fix | Delete
*/
[4727] Fix | Delete
if ( doing_filter( 'the_content' ) ) {
[4728] Fix | Delete
return false;
[4729] Fix | Delete
}
[4730] Fix | Delete
[4731] Fix | Delete
// Conditionally skip lazy-loading on images before the loop.
[4732] Fix | Delete
if (
[4733] Fix | Delete
// Only apply for main query but before the loop.
[4734] Fix | Delete
$wp_query->before_loop && $wp_query->is_main_query()
[4735] Fix | Delete
/*
[4736] Fix | Delete
* Any image before the loop, but after the header has started should not be lazy-loaded,
[4737] Fix | Delete
* except when the footer has already started which can happen when the current template
[4738] Fix | Delete
* does not include any loop.
[4739] Fix | Delete
*/
[4740] Fix | Delete
&& did_action( 'get_header' ) && ! did_action( 'get_footer' )
[4741] Fix | Delete
) {
[4742] Fix | Delete
return false;
[4743] Fix | Delete
}
[4744] Fix | Delete
}
[4745] Fix | Delete
[4746] Fix | Delete
/*
[4747] Fix | Delete
* The first elements in 'the_content' or 'the_post_thumbnail' should not be lazy-loaded,
[4748] Fix | Delete
* as they are likely above the fold.
[4749] Fix | Delete
*/
[4750] Fix | Delete
if ( 'the_content' === $context || 'the_post_thumbnail' === $context ) {
[4751] Fix | Delete
// Only elements within the main query loop have special handling.
[4752] Fix | Delete
if ( is_admin() || ! in_the_loop() || ! is_main_query() ) {
[4753] Fix | Delete
return 'lazy';
[4754] Fix | Delete
}
[4755] Fix | Delete
[4756] Fix | Delete
// Increase the counter since this is a main query content element.
[4757] Fix | Delete
$content_media_count = wp_increase_content_media_count();
[4758] Fix | Delete
[4759] Fix | Delete
// If the count so far is below the threshold, return `false` so that the `loading` attribute is omitted.
[4760] Fix | Delete
if ( $content_media_count <= wp_omit_loading_attr_threshold() ) {
[4761] Fix | Delete
return false;
[4762] Fix | Delete
}
[4763] Fix | Delete
[4764] Fix | Delete
// For elements after the threshold, lazy-load them as usual.
[4765] Fix | Delete
return 'lazy';
[4766] Fix | Delete
}
[4767] Fix | Delete
[4768] Fix | Delete
// Lazy-load by default for any unknown context.
[4769] Fix | Delete
return 'lazy';
[4770] Fix | Delete
}
[4771] Fix | Delete
[4772] Fix | Delete
/**
[4773] Fix | Delete
* Adds `loading` attribute to an `img` HTML tag.
[4774] Fix | Delete
*
[4775] Fix | Delete
* @since 5.5.0
[4776] Fix | Delete
* @deprecated 6.3.0 Use wp_img_tag_add_loading_optimization_attrs() instead.
[4777] Fix | Delete
* @see wp_img_tag_add_loading_optimization_attrs()
[4778] Fix | Delete
*
[4779] Fix | Delete
* @param string $image The HTML `img` tag where the attribute should be added.
[4780] Fix | Delete
* @param string $context Additional context to pass to the filters.
[4781] Fix | Delete
* @return string Converted `img` tag with `loading` attribute added.
[4782] Fix | Delete
*/
[4783] Fix | Delete
function wp_img_tag_add_loading_attr( $image, $context ) {
[4784] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0', 'wp_img_tag_add_loading_optimization_attrs()' );
[4785] Fix | Delete
/*
[4786] Fix | Delete
* Get loading attribute value to use. This must occur before the conditional check below so that even images that
[4787] Fix | Delete
* are ineligible for being lazy-loaded are considered.
[4788] Fix | Delete
*/
[4789] Fix | Delete
$value = wp_get_loading_attr_default( $context );
[4790] Fix | Delete
[4791] Fix | Delete
// Images should have source and dimension attributes for the `loading` attribute to be added.
[4792] Fix | Delete
if ( ! str_contains( $image, ' src="' ) || ! str_contains( $image, ' width="' ) || ! str_contains( $image, ' height="' ) ) {
[4793] Fix | Delete
return $image;
[4794] Fix | Delete
}
[4795] Fix | Delete
[4796] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[4797] Fix | Delete
$value = apply_filters( 'wp_img_tag_add_loading_attr', $value, $image, $context );
[4798] Fix | Delete
[4799] Fix | Delete
if ( $value ) {
[4800] Fix | Delete
if ( ! in_array( $value, array( 'lazy', 'eager' ), true ) ) {
[4801] Fix | Delete
$value = 'lazy';
[4802] Fix | Delete
}
[4803] Fix | Delete
[4804] Fix | Delete
return str_replace( '<img', '<img loading="' . esc_attr( $value ) . '"', $image );
[4805] Fix | Delete
}
[4806] Fix | Delete
[4807] Fix | Delete
return $image;
[4808] Fix | Delete
}
[4809] Fix | Delete
[4810] Fix | Delete
/**
[4811] Fix | Delete
* Takes input from [0, n] and returns it as [0, 1].
[4812] Fix | Delete
*
[4813] Fix | Delete
* Direct port of TinyColor's function, lightly simplified to maintain
[4814] Fix | Delete
* consistency with TinyColor.
[4815] Fix | Delete
*
[4816] Fix | Delete
* @link https://github.com/bgrins/TinyColor
[4817] Fix | Delete
*
[4818] Fix | Delete
* @since 5.8.0
[4819] Fix | Delete
* @deprecated 6.3.0
[4820] Fix | Delete
*
[4821] Fix | Delete
* @access private
[4822] Fix | Delete
*
[4823] Fix | Delete
* @param mixed $n Number of unknown type.
[4824] Fix | Delete
* @param int $max Upper value of the range to bound to.
[4825] Fix | Delete
* @return float Value in the range [0, 1].
[4826] Fix | Delete
*/
[4827] Fix | Delete
function wp_tinycolor_bound01( $n, $max ) {
[4828] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0' );
[4829] Fix | Delete
if ( 'string' === gettype( $n ) && str_contains( $n, '.' ) && 1 === (float) $n ) {
[4830] Fix | Delete
$n = '100%';
[4831] Fix | Delete
}
[4832] Fix | Delete
[4833] Fix | Delete
$n = min( $max, max( 0, (float) $n ) );
[4834] Fix | Delete
[4835] Fix | Delete
// Automatically convert percentage into number.
[4836] Fix | Delete
if ( 'string' === gettype( $n ) && str_contains( $n, '%' ) ) {
[4837] Fix | Delete
$n = (int) ( $n * $max ) / 100;
[4838] Fix | Delete
}
[4839] Fix | Delete
[4840] Fix | Delete
// Handle floating point rounding errors.
[4841] Fix | Delete
if ( ( abs( $n - $max ) < 0.000001 ) ) {
[4842] Fix | Delete
return 1.0;
[4843] Fix | Delete
}
[4844] Fix | Delete
[4845] Fix | Delete
// Convert into [0, 1] range if it isn't already.
[4846] Fix | Delete
return ( $n % $max ) / (float) $max;
[4847] Fix | Delete
}
[4848] Fix | Delete
[4849] Fix | Delete
/**
[4850] Fix | Delete
* Direct port of tinycolor's boundAlpha function to maintain consistency with
[4851] Fix | Delete
* how tinycolor works.
[4852] Fix | Delete
*
[4853] Fix | Delete
* @link https://github.com/bgrins/TinyColor
[4854] Fix | Delete
*
[4855] Fix | Delete
* @since 5.9.0
[4856] Fix | Delete
* @deprecated 6.3.0
[4857] Fix | Delete
*
[4858] Fix | Delete
* @access private
[4859] Fix | Delete
*
[4860] Fix | Delete
* @param mixed $n Number of unknown type.
[4861] Fix | Delete
* @return float Value in the range [0,1].
[4862] Fix | Delete
*/
[4863] Fix | Delete
function _wp_tinycolor_bound_alpha( $n ) {
[4864] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0' );
[4865] Fix | Delete
[4866] Fix | Delete
if ( is_numeric( $n ) ) {
[4867] Fix | Delete
$n = (float) $n;
[4868] Fix | Delete
if ( $n >= 0 && $n <= 1 ) {
[4869] Fix | Delete
return $n;
[4870] Fix | Delete
}
[4871] Fix | Delete
}
[4872] Fix | Delete
return 1;
[4873] Fix | Delete
}
[4874] Fix | Delete
[4875] Fix | Delete
/**
[4876] Fix | Delete
* Rounds and converts values of an RGB object.
[4877] Fix | Delete
*
[4878] Fix | Delete
* Direct port of TinyColor's function, lightly simplified to maintain
[4879] Fix | Delete
* consistency with TinyColor.
[4880] Fix | Delete
*
[4881] Fix | Delete
* @link https://github.com/bgrins/TinyColor
[4882] Fix | Delete
*
[4883] Fix | Delete
* @since 5.8.0
[4884] Fix | Delete
* @deprecated 6.3.0
[4885] Fix | Delete
*
[4886] Fix | Delete
* @access private
[4887] Fix | Delete
*
[4888] Fix | Delete
* @param array $rgb_color RGB object.
[4889] Fix | Delete
* @return array Rounded and converted RGB object.
[4890] Fix | Delete
*/
[4891] Fix | Delete
function wp_tinycolor_rgb_to_rgb( $rgb_color ) {
[4892] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0' );
[4893] Fix | Delete
[4894] Fix | Delete
return array(
[4895] Fix | Delete
'r' => wp_tinycolor_bound01( $rgb_color['r'], 255 ) * 255,
[4896] Fix | Delete
'g' => wp_tinycolor_bound01( $rgb_color['g'], 255 ) * 255,
[4897] Fix | Delete
'b' => wp_tinycolor_bound01( $rgb_color['b'], 255 ) * 255,
[4898] Fix | Delete
);
[4899] Fix | Delete
}
[4900] Fix | Delete
[4901] Fix | Delete
/**
[4902] Fix | Delete
* Helper function for hsl to rgb conversion.
[4903] Fix | Delete
*
[4904] Fix | Delete
* Direct port of TinyColor's function, lightly simplified to maintain
[4905] Fix | Delete
* consistency with TinyColor.
[4906] Fix | Delete
*
[4907] Fix | Delete
* @link https://github.com/bgrins/TinyColor
[4908] Fix | Delete
*
[4909] Fix | Delete
* @since 5.8.0
[4910] Fix | Delete
* @deprecated 6.3.0
[4911] Fix | Delete
*
[4912] Fix | Delete
* @access private
[4913] Fix | Delete
*
[4914] Fix | Delete
* @param float $p first component.
[4915] Fix | Delete
* @param float $q second component.
[4916] Fix | Delete
* @param float $t third component.
[4917] Fix | Delete
* @return float R, G, or B component.
[4918] Fix | Delete
*/
[4919] Fix | Delete
function wp_tinycolor_hue_to_rgb( $p, $q, $t ) {
[4920] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0' );
[4921] Fix | Delete
[4922] Fix | Delete
if ( $t < 0 ) {
[4923] Fix | Delete
++$t;
[4924] Fix | Delete
}
[4925] Fix | Delete
if ( $t > 1 ) {
[4926] Fix | Delete
--$t;
[4927] Fix | Delete
}
[4928] Fix | Delete
if ( $t < 1 / 6 ) {
[4929] Fix | Delete
return $p + ( $q - $p ) * 6 * $t;
[4930] Fix | Delete
}
[4931] Fix | Delete
if ( $t < 1 / 2 ) {
[4932] Fix | Delete
return $q;
[4933] Fix | Delete
}
[4934] Fix | Delete
if ( $t < 2 / 3 ) {
[4935] Fix | Delete
return $p + ( $q - $p ) * ( 2 / 3 - $t ) * 6;
[4936] Fix | Delete
}
[4937] Fix | Delete
return $p;
[4938] Fix | Delete
}
[4939] Fix | Delete
[4940] Fix | Delete
/**
[4941] Fix | Delete
* Converts an HSL object to an RGB object with converted and rounded values.
[4942] Fix | Delete
*
[4943] Fix | Delete
* Direct port of TinyColor's function, lightly simplified to maintain
[4944] Fix | Delete
* consistency with TinyColor.
[4945] Fix | Delete
*
[4946] Fix | Delete
* @link https://github.com/bgrins/TinyColor
[4947] Fix | Delete
*
[4948] Fix | Delete
* @since 5.8.0
[4949] Fix | Delete
* @deprecated 6.3.0
[4950] Fix | Delete
*
[4951] Fix | Delete
* @access private
[4952] Fix | Delete
*
[4953] Fix | Delete
* @param array $hsl_color HSL object.
[4954] Fix | Delete
* @return array Rounded and converted RGB object.
[4955] Fix | Delete
*/
[4956] Fix | Delete
function wp_tinycolor_hsl_to_rgb( $hsl_color ) {
[4957] Fix | Delete
_deprecated_function( __FUNCTION__, '6.3.0' );
[4958] Fix | Delete
[4959] Fix | Delete
$h = wp_tinycolor_bound01( $hsl_color['h'], 360 );
[4960] Fix | Delete
$s = wp_tinycolor_bound01( $hsl_color['s'], 100 );
[4961] Fix | Delete
$l = wp_tinycolor_bound01( $hsl_color['l'], 100 );
[4962] Fix | Delete
[4963] Fix | Delete
if ( 0 === $s ) {
[4964] Fix | Delete
// Achromatic.
[4965] Fix | Delete
$r = $l;
[4966] Fix | Delete
$g = $l;
[4967] Fix | Delete
$b = $l;
[4968] Fix | Delete
} else {
[4969] Fix | Delete
$q = $l < 0.5 ? $l * ( 1 + $s ) : $l + $s - $l * $s;
[4970] Fix | Delete
$p = 2 * $l - $q;
[4971] Fix | Delete
$r = wp_tinycolor_hue_to_rgb( $p, $q, $h + 1 / 3 );
[4972] Fix | Delete
$g = wp_tinycolor_hue_to_rgb( $p, $q, $h );
[4973] Fix | Delete
$b = wp_tinycolor_hue_to_rgb( $p, $q, $h - 1 / 3 );
[4974] Fix | Delete
}
[4975] Fix | Delete
[4976] Fix | Delete
return array(
[4977] Fix | Delete
'r' => $r * 255,
[4978] Fix | Delete
'g' => $g * 255,
[4979] Fix | Delete
'b' => $b * 255,
[4980] Fix | Delete
);
[4981] Fix | Delete
}
[4982] Fix | Delete
[4983] Fix | Delete
/**
[4984] Fix | Delete
* Parses hex, hsl, and rgb CSS strings using the same regex as TinyColor v1.4.2
[4985] Fix | Delete
* used in the JavaScript. Only colors output from react-color are implemented.
[4986] Fix | Delete
*
[4987] Fix | Delete
* Direct port of TinyColor's function, lightly simplified to maintain
[4988] Fix | Delete
* consistency with TinyColor.
[4989] Fix | Delete
*
[4990] Fix | Delete
* @link https://github.com/bgrins/TinyColor
[4991] Fix | Delete
* @link https://github.com/casesandberg/react-color/
[4992] Fix | Delete
*
[4993] Fix | Delete
* @since 5.8.0
[4994] Fix | Delete
* @since 5.9.0 Added alpha processing.
[4995] Fix | Delete
* @deprecated 6.3.0
[4996] Fix | Delete
*
[4997] Fix | Delete
* @access private
[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