|
@@ 391-400 (lines=10) @@
|
| 388 |
|
* @param int $id post ID |
| 389 |
|
* @return string Swapped content |
| 390 |
|
*/ |
| 391 |
|
public function edit_post_content( $content, $id ) { |
| 392 |
|
if ( $this->is_markdown( $id ) ) { |
| 393 |
|
$post = get_post( $id ); |
| 394 |
|
if ( $post && ! empty( $post->post_content_filtered ) ) { |
| 395 |
|
$post = $this->swap_for_editing( $post ); |
| 396 |
|
return $post->post_content; |
| 397 |
|
} |
| 398 |
|
} |
| 399 |
|
return $content; |
| 400 |
|
} |
| 401 |
|
|
| 402 |
|
/** |
| 403 |
|
* Swap post_content_filtered and post_content for editing |
|
@@ 408-416 (lines=9) @@
|
| 405 |
|
* @param int $id post ID |
| 406 |
|
* @return string Swapped content |
| 407 |
|
*/ |
| 408 |
|
public function edit_post_content_filtered( $content, $id ) { |
| 409 |
|
// if markdown was disabled, let's turn this off |
| 410 |
|
if ( ! $this->is_posting_enabled() && $this->is_markdown( $id ) ) { |
| 411 |
|
$post = get_post( $id ); |
| 412 |
|
if ( $post && ! empty( $post->post_content_filtered ) ) |
| 413 |
|
$content = ''; |
| 414 |
|
} |
| 415 |
|
return $content; |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
/** |
| 419 |
|
* Magic happens here. Markdown is converted and stored on post_content. Original Markdown is stored |