-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCFDBShortcodeDataTable.php
executable file
·55 lines (43 loc) · 2.6 KB
/
CFDBShortcodeDataTable.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
<?php
/*
"Contact Form to Database" Copyright (C) 2011-2013 Michael Simpson (email : [email protected])
This file is part of Contact Form to Database.
Contact Form to Database 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 3 of the License, or
(at your option) any later version.
Contact Form to Database 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 Contact Form to Database.
If not, see <http://www.gnu.org/licenses/>.
*/
require_once('ShortCodeScriptLoader.php');
class CFDBShortcodeDataTable extends ShortCodeScriptLoader {
public function handleShortcode($atts, $content = null) {
$atts['content'] = $content;
$atts['useDT'] = true;
require_once('CFDBShortcodeTable.php');
$sc = new CFDBShortcodeTable();
return $sc->handleShortcode($atts, $content);
}
public function register($shortcodeName) {
parent::register($shortcodeName);
// Unfortunately, can't put styles in the footer so we have to always add this style sheet
// There is an article about how one might go about this here:
// http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/
// But it appears to expects posts on the page and I'm concerned it will not work in all cases
// Just enqueuing it causes problems in some pages. Need a targeted way to do this.
// wp_enqueue_style('datatables-demo', 'http://www.datatables.net/release-datatables/media/css/demo_table.css');
}
public function addScript() {
wp_enqueue_style('bootstrapdt', plugins_url('/', __FILE__) . 'DataTables/media/css/dataTables.bootstrap.css', array( ), '3.0.0', false );
wp_enqueue_script('bootstrapjs', plugins_url('/', __FILE__) . 'DataTables/media/js/dataTables.bootstrap.js', array('jquery'), '3.0.0', true );
// wp_print_styles('datatables-demo');
wp_enqueue_script('datatables', plugins_url('/', __FILE__) . 'DataTables/media/js/jquery.dataTables.min.js', array('jquery'));
do_action_ref_array('cfdb_edit_enqueue', array());
wp_print_scripts('datatables');
}
}