Version Description
- Improvement: Only show ratings given by an enabled feature
- Improvement: Import title in older versions of EasyRecipe recipes
- Improvement: Prevent instruction list style icon position problem
- Fix: Default author setting not working
- Fix: Prevent PHP warning when saving posts
Download this release
Release Info
Developer | BrechtVds |
Plugin | WP Recipe Maker |
Version | 1.24.0 |
Comparing to | |
See all releases |
Code changes from version 1.23.0 to 1.24.0
- assets/css/public/_template_reset.scss +2 -1
- assets/css/public/public.min.css +1 -1
- assets/js/admin/recipe-form.js +27 -19
- includes/admin/class-wprm-recipe-saver.php +1 -1
- includes/admin/import/class-wprm-import-easyrecipe.php +15 -3
- includes/class-wp-recipe-maker.php +1 -1
- includes/public/class-wprm-rating.php +22 -17
- includes/public/class-wprm-recipe.php +2 -2
- includes/public/class-wprm-settings.php +1 -1
- includes/public/class-wprm-template-helper.php +5 -1
- readme.txt +17 -0
- templates/admin/menu/faq/whats_new.php +11 -0
- wp-recipe-maker.php +1 -1
assets/css/public/_template_reset.scss
CHANGED
@@ -8,7 +8,8 @@
|
|
8 |
font-size: 1em;
|
9 |
}
|
10 |
|
11 |
-
li
|
|
|
12 |
list-style-position: outside;
|
13 |
}
|
14 |
|
8 |
font-size: 1em;
|
9 |
}
|
10 |
|
11 |
+
li,
|
12 |
+
li.wprm-recipe-instruction {
|
13 |
list-style-position: outside;
|
14 |
}
|
15 |
|
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{list-style-position:outside}
|
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}
|
assets/js/admin/recipe-form.js
CHANGED
@@ -122,7 +122,7 @@ wprm_admin.clear_recipe_fields = function() {
|
|
122 |
wprm_admin.remove_media_image(jQuery('.wprm-recipe-image-container'));
|
123 |
jQuery('#wprm-recipe-name').val('');
|
124 |
wprm_admin.rich_editor.resetContent(''); // Recipe summary
|
125 |
-
jQuery('#wprm-recipe-author-display').val('
|
126 |
jQuery('#wprm-recipe-author-name').val('');
|
127 |
jQuery('#wprm-recipe-author-link').val('');
|
128 |
jQuery('#wprm-recipe-servings').val('');
|
@@ -405,26 +405,34 @@ wprm_admin.add_instruction_group = function(name) {
|
|
405 |
};
|
406 |
|
407 |
wprm_admin.insert_update_recipe = function(button) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
// Recipe Details
|
409 |
var recipe = {
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
};
|
429 |
|
430 |
// Recipe Tags
|
122 |
wprm_admin.remove_media_image(jQuery('.wprm-recipe-image-container'));
|
123 |
jQuery('#wprm-recipe-name').val('');
|
124 |
wprm_admin.rich_editor.resetContent(''); // Recipe summary
|
125 |
+
jQuery('#wprm-recipe-author-display').val('default').change();
|
126 |
jQuery('#wprm-recipe-author-name').val('');
|
127 |
jQuery('#wprm-recipe-author-link').val('');
|
128 |
jQuery('#wprm-recipe-servings').val('');
|
405 |
};
|
406 |
|
407 |
wprm_admin.insert_update_recipe = function(button) {
|
408 |
+
// Default author display
|
409 |
+
|
410 |
+
var author_display = jQuery('#wprm-recipe-author-display').val();
|
411 |
+
|
412 |
+
if(author_display == 'default') {
|
413 |
+
author_display = jQuery('#wprm-recipe-author-display').find('option:first').data('default');
|
414 |
+
}
|
415 |
+
|
416 |
// Recipe Details
|
417 |
var recipe = {
|
418 |
+
image_id: jQuery('#wprm-recipe-image-id').val(),
|
419 |
+
name: jQuery('#wprm-recipe-name').val(),
|
420 |
+
summary: jQuery('#wprm-recipe-summary').val(),
|
421 |
+
author_display: author_display,
|
422 |
+
author_name: jQuery('#wprm-recipe-author-name').val(),
|
423 |
+
author_link: jQuery('#wprm-recipe-author-link').val(),
|
424 |
+
servings: jQuery('#wprm-recipe-servings').val(),
|
425 |
+
servings_unit: jQuery('#wprm-recipe-servings-unit').val(),
|
426 |
+
prep_time: jQuery('#wprm-recipe-prep-time').val(),
|
427 |
+
cook_time: jQuery('#wprm-recipe-cook-time').val(),
|
428 |
+
total_time: jQuery('#wprm-recipe-total-time').val(),
|
429 |
+
nutrition: {
|
430 |
+
calories: jQuery('#wprm-recipe-calories').val()
|
431 |
+
},
|
432 |
+
tags: {
|
433 |
+
course: jQuery('#wprm-recipe-tag-course').val(),
|
434 |
+
cuisine: jQuery('#wprm-recipe-tag-cuisine').val()
|
435 |
+
}
|
436 |
};
|
437 |
|
438 |
// Recipe Tags
|
includes/admin/class-wprm-recipe-saver.php
CHANGED
@@ -208,7 +208,7 @@ class WPRM_Recipe_Saver {
|
|
208 |
$post = get_post( $post_id );
|
209 |
|
210 |
$categories = get_the_terms( $post, 'category' );
|
211 |
-
$cat_ids = is_wp_error( $categories ) ? array() : wp_list_pluck( $categories, 'term_id' );
|
212 |
|
213 |
// Update recipes.
|
214 |
foreach ( $recipe_ids as $recipe_id ) {
|
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 ) {
|
includes/admin/import/class-wprm-import-easyrecipe.php
CHANGED
@@ -102,7 +102,12 @@ class WPRM_Import_Easyrecipe extends WPRM_Import {
|
|
102 |
if ( count( $recipes_html ) > 0 ) {
|
103 |
foreach ( $recipes_html as $index => $recipe_html ) {
|
104 |
$name = $recipe_html->find( 'div[class=ERName]', 0 );
|
105 |
-
$name = is_object( $name ) ? $this->strip_easyrecipe_tags( $name->plaintext ) :
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
$recipe_id = $post->ID . '-' . $index;
|
108 |
$recipes[ $recipe_id ] = array(
|
@@ -189,11 +194,18 @@ class WPRM_Import_Easyrecipe extends WPRM_Import {
|
|
189 |
}
|
190 |
}
|
191 |
|
192 |
-
//
|
193 |
$easyrecipe_field = $recipe_html->find( 'div[class=ERName]', 0 );
|
194 |
-
$wprm_field = is_object( $easyrecipe_field ) ? $this->strip_easyrecipe_tags( $easyrecipe_field->plaintext ) :
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
$recipe['name'] = $wprm_field;
|
196 |
|
|
|
197 |
$easyrecipe_field = $recipe_html->find( 'div[class=ERSummary]', 0 );
|
198 |
$wprm_field = is_object( $easyrecipe_field ) ? $this->replace_easyrecipe_tags( $easyrecipe_field->plaintext ) : '';
|
199 |
$recipe['summary'] = $wprm_field;
|
102 |
if ( count( $recipes_html ) > 0 ) {
|
103 |
foreach ( $recipes_html as $index => $recipe_html ) {
|
104 |
$name = $recipe_html->find( 'div[class=ERName]', 0 );
|
105 |
+
$name = is_object( $name ) ? $this->strip_easyrecipe_tags( $name->plaintext ) : false;
|
106 |
+
|
107 |
+
if ( false === $name ) {
|
108 |
+
$name = $recipe_html->find( 'span[class=ERName]', 0 );
|
109 |
+
$name = is_object( $name ) ? $this->strip_easyrecipe_tags( $name->plaintext ) : __( 'Unknown', 'wp-recipe-maker' );
|
110 |
+
}
|
111 |
|
112 |
$recipe_id = $post->ID . '-' . $index;
|
113 |
$recipes[ $recipe_id ] = array(
|
194 |
}
|
195 |
}
|
196 |
|
197 |
+
// Name.
|
198 |
$easyrecipe_field = $recipe_html->find( 'div[class=ERName]', 0 );
|
199 |
+
$wprm_field = is_object( $easyrecipe_field ) ? $this->strip_easyrecipe_tags( $easyrecipe_field->plaintext ) : false;
|
200 |
+
|
201 |
+
if ( false === $wprm_field ) {
|
202 |
+
$easyrecipe_field = $recipe_html->find( 'span[class=ERName]', 0 );
|
203 |
+
$wprm_field = is_object( $easyrecipe_field ) ? $this->strip_easyrecipe_tags( $easyrecipe_field->plaintext ) : '';
|
204 |
+
}
|
205 |
+
|
206 |
$recipe['name'] = $wprm_field;
|
207 |
|
208 |
+
// Simple matching.
|
209 |
$easyrecipe_field = $recipe_html->find( 'div[class=ERSummary]', 0 );
|
210 |
$wprm_field = is_object( $easyrecipe_field ) ? $this->replace_easyrecipe_tags( $easyrecipe_field->plaintext ) : '';
|
211 |
$recipe['summary'] = $wprm_field;
|
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.
|
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.24.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-rating.php
CHANGED
@@ -81,38 +81,43 @@ class WPRM_Rating {
|
|
81 |
);
|
82 |
|
83 |
// Get comment ratings.
|
84 |
-
|
|
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
if ( $comment_rating ) {
|
90 |
-
$rating['count']++;
|
91 |
-
$rating['total'] += $comment_rating;
|
92 |
-
} else {
|
93 |
-
// Check for EasyRecipe or WP Tasty rating.
|
94 |
-
$comment_rating = intval( get_comment_meta( $comment->comment_ID, 'ERRating', true ) );
|
95 |
|
96 |
if ( $comment_rating ) {
|
97 |
$rating['count']++;
|
98 |
$rating['total'] += $comment_rating;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
-
|
101 |
-
|
|
|
102 |
}
|
103 |
}
|
104 |
}
|
105 |
|
106 |
// Get user ratings.
|
107 |
-
|
|
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
112 |
}
|
113 |
|
|
|
114 |
if ( $rating['count'] > 0 ) {
|
115 |
-
|
116 |
}
|
117 |
|
118 |
// Update recipe rating and average (to sort by).
|
81 |
);
|
82 |
|
83 |
// Get comment ratings.
|
84 |
+
if ( WPRM_Settings::get( 'features_comment_ratings' ) ) {
|
85 |
+
$comments = get_approved_comments( $recipe->parent_post_id() );
|
86 |
|
87 |
+
foreach ( $comments as $comment ) {
|
88 |
+
$comment_rating = intval( get_comment_meta( $comment->comment_ID, 'wprm-comment-rating', true ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
if ( $comment_rating ) {
|
91 |
$rating['count']++;
|
92 |
$rating['total'] += $comment_rating;
|
93 |
+
} else {
|
94 |
+
// Check for EasyRecipe or WP Tasty rating.
|
95 |
+
$comment_rating = intval( get_comment_meta( $comment->comment_ID, 'ERRating', true ) );
|
96 |
+
|
97 |
+
if ( $comment_rating ) {
|
98 |
+
$rating['count']++;
|
99 |
+
$rating['total'] += $comment_rating;
|
100 |
|
101 |
+
// This should be migrated.
|
102 |
+
update_comment_meta( $comment->comment_ID, 'wprm-comment-rating', $comment_rating );
|
103 |
+
}
|
104 |
}
|
105 |
}
|
106 |
}
|
107 |
|
108 |
// Get user ratings.
|
109 |
+
if ( WPRM_Addons::is_active( 'premium' ) && WPRM_Settings::get( 'features_user_ratings' ) ) {
|
110 |
+
$user_ratings = get_post_meta( $recipe_id, 'wprm_user_ratings' );
|
111 |
|
112 |
+
foreach ( $user_ratings as $user_rating ) {
|
113 |
+
$rating['count']++;
|
114 |
+
$rating['total'] += $user_rating['rating'];
|
115 |
+
}
|
116 |
}
|
117 |
|
118 |
+
// Calculate average.
|
119 |
if ( $rating['count'] > 0 ) {
|
120 |
+
$rating['average'] = ceil( $rating['total'] / $rating['count'] * 100 ) / 100;
|
121 |
}
|
122 |
|
123 |
// Update recipe rating and average (to sort by).
|
includes/public/class-wprm-recipe.php
CHANGED
@@ -347,9 +347,9 @@ class WPRM_Recipe {
|
|
347 |
$rating = self::unserialize( $this->meta( 'wprm_rating', array() ) );
|
348 |
|
349 |
// Recalculate if rating has not been set yet.
|
350 |
-
if ( empty( $rating ) ) {
|
351 |
$rating = WPRM_Rating::update_recipe_rating( $this->id() );
|
352 |
-
}
|
353 |
|
354 |
// Attach current user rating.
|
355 |
if ( WPRM_Addons::is_active( 'premium' ) ) {
|
347 |
$rating = self::unserialize( $this->meta( 'wprm_rating', array() ) );
|
348 |
|
349 |
// Recalculate if rating has not been set yet.
|
350 |
+
// if ( empty( $rating ) ) {
|
351 |
$rating = WPRM_Rating::update_recipe_rating( $this->id() );
|
352 |
+
// }
|
353 |
|
354 |
// Attach current user rating.
|
355 |
if ( WPRM_Addons::is_active( 'premium' ) ) {
|
includes/public/class-wprm-settings.php
CHANGED
@@ -68,7 +68,7 @@ class WPRM_Settings {
|
|
68 |
'features_custom_style' => true,
|
69 |
// Features Premium.
|
70 |
'features_adjustable_servings' => true,
|
71 |
-
'features_user_ratings' =>
|
72 |
// Advanced.
|
73 |
'recipe_css' => '',
|
74 |
'print_css' => '',
|
68 |
'features_custom_style' => true,
|
69 |
// Features Premium.
|
70 |
'features_adjustable_servings' => true,
|
71 |
+
'features_user_ratings' => false,
|
72 |
// Advanced.
|
73 |
'recipe_css' => '',
|
74 |
'print_css' => '',
|
includes/public/class-wprm-template-helper.php
CHANGED
@@ -250,7 +250,11 @@ class WPRM_Template_Helper {
|
|
250 |
}
|
251 |
|
252 |
if ( $show_details ) {
|
253 |
-
|
|
|
|
|
|
|
|
|
254 |
} else {
|
255 |
$output .= '<div class="wprm-recipe-rating-details-meta" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
|
256 |
$output .= '<meta itemprop="ratingValue" content="' . $rating['average'] . '">';
|
250 |
}
|
251 |
|
252 |
if ( $show_details ) {
|
253 |
+
if ( $rating['count'] > 0 ) {
|
254 |
+
$output .= '<div class="wprm-recipe-rating-details" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span class="wprm-recipe-rating-average" itemprop="ratingValue">' . $rating['average'] . '</span> ' . __( 'from', 'wp-recipe-maker' ) . ' <span class="wprm-recipe-rating-count" itemprop="ratingCount">' . $rating['count'] . '</span> ' . _n( 'vote', 'votes', $rating['count'], 'wp-recipe-maker' ) . '</div>';
|
255 |
+
} else {
|
256 |
+
$output .= '<div class="wprm-recipe-rating-details"><span class="wprm-recipe-rating-average">' . $rating['average'] . '</span> ' . __( 'from', 'wp-recipe-maker' ) . ' <span class="wprm-recipe-rating-count">' . $rating['count'] . '</span> ' . _n( 'vote', 'votes', $rating['count'], 'wp-recipe-maker' ) . '</div>';
|
257 |
+
}
|
258 |
} else {
|
259 |
$output .= '<div class="wprm-recipe-rating-details-meta" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
|
260 |
$output .= '<meta itemprop="ratingValue" content="' . $rating['average'] . '">';
|
readme.txt
CHANGED
@@ -103,6 +103,17 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 1.23.0 =
|
107 |
* Feature: Import WP Tasty Recipes
|
108 |
* Improvement: Better handling of shortcodes in JSON-LD metadata
|
@@ -345,6 +356,12 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
345 |
|
346 |
== Upgrade notice ==
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
= 1.23.0 =
|
349 |
Update to prevent a Jetpack compatibility problem
|
350 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 1.24.0 =
|
107 |
+
* Improvement: Only show ratings given by an enabled feature
|
108 |
+
* Improvement: Import title in older versions of EasyRecipe recipes
|
109 |
+
* Improvement: Prevent instruction list style icon position problem
|
110 |
+
* Fix: Default author setting not working
|
111 |
+
* Fix: Prevent PHP warning when saving posts
|
112 |
+
|
113 |
+
= 1.23.1 =
|
114 |
+
* Fix: Make sure recipe rating is updated
|
115 |
+
* Fix: Inline rating metadata when there are no votes yet
|
116 |
+
|
117 |
= 1.23.0 =
|
118 |
* Feature: Import WP Tasty Recipes
|
119 |
* Improvement: Better handling of shortcodes in JSON-LD metadata
|
356 |
|
357 |
== Upgrade notice ==
|
358 |
|
359 |
+
= 1.24.0 =
|
360 |
+
Update to fix a few bugs
|
361 |
+
|
362 |
+
= 1.23.1 =
|
363 |
+
Update if you're experiencing issues with the recipe ratings
|
364 |
+
|
365 |
= 1.23.0 =
|
366 |
Update to prevent a Jetpack compatibility problem
|
367 |
|
templates/admin/menu/faq/whats_new.php
CHANGED
@@ -11,6 +11,17 @@
|
|
11 |
|
12 |
?>
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<h3>2017-09-01 | WP Recipe Maker 1.23.0</h3>
|
15 |
<ul>
|
16 |
<li>Feature: Import WP Tasty Recipes</li>
|
11 |
|
12 |
?>
|
13 |
|
14 |
+
<h3>2017-10-05 | WP Recipe Maker 1.24.0</h3>
|
15 |
+
<ul>
|
16 |
+
<li>Improvement: Only show ratings given by an enabled feature</li>
|
17 |
+
<li>Improvement: Import title in older versions of EasyRecipe recipes</li>
|
18 |
+
<li>Improvement: Prevent instruction list style icon position problem</li>
|
19 |
+
<li>Fix: Default author setting not working</li>
|
20 |
+
<li>Fix: Make sure recipe rating is updated</li>
|
21 |
+
<li>Fix: Inline rating metadata when there are no votes yet</li>
|
22 |
+
<li>Fix: Prevent PHP warning when saving posts</li>
|
23 |
+
</ul>
|
24 |
+
|
25 |
<h3>2017-09-01 | WP Recipe Maker 1.23.0</h3>
|
26 |
<ul>
|
27 |
<li>Feature: Import WP Tasty Recipes</li>
|
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.
|
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.24.0
|
19 |
* Author: Bootstrapped Ventures
|
20 |
* Author URI: http://bootstrapped.ventures/
|
21 |
* License: GPL-2.0+
|