public function split_shared_term($old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
 {
     // Recipe Grid
     if (WPUltimateRecipe::is_addon_active('recipe-grid')) {
         WPUltimateRecipe::addon('recipe-grid')->updated_terms($new_term_id, 'ingredient');
     }
 }
function wpurp_admin_template_editor()
{
    if (WPUltimateRecipe::is_addon_active('template-editor')) {
        $url = WPUltimateRecipe::addon('template-editor')->editor_url();
        $url .= '#?dir=' . urlencode(ABSPATH);
        $button = '<a href="' . $url . '" class="button button-primary" target="_blank">' . __('Open the Template Editor', 'wp-ultimate-recipe') . '</a>';
    } else {
        $button = '<a href="#" class="button button-primary button-disabled" disabled>' . __('Open the Template Editor', 'wp-ultimate-recipe') . '</a>';
    }
    return $button;
}
示例#3
0
    public function output($recipe, $args = array())
    {
        if (!$this->output_block($recipe, $args)) {
            return '';
        }
        if (!is_user_logged_in() || !WPUltimateRecipe::is_addon_active('favorite-recipes')) {
            return '';
        }
        $current_icon = WPURP_Favorite_Recipes::is_favorite_recipe($recipe->ID()) ? $this->iconAlt : $this->icon;
        $icon = '<i class="fa ' . esc_attr($current_icon) . '" data-icon="' . esc_attr($this->icon) . '" data-icon-alt="' . esc_attr($this->iconAlt) . '"></i>';
        $tooltip_text = WPUltimateRecipe::option('favorite_recipes_tooltip_text', __('Add to your Favorite Recipes', 'wp-ultimate-recipe'));
        $tooltip_alt_text = WPUltimateRecipe::option('favorited_recipes_tooltip_text', __('This recipe is in your Favorite Recipes', 'wp-ultimate-recipe'));
        if ($tooltip_text && $tooltip_alt_text) {
            $this->classes = array('recipe-tooltip');
        }
        if (WPURP_Favorite_Recipes::is_favorite_recipe($recipe->ID())) {
            $tooltip_text_backup = $tooltip_text;
            $tooltip_text = $tooltip_alt_text;
            $tooltip_alt_text = $tooltip_text_backup;
        }
        $output = $this->before_output();
        ob_start();
        ?>
<a href="#"<?php 
        echo $this->style();
        ?>
 data-recipe-id="<?php 
        echo $recipe->ID();
        ?>
"><?php 
        echo $icon;
        ?>
</a>
<?php 
        if ($tooltip_text && $tooltip_alt_text) {
            ?>
    <div class="recipe-tooltip-content">
        <div class="tooltip-shown"><?php 
            echo $tooltip_text;
            ?>
</div>
        <div class="tooltip-alt"><?php 
            echo $tooltip_alt_text;
            ?>
</div>
    </div>
<?php 
        }
        $output .= ob_get_contents();
        ob_end_clean();
        return $this->after_output($output, $recipe);
    }
示例#4
0
 public function output($recipe, $args = array())
 {
     if (!$this->output_block($recipe, $args)) {
         return '';
     }
     if (WPUltimateRecipe::is_addon_active('user-ratings') && WPUltimateRecipe::option('user_ratings_enable', 'everyone') != 'disabled') {
         $stars = WPUltimateRecipe::addon('user-ratings')->output($recipe);
     } else {
         $stars = $this->stars_author($recipe);
     }
     $output = $this->before_output();
     $output .= '<span' . $this->style() . '>' . $stars . '</span>';
     return $this->after_output($output, $recipe);
 }
 public function output($recipe, $args = array())
 {
     if (!$this->output_block($recipe, $args)) {
         return '';
     }
     $output = $this->before_output();
     if (WPUltimateRecipe::option('recipe_adjustable_servings', '1') == '1') {
         if (WPUltimateRecipe::is_addon_active('unit-conversion')) {
             $output .= '<span' . $this->style() . '><input type="number" class="advanced-adjust-recipe-servings" data-original="' . $recipe->servings_normalized() . '" data-start-servings="' . $recipe->servings_normalized() . '" value="' . $recipe->servings_normalized() . '"' . $this->style('input') . '/> ' . $recipe->servings_type() . '</span>';
         } else {
             $output = '<span' . $this->style() . '><input type="number" class="adjust-recipe-servings" data-original="' . $recipe->servings_normalized() . '" data-start-servings="' . $recipe->servings_normalized() . '" value="' . $recipe->servings_normalized() . '"' . $this->style('input') . '/> ' . $recipe->servings_type() . '</span>';
         }
     }
     return $this->after_output($output, $recipe);
 }
 public function check_recipe_demo()
 {
     if (isset($_GET['wpurp_reset_demo_recipe'])) {
         update_option('wpurp_demo_recipe', false);
         WPUltimateRecipe::get()->helper('notices')->add_admin_notice('<strong>WP Ultimate Recipe</strong> The Recipe Demo has been reset');
     }
     if (!get_option('wpurp_demo_recipe', false)) {
         // Demo Recipe content
         $_POST = array('recipe_meta_box_nonce' => wp_create_nonce('recipe'), 'recipe_description' => __('This must be the best demo recipe I have ever seen. I could eat this every single day.', 'wp-ultimate-recipe'), 'recipe_rating' => '4', 'recipe_servings' => '2', 'recipe_servings_type' => __('people', 'wp-ultimate-recipe'), 'recipe_prep_time' => '10', 'recipe_prep_time_text' => __('minutes', 'wp-ultimate-recipe'), 'recipe_cook_time' => '20', 'recipe_cook_time_text' => __('minutes', 'wp-ultimate-recipe'), 'recipe_passive_time' => '1', 'recipe_passive_time_text' => __('hour', 'wp-ultimate-recipe'), 'recipe_ingredients' => array(array('group' => '', 'amount' => '175', 'unit' => 'g', 'ingredient' => 'tagliatelle', 'notes' => ''), array('group' => '', 'amount' => '200', 'unit' => 'g', 'ingredient' => 'bacon', 'notes' => 'tiny strips'), array('group' => 'Fresh Pesto', 'amount' => '1', 'unit' => 'clove', 'ingredient' => 'garlic', 'notes' => ''), array('group' => 'Fresh Pesto', 'amount' => '12.5', 'unit' => 'g', 'ingredient' => 'pine kernels', 'notes' => ''), array('group' => 'Fresh Pesto', 'amount' => '50', 'unit' => 'g', 'ingredient' => 'basil leaves', 'notes' => ''), array('group' => 'Fresh Pesto', 'amount' => '6.25', 'unit' => 'cl', 'ingredient' => 'olive oil', 'notes' => 'extra virgin'), array('group' => 'Fresh Pesto', 'amount' => '27.5', 'unit' => 'g', 'ingredient' => 'Parmesan cheese', 'notes' => 'freshly grated')), 'recipe_instructions' => array(array('group' => 'Fresh Pesto (you can make this in advance)', 'description' => 'We\'ll be using a food processor to make the pesto. Put the garlic, pine kernels and some salt in there and process briefly.', 'image' => ''), array('group' => 'Fresh Pesto (you can make this in advance)', 'description' => 'Add the basil leaves (but keep some for the presentation) and blend to a green paste.', 'image' => ''), array('group' => 'Fresh Pesto (you can make this in advance)', 'description' => 'While processing, gradually add the olive oil and finally add the Parmesan cheese.', 'image' => ''), array('group' => 'Finishing the dish', 'description' => 'Bring a pot of salted water to the boil and cook your tagliatelle al dente.', 'image' => ''), array('group' => 'Finishing the dish', 'description' => 'Use the cooking time of the pasta to sauté your bacon strips.', 'image' => ''), array('group' => 'Finishing the dish', 'description' => 'After about 8 to 10 minutes, the pasta should be done. Drain it and put it back in the pot to mix it with the pesto.', 'image' => ''), array('group' => 'Finishing the dish', 'description' => 'Present the dish with some fresh basil leaves on top.', 'image' => '')), 'recipe_notes' => __('Use this section for whatever you like.', 'wp-ultimate-recipe'));
         $post_content = '<p>' . __('Use this like normal post content. The recipe will automatically be included at the end of the post, or wherever you place the shortcode:', 'wp-ultimate-recipe') . '</p>[recipe]<br/><p>' . __('This text will appear below your recipe.', 'wp-ultimate-recipe');
         if (WPUltimateRecipe::is_addon_active('nutritional-information')) {
             $post_content .= ' ' . __('Followed by the nutrition label:', 'wp-ultimate-recipe') . '</p>[nutrition-label]<br/>';
         } else {
             $post_content .= '</p>';
         }
         // Insert post
         $post = array('post_title' => __('Demo Recipe', 'wp-ultimate-recipe'), 'post_content' => $post_content, 'post_type' => 'recipe', 'post_status' => 'private', 'post_author' => get_current_user_id());
         $post_id = wp_insert_post($post);
         update_option('wpurp_demo_recipe', $post_id);
         // Update post taxonomies
         $tags = array('cuisine' => array('Italian'), 'course' => array('Main Dish'));
         foreach ($tags as $tag => $terms) {
             $term_ids = array();
             foreach ($terms as $term) {
                 $existing_term = term_exists($term, $tag);
                 if ($existing_term == 0 || $existing_term == null) {
                     $new_term = wp_insert_term($term, $tag);
                     $term_ids[] = (int) $new_term['term_id'];
                 } else {
                     $term_ids[] = (int) $existing_term['term_id'];
                 }
             }
             wp_set_object_terms($post_id, $term_ids, $tag);
         }
         // Recipe image
         $url = WPUltimateRecipe::get()->coreUrl . '/img/demo-recipe.jpg';
         media_sideload_image($url, $post_id);
         $attachments = get_posts(array('numberposts' => '1', 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC'));
         if (sizeof($attachments) > 0) {
             set_post_thumbnail($post_id, $attachments[0]->ID);
         }
         // Nutritional Information
         $nutritional = array('calories' => '1276', 'carbohydrate' => '71', 'protein' => '57', 'fat' => '85', 'saturated_fat' => '22', 'polyunsaturated_fat' => '10', 'monounsaturated_fat' => '44', 'trans_fat' => '', 'cholesterol' => '238', 'sodium' => '2548', 'potassium' => '620', 'fiber' => '4', 'sugar' => '4', 'vitamin_a' => '2', 'vitamin_c' => '0.1', 'calcium' => '16', 'iron' => '12');
         update_post_meta($post_id, 'recipe_nutritional', $nutritional);
         // Update recipe content
         WPUltimateRecipe::get()->helper('recipe_save')->save($post_id, get_post($post_id));
     }
 }
 public function output($recipe, $args = array())
 {
     if (!$this->output_block($recipe, $args)) {
         return '';
     }
     $output = $this->before_output();
     if (WPUltimateRecipe::is_addon_active('unit-conversion') && WPUltimateRecipe::option('recipe_adjustable_units', '1') == '1') {
         $output = '<span' . $this->style() . '>';
         $output .= '<select onchange="RecipeUnitConversion.recalculate(this)" class="adjust-recipe-unit"' . $this->style('select') . '>';
         $systems = WPUltimateRecipe::get()->helper('ingredient_units')->get_active_systems();
         foreach ($systems as $i => $system) {
             $output .= '<option value="' . $i . '">' . $system['name'] . '</option>';
         }
         $output .= '</select></span>';
     }
     return $this->after_output($output, $recipe);
 }
示例#8
0
 public function output($recipe, $args = array())
 {
     if (!$this->output_block($recipe, $args)) {
         return '';
     }
     $value = $recipe->nutritional($this->field);
     $unit = '';
     if ($this->percentage && $value != '') {
         $daily = WPUltimateRecipe::is_addon_active('nutritional-information') ? WPUltimateRecipe::addon('nutritional-information')->daily : array();
         $value = isset($daily[$this->field]) ? round(floatval($value) / $daily[$this->field] * 100) : $value;
         if ($this->unit) {
             $unit = '%';
         }
     } else {
         if ($this->unit && $value != '') {
             $fields = WPUltimateRecipe::is_addon_active('nutritional-information') ? WPUltimateRecipe::addon('nutritional-information')->fields : array();
             $unit = isset($fields[$this->field]) ? $fields[$this->field] : '';
         }
     }
     $output = $this->before_output();
     $output .= '<span' . $this->style() . '>' . $value . $unit . '</span>';
     return $this->after_output($output, $recipe);
 }
 /**
  * Handles saving of recipes
  */
 public function save($id, $post)
 {
     if ($post->post_type == 'recipe') {
         if (!isset($_POST['recipe_meta_box_nonce']) || !wp_verify_nonce($_POST['recipe_meta_box_nonce'], 'recipe')) {
             return $id;
         }
         $recipe = new WPURP_Recipe($post);
         $fields = $recipe->fields();
         // Make sure the recipe_title meta is present
         if (!isset($_POST['recipe_title'])) {
             $_POST['recipe_title'] = $recipe->title();
         } else {
             if ($_POST['recipe_title'] == '') {
                 $_POST['recipe_title'] = $post->post_title;
             }
         }
         // TODO Refactor saving of fields
         foreach ($fields as $field) {
             $old = get_post_meta($recipe->ID(), $field, true);
             $new = isset($_POST[$field]) ? $_POST[$field] : null;
             // Field specific adjustments
             if (isset($new) && $field == 'recipe_ingredients') {
                 $ingredients = array();
                 $non_empty_ingredients = array();
                 foreach ($new as $ingredient) {
                     if (trim($ingredient['ingredient']) != '') {
                         $term = term_exists($ingredient['ingredient'], 'ingredient');
                         if ($term === 0 || $term === null) {
                             $term = wp_insert_term($ingredient['ingredient'], 'ingredient');
                         }
                         if (is_wp_error($term)) {
                             if (isset($term->error_data['term_exists'])) {
                                 $term_id = intval($term->error_data['term_exists']);
                             } else {
                                 var_dump($term);
                             }
                         } else {
                             $term_id = intval($term['term_id']);
                         }
                         $ingredient['ingredient_id'] = $term_id;
                         $ingredients[] = $term_id;
                         $ingredient['amount_normalized'] = $this->normalize_amount($ingredient['amount']);
                         $non_empty_ingredients[] = $ingredient;
                     }
                 }
                 wp_set_post_terms($recipe->ID(), $ingredients, 'ingredient');
                 $new = $non_empty_ingredients;
             } elseif (isset($new) && $field == 'recipe_instructions') {
                 $non_empty_instructions = array();
                 foreach ($new as $instruction) {
                     if ($instruction['description'] != '' || isset($instruction['image']) && $instruction['image'] != '') {
                         $non_empty_instructions[] = $instruction;
                     }
                 }
                 $new = $non_empty_instructions;
             } elseif (isset($new) && $field == 'recipe_servings') {
                 update_post_meta($recipe->ID(), 'recipe_servings_normalized', $this->normalize_servings($new));
             } elseif (isset($new) && $field == 'recipe_rating') {
                 $term_name = intval($new) == 1 ? $new . ' ' . __('star', 'wp-ultimate-recipe') : $new . ' ' . __('stars', 'wp-ultimate-recipe');
                 wp_set_post_terms($recipe->ID(), $term_name, 'rating');
             }
             // Update or delete meta data if changed
             if (isset($new) && $new != $old) {
                 update_post_meta($recipe->ID(), $field, $new);
                 if ($field == 'recipe_ingredients' && WPUltimateRecipe::is_addon_active('nutritional-information') && WPUltimateRecipe::option('nutritional_information_notice', '1') == '1' && current_user_can(WPUltimateRecipe::option('nutritional_information_capability', 'manage_options'))) {
                     $notice = '<strong>' . $_POST['recipe_title'] . ':</strong> <a href="' . admin_url('edit.php?post_type=recipe&page=wpurp_nutritional_information&limit_by_recipe=' . $recipe->ID()) . '">' . __('Update the Nutritional Information', 'wp-ultimate-recipe') . '</a>';
                     WPUltimateRecipe::get()->helper('notices')->add_admin_notice($notice);
                 }
             } elseif ($new == '' && $old) {
                 delete_post_meta($recipe->ID(), $field, $old);
             }
         }
         $this->update_recipe_terms($recipe->ID());
     }
 }
示例#10
0
 public function rating()
 {
     if (WPUltimateRecipe::is_addon_active('user-ratings') && WPUltimateRecipe::option('user_ratings_enable', 'everyone') != 'disabled') {
         $user_rating = WPURP_User_Ratings::get_recipe_rating($this->ID());
         return $user_rating['rating'];
     } else {
         return $this->rating_author();
     }
 }
<?php

$unit_helper = WPUltimateRecipe::get()->helper('ingredient_units');
$conversion_units_admin = $unit_helper->get_unit_admin_settings();
$unit_systems_admin = $unit_helper->get_unit_system_admin_settings();
// Include part of site URL hash in HTML settings to update when site URL changes
$sitehash = substr(md5(WPUltimateRecipe::get()->coreUrl), 0, 8);
$template_editor_button = WPUltimateRecipe::is_addon_active('template-editor') ? 'recipe_template_open_editor_active' . $sitehash : 'recipe_template_open_editor_disabled';
$custom_fields_button = WPUltimateRecipe::is_addon_active('custom-fields') ? 'recipe_fields_manage_custom_active' . $sitehash : 'recipe_fields_manage_custom_disabled';
$admin_menu = array('title' => 'WP Ultimate Recipe ' . __('Settings', 'wp-ultimate-recipe'), 'logo' => WPUltimateRecipe::get()->coreUrl . '/img/icon_100.png', 'menus' => array(array('title' => __('Recipe Template', 'wp-ultimate-recipe'), 'name' => 'recipe_template', 'icon' => 'font-awesome:fa-picture-o', 'menus' => array(array('title' => __('Template Editor', 'wp-ultimate-recipe'), 'name' => 'recipe_template_template_editor_menu', 'controls' => array(array('type' => 'notebox', 'name' => 'recipe_template_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'section', 'title' => __('Template Editor', 'wp-ultimate-recipe'), 'name' => 'recipe_template_editor', 'fields' => array(array('type' => 'html', 'name' => $template_editor_button, 'binding' => array('field' => '', 'function' => 'wpurp_admin_template_editor')), array('type' => 'select', 'name' => 'recipe_template_editor_recipe', 'label' => __('Preview Recipe', 'wp-ultimate-recipe'), 'description' => __('This recipe will be used for the preview in the editor.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_template_editor_recipe'))), 'default' => array('{{first}}')))), array('type' => 'section', 'title' => __('Default Templates', 'wp-ultimate-recipe'), 'name' => 'recipe_templates', 'fields' => array(array('type' => 'select', 'name' => 'recipe_template_recipe_template', 'label' => __('Recipe Template', 'wp-ultimate-recipe'), 'description' => __('The default template to use for recipes.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_templates'))), 'default' => array('0'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_template_print_template', 'label' => __('Print Template', 'wp-ultimate-recipe'), 'description' => __('The default template to use for printed recipes.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_templates'))), 'default' => array('1'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_template_recipegrid_template', 'label' => __('Recipe Grid Template', 'wp-ultimate-recipe'), 'description' => __('The default template to use for recipes in the Recipe Grid.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_templates'))), 'default' => array('2'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_template_feed_template', 'label' => __('RSS Feed Template', 'wp-ultimate-recipe'), 'description' => __('The default template to use for RSS feeds.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_templates'))), 'default' => array('99'), 'validation' => 'required'))))), array('title' => __('Featured Image', 'wp-ultimate-recipe'), 'name' => 'recipe_template_featured_image_menu', 'controls' => array(array('type' => 'section', 'title' => __('Theme', 'wp-ultimate-recipe'), 'name' => 'featured_image_section_theme', 'fields' => array(array('type' => 'select', 'name' => 'recipe_theme_thumbnail', 'label' => __('Display Thumbnail', 'wp-ultimate-recipe'), 'description' => __('Thumbnail position depends on the theme you use', 'wp-ultimate-recipe') . '.', 'items' => array(array('value' => 'never', 'label' => __('Never', 'wp-ultimate-recipe')), array('value' => 'archive', 'label' => __('Only on archive pages', 'wp-ultimate-recipe')), array('value' => 'recipe', 'label' => __('Only on recipe pages', 'wp-ultimate-recipe')), array('value' => 'always', 'label' => __('Always', 'wp-ultimate-recipe'))), 'default' => array('archive'), 'validation' => 'required'))), array('type' => 'section', 'title' => __('Recipe', 'wp-ultimate-recipe'), 'name' => 'featured_image_section_recipe', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_alternate_image', 'label' => __('Alternate Image', 'wp-ultimate-recipe'), 'description' => __('Ability to define an alternate image for the recipe.', 'wp-ultimate-recipe'), 'default' => '1'))))), array('title' => __('Recipe Box', 'wp-ultimate-recipe'), 'name' => 'recipe_template_recipe_box_menu', 'controls' => array(array('type' => 'section', 'title' => __('Functionality', 'wp-ultimate-recipe'), 'name' => 'section_functionality', 'fields' => array(array('type' => 'textbox', 'name' => 'print_tooltip_text', 'label' => __('Print Button Tooltip', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('Print Recipe', 'wp-ultimate-recipe')), array('type' => 'toggle', 'name' => 'recipe_adjustable_servings', 'label' => __('Adjustable Servings', 'wp-ultimate-recipe'), 'description' => __('Allow users to dynamically adjust the servings of recipes.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'slider', 'name' => 'recipe_adjustable_servings_precision', 'label' => __('Ingredient Precision', 'wp-ultimate-recipe'), 'description' => __('Precision of decimal numbers for ingredient quantities after adjusting servings.', 'wp-ultimate-recipe'), 'min' => '0', 'max' => '10', 'step' => '1', 'default' => '2'), array('type' => 'toggle', 'name' => 'recipe_adjustable_servings_fractions', 'label' => __('Use Fractions', 'wp-ultimate-recipe'), 'description' => __("Use fractions after adjusting, even if the original quantity wasn't one.", 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'recipe_adjustable_servings_hyphen', 'label' => __('Use Hyphens for Ranges', 'wp-ultimate-recipe'), 'description' => __("A hyphen in your quantity will be treated as a range.", 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'slider', 'name' => 'recipe_default_servings', 'label' => __('Default Servings', 'wp-ultimate-recipe'), 'description' => __('Default number of servings to use when none specified.', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '10', 'step' => '1', 'default' => '4'), array('type' => 'toggle', 'name' => 'recipe_linkback', 'label' => __('Link to plugin', 'wp-ultimate-recipe'), 'description' => __('Show a link to the plugin website as a little thank you.', 'wp-ultimate-recipe'), 'default' => '0'))), array('type' => 'section', 'title' => __('Images', 'wp-ultimate-recipe'), 'name' => 'section_recipe_images', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_images_clickable', 'label' => __('Clickable Images', 'wp-ultimate-recipe'), 'description' => __('Best used in combination with a lightbox plugin.', 'wp-ultimate-recipe'), 'default' => ''), array('type' => 'select', 'name' => 'recipe_image_title', 'label' => __('Recipe Image Title', 'wp-ultimate-recipe'), 'description' => __('Title attritube to be used for the recipe image.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'attachment', 'label' => __('Use media attachment title', 'wp-ultimate-recipe')), array('value' => 'recipe_title', 'label' => __('Use recipe title', 'wp-ultimate-recipe'))), 'default' => array('attachment'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_image_alt', 'label' => __('Recipe Image Alt', 'wp-ultimate-recipe'), 'description' => __('Alt attritube to be used for the recipe image.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'attachment', 'label' => __('Use media attachment alt', 'wp-ultimate-recipe')), array('value' => 'recipe_title', 'label' => __('Use recipe title', 'wp-ultimate-recipe'))), 'default' => array('attachment'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_instruction_images_title', 'label' => __('Instruction Images Title', 'wp-ultimate-recipe'), 'description' => __('Title attritube to be used for instruction images.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'attachment', 'label' => __('Use media attachment title', 'wp-ultimate-recipe')), array('value' => 'instruction', 'label' => __('Use instruction text', 'wp-ultimate-recipe'))), 'default' => array('attachment'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_instruction_images_alt', 'label' => __('Instruction Images Alt', 'wp-ultimate-recipe'), 'description' => __('Alt attritube to be used for instruction images.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'attachment', 'label' => __('Use media attachment alt', 'wp-ultimate-recipe')), array('value' => 'instruction', 'label' => __('Use instruction text', 'wp-ultimate-recipe'))), 'default' => array('attachment'), 'validation' => 'required'))), array('type' => 'section', 'title' => __('Ingredients', 'wp-ultimate-recipe'), 'name' => 'section_ingredients', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_ingredient_links_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('Custom links are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'select', 'name' => 'recipe_ingredient_links', 'label' => __('Ingredient Links', 'wp-ultimate-recipe'), 'description' => __('Links to be used in the ingredient list.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'disabled', 'label' => __('No ingredient links', 'wp-ultimate-recipe')), array('value' => 'archive', 'label' => __('Only link to ingredient archive page', 'wp-ultimate-recipe')), array('value' => 'archive_custom', 'label' => __('Custom link if provided, otherwise archive page', 'wp-ultimate-recipe')), array('value' => 'custom', 'label' => __('Custom links if provided, otherwise no link', 'wp-ultimate-recipe'))), 'default' => array('archive_custom'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_ingredient_custom_links_target', 'label' => __('Custom Links', 'wp-ultimate-recipe'), 'description' => __('Custom links can be added on the ', 'wp-ultimate-recipe') . ' <a href="' . admin_url('edit-tags.php?taxonomy=ingredient&post_type=recipe') . '" target="_blank">' . __('ingredients page', 'wp-ultimate-recipe') . '</a>.', 'items' => array(array('value' => '_self', 'label' => __('Open in the current tab/window', 'wp-ultimate-recipe')), array('value' => '_blank', 'label' => __('Open in a new tab/window', 'wp-ultimate-recipe'))), 'default' => array('_blank'), 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed'), 'validation' => 'required'), array('type' => 'toggle', 'name' => 'recipe_ingredient_custom_links_nofollow', 'label' => __('Use Nofollow', 'wp-ultimate-recipe'), 'description' => __('Add the nofollow attribute to custom ingredient links.', 'wp-ultimate-recipe'), 'default' => '0'))))), array('title' => __('Print Version', 'wp-ultimate-recipe'), 'name' => 'recipe_template_print_template_menu', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'print_template_section_general', 'fields' => array(array('type' => 'textbox', 'name' => 'print_template_keyword', 'label' => __('Print Keyword', 'wp-ultimate-recipe'), 'description' => __('Keyword used in the URL to get the print version', 'wp-ultimate-recipe'), 'default' => 'print'))), array('type' => 'section', 'title' => __('Title', 'wp-ultimate-recipe'), 'name' => 'print_template_section_title', 'fields' => array(array('type' => 'textbox', 'name' => 'print_template_title_text', 'label' => __('Title Text', 'wp-ultimate-recipe'), 'description' => __('Title of the new webpage that opens.', 'wp-ultimate-recipe'), 'default' => get_bloginfo('name')))), array('type' => 'section', 'title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'print_template_section_advanced', 'fields' => array(array('type' => 'toggle', 'name' => 'print_version_legacy_code', 'label' => __('Use Legacy Print', 'wp-ultimate-recipe'), 'description' => __('Use the old print style.', 'wp-ultimate-recipe'), 'default' => '0'))))), array('title' => __('RSS Feed', 'wp-ultimate-recipe'), 'name' => 'recipe_template_rss_feed_menu', 'controls' => array(array('type' => 'section', 'title' => __('Recipe Posts', 'wp-ultimate-recipe'), 'name' => 'recipe_template_rss_feed_recipe_posts', 'fields' => array(array('type' => 'select', 'name' => 'recipe_rss_feed_display', 'label' => __('Display', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'excerpt', 'label' => __('Only the excerpt', 'wp-ultimate-recipe')), array('value' => 'full', 'label' => __('The entire recipe', 'wp-ultimate-recipe'))), 'default' => array('full'), 'validation' => 'required'))), array('type' => 'section', 'title' => __('Recipe Shortcode', 'wp-ultimate-recipe'), 'name' => 'recipe_template_rss_feed_shortcode', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_rss_feed_shortcode', 'label' => __('Display', 'wp-ultimate-recipe'), 'description' => __('Output the recipe shortcode in RSS feeds?', 'wp-ultimate-recipe'), 'default' => '1'))))), array('title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'recipe_template_advanced_menu', 'controls' => array(array('type' => 'section', 'title' => __('Mobile', 'wp-ultimate-recipe'), 'name' => 'recipe_template_advanced', 'fields' => array(array('type' => 'slider', 'name' => 'recipe_template_responsive_breakpoint', 'label' => __('Responsive Breakpoint', 'wp-ultimate-recipe'), 'description' => __('The width of the recipe box at which will be switched to the mobile version.', 'wp-ultimate-recipe'), 'min' => '10', 'max' => '1000', 'step' => '1', 'default' => '550'))), array('type' => 'section', 'title' => 'CSS', 'name' => 'recipe_template_advanced_styling', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_template_force_style', 'label' => __('Force CSS style', 'wp-ultimate-recipe'), 'description' => __('This ensures maximum compatibility with most themes. Can be disabled for advanced usage.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'recipe_template_font_awesome', 'label' => __('Include Font Awesome', 'wp-ultimate-recipe'), 'description' => __('You can disable this if your theme already includes Font Awesome.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'recipe_template_inline_css', 'label' => __('Output Inline CSS', 'wp-ultimate-recipe'), 'description' => __('When disabled the Template Editor will not output any inline CSS.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'recipe_template_base_css', 'label' => __('Use base CSS', 'wp-ultimate-recipe'), 'description' => __('When disabled the base CSS file will not be included.', 'wp-ultimate-recipe'), 'default' => '1'))))))), array('title' => __('Recipe Archive', 'wp-ultimate-recipe'), 'name' => 'recipe_archive', 'icon' => 'font-awesome:fa-archive', 'controls' => array(array('type' => 'section', 'title' => __('Recipe Archive Pages', 'wp-ultimate-recipe'), 'name' => 'section_recipe_archive_pages', 'fields' => array(array('type' => 'select', 'name' => 'recipe_archive_display', 'label' => __('Display', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'excerpt', 'label' => __('Only the excerpt', 'wp-ultimate-recipe')), array('value' => 'full', 'label' => __('The entire recipe', 'wp-ultimate-recipe'))), 'default' => array('full'), 'validation' => 'required'), array('type' => 'textbox', 'name' => 'recipe_slug', 'label' => __('Slug', 'wp-ultimate-recipe'), 'default' => 'recipe', 'validation' => 'required'), array('type' => 'html', 'name' => 'recipe_slug_preview' . $sitehash, 'binding' => array('field' => 'recipe_slug', 'function' => 'wpurp_admin_recipe_slug_preview')), array('type' => 'notebox', 'name' => 'recipe_slug_notebox', 'label' => __('404 error/page not found?', 'wp-ultimate-recipe'), 'description' => __('Try', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipe.com/docs/404-page-found/" target="_blank">' . __('flushing your permalinks', 'wp-ultimate-recipe') . '</a>.', 'status' => 'info'))), array('type' => 'section', 'title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'section_recipe_archive_advanced', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_archive_disabled', 'label' => __('Disable Recipe Archive', 'wp-ultimate-recipe'), 'description' => __('Make sure to flush your permalinks after changing this setting.', 'wp-ultimate-recipe'), 'default' => '0'))))), array('title' => __('Partner Integrations', 'wp-ultimate-recipe'), 'name' => 'partners_integrations', 'icon' => 'font-awesome:fa-link', 'controls' => array(array('type' => 'section', 'title' => 'Chicory', 'name' => 'section_integrations_chicory', 'fields' => array(array('type' => 'toggle', 'name' => 'partners_integrations_chicory_enable', 'label' => 'Chicory', 'description' => __('Connect your recipes to leading online grocers with the Chicory "get ingredients" button.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'checkbox', 'name' => 'partners_integrations_chicory_terms', 'label' => '', 'items' => array(array('value' => '1', 'label' => __("I agree to Chicory's", 'wp-ultimate-recipe') . '</label> <a href="http://chicoryapp.com/terms/" target="_blank">' . __('terms of use', 'wp-ultimate-recipe') . '</a><label>'))), array('type' => 'notebox', 'name' => 'partners_integrations_chicory_agree', 'label' => 'Chicory', 'description' => __("You need to agree to Chicory's terms of use if you want the button to show up.", 'wp-ultimate-recipe'), 'status' => 'warning', 'dependency' => array('field' => 'partners_integrations_chicory_enable,partners_integrations_chicory_terms', 'function' => 'wpurp_admin_chicory_terms')))), array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_integrations_general', 'fields' => array(array('type' => 'toggle', 'name' => 'partners_integrations_bigoven_enable', 'label' => 'BigOven', 'description' => __('Show save recipe to BigOven button.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'partners_integrations_foodfanatic_enable', 'label' => 'Food Fanatic', 'description' => __('Show save recipe to Food Fanatic button.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'partners_integrations_yummly_enable', 'label' => 'Yummly', 'description' => __('Show the Yum button.', 'wp-ultimate-recipe'), 'default' => '0'))))), array('title' => __('Recipe Sharing', 'wp-ultimate-recipe'), 'name' => 'recipe_sharing', 'icon' => 'font-awesome:fa-thumbs-o-up', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_general', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_sharing_enable', 'label' => __('Enable Sharing', 'wp-ultimate-recipe'), 'description' => __('Show sharing buttons.', 'wp-ultimate-recipe'), 'default' => '1'))), array('type' => 'section', 'title' => __('Language', 'wp-ultimate-recipe'), 'name' => 'section_recipe_sharing_language', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_sharing_language_options', 'description' => __('Available languages can be found over here:', 'wp-ultimate-recipe') . ' <a href="https://developers.facebook.com/docs/internationalization/" target="_blank">Facebook</a>, <a href="https://dev.twitter.com/overview/general/adding-international-support-to-your-apps" target="_blank">Twitter</a>, <a href="https://developers.google.com/+/web/+1button/#available-languages" target="_blank">Google+</a>', 'status' => 'info'), array('type' => 'textbox', 'name' => 'recipe_sharing_language_facebook', 'label' => 'Facebook', 'default' => 'en_US', 'validation' => 'required'), array('type' => 'textbox', 'name' => 'recipe_sharing_language_twitter', 'label' => 'Twitter', 'default' => 'en', 'validation' => 'required'), array('type' => 'textbox', 'name' => 'recipe_sharing_language_google', 'label' => 'Google+', 'default' => 'en-US', 'validation' => 'required'))), array('type' => 'section', 'title' => __('Default text to share', 'wp-ultimate-recipe'), 'name' => 'section_recipe_sharing_default_text', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_sharing_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'notebox', 'name' => 'recipe_sharing_codes', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Use %title% as a placeholder for the recipe title.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'textbox', 'name' => 'recipe_sharing_twitter', 'label' => 'Twitter', 'default' => '%title% - Powered by @WPUltimRecipe', 'validation' => 'required'), array('type' => 'textbox', 'name' => 'recipe_sharing_pinterest', 'label' => 'Pinterest', 'default' => '%title% - Powered by @ultimaterecipe', 'validation' => 'required'))))), array('title' => __('Recipe Fields', 'wp-ultimate-recipe'), 'name' => 'recipe_fields', 'icon' => 'font-awesome:fa-edit', 'controls' => array(array('type' => 'notebox', 'name' => 'recipe_tags_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'section', 'title' => __('Custom Recipe Fields', 'wp-ultimate-recipe'), 'name' => 'section_recipe_fields_custom', 'fields' => array(array('type' => 'html', 'name' => $custom_fields_button, 'binding' => array('field' => '', 'function' => 'wpurp_admin_manage_fields')))), array('type' => 'section', 'title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'section_recipe_fields_advanced', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_fields_in_user_submission', 'label' => __('Show Custom Fields in User Submission form', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'multiselect', 'name' => 'recipe_fields_user_submission', 'label' => __('Fields', 'wp-ultimate-recipe'), 'description' => __('Fields to show in the User Submission form.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_custom_fields'))), 'default' => array('{{all}}'), 'dependency' => array('field' => 'recipe_fields_in_user_submission', 'function' => 'vp_dep_boolean')))))), array('title' => __('Recipe Tags', 'wp-ultimate-recipe'), 'name' => 'recipe_tags', 'icon' => 'font-awesome:fa-tags', 'controls' => array(array('type' => 'section', 'title' => __('Custom Recipe Tags', 'wp-ultimate-recipe'), 'name' => 'section_recipe_tags_custom', 'fields' => array(array('type' => 'html', 'name' => 'recipe_tags_manage_custom' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_manage_tags')), array('type' => 'multiselect', 'name' => 'recipe_tags_hide_in_recipe', 'label' => __('Hide Custom Tags', 'wp-ultimate-recipe'), 'description' => __('Do not show these tags in the Recipe Box.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_recipe_tags')))))), array('type' => 'section', 'title' => __('WordPress Categories & Tags', 'wp-ultimate-recipe'), 'name' => 'section_recipe_tags_wordpress', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_tags_use_wp_categories', 'label' => __('Use Categories and Tags', 'wp-ultimate-recipe'), 'description' => __('Use the default WP Categories and Tags to organize your recipes.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'recipe_tags_show_in_archives', 'label' => __('Show Recipes in Archives', 'wp-ultimate-recipe'), 'description' => __('Show recipes in the WP Categories and Tags archives.', 'wp-ultimate-recipe'), 'default' => '1'))), array('type' => 'section', 'title' => __('Links', 'wp-ultimate-recipe'), 'name' => 'section_tags_links', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_tags_links_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('Custom links are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'select', 'name' => 'recipe_tags_links', 'label' => __('Tag Links', 'wp-ultimate-recipe'), 'description' => __('Links to be used in the tag list.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'disabled', 'label' => __('No tag links', 'wp-ultimate-recipe')), array('value' => 'archive', 'label' => __('Only link to archive page', 'wp-ultimate-recipe')), array('value' => 'archive_custom', 'label' => __('Custom link if provided, otherwise archive page', 'wp-ultimate-recipe')), array('value' => 'custom', 'label' => __('Custom links if provided, otherwise no link', 'wp-ultimate-recipe'))), 'default' => array('archive_custom'), 'validation' => 'required'), array('type' => 'select', 'name' => 'recipe_tags_custom_links_target', 'label' => __('Custom Links', 'wp-ultimate-recipe'), 'description' => __('Custom links can be added on the ', 'wp-ultimate-recipe') . ' <a href="' . admin_url('edit-tags.php?taxonomy=category&post_type=recipe') . '" target="_blank">' . __('tag page', 'wp-ultimate-recipe') . '</a>.', 'items' => array(array('value' => '_self', 'label' => __('Open in the current tab/window', 'wp-ultimate-recipe')), array('value' => '_blank', 'label' => __('Open in a new tab/window', 'wp-ultimate-recipe'))), 'default' => array('_blank'), 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed'), 'validation' => 'required'), array('type' => 'toggle', 'name' => 'recipe_tags_custom_links_nofollow', 'label' => __('Use Nofollow', 'wp-ultimate-recipe'), 'description' => __('Add the nofollow attribute to custom tag links.', 'wp-ultimate-recipe'), 'default' => '0'))), array('type' => 'section', 'title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'section_recipe_tags_advanced', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_tags_cu_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'notebox', 'name' => 'recipe_tags_show_in_recipe_info', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Categories will only show up as tags in the recipe if they have a parent category. For example: a "Courses" parent category with "Main Dish" and "Dessert" as child categories assigned to your recipes.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'toggle', 'name' => 'recipe_tags_show_in_recipe', 'label' => __('Show Categories in Recipe', 'wp-ultimate-recipe'), 'description' => __('Use WP categories as if they are tags for their parent category.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'recipe_tags_filter_categories', 'label' => __('Show Categories Filter', 'wp-ultimate-recipe'), 'description' => __('Users can see the categories when filtering.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'recipe_tags_filter_tags', 'label' => __('Show Tags Filter', 'wp-ultimate-recipe'), 'description' => __('Users can see the tags when filtering.', 'wp-ultimate-recipe'), 'default' => '0'))))), array('title' => __('User Ratings', 'wp-ultimate-recipe'), 'name' => 'user_ratings', 'icon' => 'font-awesome:fa-star-half-o', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_user_ratings_general', 'fields' => array(array('type' => 'notebox', 'name' => 'user_ratings_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'select', 'name' => 'user_ratings_enable', 'label' => __('User Ratings', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'disabled', 'label' => __('Disabled', 'wp-ultimate-recipe')), array('value' => 'users_only', 'label' => __('Only logged in users can rate recipes', 'wp-ultimate-recipe')), array('value' => 'everyone', 'label' => __('Everyone can rate recipes', 'wp-ultimate-recipe'))), 'default' => array('everyone'), 'validation' => 'required'), array('type' => 'toggle', 'name' => 'user_ratings_vote_attention', 'label' => __('Show indicator', 'wp-ultimate-recipe'), 'description' => __('Attract attention to the possibility to vote.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'slider', 'name' => 'user_ratings_minimum_votes', 'label' => __('Minimum # Votes', 'wp-ultimate-recipe'), 'description' => __('Minimum number of votes needed before sharing the rating as metadata used by Google and other search engines.', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '50', 'step' => '1', 'default' => '2'), array('type' => 'select', 'name' => 'user_ratings_rounding', 'label' => __('Rounding Ratings', 'wp-ultimate-recipe'), 'description' => __('Round the ratings presented in the metadata.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'disabled', 'label' => __('Disabled', 'wp-ultimate-recipe')), array('value' => 'half', 'label' => __('Round up to nearest half', 'wp-ultimate-recipe')), array('value' => 'integer', 'label' => __('Round up to nearest integer', 'wp-ultimate-recipe'))), 'default' => array('disabled'), 'validation' => 'required'))))), array('title' => __('Unit Conversion', 'wp-ultimate-recipe'), 'name' => 'unit_conversion', 'icon' => 'font-awesome:fa-exchange', 'menus' => array(array('title' => __('General Settings', 'wp-ultimate-recipe'), 'name' => 'unit_conversion_general_settings', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_unit_conversion_general', 'fields' => array(array('type' => 'notebox', 'name' => 'unit_conversion_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'toggle', 'name' => 'recipe_adjustable_units', 'label' => __('Allow Conversion', 'wp-ultimate-recipe'), 'description' => __('Allow your visitors to switch between Imperial and Metric units.', 'wp-ultimate-recipe'), 'default' => '1'))))), array('title' => __('Unit Systems', 'wp-ultimate-recipe'), 'name' => 'unit_conversion_unit_systems', 'controls' => $unit_systems_admin), array('title' => __('Unit Aliases', 'wp-ultimate-recipe'), 'name' => 'unit_conversion_unit_aliases', 'controls' => $conversion_units_admin))), array('title' => __('Recipe Grid', 'wp-ultimate-recipe'), 'name' => 'recipe_grid', 'icon' => 'font-awesome:fa-th', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_recipe_grid_general', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_grid_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'html', 'name' => 'recipe_grid_manage' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_manage_recipe_grid')))), array('type' => 'section', 'title' => __('Backwards Compatibility', 'wp-ultimate-recipe'), 'name' => 'section_recipe_grid_backwards_compatibility', 'fields' => array(array('type' => 'notebox', 'name' => 'recipe_grid_shortcode', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Use the [ultimate-recipe-grid] shortcode to display the Recipe Grid.', 'wp-ultimate-recipe') . ' ' . __('The shortcode can be added to any page or post.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'html', 'name' => 'recipe_grid_reset_terms' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_reset_recipe_grid_terms')), array('type' => 'notebox', 'name' => 'recipe_grid_shortcode', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('The Multi-Select, Match All and Parents match Children setting has been moved to the shortcode and can now be changed per Recipe Grid.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')))))), array('title' => __('User Submission', 'wp-ultimate-recipe'), 'name' => 'user_submission', 'icon' => 'font-awesome:fa-user', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_user_submission_general', 'fields' => array(array('type' => 'notebox', 'name' => 'user_submission_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'notebox', 'name' => 'user_submission_shortcode', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Use the following shortcode to display the front-end form:', 'wp-ultimate-recipe') . ' [ultimate-recipe-submissions]. ' . __('The shortcode can be added to any page or post.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'select', 'name' => 'user_submission_enable', 'label' => __('Allow submissions from', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe') . ' (' . __('disabled', 'wp-ultimate-recipe') . ')'), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('guests'), 'validation' => 'required'), array('type' => 'toggle', 'name' => 'user_submission_preview_button', 'label' => __('Allow visitors to preview their submission', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'user_submission_delete_button', 'label' => __('Allow users to delete their own recipes', 'wp-ultimate-recipe'), 'description' => __('Show a delete button when users are editing their own recipes from the front-end.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'codeeditor', 'name' => 'user_submission_submitted_text', 'label' => __('After-submission text', 'wp-ultimate-recipe'), 'description' => __('Text to be shown after a user has submitted a recipe.', 'wp-ultimate-recipe') . ' ' . __('HTML can be used.', 'wp-ultimate-recipe'), 'theme' => 'github', 'mode' => 'html', 'default' => __('Recipe submitted! Thank you, your recipe is now awaiting moderation.', 'wp-ultimate-recipe')), array('type' => 'multiselect', 'name' => 'user_submission_required_fields', 'label' => __('Required Fields', 'wp-ultimate-recipe'), 'description' => __('Fields that are required to fill in.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_user_submission_required_fields'))), 'default' => array('title', 'recipe-author')))), array('type' => 'section', 'title' => __('Security Question', 'wp-ultimate-recipe'), 'name' => 'section_user_submission_security_question', 'fields' => array(array('type' => 'toggle', 'name' => 'user_submissions_use_security_question', 'label' => __('Security Question', 'wp-ultimate-recipe'), 'description' => __('Use a security question to prevent spam.', 'wp-ultimate-recipe'), 'default' => ''), array('type' => 'textbox', 'name' => 'user_submissions_security_question', 'label' => __('Question', 'wp-ultimate-recipe'), 'description' => __('The question your visitors have to answer.', 'wp-ultimate-recipe'), 'default' => '4 + 7 =', 'dependency' => array('field' => 'user_submissions_use_security_question', 'function' => 'vp_dep_boolean')), array('type' => 'textbox', 'name' => 'user_submissions_security_answer', 'label' => __('Answer', 'wp-ultimate-recipe'), 'description' => __('The correct answer to that question.', 'wp-ultimate-recipe'), 'default' => '11', 'dependency' => array('field' => 'user_submissions_use_security_question', 'function' => 'vp_dep_boolean')))), array('type' => 'section', 'title' => __('Recipe Tags', 'wp-ultimate-recipe'), 'name' => 'section_user_submission_recipe_tags', 'fields' => array(array('type' => 'toggle', 'name' => 'recipe_tags_user_submissions_multiselect', 'label' => __('Allow Multiselect', 'wp-ultimate-recipe'), 'description' => __('Allow users to select multiple terms per category.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'recipe_tags_user_submissions_categories', 'label' => __('User Submitted Categories', 'wp-ultimate-recipe'), 'description' => __('Allow users to assign categories when submitting recipes.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'recipe_tags_user_submissions_tags', 'label' => __('User Submitted Tags', 'wp-ultimate-recipe'), 'description' => __('Allow users to assign tags when submitting recipes.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'multiselect', 'name' => 'user_submission_hide_tags', 'label' => __('Hide Custom Tags', 'wp-ultimate-recipe'), 'description' => __('Hide these tags on the user submission page.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_recipe_tags')))), array('type' => 'multiselect', 'name' => 'user_submission_hide_category_terms', 'label' => __('Hide Category Terms', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_category_terms')))), array('type' => 'multiselect', 'name' => 'user_submission_hide_tag_terms', 'label' => __('Hide Tag Terms', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_tag_terms')))))), array('type' => 'section', 'title' => __('Approval Rules', 'wp-ultimate-recipe'), 'name' => 'section_user_submission_approval_rules', 'fields' => array(array('type' => 'select', 'name' => 'user_submission_approve', 'label' => __('Auto approve', 'wp-ultimate-recipe'), 'description' => __('Publish recipe immediately on submission.', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe')), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('off'), 'validation' => 'required'), array('type' => 'multiselect', 'name' => 'user_submission_approve_users', 'label' => __('Auto approve specific users', 'wp-ultimate-recipe'), 'description' => __('Publish recipes from these users immediately on submission.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_users')))), array('type' => 'textbox', 'name' => 'user_submissions_approve_role', 'label' => __('Auto approve users with role or capability', 'wp-ultimate-recipe'), 'description' => __('Publish recipes from these users immediately on submission.', 'wp-ultimate-recipe'), 'default' => ''))), array('type' => 'section', 'title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'section_user_submission_advanced', 'fields' => array(array('type' => 'toggle', 'name' => 'user_submission_ingredient_list', 'label' => __('Can only select existing ingredients', 'wp-ultimate-recipe'), 'description' => __('When enabled visitors will only be able to select from a list of existing ingredients.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'user_submission_email_admin', 'label' => __('Email administrator', 'wp-ultimate-recipe'), 'description' => __('Send an email notification when a new recipe is submitted.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'user_submission_restrict_media_access', 'label' => __('Restrict Media Library Access', 'wp-ultimate-recipe'), 'description' => __('Only show media library for editors and up', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'user_submission_use_media_manager', 'label' => __('Use Media Manager', 'wp-ultimate-recipe'), 'description' => __('Let logged in users use the Media Manager to upload images', 'wp-ultimate-recipe'), 'default' => '1'))))), array('title' => __('Meal Planner', 'wp-ultimate-recipe'), 'name' => 'meal_planner', 'icon' => 'font-awesome:fa-calendar', 'controls' => array(array('type' => 'section', 'title' => __('Access', 'wp-ultimate-recipe'), 'name' => 'section_meal_planner_access', 'fields' => array(array('type' => 'notebox', 'name' => 'meal_planner_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'notebox', 'name' => 'meal_planner_shortcode', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Use the following shortcode to display the front-end form:', 'wp-ultimate-recipe') . ' [ultimate-recipe-meal-planner]. ' . __('The shortcode can be added to any page or post.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'select', 'name' => 'meal_planner_enable', 'label' => __('Enable Meal Planner for', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe') . ' (' . __('disabled', 'wp-ultimate-recipe') . ')'), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('guests'), 'validation' => 'required'), array('type' => 'codeeditor', 'name' => 'meal_planner_disabled_text', 'label' => __('Disabled Text', 'wp-ultimate-recipe'), 'description' => __('Text to be shown when the Meal Planner is disabled for a visitor.', 'wp-ultimate-recipe') . ' ' . __('HTML can be used.', 'wp-ultimate-recipe'), 'theme' => 'github', 'mode' => 'html', 'default' => ''))), array('type' => 'section', 'title' => __('Add to Meal Plan Button', 'wp-ultimate-recipe'), 'name' => 'section_meal_planner_add_to_meal_plan', 'fields' => array(array('type' => 'select', 'name' => 'meal_planner_add_to_meal_plan', 'label' => __('Show add to meal plan button for', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe') . ' (' . __('disabled', 'wp-ultimate-recipe') . ')'), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('off'), 'validation' => 'required'), array('type' => 'textbox', 'name' => 'add_to_meal_plan_tooltip_text', 'label' => __('Tooltip after adding', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('Add to Meal Plan:', 'wp-ultimate-recipe')), array('type' => 'textbox', 'name' => 'added_to_meal_plan_tooltip_text', 'label' => __('Tooltip after adding', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('This recipe has been added to your Meal Plan', 'wp-ultimate-recipe')), array('type' => 'notebox', 'name' => 'add_to_meal_plan_tooltip_html', 'description' => __('You can use HTML to link to the relevant page in the tooltips:', 'wp-ultimate-recipe') . '<br/>' . htmlspecialchars('<a href="/meal-plan/">Meal Plan</a>'), 'status' => 'info'))), array('type' => 'section', 'title' => __('Appearance', 'wp-ultimate-recipe'), 'name' => 'section_meal_planner_appearance', 'fields' => array(array('type' => 'slider', 'name' => 'meal_planner_days_desktop', 'label' => __('Number of Days on Desktop', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '10', 'step' => '1', 'default' => '5'), array('type' => 'slider', 'name' => 'meal_planner_days_tablet', 'label' => __('Number of Days on Tablet', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '10', 'step' => '1', 'default' => '3'), array('type' => 'slider', 'name' => 'meal_planner_days_mobile', 'label' => __('Number of Days on Mobile', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '10', 'step' => '1', 'default' => '1'), array('type' => 'textbox', 'name' => 'meal_planner_date_format', 'label' => __('Date Format', 'wp-ultimate-recipe'), 'description' => '<a href="http://php.net/manual/en/function.date.php" target="_blank">' . __('Use PHP Date String', 'wp-ultimate-recipe') . '</a>', 'default' => 'F j'), array('type' => 'multiselect', 'name' => 'meal_planner_default_courses', 'label' => __('Default Courses', 'wp-ultimate-recipe'), 'description' => __('Default courses to show in the menu.', 'wp-ultimate-recipe'), 'items' => array(array('value' => __('Breakfast', 'wp-ultimate-recipe'), 'label' => __('Breakfast', 'wp-ultimate-recipe')), array('value' => __('Lunch', 'wp-ultimate-recipe'), 'label' => __('Lunch', 'wp-ultimate-recipe')), array('value' => __('Snack', 'wp-ultimate-recipe'), 'label' => __('Snack', 'wp-ultimate-recipe')), array('value' => __('Dinner', 'wp-ultimate-recipe'), 'label' => __('Dinner', 'wp-ultimate-recipe')), array('value' => __('Dessert', 'wp-ultimate-recipe'), 'label' => __('Dessert', 'wp-ultimate-recipe'))), 'default' => array(__('Breakfast', 'wp-ultimate-recipe'), __('Lunch', 'wp-ultimate-recipe'), __('Dinner', 'wp-ultimate-recipe'))), array('type' => 'select', 'name' => 'meal_planner_recipe_details_template', 'label' => __('Recipe Details Template', 'wp-ultimate-recipe'), 'description' => __('The template to use for recipe details.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_templates'))), 'default' => array('96'), 'validation' => 'required'))), array('type' => 'section', 'title' => __('Shopping List', 'wp-ultimate-recipe'), 'name' => 'section_meal_planner_shopping_list', 'fields' => array(array('type' => 'toggle', 'name' => 'meal_plan_shopping_list_ingredient_notes', 'label' => __('Show Ingredient Notes', 'wp-ultimate-recipe'), 'description' => __('Ingredients with different notes will be handled as different ingredients.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'meal_plan_shopping_list_consolidate_ingredients', 'label' => __('Consolidate Ingredients', 'wp-ultimate-recipe'), 'description' => __('Convert units to be able to consolidate ingredients into 1 line.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'meal_plan_shopping_list_checkboxes', 'label' => __('Show Checkboxes', 'wp-ultimate-recipe'), 'description' => __('Show checkboxes in the shopping list to cross items of the list.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'meal_plan_shopping_list_save', 'label' => __('Show Save Button', 'wp-ultimate-recipe'), 'description' => __('Allow visitors to save the shopping list for mobile usage.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'textbox', 'name' => 'meal_plan_shopping_list_keyword', 'label' => __('Mobile Shopping List Keyword', 'wp-ultimate-recipe'), 'description' => __('Keyword used in the URL to get the mobile shopping list.', 'wp-ultimate-recipe'), 'default' => 'shopping-list'))))), array('title' => __('User Menus', 'wp-ultimate-recipe'), 'name' => 'user_menus', 'icon' => 'font-awesome:fa-list-alt', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_user_menus_general', 'fields' => array(array('type' => 'notebox', 'name' => 'user_menus_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'notebox', 'name' => 'user_menus_shortcode', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Use the following shortcode to display the front-end form:', 'wp-ultimate-recipe') . ' [ultimate-recipe-user-menus]. ' . __('The shortcode can be added to any page or post.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'select', 'name' => 'user_menus_enable', 'label' => __('Enable user menus for', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe') . ' (' . __('disabled', 'wp-ultimate-recipe') . ')'), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('guests'), 'validation' => 'required'), array('type' => 'select', 'name' => 'user_menus_enable_save', 'label' => __('Enable user menus save function for', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe') . ' (' . __('disabled', 'wp-ultimate-recipe') . ')'), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('guests'), 'validation' => 'required'), array('type' => 'toggle', 'name' => 'user_menus_enable_delete', 'label' => __('Enable Delete Button', 'wp-ultimate-recipe'), 'description' => __('Users can delete their own saved menus.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'slider', 'name' => 'user_menus_default_servings', 'label' => __('Default Servings', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '10', 'step' => '1', 'default' => '4'), array('type' => 'toggle', 'name' => 'user_menus_ingredient_notes', 'label' => __('Show Ingredient Notes', 'wp-ultimate-recipe'), 'description' => __('Ingredients with different notes will be handled as different ingredients.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'user_menus_checkboxes', 'label' => __('Show Checkboxes', 'wp-ultimate-recipe'), 'description' => __('Show checkboxes in the shopping list to cross items of the list.', 'wp-ultimate-recipe'), 'default' => '1'))), array('type' => 'section', 'title' => __('Add to Shopping List Button', 'wp-ultimate-recipe'), 'name' => 'section_user_menus_add_to_shopping_list', 'fields' => array(array('type' => 'select', 'name' => 'user_menus_add_to_shopping_list', 'label' => __('Show add to shopping list button for', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'off', 'label' => __('Nobody', 'wp-ultimate-recipe') . ' (' . __('disabled', 'wp-ultimate-recipe') . ')'), array('value' => 'guests', 'label' => __('Guests and registered users', 'wp-ultimate-recipe')), array('value' => 'registered', 'label' => __('Registered users only', 'wp-ultimate-recipe'))), 'default' => array('off'), 'validation' => 'required'), array('type' => 'textbox', 'name' => 'add_to_shopping_list_tooltip_text', 'label' => __('Add to Shopping List Button Tooltip', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('Add to Shopping List', 'wp-ultimate-recipe')), array('type' => 'textbox', 'name' => 'added_to_shopping_list_tooltip_text', 'label' => __('Tooltip after adding', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('This recipe is in your Shopping List', 'wp-ultimate-recipe')), array('type' => 'notebox', 'name' => 'add_to_shopping_list_tooltip_html', 'description' => __('You can use HTML to link to the relevant page in the tooltips:', 'wp-ultimate-recipe') . '<br/>' . htmlspecialchars('<a href="/shopping-list/">Shopping List</a>'), 'status' => 'info'))), array('type' => 'section', 'title' => __('Unit Systems', 'wp-ultimate-recipe'), 'name' => 'section_user_menus_unit_systems', 'fields' => array(array('type' => 'toggle', 'name' => 'user_menus_consolidate_ingredients', 'label' => __('Consolidate Ingredients', 'wp-ultimate-recipe'), 'description' => __('Convert units to be able to consolidate ingredients into 1 line.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'user_menus_dynamic_unit_system', 'label' => __('Unit System Dropdown', 'wp-ultimate-recipe'), 'description' => __('Users can use a dropdown to select the unit system they want.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'select', 'name' => 'user_menus_default_unit_system', 'label' => __('Default Unit System', 'wp-ultimate-recipe'), 'description' => __('Unit system to use for the shopping list feature.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_get_unit_systems'))), 'default' => array('0'), 'validation' => 'required', 'dependency' => array('field' => 'user_menus_dynamic_unit_system', 'function' => 'vp_dep_boolean')), array('type' => 'slider', 'name' => 'user_menus_static_nbr_systems', 'label' => __('Number of Systems', 'wp-ultimate-recipe'), 'description' => __('Number of unit systems displayed in the shopping list.', 'wp-ultimate-recipe'), 'min' => '1', 'max' => '3', 'step' => '1', 'default' => '1', 'dependency' => array('field' => 'user_menus_dynamic_unit_system', 'function' => 'vp_dep_boolean_inverse')), array('type' => 'select', 'name' => 'user_menus_static_system_1', 'label' => __('Unit System', 'wp-ultimate-recipe') . ' 1', 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_get_unit_systems'))), 'default' => array('0'), 'validation' => 'required', 'dependency' => array('field' => 'user_menus_dynamic_unit_system', 'function' => 'vp_dep_boolean_inverse')), array('type' => 'select', 'name' => 'user_menus_static_system_2', 'label' => __('Unit System', 'wp-ultimate-recipe') . ' 2', 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_get_unit_systems'))), 'default' => array('0'), 'validation' => 'required', 'dependency' => array('field' => 'user_menus_dynamic_unit_system', 'function' => 'vp_dep_boolean_inverse')), array('type' => 'select', 'name' => 'user_menus_static_system_3', 'label' => __('Unit System', 'wp-ultimate-recipe') . ' 3', 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_get_unit_systems'))), 'default' => array('0'), 'validation' => 'required', 'dependency' => array('field' => 'user_menus_dynamic_unit_system', 'function' => 'vp_dep_boolean_inverse')))), array('type' => 'section', 'title' => __('Print Options', 'wp-ultimate-recipe'), 'name' => 'section_user_menus_print', 'fields' => array(array('type' => 'toggle', 'name' => 'user_menus_enable_print_list', 'label' => __('Print Shopping List Button', 'wp-ultimate-recipe'), 'description' => __('Show a button to print the shopping list.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'user_menus_print_with_menu', 'label' => __('Include Recipe List', 'wp-ultimate-recipe'), 'description' => __('Include of list of the recipes in the menu when printing the shopping list.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'user_menus_enable_print_menu', 'label' => __('Print Menu Button', 'wp-ultimate-recipe'), 'description' => __('Show a button to print the entire menu (Shopping list and recipes).', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'select', 'name' => 'user_menus_recipe_print_template', 'label' => __('Print Template', 'wp-ultimate-recipe'), 'description' => __('The default template to use for printed recipes.', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_templates'))), 'default' => array('1'), 'validation' => 'required'))), array('type' => 'section', 'title' => __('Slug', 'wp-ultimate-recipe'), 'name' => 'section_user_menus_slug', 'fields' => array(array('type' => 'textbox', 'name' => 'user_menus_slug', 'label' => __('Slug', 'wp-ultimate-recipe'), 'default' => 'menu', 'validation' => 'required'), array('type' => 'html', 'name' => 'user_menus_slug_preview' . $sitehash, 'binding' => array('field' => 'user_menus_slug', 'function' => 'wpurp_admin_user_menus_slug_preview')), array('type' => 'notebox', 'name' => 'user_menus_slug_notebox', 'label' => __('404 error/page not found?', 'wp-ultimate-recipe'), 'description' => __('Try', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipe.com/docs/404-page-found/" target="_blank">' . __('flushing your permalinks', 'wp-ultimate-recipe') . '</a>.', 'status' => 'info'))))), array('title' => __('Favorite Recipes', 'wp-ultimate-recipe'), 'name' => 'favorite_recipes', 'icon' => 'font-awesome:fa-heart', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_favorite_recipes_general', 'fields' => array(array('type' => 'notebox', 'name' => 'favorite_recipes_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'notebox', 'name' => 'favorite_recipes_shortcode', 'label' => __('Important', 'wp-ultimate-recipe'), 'description' => __('Use the following shortcode to display the list of favorite recipes:', 'wp-ultimate-recipe') . ' [ultimate-recipe-favorites]. ' . __('The shortcode can be added to any page or post.', 'wp-ultimate-recipe'), 'status' => 'info', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_installed')), array('type' => 'toggle', 'name' => 'favorite_recipes_enabled', 'label' => __('Enable Button', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'textbox', 'name' => 'favorite_recipes_tooltip_text', 'label' => __('Favorite Recipes Button Tooltip', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('Add to your Favorite Recipes', 'wp-ultimate-recipe')), array('type' => 'textbox', 'name' => 'favorited_recipes_tooltip_text', 'label' => __('Tooltip after adding', 'wp-ultimate-recipe'), 'description' => __('Text to show when someone hovers over the button.', 'wp-ultimate-recipe'), 'default' => __('This recipe is in your Favorite Recipes', 'wp-ultimate-recipe')), array('type' => 'notebox', 'name' => 'favorite_recipes_tooltip_html', 'description' => __('You can use HTML to link to the relevant page in the tooltips:', 'wp-ultimate-recipe') . '<br/>' . htmlspecialchars('<a href="/favorite-recipes/">Favorite Recipes</a>'), 'status' => 'info'))))), array('title' => __('Nutritional Information', 'wp-ultimate-recipe'), 'name' => 'nutritional_information', 'icon' => 'font-awesome:fa-tasks', 'controls' => array(array('type' => 'section', 'title' => __('General', 'wp-ultimate-recipe'), 'name' => 'section_nutritional_information_general', 'fields' => array(array('type' => 'notebox', 'name' => 'nutritional_information_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'select', 'name' => 'nutritional_information_unit', 'label' => __('Display Unit', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'calories', 'label' => __('Calories', 'wp-ultimate-recipe')), array('value' => 'kilojoules', 'label' => __('Kilojoules', 'wp-ultimate-recipe'))), 'default' => array('calories'), 'validation' => 'required'), array('type' => 'toggle', 'name' => 'nutritional_information_notice', 'label' => __('Show Notice', 'wp-ultimate-recipe'), 'description' => __('Show notice to update Nutritional Information after updating a recipe.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'textbox', 'name' => 'nutritional_information_capability', 'label' => __('Required role or capability', 'wp-ultimate-recipe'), 'description' => __('Only users with this role or capability can edit the Nutritional Information.', 'wp-ultimate-recipe'), 'default' => 'manage_options'))))), array('title' => __('Import Recipes', 'wp-ultimate-recipe'), 'name' => 'import_recipes', 'icon' => 'font-awesome:fa-upload', 'controls' => array(array('type' => 'section', 'title' => __('Import Options', 'wp-ultimate-recipe'), 'name' => 'secion_import_recipes_options', 'fields' => array(array('type' => 'textarea', 'name' => 'import_recipes_generic_units', 'label' => __('Generic ingredient units', 'wp-ultimate-recipe'), 'description' => __('Generic ingredient units to recognize while importing. Separate with a ;', 'wp-ultimate-recipe'), 'default' => $defaults['import_recipes_generic_units']), array('type' => 'select', 'name' => 'import_recipes_order', 'label' => __('Import order', 'wp-ultimate-recipe'), 'items' => array(array('value' => 'ASC', 'label' => __('Import oldest recipes first', 'wp-ultimate-recipe')), array('value' => 'DESC', 'label' => __('Import latest recipes first', 'wp-ultimate-recipe'))), 'default' => array('ASC'), 'validation' => 'required'))), array('type' => 'section', 'title' => __('Import From', 'wp-ultimate-recipe'), 'name' => 'secion_import_recipes_plugins', 'fields' => array(array('type' => 'notebox', 'name' => 'import_recipes_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'html', 'name' => 'import_recipes_cooked' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_cooked')), array('type' => 'html', 'name' => 'import_recipes_easyrecipe' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_easyrecipe')), array('type' => 'html', 'name' => 'import_recipes_recipecard' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_recipecard')), array('type' => 'html', 'name' => 'import_recipes_recipress' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_recipress')), array('type' => 'html', 'name' => 'import_recipes_ziplist' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_ziplist')), array('type' => 'html', 'name' => 'import_recipes_xml' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_xml')), array('type' => 'html', 'name' => 'import_recipes_xml_ingredients' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_xml_ingredients')), array('type' => 'html', 'name' => 'import_recipes_fdx' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_import_fdx')))))), array('title' => __('Export Recipes', 'wp-ultimate-recipe'), 'name' => 'export_recipes', 'icon' => 'font-awesome:fa-download', 'controls' => array(array('type' => 'notebox', 'name' => 'export_recipes_premium_not_installed', 'label' => 'WP Ultimate Recipe Premium', 'description' => __('These features are only available in ', 'wp-ultimate-recipe') . ' <a href="http://www.wpultimaterecipeplugin.com/premium/" target="_blank">WP Ultimate Recipe Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpurp_admin_premium_not_installed')), array('type' => 'html', 'name' => 'export_recipes_xml' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_admin_export_xml')))), array('title' => __('Advanced', 'wp-ultimate-recipe'), 'name' => 'advanced', 'icon' => 'font-awesome:fa-wrench', 'controls' => array(array('type' => 'section', 'title' => __('Recipe', 'wp-ultimate-recipe'), 'name' => 'advanced_section_recipe', 'fields' => array(array('type' => 'html', 'name' => 'advanced_reset_demo_recipe' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_reset_demo_recipe')), array('type' => 'toggle', 'name' => 'recipe_as_posts', 'label' => __('Recipes act as posts', 'wp-ultimate-recipe'), 'description' => __('Recipes act like normal posts. For example: they show up on your front page.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'show_recipes_in_posts', 'label' => __('Recipes in admin posts', 'wp-ultimate-recipe'), 'description' => __('Show recipes in admin posts overview when acting as posts.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'remove_recipe_slug', 'label' => __('Remove recipe slug', 'wp-ultimate-recipe'), 'description' => __('Make sure your slugs are unique across posts, pages and recipes! Your archive page will still be available.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'output_yandex_metadata', 'label' => __('Use Yandex metadata', 'wp-ultimate-recipe'), 'description' => __('Add a resultPhoto meta field for Yandex.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'ignore_ingredient_ids', 'label' => __('Ignore Ingredient IDs', 'wp-ultimate-recipe'), 'description' => __('Can be useful when using content copy plugins.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'toggle', 'name' => 'disable_ingredient_autocomplete', 'label' => __('Disable Ingredient Autocomplete', 'wp-ultimate-recipe'), 'description' => __('Disable the ingredient suggestions when entering them in the recipe form.', 'wp-ultimate-recipe'), 'default' => '0'))), array('type' => 'section', 'title' => __('Shortcode Editor', 'wp-ultimate-recipe'), 'name' => 'advanced_section_shortcode', 'fields' => array(array('type' => 'html', 'name' => 'advanced_reset_cache' . $sitehash, 'binding' => array('field' => '', 'function' => 'wpurp_reset_cache')), array('type' => 'multiselect', 'name' => 'shortcode_editor_post_types', 'label' => __('Show shortcode editor for', 'wp-ultimate-recipe'), 'description' => __('Where do you want to be able to insert recipes with the shortcode editor?', 'wp-ultimate-recipe'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpurp_admin_post_types'))), 'default' => array('{{all}}')))), array('type' => 'section', 'title' => __('Performance', 'wp-ultimate-recipe'), 'name' => 'advanced_section_performance', 'fields' => array(array('type' => 'toggle', 'name' => 'overview_show_recipe_thumbnails', 'label' => __('Show Thumbnails in Overview', 'wp-ultimate-recipe'), 'description' => __('Show the recipe thumbnails on the recipe overview page.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'overview_show_recipe_rating', 'label' => __('Show Rating in Overview', 'wp-ultimate-recipe'), 'description' => __('Show the recipe rating on the recipe overview page.', 'wp-ultimate-recipe'), 'default' => '1'))), array('type' => 'section', 'title' => __('Assets', 'wp-ultimate-recipe'), 'name' => 'advanced_section_assets', 'fields' => array(array('type' => 'toggle', 'name' => 'assets_use_minified', 'label' => __('Use minified assets', 'wp-ultimate-recipe'), 'description' => __('Use minified assets to improve page load speed.', 'wp-ultimate-recipe'), 'default' => '1'), array('type' => 'toggle', 'name' => 'assets_generate_minified', 'label' => __('Generate minified assets', 'wp-ultimate-recipe'), 'description' => __('Generate minified assets on the fly.', 'wp-ultimate-recipe'), 'default' => '0'), array('type' => 'textbox', 'name' => 'assets_generate_minified_dir', 'label' => __('Minified assets directory', 'wp-ultimate-recipe'), 'description' => __('Directory to generate the minified assets to. Should be writable.', 'wp-ultimate-recipe'), 'default' => '', 'dependency' => array('field' => 'assets_generate_minified', 'function' => 'vp_dep_boolean')))))), array('title' => __('Custom Code', 'wp-ultimate-recipe'), 'name' => 'custom_code', 'icon' => 'font-awesome:fa-code', 'controls' => array(array('type' => 'codeeditor', 'name' => 'custom_code_public_css', 'label' => __('Public CSS', 'wp-ultimate-recipe'), 'theme' => 'github', 'mode' => 'css'), array('type' => 'codeeditor', 'name' => 'custom_code_print_css', 'label' => __('Print Recipe CSS', 'wp-ultimate-recipe'), 'theme' => 'github', 'mode' => 'css'), array('type' => 'codeeditor', 'name' => 'custom_code_print_shoppinglist_css', 'label' => __('Print Shopping List CSS', 'wp-ultimate-recipe'), 'theme' => 'github', 'mode' => 'css')))));
示例#12
0
 /**
  * TODO Refactor this.
  */
 private function tags_list($recipe)
 {
     $tags = array();
     $taxonomies = WPUltimateRecipe::get()->tags();
     unset($taxonomies['ingredient']);
     foreach ($taxonomies as $taxonomy => $options) {
         if (!in_array($taxonomy, WPUltimateRecipe::option('recipe_tags_hide_in_recipe', array()))) {
             $terms = get_the_term_list($recipe->ID(), $taxonomy, '', ', ');
             if (!is_wp_error($terms) && $terms != '') {
                 $tags[$options['labels']['singular_name']] = $terms;
             }
         }
     }
     // Categories as tags
     if (WPUltimateRecipe::is_addon_active('custom-taxonomies') && WPUltimateRecipe::option('recipe_tags_show_in_recipe', '0') == '1') {
         $categories = wp_get_post_categories($recipe->ID());
         $category_groups = array();
         foreach ($categories as $category) {
             $cat = get_category($category);
             if (!is_null($cat->parent) && $cat->parent != 0) {
                 $category_groups[$cat->parent][] = $cat;
             }
         }
         foreach ($category_groups as $group => $categories) {
             $group_category = get_category($group);
             $group_name = $group_category->name;
             $cats = array();
             foreach ($categories as $cat) {
                 $link = get_category_link($cat->cat_ID);
                 $cats[] = '<a href="' . $link . '">' . $cat->name . '</a>';
             }
             $tags[$group_name] = implode(', ', $cats);
         }
     }
     return apply_filters('wpurp_output_recipe_block_recipe-tags_terms', $tags, $recipe);
 }
示例#13
0
    public function output($recipe, $args = array())
    {
        if (!$this->output_block($recipe, $args)) {
            return '';
        }
        // Default arguments
        $args['desktop'] = true;
        $args['max_width'] = 9999;
        $args['max_height'] = 9999;
        $args['max_width'] = $this->max_width && $args['max_width'] > $this->max_width ? $this->max_width : $args['max_width'];
        $args['max_height'] = $this->max_height && $args['max_height'] > $this->max_height ? $this->max_height : $args['max_height'];
        if (isset($args['classes'])) {
            $this->classes = $args['classes'];
        }
        if (isset($args['wp-ultimate-post-grid'])) {
            $this->add_style('position', 'absolute');
        }
        $meta = $args['template_type'] == 'recipe' || $args['template_type'] == 'metadata' ? ' itemscope itemtype="http://schema.org/Recipe"' : '';
        $output = $this->before_output();
        ob_start();
        ?>
<div<?php 
        echo $meta;
        ?>
 id="wpurp-container-recipe-<?php 
        echo $recipe->ID();
        ?>
" data-permalink="<?php 
        echo $recipe->link();
        ?>
" data-servings-original="<?php 
        echo $recipe->servings_normalized();
        ?>
"<?php 
        echo $this->style();
        ?>
>

<?php 
        if ($args['template_type'] == 'recipe' || $args['template_type'] == 'metadata') {
            ?>
    <meta itemprop="url" content="<?php 
            echo esc_attr($recipe->link());
            ?>
" />
    <meta itemprop="author" content="<?php 
            echo esc_attr($recipe->author());
            ?>
">
    <meta itemprop="datePublished" content="<?php 
            echo esc_attr($recipe->date());
            ?>
">
    <meta itemprop="recipeYield" content="<?php 
            echo esc_attr($recipe->servings()) . ' ' . esc_attr($recipe->servings_type());
            ?>
">

    <?php 
            if (WPUltimateRecipe::option('output_yandex_metadata', '0') == '1') {
                ?>
    <link itemprop="resultPhoto" href="<?php 
                echo esc_attr($recipe->image_url('full'));
                ?>
">
    <?php 
            }
            ?>

    <?php 
            // Ratings metadata
            $show_rating = false;
            $count = null;
            $rating = null;
            // Check user ratings
            if (WPUltimateRecipe::is_addon_active('user-ratings') && WPUltimateRecipe::option('user_ratings_enable', 'everyone') != 'disabled') {
                $rating_data = WPURP_User_Ratings::get_recipe_rating($recipe->ID());
                $count = $rating_data['votes'];
                $rating = $rating_data['rating'];
                // Optional rounding
                $rounding = WPUltimateRecipe::option('user_ratings_rounding', 'disabled');
                if ($rounding == 'half') {
                    $rating = ceil($rating * 2) / 2;
                } else {
                    if ($rounding == 'integer') {
                        $rating = ceil($rating);
                    }
                }
                // Do we have the minimum # of votes?
                $minimum_votes = intval(WPUltimateRecipe::option('user_ratings_minimum_votes', '1'));
                $show_rating = $count >= $minimum_votes ? true : false;
            }
            // Use the author rating if we don't already have a rating to display
            if (!$show_rating) {
                $count = 1;
                $rating = $recipe->rating_author();
                if ($rating != 0) {
                    $show_rating = true;
                }
            }
            if ($show_rating) {
                ?>
    <div class="wpurp-meta" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
        <meta itemprop="ratingValue" content="<?php 
                echo $rating;
                ?>
">
        <meta itemprop="reviewCount" content="<?php 
                echo $count;
                ?>
">
    </div>
    <?php 
            }
            ?>

    <?php 
            // Nutritional Metadata
            if (WPUltimateRecipe::is_addon_active('nutritional-information')) {
                $nutritional_meta = '<div class="wpurp-meta" itemprop="nutrition" itemscope itemtype="http://schema.org/NutritionInformation">';
                $nutritional = $recipe->nutritional();
                $mapping = array('calories' => 'calories', 'fat' => 'fatContent', 'saturated_fat' => 'saturatedFatContent', 'unsaturated_fat' => 'unsaturatedFatContent', 'trans_fat' => 'transFatContent', 'carbohydrate' => 'carbohydrateContent', 'sugar' => 'sugarContent', 'fiber' => 'fiberContent', 'protein' => 'proteinContent', 'cholesterol' => 'cholesterolContent', 'sodium' => 'sodiumContent');
                // Unsaturated Fat = mono + poly
                if (isset($nutritional['monounsaturated_fat']) && $nutritional['monounsaturated_fat'] !== '') {
                    $nutritional['unsaturated_fat'] = floatval($nutritional['monounsaturated_fat']);
                }
                if (isset($nutritional['polyunsaturated_fat']) && $nutritional['polyunsaturated_fat'] !== '') {
                    $mono = isset($nutritional['unsaturated_fat']) ? $nutritional['unsaturated_fat'] : 0;
                    $nutritional['unsaturated_fat'] = $mono + floatval($nutritional['polyunsaturated_fat']);
                }
                // Output metadata
                $nutritional_meta_set = false;
                foreach ($mapping as $field => $meta_field) {
                    if (isset($nutritional[$field]) && $nutritional[$field] !== '') {
                        $nutritional_meta_set = true;
                        $nutritional_meta .= '<meta itemprop="' . $meta_field . '" content="' . floatval($nutritional[$field]) . '">';
                    }
                }
                $nutritional_meta .= '</div>';
                if ($nutritional_meta_set) {
                    echo $nutritional_meta;
                }
            }
        }
        ?>

<?php 
        if ($args['template_type'] == 'metadata') {
            ?>

    <meta itemprop="image" content="<?php 
            echo esc_attr($recipe->image_url('full'));
            ?>
">
    <meta itemprop="name" content="<?php 
            echo esc_attr($recipe->title());
            ?>
">
    <meta itemprop="description" content="<?php 
            echo esc_attr($recipe->description());
            ?>
">
    <?php 
            if ($recipe->prep_time_meta()) {
                ?>
<meta itemprop="prepTime" content="<?php 
                echo $recipe->prep_time_meta();
                ?>
"><?php 
            }
            ?>
    <?php 
            if ($recipe->cook_time_meta()) {
                ?>
<meta itemprop="cookTime" content="<?php 
                echo $recipe->cook_time_meta();
                ?>
"><?php 
            }
            ?>
    <?php 
            // Ingredients metadata (done here to avoid doubles)
            if ($recipe->has_ingredients()) {
                $previous_group = null;
                foreach ($recipe->ingredients() as $ingredient) {
                    $group = isset($ingredient['group']) ? $ingredient['group'] : '';
                    if ($group !== $previous_group) {
                        if (!is_null($previous_group)) {
                            echo '</div>';
                        }
                        echo '<div class="wpurp-meta wpurp-meta-ingredient-group" content="' . esc_attr($group) . '">';
                        $previous_group = $group;
                    }
                    $meta = $ingredient['amount'] . ' ' . $ingredient['unit'] . ' ' . $ingredient['ingredient'];
                    if (trim($ingredient['notes']) !== '') {
                        $meta .= ' (' . $ingredient['notes'] . ')';
                    }
                    echo '<meta itemprop="ingredients" content="' . esc_attr($meta) . '">';
                }
                echo '</div>';
            }
            // Instructions metadata
            if ($recipe->has_instructions()) {
                $previous_group = null;
                foreach ($recipe->instructions() as $instruction) {
                    $group = isset($instruction['group']) ? $instruction['group'] : '';
                    if ($group !== $previous_group) {
                        if (!is_null($previous_group)) {
                            echo '</div>';
                        }
                        echo '<div class="wpurp-meta wpurp-meta-instruction-group" content="' . esc_attr($group) . '">';
                        $previous_group = $group;
                    }
                    echo '<meta itemprop="recipeInstructions" content="' . esc_attr($instruction['description']) . '">';
                }
                echo '</div>';
            }
        }
        ?>

    <?php 
        $this->output_children($recipe, 0, 0, $args);
        ?>
</div>
<?php 
        $output .= ob_get_contents();
        ob_end_clean();
        return $this->after_output($output, $recipe);
    }
 public function get()
 {
     $args = array('post_type' => 'recipe', 'post_status' => $this->post_status, 'orderby' => $this->order_by, 'order' => $this->order, 'posts_per_page' => $this->limit, 'offset' => $this->offset, 'ignore_sticky_posts' => 1);
     if ($this->limit == -1) {
         $args['nopaging'] = true;
     }
     if ($this->author) {
         $args['author'] = $this->author;
     }
     if ($this->date_from || $this->date_to) {
         $args['date_query'] = array('inclusive' => true);
         if ($this->date_from) {
             $args['date_query']['after'] = array('year' => $this->date_from['year'], 'month' => $this->date_from['month'], 'day' => $this->date_from['day']);
         }
         if ($this->date_to) {
             $args['date_query']['before'] = array('year' => $this->date_to['year'], 'month' => $this->date_to['month'], 'day' => $this->date_to['day']);
         }
     }
     if ($this->taxonomy && !$this->term) {
         $args['tax_query'] = array('taxonomy' => $this->taxonomy);
     }
     if ($this->taxonomy && $this->term) {
         if ($this->taxonomy == 'category') {
             $args['category_name'] = $this->term;
         } else {
             if ($this->taxonomy == 'post_tag') {
                 $args['tag'] = $this->term;
             } else {
                 $args[$this->taxonomy] = $this->term;
             }
         }
     }
     if ($this->ids) {
         $args['post__in'] = $this->ids;
     }
     if ($this->ids_only) {
         $args['fields'] = 'ids';
     }
     // Special order bys
     if (in_array($this->order_by, array('post_title', 'title', 'name'))) {
         $args['orderby'] = 'meta_value';
         $args['meta_key'] = 'recipe_title';
     }
     if ($this->order_by == 'rating') {
         $args['orderby'] = 'meta_value_num';
         if (WPUltimateRecipe::is_addon_active('user-ratings') && WPUltimateRecipe::option('user_ratings_enable', 'everyone') != 'disabled') {
             $args['meta_key'] = 'recipe_user_ratings_rating';
         } else {
             $args['meta_key'] = 'recipe_rating';
         }
     }
     // Images only
     if ($this->images_only) {
         $args['meta_query'] = array(array('key' => '_thumbnail_id', 'value' => '0', 'compare' => '>'));
     }
     $query = new WP_Query($args);
     $recipes = array();
     if ($query->have_posts()) {
         $posts = $query->posts;
         if ($this->ids_only) {
             // Reset to defaults for next query
             $this->defaults();
             return $posts;
         }
         foreach ($posts as $post) {
             $recipes[] = new WPURP_Recipe($post);
         }
     }
     // Reset to defaults for next query
     $this->defaults();
     return $recipes;
 }
示例#15
0
 /**
  * TODO Refactor this.
  */
 private function tags_list($recipe)
 {
     $tags = array();
     $tag_links = WPUltimateRecipe::option('recipe_tags_links', 'archive_custom');
     $taxonomies = WPUltimateRecipe::get()->tags();
     unset($taxonomies['ingredient']);
     foreach ($taxonomies as $taxonomy => $options) {
         if (!in_array($taxonomy, WPUltimateRecipe::option('recipe_tags_hide_in_recipe', array()))) {
             $terms = get_the_terms($recipe->ID(), $taxonomy);
             if ($terms && !is_wp_error($terms)) {
                 $links = array();
                 foreach ($terms as $term) {
                     $opening_tag = '';
                     $closing_tag = '';
                     if ($tag_links !== 'disabled') {
                         if ($tag_links == 'archive_custom' || $tag_links == 'custom') {
                             $custom_link = WPURP_Taxonomy_MetaData::get($taxonomy, $term->slug, 'wpurp_link');
                         } else {
                             $custom_link = false;
                         }
                         if ($custom_link !== false && $custom_link !== '') {
                             $nofollow = WPUltimateRecipe::option('recipe_tags_custom_links_nofollow', '0') == '1' ? ' rel="nofollow"' : '';
                             $opening_tag = '<a href="' . $custom_link . '" class="custom-tag-link" target="' . WPUltimateRecipe::option('recipe_tags_custom_links_target', '_blank') . '"' . $nofollow . '>';
                             $closing_tag = '</a>';
                         } else {
                             if ($tag_links != 'custom') {
                                 $opening_tag = '<a href="' . get_term_link($term->slug, $taxonomy) . '">';
                                 $closing_tag = '</a>';
                             }
                         }
                     }
                     $links[] = $opening_tag . $term->name . $closing_tag;
                 }
                 // Get name at this point in time to have correct WPML translation
                 $tax = get_taxonomy($taxonomy);
                 $label = __($tax->labels->singular_name, 'wp-ultimate-recipe');
                 $tags[$label] = join(', ', $links);
             }
         }
     }
     // Categories as tags
     if (WPUltimateRecipe::is_addon_active('custom-taxonomies') && WPUltimateRecipe::option('recipe_tags_show_in_recipe', '0') == '1') {
         $categories = wp_get_post_categories($recipe->ID());
         $category_groups = array();
         foreach ($categories as $category) {
             $cat = get_category($category);
             if (!is_null($cat->parent) && $cat->parent != 0) {
                 $category_groups[$cat->parent][] = $cat;
             }
         }
         foreach ($category_groups as $group => $categories) {
             $group_category = get_category($group);
             $group_name = $group_category->name;
             $cats = array();
             foreach ($categories as $cat) {
                 $link = get_category_link($cat->cat_ID);
                 $cats[] = '<a href="' . $link . '">' . $cat->name . '</a>';
             }
             $tags[$group_name] = implode(', ', $cats);
         }
     }
     return apply_filters('wpurp_output_recipe_block_recipe-tags_terms', $tags, $recipe);
 }