Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions class-bjgk-genesis-enews-extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function __construct() {
'id' => '',
'email-field' => '',
'action' => '',
'onclick_text' => '',
);

$widget_ops = array(
Expand Down Expand Up @@ -109,15 +110,15 @@ function widget( $args, $instance ) {
<label for="subbox" class="screenread"><?php echo esc_attr( $instance['input_text'] ); ?></label><input type="<?php echo current_theme_supports( 'html5' ) ? 'email' : 'text'; ?>" value="<?php echo esc_attr( $instance['input_text'] ); ?>" id="subbox" onfocus="if ( this.value == '<?php echo esc_js( $instance['input_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['input_text'] ); ?>'; }" name="email" <?php if ( current_theme_supports( 'html5' ) ) : ?>required="required"<?php endif; ?> />
<input type="hidden" name="uri" value="<?php echo esc_attr( $instance['id'] ); ?>" />
<input type="hidden" name="loc" value="<?php echo esc_attr( get_locale() ); ?>" />
<input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" />
<input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" <?php if ( ! empty( $instance['onclick_text'] ) ) : ?>onClick="<?php echo esc_attr( $instance['onclick_text'] ); ?>"<?php endif; ?>/>
</form>
<?php elseif ( ! empty( $instance['action'] ) ) : ?>
<form id="subscribe" action="<?php echo esc_attr( $instance['action'] ); ?>" method="post" <?php if ($instance['open_same_window'] == 0 ) : ?> target="_blank"<?php endif; ?> onsubmit="if ( subbox1.value == '<?php echo esc_js( $instance['fname_text'] ); ?>') { subbox1.value = ''; } if ( subbox2.value == '<?php echo esc_js( $instance['lname_text'] ); ?>') { subbox2.value = ''; }" name="<?php echo esc_attr( $this->id ); ?>">
<?php if ( ! empty($instance['fname-field'] ) ) : ?><label for="subbox1" class="screenread"><?php echo esc_attr( $instance['fname_text'] ); ?></label><input type="text" id="subbox1" class="enews-subbox" value="<?php echo esc_attr( $instance['fname_text'] ); ?>" onfocus="if ( this.value == '<?php echo esc_js( $instance['fname_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['fname_text'] ); ?>'; }" name="<?php echo esc_attr( $instance['fname-field'] ); ?>" /><?php endif ?>
<?php if ( ! empty($instance['lname-field'] ) ) : ?><label for="subbox2" class="screenread"><?php echo esc_attr( $instance['lname_text'] ); ?></label><input type="text" id="subbox2" class="enews-subbox" value="<?php echo esc_attr( $instance['lname_text'] ); ?>" onfocus="if ( this.value == '<?php echo esc_js( $instance['lname_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['lname_text'] ); ?>'; }" name="<?php echo esc_attr( $instance['lname-field'] ); ?>" /><?php endif ?>
<label for="subbox" class="screenread"><?php echo esc_attr( $instance['input_text'] ); ?></label><input type="<?php echo current_theme_supports( 'html5' ) ? 'email' : 'text'; ?>" value="<?php echo esc_attr( $instance['input_text'] ); ?>" id="subbox" onfocus="if ( this.value == '<?php echo esc_js( $instance['input_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['input_text'] ); ?>'; }" name="<?php echo esc_js( $instance['email-field'] ); ?>" <?php if ( current_theme_supports( 'html5' ) ) : ?>required="required"<?php endif; ?> />
<?php echo $instance['hidden_fields']; ?>
<input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" />
<input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" <?php if ( ! empty( $instance['onclick_text'] ) ) : ?>onClick="<?php echo esc_attr( $instance['onclick_text'] ); ?>"<?php endif; ?>/>
</form>
<?php elseif ( ! empty( $instance['mailpoet-list'] ) && 'disabled' != $instance['mailpoet-list'] ) : ?>
<form id="subscribe" action="<?php echo $current_url; ?>" method="post" onsubmit="if ( subbox1.value == '<?php echo esc_js( $instance['fname_text'] ); ?>') { subbox1.value = ''; } if ( subbox2.value == '<?php echo esc_js( $instance['lname_text'] ); ?>') { subbox2.value = ''; }" name="<?php echo esc_attr( $this->id ); ?>">
Expand All @@ -135,7 +136,7 @@ function widget( $args, $instance ) {
<label for="subbox" class="screenread"><?php echo esc_attr( $instance['input_text'] ); ?></label><input type="<?php echo current_theme_supports( 'html5' ) ? 'email' : 'text'; ?>" value="<?php echo esc_attr( $instance['input_text'] ); ?>" id="subbox" onfocus="if ( this.value == '<?php echo esc_js( $instance['input_text'] ); ?>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['input_text'] ); ?>'; }" name="mailpoet-email" <?php if ( current_theme_supports( 'html5' ) ) : ?>required="required"<?php endif; ?> />
<?php echo $instance['hidden_fields']; ?>
<input type="hidden" name="submission-type" value="mailpoet" />
<input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" />
<input type="submit" value="<?php echo esc_attr( $instance['button_text'] ); ?>" id="subbutton" <?php if ( ! empty( $instance['onclick_text'] ) ) : ?>onClick="<?php echo esc_attr( $instance['onclick_text'] ); ?>"<?php endif; ?>/>
</form>
<?php endif;
echo wpautop( $instance['after_text'] ); // We run KSES on update
Expand Down Expand Up @@ -260,12 +261,17 @@ function form( $instance ) {
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'lname-field' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'lname-field' ) ); ?>" value="<?php echo esc_attr( $instance['lname-field'] ); ?>" class="widefat" />
</p>

<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'onclick_text' ) ); ?>"><?php _e( 'onClick', 'genesis-enews-extended' ); ?>:</label>
<textarea id="<?php echo esc_attr( $this->get_field_id( 'onclick_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'onclick_text' ) ); ?>" class="widefat"><?php echo esc_attr( $instance['onclick_text'] ); ?></textarea>
<br><small><?php _e( 'If you\'re using Google Analytics\'s event tracking to track button presses, that code goes here.', 'genesis-enews-extended'); ?></small>
</p>

