Example #1
0
function optinrev_admin()
{
    global $optinrev_plugin, $wp_version;
    $dir = plugin_dir_url(__FILE__);
    $this_uri = preg_replace('#&.*?$#', '', str_replace('%7E', '~', $_SERVER['REQUEST_URI']));
    $optin = optinrev_popups();
    $optinrev_show_popup = optinrev_get('optinrev_show_popup');
    $ispopup = optinrev_get('optinrev_popup_enabled');
    $is_showonload = optinrev_get('optinrev_show_where');
    if (empty($is_showonload)) {
        optinrev_update('optinrev_show_where', 'show_on_load');
    }
    optinrev_update('optinrev_autosave', 'false');
    optinrev_update('optinrev_showmobile', 'false');
    optinrev_update('optinrev_poweredby', 'false');
    //if show
    $wshow = explode('|', $optinrev_show_popup);
    $ispop = optinrev_getbool('optinrev_optinrevolution/optin1_enabled');
    $r = 1;
    ?>
<div id="optin-revolution">
<div class="get-help">Get Help : <a href="<?php 
    echo OPTINREV_TUTORIAL_LINK;
    ?>
" target="_blank">Tutorials</a> | <a href="https://www.optinrevolution.com/?utm_source=plugin&utm_medium=link&utm_campaign=upgrade" title="Upgrade to Pro" target="_blank"><b>Upgrade to Pro</b></a></div>
<div class="col1">
<div class="wrap fform">
<?php 
    if (get_option('optinrev_cookies')) {
        ?>
  <div id="message" class="updated fade" style="padding:10px;">
  <strong><?php 
        echo __('Successfully cookies cleaned.');
        ?>
</strong>
  </div>
<?php 
        delete_option('optinrev_cookies');
    }
    ?>
<div class="icon32" id="icon-options-general"><br /></div><?php 
    echo "<h2>" . __('Optin Revolution Settings', 'optinrev_trdom') . "</h2>";
    ?>
 <br />
  <div id="post-message" class="updated"></div>
  <div class="clear"></div>  
  <!--//banner-->  
  <?php 
    echo optinrev_banner();
    ?>
  <!--//banner-->

  <div class="opt-row">
  <form name="optinrev_form" id="optinrev_form" method="post" action="<?php 
    echo $this_uri;
    ?>
">
    <?php 
    wp_nonce_field();
    ?>
    <p><label class="lbladmin"><?php 
    _e('Optin Revolution Popup');
    ?>
</label><div class="fbox"><input type="checkbox" name="optinrev_popup_enabled" id="optinrev_popup_enabled" <?php 
    echo $ispopup === 'true' ? 'checked="checked"' : '';
    ?>
/></div><div class="clear"></div></p>
    <div class="row"><label class="lbladmin"><?php 
    _e('Show Optin Revolution Popup');
    ?>
</label>
        <div class="fbox popup-option">
        <div class="rw"><input type="radio" name="optinrev_show[]" id="show_always" value="always" onchange="wtfn.optinrev_show_popup('show_always');" <?php 
    echo $wshow[0] === 'show_always' ? 'checked' : '';
    ?>
/>&nbsp;&nbsp;Always</div>
        <div class="rw"><input type="radio" name="optinrev_show[]" id="show_times_per_session" value="times_per_session" onchange="wtfn.optinrev_show_popup('show_times_per_session');" <?php 
    echo $wshow[0] === 'show_times_per_session' ? 'checked' : '';
    ?>
/>&nbsp;<input type="hidden" name="optinrev_time_session" id="optinrev_time_session" size="5" value="<?php 
    echo isset($wshow[1]) && $wshow[0] === 'show_times_per_session' ? $wshow[1] : 1;
    ?>
"/>&nbsp;Once per browser session</div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="row" id="save_showset"><label>&nbsp;</label><span class="submit"><input type="button" name="optinrev_save_showset" class="optinrev_xbutton" id="optinrev_save_showset" value="Save"/></span></div>
    <br />    
    <div class="row"><label class="lbladmin"><?php 
    _e('Cookies');
    ?>
</label><input type="button" class="optinrev_xbutton" name="optinrev_clean_cookies" value="Clear Cookies" onclick="admin.cookies();"/></div>
    <div class="row"><label class="lbladmin"><?php 
    _e('Email Form Settings');
    ?>
</label><input type="button" class="optinrev_xbutton" name="optinrev_reset_emailforms" value="Reset" onclick="wtfn.reset_emailform();"/></div>
    <div class="row"><label class="lbladmin"><?php 
    _e('Popup and Email Form Settings');
    ?>
</label><input type="button" class="optinrev_xbutton" name="optinrev_reset_popup" value="Reset" onclick="wtfn.reset_popup();"/></div>    
  </form>
  </div>
  <script type="text/javascript" src="<?php 
    echo $dir;
    ?>
js/optinrev-admin-setting.js?t=<?php 
    echo optinrev_cid();
    ?>
ver=<?php 
    echo $wp_version;
    ?>
"></script><br />
  <p>
  <?php 
    echo optinrev_hosted_video();
    ?>
  </p>


</div>
</div>

<div class="col2">
  <div class="need-support-box" style="margin-top:50px;">
  <h2>Need support?</h2>
  <p>If you are having problems with this plugin, please talk about them in the <a href="<?php 
    echo OPTINREV_SUPPORT;
    ?>
" target="_blank">Support forums</a>.</p>
  </div>

  <div class="social-box">
  <h2>Need a email provider? We support:</h2>
  <?php 
    optinrev_email_support();
    ?>
  <div class="clear"></div>
  </div>
</div>
<div class='clear'></div>
</div>
<?php 
}
Example #2
0
        $is_bfcase = json_encode($is_bfcase);
    }
    $is_delbfcase = 0;
    if ($imgs = optinrev_delete_image($plugin_page)) {
        $is_delbfcase = array();
        foreach ($imgs as $v) {
            $is_delbfcase[] = $v->content;
            optinrev_delete($v->name);
        }
        $is_delbfcase = json_encode($is_delbfcase);
    }
    //briefcase button - it will insert to the canvas
    $is_actionbtn = 0;
    if ($case_btn = optinrev_get('optinrev_add_button_briefcase')) {
        $is_actionbtn = $case_btn;
        optinrev_update('optinrev_active_action_button', $is_actionbtn);
        optinrev_delete('optinrev_add_button_briefcase');
    }
    $is_upload = optinrev_get('optinrev_upload');
    ?>
