Version Description
- Feature: Edit Recipe button for easy access
- Feature: Setting to set capability required for the manage page
- Improvement: Shortcode preview shows entire recipe
- Improvement: Taxonomies in REST API
- Improvement: AggregateRating details in inline metadata even when not shown
- Improvement: Better parsing of ingredient notes
- Fix: Clearfix for recipe container
- Fix: Manage page filters appearing over modal
- Fix: Pagination on taxonomy manage pages
Download this release
Release Info
Developer | BrechtVds |
Plugin | WP Recipe Maker |
Version | 1.14.0 |
Comparing to | |
See all releases |
Code changes from version 1.13.0 to 1.14.0
- assets/css/admin/manage.min.css +1 -1
- assets/css/admin/manage.scss +1 -0
- assets/css/public/_template_reset.scss +4 -0
- assets/css/public/public.min.css +1 -1
- assets/js/admin/modal.js +10 -0
- assets/js/admin/recipe-form.js +36 -31
- includes/admin/class-wprm-recipe-parser.php +8 -7
- includes/admin/manage/class-wprm-manage-ingredients.php +3 -1
- includes/admin/manage/class-wprm-manage-taxonomies.php +3 -1
- includes/admin/manage/class-wprm-manage.php +1 -1
- includes/admin/menu/class-wprm-admin-menu.php +1 -1
- includes/admin/modal/class-wprm-button.php +12 -0
- includes/class-wp-recipe-maker.php +1 -1
- includes/public/class-wprm-settings.php +3 -0
- includes/public/class-wprm-taxonomies.php +2 -1
- includes/public/class-wprm-template-helper.php +5 -0
- readme.txt +15 -1
- templates/admin/menu/faq/whats_new.php +13 -0
- templates/admin/modal/shortcode-preview.php +117 -2
- templates/admin/settings/features.php +11 -0
- wp-recipe-maker.php +1 -1
assets/css/admin/manage.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-manage .dataTables_wrapper,.wprm-manage .wprm-manage-recipes-filters{margin-top:20px}.wprm-manage .wprm-manage-recipes-filters .select2_wprm-container,.wprm-manage .wprm-manage-recipes-filters .wprm-manage-recipes-filter{margin-left:5px}.wprm-manage .wprm-manage-datatable{display:none}.wprm-manage .wprm-manage-datatable .wprm-icon{cursor:pointer;color:#444}.wprm-manage .dataTables_wrapper .wprm-manage-datatable{display:table}.wprm-manage-custom-taxonomies-actions-tooltip,.wprm-manage-ingredients-actions-tooltip,.wprm-manage-recipes-actions-tooltip,.wprm-manage-taxonomies-actions-tooltip{text-align:right;min-width:250px;min-height:70px;font-size:14px}.wprm-manage-custom-taxonomies-actions-tooltip .tooltip-header,.wprm-manage-ingredients-actions-tooltip .tooltip-header,.wprm-manage-recipes-actions-tooltip .tooltip-header,.wprm-manage-taxonomies-actions-tooltip .tooltip-header{margin-bottom:5px;font-weight:700}.wprm-manage-custom-taxonomies-actions-tooltip a,.wprm-manage-ingredients-actions-tooltip a,.wprm-manage-recipes-actions-tooltip a,.wprm-manage-taxonomies-actions-tooltip a{color:#fff;display:block;text-decoration:none}.wprm-manage-custom-taxonomies-actions-tooltip a:hover,.wprm-manage-ingredients-actions-tooltip a:hover,.wprm-manage-recipes-actions-tooltip a:hover,.wprm-manage-taxonomies-actions-tooltip a:hover{text-decoration:underline}
|
1 |
+
.wprm-manage .dataTables_wrapper,.wprm-manage .wprm-manage-recipes-filters{margin-top:20px}.wprm-manage .wprm-manage-recipes-filters .select2_wprm-container,.wprm-manage .wprm-manage-recipes-filters .wprm-manage-recipes-filter{margin-left:5px;z-index:100}.wprm-manage .wprm-manage-datatable{display:none}.wprm-manage .wprm-manage-datatable .wprm-icon{cursor:pointer;color:#444}.wprm-manage .dataTables_wrapper .wprm-manage-datatable{display:table}.wprm-manage-custom-taxonomies-actions-tooltip,.wprm-manage-ingredients-actions-tooltip,.wprm-manage-recipes-actions-tooltip,.wprm-manage-taxonomies-actions-tooltip{text-align:right;min-width:250px;min-height:70px;font-size:14px}.wprm-manage-custom-taxonomies-actions-tooltip .tooltip-header,.wprm-manage-ingredients-actions-tooltip .tooltip-header,.wprm-manage-recipes-actions-tooltip .tooltip-header,.wprm-manage-taxonomies-actions-tooltip .tooltip-header{margin-bottom:5px;font-weight:700}.wprm-manage-custom-taxonomies-actions-tooltip a,.wprm-manage-ingredients-actions-tooltip a,.wprm-manage-recipes-actions-tooltip a,.wprm-manage-taxonomies-actions-tooltip a{color:#fff;display:block;text-decoration:none}.wprm-manage-custom-taxonomies-actions-tooltip a:hover,.wprm-manage-ingredients-actions-tooltip a:hover,.wprm-manage-recipes-actions-tooltip a:hover,.wprm-manage-taxonomies-actions-tooltip a:hover{text-decoration:underline}
|
assets/css/admin/manage.scss
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
.wprm-manage-recipes-filter,
|
7 |
.select2_wprm-container {
|
8 |
margin-left: 5px;
|
|
|
9 |
}
|
10 |
}
|
11 |
|
6 |
.wprm-manage-recipes-filter,
|
7 |
.select2_wprm-container {
|
8 |
margin-left: 5px;
|
9 |
+
z-index: 100;
|
10 |
}
|
11 |
}
|
12 |
|
assets/css/public/_template_reset.scss
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
// main: public.scss
|
2 |
.wprm-recipe {
|
|
|
|
|
|
|
|
|
3 |
p, li {
|
4 |
font-size: 1em;
|
5 |
}
|
1 |
// main: public.scss
|
2 |
.wprm-recipe {
|
3 |
+
// Clearfix
|
4 |
+
overflow: auto;
|
5 |
+
zoom: 1;
|
6 |
+
|
7 |
p, li {
|
8 |
font-size: 1em;
|
9 |
}
|
assets/css/public/public.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.comment-form-wprm-rating,.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-recipe li,.wprm-recipe p{font-size:1em}
|
1 |
+
.comment-form-wprm-rating,.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-recipe{overflow:auto;zoom:1}.wprm-recipe li,.wprm-recipe p{font-size:1em}
|
assets/js/admin/modal.js
CHANGED
@@ -69,6 +69,16 @@ jQuery(document).ready(function($) {
|
|
69 |
wprm_admin.open_modal(editor_id);
|
70 |
});
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
// Closing Modal
|
73 |
jQuery('.wprm-modal-container').on('click', '.wprm-modal-close, .wprm-modal-backdrop', function() {
|
74 |
if(confirm(wprm_modal.text.modal_close_confirm)) {
|
69 |
wprm_admin.open_modal(editor_id);
|
70 |
});
|
71 |
|
72 |
+
// Edit Recipe button
|
73 |
+
jQuery(document).on('click', '.wprm-modal-edit-button', function() {
|
74 |
+
var editor_id = jQuery(this).data('editor');
|
75 |
+
var recipe_id = jQuery(this).data('recipe');
|
76 |
+
|
77 |
+
wprm_admin.open_modal(editor_id, {
|
78 |
+
recipe_id: recipe_id
|
79 |
+
});
|
80 |
+
});
|
81 |
+
|
82 |
// Closing Modal
|
83 |
jQuery('.wprm-modal-container').on('click', '.wprm-modal-close, .wprm-modal-backdrop', function() {
|
84 |
if(confirm(wprm_modal.text.modal_close_confirm)) {
|
assets/js/admin/recipe-form.js
CHANGED
@@ -367,37 +367,7 @@ wprm_admin.insert_update_recipe = function(button) {
|
|
367 |
});
|
368 |
|
369 |
// Recipe Ingredients
|
370 |
-
|
371 |
-
var ingredient_group = {
|
372 |
-
name: '',
|
373 |
-
ingredients: []
|
374 |
-
};
|
375 |
-
jQuery('.wprm-recipe-ingredients').find('tr').each(function() {
|
376 |
-
var row = jQuery(this);
|
377 |
-
if (row.hasClass('wprm-recipe-ingredient-group')) {
|
378 |
-
// Add current ingredient group to ingredients
|
379 |
-
if (ingredient_group.ingredients.length > 0) {
|
380 |
-
ingredients.push(ingredient_group);
|
381 |
-
}
|
382 |
-
|
383 |
-
ingredient_group = {
|
384 |
-
name: row.find('.wprm-recipe-ingredient-group-name').val(),
|
385 |
-
ingredients: []
|
386 |
-
};
|
387 |
-
} else {
|
388 |
-
ingredient_group.ingredients.push({
|
389 |
-
amount: row.find('.wprm-recipe-ingredient-amount').val(),
|
390 |
-
unit: row.find('.wprm-recipe-ingredient-unit').val(),
|
391 |
-
name: row.find('.wprm-recipe-ingredient-name').val(),
|
392 |
-
notes: row.find('.wprm-recipe-ingredient-notes').val()
|
393 |
-
});
|
394 |
-
}
|
395 |
-
});
|
396 |
-
// Add remaining ingredient group
|
397 |
-
if (ingredient_group.ingredients.length > 0) {
|
398 |
-
ingredients.push(ingredient_group);
|
399 |
-
}
|
400 |
-
recipe.ingredients = ingredients;
|
401 |
|
402 |
// Recipe Instructions
|
403 |
var instructions = [];
|
@@ -475,6 +445,41 @@ wprm_admin.insert_update_recipe = function(button) {
|
|
475 |
}, 'json');
|
476 |
};
|
477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
jQuery(document).ready(function($) {
|
479 |
// Recipe and Instruction Image handler
|
480 |
jQuery('.wprm-recipe-details-form, .wprm-recipe-instructions-form').on('click', '.wprm-recipe-image-add', function(e) {
|
367 |
});
|
368 |
|
369 |
// Recipe Ingredients
|
370 |
+
recipe.ingredients = wprm_admin.get_ingredients();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
// Recipe Instructions
|
373 |
var instructions = [];
|
445 |
}, 'json');
|
446 |
};
|
447 |
|
448 |
+
wprm_admin.get_ingredients = function() {
|
449 |
+
var ingredients = [];
|
450 |
+
var ingredient_group = {
|
451 |
+
name: '',
|
452 |
+
ingredients: []
|
453 |
+
};
|
454 |
+
jQuery('.wprm-recipe-ingredients').find('tr').each(function() {
|
455 |
+
var row = jQuery(this);
|
456 |
+
if (row.hasClass('wprm-recipe-ingredient-group')) {
|
457 |
+
// Add current ingredient group to ingredients
|
458 |
+
if (ingredient_group.ingredients.length > 0) {
|
459 |
+
ingredients.push(ingredient_group);
|
460 |
+
}
|
461 |
+
|
462 |
+
ingredient_group = {
|
463 |
+
name: row.find('.wprm-recipe-ingredient-group-name').val(),
|
464 |
+
ingredients: []
|
465 |
+
};
|
466 |
+
} else {
|
467 |
+
ingredient_group.ingredients.push({
|
468 |
+
amount: row.find('.wprm-recipe-ingredient-amount').val(),
|
469 |
+
unit: row.find('.wprm-recipe-ingredient-unit').val(),
|
470 |
+
name: row.find('.wprm-recipe-ingredient-name').val(),
|
471 |
+
notes: row.find('.wprm-recipe-ingredient-notes').val()
|
472 |
+
});
|
473 |
+
}
|
474 |
+
});
|
475 |
+
|
476 |
+
// Add remaining ingredient group
|
477 |
+
if (ingredient_group.ingredients.length > 0) {
|
478 |
+
ingredients.push(ingredient_group);
|
479 |
+
}
|
480 |
+
return ingredients;
|
481 |
+
};
|
482 |
+
|
483 |
jQuery(document).ready(function($) {
|
484 |
// Recipe and Instruction Image handler
|
485 |
jQuery('.wprm-recipe-details-form, .wprm-recipe-instructions-form').on('click', '.wprm-recipe-image-add', function(e) {
|
includes/admin/class-wprm-recipe-parser.php
CHANGED
@@ -116,14 +116,8 @@ class WPRM_Recipe_Parser {
|
|
116 |
// Notes.
|
117 |
$notes = array();
|
118 |
|
119 |
-
|
120 |
-
if ( isset( $match[0] ) ) {
|
121 |
-
$notes[] = trim( $match[2] );
|
122 |
-
$raw = trim( $match[1] );
|
123 |
-
}
|
124 |
-
|
125 |
preg_match_all( '/\((.*?)\)/i', $raw, $matches );
|
126 |
-
|
127 |
if ( isset( $matches[1] ) ) {
|
128 |
foreach ( $matches[1] as $match ) {
|
129 |
$notes[] = trim( $match );
|
@@ -132,6 +126,13 @@ class WPRM_Recipe_Parser {
|
|
132 |
$raw = preg_replace( '/\((.*?)\)/i', '', $raw );
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
$notes = implode( ', ', $notes );
|
136 |
|
137 |
// Name.
|
116 |
// Notes.
|
117 |
$notes = array();
|
118 |
|
119 |
+
// Check for ().
|
|
|
|
|
|
|
|
|
|
|
120 |
preg_match_all( '/\((.*?)\)/i', $raw, $matches );
|
|
|
121 |
if ( isset( $matches[1] ) ) {
|
122 |
foreach ( $matches[1] as $match ) {
|
123 |
$notes[] = trim( $match );
|
126 |
$raw = preg_replace( '/\((.*?)\)/i', '', $raw );
|
127 |
}
|
128 |
|
129 |
+
// Check for comma.
|
130 |
+
preg_match( '/(.*?),(.*)/i', $raw, $match );
|
131 |
+
if ( isset( $match[0] ) ) {
|
132 |
+
$notes[] = trim( $match[2] );
|
133 |
+
$raw = trim( $match[1] );
|
134 |
+
}
|
135 |
+
|
136 |
$notes = implode( ', ', $notes );
|
137 |
|
138 |
// Name.
|
includes/admin/manage/class-wprm-manage-ingredients.php
CHANGED
@@ -136,7 +136,9 @@ class WPRM_Manage_Ingredients {
|
|
136 |
);
|
137 |
}
|
138 |
|
139 |
-
|
|
|
|
|
140 |
|
141 |
return array(
|
142 |
'draw' => $datatable['draw'],
|
136 |
);
|
137 |
}
|
138 |
|
139 |
+
unset( $args['offset'] );
|
140 |
+
unset( $args['number'] );
|
141 |
+
$total = wp_count_terms( 'wprm_ingredient', $args );
|
142 |
|
143 |
return array(
|
144 |
'draw' => $datatable['draw'],
|
includes/admin/manage/class-wprm-manage-taxonomies.php
CHANGED
@@ -87,7 +87,9 @@ class WPRM_Manage_Taxonomies {
|
|
87 |
);
|
88 |
}
|
89 |
|
90 |
-
|
|
|
|
|
91 |
|
92 |
return array(
|
93 |
'draw' => $datatable['draw'],
|
87 |
);
|
88 |
}
|
89 |
|
90 |
+
unset( $args['offset'] );
|
91 |
+
unset( $args['number'] );
|
92 |
+
$total = wp_count_terms( $taxonomy, $args );
|
93 |
|
94 |
return array(
|
95 |
'draw' => $datatable['draw'],
|
includes/admin/manage/class-wprm-manage.php
CHANGED
@@ -247,7 +247,7 @@ class WPRM_Manage {
|
|
247 |
* @since 1.9.0
|
248 |
*/
|
249 |
public static function add_submenu_page() {
|
250 |
-
add_submenu_page( 'wprecipemaker', __( 'Manage', 'wp-recipe-maker-premium' ), __( 'Manage', 'wp-recipe-maker-premium' ), '
|
251 |
}
|
252 |
|
253 |
/**
|
247 |
* @since 1.9.0
|
248 |
*/
|
249 |
public static function add_submenu_page() {
|
250 |
+
add_submenu_page( 'wprecipemaker', __( 'Manage', 'wp-recipe-maker-premium' ), __( 'Manage', 'wp-recipe-maker-premium' ), WPRM_Settings::get( 'features_manage_access' ), 'wprecipemaker', array( __CLASS__, 'page_template' ) );
|
251 |
}
|
252 |
|
253 |
/**
|
includes/admin/menu/class-wprm-admin-menu.php
CHANGED
@@ -36,7 +36,7 @@ class WPRM_Admin_Menu {
|
|
36 |
public static function add_menu_page() {
|
37 |
// Base64 encoded svg icon.
|
38 |
$icon = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0Ij48ZyA+DQo8cGF0aCBmaWxsPSIjZmZmZmZmIiBkPSJNMTAsMEM5LjQsMCw5LDAuNCw5LDF2NEg3VjFjMC0wLjYtMC40LTEtMS0xUzUsMC40LDUsMXY0SDNWMWMwLTAuNi0wLjQtMS0xLTFTMSwwLjQsMSwxdjhjMCwxLjcsMS4zLDMsMywzDQp2MTBjMCwxLjEsMC45LDIsMiwyczItMC45LDItMlYxMmMxLjcsMCwzLTEuMywzLTNWMUMxMSwwLjQsMTAuNiwwLDEwLDB6Ii8+DQo8cGF0aCBkYXRhLWNvbG9yPSJjb2xvci0yIiBmaWxsPSIjZmZmZmZmIiBkPSJNMTksMGMtMy4zLDAtNiwyLjctNiw2djljMCwwLjYsMC40LDEsMSwxaDJ2NmMwLDEuMSwwLjksMiwyLDJzMi0wLjksMi0yVjENCkMyMCwwLjQsMTkuNiwwLDE5LDB6Ii8+DQo8L2c+PC9zdmc+';
|
39 |
-
add_menu_page( 'WP Recipe Maker', 'WP Recipe Maker', '
|
40 |
}
|
41 |
}
|
42 |
|
36 |
public static function add_menu_page() {
|
37 |
// Base64 encoded svg icon.
|
38 |
$icon = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0Ij48ZyA+DQo8cGF0aCBmaWxsPSIjZmZmZmZmIiBkPSJNMTAsMEM5LjQsMCw5LDAuNCw5LDF2NEg3VjFjMC0wLjYtMC40LTEtMS0xUzUsMC40LDUsMXY0SDNWMWMwLTAuNi0wLjQtMS0xLTFTMSwwLjQsMSwxdjhjMCwxLjcsMS4zLDMsMywzDQp2MTBjMCwxLjEsMC45LDIsMiwyczItMC45LDItMlYxMmMxLjcsMCwzLTEuMywzLTNWMUMxMSwwLjQsMTAuNiwwLDEwLDB6Ii8+DQo8cGF0aCBkYXRhLWNvbG9yPSJjb2xvci0yIiBmaWxsPSIjZmZmZmZmIiBkPSJNMTksMGMtMy4zLDAtNiwyLjctNiw2djljMCwwLjYsMC40LDEsMSwxaDJ2NmMwLDEuMSwwLjksMiwyLDJzMi0wLjksMi0yVjENCkMyMCwwLjQsMTkuNiwwLDE5LDB6Ii8+DQo8L2c+PC9zdmc+';
|
39 |
+
add_menu_page( 'WP Recipe Maker', 'WP Recipe Maker', WPRM_Settings::get( 'features_manage_access' ), 'wprecipemaker', array( 'WPRM_Manage', 'page_template' ), 'data:image/svg+xml;base64,' . $icon, 58 );
|
40 |
}
|
41 |
}
|
42 |
|
includes/admin/modal/class-wprm-button.php
CHANGED
@@ -44,6 +44,18 @@ class WPRM_Button {
|
|
44 |
$title = 'WP Recipe Maker';
|
45 |
|
46 |
echo '<button type="button" class="button wprm-modal-button" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $title ) . '</button>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
}
|
49 |
|
44 |
$title = 'WP Recipe Maker';
|
45 |
|
46 |
echo '<button type="button" class="button wprm-modal-button" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $title ) . '</button>';
|
47 |
+
|
48 |
+
// Edit Recipe button.
|
49 |
+
$post = get_post();
|
50 |
+
if ( $post instanceof WP_Post ) {
|
51 |
+
$recipes = WPRM_Recipe_Manager::get_recipe_ids_from_content( $post->post_content );
|
52 |
+
|
53 |
+
if ( isset( $recipes[0] ) ) {
|
54 |
+
$recipe_id = $recipes[0];
|
55 |
+
$title = __( 'Edit Recipe', 'wp-recipe-maker' );
|
56 |
+
echo '<button type="button" class="button wprm-modal-edit-button" data-recipe="' . esc_attr( $recipe_id ) . '" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $title ) . '</button>';
|
57 |
+
}
|
58 |
+
}
|
59 |
}
|
60 |
}
|
61 |
|
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.1.1' );
|
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.14.0' );
|
35 |
define( 'WPRM_PREMIUM_VERSION_REQUIRED', '1.1.1' );
|
36 |
define( 'WPRM_POST_TYPE', 'wprm_recipe' );
|
37 |
define( 'WPRM_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
|
includes/public/class-wprm-settings.php
CHANGED
@@ -54,6 +54,7 @@ class WPRM_Settings {
|
|
54 |
'default_print_template' => 'clean-print',
|
55 |
'print_credit' => '',
|
56 |
// Features.
|
|
|
57 |
'features_comment_ratings' => true,
|
58 |
// Features Premium.
|
59 |
'features_adjustable_servings' => true,
|
@@ -287,11 +288,13 @@ class WPRM_Settings {
|
|
287 |
*/
|
288 |
public static function form_save_settings_features() {
|
289 |
if ( isset( $_POST['wprm_settings'] ) && wp_verify_nonce( sanitize_key( $_POST['wprm_settings'] ), 'wprm_settings' ) ) { // Input var okay.
|
|
|
290 |
$features_comment_ratings = isset( $_POST['features_comment_ratings'] ) && sanitize_key( $_POST['features_comment_ratings'] ) ? true : false; // Input var okay.
|
291 |
$features_adjustable_servings = isset( $_POST['features_adjustable_servings'] ) && sanitize_key( $_POST['features_adjustable_servings'] ) ? true : false; // Input var okay.
|
292 |
|
293 |
$settings = array();
|
294 |
|
|
|
295 |
$settings['features_comment_ratings'] = $features_comment_ratings;
|
296 |
$settings['features_adjustable_servings'] = $features_adjustable_servings;
|
297 |
|
54 |
'default_print_template' => 'clean-print',
|
55 |
'print_credit' => '',
|
56 |
// Features.
|
57 |
+
'features_manage_access' => 'manage_options',
|
58 |
'features_comment_ratings' => true,
|
59 |
// Features Premium.
|
60 |
'features_adjustable_servings' => true,
|
288 |
*/
|
289 |
public static function form_save_settings_features() {
|
290 |
if ( isset( $_POST['wprm_settings'] ) && wp_verify_nonce( sanitize_key( $_POST['wprm_settings'] ), 'wprm_settings' ) ) { // Input var okay.
|
291 |
+
$features_manage_access = isset( $_POST['features_manage_access'] ) ? sanitize_text_field( wp_unslash( $_POST['features_manage_access'] ) ) : ''; // Input var okay.
|
292 |
$features_comment_ratings = isset( $_POST['features_comment_ratings'] ) && sanitize_key( $_POST['features_comment_ratings'] ) ? true : false; // Input var okay.
|
293 |
$features_adjustable_servings = isset( $_POST['features_adjustable_servings'] ) && sanitize_key( $_POST['features_adjustable_servings'] ) ? true : false; // Input var okay.
|
294 |
|
295 |
$settings = array();
|
296 |
|
297 |
+
if ( $features_manage_access ) { $settings['features_manage_access'] = $features_manage_access; }
|
298 |
$settings['features_comment_ratings'] = $features_comment_ratings;
|
299 |
$settings['features_adjustable_servings'] = $features_adjustable_servings;
|
300 |
|
includes/public/class-wprm-taxonomies.php
CHANGED
@@ -41,9 +41,10 @@ class WPRM_Taxonomies {
|
|
41 |
'labels' => $labels,
|
42 |
'hierarchical' => true,
|
43 |
'public' => false,
|
44 |
-
'show_ui'
|
45 |
'query_var' => false,
|
46 |
'rewrite' => false,
|
|
|
47 |
);
|
48 |
|
49 |
register_taxonomy( $taxonomy, WPRM_POST_TYPE, $args );
|
41 |
'labels' => $labels,
|
42 |
'hierarchical' => true,
|
43 |
'public' => false,
|
44 |
+
'show_ui' => false,
|
45 |
'query_var' => false,
|
46 |
'rewrite' => false,
|
47 |
+
'show_in_rest' => true,
|
48 |
);
|
49 |
|
50 |
register_taxonomy( $taxonomy, WPRM_POST_TYPE, $args );
|
includes/public/class-wprm-template-helper.php
CHANGED
@@ -223,6 +223,11 @@ class WPRM_Template_Helper {
|
|
223 |
|
224 |
if ( $show_details ) {
|
225 |
$output .= '<div class="wprm-recipe-rating-details" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span itemprop="ratingValue">' . $rating['average'] . '</span> ' . __( 'from', 'wp-recipe-maker' ) . ' <span itemprop="ratingCount">' . $rating['count'] . '</span> ' . _n( 'vote', 'votes', $rating['count'], 'wp-recipe-maker' ) . '</div>';
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
$output .= '</div>';
|
223 |
|
224 |
if ( $show_details ) {
|
225 |
$output .= '<div class="wprm-recipe-rating-details" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span itemprop="ratingValue">' . $rating['average'] . '</span> ' . __( 'from', 'wp-recipe-maker' ) . ' <span itemprop="ratingCount">' . $rating['count'] . '</span> ' . _n( 'vote', 'votes', $rating['count'], 'wp-recipe-maker' ) . '</div>';
|
226 |
+
} else {
|
227 |
+
$output .= '<div class="wprm-recipe-rating-details-meta" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
|
228 |
+
$output .= '<meta itemprop="ratingValue" content="' . $rating['average'] . '">';
|
229 |
+
$output .= '<meta itemprop="ratingCount" content="' . $rating['count'] . '">';
|
230 |
+
$output .= '</div>';
|
231 |
}
|
232 |
|
233 |
$output .= '</div>';
|
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.7.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -92,6 +92,17 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
92 |
|
93 |
== Changelog ==
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
= 1.13.0 =
|
96 |
* Feature: Filter recipes on manage page by ingredients and tags
|
97 |
* Feature: Change comment rating stars color in the settings
|
@@ -230,6 +241,9 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
230 |
|
231 |
== Upgrade notice ==
|
232 |
|
|
|
|
|
|
|
233 |
= 1.13.0 =
|
234 |
Update to prevent warning notices on the settings page
|
235 |
|
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.7.2
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
92 |
|
93 |
== Changelog ==
|
94 |
|
95 |
+
= 1.14.0 =
|
96 |
+
* Feature: Edit Recipe button for easy access
|
97 |
+
* Feature: Setting to set capability required for the manage page
|
98 |
+
* Improvement: Shortcode preview shows entire recipe
|
99 |
+
* Improvement: Taxonomies in REST API
|
100 |
+
* Improvement: AggregateRating details in inline metadata even when not shown
|
101 |
+
* Improvement: Better parsing of ingredient notes
|
102 |
+
* Fix: Clearfix for recipe container
|
103 |
+
* Fix: Manage page filters appearing over modal
|
104 |
+
* Fix: Pagination on taxonomy manage pages
|
105 |
+
|
106 |
= 1.13.0 =
|
107 |
* Feature: Filter recipes on manage page by ingredients and tags
|
108 |
* Feature: Change comment rating stars color in the settings
|
241 |
|
242 |
== Upgrade notice ==
|
243 |
|
244 |
+
= 1.14.0 =
|
245 |
+
Update for various improvements and bug fixes
|
246 |
+
|
247 |
= 1.13.0 =
|
248 |
Update to prevent warning notices on the settings page
|
249 |
|
templates/admin/menu/faq/whats_new.php
CHANGED
@@ -11,6 +11,19 @@
|
|
11 |
|
12 |
?>
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<h3>2017-01-31 | WP Recipe Maker 1.13.0</h3>
|
15 |
<ul>
|
16 |
<li>Feature: Filter recipes on manage page by ingredients and tags</li>
|
11 |
|
12 |
?>
|
13 |
|
14 |
+
<h3>2017-02-15 | WP Recipe Maker 1.14.0</h3>
|
15 |
+
<ul>
|
16 |
+
<li>Feature: Edit Recipe button for easy access</li>
|
17 |
+
<li>Feature: Setting to set capability required for the manage page</li>
|
18 |
+
<li>Improvement: Shortcode preview shows entire recipe</li>
|
19 |
+
<li>Improvement: Taxonomies in REST API</li>
|
20 |
+
<li>Improvement: AggregateRating details in inline metadata even when not shown</li>
|
21 |
+
<li>Improvement: Better parsing of ingredient notes</li>
|
22 |
+
<li>Fix: Clearfix for recipe container</li>
|
23 |
+
<li>Fix: Manage page filters appearing over modal</li>
|
24 |
+
<li>Fix: Pagination on taxonomy manage pages</li>
|
25 |
+
</ul>
|
26 |
+
|
27 |
<h3>2017-01-31 | WP Recipe Maker 1.13.0</h3>
|
28 |
<ul>
|
29 |
<li>Feature: Filter recipes on manage page by ingredients and tags</li>
|
templates/admin/modal/shortcode-preview.php
CHANGED
@@ -14,8 +14,123 @@
|
|
14 |
$image = $recipe->image( array( 100, 100 ) );
|
15 |
if ( $image ) :
|
16 |
?>
|
17 |
-
<span contentEditable="false" style="display: inline-block; float:
|
18 |
<?php endif; // Image. ?>
|
|
|
19 |
<span contentEditable="false" style="display: inline-block; margin-bottom: 10px;"><?php echo esc_html( $recipe->name() ); ?></span>
|
20 |
-
<span contentEditable="false" style="display: block; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->summary() ) ) ); ?></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
<span contentEditable="false" style="display: block; clear: both; height: 1px; line-height: 1px;"> </span>
|
14 |
$image = $recipe->image( array( 100, 100 ) );
|
15 |
if ( $image ) :
|
16 |
?>
|
17 |
+
<span contentEditable="false" style="display: inline-block; float: right; margin: 0 10px 10px 0;"><?php echo wp_kses_post( $image ); ?></span>
|
18 |
<?php endif; // Image. ?>
|
19 |
+
|
20 |
<span contentEditable="false" style="display: inline-block; margin-bottom: 10px;"><?php echo esc_html( $recipe->name() ); ?></span>
|
21 |
+
<span contentEditable="false" style="display: block; font-size: 12px; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->summary() ) ) ); ?></span>
|
22 |
+
|
23 |
+
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
24 |
+
<?php
|
25 |
+
$taxonomies = WPRM_Taxonomies::get_taxonomies();
|
26 |
+
|
27 |
+
foreach ( $taxonomies as $taxonomy => $options ) :
|
28 |
+
$key = substr( $taxonomy, 5 );
|
29 |
+
$terms = $recipe->tags( $key );
|
30 |
+
|
31 |
+
if ( count( $terms ) > 0 ) : ?>
|
32 |
+
<span contentEditable="false" style="display: block; font-size: 12px;"><?php echo esc_html( WPRM_Template_Helper::label( $key . '_tags', $options['singular_name'] ) ); ?>:
|
33 |
+
<?php foreach ( $terms as $index => $term ) {
|
34 |
+
if ( 0 !== $index ) {
|
35 |
+
echo ', ';
|
36 |
+
}
|
37 |
+
echo esc_html( $term->name );
|
38 |
+
} ?>
|
39 |
+
</span>
|
40 |
+
<?php endif; // Count.
|
41 |
+
endforeach; // Taxonomies. ?>
|
42 |
+
</span>
|
43 |
+
|
44 |
+
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
45 |
+
<?php if ( $recipe->prep_time() ) : ?>
|
46 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
47 |
+
<?php echo esc_html( WPRM_Template_Helper::label( 'prep_time' ) ); ?>:
|
48 |
+
<?php echo esc_html( $recipe->prep_time() ); ?>m
|
49 |
+
</span>
|
50 |
+
<?php endif; // Prep time. ?>
|
51 |
+
<?php if ( $recipe->cook_time() ) : ?>
|
52 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
53 |
+
<?php echo esc_html( WPRM_Template_Helper::label( 'cook_time' ) ); ?>:
|
54 |
+
<?php echo esc_html( $recipe->cook_time() ); ?>m
|
55 |
+
</span>
|
56 |
+
<?php endif; // Cook time. ?>
|
57 |
+
<?php if ( $recipe->total_time() ) : ?>
|
58 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
59 |
+
<?php echo esc_html( WPRM_Template_Helper::label( 'total_time' ) ); ?>:
|
60 |
+
<?php echo esc_html( $recipe->total_time() ); ?>m
|
61 |
+
</span>
|
62 |
+
<?php endif; // Total time. ?>
|
63 |
+
</span>
|
64 |
+
|
65 |
+
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
66 |
+
<?php if ( $recipe->servings() ) : ?>
|
67 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
68 |
+
<?php echo esc_html( WPRM_Template_Helper::label( 'servings' ) ); ?>:
|
69 |
+
<?php echo esc_html( $recipe->servings() . ' ' . $recipe->servings_unit() ); ?>
|
70 |
+
</span>
|
71 |
+
<?php endif; // Servings. ?>
|
72 |
+
<?php if ( $recipe->calories() ) : ?>
|
73 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
74 |
+
<?php echo esc_html( WPRM_Template_Helper::label( 'calories' ) ); ?>:
|
75 |
+
<?php echo esc_html( $recipe->calories() ); ?>
|
76 |
+
</span>
|
77 |
+
<?php endif; // Calories. ?>
|
78 |
+
<?php if ( $recipe->author() ) : ?>
|
79 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
80 |
+
<?php echo esc_html( WPRM_Template_Helper::label( 'author' ) ); ?>:
|
81 |
+
<?php echo esc_html( $recipe->author() ); ?>
|
82 |
+
</span>
|
83 |
+
<?php endif; // Author. ?>
|
84 |
+
</span>
|
85 |
+
|
86 |
+
<?php
|
87 |
+
$ingredients = $recipe->ingredients();
|
88 |
+
if ( count( $ingredients ) > 0 ) : ?>
|
89 |
+
<span contentEditable="false" style="display: block; margin-top: 10px; margin-bottom: 10px;">
|
90 |
+
<?php foreach ( $ingredients as $ingredient_group ) : ?>
|
91 |
+
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
92 |
+
<?php if ( $ingredient_group['name'] ) : ?>
|
93 |
+
<span contentEditable="false" style="display: block; font-size: 12px; font-weight: bold;"><?php echo esc_html( $ingredient_group['name'] ); ?></span>
|
94 |
+
<?php endif; // Ingredient group name. ?>
|
95 |
+
<?php foreach ( $ingredient_group['ingredients'] as $ingredient ) : ?>
|
96 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
97 |
+
-
|
98 |
+
<?php if ( $ingredient['amount'] ) : ?>
|
99 |
+
<?php echo esc_html( $ingredient['amount'] ); ?>
|
100 |
+
<?php endif; // Ingredient amount. ?>
|
101 |
+
<?php if ( $ingredient['unit'] ) : ?>
|
102 |
+
<?php echo esc_html( $ingredient['unit'] ); ?>
|
103 |
+
<?php endif; // Ingredient unit. ?>
|
104 |
+
<?php echo esc_html( $ingredient['name'] ); ?>
|
105 |
+
<?php if ( $ingredient['notes'] ) : ?>
|
106 |
+
(<?php echo esc_html( $ingredient['notes'] ); ?>)
|
107 |
+
<?php endif; // Ingredient notes. ?>
|
108 |
+
</span>
|
109 |
+
<?php endforeach; // Ingredients. ?>
|
110 |
+
</span>
|
111 |
+
<?php endforeach; // Ingredient groups. ?>
|
112 |
+
</span>
|
113 |
+
<?php endif; // Ingredients. ?>
|
114 |
+
|
115 |
+
<?php
|
116 |
+
$instructions = $recipe->instructions();
|
117 |
+
if ( count( $instructions ) > 0 ) : ?>
|
118 |
+
<span contentEditable="false" style="display: block; margin-top: 10px; margin-bottom: 10px;">
|
119 |
+
<?php foreach ( $instructions as $instruction_group ) : ?>
|
120 |
+
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
121 |
+
<?php if ( $instruction_group['name'] ) : ?>
|
122 |
+
<span contentEditable="false" style="display: block; font-size: 12px; font-weight: bold;"><?php echo esc_html( $instruction_group['name'] ); ?></span>
|
123 |
+
<?php endif; // instruction group name. ?>
|
124 |
+
<?php foreach ( $instruction_group['instructions'] as $index => $instruction ) : ?>
|
125 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
126 |
+
<?php echo esc_html( ($index + 1) . ') ' . strip_shortcodes( wp_strip_all_tags( $instruction['text'] ) ) ); ?>
|
127 |
+
</span>
|
128 |
+
<?php endforeach; // instructions. ?>
|
129 |
+
</span>
|
130 |
+
<?php endforeach; // instruction groups. ?>
|
131 |
+
</span>
|
132 |
+
<?php endif; // instructions. ?>
|
133 |
+
|
134 |
+
<span contentEditable="false" style="display: block; font-size: 12px; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->notes() ) ) ); ?></span>
|
135 |
+
|
136 |
<span contentEditable="false" style="display: block; clear: both; height: 1px; line-height: 1px;"> </span>
|
templates/admin/settings/features.php
CHANGED
@@ -40,6 +40,17 @@
|
|
40 |
<?php endif; ?>
|
41 |
</td>
|
42 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
</tbody>
|
44 |
</table>
|
45 |
<h2 class="title"><?php esc_html_e( 'Premium Features', 'wp-recipe-maker' ); ?></h2>
|
40 |
<?php endif; ?>
|
41 |
</td>
|
42 |
</tr>
|
43 |
+
<tr>
|
44 |
+
<th scope="row">
|
45 |
+
<label for="features_manage_access"><?php esc_html_e( 'Access to Manage Page', 'wp-recipe-maker-premium' ); ?></label>
|
46 |
+
</th>
|
47 |
+
<td>
|
48 |
+
<input name="features_manage_access" type="text" id="features_manage_access" value="<?php echo esc_attr( WPRM_Settings::get( 'features_manage_access' ) ); ?>" class="regular-text">
|
49 |
+
<p class="description" id="tagline-features_manage_access">
|
50 |
+
<?php esc_html_e( 'Required capability to access the WP Recipe Maker > Manage page.', 'wp-recipe-maker-premium' ); ?>
|
51 |
+
</p>
|
52 |
+
</td>
|
53 |
+
</tr>
|
54 |
</tbody>
|
55 |
</table>
|
56 |
<h2 class="title"><?php esc_html_e( 'Premium Features', 'wp-recipe-maker' ); ?></h2>
|
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.14.0
|
19 |
* Author: Bootstrapped Ventures
|
20 |
* Author URI: http://bootstrapped.ventures/
|
21 |
* License: GPL-2.0+
|