PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.2.1
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.2.1
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / elementor / modules / dynamic-keywords / module.php

module.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.2.1, at includes/elementor/modules/dynamic-keywords/module.php

99 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || die();
4
5 class Sellkit_Elementor_Dynamic_Keywords_Module extends Sellkit_Elementor_Base_Module {
6 public function __construct() {
7 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'insert_modal_file_to_footer' ] );
8 add_action( 'elementor/editor/init', array( $this, 'sellkit_register_widget_message' ) );
9
10 $this->insert_tags_file();
11 }
12
13 /**
14 * Get page template fiter callback for elementor preview mode
15 *
16 * @return string
17 */
18 public function sellkit_register_widget_message() {
19 add_action( 'wp_footer', [ $this, 'sellkit_print_inline_script' ], 9999 );
20 }
21
22 //Add note to top of element.
23 public function sellkit_print_inline_script() {
24
25 ?>
26 <script>
27 ( function ( $ ) {
28 "use strict";
29
30 var sellkitSupportWidgets =<?php echo wp_json_encode( $this->sellkit_get_merge_tags_supported_widgets() ); ?>;
31
32 elementor.hooks.addAction('panel/open_editor/widget', function ( panel, model, view ) {
33 if ( sellkitSupportWidgets.indexOf( model.get( 'widgetType') ) === -1 ) {
34 return;
35 }
36
37 var html = '<div class="sellkit-customize-note">' +
38 '<div class="elementor-panel-alert elementor-panel-alert-info"><?php esc_html_e( 'You can also add personalization tags to this element using shortcodes. ', 'sellkit' ); ?><a style="text-decoration: underline;" href="javascript:void(0)"><?php esc_html_e( 'Click here to show the available shortcodes', 'sellkit' ); ?></a></div>'
39 '</div>';
40 $ ( '.elementor-panel-navigation' ).eq( 0 ).after( html );
41
42 $( '.sellkit-customize-note a' ).on( 'click', function( e ) {
43 $( '.sellkit-popup-box' ).addClass( 'sellkit-popup-active' );
44 e.stopPropagation();
45 } );
46
47 $( '.sellkit-close-button' ).on( 'click', function() {
48 $( '.sellkit-popup-box' ).removeClass( 'sellkit-popup-active' );
49 } );
50
51 $( document ).on( 'click', function( e ) {
52 if ( ! $( e.target ).closest( '.sellkit-popup-list' ).length ) {
53 $( '.sellkit-popup-box' ).removeClass( 'sellkit-popup-active' );
54 }
55 });
56
57 $( '.sellkit-popup-box button' ).on( 'click', function() {
58 var inputeId = $( this ).attr( 'value' );
59 var copyText = document.getElementById( inputeId );
60 copyText.select();
61 copyText.setSelectionRange( 0, 99999 );
62 document.execCommand( "copy" );
63 } );
64 } );
65
66 } )( jQuery );
67 </script>
68 <?php
69 }
70
71 /**
72 * Add supported widgets.
73 *
74 * @return array
75 */
76 public function sellkit_get_merge_tags_supported_widgets() {
77 return [ 'heading', 'text-editor', 'google_maps', 'raven-heading', 'sellkit-order-details' ];
78 }
79
80 /**
81 * Include modal file.
82 *
83 * @since 1.1.0
84 */
85 public function insert_modal_file_to_footer() {
86 include_once 'template/modal.php';
87 }
88
89 /**
90 * Include tags file.
91 *
92 * @since 1.1.0
93 */
94 public function insert_tags_file() {
95 include_once 'tags-list/tags.php';
96 }
97
98 }
99