@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param Table $table The table into which the record is being saved. |
118 | 118 | * @param string $pk_value The primary key of the record being saved. May be null. |
119 | - * @return boolean |
|
119 | + * @return false|null |
|
120 | 120 | */ |
121 | 121 | public function before_save( Table $table, $pk_value ) { |
122 | 122 | // Don't save changes to the changes tables. |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @param Table $table The table the record is being saved in. |
139 | 139 | * @param Record $new_record The record, after being saved. |
140 | - * @return boolean |
|
140 | + * @return false|null |
|
141 | 141 | */ |
142 | 142 | public function after_save( Table $table, Record $new_record ) { |
143 | 143 | // Don't save changes to the changes tables. |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use WordPress\Tabulate\DB\ChangeTracker; |
12 | 12 | use WordPress\Tabulate\DB\Exception as TabulateException; |
13 | 13 | use WordPress\Tabulate\DB\Reports; |
14 | -use WordPress\Tabulate\DB\Table; |
|
15 | 14 | use WP_Admin_Bar; |
16 | 15 | use WP_Filesystem_Base; |
17 | 16 | use wpdb; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | // Home page (also change the first submenu item's title). |
92 | 92 | add_menu_page( 'Tabulate', 'Tabulate', 'read', TABULATE_SLUG, $dispatch_callback ); |
93 | - $page_title = ( isset( $_GET['table'] ) ) ? Text::titlecase( $_GET['table'] ) : 'Tabulate'; |
|
93 | + $page_title = ( isset( $_GET[ 'table' ] ) ) ? Text::titlecase( $_GET[ 'table' ] ) : 'Tabulate'; |
|
94 | 94 | add_submenu_page( TABULATE_SLUG, $page_title, 'Overview', 'read', TABULATE_SLUG, $dispatch_callback ); |
95 | 95 | |
96 | 96 | // Add submenu pages. |
@@ -147,17 +147,17 @@ discard block |
||
147 | 147 | |
148 | 148 | // Only dispatch when it's our page. |
149 | 149 | $slug_lenth = strlen( TABULATE_SLUG ); |
150 | - if ( ! isset( $request['page'] ) || substr( $request['page'], 0, $slug_lenth ) !== TABULATE_SLUG ) { |
|
150 | + if ( ! isset( $request[ 'page' ] ) || substr( $request[ 'page' ], 0, $slug_lenth ) !== TABULATE_SLUG ) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Discern the controller name, based on an explicit request parameter, or |
155 | 155 | // the trailing part of the page slug (i.e. after 'tabulate_'). |
156 | 156 | $controller_name = 'home'; |
157 | - if ( isset( $request['controller'] ) && strlen( $request['controller'] ) > 0 ) { |
|
158 | - $controller_name = $request['controller']; |
|
159 | - } elseif ( isset( $request['page'] ) && strlen( $request['page'] ) > $slug_lenth ) { |
|
160 | - $controller_name = substr( $request['page'], $slug_lenth + 1 ); |
|
157 | + if ( isset( $request[ 'controller' ] ) && strlen( $request[ 'controller' ] ) > 0 ) { |
|
158 | + $controller_name = $request[ 'controller' ]; |
|
159 | + } elseif ( isset( $request[ 'page' ] ) && strlen( $request[ 'page' ] ) > $slug_lenth ) { |
|
160 | + $controller_name = substr( $request[ 'page' ], $slug_lenth + 1 ); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // Create the controller and run the action. |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | } |
168 | 168 | $controller = new $controller_classname( $this->wpdb ); |
169 | 169 | $controller->set_filesystem( $this->filesystem ); |
170 | - $action = ! empty( $request['action'] ) ? $request['action'] : 'index'; |
|
171 | - unset( $request['page'], $request['controller'], $request['action'] ); |
|
170 | + $action = ! empty( $request[ 'action' ] ) ? $request[ 'action' ] : 'index'; |
|
171 | + unset( $request[ 'page' ], $request[ 'controller' ], $request[ 'action' ] ); |
|
172 | 172 | try { |
173 | 173 | $this->output = $controller->$action( $request ); |
174 | 174 | } catch ( Exception $e ) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $script_url = plugins_url( TABULATE_SLUG ) . '/assets/scripts.js'; |
216 | 216 | $deps = array( 'jquery-ui-autocomplete', 'tabulate-omnivore', 'tabulate-maskedinput', 'tabulate-timepicker' ); |
217 | 217 | if ( Util::is_plugin_active( 'rest-api/plugin.php' ) ) { |
218 | - $deps[] = 'wp-api'; |
|
218 | + $deps[ ] = 'wp-api'; |
|
219 | 219 | } |
220 | 220 | wp_enqueue_script( 'tabulate-scripts', $script_url, $deps, TABULATE_VERSION, true ); |
221 | 221 |