Introducing coding standards validation.

This commit is contained in:
Marcos Schratzenstaller
2019-04-22 17:28:46 -03:00
committed by Nathan Rice
parent 6e40c921ab
commit fd504d41ac
1624 changed files with 190339 additions and 262 deletions
+31 -12
View File
@@ -1,4 +1,9 @@
<?php
/**
* Genesis Simple Sidebars Core.
*
* @package genesis-simple-sidebars
*/
/**
* Controls the core functions of registration and output of Sidebars
@@ -9,11 +14,15 @@ class Genesis_Simple_Sidebars_Core {
/**
* The created sidebars.
*
* @var string
*/
private $sidebars;
/**
* Public taxonomies.
*
* @var array
*/
private $public_taxonomies;
@@ -55,19 +64,21 @@ class Genesis_Simple_Sidebars_Core {
return;
}
// Cycle through created sidebars, register them as widget areas
// Cycle through created sidebars, register them as widget areas.
foreach ( (array) $sidebars as $id => $info ) {
if ( ! isset( $info['name'] ) || ! isset( $info['description'] ) ) {
continue;
}
genesis_register_sidebar( array(
'name' => esc_html( $info['name'] ),
'id' => $id,
'description' => esc_html( $info['description'] ),
'editable' => 1,
) );
genesis_register_sidebar(
array(
'name' => esc_html( $info['name'] ),
'id' => $id,
'description' => esc_html( $info['description'] ),
'editable' => 1,
)
);
}
@@ -76,6 +87,8 @@ class Genesis_Simple_Sidebars_Core {
/**
* Filter the widgets in each widget area.
*
* @param array $widgets Widgets.
*
* @since 2.1.0
*/
public function sidebars_widgets_filter( $widgets ) {
@@ -111,6 +124,9 @@ class Genesis_Simple_Sidebars_Core {
/**
* Take the $widgets array and swap the contents of each widget area with a custom widget area, if specified.
*
* @param array $widgets Widgets.
* @param array $sidebars Sidebars.
*
* @since 2.1.0
*/
public function swap_widgets( $widgets, $sidebars ) {
@@ -128,7 +144,6 @@ class Genesis_Simple_Sidebars_Core {
if ( $new_sidebar && ! empty( $widgets[ $new_sidebar ] ) ) {
$widgets[ $old_sidebar ] = $widgets[ $new_sidebar ];
}
}
return $widgets;
@@ -138,6 +153,8 @@ class Genesis_Simple_Sidebars_Core {
/**
* Get all custom registered sidebars.
*
* @param bool $cache Indicates if should get from cache.
*
* @since 2.1.0
*/
public function get_sidebars( $cache = true ) {
@@ -164,10 +181,12 @@ class Genesis_Simple_Sidebars_Core {
public function get_public_taxonomies() {
if ( is_null( $this->public_taxonomies ) ) {
$this->public_taxonomies = get_taxonomies( array(
'show_ui' => true,
'public' => true,
) );
$this->public_taxonomies = get_taxonomies(
array(
'show_ui' => true,
'public' => true,
)
);
}
$this->public_taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) );