Coding standards erorrs fixed, sanitization and escaping strings.

This commit is contained in:
Marcos Schratzenstaller
2019-04-23 11:58:27 -03:00
committed by Nathan Rice
parent 442cb88868
commit d6b32b1e70
6 changed files with 129 additions and 84 deletions
@@ -1,7 +1,18 @@
<?php
/**
* Genesis Simple Sidebars Entry file.
*
* @package genesis-simple-sidebars
*/
/**
* Genesis Simple Sidebars Entry class.
*/
class Genesis_Simple_Sidebars_Entry {
/**
* Init function.
*/
public function init() {
add_action( 'admin_menu', array( $this, 'add_metaboxes' ) );
@@ -18,7 +29,7 @@ class Genesis_Simple_Sidebars_Entry {
foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) {
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || 'post' === $type || 'page' === $type ) {
add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'genesis-simple-sidebars' ), array( $this, 'metabox_content' ), $type, 'side', 'low' );
}
}
@@ -45,12 +56,15 @@ class Genesis_Simple_Sidebars_Entry {
*/
public function metabox_save( $post_id, $post ) {
if ( ! isset( $_POST['genesis_simple_sidebars'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
$genesis_simple_sidebars = isset( $_POST['genesis_simple_sidebars'] ) ? sanitize_text_field( wp_unslash( $_POST['genesis_simple_sidebars'] ) ) : '';
if ( empty( $genesis_simple_sidebars ) ) {
return;
}
$data = wp_parse_args(
$_POST['genesis_simple_sidebars'],
$genesis_simple_sidebars,
array(
'_ss_header' => '',
'_ss_sidebar' => '',