Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Plugins

Mickroz edited this page Sep 4, 2015 · 4 revisions

Plugins

w2w provides a simple plugin system using actions and filters. for now there are only 3 filters in shows namely: the_data = holds an array with all data from the shows hook_before_checkin = holds an array with buttons/links hook_after_checkin = holds an array with buttons/links

your plugin should contain the following code:

<?php
/**
* @ignore
*/
if (!defined('IN_W2W'))
{
	exit;
}

$log->info('plugins', 'new_data loaded');

register_filter('the_data','new_data');
 
function new_data($data)
{
// Your plugin code
return $data;
}
?>

if you want to put a button in for example hook_before_checkin, you have to extract the key 'hook_before_checkin' from the $data array which holds an simple array with all buttons, remember to store this as an array or otherwise you will get a bunch of errors. alway check if hook_before_checkin or hook_after_checkin exist in $data, they do not exist by default. $data is an array as follow:

Array
(
    [257655] => Array
        (
            [tvdbid] => 257655
            [show_name] => Arrow
            [tvrage_id] => 30715
            [show_slug] => arrow
            [trakt_id] => 1712337
            [message] => Arrow 1x01 Pilot
            [season] => 1
            [episode] => 1x01
            [episode_number] => 1
            [name] => Pilot
            [description] => After a violent shipwreck, billionaire playboy Oliver Queen was missing and presumed dead for five years before being discovered alive on a remote island in the Pacific. Back in Starling City, Oliver slowly reconnects with those closest to him. Oliver has brought back many new skills from his time on the island and despite the watchful eye of his new bodyguard John Diggle, Oliver manages to secretly create the persona of Arrow -- a vigilante -- to right the wrongs of his family and fight the ills of society. As Arrow, Oliver will atone for the past sins of his family while he searches for the personal redemption he needs.
            [status] => Downloaded
            [location] => /path/to/shows/Arrow/Season 01/Arrow - S01E01 - Pilot_HD TV-CtrlHD.mkv
            [subbed] => 1
			[hook_before_checkin] => Array
				(
					[0] => button 1
				)
			[hook_after_checkin] => Array
				(
					[0] => button 1
				)
        )
)```
Clone this wiki locally