Plugin Directory

Changeset 2905877


Ignore:
Timestamp:
04/28/2023 08:57:30 PM (3 years ago)
Author:
alvinmuthui
Message:

version 1.0.1

Location:
feature-add-ons-for-booked/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • feature-add-ons-for-booked/trunk/features-for-booked.php

    r2713421 r2905877  
    33 * Feature Add-Ons For Booked
    44 *
    5  * @author            Moses Migwi, Alvin Muthui
     5 * @author            Alvin Muthui
    66 * @license           GPL-2.0-or-later
    77 * @package           FeatureAddOnsForBooked
     
    1111 * Plugin URI: https://www.example.com/
    1212 * Description: Adds better export options, and an appointments list view to the BoxyStudio Booked Appointments plugin
    13  * Version: 1.0.0
    14  * Author: Moses Migwi, Alvin Muthui
     13 * Version: 1.0.1
     14 * Author: Alvin Muthui
    1515 * Requires at least: 5.3
    16  * Requires PHP:      7.0
     16 * Requires PHP:      7.2
    1717 * Author URI:        https://profiles.wordpress.org/alvinmuthui/
    1818 * License:           GPL v2 or later
     
    3737$faofb_plugin_root_director = plugin_dir_path( __FILE__ );
    3838
     39
    3940require 'includes/class-faofb.php';
  • feature-add-ons-for-booked/trunk/includes/class-faofb-export.php

    r2713421 r2905877  
    160160         * Builds args for meta query to query appointments using from and to date.
    161161         *
     162         * @since 1.0.0
     163         * @since 1.0.1 introduced $calendar_id argument.
     164         *
    162165         * @param date   $from_date the start date.
    163166         * @param date   $to_date end date.
    164167         * @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
    169184            $meta_query = array(
    170185                array(
     
    182197                'orderby'        => 'meta_value_num',
    183198                'order'          => 'ASC',
     199                'tax_query' => $tax_query,
    184200                'meta_query'     => $meta_query,
    185201            ); // phpcs:enable
     
    221237                        );
    222238
    223                         $timestamp = gmdate( $date_format, $appointment_timestamp['0'] );
     239                        $appointment_date = gmdate( $date_format, $appointment_timestamp['0'] );
    224240
    225241                        $time_slot  = explode( '-', $appointment_timeslot['0'] );
     
    283299                            $appointments_array[ $post->ID ]['guest_email'] = $guest_email;
    284300                        endif;
    285                         $appointments_array[ $post->ID ]['appointment_date']               = $timestamp;
     301                        $appointments_array[ $post->ID ]['appointment_date']               = $appointment_date;
    286302                        $appointments_array[ $post->ID ]['start_time']                     = $time_start;
    287303                        $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;
    289305                        $appointments_array[ $post->ID ]['post_status']                    = $appointment_status;
    290306
     
    345361
    346362// Export filtered appointments to excel.
    347 if ( isset( $_POST['from_date'] ) && isset( $_POST['to_date'] ) ) :
    348 
     363if ( isset( $_POST['from_date'] ) && isset( $_POST['to_date'] ) && isset( $_POST['calendar_id'] ) ) :
     364    $calendar_id      = sanitize_text_field( wp_unslash( $_POST['calendar_id'] ) );
    349365    $from_date        = sanitize_text_field( wp_unslash( $_POST['from_date'] ) );
    350366    $to_date          = sanitize_text_field( wp_unslash( $_POST['to_date'] ) );
    351367    $appointment_type = '';// Initialize the variable.
     368
    352369    if ( isset( $_POST['appointment_type'] ) ) {
    353370            $appointment_type = sanitize_text_field( wp_unslash( $_POST['appointment_type'] ) );
    354371    }
    355372
    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();
    357374    die;// Goal achieved.
    358375
  • feature-add-ons-for-booked/trunk/includes/class-faofb.php

    r2713421 r2905877  
    33 * Feature Add-Ons For Booked
    44 *
    5  * @author            Moses Migwi, Alvin Muthui
     5 * @author            Alvin Muthui
    66 * @license           GPL-2.0-or-later
    77 * @package           FeatureAddOnsForBooked
     
    2424     */
    2525    class FAOFB {
     26        // global settings.
     27
     28        /**
     29         * Location for the includes folder
     30         *
     31         * @var string
     32         */
     33        protected $faofb_includes_dir;
    2634        /**
    2735         * Constructor to initialize necessary global variables
     
    3038            // Initialize global variables.
    3139            global $faofb_version; // Plugin version.
    32             $faofb_version = '1.0.0';
    33 
     40            $faofb_version = '1.1.0';
    3441        }
    3542
     
    4047         */
    4148        public function init() {
     49            $this->init_setting();
    4250            add_action( 'admin_enqueue_scripts', array( $this, 'add_plugin_scripts' ) );
    4351            $this->add_plugin_required_files();
     
    4553            // Export all appointments.
    4654            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.
    4765        }
    4866
     
    5876            wp_enqueue_script( 'jquery-ui-datepicker' );// Load jquery-ui-datepicker script preloaded in WordPress.
    5977            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.
    6179
    6280        }
     
    136154
    137155        }
     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        }
    138165    }
    139166
     
    156183
    157184faofb();// Start the plugin logic.
    158 
  • feature-add-ons-for-booked/trunk/readme.txt

    r2737110 r2905877  
    11=== Feature Add-Ons For Booked  ===
    2 Contributors: alvinmuthui, Moses Migwi
    3 Donate link: https://profiles.wordpress.org/alvinmuthui/
     2Contributors: alvinmuthui
     3Donate link: https://www.buymeacoffee.com/alvinmuthui
    44Tags: Booked Appointments, Boxy Studio, Extension Add ons
    55Requires at least: 5.0
    6 Tested up to: 6.0
    7 Stable tag: 1.0.0
     6Tested up to: 6.2
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5252
    5353= 1.0.0 =
    54 Begining of Feature Add-Ons For Booked.
     54Beginning 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.