Changeset 2905877
- Timestamp:
- 04/28/2023 08:57:30 PM (3 years ago)
- Location:
- feature-add-ons-for-booked/trunk
- Files:
-
- 4 edited
-
features-for-booked.php (modified) (3 diffs)
-
includes/class-faofb-export.php (modified) (5 diffs)
-
includes/class-faofb.php (modified) (8 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
feature-add-ons-for-booked/trunk/features-for-booked.php
r2713421 r2905877 3 3 * Feature Add-Ons For Booked 4 4 * 5 * @author Moses Migwi,Alvin Muthui5 * @author Alvin Muthui 6 6 * @license GPL-2.0-or-later 7 7 * @package FeatureAddOnsForBooked … … 11 11 * Plugin URI: https://www.example.com/ 12 12 * Description: Adds better export options, and an appointments list view to the BoxyStudio Booked Appointments plugin 13 * Version: 1.0. 014 * Author: Moses Migwi,Alvin Muthui13 * Version: 1.0.1 14 * Author: Alvin Muthui 15 15 * Requires at least: 5.3 16 * Requires PHP: 7. 016 * Requires PHP: 7.2 17 17 * Author URI: https://profiles.wordpress.org/alvinmuthui/ 18 18 * License: GPL v2 or later … … 37 37 $faofb_plugin_root_director = plugin_dir_path( __FILE__ ); 38 38 39 39 40 require 'includes/class-faofb.php'; -
feature-add-ons-for-booked/trunk/includes/class-faofb-export.php
r2713421 r2905877 160 160 * Builds args for meta query to query appointments using from and to date. 161 161 * 162 * @since 1.0.0 163 * @since 1.0.1 introduced $calendar_id argument. 164 * 162 165 * @param date $from_date the start date. 163 166 * @param date $to_date end date. 164 167 * @param string $appointment_type the appointment type. 165 * 166 * @return FAOFB_Export used for chaining. 167 */ 168 public function by_date( $from_date, $to_date, string $appointment_type ): FAOFB_Export { 168 * @param string $calendar_id to pass calendar filter value. 169 * 170 * @return FAOFB_Export used for chaining. 171 */ 172 public function by_date( $from_date, $to_date, string $appointment_type, string $calendar_id ): FAOFB_Export { 173 $tax_query = array(); 174 if ( 'all' !== $calendar_id ) { 175 $tax_query = array( 176 array( 177 'taxonomy' => 'booked_custom_calendars', 178 'field' => 'term_id', 179 'terms' => (int) $calendar_id, 180 ), 181 ); 182 } 183 169 184 $meta_query = array( 170 185 array( … … 182 197 'orderby' => 'meta_value_num', 183 198 'order' => 'ASC', 199 'tax_query' => $tax_query, 184 200 'meta_query' => $meta_query, 185 201 ); // phpcs:enable … … 221 237 ); 222 238 223 $ timestamp= gmdate( $date_format, $appointment_timestamp['0'] );239 $appointment_date = gmdate( $date_format, $appointment_timestamp['0'] ); 224 240 225 241 $time_slot = explode( '-', $appointment_timeslot['0'] ); … … 283 299 $appointments_array[ $post->ID ]['guest_email'] = $guest_email; 284 300 endif; 285 $appointments_array[ $post->ID ]['appointment_date'] = $ timestamp;301 $appointments_array[ $post->ID ]['appointment_date'] = $appointment_date; 286 302 $appointments_array[ $post->ID ]['start_time'] = $time_start; 287 303 $appointments_array[ $post->ID ]['end_time'] = $time_end; 288 $appointments_array[ $post->ID ]['appointment_combined_date_time'] = $ date_start. ' from ' . $time_start . ' to ' . $time_end;304 $appointments_array[ $post->ID ]['appointment_combined_date_time'] = $appointment_date . ' from ' . $time_start . ' to ' . $time_end; 289 305 $appointments_array[ $post->ID ]['post_status'] = $appointment_status; 290 306 … … 345 361 346 362 // Export filtered appointments to excel. 347 if ( isset( $_POST['from_date'] ) && isset( $_POST['to_date'] ) ) :348 363 if ( isset( $_POST['from_date'] ) && isset( $_POST['to_date'] ) && isset( $_POST['calendar_id'] ) ) : 364 $calendar_id = sanitize_text_field( wp_unslash( $_POST['calendar_id'] ) ); 349 365 $from_date = sanitize_text_field( wp_unslash( $_POST['from_date'] ) ); 350 366 $to_date = sanitize_text_field( wp_unslash( $_POST['to_date'] ) ); 351 367 $appointment_type = '';// Initialize the variable. 368 352 369 if ( isset( $_POST['appointment_type'] ) ) { 353 370 $appointment_type = sanitize_text_field( wp_unslash( $_POST['appointment_type'] ) ); 354 371 } 355 372 356 $faofb_export->by_date( $from_date, $to_date, $appointment_type )->add_rows_to_cvs();373 $faofb_export->by_date( $from_date, $to_date, $appointment_type, $calendar_id )->add_rows_to_cvs(); 357 374 die;// Goal achieved. 358 375 -
feature-add-ons-for-booked/trunk/includes/class-faofb.php
r2713421 r2905877 3 3 * Feature Add-Ons For Booked 4 4 * 5 * @author Moses Migwi,Alvin Muthui5 * @author Alvin Muthui 6 6 * @license GPL-2.0-or-later 7 7 * @package FeatureAddOnsForBooked … … 24 24 */ 25 25 class FAOFB { 26 // global settings. 27 28 /** 29 * Location for the includes folder 30 * 31 * @var string 32 */ 33 protected $faofb_includes_dir; 26 34 /** 27 35 * Constructor to initialize necessary global variables … … 30 38 // Initialize global variables. 31 39 global $faofb_version; // Plugin version. 32 $faofb_version = '1.0.0'; 33 40 $faofb_version = '1.1.0'; 34 41 } 35 42 … … 40 47 */ 41 48 public function init() { 49 $this->init_setting(); 42 50 add_action( 'admin_enqueue_scripts', array( $this, 'add_plugin_scripts' ) ); 43 51 $this->add_plugin_required_files(); … … 45 53 // Export all appointments. 46 54 add_action( 'admin_init', array( $this, 'export_file' ) ); 55 } 56 57 /** 58 * Function to initialize necessary plugin variables. 59 * 60 * @return void 61 */ 62 protected function init_setting() { 63 global $faofb_plugin_root_director; 64 $this->faofb_includes_dir = $faofb_plugin_root_director . 'includes/';// todo: Add filter over here. 47 65 } 48 66 … … 58 76 wp_enqueue_script( 'jquery-ui-datepicker' );// Load jquery-ui-datepicker script preloaded in WordPress. 59 77 wp_enqueue_style( 'jquery-style', plugin_dir_url( __FILE__ ) . '../assets/css/jquery-ui.css', array(), '1.8.2', false );// src: https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css . 60 wp_enqueue_style( 'faofb-style', plugin_dir_url( __FILE__ ) . '../assets/admin/css/faofb-style.min.css', array(), '1. 0.0', false );78 wp_enqueue_style( 'faofb-style', plugin_dir_url( __FILE__ ) . '../assets/admin/css/faofb-style.min.css', array(), '1.1.0', false );// Todo: automatically add the version. 61 79 62 80 } … … 136 154 137 155 } 156 157 /** 158 * Retrieves faofb_includes_dir value. 159 * 160 * @return faofb_includes_dir 161 */ 162 public function get_faofb_includes_dir() { 163 return $this->faofb_includes_dir; 164 } 138 165 } 139 166 … … 156 183 157 184 faofb();// Start the plugin logic. 158 -
feature-add-ons-for-booked/trunk/readme.txt
r2737110 r2905877 1 1 === Feature Add-Ons For Booked === 2 Contributors: alvinmuthui , Moses Migwi3 Donate link: https:// profiles.wordpress.org/alvinmuthui/2 Contributors: alvinmuthui 3 Donate link: https://www.buymeacoffee.com/alvinmuthui 4 4 Tags: Booked Appointments, Boxy Studio, Extension Add ons 5 5 Requires at least: 5.0 6 Tested up to: 6. 07 Stable tag: 1.0. 06 Tested up to: 6.2 7 Stable tag: 1.0.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 52 52 53 53 = 1.0.0 = 54 Begining of Feature Add-Ons For Booked. 54 Beginning of Feature Add-Ons For Booked. 55 56 = 1.0.1 57 * Fixed: In WordPress Admin-> Appointments-> Export, you can filter posts by calendar. 58 * Fixed: Notice undefined variable: date_start
Note: See TracChangeset
for help on using the changeset viewer.