Plugin Directory

Changeset 3417789


Ignore:
Timestamp:
12/11/2025 10:59:44 PM (2 days ago)
Author:
webdevstudios
Message:

release version 1.2.6

Location:
automatic-featured-images-from-videos
Files:
9 added
4 edited

Legend:

Unmodified
Added
Removed
  • automatic-featured-images-from-videos/trunk/automatic-featured-images-from-videos.php

    r3265913 r3417789  
    11<?php
    2 /*
     2/**
    33 * Plugin Name: Automatic Featured Images from YouTube / Vimeo
    44 * Plugin URI: https://webdevstudios.com
    5  * Description: If a YouTube or Vimeo video exists in the first few paragraphs of a post, automatically set the post's featured image to that video's thumbnail.
    6  * Version: 1.2.5
     5 * Description: Automatically create featured images from YouTube and Vimeo generated video thumbnails, from above the fold embeds.
     6 * Version: 1.2.6
    77 * Author: WebDevStudios
    88 * Author URI: https://webdevstudios.com
     
    7272 * @param WP_Post $post    Post object.
    7373 */
    74 function wds_set_media_as_featured_image( $post_id, $post ) {
     74function wds_set_media_as_featured_image( int $post_id, WP_Post $post ) {
    7575    wds_check_if_content_contains_video( $post_id, $post );
    7676    _doing_it_wrong( 'wds_set_media_as_feature_image', esc_html__( 'This function has been replaced with wds_check_if_content_contains_video', 'automatic-featured-images-from-videos' ), '4.6' );
     
    8484 * @since  1.0.5
    8585 *
    86  * @param int    $post_id ID of the post being saved.
    87  * @param object $post    Post object.
    88  */
    89 function wds_check_if_content_contains_video( $post_id, $post ) {
     86 * @param int     $post_id ID of the post being saved.
     87 * @param WP_Post $post    Post object.
     88 */
     89function wds_check_if_content_contains_video( int $post_id, WP_Post $post ) {
    9090
    9191    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
     
    9999    }
    100100
    101     $content = isset( $post->post_content ) ? $post->post_content : '';
     101    $content = $post->post_content ?? '';
    102102
    103103    /**
     
    185185 * @param string $video_thumbnail_url URL of the image thumbnail.
    186186 * @param string $video_id            Video ID from embed.
    187  */
    188 function wds_set_video_thumbnail_as_featured_image( $post_id, $video_thumbnail_url, $video_id = '', $video_title = '' ) {
     187 * @param string $video_title         Video title from embed
     188 */
     189function wds_set_video_thumbnail_as_featured_image( int $post_id, string $video_thumbnail_url, string $video_id = '', string $video_title = '' ) {
    189190
    190191    // Bail if no valid video thumbnail URL.
     
    276277 * @return mixed
    277278 */
    278 function wds_ms_media_sideload_image_with_new_filename( $url, $post_id, $filename = null, $video_id = null ) {
     279function wds_ms_media_sideload_image_with_new_filename( string $url, int $post_id, string $filename = '', string $video_id = '' ) {
    279280
    280281    if ( ! $url || ! $post_id ) {
     
    364365 * @return array Video data.
    365366 */
    366 function wds_get_youtube_details( $youtube_id ) {
     367function wds_get_youtube_details( string $youtube_id ): array {
    367368    $video = [];
    368369    $video_thumbnail_url_string = 'https://img.youtube.com/vi/%s/%s';
     
    408409 * @return array Video information.
    409410 */
    410 function wds_get_vimeo_details( $vimeo_id ) {
     411function wds_get_vimeo_details( string $vimeo_id ): array {
    411412    $video = [];
    412413
     
    416417        $response                     = json_decode( $vimeo_data['body'] );
    417418
    418         $large = isset( $response[0]->thumbnail_large ) ? $response[0]->thumbnail_large : '';
     419        $large = $response[0]->thumbnail_large ?? '';
    419420        if ( $large ) {
    420421            $larger_test = explode( '_', $large );
     
    447448 * @return bool
    448449 */
    449 function wds_post_has_video( $post_id ) {
     450function wds_post_has_video( int $post_id ) {
    450451    if ( ! metadata_exists( 'post', $post_id, '_is_video' ) ) {
    451452        wds_check_if_content_contains_video( $post_id, get_post( $post_id ) );
     
    465466 * @return string
    466467 */
    467 function wds_get_video_url( $post_id ) {
     468function wds_get_video_url( int $post_id ): string {
    468469    if ( wds_post_has_video( $post_id ) ) {
    469470        if ( ! metadata_exists( 'post', $post_id, '_video_url' ) ) {
     
    486487 * @return string
    487488 */
    488 function wds_get_embeddable_video_url( $post_id ) {
     489function wds_get_embeddable_video_url( int $post_id ) : string {
    489490    if ( wds_post_has_video( $post_id ) ) {
    490491        if ( ! metadata_exists( 'post', $post_id, '_video_embed_url' ) ) {
     
    501502 * @author Gary Kovar
    502503 * @since 1.1.0
    503  */
    504 function wds_register_display_video_metabox( $post_type, $post ) {
     504 *
     505 * @param string $post_type Current post type for post being rendered
     506 */
     507function wds_register_display_video_metabox( string $post_type, WP_Post $post ) {
    505508    if ( get_post_meta( $post->ID, '_is_video', true ) ) {
    506509        add_meta_box(
     
    535538 * @return WP_Query WP_Query object
    536539 */
    537 function wds_automatic_featured_images_from_videos_wp_query( $post_type, $posts_per_page ) {
     540function wds_automatic_featured_images_from_videos_wp_query( string $post_type, int $posts_per_page ): WP_Query {
    538541    $args  = [
    539542        'post_type'      => $post_type,
  • automatic-featured-images-from-videos/trunk/includes/ajax.php

    r3265913 r3417789  
    1717
    1818    // Register the script we might use.
    19     wp_register_script( 'wds_featured_images_from_video_script', WDSAFI_DIR . 'js/button.js' );
     19    wp_register_script( 'wds_featured_images_from_video_script', WDSAFI_DIR . 'js/button.js', [], '1.2.6' );
    2020
    2121    global $post_type;
     
    4747 * @return string
    4848 */
    49 function wds_featured_images_from_video_processing_status( $post_type ) {
     49function wds_featured_images_from_video_processing_status( string $post_type ) {
    5050
    5151    // Check if the bulk task has already been scheduled.
    52     if ( wp_next_scheduled( 'wds_bulk_process_video_query_init', array( $post_type ) ) ) {
     52    if ( wp_next_scheduled( 'wds_bulk_process_video_query_init', [ $post_type ] ) ) {
    5353        return 'running';
    5454    }
     
    5757    $query = wds_automatic_featured_images_from_videos_wp_query( $post_type, apply_filters( 'wds_featured_images_from_video_posts_bulk_quantity', 10 ) );
    5858
    59     if ( $query->post_count > 1 ) {
     59    if ( $query->post_count >= 1 ) {
    6060        return 'ready_to_process';
    6161    }
     
    7171 */
    7272function wds_featured_images_from_video_processing_current_disposition() {
    73     return esc_html__( 'Processing...', 'wds_automatic_featured_images_from_videos' );
     73    return esc_html__( 'Processing...', 'automatic-featured-images-from-videos' );
    7474}
  • automatic-featured-images-from-videos/trunk/includes/bulk-operations.php

    r3265913 r3417789  
    4646 * @param string $post_type Post type to process.
    4747 */
    48 function wds_bulk_process_video_query( $post_type ) {
     48function wds_bulk_process_video_query( string $post_type ) {
    4949
    5050    $post_count = 10;
  • automatic-featured-images-from-videos/trunk/readme.txt

    r3265913 r3417789  
    33Contributors: webdevstudios, pluginize
    44Donate link: http://webdevstudios.com/
    5 Tags: video, youtube, vimeo, featured image
     5Tags: youtube, vimeo, automatic featured image, featured images, video
    66Requires at least: 5.0
    7 Tested up to: 6.7.2
    8 Stable tag: 1.2.5
     7Tested up to: 6.9
     8Stable tag: 1.2.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    11 Requires PHP: 5.6
     11Requires PHP: 7.4
    1212
    1313If a YouTube or Vimeo video embed exists near the start of a post, we'll automatically set the post's featured image to a thumbnail of the video.
     
    4040
    4141== Changelog ==
     42
     43= 1.2.6 =
     44* Fixed: bulk processing if only 0ne post was found needing processing. Originally needed 2 or more
     45* Fixed: missed textdomain
     46* Bumped required PHP to 7.4
     47* Confirmed compatibility with WordPress 6.9
    4248
    4349= 1.2.5 =
Note: See TracChangeset for help on using the changeset viewer.