Beispiel #1
0
 public function print_recipe($recipe, $parameters)
 {
     // Get Serving Size
     preg_match("/[0-9\\.,]+/", $parameters, $servings);
     $servings = empty($servings) ? 0.0 : floatval(str_replace(',', '.', $servings[0]));
     if ($servings <= 0) {
         $servings = $recipe->servings_normalized();
     }
     if (WPUltimateRecipe::is_premium_active()) {
         // Get Unit System
         $unit_system = false;
         $requested_systems = explode('/', $parameters);
         $systems = WPUltimateRecipe::get()->helper('ingredient_units')->get_active_systems();
         foreach ($systems as $id => $options) {
             foreach ($requested_systems as $requested_system) {
                 if ($requested_system == $this->convertToSlug($options['name'])) {
                     $unit_system = $id;
                 }
             }
         }
     }
     // Get Template
     $template = WPUltimateRecipe::get()->template('print', 'default');
     $fonts = false;
     if (isset($template->fonts) && count($template->fonts) > 0) {
         $fonts = 'http://fonts.googleapis.com/css?family=' . implode('|', $template->fonts);
     }
     include 'print_template.php';
 }
 public function vafpress_menu_init()
 {
     $defaults = $this->defaults;
     require_once WPUltimateRecipe::get()->coreDir . '/helpers/vafpress/vafpress_menu_whitelist.php';
     require_once WPUltimateRecipe::get()->coreDir . '/helpers/vafpress/vafpress_menu_options.php';
     new VP_Option(array('is_dev_mode' => false, 'option_key' => 'wpurp_option', 'page_slug' => 'wpurp_admin', 'template' => $admin_menu, 'menu_page' => 'edit.php?post_type=recipe', 'use_auto_group_naming' => true, 'use_exim_menu' => true, 'minimum_role' => 'manage_options', 'layout' => 'fluid', 'page_title' => __('Settings', 'wp-ultimate-recipe'), 'menu_label' => __('Settings', 'wp-ultimate-recipe')));
 }
 function index_shortcode($options)
 {
     $options = shortcode_atts(array('headers' => 'false'), $options);
     $query = WPUltimateRecipe::get()->helper('query_recipes');
     $recipes = $query->order_by('title')->order('ASC')->get();
     $out = '<div class="wpurp-index-container">';
     if ($recipes) {
         $letters = array();
         foreach ($recipes as $recipe) {
             $title = $recipe->title();
             if ($title) {
                 if ($options['headers'] != 'false') {
                     $first_letter = strtoupper(mb_substr($title, 0, 1));
                     if (!in_array($first_letter, $letters)) {
                         $letters[] = $first_letter;
                         $out .= '<h2>';
                         $out .= $first_letter;
                         $out .= '</h2>';
                     }
                 }
                 $out .= '<a href="' . $recipe->link() . '">';
                 $out .= $title;
                 $out .= '</a><br/>';
             }
         }
     } else {
         $out .= __("You have to create a recipe first, check the 'Recipes' menu on the left.", 'wp-ultimate-recipe');
     }
     $out .= '</div>';
     return $out;
 }
 public function add_taxonomy()
 {
     if (!wp_verify_nonce($_POST['add_taxonomy_nonce'], 'add_taxonomy')) {
         die('Invalid nonce.' . var_export($_POST, true));
     }
     $name = $_POST['wpurp_custom_taxonomy_name'];
     $singular = $_POST['wpurp_custom_taxonomy_singular_name'];
     $slug = str_replace(' ', '-', strtolower($_POST['wpurp_custom_taxonomy_slug']));
     $edit_tag_name = $_POST['wpurp_edit'];
     $editing = false;
     if (strlen($edit_tag_name) > 0) {
         $editing = true;
     }
     if (!$editing) {
         die('There was an unexpected error. Please try again.');
     }
     if (!$editing && taxonomy_exists(strtolower($singular))) {
         die('This taxonomy already exists.');
     }
     if (strlen($name) > 1 && strlen($singular) > 1) {
         $taxonomies = WPUltimateRecipe::get()->tags();
         $name_lower = strtolower($name);
         // Cannot add tags in the basic version
         $tag_name = $edit_tag_name;
         // TODO Filter this to allow customizing
         $taxonomies[$tag_name] = array('labels' => array('name' => $name, 'singular_name' => $singular, 'search_items' => __('Search', 'wp-ultimate-recipe') . ' ' . $name, 'popular_items' => __('Popular', 'wp-ultimate-recipe') . ' ' . $name, 'all_items' => __('All', 'wp-ultimate-recipe') . ' ' . $name, 'edit_item' => __('Edit', 'wp-ultimate-recipe') . ' ' . $singular, 'update_item' => __('Update', 'wp-ultimate-recipe') . ' ' . $singular, 'add_new_item' => __('Add New', 'wp-ultimate-recipe') . ' ' . $singular, 'new_item_name' => __('New', 'wp-ultimate-recipe') . ' ' . $singular . ' ' . __('Name', 'wp-ultimate-recipe'), 'separate_items_with_commas' => __('Separate', 'wp-ultimate-recipe') . ' ' . $name_lower . ' ' . __('with commas', 'wp-ultimate-recipe'), 'add_or_remove_items' => __('Add or remove', 'wp-ultimate-recipe') . ' ' . $name_lower, 'choose_from_most_used' => __('Choose from the most used', 'wp-ultimate-recipe') . ' ' . $name_lower, 'not_found' => __('No', 'wp-ultimate-recipe') . ' ' . $name_lower . ' ' . __('found.', 'wp-ultimate-recipe'), 'menu_name' => $name), 'show_ui' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => array('slug' => $slug, 'hierarchical' => true));
         WPUltimateRecipe::get()->helper('taxonomies')->update($taxonomies);
         WPUltimateRecipe::get()->helper('taxonomies')->check_recipe_taxonomies();
         WPUltimateRecipe::get()->helper('permalinks_flusher')->set_flush_needed();
     }
     wp_redirect($_SERVER['HTTP_REFERER']);
     exit;
 }
