PluginProbe
ActivityPub / 7.7.0
ActivityPub v7.7.0
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-shortcodes.php +21 -20 9.2.07.7.0 View file →
@@ -14,11 +14,11 @@
14 14 /**
15 15 * Register the shortcodes.
16 16 */
17 17 public static function register() {
18 - foreach ( \get_class_methods( self::class ) as $shortcode ) {
18 + foreach ( get_class_methods( self::class ) as $shortcode ) {
19 19 if ( 'init' !== $shortcode ) {
20 - \add_shortcode( 'ap_' . $shortcode, array( self::class, $shortcode ) );
20 + add_shortcode( 'ap_' . $shortcode, array( self::class, $shortcode ) );
21 21 }
22 22 }
23 23 }
24 24
@@ -25,11 +25,11 @@
25 25 /**
26 26 * Unregister the shortcodes.
27 27 */
28 28 public static function unregister() {
29 - foreach ( \get_class_methods( self::class ) as $shortcode ) {
29 + foreach ( get_class_methods( self::class ) as $shortcode ) {
30 30 if ( 'init' !== $shortcode ) {
31 - \remove_shortcode( 'ap_' . $shortcode );
31 + remove_shortcode( 'ap_' . $shortcode );
32 32 }
33 33 }
34 34 }
35 35
@@ -90,9 +90,9 @@
90 90 if ( ! $title ) {
91 91 return '';
92 92 }
93 93
94 - $attributes = \shortcode_atts(
94 + $attributes = shortcode_atts(
95 95 array( 'type' => 'plain' ),
96 96 $attributes,
97 97 $tag
98 98 );
@@ -100,9 +100,9 @@
100 100 if ( 'html' !== $attributes['type'] ) {
101 101 return $title;
102 102 }
103 103
104 - return \sprintf( '<h2>%s</h2>', $title );
104 + return sprintf( '<h2>%s</h2>', $title );
105 105 }
106 106
107 107 /**
108 108 * Generates output for the 'ap_excerpt' Shortcode
@@ -119,15 +119,15 @@
119 119 if ( ! $item ) {
120 120 return '';
121 121 }
122 122
123 - $attributes = \shortcode_atts(
123 + $attributes = shortcode_atts(
124 124 array( 'length' => ACTIVITYPUB_EXCERPT_LENGTH ),
125 125 $attributes,
126 126 $tag
127 127 );
128 128
129 - $excerpt_length = \intval( $attributes['length'] );
129 + $excerpt_length = intval( $attributes['length'] );
130 130
131 131 if ( 0 === $excerpt_length ) {
132 132 $excerpt_length = ACTIVITYPUB_EXCERPT_LENGTH;
133 133 }
@@ -154,11 +154,11 @@
154 154 return '';
155 155 }
156 156
157 157 // Prevent inception.
158 - \remove_shortcode( 'ap_content' );
158 + remove_shortcode( 'ap_content' );
159 159
160 - $attributes = \shortcode_atts(
160 + $attributes = shortcode_atts(
161 161 array( 'apply_filters' => 'yes' ),
162 162 $attributes,
163 163 $tag
164 164 );
@@ -166,11 +166,11 @@
166 166 $content = '';
167 167
168 168 if ( 'attachment' === $item->post_type ) {
169 169 // Get title of attachment with fallback to alt text.
170 - $content = \wp_get_attachment_caption( $item->ID );
170 + $content = wp_get_attachment_caption( $item->ID );
171 171 if ( empty( $content ) ) {
172 - $content = \get_post_meta( $item->ID, '_wp_attachment_image_alt', true );
172 + $content = get_post_meta( $item->ID, '_wp_attachment_image_alt', true );
173 173 }
174 174 }
175 175
176 176 if ( empty( $content ) ) {
@@ -187,13 +187,14 @@
187 187 $content = \wptexturize( $content );
188 188 $content = \wp_filter_content_tags( $content );
189 189 }
190 190
191 + // Replace script and style elements.
192 + $content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
191 193 $content = \strip_shortcodes( $content );
192 - $content = Sanitize::clean_html( $content );
193 - $content = Sanitize::strip_whitespace( $content );
194 + $content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
194 195
195 - \add_shortcode( 'ap_content', array( 'Activitypub\Shortcodes', 'content' ) );
196 + add_shortcode( 'ap_content', array( 'Activitypub\Shortcodes', 'content' ) );
196 197
197 198 return $content;
198 199 }
199 200
@@ -212,9 +213,9 @@
212 213 if ( ! $item ) {
213 214 return '';
214 215 }
215 216
216 - $attributes = \shortcode_atts(
217 + $attributes = shortcode_atts(
217 218 array(
218 219 'type' => 'url',
219 220 ),
220 221 $attributes,
@@ -246,9 +247,9 @@
246 247 if ( ! $item ) {
247 248 return '';
248 249 }
249 250
250 - $attributes = \shortcode_atts(
251 + $attributes = shortcode_atts(
251 252 array(
252 253 'type' => 'url',
253 254 ),
254 255 $attributes,
@@ -280,9 +281,9 @@
280 281 if ( ! $item ) {
281 282 return '';
282 283 }
283 284
284 - $attributes = \shortcode_atts(
285 + $attributes = shortcode_atts(
285 286 array(
286 287 'type' => 'full',
287 288 ),
288 289 $attributes,
@@ -290,9 +291,9 @@
290 291 );
291 292
292 293 $size = 'full';
293 294
294 - if ( \in_array(
295 + if ( in_array(
295 296 $attributes['type'],
296 297 array( 'thumbnail', 'medium', 'large', 'full' ),
297 298 true
298 299 ) ) {
@@ -337,9 +338,9 @@
337 338 if ( ! $name ) {
338 339 return '';
339 340 }
340 341
341 - return \wp_strip_all_tags( $name );
342 + return wp_strip_all_tags( $name );
342 343 }
343 344
344 345 /**
345 346 * Generates output for the 'ap_authorurl' Shortcode.