/** * Adds the fields to the booking form. * * @access public * @since 1.0.0 * @return void */ public function wprm_get_bookigs_fields() { // Let's get all the fields $booking_fields = $this->wprm_bookigs_fields(); $fields = null; // Cycle through each field and show proper field type foreach ($booking_fields as $field) { switch ($field['type']) { case 'text': $fields .= WPRM()->html->text(array('name' => $field['name'], 'label' => $field['label'], 'value' => $field['value'], 'desc' => $field['desc'], 'placeholder' => isset($field['placeholder']) ? $field['placeholder'] : null)); break; case 'email': $fields .= WPRM()->html->email(array('name' => $field['name'], 'label' => $field['label'], 'value' => $field['value'], 'desc' => $field['desc'], 'placeholder' => isset($field['placeholder']) ? $field['placeholder'] : null)); break; case 'checkbox': $fields .= WPRM()->html->checkbox(array('name' => $field['name'], 'label' => $field['label'])); break; case 'select': $fields .= WPRM()->html->select(array('name' => $field['name'], 'label' => $field['label'], 'desc' => $field['desc'], 'options' => $field['options'], 'show_option_all' => null, 'show_option_none' => null)); break; case 'textarea': $fields .= WPRM()->html->textarea(array('name' => $field['name'], 'label' => $field['label'], 'value' => $field['value'], 'desc' => $field['desc'])); break; case 'html': $fields .= WPRM()->html->html(array('value' => $field['value'])); break; } } // Output fields. return $fields; }
load_textdomain('wprm', $mofile_global); } elseif (file_exists($mofile_local)) { // Look in local /wp-content/plugins/wp-restaurant-manager/languages/ folder load_textdomain('wprm', $mofile_local); } else { // Load the default language files load_plugin_textdomain('wprm', false, $wprm_lang_dir); } } } } // End if class_exists check /** * The main function responsible for returning the one true WP_Restaurant_Manager * Instance to functions everywhere. * * Use this function like you would a global variable, except without needing * to declare the global. * * Example: <?php $wprm = WPRM(); ?> * * @since 1.0.0 * @return object The one true WP_Restaurant_Manager Instance */ function WPRM() { return WP_Restaurant_Manager::instance(); } // Get WPRM Running WPRM();
/** * Search content for email tags and filter email tags through their hooks * * @param string $content Content to search for email tags * @param int $booking_id The booking id * * @since 1.0.0 * * @return string Content with email tags filtered out. */ function wprm_do_email_tags($content, $booking_id) { // Replace all tags $content = WPRM()->email_tags->do_tags($content, $booking_id); // Maintaining backwards compatibility $content = apply_filters('wprm_email_template_tags', $content, $booking_id); // Return content return $content; }
/** * Dates Callback * * Renders dates table * * @since 1.0.0 * @param array $args Arguments passed by the setting * @global $wprm_options Array of all the WPRM Options * @return void */ function wprm_dates_to_exclude_callback($args) { global $wprm_options; $dates = wprm_get_dates_to_exclude(); ob_start(); ?> <p><?php echo $args['desc']; ?> </p> <table id="wprm_dates_to_exclude" class="wp-list-table widefat fixed posts"> <thead> <tr> <th scope="col" class="wprm_date_to_exclude"><?php _e('Date To Exclude', 'wprm'); ?> </th> <th scope="col"><?php _e('Remove', 'wprm'); ?> </th> </tr> </thead> <?php if (!empty($dates)) { ?> <?php foreach ($dates as $key => $date) { ?> <tr> <td class="wprm_date_to_exclude"> <?php echo WPRM()->html->text(array('name' => 'date_to_exclude[' . $key . '][date]', 'value' => $date['date'])); ?> </td> <td><span class="wprm_remove_date_to_exclude button-secondary"><?php _e('Remove Date', 'wprm'); ?> </span></td> </tr> <?php } ?> <?php } else { ?> <tr> <td class="wprm_date_to_exclude"> <?php echo WPRM()->html->text(array('name' => 'date_to_exclude[0][date]')); ?> </td> <td><span class="wprm_remove_date_to_exclude button-secondary"><?php _e('Remove Date', 'wprm'); ?> </span></td> </tr> <?php } ?> </table> <p> <span class="button-secondary" id="wprm_add_date_to_exclude"><?php _e('Add New Date', 'wprm'); ?> </span> </p> <?php echo ob_get_clean(); }