-
Notifications
You must be signed in to change notification settings - Fork 1
/
towtruck.php
51 lines (42 loc) · 1.71 KB
/
towtruck.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
Plugin Name: Tow Truck
Plugin URI: https://derekmarcinyshyn.github.com/towtruck
Description: <a href="http://towtruck.mozillalabs.com/">Mozilla Labs Tow Truck</a> collaboration made easy.
Author: Derek Marcinyshyn
Author URI: http://derek.marcinyshyn.com
Version: 1.1
License: GPLv2
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Exit if called directly
defined( 'ABSPATH' ) or die ( 'Cannot access pages directly.' );
/**
* Add Tow Truck over https
*/
function add_tow_truck() {
if ( is_admin_bar_showing() )
wp_enqueue_script( 'tow-truck', 'https://towtruck.mozillalabs.com/towtruck.js', '', false, true );
}
add_action( 'init', 'add_tow_truck' );
/**
* Add Button for Tow Truck in Admin Bar
*/
function add_tow_truck_button() {
global $wp_admin_bar;
if ( is_admin_bar_showing() ) {
$meta = array( 'onclick' => 'TowTruck(this); return false;' );
$wp_admin_bar->add_menu( array( 'id' => 'tow-truck', 'title' => __( 'Start TowTruck', 'towtruck'), 'href' => "#", 'meta' => $meta ) );
}
}
add_action( 'admin_bar_menu', 'add_tow_truck_button', 1000 );