WP Recipe Maker - Version 1.18.0

Version Description

  • Feature: Add custom styling to the recipe print page
  • Feature: Bulk delete ingredients
  • Improvement: Easy edit and view links for imported recipes
  • Fix: Prevent jumping to the top on the manage page
  • Fix: Print URL without trailing slash
Download this release

Release Info

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

Code changes from version 1.17.1 to 1.18.0

assets/css/admin/import.min.css CHANGED
@@ -1 +1 @@
1
- .wprm-import p{max-width:600px}.wprm-import .wprm-import-error{max-width:600px;border:1px solid #8b0000;background-color:#ff9f9f;padding:10px}.wprm-import .wprm-import-recipes{width:100%}.wprm-import .wprm-import-recipes td:nth-child(1){width:2%}
1
+ .wprm-import p{max-width:600px}.wprm-import .wprm-import-error{max-width:600px;border:1px solid #8b0000;background-color:#ff9f9f;padding:10px}.wprm-import .wprm-import-recipes{width:100%}.wprm-import .wprm-import-recipes input[type=checkbox]{vertical-align:top}.wprm-import .wprm-import-recipes a{text-decoration:none}.wprm-import .wprm-import-recipes .dashicons.dashicons-visibility{font-size:18px}.wprm-import .wprm-import-recipes td:nth-child(1){width:2%}.wprm-import .wprm-import-recipes td:nth-child(2){width:30%}
assets/css/admin/import.scss CHANGED
@@ -13,10 +13,25 @@
13
  .wprm-import-recipes {
14
  width: 100%;
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  td {
17
  &:nth-child(1) {
18
  width: 2%;
19
  }
 
 
 
20
  }
21
  }
22
  }
13
  .wprm-import-recipes {
14
  width: 100%;
15
 
16
+ input[type="checkbox"] {
17
+ vertical-align: top;
18
+ }
19
+
20
+ a {
21
+ text-decoration: none;
22
+ }
23
+
24
+ .dashicons.dashicons-visibility {
25
+ font-size: 18px;
26
+ }
27
+
28
  td {
29
  &:nth-child(1) {
30
  width: 2%;
31
  }
32
+ &:nth-child(2) {
33
+ width: 30%;
34
+ }
35
  }
36
  }
37
  }
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;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 .wprm-manage-recipes-seo{margin:0 auto;width:15px;height:15px;border:1px solid #444;border-radius:50%}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-bad{background-color:#e74c3c}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-warning{background-color:#e67e22}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-rating{background-color:#f1c40f}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-good{background-color:#27ae60}.wprm-manage .wprm-manage-recipes-seo:hover{cursor:pointer}.wprm-manage .wprm-manage-recipes-seo-tooltip{display:none}.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-header{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 .wprm-manage-recipes-seo{margin:0 auto;width:15px;height:15px;border:1px solid #444;border-radius:50%}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-bad{background-color:#e74c3c}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-warning{background-color:#e67e22}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-rating{background-color:#f1c40f}.wprm-manage .wprm-manage-recipes-seo.wprm-manage-recipes-seo-good{background-color:#27ae60}.wprm-manage .wprm-manage-recipes-seo:hover{cursor:pointer}.wprm-manage .wprm-manage-recipes-seo-tooltip{display:none}.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
@@ -1,8 +1,10 @@
1
  .wprm-manage {
2
 
3
- .wprm-manage-recipes-filters {
4
  margin-top: 20px;
5
-
 
 
6
  .wprm-manage-recipes-filter,
7
  .select2_wprm-container {
8
  margin-left: 5px;
1
  .wprm-manage {
2
 
3
+ .wprm-manage-header {
4
  margin-top: 20px;
5
+ }
6
+
7
+ .wprm-manage-recipes-filters {
8
  .wprm-manage-recipes-filter,
9
  .select2_wprm-container {
10
  margin-left: 5px;
assets/js/admin/import.js CHANGED
@@ -65,4 +65,15 @@ jQuery(document).ready(function($) {
65
 
66
  window.location = url;
67
  });
 
 
 
 
 
 
 
 
 
 
 
68
  });
65
 
66
  window.location = url;
67
  });
68
+
69
+ // Edit imported recipe
70
+ jQuery(document).on('click', '.wprm-manage-recipes-actions-edit', function(e) {
71
+ e.preventDefault();
72
+
73
+ var id = jQuery(this).data('id');
74
+
75
+ wprm_admin.open_modal(false, {
76
+ recipe_id: id
77
+ });
78
+ });
79
  });
assets/js/admin/manage.js CHANGED
@@ -28,6 +28,19 @@ wprm_admin.delete_or_merge_term = function(term_id, taxonomy, new_term_id) {
28
  });
