| @@ -1,8 +1,12 @@ | ||
| 1 | 1 | <?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | |
| 3 | 3 | use Automattic\Jetpack\Assets; |
| 4 | 4 | |
| 5 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 6 | + exit( 0 ); | |
| 7 | +} | |
| 8 | + | |
| 5 | 9 | /** |
| 6 | 10 | * Embed recipe 'cards' in post, with basic styling and print functionality |
| 7 | 11 | * |
| 8 | 12 | * To Do |
| @@ -15,8 +19,10 @@ | ||
| 15 | 19 | */ |
| 16 | 20 | |
| 17 | 21 | /** |
| 18 | 22 | * Register and display Recipes in posts. |
| 23 | + * | |
| 24 | + * @phan-constructor-used-for-side-effects | |
| 19 | 25 | */ |
| 20 | 26 | class Jetpack_Recipes { |
| 21 | 27 | |
| 22 | 28 | /** |
| @@ -110,20 +116,20 @@ | ||
| 110 | 116 | if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) { |
| 111 | 117 | return; |
| 112 | 118 | } |
| 113 | 119 | |
| 114 | - wp_enqueue_script( | |
| 115 | - 'jetpack-recipes-printthis', | |
| 116 | - Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes-printthis.min.js', 'modules/shortcodes/js/recipes-printthis.js' ), | |
| 120 | + wp_register_script( | |
| 121 | + 'jetpack-shortcode-deps', | |
| 122 | + plugins_url( '_inc/build/shortcodes/js/dependencies.min.js', JETPACK__PLUGIN_FILE ), | |
| 117 | 123 | array( 'jquery' ), |
| 118 | - '20170202', | |
| 119 | - false | |
| 124 | + '20250905', | |
| 125 | + true | |
| 120 | 126 | ); |
| 121 | 127 | |
| 122 | 128 | wp_enqueue_script( |
| 123 | 129 | 'jetpack-recipes-js', |
| 124 | 130 | Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes.min.js', 'modules/shortcodes/js/recipes.js' ), |
| 125 | - array( 'jquery', 'jetpack-recipes-printthis' ), | |
| 131 | + array( 'jquery', 'jetpack-shortcode-deps' ), | |
| 126 | 132 | '20131230', |
| 127 | 133 | false |
| 128 | 134 | ); |
| 129 | 135 | |
| @@ -477,13 +483,8 @@ | ||
| 477 | 483 | $list_item_replacement = '<li class="jetpack-recipe-nutrition">${1}</li>'; |
| 478 | 484 | $itemprop = ' itemprop="nutrition"'; |
| 479 | 485 | $listtype = 'ul'; |
| 480 | 486 | break; |
| 481 | - case 'nutrition': | |
| 482 | - $list_item_replacement = '<li class="jetpack-recipe-nutrition nutrition">${1}</li>'; | |
| 483 | - $itemprop = ' itemprop="nutrition"'; | |
| 484 | - $listtype = 'ul'; | |
| 485 | - break; | |
| 486 | 487 | default: |
| 487 | 488 | $list_item_replacement = '<li class="jetpack-recipe-notes">${1}</li>'; |
| 488 | 489 | $itemprop = ''; |
| 489 | 490 | $listtype = 'ul'; |
| @@ -682,10 +683,12 @@ | ||
| 682 | 683 | public function themecolor_styles() { |
| 683 | 684 | global $themecolors; |
| 684 | 685 | $style = ''; |
| 685 | 686 | |
| 686 | - if ( isset( $themecolors ) ) { | |
| 687 | + if ( isset( $themecolors['border'] ) ) { | |
| 687 | 688 | $style .= '.jetpack-recipe { border-color: #' . esc_attr( $themecolors['border'] ) . '; }'; |
| 689 | + } | |
| 690 | + if ( isset( $themecolors['link'] ) ) { | |
| 688 | 691 | $style .= '.jetpack-recipe-title { border-bottom-color: #' . esc_attr( $themecolors['link'] ) . '; }'; |
| 689 | 692 | } |
| 690 | 693 | |
| 691 | 694 | return $style; |