AmazoLinkenator Settings';
array_unshift($links, $settings_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'AmazoLinkenator_settings_link' );
// build the class for all of this
class AmazoLinkenator_Settings_Page
{
// Holds the values to be used in the fields callbacks
private $options;
// start your engines!
public function __construct()
{
add_action( 'admin_menu', array( $this, 'AmazoLinkenator_add_plugin_page' ) );
add_action( 'admin_init', array( $this, 'AmazoLinkenator_page_init' ) );
}
// add options page
public function AmazoLinkenator_add_plugin_page()
{
// This page will be under "Settings"
add_options_page(
'AmazoLinkenator Settings Admin',
'AmazoLinkenator Settings',
'manage_options',
'AmazoLinkenator_settings',
array( $this, 'AmazoLinkenator_create_admin_page' )
);
}
// options page callback
public function AmazoLinkenator_create_admin_page()
{
// Set class property
$this->options = get_option( 'AmazoLinkenator_options' );
?>
Save your settings once after upgrading to the latest version.
';
}
// version number callback
public function AmazoLinkenator_the_version_callback()
{
printf(
'',
isset( $this->options['the_version'] ) ? esc_attr( $this->options['the_version']) : esc_attr( $this->options['the_version'])
);
}
// api key callback
public function AmazoLinkenator_amazon_affiliate_key_callback()
{
printf(
'
Enter Your Amazon Affiliate Key. Make sure it is correct; it is not validated.
Check if you want to Affiliate the Amazon URLs in page/post content. URLs are affiliated only on content save/update.
",
isset($this->options['enable_affiliator_posts'] ) ? '1' : '0'
);
}
// comment checkbox callback
public function AmazoLinkenator_enable_comments_callback()
{
printf(
"
options[enable_comments] , false ) . " />
Check if you want to Affiliate the Amazon URLs in post comments. URLs in comments are only affiliated when the comment is saved or updated.
",
isset($this->options['enable_comments'] ) ? '1' : '0'
);
}
// comment checkbox callback
public function AmazoLinkenator_auto_shorten_callback()
{
printf(
"
options[auto_shorten] , false ) . " />
Check if you want to automatically shorten the URL (great for 'hiding' your Affiliate codes). URLs are only shortened when a post/page/comment is saved or updated. Requires you to get set up an Bit.ly Application here https://bitly.com/a/create_oauth_app , and then get a 'Generic Access Token' here https://bitly.com/a/oauth_apps. Enter your Bit.ly Generic Access Token below.. You can check shortened URLs here for your affiliate code.
",
isset($this->options['enable_comments'] ) ? '1' : '0'
);
}
// comment checkbox callback
public function AmazoLinkenator_bitly_token_callback()
{
printf(
'
Enter Your Bit.ly Generic Access Token Make sure it is correct; it is not validated.
',
isset( $this->options['bitly_token'] ) ? esc_attr( $this->options['bitly_token']) : ''
);
}
}
if( is_admin() )
// end of the class stuff
$my_settings_page = new AmazoLinkenator_Settings_Page();
// ----------------------------------------------------------------------------
// supporting functions
// ----------------------------------------------------------------------------
// display the top info part of the page
// ----------------------------------------------------------------------------
function AmazoLinkenator_info_top() {
//$image = plugin_dir_url( __FILE__ ) . '/assets/AmazoLinkenator_logo.png';
$image1 = plugin_dir_url( __FILE__ ) . '/assets/icon-128x128.png';
$image2 = plugin_dir_url( __FILE__ ) . '/assets/banner-772x250.png';
?>
AmazoLinkenator will automatically (without any effort on your part) add your Amazon Affiliate code to any Amazon URLs. This will happen for pages, posts, and comments (depending on your settings below). Because you don't have to do anything special to affiliate a URL, this plugin is great for sites with lots of authors.
The big advantage is that if you find an Amazon item that you want to include in a page and post, you don't need to do any extra steps to add your affiliate code. Just paste the Amazon link in the page/post, and Publish. Your Amazon Affiliate link will automatically be added to the product URL.
And AmazoLinkenator also works with any Amazon product links that your site commenters might add. If anyone includes a link in their comment that has their Amazon Affiliate code, it will be replaced with your affiliate code. All automatically!
URLs are affiliated only when posts/pages/comments are saved/updated/submitted. Any prior content will get the current affiliate code if it is re-saved.
All you need is a valid Amazon Affiliate Key; start here. The plugin doesn't check for a valid Amazon Affiliate key. Any URL affiliated will not be re-affiliated, and will stay the same.
Plus, there's an option to automatically shorten the URL. This is great for 'hiding' your Amazon Affilliate link code. You just need a free Bit.ly Generic Access Token (start here).