These instructions are for implementing a new Processor for an AJAX action:

1. Create a new class that implements Processor_Base and the following functions:

- verify_ajax_nonce : verifies the relevant nonce.
- get_data_map : registers the data map which represents the structure of data received via the AJAX call. This - part is important in order to keep calls secure and lean. See example below.
process_entry : Processes the entry that was stored in the DB. A simple implementation would be to call the appropriate AJAX hook that was prevented by this plugin.

* An example of a more complicated Processor class can be found under this plugin's /processors directory, with the name 'class-pys.php' which is intended to process PixelYourSite Data.

2. Register the Processor and action:
The action and according class_name should be registered in order to be used later in the MU Plugin.
It's better to register only once when you're sure it is needed, however, you can register multiple times without duplication.

Example:
add_action('admin_init', 'your_code_load_processors');

function your_code_load_processors() {
    
    $_processors = new \QACP\Processors();

    // Sets a directory to load Processors from, in addition to the default QACP directory.
    // The custom directories will be searched for a filename in the form of "{class_name}.php" and
    // before the default directory is searched.
    //
    $_processors->register_custom_processor_directory( __DIR__ . '/processors' );
    
    // Sets an action and a processor class name to load.
    // Class name is case insensitive.
    //
    $_processors->set_action( {action_name}, {class_name} );

    // or to remove.
    //
    $_processors->remove_action( {action_name}, {class_name} );

}

3. Example Data Map ( for 'get_data_map' function ):

$_data_map = array(
    'url' => array(
        'sanitize' => 'sanitize_text_field',
        'data_max_length' => 1024,
    ),
    'taxonomies' => array(
        'sanitize' => 'sanitize_text_field',
        'fields' => array(
            'categories' => [],
            'tags' => [],
        )
    ),
    'ids' => array(
        'sanitize_as_array' => true,
        'sanitize' => 'sanitize_text_field',
        'array_max_length' => 30,
        'data_max_length' => 256,
    ),
);
        