AnodyneXtras

We're So Sorry...

Because of the nature of downloading and uploading content with AnodyneXtras, it is not available on mobile devices. If you want to browse, search, and upload, please use a laptop or desktop computer.

You can also check out some of our other sites and services using the links below.


Parser Events MOD

by Jon Matterson

NOTE: Because of formatting issues on the Xtras site, this README may be better viewed at: https://github.com/jonmatterson/nova-mod-parser_events

This mod adds the ability to listen for parser events, namely the parse_string method used to generate Nova emails.

Requirements

This extension requires:

  • Nova 2.6+

Installation

If you do not already have a file application/libraries/MY_Parser.php, simply copy the file application/libraries/MY_Parser.php into your application/libraries folder.

If you do have a custom file application/libraries/MY_Parser.php already, you need to copy the parse_string method from the corresponding module in this file into your existing file. If you already have a custom version of parse_string not from this mod, then you'll need to modify your code to emit the two events as shown in this module's file.

Usage

This mod adds two events:

  1. parser.parse_string.data.[route...], where the route segments from your URL are separated by .; and
  2. parser.parse_string.output.[route...], where the route segments from your URL are separated by ..

The parser.parse_string.data is emitted before the string is parsed, allowing you to manipulate the data being loaded into the string (contained in the property data in the event object passed to the listener). The parser.parse_string.output is emitted after the string has been parsed, allowing you to manipulate the output of the parser (contained in the property output of the event object passed to the listener).

An example of manipulating the data for the emails sent from the join form:

$this->event->listen(['parser', 'parse_string', 'data', 'main', 'join'], function($event){
    // edit properties of $event['data']
});

An example of manipulating the output of the emails sent from the join form:

$this->event->listen(['parser', 'parse_string', 'output', 'main', 'join'], function($event){
    // edit the string $event['output']
});

If you do not already have a file application/libraries/MY_Parser.php, simply copy the file application/libraries/MY_Parser.php into your application/libraries folder.

If you do have a custom file application/libraries/MY_Parser.php already, you need to copy the parse_string method from the corresponding module in this file into your existing file. If you already have a custom version of parse_string not from this mod, then you'll need to modify your code to emit the two events as shown in this module's file.

In order to download Xtras, you must have an AnodyneID. You can log in or register your AnodyneID.

Details

Author
Jon Matterson
Downloads
59
Rating
5.0
Added
07 April 2019
Last Updated
16 August 2019