Beispiel #5
0
 public function __construct($name)
 {
     $this->addonPath = '/addons/' . $name;
     $this->addonDir = WPUltimateRecipe::get()->coreDir . $this->addonPath;
     $this->addonUrl = WPUltimateRecipe::get()->coreUrl . $this->addonPath;
     $this->addonName = $name;
 }
Beispiel #6
0
 public function check_manual_reset()
 {
     if (isset($_GET['wpurp_reset_cache'])) {
         $this->reset();
         WPUltimateRecipe::get()->helper('notices')->add_admin_notice('<strong>WP Ultimate Recipe</strong> The cache has been reset');
     }
 }
 public function hide()
 {
     if (isset($_GET['wpurp_hide_getting_started'])) {
         check_admin_referer('wpurp_hide_getting_started', 'wpurp_hide_getting_started');
         update_user_meta(get_current_user_id(), '_wpurp_hide_getting_started', get_option(WPUltimateRecipe::get()->pluginName . '_version'));
     }
 }
    public function output($recipe, $args = array())
    {
        if (!$this->output_block($recipe, $args)) {
            return '';
        }
        $icon = '<i class="fa ' . esc_attr($this->icon) . '"></i>';
        $classes = array();
        $tooltip_text = WPUltimateRecipe::option('add_to_meal_plan_tooltip_text', __('Add to Meal Plan:', 'wp-ultimate-recipe'));
        $tooltip_alt_text = WPUltimateRecipe::option('added_to_meal_plan_tooltip_text', __('This recipe has been added to your Meal Plan', 'wp-ultimate-recipe'));
        $classes[] = 'recipe-tooltip';
        $this->classes = $classes;
        $output = $this->before_output();
        ob_start();
        ?>
<a href="#"<?php 
        echo $this->style();
        ?>
 data-recipe-id="<?php 
        echo $recipe->ID();
        ?>
"><?php 
        echo $icon;
        ?>
</a>
<div class="recipe-tooltip-content">
    <div class="tooltip-shown">
        <span class="wpurp-meal-plan-button-text"><?php 
        echo $tooltip_text;
        ?>
</span>
        <input type="text" class="wpurp-meal-plan-button-date" value="<?php 
        $today = new DateTime('today', WPUltimateRecipe::get()->timezone());
        echo $today->format('m/d/Y');
        ?>
">
        <select class="wpurp-meal-plan-button-course">
            <option value="0"><?php 
        _e('Select Course to Add:', 'wp-ultimate-recipe');
        ?>
</option>
            <?php 
        $meal_plan = WPUltimateRecipe::addon('meal-planner')->get_meal_plan();
        foreach ($meal_plan['courses'] as $course) {
            echo '<option value="' . esc_attr($course) . '">' . $course . '</option>';
        }
        ?>
        </select>
    </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);
    }
 public function cron_migrations()
 {
     $cron_migrate_version = get_option('wpurp_cron_migrate_version', '0.0.1');
     if ($cron_migrate_version < '2.3.3') {
         require_once WPUltimateRecipe::get()->coreDir . '/helpers/migration/cron_2_3_3_recipe_search.php';
     } elseif ($cron_migrate_version < '2.4') {
         // Example cron migration for 2.4
     }
 }
