PluginProbe
ActivityPub / 7.8.2
ActivityPub v7.8.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-shortcodes.php +20 -18 9.2.07.8.2 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,15 @@
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 194 $content = Sanitize::clean_html( $content );
193 195 $content = Sanitize::strip_whitespace( $content );
194 196
195 - \add_shortcode( 'ap_content', array( 'Activitypub\Shortcodes', 'content' ) );
197 + add_shortcode( 'ap_content', array( 'Activitypub\Shortcodes', 'content' ) );
196 198
197 199 return $content;
198 200 }
199 201
@@ -212,9 +214,9 @@
212 214 if ( ! $item ) {
213 215 return '';
214 216 }
215 217
216 - $attributes = \shortcode_atts(
218 + $attributes = shortcode_atts(
217 219 array(
218 220 'type' => 'url',
219 221 ),
220 222 $attributes,
@@ -246,9 +248,9 @@
246 248 if ( ! $item ) {
247 249 return '';
248 250 }
249 251
250 - $attributes = \shortcode_atts(
252 + $attributes = shortcode_atts(
251 253 array(
252 254 'type' => 'url',
253 255 ),
254 256 $attributes,
@@ -280,9 +282,9 @@
280 282 if ( ! $item ) {
281 283 return '';
282 284 }
283 285
284 - $attributes = \shortcode_atts(
286 + $attributes = shortcode_atts(
285 287 array(
286 288 'type' => 'full',
287 289 ),
288 290 $attributes,
@@ -290,9 +292,9 @@
290 292 );
291 293
292 294 $size = 'full';
293 295
294 - if ( \in_array(
296 + if ( in_array(
295 297 $attributes['type'],
296 298 array( 'thumbnail', 'medium', 'large', 'full' ),
297 299 true
298 300 ) ) {
@@ -337,9 +339,9 @@
337 339 if ( ! $name ) {
338 340 return '';
339 341 }
340 342
341 - return \wp_strip_all_tags( $name );
343 + return wp_strip_all_tags( $name );
342 344 }
343 345
344 346 /**
345 347 * Generates output for the 'ap_authorurl' Shortcode.