### Install dependencies and build assets with npm run start Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Installs dependencies and builds assets. Runs composer install, npm install, and grunt dist. May take a while as dependencies are downloaded and namespaces are prefixed using Strauss. ```bash npm run start ``` -------------------------------- ### Install WordPress test suite with install-wp-tests.sh Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Prepares the WordPress testing suite by loading WordPress core and configuring the database connection. The database port may vary; use the appropriate credentials and port printed by npm run env:start. ```bash bash bin/install-wp-tests.sh wordpress root password 127.0.0.1:49153 latest ``` -------------------------------- ### Start wp-env environment with npm run env:start Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Starts the WordPress environment using wp-env. Requires Docker and optionally WSL2 on Windows. The provided .wp-env.json should be sufficient for normal development. ```bash npm run env:start ``` -------------------------------- ### Start WordPress environment for E2E tests Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Starts the WordPress environment for E2E tests with Cypress. ```bash npm run env:test:start ``` -------------------------------- ### Install Cypress test data Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Installs the test data needed for the Cypress E2E tests. ```bash npm run cypress:setup ``` -------------------------------- ### GET /wp-json/commonsbooking/v1/projects Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/en/documentation/api/commonsbooking-api.md Fetches basic data about the WordPress instance. ```APIDOC ## GET /wp-json/commonsbooking/v1/projects ### Description Returns the basic data of the WordPress instance. ### Method GET ### Endpoint `/wp-json/commonsbooking/v1/projects` ### Parameters #### Query Parameters - **apikey** (string) - Optional - API key if required by the API share settings. ### Response #### Success Response (200) Returns basic data of the WordPress instance. The response schema is defined at https://github.com/wielebenwir/commons-api/blob/master/commons-api.projects.schema.json ``` -------------------------------- ### CB Search Shortcode Usage Examples Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/en/documentation/administration/new-frontend.md Shortcode usage examples for the new frontend. The first shows the basic call with the map ID, the second adds the layouts parameter to display a filter and availability calendar, and the third adds the filter-expanded option to show the filter without collapse or dialog. ```text [cb_search id="4" ...] ``` ```text [cb_search id="4" layouts="Filter,AvailabilityCalendar"] ``` ```text [cb_search id="4" layouts="Filter,List" filter-expanded] ``` -------------------------------- ### Run benchmark with phpbench Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Runs the benchmark tests and generates an aggregate report. ```bash php tests/benchmark/phpbench.php run tests/benchmark --report=aggregate ``` -------------------------------- ### Build plugin zip with bin/build-zip.sh Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Creates the plugin zip file for uploading to a development server. ```bash bin/build-zip.sh ``` -------------------------------- ### Change default repetition start with commonsbooking_defaults_repetition-start Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/de/documentation/advanced-functionality/change-timeframe-creation-defaults.md Sets the default repetition start date. The filter 'commonsbooking_defaults_repetition-start' expects a string in mm/dd/yyyy format (e.g., '05/27/2023'). ```php function change_defaults_repetition_start( $repetition ) { //$repetition = "05/27/2023"; //format mm/dd/yyyy return $repetition; } add_filter( 'commonsbooking_defaults_repetition-start', 'change_defaults_repetition_start' ); ``` -------------------------------- ### Change default start time with commonsbooking_defaults_start-time Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/de/documentation/advanced-functionality/change-timeframe-creation-defaults.md Sets the default start time for a timeframe. The filter 'commonsbooking_defaults_start-time' expects a string in 24h format (e.g., '05:00'). ```php function change_defaults_start_time( $start_time ) { //$start_time = "05:00"; //24h format return $start_time; } add_filter( 'commonsbooking_defaults_start-time', 'change_defaults_start_time' ); ``` -------------------------------- ### Change default booking start day offset with commonsbooking_defaults_booking-startday-offset Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/de/documentation/advanced-functionality/change-timeframe-creation-defaults.md Sets the default booking start day offset (lead time). The filter 'commonsbooking_defaults_booking-startday-offset' expects a number. ```php function change_defaults_booking_startday_offset( $offset ) { $offset = 0; //just a number return $offset; } add_filter( 'commonsbooking_defaults_booking-startday-offset', 'change_defaults_booking_startday_offset' ); ``` -------------------------------- ### Action Hook Beispiel: commonsbooking_before_item-single Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/de/documentation/advanced-functionality/hooks-and-filters.md Zeigt, wie man eine Callback-Funktion mit add_action an den Hook 'commonsbooking_before_item-single' bindet. Der Code wird vor dem item-single Template angezeigt. ```php function itemsingle_callback() { // wird vor dem item-single template angezeigt } add_action( 'commonsbooking_before_item-single', 'itemsingle_callback' ); ``` -------------------------------- ### GET /wp-json/commonsbooking/v1/locations Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/en/documentation/api/commonsbooking-api.md Retrieves a list of all locations including their geo-coordinates. ```APIDOC ## GET /wp-json/commonsbooking/v1/locations ### Description Returns a list of all locations including geo-coordinates. ### Method GET ### Endpoint `/wp-json/commonsbooking/v1/locations` ### Parameters #### Query Parameters - **apikey** (string) - Optional - API key if required by the API share settings. ### Response #### Success Response (200) Returns a list of locations with geo-coordinates. The response schema is defined at https://github.com/wielebenwir/commons-api/blob/master/commons-api.locations.schema.json ``` -------------------------------- ### Activate kasimir theme via WP CLI Source: https://github.com/wielebenwir/commonsbooking/blob/master/Readme.md Activates the kasimir theme via WP CLI inside the wp-env Docker container for testing. ```bash npm run env run cli wp theme activate kasimir-theme ``` -------------------------------- ### GET /wp-json/commonsbooking/v1/availability Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/en/documentation/api/commonsbooking-api.md Retrieves availability information for items at locations. ```APIDOC ## GET /wp-json/commonsbooking/v1/availability ### Description Shows the availability of items at locations. ### Method GET ### Endpoint `/wp-json/commonsbooking/v1/availability` ### Parameters #### Query Parameters - **apikey** (string) - Optional - API key if required by the API share settings. ### Response #### Success Response (200) Returns availability data for items at locations. The response schema is defined at https://github.com/wielebenwir/commons-api/blob/master/commons-api.availability.schema.json ``` -------------------------------- ### cb_bookings Source: https://github.com/wielebenwir/commonsbooking/blob/master/docs/de/documentation/administration/shortcodes.md Shortcode zur Anzeige einer Liste aller Buchungen des eingeloggten Nutzers. Administratoren sehen alle Buchungen, cb_manager sehen eigene und zugeordnete Buchungen. ```APIDOC ## [cb_bookings] ### Description Liste aller Buchungen, also eigene Buchungen des eingeloggten Nutzenden. Administratoren sehen alle Buchungen, cb_manager sehen eigene Buchungen und Buchungen der zugeordneten Artikel und Stationen. ### Shortcode `[cb_bookings]` ### Parameters Keine Parameter dokumentiert. ```