[ defined( 'ELEMENTOR_VERSION' ) && ( ! Edition::has( 'elementor' ) || ! apply_filters( 'clusterlane_elementor_write', true ) ), fn() => get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder' ], 'Beaver Builder' => [ defined( 'FL_BUILDER_VERSION' ), fn() => (bool) get_post_meta( $post_id, '_fl_builder_enabled', true ) ], 'Bricks' => [ defined( 'BRICKS_VERSION' ), fn() => get_post_meta( $post_id, '_bricks_editor_mode', true ) === 'bricks' ], ]; foreach ( $builders as $name => [ $active, $uses ] ) { if ( $active && $uses() ) return $name; } return apply_filters( 'clusterlane_page_builder', null, $post_id ); } /** * Display name of another user who has this article open in the editor * right now (WordPress post lock), or null. Writing while someone edits * would be overwritten by their next save — or overwrite their work. */ public static function locked_by( int $post_id ): ?string { if ( ! function_exists( 'wp_check_post_lock' ) ) { require_once ABSPATH . 'wp-admin/includes/post.php'; } $user_id = wp_check_post_lock( $post_id ); if ( ! $user_id ) return null; $user = get_userdata( $user_id ); return $user ? $user->display_name : __( 'Another user', 'clusterlane' ); } public static function locked_message( string $name ): string { /* translators: %s: user display name */ return sprintf( __( '%s is editing this article right now. Try again when they are done, so neither change overwrites the other.', 'clusterlane' ), $name ); } public static function page_builder_message( string $builder ): string { if ( $builder === 'Elementor' && ! Edition::has( 'elementor' ) ) { /* translators: %s: edition name */ return sprintf( __( 'This article is built with Elementor. Adding links to Elementor layouts is part of %s — add the link in the Elementor editor instead.', 'clusterlane' ), Edition::label( Edition::tier_for( 'elementor' ) ) ); } return sprintf( /* translators: %s: page builder name, e.g. Elementor */ __( 'This article is built with %1$s. Clusterlane can’t insert links into %2$s layouts yet — a link added here would not show on the site. Add it in the %3$s editor instead.', 'clusterlane' ), $builder, $builder, $builder ); } }