add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' ); if ( isset( $data['table']['is_corrupted'] ) && $data['table']['is_corrupted'] ) { $this->add_text_box( 'table-corrupted', array( $this, 'textbox_corrupted_table' ), 'header' ); return; } $this->process_action_messages( array( 'success_add' => __( 'The table was added successfully.', 'tablepress' ), 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ' ' . sprintf( __( 'You are now seeing the copied table, which has the table ID “%s”.', 'tablepress' ), esc_html( $data['table']['id'] ) ), 'success_import' => __( 'The table was imported successfully.', 'tablepress' ), 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ), ) ); wp_enqueue_style( 'wp-jquery-ui-dialog' ); wp_enqueue_style( 'editor-buttons' ); wp_enqueue_script( 'wpdialogs' ); // For the Advanced Editor, Table Preview, and Help Boxes. add_filter( 'media_view_strings', array( $this, 'change_media_view_strings' ) ); wp_enqueue_media(); wp_enqueue_script( 'wplink' ); // JS for the "Insert Link" button. $this->admin_page->enqueue_style( 'jspreadsheet' ); $this->admin_page->enqueue_style( 'jsuites', array( 'tablepress-jspreadsheet' ) ); $this->admin_page->enqueue_style( 'edit', array( 'tablepress-jspreadsheet', 'tablepress-jsuites' ) ); if ( tb_tp_fs()->is_free_plan() ) { $this->admin_page->enqueue_style( 'edit-features', array( 'tablepress-edit' ) ); } $this->admin_page->enqueue_script( 'jspreadsheet' ); $this->admin_page->enqueue_script( 'jsuites', array( 'tablepress-jspreadsheet' ) ); $this->admin_page->enqueue_script( 'edit', array( 'tablepress-jspreadsheet', 'tablepress-jsuites', 'jquery-core' ) ); $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); $this->add_text_box( 'buttons-1', array( $this, 'textbox_buttons' ), 'normal' ); $this->add_meta_box( 'table-information', __( 'Table Information', 'tablepress' ), array( $this, 'postbox_table_information' ), 'normal' ); $this->add_meta_box( 'table-data', __( 'Table Content', 'tablepress' ), array( $this, 'postbox_table_data' ), 'normal' ); $this->add_meta_box( 'table-manipulation', __( 'Table Manipulation', 'tablepress' ), array( $this, 'postbox_table_manipulation' ), 'normal' ); $this->add_meta_box( 'table-options', __( 'Table Options', 'tablepress' ), array( $this, 'postbox_table_options' ), 'normal' ); $this->add_meta_box( 'datatables-features', __( 'Table Features for Site Visitors', 'tablepress' ), array( $this, 'postbox_datatables_features' ), 'normal' ); $this->add_text_box( 'hidden-containers', array( $this, 'textbox_hidden_containers' ), 'additional' ); $this->add_text_box( 'buttons-2', array( $this, 'textbox_buttons' ), 'additional' ); $this->add_text_box( 'other-actions', array( $this, 'textbox_other_actions' ), 'submit' ); add_filter( 'screen_settings', array( $this, 'add_screen_options_output' ), 10, 2 ); } /** * Change Media View string "Insert into post" to "Insert into Table". * * @since 1.0.0 * * @param array $strings Current set of Media View strings. * @return array Changed Media View strings. */ public function change_media_view_strings( array $strings ) { $strings['insertIntoPost'] = __( 'Insert into Table', 'tablepress' ); return $strings; } /** * Adds custom screen options to the screen. * * @since 2.1.0 * * @param string $screen_settings Screen settings. * @param WP_Screen $screen WP_Screen object. * @return string Extended Screen settings. */ public function add_screen_options_output( $screen_settings, $screen ) { $screen_settings = '
'; return $screen_settings; } /** * Renders the current view. * * In comparison to the parent class method, this contains handling for the no-js case and adjusts the HTML code structure. * * @since 2.0.0 */ public function render() { ?>|
/>
" readonly />
|
|
| : | ' . TablePress::format_datetime( $data['table']['last_modified'] ) . '', '' . TablePress::get_user_display_name( $data['table']['options']['last_editor'] ) . '' ); ?> |
| : | : |
| : | : |
| : | : |
| : | : |
'; if ( current_user_can( 'tablepress_preview_table', $data['table']['id'] ) ) { echo '' . __( 'Preview', 'tablepress' ) . ''; } ?> '; } /** * Print the "Delete Table" and "Export Table" buttons. * * @since 1.0.0 * * @param array $data Data for this screen. * @param array $box Information about the text box. */ public function textbox_other_actions( array $data, array $box ) { $user_can_copy_table = current_user_can( 'tablepress_copy_table', $data['table']['id'] ); $user_can_export_table = current_user_can( 'tablepress_export_table', $data['table']['id'] ); $user_can_delete_table = current_user_can( 'tablepress_delete_table', $data['table']['id'] ); if ( ! $user_can_copy_table && ! $user_can_export_table && ! $user_can_delete_table ) { return; } echo '
'; echo __( 'Other Actions', 'tablepress' ) . ': '; if ( $user_can_copy_table ) { echo '' . __( 'Copy Table', 'tablepress' ) . ' '; } if ( $user_can_export_table ) { echo '' . __( 'Export Table', 'tablepress' ) . ' '; } if ( $user_can_delete_table ) { echo '' . __( 'Delete Table', 'tablepress' ) . ''; } echo '
'; } /** * Print the hidden containers for the Preview. * * @since 1.0.0 * * @param array $data Data for this screen. * @param array $box Information about the text box. */ public function textbox_hidden_containers( array $data, array $box ) { ?>| : | |
|---|---|
| : | |
| : | |
| : | |
| : | '; $position_select .= ''; $position_select .= ''; $position_select .= ''; ?>|
| : | '; $position_select .= ''; $position_select .= ''; $position_select .= ''; ?>|
| : |
| : | |
|---|---|
| : | |
| : | |
| : | |
| : | |
| : | |
| : | |
| : |
' . esc_html( $data['table']['json_error'] ) . '' ); ?>
TablePress FAQ page for further instructions.', 'tablepress' ), 'https://tablepress.org/faq/corrupted-tables/' ); ?>
'list' ) ) . '" class="button">' . __( 'Back to the List of Tables', 'tablepress' ) . ''; ?>
' . __( 'Did you know?', 'tablepress' ) . ' ' . __( 'Right-clicking the table content fields will open a context menu for quick access to common editing tools.', 'tablepress' ) . '
'; $this->admin_page->print_wp_pointer_js( 'tp20_edit_context_menu', '#table-editor', array( 'content' => $content, 'position' => array( 'edge' => 'bottom', 'align' => 'center' ), ) ); } /** * Sets the content for the WP feature pointer about the screen options for changing the cell size. * * @since 2.1.0 */ public function wp_pointer_tp21_edit_screen_options() { $content = '' . __( 'Did you know?', 'tablepress' ) . ' ' . sprintf( __( 'You can change the default cell size for the table editor on this “Edit” screen in the “%s”.', 'tablepress' ), __( 'Screen Options', 'default' ) ) . '
'; $this->admin_page->print_wp_pointer_js( 'tp21_edit_screen_options', '#screen-options-link-wrap', array( 'content' => $content, 'position' => array( 'edge' => 'top', 'align' => 'right' ), 'pointerClass' => 'wp-pointer pointer-tp21_edit_screen_options', ) ); } } // class TablePress_Edit_View