/** * Maybe submit a popup * * If a popup has been submitted we process the submission * and then redirect the user based on the submission result. * * @since 2.0 * @return bool|void */ function wpbo_maybe_submit() { if (!isset($_POST['wpbo_nonce']) || !wp_verify_nonce($_POST['wpbo_nonce'], 'subscribe')) { return; } if (!isset($_POST['wpbo_email']) || !isset($_POST['wpbo_id'])) { return; } $popup_id = filter_input(INPUT_POST, 'wpbo_id', FILTER_SANITIZE_NUMBER_INT); if (!WPBO_Popup::popup_exists($popup_id)) { return; } $popup = new WPBO_Popup($popup_id); $popup->submit(); }
/** * Record popup impression. * * @since 1.0.0 * * @param int $popup_id ID of the popup to increment * * @return integer Total number of impressions */ function wpbo_new_impression($popup_id = 0) { if (empty($popup_id) && isset($_POST['popup_id'])) { $popup_id = (int) filter_input(INPUT_POST, 'popup_id', FILTER_SANITIZE_NUMBER_INT); } if (0 === $popup_id || empty($popup_id)) { echo 'Incorrect popup ID'; die; } if (!WPBO_Popup::popup_exists($popup_id)) { echo 'Not a popup'; die; } $popup = new WPBO_Popup($popup_id); echo $popup->new_impression(); die; }
<?php $popup_id = filter_input(INPUT_GET, 'wpbo_popup', FILTER_SANITIZE_NUMBER_INT); $popup = new WPBO_Popup($popup_id); $template = $popup->get_markup(); ?> <div class="wrap"> <?php require_once WPBO_PATH . 'includes/admin/views/customizer-controls.php'; if (empty($popup_id)) { // Ask which popup to customize require_once WPBO_PATH . 'includes/admin/views/customizer-template-selector.php'; } elseif (empty($template)) { $link = empty($popup_id) ? add_query_arg(array('post_type' => 'wpbo-popup'), admin_url('edit.php')) : add_query_arg(array('post' => $popup_id, 'action' => 'edit'), admin_url('post.php')); $message = sprintf(__('There is no template selected for this popup. Please <a href="%s">edit the popup settings</a>.', 'betteroptin'), esc_url($link)); printf('<p class="wpbo-warning">%s</p>', $message); } else { $bg_color = $popup->option('overlay_color', '#000'); $opacity = $popup->option('overlay_opacity', '0.5'); printf('<div class="wpbo"><div class="taed-admin-overlay" style="background-color: %s; opacity: %s;"></div><div class="taed-webfontload">%s<br><img src="%s" alt="%s"></div>%s</div>', $bg_color, $opacity, esc_attr_x('Please be patient', 'Popup template is loading', 'betteroptin'), WPBO_URL . 'admin/assets/images/ajax-loader.gif', esc_html__('Loading', 'betteroptin'), $template); ?> <a href="<?php echo $cancel; ?> " class="button-secondary wpbo-back-btn">← <?php esc_html_e('Back to popup settings', 'betteroptin'); ?> </a><?php }
<?php global $post; $post_id = isset($post->ID) ? $post->ID : 0; $popup = new WPBO_Popup($post_id); $animations = array('bounceIn' => 'bounceIn', 'bounceInDown' => 'bounceInDown', 'bounceInLeft' => 'bounceInLeft', 'bounceInRight' => 'bounceInRight', 'bounceInUp' => 'bounceInUp', 'fadeIn' => 'fadeIn', 'fadeInDown' => 'fadeInDown', 'fadeInDownBig' => 'fadeInDownBig', 'fadeInLeft' => 'fadeInLeft', 'fadeInLeftBig' => 'fadeInLeftBig', 'fadeInRight' => 'fadeInRight', 'fadeInRightBig' => 'fadeInRightBig', 'fadeInUp' => 'fadeInUp', 'fadeInUpBig' => 'fadeInUpBig', 'rotateIn' => 'rotateIn', 'rotateInDownLeft' => 'rotateInDownLeft', 'rotateInDownRight' => 'rotateInDownRight', 'rotateInUpLeft' => 'rotateInUpLeft', 'rotateInUpRight' => 'rotateInUpRight', 'slideInLeft' => 'slideInLeft', 'slideInRight' => 'slideInRight', 'slideInDown' => 'slideInDown', 'rollIn' => 'rollIn', 'flipInX' => 'flipInX', 'flipInY' => 'flipInY', 'lightSpeedIn' => 'lightSpeedIn'); ?> <fieldset class="wpbo-step" data-step="2"> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"> <label for="wpbo_close_overlay"><?php _e('Close on Overlay', 'betteroptin'); ?> </label> </th> <td> <label for="wpbo_close_overlay"> <input name="wpbo_settings[close_overlay]" type="checkbox" id="wpbo_close_overlay" value="1" <?php if ('1' == $popup->option('close_overlay', '0')) { ?> checked="checked"<?php } ?> > <?php _e('Yes', 'betteroptin'); ?> </label> <p class="description"><?php