Beispiel #10
0
 public function faq_page()
 {
     if (!current_user_can('edit_posts')) {
         wp_die('You do not have sufficient permissions to access this page.');
     }
     // Hide the new user notice
     update_user_meta(get_current_user_id(), '_wpurp_hide_new_notice', get_option(WPUltimateRecipe::get()->pluginName . '_version'));
     include WPUltimateRecipe::get()->coreDir . '/static/faq.php';
 }
 public function register_recipe_post_type()
 {
     $slug = WPUltimateRecipe::option('recipe_slug', 'recipe');
     $name = __('Recipes', 'wp-ultimate-recipe');
     $singular = __('Recipe', 'wp-ultimate-recipe');
     $taxonomies = array('');
     if (WPUltimateRecipe::option('recipe_tags_use_wp_categories', '1') == '1') {
         $taxonomies = array('category', 'post_tag');
     }
     $has_archive = WPUltimateRecipe::option('recipe_archive_disabled', '0') == '1' ? false : true;
     $args = apply_filters('wpurp_register_post_type', array('labels' => array('name' => $name, 'singular_name' => $singular, 'add_new' => __('Add New', 'wp-ultimate-recipe'), 'add_new_item' => __('Add New', 'wp-ultimate-recipe') . ' ' . $singular, 'edit' => __('Edit', 'wp-ultimate-recipe'), 'edit_item' => __('Edit', 'wp-ultimate-recipe') . ' ' . $singular, 'new_item' => __('New', 'wp-ultimate-recipe') . ' ' . $singular, 'view' => __('View', 'wp-ultimate-recipe'), 'view_item' => __('View', 'wp-ultimate-recipe') . ' ' . $singular, 'search_items' => __('Search', 'wp-ultimate-recipe') . ' ' . $name, 'not_found' => __('No', 'wp-ultimate-recipe') . ' ' . $name . ' ' . __('found.', 'wp-ultimate-recipe'), 'not_found_in_trash' => __('No', 'wp-ultimate-recipe') . ' ' . $name . ' ' . __('found in trash.', 'wp-ultimate-recipe'), 'parent' => __('Parent', 'wp-ultimate-recipe') . ' ' . $singular), 'public' => true, 'menu_position' => 5, 'supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpt', 'author', 'publicize', 'shortlinks', 'genesis-simple-sidebars'), 'yarpp_support' => true, 'taxonomies' => $taxonomies, 'menu_icon' => WPUltimateRecipe::get()->coreUrl . '/img/icon_16.png', 'has_archive' => $has_archive, 'rewrite' => array('slug' => $slug), 'show_in_rest' => true));
     register_post_type('recipe', $args);
 }
 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));
     }
 }