/* <![CDATA[ */var j = jQuery.noConflict(),doc_base_url='<?php 
    echo home_url('/');
    ?>
',wtp = '<?php 
    echo $dir;
    ?>
', defs = {'width': 900, 'height': 600}, jpdata = [], wtpage = '<?php 
    echo $plugin_page;
    ?>
', vldator = <?php 
    echo isset($_POST['optinrev_input_validator']) ? json_encode($_POST['optinrev_input_validator']) : '{}';
Example #3
0
 function optinrev_action_callback()
 {
     if (function_exists('current_user_can') && !current_user_can('manage_options')) {
         die('');
     }
     //keep silent;
     global $wpdb;
     //saving setup
     if (isset($_POST['save_setup_settings'])) {
         //email form
         $mail_form = array('aweber' => 'Aweber', 'icontact' => 'Icontact', 'getresponse' => 'GetResponse', 'mailchimp' => 'Mailchimp', 'constantcontact' => 'Constant Contact', 'wysija' => 'Wysija');
         foreach ($mail_form as $k => $v) {
             //empty the others;
             if (isset($_POST['optinrev_optin_' . $k])) {
                 if (isset($_POST['optinrev_foptin_active']) && $_POST['optinrev_foptin_active'] !== $k) {
                     $_POST['optinrev_optin_' . $k] = null;
                 }
             }
         }
         if (!isset($_POST['optinrev_femail_validate'])) {
             $_POST['optinrev_femail_validate'] = 'off';
         }
         optinrev_update($_POST['save_setup_settings'], maybe_serialize($_POST));
         echo 'success';
         exit;
     }
     //enabled/disabled
     if (isset($_POST['optinrev_popup_enabled'])) {
         optinrev_update('optinrev_popup_enabled', $_POST['optinrev_popup_enabled']);
         exit;
     }
     //enabled/disabled
     if (isset($_POST['optinrev_popup']) && ($pop = strip_tags($_POST['optinrev_popup']))) {
         optinrev_update('optinrev_optinrevolution/optin1_enabled', $pop);
         exit;
     }
     //optinrev_show_where
     if (isset($_POST['optinrev_show_where']) && ($show_on = esc_html($_POST['optinrev_show_where']))) {
         optinrev_update('optinrev_show_where', $show_on);
         exit;
     }
     //showing popup
     if (isset($_POST['optinrev_show_popup']) && ($setp = esc_html($_POST['optinrev_show_popup']))) {
         $setp_ar = explode('|', $setp);
         $setv = $setp;
         if (count($setp_ar) > 0) {
             if ($setp_ar[0] == 'show_once_in') {
                 $et = strtotime('+' . $setp_ar[1] . ' day');
                 $setv = $setv . '|' . time() . '|' . $et;
             }
         }
         optinrev_update('optinrev_show_popup', $setv);
         if (function_exists('wp_cache_clear_cache')) {
             wp_cache_clear_cache();
         }
         exit;
     }
     //optinrev_pixel_tracking
     if (isset($_POST['optinrev_pixel_tracking'])) {
         optinrev_update('optinrev_pixel_tracking', esc_html($_POST['optinrev_pixel_tracking']));
         exit;
     }
     //delete img
     if (isset($_POST['optinrev_remove_img']) && ($img = esc_html($_POST['optinrev_remove_img']))) {
         optinrev_delete($img);
         echo json_encode(array('action' => 'success'));
         exit;
     }
     //add images
     if (isset($_POST['optinrev_add_image']) && ($add_img = esc_html($_POST['optinrev_add_image']))) {
         //images from wp/content/uploads
         $img_id = explode('_', $add_img);
         $img_id = $img_id[2];
         $add_img_id = $_POST['optinrev_curr_page'] . '_img_uid_' . optinrev_unique_id() . '_' . $img_id;
         $img = optinrev_get_media($img_id);
         $imgurl = parse_url($img->guid);
         optinrev_update($add_img, basename($imgurl['path']) . '|' . $add_img);
         echo json_encode(array('action' => 'success', 'image' => '//' . $_SERVER['HTTP_HOST'] . $imgurl['path']));
         exit;
     }
     //reset
     if (isset($_POST['optinrev_popup_reset']) && intval($_POST['optinrev_popup_reset'])) {
         optinrev_update('optinrevolution/optin1', optinrev_get('optinrev_default'));
         optinrev_update('optinrev_active_action_button', 'get_access2.png');
         $tb_options = $wpdb->prefix . 'optinrev';
         $wpdb->query($wpdb->prepare("delete from {$tb_options} where name like %s", '%_img_uid_%'));
         $wpdb->query($wpdb->prepare("delete from {$tb_options} where name like %s", 'stage_img_%'));
         $wpdb->query($wpdb->prepare("delete from {$tb_options} where name like %s", 'action_button_%'));
         exit('success');
     }
     //get the validator
     if (isset($_POST['optinrev_mce_validator']) && ($page = esc_html($_POST['optinrev_mce_validator']))) {
         $p = unserialize(optinrev_get($page));
         echo json_encode($p['optinrev_input_validator']);
         exit;
     }
     //mail provider form
     if (isset($_POST['optinrev_mail_webform']) && ($cur_page = esc_html($_POST['optinrev_mail_webform']))) {
         //optin setup
         $optin = unserialize(optinrev_get($cur_page));
         if ($optin) {
             //providers
             $prov = $_POST['optinrev_mail_provider'];
             $mpro = unserialize(optinrev_get('optinrev_mail_providers'));
             $mdta = explode(',', $mpro[$prov]['input']);
             //input text
             $inputs = isset($optin['optinrev_email_form'][$prov]) ? $optin['optinrev_email_form'][$prov] : null;
             $inputs_enabled = isset($optin['optinrev_input_enabled']) ? $optin['optinrev_input_enabled'] : '';
             $htm = '';
             foreach ($mdta as $v) {
                 $fable = isset($inputs_enabled[$v]) ? $inputs_enabled[$v] : false;
                 $vl = isset($inputs[$v]) ? $inputs[$v] : '';
                 $lbl = ucwords(str_replace('_', ' ', $v));
                 //Input label
                 $lbl = str_replace('Fields Email', 'Email', $lbl);
                 $reqvalid = $req = $autotxt = $ismchimp = '';
                 $value_email = array('email', 'fields_email');
                 $valid_field = array('email', 'fields_email');
                 if (in_array($v, $valid_field)) {
                     $req = isset($optin['validate'][$v]) ? 'checked' : '';
                     $reqvalid = 'Validate&nbsp;<input type="checkbox" name="validate[' . $v . ']" value="1" ' . $req . '/>';
                 }
                 if ($prov == 'mailchimp') {
                     if ($lbl == 'Mcaction') {
                         $ismchimp = '<div class="row"><label>&nbsp;</label><span class="note">Example Value: <b>mailchimp.us1.list-manage.com</b> ( Replace with your url with your action value information )</span></div>';
                     }
                     $vl = str_replace('http://', '', $vl);
                     $lbl = ucfirst(str_replace('Mc', '', $lbl));
                 }
                 $name_sel = '';
                 $txt = '';
                 if (in_array($v, $value_email)) {
                     if (empty($vl)) {
                         $vl = 'Enter Your Email...';
                     }
                     $txt = 'onfocus="wtfn.intips(this, \'' . $vl . '\',1);" onblur="wtfn.intips(this, \'' . $vl . '\',0);"';
                 }
                 //if has an 'id'
                 $lbl = str_replace(' Id', ' ID', $lbl);
                 $htm .= '<div class="row"><label>' . $lbl . '</label><input type="text" name="optinrev_email_form[' . $_POST['optinrev_mail_provider'] . '][' . $v . ']" ' . $txt . ' value="' . $vl . '" size="40">' . $ismchimp . '&nbsp;' . $reqvalid . '&nbsp;' . $name_sel . '</div>';
             }
             echo $htm;
         }
         exit;
     }
     //Member verification
     if (isset($_POST['authenticate']) && ($user = esc_html($_POST['authenticate']))) {
         include_once ABSPATH . 'wp-includes/class-IXR.php';
         parse_str(str_replace('amp;', '', $user), $post);
         $res = 'invalid_user';
         if (empty($post['amember_email'])) {
             $res = 'invalid_user';
             exit;
         }
         if (!strpos($post['amember_email'], '@')) {
             $res = 'invalid_user';
             exit;
         }
         $client = new IXR_Client(OPTINREV_XMLRPC_URL);
         if ($client->query('proplug.is_user_authorized', $post['amember_email'], optinrev_get_host())) {
             $res = $client->getResponse();
         } else {
             $res = 2;
         }
         $res = $res == 1 ? 'authorized' : $res;
         $res = $res == 2 ? 'invalid_member' : $res;
         $res = $res == 3 ? 'invalid_login' : $res;
         exit(sprintf('%s', $res));
     }
     //Save the info
     if (isset($_POST['pro_authorized']) && ($pro = esc_html($_POST['pro_authorized']))) {
         parse_str(str_replace('amp;', '', $pro), $post);
         optinrev_update('optinrev_pro_authorized', serialize($post));
         echo 'valid';
         exit;
     }
     //set autosave
     if (isset($_POST['optinrev_autosave']) && ($autosave = esc_html($_POST['optinrev_autosave']))) {
         optinrev_update('optinrev_autosave', $autosave);
         exit;
     }
     //set poweredby
     if (isset($_POST['optinrev_poweredby']) && ($poweredby = esc_html($_POST['optinrev_poweredby']))) {
         optinrev_update('optinrev_poweredby', $poweredby);
         exit;
     }
     if (isset($_POST['optinrev_showmobile']) && ($showmobile = esc_html($_POST['optinrev_showmobile']))) {
         optinrev_update('optinrev_showmobile', $showmobile);
         exit;
     }
     //optinrev_add_image_briefcase
     if (isset($_POST['optinrev_add_image_briefcase']) && ($img = esc_html($_POST['optinrev_add_image_briefcase']))) {
         $img_id = esc_html($_POST['optinrev_curr_page']) . '_images_' . optinrev_unique_id();
         optinrev_update($img_id, $img);
         exit;
     }
     //optinrev_del_image_briefcase
     if (isset($_POST['optinrev_del_image_briefcase']) && ($img = esc_html($_POST['optinrev_del_image_briefcase']))) {
         $img_id = esc_html($_POST['optinrev_curr_page']) . '_delete_images_' . optinrev_unique_id();
         optinrev_update($img_id, $img);
         exit;
     }
     //optinrev_add_action button_briefcase
     if (isset($_POST['optinrev_add_button_briefcase']) && ($img = esc_html($_POST['optinrev_add_button_briefcase']))) {
         optinrev_update('optinrev_add_button_briefcase', $img);
         exit;
     }
     //remove an image to the stage
     if (isset($_POST['optinrev_remove_object']) && ($img_id = esc_html($_POST['optinrev_remove_object']))) {
         optinrev_delete($img_id);
         exit;
     }
     //getimage size
     if (isset($_POST['optinrev_getimagesize']) && ($img = esc_html($_POST['optinrev_getimagesize']))) {
         $is_cdn = isset($_POST['cdn']) ? '' : $_SERVER['DOCUMENT_ROOT'];
         if (list($width, $height) = @getimagesize($is_cdn . $img)) {
             $imgd = array('width' => $width, 'height' => $height);
             echo json_encode($imgd);
         } else {
             echo '0';
         }
         exit;
     }
     //reset action button
     if (isset($_POST['optinrev_reset_action_button'])) {
         optinrev_update('optinrev_active_action_button', 'get_access2.png');
         exit;
     }
     //Email form reset
     if (isset($_POST['optinrev_emailform_reset']) && intval($_POST['optinrev_emailform_reset'])) {
         $optin = maybe_unserialize(optinrev_get('optinrevolution/optin1'));
         $optin['optinrev_optin_aweber'] = null;
         $optin['optinrev_optin_icontact'] = null;
         $optin['optinrev_optin_getresponse'] = null;
         $optin['optinrev_optin_mailchimp'] = null;
         $optin['optinrev_optin_constantcontact'] = null;
         $optin['wysija_list_id'] = null;
         $optin['optinrev_femail_validate'] = null;
         $optin['optinrev_foptin_active'] = null;
         $optin['optinrev_foptin_form_active'] = null;
         optinrev_update('optinrevolution/optin1', serialize($optin));
         exit;
     }
     //Factory Reset
     if (isset($_POST['optinrev_factory_reset']) && intval($_POST['optinrev_factory_reset'])) {
         optinrev_update('optinrevolution/optin1', optinrev_get('optinrev_default'));
         optinrev_update('optinrev_active_action_button', 'get_access2.png');
         $tb_options = $wpdb->prefix . 'optinrev';
         $wpdb->query($wpdb->prepare("delete from {$tb_options} where name like %s", '%_img_uid_%'));
         $wpdb->query($wpdb->prepare("delete from {$tb_options} where name like %s", 'stage_img_%'));
         $wpdb->query($wpdb->prepare("delete from {$tb_options} where name like %s", 'action_button_%'));
         exit;
     }
 }