Exemple #1
0
function optinrev_pro()
{
    global $optinrev_plugin, $plugin_url;
    $this_uri = preg_replace('#&.*?$#', '', str_replace('%7E', '~', $_SERVER['REQUEST_URI']));
    $auth_info = array();
    if ($auth_info = optinrev_get('optinrev_pro_authorized')) {
        $auth_info = unserialize($auth_info);
    }
    ?>
<div id="optin-revolution">
  <div class="wrap fform pro-license">
    <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="icon32" id="icon-options-general"><br /></div><?php 
    echo "<h2>" . __('Optin Revolution Pro Settings', 'optinrev_trdom') . "</h2>";
    ?>
 <br />
    <div class="opt-row">
    <h3>Optin Revolution Pro License Information</h3>
    <form id="cred_form" name="cred_form" method="post" action="<?php 
    echo $this_uri;
    ?>
">
      <?php 
    wp_nonce_field();
    ?>
         
      <div class="row"><label><b>Email</b>&nbsp;</label><input type="text" name="amember_email" id="amember_email" size="30" value="<?php 
    echo count($auth_info) ? $auth_info['amember_email'] : '';
    ?>
"></div>
      <div class="row"><label>&nbsp;</label><input type="submit" name="Submit" class="optinrev_xbutton" value="<?php 
    _e('Save', 'optin');
    ?>
" />&nbsp;<span id="acn_verify"></span></div>
      <div class="row"><label>&nbsp;</label><span class="note">Example domain registered = <?php 
    echo optinrev_get_host();
    ?>
</span></div>
    </form><br />
    </div>
    <p>  
    <?php 
    echo optinrev_hosted_video();
    ?>
    </p>
  </div>
</div>
<?php 
}
Exemple #2
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;
     }
 }