PluginProbe
TablePress – Tables in WordPress made easy / 2.0.4
TablePress – Tables in WordPress made easy v2.0.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / views / view-editor_button_thickbox.php

view-editor_button_thickbox.php in TablePress – Tables in WordPress made easy 2.0.4, at views/view-editor_button_thickbox.php

154 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Editor Button Thickbox List View
4 *
5 * @package TablePress
6 * @subpackage Views
7 * @author Tobias Bäthge
8 * @since 1.0.0
9 */
10
11 // Prohibit direct script loading.
12 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
13
14 /**
15 * Editor Button Thickbox List View class
16 *
17 * @package TablePress
18 * @subpackage Views
19 * @author Tobias Bäthge
20 * @since 1.0.0
21 */
22 class TablePress_Editor_Button_Thickbox_View extends TablePress_View {
23
24 /**
25 * Object for the Editor Button Thickbox List Table.
26 *
27 * @since 1.0.0
28 * @var TablePress_Editor_Button_Thickbox_List_Table
29 */
30 protected $wp_list_table;
31
32 /**
33 * Initializes the View class.
34 *
35 * @since 1.0.0
36 */
37 public function __construct() {
38 // Intentionally left empty, to void code from parent::__construct().
39 }
40
41 /**
42 * Sets up the view with data and do things that are specific for this view.
43 *
44 * @since 1.0.0
45 *
46 * @param string $action Action for this view.
47 * @param array $data Data for this view.
48 */
49 public function setup( $action, array $data ) {
50 $this->action = $action;
51 $this->data = $data;
52
53 $this->wp_list_table = TablePress::load_class( 'TablePress_Editor_Button_Thickbox_List_Table', 'class-editor-button-thickbox-list-table.php', 'views' );
54
55 $this->wp_list_table->set_items( $this->data['table_ids'] );
56 $this->wp_list_table->prepare_items();
57 }
58
59 /**
60 * Renders the current view.
61 *
62 * @since 1.0.0
63 */
64 public function render() {
65 _wp_admin_html_begin();
66
67 wp_print_styles( 'colors' );
68 wp_print_scripts( 'jquery-core' );
69 ?>
70 <title><?php printf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), __( 'List of Tables', 'tablepress' ), 'TablePress' ); ?></title>
71 <style>
72 /* Account for .wp-toolbar. */
73 html {
74 padding-top: 0 !important;
75 }
76 #tablepress-page {
77 margin: 0 15px;
78 padding: 0 0 15px 0;
79 }
80 #tablepress-page .subtitle {
81 float: left;
82 padding: 10px 0 0;
83 }
84 #tablepress-page p.search-box {
85 position: relative;
86 }
87 /* Width and font weight for the columns. */
88 .tablepress-editor-button-list thead .column-table_id {
89 width: 50px;
90 }
91 .tablepress-editor-button-list tbody .column-table_id,
92 .tablepress-editor-button-list tbody .column-table_name {
93 font-weight: bold;
94 }
95 .tablepress-editor-button-list thead .column-table_action {
96 min-width: 150px;
97 }
98 /* Responsiveness on the All Tables screen. */
99 @media screen and (max-width: 782px) {
100 .tablepress-editor-button-list .column-table_id {
101 display: none !important;
102 padding: 3px 8px 3px 35%;
103 }
104 }
105 <?php if ( is_rtl() ) : ?>
106 /* RTL CSS */
107 .rtl #tablepress-page .subtitle {
108 float: right;
109 }
110 <?php endif; ?>
111 </style>
112 </head>
113 <body class="wp-admin wp-core-ui js iframe<?php echo is_rtl() ? ' rtl' : ''; ?>">
114 <div id="tablepress-page" class="wrap">
115 <h1><?php printf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), __( 'List of Tables', 'tablepress' ), 'TablePress' ); ?></h1>
116 <div id="poststuff">
117 <p><?php _e( 'This is a list of your tables.', 'tablepress' ); ?> <?php _e( 'You may insert a table into a post or page here.', 'tablepress' ); ?></p>
118 <p><?php printf( __( 'Click the “%1$s” button for the desired table to automatically insert its Shortcode into the editor.', 'tablepress' ), __( 'Insert Shortcode', 'tablepress' ) ); ?></p>
119 <?php
120 if ( ! empty( $_GET['s'] ) ) {
121 printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'tablepress' ) . '</span>', esc_html( wp_unslash( $_GET['s'] ) ) );
122 }
123 ?>
124 <form method="get" action="">
125 <input type="hidden" name="action" value="tablepress_<?php echo $this->action; ?>" />
126 <?php
127 wp_nonce_field( TablePress::nonce( $this->action ), '_wpnonce', false );
128 $this->wp_list_table->search_box( __( 'Search Tables', 'tablepress' ), 'tables_search' );
129 ?>
130 </form>
131 <?php $this->wp_list_table->display(); ?>
132 </div>
133 </div>
134 <script>
135 jQuery( function( $ ) {
136 // Toggle list table rows on small screens.
137 $( '.tablepress-editor-button-list' )
138 .on( 'click', 'tr', function() {
139 this.classList.toggle( 'is-expanded' );
140 })
141 .on( 'click', '.insert-shortcode', function() {
142 const win = window.dialogArguments || opener || parent || top;
143 win.send_to_editor( this.title );
144 } );
145 } );
146 </script>
147 </body>
148 </html>
149 <?php
150 }
151
152 } // class TablePress_Editor_Button_View
153
154