Plugin Directory

Changeset 2955592


Ignore:
Timestamp:
08/19/2023 04:10:02 AM (3 years ago)
Author:
simon_tw
Message:

Update form UI

Location:
wp-line-notify/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-line-notify/trunk/includes/page-setup.php

    r2954624 r2955592  
    182182    if(isset($test_send)) echo $test_send;
    183183    ?>
    184     <form id="sig_line_notify_test" action="<?php echo admin_url('admin-ajax.php?action=sig_line_notify_test')?>" method="post">
     184    <form id="sig_line_notify_test" action="<?php echo esc_url( admin_url('admin-ajax.php?action=sig_line_notify_test')); ?>" method="post">
    185185        <?php wp_nonce_field( 'sig_line_notify_test_nonce' ); ?>
    186186        <table class="form-table">
     
    209209                <textarea name="line_notify_content_test" style="width: 400px; height: 100px; "></textarea>
    210210                <div id="line_notify_result_test"></div>
     211                <?php submit_button( __( 'Send test' , 'wp-line-notify' ), 'primary', '', true, 'id=submit_test'); ?>
    211212            </td>
    212213        </tr>
    213214        </table>
    214         <?php submit_button(__( 'Send test' , 'wp-line-notify' )); ?>
     215
    215216    </form>
    216217</div>
     
    221222    $('#user-id').on('change',function(){
    222223        var uid = $(this).val();
    223         location.href = '<?php echo admin_url('options-general.php?page=sig-wp-line-notify&uid=')?>'+uid;
     224        location.href = '<?php echo esc_url( admin_url('options-general.php?page=sig-wp-line-notify&uid=') ); ?>'+uid;
    224225    });
    225226
     
    229230
    230231    $('#sig_line_notify_test').submit(function(){
    231         $.post( '<?php echo admin_url('admin-ajax.php?action=sig_line_notify_test')?>', $('#sig_line_notify_test').serialize() )
     232        $('#submit_test').prop('disabled', true);
     233        $.post( '<?php echo esc_url( admin_url('admin-ajax.php?action=sig_line_notify_test') ); ?>', $('#sig_line_notify_test').serialize() )
    232234        .fail(function(jqXHR, textStatus) {
    233235            errText = jqXHR.responseText;
    234             alert( 'Error.' + errText.replace(/<[^>]+>/g, '') );
     236            $('#line_notify_result_test').text('Error: ' + errText.replace(/<[^>]+>/g, ''));
     237            $('#submit_test').prop('disabled', false);
    235238        })
    236239        .done(function( data ) {
    237240            $('#line_notify_result_test').text(data);
     241            $('#submit_test').prop('disabled', false);
    238242        });
    239243        return false;
    240244    });
    241245
    242     $('#btn-revoke').click(function(){
    243         if(confirm("<?php _e( 'Are you sure to revoke notification configurations?' , 'wp-line-notify' ) ?>")){
    244             $.getJSON("<?php echo $revoke_url;?>", function(result){
    245                 alert(result.message);
    246                 if(result.rs) window.location.reload();
    247             });
    248         }else{
    249             return false;
    250         }
    251     });
    252246});
    253247</script>
  • wp-line-notify/trunk/readme.txt

    r2954624 r2955592  
    55Tested up to: 6.3
    66Requires PHP: 7.4
    7 Stable tag: 1.4.3
     7Stable tag: 1.4.4
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3232
    3333== Changelog ==
     34
     35= 1.4.4 - 2023-08-19 =
     36* Update: Form UI.
     37* Improved: Remove revoke function.
    3438
    3539= 1.4.3 - 2023-08-17 =
  • wp-line-notify/trunk/wp-line-notify.php

    r2954624 r2955592  
    33 * Plugin Name: WordPress LINE Notify
    44 * Description: This plugin can send a alert message by LINE Notify
    5  * Version:     1.4.3
     5 * Version:     1.4.4
    66 * Author:      Simon Chuang
    77 * Author URI:  https://github.com/mark2me/wp-line-notify
     
    2828    private $plugin_name = '';
    2929
    30     private $revoke_url = 'admin-ajax.php?action=sig_line_notify_revoke';
    31 
    3230    public $option;
    3331
     
    9492            add_action( 'elementor_pro/forms/actions/register', array( $this, 'register_new_form_actions') );
    9593        }
    96 
    97         // revoke
    98         add_action( 'wp_ajax_sig_line_notify_revoke', function(){
    99             $line = new sig_line_notify( $this->option['token'] );
    100             return $line->revoke();
    101         });
    10294
    10395        // test token
     
    135127
    136128    public function html_settings_page() {
    137 
    138         $revoke_url = admin_url($this->revoke_url);
    139129
    140130        $option_name = $this->current_user_option_name();
     
    505495        check_admin_referer('sig_line_notify_test_nonce');
    506496
    507         $message = ( !empty($_POST['line_notify_content_test']) ) ? sanitize_textarea_field( $_POST['line_notify_content_test'] ) : __( 'This is a Line notify plugin test.' , 'wp-line-notify' );
     497        $message = sanitize_textarea_field( $_POST['line_notify_content_test'] );
     498        if( empty($message) ) $message = __( 'This is a Line notify plugin test.' , 'wp-line-notify' );
    508499
    509500        $uid = $_POST['line_notify_uid_test'];
     
    524515                $rs_msg = __( 'Send test ok!' , 'wp-line-notify' );
    525516            } else {
    526                 $rs_msg = sprintf('%1s, message: %2s', __( 'Error on send LINE Notify.' , 'wp-line-notify' ), $rs );
    527             }
    528 
    529         }
    530 
    531         wp_die($rs_msg);
     517                $rs_msg = sprintf('%1s, message: %2s', __( 'Error on send LINE Notify.' , 'wp-line-notify' ), sanitize_text_field($rs) );
     518            }
     519
     520        }
     521
     522        wp_die( $rs_msg );
    532523    }
    533524
Note: See TracChangeset for help on using the changeset viewer.