Beispiel #13
0
 private function stars_author($recipe)
 {
     $star_full = '<img src="' . WPUltimateRecipe::get()->coreUrl . '/img/star.png" width="15" height="14">';
     $star_empty = '<img src="' . WPUltimateRecipe::get()->coreUrl . '/img/star_grey.png" width="15" height="14">';
     $rating = $recipe->rating_author();
     $stars = '';
     if ($rating != 0) {
         for ($i = 1; $i <= 5; $i++) {
             if ($i <= $rating) {
                 $stars .= $star_full;
             } else {
                 $stars .= $star_empty;
             }
         }
     }
     return $stars;
 }
 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);
 }
    public function output($recipe, $args = array())
    {
        if (!$this->output_block($recipe, $args)) {
            return '';
        }
        if (!$this->icon) {
            $icon = '<img src="' . WPUltimateRecipe::get()->coreUrl . '/img/printer.png">';
        } else {
            $icon = '<i class="fa ' . esc_attr($this->icon) . '"></i>';
        }
        $tooltip_text = WPUltimateRecipe::option('print_tooltip_text', __('Print Recipe', 'wp-ultimate-recipe'));
        if ($tooltip_text) {
            $this->classes = array('recipe-tooltip');
        }
        $recipe_id = WPUltimateRecipe::option('print_version_legacy_code', '0') == '1' ? ' data-recipe-id="' . $recipe->ID() . '"' : '';
        $output = $this->before_output();
        ob_start();
        ?>
<a href="<?php 
        echo $recipe->link_print();
        ?>
" target="_blank"<?php 
        echo $recipe_id . $this->style();
        ?>
><?php 
        echo $icon;
        ?>
</a>
<?php 
        if ($tooltip_text) {
            ?>
<div class="recipe-tooltip-content">
    <?php 
            echo $tooltip_text;
            ?>
</div>
<?php 
        }
        $output .= ob_get_contents();
        ob_end_clean();
        return $this->after_output($output, $recipe);
    }
 public function term_management_tool($to, $from)
 {
     if ($from->taxonomy == 'ingredient' && $to->taxonomy == 'ingredient') {
         // Check all recipes with new term for ingredients with the old term
         $recipes = WPUltimateRecipe::get()->query()->taxonomy('ingredient')->term($to->slug)->get();
         foreach ($recipes as $recipe) {
             $ingredients = $recipe->ingredients();
             $update = false;
             foreach ($ingredients as $index => $ingredient) {
                 if ($ingredient['ingredient_id'] == $from->term_id) {
                     $update = true;
                     $ingredients[$index]['ingredient_id'] = $to->term_id;
                     $ingredients[$index]['ingredient'] = $to->name;
                 }
             }
             if ($update) {
                 update_post_meta($recipe->ID(), 'recipe_ingredients', $ingredients);
             }
         }
     }
 }
 public function content_filter($content)
 {
     $api_request = defined('REST_REQUEST');
     $ignore_query = apply_filters('wpurp_recipe_content_loop_check', !in_the_loop() || !is_main_query());
     if (!$api_request && !is_feed() && $ignore_query) {
         return $content;
     }
     if (get_post_type() == 'recipe') {
         remove_filter('the_content', array($this, 'content_filter'), 10);
         $recipe = new WPURP_Recipe(get_post());
         if (!post_password_required() && (is_single() || WPUltimateRecipe::option('recipe_archive_display', 'full') == 'full' || is_feed() && WPUltimateRecipe::option('recipe_rss_feed_display', 'full') == 'full')) {
             $taxonomies = WPUltimateRecipe::get()->tags();
             unset($taxonomies['ingredient']);
             $type = is_feed() ? 'feed' : 'recipe';
             $recipe_box = apply_filters('wpurp_output_recipe', $recipe->output_string($type), $recipe);
             if (strpos($content, '[recipe]') !== false) {
                 $content = str_replace('[recipe]', $recipe_box, $content);
             } else {
                 if (preg_match("/<!--\\s*nextpage.*-->/", $recipe->post_content(), $out)) {
                     // Add metadata if there is a 'nextpage' tag and there wasn't a '[recipe]' tag on this specific page
                     $content .= $recipe->output_string('metadata');
                 } else {
                     if (is_single() || !preg_match("/<!--\\s*more.*-->/", $recipe->post_content(), $out)) {
                         // Add recipe box to the end of single pages or excerpts (unless there's a 'more' tag
                         $content .= $recipe_box;
                     }
                 }
             }
         } else {
             $content = str_replace('[recipe]', '', $content);
             // Remove shortcode from excerpt
             $content = $this->excerpt_filter($content);
         }
         // Remove searchable part
         $content = preg_replace("/\\[wpurp-searchable-recipe\\][^\\[]*\\[\\/wpurp-searchable-recipe\\]/", "", $content);
         add_filter('the_content', array($this, 'content_filter'), 10);
     }
     return $content;
 }
    public function output($recipe, $args = array())
    {
        if (!$this->output_block($recipe, $args)) {
            return '';
        }
        $url = urlencode($recipe->link());
        $img = WPUltimateRecipe::get()->coreUrl . '/img/foodfanatic.png';
        $output = $this->before_output();
        ob_start();
        ?>
<a href="http://www.foodfanatic.com/recipe-box/add/?url=<?php 
        echo $url;
        ?>
" target="_blank"><img src="<?php 
        echo $img;
        ?>
"/></a>
<?php 
        $output .= ob_get_contents();
        ob_end_clean();
        return $this->after_output($output, $recipe);
    }
 public function load_pointers($hook)
 {
     // Admin pointers were introduced in WP 3.3
     if (get_bloginfo('version') < '3.3') {
         return;
     }
     // Get the screen ID
     $screen = get_current_screen();
     $screen_id = $screen->id;
     // Get pointers for all screens
     $pointers = apply_filters('wpurp_admin_tour', array());
     // Get pointers for this screen
     $pointers = array_merge($pointers, apply_filters('wpurp_admin_tour-' . $screen_id, array()));
     // No pointers? Then we stop.
     if (!$pointers || !is_array($pointers)) {
         return;
     }
     // Get dismissed pointers
     $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
     $valid_pointers = array();
     // Check pointers and remove dismissed ones.
     foreach ($pointers as $pointer_id => $pointer) {
         // Sanity check
         if (in_array($pointer_id, $dismissed) || empty($pointer) || empty($pointer_id) || empty($pointer['target']) || empty($pointer['options'])) {
             continue;
         }
         $pointer['pointer_id'] = $pointer_id;
         // Add the pointer to $valid_pointers array
         $valid_pointers['pointers'][] = $pointer;
     }
     // No valid pointers? Stop here.
     if (empty($valid_pointers)) {
         return;
     }
     // Add pointers style to queue.
     wp_enqueue_style('wp-pointer');
     // Add pointers script and our own custom script to queue.
     wp_enqueue_script('wpurp-admin-tour', WPUltimateRecipe::get()->coreUrl . '/js/admin_tour.js', array('wp-pointer'));
     // Add pointer options to script.
     wp_localize_script('wpurp-admin-tour', 'wpurp_admin_tour', $valid_pointers);
 }
