Skip to content

Commit

Permalink
Fix code sniffs in MU plugin files
Browse files Browse the repository at this point in the history
Signed-off-by: James Hunt <[email protected]>
  • Loading branch information
thetwopct committed Mar 14, 2023
1 parent 778e589 commit 80889f4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public function reset_cache_check( $post_id ) {
* @param int $post_id The post.
* @return void
*/
function staff_custom_column_data( $column, $post_id ) {
public function staff_custom_column_data( $column, $post_id ) {
switch ( $column ) {
case 'featured_image':
the_post_thumbnail( 'thumbnail' );
Expand All @@ -357,7 +357,7 @@ function staff_custom_column_data( $column, $post_id ) {
*
* @param array $columns Column headers.
*/
function staff_custom_column( $columns ) {
public function staff_custom_column( $columns ) {
// take date column.
$date = $columns['date'];
// unset it so we can move it.
Expand All @@ -373,17 +373,17 @@ function staff_custom_column( $columns ) {
/**
* Remove tags support from posts
*/
function theme_unregister_tags() {
public function theme_unregister_tags() {
unregister_taxonomy_for_object_type( 'post_tag', 'post' );
}

/**
* Removes unneeded admin menu items.
*/
function custom_menu_page_removing() {
public function custom_menu_page_removing() {
remove_menu_page( 'edit-comments.php' );
}

/**
* Sync KCDs from https://community.cncf.io/ to the commmunity events CPT.
*/
Expand Down Expand Up @@ -477,36 +477,36 @@ public function set_event_year( $post_id ) {
}
}

}

/**
* Returns an array of all descendents of $post_id.
* Recursive function.
*
* @param int $post_id parent post.
*/
function get_kids( $post_id ) {
global $wpdb;
/**
* Returns an array of all descendents of $post_id.
* Recursive function.
*
* @param int $post_id parent post.
*/
private function get_kids( $post_id ) {
global $wpdb;

$kid_ids = array();
$kid_ids = array();

$kid_posts = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM $wpdb->posts
$kid_posts = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM $wpdb->posts
WHERE post_parent = %d
AND post_status <> 'trash'",
$post_id
)
);
$post_id
)
);

if ( ! $kid_posts ) {
return array();
}
if ( ! $kid_posts ) {
return array();
}

foreach ( $kid_posts as $kid ) {
$kid_ids[] = $kid->ID;
$kid_ids = array_merge( $kid_ids, get_kids( $kid->ID ) );
}

foreach ( $kid_posts as $kid ) {
$kid_ids[] = $kid->ID;
$kid_ids = array_merge( $kid_ids, get_kids( $kid->ID ) );
return $kid_ids;
}

return $kid_ids;
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'revisions', 'custom-fields', 'author' ),
);

register_post_type( 'lfe_community_event', $opts );
register_post_type( 'lfe_community_event', $opts );
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function insert_event_styles() {
*
* @param string $url the URL.
*/
function defer_parsing_of_js( $url ) {
public function defer_parsing_of_js( $url ) {
// Stop if admin.
if ( is_admin() ) {
return $url;
Expand Down Expand Up @@ -202,7 +202,7 @@ function defer_parsing_of_js( $url ) {
* @param string $hints returns hints.
* @param string $relation_type returns priority.
*/
function change_to_preconnect_resource_hints( $hints, $relation_type ) {
public function change_to_preconnect_resource_hints( $hints, $relation_type ) {

if ( 'preconnect' === $relation_type ) {
$hints[] = array(
Expand All @@ -222,7 +222,7 @@ function change_to_preconnect_resource_hints( $hints, $relation_type ) {
*
* @param string $more more text.
*/
function new_excerpt_more( $more ) {
public function new_excerpt_more( $more ) {
return '<span class="excerpt-ellipses">&hellip;</span>';
}

Expand All @@ -231,7 +231,7 @@ function new_excerpt_more( $more ) {
*
* @param int $length Number of words.
*/
function custom_excerpt_length( $length ) {
public function custom_excerpt_length( $length ) {
return 18;
}

Expand All @@ -252,7 +252,7 @@ function custom_excerpt_length( $length ) {
* May be (for example) 'breadcrumb' or 'article' for structured data.
* @return array $params
*/
function my_tsf_custom_image_generation_args( $params = array(), $args = null, $context = 'social' ) {
public function my_tsf_custom_image_generation_args( $params = array(), $args = null, $context = 'social' ) {

// Let's not mess with non-social sharing images.
if ( 'social' !== $context ) {
Expand Down Expand Up @@ -318,7 +318,7 @@ public function disable_pingback( &$links ) {
* @param string $urls array of urls.
* @param string $relation_type returns priority.
*/
function dns_prefetch_to_preconnect( $urls, $relation_type ) {
public function dns_prefetch_to_preconnect( $urls, $relation_type ) {
global $wp_scripts, $wp_styles;

$unique_urls = array();
Expand Down Expand Up @@ -439,5 +439,4 @@ public function add_year_to_archive_titles( $title ) {

return $title;
}

}

0 comments on commit 80889f4

Please sign in to comment.