PluginProbe ʕ •ᴥ•ʔ
Custom Sidebars – Dynamic Sidebar Classic Widget Area Manager / 3.32
Custom Sidebars – Dynamic Sidebar Classic Widget Area Manager v3.32
trunk 2.1.2.0 3.0.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3 3.31 3.32 3.35 3.36 3.37 3.38
custom-sidebars / inc / external / wpmu-lib / view / pointer.php
custom-sidebars / inc / external / wpmu-lib / view Last commit date
list.php 10 years ago pointer.php 7 years ago
pointer.php
113 lines
1 <?php
2 /**
3 * Code-snippet for WordPress pointers.
4 * Used in function lib3()->html->pointer()
5 *
6 * @since 1.0.0
7 *
8 * Variables:
9 * - $pointer_id
10 * - $html_el
11 * - $title
12 * - $body
13 * - $once
14 * - $modal
15 * - $blur
16 */
17
18 /**
19 * Filter pointer classes
20 *
21 * @since 3.1.0
22 */
23 $class = implode( ' ', apply_filters( 'wpmui_pointer_classes', $classes ) );
24 if ( ! empty( $title ) ) {
25 $title = '<h3>' . $title . '</h3>';
26 } else {
27 $title = '';
28 $class .= ' no-title';
29 }
30
31 $code = sprintf(
32 '<div class="%3$s">%1$s<p>%2$s</p></div>',
33 $title,
34 $body,
35 esc_attr( $class )
36 );
37
38 // Remove linebreaks to avoid JS errors
39 $code = str_replace( array( "\r", "\n" ), '', $code );
40
41 ?>
42 <script type="text/javascript">
43 jQuery(document).ready(function() {
44 var wpcontent = jQuery( '#wpbody' ),
45 body = jQuery( 'body' );
46
47 /**
48 * Avoid block editor
49 */
50 if ( body.hasClass( 'block-editor-page' ) ) {
51 return;
52 }
53 if ( jQuery().pointer !== undefined ) {
54 var target = jQuery( '<?php echo $html_el; ?>' );
55 if ( ! target.length ) { return; }
56 target = target.first();
57
58 <?php if ( $blur ) : ?>
59 wpcontent.addClass( 'wpmui-blur' );
60 <?php else : ?>
61 body.addClass( 'no-blur' );
62 <?php endif; ?>
63
64 <?php if ( $modal ) : ?>
65 var modal = wpmUi._make_modal( 'light' );
66 if ( undefined !== modal ) {
67 modal.on( 'click', function( ev ) {
68 target.pointer( 'close' );
69 });
70 } else {
71 wpmUi._close_modal();
72 }
73 <?php endif; ?>
74
75 // Insert the pointer HTML code
76 target.pointer({
77 content: '<?php echo $code; ?>',
78 position: {
79 edge: 'left',
80 align: 'center'
81 },
82 close: function() {
83 <?php if ( $blur ) : ?>
84 wpcontent.removeClass( 'wpmui-blur' );
85 <?php else : ?>
86 body.removeClass( 'no-blur' );
87 <?php endif; ?>
88
89 <?php if ( $modal ) : ?>
90 wpmUi._close_modal();
91 <?php endif; ?>
92
93 <?php if ( $once ) : ?>
94 jQuery.post( ajaxurl, {
95 pointer: '<?php echo esc_js( $pointer_id ) ?>',
96 action: 'dismiss-wp-pointer'
97 });
98 <?php endif; ?>
99 }
100 }).pointer('open');
101
102 // Modify the default pointer style
103 jQuery( '.wpmui-pointer-handler.prepared' ).each(function() {
104 var me = jQuery(this),
105 ptr = me.closest('.wp-pointer');
106 me.removeClass('prepared');
107 ptr.addClass( me.attr( 'class' ) );
108 me.removeClass('wpmui-pointer-handler');
109 });
110 }
111 });
112 </script>
113