<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'hidden_fields' ) ); ?>"><?php _e( 'Hidden Fields', 'genesis-enews-extended' ); ?>:</label>
<textarea id="<?php echo esc_attr( $this->get_field_id( 'hidden_fields' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hidden_fields' ) ); ?>" class="widefat"><?php echo esc_attr( $instance['hidden_fields'] ); ?></textarea>
<br><small><?php _e( 'Not all services use hidden fields.', 'genesis-enews-extended'); ?></small>
</p>

</p>
<p>
<input id="<?php echo esc_attr( $this->get_field_id( 'open_same_window' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'open_same_window' ) ); ?>" value="1" <?php checked( $instance['open_same_window'] ); ?>/>
<label for="<?php echo esc_attr( $this->get_field_id( 'open_same_window' ) ); ?>"><?php _e( 'Open confirmation page in same window?', 'genesis-enews-extended' ); ?></label>
Expand All @@ -285,7 +291,7 @@ function form( $instance ) {
<?php $input_text = empty( $instance['input_text'] ) ? __( 'E-Mail Address', 'genesis-enews-extended' ) : $instance['input_text']; ?>
<label for="<?php echo esc_attr( $this->get_field_id( 'input_text' ) ); ?>"><?php _e( 'E-Mail Input Text', 'genesis-enews-extended' ); ?>:</label>
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'input_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'input_text' ) ); ?>" value="<?php echo esc_attr( $input_text ); ?>" class="widefat" />
</p>
</p>

<p>
<?php $button_text = empty( $instance['button_text'] ) ? __( 'Go', 'genesis-enews-extended' ) : $instance['button_text']; ?>
Expand Down