| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | */ |
| 20 | 20 | public static function init() { |
| 21 | 21 | \add_filter( 'activitypub_attachments_media_markup', array( self::class, 'filter_attachments_media_markup' ), 10, 2 ); |
| 22 | 22 | \add_filter( 'activitypub_attachment_ids', array( self::class, 'filter_attached_media_ids' ), 10, 2 ); |
| 23 | - \add_action( 'add_meta_boxes', array( self::class, 'add_meta_box' ), 10, 2 ); | |
| 23 | + \add_action( 'add_meta_boxes', array( self::class, 'add_meta_box' ) ); | |
| 24 | 24 | \add_action( 'save_post', array( self::class, 'save_meta_data' ) ); |
| 25 | 25 | |
| 26 | 26 | if ( \function_exists( 'classicpress_version' ) ) { |
| 27 | 27 | \add_filter( 'activitypub_site_supports_blocks', '__return_false' ); |
| @@ -40,13 +40,13 @@ | ||
| 40 | 40 | if ( empty( $attachment_ids ) ) { |
| 41 | 41 | return $markup; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $type = \strtok( \get_post_mime_type( $attachment_ids[0] ), '/' ); | |
| 44 | + $type = strtok( \get_post_mime_type( $attachment_ids[0] ), '/' ); | |
| 45 | 45 | |
| 46 | 46 | // Single video or audio file: use media shortcode. |
| 47 | 47 | if ( 1 === \count( $attachment_ids ) && ( 'video' === $type || 'audio' === $type ) ) { |
| 48 | - return \sprintf( | |
| 48 | + return sprintf( | |
| 49 | 49 | '[%1$s src="%2$s"]', |
| 50 | 50 | \esc_attr( $type ), |
| 51 | 51 | \esc_url( \wp_get_attachment_url( $attachment_ids[0] ) ) |
| 52 | 52 | ); |
| @@ -52,9 +52,9 @@ | ||
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Multiple attachments or images: use gallery shortcode. |
| 56 | - return '[gallery ids="' . \implode( ',', $attachment_ids ) . '" link="none"]'; | |
| 56 | + return '[gallery ids="' . implode( ',', $attachment_ids ) . '" link="none"]'; | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Filter to add attached media IDs from the post's media library. |
| @@ -103,28 +103,16 @@ | ||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Add ActivityPub meta box to the post editor. |
| 106 | 106 | * |
| 107 | - * @param string $post_type The post type. | |
| 108 | - * @param \WP_Post|null $post The post being edited. | |
| 107 | + * @param string $post_type The post type. | |
| 109 | 108 | */ |
| 110 | - public static function add_meta_box( $post_type, $post = null ) { | |
| 109 | + public static function add_meta_box( $post_type ) { | |
| 111 | 110 | // Only add for post types that support ActivityPub. |
| 112 | 111 | if ( ! \post_type_supports( $post_type, 'activitypub' ) ) { |
| 113 | 112 | return; |
| 114 | 113 | } |
| 115 | 114 | |
| 116 | - /* | |
| 117 | - * The block editor ships its own ActivityPub panel, so the classic meta box must not be | |
| 118 | - * added there. With the Classic Editor plugin in switchable mode a post can still open in | |
| 119 | - * the block editor, where both would otherwise render and the meta box's save_post handler | |
| 120 | - * would overwrite the panel's value. The function_exists() check keeps ClassicPress and | |
| 121 | - * other block-less setups (where use_block_editor_for_post() is absent) safe. | |
| 122 | - */ | |
| 123 | - if ( $post instanceof \WP_Post && \function_exists( 'use_block_editor_for_post' ) && \use_block_editor_for_post( $post ) ) { | |
| 124 | - return; | |
| 125 | - } | |
| 126 | - | |
| 127 | 115 | \add_meta_box( |
| 128 | 116 | 'activitypub-settings', |
| 129 | 117 | \__( 'Fediverse ⁂', 'activitypub' ), |
| 130 | 118 | array( self::class, 'render_meta_box' ), |
| @@ -195,9 +183,9 @@ | ||
| 195 | 183 | </select> |
| 196 | 184 | <span class="howto"> |
| 197 | 185 | <?php \esc_html_e( 'Quoting allows others to cite your post while adding their own commentary.', 'activitypub' ); ?> |
| 198 | 186 | <?php |
| 199 | - \printf( | |
| 187 | + printf( | |
| 200 | 188 | /* translators: %s: The current site default quote policy. Note the leading space. */ |
| 201 | 189 | \esc_html__( ' Site default: %s', 'activitypub' ), |
| 202 | 190 | \esc_html( self::get_quote_policy_label( $default_quote_policy ) ) |
| 203 | 191 | ); |