PluginProbe
TablePress – Tables in WordPress made easy / 2.1.7
TablePress – Tables in WordPress made easy v2.1.7
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 2.1.7, at views/view-options_custom_css.php

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