function olr_shortcode_display($args) { /*============================================== 1. GENERAL VARIABLE ==============================================*/ global $lockout_reservation_length; global $message_array; global $geolocation_api; /*============================================== 2. RETRIEVE OPTION DATA ==============================================*/ $options = get_option('resto_all_setting'); /*============================================== 3. ENQUEQE SCRIPT AND STYLE ==============================================*/ if (!is_admin()) { if (!wp_script_is('jquery-ui-datepicker')) { wp_enqueue_script('jquery-ui-datepicker'); } wp_enqueue_style('olr-date-picker-style', OLR_FOLDER . 'css/jquery.ui.datepicker.css', false, false, false); wp_enqueue_style('olr-front-style', OLR_FOLDER . 'css/restaurant-front-style.css', false, false, false); wp_enqueue_script('olr-script', OLR_FOLDER . 'js/restaurant-script.js', array(), false, true); $any_data_array = array('plugin_folder' => OLR_FOLDER, 'plugin_path' => OLR_PATH, 'early_bookings' => $options['early_bookings'], 'late_bookings' => $options['late_bookings'], 'plugin_options' => get_option('resto_all_setting'), 'ajaxurl' => admin_url('admin-ajax.php'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'fake_actions_title' => $message_array['TOO MANY FAKE ACTIONS']['title'], 'fake_actions_message' => $message_array['TOO MANY FAKE ACTIONS']['message'], 'geolocation_api' => $geolocation_api); wp_localize_script('olr-script', 'data', $any_data_array); } //======== NOT USED , BECAUSE THE SHORTCODE IS FILLED WITH ALL ATTRIBUTE ================ extract(shortcode_atts(array(), $atts)); $out = ''; $out = restaurant_reservation_content($options); return $out; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { /*==================================== ENQUEUES SCRIPTS ====================================*/ if (!wp_script_is('jquery-ui-datepicker')) { wp_enqueue_script('jquery-ui-datepicker'); } wp_enqueue_script('olr-script', OLR_FOLDER . 'js/restaurant-script.js', array(), false, true); $any_data_array = array('plugin_folder' => OLR_FOLDER, 'plugin_path' => OLR_PATH, 'early_bookings' => $options['early_bookings'], 'late_bookings' => $options['late_bookings'], 'plugin_options' => get_option('resto_all_setting'), 'ajaxurl' => admin_url('admin-ajax.php'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'fake_actions_title' => $message_array['TOO MANY FAKE ACTIONS']['title'], 'fake_actions_message' => $message_array['TOO MANY FAKE ACTIONS']['message'], 'geolocation_api' => $geolocation_api); wp_localize_script('olr-script', 'data', $any_data_array); /*==================================== DISPLAY WIDGET ====================================*/ $options = get_option('resto_all_setting'); $title = apply_filters('widget_title', $instance['title']); echo $args['before_widget']; $out = ''; $out = restaurant_reservation_content($options); echo $out; echo $args['after_widget']; }