Skip to content

Commit

Permalink
phpstan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Dec 14, 2023
1 parent dc8848e commit 4ef8248
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 52 deletions.
46 changes: 26 additions & 20 deletions wp-content/mu-plugins/theme-fixes/education-pro/education-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,25 @@ function( $wp_customize ) {

unregister_sidebar( 'header-right' );

add_filter(
'genesis_get_layouts',
function( $layouts ) {
$keys = [ 'content-sidebar', 'sidebar-content', 'full-width-content' ];
return array_filter(
$layouts,
function( $k ) use ( $keys ) {
return in_array( $k, $keys, true );
},
ARRAY_FILTER_USE_KEY
);
}
);
/**
* Remove unused Genesis layouts.
*
* @return array
*/
function openlab_education_pro_remove_unused_layouts( $layouts ) {
$keys = [ 'content-sidebar', 'sidebar-content', 'full-width-content' ];

$filtered_keys = array_filter(
$layouts,
function( $k ) use ( $keys ) {
return in_array( $k, $keys, true );
},
ARRAY_FILTER_USE_KEY
);

return $filtered_keys;
}
add_filter( 'genesis_get_layouts', 'openlab_education_pro_remove_unused_layouts' );

$deregister_sidebars = [ 'home-featured', 'home-top', 'home-middle', 'home-bottom', 'sidebar-alt' ];
foreach ( $deregister_sidebars as $deregister_sidebar ) {
Expand Down Expand Up @@ -391,14 +397,14 @@ function openlab_custom_header_style() {

/**
* Remove Copyright text in footer.
*
* @return array
*/
add_filter(
'genesis_footer_creds_text',
function( $text ) {
$regex = '/\[footer_copyright[^\]]+\] ·/';
return preg_replace( $regex, '', $text );
}
);
function openlab_education_pro_remove_copyright_text_from_footer( $text ) {
$regex = '/\[footer_copyright[^\]]+\] ·/';
return preg_replace( $regex, '', $text );
}
add_filter( 'genesis_footer_creds_text', 'openlab_education_pro_remove_copyright_text_from_footer');


remove_action( 'genesis_header', 'genesis_do_header' );
Expand Down
1 change: 0 additions & 1 deletion wp-content/plugins/wds-citytech/includes/group-blogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,6 @@ class="form-control domain-validate"
$user_blogs = array_values( $user_blogs );
?>

<?php /* @phpstan-ignore-next-line */ ?>
<?php if ( ! empty( $user_blogs ) ) : ?>
<div id="wds-website-existing" class="form-field form-required">

Expand Down
15 changes: 7 additions & 8 deletions wp-content/themes/openlab/lib/plugin-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,14 @@ function( $args ) {
* It only removes the text, but we want to remove the entire empty element.
*
* This ensures that we don't get "empty link" errors in WAVE tests.
*
* @return string
*/
add_filter(
'bbp_get_topic_stick_link',
function( $link ) {
// Remove anchor elements with the class bbp-topic-super-sticky-link.
return preg_replace( '/<a[^>]*class="bbp-topic-super-sticky-link"[^>]*><\/a>/', '', $link );
},
100
);
function openlab_bbpress_remove_super_sticky_link( $link ) {
// Remove anchor elements with the class bbp-topic-super-sticky-link.
return preg_replace( '/<a[^>]*class="bbp-topic-super-sticky-link"[^>]*><\/a>/', '', $link );
}
add_filter( 'bbp_get_topic_stick_link', 'openlab_bbpress_remove_super_sticky_link', 100 );

/**
* Handle feature toggling for groups.
Expand Down
45 changes: 22 additions & 23 deletions wp-content/themes/openlab/lib/plugin-mods/docs-funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,32 @@ function openlab_add_delete_to_bp_docs_doc_action_links( $links, $doc_id ) {
* Don't allow any of budypress-docs's native directory filters.
*
* Instead, we have a Search filter in the theme.
*
* @return array
*/
add_filter(
'bp_docs_filter_types',
function( $types ) {
// We only return an empty aray when getting filter titles.
$dbs = debug_backtrace();
$is_filter_titles = false;
foreach ( $dbs as $db ) {
if ( ! empty( $db['function'] ) && 'bp_docs_filter_titles' === $db['function'] ) {
$is_filter_titles = true;
break;
}
function openlab_remove_directory_filters_from_doc_list( $types ) {
// We only return an empty aray when getting filter titles.
$dbs = debug_backtrace();
$is_filter_titles = false;
foreach ( $dbs as $db ) {
if ( ! empty( $db['function'] ) && 'bp_docs_filter_titles' === $db['function'] ) {
$is_filter_titles = true;
break;
}
}

if ( $is_filter_titles ) {
return [];
}
if ( $is_filter_titles ) {
return [];
}

return array_filter(
$types,
function( $type ) {
return 'search' === $type['slug'];
}
);
},
999
);
return array_filter(
$types,
function( $type ) {
return 'search' === $type['slug'];
}
);
}
add_filter( 'bp_docs_filter_types', 'openlab_remove_directory_filters_from_doc_list', 999 );

/**
* Don't show openlab-private-comments or wp-grade-comments Private checkbox on Docs comments.
Expand Down

0 comments on commit 4ef8248

Please sign in to comment.