Code Duplication    Length = 23-25 lines in 3 locations

modules/shortcodes/recipe.php 3 locations

@@ 362-386 (lines=25) @@
359
	 *
360
	 * @return string HTML for recipe notes shortcode.
361
	 */
362
	static function recipe_notes_shortcode( $atts, $content = '' ) {
363
		$atts = shortcode_atts(
364
			array(
365
				'title' => '', // string.
366
			),
367
			$atts,
368
			'recipe-notes'
369
		);
370
371
		$html = '';
372
373
		// Print a title if one exists.
374
		if ( '' !== $atts['title'] ) {
375
			$html .= '<h4 class="jetpack-recipe-notes-title">' . esc_html( $atts['title'] ) . '</h4>';
376
		}
377
378
		$html .= '<div class="jetpack-recipe-notes">';
379
380
		// Format content using list functionality, if desired.
381
		$html .= self::output_list_content( $content, 'notes' );
382
383
		$html .= '</div>';
384
385
		// Sanitize html.
386
		$html = wp_kses_post( $html );
387
388
		// Return the HTML block.
389
		return $html;
@@ 401-423 (lines=23) @@
398
	 *
399
	 * @return string HTML for recipe ingredients shortcode.
400
	 */
401
	static function recipe_ingredients_shortcode( $atts, $content = '' ) {
402
		$atts = shortcode_atts(
403
			array(
404
				'title' => esc_html_x( 'Ingredients', 'recipe', 'jetpack' ), // string.
405
			),
406
			$atts,
407
			'recipe-ingredients'
408
		);
409
410
		$html = '<div class="jetpack-recipe-ingredients">';
411
412
		// Print a title unless the user has opted to exclude it.
413
		if ( 'false' !== $atts['title'] ) {
414
			$html .= '<h4 class="jetpack-recipe-ingredients-title">' . esc_html( $atts['title'] ) . '</h4>';
415
		}
416
417
		// Format content using list functionality.
418
		$html .= self::output_list_content( $content, 'ingredients' );
419
420
		$html .= '</div>';
421
422
		// Sanitize html.
423
		$html = wp_kses_post( $html );
424
425
		// Return the HTML block.
426
		return $html;
@@ 520-542 (lines=23) @@
517
	 *
518
	 * @return string HTML for recipe directions shortcode.
519
	 */
520
	static function recipe_directions_shortcode( $atts, $content = '' ) {
521
		$atts = shortcode_atts(
522
			array(
523
				'title' => esc_html_x( 'Directions', 'recipe', 'jetpack' ), // string.
524
			),
525
			$atts,
526
			'recipe-directions'
527
		);
528
529
		$html = '<div class="jetpack-recipe-directions">';
530
531
		// Print a title unless the user has specified to exclude it.
532
		if ( 'false' !== $atts['title'] ) {
533
			$html .= '<h4 class="jetpack-recipe-directions-title">' . esc_html( $atts['title'] ) . '</h4>';
534
		}
535
536
		// Format content using list functionality.
537
		$html .= self::output_list_content( $content, 'directions' );
538
539
		$html .= '</div>';
540
541
		// Sanitize html.
542
		$html = wp_kses_post( $html );
543
544
		// Return the HTML block.
545
		return $html;