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