diff --git a/admin/actions.php b/admin/actions.php new file mode 100644 index 0000000..9763032 --- /dev/null +++ b/admin/actions.php @@ -0,0 +1,49 @@ + 1 ) ); + } else { + wp_nonce_ays( '' ); + } + } + + if ( '__rocket_lazyload_imagify_notice' === $args['box'] ) { + update_option( 'rocket_lazyload_dismiss_imagify_notice', 0 ); + } + + global $current_user; + $actual = get_user_meta( $current_user->ID, 'rocket_lazyload_boxes', true ); + $actual = array_merge( (array) $actual, array( $args['box'] ) ); + $actual = array_filter( $actual ); + $actual = array_unique( $actual ); + update_user_meta( $current_user->ID, 'rocket_lazyload_boxes', $actual ); + delete_transient( $args['box'] ); + + if ( 'admin-post.php' === $GLOBALS['pagenow'] ) { + if ( defined( 'DOING_AJAX' ) ) { + wp_send_json( array( 'error' => 0 ) ); + } else { + wp_safe_redirect( wp_get_referer() ); + die(); + } + } + } +} +add_action( 'wp_ajax_rocket_lazyload_ignore', 'rocket_lazyload_dismiss_boxes' ); +add_action( 'admin_post_rocket_lazyload_ignore', 'rocket_lazyload_dismiss_boxes' ); diff --git a/admin/admin.php b/admin/admin.php index 7878c54..807395d 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -8,7 +8,7 @@ * @return void */ function rocket_lazyload_add_menu() { - add_options_page( __( 'Rocket LazyLoad', 'rocket-lazy-load' ), __( 'Rocket LazyLoad', 'rocket-lazy-load' ), 'manage_options', 'rocket-lazyload', 'rocket_lazyload_options_output' ); + add_options_page( __( 'LazyLoad by WP Rocket', 'rocket-lazy-load' ), __( 'LazyLoad', 'rocket-lazy-load' ), 'manage_options', 'rocket-lazyload', 'rocket_lazyload_options_output' ); } add_action( 'admin_menu', 'rocket_lazyload_add_menu' ); @@ -70,6 +70,7 @@ function rocket_lazyload_options_output() { ?>