/**
  * Handles saving of recipes
  */
 public function save($id, $post)
 {
     if ($post->post_type == 'recipe') {
         if (!isset($_POST['recipe_meta_box_nonce']) || !wp_verify_nonce($_POST['recipe_meta_box_nonce'], 'recipe')) {
             return $id;
         }
         $recipe = new WPURP_Recipe($post);
         $searchable_recipe = $recipe->title();
         $searchable_recipe .= ' - ';
         $searchable_recipe .= $recipe->description();
         $searchable_recipe .= ' - ';
         if ($recipe->has_ingredients()) {
             $previous_group = null;
             foreach ($recipe->ingredients() as $ingredient) {
                 $group = isset($ingredient['group']) ? $ingredient['group'] : '';
                 if ($group !== $previous_group && $group) {
                     $searchable_recipe .= $group . ': ';
                     $previous_group = $group;
                 }
                 $searchable_recipe .= $ingredient['ingredient'];
                 if (trim($ingredient['notes']) !== '') {
                     $searchable_recipe .= ' (' . $ingredient['notes'] . ')';
                 }
                 $searchable_recipe .= ', ';
             }
         }
         if ($recipe->has_instructions()) {
             $previous_group = null;
             foreach ($recipe->instructions() as $instruction) {
                 $group = isset($instruction['group']) ? $instruction['group'] : '';
                 if ($group !== $previous_group && $group) {
                     $searchable_recipe .= $group . ': ';
                     $previous_group = $group;
                 }
                 $searchable_recipe .= $instruction['description'] . '; ';
             }
         }
         $searchable_recipe .= ' - ';
         $searchable_recipe .= $recipe->notes();
         // Prevent shortcodes
         $searchable_recipe = str_replace('[', '(', $searchable_recipe);
         $searchable_recipe = str_replace(']', ')', $searchable_recipe);
         $post_content = preg_replace("/<div class=\"wpurp-searchable-recipe\"[^<]*<\\/div>/", "", $post->post_content);
         // Backwards compatibility
         $post_content = preg_replace("/\\[wpurp-searchable-recipe\\][^\\[]*\\[\\/wpurp-searchable-recipe\\]/", "", $post_content);
         $post_content .= '[wpurp-searchable-recipe]';
         $post_content .= htmlentities($searchable_recipe);
         $post_content .= '[/wpurp-searchable-recipe]';
         remove_action('save_post', array($this, 'save'), 15, 2);
         wp_update_post(array('ID' => $recipe->ID(), 'post_content' => $post_content));
         update_post_meta($recipe->ID(), 'wpurp_text_search_3', time());
         add_action('save_post', array($this, 'save'), 15, 2);
     }
 }
 public function excerpt_filter($content)
 {
     $ignore_query = !in_the_loop() || !is_main_query();
     if (apply_filters('wpurp_recipe_content_loop_check', $ignore_query)) {
         return $content;
     }
     if (get_post_type() == 'recipe') {
         remove_filter('get_the_excerpt', array($this, 'excerpt_filter'), 10);
         $recipe = new WPURP_Recipe(get_post());
         $excerpt = $recipe->excerpt();
         $post_content = $recipe->post_content();
         $post_content = trim(preg_replace("/\\[wpurp-searchable-recipe\\][^\\[]*\\[\\/wpurp-searchable-recipe\\]/", "", $post_content));
         if ($post_content == '' && empty($excerpt)) {
             $content = $recipe->description();
         } else {
             if ($content == '') {
                 $content = get_the_excerpt();
             }
         }
         $content = apply_filters('wpurp_output_recipe_excerpt', $content, $recipe);
         add_filter('get_the_excerpt', array($this, 'excerpt_filter'), 10);
     }
     return $content;
 }
    }
    ?>
    <?php 
}
?>
        <tr class="recipe-general-form-description">
            <td class="recipe-general-form-label"><label for="recipe_description"><?php 
_e('Description', 'wp-ultimate-recipe');
if (in_array('recipe_description', $required_fields)) {
    echo '<span class="wpurp-required">*</span>';
}
?>
</label></td>
            <td class="recipe-general-form-field">
                <textarea name="recipe_description" id="recipe_description" rows="4"><?php 
echo $recipe->description();
?>
</textarea>
            </td>
        </tr>
        <tr class="recipe-general-form-rating">
            <td class="recipe-general-form-label"><label for="recipe_rating"><?php 
_e('Rating', 'wp-ultimate-recipe');
?>
</label></td>
            <td class="recipe-general-form-field">
                <select name="recipe_rating" id="recipe_rating">
                    <?php 
for ($i = 0; $i <= 5; $i++) {
    ?>
                    <option value="<?php 
<?php

$args = array('post_type' => 'recipe', 'post_status' => 'any', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 100, 'meta_query' => array(array('key' => 'wpurp_text_search', 'compare' => 'NOT EXISTS')));
$query = new WP_Query($args);
if ($query->have_posts()) {
    $posts = $query->posts;
    foreach ($posts as $post) {
        $recipe = new WPURP_Recipe($post);
        $searchable_recipe = $recipe->title();
        $searchable_recipe .= ' - ';
        $searchable_recipe .= $recipe->description();
        $searchable_recipe .= ' - ';
        if ($recipe->has_ingredients()) {
            $previous_group = null;
            foreach ($recipe->ingredients() as $ingredient) {
                $group = isset($ingredient['group']) ? $ingredient['group'] : '';
                if ($group !== $previous_group && $group) {
                    $searchable_recipe .= $group . ': ';
                    $previous_group = $group;
                }
                $searchable_recipe .= $ingredient['ingredient'];
                if (trim($ingredient['notes']) !== '') {
                    $searchable_recipe .= ' (' . $ingredient['notes'] . ')';
                }
                $searchable_recipe .= ', ';
            }
        }
        if ($recipe->has_instructions()) {
            $previous_group = null;
            foreach ($recipe->instructions() as $instruction) {
                $group = isset($instruction['group']) ? $instruction['group'] : '';