v1.1.1
This commit is contained in:
parent
92d56fe84d
commit
7dd3eeaa8a
1 changed files with 4912 additions and 1581 deletions
|
|
@ -293,7 +293,13 @@ function robotstxt_docmd_sync_mapping( int $mapping_id ): bool|WP_Error {
|
|||
}
|
||||
|
||||
// Convert Markdown to HTML using CommonMark.
|
||||
$converter = new \League\CommonMark\CommonMarkConverter();
|
||||
// Strip raw HTML from Markdown to prevent stored XSS via compromised upstream repos.
|
||||
$converter = new \League\CommonMark\CommonMarkConverter(
|
||||
array(
|
||||
'html_input' => 'strip',
|
||||
'allow_unsafe_links' => false,
|
||||
)
|
||||
);
|
||||
$html_content = $converter->convert( $content )->getContent();
|
||||
|
||||
// Create or update WordPress post.
|
||||
|
|
@ -321,12 +327,18 @@ function robotstxt_docmd_sync_mapping( int $mapping_id ): bool|WP_Error {
|
|||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_post_id', $post_id );
|
||||
} else {
|
||||
// Update existing post.
|
||||
wp_update_post(
|
||||
$update_result = wp_update_post(
|
||||
array(
|
||||
'ID' => $mapping['target_post_id'],
|
||||
'post_content' => $html_content,
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_wp_error( $update_result ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'error' );
|
||||
return $update_result;
|
||||
}
|
||||
}
|
||||
|
||||
// Update sync status.
|
||||
|
|
|
|||
Loading…
Reference in a new issue