Code Duplication    Length = 20-20 lines in 3 locations

json-endpoints/class.wpcom-json-api-post-endpoint.php 1 location

@@ 499-518 (lines=20) @@
496
497
	// No Blog ID parameter.  No Post ID parameter.  Depends on globals.
498
	// Expects setup_postdata() to already have been run
499
	function get_the_post_content_for_display() {
500
		global $pages, $page;
501
502
		$old_pages = $pages;
503
		$old_page  = $page;
504
505
		$content = join( "\n\n", $pages );
506
		$content = preg_replace( '/<!--more(.*?)?-->/', '', $content );
507
		$pages   = array( $content );
508
		$page    = 1;
509
510
		ob_start();
511
		the_content();
512
		$return = ob_get_clean();
513
514
		$pages = $old_pages;
515
		$page  = $old_page;
516
517
		return $return;
518
	}
519
520
	function get_blog_post( $blog_id, $post_id, $context = 'display' ) {
521
		$blog_id = $this->api->get_blog_id( $blog_id );

json-endpoints/class.wpcom-json-api-post-v1-1-endpoint.php 1 location

@@ 514-533 (lines=20) @@
511
512
	// No Blog ID parameter.  No Post ID parameter.  Depends on globals.
513
	// Expects setup_postdata() to already have been run
514
	function get_the_post_content_for_display() {
515
		global $pages, $page;
516
517
		$old_pages = $pages;
518
		$old_page  = $page;
519
520
		$content = join( "\n\n", $pages );
521
		$content = preg_replace( '/<!--more(.*?)?-->/', '', $content );
522
		$pages   = array( $content );
523
		$page    = 1;
524
525
		ob_start();
526
		the_content();
527
		$return = ob_get_clean();
528
529
		$pages = $old_pages;
530
		$page  = $old_page;
531
532
		return $return;
533
	}
534
535
	function get_blog_post( $blog_id, $post_id, $context = 'display' ) {
536
		$blog_id = $this->api->get_blog_id( $blog_id );

sal/class.json-api-post-base.php 1 location

@@ 406-425 (lines=20) @@
403
404
	// No Blog ID parameter.  No Post ID parameter.  Depends on globals.
405
	// Expects setup_postdata() to already have been run
406
	function get_the_post_content_for_display() {
407
		global $pages, $page;
408
409
		$old_pages = $pages;
410
		$old_page  = $page;
411
412
		$content = join( "\n\n", $pages );
413
		$content = preg_replace( '/<!--more(.*?)?-->/', '', $content );
414
		$pages   = array( $content );
415
		$page    = 1;
416
417
		ob_start();
418
		the_content();
419
		$return = ob_get_clean();
420
421
		$pages = $old_pages;
422
		$page  = $old_page;
423
424
		return $return;
425
	}
426
427
	public function get_author() {
428
		if ( 0 == $this->post->post_author )