-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavis-qa.php
73 lines (59 loc) · 2.1 KB
/
navis-qa.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/***
* Plugin Name: Navis Q&A
* Description: Style Q&A posts in WordPress
* Version: 0.1
* Author: Chris Amico
* License: GPLv2
***/
/*
Copyright 2011 National Public Radio, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Navis_QA {
function __construct() {
// add tinymce buttons
// add admin styles
// include qa css
add_action('init', array(&$this, 'register_tinymce_filters'));
add_action('init', array(&$this, 'add_stylesheet'));
}
function register_tinymce_filters() {
add_filter('mce_external_plugins',
array(&$this, 'add_tinymce_plugin')
);
add_filter('mce_buttons',
array(&$this, 'register_button')
);
add_filter('mce_css', array(&$this, 'mce_css'));
}
function add_tinymce_plugin($plugins_array) {
$plugins_array['navis_qa'] = plugins_url(
'js/tinymce-qa.js', __FILE__);
return $plugins_array;
}
function register_button($buttons) {
array_push($buttons, '|', 'question', 'answer', '|');
return $buttons;
}
function add_stylesheet() {
$css = plugins_url( 'css/qa.css', __FILE__ );
wp_enqueue_style('qa-styles', $css, array(), '0.1');
}
function mce_css($mce_css) {
if (! empty($mce_css)) $mce_css .= ',';
$mce_css .= plugins_url( 'css/qa-editor.css?v=1', __FILE__ );
return $mce_css;
}
}
new Navis_QA;
?>