PluginProbe
TablePress – Tables in WordPress made easy / 1.14
TablePress – Tables in WordPress made easy v1.14
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
tablepress / views / view-options_custom_css.php

view-options_custom_css.php in TablePress – Tables in WordPress made easy 1.14, at views/view-options_custom_css.php

147 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Options/Save Custom CSS Credentials Form 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 * Plugin Options/Save Custom CSS Credentials Form View class
16 * @package TablePress
17 * @subpackage Views
18 * @author Tobias Bäthge
19 * @since 1.0.0
20 */
21 class TablePress_Options_Custom_CSS_View extends TablePress_View {
22
23 /**
24 * Set up the view with data and do things that are specific for this view.
25 *
26 * @since 1.0.0
27 *
28 * @param string $action Action for this view.
29 * @param array $data Data for this view.
30 */
31 public function setup( $action, array $data ) {
32 // Set action manually here, to get correct page title and nav bar entries.
33 $this->action = 'options';
34 $this->data = $data;
35
36 // Set page title.
37 $GLOBALS['title'] = sprintf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), $this->data['view_actions'][ $this->action ]['page_title'], 'TablePress' );
38
39 $this->add_header_message( '<strong>' . __( 'Attention: Further action is required to save the changes to your &#8220;Custom CSS&#8221;!', 'tablepress' ) . '</strong>', 'notice-success' );
40
41 // Admin page helpers, like script/style loading, could be moved to view.
42 $this->admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' );
43 $this->admin_page->enqueue_style( 'common' );
44
45 $this->admin_page->add_admin_footer_text();
46
47 $this->add_text_box( 'explanation-text', array( $this, 'textbox_explanation_text' ), 'normal' );
48 $this->add_text_box( 'credentials-form', array( $this, 'textbox_credentials_form' ), 'normal' );
49 $this->add_text_box( 'proceed-no-file-saving', array( $this, 'textbox_proceed_no_file_saving' ), 'submit' );
50 }
51
52 /**
53 * Render the current view (in this view: without form tag).
54 *
55 * @since 1.0.0
56 */
57 public function render() {
58 ?>
59 <div id="tablepress-page" class="wrap">
60 <?php
61 $this->print_nav_tab_menu();
62 // Print all header messages.
63 foreach ( $this->header_messages as $message ) {
64 echo $message;
65 }
66
67 $this->do_text_boxes( 'header' );
68 ?>
69 <div id="poststuff">
70 <div id="post-body" class="metabox-holder columns-<?php echo ( isset( $GLOBALS['screen_layout_columns'] ) && ( 2 === $GLOBALS['screen_layout_columns'] ) ) ? '2' : '1'; ?>">
71 <div id="postbox-container-2" class="postbox-container">
72 <?php
73 $this->do_text_boxes( 'normal' );
74 $this->do_meta_boxes( 'normal' );
75
76 $this->do_text_boxes( 'additional' );
77 $this->do_meta_boxes( 'additional' );
78
79 // Print all submit buttons.
80 $this->do_text_boxes( 'submit' );
81 ?>
82 </div>
83 <div id="postbox-container-1" class="postbox-container">
84 <?php
85 // Print all boxes in the sidebar.
86 $this->do_text_boxes( 'side' );
87 $this->do_meta_boxes( 'side' );
88 ?>
89 </div>
90 </div>
91 <br class="clear" />
92 </div>
93 </div>
94 <?php
95 }
96
97 /**
98 * Print the content of the "Explanation" text box.
99 *
100 * @since 1.0.0
101 *
102 * @param array $data Data for this screen.
103 * @param array $box Information about the text box.
104 */
105 public function textbox_explanation_text( array $data, array $box ) {
106 ?>
107 <p>
108 <?php _e( 'Due to the configuration of your server, TablePress was not able to automatically save your &#8220;Custom CSS&#8221; to a file.', 'tablepress' ); ?>
109 <?php printf( __( 'To try again with the same method that you use for updating plugins or themes, please fill out the &#8220;%s&#8221; form below.', 'tablepress' ), __( 'Connection Information', 'default' ) ); ?>
110 </p>
111 <?php
112 }
113
114 /**
115 * Print the content of the "Credentials" text box.
116 *
117 * @since 1.0.0
118 *
119 * @param array $data Data for this screen.
120 * @param array $box Information about the text box.
121 */
122 public function textbox_credentials_form( array $data, array $box ) {
123 echo $data['credentials_form'];
124 }
125
126 /**
127 * Print the content of the "Cancel Saving" text box.
128 *
129 * @since 1.0.0
130 *
131 * @param array $data Data for this screen.
132 * @param array $box Information about the text box.
133 */
134 public function textbox_proceed_no_file_saving( array $data, array $box ) {
135 ?>
136 <h2><?php _e( 'Proceed without saving a file', 'tablepress' ); ?></h2>
137 <p>
138 <?php _e( 'To proceed without trying to save the &#8220;Custom CSS&#8221; to a file, click the button below.', 'tablepress' ); ?>
139 <?php _e( 'Your &#8220;Custom CSS&#8221; will then be loaded inline.', 'tablepress' ); ?>
140 </p><p>
141 <a href="<?php echo TablePress::url( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) ); ?>" class="button button-large"><?php _e( 'Proceed without saving &#8220;Custom CSS&#8221; to a file', 'tablepress' ); ?></a>
142 </p>
143 <?php
144 }
145
146 } // class TablePress_Options_Custom_CSS_View
147