"General Settings",
"type" => "heading"),
array( "name" => "Amazon Affiliate ID",
"desc" => "Your Amazon Affiliate ID
",
"id" => $shortname_apipp."_amazon_associateid",
"type" => "text"),
array( "name" => "Amazon Public Key",
"desc" => "Your Amazon Public Key. If you do not have one, you will need to sign up for one. You can do so here.
",
"id" => $shortname_apipp."_amazon_publickey",
"type" => "text"),
array( "name" => "Amazon Private Key",
"desc" => "Your Amazon Private Key. Check out this page for more information on Public and Secret Keys.
",
"id" => $shortname_apipp."_amazon_secretkey",
"type" => "textlong"),
array( "name" => "Your Amazon Locale/Region",
"desc" => "The Locale to use for Amazon API Calls (ca,com,co.uk,de,fr,jp) Default is 'com' for US.
",
"id" => $shortname_apipp."_amazon_locale",
"type" => "select",
"options" => array(
"0" => array("value" => "com","text" => "US (default)"),
"1" => array("value" => "ca","text" => "Canada"),
"2" => array("value" => "co.uk","text" => "United Kingdom"),
"3" => array("value" => "de","text" => "Germany"),
"4" => array("value" => "fr","text" => "France"),
"5" => array("value" => "jp","text" => "Japan")
)),
array( "name" => "Language",
"desc" => "Language to use for Text and Button (currently only English, French and Spanish - default is English).
",
"id" => $shortname_apipp."_amazon_language",
"type" => "select",
"options" => array(
"0" => array("value" => "en","text" => "English (default)"),
"1" => array("value" => "fr","text" => "French"),
"2" => array("value" => "sp","text" => "Spanish")
)),
array( "name" => "Not Available Error Message",
"desc" => "The message to display if the item is not available for some reason, i.e., your locale or no longer available.
",
"id" => $shortname_apipp."_amazon_notavailable_message",
"type" => "textlong"),
array( "name" => "Amazon Hidden Price Message",
"desc" => "For Some products, Amazon will hide the List price of a product. When hidden, this plugin cannot show a price for the product. This message will display in the List Price area when that occurs.
",
"id" => $shortname_apipp."_amazon_hiddenprice_message",
"type" => "textlong"),
array( "name" => "Hook plugin into Excerpt?",
"desc" => "If you want to have the product displayed when the the_excerpt() function is called, select this box. Disable this function if your theme uses short excerpts on pages, such as the home page. You can override this on each individual page/post.
",
"id" => $shortname_apipp."_hook_excerpt",
"type" => "checkbox"),
array( "name" => "Hook plugin into Content?",
"desc" => "If you want to have the product displayed when the the_content() function is called, select this box. NOTE: This is the standard call - if you disable both Excerpt and Content, the only way you can add products to a page/post is to add the shortcode ([AMAZONPRODUCT=XXXXXX] where XXXXXX is the ASIN or ISBN 10). You can override this on each individual page/post.
",
"id" => $shortname_apipp."_hook_content",
"type" => "checkbox"),
array( "name" => "Quick Fix - Hide Warnings?",
"desc" => "IMPORTANT MESSAGE: if you check this box, the plugin will excecute the code, ini_set(\"display_errors\", 0); to force stop WARNING messages. This can be helpful if your server php configuration has error reporting on and you are getting warning messages. This WILL override any setting you have in your php.ini or php config files. It is not recommended you turn this on unless you need it.
",
"id" => $shortname_apipp."_hide_warnings_quickfix",
"type" => "checkbox"),
array( "name" => "Uninstall when deactivated?",
"desc" => "CAREFUL WITH THIS!! If you check this box, ALL settings and database items will be removed when you deativate the plugin
",
"id" => $shortname_apipp."_uninstall",
"type" => "checkbox"),
array( "name" => "Remove ALL traces when uninstalled?",
"desc" => "AGAIN, BE CAREFUL WITH THIS!! If you check this box AND the above box, ALL Amazon shortcodes will be removed from posts and pages and all meta data associated with this plugin will be cleaned up and cleared out when you deativate this plugin. As a safety precaution, both boxes must be checked or data will not be removed.
",
"id" => $shortname_apipp."_uninstall_all",
"type" => "checkbox"),
array( "name" => "Open Product Link in New Window?",
"desc" => "If you want to have the product displayed in a new window, check this box. Default is no.
",
"id" => $shortname_apipp."_open_new_window",
"type" => "checkbox"),
array( "name" => "Show on Single Page Only?",
"desc" => "If you want to have the product displayed only when the page/post is singular, check this box. Default is no.
",
"id" => $shortname_apipp."_show_single_only",
"type" => "checkbox"),
array( "name" => "API get method",
"desc" => "If you are seeing BLANK products it may be because your server does not support the php file_get_contents() function. If that is the case, try CURL option to see if it resolves the problem. Default is File Get Contents method.
",
"id" => $shortname_apipp."_API_call_method",
"type" => "select",
"options" => array(
"0" => array("value" => "0","text" => "file_get_contents() (default)"),
"1" => array("value" => "1","text" => "CURL"),
)),
array( "name" => "Use My Custom Styles?",
"desc" => "If you want to use your own styles, check this box and enter them below.
",
"id" => $shortname_apipp."_product_styles_mine",
"type" => "checkbox"),
array( "name" => "Product Styles",
"desc" => "Your Custom styles can go here.
",
"id" => $shortname_apipp."_product_styles",
"type" => "textareabig"),
);
// Functions
function apipp_options_add_subpage(){
global $fullname_apipp, $shortname_apipp, $options_apipp;
apipp_options_admin_page($fullname_apipp, $shortname_apipp, $options_apipp);
}
function apipp_options_add_admin_page($themename,$shortname,$options) {
$up_opt='';
if ( basename(__FILE__) == 'amazon-product-in-a-post-options.php' ) {
if(isset($_REQUEST['action'])){$req_action=$_REQUEST['action'];}else{$req_action='';}
if(isset($_REQUEST[$shortname.'_option'])){$req_option=$_REQUEST[$shortname.'_option'];}else{$req_option='';}
if ( 'save' == $req_action && $req_option== $shortname ) {
foreach ($options as $value) {
if($value['type'] != 'multicheck'){
update_option( $value['id'], $_REQUEST[ $value['id'] ] );
}else{
foreach($value['options'] as $mc_key => $mc_value){
$up_opt = $value['id'].'_'.$mc_key;
update_option($up_opt, $_REQUEST[$up_opt] );
}
}
}
foreach ($options as $value) {
if($value['type'] != 'multicheck'){
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); }
}else{
foreach($value['options'] as $mc_key => $mc_value){
$up_opt = $value['id'].'_'.$mc_key;
if( isset( $_REQUEST[ $up_opt ] ) ) { update_option( $up_opt, $_REQUEST[ $up_opt ] ); $update_optionapp=$_REQUEST[ $up_opt ];} else { delete_option( $up_opt );$update_optionapp=''; }
//echo $value['id'].'- - - -';
if( $value['id'] == 'apipp_API_call_method' ){
if($update_optionapp=='0'){
update_option('awsplugin_amazon_usefilegetcontents','1');
update_option('awsplugin_amazon_usecurl','0');
}else{
update_option('awsplugin_amazon_usefilegetcontents','0');
update_option('awsplugin_amazon_usecurl','1');
}
}
}
}
}
header("Location: admin.php?page=".$shortname."_plugin_admin&saved=true");
die;
} else if( 'reset' == $_REQUEST['action'] && $_REQUEST[$shortname.'_option']== $shortname ) {
foreach ($options as $value) {
if($value['type'] != 'multicheck'){
delete_option( $value['id'] );
}else{
foreach($value['options'] as $mc_key => $mc_value){
$del_opt = $value['id'].'_'.$mc_key;
delete_option($del_opt);
}
}
}
header("Location: admin.php?page=".$shortname."_plugin_admin&reset=true");
die;
}
}
}
function apipp_options_admin_page($themename, $shortname, $options) {
global $public_key,$private_key;
global $appuninstall;
global $appuninstallall;
if ( $_REQUEST['saved'] ) echo '
'.$themename.' settings saved.
'.$themename.' settings reset.