PluginProbe
Polylang / 2.3
Polylang v2.3
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/pointer.php +12 -15 2.72.3 View file →
@@ -1,21 +1,20 @@
1 1 <?php
2 2
3 3 /**
4 - * A class to manage WP pointers
4 + * a class to manage WP pointers
5 5 * offers the possibility to have customized buttons
6 6 *
7 7 * @since 1.7.7
8 - * @deprecated 2.3.9
9 8 */
10 9 class PLL_Pointer {
11 10 protected $args;
12 11
13 12 /**
14 - * Constructor
13 + * constructor
15 14 * enqueues the pointer script
16 15 *
17 - * List of parameters accepted in $args:
16 + * list of parameters accepted in $args:
18 17 *
19 18 * pointer => required, unique identifier of the pointer
20 19 * id => required, the pointer will be attached to this html id
21 20 * position => optional array, if used both sub parameters are required
@@ -32,16 +31,14 @@
32 31 *
33 32 * @param array $args
34 33 */
35 34 public function __construct( $args ) {
36 - trigger_error( 'The class PLL_Pointer has been deprecated since Polylang 2.3.9 and will be removed in a future version.', E_USER_ERROR ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions
37 -
38 35 $this->args = $args;
39 36 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
40 37 }
41 38
42 39 /**
43 - * Enqueue javascripts and styles if the pointer has not been dismissed
40 + * enqueue javascripts and styles if the pointer has not been dismissed
44 41 *
45 42 * @since 1.7.7
46 43 */
47 44 public function enqueue_scripts() {
@@ -57,15 +54,15 @@
57 54 wp_enqueue_script( 'wp-pointer' );
58 55 }
59 56
60 57 /**
61 - * Adds the javascript of our pointer to the page
58 + * adds the javascript of our pointer to the page
62 59 *
63 60 * @since 1.7.7
64 61 */
65 62 public function print_js() {
66 63
67 - // Add optional buttons
64 + // add optional buttons
68 65 if ( ! empty( $this->args['buttons'] ) ) {
69 66 $b = "
70 67 var widget = pointer.pointer( 'widget' );
71 68 var buttons = $( '.wp-pointer-buttons', widget );
@@ -70,12 +67,12 @@
70 67 var widget = pointer.pointer( 'widget' );
71 68 var buttons = $( '.wp-pointer-buttons', widget );
72 69 $( 'a.close', widget ).remove();"; // removes the WP button
73 70
74 - // All the buttons use the standard WP ajax action to remember the pointer has been dismissed
71 + // all the buttons use the standard WP ajax action to remember the pointer has been dismissed
75 72 foreach ( $this->args['buttons'] as $button ) {
76 - $b .= sprintf(
77 - "$( '<a>' ).addClass( '%s' ).html( '%s' ).css( 'margin-left', '10px' ).click( function() {
73 + $b .= sprintf( "
74 + $( '<a>' ).addClass( '%s' ).html( '%s' ).css( 'margin-left', '10px' ).click( function() {
78 75 $.post( ajaxurl, {
79 76 pointer: '%s',
80 77 action: 'dismiss-wp-pointer'
81 78 }, function( response ) {
@@ -89,10 +86,10 @@
89 86 );
90 87 }
91 88 }
92 89
93 - $js = sprintf(
94 - "//<![CDATA[
90 + $js = sprintf( "
91 + //<![CDATA[
95 92 jQuery( document ).ready( function( $ ) {
96 93 var pointer = $( '#%s' ).pointer( {
97 94 content: '%s',
98 95 %s
@@ -107,7 +104,7 @@
107 104 empty( $this->args['position'] ) ? '' : sprintf( 'position: {edge: "%s", align: "%s",},', $this->args['position']['edge'], $this->args['position']['align'] ),
108 105 empty( $this->args['width'] ) ? '' : sprintf( 'pointerWidth: %d,', $this->args['width'] ),
109 106 empty( $b ) ? '' : $b
110 107 );
111 - echo '<script type="text/javascript">' . $js . '</script>'; // phpcs:ignore WordPress.Security.EscapeOutput
108 + echo '<script type="text/javascript">' . $js . '</script>';
112 109 }
113 110 }