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: link-template.php
$user_id = $user_id ? (int) $user_id : get_current_user_id();
[4000] Fix | Delete
[4001] Fix | Delete
if ( is_user_admin() ) {
[4002] Fix | Delete
$url = user_admin_url( 'profile.php', $scheme );
[4003] Fix | Delete
} elseif ( is_network_admin() ) {
[4004] Fix | Delete
$url = network_admin_url( 'profile.php', $scheme );
[4005] Fix | Delete
} else {
[4006] Fix | Delete
$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
[4007] Fix | Delete
}
[4008] Fix | Delete
[4009] Fix | Delete
/**
[4010] Fix | Delete
* Filters the URL for a user's profile editor.
[4011] Fix | Delete
*
[4012] Fix | Delete
* @since 3.1.0
[4013] Fix | Delete
*
[4014] Fix | Delete
* @param string $url The complete URL including scheme and path.
[4015] Fix | Delete
* @param int $user_id The user ID.
[4016] Fix | Delete
* @param string $scheme Scheme to give the URL context. Accepts 'http', 'https', 'login',
[4017] Fix | Delete
* 'login_post', 'admin', 'relative' or null.
[4018] Fix | Delete
*/
[4019] Fix | Delete
return apply_filters( 'edit_profile_url', $url, $user_id, $scheme );
[4020] Fix | Delete
}
[4021] Fix | Delete
[4022] Fix | Delete
/**
[4023] Fix | Delete
* Returns the canonical URL for a post.
[4024] Fix | Delete
*
[4025] Fix | Delete
* When the post is the same as the current requested page the function will handle the
[4026] Fix | Delete
* pagination arguments too.
[4027] Fix | Delete
*
[4028] Fix | Delete
* @since 4.6.0
[4029] Fix | Delete
*
[4030] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or object. Default is global `$post`.
[4031] Fix | Delete
* @return string|false The canonical URL. False if the post does not exist
[4032] Fix | Delete
* or has not been published yet.
[4033] Fix | Delete
*/
[4034] Fix | Delete
function wp_get_canonical_url( $post = null ) {
[4035] Fix | Delete
$post = get_post( $post );
[4036] Fix | Delete
[4037] Fix | Delete
if ( ! $post ) {
[4038] Fix | Delete
return false;
[4039] Fix | Delete
}
[4040] Fix | Delete
[4041] Fix | Delete
if ( 'publish' !== $post->post_status ) {
[4042] Fix | Delete
return false;
[4043] Fix | Delete
}
[4044] Fix | Delete
[4045] Fix | Delete
$canonical_url = get_permalink( $post );
[4046] Fix | Delete
[4047] Fix | Delete
// If a canonical is being generated for the current page, make sure it has pagination if needed.
[4048] Fix | Delete
if ( get_queried_object_id() === $post->ID ) {
[4049] Fix | Delete
$page = get_query_var( 'page', 0 );
[4050] Fix | Delete
if ( $page >= 2 ) {
[4051] Fix | Delete
if ( ! get_option( 'permalink_structure' ) ) {
[4052] Fix | Delete
$canonical_url = add_query_arg( 'page', $page, $canonical_url );
[4053] Fix | Delete
} else {
[4054] Fix | Delete
$canonical_url = trailingslashit( $canonical_url ) . user_trailingslashit( $page, 'single_paged' );
[4055] Fix | Delete
}
[4056] Fix | Delete
}
[4057] Fix | Delete
[4058] Fix | Delete
$cpage = get_query_var( 'cpage', 0 );
[4059] Fix | Delete
if ( $cpage ) {
[4060] Fix | Delete
$canonical_url = get_comments_pagenum_link( $cpage );
[4061] Fix | Delete
}
[4062] Fix | Delete
}
[4063] Fix | Delete
[4064] Fix | Delete
/**
[4065] Fix | Delete
* Filters the canonical URL for a post.
[4066] Fix | Delete
*
[4067] Fix | Delete
* @since 4.6.0
[4068] Fix | Delete
*
[4069] Fix | Delete
* @param string $canonical_url The post's canonical URL.
[4070] Fix | Delete
* @param WP_Post $post Post object.
[4071] Fix | Delete
*/
[4072] Fix | Delete
return apply_filters( 'get_canonical_url', $canonical_url, $post );
[4073] Fix | Delete
}
[4074] Fix | Delete
[4075] Fix | Delete
/**
[4076] Fix | Delete
* Outputs rel=canonical for singular queries.
[4077] Fix | Delete
*
[4078] Fix | Delete
* @since 2.9.0
[4079] Fix | Delete
* @since 4.6.0 Adjusted to use `wp_get_canonical_url()`.
[4080] Fix | Delete
*/
[4081] Fix | Delete
function rel_canonical() {
[4082] Fix | Delete
if ( ! is_singular() ) {
[4083] Fix | Delete
return;
[4084] Fix | Delete
}
[4085] Fix | Delete
[4086] Fix | Delete
$id = get_queried_object_id();
[4087] Fix | Delete
[4088] Fix | Delete
if ( 0 === $id ) {
[4089] Fix | Delete
return;
[4090] Fix | Delete
}
[4091] Fix | Delete
[4092] Fix | Delete
$url = wp_get_canonical_url( $id );
[4093] Fix | Delete
[4094] Fix | Delete
if ( ! empty( $url ) ) {
[4095] Fix | Delete
echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
[4096] Fix | Delete
}
[4097] Fix | Delete
}
[4098] Fix | Delete
[4099] Fix | Delete
/**
[4100] Fix | Delete
* Returns a shortlink for a post, page, attachment, or site.
[4101] Fix | Delete
*
[4102] Fix | Delete
* This function exists to provide a shortlink tag that all themes and plugins can target.
[4103] Fix | Delete
* A plugin must hook in to provide the actual shortlinks. Default shortlink support is
[4104] Fix | Delete
* limited to providing ?p= style links for posts. Plugins can short-circuit this function
[4105] Fix | Delete
* via the {@see 'pre_get_shortlink'} filter or filter the output via the {@see 'get_shortlink'}
[4106] Fix | Delete
* filter.
[4107] Fix | Delete
*
[4108] Fix | Delete
* @since 3.0.0
[4109] Fix | Delete
*
[4110] Fix | Delete
* @param int $id Optional. A post or site ID. Default is 0, which means the current post or site.
[4111] Fix | Delete
* @param string $context Optional. Whether the ID is a 'site' ID, 'post' ID, or 'media' ID. If 'post',
[4112] Fix | Delete
* the post_type of the post is consulted. If 'query', the current query is consulted
[4113] Fix | Delete
* to determine the ID and context. Default 'post'.
[4114] Fix | Delete
* @param bool $allow_slugs Optional. Whether to allow post slugs in the shortlink. It is up to the plugin how
[4115] Fix | Delete
* and whether to honor this. Default true.
[4116] Fix | Delete
* @return string A shortlink or an empty string if no shortlink exists for the requested resource or if shortlinks
[4117] Fix | Delete
* are not enabled.
[4118] Fix | Delete
*/
[4119] Fix | Delete
function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) {
[4120] Fix | Delete
/**
[4121] Fix | Delete
* Filters whether to preempt generating a shortlink for the given post.
[4122] Fix | Delete
*
[4123] Fix | Delete
* Returning a value other than false from the filter will short-circuit
[4124] Fix | Delete
* the shortlink generation process, returning that value instead.
[4125] Fix | Delete
*
[4126] Fix | Delete
* @since 3.0.0
[4127] Fix | Delete
*
[4128] Fix | Delete
* @param false|string $return Short-circuit return value. Either false or a URL string.
[4129] Fix | Delete
* @param int $id Post ID, or 0 for the current post.
[4130] Fix | Delete
* @param string $context The context for the link. One of 'post' or 'query',
[4131] Fix | Delete
* @param bool $allow_slugs Whether to allow post slugs in the shortlink.
[4132] Fix | Delete
*/
[4133] Fix | Delete
$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
[4134] Fix | Delete
[4135] Fix | Delete
if ( false !== $shortlink ) {
[4136] Fix | Delete
return $shortlink;
[4137] Fix | Delete
}
[4138] Fix | Delete
[4139] Fix | Delete
$post_id = 0;
[4140] Fix | Delete
if ( 'query' === $context && is_singular() ) {
[4141] Fix | Delete
$post_id = get_queried_object_id();
[4142] Fix | Delete
$post = get_post( $post_id );
[4143] Fix | Delete
} elseif ( 'post' === $context ) {
[4144] Fix | Delete
$post = get_post( $id );
[4145] Fix | Delete
if ( ! empty( $post->ID ) ) {
[4146] Fix | Delete
$post_id = $post->ID;
[4147] Fix | Delete
}
[4148] Fix | Delete
}
[4149] Fix | Delete
[4150] Fix | Delete
$shortlink = '';
[4151] Fix | Delete
[4152] Fix | Delete
// Return `?p=` link for all public post types.
[4153] Fix | Delete
if ( ! empty( $post_id ) ) {
[4154] Fix | Delete
$post_type = get_post_type_object( $post->post_type );
[4155] Fix | Delete
[4156] Fix | Delete
if ( 'page' === $post->post_type
[4157] Fix | Delete
&& 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID
[4158] Fix | Delete
) {
[4159] Fix | Delete
$shortlink = home_url( '/' );
[4160] Fix | Delete
} elseif ( $post_type && $post_type->public ) {
[4161] Fix | Delete
$shortlink = home_url( '?p=' . $post_id );
[4162] Fix | Delete
}
[4163] Fix | Delete
}
[4164] Fix | Delete
[4165] Fix | Delete
/**
[4166] Fix | Delete
* Filters the shortlink for a post.
[4167] Fix | Delete
*
[4168] Fix | Delete
* @since 3.0.0
[4169] Fix | Delete
*
[4170] Fix | Delete
* @param string $shortlink Shortlink URL.
[4171] Fix | Delete
* @param int $id Post ID, or 0 for the current post.
[4172] Fix | Delete
* @param string $context The context for the link. One of 'post' or 'query',
[4173] Fix | Delete
* @param bool $allow_slugs Whether to allow post slugs in the shortlink. Not used by default.
[4174] Fix | Delete
*/
[4175] Fix | Delete
return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs );
[4176] Fix | Delete
}
[4177] Fix | Delete
[4178] Fix | Delete
/**
[4179] Fix | Delete
* Injects rel=shortlink into the head if a shortlink is defined for the current page.
[4180] Fix | Delete
*
[4181] Fix | Delete
* Attached to the {@see 'wp_head'} action.
[4182] Fix | Delete
*
[4183] Fix | Delete
* @since 3.0.0
[4184] Fix | Delete
*/
[4185] Fix | Delete
function wp_shortlink_wp_head() {
[4186] Fix | Delete
$shortlink = wp_get_shortlink( 0, 'query' );
[4187] Fix | Delete
[4188] Fix | Delete
if ( empty( $shortlink ) ) {
[4189] Fix | Delete
return;
[4190] Fix | Delete
}
[4191] Fix | Delete
[4192] Fix | Delete
echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
[4193] Fix | Delete
}
[4194] Fix | Delete
[4195] Fix | Delete
/**
[4196] Fix | Delete
* Sends a Link: rel=shortlink header if a shortlink is defined for the current page.
[4197] Fix | Delete
*
[4198] Fix | Delete
* Attached to the {@see 'wp'} action.
[4199] Fix | Delete
*
[4200] Fix | Delete
* @since 3.0.0
[4201] Fix | Delete
*/
[4202] Fix | Delete
function wp_shortlink_header() {
[4203] Fix | Delete
if ( headers_sent() ) {
[4204] Fix | Delete
return;
[4205] Fix | Delete
}
[4206] Fix | Delete
[4207] Fix | Delete
$shortlink = wp_get_shortlink( 0, 'query' );
[4208] Fix | Delete
[4209] Fix | Delete
if ( empty( $shortlink ) ) {
[4210] Fix | Delete
return;
[4211] Fix | Delete
}
[4212] Fix | Delete
[4213] Fix | Delete
header( 'Link: <' . $shortlink . '>; rel=shortlink', false );
[4214] Fix | Delete
}
[4215] Fix | Delete
[4216] Fix | Delete
/**
[4217] Fix | Delete
* Displays the shortlink for a post.
[4218] Fix | Delete
*
[4219] Fix | Delete
* Must be called from inside "The Loop"
[4220] Fix | Delete
*
[4221] Fix | Delete
* Call like the_shortlink( __( 'Shortlinkage FTW' ) )
[4222] Fix | Delete
*
[4223] Fix | Delete
* @since 3.0.0
[4224] Fix | Delete
*
[4225] Fix | Delete
* @param string $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.'
[4226] Fix | Delete
* @param string $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title.
[4227] Fix | Delete
* @param string $before Optional HTML to display before the link. Default empty.
[4228] Fix | Delete
* @param string $after Optional HTML to display after the link. Default empty.
[4229] Fix | Delete
*/
[4230] Fix | Delete
function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
[4231] Fix | Delete
$post = get_post();
[4232] Fix | Delete
[4233] Fix | Delete
if ( empty( $text ) ) {
[4234] Fix | Delete
$text = __( 'This is the short link.' );
[4235] Fix | Delete
}
[4236] Fix | Delete
[4237] Fix | Delete
if ( empty( $title ) ) {
[4238] Fix | Delete
$title = the_title_attribute( array( 'echo' => false ) );
[4239] Fix | Delete
}
[4240] Fix | Delete
[4241] Fix | Delete
$shortlink = wp_get_shortlink( $post->ID );
[4242] Fix | Delete
[4243] Fix | Delete
if ( ! empty( $shortlink ) ) {
[4244] Fix | Delete
$link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
[4245] Fix | Delete
[4246] Fix | Delete
/**
[4247] Fix | Delete
* Filters the short link anchor tag for a post.
[4248] Fix | Delete
*
[4249] Fix | Delete
* @since 3.0.0
[4250] Fix | Delete
*
[4251] Fix | Delete
* @param string $link Shortlink anchor tag.
[4252] Fix | Delete
* @param string $shortlink Shortlink URL.
[4253] Fix | Delete
* @param string $text Shortlink's text.
[4254] Fix | Delete
* @param string $title Shortlink's title attribute.
[4255] Fix | Delete
*/
[4256] Fix | Delete
$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
[4257] Fix | Delete
echo $before, $link, $after;
[4258] Fix | Delete
}
[4259] Fix | Delete
}
[4260] Fix | Delete
[4261] Fix | Delete
/**
[4262] Fix | Delete
* Retrieves the avatar URL.
[4263] Fix | Delete
*
[4264] Fix | Delete
* @since 4.2.0
[4265] Fix | Delete
*
[4266] Fix | Delete
* @param mixed $id_or_email The avatar to retrieve a URL for. Accepts a user ID, Gravatar MD5 hash,
[4267] Fix | Delete
* user email, WP_User object, WP_Post object, or WP_Comment object.
[4268] Fix | Delete
* @param array $args {
[4269] Fix | Delete
* Optional. Arguments to use instead of the default arguments.
[4270] Fix | Delete
*
[4271] Fix | Delete
* @type int $size Height and width of the avatar in pixels. Default 96.
[4272] Fix | Delete
* @type string $default URL for the default image or a default type. Accepts:
[4273] Fix | Delete
* - '404' (return a 404 instead of a default image)
[4274] Fix | Delete
* - 'retro' (a 8-bit arcade-style pixelated face)
[4275] Fix | Delete
* - 'robohash' (a robot)
[4276] Fix | Delete
* - 'monsterid' (a monster)
[4277] Fix | Delete
* - 'wavatar' (a cartoon face)
[4278] Fix | Delete
* - 'identicon' (the "quilt", a geometric pattern)
[4279] Fix | Delete
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
[4280] Fix | Delete
* - 'blank' (transparent GIF)
[4281] Fix | Delete
* - 'gravatar_default' (the Gravatar logo)
[4282] Fix | Delete
* Default is the value of the 'avatar_default' option,
[4283] Fix | Delete
* with a fallback of 'mystery'.
[4284] Fix | Delete
* @type bool $force_default Whether to always show the default image, never the Gravatar.
[4285] Fix | Delete
* Default false.
[4286] Fix | Delete
* @type string $rating What rating to display avatars up to. Accepts:
[4287] Fix | Delete
* - 'G' (suitable for all audiences)
[4288] Fix | Delete
* - 'PG' (possibly offensive, usually for audiences 13 and above)
[4289] Fix | Delete
* - 'R' (intended for adult audiences above 17)
[4290] Fix | Delete
* - 'X' (even more mature than above)
[4291] Fix | Delete
* Default is the value of the 'avatar_rating' option.
[4292] Fix | Delete
* @type string $scheme URL scheme to use. See set_url_scheme() for accepted values.
[4293] Fix | Delete
* Default null.
[4294] Fix | Delete
* @type array $processed_args When the function returns, the value will be the processed/sanitized $args
[4295] Fix | Delete
* plus a "found_avatar" guess. Pass as a reference. Default null.
[4296] Fix | Delete
* }
[4297] Fix | Delete
* @return string|false The URL of the avatar on success, false on failure.
[4298] Fix | Delete
*/
[4299] Fix | Delete
function get_avatar_url( $id_or_email, $args = null ) {
[4300] Fix | Delete
$args = get_avatar_data( $id_or_email, $args );
[4301] Fix | Delete
return $args['url'];
[4302] Fix | Delete
}
[4303] Fix | Delete
[4304] Fix | Delete
/**
[4305] Fix | Delete
* Check if this comment type allows avatars to be retrieved.
[4306] Fix | Delete
*
[4307] Fix | Delete
* @since 5.1.0
[4308] Fix | Delete
*
[4309] Fix | Delete
* @param string $comment_type Comment type to check.
[4310] Fix | Delete
* @return bool Whether the comment type is allowed for retrieving avatars.
[4311] Fix | Delete
*/
[4312] Fix | Delete
function is_avatar_comment_type( $comment_type ) {
[4313] Fix | Delete
/**
[4314] Fix | Delete
* Filters the list of allowed comment types for retrieving avatars.
[4315] Fix | Delete
*
[4316] Fix | Delete
* @since 3.0.0
[4317] Fix | Delete
*
[4318] Fix | Delete
* @param array $types An array of content types. Default only contains 'comment'.
[4319] Fix | Delete
*/
[4320] Fix | Delete
$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
[4321] Fix | Delete
[4322] Fix | Delete
return in_array( $comment_type, (array) $allowed_comment_types, true );
[4323] Fix | Delete
}
[4324] Fix | Delete
[4325] Fix | Delete
/**
[4326] Fix | Delete
* Retrieves default data about the avatar.
[4327] Fix | Delete
*
[4328] Fix | Delete
* @since 4.2.0
[4329] Fix | Delete
*
[4330] Fix | Delete
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
[4331] Fix | Delete
* user email, WP_User object, WP_Post object, or WP_Comment object.
[4332] Fix | Delete
* @param array $args {
[4333] Fix | Delete
* Optional. Arguments to use instead of the default arguments.
[4334] Fix | Delete
*
[4335] Fix | Delete
* @type int $size Height and width of the avatar in pixels. Default 96.
[4336] Fix | Delete
* @type int $height Display height of the avatar in pixels. Defaults to $size.
[4337] Fix | Delete
* @type int $width Display width of the avatar in pixels. Defaults to $size.
[4338] Fix | Delete
* @type string $default URL for the default image or a default type. Accepts:
[4339] Fix | Delete
* - '404' (return a 404 instead of a default image)
[4340] Fix | Delete
* - 'retro' (a 8-bit arcade-style pixelated face)
[4341] Fix | Delete
* - 'robohash' (a robot)
[4342] Fix | Delete
* - 'monsterid' (a monster)
[4343] Fix | Delete
* - 'wavatar' (a cartoon face)
[4344] Fix | Delete
* - 'identicon' (the "quilt", a geometric pattern)
[4345] Fix | Delete
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
[4346] Fix | Delete
* - 'blank' (transparent GIF)
[4347] Fix | Delete
* - 'gravatar_default' (the Gravatar logo)
[4348] Fix | Delete
* Default is the value of the 'avatar_default' option,
[4349] Fix | Delete
* with a fallback of 'mystery'.
[4350] Fix | Delete
* @type bool $force_default Whether to always show the default image, never the Gravatar.
[4351] Fix | Delete
* Default false.
[4352] Fix | Delete
* @type string $rating What rating to display avatars up to. Accepts:
[4353] Fix | Delete
* - 'G' (suitable for all audiences)
[4354] Fix | Delete
* - 'PG' (possibly offensive, usually for audiences 13 and above)
[4355] Fix | Delete
* - 'R' (intended for adult audiences above 17)
[4356] Fix | Delete
* - 'X' (even more mature than above)
[4357] Fix | Delete
* Default is the value of the 'avatar_rating' option.
[4358] Fix | Delete
* @type string $scheme URL scheme to use. See set_url_scheme() for accepted values.
[4359] Fix | Delete
* Default null.
[4360] Fix | Delete
* @type array $processed_args When the function returns, the value will be the processed/sanitized $args
[4361] Fix | Delete
* plus a "found_avatar" guess. Pass as a reference. Default null.
[4362] Fix | Delete
* @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized.
[4363] Fix | Delete
* Default empty.
[4364] Fix | Delete
* }
[4365] Fix | Delete
* @return array {
[4366] Fix | Delete
* Along with the arguments passed in `$args`, this will contain a couple of extra arguments.
[4367] Fix | Delete
*
[4368] Fix | Delete
* @type bool $found_avatar True if an avatar was found for this user,
[4369] Fix | Delete
* false or not set if none was found.
[4370] Fix | Delete
* @type string|false $url The URL of the avatar that was found, or false.
[4371] Fix | Delete
* }
[4372] Fix | Delete
*/
[4373] Fix | Delete
function get_avatar_data( $id_or_email, $args = null ) {
[4374] Fix | Delete
$args = wp_parse_args(
[4375] Fix | Delete
$args,
[4376] Fix | Delete
array(
[4377] Fix | Delete
'size' => 96,
[4378] Fix | Delete
'height' => null,
[4379] Fix | Delete
'width' => null,
[4380] Fix | Delete
'default' => get_option( 'avatar_default', 'mystery' ),
[4381] Fix | Delete
'force_default' => false,
[4382] Fix | Delete
'rating' => get_option( 'avatar_rating' ),
[4383] Fix | Delete
'scheme' => null,
[4384] Fix | Delete
'processed_args' => null, // If used, should be a reference.
[4385] Fix | Delete
'extra_attr' => '',
[4386] Fix | Delete
)
[4387] Fix | Delete
);
[4388] Fix | Delete
[4389] Fix | Delete
if ( is_numeric( $args['size'] ) ) {
[4390] Fix | Delete
$args['size'] = absint( $args['size'] );
[4391] Fix | Delete
if ( ! $args['size'] ) {
[4392] Fix | Delete
$args['size'] = 96;
[4393] Fix | Delete
}
[4394] Fix | Delete
} else {
[4395] Fix | Delete
$args['size'] = 96;
[4396] Fix | Delete
}
[4397] Fix | Delete
[4398] Fix | Delete
if ( is_numeric( $args['height'] ) ) {
[4399] Fix | Delete
$args['height'] = absint( $args['height'] );
[4400] Fix | Delete
if ( ! $args['height'] ) {
[4401] Fix | Delete
$args['height'] = $args['size'];
[4402] Fix | Delete
}
[4403] Fix | Delete
} else {
[4404] Fix | Delete
$args['height'] = $args['size'];
[4405] Fix | Delete
}
[4406] Fix | Delete
[4407] Fix | Delete
if ( is_numeric( $args['width'] ) ) {
[4408] Fix | Delete
$args['width'] = absint( $args['width'] );
[4409] Fix | Delete
if ( ! $args['width'] ) {
[4410] Fix | Delete
$args['width'] = $args['size'];
[4411] Fix | Delete
}
[4412] Fix | Delete
} else {
[4413] Fix | Delete
$args['width'] = $args['size'];
[4414] Fix | Delete
}
[4415] Fix | Delete
[4416] Fix | Delete
if ( empty( $args['default'] ) ) {
[4417] Fix | Delete
$args['default'] = get_option( 'avatar_default', 'mystery' );
[4418] Fix | Delete
}
[4419] Fix | Delete
[4420] Fix | Delete
switch ( $args['default'] ) {
[4421] Fix | Delete
case 'mm':
[4422] Fix | Delete
case 'mystery':
[4423] Fix | Delete
case 'mysteryman':
[4424] Fix | Delete
$args['default'] = 'mm';
[4425] Fix | Delete
break;
[4426] Fix | Delete
case 'gravatar_default':
[4427] Fix | Delete
$args['default'] = false;
[4428] Fix | Delete
break;
[4429] Fix | Delete
}
[4430] Fix | Delete
[4431] Fix | Delete
$args['force_default'] = (bool) $args['force_default'];
[4432] Fix | Delete
[4433] Fix | Delete
$args['rating'] = strtolower( $args['rating'] );
[4434] Fix | Delete
[4435] Fix | Delete
$args['found_avatar'] = false;
[4436] Fix | Delete
[4437] Fix | Delete
/**
[4438] Fix | Delete
* Filters whether to retrieve the avatar URL early.
[4439] Fix | Delete
*
[4440] Fix | Delete
* Passing a non-null value in the 'url' member of the return array will
[4441] Fix | Delete
* effectively short circuit get_avatar_data(), passing the value through
[4442] Fix | Delete
* the {@see 'get_avatar_data'} filter and returning early.
[4443] Fix | Delete
*
[4444] Fix | Delete
* @since 4.2.0
[4445] Fix | Delete
*
[4446] Fix | Delete
* @param array $args Arguments passed to get_avatar_data(), after processing.
[4447] Fix | Delete
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
[4448] Fix | Delete
* user email, WP_User object, WP_Post object, or WP_Comment object.
[4449] Fix | Delete
*/
[4450] Fix | Delete
$args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email );
[4451] Fix | Delete
[4452] Fix | Delete
if ( isset( $args['url'] ) ) {
[4453] Fix | Delete
/** This filter is documented in wp-includes/link-template.php */
[4454] Fix | Delete
return apply_filters( 'get_avatar_data', $args, $id_or_email );
[4455] Fix | Delete
}
[4456] Fix | Delete
[4457] Fix | Delete
$email_hash = '';
[4458] Fix | Delete
$user = false;
[4459] Fix | Delete
$email = false;
[4460] Fix | Delete
[4461] Fix | Delete
if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
[4462] Fix | Delete
$id_or_email = get_comment( $id_or_email );
[4463] Fix | Delete
}
[4464] Fix | Delete
[4465] Fix | Delete
// Process the user identifier.
[4466] Fix | Delete
if ( is_numeric( $id_or_email ) ) {
[4467] Fix | Delete
$user = get_user_by( 'id', absint( $id_or_email ) );
[4468] Fix | Delete
} elseif ( is_string( $id_or_email ) ) {
[4469] Fix | Delete
if ( str_contains( $id_or_email, '@md5.gravatar.com' ) ) {
[4470] Fix | Delete
// MD5 hash.
[4471] Fix | Delete
list( $email_hash ) = explode( '@', $id_or_email );
[4472] Fix | Delete
} else {
[4473] Fix | Delete
// Email address.
[4474] Fix | Delete
$email = $id_or_email;
[4475] Fix | Delete
}
[4476] Fix | Delete
} elseif ( $id_or_email instanceof WP_User ) {
[4477] Fix | Delete
// User object.
[4478] Fix | Delete
$user = $id_or_email;
[4479] Fix | Delete
} elseif ( $id_or_email instanceof WP_Post ) {
[4480] Fix | Delete
// Post object.
[4481] Fix | Delete
$user = get_user_by( 'id', (int) $id_or_email->post_author );
[4482] Fix | Delete
} elseif ( $id_or_email instanceof WP_Comment ) {
[4483] Fix | Delete
if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) {
[4484] Fix | Delete
$args['url'] = false;
[4485] Fix | Delete
/** This filter is documented in wp-includes/link-template.php */
[4486] Fix | Delete
return apply_filters( 'get_avatar_data', $args, $id_or_email );
[4487] Fix | Delete
}
[4488] Fix | Delete
[4489] Fix | Delete
if ( ! empty( $id_or_email->user_id ) ) {
[4490] Fix | Delete
$user = get_user_by( 'id', (int) $id_or_email->user_id );
[4491] Fix | Delete
}
[4492] Fix | Delete
if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) {
[4493] Fix | Delete
$email = $id_or_email->comment_author_email;
[4494] Fix | Delete
}
[4495] Fix | Delete
}
[4496] Fix | Delete
[4497] Fix | Delete
if ( ! $email_hash ) {
[4498] Fix | Delete
if ( $user ) {
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function