oops
This commit is contained in:
parent
1fd0cca185
commit
6e2656311b
2 changed files with 4 additions and 4 deletions
|
@ -52,7 +52,7 @@ class Http {
|
|||
$response = \wp_safe_remote_post( $url, $args );
|
||||
$code = \wp_remote_retrieve_response_code( $response );
|
||||
|
||||
if ( $code <= 400 ) {
|
||||
if ( $code >= 400 ) {
|
||||
$response = new WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ) );
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class Http {
|
|||
$response = \wp_safe_remote_get( $url, $args );
|
||||
$code = \wp_remote_retrieve_response_code( $response );
|
||||
|
||||
if ( $code <= 400 ) {
|
||||
if ( $code >= 400 ) {
|
||||
$response = new WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,7 @@ class Mention {
|
|||
);
|
||||
|
||||
$the_content = \preg_replace_callback( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/', array( self::class, 'replace_with_links' ), $the_content );
|
||||
|
||||
$the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content );
|
||||
$the_content = \str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content );
|
||||
|
||||
return $the_content;
|
||||
}
|
||||
|
@ -74,6 +73,7 @@ class Mention {
|
|||
*/
|
||||
public static function replace_with_links( $result ) {
|
||||
$metadata = get_remote_metadata_by_actor( $result[0] );
|
||||
|
||||
if ( ! is_wp_error( $metadata ) && ! empty( $metadata['url'] ) ) {
|
||||
$username = ltrim( $result[0], '@' );
|
||||
if ( ! empty( $metadata['name'] ) ) {
|
||||
|
|
Loading…
Reference in a new issue