paied_users_table = $wpdb->prefix . $this->prefix . "_users"; $this->paied_items_table = $wpdb->prefix . $this->prefix . "_items"; $this->paypal_payment_info_table=$wpdb->prefix . $this->prefix . "_payment_info"; $this->paypal_url="https://www.paypal.com/cgi-bin/webscr"; if (get_option($this->prefix.'_test')=='checked'){ $this->paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; } $this->paypal_email = get_option($this->prefix.'_PayPal_Email'); //Hook into wordpress add_action('admin_menu', array(&$this,'Are_PayPal_Configuration')); add_filter('the_content', array(&$this,'post_filter')); add_action('wp_head', array(&$this,'add_meta_tags_for_robots')); register_activation_hook(__FILE__,array(&$this,'install')); } function post_filter($content){ $start_delimiter="[".$this->prefix."_LoginPlease]"; $end_delimiter="[/".$this->prefix."_LoginPlease]"; global $current_user, $user_ID,$post_ID,$post; if ($user_ID == 0) {$user_ID = $current_user->id;} if ($post_ID == 0) {$post_ID = $post->id;} if ((!$this->IsGooglebot())&&(($user_ID == 0) || (!$this->IsPostPurchased($post_ID,$user_ID)))){ $start = strpos($content, $start_delimiter); $end = strpos($content, $end_delimiter); $pre = substr($content,0,$start); $suf = substr($content,$end,strlen($content)); if (!(($start===FALSE) && ($end===FALSE))){ if ($user_ID == 0){ $domain = $_SERVER['HTTP_HOST']; $url = "http://" . $domain . $_SERVER['REQUEST_URI']; $LoginButton="".__("Login").""; $content= $pre."
".get_option($this->prefix.'_TextToShowIfNotPurchased')."
".$this->paypal_buy_now_form($item_name.":".$item_title,$item_number,$item_amount,$item_currency,$post_ID,$user_ID).$suf; } } } } $content= str_replace($start_delimiter,'',$content); $content= str_replace($end_delimiter,'',$content); return $content; } function Are_PayPal_Configuration() { global $wpdb; if ( function_exists('add_submenu_page') ){ add_menu_page(__($this->prefix), __($this->prefix), 1, __FILE__, array(&$this,'Main_Configuration_Page')); add_submenu_page(__FILE__, __($this->prefix.' Configuration 2'), __('Post Prices'), 1,$this->prefix.'_PostSetup' , array(&$this,'Configure_Prices_For_Posts')); } } function install(){ global $wpdb; if($wpdb->get_var("SHOW TABLES LIKE '$this->paied_items_table'") != $this->paied_items_table) { $sql = "CREATE TABLE " . $this->paied_items_table . " ( `id` bigint(20) NOT NULL auto_increment, `post_id` bigint(20) NOT NULL, `name` varchar(255) NOT NULL, `number` varchar(255) default NULL, `amount` double NOT NULL, `currency` char(3) NOT NULL, UNIQUE KEY `id` (`id`) );"; $sql = $sql . "CREATE TABLE " . $this->paied_users_table . " ( `id` bigint(20) NOT NULL auto_increment, `post_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, UNIQUE KEY `id` (`id`) );"; $sql=$sql." CREATE TABLE ".$this->paypal_payment_info_table." ( `FIRSTNAME` VARCHAR(100) NOT NULL DEFAULT '', `LASTNAME` VARCHAR(100) NOT NULL DEFAULT '', `BUYER_EMAIL` VARCHAR(100) NOT NULL DEFAULT '', `STREET` VARCHAR(100) NOT NULL DEFAULT '', `CITY` VARCHAR(50) NOT NULL DEFAULT '', `STATE` CHAR(3) NOT NULL DEFAULT '', `ZIPCODE` VARCHAR(11) NOT NULL DEFAULT '', `MEMO` VARCHAR(255) DEFAULT NULL, `ITEMNAME` VARCHAR(255) DEFAULT NULL, `ITEMNUMBER` VARCHAR(50) DEFAULT NULL, `OS0` VARCHAR(20) DEFAULT NULL, `ON0` VARCHAR(50) DEFAULT NULL, `OS1` VARCHAR(20) DEFAULT NULL, `ON1` VARCHAR(50) DEFAULT NULL, `QUANTITY` CHAR(3) DEFAULT NULL, `PAYMENTDATE` VARCHAR(50) NOT NULL DEFAULT '', `PAYMENTTYPE` VARCHAR(10) NOT NULL DEFAULT '', `TXNID` VARCHAR(30) NOT NULL DEFAULT '', `MC_GROSS` VARCHAR(6) NOT NULL DEFAULT '', `MC_FEE` VARCHAR(5) NOT NULL DEFAULT '', `PAYMENTSTATUS` VARCHAR(15) NOT NULL DEFAULT '', `PENDINGREASON` VARCHAR(10) DEFAULT NULL, `TXNTYPE` VARCHAR(10) NOT NULL DEFAULT '', `TAX` VARCHAR(10) DEFAULT NULL, `MC_CURRENCY` VARCHAR(5) NOT NULL DEFAULT '', `REASONCODE` VARCHAR(20) NOT NULL DEFAULT '', `CUSTOM` VARCHAR(255) NOT NULL DEFAULT '', `COUNTRY` VARCHAR(20) NOT NULL DEFAULT '', `DATECREATION` DATE NOT NULL DEFAULT '0000-00-00');"; require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); dbDelta($sql); add_option($this->prefix."_db_version", "1.0"); } } function Main_Configuration_Page() { if ( isset($_POST['submit']) ) { check_admin_referer(); $Value = $_POST['TextToShowIfNotLogedIn']; update_option($this->prefix.'_TextToShowIfNotLogedIn', $Value); $Value = $_POST['PayPal_Email']; update_option($this->prefix.'_PayPal_Email', $Value); $Value = $_POST['test']; update_option($this->prefix.'_test', $Value); $Value = $_POST['TextToShowIfNotPurchased']; update_option($this->prefix.'_TextToShowIfNotPurchased', $Value); $LastAction = __("Updated successfully ..."); } ?>'.$LastAction.'
Aurimas Norkevicius for help with the plugin.')); ?>
'.$LastAction.'
'.$LastAction.'
| $item_id | \n"; echo "$item_title | \n"; echo "";
$users = $wpdb->get_results("SELECT user_login FROM $wpdb->users u INNER JOIN $this->paied_users_table up ON up.user_id=u.id and up.post_id=$item_id");
foreach($users as $user) {
echo $user->user_login;
echo " "; } echo " | \n";
echo "$item_name | \n"; echo "$item_number | \n"; echo "$item_amount | \n"; echo "$item_currency | \n"; ?>if ($item->post_id){ ?>=_e('Clear Priceing')?> | } ?> =_e('Edit')?> | echo '
| '.__('No Posts Found').' | |||||||