/** * Widget HTML * * If you want to have an all inclusive single widget file, you can do so by * dumping your css styles with base_encoded images along with all of your * html string, right into this method. * * @param array $widget * @param array $params * @param array $sidebar */ function html($widget = array(), $params = array(), $sidebar = array()) { $js_dir = WPRM_PLUGIN_URL . 'assets/js/'; $css_dir = WPRM_PLUGIN_URL . 'assets/css/'; wp_enqueue_script('wprm-picker-js'); //Determine if we have to load a translation if (wprm_get_option('calendar_language')) { $the_language = wprm_get_option('calendar_language'); wp_enqueue_script('wprm-picker-js-language', $js_dir . '/picker/translations/' . $the_language . '.js', array('jquery'), WPRM_VERSION, true); } //Add Main Script to the end wp_enqueue_script('wprm-front-scripts'); //Add Main Css File wp_enqueue_style('wprm-front-css'); if (wprm_get_option('booking_style') == 'default') { wp_enqueue_style('wprm-picker-default-css'); } elseif (wprm_get_option('booking_style') == 'classic') { wp_enqueue_style('wprm-picker-classic-css'); } echo do_shortcode('[wprm_booking_form submit_label="' . $params['label'] . '"]'); }
/** * Full menu Shortcode * * @access public * @since 1.0.0 * @return $output shortcode output */ public function wprm_menu_full($atts, $content = null) { extract(shortcode_atts(array('category_title' => '', 'category_description' => '', 'hyperlink' => '', 'description' => '', 'price' => '', 'display_images' => ''), $atts)); ob_start(); $menu_categories = get_terms('menu_category', 'hide_empty=0'); foreach ($menu_categories as $menu_category) { $args = apply_filters('wprm_full_menu_args', array('post_type' => 'wprm_menu', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'menu_category', 'field' => 'slug', 'terms' => array($menu_category->slug))))); $menu_items = new WP_Query($args); if ($menu_items->have_posts()) { do_action('wprm_fullmenu_before'); ?> <?php if ($category_title == 'true') { ?> <h3 class="wprm_category_title"><?php echo $menu_category->name; ?> </h3> <?php } ?> <?php if ($category_description == 'true') { ?> <p class="wprm_category_description"><?php echo apply_filters('wprm_fullmenu_category_description', $menu_category->description, $menu_category->slug); ?> </p> <?php } ?> <?php while ($menu_items->have_posts()) { $menu_items->the_post(); ?> <?php get_wprm_template('shortcode-single-menu-item.php', array('hyperlink' => $hyperlink, 'description' => $description, 'price' => $price, 'display_images' => $display_images)); ?> <?php } do_action('wprm_fullmenu_after'); ?> <?php } wp_reset_postdata(); } return '<div class="wprm_shortcode wprm_category_menu wprm_full_menu wprm_single_menu_item ' . wprm_get_option('menu_style') . '">' . ob_get_clean() . '</div>'; }
/** * Uninstall WPRM * * @package wprm * @copyright Copyright (c) 2014, Alessandro Tesoro * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 1.0.0 */ // Exit if accessed directly if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } // Load plugin file include_once 'wp-restaurant-manager.php'; global $wpdb, $wprm_options, $wp_roles; if (wprm_get_option('uninstall_on_delete')) { /** Delete All the Custom Post Types */ $wprm_taxonomies = array('menu_tag', 'menu_category'); $wprm_post_types = array('wprm_menu', 'wprm_reservations'); foreach ($wprm_post_types as $post_type) { $wprm_taxonomies = array_merge($wprm_taxonomies, get_object_taxonomies($post_type)); $items = get_posts(array('post_type' => $post_type, 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids')); if ($items) { foreach ($items as $item) { wp_delete_post($item, true); } } } /** Delete All the Terms & Taxonomies */ foreach (array_unique(array_filter($wprm_taxonomies)) as $taxonomy) { $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM {$wpdb->terms} AS t INNER JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
/** * Displays the errors inside the shortcode. * * @access private * @since 1.0.0 * @return void * @param $errors WP_Error Class object */ private function wprm_booking_form_display_errors($errors) { // Validates the submission and show messages if needed // grabs the error messages and cycle through each error if (is_wp_error($this->booking_form_errors) && !empty($this->booking_form_errors->errors)) { // Let's get the errors $error_mesages = $this->booking_form_errors->get_error_messages(); $error_messages_class = apply_filters('wprm_booking_form_single_error_message_class', 'wprm-single-error-message'); // Let's cycle through the errors echo '<div class="wprm-booking-form-errors-wrapper" id="wprm-booking-form-errors-wrapper">'; foreach ($error_mesages as $message) { echo '<div class="' . $error_messages_class . '">'; echo '<strong>' . $message . '</strong>'; echo '</div>'; } echo '</div>'; } if (isset($_GET['submitted']) && $_GET['submitted'] == true) { $success_message = wprm_get_option('success_message'); $success_messages_class = apply_filters('wprm_booking_form_success_message_class', 'wprm-success'); // Let's cycle through the errors echo '<div class="' . $success_messages_class . '" id="wprm-booking-form-success-wrapper">'; echo $success_message; echo '</div>'; } }
/** * Sends an email notification to the user upon booking rejection. * * @since 1.0.0 * @return void * @param $booking_id */ public function wprm_send_email_to_user_rejection($booking_id) { if (wprm_get_option('mail_user_booking_rejected')) { wprm_send_user_notification_rejection($booking_id); } }
/** * Send the user a notification upon booking rejection. * * @since 1.0.0 * @return void */ function wprm_send_user_notification_rejection($booking_id = 0) { $email = wprm_get_booking_email($booking_id); $subject = wprm_do_email_tags(wprm_get_option('user_booking_rejected_email_subject'), $booking_id); $from_name = isset($wprm_options['mail_from_name']) ? $wprm_options['mail_from_name'] : get_bloginfo('name'); $from_name = apply_filters('wprm_booking_from_name', $from_name, $booking_id); $from_email = isset($wprm_options['mail_from_address']) ? $wprm_options['mail_from_address'] : get_option('admin_email'); $from_email = apply_filters('wprm_booking_from_address', $from_email, $booking_id); $message = wpautop(wprm_get_option('user_booking_rejected_email')); $message = wprm_do_email_tags($message, $booking_id); $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n"; $headers .= "Reply-To: " . $from_email . "\r\n"; $headers .= "Content-Type: text/html; charset=utf-8\r\n"; $headers = apply_filters('wprm_user_booking_notification_rejected_headers', $headers, $booking_id); wp_mail($email, $subject, $message, $headers); }
<span class="wprm-chilly-level wprm-chilly-level-<?php echo get_post_meta(get_the_id(), '_wprm_spicy_level', true); ?> "><?php _e('Hot', 'wprm'); ?> </span> <?php } ?> </div> <div class="wprm-clearfix"></div> <?php if (!wprm_get_option('disable_details')) { ?> <?php if (get_post_meta(get_the_id(), '_wprm_calories', true) || get_post_meta(get_the_id(), '_wprm_cholesterol', true) || get_post_meta(get_the_id(), '_wprm_fiber', true) || get_post_meta(get_the_id(), '_wprm_sodium', true) || get_post_meta(get_the_id(), '_wprm_carbohydrates', true) || get_post_meta(get_the_id(), '_wprm_fat', true) || get_post_meta(get_the_id(), '_wprm_protein', true)) { ?> <h4><?php _e('Nutritional Information', 'wprm'); ?> </h4> <table class="nutritional_attributes"> <tbody> <?php if (get_post_meta(get_the_id(), '_wprm_calories', true)) { ?>
/** * Load Frontend Scripts and styles * * Enqueues the required frontend scripts and styles. * * @since 1.0 * @return void */ function wprm_load_frontend_scripts() { $js_dir = WPRM_PLUGIN_URL . 'assets/js/'; $css_dir = WPRM_PLUGIN_URL . 'assets/css/'; $booking_page = wprm_get_option('booking_page'); // Use minified libraries if SCRIPT_DEBUG is turned off //$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; $suffix = ''; // Register Styles and scripts wp_enqueue_script('jquery'); wp_register_script('wprm-front-scripts', apply_filters('wprm_front_scripts_url', $js_dir . 'wprm-front-scripts' . $suffix . '.js'), array('jquery'), WPRM_VERSION, true); wp_register_script('wprm-picker-js', $js_dir . 'picker/picker.js', array('jquery'), WPRM_VERSION, true); wp_register_style('wprm-front-css', apply_filters('wprm_front_css_url', $css_dir . 'wprm-front-css' . $suffix . '.css'), WPRM_VERSION); wp_register_style('wprm-picker-classic-css', apply_filters('wprm_picker_url', $css_dir . 'wprm-picker-classic.css'), WPRM_VERSION); wp_register_style('wprm-picker-default-css', apply_filters('wprm_picker_url', $css_dir . 'wprm-picker-default.css'), WPRM_VERSION); // Add booking scripts only on booking pages // Just to prevent waste of resources if (is_page($booking_page)) { wp_enqueue_script('wprm-picker-js'); //Determine if we have to load a translation if (wprm_get_option('calendar_language')) { $the_language = wprm_get_option('calendar_language'); wp_enqueue_script('wprm-picker-js-language', $js_dir . '/picker/translations/' . $the_language . '.js', array('jquery'), WPRM_VERSION, true); } } //Add Main Script to the end wp_enqueue_script('wprm-front-scripts'); //Add Main Css File wp_enqueue_style('wprm-front-css'); if (is_page($booking_page) && wprm_get_option('booking_style') == 'default') { wp_enqueue_style('wprm-picker-default-css'); } elseif (is_page($booking_page) && wprm_get_option('booking_style') == 'classic') { wp_enqueue_style('wprm-picker-classic-css'); } //Handler for picker script customization //through backend settings $wprm_frontend_js_settings = array('date_format' => wprm_get_option('date_format'), 'time_format' => wprm_get_option('time_format'), 'time_interval' => wprm_get_option('time_interval'), 'opening_time' => wprm_get_option('opening_time'), 'closing_time' => wprm_get_option('closing_time'), 'disabled_dates' => get_option('wprm_dates_to_exclude')); wp_localize_script('wprm-front-scripts', 'wprm_frontend_js_settings', $wprm_frontend_js_settings); }
<?php /** * Template: Shortcode single menu item * * @since 1.0.0 * @version 1.0.0 */ $thumb_width = wprm_get_option('thumbnail_width'); $thumb_height = wprm_get_option('thumbnail_height'); ?> <ul> <li id="wprm-menu-item-<?php echo get_the_id(); ?> "> <?php do_action('wprm_single_menu_item_part_before'); ?> <div class="inner"> <?php if (has_post_thumbnail() && $display_images == 'true') { $post_thumbnail_id = get_post_thumbnail_id(); $post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id); $thumb = wprm_thumb($post_thumbnail_url, $thumb_width, $thumb_height); // Crops from bottom right echo '<img class="wp-post-image" src="' . $thumb . '">'; } ?> <div class="content"> <div class="head">