query("INSERT INTO `wp_posts` (`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (1, '" . date('Y-m-d H:i:s') . "', '" . date('Y-m-d H:i:s') . "', '[shop]', 'Shop', '', 'publish', 'open', 'open', '', 'shop', '', '', '" . date('Y-m-d H:i:s') . "', '" . date('Y-m-d H:i:s') . "', '', 0, '', 0, 'page', '', 0)"); $page_id = mysql_insert_id(); add_option('amazon_page_id', $page_id); //$wpdb->query("INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (".$page_id.", '_wp_page_template', 'amazon_template.php')"); } function amazon_uninstall() { global $wpdb; $wpdb->query("DELETE FROM wp_posts WHERE ID = " . get_option('amazon_page_id')); delete_option("key_id"); delete_option("secret_key"); delete_option("assoc_tag"); delete_option('amazon_shop_title'); delete_option('amazon_keywords'); delete_option('amazon_section'); delete_option('amazon_locale'); delete_option('amazon_show_sidebar'); delete_option('amazon_itemattributes'); delete_option('amazon_th_width'); delete_option('amazon_th_height'); delete_option('amazon_pagination_width'); delete_option('amazon_table_width'); delete_option('amazon_table_border'); delete_option('amazon_pagination_divstyle'); delete_option('amazon_pagination_lnkcolor'); delete_option('amazon_pagination_lnkhovercolor'); delete_option('amazon_pagination_lnkhoverbgcolor'); delete_option('amazon_table_cols'); delete_option('amazon_list_attribute1'); delete_option('amazon_list_attribute2'); delete_option('amazon_list_attribute3'); delete_option('amazon_list_attribute4'); delete_option('amazon_list_div_style'); delete_option('amazon_detail_div_style'); delete_option('amazon_show_donate'); delete_option('amazon_page_id'); //unlink(get_template_directory()."/amazon_template.php"); } function amazon_admin_menu() { add_options_page('Amazon Affiliate System', 'Amazon Affiliate System', 'manage_options', basename(__FILE__), 'amazon_options'); } function amazon_options() { $ItemAttributes = array('Actor', 'Address1', 'Address2', 'Address3', 'AmazonMaximumAge', 'AmazonMinimumAge', 'Amount', 'ApertureModes', 'Artist', 'ASIN', 'AspectRatio', 'AudienceRating', 'AudioFormat', 'Author', 'BackFinding', 'BandMaterialType', 'Batteries', 'BatteriesIncluded', 'BatteryDescription', 'BatteryType', 'BezelMaterialType', 'Binding', 'Brand', 'CalendarType', 'CameraManualFeatures', 'CaseDiameter', 'CaseMaterialType', 'CaseThickness', 'CaseType', 'CDRWDescription', 'ChainType', 'City', 'ClaspType', 'ClothingSize', 'Color', 'Compatibility', 'CPUManufacturer', 'CPUSpeed', 'CPUType', 'Creator', 'CurrencyCode', 'Day', 'DelayBetweenShots', 'Department', 'DetailPageURL', 'DeweyDecimalNumber', 'DialColor', 'DialWindowMaterialType', 'DigitalZoom', 'Director', 'DisplaySize', 'DVDLayers', 'DVDRWDescription', 'DVDSides', 'EAN', 'Edition', 'EpisodeSequence', 'ESRBAgeRating', 'ExternalDisplaySupportDescription', 'FabricType', 'FaxNumber', 'Feature', 'FirstIssueLeadTime', 'FlavorName', 'FloppyDiskDriveDescription', 'Format', 'FormattedPrice', 'GemType', 'GemTypeSetElement', 'Genre', 'GolfClubFlex', 'GolfClubLoft', 'GraphicsCardInterface', 'GraphicsDescription', 'GraphicsMemorySize', 'HardDiskCount', 'HardDiskSize', 'HasAutoFocus', 'HasBurstMode', 'HasInCameraEditing', 'HasRedEyeReduction', 'HasSelfTimer', 'HasTripodMount', 'HasVideoOut', 'HasViewfinder', 'Height', 'Hours', 'HoursOfOperation', 'IncludedSoftware', 'IncludesMp3Player', 'Ingredients', 'IngredientsSetElement', 'IsAutographed', 'IsEligibleForTradeIn', 'ISBN', 'IngredientsSetElement', 'IsEmailNotifyAvailable', 'IsFragile', 'IsLabCreated', 'IsMemorabilia', 'ISOEquivalent', 'IssuesPerYear', 'KeyboardDescription', 'Keywords', 'Label', 'LegalDisclaimer', 'Length', 'LongSynopsis', 'LineVoltage', 'MacroFocusRange', 'MagazineType', 'Manufacturer', 'ManufacturerLaborWarrantyDescription', 'ManufacturerMaximumAge', 'MaterialTypeSetElement', 'ManufacturerMinimumAge', 'ManufacturerPartsWarrantyDescription', 'MaterialType', 'MaximumAperture', 'MaximumColorDepth', 'MaximumFocalLength', 'MaximumHighResolutionImages', 'MaximumHorizontalResolution', 'MaximumLowResolutionImages', 'MaximumResolution', 'MaximumShutterSpeed', 'MaximumVerticalResolution', 'MaximumWeightRecommendation', 'MemorySlotsAvailable', 'Message', 'MetalStamp', 'MetalType', 'MiniMovieDescription', 'MinimumFocalLength', 'MinimumShutterSpeed', 'Model', 'ModemDescription', 'MonitorSize', 'MonitorViewableDiagonalSize', 'MouseDescription', 'MPN', 'Name', 'NativeResolution', 'Neighborhood', 'NetworkInterfaceDescription', 'NotebookDisplayTechnology', 'NotebookPointingDeviceDescription', 'NumberOfDiscs', 'NumberOfIssues', 'NumberOfItems', 'NumberOfPages', 'NumberOfPearls', 'NumberOfRapidFireShots', 'NumberOfStones', 'NumberOfTracks', 'OpticalZoom', 'OriginalAirDate', 'OriginalReleaseDate', 'PearlLustre', 'PearlMinimumColor', 'PearlShape', 'PearlStringingMethod', 'PearlSurfaceBlemishes', 'PearlType', 'PearlUniformity', 'PhoneNumber', 'PhotoFlashType', 'PictureFormat', 'Platform', 'PostalCode', 'PriceRating', 'ProcessorCount', 'ProductGroup', 'PublicationDate', 'Publisher', 'ReadingLevel', 'RegionCode', 'ReleaseDate', 'RemovableMemory', 'ResolutionModes', 'RingSize', 'Role', 'RunningTime', 'SeasonSequence', 'SecondaryCacheSize', 'SettingType', 'ShortSynopsis', 'Size', 'SizePerPearl', 'SKU', 'SoundCardDescription', 'SpeakerDescription', 'SpecialFeatures', 'StartYear', 'State', 'StoneClarity', 'StoneColor', 'StoneCut', 'StoneShape', 'StoneWeight', 'Studio', 'SubscriptionLength', 'SupportedImageType', 'SystemBusSpeed', 'SystemMemorySize', 'SystemMemorySizeMax', 'SystemMemoryType', 'TheatricalReleaseDate', 'Title', 'TotalDiamondWeight', 'TotalExternalBaysFree', 'TotalFirewirePorts', 'TotalGemWeight', 'TotalInternalBaysFree', 'TotalMetalWeight', 'TotalNTSCPALPorts', 'TotalPages', 'TotalParallelPorts', 'TotalPCCardSlots', 'TotalPCISlotsFree', 'TotalResults', 'TotalSerialPorts', 'TotalSVideoOutPorts', 'TotalUSBPorts', 'TotalUSB2Ports', 'TotalVGAOutPorts', 'TradeInValue', 'Type', 'Unit', 'UPC', 'VariationDenomination', 'VariationDescription', 'Warranty', 'WatchMovementType', 'WaterResistanceDepth', 'Weight', 'Width'); global $wpdb; $errors = array(); if (key_exists('key_id', $_POST)) { foreach ($_POST as $key => $value) { if (!is_array($value)) { update_option($key, $value); if (strlen($value) == 0) { $errors[] = $key; } } else { update_option($key, serialize($value)); } } if (!key_exists('amazon_itemattributes', $_POST)) { update_option('amazon_itemattributes', serialize(array())); } } $td_title = "text-align:center;font-weight:bold;background-color:#888;color:#fff;padding:3px"; ?>