PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.9
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.9
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 / hustle-module-widget.php
wordpress-popup / inc Last commit date
display-conditions 3 years ago front 9 months ago helpers 9 months ago metas 3 years ago multisite 3 years ago palettes 3 years ago provider 3 years ago providers 9 months ago templates 3 years ago update 3 years ago class-hustle-admin-page-abstract.php 9 months ago class-hustle-black-friday-campaign.php 7 months ago class-hustle-condition-factory.php 6 years ago class-hustle-cross-sell.php 9 months ago class-hustle-dashboard-admin.php 3 years ago class-hustle-data.php 3 years ago class-hustle-db.php 2 years ago class-hustle-installer.php 4 years ago class-hustle-meta.php 3 years ago class-hustle-module-admin.php 9 months ago class-hustle-module-collection.php 3 years ago class-hustle-module-page-abstract.php 2 years ago class-hustle-notifications.php 3 years ago class-hustle-settings-admin.php 3 years ago class-hustle-tutorials-page.php 4 years ago class-hustle-wp-dashboard-page.php 3 years ago hustle-deletion.php 3 years ago hustle-embedded-admin.php 3 years ago hustle-entries-admin.php 3 years ago hustle-entry-model.php 3 years ago hustle-general-data-protection.php 3 years ago hustle-init.php 7 months ago hustle-mail.php 3 years ago hustle-migration.php 3 years ago hustle-model.php 3 years ago hustle-module-model.php 9 months ago hustle-module-widget-legacy.php 3 years ago hustle-module-widget.php 3 years ago hustle-modules-common-admin-ajax.php 9 months ago hustle-popup-admin.php 3 years ago hustle-providers-admin.php 3 years ago hustle-providers.php 3 years ago hustle-settings-admin-ajax.php 3 years ago hustle-settings-page.php 3 years ago hustle-slidein-admin.php 3 years ago hustle-sshare-admin.php 3 years ago hustle-sshare-model.php 3 years ago hustle-tracking-model.php 3 years ago opt-in-geo.php 9 months ago opt-in-utils.php 3 years ago opt-in-wpmudev-api.php 3 years ago
hustle-module-widget.php
126 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Hustle_Module_Widget
4 *
5 * @package Hustle
6 */
7
8 /**
9 * Class Hustle_Module_Widget
10 */
11 class Hustle_Module_Widget extends WP_Widget {
12
13 /**
14 * Widget Id
15 *
16 * @var string
17 */
18 const WIDGET_ID = 'hustle_module_widget';
19
20
21 /**
22 * Registers the widget
23 */
24 public function __construct() {
25 parent::__construct(
26 self::WIDGET_ID,
27 Opt_In_Utils::get_plugin_name(),
28 /* translators: Plugin name */
29 array( 'description' => sprintf( __( 'A widget to add %s Embeds and Social Sharing.', 'hustle' ), Opt_In_Utils::get_plugin_name() ) )
30 );
31 }
32
33
34
35 /**
36 *
37 * Front-end display of widget.
38 *
39 * @param array $args Args.
40 * @param array $instance Previously saved values from database.
41 * @return string
42 */
43 public function widget( $args, $instance ) {
44 if ( ! empty( $instance['module_id'] ) ) {
45 $module = Hustle_Module_Collection::instance()->return_model_from_id( $instance['module_id'] );
46
47 if ( is_wp_error( $module ) || ! $module || empty( $module->active ) || ! $module->is_display_type_active( Hustle_Module_Model::WIDGET_MODULE ) ) {
48 return;
49 }
50 }
51
52 echo wp_kses_post( $args['before_widget'] );
53
54 if ( ! empty( $instance['title'] ) ) {
55 echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'] );
56 }
57
58 if ( ! empty( $instance['module_id'] ) ) {
59 $custom_classes = apply_filters( 'hustle_widget_module_custom_classes', '', $module );
60 echo $module->display( Hustle_Module_Model::WIDGET_MODULE, $custom_classes ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
61 } else {
62 esc_attr_e( 'Select Module', 'hustle' );
63 }
64
65 echo wp_kses_post( $args['after_widget'] );
66 }
67
68
69 /**
70 *
71 * Back-end widget form.
72 *
73 * @see WP_Widget::form()
74 * @param array $instance Previously saved values from database.
75 *
76 * @return void
77 */
78 public function form( $instance ) {
79 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'New title', 'hustle' );
80 if ( empty( $instance['module_id'] ) ) {
81 $instance['module_id'] = -1; }
82 ?>
83 <p>
84 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_attr__( 'Title:', 'hustle' ); ?></label>
85 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
86 </p>
87 <p>
88 <label for="<?php echo esc_attr( $this->get_field_id( 'module_id' ) ); ?>"><?php echo esc_attr__( 'Select Module:', 'hustle' ); ?></label>
89 <select name="<?php echo esc_attr( $this->get_field_name( 'module_id' ) ); ?>" id="hustle_module_id">
90 <option value=""><?php echo esc_attr__( 'Select Module', 'hustle' ); ?></option>
91 <?php
92 $types = array( 'embedded', 'social_sharing' );
93 foreach ( Hustle_Module_Collection::instance()->get_embed_id_names( $types ) as $mod ) :
94 $module = new Hustle_Module_Model( $mod->module_id );
95 if ( is_wp_error( $module ) ) {
96 continue;
97 }
98 ?>
99 <option <?php selected( $instance['module_id'], $mod->module_id ); ?> value="<?php echo esc_attr( $mod->module_id ); ?>"><?php echo esc_attr( $mod->module_name ); ?></option>
100
101 <?php endforeach; ?>
102 </select>
103 </p>
104 <?php
105 }
106
107
108 /**
109 * Sanitize widget form values as they are saved.
110 *
111 * @see WP_Widget::update()
112 *
113 * @param array $new_instance Values just sent to be saved.
114 * @param array $old_instance Previously saved values from database.
115 *
116 * @return array Updated safe values to be saved.
117 */
118 public function update( $new_instance, $old_instance ) {
119 $instance = array();
120 $instance['title'] = ! empty( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
121 $instance['module_id'] = ! empty( $new_instance['module_id'] ) ? wp_strip_all_tags( $new_instance['module_id'] ) : '';
122
123 return $instance;
124 }
125 }
126