getOptions(); $optionList = $this->get_option_list(); /*****************************************************************************************/ $Action = (isset($_POST[ 'AmazonLinkAction' ]) && check_admin_referer( 'update-AmazonLink-options')) ? $_POST[ 'AmazonLinkAction' ] : 'No Action'; // See if the user has posted us some information // If they did, the admin Nonce should be set. $update = False; if( $Action == __('Update Options', 'amazon-link') ) { // Update Current Wishlist settings foreach ($optionList as $optName => $optDetails) { if (isset($optDetails['Name'])) { // Read their posted value if ((($optName == 'pub_key') || ($optName == 'priv_key')) && ($Opts[$optName] != stripslashes($_POST[$optName]))) { $AWS_keys_updated = 1; $Opts[$optName] = trim(stripslashes($_POST[$optName])); } else { $Opts[$optName] = stripslashes($_POST[$optName]); } } } $this->saveOptions($Opts); $update = __('Options saved.', 'amazon-link' ); /*****************************************************************************************/ } else if ( $Action == __('Install Database','amazon-link')) { // User requested installation of the ip2nation database ?>
ip2n->install(); ?>
ip2n->uninstall(); ?>
"; print_r($Opts); echo ""; /* AWS Keys not yet validate, do a dummy request to see if we get any errors */ if (strlen($Opts['pub_key']) > 0) { if ((isset($AWS_keys_updated) || !$Opts['aws_valid'])) { $result = $this->validate_keys($Opts); $Opts['aws_valid'] = $result['Valid']; if (current_user_can('manage_options')) $this->saveOptions($Opts); if (!$result['Valid']) { $optionList['aws_valid']['Description'] = '' . __('AWS Request Failed, please check keys - Error Message: ','amazon-link') . $result['Message'] . ''; } } } else { $Opts['aws_valid'] = 0; } /*****************************************************************************************/ /* * If first run need to create a default settings */ $Update=False; foreach ($optionList as $optName => $optDetails) { if(!isset($Opts[$optName]) && isset($optDetails['Default']) && (!$optDetails['Name'])) { $Opts[$optName] = $optDetails['Default']; $Update = True; } } if ($Update && current_user_can('manage_options')) $this->saveOptions($Opts); /*****************************************************************************************/ if ($update !== False) { // ********************************************************** // Put an options updated message on the screen ?>