PluginProbe
MaxButtons – Create buttons / 7.13
MaxButtons – Create buttons v7.13
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / assets / integrations / tablepress / tablepress.php

tablepress.php in MaxButtons – Create buttons 7.13, at assets/integrations/tablepress/tablepress.php

43 lines 952 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MaxButtons;
3 defined('ABSPATH') or die('No direct access permitted');
4
5 class MBTablePress
6 {
7
8 protected $enabled = false;
9
10 public function __construct()
11 {
12 add_filter('tablepress_table_raw_render_data', array($this, 'render_on'), 10, 2);
13 add_filter('tablepress_table_output', array($this, 'render_off'));
14 add_filter('mb_shortcode_display_args', array($this, 'shortcode_args'), 5);
15 }
16
17 public function render_on($table, $options)
18 {
19 $this->enabled = true;
20 return $table;
21 }
22
23 public function render_off($output)
24 {
25 $this->enabled = false;
26 return $output;
27 }
28
29 public function shortcode_args($args)
30 {
31 $auto_press = apply_filters('mb/integrations/auto_inline_tablepress', true);
32 if ($this->enabled && $auto_press)
33 {
34 $args['load_css'] = 'inline'; // force inline css, because tablepress caches
35 }
36 return $args;
37 }
38
39
40 }
41
42 $table = new MBTablePress();
43