Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $wp_version;
- $exit_msg = 'WP File Lock for WordPress requires WordPress 2.7 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>';
- if (version_compare($wp_version, "2.7", "<")) {
- exit($exit_msg);
- }
- if (!class_exists('WPFileLock')) {
- class WPFileLock {
- var $plugin_url;
- var $cache_path;
- var $db_option = 'WPFL_Options';
- var $sent = false;
- var $required_settings = array('access_code');
- var $protect_it = false;
- function WPFileLock() {
- $this->plugin_url = trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename('Z:\vshare\install2.php')));
- $this->cache_path = ABSPATH . 'wp-content/';
- add_action('init', array(&$this, 'preprocessor'));
- add_action('admin_menu', array(&$this, 'admin_menu'));
- add_action('wp', array(&$this, 'security_check'));
- add_filter('the_posts', array(&$this, 'content_check'));
- add_action('admin_init', array(&$this, 'wp_actions'));
- add_filter('manage_posts_columns', array(&$this, 'custom_post_columns'));
- add_action('manage_posts_custom_column', array(&$this, 'custom_post_column'), 10, 2);
- add_action('save_post', array(&$this, 'save_postdata'));
- add_filter('manage_pages_columns', array(&$this, 'custom_post_columns'));
- add_action('manage_pages_custom_column', array(&$this, 'custom_post_column'), 10, 2);
- add_action('save_page', array(&$this, 'save_postdata'));
- add_filter('manage_users_columns', array(&$this, 'custom_user_columns'), 15, 1);
- add_action('manage_users_custom_column', array(&$this, 'custom_user_column'), 15, 3);
- add_action('user_register', array(&$this, 'custom_register_fields'));
- add_action('personal_options_update', array(&$this, 'save_extra_profile_fields'));
- add_action('edit_user_profile_update', array(&$this, 'save_extra_profile_fields'));
- add_action('show_user_profile', array(&$this, 'my_show_extra_profile_fields'));
- add_action('edit_user_profile', array(&$this, 'my_show_extra_profile_fields'));
- add_action('wp_print_scripts', array(&$this, 'scripts_action'));
- add_action('init', array(&$this, 'myplugin_addbuttons'));
- add_shortcode('wpfl-paypal-button', array(&$this, 'shortcode_wpfl_paypal_button'));
- add_shortcode('wpfl-login-widget', array(&$this, 'shortcode_login_widget'));
- add_shortcode('wpfl-buy-link', array(&$this, 'shortcode_buy_link'));
- add_shortcode('wpfl-dl-protect', array(&$this, 'shortcode_wpfl_dl_protect'));
- add_action("plugins_loaded", array(&$this, "widget_init"));
- add_action("wp_login", array(&$this, "login_redirect"));
- add_filter('comments_array', array(&$this, 'comment_security'));
- add_filter('comments_open', array(&$this, 'comment_form'));
- $this->admin_warnings();
- }
- function admin_warnings2() {
- echo "<div id='wpfl-warning' class='wpfl-error'><p>" . sprintf(__('<b>WP File Lock</b> is active, but will not function until a valid registration code is entered in the <a href="%1$s">options</a> page.<br /><br /><b style="color:#f00;font-size:1.2em">WARNING:</b> All content is disabled until a valid registration key is entered.'), "options-general.php?page=wp-file-lock.php") . "</p></div>";
- }
- function admin_warnings() {
- if (get_option($this->k) === FALSE) {
- add_action('admin_notices', array(&$this, 'admin_warnings2'));
- return;
- }
- $options = $this->get_options();
- foreach($this->required_settings AS $setting) {
- $display = false;
- $options[$setting] = trim($options[$setting]);
- if (!isset($options[$setting]) || empty($options[$setting])) {
- $display = true;
- }
- if ($setting == 'landing_page' && $options[$setting] == - 1) {
- $display = true;
- }
- if ($display) {
- add_action('admin_notices', array(&$this, 'display_setting_warnings'));
- }
- return;
- }
- }
- function display_setting_warnings() {
- echo "
- <div id='wpfl-warning' class='updated fade'><p><strong>" . __('WP File Lock is almost ready.') . "</strong> " . sprintf(__('You must configure all <a href="%1$s">required options</a> for it to work correctly.'), "options-general.php?page=wp-file-lock.php") . "</p></div>
- ";
- }
- function wp_actions() {
- require_once ("pluginlib.php");
- $options = $this->get_options();
- $valid = wpflVerifyReg($options['access_code']);
- if ($valid === 0) {
- delete_option($this->k);
- } else {
- update_option($this->k, $this->v);
- }
- }
- function get_more_options() {
- if (get_option($this->k) === false) {
- return false;
- } else {
- return true;
- }
- }
- function preprocessor() {
- $urlparts = explode("/", $_SERVER['REQUEST_URI']);
- $last = count($urlparts) - 1;
- $nlast = $last - 1;
- $pos = strpos($_SERVER['REQUEST_URI'], "wpfl-success");
- if ($pos !== FALSE && $pos > 0) {
- $options = $this->get_options();
- if (is_user_logged_in()) {
- if (current_user_can('level_10')) {
- $url = get_bloginfo('url') . '/wp-admin';
- header("Location: $url");
- die();
- } else if ($options['success_page_user'] > 0) {
- $id = $options['success_page_user'];
- $url = get_permalink($id);
- header("Location: $url");
- die();
- } else {
- $url = get_bloginfo('url');
- header("Location: $url");
- die();
- }
- } else {
- $url = get_bloginfo('url');
- header("Location: $url");
- die();
- }
- } else if ($urlparts[$last] == 'wpfl-buy') {
- $options = $this->get_options();
- if ($options['paypal_type'] == 2) {
- require_once "wpfl-paypal-free.php";
- exit;
- }
- $url = get_bloginfo('url');
- $uid = urlencode(base64_encode(time() . '-' . $_SERVER['REMOTE_ADDR']));
- $extra = "&cbt=Return+to+Merchant&cpp_header_image=https%3A%2F%2Fwww.e-junkie.com%2Fsslpic%2F7891.b4238789d412bd1a03f0818bf4fedcad.jpg&cpp_headerborder_color=ffffff&cpp_headerback_color=ffffff&cpp_payflow_color=ffffff";
- $cancel = "cancel_return=" . urlencode(get_bloginfo('url'));
- $return = "return=" . urlencode(get_bloginfo('url') . '/wpfl-1st-login?uid=' . $uid);
- $notify = "notify_url=" . urlencode(get_bloginfo('url') . "/wpfl-paypal");
- $custom = "custom=$uid";
- $currency = null;
- if (strlen($options['currency']) > 2) $currency = "¤cy_code=" . $options['currency'];
- if ($options['paypal_type'] == 0) {
- $paypal = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&item_name=" . urlencode(html_entity_decode($options['product_name'])) . "&amount=" . urlencode($options['product_price']) . "&no_note=1&no_shipping=1&rm=2$currency&$cancel&$return&$notify&$custom" . $extra;
- } else {
- $trial = null;
- if ($options['paypal_trial'] == 1) {
- $trial = "&a1=" . urlencode($options['trial_price']) . "&p1=" . urlencode($options['trial_period']) . "&t1=" . urlencode($options['trial_period_select']);
- }
- $paypal = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&item_name=" . urlencode(html_entity_decode($options['product_name'])) . $trial . "&a3=" . urlencode($options['product_price']) . "&p3=" . urlencode($options['payment_period']) . "&t3=" . urlencode($options['payment_period_select']) . "&src=1&srt=" . $options['number_of_payments'] . "&no_note=1&no_shipping=1&rm=2$currency&$cancel&$return&$notify&$custom" . $extra;
- }
- $paypal.= "&business=" . urlencode($options['paypal_email']);
- header("Location: $paypal");
- exit;
- } else if ($urlparts[$nlast] == 'wpfl-download') {
- if (!$this->get_more_options()) {
- return "Content disabled until valid WP File Lock Registration Key is entered!";
- }
- if (!is_user_logged_in()) {
- $options = $this->get_options();
- $id = $options['landing_page'];
- if ($id > 0) {
- $url = get_permalink($id);
- } else {
- $url = get_bloginfo('url');
- }
- header("Location: $url");
- exit;
- }
- global $current_user;
- if (get_user_meta($current_user->ID, '_wpfl_membership_id', true) != '') {
- $mydir = 'wpfilelock-' . get_option('wpfl_Activation_Timestamp');
- $dir = ABSPATH . 'wp-content/uploads/' . $mydir;
- $filename = $dir . '/' . urldecode($urlparts[$last]);
- if (is_file($filename)) {
- $file_type = filetype($filename);
- $data = file_get_contents($filename);
- $file_size = strlen($data);
- $file = urldecode($urlparts[$last]);
- header("Pragma: public");
- header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: private", false);
- header("Content-type: Application/ $file_type");
- header("Content-Disposition: attachment; filename=$file");
- header("Content-Description: Download PHP");
- header("Content-Length: $file_size");
- header("Content-Transfer-Encoding: binary");
- echo $data;
- exit;
- } else {
- echo "NO FILE";
- }
- exit;
- } else {
- $options = $this->get_options();
- $id = $options['landing_page'];
- if ($id > 0) {
- $url = get_permalink($id);
- } else {
- $url = get_bloginfo('url');
- }
- header("Location: $url");
- exit;
- }
- } else if ($urlparts[$last] == 'wpfl-reg') {
- if (!isset($_POST['wp-submit'])) {
- require_once "wpfl-paypal-free.php";
- exit;
- }
- $errors = array();
- if (!preg_match("/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i", $_POST['payer_email'])) {
- $errors['email'] = "Please enter a valid email";
- }
- if (strlen(trim($_POST['fname'])) == 0) {
- $errors['fname'] = "Please enter your first name";
- }
- if (strlen(trim($_POST['lname'])) == 0) {
- $errors['lname'] = "Please enter your last name";
- }
- if (count($errors) > 0) {
- require_once "wpfl-paypal-free.php";
- exit;
- }
- $user_name = $email = $_POST['payer_email'];
- $random_password = substr(md5(get_option('wpfl_Activation_Timestamp') . $email), -8);
- require_once (ABSPATH . WPINC . '/registration.php');
- $user_id = username_exists($email);
- if ($user_id != null) {
- wp_update_user(array('ID' => $user_id, 'user_pass' => $random_password));
- } else {
- $user_id = wp_create_user($user_name, $random_password, $email);
- }
- wp_update_user(array('ID' => $user_id, 'first_name' => $_POST['fname'], 'last_name' => $_POST['lname']));
- wp_new_user_notification($user_id, $random_password);
- update_user_meta($user_id, '_wpfl_membership_id', time());
- $this->subscribe_to_ar($email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR']);
- require_once "wpfl-paypal-free.php";
- exit;
- } else if ($urlparts[$nlast] == 'wpfl-wso') {
- if (get_option('wpfl_Activation_Timestamp') != $urlparts[$last]) {
- exit;
- } else {
- echo $this->process_WSO();
- exit;
- }
- } else if ($urlparts[$last] == 'wpfl-cbnotify') {
- $this->process_clickbank_notify();
- die;
- } else if ($urlparts[$last] == 'wpfl-drnotify') {
- $this->process_digiresults_notify();
- die;
- } else if ($urlparts[$last] == 'wpfl-login') {
- require "wpfl-login.php";
- die;
- } else if (strpos($_SERVER['REQUEST_URI'], 'wpfl-cbty') !== false) {
- require "wpfl-clickbank-pdt.php";
- die;
- } else if (strpos($_SERVER['REQUEST_URI'], 'wpfl-drty') !== false) {
- require "wpfl-digiresults-pdt.php";
- die;
- }
- $pos = strpos($_SERVER['REQUEST_URI'], "wpfl-paypal");
- if ($pos !== FALSE && $pos > 0) {
- require "wpfl-paypal-ipn.php";
- die;
- }
- $pos = strpos($_SERVER['REQUEST_URI'], "wpfl-1st-login");
- if ($pos !== FALSE && $pos > 0) {
- require "wpfl-paypal-pdt.php";
- die;
- }
- if (isset($_POST['wpfl-submitted'])) {
- $this->handle_options();
- }
- }
- function widget_display() {
- $burl = get_bloginfo('url');
- $lourl = wp_logout_url();
- $options = $this->get_options();
- if ($options['landing_page'] > 0) {
- $id = $options['landing_page'];
- $rurl = get_permalink($id);
- } else {
- $rurl = $burl;
- }
- if (is_user_logged_in()) {
- global $current_user;
- $output = " <div class=\"wpfl-widget-wrapper\">
- <div class=\"wpfl-login-form-wrapper\">
- <div class=\"wpfl-login-row\">Welcome <strong>$current_user->display_name</strong>.</div>
- <div class=\"wpfl-login-row\"><form name=\"loginform\" id=\"loginform\" action=\"$lourl\" method=\"post\">
- <input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" value=\"Log out\" />
- <input type=\"hidden\" name=\"redirect_to\" value=\"$burl\" />
- </form>
- </div>
- </div>
- </div>";
- } else {
- $output = " <div id=\"wpfl-login-form-wrapper\">
- <form name=\"loginform\" id=\"loginform\" action=\"$burl/wp-login.php\" method=\"post\">
- <div class=\"wpfl-login-row\"><label for=\"log\">Username:</label> <input type=\"text\" name=\"log\" id=\"user_login\" value=\"\" size=\"20\" tabindex=\"10\" /></div>
- <div class=\"wpfl-login-row\"><label for=\"pwd\">Password:</label> <input type=\"password\" name=\"pwd\" id=\"user_pass\" value=\"\" size=\"20\" tabindex=\"20\" /></div>
- <div class=\"wpfl-login-row\"><input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" value=\"Login\" /></div>
- <div class=\"wpfl-login-reg\">Not a member yet? <a href=\"$rurl\">Sign up here</a></div>
- <div class=\"wpfl-login-lost\"><a href=\"$burl/wp-login.php?action=lostpassword\">Lost your password?</a></div>
- <input type=\"hidden\" name=\"redirect_to\" value=\"$burl/wpfl-success\" />
- </form>
- </div>";
- }
- echo $output;
- }
- var $k = '_transient_seed_random';
- function widget($args) {
- extract($args);
- if (!isset($before_widget)) {
- echo '<li id="wpfl-login-2" class="widget-container">';
- } else {
- echo $before_widget;
- }
- if (!isset($before_title)) {
- echo '<h3 class="widget-title">';
- } else {
- echo $before_title;
- }
- if (is_user_logged_in()) {
- echo "Logged In";
- } else {
- echo "Log In";
- }
- if (!isset($after_title)) {
- echo '</h3>';
- } else {
- echo $after_title;
- }
- $this->widget_display();
- if (!isset($after_widget)) {
- echo '</li>';
- } else {
- echo $after_widget;
- }
- }
- function widget_init() {
- wp_register_sidebar_widget('wp-file-lock-smart-login', __('WP File Lock Smart Login'), array(&$this, 'widget'));
- }
- function login_redirect() {
- $burl = get_bloginfo('url') . "/wpfl-success";
- header("Location: $burl");
- die();
- }
- function myplugin_addbuttons() {
- if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) return;
- if (get_user_option('rich_editing') == 'true') {
- add_filter('mce_external_plugins', array(&$this, 'add_custom_tinymce_plugin'));
- add_filter('mce_buttons', array(&$this, 'register_custom_button'));
- }
- }
- function register_custom_button($buttons) {
- $options = $this->get_options();
- array_push($buttons, "wpfl_paypal");
- array_push($buttons, "wpfl_login_widget");
- array_push($buttons, "wpfl_dl_popup");
- return $buttons;
- }
- function add_custom_tinymce_plugin($plugin_array) {
- $plugin_array['wpfl'] = plugin_dir_url('Z:\vshare\install2.php') . 'wpfl.js';
- return $plugin_array;
- }
- function scripts_action() {
- wp_enqueue_script('file-lock', $this->plugin_url . 'wpfl-tt.js', array('jquery'));
- echo '<link rel="stylesheet" href="' . $this->plugin_url . 'wpfl.css" type="text/css" />';
- }
- function shortcode_wpfl_protected($attr, $content) {
- if (!$this->get_more_options()) {
- return "Content disabled until valid WP File Lock Registration Key is entered!";
- }
- if (!is_user_logged_in()) {
- $options = $this->get_options();
- $id = $options['landing_page'];
- $url = get_permalink($id);
- return "<span class=\"wpfl-members-only\">[ Members Only Content - please <a href=\"" . $url . "\">sign up</a> to view it... ]</span>";
- }
- global $current_user;
- if (get_user_meta($current_user->ID, '_wpfl_membership_id', true) != '') {
- return do_shortcode($content);
- }
- }
- function shortcode_wpfl_paypal_button($attr, $content) {
- $options = $this->get_options();
- if (strlen($options['payment_button_url']) > 4) {
- $iurl = $options['payment_button_url'];
- } else {
- $iurl = "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif";
- }
- return '<a href="' . get_bloginfo('url') . "/wpfl-buy" . '"><img src="' . $iurl . '" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"></a>';
- }
- function shortcode_wpfl_join_button($attr, $content) {
- $options = $this->get_options();
- if (strlen($options['join_button_url']) > 4) {
- $iurl = $options['join_button_url'];
- } else {
- $iurl = $this->plugin_url . 'images/joinbllg.gif';
- }
- return '<a href="' . get_bloginfo('url') . "/wpfl-reg" . '"><img src="' . $iurl . '" border="0" name="submit" alt="Join Now - It\'s Free!"></a>';
- }
- function shortcode_wpfl_buy_link($attr, $content) {
- return get_bloginfo('url') . "/wpfl-buy";
- }
- function shortcode_login_widget() {
- $burl = get_bloginfo('url');
- $lourl = wp_logout_url();
- $options = $this->get_options();
- if ($options['landing_page'] > 0) {
- $id = $options['landing_page'];
- $rurl = get_permalink($id);
- } else {
- $rurl = $burl;
- }
- if (is_user_logged_in()) {
- global $current_user;
- $output = " <div class=\"wpfl-widget-wrapper\">
- <div class=\"wpfl-login-form-wrapper\">
- <div class=\"wpfl-login-row\">Welcome <strong>$current_user->display_name</strong>.</div>
- <div class=\"wpfl-login-row\"><form name=\"loginform\" id=\"loginform\" action=\"$lourl\" method=\"post\">
- <input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" value=\"Log out\" />
- <input type=\"hidden\" name=\"redirect_to\" value=\"$burl\" />
- </form>
- </div>
- </div>
- </div>";
- } else {
- $output = " <div id=\"wpfl-login-form-wrapper\">
- <form name=\"loginform\" id=\"loginform\" action=\"$burl/wp-login.php\" method=\"post\">
- <div class=\"wpfl-login-row\"><label for=\"log\">Username:</label> <input type=\"text\" name=\"log\" id=\"user_login\" value=\"\" size=\"20\" tabindex=\"10\" /></div>
- <div class=\"wpfl-login-row\"><label for=\"pwd\">Password:</label> <input type=\"password\" name=\"pwd\" id=\"user_pass\" value=\"\" size=\"20\" tabindex=\"20\" /></div>
- <div class=\"wpfl-login-row\"><input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" value=\"Login\" /></div>
- <div class=\"wpfl-login-reg\">Not a member yet? <a href=\"$rurl\">Sign up here</a></div>
- <div class=\"wpfl-login-lost\"><a href=\"$burl/wp-login.php?action=lostpassword\">Lost your password?</a></div>
- <input type=\"hidden\" name=\"redirect_to\" value=\"$burl/wpfl-success\" />
- </form>
- </div>";
- }
- return $output;
- }
- function shortcode_wpfl_dl_protect($attr, $content) {
- extract(shortcode_atts(array('file' => 'NONE',), $attr));
- if (!$this->get_more_options()) {
- return "Content disabled until valid WP File Lock Registration Key is entered!";
- }
- if (!is_user_logged_in()) {
- $options = $this->get_options();
- $id = $options['landing_page'];
- $url = get_permalink($id);
- return "<span class=\"wpfl-members-only\">[ Members Only Content - please <a href=\"" . $url . "\">sign up</a> to view it... ]</span>";
- }
- global $current_user;
- if (get_user_meta($current_user->ID, '_wpfl_membership_id', true) != '') {
- $burl = get_bloginfo('url');
- $link = "<a href=\"$burl/wpfl-download/$file\">" . do_shortcode($content) . "</a>";
- return $link;
- } else {
- $options = $this->get_options();
- $id = $options['landing_page'];
- $url = get_permalink($id);
- return "<span class=\"wpfl-members-only\">[ Members Only Content - please <a href=\"" . $url . "\">sign up</a> to view it... ]</span>";
- }
- }
- function aweber_unsubscribe_deprecated($email, $user_id) {
- $options = $this->get_options();
- if ($options['unsubscribe'] == 1 && $options['from_email'] != "" && get_user_meta($user_id, '_wpfl_sub_sent', true)) {
- $headers = 'From: ' . $options['from_email'] . "\r\n";
- $body = 'REMOVE#' . $email . '#WPFL#' . $options['aweber_list'];
- mail($options['aweber_list'], $body, "Unsubscribe email.", $headers);
- delete_user_meta($user_id, '_wpfl_sub_sent');
- }
- }
- function aweber_subscribe_deprecated($email, $user_id) {
- if (get_user_meta($user_id, '_wpfl_sub_sent', true)) {
- return;
- }
- $options = $this->get_options();
- $list = null;
- $list = $options['aweber_list'];
- if ($list != null) {
- $headers = 'From: ' . $email . "\r\n";
- mail($list, $email, "Subscribe email.", $headers);
- update_user_meta($user_id, '_wpfl_sub_sent', true);
- }
- }
- function save_extra_profile_fields($user_id) {
- if (current_user_can('level_10')) {
- if (!current_user_can('edit_user', $user_id)) return false;
- if (isset($_POST['wpfl_member']) && $_POST['wpfl_member'] == 1) {
- $member = get_user_meta($user_id, '_wpfl_membership_id', true);
- if ($member) {
- } else {
- update_user_meta($user_id, '_wpfl_membership_id', 'manual');
- $user = get_userdata($user_id);
- $this->aweber_subscribe($user->user_email, $user_id);
- $this->subscribe_to_ar($user->user_email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR']);
- }
- } else {
- delete_user_meta($user_id, '_wpfl_membership_id');
- $user = get_userdata($user_id);
- $this->unsubscribe_to_ar($user->user_email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR'], $user_id);
- }
- }
- }
- function my_show_extra_profile_fields($user) {
- if (current_user_can('level_10')) {
- $member = get_user_meta($user->ID, '_wpfl_membership_id', true);
- $yes = $no = null;
- $info = null;
- if ($member != '') {
- $yes = " checked ";
- if ($member != "manual") {
- $info = "Paypal payment attached to this membership.";
- } else {
- $info = "No Paypal payment attached. MUST be manually deleted!";
- }
- } else {
- $no = " checked ";
- $info = "A membership can be manually added above, but it MUST be manually deleted in the future.";
- };
- echo ' <h3>WP File Lock Profile Information</h3>
- <table class="form-table">
- <tr>
- <th><label>Member?</label></th>
- <td>
- <input type="radio" name="wpfl_member" value="1" ';
- echo $yes;;
- echo ' /> Yes
- or
- <input type="radio" name="wpfl_member" value="0" ';
- echo $no;;
- echo ' /> No
- <br />
- <span class="description"><b>Note:</b> ';
- echo $info;;
- echo '</span>
- </td>
- </tr>
- </table>
- ';
- }
- }
- function custom_post_columns($defaults) {
- $defaults['members'] = _('Members Only?');
- return $defaults;
- }
- function custom_post_column($column_name, $id) {
- if ($column_name == 'members') {
- $protected = get_post_meta($id, '_wpfl_protected', true);
- if ($protected) {
- echo "Yes";
- } else {
- echo "No";
- }
- }
- }
- function custom_user_columns($defaults) {
- $defaults['user_members'] = _('Paid Member?');
- return $defaults;
- }
- function custom_user_column($value, $column_name, $id) {
- if ($column_name == 'user_members') {
- $member = get_user_meta($id, '_wpfl_membership_id', true);
- if ($member) {
- if ($member == "manual") {
- $info = "*";
- }
- return "Yes" . $info;
- } else {
- return "No";
- }
- }
- }
- function save_postdata($post_id) {
- if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
- if ('page' == $_POST['post_type']) {
- if (!current_user_can('edit_page', $post_id)) return $post_id;
- } else {
- if (!current_user_can('edit_post', $post_id)) return $post_id;
- }
- if ($_POST['action'] != 'inline-save') {
- $protected = (int)$_POST['_wpfl_protected'];
- update_post_meta($post_id, '_wpfl_protected', $protected);
- }
- }
- function custom_register_fields() {
- if (is_user_logged_in()) {
- if (current_user_can('level_10')) {
- global $wpdb;
- $query = "SELECT ID from $wpdb->users WHERE user_email = '" . mysql_real_escape_string($_REQUEST['email']) . "'";
- $user = $wpdb->get_results($query);
- update_user_meta($user[0]->ID, '_wpfl_membership_id', 'manual');
- }
- }
- }
- function verify_payment() {
- if (!is_user_logged_in()) {
- return;
- } else {
- global $current_user;
- if (get_user_meta($current_user->ID, '_wpfl_membership_id', true) == '') {
- $url = $this->plugin_url . 'pay.php';
- if ($url != $url) {
- header("Location: $url");
- exit;
- }
- }
- }
- }
- function comment_security($comments) {
- if (!$this->protect_it) {
- return $comments;
- }
- return array();
- }
- function comment_form() {
- global $post;
- $id = $post->ID;
- global $wpdb;
- $sqlquery = "SELECT count(1) AS count FROM " . $wpdb->posts . " WHERE id = $id AND comment_status = 'open'";
- $results = $wpdb->get_results($sqlquery, ARRAY_A);
- if ($results[0][count] > 0) {
- if (!$this->protect_it) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- function security_check() {
- if (is_admin()) {
- return;
- }
- global $post;
- global $posts;
- $msg_start = "<span class=\"wpfl-members-only\">[ Members Only Content - please <a href=\"";
- $msg_end = "\">sign up</a> to view it... ]</span>";
- $options = $this->get_options();
- if (($options['landing_page'] > 0)) {
- $id = $options['landing_page'];
- $url = get_permalink($id);
- } else {
- $url = get_bloginfo('url');
- }
- if (count($posts) == 1) {
- if (get_post_meta($post->ID, '_wpfl_protected', true) == 0) {
- return;
- }
- if (!is_user_logged_in()) {
- $posts[0]->post_content = $msg_start . $url . $msg_end;
- $post->post_content = $msg_start . $url . $msg_end;
- $this->protect_it = true;
- } else {
- global $current_user;
- if (get_user_meta($current_user->ID, '_wpfl_membership_id', true) == '') {
- $posts[0]->post_content = $msg_start . $url . $msg_end;
- $post->post_content = $msg_start . $url . $msg_end;
- }
- }
- } else {
- global $current_user;
- if (!is_user_logged_in() || get_user_meta($current_user->ID, '_wpfl_membership_id', true) == '') {
- for ($i = 0;$i < count($posts);$i++) {
- if (get_post_meta($posts[$i]->ID, '_wpfl_protected', true) != 0) {
- $posts[$i]->post_content = $msg_start . $url . $msg_end;
- }
- }
- }
- $posts = array_values($posts);
- }
- }
- var $v = 'ea989ea8741f56536c4ac066eaab9a72';
- function require_membership() {
- $options = $this->get_options();
- global $current_user;
- if (!is_user_logged_in() || get_user_meta($current_user->ID, '_wpfl_membership_id', true) == '') {
- if (!empty($options['landing_page']) && ($options['landing_page'] > 0)) {
- $id = $options['landing_page'];
- $url = get_permalink($id);
- } else {
- $url = get_bloginfo('url');
- }
- header("Location: $url");
- die();
- }
- }
- function content_check($posts) {
- $hide1 = false;
- $hide2 = false;
- global $current_user;
- if (get_user_meta($current_user->ID, '_wpfl_membership_id', true) == '') {
- $hide1 = true;
- }
- $options = $this->get_options();
- $id = $options['landing_page'];
- $url = get_permalink($id);
- $message = "<span class=\"wpfl-members-only\">[ Members Only Content - please <a href=\"" . $url . "\">sign up</a> to view it... ]</span>";
- if (!$this->get_more_options()) {
- $hide2 = true;
- }
- foreach($posts AS $post) {
- if (($hide1 && get_post_meta($post->ID, '_wpfl_protected', true) == 0)) {
- $post->post_content = preg_replace("/\[wpfl\-protected\].*\[\/wpfl\-protected\]/Ui", $message, $post->post_content);
- }
- if ($hide2) {
- $post->post_content = "Content disabled until valid WP File Lock Registration Key is entered!";
- }
- }
- return $posts;
- }
- function admin_menu() {
- add_options_page('WP File Lock Options', 'WP File Lock', 8, basename('Z:\vshare\install2.php'), array(&$this, 'handle_options'));
- add_meta_box('WPFileLock', 'WP File Lock', array(&$this, 'custom_panel'), 'post', 'normal', 'high');
- add_meta_box('WPFileLock', 'WP File Lock', array(&$this, 'custom_panel'), 'page', 'normal', 'high');
- }
- function custom_panel() {
- global $post;
- $options = $this->get_options();
- $yes = $no = null;
- $post = get_post($post->ID, OBJECT);
- if ($post->post_title == 'Auto Draft' && $post->post_status == 'auto-draft') {
- if ($options['default_protect'] == 1) {
- $yes = ' checked ';
- } else {
- $no = ' checked ';
- }
- } else {
- if (get_post_meta($post->ID, '_wpfl_protected', true) == 1) {
- $yes = ' checked ';
- } else {
- $no = ' checked ';
- }
- }
- echo 'WP File Lock Protected? <input type="radio" name="_wpfl_protected" value="1" ' . $yes . ' /> Yes or <input type="radio" name="_wpfl_protected" value="0" ' . $no . ' /> No';
- }
- function get_options() {
- $saved = get_option($this->db_option);
- if (!empty($saved)) {
- foreach($saved AS $k => $v) {
- $options[$k] = $v;
- }
- }
- if ($saved != $options) {
- update_option($this->db_option, $options);
- }
- return $options;
- }
- function handle_options() {
- $options = $this->get_options();
- if (isset($_POST['wpfl-submitted'])) {
- check_admin_referer('file-lock');
- $options = array();
- $options['access_code'] = trim(htmlentities($_POST['access_code']));
- $options['success_page_user'] = (int)$_POST['success_page_user'];
- $options['landing_page'] = (int)$_POST['landing_page'];
- $options['default_protect'] = (int)$_POST['default_protect'];
- $options['paypal_button'] = htmlentities($_POST['paypal_button']);
- $options['unsubscribe'] = htmlentities(stripslashes($_POST['unsubscribe']));
- $options['from_email'] = htmlentities(stripslashes($_POST['from_email']));
- $options['product_name'] = htmlentities(stripslashes($_POST['product_name']));
- $options['payment_button_url'] = htmlentities($_POST['payment_button_url']);
- $options['paypal_email'] = htmlentities($_POST['paypal_email']);
- $options['paypal_type'] = 0;
- $options['product_price'] = (float)($_POST['product_price']);
- $options['currency'] = htmlentities($_POST['currency']);
- $options['cuslist'] = $this->save_ar('cuslist');
- $options['wsopro'] = (int)($_POST['wsopro']);
- $options['clickbank'] = (int)($_POST['clickbank']);
- $options['digiresults'] = (int)($_POST['digiresults']);
- $options['cb_secret_key'] = htmlentities($_POST['cb_secret_key']);
- $options['dr_api_key'] = htmlentities($_POST['dr_api_key']);
- update_option($this->db_option, $options);
- $this->wp_actions();
- header("Location: options-general.php?page=wp-file-lock.php&saved=1");
- die();
- }
- if (isset($_GET['saved'])) {
- echo '<div class="updated fade"><p>Plugin settings saved.</p></div>';
- }
- $paypal_button = stripslashes(html_entity_decode($options['paypal_button']));
- $access_code = html_entity_decode($options['access_code']);
- $from_email = html_entity_decode($options['from_email']);
- $product_name = $options['product_name'];
- $payment_button_url = html_entity_decode($options['payment_button_url']);
- $join_button_url = html_entity_decode($options['join_button_url']);
- $paypal_email = html_entity_decode($options['paypal_email']);
- $paypal_type = html_entity_decode($options['paypal_type']);
- $product_price = html_entity_decode($options['product_price']);
- $cb_secret_key = html_entity_decode($options['cb_secret_key']);
- $dr_api_key = html_entity_decode($options['dr_api_key']);
- if (trim($payment_button_url) == "") {
- $payment_button_url = $this->plugin_url . 'images/pp-order-button.png';
- }
- $currencies = array('USD' => 'U.S. Dollar', 'AUD' => 'Australian Dollar', 'CAD' => 'Canadian Dollar', 'EUR' => 'Euro', 'JPY' => 'Japanese Yen', 'GBP' => 'Pound Sterling');
- $currency_select = '<select name="currency" id="currency">';
- foreach($currencies AS $curr => $value) {
- if ($curr == $options['currency']) {
- $selected = ' SELECTED ';
- } else {
- $selected = null;
- }
- $currency_select.= '<option value="' . $curr . '"' . $selected . '>' . $value . '</option>';
- }
- $currency_select.= '</select>';
- global $wpdb;
- $query = "SELECT ID, post_title from $wpdb->posts WHERE post_status = 'publish' AND post_password='' AND post_type IN ('post', 'page') ORDER BY post_title ASC";
- $posts = $wpdb->get_results($query);
- $pages_select = '<select name="landing_page" id="landing_page"><option value="-1">Select One</option>';
- if ($options['landing_page'] == 0) {
- $selected = ' SELECTED ';
- } else {
- $selected = null;
- }
- $pages_select.= '<option value="0"' . $selected . '>Home</option>';
- foreach($posts AS $post) {
- if ($post->ID == $options['landing_page']) {
- $selected = ' SELECTED ';
- } else {
- $selected = null;
- }
- $pages_select.= '<option value="' . $post->ID . '"' . $selected . '>' . $post->post_title . '</option>';
- }
- $pages_select.= '</select>';
- $pages_select3 = '<select name="success_page_user" id="success_page_user"><option value="-1">Select One</option>';
- if ($options['success_page_user'] == 0) {
- $selected = ' SELECTED ';
- } else {
- $selected = null;
- }
- $pages_select3.= '<option value="0"' . $selected . '>Home</option>';
- foreach($posts AS $post) {
- if ($post->ID == $options['success_page_user']) {
- $selected = ' SELECTED ';
- } else {
- $selected = null;
- }
- $pages_select3.= '<option value="' . $post->ID . '"' . $selected . '>' . $post->post_title . '</option>';
- }
- $pages_select3.= '</select>';
- if ($options['default_protect'] == 1) {
- $defaultyes = " checked ";
- $defaultno = null;
- } else {
- $defaultyes = null;
- $defaultno = " checked ";
- }
- if ($options['unsubscribe'] == 0) {
- $unsubscribeno = " checked ";
- $unsubscribeyes = null;
- } else {
- $unsubscribeno = null;
- $unsubscribeyes = " checked ";
- }
- if ($options['wsopro'] == 1) {
- $wsoproyes = " checked ";
- $wsoprono = null;
- } else {
- $wsoproyes = null;
- $wsoprono = " checked ";
- }
- if ($options['clickbank'] == 1) {
- $clickbankyes = " checked ";
- $clickbankno = null;
- } else {
- $clickbankyes = null;
- $clickbankno = " checked ";
- }
- if ($options['digiresults'] == 1) {
- $digiresultsyes = " checked ";
- $digiresultsno = null;
- } else {
- $digiresultsyes = null;
- $digiresultsno = " checked ";
- }
- $ars = array('AW' => 'AWeber & all white labels', 'GR' => 'Get Response', 'IM' => 'Imnica Mail');
- $cuslist_type = $options['cuslist_type'] = html_entity_decode($options['cuslist']['type']);
- $cuslist_email = html_entity_decode($options['cuslist']['email']);
- $cuslist_api_key = html_entity_decode($options['cuslist']['api_key']);
- $cuslist_name = html_entity_decode($options['cuslist']['name']);
- $cuslist_id = html_entity_decode($options['cuslist']['id']);
- $ar_select = '<select name="cuslist_type" id="cuslist_type" onchange="showaroptions(\'cuslist_type\',1)" style="margin-bottom:8px;"><option value="-1">None</option>';
- foreach($ars AS $curr => $value) {
- if ($curr == $options['cuslist_type'] OR (($options['cuslist_type'] == '' OR !isset($options['cuslist_type'])) AND $curr == 'AW')) {
- $selected = ' SELECTED ';
- } else {
- $selected = null;
- }
- $ar_select.= '<option value="' . $curr . '"' . $selected . '>' . $value . '</option>';
- }
- $ar_select.= '</select>';
- $action_url = $_SERVER['REQUEST_URI'];
- include ('wpfl-options.php');
- }
- function display_pay() {
- global $current_user;
- $output = null;
- $options = $this->get_options();
- $button = stripslashes(html_entity_decode($options['paypal_button']));
- $url = $this->plugin_url . 'ipn.php';
- $button = preg_replace("/(<\/form>)/Ui", '<input type="hidden" name="notify_url" value="' . $url . '" /><input type="hidden" name="custom" value="' . $current_user->ID . '" /></form>', $button);
- $output.= $button;
- return $output;
- }
- function process_WSO() {
- if ($_POST['txn_type'] == "web_accept" || $_POST['txn_type'] == "subscr_signup" || $_POST['txn_type'] == "cart" || $_POST['txn_type'] == "express_checkout") {
- if (isset($_POST['txn_id'])) {
- $tran_id = $_POST['txn_id'];
- $tx_id = $_POST['txn_id'];
- } else if (isset($_POST['subscr_id'])) {
- $tran_id = $_POST['subscr_id'];
- $tx_id = null;
- }
- if (!isset($_POST['txn_type']) || !isset($_POST['payer_email']) || !isset($tran_id)) {
- die();
- }
- $user_name = $email = $_POST['payer_email'];
- $random_password = substr(md5(get_option('wpfl_Activation_Timestamp') . $email), -8);
- require_once (ABSPATH . WPINC . '/registration.php');
- $user_id = username_exists($email);
- if ($user_id != null) {
- wp_update_user(array('ID' => $user_id, 'user_pass' => $random_password));
- } else {
- $user_id = wp_create_user($user_name, $random_password, $email);
- }
- wp_new_user_notification($user_id, $random_password);
- update_user_meta($user_id, '_wpfl_membership_id', $tran_id);
- if (isset($this)) {
- $this->subscribe_to_ar($email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR'], $user_id);
- }
- $output = "<br />Your username: <b>$user_name</b><br />Your Password: <b/>$random_password</b><br /><br />Please SAVE this information in a safe place, then click the \"<b>Click Here to Access Your Purchase</b>\" button below to login.";
- return $output;
- }
- }
- function process_clickbank_notify() {
- mail('ccasselman@gmail.com', 'IN process_clickbank_notify...', "REQUEST: " . print_r($_REQUEST, true));
- $options = $this->get_options();
- if ($this->ipnVerification($options['cb_secret_key']) == 1) {
- if ($_POST['ctransaction'] == 'SALE' OR $_POST['ctransaction'] == 'TEST_SALE') {
- $tran_id = $tx_id = $_POST['ctransreceipt'];
- $_POST['payer_email'] = $_POST['ccustemail'];
- $user_name = $email = $_POST['payer_email'];
- $random_password = substr(md5(get_option('wpfl_Activation_Timestamp') . $email), -8);
- require_once (ABSPATH . WPINC . '/registration.php');
- $user_id = username_exists($email);
- if ($user_id != null) {
- wp_update_user(array('ID' => $user_id, 'user_pass' => $random_password));
- } else {
- $user_id = wp_create_user($user_name, $random_password, $email);
- }
- wp_update_user(array('ID' => $user_id, 'first_name' => $_POST['ccustfirstname'], 'last_name' => $_POST['ccustlastname']));
- wp_new_user_notification($user_id, $random_password);
- update_user_meta($user_id, '_wpfl_membership_id', $tran_id);
- mail('ccasselman@gmail.com', "Before call to: aweber_subscribe($email, $user_id)) " . time(), "\nUser ID: $user_id\n$email\nUser:" . print_r($user, true) . "Details:" . print_r($_REQUEST, true));
- if (isset($this)) {
- mail('ccasselman@gmail.com', "Calling: aweber_subscribe($email, $user_id)) " . time(), "\nUser ID: $user_id\n$email\nUser:" . print_r($user, true) . "Details:" . print_r($_REQUEST, true));
- $this->subscribe_to_ar($email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR']);
- }
- } else if ($_POST['ctransaction'] == 'RFND' || $_POST['ctransaction'] == 'CGBK' || $_POST['ctransaction'] == 'INSF' || $_POST['ctransaction'] == 'CANCEL-REBILL') {
- $options = $this->get_options();
- global $wpdb;
- $user_id = 0;
- $sql = "SELECT user_id FROM " . $wpdb->usermeta . " WHERE meta_key = '_wpfl_membership_id' AND meta_value = '" . mysql_real_escape_string($_POST['ctransreceipt']) . "'";
- $results = $wpdb->get_results($sql);
- $user_id = $results[0]->user_id;
- if ($user_id > 0) {
- delete_user_meta($user_id, '_wpfl_membership_id');
- $user = get_userdata($user_id);
- $this->unsubscribe_to_ar($user->user_email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR'], $user_id);
- }
- }
- } else {
- die();
- }
- }
- function direct_receipt_is_valid($secretKey) {
- $pop = "";
- $keys = array('ccustname', 'ccustemail', 'ccustcc', 'ccuststate', 'ctransreceipt', 'cproditem', 'ctransaction', 'ctransaffiliate', 'ctranspublisher', 'cprodtype', 'cprodtitle', 'ctranspaymentmethod', 'ctransamount', 'caffitid', 'cvendthru');
- foreach($keys as $field) {
- $pop = $pop . $_POST[$field] . "|";
- }
- $pop = $pop . $secretKey;
- $calcedVerify = strtoupper(substr(sha1($pop), 0, 8));
- return $calcedVerify == $_POST["cverify"];
- }
- function process_digiresults_notify() {
- $options = $this->get_options();
- if ($this->direct_receipt_is_valid($options['dr_api_key'])) {
- if ($_POST['ctransaction'] == 'SALE' OR $_POST['ctransaction'] == 'TEST_SALE') {
- $tran_id = $tx_id = $_POST['ctransreceipt'];
- $_POST['payer_email'] = $_POST['ccustemail'];
- $user_name = $email = $_POST['payer_email'];
- $random_password = substr(md5(get_option('wpfl_Activation_Timestamp') . $email), -8);
- require_once (ABSPATH . WPINC . '/registration.php');
- $user_id = username_exists($email);
- if ($user_id != null) {
- wp_update_user(array('ID' => $user_id, 'user_pass' => $random_password));
- } else {
- $user_id = wp_create_user($user_name, $random_password, $email);
- }
- wp_update_user(array('ID' => $user_id, 'first_name' => $_POST['ccustfirstname'], 'last_name' => $_POST['ccustlastname']));
- wp_new_user_notification($user_id, $random_password);
- update_user_meta($user_id, '_wpfl_membership_id', $tran_id);
- if (isset($this)) {
- $this->subscribe_to_ar($email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR']);
- }
- } else if ($_POST['ctransaction'] == 'RFND' || $_POST['ctransaction'] == 'CGBK' || $_POST['ctransaction'] == 'INSF' || $_POST['ctransaction'] == 'CANCEL-REBILL') {
- $options = $this->get_options();
- global $wpdb;
- $user_id = 0;
- $sql = "SELECT user_id FROM " . $wpdb->usermeta . " WHERE meta_key = '_wpfl_membership_id' AND meta_value = '" . mysql_real_escape_string($_POST['ctransreceipt']) . "'";
- $results = $wpdb->get_results($sql);
- $user_id = $results[0]->user_id;
- if ($user_id > 0) {
- delete_user_meta($user_id, '_wpfl_membership_id');
- $user = get_userdata($user_id);
- $this->unsubscribe_to_ar($user->user_email, 'cuslist', $this->get_options(), $_SERVER['REMOTE_ADDR'], $user_id);
- }
- }
- } else {
- die();
- }
- }
- function ipnVerification($secretKey) {
- $pop = "";
- $ipnFields = array();
- foreach($_POST as $key => $value) {
- if ($key == "cverify") {
- continue;
- }
- $ipnFields[] = $key;
- }
- sort($ipnFields);
- foreach($ipnFields as $field) {
- $pop = $pop . $_POST[$field] . "|";
- }
- $pop = $pop . $secretKey;
- $calcedVerify = sha1(mb_convert_encoding($pop, "UTF-8"));
- $calcedVerify = strtoupper(substr($calcedVerify, 0, 8));
- return $calcedVerify == $_POST["cverify"];
- }
- function save_ar($name) {
- $info = array();
- $info['type'] = htmlentities($_POST[$name . '_type']);
- if ($_POST[$name . '_type'] == 'AW') {
- $info['email'] = htmlentities($_POST[$name . '_email']);
- } else if ($_POST[$name . '_type'] == 'GR') {
- $info['api_key'] = htmlentities($_POST[$name . '_api_key']);
- $info['name'] = htmlentities($_POST[$name . '_name']);
- require_once "lib/jsonRPCClient.php";
- $client = new jsonRPCClient('http://api2.getresponse.com');
- $result = NULL;
- try {
- $result = $client->get_campaigns($info['api_key'], array('name' => array('EQUALS' => $info['name'])));
- }
- catch(Exception $e) {
- echo "<div id='wpfl-warning' class='wpfl-error'><p>Invalid API key. Use the Back Button to fix it.</p></div>";
- }
- $info['id'] = array_pop(array_keys($result));
- } else if ($_POST[$name . '_type'] == 'IM') {
- $info['id'] = htmlentities($_POST[$name . '_id']);
- }
- return $info;
- }
- function unsubscribe_to_ar($email, $field, $options, $ip, $user_id) {
- if ($options[$field]['type'] == 'AW') {
- $list = $options[$field]['email'];
- if ($email != "" && $email != null && $list != "" && $list != null && $options['unsubscribe'] == 1) {
- $headers = 'From: ' . $options['from_email'] . "\r\n";
- $body = 'REMOVE#' . $email . '#WPFL#' . $list;
- mail($list, $body, "Unsubscribe email.", $headers);
- delete_user_meta($user_id, '_wpfl_sub_sent');
- }
- } else if ($options[$field]['type'] == 'GR') {
- } else if ($options[$field]['type'] == 'IM') {
- }
- }
- function subscribe_to_ar($email, $field, $options, $ip) {
- if ($options[$field]['type'] == 'AW') {
- $list = $options[$field]['email'];
- if ($email != "" && $email != null && $list != "" && $list != null) {
- $headers = 'From: ' . $email . "\r\n";
- @mail($list, 'Subscribe', "Subscribe Email", $headers);
- }
- } else if ($options[$field]['type'] == 'GR') {
- require_once "lib/jsonRPCClient.php";
- $client = new jsonRPCClient('http://api2.getresponse.com');
- $result = NULL;
- try {
- $result = $client->add_contact($options[$field]['api_key'], array('campaign' => $options[$field]['id'], 'name' => $email, 'email' => $email, 'cycle_day' => '0'));
- }
- catch(Exception $e) {
- die($e->getMessage());
- }
- } else if ($options[$field]['type'] == 'IM') {
- $id = $options[$field]['id'];
- if ($ip == "") {
- $ip = $_SERVER['REMOTE_ADDR'];
- }
- $url = 'http://www.imnicamail.com/v4/api.php?Command=Subscriber.Subscribe&ResponseFormat=JSON&ListID=' . $id . '&EmailAddress=' . $email . '&IPAddress=' . $ip;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, 'Content-type: application/json;');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $response = curl_exec($ch);
- curl_close($ch);
- }
- }
- }
- } else {
- exit("Class WP File Lock already declared!");
- }
- $WPFL = new WPFileLock();
- function wpfl_install() {
- global $wpdb;
- $query = "SELECT ID from $wpdb->posts WHERE post_password='' AND post_type IN ('post', 'page') AND post_status = 'publish' ORDER BY post_title DESC";
- $posts = $wpdb->get_results($query);
- foreach($posts AS $post) {
- add_post_meta($post->ID, '_wpfl_protected', '0', true);
- }
- update_user_meta(1, '_wpfl_membership_id', 'manual');
- $widgets = get_option('sidebars_widgets');
- $size = count($widgets['primary-widget-area']);
- for ($i = $size - 1;$i >= 0;$i--) {
- $widgets['primary-widget-area'][$i + 1] = $widgets['primary-widget-area'][$i];
- }
- $widgets['primary-widget-area'][0] = 'wp-file-lock-smart-login';
- add_option('sidebars_widgets', $widgets);
- add_option('wpfl_Activation_Timestamp', time(), '', 'no');
- }
- ?>
Add Comment
Please, Sign In to add comment