Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
* @since 4.7.0
[4500] Fix | Delete
*
[4501] Fix | Delete
* @param array|string $list List of slugs.
[4502] Fix | Delete
* @return string[] Sanitized array of slugs.
[4503] Fix | Delete
*/
[4504] Fix | Delete
function wp_parse_slug_list( $list ) {
[4505] Fix | Delete
$list = wp_parse_list( $list );
[4506] Fix | Delete
[4507] Fix | Delete
return array_unique( array_map( 'sanitize_title', $list ) );
[4508] Fix | Delete
}
[4509] Fix | Delete
[4510] Fix | Delete
/**
[4511] Fix | Delete
* Extract a slice of an array, given a list of keys.
[4512] Fix | Delete
*
[4513] Fix | Delete
* @since 3.1.0
[4514] Fix | Delete
*
[4515] Fix | Delete
* @param array $array The original array.
[4516] Fix | Delete
* @param array $keys The list of keys.
[4517] Fix | Delete
* @return array The array slice.
[4518] Fix | Delete
*/
[4519] Fix | Delete
function wp_array_slice_assoc( $array, $keys ) {
[4520] Fix | Delete
$slice = array();
[4521] Fix | Delete
[4522] Fix | Delete
foreach ( $keys as $key ) {
[4523] Fix | Delete
if ( isset( $array[ $key ] ) ) {
[4524] Fix | Delete
$slice[ $key ] = $array[ $key ];
[4525] Fix | Delete
}
[4526] Fix | Delete
}
[4527] Fix | Delete
[4528] Fix | Delete
return $slice;
[4529] Fix | Delete
}
[4530] Fix | Delete
[4531] Fix | Delete
/**
[4532] Fix | Delete
* Accesses an array in depth based on a path of keys.
[4533] Fix | Delete
*
[4534] Fix | Delete
* It is the PHP equivalent of JavaScript's `lodash.get()` and mirroring it may help other components
[4535] Fix | Delete
* retain some symmetry between client and server implementations.
[4536] Fix | Delete
*
[4537] Fix | Delete
* Example usage:
[4538] Fix | Delete
*
[4539] Fix | Delete
* $array = array(
[4540] Fix | Delete
* 'a' => array(
[4541] Fix | Delete
* 'b' => array(
[4542] Fix | Delete
* 'c' => 1,
[4543] Fix | Delete
* ),
[4544] Fix | Delete
* ),
[4545] Fix | Delete
* );
[4546] Fix | Delete
* _wp_array_get( $array, array( 'a', 'b', 'c' );
[4547] Fix | Delete
*
[4548] Fix | Delete
* @internal
[4549] Fix | Delete
*
[4550] Fix | Delete
* @since 5.6.0
[4551] Fix | Delete
* @access private
[4552] Fix | Delete
*
[4553] Fix | Delete
* @param array $array An array from which we want to retrieve some information.
[4554] Fix | Delete
* @param array $path An array of keys describing the path with which to retrieve information.
[4555] Fix | Delete
* @param mixed $default The return value if the path does not exist within the array,
[4556] Fix | Delete
* or if `$array` or `$path` are not arrays.
[4557] Fix | Delete
* @return mixed The value from the path specified.
[4558] Fix | Delete
*/
[4559] Fix | Delete
function _wp_array_get( $array, $path, $default = null ) {
[4560] Fix | Delete
// Confirm $path is valid.
[4561] Fix | Delete
if ( ! is_array( $path ) || 0 === count( $path ) ) {
[4562] Fix | Delete
return $default;
[4563] Fix | Delete
}
[4564] Fix | Delete
[4565] Fix | Delete
foreach ( $path as $path_element ) {
[4566] Fix | Delete
if (
[4567] Fix | Delete
! is_array( $array ) ||
[4568] Fix | Delete
( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) ||
[4569] Fix | Delete
! array_key_exists( $path_element, $array )
[4570] Fix | Delete
) {
[4571] Fix | Delete
return $default;
[4572] Fix | Delete
}
[4573] Fix | Delete
$array = $array[ $path_element ];
[4574] Fix | Delete
}
[4575] Fix | Delete
[4576] Fix | Delete
return $array;
[4577] Fix | Delete
}
[4578] Fix | Delete
[4579] Fix | Delete
/**
[4580] Fix | Delete
* Determines if the variable is a numeric-indexed array.
[4581] Fix | Delete
*
[4582] Fix | Delete
* @since 4.4.0
[4583] Fix | Delete
*
[4584] Fix | Delete
* @param mixed $data Variable to check.
[4585] Fix | Delete
* @return bool Whether the variable is a list.
[4586] Fix | Delete
*/
[4587] Fix | Delete
function wp_is_numeric_array( $data ) {
[4588] Fix | Delete
if ( ! is_array( $data ) ) {
[4589] Fix | Delete
return false;
[4590] Fix | Delete
}
[4591] Fix | Delete
[4592] Fix | Delete
$keys = array_keys( $data );
[4593] Fix | Delete
$string_keys = array_filter( $keys, 'is_string' );
[4594] Fix | Delete
[4595] Fix | Delete
return count( $string_keys ) === 0;
[4596] Fix | Delete
}
[4597] Fix | Delete
[4598] Fix | Delete
/**
[4599] Fix | Delete
* Filters a list of objects, based on a set of key => value arguments.
[4600] Fix | Delete
*
[4601] Fix | Delete
* @since 3.0.0
[4602] Fix | Delete
* @since 4.7.0 Uses `WP_List_Util` class.
[4603] Fix | Delete
*
[4604] Fix | Delete
* @param array $list An array of objects to filter
[4605] Fix | Delete
* @param array $args Optional. An array of key => value arguments to match
[4606] Fix | Delete
* against each object. Default empty array.
[4607] Fix | Delete
* @param string $operator Optional. The logical operation to perform. 'or' means
[4608] Fix | Delete
* only one element from the array needs to match; 'and'
[4609] Fix | Delete
* means all elements must match; 'not' means no elements may
[4610] Fix | Delete
* match. Default 'and'.
[4611] Fix | Delete
* @param bool|string $field A field from the object to place instead of the entire object.
[4612] Fix | Delete
* Default false.
[4613] Fix | Delete
* @return array A list of objects or object fields.
[4614] Fix | Delete
*/
[4615] Fix | Delete
function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
[4616] Fix | Delete
if ( ! is_array( $list ) ) {
[4617] Fix | Delete
return array();
[4618] Fix | Delete
}
[4619] Fix | Delete
[4620] Fix | Delete
$util = new WP_List_Util( $list );
[4621] Fix | Delete
[4622] Fix | Delete
$util->filter( $args, $operator );
[4623] Fix | Delete
[4624] Fix | Delete
if ( $field ) {
[4625] Fix | Delete
$util->pluck( $field );
[4626] Fix | Delete
}
[4627] Fix | Delete
[4628] Fix | Delete
return $util->get_output();
[4629] Fix | Delete
}
[4630] Fix | Delete
[4631] Fix | Delete
/**
[4632] Fix | Delete
* Filters a list of objects, based on a set of key => value arguments.
[4633] Fix | Delete
*
[4634] Fix | Delete
* @since 3.1.0
[4635] Fix | Delete
* @since 4.7.0 Uses `WP_List_Util` class.
[4636] Fix | Delete
*
[4637] Fix | Delete
* @param array $list An array of objects to filter.
[4638] Fix | Delete
* @param array $args Optional. An array of key => value arguments to match
[4639] Fix | Delete
* against each object. Default empty array.
[4640] Fix | Delete
* @param string $operator Optional. The logical operation to perform. 'AND' means
[4641] Fix | Delete
* all elements from the array must match. 'OR' means only
[4642] Fix | Delete
* one element needs to match. 'NOT' means no elements may
[4643] Fix | Delete
* match. Default 'AND'.
[4644] Fix | Delete
* @return array Array of found values.
[4645] Fix | Delete
*/
[4646] Fix | Delete
function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
[4647] Fix | Delete
if ( ! is_array( $list ) ) {
[4648] Fix | Delete
return array();
[4649] Fix | Delete
}
[4650] Fix | Delete
[4651] Fix | Delete
$util = new WP_List_Util( $list );
[4652] Fix | Delete
return $util->filter( $args, $operator );
[4653] Fix | Delete
}
[4654] Fix | Delete
[4655] Fix | Delete
/**
[4656] Fix | Delete
* Pluck a certain field out of each object in a list.
[4657] Fix | Delete
*
[4658] Fix | Delete
* This has the same functionality and prototype of
[4659] Fix | Delete
* array_column() (PHP 5.5) but also supports objects.
[4660] Fix | Delete
*
[4661] Fix | Delete
* @since 3.1.0
[4662] Fix | Delete
* @since 4.0.0 $index_key parameter added.
[4663] Fix | Delete
* @since 4.7.0 Uses `WP_List_Util` class.
[4664] Fix | Delete
*
[4665] Fix | Delete
* @param array $list List of objects or arrays
[4666] Fix | Delete
* @param int|string $field Field from the object to place instead of the entire object
[4667] Fix | Delete
* @param int|string $index_key Optional. Field from the object to use as keys for the new array.
[4668] Fix | Delete
* Default null.
[4669] Fix | Delete
* @return array Array of found values. If `$index_key` is set, an array of found values with keys
[4670] Fix | Delete
* corresponding to `$index_key`. If `$index_key` is null, array keys from the original
[4671] Fix | Delete
* `$list` will be preserved in the results.
[4672] Fix | Delete
*/
[4673] Fix | Delete
function wp_list_pluck( $list, $field, $index_key = null ) {
[4674] Fix | Delete
$util = new WP_List_Util( $list );
[4675] Fix | Delete
return $util->pluck( $field, $index_key );
[4676] Fix | Delete
}
[4677] Fix | Delete
[4678] Fix | Delete
/**
[4679] Fix | Delete
* Sorts a list of objects, based on one or more orderby arguments.
[4680] Fix | Delete
*
[4681] Fix | Delete
* @since 4.7.0
[4682] Fix | Delete
*
[4683] Fix | Delete
* @param array $list An array of objects to sort.
[4684] Fix | Delete
* @param string|array $orderby Optional. Either the field name to order by or an array
[4685] Fix | Delete
* of multiple orderby fields as $orderby => $order.
[4686] Fix | Delete
* @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby
[4687] Fix | Delete
* is a string.
[4688] Fix | Delete
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
[4689] Fix | Delete
* @return array The sorted array.
[4690] Fix | Delete
*/
[4691] Fix | Delete
function wp_list_sort( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
[4692] Fix | Delete
if ( ! is_array( $list ) ) {
[4693] Fix | Delete
return array();
[4694] Fix | Delete
}
[4695] Fix | Delete
[4696] Fix | Delete
$util = new WP_List_Util( $list );
[4697] Fix | Delete
return $util->sort( $orderby, $order, $preserve_keys );
[4698] Fix | Delete
}
[4699] Fix | Delete
[4700] Fix | Delete
/**
[4701] Fix | Delete
* Determines if Widgets library should be loaded.
[4702] Fix | Delete
*
[4703] Fix | Delete
* Checks to make sure that the widgets library hasn't already been loaded.
[4704] Fix | Delete
* If it hasn't, then it will load the widgets library and run an action hook.
[4705] Fix | Delete
*
[4706] Fix | Delete
* @since 2.2.0
[4707] Fix | Delete
*/
[4708] Fix | Delete
function wp_maybe_load_widgets() {
[4709] Fix | Delete
/**
[4710] Fix | Delete
* Filters whether to load the Widgets library.
[4711] Fix | Delete
*
[4712] Fix | Delete
* Returning a falsey value from the filter will effectively short-circuit
[4713] Fix | Delete
* the Widgets library from loading.
[4714] Fix | Delete
*
[4715] Fix | Delete
* @since 2.8.0
[4716] Fix | Delete
*
[4717] Fix | Delete
* @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
[4718] Fix | Delete
* Default true.
[4719] Fix | Delete
*/
[4720] Fix | Delete
if ( ! apply_filters( 'load_default_widgets', true ) ) {
[4721] Fix | Delete
return;
[4722] Fix | Delete
}
[4723] Fix | Delete
[4724] Fix | Delete
require_once ABSPATH . WPINC . '/default-widgets.php';
[4725] Fix | Delete
[4726] Fix | Delete
add_action( '_admin_menu', 'wp_widgets_add_menu' );
[4727] Fix | Delete
}
[4728] Fix | Delete
[4729] Fix | Delete
/**
[4730] Fix | Delete
* Append the Widgets menu to the themes main menu.
[4731] Fix | Delete
*
[4732] Fix | Delete
* @since 2.2.0
[4733] Fix | Delete
*
[4734] Fix | Delete
* @global array $submenu
[4735] Fix | Delete
*/
[4736] Fix | Delete
function wp_widgets_add_menu() {
[4737] Fix | Delete
global $submenu;
[4738] Fix | Delete
[4739] Fix | Delete
if ( ! current_theme_supports( 'widgets' ) ) {
[4740] Fix | Delete
return;
[4741] Fix | Delete
}
[4742] Fix | Delete
[4743] Fix | Delete
$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
[4744] Fix | Delete
ksort( $submenu['themes.php'], SORT_NUMERIC );
[4745] Fix | Delete
}
[4746] Fix | Delete
[4747] Fix | Delete
/**
[4748] Fix | Delete
* Flush all output buffers for PHP 5.2.
[4749] Fix | Delete
*
[4750] Fix | Delete
* Make sure all output buffers are flushed before our singletons are destroyed.
[4751] Fix | Delete
*
[4752] Fix | Delete
* @since 2.2.0
[4753] Fix | Delete
*/
[4754] Fix | Delete
function wp_ob_end_flush_all() {
[4755] Fix | Delete
$levels = ob_get_level();
[4756] Fix | Delete
for ( $i = 0; $i < $levels; $i++ ) {
[4757] Fix | Delete
ob_end_flush();
[4758] Fix | Delete
}
[4759] Fix | Delete
}
[4760] Fix | Delete
[4761] Fix | Delete
/**
[4762] Fix | Delete
* Load custom DB error or display WordPress DB error.
[4763] Fix | Delete
*
[4764] Fix | Delete
* If a file exists in the wp-content directory named db-error.php, then it will
[4765] Fix | Delete
* be loaded instead of displaying the WordPress DB error. If it is not found,
[4766] Fix | Delete
* then the WordPress DB error will be displayed instead.
[4767] Fix | Delete
*
[4768] Fix | Delete
* The WordPress DB error sets the HTTP status header to 500 to try to prevent
[4769] Fix | Delete
* search engines from caching the message. Custom DB messages should do the
[4770] Fix | Delete
* same.
[4771] Fix | Delete
*
[4772] Fix | Delete
* This function was backported to WordPress 2.3.2, but originally was added
[4773] Fix | Delete
* in WordPress 2.5.0.
[4774] Fix | Delete
*
[4775] Fix | Delete
* @since 2.3.2
[4776] Fix | Delete
*
[4777] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[4778] Fix | Delete
*/
[4779] Fix | Delete
function dead_db() {
[4780] Fix | Delete
global $wpdb;
[4781] Fix | Delete
[4782] Fix | Delete
wp_load_translations_early();
[4783] Fix | Delete
[4784] Fix | Delete
// Load custom DB error template, if present.
[4785] Fix | Delete
if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
[4786] Fix | Delete
require_once WP_CONTENT_DIR . '/db-error.php';
[4787] Fix | Delete
die();
[4788] Fix | Delete
}
[4789] Fix | Delete
[4790] Fix | Delete
// If installing or in the admin, provide the verbose message.
[4791] Fix | Delete
if ( wp_installing() || defined( 'WP_ADMIN' ) ) {
[4792] Fix | Delete
wp_die( $wpdb->error );
[4793] Fix | Delete
}
[4794] Fix | Delete
[4795] Fix | Delete
// Otherwise, be terse.
[4796] Fix | Delete
wp_die( '<h1>' . __( 'Error establishing a database connection' ) . '</h1>', __( 'Database Error' ) );
[4797] Fix | Delete
}
[4798] Fix | Delete
[4799] Fix | Delete
/**
[4800] Fix | Delete
* Convert a value to non-negative integer.
[4801] Fix | Delete
*
[4802] Fix | Delete
* @since 2.5.0
[4803] Fix | Delete
*
[4804] Fix | Delete
* @param mixed $maybeint Data you wish to have converted to a non-negative integer.
[4805] Fix | Delete
* @return int A non-negative integer.
[4806] Fix | Delete
*/
[4807] Fix | Delete
function absint( $maybeint ) {
[4808] Fix | Delete
return abs( (int) $maybeint );
[4809] Fix | Delete
}
[4810] Fix | Delete
[4811] Fix | Delete
/**
[4812] Fix | Delete
* Mark a function as deprecated and inform when it has been used.
[4813] Fix | Delete
*
[4814] Fix | Delete
* There is a {@see 'hook deprecated_function_run'} that will be called that can be used
[4815] Fix | Delete
* to get the backtrace up to what file and function called the deprecated
[4816] Fix | Delete
* function.
[4817] Fix | Delete
*
[4818] Fix | Delete
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
[4819] Fix | Delete
*
[4820] Fix | Delete
* This function is to be used in every function that is deprecated.
[4821] Fix | Delete
*
[4822] Fix | Delete
* @since 2.5.0
[4823] Fix | Delete
* @since 5.4.0 This function is no longer marked as "private".
[4824] Fix | Delete
* @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
[4825] Fix | Delete
*
[4826] Fix | Delete
* @param string $function The function that was called.
[4827] Fix | Delete
* @param string $version The version of WordPress that deprecated the function.
[4828] Fix | Delete
* @param string $replacement Optional. The function that should have been called. Default empty.
[4829] Fix | Delete
*/
[4830] Fix | Delete
function _deprecated_function( $function, $version, $replacement = '' ) {
[4831] Fix | Delete
[4832] Fix | Delete
/**
[4833] Fix | Delete
* Fires when a deprecated function is called.
[4834] Fix | Delete
*
[4835] Fix | Delete
* @since 2.5.0
[4836] Fix | Delete
*
[4837] Fix | Delete
* @param string $function The function that was called.
[4838] Fix | Delete
* @param string $replacement The function that should have been called.
[4839] Fix | Delete
* @param string $version The version of WordPress that deprecated the function.
[4840] Fix | Delete
*/
[4841] Fix | Delete
do_action( 'deprecated_function_run', $function, $replacement, $version );
[4842] Fix | Delete
[4843] Fix | Delete
/**
[4844] Fix | Delete
* Filters whether to trigger an error for deprecated functions.
[4845] Fix | Delete
*
[4846] Fix | Delete
* @since 2.5.0
[4847] Fix | Delete
*
[4848] Fix | Delete
* @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
[4849] Fix | Delete
*/
[4850] Fix | Delete
if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
[4851] Fix | Delete
if ( function_exists( '__' ) ) {
[4852] Fix | Delete
if ( $replacement ) {
[4853] Fix | Delete
trigger_error(
[4854] Fix | Delete
sprintf(
[4855] Fix | Delete
/* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
[4856] Fix | Delete
__( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
[4857] Fix | Delete
$function,
[4858] Fix | Delete
$version,
[4859] Fix | Delete
$replacement
[4860] Fix | Delete
),
[4861] Fix | Delete
E_USER_DEPRECATED
[4862] Fix | Delete
);
[4863] Fix | Delete
} else {
[4864] Fix | Delete
trigger_error(
[4865] Fix | Delete
sprintf(
[4866] Fix | Delete
/* translators: 1: PHP function name, 2: Version number. */
[4867] Fix | Delete
__( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
[4868] Fix | Delete
$function,
[4869] Fix | Delete
$version
[4870] Fix | Delete
),
[4871] Fix | Delete
E_USER_DEPRECATED
[4872] Fix | Delete
);
[4873] Fix | Delete
}
[4874] Fix | Delete
} else {
[4875] Fix | Delete
if ( $replacement ) {
[4876] Fix | Delete
trigger_error(
[4877] Fix | Delete
sprintf(
[4878] Fix | Delete
'%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
[4879] Fix | Delete
$function,
[4880] Fix | Delete
$version,
[4881] Fix | Delete
$replacement
[4882] Fix | Delete
),
[4883] Fix | Delete
E_USER_DEPRECATED
[4884] Fix | Delete
);
[4885] Fix | Delete
} else {
[4886] Fix | Delete
trigger_error(
[4887] Fix | Delete
sprintf(
[4888] Fix | Delete
'%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
[4889] Fix | Delete
$function,
[4890] Fix | Delete
$version
[4891] Fix | Delete
),
[4892] Fix | Delete
E_USER_DEPRECATED
[4893] Fix | Delete
);
[4894] Fix | Delete
}
[4895] Fix | Delete
}
[4896] Fix | Delete
}
[4897] Fix | Delete
}
[4898] Fix | Delete
[4899] Fix | Delete
/**
[4900] Fix | Delete
* Marks a constructor as deprecated and informs when it has been used.
[4901] Fix | Delete
*
[4902] Fix | Delete
* Similar to _deprecated_function(), but with different strings. Used to
[4903] Fix | Delete
* remove PHP4 style constructors.
[4904] Fix | Delete
*
[4905] Fix | Delete
* The current behavior is to trigger a user error if `WP_DEBUG` is true.
[4906] Fix | Delete
*
[4907] Fix | Delete
* This function is to be used in every PHP4 style constructor method that is deprecated.
[4908] Fix | Delete
*
[4909] Fix | Delete
* @since 4.3.0
[4910] Fix | Delete
* @since 4.5.0 Added the `$parent_class` parameter.
[4911] Fix | Delete
* @since 5.4.0 This function is no longer marked as "private".
[4912] Fix | Delete
* @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
[4913] Fix | Delete
*
[4914] Fix | Delete
* @param string $class The class containing the deprecated constructor.
[4915] Fix | Delete
* @param string $version The version of WordPress that deprecated the function.
[4916] Fix | Delete
* @param string $parent_class Optional. The parent class calling the deprecated constructor.
[4917] Fix | Delete
* Default empty string.
[4918] Fix | Delete
*/
[4919] Fix | Delete
function _deprecated_constructor( $class, $version, $parent_class = '' ) {
[4920] Fix | Delete
[4921] Fix | Delete
/**
[4922] Fix | Delete
* Fires when a deprecated constructor is called.
[4923] Fix | Delete
*
[4924] Fix | Delete
* @since 4.3.0
[4925] Fix | Delete
* @since 4.5.0 Added the `$parent_class` parameter.
[4926] Fix | Delete
*
[4927] Fix | Delete
* @param string $class The class containing the deprecated constructor.
[4928] Fix | Delete
* @param string $version The version of WordPress that deprecated the function.
[4929] Fix | Delete
* @param string $parent_class The parent class calling the deprecated constructor.
[4930] Fix | Delete
*/
[4931] Fix | Delete
do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
[4932] Fix | Delete
[4933] Fix | Delete
/**
[4934] Fix | Delete
* Filters whether to trigger an error for deprecated functions.
[4935] Fix | Delete
*
[4936] Fix | Delete
* `WP_DEBUG` must be true in addition to the filter evaluating to true.
[4937] Fix | Delete
*
[4938] Fix | Delete
* @since 4.3.0
[4939] Fix | Delete
*
[4940] Fix | Delete
* @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
[4941] Fix | Delete
*/
[4942] Fix | Delete
if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
[4943] Fix | Delete
if ( function_exists( '__' ) ) {
[4944] Fix | Delete
if ( $parent_class ) {
[4945] Fix | Delete
trigger_error(
[4946] Fix | Delete
sprintf(
[4947] Fix | Delete
/* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
[4948] Fix | Delete
__( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
[4949] Fix | Delete
$class,
[4950] Fix | Delete
$parent_class,
[4951] Fix | Delete
$version,
[4952] Fix | Delete
'<code>__construct()</code>'
[4953] Fix | Delete
),
[4954] Fix | Delete
E_USER_DEPRECATED
[4955] Fix | Delete
);
[4956] Fix | Delete
} else {
[4957] Fix | Delete
trigger_error(
[4958] Fix | Delete
sprintf(
[4959] Fix | Delete
/* translators: 1: PHP class name, 2: Version number, 3: __construct() method. */
[4960] Fix | Delete
__( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
[4961] Fix | Delete
$class,
[4962] Fix | Delete
$version,
[4963] Fix | Delete
'<code>__construct()</code>'
[4964] Fix | Delete
),
[4965] Fix | Delete
E_USER_DEPRECATED
[4966] Fix | Delete
);
[4967] Fix | Delete
}
[4968] Fix | Delete
} else {
[4969] Fix | Delete
if ( $parent_class ) {
[4970] Fix | Delete
trigger_error(
[4971] Fix | Delete
sprintf(
[4972] Fix | Delete
'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
[4973] Fix | Delete
$class,
[4974] Fix | Delete
$parent_class,
[4975] Fix | Delete
$version,
[4976] Fix | Delete
'<code>__construct()</code>'
[4977] Fix | Delete
),
[4978] Fix | Delete
E_USER_DEPRECATED
[4979] Fix | Delete
);
[4980] Fix | Delete
} else {
[4981] Fix | Delete
trigger_error(
[4982] Fix | Delete
sprintf(
[4983] Fix | Delete
'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
[4984] Fix | Delete
$class,
[4985] Fix | Delete
$version,
[4986] Fix | Delete
'<code>__construct()</code>'
[4987] Fix | Delete
),
[4988] Fix | Delete
E_USER_DEPRECATED
[4989] Fix | Delete
);
[4990] Fix | Delete
}
[4991] Fix | Delete
}
[4992] Fix | Delete
}
[4993] Fix | Delete
[4994] Fix | Delete
}
[4995] Fix | Delete
[4996] Fix | Delete
/**
[4997] Fix | Delete
* Mark a file as deprecated and inform when it has been used.
[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