PluginProbe
Image Optimization – Compress Images and Convert to WebP or AVIF / 1.6.6
Image Optimization – Compress Images and Convert to WebP or AVIF v1.6.6
1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 All 32 releases
image-optimization / modules / oauth / components / connect-pointer.php

connect-pointer.php in Image Optimization – Compress Images and Convert to WebP or AVIF 1.6.6, at modules/oauth/components/connect-pointer.php

65 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImageOptimization\Modules\Oauth\Components;
4
5 use ImageOptimization\Modules\Core\Components\Pointers;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 class Connect_Pointer {
12 const CURRENT_POINTER_SLUG = 'image-optimization-auth-connect';
13
14 public function admin_print_script() {
15 if ( Connect::is_connected() ) {
16 return;
17 }
18
19 wp_enqueue_script( 'wp-pointer' );
20 wp_enqueue_style( 'wp-pointer' );
21
22 $pointer_content = '<h3>' . esc_html__( 'Start by connecting your license', 'image-optimization' ) . '</h3>';
23 $pointer_content .= '<p>' . esc_html__( 'You’re one click away from improving your site’s performance dramatically!', 'image-optimization' ) . '</p>';
24 ?>
25 <script>
26 jQuery( document ).ready( function( $ ) {
27 console.log( $( '.image-optimization-stats-connect-button' ) );
28
29 const intervalId = setInterval( () => {
30 if ( ! $( '.image-optimization-stats-connect-button' ).length ) {
31 return;
32 }
33
34 clearInterval(intervalId);
35
36 $( '.image-optimization-stats-connect-button' ).first().pointer( {
37 content: '<?php echo $pointer_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>',
38 pointerClass: 'image-optimization-auth-connect-pointer',
39 position: {
40 edge: 'top',
41 align: <?php echo is_rtl() ? "'left'" : "'right'"; ?>,
42 },
43 } ).pointer( 'open' );
44 }, 100 );
45 } );
46 </script>
47
48 <style>
49 .image-optimization-auth-connect-pointer .wp-pointer-arrow {
50 inset-block-start: 4px;
51 inset-inline-start: 78%;
52 }
53
54 .image-optimization-auth-connect-pointer .wp-pointer-arrow-inner {
55 inset-block-start: 10px;
56 }
57 </style>
58 <?php
59 }
60
61 public function __construct() {
62 add_action( 'in_admin_header', [ $this, 'admin_print_script' ] );
63 }
64 }
65