function mc_locations_fields($has_data, $data, $context = 'location') { $return = '<div class="mc-locations">'; if (current_user_can('mc_edit_locations') && $context == 'event') { $return .= '<p><input type="checkbox" value="on" name="mc_copy_location" id="mc_copy_location" /> <label for="mc_copy_location">' . __('Copy this location into the locations table', 'my-calendar') . '</label></p>'; } $return .= ' <p class="checkbox"> <label for="e_label">' . __('Name of Location (e.g. <em>Joe\'s Bar and Grill</em>)', 'my-calendar') . '</label>'; $cur_label = !empty($data) ? stripslashes($data->{$context . '_label'}) : ''; if (mc_controlled_field('label')) { $return .= mc_location_controller('label', $cur_label, $context); } else { $return .= '<input type="text" id="e_label" name="' . $context . '_label" size="40" value="' . esc_attr($cur_label) . '" />'; } $street_address = $has_data ? esc_attr(stripslashes($data->{$context . '_street'})) : ''; $street_address2 = $has_data ? esc_attr(stripslashes($data->{$context . '_street2'})) : ''; $return .= ' </p> <div class="locations-container"> <div class="location-primary"> <fieldset> <legend>' . __('Location Address', 'my-calendar') . '</legend> <p> <label for="e_street">' . __('Street Address', 'my-calendar') . '</label> <input type="text" id="e_street" name="' . $context . '_street" size="40" value="' . $street_address . '" /> </p> <p> <label for="e_street2">' . __('Street Address (2)', 'my-calendar') . '</label> <input type="text" id="e_street2" name="' . $context . '_street2" size="40" value="' . $street_address2 . '" /> </p> <p> <label for="e_city">' . __('City', 'my-calendar') . '</label> '; $cur_city = !empty($data) ? stripslashes($data->{$context . '_city'}) : ''; if (mc_controlled_field('city')) { $return .= mc_location_controller('city', $cur_city, $context); } else { $return .= '<input type="text" id="e_city" name="' . $context . '_city" size="40" value="' . esc_attr($cur_city) . '" />'; } $return .= "</p>\n\t<p>"; $return .= '<label for="e_state">' . __('State/Province', 'my-calendar') . '</label> '; $cur_state = !empty($data) ? stripslashes($data->{$context . '_state'}) : ''; if (mc_controlled_field('state')) { $return .= mc_location_controller('state', $cur_state, $context); } else { $return .= '<input type="text" id="e_state" name="' . $context . '_state" size="10" value="' . esc_attr($cur_state) . '" />'; } $return .= '</p> <p> <label for="e_postcode">' . __('Postal Code', 'my-calendar') . '</label> '; $cur_postcode = !empty($data) ? stripslashes($data->{$context . '_postcode'}) : ''; if (mc_controlled_field('postcode')) { $return .= mc_location_controller('postcode', $cur_postcode, $context); } else { $return .= '<input type="text" id="e_postcode" name="' . $context . '_postcode" size="40" value="' . esc_attr($cur_postcode) . '" />'; } $return .= "</p>\n\t<p>"; $return .= '<label for="e_region">' . __('Region', 'my-calendar') . '</label> '; $cur_region = !empty($data) ? stripslashes($data->{$context . '_region'}) : ''; if (mc_controlled_field('region')) { $return .= mc_location_controller('region', $cur_region, $context); } else { $return .= '<input type="text" id="e_region" name="' . $context . '_region" size="40" value="' . esc_attr($cur_region) . '" />'; } $return .= '</p> <p> <label for="e_country">' . __('Country', 'my-calendar') . '</label> '; $cur_country = $has_data ? stripslashes($data->{$context . '_country'}) : ''; if (mc_controlled_field('country')) { $return .= mc_location_controller('country', $cur_country, $context); } else { $return .= '<input type="text" id="e_country" name="' . $context . '_country" size="10" value="' . esc_attr($cur_country) . '" />'; } $zoom = $has_data ? $data->{$context . '_zoom'} : '16'; $event_phone = $has_data ? esc_attr(stripslashes($data->{$context . '_phone'})) : ''; $event_phone2 = $has_data ? esc_attr(stripslashes($data->{$context . '_phone2'})) : ''; $event_url = $has_data ? esc_attr(stripslashes($data->{$context . '_url'})) : ''; $event_lat = $has_data ? esc_attr(stripslashes($data->{$context . '_latitude'})) : ''; $event_lon = $has_data ? esc_attr(stripslashes($data->{$context . '_longitude'})) : ''; $return .= '</p> <p> <label for="e_zoom">' . __('Initial Zoom', 'my-calendar') . '</label> <select name="' . $context . '_zoom" id="e_zoom"> <option value="16"' . jd_option_selected($zoom, '16', 'option') . '>' . __('Neighborhood', 'my-calendar') . '</option> <option value="14"' . jd_option_selected($zoom, '14', 'option') . '>' . __('Small City', 'my-calendar') . '</option> <option value="12"' . jd_option_selected($zoom, '12', 'option') . '>' . __('Large City', 'my-calendar') . '</option> <option value="10"' . jd_option_selected($zoom, '10', 'option') . '>' . __('Greater Metro Area', 'my-calendar') . '</option> <option value="8"' . jd_option_selected($zoom, '8', 'option') . '>' . __('State', 'my-calendar') . '</option> <option value="6"' . jd_option_selected($zoom, '6', 'option') . '>' . __('Region', 'my-calendar') . '</option> </select> </p> </fieldset> <fieldset> <legend>' . __('GPS Coordinates (optional)', 'my-calendar') . '</legend> <p> ' . __('If you supply GPS coordinates for your location, they will be used in place of any other address information to provide your map link.', 'my-calendar') . ' </p> <p> <label for="e_latitude">' . __('Latitude', 'my-calendar') . '</label> <input type="text" id="e_latitude" name="' . $context . '_latitude" size="10" value="' . $event_lat . '" /> <label for="e_longitude">' . __('Longitude', 'my-calendar') . '</label> <input type="text" id="e_longitude" name="' . $context . '_longitude" size="10" value="' . $event_lon . '" /> </p> </fieldset> </div> <div class="location-secondary"> <fieldset> <legend>' . __('Location Contact Information', 'my-calendar') . '</legend> <p> <label for="e_phone">' . __('Phone', 'my-calendar') . '</label> <input type="text" id="e_phone" name="' . $context . '_phone" size="32" value="' . $event_phone . '" /> </p> <p> <label for="e_phone2">' . __('Secondary Phone', 'my-calendar') . '</label> <input type="text" id="e_phone2" name="' . $context . '_phone2" size="32" value="' . $event_phone2 . '" /> </p> <p> <label for="e_url">' . __('Location URL', 'my-calendar') . '</label> <input type="text" id="e_url" name="' . $context . '_url" size="40" value="' . $event_url . '" /> </p> </fieldset> <fieldset> <legend>' . __('Location Accessibility', 'my-calendar') . '</legend> <ul class="accessibility-features checkboxes">'; $access = apply_filters('mc_venue_accessibility', mc_location_access()); $access_list = ''; if ($has_data) { if ($context == 'location') { $location_access = unserialize($data->{$context . '_access'}); } else { $location_access = unserialize(mc_location_data('location_access', $data->event_location)); } } else { $location_access = array(); } foreach ($access as $k => $a) { $id = "loc_access_{$k}"; $label = $a; $checked = ''; if (is_array($location_access)) { $checked = in_array($a, $location_access) || in_array($k, $location_access) ? " checked='checked'" : ''; } $item = sprintf('<li><input type="checkbox" id="%1$s" name="' . $context . '_access[]" value="%4$s" class="checkbox" %2$s /> <label for="%1$s">%3$s</label></li>', esc_attr($id), $checked, esc_html($label), esc_attr($a)); $access_list .= $item; } $return .= $access_list; $return .= '</ul> </fieldset></div> </div> </div>'; return $return; }
function my_calendar_print_group_fields($data, $mode, $event_id, $group_id = '') { global $user_ID, $wpdb; $mcdb = $wpdb; get_currentuserinfo(); $has_data = empty($data) ? false : true; $user = get_userdata($user_ID); $mc_input_administrator = get_option('mc_input_options_administrators') == 'true' && current_user_can('manage_options') ? true : false; $mc_input = get_option('mc_input_options'); ?> <div class="postbox-container jcd-wide"> <div class="metabox-holder"> <form method="post" action="<?php echo admin_url("admin.php?page=my-calendar-groups&mode=edit&event_id={$event_id}&group_id={$group_id}"); ?> "> <div> <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('my-calendar-nonce'); ?> "/> <input type="hidden" name="group_id" value="<?php if (!empty($data->event_group_id)) { echo $data->event_group_id; } else { echo mc_group_id(); } ?> "/> <input type="hidden" name="event_action" value="<?php esc_attr_e($mode); ?> "/> <input type="hidden" name="event_id" value="<?php esc_attr_e($event_id); ?> "/> <input type="hidden" name="event_author" value="<?php esc_attr_e($user_ID); ?> "/> <input type="hidden" name="event_post" value="<?php esc_attr_e($data->event_post); ?> "/> <input type="hidden" name="event_nonce_name" value="<?php echo wp_create_nonce('event_nonce'); ?> "/> </div> <div class="ui-sortable meta-box-sortables"> <div class="postbox"> <h3><?php _e('Manage Event Groups', 'my-calendar'); ?> </h3> <div class="inside"> <fieldset> <legend><?php _e('Enter your Event Information', 'my-calendar'); ?> </legend> <p> <label for="e_title"><?php _e('Event Title', 'my-calendar'); ?> <span><?php _e('(required)', 'my-calendar'); ?> </span><?php if (!mc_compare_group_members($group_id, 'event_title')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label><br/><input type="text" id="e_title" name="event_title" size="60" value="<?php if (!empty($data)) { echo stripslashes(esc_attr($data->event_title)); } ?> "/> </p> <?php $apply = mc_group_form($group_id, 'apply'); echo $apply; if ($data->event_repeats == 0 && ($data->event_recur == 'S1' || $data->event_recur == 'S')) { ?> <p> <input type="checkbox" value="1" id="e_span" name="event_span"<?php if (!empty($data) && $data->event_span == '1') { echo " checked=\"checked\""; } else { if (!empty($data) && $data->event_span == '0') { echo ""; } else { if (get_option('mc_event_span') == 'true') { echo " checked=\"checked\""; } } } ?> /> <label for="e_span"><?php _e('Selected dates are a single multi-day event.', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_span')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> </p> <?php } else { ?> <div><input type='hidden' name='event_span' value='<?php esc_attr_e($data->event_span); ?> '/></div> <?php } ?> <?php if ($mc_input['event_desc'] == 'on' || $mc_input_administrator) { ?> <div id="group_description"><?php if (!empty($data)) { $description = $data->event_desc; } else { $description = ''; } ?> <label for="content"><?php _e('Event Description (<abbr title="hypertext markup language">HTML</abbr> allowed)', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_desc')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label><br/><?php wp_editor(stripslashes($description), 'content', array('textarea_rows' => 10)); ?> </div> <?php } ?> <?php if ($mc_input['event_short'] == 'on' || $mc_input_administrator) { ?> <p> <label for="e_short"><?php _e('Event Short Description (<abbr title="hypertext markup language">HTML</abbr> allowed)', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_short')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label><br/><textarea id="e_short" name="event_short" rows="2" cols="80"><?php if (!empty($data)) { echo stripslashes(esc_attr($data->event_short)); } ?> </textarea> </p> <?php } if (mc_show_edit_block('event_image')) { ?> <div class='mc-image-upload field-holder'> <?php if (!empty($data->event_image)) { ?> <div class="event_image"><img src="<?php if ($has_data) { echo esc_attr($data->event_image); } ?> " alt=""/></div> <?php } else { ?> <div class="event_image"></div> <?php } ?> <input type="hidden" name="event_image_id" value="" class="textfield" id="e_image_id"/> <label for="e_image"><?php _e("Add an image:", 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_image')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" name="event_image" id="e_image" size="60" value="<?php if ($has_data) { echo esc_attr($data->event_image); } ?> " placeholder="http://yourdomain.com/image.jpg"/> <a href="#" class="button textfield-field"><?php _e("Upload", 'my-calendar'); ?> </a> </div> <?php } else { ?> <div> <input type="hidden" name="event_image" value="<?php if ($has_data) { echo esc_attr($data->event_image); } ?> "/> <?php if (!empty($data->event_image)) { ?> <div class="event_image"><img src="<?php echo esc_attr($data->event_image); ?> " alt=""/> </div> <?php } ?> </div> <?php } ?> <p> <label for="e_host"><?php _e('Event Host', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_host')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <select id="e_host" name="event_host"> <?php // Grab all the categories and list them $userList = my_calendar_getUsers(); foreach ($userList as $u) { echo '<option value="' . $u->ID . '"'; if (is_object($data) && $data->event_host == $u->ID) { echo ' selected="selected"'; } else { if (is_object($u) && $u->ID == $user->ID && empty($data->event_host)) { echo ' selected="selected"'; } } $display_name = $u->display_name == '' ? $u->user_nicename : $u->display_name; echo ">{$display_name}</option>\n"; } ?> </select> </p> <?php if ($mc_input['event_category'] == 'on' || $mc_input_administrator) { ?> <p> <label for="e_category"><?php _e('Event Category', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_category')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <select id="e_category" name="event_category"> <?php echo mc_category_select($data); ?> </select> </p> <?php } else { ?> <div> <input type="hidden" name="event_category" value="1"/> </div> <?php } ?> <?php if ($mc_input['event_link'] == 'on' || $mc_input_administrator) { ?> <p> <label for="e_link"><?php _e('Event Link (Optional)', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_link')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_link" name="event_link" size="40" value="<?php if (!empty($data)) { echo esc_url($data->event_link); } ?> "/> <input type="checkbox" value="1" id="e_link_expires" name="event_link_expires"<?php if (!empty($data) && $data->event_link_expires == '1') { echo " checked=\"checked\""; } else { if (!empty($data) && $data->event_link_expires == '0') { echo ""; } else { if (get_option('mc_event_link_expires') == 'true') { echo " checked=\"checked\""; } } } ?> /> <label for="e_link_expires"><?php _e('Link will expire after event.', 'my-calendar'); ?> </label> </p> <?php } ?> </fieldset> <p> <input type="submit" name="save" class="button-primary" value="<?php _e('Edit Event Group', 'my-calendar'); ?> "/> </p> </div> </div> </div> <?php if ($mc_input['event_open'] == 'on' || $mc_input_administrator) { // add a "don't change" option here ?> <div class="ui-sortable meta-box-sortables"> <div class="postbox"> <h3><?php _e('Event Registration Options', 'my-calendar'); ?> </h3> <div class="inside"> <fieldset> <legend><?php _e('Event Registration Status', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_open')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </legend> <?php echo apply_filters('mc_event_registration', '', $has_data, $data, 'admin'); ?> </fieldset> </div> </div> </div> <?php } else { ?> <div> <input type="hidden" name="event_open" value="<?php echo $has_data ? esc_attr($data->event_open) : '2'; ?> "/> <input type="hidden" name="event_tickets" value="<?php echo $has_data ? esc_attr($data->event_tickets) : ''; ?> "/> <input type="hidden" name="event_registration" value="<?php echo $has_data ? esc_attr($data->event_registration) : ''; ?> "/> </div> <?php } ?> <?php if ($mc_input['event_location'] == 'on' || $mc_input['event_location_dropdown'] == 'on' || $mc_input_administrator) { ?> <div class="ui-sortable meta-box-sortables"> <div class="postbox"> <h3><?php _e('Event Location', 'my-calendar'); ?> </h3> <div class="inside location_form"> <fieldset> <legend><?php _e('Event Location', 'my-calendar'); ?> </legend> <?php } ?> <?php if ($mc_input['event_location_dropdown'] == 'on' || $mc_input_administrator) { ?> <?php $locations = $mcdb->get_results("SELECT location_id,location_label FROM " . my_calendar_locations_table() . " ORDER BY location_label ASC"); if (!empty($locations)) { ?> <p> <label for="location_preset"><?php _e('Choose a preset location:', 'my-calendar'); ?> </label> <select name="location_preset" id="location_preset"> <option value="none"> --</option> <?php foreach ($locations as $location) { echo "<option value=\"" . $location->location_id . "\">" . esc_html(stripslashes($location->location_label)) . "</option>"; } ?> </select> </p> <?php } else { ?> <input type="hidden" name="location_preset" value="none"/> <p> <a href="<?php echo admin_url("admin.php?page=my-calendar-locations"); ?> "><?php _e('Add recurring locations for later use.', 'my-calendar'); ?> </a> </p> <?php } ?> <?php } else { ?> <input type="hidden" name="location_preset" value="none"/> <?php } ?> <?php if ($mc_input['event_location'] == 'on' || $mc_input_administrator) { ?> <p> <label for="e_label"><?php _e('Name of Location (e.g. <em>Joe\'s Bar and Grill</em>)', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_label')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label><br/><input type="text" id="e_label" name="event_label" size="40" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_label)); } ?> "/> </p> <p> <label for="e_street"><?php _e('Street Address', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_street')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_street" name="event_street" size="40" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_street)); } ?> "/> </p> <p> <label for="e_street2"><?php _e('Street Address (2)', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_street2')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_street2" name="event_street2" size="40" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_street2)); } ?> "/> </p> <p> <label for="e_city"><?php _e('City', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_city')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_city" name="event_city" size="40" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_city)); } ?> "/> <label for="e_state"><?php _e('State/Province', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_state')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_state" name="event_state" size="10" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_state)); } ?> "/> </p> <p> <label for="e_postcode"><?php _e('Postal Code', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_postcode')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_postcode" name="event_postcode" size="10" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_postcode)); } ?> "/> <label for="e_region"><?php _e('Region', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_region')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_region" name="event_region" size="40" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_region)); } ?> "/> </p> <p> <label for="e_country"><?php _e('Country', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_country')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_country" name="event_country" size="10" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_country)); } ?> "/> </p> <p> <label for="e_zoom"><?php _e('Initial Zoom', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_zoom')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <select name="event_zoom" id="e_zoom"> <option value="16"<?php if (!empty($data) && $data->event_zoom == 16) { echo " selected=\"selected\""; } ?> ><?php _e('Neighborhood', 'my-calendar'); ?> </option> <option value="14"<?php if (!empty($data) && $data->event_zoom == 14) { echo " selected=\"selected\""; } ?> ><?php _e('Small City', 'my-calendar'); ?> </option> <option value="12"<?php if (!empty($data) && $data->event_zoom == 12) { echo " selected=\"selected\""; } ?> ><?php _e('Large City', 'my-calendar'); ?> </option> <option value="10"<?php if (!empty($data) && $data->event_zoom == 10) { echo " selected=\"selected\""; } ?> ><?php _e('Greater Metro Area', 'my-calendar'); ?> </option> <option value="8"<?php if (!empty($data) && $data->event_zoom == 8) { echo " selected=\"selected\""; } ?> ><?php _e('State', 'my-calendar'); ?> </option> <option value="6"<?php if (!empty($data) && $data->event_zoom == 6) { echo " selected=\"selected\""; } ?> ><?php _e('Region', 'my-calendar'); ?> </option> </select> </p> <p> <label for="e_phone"><?php _e('Phone', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_phone')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_phone" name="event_phone" size="32" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_phone)); } ?> "/> </p> <p> <label for="e_url"><?php _e('Location URL', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_url')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_url" name="event_url" size="40" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_url)); } ?> "/> </p> <fieldset> <legend><?php _e('GPS Coordinates (optional)', 'my-calendar'); ?> </legend> <p> <label for="e_latitude"><?php _e('Latitude', 'my-calendar'); if (!mc_compare_group_members($group_id, 'event_latitude')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } if (!mc_compare_group_members($group_id, 'event_longitude')) { echo " <span>" . __('Fields do not match', 'my-calendar') . "</span>"; } ?> </label> <input type="text" id="e_latitude" name="event_latitude" size="10" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_latitude)); } ?> "/> <label for="e_longitude"><?php _e('Longitude', 'my-calendar'); ?> </label> <input type="text" id="e_longitude" name="event_longitude" size="10" value="<?php if (!empty($data)) { esc_attr_e(stripslashes($data->event_longitude)); } ?> "/> </p> </fieldset> <fieldset> <legend><?php _e('Location Accessibility', 'my-calendar'); ?> </legend> <ul class='checkboxes'> <?php $access = apply_filters('mc_venue_accessibility', mc_location_access()); $access_list = ''; if (!empty($data)) { $location_access = unserialize($data->event_access); } else { $location_access = array(); } foreach ($access as $k => $a) { $id = "loc_access_{$k}"; $label = $a; $checked = ''; if (is_array($location_access)) { $checked = in_array($k, $location_access) ? " checked='checked'" : ''; } $item = sprintf('<li><input type="checkbox" id="%1$s" name="event_access[]" value="%4$s" class="checkbox" %2$s /> <label for="%1$s">%3$s</label></li>', esc_attr($id), $checked, esc_html($label), esc_attr($k)); $access_list .= $item; } echo $access_list; ?> </ul> </fieldset> <?php } ?> <?php if ($mc_input['event_location'] == 'on' || $mc_input['event_location_dropdown'] == 'on' || $mc_input_administrator) { ?> </fieldset> </div> </div> </div> <?php } ?> <p> <input type="submit" name="save" class="button-secondary" value="<?php _e('Edit Event Group', 'my-calendar'); ?> "/> </p> </form> </div> </div> <?php }