Example #1
0
function eme_replace_filter_form_placeholders($format, $multiple, $multisize, $scope_count, $fields, $category, $notcategory)
{
    if ($fields == "all") {
        $fields = "categories,locations,towns,weeks,months";
    }
    preg_match_all("/#_[A-Za-z0-9_]+/", $format, $placeholders);
    usort($placeholders[0], 'sort_stringlenth');
    // if one of these changes, also the eme_events.php needs changing for the "Next page" part
    $cat_post_name = "eme_cat_filter";
    $loc_post_name = "eme_loc_filter";
    $town_post_name = "eme_town_filter";
    $scope_post_name = "eme_scope_filter";
    $localised_scope_post_name = "eme_localised_scope_filter";
    $selected_scope = isset($_REQUEST[$scope_post_name]) ? eme_sanitize_request($_REQUEST[$scope_post_name]) : '';
    $selected_location = isset($_REQUEST[$loc_post_name]) ? eme_sanitize_request($_REQUEST[$loc_post_name]) : '';
    $selected_town = isset($_REQUEST[$town_post_name]) ? eme_sanitize_request($_REQUEST[$town_post_name]) : '';
    $selected_category = isset($_REQUEST[$cat_post_name]) ? eme_sanitize_request($_REQUEST[$cat_post_name]) : '';
    $extra_conditions_arr = array();
    if ($category != '') {
        $extra_conditions_arr[] = "(category_id IN ({$category}))";
    }
    if ($notcategory != '') {
        $extra_conditions_arr[] = "(category_id NOT IN ({$notcategory}))";
    }
    $extra_conditions = implode(' AND ', $extra_conditions_arr);
    $scope_fieldcount = 0;
    foreach ($placeholders[0] as $result) {
        $replacement = "";
        $eventful = 0;
        $found = 1;
        $orig_result = $result;
        if (preg_match('/#_(EVENTFUL_)?FILTER_CATS/', $result) && get_option('eme_categories_enabled')) {
            if (strstr($result, '#_EVENTFUL')) {
                $eventful = 1;
            }
            $categories = eme_get_categories($eventful, "future", $extra_conditions);
            if ($categories && (empty($fields) || strstr($fields, 'categories'))) {
                $cat_list = array();
                foreach ($categories as $this_category) {
                    $id = $this_category['category_id'];
                    $cat_list[$id] = eme_translate($this_category['category_name']);
                }
                asort($cat_list);
                if ($multiple) {
                    $cat_list = array(0 => __('Select one or more categories', 'eme')) + $cat_list;
                    $replacement = eme_ui_multiselect($selected_category, $cat_post_name, $cat_list, $multisize);
                } else {
                    $cat_list = array(0 => __('Select a category', 'eme')) + $cat_list;
                    $replacement = eme_ui_select($selected_category, $cat_post_name, $cat_list);
                }
            }
        } elseif (preg_match('/#_(EVENTFUL_)?FILTER_LOCS/', $result)) {
            if (strstr($result, '#_EVENTFUL')) {
                $eventful = 1;
            }
            $locations = eme_get_locations($eventful, "future");
            if ($locations && (empty($fields) || strstr($fields, 'locations'))) {
                $loc_list = array();
                foreach ($locations as $this_location) {
                    $id = $this_location['location_id'];
                    $loc_list[$id] = eme_translate($this_location['location_name']);
                }
                asort($loc_list);
                if ($multiple) {
                    $loc_list = array(0 => __('Select one or more locations', 'eme')) + $loc_list;
                    $replacement = eme_ui_multiselect($selected_location, $loc_post_name, $loc_list, $multisize);
                } else {
                    $loc_list = array(0 => __('Select a location', 'eme')) + $loc_list;
                    $replacement = eme_ui_select($selected_location, $loc_post_name, $loc_list);
                }
            }
        } elseif (preg_match('/#_(EVENTFUL_)?FILTER_TOWNS/', $result)) {
            if (strstr($result, '#_EVENTFUL')) {
                $eventful = 1;
            }
            $towns = eme_get_locations($eventful, "future");
            if ($towns && (empty($fields) || strstr($fields, 'towns'))) {
                $town_list = array();
                foreach ($towns as $this_town) {
                    $id = eme_translate($this_town['location_town']);
                    $town_list[$id] = $id;
                }
                asort($town_list);
                if ($multiple) {
                    $town_list = array(0 => __('Select one or more towns', 'eme')) + $town_list;
                    $replacement = eme_ui_multiselect($selected_town, $town_post_name, $town_list, $multisize);
                } else {
                    $town_list = array(0 => __('Select a town', 'eme')) + $town_list;
                    $replacement = eme_ui_select($selected_town, $town_post_name, $town_list);
                }
            }
        } elseif (preg_match('/#_FILTER_WEEKS/', $result)) {
            if ($scope_fieldcount == 0 && (empty($fields) || strstr($fields, 'weeks'))) {
                $replacement = eme_ui_select($selected_scope, $scope_post_name, eme_create_week_scope($scope_count));
                $scope_fieldcount++;
            }
        } elseif (preg_match('/#_FILTER_MONTHS/', $result)) {
            if ($scope_fieldcount == 0 && (empty($fields) || strstr($fields, 'months'))) {
                $replacement = eme_ui_select($selected_scope, $scope_post_name, eme_create_month_scope($scope_count));
                $scope_fieldcount++;
            }
        } elseif (preg_match('/#_FILTER_MONTHRANGE/', $result)) {
            if ($scope_fieldcount == 0 && (empty($fields) || strstr($fields, 'monthrange'))) {
                $replacement = "<input type='text' id='{$localised_scope_post_name}' name='{$localised_scope_post_name}' readonly='readonly' >";
                $replacement .= "<input type='hidden' id='{$scope_post_name}' name='{$scope_post_name}' value='" . eme_sanitize_html($selected_scope) . "'>";
                wp_enqueue_script('eme-jquery-datepick');
                wp_enqueue_style('eme-jquery-datepick', EME_PLUGIN_URL . "js/jquery-datepick/jquery.datepick.css");
                // jquery ui locales are with dashes, not underscores
                $locale_code = get_locale();
                $locale_code = preg_replace("/_/", "-", $locale_code);
                $locale_file = EME_PLUGIN_DIR . "js/jquery-datepick/jquery.datepick-{$locale_code}.js";
                $locale_file_url = EME_PLUGIN_URL . "js/jquery-datepick/jquery.datepick-{$locale_code}.js";
                // for english, no translation code is needed)
                if ($locale_code != "en-US") {
                    if (!file_exists($locale_file)) {
                        $locale_code = substr($locale_code, 0, 2);
                        $locale_file = EME_PLUGIN_DIR . "js/jquery-datepick/jquery.datepick-{$locale_code}.js";
                        $locale_file_url = EME_PLUGIN_URL . "js/jquery-datepick/jquery.datepick-{$locale_code}.js";
                    }
                    if (file_exists($locale_file)) {
                        wp_enqueue_script('eme-jquery-datepick-locale', $locale_file_url);
                    }
                }
                ob_start();
                ?>
            <script type="text/javascript">
            var locale_code = '<?php 
                echo $locale_code;
                ?>
';
            var firstDayOfWeek = <?php 
                echo get_option('start_of_week');
                ?>
;
            </script>
            <?php 
                $replacement .= ob_get_clean();
                $replacement .= "<script type='text/javascript' src='" . EME_PLUGIN_URL . "js/eme_filters.js'></script>";
            }
        } elseif (preg_match('/#_FILTER_YEARS/', $result)) {
            if ($scope_fieldcount == 0 && (empty($fields) || strstr($fields, 'years'))) {
                $replacement = eme_ui_select($selected_scope, $scope_post_name, eme_create_year_scope($scope_count));
                $scope_fieldcount++;
            }
        } else {
            $found = 0;
        }
        if ($found) {
            $replacement = apply_filters('eme_general', $replacement);
            $format = str_replace($orig_result, $replacement, $format);
        }
    }
    return do_shortcode($format);
}
Example #2
0
function eme_people_table($message="") {
   if (isset($_GET['search'])) {
      $search = "[person_id=".intval($_GET['search'])."]";
   }

   $persons = eme_get_persons();
   $destination = admin_url("admin.php?page=eme-people");
   if($message != "") {
      ?>
      <div id='message' class='updated fade below-h1' style='background-color: rgb(255, 251, 204);'>
         <p><?php print $message; ?></p>
      </div>
      <?php
   }

   if (count($persons) < 1 ) {
      _e("No people have responded to your events yet!", 'eme');
   } else { 
   ?>
      <p><?php _e('This table shows the data about the people who responded to your events', 'eme') ?> </p> 
      <form id='people-deleteunused' method='post' action='<?php print $destination; ?>'>
      <input type="hidden" name="eme_admin_action" value="deleteunusedpeople" />
      <input type="submit" value="<?php _e ( 'Delete people without bookings','eme' ); ?>" name="doaction" id="doaction" class="button-primary action" />
      </form>
      <div class="clear"></div>
      <br />
      <form id='people-filter' method='post' action='<?php print $destination; ?>'>
      <select name="eme_admin_action">
      <option value="-1" selected="selected"><?php _e ( 'Bulk Actions' ); ?></option>
      <option value="delete_people"><?php _e ( 'Delete selected','eme' ); ?></option>
      </select>
      <input type="submit" value="<?php _e ( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
      <div class="clear"></div>
      <br />

      <table id='eme-people-table' class='widefat hover stripe'>
            <thead>
            <tr>
            <th class='manage-column column-cb check-column' scope='col'><input class='select-all' type='checkbox' value='1' /></th>
            <th>hidden for person id search</th>
            <th class='manage-column' scope='col'><?php _e('ID', 'eme'); ?></th>
            <th class='manage-column' scope='col'><?php _e('Name', 'eme'); ?></th>
            <th scope='col'><?php _e('E-mail', 'eme'); ?></th>
            <th scope='col'><?php _e('Phone number', 'eme'); ?></th>
            <th scope='col'></th>
            </tr>
            </thead>
            <tbody>
      <?php
      $search_dest=admin_url("admin.php?page=eme-registration-seats");
      foreach ($persons as $person) {
         $search_url=add_query_arg(array('search'=>$person['person_id']),$search_dest);
         print "<tr><td><input type='checkbox' class ='row-selector' value='".$person['person_id']."' name='persons[]' /></td>
                  <td>[person_id=".$person['person_id']."]</td>
                  <td><a href='".admin_url("admin.php?page=eme-people&amp;eme_admin_action=editperson&amp;person_id=".$person['person_id'])."' title='". __('Click the ID in order to edit the person.','eme')."'>".$person['person_id']."</a></td>
                  <td>".eme_sanitize_html($person['lastname'].' '.$person['firstname'])."</td>
                  <td>".eme_sanitize_html($person['email'])."</td>
                  <td>".eme_sanitize_html($person['phone'])."</td>
                  <td><a href='".$search_url."'>".__('Show all bookings','eme')."</a></td>
                  </tr>";
      }
      ?>

      </tbody></table>
<script type="text/javascript">
   jQuery(document).ready( function() {
            jQuery('#eme-people-table').dataTable( {
               "dom": 'Blfrtip',
               "colReorder": true,
               <?php
               // jquery datatables locale loading
               $locale_code = get_locale();
               $locale_file = EME_PLUGIN_DIR. "js/jquery-datatables/i18n/$locale_code.json";
               $locale_file_url = EME_PLUGIN_URL. "js/jquery-datatables/i18n/$locale_code.json";
               if ($locale_code != "en_US" && file_exists($locale_file)) {
               ?>
               "language": {
               "url": "<?php echo $locale_file_url; ?>"
               },
               <?php
               }
               ?> 
               "stateSave": true,
               <?php
               if (!empty($search)) {
                  // If datatables state is saved, the initial search
                  // is ignored and we need to use stateloadparams
                  // So we give the 2 options
               ?> 
               "stateLoadParams": function (settings, data) {
                  data.search.search = "<?php echo $search; ?>";
               },
               "search": {
                  "search":  "<?php echo $search; ?>"
               },
               <?php
               }
               ?> 
               "pagingType": "full",
               "columnDefs": [
                  { "sortable": false, "targets": 0 },
                  { "visible": false, "targets": 1 }
               ],
               "buttons": [
                  'csv',
                  'print',
                  {
                     extend: 'colvis',
                     columns: [3,4,5]
                  }
               ]
           });
   } );
</script>
<?php
   }
} 
function eme_trans_sanitize_html($value, $lang = '')
{
    return eme_sanitize_html(eme_translate($value, $lang));
}
Example #4
0
function eme_templates_edit_layout($message = "") {
   $template_id = intval($_GET['template_id']);
   $template = eme_get_template($template_id);
   $layout = "
   <div class='wrap'>
      <div id='icon-edit' class='icon32'>
         <br />
      </div>
         
      <h1>".__('Edit template', 'eme')."</h1>";   
      
      if($message != "") {
         $layout .= "
      <div id='message' class='updated fade below-h1' style='background-color: rgb(255, 251, 204);'>
         <p>$message</p>
      </div>";
      }
      $layout .= "
      <div id='ajax-response'></div>

      <form name='edit_template' id='edit_template' method='post' action='".admin_url("admin.php?page=eme-templates")."' class='validate'>
      <input type='hidden' name='eme_admin_action' value='do_edittemplate' />
      <input type='hidden' name='template_id' value='".$template['id']."' />";
      
      $layout .= "
         <table class='form-table'>
            <tr class='form-field form-required'>
               <th scope='row' valign='top'><label for='description'>".__('Template description', 'eme')."</label></th>
               <td><input type='text' name='description' id='description' value='".eme_sanitize_html($template['description'])."' size='40' /><br />
                 ".__('The description of the template', 'eme')."</td>
            </tr>
            <tr class='form-field form-required'>
               <th scope='row' valign='top'><label for='format'>".__('Template format', 'eme')."</label></th>
               <td><textarea name='format' id='format' rows='5' />".eme_sanitize_html($template['format'])."</textarea><br />
                 ".__('The format of the template', 'eme')."</td>
            </tr>
         </table>
      <p class='submit'><input type='submit' class='button-primary' name='submit' value='".__('Update template', 'eme')."' /></p>
      </form>
   </div>
   ";  
   echo $layout;
}
Example #5
0
function eme_paypal_form($event, $payment, $price, $lang, $multi_booking = 0)
{
    global $post;
    $quantity = 1;
    $charge = eme_payment_provider_extra_charge($price, 'paypal');
    $price += $charge;
    $events_page_link = eme_get_events_page(true, false);
    $payment_id = $payment['id'];
    if ($multi_booking) {
        $success_link = get_permalink($post->ID);
        $fail_link = $success_link;
        $name = __("Multiple booking request", "eme");
    } else {
        $success_link = eme_payment_return_url($event, $payment, 1);
        $fail_link = eme_payment_return_url($event, $payment, 2);
        $name = eme_sanitize_html(sprintf(__("Booking for '%s'", "eme"), $event['event_name']));
    }
    $notification_link = add_query_arg(array('eme_eventAction' => 'paypal_notification'), $events_page_link);
    $button_above = eme_replace_payment_provider_placeholders(get_option('eme_paypal_button_above'), $charge, $event['currency'], $lang);
    $button_label = eme_replace_payment_provider_placeholders(get_option('eme_paypal_button_label'), $charge, $event['currency'], $lang);
    $button_below = eme_replace_payment_provider_placeholders(get_option('eme_paypal_button_below'), $charge, $event['currency'], $lang);
    $button_img_url = get_option('eme_paypal_button_img_url');
    require_once "payment_gateways/paypal/Paypal.php";
    $p = new Paypal();
    // the paypal or paypal sandbox url
    $p->paypal_url = get_option('eme_paypal_url');
    // the timeout in seconds before the button form is submitted to paypal
    // this needs the included addevent javascript function
    // 0 = no delay
    // false = disable auto submission
    $p->timeout = false;
    // the button label
    // false to disable button (if you want to rely only on the javascript auto-submission) not recommended
    $button_label = htmlentities($button_label);
    $p->button = $button_label;
    if (!empty($button_img_url)) {
        $p->button_img_url = $button_img_url;
    }
    if (get_option('eme_paypal_s_encrypt')) {
        // use encryption (strongly recommended!)
        $p->encrypt = true;
        $p->private_key = get_option('eme_paypal_s_privkey');
        $p->public_cert = get_option('eme_paypal_s_pubcert');
        $p->paypal_cert = get_option('eme_paypal_s_paypalcert');
        $p->cert_id = get_option('eme_paypal_s_certid');
    } else {
        $p->encrypt = false;
    }
    // the actual button parameters
    // https://www.paypal.com/IntegrationCenter/ic_std-variable-reference.html
    $p->add_field('charset', 'utf-8');
    $p->add_field('business', get_option('eme_paypal_business'));
    $p->add_field('return', $success_link);
    $p->add_field('cancel_return', $fail_link);
    $p->add_field('notify_url', $notification_link);
    $p->add_field('item_name', $name);
    $p->add_field('item_number', $payment_id);
    $p->add_field('currency_code', $event['currency']);
    $p->add_field('amount', $price);
    $p->add_field('quantity', $quantity);
    $p->add_field('no_shipping', 1);
    if (get_option('eme_paypal_no_tax')) {
        $p->add_field('tax', 0);
    }
    $form_html = $button_above;
    $form_html .= $p->get_button();
    $form_html .= $button_below;
    return $form_html;
}
function eme_ui_checkbox($option_value, $name, $list, $horizontal = true, $required = 0)
{
    if ($required) {
        $required_att = "required='required'";
    } else {
        $required_att = "";
    }
    $val = "";
    foreach ($list as $key => $value) {
        if (is_array($option_value)) {
            in_array($key, $option_value) ? $selected = "checked='checked' " : ($selected = '');
        } else {
            "{$key}" == $option_value ? $selected = "checked='checked' " : ($selected = '');
        }
        $val .= "<input {$required_att} type='checkbox' name='{$name}[]' value='" . eme_sanitize_html($key) . "' {$selected} />" . eme_sanitize_html($value);
        if (!$horizontal) {
            $val .= "<br />\n";
        }
    }
    return $val;
}
Example #7
0
function eme_replace_locations_placeholders($format, $location = "", $target = "html", $do_shortcode = 1, $lang = '')
{
    // first we do the custom attributes, since these can contain other placeholders
    preg_match_all("/#(ESC|URL)?_ATT\\{.+?\\}(\\{.+?\\})?/", $format, $results);
    foreach ($results[0] as $resultKey => $result) {
        $need_escape = 0;
        $need_urlencode = 0;
        $orig_result = $result;
        if (strstr($result, '#ESC')) {
            $result = str_replace("#ESC", "#", $result);
            $need_escape = 1;
        } elseif (strstr($result, '#URL')) {
            $result = str_replace("#URL", "#", $result);
            $need_urlencode = 1;
        }
        $replacement = "";
        //Strip string of placeholder and just leave the reference
        $attRef = substr(substr($result, 0, strpos($result, '}')), 6);
        if (isset($location['location_attributes'][$attRef])) {
            $replacement = $location['location_attributes'][$attRef];
        }
        if (trim($replacement) == '' && isset($results[2][$resultKey]) && $results[2][$resultKey] != '') {
            //Check to see if we have a second set of braces;
            $replacement = substr($results[2][$resultKey], 1, strlen(trim($results[2][$resultKey])) - 2);
        }
        if ($need_escape) {
            $replacement = eme_sanitize_request(eme_sanitize_html(preg_replace('/\\n|\\r/', '', $replacement)));
        }
        if ($need_urlencode) {
            $replacement = rawurlencode($replacement);
        }
        $format = str_replace($orig_result, $replacement, $format);
    }
    preg_match_all("/#(ESC|URL)?@?_?[A-Za-z0-9_]+/", $format, $placeholders);
    // make sure we set the largest matched placeholders first, otherwise if you found e.g.
    // #_LOCATION, part of #_LOCATIONPAGEURL would get replaced as well ...
    usort($placeholders[0], 'sort_stringlenth');
    foreach ($placeholders[0] as $result) {
        $need_escape = 0;
        $need_urlencode = 0;
        $orig_result = $result;
        $found = 1;
        if (strstr($result, '#ESC')) {
            $result = str_replace("#ESC", "#", $result);
            $need_escape = 1;
        } elseif (strstr($result, '#URL')) {
            $result = str_replace("#URL", "#", $result);
            $need_urlencode = 1;
        }
        $replacement = "";
        // echo "RESULT: $result <br>";
        // matches alla fields placeholder
        if (preg_match('/#_MAP/', $result)) {
            $replacement = eme_single_location_map($location);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_PASTEVENTS/', $result)) {
            $replacement = eme_events_in_location_list($location, "past");
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_NEXTEVENTS/', $result)) {
            $replacement = eme_events_in_location_list($location);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_ALLEVENTS/', $result)) {
            $replacement = eme_events_in_location_list($location, "all");
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_(ADDRESS|TOWN)/', $result)) {
            $field = "location_" . ltrim(strtolower($result), "#_");
            if (isset($location[$field])) {
                $replacement = $location[$field];
            }
            $replacement = eme_trans_sanitize_html($replacement, $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_(NAME|LOCATIONNAME|LOCATION)$/', $result)) {
            $field = "location_name";
            if (isset($location[$field])) {
                $replacement = $location[$field];
            }
            $replacement = eme_trans_sanitize_html($replacement, $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_LOCATIONID/', $result)) {
            $field = "location_id";
            $replacement = $location[$field];
            $replacement = eme_trans_sanitize_html($replacement, $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_(IMAGE|LOCATIONIMAGE)$/', $result)) {
            if (!empty($location['location_image_id'])) {
                $location['location_image_url'] = wp_get_attachment_url($location['location_image_id']);
            }
            if (!empty($location['location_image_url'])) {
                $replacement = "<img src='" . $location['location_image_url'] . "' alt='" . eme_trans_sanitize_html($location['location_name'], $lang) . "'/>";
                if ($target == "html") {
                    $replacement = apply_filters('eme_general', $replacement);
                } elseif ($target == "rss") {
                    $replacement = apply_filters('eme_general_rss', $replacement);
                } else {
                    $replacement = apply_filters('eme_text', $replacement);
                }
            }
        } elseif (preg_match('/#_(IMAGEURL|LOCATIONIMAGEURL)/', $result)) {
            if (!empty($location['location_image_id'])) {
                $location['location_image_url'] = wp_get_attachment_url($location['location_image_id']);
            }
            if ($location['location_image_url'] != '') {
                $replacement = $location['location_image_url'];
                if ($target == "html") {
                    $replacement = apply_filters('eme_general', $replacement);
                } elseif ($target == "rss") {
                    $replacement = apply_filters('eme_general_rss', $replacement);
                } else {
                    $replacement = apply_filters('eme_text', $replacement);
                }
            }
        } elseif (preg_match('/#_LOCATIONIMAGETHUMB$/', $result)) {
            if (!empty($location['location_image_id'])) {
                $thumb_array = image_downsize($location['location_image_id'], get_option('eme_thumbnail_size'));
                $thumb_url = $thumb_array[0];
                $thumb_width = $thumb_array[1];
                $thumb_height = $thumb_array[2];
                $replacement = "<img width='{$thumb_width}' height='{$thumb_height}' src='" . $thumb_url . "' alt='" . eme_trans_sanitize_html($location['location_name'], $lang) . "'/>";
                if ($target == "html") {
                    $replacement = apply_filters('eme_general', $replacement);
                } elseif ($target == "rss") {
                    $replacement = apply_filters('eme_general_rss', $replacement);
                } else {
                    $replacement = apply_filters('eme_text', $replacement);
                }
            }
        } elseif (preg_match('/#_LOCATIONIMAGETHUMBURL/', $result)) {
            if (!empty($location['location_image_id'])) {
                $thumb_array = image_downsize($location['location_image_id'], get_option('eme_thumbnail_size'));
                $thumb_url = $thumb_array[0];
                $replacement = $thumb_url;
                if ($target == "html") {
                    $replacement = apply_filters('eme_general', $replacement);
                } elseif ($target == "rss") {
                    $replacement = apply_filters('eme_general_rss', $replacement);
                } else {
                    $replacement = apply_filters('eme_text', $replacement);
                }
            }
        } elseif (preg_match('/#_LOCATIONPAGEURL/', $result)) {
            $replacement = eme_location_url($location, $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_LATITUDE/', $result)) {
            $field = "location_latitude";
            $replacement = $location[$field];
            $replacement = eme_trans_sanitize_html($replacement, $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_LONGITUDE/', $result)) {
            $field = "location_longitude";
            $replacement = $location[$field];
            $replacement = eme_trans_sanitize_html($replacement, $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_DIRECTIONS/', $result)) {
            $replacement = eme_add_directions_form($location);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_CATEGORIES|#_LOCATIONCATEGORIES/', $result) && get_option('eme_categories_enabled')) {
            $categories = eme_get_location_category_names($location['location_id']);
            $replacement = eme_trans_sanitize_html(join(", ", $categories), $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_LOCATIONCATEGORYDESCRIPTIONS/', $result) && get_option('eme_categories_enabled')) {
            $categories = eme_get_location_category_descriptions($location['location_id']);
            $replacement = eme_trans_sanitize_html(join(", ", $categories), $lang);
            if ($target == "html") {
                $replacement = apply_filters('eme_general', $replacement);
            } elseif ($target == "rss") {
                $replacement = apply_filters('eme_general_rss', $replacement);
            } else {
                $replacement = apply_filters('eme_text', $replacement);
            }
        } elseif (preg_match('/#_EDITLOCATIONLINK/', $result)) {
            if (current_user_can(get_option('eme_cap_edit_locations')) || current_user_can(get_option('eme_cap_author_locations')) && $location['location_author'] == $current_userid) {
                $replacement = "<a href=' " . admin_url("admin.php?page=eme-locations&amp;eme_admin_action=edit_location&amp;location_id=" . $location['location_id']) . "'>" . __('Edit') . "</a>";
            }
        } elseif (preg_match('/#_EDITLOCATIONURL/', $result)) {
            if (current_user_can(get_option('eme_cap_edit_locations')) || current_user_can(get_option('eme_cap_author_locations')) && $location['location_author'] == $current_userid) {
                $replacement = admin_url("admin.php?page=eme-locations&amp;eme_admin_action=edit_location&amp;location_id=" . $location['location_id']);
            }
        } elseif (preg_match('/#_IS_SINGLE_LOC/', $result)) {
            if (eme_is_single_location_page()) {
                $replacement = 1;
            } else {
                $replacement = 0;
            }
        } elseif (preg_match('/#_IS_LOGGED_IN/', $result)) {
            if (is_user_logged_in()) {
                $replacement = 1;
            } else {
                $replacement = 0;
            }
        } elseif (preg_match('/#_IS_ADMIN_PAGE/', $result)) {
            if (is_admin()) {
                $replacement = 1;
            } else {
                $replacement = 0;
            }
        } else {
            $found = 0;
        }
        if ($found) {
            if ($need_escape) {
                $replacement = eme_sanitize_request(eme_sanitize_html(preg_replace('/\\n|\\r/', '', $replacement)));
            }
            if ($need_urlencode) {
                $replacement = rawurlencode($replacement);
            }
            $format = str_replace($orig_result, $replacement, $format);
        }
    }
    # we handle DESCRIPTION the last, so no placeholder replacement happens accidentaly in the text of #_DESCRIPTION
    if (preg_match('/#_DESCRIPTION|#_LOCATIONDETAILS/', $format, $placeholders)) {
        $result = $placeholders[0];
        $need_escape = 0;
        $need_urlencode = 0;
        $orig_result = $result;
        if (strstr($result, '#ESC')) {
            $result = str_replace("#ESC", "#", $result);
            $need_escape = 1;
        } elseif (strstr($result, '#URL')) {
            $result = str_replace("#URL", "#", $result);
            $need_urlencode = 1;
        }
        $replacement = "";
        $field = "location_description";
        if (isset($location[$field])) {
            $replacement = $location[$field];
        }
        // no real sanitizing needed, but possible translation
        // this is the same as for an event in fact
        $replacement = eme_translate($replacement);
        if ($target == "html") {
            $replacement = apply_filters('eme_notes', $replacement);
        } elseif ($target == "rss") {
            $replacement = apply_filters('eme_notes_rss', $replacement);
            $replacement = apply_filters('the_content_rss', $replacement);
        } else {
            $replacement = apply_filters('eme_text', $replacement);
        }
        if ($need_escape) {
            $replacement = eme_sanitize_request(eme_sanitize_html(preg_replace('/\\n|\\r/', '', $replacement)));
        }
        if ($need_urlencode) {
            $replacement = rawurlencode($replacement);
        }
        $format = str_replace($orig_result, $replacement, $format);
    }
    // now, replace any language tags found
    $format = eme_translate($format, $lang);
    // and now replace any shortcodes, if wanted
    if ($do_shortcode) {
        return do_shortcode($format);
    } else {
        return $format;
    }
}
Example #8
0
    public function form($instance)
    {
        //Defaults
        $instance = wp_parse_args((array) $instance, array('long_events' => 0));
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $category = empty($instance['category']) ? '' : eme_sanitize_html($instance['category']);
        $notcategory = empty($instance['notcategory']) ? '' : eme_sanitize_html($instance['notcategory']);
        $long_events = isset($instance['long_events']) ? eme_sanitize_html($instance['long_events']) : false;
        $authorid = isset($instance['authorid']) ? eme_sanitize_html($instance['authorid']) : '';
        $categories = eme_get_categories();
        $option_categories = array();
        foreach ($categories as $cat) {
            $id = $cat['category_id'];
            $option_categories[$id] = $cat['category_name'];
        }
        ?>
  <p>
   <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:');
        ?>
</label>
   <input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
  </p>      
  <p>
    <label for="<?php 
        echo $this->get_field_id('long_events');
        ?>
"><?php 
        _e('Show Long Events?', 'eme');
        ?>
:</label>
    <input type="checkbox" id="<?php 
        echo $this->get_field_id('long_events');
        ?>
" name="<?php 
        echo $this->get_field_name('long_events');
        ?>
" value="1" <?php 
        echo $long_events ? 'checked="checked"' : '';
        ?>
 />
  </p>
  <?php 
        if (get_option('eme_categories_enabled')) {
            ?>
  <p>
    <label for="<?php 
            echo $this->get_field_id('category');
            ?>
"><?php 
            _e('Category', 'eme');
            ?>
:</label><br />
   <select id="<?php 
            echo $this->get_field_id('category');
            ?>
" name="<?php 
            echo $this->get_field_name('category');
            ?>
[]" multiple="multiple">
      <?php 
            eme_option_items($option_categories, $category);
            ?>
   </select>
  </p>
  <p>
    <label for="<?php 
            echo $this->get_field_id('notcategory');
            ?>
"><?php 
            _e('Exclude Category', 'eme');
            ?>
:</label><br />
   <select id="<?php 
            echo $this->get_field_id('notcategory');
            ?>
" name="<?php 
            echo $this->get_field_name('notcategory');
            ?>
[]" multiple="multiple">
      <?php 
            eme_option_items($option_categories, $notcategory);
            ?>
   </select>
  </p>
<?php 
        }
        ?>
  <p>
    <label for="<?php 
        echo $this->get_field_id('authorid');
        ?>
"><?php 
        _e('Author', 'eme');
        ?>
:</label><br />
<?php 
        wp_dropdown_users(array('id' => $this->get_field_id('authorid'), 'name' => $this->get_field_name('authorid'), 'show_option_none' => __("Select...", 'eme'), 'selected' => $authorid));
        ?>
  </p>
<?php 
    }
Example #9
0
function eme_registration_seats_form_table($pending = 0)
{
    global $plugin_page;
    $scope_names = array();
    $scope_names['past'] = __('Past events', 'eme');
    $scope_names['all'] = __('All events', 'eme');
    $scope_names['future'] = __('Future events', 'eme');
    $event_id = isset($_POST['event_id']) ? intval($_POST['event_id']) : 0;
    $scope = isset($_POST['scope']) ? $_POST['scope'] : 'future';
    if (isset($_GET['search'])) {
        $scope = "all";
        $search = "[person_id=" . intval($_GET['search']) . "]";
    }
    $all_events = eme_get_events(0, $scope);
    ?>
<div class="wrap">
<div id="icon-events" class="icon32"><br />
</div>
<h2><?php 
    _e('Add a registration for an event', 'eme');
    ?>
</h2>
<div class="wrap">
<br />
<?php 
    admin_show_warnings();
    ?>
   <form id='add-booking' name='add-booking' action="" method="post">
   <input type='hidden' name='eme_admin_action' value='newRegistration' />
   <table class="widefat">
   <tbody>
            <tr><th scope='row'><?php 
    _e('Event', 'eme');
    ?>
:</th><td>
   <select name="event_id">
   <?php 
    foreach ($all_events as $event) {
        if ($event['event_rsvp']) {
            $option_text = $event['event_name'] . " (" . eme_localised_date($event['event_start_date']) . ")";
            echo "<option value='" . $event['event_id'] . "' >" . $option_text . "</option>  ";
        }
    }
    ?>
   </select>
                </td>
            </tr>
   </tbody>
   </table>
   <input type="submit" class="button-primary action" value="<?php 
    _e('Register new booking', 'eme');
    ?>
" />
   </form>
<br />
</div>
<div class="clear"></div>
<h2><?php 
    if ($pending) {
        _e('Pending Approvals', 'eme');
    } else {
        _e('Change reserved spaces or cancel registrations', 'eme');
    }
    ?>
</h2>
<div class="wrap">
<br />

   <div class="tablenav">
   <div class="alignleft">
   <form id="eme-admin-regsearchform" name="eme-admin-regsearchform" action="<?php 
    echo admin_url("admin.php?page={$plugin_page}");
    ?>
" method="post">

   <select name="scope">
   <?php 
    foreach ($scope_names as $key => $value) {
        $selected = "";
        if ($key == $scope) {
            $selected = "selected='selected'";
        }
        echo "<option value='{$key}' {$selected}>{$value}</option>  ";
    }
    ?>
   </select>

   <select name="event_id">
   <option value='0'><?php 
    _e('All events');
    ?>
</option>
   <?php 
    $events_with_bookings = array();
    foreach ($all_events as $event) {
        $selected = "";
        if ($event_id && $event['event_id'] == $event_id) {
            $selected = "selected='selected'";
        }
        if ($pending && eme_get_pending_bookings($event['event_id']) > 0) {
            $events_with_bookings[] = $event['event_id'];
            echo "<option value='" . $event['event_id'] . "' {$selected}>" . $event['event_name'] . "</option>  ";
        } elseif (eme_get_approved_seats($event['event_id']) > 0) {
            $events_with_bookings[] = $event['event_id'];
            echo "<option value='" . $event['event_id'] . "' {$selected}>" . $event['event_name'] . "</option>  ";
        }
    }
    ?>
   </select>

   <input class="button-secondary" type="submit" value="<?php 
    _e('Filter');
    ?>
" />
   </form>
   </div>
   <br />
   <br />
   <form id="eme-admin-regform" name="eme-admin-regform" action="" method="post">
   <select name="eme_admin_action">
   <option value="-1" selected="selected"><?php 
    _e('Bulk Actions');
    ?>
</option>
<?php 
    if ($pending) {
        ?>
   <option value="approveRegistration"><?php 
        _e('Approve registration', 'eme');
        ?>
</option>
<?php 
    }
    ?>
   <option value="updatePayedStatus"><?php 
    _e('Update payed status', 'eme');
    ?>
</option>
   <option value="denyRegistration"><?php 
    _e('Deny registration', 'eme');
    ?>
</option>
   </select>
   <input type="submit" class="button-secondary" value="<?php 
    _e('Apply');
    ?>
" />

   <div class="clear"><p>
   <?php 
    _e('Send mails to attendees upon changes being made?', 'eme');
    echo eme_ui_select_binary(1, "send_mail");
    ?>
   </p></div>
<?php 
    if ($pending) {
        $booking_status = 1;
        // different table id for pending bookings, so the save-state from datatables doesn't interfere with the one from non-pending
        $table_id = "eme_pending_admin_bookings";
    } else {
        $booking_status = 2;
        $table_id = "eme_admin_bookings";
    }
    if ($event_id) {
        $bookings = eme_get_bookings_for($event_id, $booking_status);
    } else {
        $bookings = eme_get_bookings_for($events_with_bookings, $booking_status);
    }
    if (!empty($bookings)) {
        ?>
   <table class="widefat hover stripe" id="<?php 
        print "{$table_id}";
        ?>
">
   <thead>
      <tr>
         <th class='manage-column column-cb check-column' scope='col'><input
            class='select-all' type="checkbox" value='1' /></th>
         <th>hidden for person id search</th>
         <th><?php 
        _e('ID', 'eme');
        ?>
</th>
         <th><?php 
        _e('Name', 'eme');
        ?>
</th>
         <th><?php 
        _e('Date and time', 'eme');
        ?>
</th>
         <th><?php 
        _e('Booker', 'eme');
        ?>
</th>
         <th><?php 
        _e('Booking date', 'eme');
        ?>
</th>
         <th><?php 
        _e('Seats', 'eme');
        ?>
</th>
         <th><?php 
        _e('Event price', 'eme');
        ?>
</th>
         <th><?php 
        _e('Total price', 'eme');
        ?>
</th>
         <th><?php 
        _e('Unique nbr', 'eme');
        ?>
</th>
         <th><?php 
        _e('Paid', 'eme');
        ?>
</th>
      </tr>
   </thead>
   <tbody>
     <?php 
        $search_dest = admin_url("admin.php?page=eme-people");
        foreach ($bookings as $event_booking) {
            $person = eme_get_person($event_booking['person_id']);
            $search_url = add_query_arg(array('search' => $person['person_id']), $search_dest);
            $event = eme_get_event($event_booking['event_id']);
            $payment_id = eme_get_booking_payment_id($event_booking['booking_id']);
            $localised_start_date = eme_localised_date($event['event_start_date']);
            $localised_start_time = eme_localised_time($event['event_start_time']);
            $localised_end_date = eme_localised_date($event['event_end_date']);
            $localised_end_time = eme_localised_time($event['event_end_time']);
            $localised_booking_date = eme_localised_date($event_booking['creation_date']);
            $localised_booking_time = eme_localised_time($event_booking['creation_date']);
            $startstring = strtotime($event['event_start_date'] . " " . $event['event_start_time']);
            $bookingtimestamp = strtotime($event_booking['creation_date']);
            $style = "";
            $today = date("Y-m-d");
            if ($event['event_start_date'] < $today) {
                $style = "style ='background-color: #FADDB7;'";
            }
            ?>
      <tr <?php 
            echo "{$style}";
            ?>
>
         <td><input type='checkbox' class='row-selector' value='<?php 
            echo $event_booking['booking_id'];
            ?>
' name='selected_bookings[]' />
             <input type='hidden' class='row-selector' value='<?php 
            echo $event_booking['booking_id'];
            ?>
' name='bookings[]' /></td>
          <td>[person_id=<?php 
            echo $person['person_id'];
            ?>
]</td>
         <td><a class="row-title" href="<?php 
            echo admin_url("admin.php?page={$plugin_page}&amp;eme_admin_action=editRegistration&amp;booking_id=" . $event_booking['booking_id']);
            ?>
" title="<?php 
            _e('Click the booking ID in order to see and/or edit the details of the booking.', 'eme');
            ?>
"><?php 
            echo $event_booking['booking_id'];
            ?>
</a>
         <td><strong>
         <a class="row-title" href="<?php 
            echo admin_url("admin.php?page=events-manager&amp;eme_admin_action=edit_event&amp;event_id=" . $event_booking['event_id']);
            ?>
" title="<?php 
            _e('Click the event name in order to see and/or edit the details of the event.', 'eme');
            ?>
"><?php 
            echo eme_trans_sanitize_html($event['event_name']);
            ?>
</a>
         </strong>
         <?php 
            $approved_seats = eme_get_approved_seats($event['event_id']);
            $pending_seats = eme_get_pending_seats($event['event_id']);
            $total_seats = $event['event_seats'];
            echo "<br />" . __('Approved: ', 'eme') . $approved_seats . ", " . __('Pending: ', 'eme') . $pending_seats . ", " . __('Max: ', 'eme') . $total_seats;
            if ($approved_seats > 0) {
                $printable_address = admin_url("admin.php?page=eme-people&amp;eme_admin_action=booking_printable&amp;event_id=" . $event['event_id']);
                $csv_address = admin_url("admin.php?page=eme-people&amp;eme_admin_action=booking_csv&amp;event_id=" . $event['event_id']);
                echo " (<a id='booking_printable_" . $event['event_id'] . "'  target='' href='{$printable_address}'>" . __('Printable view', 'eme') . "</a>)";
                echo " (<a id='booking_csv_" . $event['event_id'] . "'  target='' href='{$csv_address}'>" . __('CSV export', 'eme') . "</a>)";
            }
            ?>
         </td>
         <td data-sort="<?php 
            echo $startstring;
            ?>
">
            <?php 
            echo $localised_start_date;
            if ($localised_end_date != '' && $localised_end_date != $localised_start_date) {
                echo " - " . $localised_end_date;
            }
            ?>
<br />
            <?php 
            echo "{$localised_start_time} - {$localised_end_time}";
            ?>
         </td>
         <td><a href="<?php 
            echo $search_url;
            ?>
" title="<?php 
            _e('Click the name of the booker in order to see and/or edit the details of the booker.', 'eme');
            ?>
"><?php 
            echo eme_sanitize_html($person['lastname']) . "(" . eme_sanitize_html($person['phone']) . ", " . eme_sanitize_html($person['email']) . ")";
            ?>
</a>
         </td>
         <td data-sort="<?php 
            echo $bookingtimestamp;
            ?>
">
            <?php 
            echo $localised_booking_date . " " . $localised_booking_time;
            ?>
         </td>
         <?php 
            if (eme_is_multi(eme_get_booking_price($event, $event_booking))) {
                ?>
         <td>
            <?php 
                echo $event_booking['booking_seats_mp'] . '<br />' . __('(Multiprice)', 'eme');
                ?>
         </td>
         <?php 
            } else {
                ?>
         <td>
            <?php 
                echo $event_booking['booking_seats'];
                ?>
         </td>
         <?php 
            }
            ?>
         <td>
            <?php 
            echo eme_get_booking_price($event, $event_booking);
            ?>
         </td>
         <td>
            <?php 
            echo eme_get_total_booking_price($event, $event_booking);
            ?>
         </td>
         <td>
            <span title="<?php 
            print sprintf(__('This is based on the payment ID of the booking: %d', 'eme'), $payment_id);
            ?>
"><?php 
            echo eme_sanitize_html($event_booking['transfer_nbr_be97']);
            ?>
</span>
         </td>
         <td>
            <?php 
            echo eme_ui_select_binary($event_booking['booking_payed'], "bookings_payed[]");
            ?>
         </td>
      </tr>
      <?php 
        }
        ?>
   </tbody>
   </table>

<script type="text/javascript">
   jQuery(document).ready( function() {
         jQuery('#<?php 
        print "{$table_id}";
        ?>
').dataTable( {
            "dom": 'CT<"clear">Rlfrtip',
            <?php 
        // jquery datatables locale loading
        $locale_code = get_locale();
        $locale_file = EME_PLUGIN_DIR . "js/jquery-datatables/i18n/{$locale_code}.json";
        $locale_file_url = EME_PLUGIN_URL . "js/jquery-datatables/i18n/{$locale_code}.json";
        if ($locale_code != "en_US" && file_exists($locale_file)) {
            ?>
            "language": {
               "url": "<?php 
            echo $locale_file_url;
            ?>
"
               },
            <?php 
        }
        ?>
 
            "stateSave": true,
            <?php 
        if (!empty($search)) {
            // If datatables state is saved, the initial search
            // is ignored and we need to use stateloadparams
            // So we give the 2 options
            ?>
 
            "stateLoadParams": function (settings, data) {
               data.search.search = "<?php 
            echo $search;
            ?>
";
            },
            "search": {
               "search":  "<?php 
            echo $search;
            ?>
"
            },
            <?php 
        }
        ?>
 
            "pagingType": "full",
            "columnDefs": [
               { "sortable": false, "targets": 0 },
               { "visible": false, "targets": 1 }
            ],
            "colVis": {
               "exclude": [0,1]
            },
            "tableTools": {
               "aButtons": [ { "sExtends": "csv", "mColumns": "visible"},
                             "print"
                           ],
               "sSwfPath": "<?php 
        echo EME_PLUGIN_URL;
        ?>
js/jquery-datatables/extensions/TableTools-2.2.4-dev/swf/copy_csv_xls.swf"
            }
         } );
   } );
</script>

<?php 
    }
    ?>

   <div class='tablenav'>
   <div class="alignleft actions"><br class='clear' />
   </div>
   <br class='clear' />
   </div>

   </div>
   </form>
</div>
</div>
<?php 
}
Example #10
0
function eme_options_page() {
   global $plugin_page;
   if ($plugin_page == 'eme-options') {
      $tab = isset( $_GET['tab'] ) ? esc_attr($_GET['tab']) : 'general';
      eme_admin_tabs($tab);
   ?>
<div class="wrap">
<div id='icon-options-general' class='icon32'><br />
</div>
<h1><?php _e ( 'Event Manager Options', 'eme' ); ?></h1>
<?php admin_show_warnings();?>
<p> 
<?php printf(__( "Please also check <a href='%s'>your profile</a> for some per-user EME settings.", 'eme' ),admin_url('profile.php')); ?>
</p>
<form id="eme_options_form" method="post" action="options.php">
<input type='hidden' name='tab' value='<?php echo $tab;?>' />
<?php
   settings_fields ( 'eme-options' );
   switch ( $tab ) {
	      case 'general' :
?>

<h3><?php _e ( 'General options', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_radio_binary ( __ ( 'Use dropdown for locations?' ), 'eme_use_select_for_locations', __ ( 'Select yes to select location from a drop-down menu; location selection will be faster, but you will lose the ability to insert locations with events.','eme' )."<br />".__ ( 'When the qtranslate plugin is installed and activated, this setting will be ignored and always considered \'Yes\'.','eme' ) );
   eme_options_radio_binary ( __ ( 'Use recurrence?' ), 'eme_recurrence_enabled', __ ( 'Select yes to enable the possibility to create recurrent events.','eme' ) ); 
   eme_options_radio_binary ( __ ( 'Use RSVP?' ), 'eme_rsvp_enabled', __ ( 'Select yes to enable the RSVP feature so people can register for an event and book places.','eme' ) );
   eme_options_radio_binary ( __ ( 'Use categories?' ), 'eme_categories_enabled', __ ( 'Select yes to enable the category features.','eme' ) );
   eme_options_radio_binary ( __ ( 'Use attributes?' ), 'eme_attributes_enabled', __ ( 'Select yes to enable the attributes feature.','eme' ) );
   eme_options_radio_binary ( __ ( 'Enable Google Maps integration?' ), 'eme_gmap_is_active', __ ( 'Check this option to enable Google Map integration.','eme' ) );
   eme_options_radio_binary ( __ ( 'Enable map scroll-wheel zooming?' ), 'eme_gmap_zooming', __ ( 'Yes, enables map scroll-wheel zooming. No, enables scroll-wheel page scrolling over maps. (It will be necessary to refresh your web browser on a map page to see the effect of this change.)', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Always include JS in header?' ), 'eme_load_js_in_header', __ ( 'Some themes are badely designed and can have issues showing the google maps or advancing in the calendar. If so, try activating this option which will cause the javascript to always be included in the header of every page (off by default).','eme' ) );
   eme_options_radio_binary ( __ ( 'Use the client computer clock for the calendar', 'eme' ), 'eme_use_client_clock', __ ( 'Check this option if you want to use the clock of the client as base to calculate current day for the calendar.', 'eme' ) );
   eme_options_select ( __('Theme loop protection','eme'), 'eme_loop_protection', array ('simple' => __('Simple loop protection (default)','eme'), 'older' => __ ( 'Loop protection for older or misbehaving themes', 'eme' ), 'desperate' => __('Last attempt at loop protection (if all else fails)','eme')), __('Choose the level of loop protection against the_content filter you want. Depending on the theme you may need to change this.','eme') );
   eme_options_radio_binary ( __ ( 'Delete all EME data when upgrading or deactivating?', 'eme' ), 'eme_uninstall_drop_data', __ ( 'Check this option if you want to delete all EME data (database tables and options) when upgrading or deactivating the plugin.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Enable shortcodes in widgets', 'eme' ), 'eme_shortcodes_in_widgets', __ ( 'Check this option if you want to enable the use of shortcodes in widgets (affects shortcodes of any plugin used in widgets, so use with care).', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Enable placeholders in event notes', 'eme' ), 'eme_enable_notes_placeholders', __ ( 'Check this option if you want to enable the use of placeholders in the event notes. By default placeholders in notes are not being touched at all so as not to interfere with possible format settings for other shortcodes you can/want to use, so use with care.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Allow deprecated placeholders', 'eme' ), 'eme_deprecated', __ ( 'Check this option if you want to use some deprecated placeholders.', 'eme' ) .' '.__('For more information, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?p=51559'>".__('the documentation', 'eme').'</a>' );
   eme_options_radio_binary ( __ ( 'Re-enable legacy placeholder syntax', 'eme' ), 'eme_legacy', __ ( 'Check this option if you want to re-enable the use of the older placeholder syntax with square brackets. Be aware of the fact that the new placeholder syntax will not work then.', 'eme' ) .' '.__('For more information, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?p=51559'>".__('the documentation', 'eme').'</a>' );
   ?>
</table>

<?php
	      break;
	      case 'seo' :
?>

<h3><?php _e ( 'Permalink options', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_radio_binary ( __ ( 'Enable event permalinks if possible?','eme' ), 'eme_seo_permalink', __ ( 'If Yes, EME will render SEO permalinks if permalinks are activated.', 'eme' ) . "<br \><strong>" . __ ( 'It is necessary to click \'Save Changes\' on the  WordPress \'Settings/Permalinks\' page before you will see the effect of this change.','eme' )."</strong>");
   eme_options_input_text ( __('Events permalink prefix', 'eme' ), 'eme_permalink_events_prefix', __( 'The permalink prefix used for events and the calendar.','eme') );
   eme_options_input_text ( __('Locations permalink prefix', 'eme' ), 'eme_permalink_locations_prefix', __( 'The permalink prefix used for locations.','eme') );
   ?>
</table>

<?php
	      break;
	      case 'access' :
?>

<h3><?php _e ( 'Access rights', 'eme' ); ?></h3>
<p><?php _e ( 'Tip: Use a plugin like "User Role Editor" to add/edit capabilities and roles.', 'eme' ); ?></p>
<table class="form-table">
   <?php
   eme_options_select (__('Add event','eme'), 'eme_cap_add_event', eme_get_all_caps (), sprintf(__('Permission needed to add a new event. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_ADD_EVENT)) );
   eme_options_select (__('Author event','eme'), 'eme_cap_author_event', eme_get_all_caps (), sprintf(__('Permission needed to edit own events. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_AUTHOR_EVENT)) );
   eme_options_select (__('Publish event','eme'), 'eme_cap_publish_event', eme_get_all_caps (), sprintf(__('Permission needed to make an event public. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_PUBLISH_EVENT)) );
   eme_options_select (__('List events','eme'), 'eme_cap_list_events', eme_get_all_caps (), sprintf(__('Permission needed to just list all events, useful for CSV exports for bookings and such. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_LIST_EVENTS)) . "<br /><b>". __('All your event admins need this as well, otherwise the menu will not show.','eme')."</b>" );
   eme_options_select (__('Edit events','eme'), 'eme_cap_edit_events', eme_get_all_caps (), sprintf(__('Permission needed to edit all events. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_EDIT_EVENTS)) );
   eme_options_select (__('Add location','eme'), 'eme_cap_add_locations', eme_get_all_caps (), sprintf(__('Permission needed to add locations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_ADD_LOCATION)) );
   eme_options_select (__('Author location','eme'), 'eme_cap_author_locations', eme_get_all_caps (), sprintf(__('Permission needed to edit own locations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_AUTHOR_LOCATION)) );
   eme_options_select (__('Edit location','eme'), 'eme_cap_edit_locations', eme_get_all_caps (), sprintf(__('Permission needed to edit all locations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_EDIT_LOCATIONS)) );
   eme_options_select (__('Edit categories','eme'), 'eme_cap_categories', eme_get_all_caps (), sprintf(__('Permission needed to edit all categories. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_CATEGORIES)) );
   eme_options_select (__('Edit templates','eme'), 'eme_cap_templates', eme_get_all_caps (), sprintf(__('Permission needed to edit all templates. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_TEMPLATES)) );
   eme_options_select (__('View people','eme'), 'eme_cap_people', eme_get_all_caps (), sprintf(__('Permission needed to view registered people info. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_PEOPLE)) );
   eme_options_select (__('Approve registrations','eme'), 'eme_cap_approve', eme_get_all_caps (), sprintf(__('Permission needed to approve pending registrations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_APPROVE)) );
   eme_options_select (__('Edit registrations','eme'), 'eme_cap_registrations', eme_get_all_caps (), sprintf(__('Permission needed to edit approved registrations. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_REGISTRATIONS)) );
   eme_options_select (__('Send Mails','eme'), 'eme_cap_send_mails', eme_get_all_caps (), sprintf(__('Permission needed to send mails for own events. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_SEND_MAILS)) );
   eme_options_select (__('Send Other Mails','eme'), 'eme_cap_send_other_mails', eme_get_all_caps (), sprintf(__('Permission needed to send mails for any event. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_SEND_OTHER_MAILS)) );
   eme_options_select (__('Edit form fields','eme'), 'eme_cap_forms', eme_get_all_caps (), sprintf(__('Permission needed to edit form fields. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_FORMS)) );
   eme_options_select (__('Cleanup','eme'), 'eme_cap_cleanup', eme_get_all_caps (), sprintf(__('Permission needed to execute cleanup actions. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_CLEANUP)) );
   eme_options_select (__('Edit settings','eme'), 'eme_cap_settings', eme_get_all_caps (),sprintf(__('Permission needed to edit settings. Default: %s','eme'), eme_capNamesCB(DEFAULT_CAP_SETTINGS)) );
   ?>
</table>

<?php
	      break;
	      case 'events' :
?>

<h3><?php _e ( 'Events page', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_select ( __ ( 'Events page', 'eme' ), 'eme_events_page', eme_get_all_pages (), __ ( 'This option allows you to select which page to use as an events page.', 'eme' )."<br /><strong>".__ ( 'The content of this page (including shortcodes of any kind) will be ignored completely and dynamically replaced by events data.','eme' )."</strong>" );
   eme_options_radio_binary ( __ ( 'Show events page in lists?', 'eme' ), 'eme_list_events_page', __ ( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'eme' )."<br /><strong>".__ ( 'This option should no longer be used, it will be deprecated. Using the [eme_events] shortcode in a self created page is recommended.', 'eme' )."</strong>" ); 
   eme_options_radio_binary ( __ ( 'Display calendar in events page?', 'eme' ), 'eme_display_calendar_in_events_page', __ ( 'This option allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','eme' ) );
   eme_options_input_text ( __('Number of events to show in lists', 'eme' ), 'eme_event_list_number_items', __( 'The number of events to show in a list if no specific limit is specified (used in the shortcode eme_events, RSS feed, the placeholders #_NEXTEVENTS and #_PASTEVENTS, ...). Use 0 for no limit.','eme') );
   eme_options_select (__('State for new event','eme'), 'eme_event_initial_state', eme_status_array(), __ ('Initial state for a new event','eme') );
   ?>
</table>
<h3><?php _e ( 'Events format', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_radio_binary ( __ ( 'Remove leading zeros from minutes?', 'eme' ), 'eme_time_remove_leading_zeros', __ ( 'PHP date/time functions have no notation to show minutes without leading zeros. Checking this option will return e.g. 9 for 09 and empty for 00.', 'eme' ) ); 
   eme_options_textarea ( __ ( 'Default event list format header', 'eme' ), 'eme_event_list_item_format_header', sprintf(__('This content will appear just above your code for the default event list format. If you leave this empty, the value <code>%s</code> will be used.','eme'),eme_sanitize_html(DEFAULT_EVENT_LIST_HEADER_FORMAT)));
   eme_options_textarea ( __ ( 'Default categories event list format header', 'eme' ), 'eme_cat_event_list_item_format_header', sprintf(__('This content will appear just above your code for the event list format when showing events for a specific category. If you leave this empty, the value <code>%s</code> will be used.','eme'),eme_sanitize_html(DEFAULT_CAT_EVENT_LIST_HEADER_FORMAT)));
   eme_options_textarea ( __ ( 'Default event list format', 'eme' ), 'eme_event_list_item_format', __ ( 'The format of any events in a list.<br/>Insert one or more of the following placeholders: <code>#_EVENTNAME</code>, <code>#_LOCATIONNAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>.<br/> Use <code>#_EXCERPT</code> to show <code>#_NOTES</code> until you place a <code>&lt;!&ndash;&ndash;more&ndash;&ndash;&gt;</code> marker.<br/> Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page.<br/> Use <code>#_EVENTPAGEURL</code> to print the event page URL and make your own customised links.<br/> Use <code>#_LOCATIONPAGEURL</code> to print the location page URL and make your own customised links.<br/>Use <code>#_EDITEVENTLINK</code> to add a link to edit page for the event, which will appear only when a user is logged in.<br/>To insert date and time values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a>  with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/> For the end time, put <code>#@</code> in front of the character, e.g. <code>#@h</code>, <code>#@i</code>, etc.<br/> You can also create a date format without prepending <code>#</code> by wrapping it in #_{} or #@_{} (e.g. <code>#_{d/m/Y}</code>). If there is no end date, the value is not shown.<br/>Use <code>#_12HSTARTTIME</code> and <code>#_12HENDTIME</code> for AM/PM start-time/end-time notation, idem <code>#_24HSTARTTIME</code> and <code>#_24HENDTIME</code>.<br/>Feel free to use HTML tags as <code>li</code>, <code>br</code> and so on.<br/>For custom attributes, you use <code>#_ATT{key}{alternative text}</code>, the second braces are optional and will appear if the attribute is not defined or left blank for that event. This key will appear as an option when adding attributes to your event.', 'eme' )."<br />".__('Use <code>#_PAST_FUTURE_CLASS</code> to return a class name indicating this event is future or past (<code>eme-future-event</code> or <code>eme-past-event</code>), use the returned value in e.g. the li-statement for each event in the list of events','eme') .'<br />'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=25'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Default event list format footer', 'eme' ), 'eme_event_list_item_format_footer', sprintf(__('This content will appear just below your code for the default event list format. If you leave this empty, the value <code>%s</code> will be used.','eme'),eme_sanitize_html(DEFAULT_EVENT_LIST_FOOTER_FORMAT)));
   eme_options_textarea ( __ ( 'Default categories event list format footer', 'eme' ), 'eme_cat_event_list_item_format_footer', sprintf(__('This content will appear just below your code for the default event list format when showing events for a specific category. If you leave this empty, the value <code>%s</code> will be used.','eme'),eme_sanitize_html(DEFAULT_CAT_EVENT_LIST_FOOTER_FORMAT)));
   eme_options_input_text ( __ ( 'Single event page title format', 'eme' ), 'eme_event_page_title_format', __ ( 'The format of a single event page title. Follow the previous formatting instructions.', 'eme' ) );
   eme_options_input_text ( __ ( 'Single event html title format', 'eme' ), 'eme_event_html_title_format', __ ( 'The format of a single event html page title. Follow the previous formatting instructions.', 'eme' ). __( ' The default is: ','eme'). eme_sanitize_html(DEFAULT_EVENT_HTML_TITLE_FORMAT));
   eme_options_textarea ( __ ( 'Default single event format', 'eme' ), 'eme_single_event_format', __ ( 'The format of a single event page.<br/>Follow the previous formatting instructions. <br/>Use <code>#_MAP</code> to insert a map.<br/>Use <code>#_CONTACTNAME</code>, <code>#_CONTACTEMAIL</code>, <code>#_CONTACTPHONE</code> to insert respectively the name, e-mail address and phone number of the designated contact person. <br/>Use <code>#_ADDBOOKINGFORM</code> to insert a form to allow the user to respond to your events reserving one or more places (RSVP).<br/> Use <code>#_REMOVEBOOKINGFORM</code> to insert a form where users, inserting their name and e-mail address, can remove their bookings.', 'eme' ).__('<br/>Use <code>#_ADDBOOKINGFORM_IF_NOT_REGISTERED</code> to insert the booking form only if the user has not registered yet. Similar use <code>#_REMOVEBOOKINGFORM_IF_REGISTERED</code> to insert the booking removal form only if the user has already registered before. These two codes only work for WP users.','eme').__('<br/> Use <code>#_DIRECTIONS</code> to insert a form so people can ask directions to the event.','eme').__('<br/> Use <code>#_CATEGORIES</code> to insert a comma-seperated list of categories an event is in.','eme').__('<br/> Use <code>#_ATTENDEES</code> to get a list of the names attending the event.','eme') .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=25'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Monthly period date format', 'eme' ), 'eme_show_period_monthly_dateformat', __ ( 'The format of the date-string used when you use showperiod=monthly as an option to &#91;the eme_events] shortcode, also used for monthly pagination. Use php date() compatible settings.', 'eme') . __( ' The default is: ','eme'). DEFAULT_SHOW_PERIOD_MONTHLY_DATEFORMAT );
   eme_options_input_text ( __ ( 'Yearly period date format', 'eme' ), 'eme_show_period_yearly_dateformat', __ ( 'The format of the date-string used when you use showperiod=yearly as an option to &#91;the eme_events] shortcode, also used for yearly pagination. Use php date() compatible settings.', 'eme') . __( ' The default is: ','eme'). DEFAULT_SHOW_PERIOD_YEARLY_DATEFORMAT );
   eme_options_input_text ( __ ( 'Events page title', 'eme' ), 'eme_events_page_title', __ ( 'The title on the multiple events page.', 'eme' ) );
   eme_options_input_text ( __ ( 'No events message', 'eme' ), 'eme_no_events_message', __ ( 'The message displayed when no events are available.', 'eme' ) );
   ?>
</table>
<h3><?php _e ( 'Events filtering format', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_textarea ( __ ( 'Default event list filtering format', 'eme' ), 'eme_filter_form_format', __ ( 'This defines the layout of the event list filtering form when using the shortcode <code>[eme_filterform]</code>. Use <code>#_FILTER_CATS</code>, <code>#_FILTER_LOCS</code>, <code>#_FILTER_TOWNS</code>, <code>#_FILTER_WEEKS</code>, <code>#_FILTER_MONTHS</code>.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=28'>".__('the documentation', 'eme').'</a>' );
   ?>
</table>

<?php
	      break;
	      case 'calendar' :
?>

<h3><?php _e ( 'Calendar options', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_radio_binary ( __ ( 'Hide past events?', 'eme' ), 'eme_cal_hide_past_events', __ ( 'Check this option if you want to hide past events in the calendar.', 'eme' ) ); 
   ?>
</table>
<h3><?php _e ( 'Calendar format', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_input_text ( __ ( 'Small calendar title', 'eme' ), 'eme_small_calendar_event_title_format', __ ( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'eme' ) );
   eme_options_input_text ( __ ( 'Small calendar title separator', 'eme' ), 'eme_small_calendar_event_title_separator', __ ( 'The separator appearing on the above title when more than one event is taking place on the same day.', 'eme' ) );
   eme_options_input_text ( __ ( 'Full calendar events format', 'eme' ), 'eme_full_calendar_event_format', __ ( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'eme' ) );
   ?>
</table>

<?php
	      break;
	      case 'locations' :
?>

<h3><?php _e ( 'Locations format', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_textarea ( __ ( 'Default location list format header', 'eme' ), 'eme_location_list_format_header', sprintf(__( 'This content will appear just above your code for the default location list format. If you leave this empty, the value <code>%s</code> will be used.<br/>Used by the shortcode <code>[eme_locations]</code>', 'eme'),eme_sanitize_html(DEFAULT_LOCATION_LIST_HEADER_FORMAT)));
   eme_options_textarea ( __ ( 'Default location list item format', 'eme' ), 'eme_location_list_format_item', sprintf(__ ( 'The format of a location in a location list. If you leave this empty, the value <code>%s</code> will be used.<br/>See the documentation for a list of available placeholders for locations.<br/>Used by the shortcode <code>[eme_locations]</code>', 'eme' ),eme_sanitize_html(DEFAULT_LOCATION_EVENT_LIST_ITEM_FORMAT)) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=26'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Default location list format footer', 'eme' ), 'eme_location_list_format_footer', sprintf(__( 'This content will appear just below your code for the default location list format. If you leave this empty, the value <code>%s</code> will be used.<br/>Used by the shortcode <code>[eme_locations]</code>', 'eme'),eme_sanitize_html(DEFAULT_LOCATION_LIST_FOOTER_FORMAT)));

   eme_options_input_text ( __ ( 'Single location page title format', 'eme' ), 'eme_location_page_title_format', __ ( 'The format of a single location page title.<br/>Follow the previous formatting instructions.', 'eme' ) );
   eme_options_input_text ( __ ( 'Single location html title format', 'eme' ), 'eme_location_html_title_format', __ ( 'The format of a single location html page title.<br/>Follow the previous formatting instructions.', 'eme' ). __( ' The default is: ','eme'). DEFAULT_LOCATION_HTML_TITLE_FORMAT);
   eme_options_textarea ( __ ( 'Default single location page format', 'eme' ), 'eme_single_location_format', __ ( 'The format of a single location page.<br/>Insert one or more of the following placeholders: <code>#_LOCATIONNAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code>.<br/> Use <code>#_MAP</code> to display a map of the event location, and <code>#_IMAGE</code> to display an image of the location.<br/> Use <code>#_NEXTEVENTS</code> to insert a list of the upcoming events, <code>#_PASTEVENTS</code> for a list of past events, <code>#_ALLEVENTS</code> for a list of all events taking place in this location.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=26'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Default location balloon format', 'eme' ), 'eme_location_baloon_format', __ ( 'The format of the text appearing in the balloon describing the location in the map.<br/>Insert one or more of the following placeholders: <code>#_LOCATIONNAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code>,<code>#_IMAGE</code>, <code>#_LOCATIONPAGEURL</code> or <code>#_DIRECTIONS</code>.', 'eme' ) );
   eme_options_textarea ( __ ( 'Default location event list format', 'eme' ), 'eme_location_event_list_item_format', __ ( 'The format of the events list inserted in the location page through the <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> element. <br/> Follow the events formatting instructions', 'eme' ) );
   eme_options_textarea ( __ ( 'Default no events message', 'eme' ), 'eme_location_no_events_message', __ ( 'The message to be displayed in the list generated by <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> when no events are available.', 'eme' ) );
   ?>
</table>

<?php
	      break;
	      case 'rss' :
?>

<h3><?php _e ( 'RSS and ICAL feed format', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_input_text ( __ ( 'RSS main title', 'eme' ), 'eme_rss_main_title', __ ( 'The main title of your RSS events feed.', 'eme' ) );
   eme_options_input_text ( __ ( 'RSS main description', 'eme' ), 'eme_rss_main_description', __ ( 'The main description of your RSS events feed.', 'eme' ) );
   eme_options_input_text ( __ ( 'RSS title format', 'eme' ), 'eme_rss_title_format', __ ( 'The format of the title of each item in the events RSS feed.', 'eme' ) );
   eme_options_textarea ( __ ( 'RSS description format', 'eme' ), 'eme_rss_description_format', __ ( 'The format of the description of each item in the events RSS feed. Follow the previous formatting instructions.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'RSS Pubdate usage', 'eme' ), 'eme_rss_show_pubdate', __ ( 'Show the event creation/modification date as PubDate info in the in the events RSS feed.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'RSS Pubdate is start date', 'eme' ), 'eme_rss_pubdate_startdate', __ ( 'If you select this, the pubDate field in RSS will be the event start date, not the modification date.', 'eme' ) );
   eme_options_input_text ( __ ( 'ICAL title format', 'eme' ), 'eme_ical_title_format', __ ( 'The format of the title of each item in the events ICAL feed.', 'eme' ) );
   eme_options_input_text ( __ ( 'ICAL description format', 'eme' ), 'eme_ical_description_format', __ ( 'The format of the description of each item in the events ICAL feed. Follow the previous formatting instructions.', 'eme' ) );
   ?>
</table>

<?php
	      break;
	      case 'rsvp' :
?>

<h3><?php _e ( 'RSVP: registrations and bookings', 'eme' ); ?></h3>
<table class='form-table'>
     <?php
   $indexed_users[-1]=__('Event author','eme');
   $indexed_users+=eme_get_indexed_users();
   eme_options_select ( __ ( 'Default contact person', 'eme' ), 'eme_default_contact_person', $indexed_users, __ ( 'Select the default contact person. This user will be employed whenever a contact person is not explicitly specified for an event', 'eme' ) );
   eme_options_radio_binary ( __ ( 'By default enable registrations for new events?', 'eme' ), 'eme_rsvp_reg_for_new_events', __ ( 'Check this option if you want to enable registrations by default for new events.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'By default require approval for registrations?', 'eme' ), 'eme_rsvp_require_approval', __ ( 'Check this option if you want by default that new registrations require approval.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'By default require WP membership to be able to register?', 'eme' ), 'eme_rsvp_registered_users_only', __ ( 'Check this option if you want by default that only WP registered users can book for an event.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Check required fields upon submit?', 'eme' ), 'eme_rsvp_check_required_fields', __ ( 'Check this option if you want to check on the server-side if all required fields have been completed upon RSVP form submit. Consider using a captcha if disabling this.', 'eme' ) );
   eme_options_input_text ( __ ( 'Default number of spaces', 'eme' ), 'eme_rsvp_default_number_spaces', __ ( 'The default number of spaces an event has.', 'eme' ) );
   eme_options_input_text ( __ ( 'Min number of spaces to book', 'eme' ), 'eme_rsvp_addbooking_min_spaces', __ ( 'The minimum number of spaces a person can book in one go (it can be 0, for e.g. just an attendee list).', 'eme' ) );
   eme_options_input_text ( __ ( 'Max number of spaces to book', 'eme' ), 'eme_rsvp_addbooking_max_spaces', __ ( 'The maximum number of spaces a person can book in one go.', 'eme' ) );
   $eme_rsvp_number_days=get_option('eme_rsvp_number_days');
   $eme_rsvp_number_hours=get_option('eme_rsvp_number_hours');
   $eme_rsvp_end_target=get_option('eme_rsvp_end_target');
   ?>
   <tr valign="top" id='eme_rsvp_number_row'>
      <th scope="row"><?php _e('By default allow RSVP until this many', 'eme') ?></th>
      <td>
      <input name="eme_rsvp_number_days" type="text" id="eme_rsvp_number_days" value="<?php echo eme_sanitize_html($eme_rsvp_number_days); ?>" size="4" /> <?php _e('days', 'eme') ?>
      <input name="eme_rsvp_number_hours" type="text" id="eme_rsvp_number_hours" value="<?php echo eme_sanitize_html($eme_rsvp_number_hours); ?>" size="4" /> <?php _e('hours', 'eme') ?>
      <?php
      $eme_rsvp_end_target_list = array('start'=>__('starts','eme'),'end'=>__('ends','eme'));
      _e ( 'before the event ','eme' );
      echo eme_ui_select($eme_rsvp_end_target,'eme_rsvp_end_target',$eme_rsvp_end_target_list);
      ?>
      </td>
   </tr>
   <?php
   eme_options_input_text ( __ ( 'RSVP cancel cutoff', 'eme' ), 'eme_cancel_rsvp_days', __ ( 'Allow RSVP cancellation until this many days before the event starts.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Use captcha for booking form?', 'eme' ), 'eme_captcha_for_booking', __ ( 'Check this option if you want to use a captcha on the booking form, to thwart spammers a bit.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Hide fully booked events?', 'eme' ), 'eme_rsvp_hide_full_events', __ ( 'Check this option if you want to hide events that are fully booked from the calendar and events listing in the front.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Hide RSVP ended events?', 'eme' ), 'eme_rsvp_hide_rsvp_ended_events', __ ( 'Check this option if you want to hide events which RSVP registration period has already ended.', 'eme' ) );
   eme_options_input_text ( __ ( 'Add booking form submit text', 'eme' ), 'eme_rsvp_addbooking_submit_string', __ ( "The string of the submit button on the add booking form", 'eme' ) );
   eme_options_input_text ( __ ( 'Delete booking form submit text', 'eme' ), 'eme_rsvp_delbooking_submit_string', __ ( "The string of the submit button on the delete booking form", 'eme' ) );
   eme_options_input_text ( __ ( 'Attendees list format', 'eme' ), 'eme_attendees_list_format', __ ( "The format for the attendees list when using the <code>#_ATTENDEES</code> placeholder.", 'eme' ). __('For all placeholders you can use here, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=48'>".__('the documentation', 'eme').'</a>' );
   eme_options_radio_binary ( __ ( 'Attendees list ignore pending', 'eme' ), 'eme_attendees_list_ignore_pending', __ ( "Whether or not to ignore pending bookings when using the <code>#_ATTENDEES</code> placeholder.", 'eme' ));
   eme_options_input_text ( __ ( 'Bookings list header format', 'eme' ), 'eme_bookings_list_header_format', __ ( "The header format for the bookings list when using the <code>#_BOOKINGS</code> placeholder.", 'eme' ). sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(DEFAULT_BOOKINGS_LIST_HEADER_FORMAT)));
   eme_options_input_text ( __ ( 'Bookings list format', 'eme' ), 'eme_bookings_list_format', __ ( "The format for the bookings list when using the <code>#_BOOKINGS</code> placeholder.", 'eme' ). __('For all placeholders you can use here, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=45'>".__('the documentation', 'eme').'</a>' .__('For more information about form fields, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=44'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Bookings list footer format', 'eme' ), 'eme_bookings_list_footer_format', __ ( "The footer format for the bookings list when using the <code>#_BOOKINGS</code> placeholder.", 'eme' ). sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(DEFAULT_BOOKINGS_LIST_FOOTER_FORMAT)));
   eme_options_radio_binary ( __ ( 'Bookings list ignore pending', 'eme' ), 'eme_bookings_list_ignore_pending', __ ( "Whether or not to ignore pending bookings when using the <code>#_BOOKINGS</code> placeholder.", 'eme' ));
   eme_options_textarea ( __ ( 'Booking recorded message', 'eme' ), 'eme_registration_recorded_ok_html', __ ( "The text (html allowed) shown to the user when the booking has been made successfully.", 'eme' ) );
   eme_options_radio_binary ( __ ( 'Show RSVP form again after booking?', 'eme' ), 'eme_rsvp_show_form_after_booking', __ ( "Uncheck this option if you don't want to show the RSVP booking form again after a successful booking.", 'eme' ) );
   ?>
</table>

<h3><?php _e ( 'RSVP: form format', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      eme_options_textarea (__('Form format','eme'),'eme_registration_form_format', __("The look and feel of the form for registrations. #_NAME, #_EMAIL and #_SEATS are obligated fields, if not present then the form will not be shown.",'eme')  .'<br/>'.__('For more information about form fields, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=44'>".__('the documentation', 'eme').'</a>');
      eme_options_textarea (__('Cancel form format','eme'),'eme_cancel_form_format', __("The look and feel of the cancel form for registrations. #_NAME and #_EMAIL are obligated fields, if not present then the form will not be shown.", 'eme').'<br/>'.__('For more information about form fields, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=5950'>".__('the documentation', 'eme').'</a>');
   ?>
</table>


<?php
	      break;
	      case 'mail' :
?>

<h3><?php _e ( 'RSVP: mail options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
   eme_options_radio_binary ( __ ( 'Enable the RSVP e-mail notifications?', 'eme' ), 'eme_rsvp_mail_notify_is_active', __ ( 'Check this option if you want to receive an email when someone books places for your events.', 'eme' ) );
   ?>
</table>
<table id="rsvp_mail_notify-data" class='form-table'>
   <?php
   eme_options_radio_binary ( __ ( 'Send HTML mails', 'eme' ), 'eme_rsvp_send_html', __ ( 'Check this option if you want to use html in the mails being sent.', 'eme' ) );
   eme_options_radio_binary ( __ ( 'Quick deny send mails', 'eme' ), 'eme_deny_mail_event_edit', __ ( 'Check this option if you want to sent mails when denying a registration while editing an event.', 'eme' ) );
   eme_options_input_text ( __ ( 'Contact person email subject format', 'eme' ), 'eme_contactperson_email_subject', __ ( 'The format of the email subject which will be sent to the contact person.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Contact person email format', 'eme' ), 'eme_contactperson_email_body', __ ( 'The format of the email which will be sent to the contact person.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Contact person cancelled email subject format', 'eme' ), 'eme_contactperson_cancelled_email_subject', __ ( 'The format of the email subject which will be sent to the contact person for a cancellation.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Contact person cancelled email format', 'eme' ), 'eme_contactperson_cancelled_email_body', __ ( 'The format of the email which will be sent to the contact person for a cancellation.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Contact person pending email subject format', 'eme' ), 'eme_contactperson_pending_email_subject', __ ( 'The format of the email subject which will be sent to the contact person if approval is needed.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Contact person pending email format', 'eme' ), 'eme_contactperson_pending_email_body', __ ( 'The format of the email which will be sent to the contact person if approval is needed.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Respondent email subject format', 'eme' ), 'eme_respondent_email_subject', __ ( 'The format of the email subject which will be sent to the respondent.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Respondent email format', 'eme' ), 'eme_respondent_email_body', __ ( 'The format of the email which will be sent to the respondent.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Registration pending email subject format', 'eme' ), 'eme_registration_pending_email_subject', __ ( 'The format of the email subject which will be sent to the respondent when the event requires registration approval.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Registration pending email format', 'eme' ), 'eme_registration_pending_email_body', __ ( 'The format of the email which will be sent to the respondent when the event requires registration approval.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Registration cancelled email subject format', 'eme' ), 'eme_registration_cancelled_email_subject', __ ( 'The format of the email subject which will be sent to the respondent when the respondent cancels the registrations for an event.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Registration cancelled email format', 'eme' ), 'eme_registration_cancelled_email_body', __ ( 'The format of the email which will be sent to the respondent when the respondent cancels the registrations for an event.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Registration denied email subject format', 'eme' ), 'eme_registration_denied_email_subject', __ ( 'The format of the email subject which will be sent to the respondent when the admin denies the registration request if the event requires registration approval.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Registration denied email format', 'eme' ), 'eme_registration_denied_email_body', __ ( 'The format of the email which will be sent to the respondent when the admin denies the registration request if the event requires registration approval.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Registration updated email subject format', 'eme' ), 'eme_registration_updated_email_subject', __ ( 'The format of the email subject which will be sent to the respondent when the admin updates the registration request.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Registration updated email format', 'eme' ), 'eme_registration_updated_email_body', __ ( 'The format of the email which will be sent to the respondent when the admin updates the registration request.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_input_text ( __ ( 'Notification sender name', 'eme' ), 'eme_mail_sender_name', __ ( "Insert the display name of the notification sender.", 'eme' ) );
   eme_options_input_text ( __ ( 'Notification sender address', 'eme' ), 'eme_mail_sender_address', __ ( "Insert the address of the notification sender. It must correspond with your Gmail account user if you use Gmail to send mails.", 'eme' ), "email" );
   eme_options_input_text ( __ ( 'Notification BCC address', 'eme' ), 'eme_mail_bcc_address', __ ( "Insert an address that will be added in Bcc to all outgoing mails. Can be left empty.", 'eme' ), "email" );
   eme_options_select ( __ ( 'Mail sending method', 'eme' ), 'eme_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __ ( 'PHP mail function', 'eme' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail', 'wp_mail' => 'WP Mail' ), __ ( 'Select the method to send email notification.', 'eme' ) );
   eme_options_input_text (__( 'SMTP host','eme'), 'eme_smtp_host', __ ( "The SMTP host. Usually it corresponds to 'localhost'. If you use Gmail, set this value to 'ssl://smtp.gmail.com:465'.", 'eme' ) );
   eme_options_input_text ( __('Mail sending port','eme'), 'eme_smtp_port', __ ( "The port through which you e-mail notifications will be sent. Make sure the firewall doesn't block this port", 'eme' ) );
   eme_options_radio_binary ( __ ( 'Use SMTP authentication?', 'eme' ), 'eme_rsvp_mail_SMTPAuth', __ ( 'SMTP authentication is often needed. If you use Gmail, make sure to set this parameter to Yes', 'eme' ) );
   eme_options_input_text ( __ ( 'SMTP username', 'eme' ), 'eme_smtp_username', __ ( "Insert the username to be used to access your SMTP server.", 'eme' ) );
   eme_options_input_password ( __ ( 'SMTP password', 'eme' ), 'eme_smtp_password', __ ( "Insert the password to be used to access your SMTP server", 'eme' ) );
   eme_options_radio_binary ( __ ( 'Debug SMTP?', 'eme' ), 'eme_smtp_debug', __ ( 'Check this option if you have issues sending mail via SMTP. Only do this for debugging purposes and deactivate it afterwards!', 'eme' ) );
   ?>
   </div>
</table>

<?php
	      break;
	      case 'payments' :
            $events_page_link = eme_get_events_page(true, false);
?>

<h3><?php _e ( 'RSVP: price options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
   eme_options_select ( __ ( 'Default currency', 'eme' ), 'eme_default_currency', eme_currency_array(), __ ( 'Select the default currency for payments.', 'eme' ) );
   eme_options_input_text ( __ ( 'Default price', 'eme' ), 'eme_default_price', __ ( 'The default price for an event.', 'eme' ) );
   eme_options_textarea ( __ ( 'Payment form header format', 'eme' ), 'eme_payment_form_header_format', __ ( 'The format of the text shown above the payment buttons. If left empty, a standard text will be shown.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Payment form footer format', 'eme' ), 'eme_payment_form_footer_format', __ ( 'The format of the text shown below the payment buttons. Default: empty.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=27'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Multibooking payment form header format', 'eme' ), 'eme_multipayment_form_header_format', __ ( 'The format of the text shown above the payment buttons in the multibooking form. If left empty, a standard text will be shown.', 'eme' ).'<br/>'.__('Although the same placeholders as for the regular payment form header format can be used, it is advised to only use multibooking related placeholders.', 'eme') );
   eme_options_textarea ( __ ( 'Multibooking payment form footer format', 'eme' ), 'eme_multipayment_form_footer_format', __ ( 'The format of the text shown below the payment buttons in the multibooking form. Default: empty.', 'eme' ).'<br/>'.__('Although the same placeholders as for the regular payment form header format can be used, it is advised to only use multibooking related placeholders.', 'eme') );
   eme_options_radio_binary ( __ ( 'Show custom payment return page', 'eme' ), 'eme_payment_show_custom_return_page', __ ( 'Check this option if you want to define a custom page format for the sucess or failure of the payment.', 'eme' ) );
   eme_options_textarea ( __ ( 'Payment succes return page format', 'eme' ), 'eme_payment_succes_format', __ ( 'The format of the return page when the payment is succesfull.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=25'>".__('the documentation', 'eme').'</a>' );
   eme_options_textarea ( __ ( 'Payment failure return page format', 'eme' ), 'eme_payment_fail_format', __ ( 'The format of the return page when the payment failed or has been canceled.', 'eme' ) .'<br/>'.__('For all possible placeholders, see ', 'eme')."<a target='_blank' href='http://www.e-dynamics.be/wordpress/?cat=25'>".__('the documentation', 'eme').'</a>' );
   eme_options_radio_binary ( __ ( 'Add booking id to return page info', 'eme' ), 'eme_payment_add_bookingid_to_return', __ ( 'Check this option if you want to add the booking id to the return page. This will allow you to also use booking placeholders next to the regular event placeholders, but beware that other people can change the url and see other booking info then!', 'eme' ) );
   ?>
</table>

<h3><?php _e ( 'RSVP: paypal options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      $notification_link = add_query_arg(array('eme_eventAction'=>'paypal_notification'),$events_page_link);
      eme_options_select ( __('PayPal live or test','eme'), 'eme_paypal_url', array (PAYPAL_SANDBOX_URL => __('Paypal Sandbox (for testing)','eme'), PAYPAL_LIVE_URL => __ ( 'Paypal Live', 'eme' )), __('Choose wether you want to test paypal in a paypal sandbox or go live and really use paypal.','eme') );
      eme_options_input_text (__('PayPal business info','eme'),'eme_paypal_business', __("Paypal business ID or email.",'eme'));
      eme_options_radio_binary ( __ ( 'Use paypal encryption?','eme' ), 'eme_paypal_s_encrypt', __ ( 'Select yes to encrypt the paypal button using certificates.','eme' ) );
      eme_options_radio_binary ( __ ( 'Ignore paypal tax setting?','eme' ), 'eme_paypal_no_tax', __ ( 'Select yes to ignore the tax setting in your paypal profile.','eme' ) );
      eme_options_input_text (__('Paypal public cert','eme'),'eme_paypal_s_paypalcert', __("Path to paypal public certificate file.",'eme'));
      eme_options_input_text (__('Own public cert','eme'),'eme_paypal_s_pubcert', __("Path to own public certificate file.",'eme'));
      eme_options_input_text (__('Own private key','eme'),'eme_paypal_s_privkey', __("Path to own private key file.",'eme'));
      eme_options_input_text (__('Certificate ID','eme'),'eme_paypal_s_certid', __("Certificate ID of your cert at paypal.",'eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_paypal_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_paypal_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_paypal_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_paypal_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_paypal_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_paypal_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      echo "<tr><td colspan='2'>".__('Info: the url for payment notifications is: ','eme').$notification_link.'</td></tr>';
   ?>
</table>

<h3><?php _e ( 'RSVP: 2Checkout options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      $notification_link = add_query_arg(array('eme_eventAction'=>'2co_notification'),$events_page_link);

      eme_options_select ( __('2Checkout live or test','eme'), 'eme_2co_demo', array (2 => __('2Checkout Sandbox (for testing)','eme'), 1 => __('2Checkout Test (the "demo" mode)','eme'), 0 => __ ( '2Checkout Live', 'eme' )), __('Choose wether you want to test 2Checkout in a sandbox or go live and really use 2Checkout.','eme') );
      eme_options_input_text (__('2Checkout Account number','eme'),'eme_2co_business', __("2Checkout Account number.",'eme'));
      eme_options_input_password (__('2Checkout Secret','eme'),'eme_2co_secret', __("2Checkout secret.",'eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_2co_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_2co_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_2co_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_2co_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_2co_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_2co_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      echo "<tr><td colspan='2'>".__('Info: the url for payment notifications is: ','eme').$notification_link.'</td></tr>';
   ?>
</table>

<h3><?php _e ( 'RSVP: Webmoney options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      $notification_link = add_query_arg(array('eme_eventAction'=>'webmoney_notification'),$events_page_link);

      eme_options_select ( __('Webmoney live or test','eme'), 'eme_webmoney_demo', array (1 => __('Webmoney Sandbox (for testing)','eme'), 0 => __ ( 'Webmoney Live', 'eme' )), __('Choose wether you want to test Webmoney in a sandbox or go live and really use Webmoney.','eme') );
      eme_options_input_text (__('Webmoney Purse','eme'),'eme_webmoney_purse', __("Webmoney Purse.",'eme'));
      eme_options_input_password (__('Webmoney Secret','eme'),'eme_webmoney_secret', __("Webmoney secret.",'eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_webmoney_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_webmoney_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_webmoney_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_webmoney_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_webmoney_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_webmoney_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      echo "<tr><td colspan='2'>".__('Info: the url for payment notifications is: ','eme').$notification_link.'</td></tr>';
   ?>
</table>

<h3><?php _e ( 'RSVP: First Data options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      $notification_link = add_query_arg(array('eme_eventAction'=>'fdgg_notification'),$events_page_link);

      eme_options_select ( __('First Data live or test','eme'), 'eme_fdgg_url', array (FDGG_SANDBOX_URL => __('First Data Sandbox (for testing)','eme'), FDGG_LIVE_URL => __ ( 'First Data Live', 'eme' )), __('Choose wether you want to test First Data in a sandbox or go live and really use First Datal.','eme') );
      eme_options_input_text (__('First Data Store Name','eme'),'eme_fdgg_store_name', __("First Data Store Name.",'eme'));
      eme_options_input_password (__('First Data Shared Secret','eme'),'eme_fdgg_shared_secret', __("First Data Shared Secret.",'eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_fdgg_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_fdgg_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_fdgg_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_fdgg_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_fdgg_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_fdgg_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      echo "<tr><td colspan='2'>".__('Info: the url for payment notifications is: ','eme').$notification_link.'</td></tr>';
   ?>
</table>

<h3><?php _e ( 'RSVP: Mollie options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      $notification_link = add_query_arg(array('eme_eventAction'=>'mollie_notification'),$events_page_link);

      eme_options_input_text (__('Mollie API key','eme'),'eme_mollie_api_key', __('Mollie API key','eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_mollie_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_mollie_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_mollie_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_mollie_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_mollie_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_mollie_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      echo "<tr><td colspan='2'>".__('Info: the url for payment notifications is: ','eme').$notification_link.'</td></tr>';
   ?>
</table>

<h3><?php _e ( 'RSVP: Sage Pay options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      eme_options_select ( __('Sage Pay live or test','eme'), 'eme_sagepay_demo', array (1 => __('Sage Pay Sandbox (for testing)','eme'), 0 => __ ( 'Sage Pay Live', 'eme' )), __('Choose wether you want to test Sage Pay in a sandbox or go live and really use Sage Pay.','eme') );
      eme_options_input_text (__('Sage Pay Vendor Name','eme'),'eme_sagepay_vendor_name', __("Sage Pay Vendor Name",'eme'));
      eme_options_input_password (__('Sage Pay Test Password','eme'),'eme_sagepay_test_pwd', __("Sage Pay password for testing purposes",'eme'));
      eme_options_input_password (__('Sage Pay Live Password','eme'),'eme_sagepay_live_pwd', __("Sage Pay password when using Sage Pay for real",'eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_sagepay_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_sagepay_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_sagepay_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_sagepay_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_sagepay_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_sagepay_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      echo "<tr><td colspan='2'>".__('Info: for Sage Pay to work, your PHP installation must have the mcrypt module installed and activated. Search the internet for which extra PHP package to install and/or which line in php.ini to change.','eme').'</td></tr>';
   ?>
</table>

<h3><?php _e ( 'RSVP: Worldpay options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
      eme_options_select ( __('Worldpay live or test','eme'), 'eme_worldpay_demo', array (1 => __('Worldpay Sandbox (for testing)','eme'), 0 => __ ( 'Worldpay Live', 'eme' )), __('Choose wether you want to test Worldpay in a sandbox or go live and really use Worldpay.','eme') );
      eme_options_input_text (__('Worldpay installation ID','eme'),'eme_worldpay_instid', __("Worldpay installation ID",'eme'));
      eme_options_input_text (__('Worldpay MD5 secret','eme'),'eme_worldpay_md5_secret', __("Worldpay MD5 secret used when submitting payments",'eme'));
      eme_options_input_text (__('Worldpay MD5 parameters','eme'),'eme_worldpay_md5_parameters', __("Worldpay parameters used to generate the MD5 signature, separated by ':'. Only use these 4 in the order of your choice: instId,cartId,currency and/or amount",'eme'));
      eme_options_input_password (__('Worldpay Test Password','eme'),'eme_worldpay_test_pwd', __("Worldpay password for payment notifications when testing",'eme'));
      eme_options_input_password (__('Worldpay Live Password','eme'),'eme_worldpay_live_pwd', __("Worldpay password for payment notifications when using Worldpay for real",'eme'));
      eme_options_input_text (__('Extra charge','eme'),'eme_worldpay_cost', __("Extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Extra charge 2','eme'),'eme_worldpay_cost2', __("Second extra charge added when paying for an event. Can either be an absolute number or a percentage. E.g. 2 or 5%",'eme'));
      eme_options_input_text (__('Payment button label','eme'),'eme_worldpay_button_label', __('The text shown inside the payment button','eme'));
      eme_options_input_text (__('Payment button image','eme'),'eme_worldpay_button_img_url', __('The url to an image for the payment button that replaces the standard submit button with the label mentioned above.','eme'));
      eme_options_input_text (__('Text above payment button','eme'),'eme_worldpay_button_above', __('The text shown just above the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
      eme_options_input_text (__('Text below payment button','eme'),'eme_worldpay_button_below', __('The text shown just below the payment button, you can use #_EXTRACHARGE and #_CURRENCY to indicate the extra charge calculated if wanted','eme'));
   ?>
</table>

<?php
	      break;
	      case 'other' :
?>

<h3><?php _e ( 'CSV separator', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
   eme_options_input_text ( __('CSV separator','eme'), 'eme_csv_separator', __('Set the separator used in CSV exports.','eme').sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(EME_DEFAULT_CSV_SEPARATOR)) );
   ?>
</table>

<h3><?php _e ( 'Images size', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
   eme_options_select ( __('Thumbnail size','eme'), 'eme_thumbnail_size', eme_thumbnail_sizes(), __('Choose the default thumbnail size to be shown when using placeholders involving thumbnails like e.g. #_EVENTIMAGETHUMB, #_LOCATIONIMAGETHUMB, ...','eme') );
   ?>
</table>

<h3><?php _e ( 'Map options', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
   eme_options_input_text ( __('Global map zoom factor','eme'), 'eme_global_zoom_factor', __('The zoom factor used for the global map (max: 14).','eme').sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(DEFAULT_GLOBAL_ZOOM_FACTOR)) );
   eme_options_input_text ( __('Individual map zoom factor','eme'), 'eme_indiv_zoom_factor', __('The zoom factor used when showing a single map (max: 14).','eme').sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(DEFAULT_INDIV_ZOOM_FACTOR))  );
   eme_options_select ( __('Global map type','eme'), 'eme_global_maptype', array('ROADMAP' => __('Road map view','eme'),'SATELLITE' => __('Google Earth satellite images','eme'),'HYBRID' => __('Hybrid: a mixture of normal and satellite views','eme'), 'TERRAIN' => __('Terrain: a physical map based on terrain information')), __('The map type used for the global map (max: 14).','eme').sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(DEFAULT_GLOBAL_MAPTYPE)) );
   eme_options_select ( __('Individual map type','eme'), 'eme_indiv_maptype', array('ROADMAP' => __('Road map view','eme'),'SATELLITE' => __('Google Earth satellite images','eme'),'HYBRID' => __('Hybrid: a mixture of normal and satellite views','eme'), 'TERRAIN' => __('Terrain: a physical map based on terrain information')), __('The map type used when showing a single map (max: 14).','eme').sprintf(__(" The default is '%s'",'eme'),eme_sanitize_html(DEFAULT_INDIV_MAPTYPE))  );
   ?>
</table>

<h3><?php _e ( 'Extra html headers', 'eme' ); ?></h3>
<table class="form-table">
   <?php
   eme_options_textarea ( __ ( 'Extra html header', 'eme' ), 'eme_html_header', __ ( 'Here you can define extra html headers, no placeholders can be used, no html will be stripped. Can be used to add custom javascript, ...', 'eme' ) );
   eme_options_textarea ( __ ( 'Extra html footer', 'eme' ), 'eme_html_footer', __ ( 'Here you can define extra html footer, no placeholders can be used, no html will be stripped. Can be used to add custom javascript, ...', 'eme' ) );
   eme_options_textarea ( __ ( 'Extra event html headers', 'eme' ), 'eme_event_html_headers_format', __ ( 'Here you can define extra html headers when viewing a single event, typically used to add meta tags for facebook or SEO. All event placeholders can be used, but will be stripped from resulting html.', 'eme' ) );
   eme_options_textarea ( __ ( 'Extra location html headers', 'eme' ), 'eme_location_html_headers_format', __ ( 'Here you can define extra html headers when viewing a single location, typically used to add meta tags for facebook or SEO. All location placeholders can be used, but will be stripped from resulting html.', 'eme' ) );
   ?>
</table>

<h3><?php _e ( 'Facebook info', 'eme' ); ?></h3>
<table class='form-table'>
   <?php
   eme_options_input_text ( __ ( 'Facebook app id', 'eme' ), 'eme_fb_app_id', __ ( 'Provide facebook app id. This is needed to be able to import info from a facebook event when creating a new event.', 'eme' ) );
   ?>
</table>
<?php
	      break;
         }
?>


<p class="submit"><input type="submit" class="button-primary" id="eme_options_submit" name="Submit" value="<?php _e ( 'Save Changes' )?>" /></p>
</form>
</div>
<?php
   }
}
Example #11
0
function eme_categories_edit_layout($message = "")
{
    $category_id = intval($_GET['category_id']);
    $category = eme_get_category($category_id);
    $layout = "\n   <div class='wrap'>\n      <div id='icon-edit' class='icon32'>\n         <br />\n      </div>\n         \n      <h1>" . __('Edit category', 'eme') . "</h1>";
    if ($message != "") {
        $layout .= "\n      <div id='message' class='updated fade below-h1' style='background-color: rgb(255, 251, 204);'>\n         <p>{$message}</p>\n      </div>";
    }
    $layout .= "\n      <div id='ajax-response'></div>\n\n      <form name='edit_category' id='edit_category' method='post' action='" . admin_url("admin.php?page=eme-categories") . "' class='validate'>\n      <input type='hidden' name='eme_admin_action' value='do_editcategory' />\n      <input type='hidden' name='category_id' value='" . $category['category_id'] . "' />";
    $layout .= "\n         <table class='form-table'>\n            <tr class='form-field form-required'>\n               <th scope='row' valign='top'><label for='category_name'>" . __('Category name', 'eme') . "</label></th>\n               <td><input name='category_name' id='category_name' type='text' value='" . eme_sanitize_html($category['category_name']) . "' size='40' /><br />\n                 " . __('The name of the category', 'eme') . "</td>\n            </tr>\n            <tr class='form-field form-required'>\n               <th scope='row' valign='top'><label for='description'>" . __('Category description', 'eme') . "</label></th>\n               <td><textarea name='description' id='description' rows='5' />" . eme_sanitize_html($category['description']) . "</textarea><br />\n                 " . __('The description of the category', 'eme') . "</td>\n            </tr>\n         </table>\n      <p class='submit'><input type='submit' class='button-primary' name='submit' value='" . __('Update category', 'eme') . "' /></p>\n      </form>\n   </div>\n   ";
    echo $layout;
}
Example #12
0
function eme_attributes_form($eme_array)
{
    $eme_data = array();
    if (isset($eme_array['event_attributes'])) {
        $eme_data = $eme_array['event_attributes'];
    } elseif (isset($eme_array['location_attributes'])) {
        $eme_data = $eme_array['location_attributes'];
    }
    //We also get a list of attribute names and create a ddm list (since placeholders are fixed)
    $formats = get_option('eme_event_list_item_format') . get_option('eme_event_page_title_format') . get_option('eme_full_calendar_event_format') . get_option('eme_location_event_list_item_format') . get_option('eme_ical_title_format') . get_option('eme_ical_description_format') . get_option('eme_rss_description_format') . get_option('eme_rss_title_format') . get_option('eme_single_event_format') . get_option('eme_small_calendar_event_title_format') . get_option('eme_single_location_format') . get_option('eme_contactperson_email_body') . get_option('eme_contactperson_cancelled_email_body') . get_option('eme_contactperson_pending_email_body') . get_option('eme_respondent_email_body') . get_option('eme_registration_pending_email_body') . get_option('eme_registration_denied_email_body') . get_option('eme_registration_cancelled_email_body') . get_option('eme_registration_form_format') . get_option('eme_attendees_list_format') . get_option('eme_payment_form_header_format') . get_option('eme_payment_form_footer_format') . get_option('eme_multipayment_form_header_format') . get_option('eme_multipayment_form_footer_format') . get_option('eme_bookings_list_format');
    #get_option('eme_location_baloon_format' ).
    #get_option('eme_location_page_title_format' ).
    // include all templates as well
    $templates = eme_get_templates();
    foreach ($templates as $template) {
        $formats .= $template['format'];
    }
    //We now have one long string of formats
    preg_match_all("/#(ESC|URL)?_ATT\\{.+?\\}(\\{.+?\\})?/", $formats, $placeholders);
    $attributes = array();
    //Now grab all the unique attributes we can use in our event or location.
    foreach ($placeholders[0] as $result) {
        $result = str_replace("#ESC", "#", $result);
        $result = str_replace("#URL", "#", $result);
        $attribute = substr(substr($result, 0, strpos($result, '}')), 6);
        if (!in_array($attribute, $attributes)) {
            $attributes[] = $attribute;
        }
    }
    ?>
   <div class="wrap">
   <?php 
    if (count($attributes) > 0) {
        ?>
 
      <p><?php 
        _e('Add attributes here', 'eme');
        ?>
</p>
      <table class="form-table">
         <thead>
            <tr valign="top">
               <td><strong><?php 
        _e('Attribute Name', 'eme');
        ?>
</strong></td>
               <td><strong><?php 
        _e('Value', 'eme');
        ?>
</strong></td>
            </tr>
         </thead>    
         <tfoot>
            <tr valign="top">
               <td colspan="3"><a href="#" id="mtm_add_tag"><?php 
        _e('Add new tag', 'eme');
        ?>
</a></td>
            </tr>
         </tfoot>
         <tbody id="mtm_body">
            <?php 
        $count = 1;
        if (is_array($eme_data) and count($eme_data) > 0) {
            foreach ($eme_data as $name => $value) {
                ?>
                  <tr valign="top" id="mtm_<?php 
                echo $count;
                ?>
">
                     <td scope="row">
                        <select name="mtm_<?php 
                echo $count;
                ?>
_ref">
                           <?php 
                if (!in_array($name, $attributes)) {
                    echo "<option value='{$name}'>{$name} (" . __('Not defined in templates', 'eme') . ")</option>";
                }
                foreach ($attributes as $attribute) {
                    if ($attribute == $name) {
                        echo "<option selected='selected'>{$attribute}</option>";
                    } else {
                        echo "<option>{$attribute}</option>";
                    }
                }
                ?>
                        </select>
                        <a href="#" rel="<?php 
                echo $count;
                ?>
"><?php 
                _e('Remove', 'eme');
                ?>
</a>
                     </td>
                     <td>
                        <input type="text" size="40" name="mtm_<?php 
                echo $count;
                ?>
_name" value="<?php 
                echo eme_sanitize_html($value);
                ?>
" />
                     </td>
                  </tr>
                  <?php 
                $count++;
            }
        } else {
            if (count($attributes) > 0) {
                ?>
                  <tr valign="top" id="mtm_<?php 
                echo $count;
                ?>
">
                     <td scope="row">
                        <select name="mtm_<?php 
                echo $count;
                ?>
_ref">
                           <?php 
                foreach ($attributes as $attribute) {
                    echo "<option>{$attribute}</option>";
                }
                ?>
                        </select>
                        <a href="#" rel="<?php 
                echo $count;
                ?>
"><?php 
                _e('Remove', 'eme');
                ?>
</a>
                     </td>
                     <td>
                        <input type="text" size="40" name="mtm_<?php 
                echo $count;
                ?>
_name" value="" />
                     </td>
                  </tr>
                  <?php 
            } else {
                ?>
                  <tr valign="top">
                     <td scope="row" colspan='2'>
                     <?php 
                _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'eme');
                ?>
                     </td>
                  </tr>
                  <?php 
            }
        }
        ?>
         </tbody>
      </table>
   <?php 
    } else {
        ?>
      <p><?php 
        _e('No attributes defined yet. If you want attributes, you first need to define/use some in the Settings page. See the section about custom attributes on the documention site for more info.', 'eme');
        ?>
</p>
   <?php 
    }
    //endif count attributes
    ?>
   </div>
<?php 
}
Example #13
0
function eme_replace_formfields_placeholders($event, $booking = "", $format = "", $eme_multibooking = 0)
{
    global $current_user;
    $event_id = $event['event_id'];
    $registration_wp_users_only = $event['registration_wp_users_only'];
    $is_admin = is_admin();
    if ($is_admin && $booking) {
        $editing_booking_from_backend = 1;
    } else {
        $editing_booking_from_backend = 0;
    }
    // if not in the backend and wp membership is required
    // or when editing an existing booking via backend (not a new)
    if ($registration_wp_users_only && !$is_admin || $editing_booking_from_backend) {
        $readonly = "disabled='disabled'";
    } else {
        $readonly = "";
    }
    if (empty($format)) {
        if (!empty($event['event_registration_form_format'])) {
            $format = $event['event_registration_form_format'];
        } elseif ($event['event_properties']['event_registration_form_format_tpl'] > 0) {
            $format = eme_get_template_format($event['event_properties']['event_registration_form_format_tpl']);
        } else {
            $format = get_option('eme_registration_form_format');
        }
    }
    $min_allowed = $event['event_properties']['min_allowed'];
    $max_allowed = $event['event_properties']['max_allowed'];
    if ($event['event_properties']['take_attendance']) {
        $min_allowed = 0;
        $max_allowed = 1;
    }
    if ($editing_booking_from_backend) {
        // in the admin itf, and editing a booking
        // then the avail seats are the total seats
        if (eme_is_multi($event['event_seats'])) {
            $avail_seats = eme_get_multitotal($event['event_seats']);
        } else {
            $avail_seats = $event['event_seats'];
        }
    } else {
        // the next gives the number of available seats, even for multiprice
        $avail_seats = eme_get_available_seats($event_id);
    }
    $booked_places_options = array();
    if (eme_is_multi($max_allowed)) {
        $multi_max_allowed = eme_convert_multi2array($max_allowed);
        $max_allowed_is_multi = 1;
    } else {
        $max_allowed_is_multi = 0;
    }
    if (eme_is_multi($min_allowed)) {
        $multi_min_allowed = eme_convert_multi2array($min_allowed);
        $min_allowed_is_multi = 1;
    } else {
        $min_allowed_is_multi = 0;
    }
    if (eme_is_multi($event['event_seats'])) {
        // in the admin itf, and editing a booking
        // then the avail seats are the total seats
        if ($editing_booking_from_backend) {
            $multi_avail = eme_convert_multi2array($event['event_seats']);
        } else {
            $multi_avail = eme_get_available_multiseats($event_id);
        }
        foreach ($multi_avail as $key => $avail_seats) {
            $booked_places_options[$key] = array();
            if ($max_allowed_is_multi) {
                $real_max_allowed = $multi_max_allowed[$key];
            } else {
                $real_max_allowed = $max_allowed;
            }
            // don't let people choose more seats than available
            if ($real_max_allowed > $avail_seats || $real_max_allowed == 0) {
                $real_max_allowed = $avail_seats;
            }
            if ($min_allowed_is_multi) {
                $real_min_allowed = $multi_min_allowed[$key];
            } else {
                // it's no use to have a non-multi minimum for multiseats
                $real_min_allowed = 0;
            }
            for ($i = $real_min_allowed; $i <= $real_max_allowed; $i++) {
                $booked_places_options[$key][$i] = $i;
            }
        }
    } elseif (eme_is_multi($event['price'])) {
        // we just need to loop through the same amount of seats as there are prices
        foreach (eme_convert_multi2array($event['price']) as $key => $value) {
            $booked_places_options[$key] = array();
            if ($max_allowed_is_multi) {
                $real_max_allowed = $multi_max_allowed[$key];
            } else {
                $real_max_allowed = $max_allowed;
            }
            // don't let people choose more seats than available
            if ($real_max_allowed > $avail_seats || $real_max_allowed == 0) {
                $real_max_allowed = $avail_seats;
            }
            if ($min_allowed_is_multi) {
                $real_min_allowed = $multi_min_allowed[$key];
            } else {
                // it's no use to have a non-multi minimum for multiseats/multiprice
                $real_min_allowed = 0;
            }
            for ($i = $real_min_allowed; $i <= $real_max_allowed; $i++) {
                $booked_places_options[$key][$i] = $i;
            }
        }
    } else {
        if ($max_allowed_is_multi) {
            $real_max_allowed = $multi_max_allowed[0];
        } else {
            $real_max_allowed = $max_allowed;
        }
        // don't let people choose more seats than available
        if ($real_max_allowed > $avail_seats || $real_max_allowed == 0) {
            $real_max_allowed = $avail_seats;
        }
        if ($min_allowed_is_multi) {
            $real_min_allowed = $multi_min_allowed[0];
        } else {
            $real_min_allowed = $min_allowed;
        }
        for ($i = $real_min_allowed; $i <= $real_max_allowed; $i++) {
            $booked_places_options[$i] = $i;
        }
    }
    $required_fields_count = 0;
    $eme_captcha_for_booking = get_option('eme_captcha_for_booking');
    # we need 4 required fields: #_NAME, #_EMAIL, #_SEATS and #_SUBMIT
    # for multiprice: 3 + number of possible prices (we add those later on)
    if (eme_is_multi($event['price'])) {
        $required_fields_min = 3;
    } else {
        $required_fields_min = 4;
    }
    // if we require the captcha: add 1
    if (!$is_admin && $eme_captcha_for_booking) {
        $required_fields_min++;
    }
    // for multi booking forms, the required field count per booking form is 1 (SEATS)
    if (!$is_admin && $eme_multibooking) {
        $required_fields_min = 1;
    }
    $bookerLastName = "";
    $bookerFirstName = "";
    $bookerAddress1 = "";
    $bookerAddress2 = "";
    $bookerCity = "";
    $bookerState = "";
    $bookerZip = "";
    $bookerCountry = "";
    $bookerEmail = "";
    $bookerComment = "";
    $bookerPhone = "";
    $bookedSeats = 0;
    if (is_user_logged_in()) {
        get_currentuserinfo();
        $bookerLastName = $current_user->user_lastname;
        if (empty($bookerLastName)) {
            $bookerLastName = $current_user->display_name;
        }
        $bookerFirstName = $current_user->user_firstname;
        $bookerEmail = $current_user->user_email;
    }
    if ($editing_booking_from_backend) {
        $person = eme_get_person($booking['person_id']);
        // when editing a booking
        $bookerLastName = eme_sanitize_html($person['lastname']);
        $bookerFirstName = eme_sanitize_html($person['firstname']);
        $bookerAddress1 = eme_sanitize_html($person['address1']);
        $bookerAddress2 = eme_sanitize_html($person['address2']);
        $bookerCity = eme_sanitize_html($person['city']);
        $bookerState = eme_sanitize_html($person['state']);
        $bookerZip = eme_sanitize_html($person['zip']);
        $bookerCountry = eme_sanitize_html($person['country']);
        $bookerEmail = eme_sanitize_html($person['email']);
        $bookerPhone = eme_sanitize_html($person['phone']);
        $bookerComment = eme_sanitize_html($booking['booking_comment']);
        $bookedSeats = eme_sanitize_html($booking['booking_seats']);
        if ($booking['booking_seats_mp']) {
            $booking_seats_mp = eme_convert_multi2array($booking['booking_seats_mp']);
            foreach ($booking_seats_mp as $key => $val) {
                $field_index = $key + 1;
                ${"bookedSeats" . $field_index} = eme_sanitize_html($val);
            }
        }
    } else {
        // check for previously filled in data
        // this in case people entered a wrong captcha
        if (isset($_POST['lastname'])) {
            $bookerLastName = eme_sanitize_html(stripslashes_deep($_POST['lastname']));
        }
        if (isset($_POST['firstname'])) {
            $bookerFirstName = eme_sanitize_html(stripslashes_deep($_POST['firstname']));
        }
        if (isset($_POST['address1'])) {
            $bookerAddress1 = eme_sanitize_html(stripslashes_deep($_POST['address1']));
        }
        if (isset($_POST['address2'])) {
            $bookerAddress2 = eme_sanitize_html(stripslashes_deep($_POST['address2']));
        }
        if (isset($_POST['city'])) {
            $bookerCity = eme_sanitize_html(stripslashes_deep($_POST['city']));
        }
        if (isset($_POST['state'])) {
            $bookerState = eme_sanitize_html(stripslashes_deep($_POST['state']));
        }
        if (isset($_POST['zip'])) {
            $bookerZip = eme_sanitize_html(stripslashes_deep($_POST['zip']));
        }
        if (isset($_POST['country'])) {
            $bookerCountry = eme_sanitize_html(stripslashes_deep($_POST['country']));
        }
        if (isset($_POST['email'])) {
            $bookerEmail = eme_sanitize_html(stripslashes_deep($_POST['email']));
        }
        if (isset($_POST['phone'])) {
            $bookerPhone = eme_sanitize_html(stripslashes_deep($_POST['phone']));
        }
        if (isset($_POST['comment'])) {
            $bookerComment = eme_sanitize_html(stripslashes_deep($_POST['comment']));
        }
    }
    // first we do the custom attributes, since these can contain other placeholders
    preg_match_all("/#(ESC|URL)?_ATT\\{.+?\\}(\\{.+?\\})?/", $format, $results);
    foreach ($results[0] as $resultKey => $result) {
        $need_escape = 0;
        $need_urlencode = 0;
        $orig_result = $result;
        if (strstr($result, '#ESC')) {
            $result = str_replace("#ESC", "#", $result);
            $need_escape = 1;
        } elseif (strstr($result, '#URL')) {
            $result = str_replace("#URL", "#", $result);
            $need_urlencode = 1;
        }
        $replacement = "";
        //Strip string of placeholder and just leave the reference
        $attRef = substr(substr($result, 0, strpos($result, '}')), 6);
        if (isset($event['event_attributes'][$attRef])) {
            $replacement = $event['event_attributes'][$attRef];
        }
        if (trim($replacement) == '' && isset($results[2][$resultKey]) && $results[2][$resultKey] != '') {
            //Check to see if we have a second set of braces;
            $replacement = substr($results[2][$resultKey], 1, strlen(trim($results[2][$resultKey])) - 2);
        }
        if ($need_escape) {
            $replacement = eme_sanitize_request(eme_sanitize_html(preg_replace('/\\n|\\r/', '', $replacement)));
        }
        if ($need_urlencode) {
            $replacement = rawurlencode($replacement);
        }
        $format = str_replace($orig_result, $replacement, $format);
    }
    // the 2 placeholders that can contain extra text are treated seperately first
    // the question mark is used for non greedy (minimal) matching
    if (preg_match('/#_CAPTCHAHTML\\{.+\\}/', $format)) {
        // only show the captcha when booking via the frontend, not the admin backend
        if (!$is_admin && $eme_captcha_for_booking) {
            $format = preg_replace('/#_CAPTCHAHTML\\{(.+?)\\}/', '$1', $format);
        } else {
            $format = preg_replace('/#_CAPTCHAHTML\\{(.+?)\\}/', '', $format);
        }
    }
    if (preg_match('/#_SUBMIT\\{.+\\}/', $format)) {
        if ($editing_booking_from_backend) {
            $format = preg_replace('/#_SUBMIT\\{(.+?)\\}/', "<input name='eme_submit_button' class='eme_submit_button' type='submit' value='" . __('Update booking', 'eme') . "' />", $format);
        } else {
            $format = preg_replace('/#_SUBMIT\\{(.+?)\\}/', "<input name='eme_submit_button' class='eme_submit_button' type='submit' value='" . eme_trans_sanitize_html('$1') . "' />", $format);
        }
        if (!$eme_multibooking) {
            $required_fields_count++;
        }
    }
    $deprecated = get_option('eme_deprecated');
    if ($deprecated && preg_match('/#_CAPTCHAHTML\\[.+\\]/', $format)) {
        // only show the captcha when booking via the frontend, not the admin backend
        if (!$is_admin && $eme_captcha_for_booking) {
            $format = preg_replace('/#_CAPTCHAHTML\\[(.+?)\\]/', '$1', $format);
        } else {
            $format = preg_replace('/#_CAPTCHAHTML\\[(.+?)\\]/', '', $format);
        }
    }
    if ($deprecated && preg_match('/#_SUBMIT\\[.+\\]/', $format)) {
        if ($editing_booking_from_backend) {
            $format = preg_replace('/#_SUBMIT\\[(.+?)\\]/', "<input name='eme_submit_button' class='eme_submit_button' type='submit' value='" . __('Update booking', 'eme') . "' />", $format);
        } else {
            $format = preg_replace('/#_SUBMIT\\[(.+?)\\]/', "<input name='eme_submit_button' class='eme_submit_button' type='submit' value='" . eme_trans_sanitize_html('$1') . "' />", $format);
        }
        if (!$eme_multibooking) {
            $required_fields_count++;
        }
    }
    // now the normal placeholders
    preg_match_all("/#(REQ)?_?[A-Z0-9_]+(\\{[A-Z0-9_]+\\})?/", $format, $placeholders);
    // make sure we set the largest matched placeholders first, otherwise if you found e.g.
    // #_LOCATION, part of #_LOCATIONPAGEURL would get replaced as well ...
    usort($placeholders[0], 'sort_stringlenth');
    # we need 3 required fields: #_NAME, #_EMAIL and #_SEATS
    # if these are not present: we don't replace anything and the form is worthless
    foreach ($placeholders[0] as $result) {
        $orig_result = $result;
        $found = 1;
        $required = 0;
        $required_att = "";
        $html5_wanted = 0;
        $replacement = "";
        if (strstr($result, '#REQ')) {
            $result = str_replace("#REQ", "#", $result);
            $required = 1;
            $required_att = "required='required'";
        }
        // also support RESPNAME, RESPEMAIL, ...
        if (strstr($result, '#_RESP')) {
            $result = str_replace("#_RESP", "#_", $result);
        }
        if ($eme_multibooking) {
            $var_prefix = "bookings[{$event_id}][";
            $var_postfix = "]";
        } else {
            $var_prefix = '';
            $var_postfix = '';
        }
        if (preg_match('/#_NAME|#_LASTNAME/', $result)) {
            if (!$eme_multibooking) {
                $replacement = "<input required='required' type='text' name='{$var_prefix}lastname{$var_postfix}' value='{$bookerLastName}' {$readonly} />";
                $required_fields_count++;
                // #_NAME is always required
                $required = 1;
            }
        } elseif (preg_match('/#_FIRSTNAME/', $result)) {
            if (!empty($bookerFirstName)) {
                $replacement = "<input {$required_att} type='text' name='{$var_prefix}firstname{$var_postfix}' value='{$bookerFirstName}' {$readonly} />";
            } else {
                $replacement = "<input {$required_att} type='text' name='{$var_prefix}firstname{$var_postfix}' value='{$bookerFirstName}' />";
            }
        } elseif (preg_match('/#_ADDRESS1/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}address1{$var_postfix}' value='{$bookerAddress1}' />";
        } elseif (preg_match('/#_ADDRESS2/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}address2{$var_postfix}' value='{$bookerAddress2}' />";
        } elseif (preg_match('/#_CITY/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}city{$var_postfix}' value='{$bookerCity}' />";
        } elseif (preg_match('/#_STATE/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}state{$var_postfix}' value='{$bookerState}' />";
        } elseif (preg_match('/#_ZIP/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}zip{$var_postfix}' value='{$bookerZip}' />";
        } elseif (preg_match('/#_COUNTRY/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}country{$var_postfix}' value='{$bookerCountry}' />";
        } elseif (preg_match('/#_HTML5_EMAIL/', $result)) {
            if (!$eme_multibooking) {
                $replacement = "<input required='required' type='email' name='{$var_prefix}email{$var_postfix}' value='{$bookerEmail}' {$readonly} />";
                $required_fields_count++;
                // #_EMAIL is always required
                $required = 1;
            }
        } elseif (preg_match('/#_EMAIL/', $result)) {
            if (!$eme_multibooking) {
                $replacement = "<input required='required' type='text' name='{$var_prefix}email{$var_postfix}' value='{$bookerEmail}' {$readonly} />";
                $required_fields_count++;
                // #_EMAIL is always required
                $required = 1;
            }
        } elseif (preg_match('/#_HTML5_PHONE/', $result)) {
            $replacement = "<input {$required_att} type='tel' name='{$var_prefix}phone{$var_postfix}' value='{$bookerPhone}' />";
        } elseif (preg_match('/#_PHONE/', $result)) {
            $replacement = "<input {$required_att} type='text' name='{$var_prefix}phone{$var_postfix}' value='{$bookerPhone}' />";
        } elseif (preg_match('/#_SEATS$|#_SPACES$/', $result)) {
            $postfield_name = "{$var_prefix}bookedSeats{$var_postfix}";
            if ($editing_booking_from_backend && isset($bookedSeats)) {
                $entered_val = $bookedSeats;
            } elseif ($eme_multibooking && isset($_POST['bookings'][$event_id]) && isset($_POST['bookings'][$event_id]['bookedSeats'])) {
                $entered_val = intval($_POST['bookings'][$event_id]['bookedSeats']);
            } elseif (isset($_POST['bookedSeats'])) {
                $entered_val = intval($_POST['bookedSeats']);
            } else {
                $entered_val = 0;
            }
            if ($event['event_properties']['take_attendance']) {
                $replacement = eme_ui_select_binary($entered_val, $postfield_name);
            } else {
                $replacement = eme_ui_select($entered_val, $postfield_name, $booked_places_options);
            }
            $required_fields_count++;
        } elseif ($deprecated && preg_match('/#_(SEATS|SPACES)(\\d+)/', $result, $matches) || preg_match('/#_(SEATS|SPACES)\\{(\\d+)\\}/', $result, $matches)) {
            $field_id = intval($matches[2]);
            $postfield_name = "{$var_prefix}bookedSeats" . $field_id . $var_postfix;
            if ($editing_booking_from_backend && isset(${"bookedSeats" . $field_id})) {
                $entered_val = ${"bookedSeats" . $field_id};
            } elseif ($eme_multibooking && isset($_POST['bookings'][$event_id]) && isset($_POST['bookings'][$event_id]['bookedSeats' . $field_id])) {
                $entered_val = intval($_POST['bookings'][$event_id]['bookedSeats' . $field_id]);
            } elseif (isset($_POST['bookedSeats' . $field_id])) {
                $entered_val = intval($_POST['bookedSeats' . $field_id]);
            } else {
                $entered_val = 0;
            }
            if (eme_is_multi($event['event_seats']) || eme_is_multi($event['price'])) {
                if ($event['event_properties']['take_attendance']) {
                    $replacement = eme_ui_select_binary($entered_val, $postfield_name);
                } else {
                    $replacement = eme_ui_select($entered_val, $postfield_name, $booked_places_options[$field_id - 1]);
                }
            } else {
                if ($event['event_properties']['take_attendance']) {
                    $replacement = eme_ui_select_binary($entered_val, $postfield_name);
                } else {
                    $replacement = eme_ui_select($entered_val, $postfield_name, $booked_places_options);
                }
            }
            $required_fields_count++;
        } elseif (preg_match('/#_COMMENT/', $result)) {
            if (!$eme_multibooking) {
                $replacement = "<textarea {$required_att} name='{$var_prefix}comment{$var_postfix}'>{$bookerComment}</textarea>";
            }
        } elseif (preg_match('/#_CAPTCHA/', $result) && $eme_captcha_for_booking) {
            if (!$eme_multibooking) {
                $replacement = "<img src='" . EME_PLUGIN_URL . "captcha.php?sessionvar=eme_add_booking'><br /><input required='required' type='text' name='captcha_check' autocomplete='off' />";
                $required_fields_count++;
            }
        } elseif ($deprecated && preg_match('/#_FIELDNAME(\\d+)/', $result, $matches) || preg_match('/#_FIELDNAME\\{(\\d+)\\}/', $result, $matches)) {
            $field_id = intval($matches[1]);
            $formfield = eme_get_formfield_byid($field_id);
            $replacement = eme_trans_sanitize_html($formfield['field_name']);
        } elseif ($deprecated && preg_match('/#_FIELD(\\d+)/', $result, $matches) || preg_match('/#_FIELD\\{(\\d+)\\}/', $result, $matches)) {
            $field_id = intval($matches[1]);
            $postfield_name = "{$var_prefix}FIELD" . $field_id . $var_postfix;
            $entered_val = "";
            if ($booking) {
                $answers = eme_get_answers($booking['booking_id']);
                $formfield = eme_get_formfield_byid($field_id);
                foreach ($answers as $answer) {
                    if ($answer['field_name'] == $formfield['field_name']) {
                        // the entered value for the function eme_get_formfield_html needs to be an array for multiple values
                        // since we store them with "||", we can use the good old eme_is_multi function and split in an array then
                        $entered_val = $answer['answer'];
                        if (eme_is_multi($entered_val)) {
                            $entered_val = eme_convert_multi2array($entered_val);
                        }
                    }
                }
            } elseif (isset($_POST[$postfield_name])) {
                $entered_val = stripslashes_deep($_POST[$postfield_name]);
            }
            $replacement = eme_get_formfield_html($field_id, $entered_val, $required);
        } elseif (preg_match('/#_SUBMIT/', $result, $matches)) {
            if (!$eme_multibooking) {
                if ($editing_booking_from_backend) {
                    $replacement = "<input name='eme_submit_button' type='submit' value='" . __('Update booking', 'eme') . "' />";
                } else {
                    $replacement = "<input name='eme_submit_button' type='submit' value='" . eme_trans_sanitize_html(get_option('eme_rsvp_addbooking_submit_string')) . "' />";
                }
                $required_fields_count++;
            }
        } else {
            $found = 0;
        }
        if ($required) {
            $replacement .= "<div class='eme-required-field'>&nbsp;" . __('(Required field)', 'eme') . "</div>";
        }
        if ($found) {
            $format = str_replace($orig_result, $replacement, $format);
        }
    }
    // now any leftover event placeholders
    $format = eme_replace_placeholders($format, $event);
    // now, replace any language tags found in the format itself
    $format = eme_translate($format);
    # we need 4 required fields: #_NAME, #_EMAIL, #_SEATS and #_SUBMIT
    # for multiprice: 3 + number of possible prices
    # if these are not present: we don't replace anything and the form is worthless
    if (eme_is_multi($event['price'])) {
        $matches = preg_split('/\\|\\|/', $event['price']);
        $count = count($matches);
        // the count can be >3+$count if conditional tags are used to combine a form for single and multiple prices
        if ($required_fields_count >= $required_fields_min + $count) {
            return $format;
        } else {
            $res = __('Not all required fields are present in the booking form.', 'eme');
            $res .= '<br />' . __("Since this is a multiprice event, make sure you changed the setting 'Registration Form Format' for the event to include #_SEATxx placeholders for each price.", 'eme');
            $res .= '<br />' . __("See the documentation about multiprice events.", 'eme');
            return "<div id='message' class='eme-rsvp-message'>{$res}</div>";
        }
    } elseif ($required_fields_count >= $required_fields_min) {
        // the count can be > 4 if conditional tags are used to combine a form for single and multiple prices
        return $format;
    } else {
        return __('Not all required fields are present in the booking form.', 'eme');
    }
}
Example #14
0
function eme_meta_box_div_event_url($event)
{
    ?>
   <input type="text" id="event_url" name="event_url" value="<?php 
    echo eme_sanitize_html($event['event_url']);
    ?>
" />
   <br />
   <?php 
    _e('If this is filled in, the single event URL will point to this url instead of the standard event page.', 'eme');
}
Example #15
0
function eme_ui_checkbox($option_value, $name, $list, $horizontal = true, $required=0) {
   if ($required)
      $required_att="required='required'";
   else
      $required_att="";

   $val = "";
   foreach($list as $key => $value) {
      if (is_array($option_value)) {
         in_array($key,$option_value) ? $selected = "checked='checked' " : $selected = '';
      } else {
         "$key" == $option_value ? $selected = "checked='checked' " : $selected = '';
      }
      $val.= "<input $required_att type='checkbox' name='${name}[]' value='".eme_sanitize_html($key)."' $selected />".eme_sanitize_html($value);
      if(!$horizontal)  
         $val .= "<br />\n";
   }
   return $val;
}