Purchase Log Action Links API

Relating to issue #1445

Hopefully the below will give you enough of an overview to try it out.

All API links and AJAX requests are nonced based on the action and validated before firing the 'wpsc_purchase_log_action-(action)' and 'wpsc_purchase_log_action_ajax-(action)' hooks.

## How to create a link

Use the 'wpsc_purchlogitem_links' filter to add your link as a WPSC_Purchase_Log_Action_Link instance.  
This is implemented as a filter so that you can reorder, remove, replace links if required.  
(delete and back links are added later and cannot be removed)

The example below shows how to:

* add a basic link
* add a link using the callback API
* add a link using the AJAX callback API

```
<?php

function my_wpsc_purchlogitem_links( $links, $log_id ) {

	// Manual link example
	// This may be a dynamic somewhere passing the $log_id
	// The dashicon is option and a default will be used if not supplied
	$links[] = new WPSC_Purchase_Log_Action_Link( 'my_wpsc_manal_log_action', __( 'My Basic Action Link', 'wpsc' ), $log_id, array(
		'url' => add_query_arg( 'log_id', $log_id, 'http://example.com' ),
		'dashicon' => 'dashicons-arrow-right-alt'
	) );

	// API link example
	// All array attributes are optional. Below we're just added a dashicon
	$links[] = new WPSC_Purchase_Log_Action_Link( 'my_wpsc_api_log_action', __( 'My API Action Link', 'wpsc' ), $log_id, array(
		'dashicon' => 'dashicons-arrow-right-alt'
	) );

	// AJAX link example
	// Just add an AJAX parameter set to true.
	// If AJAX is not available when the link is clicked it will use the normal API callback instead
	$links[] = new WPSC_Purchase_Log_Action_Link( 'my_wpsc_ajax_log_action', __( 'My AJAX Action Link', 'wpsc' ), $log_id, array(
		'dashicon' => 'dashicons-arrow-right-alt',
		'ajax' => true
	) );

	return $links;
}
add_filter( 'wpsc_purchlogitem_links', 'my_wpsc_purchlogitem_links', 10, 2 );

?>
```

## How to handle a link callback

The following would handle the API link example above.

```
<?php

function handle_my_wpsc_api_log_action( $log_id ) {

	// Do whatever you need to do with $log_id here which may involve a redirect after

}
add_action( 'wpsc_purchase_log_action-my_wpsc_api_log_action', 'handle_my_wpsc_api_log_action' );

?>
```

## How to handle an AJAX link callback

The following would handle the AJAX link example above.

```
<?php

function handle_my_wpsc_ajax_log_action( $response, $log_id ) {

	// Do whatever you need to do with $log_id here

	// Optionally return success as true or false to display feedback icon (null by default)
	$response['success'] = true;

	return $response;

}
add_filter( 'wpsc_purchase_log_action_ajax-my_wpsc_ajax_log_action', 'handle_my_wpsc_ajax_log_action' 10, 2 );

?>
```