<?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')))));
Beispiel #21
0
 public function output($type = 'recipe', $template = 'default')
 {
     $template = WPUltimateRecipe::get()->template($type, $template);
     $template->output($this, $type);
 }
    ?>
" />
                    <input class="recipe_instructions_remove_image button wpurp-hide" type="button" value="<?php 
    _e('Remove Image', 'wp-ultimate-recipe');
    ?>
" />
                    <br /><img src="<?php 
    echo $image;
    ?>
" class="recipe_instructions_thumbnail" />
                    <?php 
}
?>
                </td>
                <td><span class="instructions-delete"><img src="<?php 
echo WPUltimateRecipe::get()->coreUrl;
?>
/img/minus.png" width="16" height="16"></span></td>
            </tr>
        </tbody>
    </table>

    <div id="ingredients-add-box">
        <a href="#" id="instructions-add"><?php 
_e('Add an instruction', 'wp-ultimate-recipe');
?>
</a>
    </div>
    <div id="ingredients-add-group-box">
        <a href="#" id="instructions-add-group"><?php 
_e('Add an instruction group', 'wp-ultimate-recipe');
 public function add_support_tab()
 {
     include WPUltimateRecipe::get()->coreDir . '/static/support_tab.html';
 }
 public function recipe_meta_box_content($post)
 {
     $recipe = new WPURP_Recipe($post);
     include WPUltimateRecipe::get()->coreDir . '/helpers/recipe_form.php';
 }
