first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<?php
class WPML_BBPress_API {
public function bbp_get_user_profile_url( $user_id = 0, $user_nicename = '' ) {
/**
* @phpstan-ignore-next-line
*/
return bbp_get_user_profile_url( $user_id, $user_nicename );
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* WPML_BBPress_Filters class file.
*
* @package WPML\Core
*/
/**
* Class WPML_BBPress_Filters
*/
class WPML_BBPress_Filters {
/**
* WPML_BBPress_API instance.
*
* @var WPML_BBPress_API
*/
private $wpml_bbpress_api;
/**
* WPML_BBPress_Filters constructor.
*
* @param WPML_BBPress_API $wpml_bbpress_api WPML_BBPress_API instance.
*/
public function __construct( $wpml_bbpress_api ) {
$this->wpml_bbpress_api = $wpml_bbpress_api;
}
/**
* Destruct instance.
*/
public function __destruct() {
$this->remove_hooks();
}
/**
* Add hooks.
*/
public function add_hooks() {
add_filter( 'author_link', array( $this, 'author_link_filter' ), 10, 3 );
}
/**
* Remove hooks.
*/
public function remove_hooks() {
remove_filter( 'author_link', array( $this, 'author_link_filter' ), 10 );
}
/**
* Author link filter.
*
* @param string $link Author link.
* @param int $author_id Author id.
* @param string $author_nicename Author nicename.
*
* @return mixed
*/
public function author_link_filter( $link, $author_id, $author_nicename ) {
if (
doing_action( 'wpseo_head' ) ||
doing_action( 'wp_head' ) ||
doing_filter( 'wpml_active_languages' )
) {
return $this->wpml_bbpress_api->bbp_get_user_profile_url( $author_id, $author_nicename );
}
return $link;
}
}