PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / trunk
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster vtrunk
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 1.8.1 All 42 releases
sellkit / includes / elementor / modules / dynamic-keywords / module.php

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

105 lines 3.1 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 $( '.sellkit-popup-box' ).removeClass( 'sellkit-popup-dark-theme sellkit-popup-light-theme sellkit-popup-auto-theme' );
45
46 var uiTheme = elementor.settings.editorPreferences.model.get( 'ui_theme' );
47
48 $( '.sellkit-popup-box' ).addClass( `sellkit-popup-${uiTheme}-theme` );
49
50 e.stopPropagation();
51 } );
52
53 $( '.sellkit-close-button' ).on( 'click', function() {
54 $( '.sellkit-popup-box' ).removeClass( 'sellkit-popup-active' );
55 } );
56
57 $( document ).on( 'click', function( e ) {
58 if ( ! $( e.target ).closest( '.sellkit-popup-list' ).length ) {
59 $( '.sellkit-popup-box' ).removeClass( 'sellkit-popup-active' );
60 }
61 });
62
63 $( '.sellkit-popup-box button' ).on( 'click', function() {
64 var inputeId = $( this ).attr( 'value' );
65 var copyText = document.getElementById( inputeId );
66 copyText.select();
67 copyText.setSelectionRange( 0, 99999 );
68 document.execCommand( "copy" );
69 } );
70 } );
71
72 } )( jQuery );
73 </script>
74 <?php
75 }
76
77 /**
78 * Add supported widgets.
79 *
80 * @return array
81 */
82 public function sellkit_get_merge_tags_supported_widgets() {
83 return [ 'heading', 'text-editor', 'google_maps', 'raven-heading', 'sellkit-order-details' ];
84 }
85
86 /**
87 * Include modal file.
88 *
89 * @since 1.1.0
90 */
91 public function insert_modal_file_to_footer() {
92 include_once 'template/modal.php';
93 }
94
95 /**
96 * Include tags file.
97 *
98 * @since 1.1.0
99 */
100 public function insert_tags_file() {
101 include_once 'tags-list/tags.php';
102 }
103
104 }
105