template.php
97 lines
| 1 | <?php |
| 2 | /** |
| 3 | * File is included inside an IncPopupItem object. |
| 4 | * All variables of the object are available in this template. |
| 5 | */ |
| 6 | |
| 7 | $has_title = ! empty( $this->title ); |
| 8 | $has_subtitle = ! empty( $this->subtitle ); |
| 9 | $has_cta = ! empty( $this->cta_label ) && ! empty( $this->cta_link ); |
| 10 | $has_img = ! empty( $this->image ); |
| 11 | $has_buttons = $has_cta || $this->can_hide; |
| 12 | |
| 13 | if ( ! $this->image_mobile && wp_is_mobile() ) { $has_img = false; } |
| 14 | |
| 15 | $msg_class = ''; |
| 16 | if ( $has_img ) { |
| 17 | $img_left = ($this->image_pos == 'left'); |
| 18 | $msg_class .= 'img-' . $this->image_pos . ' '; |
| 19 | } else { |
| 20 | $msg_class .= 'no-img '; |
| 21 | } |
| 22 | if ( $this->is_preview ) { |
| 23 | $msg_class .= 'preview '; |
| 24 | if ( ! $this->image_mobile ) { |
| 25 | $msg_class .= 'mobile-no-img '; |
| 26 | } |
| 27 | } |
| 28 | if ( $has_buttons ) { |
| 29 | $msg_class .= 'buttons '; |
| 30 | } |
| 31 | if ( $this->round_corners ) { $msg_class .= 'rounded '; } |
| 32 | if ( $this->custom_size ) { $msg_class .= 'custom-size '; } |
| 33 | $msg_class .= 'wdpu-' . $this->id . ' '; |
| 34 | |
| 35 | $move_class = $this->custom_size ? '' : 'no-move-x'; |
| 36 | |
| 37 | ?> |
| 38 | <div id="<?php echo esc_attr( $this->code->id ); ?>" |
| 39 | class="style-simple wdpu-container wdpu-background <?php echo esc_attr( $msg_class ); ?>" |
| 40 | style="display: none;"> |
| 41 | |
| 42 | <div class="wdpu-msg resize move <?php echo esc_attr( $move_class ); ?>"> |
| 43 | <a href="#" class="wdpu-close" title="<?php _e( 'Close this box', PO_LANG ); ?>"></a> |
| 44 | |
| 45 | <div class="wdpu-msg-inner resize"> |
| 46 | <?php if ( $has_img && $img_left ) : ?> |
| 47 | <div class="wdpu-image"> |
| 48 | <img src="<?php echo esc_url( $this->image ); ?>" /> |
| 49 | </div> |
| 50 | <?php endif; ?> |
| 51 | |
| 52 | <div class="wdpu-text"> |
| 53 | <div class="wdpu-inner <?php if ( ! $has_buttons ) { echo esc_attr( 'no-bm' ); } ?>"> |
| 54 | <?php if ( $has_title || $has_subtitle ) : ?> |
| 55 | <div class="wdpu-head"> |
| 56 | <?php if ( $has_title ) : ?> |
| 57 | <div class="wdpu-title"> |
| 58 | <?php echo esc_html( $this->title ); ?> |
| 59 | </div> |
| 60 | <?php endif; ?> |
| 61 | <?php if ( $has_subtitle ) : ?> |
| 62 | <div class="wdpu-subtitle"> |
| 63 | <?php echo esc_html( $this->subtitle ); ?> |
| 64 | </div> |
| 65 | <?php endif; ?> |
| 66 | </div> |
| 67 | <?php endif; ?> |
| 68 | <div class="wdpu-content"> |
| 69 | <?php echo '' . apply_filters( 'the_content', $this->content ); ?> |
| 70 | </div> |
| 71 | </div> |
| 72 | |
| 73 | <?php if ( $has_buttons ) : ?> |
| 74 | <div class="wdpu-buttons"> |
| 75 | <?php if ( $has_cta ) : ?> |
| 76 | <a href="<?php echo esc_url( $this->cta_link ); ?>" class="wdpu-cta"> |
| 77 | <?php echo esc_html( $this->cta_label ); ?> |
| 78 | </a> |
| 79 | <?php endif; ?> |
| 80 | |
| 81 | <?php if ( $this->can_hide ) : ?> |
| 82 | <a href="#" class="wdpu-hide-forever"> |
| 83 | <?php _e( 'Never see this message again.', PO_LANG ); ?> |
| 84 | </a> |
| 85 | <?php endif; ?> |
| 86 | </div> |
| 87 | <?php endif; ?> |
| 88 | </div> |
| 89 | |
| 90 | <?php if ( $has_img && ! $img_left ) : ?> |
| 91 | <div class="wdpu-image"> |
| 92 | <img src="<?php echo esc_url( $this->image ); ?>" /> |
| 93 | </div> |
| 94 | <?php endif; ?> |
| 95 | </div> |
| 96 | </div> |
| 97 | </div> |