29
  };
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  wprm_admin.delete_recipe = function(recipe_id) {
32
  var data = {
33
  action: 'wprm_delete_recipe',
@@ -215,7 +228,9 @@ jQuery(document).ready(function($) {
215
  }
216
  } );
217
 
218
- jQuery(document).on('click', '.wprm-manage-recipes-seo', function() {
 
 
219
  var id = jQuery(this).data('id');
220
 
221
  wprm_admin.open_modal(false, {
@@ -223,14 +238,18 @@ jQuery(document).ready(function($) {
223
  });
224
  });
225
 
226
- jQuery(document).on('change', '.wprm-manage-ingredients-link-nofollow', function() {
 
 
227
  var id = jQuery(this).data('id'),
228
  nofollow = jQuery(this).val();
229
 
230
  wprm_admin.update_term_metadata(id, 'ingredient_link_nofollow', nofollow);
231
  });
232
 
233
- jQuery(document).on('click', '.wprm-manage-ingredients-actions-link', function() {
 
 
234
  var id = jQuery(this).data('id'),
235
  name = jQuery('#wprm-manage-ingredients-name-' + id).text(),
236
  link_container = jQuery('#wprm-manage-ingredients-link-' + id),
@@ -240,7 +259,9 @@ jQuery(document).ready(function($) {
240
  wprm_admin.update_term_metadata(id, 'ingredient_link', new_link);
241
  });
242
 
243
- jQuery(document).on('click', '.wprm-manage-ingredients-actions-merge', function() {
 
 
244
  var id = jQuery(this).data('id'),
245
  name = jQuery('#wprm-manage-ingredients-name-' + id).text();
246
 
@@ -250,7 +271,9 @@ jQuery(document).ready(function($) {
250
  }
251
  });
252
 
253
- jQuery(document).on('click', '.wprm-manage-taxonomies-actions-merge', function() {
 
 
254
  var id = jQuery(this).data('id'),
255
  name = jQuery('#wprm-manage-taxonomies-name-' + id).text(),
256
  taxonomy = jQuery('.wprm-manage-taxonomies').data('taxonomy');
@@ -261,12 +284,16 @@ jQuery(document).ready(function($) {
261
  }
262
  });
263
 
264
- jQuery(document).on('click', '.wprm-manage-ingredients-actions-delete', function() {
 
 
265
  var id = jQuery(this).data('id');
266
  wprm_admin.delete_or_merge_term(id, 'ingredient', 0);
267
  });
268
 
269
- jQuery(document).on('click', '.wprm-manage-taxonomies-actions-delete', function() {
 
 
270
  var id = jQuery(this).data('id'),
271
  name = jQuery('#wprm-manage-taxonomies-name-' + id).text(),
272
  taxonomy = jQuery('.wprm-manage-taxonomies').data('taxonomy');
@@ -276,7 +303,9 @@ jQuery(document).ready(function($) {
276
  }
277
  });
278
 
279
- jQuery(document).on('click', '.wprm-manage-recipes-actions-edit', function() {
 
 
280
  var id = jQuery(this).data('id');
281
 
282
  wprm_admin.open_modal(false, {
@@ -284,7 +313,9 @@ jQuery(document).ready(function($) {
284
  });
285
  });
286
 
287
- jQuery(document).on('click', '.wprm-manage-recipes-actions-delete', function() {
 
 
288
  var id = jQuery(this).data('id'),
289
  name = jQuery('#wprm-manage-recipes-name-' + id).text();
290
 
@@ -292,4 +323,19 @@ jQuery(document).ready(function($) {
292
  wprm_admin.delete_recipe(id);
293
  }
294
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  });
28
  });
29
  };
30
 
31
+ wprm_admin.delete_terms = function(term_ids, taxonomy) {
32
+ var data = {
33
+ action: 'wprm_delete_terms',
34
+ security: wprm_manage.nonce,
35
+ term_ids: term_ids,
36
+ taxonomy: taxonomy
37
+ };
38
+
39
+ jQuery.post(wprm_manage.ajax_url, data, function() {
40
+ jQuery('.wprm-manage-datatable').DataTable().ajax.reload(null, false);
41
+ });
42
+ };
43
+
44
  wprm_admin.delete_recipe = function(recipe_id) {
45
  var data = {
46
  action: 'wprm_delete_recipe',
228
  }
229
  } );
230
 
231
+ jQuery(document).on('click', '.wprm-manage-recipes-seo', function(e) {
232
+ e.preventDefault();
233
+
234
  var id = jQuery(this).data('id');
235
 
236
  wprm_admin.open_modal(false, {
238
  });
239
  });
240
 
241
+ jQuery(document).on('change', '.wprm-manage-ingredients-link-nofollow', function(e) {
242
+ e.preventDefault();
243
+
244
  var id = jQuery(this).data('id'),
245
  nofollow = jQuery(this).val();
246
 
247
  wprm_admin.update_term_metadata(id, 'ingredient_link_nofollow', nofollow);
248
  });
249
 
250
+ jQuery(document).on('click', '.wprm-manage-ingredients-actions-link', function(e) {
251
+ e.preventDefault();
252
+
253
  var id = jQuery(this).data('id'),
254
  name = jQuery('#wprm-manage-ingredients-name-' + id).text(),
255
  link_container = jQuery('#wprm-manage-ingredients-link-' + id),
259
  wprm_admin.update_term_metadata(id, 'ingredient_link', new_link);
260
  });
261
 
262
+ jQuery(document).on('click', '.wprm-manage-ingredients-actions-merge', function(e) {
263
+ e.preventDefault();
264
+
265
  var id = jQuery(this).data('id'),
266
  name = jQuery('#wprm-manage-ingredients-name-' + id).text();
267
 
271
  }
272
  });
273
 
274
+ jQuery(document).on('click', '.wprm-manage-taxonomies-actions-merge', function(e) {
275
+ e.preventDefault();
276
+
277
  var id = jQuery(this).data('id'),
278
  name = jQuery('#wprm-manage-taxonomies-name-' + id).text(),
279
  taxonomy = jQuery('.wprm-manage-taxonomies').data('taxonomy');
284
  }
285
  });
286
 
287
+ jQuery(document).on('click', '.wprm-manage-ingredients-actions-delete', function(e) {
288
+ e.preventDefault();
289
+
290
  var id = jQuery(this).data('id');
291
  wprm_admin.delete_or_merge_term(id, 'ingredient', 0);
292
  });
293
 
294
+ jQuery(document).on('click', '.wprm-manage-taxonomies-actions-delete', function(e) {
295
+ e.preventDefault();
296
+
297
  var id = jQuery(this).data('id'),
298
  name = jQuery('#wprm-manage-taxonomies-name-' + id).text(),
299
  taxonomy = jQuery('.wprm-manage-taxonomies').data('taxonomy');
303
  }
304
  });
305
 
306
+ jQuery(document).on('click', '.wprm-manage-recipes-actions-edit', function(e) {
307
+ e.preventDefault();
308
+
309
  var id = jQuery(this).data('id');
310
 
311
  wprm_admin.open_modal(false, {
313
  });
314
  });
315
 
316
+ jQuery(document).on('click', '.wprm-manage-recipes-actions-delete', function(e) {
317
+ e.preventDefault();
318
+
319
  var id = jQuery(this).data('id'),
320
  name = jQuery('#wprm-manage-recipes-name-' + id).text();
321
 
323
  wprm_admin.delete_recipe(id);
324
  }
325
  });
326
+
327
+ jQuery(document).on('click', '.wprm-manage-ingredients-bulk-delete', function(e) {
328
+ e.preventDefault();
329
+
330
+ var ingredients = jQuery('.wprm-manage-ingredients-bulk:checkbox:checked');
331
+ var ids = [];
332
+
333
+ ingredients.each(function() {
334
+ ids.push(parseInt(jQuery(this).val()));
335
+ });
336
+
337
+ if(ids.length > 0) {
338
+ wprm_admin.delete_terms(ids, 'ingredient', 0);
339
+ }
340
+ });
341
  });
assets/js/admin/modal.js CHANGED
@@ -38,7 +38,9 @@ wprm_admin.close_modal = function() {
38
  };
39
 
40
  wprm_admin.shortcode_escape_map = {
41
- '"': "'"
 
 
42
  };
43
 
44
  wprm_admin.shortcode_escape = function(text) {
38
  };
39
 
40
  wprm_admin.shortcode_escape_map = {
41
+ '"': "'",
42
+ '[': '{',
43
+ ']': '}'
44
  };
45
 
46
  wprm_admin.shortcode_escape = function(text) {
includes/admin/manage/class-wprm-manage-ingredients.php CHANGED
@@ -121,6 +121,10 @@ class WPRM_Manage_Ingredients {
121
  $terms = get_terms( $args );
122
 
123
  foreach ( $terms as $term ) {
 
 
 
 
124
  // Link to recipes.
125
  $recipes_url = add_query_arg( array(
126
  'sub' => 'recipes',
@@ -155,7 +159,7 @@ class WPRM_Manage_Ingredients {
155
  }
156
 
157
  $data[] = array(
158
- $term->term_id,
159
  '<span id="wprm-manage-ingredients-name-' . esc_attr( $term->term_id ) . '">' . $term->name . '</span>',
160
  '<a href="' . $recipes_url . '">' . $term->count . '</a>',
161
  '<span id="wprm-manage-ingredients-link-' . esc_attr( $term->term_id ) . '"><a href="' . esc_url( $link ) . '" target="_blank">' . esc_url( $link ) . '</a></span>',
121
  $terms = get_terms( $args );
122
 
123
  foreach ( $terms as $term ) {
124
+ // Bulk delete checkbox.
125
+ $checkbox_disabled = $term->count > 0 ? ' disabled="disabled"' : '';
126
+ $checkbox = '<input type="checkbox" class="wprm-manage-ingredients-bulk" id="wprm-manage-ingredients-bulk-' . esc_attr( $term->term_id ) . '" value="' . esc_attr( $term->term_id ) . '"' . $checkbox_disabled . '>';
127
+
128
  // Link to recipes.
129
  $recipes_url = add_query_arg( array(
130
  'sub' => 'recipes',
159
  }
160
 
161
  $data[] = array(
162
+ $checkbox . ' <label for="wprm-manage-ingredients-bulk-' . esc_attr( $term->term_id ) . '">' . $term->term_id . '</label>',
163
  '<span id="wprm-manage-ingredients-name-' . esc_attr( $term->term_id ) . '">' . $term->name . '</span>',
164
  '<a href="' . $recipes_url . '">' . $term->count . '</a>',
165
  '<span id="wprm-manage-ingredients-link-' . esc_attr( $term->term_id ) . '"><a href="' . esc_url( $link ) . '" target="_blank">' . esc_url( $link ) . '</a></span>',
includes/admin/manage/class-wprm-manage.php CHANGED
@@ -33,6 +33,7 @@ class WPRM_Manage {
33
  add_action( 'wp_ajax_wprm_manage_datatable', array( __CLASS__, 'ajax_manage_datatable' ) );
34
  add_action( 'wp_ajax_wprm_update_term_metadata', array( __CLASS__, 'ajax_update_term_metadata' ) );
35
  add_action( 'wp_ajax_wprm_delete_or_merge_term', array( __CLASS__, 'ajax_delete_or_merge_term' ) );
 
36
  add_action( 'wp_ajax_wprm_delete_recipe', array( __CLASS__, 'ajax_delete_recipe' ) );
37
  }
38
 
@@ -127,6 +128,38 @@ class WPRM_Manage {
127
  wp_die();
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  /**
131
  * Merge terms for all recipes using them.
132
  *
33
  add_action( 'wp_ajax_wprm_manage_datatable', array( __CLASS__, 'ajax_manage_datatable' ) );
34
  add_action( 'wp_ajax_wprm_update_term_metadata', array( __CLASS__, 'ajax_update_term_metadata' ) );
35
  add_action( 'wp_ajax_wprm_delete_or_merge_term', array( __CLASS__, 'ajax_delete_or_merge_term' ) );
36
+ add_action( 'wp_ajax_wprm_delete_terms', array( __CLASS__, 'ajax_delete_terms' ) );
37
  add_action( 'wp_ajax_wprm_delete_recipe', array( __CLASS__, 'ajax_delete_recipe' ) );
38
  }
39
 
128
  wp_die();
129
  }
130
 
131
+ /**
132
+ * Delete nultiple terms at once through AJAX.
133
+ *
134
+ * @since 1.18.0
135
+ */
136
+ public static function ajax_delete_terms() {
137
+ if ( check_ajax_referer( 'wprm', 'security', false ) ) {
138
+ $term_ids = isset( $_POST['term_ids'] ) ? array_map( 'intval', $_POST['term_ids'] ) : 0; // Input var okay.
139
+ $taxonomy = isset( $_POST['taxonomy'] ) ? sanitize_key( wp_unslash( $_POST['taxonomy'] ) ) : ''; // Input var okay.
140
+
141
+ // This ensures were only chaning our own taxonomies.
142
+ $taxonomy = 'wprm_' . $taxonomy;
143
+
144
+ if ( !empty( $term_ids ) ) {
145
+
146
+ foreach ( $term_ids as $term_id ) {
147
+ $term = get_term( $term_id, $taxonomy );
148
+
149
+ // Check if this is one of our taxonomies.
150
+ if ( $term && ! is_wp_error( $term ) ) {
151
+ // Make sure this ingredient is not used anymore before deleting.
152
+ if ( 'wprm_ingredient' !== $taxonomy || 0 === $term->count ) {
153
+ wp_delete_term( $term->term_id, $taxonomy );
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ wp_die();
161
+ }
162
+
163
  /**
164
  * Merge terms for all recipes using them.
165
  *
includes/public/class-wprm-print.php CHANGED
@@ -55,13 +55,18 @@ class WPRM_Print {
55
  * @since 1.3.0
56
  */
57
  public static function print_page() {
58
- preg_match( '/\/wprm_print\/(\d+)$/', $_SERVER['REQUEST_URI'], $print_url ); // Input var okay.
59
  $recipe_id = isset( $print_url[1] ) ? intval( $print_url[1] ) : false;
60
  if ( $recipe_id && WPRM_POST_TYPE === get_post_type( $recipe_id ) ) {
61
  $recipe = WPRM_Recipe_Manager::get_recipe( $recipe_id );
62
 
63
  $styles = WPRM_Template_Manager::get_template_styles( $recipe, 'print' );
64
  $styles .= '<style>body { position: relative; padding-bottom: 30px; } #wprm-print-footer { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 0.8em; }</style>';
 
 
 
 
 
65
  if ( WPRM_Addons::is_active( 'premium' ) ) {
66
  $styles .= '<link rel="stylesheet" type="text/css" href="' . WPRMP_URL . 'assets/css/public/public.min.css"/>';
67
  }
55
  * @since 1.3.0
56
  */
57
  public static function print_page() {
58
+ preg_match( '/\/wprm_print\/(\d+)\/?$/', $_SERVER['REQUEST_URI'], $print_url ); // Input var okay.
59
  $recipe_id = isset( $print_url[1] ) ? intval( $print_url[1] ) : false;
60
  if ( $recipe_id && WPRM_POST_TYPE === get_post_type( $recipe_id ) ) {
61
  $recipe = WPRM_Recipe_Manager::get_recipe( $recipe_id );
62
 
63
  $styles = WPRM_Template_Manager::get_template_styles( $recipe, 'print' );
64
  $styles .= '<style>body { position: relative; padding-bottom: 30px; } #wprm-print-footer { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 0.8em; }</style>';
65
+
66
+ if ( WPRM_Settings::get( 'print_css' ) ) {
67
+ $styles .= '<style>' . WPRM_Settings::get( 'print_css' ) . '</style>';
68
+ }
69
+
70
  if ( WPRM_Addons::is_active( 'premium' ) ) {
71
  $styles .= '<link rel="stylesheet" type="text/css" href="' . WPRMP_URL . 'assets/css/public/public.min.css"/>';
72
  }
includes/public/class-wprm-settings.php CHANGED
@@ -66,6 +66,9 @@ class WPRM_Settings {
66
  'features_custom_style' => true,
67
  // Features Premium.
68
  'features_adjustable_servings' => true,
 
 
 
69
  );
70
 
71
  /**
@@ -79,6 +82,7 @@ class WPRM_Settings {
79
  add_action( 'admin_post_wprm_settings_appearance', array( __CLASS__, 'form_save_settings_appearance' ) );
80
  add_action( 'admin_post_wprm_settings_labels', array( __CLASS__, 'form_save_settings_labels' ) );
81
  add_action( 'admin_post_wprm_settings_features', array( __CLASS__, 'form_save_settings_features' ) );
 
82
 
83
  add_action( 'wprm_settings_page', array( __CLASS__, 'settings_page' ) );
84
  }
@@ -117,6 +121,8 @@ class WPRM_Settings {
117
  require_once( WPRM_DIR . 'templates/admin/settings/labels.php' );
118
  } elseif ( 'features' === $sub ) {
119
  require_once( WPRM_DIR . 'templates/admin/settings/features.php' );
 
 
120
  }
121
  }
122
 
@@ -331,6 +337,27 @@ class WPRM_Settings {
331
  wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings&sub=features' ) );
332
  exit();
333
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
335
 
336
  WPRM_Settings::init();
66
  'features_custom_style' => true,
67
  // Features Premium.
68
  'features_adjustable_servings' => true,
69
+ // Advanced.
70
+ 'recipe_css' => '',
71
+ 'print_css' => '',
72
  );
73
 
74
  /**
82
  add_action( 'admin_post_wprm_settings_appearance', array( __CLASS__, 'form_save_settings_appearance' ) );
83
  add_action( 'admin_post_wprm_settings_labels', array( __CLASS__, 'form_save_settings_labels' ) );
84
  add_action( 'admin_post_wprm_settings_features', array( __CLASS__, 'form_save_settings_features' ) );
85
+ add_action( 'admin_post_wprm_settings_advanced', array( __CLASS__, 'form_save_settings_advanced' ) );
86
 
87
  add_action( 'wprm_settings_page', array( __CLASS__, 'settings_page' ) );
88
  }
121
  require_once( WPRM_DIR . 'templates/admin/settings/labels.php' );
122
  } elseif ( 'features' === $sub ) {
123
  require_once( WPRM_DIR . 'templates/admin/settings/features.php' );
124
+ } elseif ( 'advanced' === $sub ) {
125
+ require_once( WPRM_DIR . 'templates/admin/settings/advanced.php' );
126
  }
127
  }
128
 
337
  wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings&sub=features' ) );
338
  exit();
339
  }
340
+
341
+ /**
342
+ * Save the advanced settings.
343
+ *
344
+ * @since 1.7.0
345
+ */
346
+ public static function form_save_settings_advanced() {
347
+ if ( isset( $_POST['wprm_settings'] ) && wp_verify_nonce( sanitize_key( $_POST['wprm_settings'] ), 'wprm_settings' ) ) { // Input var okay.
348
+ $recipe_css = isset( $_POST['recipe_css'] ) ? wp_kses_post( wp_unslash( $_POST['recipe_css'] ) ) : ''; // Input var okay.
349
+ $print_css = isset( $_POST['print_css'] ) ? wp_kses_post( wp_unslash( $_POST['print_css'] ) ) : ''; // Input var okay.
350
+
351
+ $settings = array();
352
+
353
+ $settings['recipe_css'] = $recipe_css;
354
+ $settings['print_css'] = $print_css;
355
+
356
+ self::update_settings( $settings );
357
+ }
358
+ wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings&sub=advanced' ) );
359
+ exit();
360
+ }
361
  }
362
 
363
  WPRM_Settings::init();
includes/public/class-wprm-template-manager.php CHANGED
@@ -96,6 +96,9 @@ class WPRM_Template_Manager {
96
  $output .= ' .wprm-comment-rating svg path, .comment-form-wprm-rating svg path { fill: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
97
  $output .= ' .wprm-comment-rating svg polygon, .comment-form-wprm-rating svg polygon { stroke: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
98
 
 
 
 
99
  $output .= '</style>';
100
 
101
  echo $output;
96
  $output .= ' .wprm-comment-rating svg path, .comment-form-wprm-rating svg path { fill: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
97
  $output .= ' .wprm-comment-rating svg polygon, .comment-form-wprm-rating svg polygon { stroke: ' . WPRM_Settings::get( 'template_color_comment_rating' ) . '; }';
98
 
99
+ // Custom recipe CSS.
100
+ $output .= WPRM_Settings::get( 'recipe_css' );
101
+
102
  $output .= '</style>';
103
 
104
  echo $output;
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.3
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -97,6 +97,13 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
97
 
98
  == Changelog ==
99
 
 
 
 
 
 
 
 
100
  = 1.17.1 =
101
  * Fix: Ingredient import problem
102
 
@@ -285,6 +292,9 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
285
 
286
  == Upgrade notice ==
287
 
 
 
 
288
  = 1.17.1 =
289
  Update if you're importing recipes
290
 
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.4
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
97
 
98
  == Changelog ==
99
 
100
+ = 1.18.0 =
101
+ * Feature: Add custom styling to the recipe print page
102
+ * Feature: Bulk delete ingredients
103
+ * Improvement: Easy edit and view links for imported recipes
104
+ * Fix: Prevent jumping to the top on the manage page
105
+ * Fix: Print URL without trailing slash
106
+
107
  = 1.17.1 =
108
  * Fix: Ingredient import problem
109
 
292
 
293
  == Upgrade notice ==
294
 
295
+ = 1.18.0 =
296
+ Update to easily customize the recipe print page
297
+
298
  = 1.17.1 =
299
  Update if you're importing recipes
300
 
templates/admin/manage/ingredients.php CHANGED
@@ -15,6 +15,10 @@ if ( ! function_exists( 'get_term_meta' ) ) {
15
 
16
  ?>
17
 
 
 
 
 
18
  <table id="wprm-manage-ingredients" class="wprm-manage-datatable" cellspacing="0" width="100%">
19
  <thead>
20
  <tr>
15
 
16
  ?>
17
 
18
+ <div class="wprm-manage-header">
19
+ <button type="button" class="button button-primary wprm-manage-ingredients-bulk-delete"><?php esc_html_e( 'Delete selected Ingredients', 'wp-recipe-maker' ); ?></button>
20
+ </div>
21
+
22
  <table id="wprm-manage-ingredients" class="wprm-manage-datatable" cellspacing="0" width="100%">
23
  <thead>
24
  <tr>
templates/admin/manage/recipes.php CHANGED
@@ -10,7 +10,7 @@
10
  */
11
 
12
  ?>
13
- <div class="wprm-manage-recipes-filters">
14
  <?php
15
  esc_html_e( 'Filter', 'wp-recipe-maker' );
16
  $taxonomies = WPRM_Taxonomies::get_taxonomies( true );
10
  */
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 );
templates/admin/menu/faq/whats_new.php CHANGED
@@ -11,6 +11,15 @@
11
 
12
  ?>
13
 
 
 
 
 
 
 
 
 
 
14
  <h3>2017-04-11 | WP Recipe Maker Premium 1.4.0</h3>
15
  <ul>
16
  <li>Feature: Text field display for servings changer</li>
11
 
12
  ?>
13
 
14
+ <h3>2017-05-11 | WP Recipe Maker 1.18.0</h3>
15
+ <ul>
16
+ <li>Feature: Add custom styling to the recipe print page</li>
17
+ <li>Feature: Bulk delete ingredients</li>
18
+ <li>Improvement: Easy edit and view links for imported recipes</li>
19
+ <li>Fix: Prevent jumping to the top on the manage page</li>
20
+ <li>Fix: Print URL without trailing slash</li>
21
+ </ul>
22
+
23
  <h3>2017-04-11 | WP Recipe Maker Premium 1.4.0</h3>
24
  <ul>
25
  <li>Feature: Text field display for servings changer</li>
templates/admin/menu/import/import-overview.php CHANGED
@@ -99,11 +99,14 @@
99
  <td>
100
  <input type="checkbox" name="recipes[]" value="<?php echo esc_attr( $recipe->id() ); ?>" />
101
  </td>
 
 
 
102
  <td>
103
  <?php if ( $recipe->parent_post_id() > 0 ) : ?>
104
- <a href="<?php echo esc_url( get_edit_post_link( $recipe->parent_post_id() ) ); ?>" target="_blank"><?php echo esc_html( $recipe->name() ); ?></a>
105
  <?php else : ?>
106
- <?php echo esc_html( $recipe->name() . ' (' . __( 'no parent post found', 'wp-recipe-maker' ) . ')' ); ?>
107
  <?php endif; // Parent Post ID. ?>
108
  </td>
109
  </tr>
@@ -115,3 +118,8 @@
115
  <?php endforeach; // Each importer. ?>
116
  <?php endif; // Recipes to import. ?>
117
  </div>
 
 
 
 
 
99
  <td>
100
  <input type="checkbox" name="recipes[]" value="<?php echo esc_attr( $recipe->id() ); ?>" />
101
  </td>
102
+ <td>
103
+ <a href="#" class="wprm-manage-recipes-actions-edit" data-id="<?php echo esc_attr( $recipe->id() ); ?>"><span class="dashicons dashicons-edit"></span></a> <?php echo esc_html( $recipe->name() ); ?>
104
+ </td>
105
  <td>
106
  <?php if ( $recipe->parent_post_id() > 0 ) : ?>
107
+ <a href="<?php echo esc_url( get_edit_post_link( $recipe->parent_post_id() ) ); ?>" target="_blank"><span class="dashicons dashicons-edit"></span></a> <a href="<?php echo esc_url( get_permalink( $recipe->parent_post_id() ) ); ?>" target="_blank"><span class="dashicons dashicons-visibility"></span></a> <?php echo get_the_title( $recipe->parent_post_id() ); ?>
108
  <?php else : ?>
109
+ <?php esc_html_e( 'no parent post found', 'wp-recipe-maker' ); ?>
110
  <?php endif; // Parent Post ID. ?>
111
  </td>
112
  </tr>
118
  <?php endforeach; // Each importer. ?>
119
  <?php endif; // Recipes to import. ?>
120
  </div>
121
+
122
+ <?php
123
+ $menu = WPRM_Modal::get_modal_menu();
124
+ require_once( WPRM_DIR . 'templates/admin/modal/modal.php' );
125
+ ?>
templates/admin/modal/tabs/recipe-details.php CHANGED
@@ -81,6 +81,10 @@
81
  <label for="wprm-recipe-total-time"><?php esc_html_e( 'Total Time', 'wp-recipe-maker' ); ?></label>
82
  <input type="number" id="wprm-recipe-total-time" class="wprm-recipe-time" placeholder="30" min="0" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
83
  </div>
 
 
 
 
84
  <?php
85
  $taxonomies = WPRM_Taxonomies::get_taxonomies();
86
 
81
  <label for="wprm-recipe-total-time"><?php esc_html_e( 'Total Time', 'wp-recipe-maker' ); ?></label>
82
  <input type="number" id="wprm-recipe-total-time" class="wprm-recipe-time" placeholder="30" min="0" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
83
  </div>
84
+ <div class='wprm-modal-hint'>
85
+ <span class="wprm-modal-hint-header"><?php esc_html_e( 'Hint', 'wp-recipe-maker' ); ?></span>
86
+ <span class="wprm-modal-hint-text"><?php esc_html_e( 'Your recipe template will automatically use hours.', 'wp-recipe-maker' ); ?></span>
87
+ </div>
88
  <?php
89
  $taxonomies = WPRM_Taxonomies::get_taxonomies();
90
 
templates/admin/settings.php CHANGED
@@ -16,6 +16,7 @@ $tabs = apply_filters( 'wprm_settings_tabs', array(
16
  'appearance' => __( 'Appearance', 'wp-recipe-maker' ),
17
  'labels' => __( 'Labels', 'wp-recipe-maker' ),
18
  'features' => __( 'Features', 'wp-recipe-maker' ),
 
19
  ) );
20
 
21
  if ( ! array_key_exists( $sub, $tabs ) ) {
16
  'appearance' => __( 'Appearance', 'wp-recipe-maker' ),
17
  'labels' => __( 'Labels', 'wp-recipe-maker' ),
18
  'features' => __( 'Features', 'wp-recipe-maker' ),
19
+ 'advanced' => __( 'Advanced', 'wp-recipe-maker' ),
20
  ) );
21
 
22
  if ( ! array_key_exists( $sub, $tabs ) ) {
templates/admin/settings/advanced.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for the advanced settings sub page.
4
+ *
5
+ * @link http://bootstrapped.ventures
6
+ * @since 1.0.0
7
+ *
8
+ * @package WP_Recipe_Maker
9
+ * @subpackage WP_Recipe_Maker/templates/admin/settings
10
+ */
11
+
12
+ ?>
13
+
14
+ <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
15
+ <input type="hidden" name="action" value="wprm_settings_advanced">
16
+ <?php wp_nonce_field( 'wprm_settings', 'wprm_settings', false ); ?>
17
+ <h2 class="title"><?php esc_html_e( 'Custom Styling', 'wp-recipe-maker' ); ?></h2>
18
+ <p>
19
+ <?php esc_html_e( 'Add your own CSS for styling the plugin.', 'wp-recipe-maker' ); ?>
20
+ </p>
21
+ <table class="form-table">
22
+ <tbody>
23
+ <?php if ( WPRM_Settings::get( 'features_custom_style' ) ) : ?>
24
+ <tr>
25
+ <th scope="row">
26
+ <label for="recipe_css"><?php esc_html_e( 'Recipe CSS', 'wp-recipe-maker' ); ?></label>
27
+ </th>
28
+ <td>
29
+ <textarea name="recipe_css" rows="8" cols="50" id="recipe_css" class="large-text code"><?php echo esc_html( WPRM_Settings::get( 'recipe_css' ) ); ?></textarea>
30
+ </td>
31
+ </tr>
32
+ <?php endif; ?>
33
+ <tr>
34
+ <th scope="row">
35
+ <label for="print_css"><?php esc_html_e( 'Recipe Print CSS', 'wp-recipe-maker' ); ?></label>
36
+ </th>
37
+ <td>
38
+ <textarea name="print_css" rows="8" cols="50" id="print_css" class="large-text code"><?php echo esc_html( WPRM_Settings::get( 'print_css' ) ); ?></textarea>
39
+ </td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
43
+ <?php submit_button( __( 'Save Changes', 'wp-recipe-maker' ) ); ?>
44
+ </form>
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.17.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.18.0
19
  * Author: Bootstrapped Ventures
20
  * Author URI: http://bootstrapped.ventures/
21
  * License: GPL-2.0+