Plugin Directory

Changeset 3479224


Ignore:
Timestamp:
03/10/2026 03:39:44 PM (3 weeks ago)
Author:
wpsaad
Message:

#Update to version 1.8.3

Location:
alt-manager
Files:
254 added
3 edited

Legend:

Unmodified
Added
Removed
  • alt-manager/trunk/alt-manager.php

    r3473540 r3479224  
    1111 * plugin URI: https://wpsaad.com/alt-manager-wordpress-image-alt-text-plugin/
    1212 * Description:Automatically bulk change images alt text to dynamic alt tags values related to content or media and also generate empty values for both alt and title tags.
    13  * Version: 1.8.2
     13 * Version: 1.8.3
    1414 * Author: WPSAAD
    1515 * Author URI: https://wpsaad.com
  • alt-manager/trunk/inc/alm-empty-generator.php

    r3473540 r3479224  
    134134                    $next_sibling = $img->next_sibling();
    135135                    if ( !empty( $next_sibling->innertext() ) ) {
    136                         $img->setAttribute( 'alt', $next_sibling->innertext() );
     136                        $img->setAttribute( 'alt', esc_attr( $next_sibling->innertext() ) );
    137137                    }
    138138                }
     
    145145                    // options
    146146                    $options = [
    147                         'Site Name'        => get_bloginfo( 'name' ),
    148                         'Site Description' => get_bloginfo( 'description' ),
    149                         'Page Title'       => get_the_title( $ID ),
    150                         'Post Title'       => get_post_field( 'post_title', $ID ),
    151                         'Product Title'    => get_post_field( 'post_title', $ID ),
     147                        'Site Name'        => sanitize_text_field( get_bloginfo( 'name' ) ),
     148                        'Site Description' => sanitize_text_field( get_bloginfo( 'description' ) ),
     149                        'Page Title'       => sanitize_text_field( get_the_title( $ID ) ),
     150                        'Post Title'       => sanitize_text_field( get_post_field( 'post_title', $ID ) ),
     151                        'Product Title'    => sanitize_text_field( get_post_field( 'post_title', $ID ) ),
    152152                    ];
    153153                    //wp image attachment data
     
    170170                        $alt = $options['Site Name'];
    171171                        $title = $options['Site Name'];
    172                         $img->setAttribute( 'alt', $alt );
    173                         $img->setAttribute( 'title', $title );
     172                        $img->setAttribute( 'alt', esc_attr( $alt ) );
     173                        $img->setAttribute( 'title', esc_attr( $title ) );
    174174                    }
    175175                    if ( !$logo_checker ) {
     
    192192                            //Empty alt option
    193193                            if ( 'enabled' === $generate_empty_alt && empty( $img->getAttribute( 'alt' ) ) ) {
    194                                 $img->setAttribute( 'alt', $alt );
     194                                $img->setAttribute( 'alt', esc_attr( $alt ) );
    195195                            } elseif ( 'enabled' === $generate_empty_alt && !empty( $img->getAttribute( 'alt' ) ) ) {
    196                                 $img->setAttribute( 'alt', $img->getAttribute( 'alt' ) );
    197                             } else {
    198                                 $img->setAttribute( 'alt', $alt );
     196                                $img->setAttribute( 'alt', esc_attr( $img->getAttribute( 'alt' ) ) );
     197                            } else {
     198                                $img->setAttribute( 'alt', esc_attr( $alt ) );
    199199                            }
    200200                            //page images title
     
    212212                            //Empty title option
    213213                            if ( 'enabled' === $generate_empty_title && empty( $img->getAttribute( 'title' ) ) ) {
    214                                 $img->setAttribute( 'title', $title );
     214                                $img->setAttribute( 'title', esc_attr( $title ) );
    215215                            } elseif ( 'enabled' === $generate_empty_title && !empty( $img->getAttribute( 'title' ) ) ) {
    216                                 $img->setAttribute( 'title', $img->getAttribute( 'title' ) );
    217                             } else {
    218                                 $img->setAttribute( 'title', $title );
     216                                $img->setAttribute( 'title', esc_attr( $img->getAttribute( 'title' ) ) );
     217                            } else {
     218                                $img->setAttribute( 'title', esc_attr( $title ) );
    219219                            }
    220220                        }
     
    226226                            $title = '';
    227227                            if ( 'page' !== alm_get_option( 'show_on_front' ) && !empty( alm_get_option( 'show_on_front' ) ) ) {
    228                                 $img->setAttribute( 'alt', $options['Site Name'] );
    229                                 $img->setAttribute( 'title', $options['Site Name'] );
     228                                $img->setAttribute( 'alt', esc_attr( $options['Site Name'] ) );
     229                                $img->setAttribute( 'title', esc_attr( $options['Site Name'] ) );
    230230                            } else {
    231231                                //Homepage images alt
     
    243243                                //Empty alt option
    244244                                if ( 'enabled' === $generate_empty_alt && empty( $img->getAttribute( 'alt' ) ) ) {
    245                                     $img->setAttribute( 'alt', $alt );
     245                                    $img->setAttribute( 'alt', esc_attr( $alt ) );
    246246                                } elseif ( 'enabled' === $generate_empty_alt && !empty( $img->getAttribute( 'alt' ) ) ) {
    247                                     $img->setAttribute( 'alt', $img->getAttribute( 'alt' ) );
     247                                    $img->setAttribute( 'alt', esc_attr( $img->getAttribute( 'alt' ) ) );
    248248                                } else {
    249                                     $img->setAttribute( 'alt', $alt );
     249                                    $img->setAttribute( 'alt', esc_attr( $alt ) );
    250250                                }
    251251                                //Homepage images title
     
    263263                                //Empty title option
    264264                                if ( 'enabled' === $generate_empty_title && empty( $img->getAttribute( 'title' ) ) ) {
    265                                     $img->setAttribute( 'title', $title );
     265                                    $img->setAttribute( 'title', esc_attr( $title ) );
    266266                                } elseif ( 'enabled' === $generate_empty_title && !empty( $img->getAttribute( 'title' ) ) ) {
    267                                     $img->setAttribute( 'title', $img->getAttribute( 'title' ) );
     267                                    $img->setAttribute( 'title', esc_attr( $img->getAttribute( 'title' ) ) );
    268268                                } else {
    269                                     $img->setAttribute( 'title', $title );
     269                                    $img->setAttribute( 'title', esc_attr( $title ) );
    270270                                }
    271271                            }
     
    289289                            //Empty alt option
    290290                            if ( 'enabled' === $generate_empty_alt && empty( $img->getAttribute( 'alt' ) ) ) {
    291                                 $img->setAttribute( 'alt', $alt );
     291                                $img->setAttribute( 'alt', esc_attr( $alt ) );
    292292                            } elseif ( 'enabled' === $generate_empty_alt && !empty( $img->getAttribute( 'alt' ) ) ) {
    293                                 $img->setAttribute( 'alt', $img->getAttribute( 'alt' ) );
    294                             } else {
    295                                 $img->setAttribute( 'alt', $alt );
     293                                $img->setAttribute( 'alt', esc_attr( $img->getAttribute( 'alt' ) ) );
     294                            } else {
     295                                $img->setAttribute( 'alt', esc_attr( $alt ) );
    296296                            }
    297297                            //post images title
     
    309309                            //Empty title option
    310310                            if ( 'enabled' === $generate_empty_title && empty( $img->getAttribute( 'title' ) ) ) {
    311                                 $img->setAttribute( 'title', $title );
     311                                $img->setAttribute( 'title', esc_attr( $title ) );
    312312                            } elseif ( 'enabled' === $generate_empty_title && !empty( $img->getAttribute( 'title' ) ) ) {
    313                                 $img->setAttribute( 'title', $img->getAttribute( 'title' ) );
    314                             } else {
    315                                 $img->setAttribute( 'title', $title );
     313                                $img->setAttribute( 'title', esc_attr( $img->getAttribute( 'title' ) ) );
     314                            } else {
     315                                $img->setAttribute( 'title', esc_attr( $title ) );
    316316                            }
    317317                        }
     
    352352    }
    353353    $replacements = [
    354         'Site Name'        => get_bloginfo( 'name' ),
    355         'Site Description' => get_bloginfo( 'description' ),
    356         'Page Title'       => get_the_title( $ID ),
    357         'Post Title'       => get_post_field( 'post_title', $ID ),
    358         'Product Title'    => get_post_field( 'post_title', $ID ),
     354        'Site Name'        => sanitize_text_field( get_bloginfo( 'name' ) ),
     355        'Site Description' => sanitize_text_field( get_bloginfo( 'description' ) ),
     356        'Page Title'       => sanitize_text_field( get_the_title( $ID ) ),
     357        'Post Title'       => sanitize_text_field( get_post_field( 'post_title', $ID ) ),
     358        'Product Title'    => sanitize_text_field( get_post_field( 'post_title', $ID ) ),
    359359    ];
    360360    $alt_keys = alm_get_option( "{$context}_images_alt" );
     
    375375    }
    376376    // Decode for raw readable characters
    377     $alt_output = htmlspecialchars_decode( $alt_final, ENT_QUOTES );
    378     $title_output = htmlspecialchars_decode( $title_final, ENT_QUOTES );
     377    $alt_output = esc_attr( $alt_final );
     378    $title_output = esc_attr( $title_final );
    379379    // Enqueue script properly
    380380    wp_enqueue_script(
  • alt-manager/trunk/readme.txt

    r3455850 r3479224  
    55Tested up to: 6.9
    66Requires PHP: 5.2.4
    7 Stable tag: 1.8.2
     7Stable tag: 1.8.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.