1<?php
2/*
3 * Copyright (c) 2014 Mark C. Prins <mprins@users.sf.net>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17if (!defined('DOKU_INC'))
18	die ();
19
20if (!defined('DOKU_PLUGIN'))
21	define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
22require_once (DOKU_PLUGIN . 'action.php');
23
24/**
25 * DokuWiki Plugin mapillary (Action Component).
26 *
27 * @license BSD license
28 * @author Mark C. Prins <mprins@users.sf.net>
29 */
30class action_plugin_mapillary extends DokuWiki_Action_Plugin {
31
32	/**
33	 * Register for events.
34	 *
35	 * @param Doku_Event_Handler $controller
36	 *        	DokuWiki's event controller object. Also available as global $EVENT_HANDLER
37	 */
38	public function register(Doku_Event_Handler $controller) {
39		$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_mapillary_btn', array());
40	}
41
42	/**
43	 * Inserts the toolbar button.
44	 *
45	 * @param Doku_Event $event
46	 *        	the DokuWiki event
47	 */
48	function insert_mapillary_btn(Doku_Event&$event, $param) {
49		$event->data [ ] = array(
50				'type' => 'format',
51				'title' => 'Mapillary widget',
52				'icon' => '../../plugins/mapillary/images/mapillary.png',
53				'open' => '{{mapillary>',
54				'sample' => 'JEyWkAPk0cqzCvh09HRABg',
55				'close' => '&500}}'
56		);
57	}
58}