HEX
Server: Apache
System: Linux cpanelx.inxs.ro 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: crowdandsafety (1041)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/crowdandsafety/public_html/wp-content/plugins/cornerstone/includes/integration/bbpress.php
<?php


add_filter( 'x_breadcrumbs_integrate', function( $crumbs ) {

  if ( ! is_bbpress() ) {
    return $crumbs;
  }

  global $wp;
  $crumbs = [];

  if ( bbp_is_forum_archive() ) {

    $crumbs[] = array(
      'type'  => 'bbp',
      'url'   => home_url( $wp->request . '/' ),
      'label' => bbp_get_forum_archive_title(),
    );

  } else {

    $disabled = has_filter( 'bbp_no_breadcrumb', '__return_true' );

    if ( $disabled ) {
      remove_filter( 'bbp_no_breadcrumb', '__return_true' );
    }

    $bbpress_crumbs = [];

    // Siphon out the bbPress crumbs
    $temp_filter = function ($trail, $crumbs) use (&$bbpress_crumbs) {
      $bbpress_crumbs = $crumbs;
      return $trail;
    };

    add_filter( 'bbp_get_breadcrumb', $temp_filter, 10, 2 );
    bbp_get_breadcrumb();
    remove_filter( 'bbp_get_breadcrumb', $temp_filter, 10, 2);

    if ( $disabled ) {
      add_filter( 'bbp_no_breadcrumb', '__return_true' );
    }

    $final_bbpress_crumb = array_pop( $bbpress_crumbs );

    foreach ( $bbpress_crumbs as $bbpress_crumb ) {

      preg_match( '/<a.+?href="(.+?)".*?class="(.*?)".*?>(.*?)<\/a>/', $bbpress_crumb, $matches );

      $crumbs[] = array(
        'type'  => isset( $matches[2] ) ? $matches[2] : '',
        'url'   => isset( $matches[1] ) ? $matches[1] : '',
        'label' => isset( $matches[3] ) ? $matches[3] : '',
      );

    }

    $crumbs[] = array(
      'type'  => 'bbp-current',
      'url'   => home_url( $wp->request . '/' ),
      'label' => $final_bbpress_crumb,
    );

  }

  return $crumbs;

} );