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: class-wp-scripts.php
if ( $display ) {
[500] Fix | Delete
echo $this->get_inline_script_tag( $handle, $position );
[501] Fix | Delete
}
[502] Fix | Delete
return $output;
[503] Fix | Delete
}
[504] Fix | Delete
[505] Fix | Delete
/**
[506] Fix | Delete
* Gets data for inline scripts registered for a specific handle.
[507] Fix | Delete
*
[508] Fix | Delete
* @since 6.3.0
[509] Fix | Delete
*
[510] Fix | Delete
* @param string $handle Name of the script to get data for.
[511] Fix | Delete
* Must be lowercase.
[512] Fix | Delete
* @param string $position Optional. Whether to add the inline script
[513] Fix | Delete
* before the handle or after. Default 'after'.
[514] Fix | Delete
* @return string Inline script, which may be empty string.
[515] Fix | Delete
*/
[516] Fix | Delete
public function get_inline_script_data( $handle, $position = 'after' ) {
[517] Fix | Delete
$data = $this->get_data( $handle, $position );
[518] Fix | Delete
if ( empty( $data ) || ! is_array( $data ) ) {
[519] Fix | Delete
return '';
[520] Fix | Delete
}
[521] Fix | Delete
[522] Fix | Delete
return trim( implode( "\n", $data ), "\n" );
[523] Fix | Delete
}
[524] Fix | Delete
[525] Fix | Delete
/**
[526] Fix | Delete
* Gets tags for inline scripts registered for a specific handle.
[527] Fix | Delete
*
[528] Fix | Delete
* @since 6.3.0
[529] Fix | Delete
*
[530] Fix | Delete
* @param string $handle Name of the script to get associated inline script tag for.
[531] Fix | Delete
* Must be lowercase.
[532] Fix | Delete
* @param string $position Optional. Whether to get tag for inline
[533] Fix | Delete
* scripts in the before or after position. Default 'after'.
[534] Fix | Delete
* @return string Inline script, which may be empty string.
[535] Fix | Delete
*/
[536] Fix | Delete
public function get_inline_script_tag( $handle, $position = 'after' ) {
[537] Fix | Delete
$js = $this->get_inline_script_data( $handle, $position );
[538] Fix | Delete
if ( empty( $js ) ) {
[539] Fix | Delete
return '';
[540] Fix | Delete
}
[541] Fix | Delete
[542] Fix | Delete
$id = "{$handle}-js-{$position}";
[543] Fix | Delete
[544] Fix | Delete
return wp_get_inline_script_tag( $js, compact( 'id' ) );
[545] Fix | Delete
}
[546] Fix | Delete
[547] Fix | Delete
/**
[548] Fix | Delete
* Localizes a script, only if the script has already been added.
[549] Fix | Delete
*
[550] Fix | Delete
* @since 2.1.0
[551] Fix | Delete
*
[552] Fix | Delete
* @param string $handle Name of the script to attach data to.
[553] Fix | Delete
* @param string $object_name Name of the variable that will contain the data.
[554] Fix | Delete
* @param array $l10n Array of data to localize.
[555] Fix | Delete
* @return bool True on success, false on failure.
[556] Fix | Delete
*/
[557] Fix | Delete
public function localize( $handle, $object_name, $l10n ) {
[558] Fix | Delete
if ( 'jquery' === $handle ) {
[559] Fix | Delete
$handle = 'jquery-core';
[560] Fix | Delete
}
[561] Fix | Delete
[562] Fix | Delete
if ( is_array( $l10n ) && isset( $l10n['l10n_print_after'] ) ) { // back compat, preserve the code in 'l10n_print_after' if present.
[563] Fix | Delete
$after = $l10n['l10n_print_after'];
[564] Fix | Delete
unset( $l10n['l10n_print_after'] );
[565] Fix | Delete
}
[566] Fix | Delete
[567] Fix | Delete
if ( ! is_array( $l10n ) ) {
[568] Fix | Delete
_doing_it_wrong(
[569] Fix | Delete
__METHOD__,
[570] Fix | Delete
sprintf(
[571] Fix | Delete
/* translators: 1: $l10n, 2: wp_add_inline_script() */
[572] Fix | Delete
__( 'The %1$s parameter must be an array. To pass arbitrary data to scripts, use the %2$s function instead.' ),
[573] Fix | Delete
'<code>$l10n</code>',
[574] Fix | Delete
'<code>wp_add_inline_script()</code>'
[575] Fix | Delete
),
[576] Fix | Delete
'5.7.0'
[577] Fix | Delete
);
[578] Fix | Delete
[579] Fix | Delete
if ( false === $l10n ) {
[580] Fix | Delete
// This should really not be needed, but is necessary for backward compatibility.
[581] Fix | Delete
$l10n = array( $l10n );
[582] Fix | Delete
}
[583] Fix | Delete
}
[584] Fix | Delete
[585] Fix | Delete
if ( is_string( $l10n ) ) {
[586] Fix | Delete
$l10n = html_entity_decode( $l10n, ENT_QUOTES, 'UTF-8' );
[587] Fix | Delete
} elseif ( is_array( $l10n ) ) {
[588] Fix | Delete
foreach ( $l10n as $key => $value ) {
[589] Fix | Delete
if ( ! is_scalar( $value ) ) {
[590] Fix | Delete
continue;
[591] Fix | Delete
}
[592] Fix | Delete
[593] Fix | Delete
$l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
[594] Fix | Delete
}
[595] Fix | Delete
}
[596] Fix | Delete
[597] Fix | Delete
$script = "var $object_name = " . wp_json_encode( $l10n ) . ';';
[598] Fix | Delete
[599] Fix | Delete
if ( ! empty( $after ) ) {
[600] Fix | Delete
$script .= "\n$after;";
[601] Fix | Delete
}
[602] Fix | Delete
[603] Fix | Delete
$data = $this->get_data( $handle, 'data' );
[604] Fix | Delete
[605] Fix | Delete
if ( ! empty( $data ) ) {
[606] Fix | Delete
$script = "$data\n$script";
[607] Fix | Delete
}
[608] Fix | Delete
[609] Fix | Delete
return $this->add_data( $handle, 'data', $script );
[610] Fix | Delete
}
[611] Fix | Delete
[612] Fix | Delete
/**
[613] Fix | Delete
* Sets handle group.
[614] Fix | Delete
*
[615] Fix | Delete
* @since 2.8.0
[616] Fix | Delete
*
[617] Fix | Delete
* @see WP_Dependencies::set_group()
[618] Fix | Delete
*
[619] Fix | Delete
* @param string $handle Name of the item. Should be unique.
[620] Fix | Delete
* @param bool $recursion Internal flag that calling function was called recursively.
[621] Fix | Delete
* @param int|false $group Optional. Group level: level (int), no groups (false).
[622] Fix | Delete
* Default false.
[623] Fix | Delete
* @return bool Not already in the group or a lower group.
[624] Fix | Delete
*/
[625] Fix | Delete
public function set_group( $handle, $recursion, $group = false ) {
[626] Fix | Delete
if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) {
[627] Fix | Delete
$grp = 1;
[628] Fix | Delete
} else {
[629] Fix | Delete
$grp = (int) $this->get_data( $handle, 'group' );
[630] Fix | Delete
}
[631] Fix | Delete
[632] Fix | Delete
if ( false !== $group && $grp > $group ) {
[633] Fix | Delete
$grp = $group;
[634] Fix | Delete
}
[635] Fix | Delete
[636] Fix | Delete
return parent::set_group( $handle, $recursion, $grp );
[637] Fix | Delete
}
[638] Fix | Delete
[639] Fix | Delete
/**
[640] Fix | Delete
* Sets a translation textdomain.
[641] Fix | Delete
*
[642] Fix | Delete
* @since 5.0.0
[643] Fix | Delete
* @since 5.1.0 The `$domain` parameter was made optional.
[644] Fix | Delete
*
[645] Fix | Delete
* @param string $handle Name of the script to register a translation domain to.
[646] Fix | Delete
* @param string $domain Optional. Text domain. Default 'default'.
[647] Fix | Delete
* @param string $path Optional. The full file path to the directory containing translation files.
[648] Fix | Delete
* @return bool True if the text domain was registered, false if not.
[649] Fix | Delete
*/
[650] Fix | Delete
public function set_translations( $handle, $domain = 'default', $path = '' ) {
[651] Fix | Delete
if ( ! isset( $this->registered[ $handle ] ) ) {
[652] Fix | Delete
return false;
[653] Fix | Delete
}
[654] Fix | Delete
[655] Fix | Delete
/** @var \_WP_Dependency $obj */
[656] Fix | Delete
$obj = $this->registered[ $handle ];
[657] Fix | Delete
[658] Fix | Delete
if ( ! in_array( 'wp-i18n', $obj->deps, true ) ) {
[659] Fix | Delete
$obj->deps[] = 'wp-i18n';
[660] Fix | Delete
}
[661] Fix | Delete
[662] Fix | Delete
return $obj->set_translations( $domain, $path );
[663] Fix | Delete
}
[664] Fix | Delete
[665] Fix | Delete
/**
[666] Fix | Delete
* Prints translations set for a specific handle.
[667] Fix | Delete
*
[668] Fix | Delete
* @since 5.0.0
[669] Fix | Delete
*
[670] Fix | Delete
* @param string $handle Name of the script to add the inline script to.
[671] Fix | Delete
* Must be lowercase.
[672] Fix | Delete
* @param bool $display Optional. Whether to print the script
[673] Fix | Delete
* instead of just returning it. Default true.
[674] Fix | Delete
* @return string|false Script on success, false otherwise.
[675] Fix | Delete
*/
[676] Fix | Delete
public function print_translations( $handle, $display = true ) {
[677] Fix | Delete
if ( ! isset( $this->registered[ $handle ] ) || empty( $this->registered[ $handle ]->textdomain ) ) {
[678] Fix | Delete
return false;
[679] Fix | Delete
}
[680] Fix | Delete
[681] Fix | Delete
$domain = $this->registered[ $handle ]->textdomain;
[682] Fix | Delete
$path = '';
[683] Fix | Delete
[684] Fix | Delete
if ( isset( $this->registered[ $handle ]->translations_path ) ) {
[685] Fix | Delete
$path = $this->registered[ $handle ]->translations_path;
[686] Fix | Delete
}
[687] Fix | Delete
[688] Fix | Delete
$json_translations = load_script_textdomain( $handle, $domain, $path );
[689] Fix | Delete
[690] Fix | Delete
if ( ! $json_translations ) {
[691] Fix | Delete
return false;
[692] Fix | Delete
}
[693] Fix | Delete
[694] Fix | Delete
$output = <<<JS
[695] Fix | Delete
( function( domain, translations ) {
[696] Fix | Delete
var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;
[697] Fix | Delete
localeData[""].domain = domain;
[698] Fix | Delete
wp.i18n.setLocaleData( localeData, domain );
[699] Fix | Delete
} )( "{$domain}", {$json_translations} );
[700] Fix | Delete
JS;
[701] Fix | Delete
[702] Fix | Delete
if ( $display ) {
[703] Fix | Delete
wp_print_inline_script_tag( $output, array( 'id' => "{$handle}-js-translations" ) );
[704] Fix | Delete
}
[705] Fix | Delete
[706] Fix | Delete
return $output;
[707] Fix | Delete
}
[708] Fix | Delete
[709] Fix | Delete
/**
[710] Fix | Delete
* Determines script dependencies.
[711] Fix | Delete
*
[712] Fix | Delete
* @since 2.1.0
[713] Fix | Delete
*
[714] Fix | Delete
* @see WP_Dependencies::all_deps()
[715] Fix | Delete
*
[716] Fix | Delete
* @param string|string[] $handles Item handle (string) or item handles (array of strings).
[717] Fix | Delete
* @param bool $recursion Optional. Internal flag that function is calling itself.
[718] Fix | Delete
* Default false.
[719] Fix | Delete
* @param int|false $group Optional. Group level: level (int), no groups (false).
[720] Fix | Delete
* Default false.
[721] Fix | Delete
* @return bool True on success, false on failure.
[722] Fix | Delete
*/
[723] Fix | Delete
public function all_deps( $handles, $recursion = false, $group = false ) {
[724] Fix | Delete
$r = parent::all_deps( $handles, $recursion, $group );
[725] Fix | Delete
if ( ! $recursion ) {
[726] Fix | Delete
/**
[727] Fix | Delete
* Filters the list of script dependencies left to print.
[728] Fix | Delete
*
[729] Fix | Delete
* @since 2.3.0
[730] Fix | Delete
*
[731] Fix | Delete
* @param string[] $to_do An array of script dependency handles.
[732] Fix | Delete
*/
[733] Fix | Delete
$this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
[734] Fix | Delete
}
[735] Fix | Delete
return $r;
[736] Fix | Delete
}
[737] Fix | Delete
[738] Fix | Delete
/**
[739] Fix | Delete
* Processes items and dependencies for the head group.
[740] Fix | Delete
*
[741] Fix | Delete
* @since 2.8.0
[742] Fix | Delete
*
[743] Fix | Delete
* @see WP_Dependencies::do_items()
[744] Fix | Delete
*
[745] Fix | Delete
* @return string[] Handles of items that have been processed.
[746] Fix | Delete
*/
[747] Fix | Delete
public function do_head_items() {
[748] Fix | Delete
$this->do_items( false, 0 );
[749] Fix | Delete
return $this->done;
[750] Fix | Delete
}
[751] Fix | Delete
[752] Fix | Delete
/**
[753] Fix | Delete
* Processes items and dependencies for the footer group.
[754] Fix | Delete
*
[755] Fix | Delete
* @since 2.8.0
[756] Fix | Delete
*
[757] Fix | Delete
* @see WP_Dependencies::do_items()
[758] Fix | Delete
*
[759] Fix | Delete
* @return string[] Handles of items that have been processed.
[760] Fix | Delete
*/
[761] Fix | Delete
public function do_footer_items() {
[762] Fix | Delete
$this->do_items( false, 1 );
[763] Fix | Delete
return $this->done;
[764] Fix | Delete
}
[765] Fix | Delete
[766] Fix | Delete
/**
[767] Fix | Delete
* Whether a handle's source is in a default directory.
[768] Fix | Delete
*
[769] Fix | Delete
* @since 2.8.0
[770] Fix | Delete
*
[771] Fix | Delete
* @param string $src The source of the enqueued script.
[772] Fix | Delete
* @return bool True if found, false if not.
[773] Fix | Delete
*/
[774] Fix | Delete
public function in_default_dir( $src ) {
[775] Fix | Delete
if ( ! $this->default_dirs ) {
[776] Fix | Delete
return true;
[777] Fix | Delete
}
[778] Fix | Delete
[779] Fix | Delete
if ( str_starts_with( $src, '/' . WPINC . '/js/l10n' ) ) {
[780] Fix | Delete
return false;
[781] Fix | Delete
}
[782] Fix | Delete
[783] Fix | Delete
foreach ( (array) $this->default_dirs as $test ) {
[784] Fix | Delete
if ( str_starts_with( $src, $test ) ) {
[785] Fix | Delete
return true;
[786] Fix | Delete
}
[787] Fix | Delete
}
[788] Fix | Delete
return false;
[789] Fix | Delete
}
[790] Fix | Delete
[791] Fix | Delete
/**
[792] Fix | Delete
* This overrides the add_data method from WP_Dependencies, to support normalizing of $args.
[793] Fix | Delete
*
[794] Fix | Delete
* @since 6.3.0
[795] Fix | Delete
*
[796] Fix | Delete
* @param string $handle Name of the item. Should be unique.
[797] Fix | Delete
* @param string $key The data key.
[798] Fix | Delete
* @param mixed $value The data value.
[799] Fix | Delete
* @return bool True on success, false on failure.
[800] Fix | Delete
*/
[801] Fix | Delete
public function add_data( $handle, $key, $value ) {
[802] Fix | Delete
if ( ! isset( $this->registered[ $handle ] ) ) {
[803] Fix | Delete
return false;
[804] Fix | Delete
}
[805] Fix | Delete
[806] Fix | Delete
if ( 'strategy' === $key ) {
[807] Fix | Delete
if ( ! empty( $value ) && ! $this->is_delayed_strategy( $value ) ) {
[808] Fix | Delete
_doing_it_wrong(
[809] Fix | Delete
__METHOD__,
[810] Fix | Delete
sprintf(
[811] Fix | Delete
/* translators: 1: $strategy, 2: $handle */
[812] Fix | Delete
__( 'Invalid strategy `%1$s` defined for `%2$s` during script registration.' ),
[813] Fix | Delete
$value,
[814] Fix | Delete
$handle
[815] Fix | Delete
),
[816] Fix | Delete
'6.3.0'
[817] Fix | Delete
);
[818] Fix | Delete
return false;
[819] Fix | Delete
} elseif ( ! $this->registered[ $handle ]->src && $this->is_delayed_strategy( $value ) ) {
[820] Fix | Delete
_doing_it_wrong(
[821] Fix | Delete
__METHOD__,
[822] Fix | Delete
sprintf(
[823] Fix | Delete
/* translators: 1: $strategy, 2: $handle */
[824] Fix | Delete
__( 'Cannot supply a strategy `%1$s` for script `%2$s` because it is an alias (it lacks a `src` value).' ),
[825] Fix | Delete
$value,
[826] Fix | Delete
$handle
[827] Fix | Delete
),
[828] Fix | Delete
'6.3.0'
[829] Fix | Delete
);
[830] Fix | Delete
return false;
[831] Fix | Delete
}
[832] Fix | Delete
}
[833] Fix | Delete
return parent::add_data( $handle, $key, $value );
[834] Fix | Delete
}
[835] Fix | Delete
[836] Fix | Delete
/**
[837] Fix | Delete
* Gets all dependents of a script.
[838] Fix | Delete
*
[839] Fix | Delete
* @since 6.3.0
[840] Fix | Delete
*
[841] Fix | Delete
* @param string $handle The script handle.
[842] Fix | Delete
* @return string[] Script handles.
[843] Fix | Delete
*/
[844] Fix | Delete
private function get_dependents( $handle ) {
[845] Fix | Delete
// Check if dependents map for the handle in question is present. If so, use it.
[846] Fix | Delete
if ( isset( $this->dependents_map[ $handle ] ) ) {
[847] Fix | Delete
return $this->dependents_map[ $handle ];
[848] Fix | Delete
}
[849] Fix | Delete
[850] Fix | Delete
$dependents = array();
[851] Fix | Delete
[852] Fix | Delete
// Iterate over all registered scripts, finding dependents of the script passed to this method.
[853] Fix | Delete
foreach ( $this->registered as $registered_handle => $args ) {
[854] Fix | Delete
if ( in_array( $handle, $args->deps, true ) ) {
[855] Fix | Delete
$dependents[] = $registered_handle;
[856] Fix | Delete
}
[857] Fix | Delete
}
[858] Fix | Delete
[859] Fix | Delete
// Add the handles dependents to the map to ease future lookups.
[860] Fix | Delete
$this->dependents_map[ $handle ] = $dependents;
[861] Fix | Delete
[862] Fix | Delete
return $dependents;
[863] Fix | Delete
}
[864] Fix | Delete
[865] Fix | Delete
/**
[866] Fix | Delete
* Checks if the strategy passed is a valid delayed (non-blocking) strategy.
[867] Fix | Delete
*
[868] Fix | Delete
* @since 6.3.0
[869] Fix | Delete
*
[870] Fix | Delete
* @param string $strategy The strategy to check.
[871] Fix | Delete
* @return bool True if $strategy is one of the delayed strategies, otherwise false.
[872] Fix | Delete
*/
[873] Fix | Delete
private function is_delayed_strategy( $strategy ) {
[874] Fix | Delete
return in_array(
[875] Fix | Delete
$strategy,
[876] Fix | Delete
$this->delayed_strategies,
[877] Fix | Delete
true
[878] Fix | Delete
);
[879] Fix | Delete
}
[880] Fix | Delete
[881] Fix | Delete
/**
[882] Fix | Delete
* Gets the best eligible loading strategy for a script.
[883] Fix | Delete
*
[884] Fix | Delete
* @since 6.3.0
[885] Fix | Delete
*
[886] Fix | Delete
* @param string $handle The script handle.
[887] Fix | Delete
* @return string The best eligible loading strategy.
[888] Fix | Delete
*/
[889] Fix | Delete
private function get_eligible_loading_strategy( $handle ) {
[890] Fix | Delete
$intended = (string) $this->get_data( $handle, 'strategy' );
[891] Fix | Delete
[892] Fix | Delete
// Bail early if there is no intended strategy.
[893] Fix | Delete
if ( ! $intended ) {
[894] Fix | Delete
return '';
[895] Fix | Delete
}
[896] Fix | Delete
[897] Fix | Delete
/*
[898] Fix | Delete
* If the intended strategy is 'defer', limit the initial list of eligible
[899] Fix | Delete
* strategies, since 'async' can fallback to 'defer', but not vice-versa.
[900] Fix | Delete
*/
[901] Fix | Delete
$initial = ( 'defer' === $intended ) ? array( 'defer' ) : null;
[902] Fix | Delete
[903] Fix | Delete
$eligible = $this->filter_eligible_strategies( $handle, $initial );
[904] Fix | Delete
[905] Fix | Delete
// Return early once we know the eligible strategy is blocking.
[906] Fix | Delete
if ( empty( $eligible ) ) {
[907] Fix | Delete
return '';
[908] Fix | Delete
}
[909] Fix | Delete
[910] Fix | Delete
return in_array( 'async', $eligible, true ) ? 'async' : 'defer';
[911] Fix | Delete
}
[912] Fix | Delete
[913] Fix | Delete
/**
[914] Fix | Delete
* Filter the list of eligible loading strategies for a script.
[915] Fix | Delete
*
[916] Fix | Delete
* @since 6.3.0
[917] Fix | Delete
*
[918] Fix | Delete
* @param string $handle The script handle.
[919] Fix | Delete
* @param string[]|null $eligible Optional. The list of strategies to filter. Default null.
[920] Fix | Delete
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
[921] Fix | Delete
* @return string[] A list of eligible loading strategies that could be used.
[922] Fix | Delete
*/
[923] Fix | Delete
private function filter_eligible_strategies( $handle, $eligible = null, $checked = array() ) {
[924] Fix | Delete
// If no strategies are being passed, all strategies are eligible.
[925] Fix | Delete
if ( null === $eligible ) {
[926] Fix | Delete
$eligible = $this->delayed_strategies;
[927] Fix | Delete
}
[928] Fix | Delete
[929] Fix | Delete
// If this handle was already checked, return early.
[930] Fix | Delete
if ( isset( $checked[ $handle ] ) ) {
[931] Fix | Delete
return $eligible;
[932] Fix | Delete
}
[933] Fix | Delete
[934] Fix | Delete
// Mark this handle as checked.
[935] Fix | Delete
$checked[ $handle ] = true;
[936] Fix | Delete
[937] Fix | Delete
// If this handle isn't registered, don't filter anything and return.
[938] Fix | Delete
if ( ! isset( $this->registered[ $handle ] ) ) {
[939] Fix | Delete
return $eligible;
[940] Fix | Delete
}
[941] Fix | Delete
[942] Fix | Delete
// If the handle is not enqueued, don't filter anything and return.
[943] Fix | Delete
if ( ! $this->query( $handle, 'enqueued' ) ) {
[944] Fix | Delete
return $eligible;
[945] Fix | Delete
}
[946] Fix | Delete
[947] Fix | Delete
$is_alias = (bool) ! $this->registered[ $handle ]->src;
[948] Fix | Delete
$intended_strategy = $this->get_data( $handle, 'strategy' );
[949] Fix | Delete
[950] Fix | Delete
// For non-alias handles, an empty intended strategy filters all strategies.
[951] Fix | Delete
if ( ! $is_alias && empty( $intended_strategy ) ) {
[952] Fix | Delete
return array();
[953] Fix | Delete
}
[954] Fix | Delete
[955] Fix | Delete
// Handles with inline scripts attached in the 'after' position cannot be delayed.
[956] Fix | Delete
if ( $this->has_inline_script( $handle, 'after' ) ) {
[957] Fix | Delete
return array();
[958] Fix | Delete
}
[959] Fix | Delete
[960] Fix | Delete
// If the intended strategy is 'defer', filter out 'async'.
[961] Fix | Delete
if ( 'defer' === $intended_strategy ) {
[962] Fix | Delete
$eligible = array( 'defer' );
[963] Fix | Delete
}
[964] Fix | Delete
[965] Fix | Delete
$dependents = $this->get_dependents( $handle );
[966] Fix | Delete
[967] Fix | Delete
// Recursively filter eligible strategies for dependents.
[968] Fix | Delete
foreach ( $dependents as $dependent ) {
[969] Fix | Delete
// Bail early once we know the eligible strategy is blocking.
[970] Fix | Delete
if ( empty( $eligible ) ) {
[971] Fix | Delete
return array();
[972] Fix | Delete
}
[973] Fix | Delete
[974] Fix | Delete
$eligible = $this->filter_eligible_strategies( $dependent, $eligible, $checked );
[975] Fix | Delete
}
[976] Fix | Delete
[977] Fix | Delete
return $eligible;
[978] Fix | Delete
}
[979] Fix | Delete
[980] Fix | Delete
/**
[981] Fix | Delete
* Gets data for inline scripts registered for a specific handle.
[982] Fix | Delete
*
[983] Fix | Delete
* @since 6.3.0
[984] Fix | Delete
*
[985] Fix | Delete
* @param string $handle Name of the script to get data for. Must be lowercase.
[986] Fix | Delete
* @param string $position The position of the inline script.
[987] Fix | Delete
* @return bool Whether the handle has an inline script (either before or after).
[988] Fix | Delete
*/
[989] Fix | Delete
private function has_inline_script( $handle, $position = null ) {
[990] Fix | Delete
if ( $position && in_array( $position, array( 'before', 'after' ), true ) ) {
[991] Fix | Delete
return (bool) $this->get_data( $handle, $position );
[992] Fix | Delete
}
[993] Fix | Delete
[994] Fix | Delete
return (bool) ( $this->get_data( $handle, 'before' ) || $this->get_data( $handle, 'after' ) );
[995] Fix | Delete
}
[996] Fix | Delete
[997] Fix | Delete
/**
[998] Fix | Delete
* Resets class properties.
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function