PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / source / class.tpl.php

class.tpl.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at source/class.tpl.php

74 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') or die("Cannot access pages directly.");
4
5 /**
6 * Class PDTTpl is an extremely lightweight templater used to render tables
7 * for the WPDataTables module.
8 *
9 * @author cjbug@ya.ru
10 *
11 * @since September 2012
12 */
13 class PDTTpl{
14
15 private $data;
16 private $body;
17 private $js;
18 private $css;
19
20 function setTemplate($b) { $this->body = $b; }
21 function addCss($c) { $this->data['_css'][] = $c; }
22 function addJs($j) { $this->data['_js'][] = $j; }
23 function addBread($n,$l) { $this->breadcrumbs[$n] = $l; }
24
25 function addData($key, $val){
26 $this->data[$key] = $val;
27 }
28
29 function addDataRef($key, $val){
30 $this->data[$key] = $val;
31 }
32
33 function showData(){
34 if(!empty($this->data)){
35 foreach ($this->data as $key=>$value) {
36 $$key=$value;
37 }
38 unset($this->data);
39 }
40 if(!empty($_css)){
41 foreach($_css as $css_file){
42 echo '<link rel="stylesheet" href="'.$css_file.'" type="text/css" media="screen, projection" />'."\n";
43 }
44 unset($_css);
45 }
46 if(!empty($_js)){
47 foreach($_js as $js_file){
48 echo '<script type="text/javascript" src="'.$js_file.'"></script>'."\n";
49 }
50 unset($_js);
51 }
52 /**
53 * New filter introduced in version 1.6
54 *
55 * @author Vladica Bibeskovic
56 */
57 $template_file = apply_filters('wpdatatables_filter_template_file_location', WDT_TEMPLATE_PATH . $this->body);
58 if( file_exists( $template_file )) {
59 include( $template_file );
60 } else {
61 include( WDT_TEMPLATE_PATH . $this->body );
62 }
63 }
64
65 function returnData(){
66 ob_start();
67 $this->showData();
68 $ret_val = ob_get_contents();
69 ob_end_clean();
70 return $ret_val;
71 }
72
73 }
74 ?>