| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -30,8 +30,8 @@ function create_broadcast_post()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    );
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				add_action('init', 'create_broadcast_post');
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				add_action('add_meta_boxes', 'live_meta_box_add');
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				function live_meta_box_add()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    //give name of your input field
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -47,7 +47,7 @@ function orari_dirette_input($post)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    $broadcast = term_exists('Podcast', 'category', 0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    $old_term = term_exists($post->post_title, 'category', $broadcast);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				 ?>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					 <input type="hidden" name="taxonomy_id" value="<?php echo $old_term['term_id'] ?>" />
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					 <input type="hidden" name="taxonomy_id" value="<?php echo $old_term['term_id'] ?>" /> 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				<?php
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for ($x=0;$x<7;$x++) :
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        $onair_day[$x] = isset($values['on_air_day_'.$x]) ? esc_attr($values['on_air_day_'.$x][0]) : '';
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -60,14 +60,14 @@ function orari_dirette_input($post)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            <select name="on_air_day_<?php echo $x; ?>" id="on_air_day_<?php echo $x; ?>">
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]=='') ? 'selected="selected"' : ''; ?> value="">Seleziona un giorno</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==1) ? 'selected="selected"' : ''; ?> value="1">Lunedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==2) ? 'selected="selected"' : ''; ?> value="2">Martedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==3) ? 'selected="selected"' : ''; ?> value="3">Mercoledì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==4) ? 'selected="selected"' : ''; ?> value="4">Giovedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==5) ? 'selected="selected"' : ''; ?> value="5">Venerdì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==6) ? 'selected="selected"' : ''; ?> value="6">Sabato</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==7) ? 'selected="selected"' : ''; ?> value="7">Domenica</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]=='') ? 'selected' : ''; ?> value="">Seleziona un giorno</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==1) ? 'selected' : ''; ?> value="1">Lunedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==2) ? 'selected' : ''; ?> value="2">Martedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==3) ? 'selected' : ''; ?> value="3">Mercoledì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==4) ? 'selected' : ''; ?> value="4">Giovedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==5) ? 'selected' : ''; ?> value="5">Venerdì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==6) ? 'selected' : ''; ?> value="6">Sabato</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_day[$x]==7) ? 'selected' : ''; ?> value="7">Domenica</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            </select>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        </div>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -77,9 +77,11 @@ function orari_dirette_input($post)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            <select name="on_air_cadence_<?php echo $x; ?>" id="on_air_cadence_<?php echo $x; ?>">
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            <label for="on_air_cadence_<?php echo $x; ?>">Cadenza</label>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==1) ? 'selected="selected"' : ''; ?> value="1">Una volta a settimana</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==2) ? 'selected="selected"' : ''; ?> value="2">Una volta ogni 2 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==4) ? 'selected="selected"' : ''; ?> value="4">Una volta ogni 4 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==1) ? 'selected' : ''; ?> value="1">Una volta a settimana</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==2) ? 'selected' : ''; ?> value="2">Una volta ogni 2 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==3) ? 'selected' : ''; ?> value="3" type="hidden">Una volta ogni 3 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==4) ? 'selected' : ''; ?> value="4">Una volta ogni 4 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($onair_cadence[$x]==5) ? 'selected' : ''; ?> value="5">Una volta al mese</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            </select>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        </div>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -93,6 +95,8 @@ function orari_dirette_input($post)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style="clear:both;"></div>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				<?php
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    endfor;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    wp_enqueue_script('add_onchange_listener', plugin_dir_url(__FILE__).'add_onchange_listener.js', array(), '1.0', true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				function orari_repliche_input($post)
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -112,14 +116,14 @@ function orari_repliche_input($post)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        </div>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          <select name="rerun_day_<?php echo $x; ?>" id="rerun_day_<?php echo $x; ?>">
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]=='') ? 'selected="selected"' : ''; ?> value="">Seleziona un giorno</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==1) ? 'selected="selected"' : ''; ?> value="1">Lunedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==2) ? 'selected="selected"' : ''; ?> value="2">Martedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==3) ? 'selected="selected"' : ''; ?> value="3">Mercoledì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==4) ? 'selected="selected"' : ''; ?> value="4">Giovedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==5) ? 'selected="selected"' : ''; ?> value="5">Venerdì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==6) ? 'selected="selected"' : ''; ?> value="6">Sabato</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==7) ? 'selected="selected"' : ''; ?> value="7">Domenica</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]=='') ? 'selected' : ''; ?> value="">Seleziona un giorno</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==1) ? 'selected' : ''; ?> value="1">Lunedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==2) ? 'selected' : ''; ?> value="2">Martedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==3) ? 'selected' : ''; ?> value="3">Mercoledì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==4) ? 'selected' : ''; ?> value="4">Giovedì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==5) ? 'selected' : ''; ?> value="5">Venerdì</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==6) ? 'selected' : ''; ?> value="6">Sabato</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				              <option <?php echo ($rerun_day[$x]==7) ? 'selected' : ''; ?> value="7">Domenica</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          </select>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        </div>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -129,9 +133,9 @@ function orari_repliche_input($post)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            <select name="rerun_cadence_<?php echo $x; ?>" id="rerun_cadence_<?php echo $x; ?>">
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            <label for="rerun_cadence_<?php echo $x; ?>">Cadenza</label>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($rerun_cadence[$x]==1) ? 'selected="selected"' : ''; ?> value="1">Una volta a settimana</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($rerun_cadence[$x]==2) ? 'selected="selected"' : ''; ?> value="2">Una volta ogni 2 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($rerun_cadence[$x]==4) ? 'selected="selected"' : ''; ?> value="4">Una volta ogni 4 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($rerun_cadence[$x]==1) ? 'selected' : ''; ?> value="1">Una volta a settimana</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($rerun_cadence[$x]==2) ? 'selected' : ''; ?> value="2">Una volta ogni 2 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                <option <?php echo ($rerun_cadence[$x]==4) ? 'selected' : ''; ?> value="4">Una volta ogni 4 settimane</option>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            </select>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        </div>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        <div style='width:20%;float:left;'>
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -166,12 +170,7 @@ function orari_dirette_save($post_id)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (!current_user_can('edit_post', $post_id)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    /*
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo '<pre>';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print_r($_POST);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    echo '</pre>';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    exit();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				     */
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // now we can actually save the data
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    $allowed = array(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        'a' => array( // on allow a tags
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -199,17 +198,39 @@ function orari_dirette_save($post_id)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            wp_insert_term($_POST['post_title'], 'category', $args);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        update_post_meta($post_id, 'taxonomy_id', wp_kses($_POST['taxonomy_id'], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        for ($x=0;$x<7;$x++) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_day_'.$x, wp_kses($_POST['on_air_day_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            $onair_day_data = wp_kses($_POST['on_air_day_'.$x], $allowed);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            $rerun_day_data = wp_kses($_POST['rerun_day_'.$x], $allowed);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            $onair_start_date_data = wp_kses($_POST['on_air_start_date_'.$x], $allowed);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            $rerun_start_date_data = wp_kses($_POST['rerun_start_date_'.$x], $allowed);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (!empty($onair_day_data) && !empty($onair_start_date_data)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                check_and_correct_start_date_flag($onair_start_date_data, $onair_day_data);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            } 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (!empty($rerun_day_data) && !empty($rerun_start_date_data)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                check_and_correct_start_date_flag($rerun_start_date_data, $rerun_day_data);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }  
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_day_'.$x, $onair_day_data);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_start_'.$x, wp_kses($_POST['on_air_start_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_end_'.$x, wp_kses($_POST['on_air_end_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_cadence_'.$x, wp_kses($_POST['on_air_cadence_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_start_date_'.$x, wp_kses($_POST['on_air_start_date_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_day_'.$x, wp_kses($_POST['rerun_day_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_day_'.$x, $rerun_day_data);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_start_'.$x, wp_kses($_POST['rerun_start_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_end_'.$x, wp_kses($_POST['rerun_end_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_cadence_'.$x, wp_kses($_POST['rerun_end_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_start_date_'.$x, wp_kses($_POST['rerun_start_date_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_cadence_'.$x, wp_kses($_POST['rerun_cadence_'.$x], $allowed));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'on_air_start_date_'.$x, $onair_start_date_data);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            update_post_meta($post_id, 'rerun_start_date_'.$x, $rerun_start_date_data);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				function check_and_correct_start_date_flag(&$start_date_ptr, $day) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    $start_date_dt = new DateTime($start_date_ptr);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    $weekday_number = $start_date_dt->format("N");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if ($day != $weekday_number) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        $day_diff = $day - $weekday_number;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        $start_date_dt->modify($day_diff." days");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        $start_date_ptr = $start_date_dt->format("Y-m-d");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    };         
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |