Created
August 2, 2022 08:10
-
-
Save Lindstromer/765dd3bee9bd3c1ffe47f9b596d01a95 to your computer and use it in GitHub Desktop.
Bokameraintegration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| Plugin Name: Bokamera integration - SH | |
| Plugin URI: http://olaflindstrom.se | |
| Description: Integrate bokamera with shortcode. | |
| Author: Olaf L | |
| Version: 1.0.0 | |
| */ | |
| class BokaMeraIntegration { | |
| public function __construct() | |
| { | |
| add_action( 'wp_head', [ $this, 'virserum_services' ] ); | |
| add_action( 'wp_head', [ $this, 'aseda_services' ] ); | |
| add_action( 'wp_head', [ $this, 'flaten_services' ] ); | |
| add_action( 'wp_head', [ $this, 'hultsfred_services' ] ); | |
| add_action( 'wp_footer', [ $this, 'add_script_to_end_body' ] ); | |
| add_shortcode( 'bokamera', [ $this, 'shortcode' ] ); | |
| } | |
| public function add_script_to_end_body() { | |
| echo '<script src="https://embed.bookmore.com/v2/embed.js"></script>'; | |
| } | |
| public function virserum_services() { | |
| if (! is_page('4131')) { | |
| return; | |
| } | |
| echo '<script type="text/javascript"> | |
| window.BOKAMERA = { | |
| "configuration": { | |
| "bookMethods": [ | |
| "contact-information", | |
| "login", | |
| "login-facebook" | |
| ], | |
| "bookLayout": "service-based", | |
| "timesLayout": "week", | |
| "listingLayout": "rows", | |
| "language": "sv", | |
| "company": "180f696c-fb6c-4c9b-8442-c6a50bd049d2", | |
| "serviceIdsToShow": [ | |
| "79598", | |
| "79602" | |
| ], | |
| "showNextAvailableTime": false, | |
| "hideServiceImage": false, | |
| "showEndTimeOnTimeslots": false, | |
| "darkTheme": false, | |
| "translations": [] | |
| } | |
| } | |
| </script>'; | |
| } | |
| public function aseda_services() { | |
| if (! is_page('4164')) { | |
| return; | |
| } | |
| echo '<script type="text/javascript"> | |
| window.BOKAMERA = { | |
| "configuration": { | |
| "bookMethods": [ | |
| "contact-information", | |
| "login", | |
| "login-facebook" | |
| ], | |
| "bookLayout": "service-based", | |
| "timesLayout": "week", | |
| "listingLayout": "rows", | |
| "language": "sv", | |
| "company": "180f696c-fb6c-4c9b-8442-c6a50bd049d2", | |
| "serviceIdsToShow": [ | |
| "79599", | |
| "79600" | |
| ], | |
| "showNextAvailableTime": false, | |
| "hideServiceImage": false, | |
| "showEndTimeOnTimeslots": false, | |
| "darkTheme": false, | |
| "translations": [] | |
| } | |
| } | |
| </script>'; | |
| } | |
| public function flaten_services() { | |
| if (! is_page('4548')) { | |
| return; | |
| } | |
| echo '<script type="text/javascript"> | |
| window.BOKAMERA = { | |
| "configuration": { | |
| "bookMethods": [ | |
| "contact-information", | |
| "login", | |
| "login-facebook" | |
| ], | |
| "bookLayout": "service-based", | |
| "timesLayout": "week", | |
| "listingLayout": "rows", | |
| "language": "sv", | |
| "company": "b1d039b7-a168-4faa-9b49-e8d04855cc09", | |
| "serviceIdsToShow": [ | |
| "80322", | |
| "88251" | |
| ], | |
| "showNextAvailableTime": false, | |
| "hideServiceImage": false, | |
| "showEndTimeOnTimeslots": false, | |
| "darkTheme": false, | |
| "translations": [] | |
| } | |
| } | |
| </script>'; | |
| } | |
| public function hultsfred_services() { | |
| if (! is_page('4511')) { | |
| return; | |
| } | |
| echo '<script type="text/javascript"> | |
| window.BOKAMERA = { | |
| "configuration": { | |
| "bookMethods": [ | |
| "contact-information", | |
| "login", | |
| "login-facebook" | |
| ], | |
| "bookLayout": "service-based", | |
| "timesLayout": "week", | |
| "listingLayout": "rows", | |
| "language": "sv", | |
| "company": "b1d039b7-a168-4faa-9b49-e8d04855cc09", | |
| "serviceIdsToShow": [ | |
| "71155", | |
| "71156", | |
| "88247" | |
| ], | |
| "showNextAvailableTime": false, | |
| "hideServiceImage": false, | |
| "showEndTimeOnTimeslots": false, | |
| "darkTheme": false, | |
| "translations": [] | |
| } | |
| } | |
| </script>'; | |
| } | |
| public static function shortcode( $atts ) { | |
| return ' | |
| <div id="rotatedevice"> | |
| <p>Rotera telefonen! För att kunna använda vår bokning på små skärmar behöver du hålla telefonen i landskapsläge.</p> | |
| </div> | |
| <div id="bokamera-embedded"></div>'; | |
| } | |
| } | |
| $bokaMera = new BokaMeraIntegration(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment