$_GET['sql-column'], 'sql-table' => $_GET['sql-table'], 'sql-primary-column' => $_GET['sql-primary-column'], 'sql-primary-type' => $_GET['sql-primary-type'], 'sql-primary-key' => $_GET['sql-primary-key'], ), $fields ); } return $fields; } /** * Append a helper class ot the wp-admin body class. * * @param string $class The classes for the admin body class. * * @return string */ public function admin_body_class( $class ) { if ( isset( $_GET['file-type'] ) && 'sql' === $_GET['file-type'] && current_user_can( String_Locator::$default_capability ) ) { $class .= ' file-edit-screen'; } return $class; } /** * Conditionally filter the editor interface for SQL files. * * @param string $include_path The path to the editor interface. * * @return string */ public function sql_edit_page( $include_path ) { if ( ! isset( $_GET['file-type'] ) || 'sql' !== $_GET['file-type'] || ! current_user_can( String_Locator::$default_capability ) ) { return $include_path; } // Validate the table name. if ( ! isset( $_GET['sql-table'] ) || ! validate_sql_fields( $_GET['sql-table'] ) ) { return $include_path; } // Validate the primary column if ( ! isset( $_GET['sql-primary-column'] ) || ! validate_sql_fields( $_GET['sql-primary-column'] ) ) { return $include_path; } // A primary key needs to be provided, this could be anything so we just make sure it is set and not empty. if ( ! isset( $_GET['sql-primary-key'] ) || empty( $_GET['sql-primary-key'] ) ) { return $include_path; } return STRING_LOCATOR_PLUGIN_DIR . '/includes/Extension/SQL/views/editor/sql.php'; } } new Edit();