version = '2.0 Beta 1.1'; $this->plugin_home_url = 'http://manalang.com/wp-amazon'; $this->country = get_option('wpamazon_country_tld'); $this->associate_id = get_option('wpamazon_associate_id'); // Set defaults if properties aren't set if ( !$this->country ) update_option('wpamazon_country_tld', 'US'); } function check_for_updates() { $request = "GET http://svn.wp-plugins.org/wp-amazon/trunks/latest-version.txt HTTP/1.1\n"; $request .= "Host: svn.wp-plugins.org\n"; $request .= "Referer: " . $_SERVER["SCRIPT_URI"] . "\n"; $request .= "Connection: close\n"; $request .= "\n"; $fp = fsockopen("svn.wp-plugins.org", 80); fputs($fp, $request); while(!feof($fp)) { $result .= fgets($fp, 128); } fclose($fp); $result = split("\r\n", $result); foreach($result as $k) { if(!strncmp($k, "Version: ", 9)) { $result = $k; break; } } $version = split(": ", $k); $version = $version[1]; return $version; } function options_page() { if(isset($_POST['submitted'])) { update_option('wpamazon_country_tld', $_POST['wpamazon_country_tld']); update_option('wpamazon_associate_id', $_POST['wpamazon_associate_id']); //get any new variables $this->wp_amazon(); echo '

' . __('Options saved.', 'wpamazon') . '

'; } $this->country = get_option('wpamazon_country_tld'); $this->associate_id = get_option('wpamazon_associate_id'); $var[$this->country] = "selected"; $formaction = $_SERVER['PHP_SELF'] . "?page=wp-amazon/wp-amazon.php"; // Check if there is a new version of WP-Amazon $version_synch_val = get_option('wpamazon_check_version'); if ( empty($version_synch_val) ) add_option('wpamazon_check_version', '0'); if (get_option('wpamazon_check_version') < ( time() - 1200 ) ) { $latest_version = $this->check_for_updates(); update_option('wpamazon_check_version', time()); update_option('wpamazon_latest_version', $latest_version); } else { $latest_version = get_option('wpamazon_latest_version'); } if ($this->version != $latest_version ) $update = "plugin_home_url\" style=\"color:red\">Click here to get the latest update."; // Start outputting XHMTL ?>

Amazon Associates website for details.', 'wpamazon'); ?>


version, $latest_version, $update); ?>