PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.9
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.9
7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / inc / providers / gutenberg / blocks / block-popup-trigger.php
wordpress-popup / inc / providers / gutenberg / blocks Last commit date
block-embeds.php 3 years ago block-popup-trigger.php 3 years ago block-slidein-trigger.php 3 years ago block-social-share.php 3 years ago block-unsubscribe.php 3 years ago
block-popup-trigger.php
118 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Hustle_GHBlock_Popup_Trigger class
4 *
5 * @package Hustle
6 */
7
8 /**
9 * Class Hustle_GHBlock_Popup_Trigger
10 *
11 * @since 1.0 Gutenberg Addon
12 */
13 class Hustle_GHBlock_Popup_Trigger extends Hustle_GHBlock_Abstract {
14
15 /**
16 * Block identifier
17 *
18 * @since 1.0 Gutenberg Addon
19 *
20 * @var string
21 */
22 protected $slug = 'popup-trigger';
23
24 /**
25 * Hustle_GHBlock_Popup_Trigger constructor.
26 *
27 * @since 1.0 Gutenberg Addon
28 */
29 public function __construct() {
30 // Initialize block.
31 $this->init();
32 }
33
34 /**
35 * Render block markup on front-end
36 *
37 * @since 1.0 Gutenberg Addon
38 * @param array $properties Block properties.
39 *
40 * @return string
41 */
42 public function render_block( $properties = array() ) {
43
44 $content = isset( $properties['content'] ) ? $properties['content'] : __( 'Click here', 'hustle' );
45 $css_class = isset( $properties['css_class'] ) ? $properties['css_class'] : '';
46
47 if ( isset( $properties['id'] ) ) {
48 return '[wd_hustle id="' . esc_attr( $properties['id'] ) . '" type="popup" css_class="' . esc_attr( $css_class ) . '"]' . $content . '[/wd_hustle]';
49 }
50 }
51
52 /**
53 * Enqueue assets ( scritps / styles )
54 * Should be overriden in block class
55 *
56 * @since 1.0 Gutenberg Addon
57 */
58 public function load_assets() {
59 // Scripts.
60 wp_enqueue_script(
61 'hustle-block-popup-trigger',
62 Hustle_Gutenberg::get_plugin_url() . '/js/popup-trigger-block.min.js',
63 array( 'wp-blocks', 'wp-i18n', 'wp-element' ),
64 filemtime( Hustle_Gutenberg::get_plugin_dir() . '/js/popup-trigger-block.min.js' ),
65 true
66 );
67
68 // Localize scripts.
69 wp_localize_script(
70 'hustle-block-popup-trigger',
71 'hustle_popup_trigger_data',
72 array(
73 'wizard_page' => Hustle_Data::POPUP_WIZARD_PAGE,
74 'modules' => $this->get_modules(),
75 'admin_url' => admin_url( 'admin.php' ),
76 'nonce' => wp_create_nonce( 'hustle_gutenberg_get_module' ),
77 'shortcode_tag' => Hustle_Module_Front::SHORTCODE,
78 'text_domain' => 'hustle',
79 'l10n' => $this->localize(),
80 )
81 );
82 }
83
84 /**
85 * Get modules
86 *
87 * @return array
88 */
89 public function get_modules() {
90 $module_list = $this->get_modules_by_type( 'popup' );
91 return $module_list;
92 }
93
94 /**
95 * Get texts for localize
96 *
97 * @return array
98 */
99 private function localize() {
100 return array(
101 'module' => esc_html__( 'Module', 'hustle' ),
102 'additional_css_classes' => esc_html__( 'Additional CSS Classes', 'hustle' ),
103 'click_here' => esc_html__( 'Click here', 'hustle' ),
104 'content_here' => esc_html__( 'Add the clickable text that will trigger the module.', 'hustle' ),
105 'advanced' => esc_html__( 'Advanced', 'hustle' ),
106 'trigger_content' => esc_html__( 'Trigger Content', 'hustle' ),
107 'name' => esc_html__( 'Name', 'hustle' ),
108 'customize_module' => esc_html__( 'Customize Popup', 'hustle' ),
109 'rendering' => esc_html__( 'Rendering...', 'hustle' ), // Unused.
110 'block_name' => esc_html__( 'Popup Trigger', 'hustle' ),
111 'block_description' => esc_html__( 'Embed the trigger button for a popup module.', 'hustle' ),
112 'block_more_description' => esc_html__( 'Note: the Trigger property of the Popup should be set to Click to embed the trigger button for the module.', 'hustle' ),
113 );
114 }
115 }
116
117 new Hustle_GHBlock_Popup_Trigger();
118