WP Recipe Maker - Version 1.26.0

Version Description

  • Feature: Setting to automatically add recipe snippets like Jump to Recipe
  • Feature: Create recipes on the Manage page
  • Feature: Import from Cooked recipe plugin
  • Improvement: Ability to reset settings to defaults
  • Fix: Prevent issue with image metadata in different thumbnail sizes
  • Fix: Prevent trashing parent post from trashing recipe
  • Fix: Recipe image not loading when using Fly Dynamic Image Resizer
Download this release

Release Info

Developer BrechtVds
Plugin Icon 128x128 WP Recipe Maker
Version 1.26.0
Comparing to
See all releases

Code changes from version 1.25.0 to 1.26.0

assets/css/public/_snippets.scss ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // main: public.scss
2
+
3
+ .wprm-automatic-recipe-snippets {
4
+ text-align: center;
5
+ margin-bottom: 10px;
6
+
7
+ .wprm-jump-to-recipe-shortcode, .wprm-print-recipe-shortcode {
8
+ display: inline-block;
9
+ margin: 0 5px;
10
+ padding: 5px 10px;
11
+ }
12
+ }
assets/css/public/public.min.css CHANGED
@@ -1 +1 @@
1
- .wprm-print .wprm-recipe-print,.wprm-print .wprm-unit-conversion-container,.wprm-recipe li:before{display:none}.comment-form-wprm-rating .wprm-rating-star{cursor:pointer}.wprm-rating-star svg{vertical-align:middle;width:16px;height:16px;margin:0}.wprm-rating-star.rated svg polygon{fill:#000}.wprm-print .wprm-recipe{max-width:750px;margin:0 auto}.wprm-recipe{overflow:auto;zoom:1}.wprm-recipe li,.wprm-recipe p{font-size:1em}.wprm-recipe li,.wprm-recipe li.wprm-recipe-instruction{list-style-position:outside}.wprm-recipe .wprm-nutrition-label{margin-top:10px}
1
+ .comment-form-wprm-rating .wprm-rating-star{cursor:pointer}.wprm-rating-star svg{vertical-align:middle;width:16px;height:16px;margin:0}.wprm-rating-star.rated svg polygon{fill:#000}.wprm-print .wprm-recipe{max-width:750px;margin:0 auto}.wprm-print .wprm-recipe-print,.wprm-print .wprm-unit-conversion-container{display:none}.wprm-automatic-recipe-snippets{text-align:center;margin-bottom:10px}.wprm-automatic-recipe-snippets .wprm-jump-to-recipe-shortcode,.wprm-automatic-recipe-snippets .wprm-print-recipe-shortcode{display:inline-block;margin:0 5px;padding:5px 10px}.wprm-recipe{overflow:auto;zoom:1}.wprm-recipe li,.wprm-recipe p{font-size:1em}.wprm-recipe li,.wprm-recipe li.wprm-recipe-instruction{list-style-position:outside}.wprm-recipe li:before{display:none}.wprm-recipe .wprm-nutrition-label{margin-top:10px}
assets/css/public/public.scss CHANGED
@@ -1,3 +1,4 @@
1
  @import "comments";
2
  @import "print";
 
3
  @import "template_reset";
1
  @import "comments";
2
  @import "print";
3
+ @import "snippets";
4
  @import "template_reset";
assets/js/admin/settings.js CHANGED
@@ -3,4 +3,11 @@ var wprm_admin = wprm_admin || {};
3
  jQuery(document).ready(function($) {
4
  jQuery('.wprm-settings').find('select').select2_wprm();
5
  jQuery('.wprm-settings').find('.wprm-color').wpColorPicker();
 
 
 
 
 
 
 
6
  });
3
  jQuery(document).ready(function($) {
4
  jQuery('.wprm-settings').find('select').select2_wprm();
5
  jQuery('.wprm-settings').find('.wprm-color').wpColorPicker();
6
+
7
+ jQuery('#reset_settings_to_default').on('click', function() {
8
+ var checkbox = jQuery(this);
9
+ if(checkbox.is(':checked')) {
10
+ alert('Warning: having this checked will reset all your settings to default again');
11
+ }
12
+ });
13
  });
includes/admin/class-wprm-recipe-saver.php CHANGED
@@ -207,25 +207,31 @@ class WPRM_Recipe_Saver {
207
  public static function update_recipes_in_post( $post_id, $recipe_ids ) {
208
  $post = get_post( $post_id );
209
 
210
- $categories = get_the_terms( $post, 'category' );
211
- $cat_ids = ! $categories || is_wp_error( $categories ) ? array() : wp_list_pluck( $categories, 'term_id' );
212
-
213
- // Update recipes.
214
- foreach ( $recipe_ids as $recipe_id ) {
215
- $recipe = array(
216
- 'ID' => $recipe_id,
217
- 'post_status' => $post->post_status,
218
- 'post_author' => $post->post_author,
219
- 'post_date' => $post->post_date,
220
- 'post_modified' => $post->post_modified,
221
- );
222
- wp_update_post( $recipe );
223
-
224
- update_post_meta( $recipe_id, 'wprm_parent_post_id', $post_id );
225
-
226
- // Optionally associate categories with recipes.
227
- if ( is_object_in_taxonomy( WPRM_POST_TYPE, 'category' ) ) {
228
- wp_set_post_categories( $recipe_id, $cat_ids );
 
 
 
 
 
 
229
  }
230
  }
231
  }
207
  public static function update_recipes_in_post( $post_id, $recipe_ids ) {
208
  $post = get_post( $post_id );
209
 
210
+ if ( 'trash' !== $post->post_status ) {
211
+ $categories = get_the_terms( $post, 'category' );
212
+ $cat_ids = ! $categories || is_wp_error( $categories ) ? array() : wp_list_pluck( $categories, 'term_id' );
213
+
214
+ // Update recipes.
215
+ foreach ( $recipe_ids as $recipe_id ) {
216
+ $recipe = array(
217
+ 'ID' => $recipe_id,
218
+ 'post_status' => $post->post_status,
219
+ 'post_author' => $post->post_author,
220
+ 'post_date' => $post->post_date,
221
+ 'post_modified' => $post->post_modified,
222
+ );
223
+ wp_update_post( $recipe );
224
+
225
+ update_post_meta( $recipe_id, 'wprm_parent_post_id', $post_id );
226
+
227
+ // Optionally associate categories with recipes.
228
+ if ( is_object_in_taxonomy( WPRM_POST_TYPE, 'category' ) ) {
229
+ wp_set_post_categories( $recipe_id, $cat_ids );
230
+ }
231
+ }
232
+ } else {
233
+ foreach ( $recipe_ids as $recipe_id ) {
234
+ delete_post_meta( $recipe_id, 'wprm_parent_post_id' );
235
  }
236
  }
237
  }
includes/admin/import/class-wprm-import-cooked.php ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Responsible for importing Cooked recipes.
4
+ *
5
+ * @link http://bootstrapped.ventures
6
+ * @since 1.26.0
7
+ *
8
+ * @package WP_Recipe_Maker
9
+ * @subpackage WP_Recipe_Maker/includes/admin/import
10
+ */
11
+
12
+ /**
13
+ * Responsible for importing Cooked recipes.
14
+ *
15
+ * @since 1.26.0
16
+ * @package WP_Recipe_Maker
17
+ * @subpackage WP_Recipe_Maker/includes/admin/import
18
+ * @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
19
+ */
20
+ class WPRM_Import_Cooked extends WPRM_Import {
21
+ /**
22
+ * Get the UID of this import source.
23
+ *
24
+ * @since 1.26.0
25
+ */
26
+ public function get_uid() {
27
+ return 'cooked';
28
+ }
29
+
30
+ /**
31
+ * Wether or not this importer requires a manual search for recipes.
32
+ *
33
+ * @since 1.26.0
34
+ */
35
+ public function requires_search() {
36
+ return false;
37
+ }
38
+
39
+ /**
40
+ * Get the name of this import source.
41
+ *
42
+ * @since 1.26.0
43
+ */
44
+ public function get_name() {
45
+ return 'Cooked';
46
+ }
47
+
48
+ /**
49
+ * Get HTML for the import settings.
50
+ *
51
+ * @since 1.26.0
52
+ */
53
+ public function get_settings_html() {
54
+ $html = '<h4>Import Type</h4>';
55
+ $html .= '<input type="radio" name="cooked-import-type" value="convert" id="cooked-import-type-convert" checked> <label for="cooked-import-type-convert">Convert to posts</label>';
56
+ $html .= "<p>Most people should use this option. The recipe post type will be converted to a regular post that includes a WP Recipe Maker recipe. Every occurrence of the Cooked shortcode will be replaced as well.</p>";
57
+ $html .= '<input type="radio" name="cooked-import-type" value="hide" id="cooked-import-type-hide" /> <label for="cooked-import-type-hide">No conversion to posts needed</label>';
58
+ $html .= '<p>Only use this if you had the advanced "Disable Public Recipes" setting enabled in Cooked. The new WP Recipe Maker recipes will only show up wherever you used the Cooked recipe shortcode. Do not use this option if you are unsure. Contact us instead to confirm.</p>';
59
+ $html .= '<h4>Recipe Tags</h4>';
60
+
61
+ $cooked_taxonomies = array(
62
+ 'cp_recipe_category' => 'Categories',
63
+ 'cp_recipe_tags' => 'Tags',
64
+ 'cp_recipe_cuisine' => 'Cuisines',
65
+ 'cp_recipe_cooking_method' => 'Cooking Methods',
66
+ );
67
+
68
+ $wprm_taxonomies = WPRM_Taxonomies::get_taxonomies();
69
+
70
+ foreach ( $wprm_taxonomies as $wprm_taxonomy => $options ) {
71
+ $wprm_key = substr( $wprm_taxonomy, 5 );
72
+
73
+ $html .= '<label for="cooked-tags-' . $wprm_key . '">' . $options['name'] . ':</label> ';
74
+ $html .= '<select name="cooked-tags-' . $wprm_key . '" id="cooked-tags-' . $wprm_key . '">';
75
+ $html .= "<option value=\"\">Don't import anything for this tag</option>";
76
+ foreach ( $cooked_taxonomies as $name => $label ) {
77
+ $selected = $wprm_key === $name ? ' selected="selected"' : '';
78
+ $html .= '<option value="' . esc_attr( $name ) . '"' . esc_html( $selected ) . '>' . esc_html( $label ) . '</option>';
79
+ }
80
+ $html .= '</select>';
81
+ $html .= '<br />';
82
+ }
83
+
84
+ return $html;
85
+ }
86
+
87
+ /**
88
+ * Get the total number of recipes to import.
89
+ *
90
+ * @since 1.26.0
91
+ */
92
+ public function get_recipe_count() {
93
+ $args = array(
94
+ 'post_type' => 'cp_recipe',
95
+ 'post_status' => 'any',
96
+ 'posts_per_page' => 1,
97
+ );
98
+
99
+ $query = new WP_Query( $args );
100
+ return $query->found_posts;
101
+ }
102
+
103
+ /**
104
+ * Get a list of recipes that are available to import.
105
+ *
106
+ * @since 1.26.0
107
+ * @param int $page Page of recipes to get.
108
+ */
109
+ public function get_recipes( $page = 0 ) {
110
+ $recipes = array();
111
+
112
+ $limit = 100;
113
+ $offset = $limit * $page;
114
+
115
+ $args = array(
116
+ 'post_type' => 'cp_recipe',
117
+ 'post_status' => 'any',
118
+ 'orderby' => 'date',
119
+ 'order' => 'DESC',
120
+ 'posts_per_page' => $limit,
121
+ 'offset' => $offset,
122
+ );
123
+
124
+ $query = new WP_Query( $args );
125
+
126
+ if ( $query->have_posts() ) {
127
+ $posts = $query->posts;
128
+
129
+ foreach ( $posts as $post ) {
130
+ $recipes[ $post->ID ] = array(
131
+ 'name' => $post->post_title,
132
+ 'url' => get_edit_post_link( $post->ID ),
133
+ );
134
+ }
135
+ }
136
+
137
+ return $recipes;
138
+ }
139
+
140
+ /**
141
+ * Get recipe with the specified ID in the import format.
142
+ *
143
+ * @since 1.26.0
144
+ * @param mixed $id ID of the recipe we want to import.
145
+ * @param array $post_data POST data passed along when submitting the form.
146
+ */
147
+ public function get_recipe( $id, $post_data ) {
148
+ $post = get_post( $id );
149
+ $import_type = isset( $post_data['cooked-import-type'] ) ? $post_data['cooked-import-type'] : '';
150
+
151
+ // If the import type is not set, redirect back.
152
+ if ( ! in_array( $import_type, array( 'convert', 'hide' ), true ) ) {
153
+ return new WP_Error( 'import_type', 'You need to select an import type.' );
154
+ wp_safe_redirect( add_query_arg( array( 'from' => $this->get_uid(), 'error' => rawurlencode( 'You need to select an import type.' ) ), admin_url( 'admin.php?page=wprm_import' ) ) );
155
+ exit();
156
+ }
157
+
158
+ // If we're converting the Cooked recipe to a normal post we want the import ID to be 0.
159
+ $import_id = 'convert' === $import_type ? 0 : $id;
160
+ $cooked_recipe = get_post_meta( $id, '_recipe_settings', true );
161
+
162
+ $recipe = array(
163
+ 'import_id' => $import_id,
164
+ 'import_backup' => array(
165
+ 'cooked_recipe_id' => $id,
166
+ 'cooked_import_type' => $import_type,
167
+ 'cooked_recipe_settings' => $cooked_recipe,
168
+ ),
169
+ );
170
+
171
+ $recipe['image_id'] = get_post_thumbnail_id( $id );
172
+ $recipe['name'] = $post->post_title;
173
+ $recipe['summary'] = isset( $cooked_recipe['excerpt'] ) ? $cooked_recipe['excerpt'] : '';
174
+ $recipe['servings'] = isset( $cooked_recipe['nutrition']['servings'] ) ? $cooked_recipe['nutrition']['servings'] : '';
175
+
176
+ // Recipe Times.
177
+ $recipe['prep_time'] = isset( $cooked_recipe['prep_time'] ) ? $cooked_recipe['prep_time'] : '';
178
+ $recipe['cook_time'] = isset( $cooked_recipe['cook_time'] ) ? $cooked_recipe['cook_time'] : '';
179
+
180
+ $total_time = intval( $recipe['prep_time'] ) + intval( $recipe['cook_time'] );
181
+ $recipe['total_time'] = $total_time ? $total_time : '';
182
+
183
+ // Recipe Tags.
184
+ $recipe['tags'] = array();
185
+
186
+ $wprm_taxonomies = WPRM_Taxonomies::get_taxonomies();
187
+ foreach ( $wprm_taxonomies as $wprm_taxonomy => $options ) {
188
+ $wprm_key = substr( $wprm_taxonomy, 5 );
189
+ $tag = isset( $post_data[ 'cooked-tags-' . $wprm_key ] ) ? $post_data[ 'cooked-tags-' . $wprm_key ] : false;
190
+
191
+ if ( $tag ) {
192
+ $terms = get_the_terms( $id, $tag );
193
+ if ( $terms && ! is_wp_error( $terms ) ) {
194
+ foreach ( $terms as $term ) {
195
+ $recipe['tags'][ $wprm_key ][] = $term->name;
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ // Recipe Ingredients.
202
+ $ingredients = isset( $cooked_recipe['ingredients'] ) ? $cooked_recipe['ingredients'] : array();
203
+ $recipe['ingredients'] = array();
204
+
205
+ $current_group = array(
206
+ 'name' => '',
207
+ 'ingredients' => array(),
208
+ );
209
+ foreach ( $ingredients as $ingredient ) {
210
+ if ( isset( $ingredient['section_heading_name'] ) ) {
211
+ $recipe['ingredients'][] = $current_group;
212
+ $current_group = array(
213
+ 'name' => $ingredient['section_heading_name'],
214
+ 'ingredients' => array(),
215
+ );
216
+ } else {
217
+ $current_group['ingredients'][] = array(
218
+ 'amount' => $ingredient['amount'],
219
+ 'unit' => $ingredient['measurement'],
220
+ 'name' => $ingredient['name'],
221
+ 'notes' => '',
222
+ );
223
+ }
224
+ }
225
+ $recipe['ingredients'][] = $current_group;
226
+
227
+ // Recipe Instructions.
228
+ $instructions = isset( $cooked_recipe['directions'] ) ? $cooked_recipe['directions'] : array();
229
+ $recipe['instructions'] = array();
230
+
231
+ $current_group = array(
232
+ 'name' => '',
233
+ 'instructions' => array(),
234
+ );
235
+ foreach ( $instructions as $instruction ) {
236
+ if ( isset( $instruction['section_heading_name'] ) ) {
237
+ $recipe['instructions'][] = $current_group;
238
+ $current_group = array(
239
+ 'name' => $instruction['section_heading_name'],
240
+ 'instructions' => array(),
241
+ );
242
+ } else {
243
+ $current_group['instructions'][] = array(
244
+ 'text' => $instruction['content'],
245
+ 'image' => $instruction['image'],
246
+ );
247
+ }
248
+ }
249
+ $recipe['instructions'][] = $current_group;
250
+
251
+ // Recipe Nutrition.
252
+ $recipe['nutrition'] = array();
253
+
254
+ $nutrition_mapping = array(
255
+ 'serving_size' => 'serving_size',
256
+ 'calories' => 'calories',
257
+ 'carbs' => 'carbohydrates',
258
+ 'protein' => 'protein',
259
+ 'fat' => 'fat',
260
+ 'sat_fat' => 'saturated_fat',
261
+ 'trans_fat' => 'trans_fat',
262
+ 'cholesterol' => 'cholesterol',
263
+ 'sodium' => 'sodium',
264
+ 'potassium' => 'potassium',
265
+ 'fiber' => 'fiber',
266
+ 'sugars' => 'sugar',
267
+ 'vitamin_a' => 'vitamin_a',
268
+ 'vitamin_c' => 'vitamin_c',
269
+ 'calcium' => 'calcium',
270
+ 'iron' => 'iron',
271
+ );
272
+
273
+ $nutrition = isset( $cooked_recipe['nutrition'] ) ? $cooked_recipe['nutrition'] : array();
274
+
275
+ foreach ( $nutrition_mapping as $cooked_field => $wprm_field ) {
276
+ $recipe['nutrition'][ $wprm_field ] = isset( $nutrition[ $cooked_field ] ) ? $nutrition[ $cooked_field ] : '';
277
+ }
278
+
279
+ return $recipe;
280
+ }
281
+
282
+ /**
283
+ * Replace the original recipe with the newly imported WPRM one.
284
+ *
285
+ * @since 1.26.0
286
+ * @param mixed $id ID of the recipe we want replace.
287
+ * @param mixed $wprm_id ID of the WPRM recipe to replace with.
288
+ * @param array $post_data POST data passed along when submitting the form.
289
+ */
290
+ public function replace_recipe( $id, $wprm_id, $post_data ) {
291
+ $import_type = isset( $post_data['cooked-import-type'] ) ? $post_data['cooked-import-type'] : '';
292
+
293
+ // If the import type is not set, redirect back.
294
+ if ( ! in_array( $import_type, array( 'convert', 'hide' ), true ) ) {
295
+ return new WP_Error( 'import_type', 'You need to select an import type.' );
296
+ wp_safe_redirect( add_query_arg( array( 'from' => $this->get_uid(), 'error' => rawurlencode( 'You need to select an import type.' ) ), admin_url( 'admin.php?page=wprm_import' ) ) );
297
+ exit();
298
+ }
299
+
300
+ // If import type is "hide" we count on the fallback shortcode.
301
+ if ( 'convert' === $import_type ) {
302
+ $post = get_post( $id );
303
+
304
+ // Update content and convert to post.
305
+ $update_content = array(
306
+ 'ID' => $id,
307
+ 'post_type' => 'post',
308
+ 'post_content' => '[wprm-recipe id="' . $wprm_id . '"]',
309
+ );
310
+ wp_update_post( $update_content );
311
+
312
+ // Append categories and tags to converted post.
313
+ $terms = get_the_terms( $id, 'cp_recipe_category' );
314
+ if ( $terms && ! is_wp_error( $terms ) ) {
315
+ $categories = array();
316
+ foreach ( $terms as $term ) {
317
+ $categories[] = $term->name;
318
+ }
319
+ wp_set_object_terms( $id, $categories, 'category', true );
320
+ }
321
+ $terms = get_the_terms( $id, 'cp_recipe_tags' );
322
+ if ( $terms && ! is_wp_error( $terms ) ) {
323
+ $tags = array();
324
+ foreach ( $terms as $term ) {
325
+ $tags[] = $term->name;
326
+ }
327
+ wp_set_object_terms( $id, $tags, 'post_tag', true );
328
+ }
329
+ }
330
+ }
331
+ }
includes/admin/import/class-wprm-import-wpultimaterecipe.php CHANGED
@@ -52,10 +52,10 @@ class WPRM_Import_Wpultimaterecipe extends WPRM_Import {
52
  */
53
  public function get_settings_html() {
54
  $html = '<h4>Import Type</h4>';
55
- $html .= '<input type="radio" name="wpurp-import-type" value="convert" id="wpurp-import-type-convert" /> <label for="wpurp-import-type-convert">Convert to posts</label>';
56
- $html .= "<p>Use this if you've been treating your WP Ultimate Recipe recipes like posts. The recipe post type will be converted to a regular post that includes a WP Recipe Maker recipe. Every occurrence of the WP Ultimate Recipe recipe shortcode will be replaced as well.</p>";
57
  $html .= '<input type="radio" name="wpurp-import-type" value="hide" id="wpurp-import-type-hide" /> <label for="wpurp-import-type-hide">No conversion to posts needed</label>';
58
- $html .= '<p>Use this if you were only including WP Ultimate Recipe recipes into regular posts/pages instead of having the recipe post type act like a regular post. The new WP Recipe Maker recipes will only show up wherever you used the WP Ultimate Recipe recipe shortcode.</p>';
59
  $html .= '<h4>Recipe Tags</h4>';
60
 
61
  $wpurp_taxonomies = get_option( 'wpurp_taxonomies', array() );
52
  */
53
  public function get_settings_html() {
54
  $html = '<h4>Import Type</h4>';
55
+ $html .= '<input type="radio" name="wpurp-import-type" value="convert" id="wpurp-import-type-convert" checked> <label for="wpurp-import-type-convert">Convert to posts</label>';
56
+ $html .= "<p>Most people should use this option. The recipe post type will be converted to a regular post that includes a WP Recipe Maker recipe. Every occurrence of the WP Ultimate Recipe recipe shortcode will be replaced as well.</p>";
57
  $html .= '<input type="radio" name="wpurp-import-type" value="hide" id="wpurp-import-type-hide" /> <label for="wpurp-import-type-hide">No conversion to posts needed</label>';
58
+ $html .= '<p>Only use this if you manually disabled the advanced "Recipes act as Posts" setting in WP Ultimate Recipe. The new WP Recipe Maker recipes will only show up wherever you used the WP Ultimate Recipe recipe shortcode. Do not use this option if you are unsure. Contact us instead to confirm.</p>';
59
  $html .= '<h4>Recipe Tags</h4>';
60
 
61
  $wpurp_taxonomies = get_option( 'wpurp_taxonomies', array() );
includes/class-wp-recipe-maker.php CHANGED
@@ -31,7 +31,7 @@ class WP_Recipe_Maker {
31
  * @since 1.0.0
32
  */
33
  private function define_constants() {
34
- define( 'WPRM_VERSION', '1.25.0' );
35
  define( 'WPRM_PREMIUM_VERSION_REQUIRED', '1.6.0' );
36
  define( 'WPRM_POST_TYPE', 'wprm_recipe' );
37
  define( 'WPRM_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
31
  * @since 1.0.0
32
  */
33
  private function define_constants() {
34
+ define( 'WPRM_VERSION', '1.26.0' );
35
  define( 'WPRM_PREMIUM_VERSION_REQUIRED', '1.6.0' );
36
  define( 'WPRM_POST_TYPE', 'wprm_recipe' );
37
  define( 'WPRM_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
includes/public/class-wprm-assets.php CHANGED
@@ -26,6 +26,10 @@ class WPRM_Assets {
26
  */
27
  public static function init() {
28
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue' ), 1 );
 
 
 
 
29
  }
30
 
31
  /**
@@ -46,6 +50,89 @@ class WPRM_Assets {
46
  'nonce' => wp_create_nonce( 'wprm' ),
47
  ));
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
  WPRM_Assets::init();
26
  */
27
  public static function init() {
28
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue' ), 1 );
29
+
30
+ if ( WPRM_Settings::get( 'features_custom_style' ) ) {
31
+ add_action( 'wp_head', array( __CLASS__, 'custom_css' ) );
32
+ }
33
  }
34
 
35
  /**
50
  'nonce' => wp_create_nonce( 'wprm' ),
51
  ));
52
  }
53
+
54
+ /**
55
+ * Output custom CSS from the options.
56
+ *
57
+ * @since 1.10.0
58
+ * @param mixed $type Type of recipe to output the custom CSS for.
59
+ */
60
+ public static function custom_css( $type = 'recipe' ) {
61
+ $selector = 'print' === $type ? ' html body.wprm-print' : ' html body .wprm-recipe-container';
62
+
63
+ $output = '<style type="text/css">';
64
+
65
+ // Recipe Snippets appearance.
66
+ if ( WPRM_Settings::get( 'recipe_snippets_automatically_add' ) ) {
67
+ $output .= ' .wprm-automatic-recipe-snippets a.wprm-jump-to-recipe-shortcode, .wprm-automatic-recipe-snippets a.wprm-print-recipe-shortcode {';
68
+ $output .= ' background-color: ' . WPRM_Settings::get( 'recipe_snippets_background_color' ) . ';';
69
+ $output .= ' color: ' . WPRM_Settings::get( 'recipe_snippets_text_color' ) . ';';
70
+ $output .= '}';
71
+ }
72
+
73
+ // Template Appearance.
74
+ if ( WPRM_Settings::get( 'template_font_size' ) ) {
75
+ $output .= $selector . ' .wprm-recipe { font-size: ' . WPRM_Settings::get( 'template_font_size' ) . 'px; }';
76
+ }
77
+ if ( WPRM_Settings::get( 'template_font_regular' ) ) {
78
+ $output .= $selector . ' .wprm-recipe { font-family: ' . WPRM_Settings::get( 'template_font_regular' ) . '; }';
79
+ $output .= $selector . ' .wprm-recipe p { font-family: ' . WPRM_Settings::get( 'template_font_regular' ) . '; }';
80
+ $output .= $selector . ' .wprm-recipe li { font-family: ' . WPRM_Settings::get( 'template_font_regular' ) . '; }';
81
+ }
82
+ if ( WPRM_Settings::get( 'template_font_header' ) ) {
83
+ $output .= $selector . ' .wprm-recipe .wprm-recipe-name { font-family: ' . WPRM_Settings::get( 'template_font_header' ) . '; }';
84
+ $output .= $selector . ' .wprm-recipe .wprm-recipe-header { font-family: ' . WPRM_Settings::get( 'template_font_header' ) . '; }';
85
+ }
86
+
87
+ $output .= $selector . ' { color: ' . WPRM_Settings::get( 'template_color_text' ) . '; }';
88
+ $output .= $selector . ' .wprm-recipe { background-color: ' . WPRM_Settings::get( 'template_color_background' ) . '; }';
89
+ $output .= $selector . ' .wprm-recipe { border-color: ' . WPRM_Settings::get( 'template_color_border' ) . '; }';
90
+ $output .= $selector . ' .wprm-recipe .wprm-color-border { border-color: ' . WPRM_Settings::get( 'template_color_border' ) . '; }';
91
+ $output .= $selector . ' a { color: ' . WPRM_Settings::get( 'template_color_link' ) . '; }';
92
+ $output .= $selector . ' .wprm-recipe .wprm-color-header { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
93
+ $output .= $selector . ' h1 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
94
+ $output .= $selector . ' h2 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
95
+ $output .= $selector . ' h3 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
96
+ $output .= $selector . ' h4 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
97
+ $output .= $selector . ' h5 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
98
+ $output .= $selector . ' h6 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
99
+ $output .= $selector . ' svg path { fill: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
100
+ $output .= $selector . ' svg rect { fill: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
101
+ $output .= $selector . ' svg polygon { stroke: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
102
+ $output .= $selector . ' .wprm-rating-star-full svg polygon { fill: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
103
+ $output .= $selector . ' .wprm-recipe .wprm-color-accent { background-color: ' . WPRM_Settings::get( 'template_color_accent' ) . '; }';
104
+ $output .= $selector . ' .wprm-recipe .wprm-color-accent { color: ' . WPRM_Settings::get( 'template_color_accent_text' ) . '; }';
105
+ $output .= $selector . ' .wprm-recipe .wprm-color-accent2 { background-color: ' . WPRM_Settings::get( 'template_color_accent2' ) . '; }';
106
+ $output .= $selector . ' .wprm-recipe .wprm-color-accent2 { color: ' . WPRM_Settings::get( 'template_color_accent2_text' ) . '; }';
107
+
108
+ // List style.
109
+ if ( 'checkbox' === WPRM_Settings::get( 'template_ingredient_list_style' ) ) {
110
+ $output .= $selector . ' li.wprm-recipe-ingredient { list-style-type: none; }';
111
+ } else {
112
+ $output .= $selector . ' li.wprm-recipe-ingredient { list-style-type: ' . WPRM_Settings::get( 'template_ingredient_list_style' ) . '; }';
113
+ }
114
+ if ( 'checkbox' === WPRM_Settings::get( 'template_instruction_list_style' ) ) {
115
+ $output .= $selector . ' li.wprm-recipe-instruction { list-style-type: none; }';
116
+ } else {
117
+ $output .= $selector . ' li.wprm-recipe-instruction { list-style-type: ' . WPRM_Settings::get( 'template_instruction_list_style' ) . '; }';
118
+ }
119
+
120
+ // Comment ratings.
121
+ $output .= ' .wprm-comment-rating svg path, .comment-form-wprm-rating svg path { fill: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
122
+ $output .= ' .wprm-comment-rating svg polygon, .comment-form-wprm-rating svg polygon { stroke: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
123
+
124
+ // Allow add-ons to hook in.
125
+ $output = apply_filters( 'wprm_custom_css', $output, $type, $selector );
126
+
127
+ // Custom recipe CSS.
128
+ if ( 'print' !== $type ) {
129
+ $output .= WPRM_Settings::get( 'recipe_css' );
130
+ }
131
+
132
+ $output .= '</style>';
133
+
134
+ echo $output;
135
+ }
136
  }
137
 
138
  WPRM_Assets::init();
includes/public/class-wprm-metadata.php CHANGED
@@ -115,7 +115,7 @@ class WPRM_Metadata {
115
  $recipe->image_url( 'wprm-metadata-16_9' ),
116
  );
117
 
118
- $metadata['image'] = array_unique( $image_sizes );
119
  }
120
 
121
  // Yield.
115
  $recipe->image_url( 'wprm-metadata-16_9' ),
116
  );
117
 
118
+ $metadata['image'] = array_values( array_unique( $image_sizes ) );
119
  }
120
 
121
  // Yield.
includes/public/class-wprm-print.php CHANGED
@@ -53,7 +53,7 @@ class WPRM_Print {
53
 
54
  // Custom Style.
55
  ob_start();
56
- WPRM_Template_Manager::custom_css( 'print' );
57
  $custom_css = ob_get_contents();
58
  ob_end_clean();
59
 
53
 
54
  // Custom Style.
55
  ob_start();
56
+ WPRM_Assets::custom_css( 'print' );
57
  $custom_css = ob_get_contents();
58
  ob_end_clean();
59
 
includes/public/class-wprm-recipe.php CHANGED
@@ -273,9 +273,13 @@ class WPRM_Recipe {
273
  * @param mixed $size Thumbnail name or size array of the image we want.
274
  */
275
  public function image_data( $size = 'thumbnail' ) {
 
 
276
  if ( function_exists( 'fly_get_attachment_image_src' ) ) {
277
  $thumb = fly_get_attachment_image_src( $this->image_id(), $size );
278
- } else {
 
 
279
  $thumb = wp_get_attachment_image_src( $this->image_id(), $size );
280
  }
281
 
@@ -318,7 +322,9 @@ class WPRM_Recipe {
318
  if ( $thumb ) {
319
  $image_url = isset( $thumb[0] ) ? $thumb[0] : $thumb['src'];
320
  }
321
- } else {
 
 
322
  $thumb = wp_get_attachment_image_src( $this->image_id(), $size );
323
  $image_url = $thumb && isset( $thumb[0] ) ? $thumb[0] : '';
324
  }
273
  * @param mixed $size Thumbnail name or size array of the image we want.
274
  */
275
  public function image_data( $size = 'thumbnail' ) {
276
+ $thumb = false;
277
+
278
  if ( function_exists( 'fly_get_attachment_image_src' ) ) {
279
  $thumb = fly_get_attachment_image_src( $this->image_id(), $size );
280
+ }
281
+
282
+ if ( ! $thumb ) {
283
  $thumb = wp_get_attachment_image_src( $this->image_id(), $size );
284
  }
285
 
322
  if ( $thumb ) {
323
  $image_url = isset( $thumb[0] ) ? $thumb[0] : $thumb['src'];
324
  }
325
+ }
326
+
327
+ if ( ! $image_url ) {
328
  $thumb = wp_get_attachment_image_src( $this->image_id(), $size );
329
  $image_url = $thumb && isset( $thumb[0] ) ? $thumb[0] : '';
330
  }
includes/public/class-wprm-settings.php CHANGED
@@ -36,6 +36,10 @@ class WPRM_Settings {
36
  */
37
  private static $defaults = array(
38
  // Appearance.
 
 
 
 
39
  'recipe_image_use_featured' => false,
40
  'recipe_author_display_default' => 'disabled',
41
  'show_nutrition_label' => 'disabled',
@@ -49,7 +53,7 @@ class WPRM_Settings {
49
  'template_color_border' => '#aaaaaa',
50
  'template_color_background' => '#ffffff',
51
  'template_color_text' => '#333333',
52
- 'template_color_link' => '#000000',
53
  'template_color_header' => '#000000',
54
  'template_color_icon' => '#343434',
55
  'template_color_comment_rating' => '#343434',
@@ -229,6 +233,11 @@ class WPRM_Settings {
229
  */
230
  public static function form_save_settings_appearance() {
231
  if ( isset( $_POST['wprm_settings'] ) && wp_verify_nonce( sanitize_key( $_POST['wprm_settings'] ), 'wprm_settings' ) ) { // Input var okay.
 
 
 
 
 
232
  $recipe_image_use_featured = isset( $_POST['recipe_image_use_featured'] ) && sanitize_key( $_POST['recipe_image_use_featured'] ) ? true : false; // Input var okay.
233
  $recipe_author_display_default = isset( $_POST['recipe_author_display_default'] ) ? sanitize_text_field( wp_unslash( $_POST['recipe_author_display_default'] ) ) : ''; // Input var okay.
234
  $show_nutrition_label = isset( $_POST['show_nutrition_label'] ) ? sanitize_text_field( wp_unslash( $_POST['show_nutrition_label'] ) ) : ''; // Input var okay.
@@ -261,6 +270,11 @@ class WPRM_Settings {
261
 
262
  $settings = array();
263
 
 
 
 
 
 
264
  $settings['recipe_image_use_featured'] = $recipe_image_use_featured;
265
 
266
  if ( in_array( $recipe_author_display_default, array( 'disabled', 'post_author', 'custom' ) ) ) {
@@ -388,6 +402,7 @@ class WPRM_Settings {
388
  $metadata_pinterest_optout = isset( $_POST['metadata_pinterest_optout'] ) && sanitize_key( $_POST['metadata_pinterest_optout'] ) ? true : false; // Input var okay.
389
  $recipe_css = isset( $_POST['recipe_css'] ) ? wp_kses_post( wp_unslash( $_POST['recipe_css'] ) ) : ''; // Input var okay.
390
  $print_css = isset( $_POST['print_css'] ) ? wp_kses_post( wp_unslash( $_POST['print_css'] ) ) : ''; // Input var okay.
 
391
 
392
  $settings = array();
393
 
@@ -395,7 +410,12 @@ class WPRM_Settings {
395
  $settings['recipe_css'] = $recipe_css;
396
  $settings['print_css'] = $print_css;
397
 
398
- self::update_settings( $settings );
 
 
 
 
 
399
  }
400
  wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings&sub=advanced' ) );
401
  exit();
36
  */
37
  private static $defaults = array(
38
  // Appearance.
39
+ 'recipe_snippets_automatically_add' => false,
40
+ 'recipe_snippets_text' => '[wprm-recipe-jump] [wprm-recipe-print]',
41
+ 'recipe_snippets_background_color' => '#2c3e50',
42
+ 'recipe_snippets_text_color' => '#ffffff',
43
  'recipe_image_use_featured' => false,
44
  'recipe_author_display_default' => 'disabled',
45
  'show_nutrition_label' => 'disabled',
53
  'template_color_border' => '#aaaaaa',
54
  'template_color_background' => '#ffffff',
55
  'template_color_text' => '#333333',
56
+ 'template_color_link' => '#3498db',
57
  'template_color_header' => '#000000',
58
  'template_color_icon' => '#343434',
59
  'template_color_comment_rating' => '#343434',
233
  */
234
  public static function form_save_settings_appearance() {
235
  if ( isset( $_POST['wprm_settings'] ) && wp_verify_nonce( sanitize_key( $_POST['wprm_settings'] ), 'wprm_settings' ) ) { // Input var okay.
236
+ $recipe_snippets_automatically_add = isset( $_POST['recipe_snippets_automatically_add'] ) && sanitize_key( $_POST['recipe_snippets_automatically_add'] ) ? true : false; // Input var okay.
237
+ $recipe_snippets_text = isset( $_POST['recipe_snippets_text'] ) ? sanitize_text_field( wp_unslash( $_POST['recipe_snippets_text'] ) ) : ''; // Input var okay.
238
+ $recipe_snippets_background_color = isset( $_POST['recipe_snippets_background_color'] ) ? sanitize_text_field( wp_unslash( $_POST['recipe_snippets_background_color'] ) ) : ''; // Input var okay.
239
+ $recipe_snippets_text_color = isset( $_POST['recipe_snippets_text_color'] ) ? sanitize_text_field( wp_unslash( $_POST['recipe_snippets_text_color'] ) ) : ''; // Input var okay.
240
+
241
  $recipe_image_use_featured = isset( $_POST['recipe_image_use_featured'] ) && sanitize_key( $_POST['recipe_image_use_featured'] ) ? true : false; // Input var okay.
242
  $recipe_author_display_default = isset( $_POST['recipe_author_display_default'] ) ? sanitize_text_field( wp_unslash( $_POST['recipe_author_display_default'] ) ) : ''; // Input var okay.
243
  $show_nutrition_label = isset( $_POST['show_nutrition_label'] ) ? sanitize_text_field( wp_unslash( $_POST['show_nutrition_label'] ) ) : ''; // Input var okay.
270
 
271
  $settings = array();
272
 
273
+ $settings['recipe_snippets_automatically_add'] = $recipe_snippets_automatically_add;
274
+ $settings['recipe_snippets_text'] = $recipe_snippets_text;
275
+ if ( $recipe_snippets_background_color ) { $settings['recipe_snippets_background_color'] = $recipe_snippets_background_color; }
276
+ if ( $recipe_snippets_text_color ) { $settings['recipe_snippets_text_color'] = $recipe_snippets_text_color; }
277
+
278
  $settings['recipe_image_use_featured'] = $recipe_image_use_featured;
279
 
280
  if ( in_array( $recipe_author_display_default, array( 'disabled', 'post_author', 'custom' ) ) ) {
402
  $metadata_pinterest_optout = isset( $_POST['metadata_pinterest_optout'] ) && sanitize_key( $_POST['metadata_pinterest_optout'] ) ? true : false; // Input var okay.
403
  $recipe_css = isset( $_POST['recipe_css'] ) ? wp_kses_post( wp_unslash( $_POST['recipe_css'] ) ) : ''; // Input var okay.
404
  $print_css = isset( $_POST['print_css'] ) ? wp_kses_post( wp_unslash( $_POST['print_css'] ) ) : ''; // Input var okay.
405
+ $reset_settings_to_default = isset( $_POST['reset_settings_to_default'] ) && sanitize_key( $_POST['reset_settings_to_default'] ) ? true : false; // Input var okay.
406
 
407
  $settings = array();
408
 
410
  $settings['recipe_css'] = $recipe_css;
411
  $settings['print_css'] = $print_css;
412
 
413
+ if ( $reset_settings_to_default ) {
414
+ delete_option( 'wprm_settings' );
415
+ self::$settings = array();
416
+ } else {
417
+ self::update_settings( $settings );
418
+ }
419
  }
420
  wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings&sub=advanced' ) );
421
  exit();
includes/public/class-wprm-shortcode.php CHANGED
@@ -37,6 +37,7 @@ class WPRM_Shortcode {
37
  add_filter( 'content_edit_pre', array( __CLASS__, 'replace_tasty_shortcode' ) );
38
 
39
  add_filter( 'the_content', array( __CLASS__, 'replace_tasty_shortcode' ) );
 
40
 
41
  add_action( 'init', array( __CLASS__, 'fallback_shortcodes' ), 11 );
42
  }
@@ -59,6 +60,10 @@ class WPRM_Shortcode {
59
  add_shortcode( 'ultimate-recipe', array( __CLASS__, 'recipe_shortcode' ) );
60
  }
61
 
 
 
 
 
62
  if ( ! shortcode_exists( 'nutrition-label' ) ) {
63
  add_shortcode( 'nutrition-label', array( __CLASS__, 'remove_shortcode' ) );
64
  add_shortcode( 'ultimate-nutrition-label', array( __CLASS__, 'remove_shortcode' ) );
@@ -180,6 +185,21 @@ class WPRM_Shortcode {
180
  }
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  /**
184
  * Output for the jump to recipe shortcode.
185
  *
37
  add_filter( 'content_edit_pre', array( __CLASS__, 'replace_tasty_shortcode' ) );
38
 
39
  add_filter( 'the_content', array( __CLASS__, 'replace_tasty_shortcode' ) );
40
+ add_filter( 'the_content', array( __CLASS__, 'automatically_add_recipe_snippets' ), 20 );
41
 
42
  add_action( 'init', array( __CLASS__, 'fallback_shortcodes' ), 11 );
43
  }
60
  add_shortcode( 'ultimate-recipe', array( __CLASS__, 'recipe_shortcode' ) );
61
  }
62
 
63
+ if ( ! shortcode_exists( 'cooked-recipe' ) ) {
64
+ add_shortcode( 'cooked-recipe', array( __CLASS__, 'recipe_shortcode' ) );
65
+ }
66
+
67
  if ( ! shortcode_exists( 'nutrition-label' ) ) {
68
  add_shortcode( 'nutrition-label', array( __CLASS__, 'remove_shortcode' ) );
69
  add_shortcode( 'ultimate-nutrition-label', array( __CLASS__, 'remove_shortcode' ) );
185
  }
186
  }
187
 
188
+ /**
189
+ * Automatically add recipe snippets above the post content.
190
+ *
191
+ * @since 1.26.0
192
+ * @param mixed $content Content we want to filter before it gets passed along.
193
+ */
194
+ public static function automatically_add_recipe_snippets( $content ) {
195
+ if ( WPRM_Settings::get( 'recipe_snippets_automatically_add' ) ) {
196
+ $text = '<div class="wprm-automatic-recipe-snippets">' . do_shortcode( WPRM_Settings::get( 'recipe_snippets_text' ) ) . '</div>';
197
+ $content = $text . $content;
198
+ }
199
+
200
+ return $content;
201
+ }
202
+
203
  /**
204
  * Output for the jump to recipe shortcode.
205
  *
includes/public/class-wprm-template-manager.php CHANGED
@@ -34,10 +34,6 @@ class WPRM_Template_Manager {
34
  */
35
  public static function init() {
36
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
37
-
38
- if ( WPRM_Settings::get( 'features_custom_style' ) ) {
39
- add_action( 'wp_head', array( __CLASS__, 'custom_css' ) );
40
- }
41
  }
42
 
43
  /**
@@ -51,80 +47,6 @@ class WPRM_Template_Manager {
51
  wp_enqueue_style( 'wprm-template', $template['url'] . '/' . $template['slug'] . '.min.css', array(), WPRM_VERSION, 'all' );
52
  }
53
 
54
- /**
55
- * Output custom CSS from the options.
56
- *
57
- * @since 1.10.0
58
- * @param mixed $type Type of recipe to output the custom CSS for.
59
- */
60
- public static function custom_css( $type = 'recipe' ) {
61
- $selector = 'print' === $type ? ' html body.wprm-print' : ' html body .wprm-recipe-container';
62
-
63
- $output = '<style type="text/css">';
64
-
65
- if ( WPRM_Settings::get( 'template_font_size' ) ) {
66
- $output .= $selector . ' .wprm-recipe { font-size: ' . WPRM_Settings::get( 'template_font_size' ) . 'px; }';
67
- }
68
- if ( WPRM_Settings::get( 'template_font_regular' ) ) {
69
- $output .= $selector . ' .wprm-recipe { font-family: ' . WPRM_Settings::get( 'template_font_regular' ) . '; }';
70
- $output .= $selector . ' .wprm-recipe p { font-family: ' . WPRM_Settings::get( 'template_font_regular' ) . '; }';
71
- $output .= $selector . ' .wprm-recipe li { font-family: ' . WPRM_Settings::get( 'template_font_regular' ) . '; }';
72
- }
73
- if ( WPRM_Settings::get( 'template_font_header' ) ) {
74
- $output .= $selector . ' .wprm-recipe .wprm-recipe-name { font-family: ' . WPRM_Settings::get( 'template_font_header' ) . '; }';
75
- $output .= $selector . ' .wprm-recipe .wprm-recipe-header { font-family: ' . WPRM_Settings::get( 'template_font_header' ) . '; }';
76
- }
77
-
78
- $output .= $selector . ' { color: ' . WPRM_Settings::get( 'template_color_text' ) . '; }';
79
- $output .= $selector . ' .wprm-recipe { background-color: ' . WPRM_Settings::get( 'template_color_background' ) . '; }';
80
- $output .= $selector . ' .wprm-recipe { border-color: ' . WPRM_Settings::get( 'template_color_border' ) . '; }';
81
- $output .= $selector . ' .wprm-recipe .wprm-color-border { border-color: ' . WPRM_Settings::get( 'template_color_border' ) . '; }';
82
- $output .= $selector . ' a { color: ' . WPRM_Settings::get( 'template_color_link' ) . '; }';
83
- $output .= $selector . ' .wprm-recipe .wprm-color-header { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
84
- $output .= $selector . ' h1 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
85
- $output .= $selector . ' h2 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
86
- $output .= $selector . ' h3 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
87
- $output .= $selector . ' h4 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
88
- $output .= $selector . ' h5 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
89
- $output .= $selector . ' h6 { color: ' . WPRM_Settings::get( 'template_color_header' ) . '; }';
90
- $output .= $selector . ' svg path { fill: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
91
- $output .= $selector . ' svg rect { fill: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
92
- $output .= $selector . ' svg polygon { stroke: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
93
- $output .= $selector . ' .wprm-rating-star-full svg polygon { fill: ' . WPRM_Settings::get( 'template_color_icon' ) . '; }';
94
- $output .= $selector . ' .wprm-recipe .wprm-color-accent { background-color: ' . WPRM_Settings::get( 'template_color_accent' ) . '; }';
95
- $output .= $selector . ' .wprm-recipe .wprm-color-accent { color: ' . WPRM_Settings::get( 'template_color_accent_text' ) . '; }';
96
- $output .= $selector . ' .wprm-recipe .wprm-color-accent2 { background-color: ' . WPRM_Settings::get( 'template_color_accent2' ) . '; }';
97
- $output .= $selector . ' .wprm-recipe .wprm-color-accent2 { color: ' . WPRM_Settings::get( 'template_color_accent2_text' ) . '; }';
98
-
99
- // List style.
100
- if ( 'checkbox' === WPRM_Settings::get( 'template_ingredient_list_style' ) ) {
101
- $output .= $selector . ' li.wprm-recipe-ingredient { list-style-type: none; }';
102
- } else {
103
- $output .= $selector . ' li.wprm-recipe-ingredient { list-style-type: ' . WPRM_Settings::get( 'template_ingredient_list_style' ) . '; }';
104
- }
105
- if ( 'checkbox' === WPRM_Settings::get( 'template_instruction_list_style' ) ) {
106
- $output .= $selector . ' li.wprm-recipe-instruction { list-style-type: none; }';
107
- } else {
108
- $output .= $selector . ' li.wprm-recipe-instruction { list-style-type: ' . WPRM_Settings::get( 'template_instruction_list_style' ) . '; }';
109
- }
110
-
111
- // Comment ratings.
112
- $output .= ' .wprm-comment-rating svg path, .comment-form-wprm-rating svg path { fill: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
113
- $output .= ' .wprm-comment-rating svg polygon, .comment-form-wprm-rating svg polygon { stroke: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
114
-
115
- // Allow add-ons to hook in.
116
- $output = apply_filters( 'wprm_custom_css', $output, $type, $selector );
117
-
118
- // Custom recipe CSS.
119
- if ( 'print' !== $type ) {
120
- $output .= WPRM_Settings::get( 'recipe_css' );
121
- }
122
-
123
- $output .= '</style>';
124
-
125
- echo $output;
126
- }
127
-
128
  /**
129
  * Get template for a specific recipe.
130
  *
34
  */
35
  public static function init() {
36
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
 
 
 
 
37
  }
38
 
39
  /**
47
  wp_enqueue_style( 'wprm-template', $template['url'] . '/' . $template['slug'] . '.min.css', array(), WPRM_VERSION, 'all' );
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Get template for a specific recipe.
52
  *
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: BrechtVds
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QG7KZMGFU325Y
4
  Tags: recipe, recipes, ingredients, food, cooking, seo, schema.org, json-ld
5
  Requires at least: 4.4
6
- Tested up to: 4.8
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -68,6 +68,7 @@ Currently using another recipe plugin? No problem! You can easily migrate all yo
68
  * Yumprint Recipe Card
69
  * Tasty Recipes
70
  * FoodiePress
 
71
  * (More coming soon!)
72
 
73
  This plugin is in active development. Feel free to contact us with any feature requests or ideas.
@@ -104,6 +105,15 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
 
107
  = 1.25.0 =
108
  * Feature: Show recipe rating on manage page
109
  * Feature: Remove inline metadata for recipes, using JSON-LD metadata only now
@@ -367,6 +377,9 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
367
 
368
  == Upgrade notice ==
369
 
 
 
 
370
  = 1.25.0 =
371
  Update to use the latest recipe metadata structure
372
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QG7KZMGFU325Y
4
  Tags: recipe, recipes, ingredients, food, cooking, seo, schema.org, json-ld
5
  Requires at least: 4.4
6
+ Tested up to: 4.9
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
68
  * Yumprint Recipe Card
69
  * Tasty Recipes
70
  * FoodiePress
71
+ * Cooked
72
  * (More coming soon!)
73
 
74
  This plugin is in active development. Feel free to contact us with any feature requests or ideas.
105
 
106
  == Changelog ==
107
 
108
+ = 1.26.0 =
109
+ * Feature: Setting to automatically add recipe snippets like Jump to Recipe
110
+ * Feature: Create recipes on the Manage page
111
+ * Feature: Import from Cooked recipe plugin
112
+ * Improvement: Ability to reset settings to defaults
113
+ * Fix: Prevent issue with image metadata in different thumbnail sizes
114
+ * Fix: Prevent trashing parent post from trashing recipe
115
+ * Fix: Recipe image not loading when using Fly Dynamic Image Resizer
116
+
117
  = 1.25.0 =
118
  * Feature: Show recipe rating on manage page
119
  * Feature: Remove inline metadata for recipes, using JSON-LD metadata only now
377
 
378
  == Upgrade notice ==
379
 
380
+ = 1.26.0 =
381
+ Update to prevent issues with the recipe metadata
382
+
383
  = 1.25.0 =
384
  Update to use the latest recipe metadata structure
385
 
templates/admin/manage/recipes.php CHANGED
@@ -11,6 +11,7 @@
11
 
12
  ?>
13
  <div class="wprm-manage-header wprm-manage-recipes-filters">
 
14
  <?php
15
  esc_html_e( 'Filter', 'wp-recipe-maker' );
16
  $taxonomies = WPRM_Taxonomies::get_taxonomies( true );
11
 
12
  ?>
13
  <div class="wprm-manage-header wprm-manage-recipes-filters">
14
+ <button type="button" class="button button-primary wprm-modal-button" title="<?php esc_attr_e( 'Create Recipe', 'wp-recipe-maker' ); ?>"><?php esc_html_e( 'Create Recipe', 'wp-recipe-maker' ); ?></button><br/><br/>
15
  <?php
16
  esc_html_e( 'Filter', 'wp-recipe-maker' );
17
  $taxonomies = WPRM_Taxonomies::get_taxonomies( true );
templates/admin/menu/faq/whats_new.php CHANGED
@@ -11,6 +11,17 @@
11
 
12
  ?>
13
 
 
 
 
 
 
 
 
 
 
 
 
14
  <h3>2017-11-03 | WP Recipe Maker Premium 1.7.0</h3>
15
  <ul>
16
  <li>Feature: Show user and total ratings on the manage page</li>
11
 
12
  ?>
13
 
14
+ <h3>2017-11-22 | WP Recipe Maker 1.26.0</h3>
15
+ <ul>
16
+ <li>Feature: Setting to automatically add recipe snippets like Jump to Recipe</li>
17
+ <li>Feature: Create recipes on the Manage page</li>
18
+ <li>Feature: Import from Cooked recipe plugin</li>
19
+ <li>Improvement: Ability to reset settings to defaults</li>
20
+ <li>Fix: Prevent issue with image metadata in different thumbnail sizes</li>
21
+ <li>Fix: Prevent trashing parent post from trashing recipe</li>
22
+ <li>Fix: Recipe image not loading when using Fly Dynamic Image Resizer</li>
23
+ </ul>
24
+
25
  <h3>2017-11-03 | WP Recipe Maker Premium 1.7.0</h3>
26
  <ul>
27
  <li>Feature: Show user and total ratings on the manage page</li>
templates/admin/settings/advanced.php CHANGED
@@ -57,5 +57,21 @@
57
  </tr>
58
  </tbody>
59
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  <?php submit_button( __( 'Save Changes', 'wp-recipe-maker' ) ); ?>
61
  </form>
57
  </tr>
58
  </tbody>
59
  </table>
60
+ <h2 class="title"><?php esc_html_e( 'Settings', 'wp-recipe-maker' ); ?></h2>
61
+ <table class="form-table">
62
+ <tbody>
63
+ <tr>
64
+ <th scope="row">
65
+ <?php esc_html_e( 'Reset to defaults', 'wp-recipe-maker' ); ?>
66
+ </th>
67
+ <td>
68
+ <label for="reset_settings_to_default">
69
+ <input name="reset_settings_to_default" type="checkbox" id="reset_settings_to_default" />
70
+ <?php esc_html_e( 'Reset settings to default upon save', 'wp-recipe-maker' ); ?>
71
+ </label>
72
+ </td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
  <?php submit_button( __( 'Save Changes', 'wp-recipe-maker' ) ); ?>
77
  </form>
templates/admin/settings/appearance.php CHANGED
@@ -14,6 +14,52 @@
14
  <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
15
  <input type="hidden" name="action" value="wprm_settings_appearance">
16
  <?php wp_nonce_field( 'wprm_settings', 'wprm_settings', false ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <h2 class="title"><?php esc_html_e( 'Recipe Fields', 'wp-recipe-maker' ); ?></h2>
18
  <table class="form-table">
19
  <tbody>
14
  <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
15
  <input type="hidden" name="action" value="wprm_settings_appearance">
16
  <?php wp_nonce_field( 'wprm_settings', 'wprm_settings', false ); ?>
17
+ <h2 class="title"><?php esc_html_e( 'Recipe Snippets', 'wp-recipe-maker' ); ?></h2>
18
+ <table class="form-table">
19
+ <tbody>
20
+ <tr>
21
+ <th scope="row">
22
+ <?php esc_html_e( 'Automatically add snippets', 'wp-recipe-maker' ); ?>
23
+ </th>
24
+ <td>
25
+ <label for="recipe_snippets_automatically_add">
26
+ <?php $checked = WPRM_Settings::get( 'recipe_snippets_automatically_add' ) ? ' checked="checked"' : ''; ?>
27
+ <input name="recipe_snippets_automatically_add" type="checkbox" id="recipe_snippets_automatically_add"<?php echo esc_html( $checked ); ?> />
28
+ <?php esc_html_e( 'Automatically add "Jump to Recipe" and/or "Print Recipe" buttons above the post content', 'wp-recipe-maker' ); ?>
29
+ </label>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th scope="row">
34
+ <label for="recipe_snippets_text"><?php esc_html_e( 'Text to output', 'wp-recipe-maker' ); ?></label>
35
+ </th>
36
+ <td>
37
+ <input name="recipe_snippets_text" type="text" id="recipe_snippets_text" value="<?php echo esc_attr( WPRM_Settings::get( 'recipe_snippets_text' ) ); ?>" class="regular-text">
38
+ <p class="description" id="tagline-recipe_snippets_text">
39
+ <?php esc_html_e( 'Use [wprm-recipe-jump] and [wprm-recipe-print] to add these snippets', 'wp-recipe-maker-premium' ); ?>
40
+ </p>
41
+ </td>
42
+ </tr>
43
+ <?php if ( WPRM_Settings::get( 'features_custom_style' ) ) : ?>
44
+ <tr>
45
+ <th scope="row">
46
+ <label for="recipe_snippets_background_color"><?php esc_html_e( 'Background Color', 'wp-recipe-maker' ); ?></label>
47
+ </th>
48
+ <td>
49
+ <input name="recipe_snippets_background_color" type="text" id="recipe_snippets_background_color" value="<?php echo esc_attr( WPRM_Settings::get( 'recipe_snippets_background_color' ) ); ?>" data-default-color="<?php echo esc_attr( WPRM_Settings::get_default( 'recipe_snippets_background_color' ) ); ?>" class="wprm-color">
50
+ </td>
51
+ </tr>
52
+ <tr>
53
+ <th scope="row">
54
+ <label for="recipe_snippets_text_color"><?php esc_html_e( 'Text Color', 'wp-recipe-maker' ); ?></label>
55
+ </th>
56
+ <td>
57
+ <input name="recipe_snippets_text_color" type="text" id="recipe_snippets_text_color" value="<?php echo esc_attr( WPRM_Settings::get( 'recipe_snippets_text_color' ) ); ?>" data-default-color="<?php echo esc_attr( WPRM_Settings::get_default( 'recipe_snippets_text_color' ) ); ?>" class="wprm-color">
58
+ </td>
59
+ </tr>
60
+ <?php endif; ?>
61
+ </tbody>
62
+ </table>
63
  <h2 class="title"><?php esc_html_e( 'Recipe Fields', 'wp-recipe-maker' ); ?></h2>
64
  <table class="form-table">
65
  <tbody>
wp-recipe-maker.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: WP Recipe Maker
16
  * Plugin URI: http://bootstrapped.ventures/wp-recipe-maker/
17
  * Description: The easy and user-friendly recipe plugin for everyone. Automatic JSON-LD metadata for better SEO will get you more visitors!
18
- * Version: 1.25.0
19
  * Author: Bootstrapped Ventures
20
  * Author URI: http://bootstrapped.ventures/
21
  * License: GPL-2.0+
15
  * Plugin Name: WP Recipe Maker
16
  * Plugin URI: http://bootstrapped.ventures/wp-recipe-maker/
17
  * Description: The easy and user-friendly recipe plugin for everyone. Automatic JSON-LD metadata for better SEO will get you more visitors!
18
+ * Version: 1.26.0
19
  * Author: Bootstrapped Ventures
20
  * Author URI: http://bootstrapped.ventures/
21
  * License: GPL-2.0+