PluginProbe
TablePress – Tables in WordPress made easy / 3.0
TablePress – Tables in WordPress made easy v3.0
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 2.4.4 All 44 releases
← All changes | views/view-export.php +18 -20 trunk3.0 View file →
@@ -34,10 +34,8 @@
34 34 // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
35 35
36 36 parent::setup( $action, $data );
37 37
38 - TablePress::enqueue_script( 'common', array( 'jquery-core', 'postbox' ) );
39 -
40 38 $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' );
41 39
42 40 $this->process_action_messages( array(
43 41 'error_export' => __( 'Error: The export failed.', 'tablepress' ),
@@ -49,9 +47,9 @@
49 47 $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
50 48 if ( 0 === $data['tables_count'] ) {
51 49 $this->add_meta_box( 'no-tables', __( 'Export Tables', 'tablepress' ), array( $this, 'postbox_no_tables' ), 'normal' );
52 50 } else {
53 - TablePress::enqueue_script( 'export' );
51 + $this->admin_page->enqueue_script( 'export' );
54 52 $this->add_meta_box( 'export-form', __( 'Export Tables', 'tablepress' ), array( $this, 'postbox_export_form' ), 'normal' );
55 53 }
56 54 }
57 55
@@ -91,14 +89,9 @@
91 89 $add_url = TablePress::url( array( 'action' => 'add' ) );
92 90 $import_url = TablePress::url( array( 'action' => 'import' ) );
93 91 ?>
94 92 <p><?php _e( 'No tables found.', 'tablepress' ); ?></p>
95 - <p>
96 - <?php
97 - /* translators: %1$s: URL to add table page, %2$s: URL to import table page */
98 - printf( __( 'You should <a href="%1$s">add</a> or <a href="%2$s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url );
99 - ?>
100 - </p>
93 + <p><?php printf( __( 'You should <a href="%1$s">add</a> or <a href="%2$s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url ); ?></p>
101 94 <?php
102 95 }
103 96
104 97 /**
@@ -109,20 +102,25 @@
109 102 * @param array<string, mixed> $data Data for this screen.
110 103 * @param array<string, mixed> $box Information about the meta box.
111 104 */
112 105 public function postbox_export_form( array $data, array $box ): void {
113 - $this->print_script_data_json(
114 - 'export',
115 - array(
116 - 'tables' => $data['tables'],
117 - 'exportFormats' => $data['export_formats'],
118 - 'csvDelimiters' => $data['csv_delimiters'],
119 - 'zipSupportAvailable' => $data['zip_support_available'],
120 - 'selectedTables' => $data['export_ids'],
121 - 'exportFormat' => $data['export_format'],
122 - 'csvDelimiter' => $data['csv_delimiter'],
123 - ),
106 + $script_data = array(
107 + 'tables' => $this->admin_page->convert_to_json_parse_output( $data['tables'] ),
108 + 'exportFormats' => $this->admin_page->convert_to_json_parse_output( $data['export_formats'] ),
109 + 'csvDelimiters' => $this->admin_page->convert_to_json_parse_output( $data['csv_delimiters'] ),
110 + 'zipSupportAvailable' => $this->admin_page->convert_to_json_parse_output( $data['zip_support_available'] ),
111 + 'selectedTables' => $this->admin_page->convert_to_json_parse_output( $data['export_ids'] ),
112 + 'exportFormat' => $this->admin_page->convert_to_json_parse_output( $data['export_format'] ),
113 + 'csvDelimiter' => $this->admin_page->convert_to_json_parse_output( $data['csv_delimiter'] ),
124 114 );
115 +
116 + echo "<script>\n";
117 + echo "window.tp = window.tp || {};\n";
118 + echo "tp.export = {};\n";
119 + foreach ( $script_data as $variable => $value ) {
120 + echo "tp.export.{$variable} = {$value};\n";
121 + }
122 + echo "</script>\n";
125 123
126 124 echo '<div id="tablepress-export-screen"></div>';
127 125 }
128 126