Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Admin/Metabox/Document_Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function render( $post ) {
*/
public function save( $post_id ) {
// Verify nonce
if ( ! isset( $_POST['dll_document_link_nonce'] ) || ! wp_verify_nonce( $_POST['dll_document_link_nonce'], 'dll_save_document_link' ) ) {
if ( ! isset( $_POST['dll_document_link_nonce'] ) || ! wp_verify_nonce( wp_unslash( $_POST['dll_document_link_nonce'] ), 'dll_save_document_link' ) ) {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ public function sanitize_document_page( $page_setting ) {
*/
public function sanitize_shortcode_settings( $args ) {
$existing_options = $this->get_existing_shortcode_options();
$option_page = $_REQUEST['option_page'];
$option_page = isset( $_REQUEST['option_page'] )
? sanitize_key( wp_unslash( $_REQUEST['option_page'] ) )
: '';

if ( ! $option_page ) {
return array_merge( $existing_options, $args );
Expand Down
21 changes: 16 additions & 5 deletions src/Simple_Document_Library.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,22 @@ public function get_table( $output_type = 'html' ) {
$columns = $this->get_columns();

// Parse DataTables parameters from the AJAX request
$draw = isset( $_POST['draw'] ) ? intval( $_POST['draw'] ) : 1;
$this->args['offset'] = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0;
$this->args['rows_per_page'] = isset( $_POST['length'] ) && intval( $_POST['length'] ) !== -1 ? intval( $_POST['length'] ) : $this->args['rows_per_page'];
$this->args['sort_by'] = isset( $_POST['order'] ) ? $columns[$_POST['order'][0]['column']] : $this->get_orderby();
$this->args['sort_order'] = isset( $_POST['order'] ) ? sanitize_key( $_POST['order'][0]['dir'] ) : $this->args['sort_order'];
$draw = isset( $_POST['draw'] ) ? intval( wp_unslash( $_POST['draw'] ) ) : 1;
$this->args['offset'] = isset( $_POST['start'] ) ? intval( wp_unslash( $_POST['start'] ) ) : 0;
$this->args['rows_per_page'] = isset( $_POST['length'] ) && intval( wp_unslash( $_POST['length'] ) ) !== -1 ? intval( wp_unslash( $_POST['length'] ) ) : $this->args['rows_per_page'];
$order = isset( $_POST['order'] ) && is_array( $_POST['order'] ) ? wp_unslash( $_POST['order'] ) : [];
$column_index = isset( $order[0]['column'] ) && is_scalar( $order[0]['column'] )
? filter_var( $order[0]['column'], FILTER_VALIDATE_INT )
: false;
$this->args['sort_by'] = false !== $column_index && $column_index >= 0 && isset( $columns[ $column_index ] )
? $columns[ $column_index ]
: $this->get_orderby();
$direction = isset( $order[0]['dir'] ) && is_scalar( $order[0]['dir'] )
? sanitize_key( (string) $order[0]['dir'] )
: '';
if ( in_array( $direction, [ 'asc', 'desc' ], true ) ) {
$this->args['sort_order'] = $direction;
}
$this->args['search_value'] = isset( $_POST['search']['value'] ) ? sanitize_text_field( wp_unslash( $_POST['search']['value'] ) ) : '';
$this->args['rows_per_page'] = filter_var( $this->args['rows_per_page'], FILTER_VALIDATE_INT );

Expand Down