$builder ) { $value = get_post_meta( $post_id, (string) $meta_key, true ); if ( '' === $value || false === $value || null === $value || '0' === $value || 'off' === $value ) { continue; // Present-but-falsy (e.g. Divi toggled off) is not current ownership. } return (string) $builder; } return false; } /** * The page-builder ownership marker map: meta key => detected builder's short name. * * Extracted to its own function so aafm_hard_blocked_meta_key() (includes/helpers.php) can hard- * block every configured marker key from the generic post-meta abilities - Codex final round 7 * HIGH: `et_pb_use_builder`/`fusion_builder_status`/`fusion_builder_converted` are NOT `_`-prefixed * so is_protected_meta() never protects them, and neither did the built-in hard-block list, so an * operator who exposes `*` (or one of these keys by name) via the meta allowlist let the agent * clear the marker with update-post-meta/delete-post-meta and then have aafm_exec_update_post()'s * ownership check pass on the very next call, writing through the guard entirely. * `_elementor_data`/`_fl_builder_data` were already covered by is_protected_meta()'s leading- * underscore rule; blocking the whole map here rather than only the two gap keys keeps this * automatically correct for any marker added later through the aafm_page_builder_markers filter, * including a future OptimizePress marker once one is confirmed. * * @return array Meta key => builder short name. */ function aafm_page_builder_markers(): array { return apply_filters( 'aafm_page_builder_markers', array( '_elementor_data' => 'elementor', 'et_pb_use_builder' => 'divi', '_fl_builder_data' => 'beaver-builder', 'fusion_builder_status' => 'avada', 'fusion_builder_converted' => 'avada', ) ); } /** * The shared refusal error every content-write call site returns identically when the target * post is owned by a foreign page builder. * * Wording covers BOTH outcomes an unguarded write could have, not only "no visible effect": * Avada/Fusion Builder is the one covered builder that DOES render from post_content (Fusion * shortcodes), so an unguarded generic write there would alter or corrupt the shortcode tree * rather than silently do nothing - Codex final round 7 LOW. * * @param string $builder The detected builder's short name (from aafm_post_has_foreign_builder_ownership()). * @return WP_Error */ function aafm_page_builder_owned_error( string $builder ): WP_Error { $label = ucwords( str_replace( '-', ' ', $builder ) ); return new WP_Error( 'aafm_page_builder_owned', sprintf( /* translators: 1: detected page builder name, e.g. Elementor. 2: same name, repeated for readability. 3: same name, repeated for readability. */ __( 'This content is owned by %1$s. Writing to it through this ability would either have no visible effect or corrupt %2$s\'s own stored markup, because %3$s renders from its own stored data rather than (or in addition to) the post content field. Edit it there directly.', 'agent-abilities-for-mcp' ), $label, $label, $label ), array( 'status' => 409 ) ); }