PluginProbe
ActivityPub / 8.0.2
ActivityPub v8.0.2
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/class-embed.php +11 -11 9.2.08.0.2 View file →
@@ -55,9 +55,9 @@
55 55
56 56 // If we don't have an avatar URL, but we have an author URL, try to fetch it.
57 57 if ( ! $avatar_url && $author_url ) {
58 58 $author = Http::get_remote_object( $author_url );
59 - if ( \is_wp_error( $author ) ) {
59 + if ( is_wp_error( $author ) ) {
60 60 $author = array();
61 61 } else {
62 62 $avatar_url = $author['icon']['url'] ?? '';
63 63 $author_name = empty( $author['name'] ) ? $author_name : $author['name'];
@@ -77,9 +77,9 @@
77 77 }
78 78
79 79 $title = $activity_object['name'] ?? '';
80 80 $content = $activity_object['content'] ?? '';
81 - $published = isset( $activity_object['published'] ) ? \gmdate( \get_option( 'date_format' ) . ', ' . \get_option( 'time_format' ), \strtotime( $activity_object['published'] ) ) : '';
81 + $published = isset( $activity_object['published'] ) ? gmdate( get_option( 'date_format' ) . ', ' . get_option( 'time_format' ), strtotime( $activity_object['published'] ) ) : '';
82 82 $boosts = isset( $activity_object['shares']['totalItems'] ) ? (int) $activity_object['shares']['totalItems'] : null;
83 83 $favorites = isset( $activity_object['likes']['totalItems'] ) ? (int) $activity_object['likes']['totalItems'] : null;
84 84
85 85 $audio = null;
@@ -94,9 +94,9 @@
94 94 ),
95 95 );
96 96 } elseif ( isset( $activity_object['attachment'] ) ) {
97 97 foreach ( $activity_object['attachment'] as $attachment ) {
98 - $type = isset( $attachment['mediaType'] ) ? \strtok( $attachment['mediaType'], '/' ) : \strtolower( $attachment['type'] );
98 + $type = isset( $attachment['mediaType'] ) ? strtok( $attachment['mediaType'], '/' ) : strtolower( $attachment['type'] );
99 99
100 100 switch ( $type ) {
101 101 case 'image':
102 102 $images[] = $attachment;
@@ -111,10 +111,10 @@
111 111 }
112 112 $images = \array_slice( $images, 0, 4 );
113 113 }
114 114
115 - \ob_start();
116 - \load_template(
115 + ob_start();
116 + load_template(
117 117 ACTIVITYPUB_PLUGIN_DIR . 'templates/embed.php',
118 118 false,
119 119 array(
120 120 'audio' => $audio,
@@ -136,13 +136,13 @@
136 136 if ( $inline_css ) {
137 137 // Grab the CSS.
138 138 $css = \file_get_contents( ACTIVITYPUB_PLUGIN_DIR . 'assets/css/activitypub-embed.css' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
139 139 // We embed CSS directly because this may be in an iframe.
140 - \printf( '<style>%s</style>', $css ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
140 + printf( '<style>%s</style>', $css ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
141 141 }
142 142
143 143 // A little light whitespace cleanup.
144 - return \preg_replace( '/\s+/', ' ', \ob_get_clean() );
144 + return preg_replace( '/\s+/', ' ', ob_get_clean() );
145 145 }
146 146
147 147 /**
148 148 * Check if a real oEmbed result exists for the given URL.
@@ -260,9 +260,9 @@
260 260 if ( '/oembed/1.0/proxy' !== $request->get_route() ) {
261 261 return $response;
262 262 }
263 263
264 - if ( ( \is_wp_error( $response ) && 'oembed_invalid_url' === $response->get_error_code() ) || empty( $response->html ) ) {
264 + if ( ( is_wp_error( $response ) && 'oembed_invalid_url' === $response->get_error_code() ) || empty( $response->html ) ) {
265 265 $url = $request->get_param( 'url' );
266 266 $html = self::get_html( $url );
267 267
268 268 if ( $html ) {
@@ -273,14 +273,14 @@
273 273 'scripts' => array(),
274 274 );
275 275
276 276 /** This filter is documented in wp-includes/class-wp-oembed.php */
277 - $data->html = \apply_filters( 'oembed_result', $data->html, $url, $args );
277 + $data->html = apply_filters( 'oembed_result', $data->html, $url, $args );
278 278
279 279 /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
280 - $ttl = \apply_filters( 'rest_oembed_ttl', DAY_IN_SECONDS, $url, $args );
280 + $ttl = apply_filters( 'rest_oembed_ttl', DAY_IN_SECONDS, $url, $args );
281 281
282 - \set_transient( 'oembed_' . \md5( \serialize( $args ) ), $data, $ttl ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
282 + set_transient( 'oembed_' . md5( serialize( $args ) ), $data, $ttl ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
283 283
284 284 $response = new \WP_REST_Response( $data );
285 285 }
286 286 } elseif ( ! empty( $request->get_param( 'activitypub' ) ) ) {