@@ 331-355 (lines=25) @@ | ||
328 | * |
|
329 | * @return string HTML for recipe notes shortcode. |
|
330 | */ |
|
331 | public static function recipe_notes_shortcode( $atts, $content = '' ) { |
|
332 | $atts = shortcode_atts( |
|
333 | array( |
|
334 | 'title' => '', // string. |
|
335 | ), |
|
336 | $atts, |
|
337 | 'recipe-notes' |
|
338 | ); |
|
339 | ||
340 | $html = ''; |
|
341 | ||
342 | // Print a title if one exists. |
|
343 | if ( '' !== $atts['title'] ) { |
|
344 | $html .= '<h4 class="jetpack-recipe-notes-title">' . esc_html( $atts['title'] ) . '</h4>'; |
|
345 | } |
|
346 | ||
347 | $html .= '<div class="jetpack-recipe-notes">'; |
|
348 | ||
349 | // Format content using list functionality, if desired. |
|
350 | $html .= self::output_list_content( $content, 'notes' ); |
|
351 | ||
352 | $html .= '</div>'; |
|
353 | ||
354 | // Sanitize html. |
|
355 | $html = wp_kses_post( $html ); |
|
356 | ||
357 | // Return the HTML block. |
|
358 | return $html; |
|
@@ 370-392 (lines=23) @@ | ||
367 | * |
|
368 | * @return string HTML for recipe ingredients shortcode. |
|
369 | */ |
|
370 | public static function recipe_ingredients_shortcode( $atts, $content = '' ) { |
|
371 | $atts = shortcode_atts( |
|
372 | array( |
|
373 | 'title' => esc_html_x( 'Ingredients', 'recipe', 'jetpack' ), // string. |
|
374 | ), |
|
375 | $atts, |
|
376 | 'recipe-ingredients' |
|
377 | ); |
|
378 | ||
379 | $html = '<div class="jetpack-recipe-ingredients">'; |
|
380 | ||
381 | // Print a title unless the user has opted to exclude it. |
|
382 | if ( 'false' !== $atts['title'] ) { |
|
383 | $html .= '<h4 class="jetpack-recipe-ingredients-title">' . esc_html( $atts['title'] ) . '</h4>'; |
|
384 | } |
|
385 | ||
386 | // Format content using list functionality. |
|
387 | $html .= self::output_list_content( $content, 'ingredients' ); |
|
388 | ||
389 | $html .= '</div>'; |
|
390 | ||
391 | // Sanitize html. |
|
392 | $html = wp_kses_post( $html ); |
|
393 | ||
394 | // Return the HTML block. |
|
395 | return $html; |
|
@@ 489-511 (lines=23) @@ | ||
486 | * |
|
487 | * @return string HTML for recipe directions shortcode. |
|
488 | */ |
|
489 | public static function recipe_directions_shortcode( $atts, $content = '' ) { |
|
490 | $atts = shortcode_atts( |
|
491 | array( |
|
492 | 'title' => esc_html_x( 'Directions', 'recipe', 'jetpack' ), // string. |
|
493 | ), |
|
494 | $atts, |
|
495 | 'recipe-directions' |
|
496 | ); |
|
497 | ||
498 | $html = '<div class="jetpack-recipe-directions">'; |
|
499 | ||
500 | // Print a title unless the user has specified to exclude it. |
|
501 | if ( 'false' !== $atts['title'] ) { |
|
502 | $html .= '<h4 class="jetpack-recipe-directions-title">' . esc_html( $atts['title'] ) . '</h4>'; |
|
503 | } |
|
504 | ||
505 | // Format content using list functionality. |
|
506 | $html .= self::output_list_content( $content, 'directions' ); |
|
507 | ||
508 | $html .= '</div>'; |
|
509 | ||
510 | // Sanitize html. |
|
511 | $html = wp_kses_post( $html ); |
|
512 | ||
513 | // Return the HTML block. |
|
514 | return $html; |