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/clone/wp-inclu...
File: media.php
[3500] Fix | Delete
foreach ( $default_types as $type ) {
[3501] Fix | Delete
$defaults_atts[ $type ] = '';
[3502] Fix | Delete
}
[3503] Fix | Delete
[3504] Fix | Delete
$atts = shortcode_atts( $defaults_atts, $attr, 'video' );
[3505] Fix | Delete
[3506] Fix | Delete
if ( is_admin() ) {
[3507] Fix | Delete
// Shrink the video so it isn't huge in the admin.
[3508] Fix | Delete
if ( $atts['width'] > $defaults_atts['width'] ) {
[3509] Fix | Delete
$atts['height'] = round( ( $atts['height'] * $defaults_atts['width'] ) / $atts['width'] );
[3510] Fix | Delete
$atts['width'] = $defaults_atts['width'];
[3511] Fix | Delete
}
[3512] Fix | Delete
} else {
[3513] Fix | Delete
// If the video is bigger than the theme.
[3514] Fix | Delete
if ( ! empty( $content_width ) && $atts['width'] > $content_width ) {
[3515] Fix | Delete
$atts['height'] = round( ( $atts['height'] * $content_width ) / $atts['width'] );
[3516] Fix | Delete
$atts['width'] = $content_width;
[3517] Fix | Delete
}
[3518] Fix | Delete
}
[3519] Fix | Delete
[3520] Fix | Delete
$is_vimeo = false;
[3521] Fix | Delete
$is_youtube = false;
[3522] Fix | Delete
$yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
[3523] Fix | Delete
$vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#';
[3524] Fix | Delete
[3525] Fix | Delete
$primary = false;
[3526] Fix | Delete
if ( ! empty( $atts['src'] ) ) {
[3527] Fix | Delete
$is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) );
[3528] Fix | Delete
$is_youtube = ( preg_match( $yt_pattern, $atts['src'] ) );
[3529] Fix | Delete
[3530] Fix | Delete
if ( ! $is_youtube && ! $is_vimeo ) {
[3531] Fix | Delete
$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
[3532] Fix | Delete
[3533] Fix | Delete
if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) {
[3534] Fix | Delete
return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
[3535] Fix | Delete
}
[3536] Fix | Delete
}
[3537] Fix | Delete
[3538] Fix | Delete
if ( $is_vimeo ) {
[3539] Fix | Delete
wp_enqueue_script( 'mediaelement-vimeo' );
[3540] Fix | Delete
}
[3541] Fix | Delete
[3542] Fix | Delete
$primary = true;
[3543] Fix | Delete
array_unshift( $default_types, 'src' );
[3544] Fix | Delete
} else {
[3545] Fix | Delete
foreach ( $default_types as $ext ) {
[3546] Fix | Delete
if ( ! empty( $atts[ $ext ] ) ) {
[3547] Fix | Delete
$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
[3548] Fix | Delete
if ( strtolower( $type['ext'] ) === $ext ) {
[3549] Fix | Delete
$primary = true;
[3550] Fix | Delete
}
[3551] Fix | Delete
}
[3552] Fix | Delete
}
[3553] Fix | Delete
}
[3554] Fix | Delete
[3555] Fix | Delete
if ( ! $primary ) {
[3556] Fix | Delete
$videos = get_attached_media( 'video', $post_id );
[3557] Fix | Delete
if ( empty( $videos ) ) {
[3558] Fix | Delete
return;
[3559] Fix | Delete
}
[3560] Fix | Delete
[3561] Fix | Delete
$video = reset( $videos );
[3562] Fix | Delete
$atts['src'] = wp_get_attachment_url( $video->ID );
[3563] Fix | Delete
if ( empty( $atts['src'] ) ) {
[3564] Fix | Delete
return;
[3565] Fix | Delete
}
[3566] Fix | Delete
[3567] Fix | Delete
array_unshift( $default_types, 'src' );
[3568] Fix | Delete
}
[3569] Fix | Delete
[3570] Fix | Delete
/**
[3571] Fix | Delete
* Filters the media library used for the video shortcode.
[3572] Fix | Delete
*
[3573] Fix | Delete
* @since 3.6.0
[3574] Fix | Delete
*
[3575] Fix | Delete
* @param string $library Media library used for the video shortcode.
[3576] Fix | Delete
*/
[3577] Fix | Delete
$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
[3578] Fix | Delete
if ( 'mediaelement' === $library && did_action( 'init' ) ) {
[3579] Fix | Delete
wp_enqueue_style( 'wp-mediaelement' );
[3580] Fix | Delete
wp_enqueue_script( 'wp-mediaelement' );
[3581] Fix | Delete
wp_enqueue_script( 'mediaelement-vimeo' );
[3582] Fix | Delete
}
[3583] Fix | Delete
[3584] Fix | Delete
/*
[3585] Fix | Delete
* MediaElement.js has issues with some URL formats for Vimeo and YouTube,
[3586] Fix | Delete
* so update the URL to prevent the ME.js player from breaking.
[3587] Fix | Delete
*/
[3588] Fix | Delete
if ( 'mediaelement' === $library ) {
[3589] Fix | Delete
if ( $is_youtube ) {
[3590] Fix | Delete
// Remove `feature` query arg and force SSL - see #40866.
[3591] Fix | Delete
$atts['src'] = remove_query_arg( 'feature', $atts['src'] );
[3592] Fix | Delete
$atts['src'] = set_url_scheme( $atts['src'], 'https' );
[3593] Fix | Delete
} elseif ( $is_vimeo ) {
[3594] Fix | Delete
// Remove all query arguments and force SSL - see #40866.
[3595] Fix | Delete
$parsed_vimeo_url = wp_parse_url( $atts['src'] );
[3596] Fix | Delete
$vimeo_src = 'https://' . $parsed_vimeo_url['host'] . $parsed_vimeo_url['path'];
[3597] Fix | Delete
[3598] Fix | Delete
// Add loop param for mejs bug - see #40977, not needed after #39686.
[3599] Fix | Delete
$loop = $atts['loop'] ? '1' : '0';
[3600] Fix | Delete
$atts['src'] = add_query_arg( 'loop', $loop, $vimeo_src );
[3601] Fix | Delete
}
[3602] Fix | Delete
}
[3603] Fix | Delete
[3604] Fix | Delete
/**
[3605] Fix | Delete
* Filters the class attribute for the video shortcode output container.
[3606] Fix | Delete
*
[3607] Fix | Delete
* @since 3.6.0
[3608] Fix | Delete
* @since 4.9.0 The `$atts` parameter was added.
[3609] Fix | Delete
*
[3610] Fix | Delete
* @param string $class CSS class or list of space-separated classes.
[3611] Fix | Delete
* @param array $atts Array of video shortcode attributes.
[3612] Fix | Delete
*/
[3613] Fix | Delete
$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'], $atts );
[3614] Fix | Delete
[3615] Fix | Delete
$html_atts = array(
[3616] Fix | Delete
'class' => $atts['class'],
[3617] Fix | Delete
'id' => sprintf( 'video-%d-%d', $post_id, $instance ),
[3618] Fix | Delete
'width' => absint( $atts['width'] ),
[3619] Fix | Delete
'height' => absint( $atts['height'] ),
[3620] Fix | Delete
'poster' => esc_url( $atts['poster'] ),
[3621] Fix | Delete
'loop' => wp_validate_boolean( $atts['loop'] ),
[3622] Fix | Delete
'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
[3623] Fix | Delete
'muted' => wp_validate_boolean( $atts['muted'] ),
[3624] Fix | Delete
'preload' => $atts['preload'],
[3625] Fix | Delete
);
[3626] Fix | Delete
[3627] Fix | Delete
// These ones should just be omitted altogether if they are blank.
[3628] Fix | Delete
foreach ( array( 'poster', 'loop', 'autoplay', 'preload', 'muted' ) as $a ) {
[3629] Fix | Delete
if ( empty( $html_atts[ $a ] ) ) {
[3630] Fix | Delete
unset( $html_atts[ $a ] );
[3631] Fix | Delete
}
[3632] Fix | Delete
}
[3633] Fix | Delete
[3634] Fix | Delete
$attr_strings = array();
[3635] Fix | Delete
foreach ( $html_atts as $k => $v ) {
[3636] Fix | Delete
$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
[3637] Fix | Delete
}
[3638] Fix | Delete
[3639] Fix | Delete
$html = '';
[3640] Fix | Delete
[3641] Fix | Delete
if ( 'mediaelement' === $library && 1 === $instance ) {
[3642] Fix | Delete
$html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
[3643] Fix | Delete
}
[3644] Fix | Delete
[3645] Fix | Delete
$html .= sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
[3646] Fix | Delete
[3647] Fix | Delete
$fileurl = '';
[3648] Fix | Delete
$source = '<source type="%s" src="%s" />';
[3649] Fix | Delete
[3650] Fix | Delete
foreach ( $default_types as $fallback ) {
[3651] Fix | Delete
if ( ! empty( $atts[ $fallback ] ) ) {
[3652] Fix | Delete
if ( empty( $fileurl ) ) {
[3653] Fix | Delete
$fileurl = $atts[ $fallback ];
[3654] Fix | Delete
}
[3655] Fix | Delete
if ( 'src' === $fallback && $is_youtube ) {
[3656] Fix | Delete
$type = array( 'type' => 'video/youtube' );
[3657] Fix | Delete
} elseif ( 'src' === $fallback && $is_vimeo ) {
[3658] Fix | Delete
$type = array( 'type' => 'video/vimeo' );
[3659] Fix | Delete
} else {
[3660] Fix | Delete
$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
[3661] Fix | Delete
}
[3662] Fix | Delete
$url = add_query_arg( '_', $instance, $atts[ $fallback ] );
[3663] Fix | Delete
$html .= sprintf( $source, $type['type'], esc_url( $url ) );
[3664] Fix | Delete
}
[3665] Fix | Delete
}
[3666] Fix | Delete
[3667] Fix | Delete
if ( ! empty( $content ) ) {
[3668] Fix | Delete
if ( str_contains( $content, "\n" ) ) {
[3669] Fix | Delete
$content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
[3670] Fix | Delete
}
[3671] Fix | Delete
$html .= trim( $content );
[3672] Fix | Delete
}
[3673] Fix | Delete
[3674] Fix | Delete
if ( 'mediaelement' === $library ) {
[3675] Fix | Delete
$html .= wp_mediaelement_fallback( $fileurl );
[3676] Fix | Delete
}
[3677] Fix | Delete
$html .= '</video>';
[3678] Fix | Delete
[3679] Fix | Delete
$width_rule = '';
[3680] Fix | Delete
if ( ! empty( $atts['width'] ) ) {
[3681] Fix | Delete
$width_rule = sprintf( 'width: %dpx;', $atts['width'] );
[3682] Fix | Delete
}
[3683] Fix | Delete
$output = sprintf( '<div style="%s" class="wp-video">%s</div>', $width_rule, $html );
[3684] Fix | Delete
[3685] Fix | Delete
/**
[3686] Fix | Delete
* Filters the output of the video shortcode.
[3687] Fix | Delete
*
[3688] Fix | Delete
* @since 3.6.0
[3689] Fix | Delete
*
[3690] Fix | Delete
* @param string $output Video shortcode HTML output.
[3691] Fix | Delete
* @param array $atts Array of video shortcode attributes.
[3692] Fix | Delete
* @param string $video Video file.
[3693] Fix | Delete
* @param int $post_id Post ID.
[3694] Fix | Delete
* @param string $library Media library used for the video shortcode.
[3695] Fix | Delete
*/
[3696] Fix | Delete
return apply_filters( 'wp_video_shortcode', $output, $atts, $video, $post_id, $library );
[3697] Fix | Delete
}
[3698] Fix | Delete
add_shortcode( 'video', 'wp_video_shortcode' );
[3699] Fix | Delete
[3700] Fix | Delete
/**
[3701] Fix | Delete
* Gets the previous image link that has the same post parent.
[3702] Fix | Delete
*
[3703] Fix | Delete
* @since 5.8.0
[3704] Fix | Delete
*
[3705] Fix | Delete
* @see get_adjacent_image_link()
[3706] Fix | Delete
*
[3707] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[3708] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[3709] Fix | Delete
* @param string|false $text Optional. Link text. Default false.
[3710] Fix | Delete
* @return string Markup for previous image link.
[3711] Fix | Delete
*/
[3712] Fix | Delete
function get_previous_image_link( $size = 'thumbnail', $text = false ) {
[3713] Fix | Delete
return get_adjacent_image_link( true, $size, $text );
[3714] Fix | Delete
}
[3715] Fix | Delete
[3716] Fix | Delete
/**
[3717] Fix | Delete
* Displays previous image link that has the same post parent.
[3718] Fix | Delete
*
[3719] Fix | Delete
* @since 2.5.0
[3720] Fix | Delete
*
[3721] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[3722] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[3723] Fix | Delete
* @param string|false $text Optional. Link text. Default false.
[3724] Fix | Delete
*/
[3725] Fix | Delete
function previous_image_link( $size = 'thumbnail', $text = false ) {
[3726] Fix | Delete
echo get_previous_image_link( $size, $text );
[3727] Fix | Delete
}
[3728] Fix | Delete
[3729] Fix | Delete
/**
[3730] Fix | Delete
* Gets the next image link that has the same post parent.
[3731] Fix | Delete
*
[3732] Fix | Delete
* @since 5.8.0
[3733] Fix | Delete
*
[3734] Fix | Delete
* @see get_adjacent_image_link()
[3735] Fix | Delete
*
[3736] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[3737] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[3738] Fix | Delete
* @param string|false $text Optional. Link text. Default false.
[3739] Fix | Delete
* @return string Markup for next image link.
[3740] Fix | Delete
*/
[3741] Fix | Delete
function get_next_image_link( $size = 'thumbnail', $text = false ) {
[3742] Fix | Delete
return get_adjacent_image_link( false, $size, $text );
[3743] Fix | Delete
}
[3744] Fix | Delete
[3745] Fix | Delete
/**
[3746] Fix | Delete
* Displays next image link that has the same post parent.
[3747] Fix | Delete
*
[3748] Fix | Delete
* @since 2.5.0
[3749] Fix | Delete
*
[3750] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[3751] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[3752] Fix | Delete
* @param string|false $text Optional. Link text. Default false.
[3753] Fix | Delete
*/
[3754] Fix | Delete
function next_image_link( $size = 'thumbnail', $text = false ) {
[3755] Fix | Delete
echo get_next_image_link( $size, $text );
[3756] Fix | Delete
}
[3757] Fix | Delete
[3758] Fix | Delete
/**
[3759] Fix | Delete
* Gets the next or previous image link that has the same post parent.
[3760] Fix | Delete
*
[3761] Fix | Delete
* Retrieves the current attachment object from the $post global.
[3762] Fix | Delete
*
[3763] Fix | Delete
* @since 5.8.0
[3764] Fix | Delete
*
[3765] Fix | Delete
* @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
[3766] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[3767] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[3768] Fix | Delete
* @param bool $text Optional. Link text. Default false.
[3769] Fix | Delete
* @return string Markup for image link.
[3770] Fix | Delete
*/
[3771] Fix | Delete
function get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
[3772] Fix | Delete
$post = get_post();
[3773] Fix | Delete
$attachments = array_values(
[3774] Fix | Delete
get_children(
[3775] Fix | Delete
array(
[3776] Fix | Delete
'post_parent' => $post->post_parent,
[3777] Fix | Delete
'post_status' => 'inherit',
[3778] Fix | Delete
'post_type' => 'attachment',
[3779] Fix | Delete
'post_mime_type' => 'image',
[3780] Fix | Delete
'order' => 'ASC',
[3781] Fix | Delete
'orderby' => 'menu_order ID',
[3782] Fix | Delete
)
[3783] Fix | Delete
)
[3784] Fix | Delete
);
[3785] Fix | Delete
[3786] Fix | Delete
foreach ( $attachments as $k => $attachment ) {
[3787] Fix | Delete
if ( (int) $attachment->ID === (int) $post->ID ) {
[3788] Fix | Delete
break;
[3789] Fix | Delete
}
[3790] Fix | Delete
}
[3791] Fix | Delete
[3792] Fix | Delete
$output = '';
[3793] Fix | Delete
$attachment_id = 0;
[3794] Fix | Delete
[3795] Fix | Delete
if ( $attachments ) {
[3796] Fix | Delete
$k = $prev ? $k - 1 : $k + 1;
[3797] Fix | Delete
[3798] Fix | Delete
if ( isset( $attachments[ $k ] ) ) {
[3799] Fix | Delete
$attachment_id = $attachments[ $k ]->ID;
[3800] Fix | Delete
$attr = array( 'alt' => get_the_title( $attachment_id ) );
[3801] Fix | Delete
$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text, $attr );
[3802] Fix | Delete
}
[3803] Fix | Delete
}
[3804] Fix | Delete
[3805] Fix | Delete
$adjacent = $prev ? 'previous' : 'next';
[3806] Fix | Delete
[3807] Fix | Delete
/**
[3808] Fix | Delete
* Filters the adjacent image link.
[3809] Fix | Delete
*
[3810] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency,
[3811] Fix | Delete
* either 'next', or 'previous'.
[3812] Fix | Delete
*
[3813] Fix | Delete
* Possible hook names include:
[3814] Fix | Delete
*
[3815] Fix | Delete
* - `next_image_link`
[3816] Fix | Delete
* - `previous_image_link`
[3817] Fix | Delete
*
[3818] Fix | Delete
* @since 3.5.0
[3819] Fix | Delete
*
[3820] Fix | Delete
* @param string $output Adjacent image HTML markup.
[3821] Fix | Delete
* @param int $attachment_id Attachment ID
[3822] Fix | Delete
* @param string|int[] $size Requested image size. Can be any registered image size name, or
[3823] Fix | Delete
* an array of width and height values in pixels (in that order).
[3824] Fix | Delete
* @param string $text Link text.
[3825] Fix | Delete
*/
[3826] Fix | Delete
return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
[3827] Fix | Delete
}
[3828] Fix | Delete
[3829] Fix | Delete
/**
[3830] Fix | Delete
* Displays next or previous image link that has the same post parent.
[3831] Fix | Delete
*
[3832] Fix | Delete
* Retrieves the current attachment object from the $post global.
[3833] Fix | Delete
*
[3834] Fix | Delete
* @since 2.5.0
[3835] Fix | Delete
*
[3836] Fix | Delete
* @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
[3837] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[3838] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[3839] Fix | Delete
* @param bool $text Optional. Link text. Default false.
[3840] Fix | Delete
*/
[3841] Fix | Delete
function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
[3842] Fix | Delete
echo get_adjacent_image_link( $prev, $size, $text );
[3843] Fix | Delete
}
[3844] Fix | Delete
[3845] Fix | Delete
/**
[3846] Fix | Delete
* Retrieves taxonomies attached to given the attachment.
[3847] Fix | Delete
*
[3848] Fix | Delete
* @since 2.5.0
[3849] Fix | Delete
* @since 4.7.0 Introduced the `$output` parameter.
[3850] Fix | Delete
*
[3851] Fix | Delete
* @param int|array|object $attachment Attachment ID, data array, or data object.
[3852] Fix | Delete
* @param string $output Output type. 'names' to return an array of taxonomy names,
[3853] Fix | Delete
* or 'objects' to return an array of taxonomy objects.
[3854] Fix | Delete
* Default is 'names'.
[3855] Fix | Delete
* @return string[]|WP_Taxonomy[] List of taxonomies or taxonomy names. Empty array on failure.
[3856] Fix | Delete
*/
[3857] Fix | Delete
function get_attachment_taxonomies( $attachment, $output = 'names' ) {
[3858] Fix | Delete
if ( is_int( $attachment ) ) {
[3859] Fix | Delete
$attachment = get_post( $attachment );
[3860] Fix | Delete
} elseif ( is_array( $attachment ) ) {
[3861] Fix | Delete
$attachment = (object) $attachment;
[3862] Fix | Delete
}
[3863] Fix | Delete
[3864] Fix | Delete
if ( ! is_object( $attachment ) ) {
[3865] Fix | Delete
return array();
[3866] Fix | Delete
}
[3867] Fix | Delete
[3868] Fix | Delete
$file = get_attached_file( $attachment->ID );
[3869] Fix | Delete
$filename = wp_basename( $file );
[3870] Fix | Delete
[3871] Fix | Delete
$objects = array( 'attachment' );
[3872] Fix | Delete
[3873] Fix | Delete
if ( str_contains( $filename, '.' ) ) {
[3874] Fix | Delete
$objects[] = 'attachment:' . substr( $filename, strrpos( $filename, '.' ) + 1 );
[3875] Fix | Delete
}
[3876] Fix | Delete
[3877] Fix | Delete
if ( ! empty( $attachment->post_mime_type ) ) {
[3878] Fix | Delete
$objects[] = 'attachment:' . $attachment->post_mime_type;
[3879] Fix | Delete
[3880] Fix | Delete
if ( str_contains( $attachment->post_mime_type, '/' ) ) {
[3881] Fix | Delete
foreach ( explode( '/', $attachment->post_mime_type ) as $token ) {
[3882] Fix | Delete
if ( ! empty( $token ) ) {
[3883] Fix | Delete
$objects[] = "attachment:$token";
[3884] Fix | Delete
}
[3885] Fix | Delete
}
[3886] Fix | Delete
}
[3887] Fix | Delete
}
[3888] Fix | Delete
[3889] Fix | Delete
$taxonomies = array();
[3890] Fix | Delete
[3891] Fix | Delete
foreach ( $objects as $object ) {
[3892] Fix | Delete
$taxes = get_object_taxonomies( $object, $output );
[3893] Fix | Delete
[3894] Fix | Delete
if ( $taxes ) {
[3895] Fix | Delete
$taxonomies = array_merge( $taxonomies, $taxes );
[3896] Fix | Delete
}
[3897] Fix | Delete
}
[3898] Fix | Delete
[3899] Fix | Delete
if ( 'names' === $output ) {
[3900] Fix | Delete
$taxonomies = array_unique( $taxonomies );
[3901] Fix | Delete
}
[3902] Fix | Delete
[3903] Fix | Delete
return $taxonomies;
[3904] Fix | Delete
}
[3905] Fix | Delete
[3906] Fix | Delete
/**
[3907] Fix | Delete
* Retrieves all of the taxonomies that are registered for attachments.
[3908] Fix | Delete
*
[3909] Fix | Delete
* Handles mime-type-specific taxonomies such as attachment:image and attachment:video.
[3910] Fix | Delete
*
[3911] Fix | Delete
* @since 3.5.0
[3912] Fix | Delete
*
[3913] Fix | Delete
* @see get_taxonomies()
[3914] Fix | Delete
*
[3915] Fix | Delete
* @param string $output Optional. The type of taxonomy output to return. Accepts 'names' or 'objects'.
[3916] Fix | Delete
* Default 'names'.
[3917] Fix | Delete
* @return string[]|WP_Taxonomy[] Array of names or objects of registered taxonomies for attachments.
[3918] Fix | Delete
*/
[3919] Fix | Delete
function get_taxonomies_for_attachments( $output = 'names' ) {
[3920] Fix | Delete
$taxonomies = array();
[3921] Fix | Delete
[3922] Fix | Delete
foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
[3923] Fix | Delete
foreach ( $taxonomy->object_type as $object_type ) {
[3924] Fix | Delete
if ( 'attachment' === $object_type || str_starts_with( $object_type, 'attachment:' ) ) {
[3925] Fix | Delete
if ( 'names' === $output ) {
[3926] Fix | Delete
$taxonomies[] = $taxonomy->name;
[3927] Fix | Delete
} else {
[3928] Fix | Delete
$taxonomies[ $taxonomy->name ] = $taxonomy;
[3929] Fix | Delete
}
[3930] Fix | Delete
break;
[3931] Fix | Delete
}
[3932] Fix | Delete
}
[3933] Fix | Delete
}
[3934] Fix | Delete
[3935] Fix | Delete
return $taxonomies;
[3936] Fix | Delete
}
[3937] Fix | Delete
[3938] Fix | Delete
/**
[3939] Fix | Delete
* Determines whether the value is an acceptable type for GD image functions.
[3940] Fix | Delete
*
[3941] Fix | Delete
* In PHP 8.0, the GD extension uses GdImage objects for its data structures.
[3942] Fix | Delete
* This function checks if the passed value is either a GdImage object instance
[3943] Fix | Delete
* or a resource of type `gd`. Any other type will return false.
[3944] Fix | Delete
*
[3945] Fix | Delete
* @since 5.6.0
[3946] Fix | Delete
*
[3947] Fix | Delete
* @param resource|GdImage|false $image A value to check the type for.
[3948] Fix | Delete
* @return bool True if `$image` is either a GD image resource or a GdImage instance,
[3949] Fix | Delete
* false otherwise.
[3950] Fix | Delete
*/
[3951] Fix | Delete
function is_gd_image( $image ) {
[3952] Fix | Delete
if ( $image instanceof GdImage
[3953] Fix | Delete
|| is_resource( $image ) && 'gd' === get_resource_type( $image )
[3954] Fix | Delete
) {
[3955] Fix | Delete
return true;
[3956] Fix | Delete
}
[3957] Fix | Delete
[3958] Fix | Delete
return false;
[3959] Fix | Delete
}
[3960] Fix | Delete
[3961] Fix | Delete
/**
[3962] Fix | Delete
* Creates a new GD image resource with transparency support.
[3963] Fix | Delete
*
[3964] Fix | Delete
* @todo Deprecate if possible.
[3965] Fix | Delete
*
[3966] Fix | Delete
* @since 2.9.0
[3967] Fix | Delete
*
[3968] Fix | Delete
* @param int $width Image width in pixels.
[3969] Fix | Delete
* @param int $height Image height in pixels.
[3970] Fix | Delete
* @return resource|GdImage|false The GD image resource or GdImage instance on success.
[3971] Fix | Delete
* False on failure.
[3972] Fix | Delete
*/
[3973] Fix | Delete
function wp_imagecreatetruecolor( $width, $height ) {
[3974] Fix | Delete
$img = imagecreatetruecolor( $width, $height );
[3975] Fix | Delete
[3976] Fix | Delete
if ( is_gd_image( $img )
[3977] Fix | Delete
&& function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' )
[3978] Fix | Delete
) {
[3979] Fix | Delete
imagealphablending( $img, false );
[3980] Fix | Delete
imagesavealpha( $img, true );
[3981] Fix | Delete
}
[3982] Fix | Delete
[3983] Fix | Delete
return $img;
[3984] Fix | Delete
}
[3985] Fix | Delete
[3986] Fix | Delete
/**
[3987] Fix | Delete
* Based on a supplied width/height example, returns the biggest possible dimensions based on the max width/height.
[3988] Fix | Delete
*
[3989] Fix | Delete
* @since 2.9.0
[3990] Fix | Delete
*
[3991] Fix | Delete
* @see wp_constrain_dimensions()
[3992] Fix | Delete
*
[3993] Fix | Delete
* @param int $example_width The width of an example embed.
[3994] Fix | Delete
* @param int $example_height The height of an example embed.
[3995] Fix | Delete
* @param int $max_width The maximum allowed width.
[3996] Fix | Delete
* @param int $max_height The maximum allowed height.
[3997] Fix | Delete
* @return int[] {
[3998] Fix | Delete
* An array of maximum width and height values.
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function