public function handle_optin_forms()
 {
     // Honeypot
     if (!empty($_POST['email']) || !empty($_POST['web'])) {
         echo json_encode(array('error' => 'honeypot'));
         die;
     }
     $box_id = $_POST['box_id'];
     $box_opts = apply_filters('spu/metaboxes/get_box_options', $this->helper->get_box_options($box_id), $box_id);
     // If not box opts or wrong id
     if (empty($box_opts)) {
         echo json_encode(array('error' => 'nobox'));
         die;
     }
     $sender_class = 'SPU_' . $box_opts['optin'];
     // Create provider class
     $sender = new $sender_class();
     // Map lead
     $lead = array('email' => $_POST['spu-email'], 'name' => !empty($_POST['spu-name']) ? $_POST['spu-name'] : '');
     $result = $sender->subscribe($lead, $box_opts);
     if ($result === true) {
         if (!empty($box_opts['optin_redirect'])) {
             echo json_encode(array('redirect' => $box_opts['optin_redirect'], 'lead' => $lead));
             die;
         }
         if (!empty($box_opts['optin_success'])) {
             echo json_encode(array('success_msg' => $box_opts['optin_success']));
             die;
         }
         echo json_encode(array('success' => 'true'));
     } else {
         echo json_encode(array('error' => $result));
     }
     die;
 }
                // create field
                $args = array('group_id' => $group_id, 'rule_id' => $rule_id, 'name' => 'spu_rules[' . $group_id . '][' . $rule_id . '][param]', 'value' => $rule['param']);
                Spu_Helper::print_select($args, $choices);
                ?>
</td>
					<td class="operator"><?php 
                $choices = array('==' => __("is equal to", 'popups'), '!=' => __("is not equal to", 'popups'));
                // allow custom rules rules
                $choices = apply_filters('spu/metaboxes/rule_operators', $choices);
                $args = array('group_id' => $group_id, 'rule_id' => $rule_id, 'name' => 'spu_rules[' . $group_id . '][' . $rule_id . '][operator]', 'value' => $rule['operator']);
                Spu_Helper::print_select($args, $choices);
                ?>
</td>
					<td class="value"><?php 
                $args = array('group_id' => $group_id, 'rule_id' => $rule_id, 'value' => !empty($rule['value']) ? $rule['value'] : '', 'name' => 'spu_rules[' . $group_id . '][' . $rule_id . '][value]', 'param' => $rule['param']);
                Spu_Helper::ajax_render_rules($args);
                ?>
</td>
					<td class="add">
						<a href="#" class="rules-add-rule button"><?php 
                _e("and", 'popups');
                ?>
</a>
					</td>
					<td class="remove">
						<a href="#" class="rules-remove-rule rules-remove-rule">-</a>
					</td>
					</tr>
					<?php 
            }
            ?>
Beispiel #3
0
/**
 * Popup view
 *
 * @package   Popups
 * @author    Damian Logghe <info@timersys.com
 * @license   GPL-2.0+
 * @link      https://timersys.com
 * @copyright 2014 Timersys
 */
?>
<!-- Popups v<?php 
echo self::VERSION;
?>
 - http://wordpress.org/plugins/social-popup/--><?php 
$box = get_post($spu_id);
$helper = new Spu_Helper();
// has box with this id been found?
if (!$box instanceof WP_Post || $box->post_status !== 'publish') {
    return;
}
$opts = $helper->get_box_options($box->ID);
$css = $opts['css'];
$content = $box->post_content;
$data_attrs = '';
$box_class = '';
$width = !empty($css['width']) ? $css['width'] : '';
// run filters on content
$content = apply_filters('spu/popup/content', $content, $box);
// Qtranslate support
if (function_exists('qtrans_useCurrentLanguageIfNotFoundShowAvailable')) {
    $content = qtrans_useCurrentLanguageIfNotFoundShowAvailable($content);