| @@ -1,53 +1,47 @@ | ||
| 1 | 1 | <?php |
| 2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 3 | 3 | |
| 4 | -$disabled_attr = disabled( true, $data['checkbox_selected'], false ); | |
| 5 | 4 | $disabled_class = $data['checkbox_selected'] ? ' disabled' : ''; |
| 6 | -$folder_icon = '<svg width="20px" height="17px" viewBox="0 0 20 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-608.000000, -318.000000)" stroke-linecap="round" stroke-linejoin="round"><g transform="translate(609.000000, 319.000000)" stroke="#000000" stroke-width="2"><path d="M0,14.1428571 L18,14.1428571 L18,1.92857143 L7.71428571,1.92857143 L5.14285714,0 L0,0 L0,14.1428571 Z M18,5.14285714 L0,5.14285714 L18,5.14285714 Z"></path></g></g></svg>'; | |
| 5 | + | |
| 6 | +if ( $data['checkbox_selected'] ) { | |
| 7 | + // translators: %s is a folder path. | |
| 8 | + $button_title = sprintf( esc_attr__( 'The folder "%s" is already selected.', 'imagify' ), $data['relative_path'] ); | |
| 9 | + // translators: %s is a folder path. | |
| 10 | + $folder_title = sprintf( esc_attr__( 'The folder "%s" is already selected.', 'imagify' ), $data['relative_path'] ); | |
| 11 | +} else { | |
| 12 | + // translators: %s is a folder path. | |
| 13 | + $button_title = sprintf( esc_attr__( 'Open/Close the folder "%s".', 'imagify' ), $data['relative_path'] ); | |
| 14 | + // translators: %s is a folder path. | |
| 15 | + $folder_title = sprintf( esc_attr__( 'Select the folder "%s".', 'imagify' ), $data['relative_path'] ); | |
| 16 | +} | |
| 7 | 17 | ?> |
| 8 | 18 | |
| 9 | -<li<?php echo $data['checkbox_selected'] ? ' class="imagify-folder-already-selected"' : ''; ?>> | |
| 19 | +<li <?php echo $data['checkbox_selected'] ? ' class="imagify-folder-already-selected"' : ''; ?>> | |
| 10 | 20 | <?php if ( empty( $data['no_button'] ) ) : ?> |
| 11 | - <button type="button" class="imagify-folder" data-folder="<?php echo $data['relative_path']; ?>"<?php echo $disabled_attr; ?> title="<?php | |
| 12 | - if ( $data['checkbox_selected'] ) { | |
| 13 | - /* translators: %s is a folder path. */ | |
| 14 | - printf( esc_attr__( 'The folder "%s" is already selected.', 'imagify' ), $data['relative_path'] ); | |
| 15 | - } else { | |
| 16 | - /* translators: %s is a folder path. */ | |
| 17 | - printf( esc_attr__( 'Open/Close the folder "%s".', 'imagify' ), $data['relative_path'] ); | |
| 18 | - } | |
| 19 | - ?>"> | |
| 21 | + <button type="button" class="imagify-folder" data-folder="<?php echo esc_attr( $data['relative_path'] ); ?>"<?php disabled( true, $data['checkbox_selected'] ); ?> title="<?php echo esc_attr( $button_title ); ?>"> | |
| 20 | 22 | <?php if ( ! $data['checkbox_selected'] ) { ?> |
| 21 | 23 | <span class="imagify-loader"><img alt="<?php esc_attr_e( 'Loading...', 'imagify' ); ?>" src="<?php echo esc_url( IMAGIFY_ASSETS_IMG_URL . 'spinner.gif' ); ?>" width="20" height="20"/></span> |
| 22 | 24 | <?php } ?> |
| 23 | - <span class="imagify-folder-icon"><?php echo $folder_icon; ?></span> | |
| 25 | + <span class="imagify-folder-icon"><svg width="20px" height="17px" viewBox="0 0 20 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-608.000000, -318.000000)" stroke-linecap="round" stroke-linejoin="round"><g transform="translate(609.000000, 319.000000)" stroke="#000000" stroke-width="2"><path d="M0,14.1428571 L18,14.1428571 L18,1.92857143 L7.71428571,1.92857143 L5.14285714,0 L0,0 L0,14.1428571 Z M18,5.14285714 L0,5.14285714 L18,5.14285714 Z"></path></g></g></svg></span> | |
| 24 | 26 | </button> |
| 25 | 27 | <?php else : ?> |
| 26 | - <span class="imagify-folder<?php echo $disabled_class; ?>"> | |
| 27 | - <span class="imagify-folder-icon"><?php echo $folder_icon; ?></span> | |
| 28 | + <span class="imagify-folder<?php echo esc_attr( $disabled_class ); ?>"> | |
| 29 | + <span class="imagify-folder-icon"><svg width="20px" height="17px" viewBox="0 0 20 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-608.000000, -318.000000)" stroke-linecap="round" stroke-linejoin="round"><g transform="translate(609.000000, 319.000000)" stroke="#000000" stroke-width="2"><path d="M0,14.1428571 L18,14.1428571 L18,1.92857143 L7.71428571,1.92857143 L5.14285714,0 L0,0 L0,14.1428571 Z M18,5.14285714 L0,5.14285714 L18,5.14285714 Z"></path></g></g></svg></span> | |
| 28 | 30 | </span> |
| 29 | 31 | <?php endif; ?> |
| 30 | 32 | |
| 31 | - <input type="checkbox" name="imagify-custom-files[]" value="<?php echo $data['checkbox_value']; ?>" id="imagify-custom-folder-<?php echo $data['checkbox_id']; ?>" class="screen-reader-text"<?php echo $disabled_attr; ?>/> | |
| 33 | + <input type="checkbox" name="imagify-custom-files[]" value="<?php echo esc_attr( $data['checkbox_value'] ); ?>" id="imagify-custom-folder-<?php echo esc_attr( $data['checkbox_id'] ); ?>" class="screen-reader-text" <?php disabled( true, $data['checkbox_selected'] ); ?> /> | |
| 32 | 34 | |
| 33 | - <label for="imagify-custom-folder-<?php echo $data['checkbox_id']; ?>" title="<?php | |
| 34 | - if ( $data['checkbox_selected'] ) { | |
| 35 | - /* translators: %s is a folder path. */ | |
| 36 | - printf( esc_attr__( 'The folder "%s" is already selected.', 'imagify' ), $data['relative_path'] ); | |
| 37 | - } else { | |
| 38 | - /* translators: %s is a folder path. */ | |
| 39 | - printf( esc_attr__( 'Select the folder "%s".', 'imagify' ), $data['relative_path'] ); | |
| 40 | - } | |
| 41 | - ?>"> | |
| 35 | + <label for="imagify-custom-folder-<?php echo esc_attr( $data['checkbox_id'] ); ?>" title="<?php echo esc_attr( $folder_title ); ?>"> | |
| 42 | 36 | <?php echo esc_html( $data['label'] ); ?> |
| 43 | 37 | |
| 44 | 38 | <span class="imagify-add-ed-folder"> |
| 45 | 39 | <?php |
| 46 | 40 | if ( $data['checkbox_selected'] ) { |
| 47 | - _e( 'Folder Added', 'imagify' ); | |
| 41 | + esc_html_e( 'Folder Added', 'imagify' ); | |
| 48 | 42 | } else { |
| 49 | - _ex( 'Add Folder', 'checkbox label', 'imagify' ); | |
| 43 | + echo esc_html_x( 'Add Folder', 'checkbox label', 'imagify' ); | |
| 50 | 44 | } |
| 51 | 45 | ?> |
| 52 | 46 | <span class="imagify-fake-checkbox"></span> |
| 53 | 47 | </span> |