WordPress.org

Plugin Directory

Changeset 399254


Ignore:
Timestamp:
06/20/11 16:56:43 (3 years ago)
Author:
mfields
Message:

fix button + i18n + escaping

Location:
taxonomy-images/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • taxonomy-images/trunk/edit-tags.js

    r391118 r399254  
    77    } ); 
    88 
    9     $( '.taxonomy-images-modal .remove' ).live( 'click', function () { 
    10         var tt_id = parseInt( $( this ).attr( 'rel' ) ); 
     9    $( '.taxonomy-image-control .remove' ).live( 'click', function () { 
    1110        $.ajax( { 
    1211            url: ajaxurl, 
     
    1615                'action'   : 'taxonomy_image_plugin_remove_association', 
    1716                'wp_nonce' : taxonomyImagesPlugin.nonce, 
    18                 'tt_id'    : tt_id 
     17                'tt_id'    : taxonomyImagesPlugin.tt_id 
    1918                }, 
    2019            cache: false, 
    2120            success: function ( response ) { 
    2221                if ( 'good' === response.status ) { 
    23                     $( '#remove-' + tt_id ).addClass( 'hide' ); 
    24                     $( '#taxonomy_image_plugin_' + tt_id ).attr( 'src', taxonomyImagesPlugin.img_src ); 
     22                    $( '#remove-' + taxonomyImagesPlugin.tt_id ).addClass( 'hide' ); 
     23                    $( '#taxonomy_image_plugin_' + taxonomyImagesPlugin.tt_id ).attr( 'src', taxonomyImagesPlugin.img_src ); 
    2524                } 
    2625                else if ( 'bad' === response.status ) { 
  • taxonomy-images/trunk/taxonomy-images.php

    r399221 r399254  
    109109        $image_id = (int) $post->ID; 
    110110 
    111         $o = '<div class="taxonomy-image-modal-control" id="taxonomy-image-modal-control-' . $image_id . '">'; 
    112  
    113         $o.= '<span class="button create-association">' . sprintf( __( 'Associate with %1$s', 'taxonomy-images' ), '<span class="term-name">' . esc_html__( 'this term', 'taxonomy-images' ) . '</span>' ) . '</span>'; 
    114  
    115         $o.= '<span class="remove-association">' . sprintf( __( 'Remove association with %1$s', 'taxonomy-images' ), '<span class="term-name">' . esc_html__( 'this term', 'taxonomy-images' ) . '</span>' ) . '</span>'; 
     111        $o = '<div class="taxonomy-image-modal-control" id="' . esc_attr( 'taxonomy-image-modal-control-' . $image_id ) . '">'; 
     112 
     113        $o.= '<span class="button create-association">' . sprintf( esc_html__( 'Associate with %1$s', 'taxonomy-images' ), '<span class="term-name">' . esc_html__( 'this term', 'taxonomy-images' ) . '</span>' ) . '</span>'; 
     114 
     115        $o.= '<span class="remove-association">' . sprintf( esc_html__( 'Remove association with %1$s', 'taxonomy-images' ), '<span class="term-name">' . esc_html__( 'this term', 'taxonomy-images' ) . '</span>' ) . '</span>'; 
    116116 
    117117        $o.= '<input class="taxonomy-image-button-image-id" name="' . esc_attr( 'taxonomy-image-button-image-id-' . $image_id ) . '" type="hidden" value="' . esc_attr( $image_id ) . '" />'; 
    118118 
    119         $o.= '<input class="taxonomy-image-button-nonce-create" name="' . esc_attr( 'taxonomy-image-button-nonce-create-' . $image_id ) . '" type="hidden" value="' . wp_create_nonce( 'taxonomy-image-plugin-create-association' ) . '" />'; 
    120  
    121         $o.= '<input class="taxonomy-image-button-nonce-remove" name="' . esc_attr( 'taxonomy-image-button-nonce-remove-' . $image_id ) . '" type="hidden" value="' . wp_create_nonce( 'taxonomy-image-plugin-remove-association' ) . '" />'; 
     119        $o.= '<input class="taxonomy-image-button-nonce-create" name="' . esc_attr( 'taxonomy-image-button-nonce-create-' . $image_id ) . '" type="hidden" value="' . esc_attr( wp_create_nonce( 'taxonomy-image-plugin-create-association' ) ) . '" />'; 
     120 
     121        $o.= '<input class="taxonomy-image-button-nonce-remove" name="' . esc_attr( 'taxonomy-image-button-nonce-remove-' . $image_id ) . '" type="hidden" value="' . esc_attr( wp_create_nonce( 'taxonomy-image-plugin-remove-association' ) ) . '" />'; 
    122122 
    123123        $o.= '</div>'; 
     
    271271    } 
    272272 
    273     add_settings_error( 'taxonomy_image_plugin_settings', 'taxonomies_updated', $message, 'updated' ); 
     273    add_settings_error( 'taxonomy_image_plugin_settings', 'taxonomies_updated', esc_html( $message ), 'updated' ); 
    274274 
    275275    return $clean; 
     
    308308    add_settings_section( 
    309309        'taxonomy_image_plugin_settings', 
    310         __( 'Settings', 'taxonomy-images' ), 
     310        esc_html__( 'Settings', 'taxonomy-images' ), 
    311311        '__return_false', 
    312312        'taxonomy_image_plugin_settings' 
     
    314314    add_settings_field( 
    315315        'taxonomy-images', 
    316         __( 'Taxonomies', 'taxonomy-images' ), 
     316        esc_html__( 'Taxonomies', 'taxonomy-images' ), 
    317317        'taxonomy_image_plugin_control_taxonomies', 
    318318        'taxonomy_image_plugin_settings', 
     
    333333function taxonomy_images_settings_menu() { 
    334334    add_options_page( 
    335         __( 'Taxonomy Images', 'taxonomy-images' ), 
    336         __( 'Taxonomy Images', 'taxonomy-images' ), 
     335        esc_html__( 'Taxonomy Images', 'taxonomy-images' ), /* HTML <title> tag. */ 
     336        esc_html__( 'Taxonomy Images', 'taxonomy-images' ), /* Link text in admin menu. */ 
    337337        'manage_options', 
    338338        'taxonomy_image_plugin_settings', 
     
    359359    print "\n" . '<div class="wrap">'; 
    360360    screen_icon(); 
    361     print "\n" . '<h2>' . __( 'Taxonomy Images Plugin Settings', 'taxonomy-images' ) . '</h2>'; 
     361    print "\n" . '<h2>' . esc_html__( 'Taxonomy Images Plugin Settings', 'taxonomy-images' ) . '</h2>'; 
    362362    print "\n" . '<div id="taxonomy-images">'; 
    363363    print "\n" . '<form action="options.php" method="post">'; 
     
    412412    $response = wp_parse_args( $args, array( 
    413413        'status' => 'bad', 
    414         'why'    => 'Unknown error encountered' 
     414        'why'    => esc_html__( 'Unknown error encountered', 'taxonomy-images' ) 
    415415    ) ); 
    416416    header( 'Content-type: application/jsonrequest' ); 
     
    421421 
    422422/** 
    423  * Get Term Info 
     423 * Get Term Info. 
    424424 * 
    425425 * Returns term info by term_taxonomy_id. 
     
    487487        taxonomy_image_plugin_json_response( array( 
    488488            'status' => 'bad', 
    489             'why'    => __( 'tt_id not sent', 'taxonomy-images' ), 
     489            'why'    => esc_html__( 'tt_id not sent', 'taxonomy-images' ), 
    490490        ) ); 
    491491    } 
     
    495495        taxonomy_image_plugin_json_response( array( 
    496496            'status' => 'bad', 
    497             'why'    => __( 'tt_id is empty', 'taxonomy-images' ), 
     497            'why'    => esc_html__( 'tt_id is empty', 'taxonomy-images' ), 
    498498        ) ); 
    499499    } 
     
    502502        taxonomy_image_plugin_json_response( array( 
    503503            'status' => 'bad', 
    504             'why'    => __( 'You do not have the correct capability to manage this term', 'taxonomy-images' ), 
     504            'why'    => esc_html__( 'You do not have the correct capability to manage this term', 'taxonomy-images' ), 
    505505        ) ); 
    506506    } 
     
    509509        taxonomy_image_plugin_json_response( array( 
    510510            'status' => 'bad', 
    511             'why'    => __( 'No nonce included.', 'taxonomy-images' ), 
     511            'why'    => esc_html__( 'No nonce included.', 'taxonomy-images' ), 
    512512        ) ); 
    513513    } 
     
    516516        taxonomy_image_plugin_json_response( array( 
    517517            'status' => 'bad', 
    518             'why'    => __( 'Nonce did not match', 'taxonomy-images' ), 
     518            'why'    => esc_html__( 'Nonce did not match', 'taxonomy-images' ), 
    519519        ) ); 
    520520    } 
     
    523523        taxonomy_image_plugin_json_response( array( 
    524524            'status' => 'bad', 
    525             'why'    => __( 'Image id not sent', 'taxonomy-images' ) 
     525            'why'    => esc_html__( 'Image id not sent', 'taxonomy-images' ) 
    526526        ) ); 
    527527    } 
     
    531531        taxonomy_image_plugin_json_response( array( 
    532532            'status' => 'bad', 
    533             'why'    => __( 'Image id is not a positive integer', 'taxonomy-images' ) 
     533            'why'    => esc_html__( 'Image id is not a positive integer', 'taxonomy-images' ) 
    534534        ) ); 
    535535    } 
     
    540540        taxonomy_image_plugin_json_response( array( 
    541541            'status' => 'good', 
    542             'why'    => 'Image successfully associated', 
     542            'why'    => esc_html__( 'Image successfully associated', 'taxonomy-images' ), 
    543543            'attachment_thumb_src' => taxonomy_image_plugin_get_image_src( $image_id ) 
    544544        ) ); 
     
    547547        taxonomy_image_plugin_json_response( array( 
    548548            'status' => 'bad', 
    549             'why'    => __( 'Association could not be created', 'taxonomy-images' ) 
     549            'why'    => esc_html__( 'Association could not be created', 'taxonomy-images' ) 
    550550        ) ); 
    551551    } 
     
    569569        taxonomy_image_plugin_json_response( array( 
    570570            'status' => 'bad', 
    571             'why'    => __( 'tt_id not sent', 'taxonomy-images' ), 
     571            'why'    => esc_html__( 'tt_id not sent', 'taxonomy-images' ), 
    572572        ) ); 
    573573    } 
     
    577577        taxonomy_image_plugin_json_response( array( 
    578578            'status' => 'bad', 
    579             'why'    => __( 'tt_id is empty', 'taxonomy-images' ), 
     579            'why'    => esc_html__( 'tt_id is empty', 'taxonomy-images' ), 
    580580        ) ); 
    581581    } 
     
    584584        taxonomy_image_plugin_json_response( array( 
    585585            'status' => 'bad', 
    586             'why'    => __( 'You do not have the correct capability to manage this term', 'taxonomy-images' ), 
     586            'why'    => esc_html__( 'You do not have the correct capability to manage this term', 'taxonomy-images' ), 
    587587        ) ); 
    588588    } 
     
    591591        taxonomy_image_plugin_json_response( array( 
    592592            'status' => 'bad', 
    593             'why'    => __( 'No nonce included', 'taxonomy-images' ), 
     593            'why'    => esc_html__( 'No nonce included', 'taxonomy-images' ), 
    594594        ) ); 
    595595    } 
     
    598598        taxonomy_image_plugin_json_response( array( 
    599599            'status' => 'bad', 
    600             'why'    => __( 'Nonce did not match', 'taxonomy-images' ), 
     600            'why'    => esc_html__( 'Nonce did not match', 'taxonomy-images' ), 
    601601        ) ); 
    602602    } 
     
    606606        taxonomy_image_plugin_json_response( array( 
    607607            'status' => 'good', 
    608             'why'    => __( 'Nothing to remove', 'taxonomy-images' ) 
     608            'why'    => esc_html__( 'Nothing to remove', 'taxonomy-images' ) 
    609609        ) ); 
    610610    } 
     
    615615        taxonomy_image_plugin_json_response( array( 
    616616            'status' => 'good', 
    617             'why'    => __( 'Association successfully removed', 'taxonomy-images' ) 
     617            'why'    => esc_html__( 'Association successfully removed', 'taxonomy-images' ) 
    618618        ) ); 
    619619    } 
     
    621621        taxonomy_image_plugin_json_response( array( 
    622622            'status' => 'bad', 
    623             'why'    => __( 'Association could not be removed', 'taxonomy-images' ) 
     623            'why'    => esc_html__( 'Association could not be removed', 'taxonomy-images' ) 
    624624        ) ); 
    625625    } 
     
    691691    $new_columns = $original_columns; 
    692692    array_splice( $new_columns, 1 ); 
    693     $new_columns['taxonomy_image_plugin'] = __( 'Image', 'taxonomy-images' ); /* Add custom column */ 
     693    $new_columns['taxonomy_image_plugin'] = esc_html__( 'Image', 'taxonomy-images' ); 
    694694    return array_merge( $new_columns, $original_columns ); 
    695695} 
     
    740740    ?> 
    741741    <tr class="form-field hide-if-no-js"> 
    742         <th scope="row" valign="top"><label for="description"><?php _e( 'Image', 'taxonomy-images' ) ?></label></th> 
     742        <th scope="row" valign="top"><label for="description"><?php print esc_html__( 'Image', 'taxonomy-images' ) ?></label></th> 
    743743        <td> 
    744744            <?php print taxonomy_image_plugin_control_image( $term->term_id, $taxonomy->name ); ?> 
    745745            <div class="clear"></div> 
    746             <span class="description"><?php printf( __( 'Associate an image from your media library to this %1$s.', 'taxonomy-images' ), $name ); ?></span> 
     746            <span class="description"><?php printf( esc_html__( 'Associate an image from your media library to this %1$s.', 'taxonomy-images' ), esc_html( $name ) ); ?></span> 
    747747        </td> 
    748748    </tr> 
     
    770770    $taxonomy = get_taxonomy( $taxonomy ); 
    771771 
    772     $name = __( 'term', 'taxonomy-images' ); 
     772    $name = esc_html__( 'term', 'taxonomy-images' ); 
    773773    if ( isset( $taxonomy->labels->singular_name ) ) { 
    774774        $name = strtolower( $taxonomy->labels->singular_name ); 
     
    788788 
    789789    $o = "\n" . '<div id="' . esc_attr( 'taxonomy-image-control-' . $tt_id ) . '" class="taxonomy-image-control hide-if-no-js">'; 
    790     $o.= "\n" . '<a class="thickbox taxonomy-image-thumbnail" href="' . esc_url( admin_url( 'media-upload.php' ) . '?type=image&tab=library&post_id=0&TB_iframe=true' ) . '" title="' . sprintf( esc_attr__( 'Associate an image with the %1$s named &#8220;%2$s&#8221;.', 'taxonomy-images' ), $name, $term->name ) . '"><img id="' . esc_attr( 'taxonomy_image_plugin_' . $tt_id ) . '" src="' . esc_url( $img ) . '" alt="" /></a>'; 
    791     $o.= "\n" . '<a class="control upload thickbox" href="' . esc_url( admin_url( 'media-upload.php' ) . '?type=image&tab=type&post_id=0&TB_iframe=true' ) . '" title="' . sprintf( esc_attr__( 'Upload a new image for this %s.', 'taxonomy-images' ), $name ) . '">' . esc_html__( 'Upload.', 'taxonomy-images' ) . '</a>'; 
    792     $o.= "\n" . '<a class="control remove' . $hide . '" href="#" id="' . esc_attr( 'remove-' . $tt_id ) . '" rel="' . esc_attr( $tt_id ) . '" title="' . sprintf( esc_attr__( 'Remove image from this %s.', 'taxonomy-images' ), $name ) . '">' . esc_html__( 'Delete', 'taxonomy-images' ) . '</a>'; 
     790    $o.= "\n" . '<a class="thickbox taxonomy-image-thumbnail" href="' . esc_url( admin_url( 'media-upload.php' ) . '?type=image&tab=library&post_id=0&TB_iframe=true' ) . '" title="' . esc_attr( sprintf( __( 'Associate an image with the %1$s named &#8220;%2$s&#8221;.', 'taxonomy-images' ), $name, $term->name ) ) . '"><img id="' . esc_attr( 'taxonomy_image_plugin_' . $tt_id ) . '" src="' . esc_url( $img ) . '" alt="" /></a>'; 
     791    $o.= "\n" . '<a class="control upload thickbox" href="' . esc_url( admin_url( 'media-upload.php' ) . '?type=image&tab=type&post_id=0&TB_iframe=true' ) . '" title="' . esc_attr( sprintf( __( 'Upload a new image for this %s.', 'taxonomy-images' ), $name ) ) . '">' . esc_html__( 'Upload.', 'taxonomy-images' ) . '</a>'; 
     792    $o.= "\n" . '<a class="control remove' . $hide . '" href="#" id="' . esc_attr( 'remove-' . $tt_id ) . '" rel="' . esc_attr( $tt_id ) . '" title="' . esc_attr( sprintf( __( 'Remove image from this %s.', 'taxonomy-images' ), $name ) ) . '">' . esc_html__( 'Delete', 'taxonomy-images' ) . '</a>'; 
    793793    $o.= "\n" . '<input type="hidden" class="tt_id" name="' . esc_attr( 'tt_id-' . $tt_id ) . '" value="' . esc_attr( $tt_id ) . '" />'; 
    794794 
     
    819819        ); 
    820820    wp_localize_script( 'taxonomy-images-media-upload-popup', 'TaxonomyImagesModal', array ( 
    821         'termBefore'  => __( '&#8220;', 'taxonomy-images' ), 
    822         'termAfter'   => __( '&#8221;', 'taxonomy-images' ), 
    823         'associating' => __( 'Associating &#8230;', 'taxonomy-images' ), 
    824         'success'     => __( 'Successfully Associated', 'taxonomy-images' ), 
    825         'removing'    => __( 'Removing &#8230;', 'taxonomy-images' ), 
    826         'removed'     => __( 'Successfully Removed', 'taxonomy-images' ) 
     821        'termBefore'  => esc_html__( '&#8220;', 'taxonomy-images' ), 
     822        'termAfter'   => esc_html__( '&#8221;', 'taxonomy-images' ), 
     823        'associating' => esc_html__( 'Associating &#8230;', 'taxonomy-images' ), 
     824        'success'     => esc_html__( 'Successfully Associated', 'taxonomy-images' ), 
     825        'removing'    => esc_html__( 'Removing &#8230;', 'taxonomy-images' ), 
     826        'removed'     => esc_html__( 'Successfully Removed', 'taxonomy-images' ) 
    827827        ) ); 
    828828} 
     
    11191119 */ 
    11201120function taxonomy_image_plugin_please_use_filter( $function, $filter ) { 
    1121     trigger_error( sprintf( esc_html( 'The %1$s has been called directly. Please use the %2$s filter instead.' ), 
     1121    trigger_error( sprintf( esc_html__( 'The %1$s has been called directly. Please use the %2$s filter instead.', 'taxonomy-images' ), 
    11221122    '<code>' . esc_html( $function . '()' ) . '</code>', 
    11231123    '<code>' . esc_html( $filter ) . '</code>' 
     
    11731173function taxonomy_images_plugin_settings_page_link( $link_text = '' ) { 
    11741174    if ( empty( $link_text ) ) { 
    1175         $link_text = esc_html__( 'Manage Settings', 'taxonomy-images' ); 
     1175        $link_text = __( 'Manage Settings', 'taxonomy-images' ); 
    11761176    } 
    11771177 
    11781178    $link = ''; 
    11791179    if ( current_user_can( 'manage_options' ) ) { 
    1180         $link = '<a href="' . esc_url( add_query_arg( array( 'page' => 'taxonomy_image_plugin_settings' ), admin_url( 'options-general.php' ) ) ) . '">' . $link_text . '</a>'; 
     1180        $link = '<a href="' . esc_url( add_query_arg( array( 'page' => 'taxonomy_image_plugin_settings' ), admin_url( 'options-general.php' ) ) ) . '">' . esc_html( $link_text ) . '</a>'; 
    11811181    } 
    11821182 
Note: See TracChangeset for help on using the changeset viewer.