function wpurp_admin_template_editor_recipe()
{
    return WPUltimateRecipe::get()->helper('cache')->get('recipes_by_title');
}
 public function activation_notice()
 {
     $notice = '<strong>WP Ultimate Recipe</strong><br/>';
     $notice .= '<a href="' . admin_url('edit.php?post_type=recipe&page=wpurp_faq&sub=whats_new') . '">Check out our latest changes on the <strong>Recipes > FAQ</strong> page</a>';
     WPUltimateRecipe::get()->helper('notices')->add_admin_notice($notice);
 }
 public function assets()
 {
     $fonts = array();
     $templates = array($this->get_template('recipe', 'default'), $this->get_template('grid', 'default'));
     foreach ($templates as $template) {
         if (isset($template->fonts) && count($template->fonts) > 0) {
             $fonts = array_merge($fonts, $template->fonts);
         }
     }
     if (count($fonts) > 0) {
         WPUltimateRecipe::get()->helper('assets')->add(array('type' => 'css', 'file' => '//fonts.googleapis.com/css?family=' . implode('|', array_unique($fonts)), 'direct' => true, 'public' => true));
     }
 }
        }
    }
    /**
     * Add a directory to look for helpers.
     */
    public function add_helper_directory($dir)
    {
        if (is_dir($dir)) {
            $this->helper_dirs[] = $dir;
        }
    }
    /*
     * Quick access functions
     */
    public function tags()
    {
        return $this->helper('taxonomies')->get();
    }
    public function query()
    {
        return $this->helper('query_recipes');
    }
    public function template($type, $template)
    {
        return $this->addon('custom-templates')->get_template($type, $template);
    }
}
// Premium version is responsible for instantiating if available
if (!class_exists('WPUltimateRecipePremium')) {
    WPUltimateRecipe::get();
}
<?php

/*
 * -> 2.1.4
 *
 * Fix normalized servings problem
 */
/**
 * Normalize servings and amounts
 */
// Get all recipe posts and loop through them
$recipes = WPUltimateRecipe::get()->query()->all();
foreach ($recipes as $recipe) {
    // Normalize servings
    $servings = WPUltimateRecipe::get()->helper('recipe_save')->normalize_servings($recipe->servings());
    update_post_meta($recipe->ID(), 'recipe_servings_normalized', $servings);
}
// Successfully migrated to 2.1.4
$migrate_version = '2.1.4';
update_option('wpurp_migrate_version', $migrate_version);
if ($notices) {
    WPUltimateRecipe::get()->helper('notices')->add_admin_notice('<strong>WP Ultimate Recipe</strong> Successfully migrated to 2.1.4+');
}
 /**
  * Save a list of the recipe terms so we can load the Recipe Grid faster
  */
 public function update_recipe_terms($recipe_id)
 {
     $taxonomies = WPUltimateRecipe::get()->tags();
     $taxonomies['category'] = array('labels' => array('name' => __('Categories', 'wp-ultimate-recipe')));
     $taxonomies['post_tag'] = array('labels' => array('name' => __('Tags', 'wp-ultimate-recipe')));
     $recipe_terms = array();
     $recipe_terms_with_parents = array();
     foreach ($taxonomies as $taxonomy => $options) {
         $terms = wp_get_post_terms($recipe_id, $taxonomy);
         $recipe_terms[$taxonomy] = array(0);
         $recipe_terms_with_parents[$taxonomy] = array(0);
         $parents = array();
         foreach ($terms as $term) {
             $recipe_terms[$taxonomy][] = $term->term_id;
             $recipe_terms_with_parents[$taxonomy][] = $term->term_id;
             if ($term->parent != 0) {
                 $parents[] = $term->parent;
             }
         }
         // Get term parents as well
         while (count($parents) > 0) {
             $children = $parents;
             $parents = array();
             foreach ($children as $child) {
                 $term = get_term($child, $taxonomy);
                 $recipe_terms_with_parents[$taxonomy][] = $term->term_id;
                 if ($term->parent != 0) {
                     $parents[] = $term->parent;
                 }
             }
         }
     }
     update_post_meta($recipe_id, 'recipe_terms', $recipe_terms);
     update_post_meta($recipe_id, 'recipe_terms_with_parents', $recipe_terms_with_parents);
 }