Changeset 2842501
- Timestamp:
- 01/02/2023 08:19:41 PM (3 years ago)
- Location:
- airport-transfers
- Files:
-
- 18 added
- 8 deleted
- 19 edited
- 1 copied
-
assets/banner-1544x500.jpg (deleted)
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.jpg (deleted)
-
assets/banner-772x250.png (added)
-
assets/icon.svg (modified) (1 prop)
-
assets/screenshot-1.jpg (modified) (1 prop) (previous)
-
assets/screenshot-2.jpg (modified) (1 prop) (previous)
-
tags/master (copied) (copied from airport-transfers/trunk)
-
tags/master/.gitattributes (added)
-
tags/master/README.md (modified) (2 diffs)
-
tags/master/admin/class-airport-transfers-admin.php (modified) (1 diff)
-
tags/master/admin/views/settings-page.php (modified) (3 diffs)
-
tags/master/airport-transfers.php (modified) (1 diff)
-
tags/master/assets/js (added)
-
tags/master/assets/js/index.js (added)
-
tags/master/composer.json (added)
-
tags/master/functions.php (added)
-
tags/master/languages/ns-airport-transfers-bg_BG.mo (added)
-
tags/master/languages/ns-airport-transfers-bg_BG.po (added)
-
tags/master/languages/ns-airport-transfers-en_GB.mo (deleted)
-
tags/master/languages/ns-airport-transfers-en_GB.po (deleted)
-
tags/master/languages/ns-airport-transfers.pot (modified) (1 diff)
-
tags/master/public/class-airport-transfers.php (modified) (1 diff)
-
tags/master/public/views/form.php (modified) (15 diffs)
-
tags/master/public/views/modal-error.php (modified) (2 diffs)
-
tags/master/readme.txt (added)
-
tags/master/texts.php (deleted)
-
trunk/.gitattributes (added)
-
trunk/README.md (modified) (2 diffs)
-
trunk/admin/class-airport-transfers-admin.php (modified) (1 diff)
-
trunk/admin/views/settings-page.php (modified) (3 diffs)
-
trunk/airport-transfers.php (modified) (1 diff)
-
trunk/assets/js (added)
-
trunk/assets/js/index.js (added)
-
trunk/composer.json (added)
-
trunk/functions.php (added)
-
trunk/languages/ns-airport-transfers-bg_BG.mo (added)
-
trunk/languages/ns-airport-transfers-bg_BG.po (added)
-
trunk/languages/ns-airport-transfers-en_GB.mo (deleted)
-
trunk/languages/ns-airport-transfers-en_GB.po (deleted)
-
trunk/languages/ns-airport-transfers.pot (modified) (1 diff)
-
trunk/public/class-airport-transfers.php (modified) (1 diff)
-
trunk/public/views/form.php (modified) (15 diffs)
-
trunk/public/views/modal-error.php (modified) (2 diffs)
-
trunk/readme.txt (added)
-
trunk/texts.php (deleted)
Legend:
- Unmodified
- Added
- Removed
-
airport-transfers/assets/icon.svg
-
Property
svn:mime-type
set to
image/svg+xml
-
Property
svn:mime-type
set to
-
airport-transfers/assets/screenshot-1.jpg
-
Property
svn:mime-type
changed from
image/pngtoimage/jpeg
-
Property
svn:mime-type
changed from
-
airport-transfers/assets/screenshot-2.jpg
-
Property
svn:mime-type
changed from
image/pngtoimage/jpeg
-
Property
svn:mime-type
changed from
-
airport-transfers/tags/master/README.md
r1959832 r2842501 1 === Airport Transfers === 2 Contributors: atanasantonov 3 Receive orders for transfer with this simple plugin. Easy to install and configure for your needs. Unlimited airports. Polylang compatible and fully translatable! 4 Tags: transfer, airport, arrival, departure 5 Requires at least: 3.0.1 6 Tested up to: 5.0 7 Requires PHP: 5.6 8 Stable tag: trunk 9 License: GPLv2 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 1 # Airport Transfers 2 12 3 Special airport transfers form that delivers mail to an administrator with customer's data. 13 14 == Description ==15 16 Receive orders for transfer with this simple plugin. Easy to install and configure for your needs. Form is designed to serve as transfer order tool.17 4 18 The plugin has full localisation and internationalisation support. Polylang compatible! 19 5 Form is designed to serve as transfer order tool. Design is airport transfers ready. 6 7 The plugin has full l10n and i18n support. 8 20 9 There are several options like mails for the delivery and default settings. 21 22 == Installation == 10 11 = Features = 12 * Simple & Intuitive 13 * Flexible transfer reservation form 14 * Multiple emails can be used for notifications 15 16 ## Installation 23 17 24 18 Download and activate the plugin. The plugin works with shortcode: … … 33 27 34 28 After the settings are done and the shortcode is placed on the desired pages you are ready to operate. 35 36 == Frequently Asked Questions ==37 29 38 = Can I customize where the emails will be delivered? = 39 30 ## Screenshots 31 32  33 34  35 36 ## Frequently Asked Questions 37 38 ### Can I customize where the emails will be delivered? 39 40 40 Yes, you can add as many emails for delivery as you want. The only rule is that they must be comma separated. 41 41 42 = Can I place a custom contact information? = 43 42 ### Can I place a custom contact information? 43 44 44 Yes, you can place your phone/phones and email. 45 45 46 = Can I customize the destination country? = 47 46 ### Can I customize the destination country? 47 48 48 Yes, you can set any country you want. It can be a default one and as option in every page where the shorcode is placed. 49 49 50 = Can I switch between 12 and 24 hour format? = 51 50 ### Can I switch between 12 and 24 hour format? 51 52 52 Yes, you can choose default the format in the settings page and also as option in every page where the shorcode is placed.. 53 54 = Is there a limitation of airports number? = 55 53 54 ### Is there a limitation of airports number? 55 56 56 No, you can add as many airports in the dropdown as you wish. 57 58 = What about the number of request? = 59 57 58 ### What about the number of request? 59 60 60 There is no limitation. You can recieve as many orders as they are submitted. 61 61 62 = Is there a mandatory fields verification? = 63 62 ### Is there a mandatory fields verification? 63 64 64 Yes, the most important fields are validated twice - both on client's machine and on the server. Especially the email address. 65 65 66 = How can the customer understand that is missing something? = 67 66 ### How can the customer understand that is missing something? 67 68 68 There is a nice gentle modal window that is opened when mandatory field is empty. 69 69 70 == Screenshots == 71 72 1. This screen shows the settings page. 70 ## Changelog 73 71 74 2. This is the second screens shows the form in the page on frontend. 72 ### 1.1 73 * Security fixes. 75 74 76 == Donations == 77 78 If you like the plugin and it helps you to offer better services at your clients you can buy me a fruit! 79 80 (BTC) 1ATAnAsK2wwDGK6UKrUewJDWtZ6kgJXEYu 81 (LTC) LdoQwdNn2FQAap8QBYDP8H4TetGmhhx3vj 82 (ZEC) t1VXcnmXZPaEfXtkshmhBtWEHy1CHqETh1V 83 84 == Changelog == 85 86 = 1.0 = 75 ### 1.0 87 76 * First release. 88 77 * No changes. 89 90 == Upgrade Notice ==91 92 = 1.0 =93 94 No upgrades needed at this time. -
airport-transfers/tags/master/admin/class-airport-transfers-admin.php
r1725009 r2842501 4 4 5 5 class NS_Airport_Transfers_Admin { 6 7 private static $initiated = FALSE;8 private static $class = 'NS_Airport_Transfers_Admin';9 public static $prefix = 'ns_admin_';10 public static $textdomain = 'ns-airport-transfers';11 public static $settings = 'ns-airport-transfers-group';12 6 13 public static function init() { 14 if(!self::$initiated) { 15 self::ns_admin_init_hooks(); 16 } 17 } 7 private static $initiated = FALSE; 8 public static $settings = 'ns-airport-transfers-group'; 18 9 19 /** 20 * Initializes WordPress hooks 21 */ 22 private static function ns_admin_init_hooks() { 23 add_action( 'admin_init', array( self::$class, self::$prefix.'init' ) ); 24 add_action( 'admin_init', array( self::$class, self::$prefix.'texts' ) ); 25 add_action( 'admin_menu', array( self::$class, self::$prefix.'menu' ) ); 26 add_action( 'admin_init', array( self::$class, self::$prefix.'register_settings' ) ); 27 28 self::$initiated = TRUE; 29 } 10 /** 11 * Init. 12 */ 13 public static function init() { 14 if( ! self::$initiated ) { 15 self::init_hooks(); 16 } 17 } 30 18 31 public static function ns_admin_init() {32 19 33 } 34 35 public static function ns_admin_menu() { 36 add_menu_page('Airport Transfers', 'Airport Transfers', 'edit_posts', self::$textdomain.'-settings', array( self::$class, self::$prefix.'settings_page' ),'dashicons-admin-generic'); 37 } 38 39 public static function ns_admin_register_settings() { 40 register_setting( self::$settings, 'ns-airport-transfers-admin-email' ); 41 register_setting( self::$settings, 'ns-airport-transfers-contact-email' ); 42 register_setting( self::$settings, 'ns-airport-transfers-contact-phone' ); 43 register_setting( self::$settings, 'ns-airport-transfers-country' ); 44 register_setting( self::$settings, 'ns-airport-transfers-resort' ); 45 register_setting( self::$settings, 'ns-airport-transfers-time-format' ); 46 } 47 48 public static function ns_admin_settings_page() { 49 require_once( plugin_dir_path(__FILE__) . 'views/settings-page.php' ); 50 } 20 /** 21 * Register hooks. 22 */ 23 private static function init_hooks() { 24 add_action( 'admin_init', array( '\NS_Airport_Transfers_Admin', 'init' ) ); 25 add_action( 'admin_menu', array( '\NS_Airport_Transfers_Admin', 'admin_menu' ) ); 26 add_action( 'admin_init', array( '\NS_Airport_Transfers_Admin', 'register_settings' ) ); 51 27 52 public static function ns_admin_texts() { 28 self::$initiated = TRUE; 29 } 53 30 54 // prepare the texts55 global $texts;56 31 57 foreach ($texts as $text) 58 { 59 __($text,self::$textdomain); 60 if(function_exists('pll_register_string')) 61 { 62 pll_register_string(__('Form elements',self::$textdomain), $text, 'Airport Transfers'); 63 } 64 } 65 } 66 67 // ajax form handler 68 public static function ns_admin_send() { 69 try { 70 // check post at all 71 if(empty($_POST)) { 72 throw new Exception(airport_transfers_lang('Incorrect data!')); 73 } 74 75 $post = $_POST; 32 /** 33 * Admin menu. 34 */ 35 public static function admin_menu() { 36 add_submenu_page( 37 'options-general.php', 38 'Airport Transfers', 39 'Airport Transfers', 40 'edit_posts', 41 'ns-airport-transfers-settings', 42 array( '\NS_Airport_Transfers_Admin', 'settings_page' ), 43 100 44 ); 45 } 76 46 77 78 $lang = sanitize_text_field($post['lang']);79 80 // check email81 $email = filter_var(sanitize_email($post['email']), FILTER_VALIDATE_EMAIL);82 if (!$email) {83 throw new Exception(airport_transfers_lang('Invalid email address!'));84 }85 86 // Subject87 $subject = airport_transfers_lang('Request');88 47 89 // Message 90 $message = ''; 91 92 // information 93 $message .= airport_transfers_lang('Your Name', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['name'])).PHP_EOL; 94 $message .= airport_transfers_lang('Email Address', $lang).": ".$email.PHP_EOL; 95 $message .= airport_transfers_lang('Mobile', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['phone'])).PHP_EOL; 96 $message .= airport_transfers_lang('I would like to', $lang).": ".sanitize_text_field($post['like_to']).PHP_EOL; 97 $message .= airport_transfers_lang('Transfer type', $lang).": ".airport_transfers_lang(sanitize_text_field($post['transfer_type']), $lang).PHP_EOL; 98 $message .= airport_transfers_lang('No. of adults', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['adults'])).PHP_EOL; 99 $message .= airport_transfers_lang('No. of children', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['children'])).PHP_EOL; 100 $message .= airport_transfers_lang('No. of koffers', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['koffers'])).PHP_EOL; 101 if(sanitize_text_field($post['resort'])==='winter') { 102 $message .= airport_transfers_lang('No. of ski/snowboards', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['ski'])).PHP_EOL; 103 } 104 105 $message .= PHP_EOL; 106 107 // transfer_type 108 $transfer_type = sanitize_text_field($post['transfer_type']); 109 110 // time format 111 $time_format = sanitize_text_field($post['time_format']); 112 113 // arrival 114 $post_arrival_us_time = sanitize_text_field($post['arrival_us_time']); 115 $arrival_us_time = ($time_format==='12'&&$post_arrival_us_time!=='') ? $post_arrival_us_time : ''; 116 if($transfer_type==='two_way' || $transfer_type==='from_airport') { 117 $message .= airport_transfers_lang('Date of arrival', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['arrival_date'])).PHP_EOL; 118 $message .= airport_transfers_lang('Time of arrival', $lang).": ".sanitize_text_field($post['arrival_hour']).':'.sanitize_text_field($post['arrival_minutes']).$arrival_us_time.PHP_EOL; 119 $message .= airport_transfers_lang('Airport', $lang).": ".sanitize_text_field($post['arrival_airport']).PHP_EOL; 120 $message .= airport_transfers_lang('Flight number', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['arrival_flight'])).PHP_EOL; 121 $message .= PHP_EOL; 122 } 123 124 // departure 125 $post_out_us_time = sanitize_text_field($post['out_us_time']); 126 $out_us_time = ($time_format==='12'&&$post_out_us_time!=='') ? $post_out_us_time : ''; 127 if($transfer_type==='two_way' || $transfer_type==='to_airport') { 128 $message .= airport_transfers_lang('Date of departure', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['out_date'])).PHP_EOL; 129 $message .= airport_transfers_lang('Time of departure', $lang).": ".sanitize_text_field($post['out_hour']).':'.sanitize_text_field($post['out_minutes']).$out_us_time.PHP_EOL; 130 $message .= airport_transfers_lang('Airport', $lang).": ".sanitize_text_field($post['out_airport']).PHP_EOL; 131 $message .= airport_transfers_lang('Flight number', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['out_flight'])).PHP_EOL; 132 $message .= PHP_EOL; 133 } 134 135 // address in destination country 136 $message .= airport_transfers_lang('Address in', $lang).' '.airport_transfers_lang(get_option('ns-airport-transfers-country'), $lang).PHP_EOL; 137 $message .= airport_transfers_lang('Address of hotel/accommodation', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['adress'])).PHP_EOL; 138 139 // instructions 140 $message .= airport_transfers_lang('Remarks/instructions', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['instructions'])).PHP_EOL; 141 142 // Headers 143 $headers = 'MIME-Version: 1.0' . PHP_EOL; 144 $headers .= 'Content-type: text/plain; charset=utf-8' . PHP_EOL; 145 $headers .= 'Content-Transfer-Encoding: 7bit' . PHP_EOL; 146 $headers .= 'Message-ID: <' . time() . '-'. md5($email).'>' . PHP_EOL; 147 $headers .= 'From: '.get_option('blogname').' <'.get_option('admin_email').'>' . PHP_EOL; 148 $headers .= 'Return-Path: <'.get_option('admin_email').'>' . PHP_EOL; 149 150 // get administrative emails for the form 151 if(!mail(get_option('ns-airport-transfers-admin-email'), $subject, $message, $headers)) { 152 $error_message = 'Sending mail failed!'.PHP_EOL.PHP_EOL; 153 $error_message = 'Form message:'.PHP_EOL.PHP_EOL; 154 $error_message .= print_r($message,TRUE).PHP_EOL; 155 mail(get_option('admin_email'), 'Airport Transfers Plugin', $error_message, $headers); 156 throw new Exception(airport_transfers_lang('System Error!', $lang)); 157 } 158 159 $result['status'] = 'success'; 160 $result['data'] = airport_transfers_lang('Thank you for your submission! We will answer as soon as possible!', $lang); 161 162 } catch (Exception $e) { 163 $result['status'] = 'error'; 164 $result['data'] = $e->getMessage(); 165 } finally { 166 echo json_encode($result); 167 } 168 wp_die(); 169 } 48 /** 49 * Register settings. 50 */ 51 public static function register_settings() { 52 register_setting( self::$settings, 'ns-airport-transfers-admin-email' ); 53 register_setting( self::$settings, 'ns-airport-transfers-contact-email' ); 54 register_setting( self::$settings, 'ns-airport-transfers-contact-phone' ); 55 register_setting( self::$settings, 'ns-airport-transfers-country' ); 56 register_setting( self::$settings, 'ns-airport-transfers-resort' ); 57 register_setting( self::$settings, 'ns-airport-transfers-time-format' ); 58 } 59 60 61 /** 62 * Settings page. 63 */ 64 public static function settings_page() { 65 require_once( NS_AIRPORT_TRANSFERS_PATH . 'admin/views/settings-page.php' ); 66 } 170 67 } 171 68 -
airport-transfers/tags/master/admin/views/settings-page.php
r1725009 r2842501 3 3 <div class="wrap"> 4 4 <h1>Airport Transfers</h1> 5 <p class="description"><span class="dashicons dashicons-admin-settings"></span> <?php e cho __('Styling and functionality settings',self::$textdomain); ?>.</p>5 <p class="description"><span class="dashicons dashicons-admin-settings"></span> <?php esc_html_e('Styling and functionality settings','ns-airport-transfers'); ?>.</p> 6 6 7 7 <form method="post" action="options.php"> 8 8 <?php settings_fields( self::$settings ); ?> 9 9 <?php do_settings_sections( self::$settings ); ?> 10 11 <table class="form-table"> 12 10 11 <table class="form-table"> 12 13 13 <tr> 14 <th scope="row"><?php e cho __('Admin email/emails',self::$textdomain); ?></th>14 <th scope="row"><?php esc_html_e('Admin email/emails','ns-airport-transfers'); ?></th> 15 15 <td> 16 16 <input type="text" name="ns-airport-transfers-admin-email" value="<?php echo esc_attr( get_option('ns-airport-transfers-admin-email') ); ?>" class="large-text" /> 17 <p class="description"><?php e cho __('Email/emails for delivery. Comma separated if more than one (admin1@example.com, admin2@example.com, ...)',self::$textdomain); ?></p>17 <p class="description"><?php esc_html_e('Email/emails for delivery. Comma separated if more than one (admin1@example.com, admin2@example.com, ...)','ns-airport-transfers'); ?></p> 18 18 <br><hr></td> 19 19 </tr> 20 20 21 21 <tr> 22 <th scope="row"><?php e cho __('Contact email',self::$textdomain); ?></th>22 <th scope="row"><?php esc_html_e('Contact email','ns-airport-transfers'); ?></th> 23 23 <td> 24 24 <input type="text" name="ns-airport-transfers-contact-email" value="<?php echo esc_attr( get_option('ns-airport-transfers-contact-email') ); ?>" class="large-text" /> 25 <p class="description"><?php e cho __('Contact email.',self::$textdomain); ?></p>25 <p class="description"><?php esc_html_e('Contact email.','ns-airport-transfers'); ?></p> 26 26 <br><hr></td> 27 27 </tr> 28 28 29 29 <tr> 30 <th scope="row"><?php e cho __('Contact phone/phones',self::$textdomain); ?></th>30 <th scope="row"><?php esc_html_e('Contact phone/phones','ns-airport-transfers'); ?></th> 31 31 <td> 32 32 <input type="text" name="ns-airport-transfers-contact-phone" value="<?php echo esc_attr( get_option('ns-airport-transfers-contact-phone') ); ?>" class="large-text" /> 33 <p class="description"><?php e cho __('Contact phone/phones.',self::$textdomain); ?></p>33 <p class="description"><?php esc_html_e('Contact phone/phones.','ns-airport-transfers'); ?></p> 34 34 <br><hr></td> 35 35 </tr> 36 36 37 37 <tr> 38 <th scope="row"><?php e cho __('Default destination country',self::$textdomain); ?></th>38 <th scope="row"><?php esc_html_e('Default destination country','ns-airport-transfers'); ?></th> 39 39 <td> 40 40 <input type="text" name="ns-airport-transfers-country" value="<?php echo esc_attr( get_option('ns-airport-transfers-country') ); ?>" /> 41 <p class="description"><?php e cho __('Set the country (also can be set in the shortcode [airport-transfers-form country="Earthsea"])',self::$textdomain); ?></p>41 <p class="description"><?php esc_html_e('Set the country (also can be set in the shortcode [airport-transfers-form country="Earthsea"])','ns-airport-transfers'); ?></p> 42 42 </td> 43 43 </tr> 44 44 45 45 <tr> 46 <th scope="row"><?php e cho __('Resort type',self::$textdomain); ?></th>46 <th scope="row"><?php esc_html_e('Resort type','ns-airport-transfers'); ?></th> 47 47 <td> 48 48 <select name="ns-airport-transfers-resort"> … … 54 54 <?php foreach ($options as $value => $name) : ?> 55 55 <?php $selected = ($format===$value) ? ' selected="selected"' : ''; ?> 56 <option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php e cho __($name,self::$textdomain); ?></option>56 <option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php esc_html_e($name,'ns-airport-transfers'); ?></option> 57 57 <?php endforeach; ?> 58 58 </select> 59 <p class="description"><?php e cho __('Select default resort type (also can be set in the shortcode [airport-transfers-form resort="summer/winter"])',self::$textdomain); ?></p>59 <p class="description"><?php esc_html_e('Select default resort type (also can be set in the shortcode [airport-transfers-form resort="summer/winter"])','ns-airport-transfers'); ?></p> 60 60 </td> 61 61 </tr> 62 62 63 63 <tr> 64 <th scope="row"><?php e cho __('Time format',self::$textdomain); ?></th>64 <th scope="row"><?php esc_html_e('Time format','ns-airport-transfers'); ?></th> 65 65 <td> 66 66 <select name="ns-airport-transfers-time-format"> … … 69 69 <?php foreach ($options as $option) : ?> 70 70 <?php $selected = ($format===$option) ? ' selected="selected"' : ''; ?> 71 <option value="<?php echo $option; ?>"<?php echo $selected; ?>><?php echo $option; ?> <?php e cho __('Hours',self::$textdomain); ?></option>71 <option value="<?php echo $option; ?>"<?php echo $selected; ?>><?php echo $option; ?> <?php esc_html_e('Hours','ns-airport-transfers'); ?></option> 72 72 <?php endforeach; ?> 73 73 </select> 74 <p class="description"><?php e cho __('Select default time-format (also can be set in the shortcode [airport-transfers-form time-format="24"])',self::$textdomain); ?></p>74 <p class="description"><?php esc_html_e('Select default time-format (also can be set in the shortcode [airport-transfers-form time-format="24"])','ns-airport-transfers'); ?></p> 75 75 </td> 76 76 </tr> -
airport-transfers/tags/master/airport-transfers.php
r1725009 r2842501 1 <?php 1 <?php 2 2 /* 3 3 Plugin Name: Airport Transfers 4 Plugin URI: https://github.com/atanasantonov/ wordpress-plugins/tree/master/airport-transfers4 Plugin URI: https://github.com/atanasantonov/airport-transfers 5 5 Description: Plugin delivers multilingual form for airport transfers 6 Version: 1.06 Version: master 7 7 Author: Atanas Antonov 8 Author URI: http ://nantstudio.eu/8 Author URI: https://unax.org 9 9 License: GPL2 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 11 Text Domain: ns-airport-transfers 12 Domain Path: /languages 12 Domain Path: /languages/ 13 13 */ 14 14 15 15 defined( 'ABSPATH' ) or die( 'I can\'t do anything alone! Sorry!' ); 16 16 17 define( 'NS_AIRPORT_TRANSFERS_VERSION', 'master' ); 18 define( 'NS_AIRPORT_TRANSFERS_PATH', plugin_dir_path( __FILE__ ) ); 19 define( 'NS_AIRPORT_TRANSFERS_URL', plugins_url( '/', __FILE__ ) ); 20 21 load_plugin_textdomain('ns-airport-transfers', false, basename( dirname( __FILE__ ) ) . '/languages' ); 22 23 require_once( NS_AIRPORT_TRANSFERS_PATH . 'functions.php' ); 24 require_once( NS_AIRPORT_TRANSFERS_PATH . 'admin/class-airport-transfers-admin.php' ); 25 require_once( NS_AIRPORT_TRANSFERS_PATH . 'public/class-airport-transfers.php' ); 26 17 27 register_activation_hook( __FILE__, 'ns_airport_transfers_activate' ); 18 28 register_deactivation_hook( __FILE__, 'ns_airport_transfers_uninstall' ); 19 29 20 // add the options defaults 21 function ns_airport_transfers_activate() { 22 add_option( 'ns-airport-transfers-admin-email', get_option('admin_email')); // Admin email delivery and contact address 23 add_option( 'ns-airport-transfers-contact-email', '' ); // Contant email 24 add_option( 'ns-airport-transfers-contact-phone', '' ); // Contant phone 25 add_option( 'ns-airport-transfers-country', 'Earthsea' ); // Can be set in plugin's settings page or trough the shortcode 26 add_option( 'ns-airport-transfers-resort', 'summer' ); // Include ski field or not. Can be set in plugin's settings page or trough the shortcode 27 add_option( 'ns-airport-transfers-time-format', '24' ); // 12 or 24 Hours time format. Can be set in plugin's settings page or trough the shortcode 30 if ( is_admin() ) { 31 \NS_Airport_Transfers_Admin::init(); 32 add_action( 'init', array( '\NS_Airport_Transfers_Admin', 'init' ) ); 28 33 } 29 34 30 // delete the unnecessary options from the database 31 function ns_airport_transfers_uninstall() { 32 delete_option('ns-airport-transfers-admin-email'); 33 delete_option('ns-airport-transfers-contact-email'); 34 delete_option('ns-airport-transfers-contact-phone'); 35 delete_option('ns-airport-transfers-country'); 36 delete_option('ns-airport-transfers-resort'); 37 delete_option('ns-airport-transfers-time-format'); 38 } 39 40 load_plugin_textdomain('ns-airport-transfers', false, basename( dirname( __FILE__ ) ) . '/languages' ); 41 require_once( plugin_dir_path(__FILE__) . 'texts.php' ); 42 43 /** 44 * airport_transfers_lang 45 * 46 * returns translation of the string 47 * @param string $string - string to be translated 48 * @param string $lang - desired language 49 * Function check if Polylang plugin's 'pll_translate_string' function 50 * is available. If so the plugin's function will be used. Otherwise Wordpress translation system will be used. 51 */ 52 function airport_transfers_lang($string='',$lang=null) { 53 if(function_exists('pll_translate_string')) { 54 $string = isset($lang) ? pll_translate_string($string, $lang) : pll__($string); 55 } else { 56 $string = __($string, 'ns-airport-transfers'); 57 } 58 return $string; 59 } 60 61 /** 62 * airport_transfers_lang_e 63 * 64 * returns translation of the string with echo 65 * @param string $string - string to be translated 66 * @param string $lang - desired language 67 * same as airport_transfers_lang but with echo 68 */ 69 function airport_transfers_lang_e($string='',$lang=null) { 70 if(function_exists('pll_translate_string')) { 71 $string = isset($lang) ? pll_translate_string($string, $lang) : pll__($string); 72 } else { 73 $string = __($string, 'ns-airport-transfers'); 74 } 75 echo $string; 76 return; 77 } 78 79 /** 80 * airport_transfers_check_val 81 * 82 * returns '-' if param is empty string 83 * @param string $string 84 */ 85 function airport_transfers_check_val($string='') { 86 $string = ($string!='') ? $string : '-'; 87 return $string; 88 } 89 90 if (is_admin()) { 91 require_once( plugin_dir_path(__FILE__) . 'admin/class-airport-transfers-admin.php' ); 92 add_action( 'init', array( 'NS_Airport_Transfers_Admin', 'init' ) ); 93 94 // register ajax functions for the fronend 95 add_action( 'wp_ajax_send', array( 'NS_Airport_Transfers_Admin', 'ns_admin_send' )); 96 add_action( 'wp_ajax_nopriv_send', array( 'NS_Airport_Transfers_Admin', 'ns_admin_send' )); 97 } 98 else 99 { 100 function ns_enqueue_scripts() { 101 // load css 102 wp_enqueue_style( 'bootstrap', plugins_url('assets/bootstrap/css/bootstrap.min.css', __FILE__)); 103 wp_enqueue_style( 'jquery-ui', plugins_url('assets/jquery-ui/jquery-ui.min.css', __FILE__)); 104 wp_enqueue_style( 'ns-airport-transfers', plugins_url('assets/css/styles.css', __FILE__)); 105 106 // load scripts 107 wp_enqueue_script('jquery'); 108 wp_enqueue_script('jquery-ui-datepicker'); 109 wp_enqueue_script('bootstrap', plugins_url('assets/bootstrap/js/bootstrap.min.js', __FILE__ ),array('jquery')); 110 } 111 add_action( 'wp_enqueue_scripts','ns_enqueue_scripts'); 112 113 require_once( plugin_dir_path(__FILE__) . 'public/class-airport-transfers.php' ); 114 add_action( 'init', array( 'NS_Airport_Transfers', 'init' ) ); 115 } 35 \NS_Airport_Transfers::init(); -
airport-transfers/tags/master/languages/ns-airport-transfers.pot
r1725009 r2842501 2 2 msgid "" 3 3 msgstr "" 4 "Project-Id-Version: PACKAGE VERSION\n"4 "Project-Id-Version: Airport Transfers\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 20 17-08-30 11:45+0000\n"6 "POT-Creation-Date: 2023-01-02 17:48+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 9 9 "Language-Team: \n" 10 10 "Language: \n" 11 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION \n"11 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 12 12 "MIME-Version: 1.0\n" 13 13 "Content-Type: text/plain; charset=UTF-8\n" 14 14 "Content-Transfer-Encoding: 8bit\n" 15 "X-Generator: Loco - https://localise.biz/" 15 "X-Generator: Loco https://localise.biz/\n" 16 "X-Loco-Version: 2.6.2; wp-6.0.3\n" 17 "X-Domain: ns-airport-transfers" 18 19 #: public/class-airport-transfers.php:190 public/views/form.php:197 20 msgid "Address in" 21 msgstr "" 22 23 #: public/class-airport-transfers.php:191 public/views/form.php:202 24 msgid "Address of hotel/accommodation" 25 msgstr "" 26 27 #: admin/views/settings-page.php:14 28 msgid "Admin email/emails" 29 msgstr "" 30 31 #: public/views/form.php:80 32 msgid "After arrival" 33 msgstr "" 34 35 #: public/class-airport-transfers.php:173 36 #: public/class-airport-transfers.php:184 public/views/form.php:117 37 #: public/views/form.php:175 38 msgid "Airport" 39 msgstr "" 40 41 #. Name of the plugin 42 msgid "Airport Transfers" 43 msgstr "" 44 45 #. Author of the plugin 46 msgid "Atanas Antonov" 47 msgstr "" 48 49 #: public/views/modal-error.php:7 public/views/modal-error.php:22 50 msgid "Close" 51 msgstr "" 52 53 #: admin/views/settings-page.php:22 54 msgid "Contact email" 55 msgstr "" 56 57 #: admin/views/settings-page.php:25 58 msgid "Contact email." 59 msgstr "" 60 61 #: admin/views/settings-page.php:30 62 msgid "Contact phone/phones" 63 msgstr "" 64 65 #: admin/views/settings-page.php:33 66 msgid "Contact phone/phones." 67 msgstr "" 68 69 #: public/class-airport-transfers.php:171 public/views/form.php:83 70 msgid "Date of arrival" 71 msgstr "" 72 73 #: public/class-airport-transfers.php:182 public/views/form.php:141 74 msgid "Date of departure" 75 msgstr "" 76 77 #: admin/views/settings-page.php:38 78 msgid "Default destination country" 79 msgstr "" 80 81 #: public/class-airport-transfers.php:56 public/class-airport-transfers.php:148 82 msgid "Email Address" 83 msgstr "" 84 85 #: public/views/form.php:18 86 msgid "Email address" 87 msgstr "" 88 89 #: admin/views/settings-page.php:17 90 msgid "" 91 "Email/emails for delivery. Comma separated if more than one (admin1@example." 92 "com, admin2@example.com, ...)" 93 msgstr "" 94 95 #: public/views/modal-error.php:8 96 msgid "Error" 97 msgstr "" 98 99 #: public/class-airport-transfers.php:174 100 #: public/class-airport-transfers.php:185 public/views/form.php:129 101 #: public/views/form.php:187 102 msgid "Flight number" 103 msgstr "" 104 105 #: public/views/form.php:46 public/views/form.php:80 106 msgid "From airport" 107 msgstr "" 108 109 #: public/views/form.php:93 public/views/form.php:151 110 msgid "Hour" 111 msgstr "" 112 113 #: admin/views/settings-page.php:71 114 msgid "Hours" 115 msgstr "" 116 117 #. URI of the plugin 118 msgid "https://github.com/atanasantonov/airport-transfers" 119 msgstr "" 120 121 #. Author URI of the plugin 122 msgid "https://unax.org" 123 msgstr "" 124 125 #: public/class-airport-transfers.php:150 public/views/form.php:34 126 msgid "I would like to" 127 msgstr "" 128 129 #: public/class-airport-transfers.php:131 130 msgid "Incorrect data!" 131 msgstr "" 132 133 #: public/views/form.php:8 134 msgid "Information about you" 135 msgstr "" 136 137 #: public/class-airport-transfers.php:137 138 msgid "Invalid email address!" 139 msgstr "" 140 141 #: public/views/form.php:29 142 msgid "It's mandatory to input your phone number" 143 msgstr "" 144 145 #: public/views/form.php:4 146 msgid "Javascript must be enabled!" 147 msgstr "" 148 149 #: public/views/form.php:138 150 msgid "Leaving" 151 msgstr "" 152 153 #: public/views/form.php:36 154 msgid "Make reservation" 155 msgstr "" 156 157 #: public/class-airport-transfers.php:58 158 msgid "Mandatory Field" 159 msgstr "" 160 161 #: public/views/form.php:101 public/views/form.php:159 162 msgid "Min" 163 msgstr "" 164 165 #: public/class-airport-transfers.php:57 public/class-airport-transfers.php:149 166 #: public/views/form.php:26 167 msgid "Mobile" 168 msgstr "" 169 170 #: public/class-airport-transfers.php:152 public/views/form.php:53 171 msgid "No. of adults" 172 msgstr "" 173 174 #: public/class-airport-transfers.php:153 public/views/form.php:58 175 msgid "No. of children" 176 msgstr "" 177 178 #: public/class-airport-transfers.php:154 public/views/form.php:65 179 msgid "No. of koffers" 180 msgstr "" 181 182 #: public/class-airport-transfers.php:156 public/views/form.php:71 183 msgid "No. of ski/snowboards" 184 msgstr "" 185 186 #: public/views/form.php:21 187 msgid "On this Email you will recieve confirmation" 188 msgstr "" 189 190 #: public/views/form.php:46 public/views/form.php:47 191 msgid "One way" 192 msgstr "" 193 194 #. Description of the plugin 195 msgid "Plugin delivers multilingual form for airport transfers" 196 msgstr "" 197 198 #: public/class-airport-transfers.php:194 public/views/form.php:211 199 msgid "Remarks/instructions" 200 msgstr "" 201 202 #: public/class-airport-transfers.php:141 203 msgid "Request" 204 msgstr "" 205 206 #: public/views/form.php:37 207 msgid "Request more information" 208 msgstr "" 209 210 #: admin/views/settings-page.php:46 211 msgid "Resort type" 212 msgstr "" 213 214 #: public/views/form.php:120 public/views/form.php:178 215 msgid "select" 216 msgstr "" 217 218 #: admin/views/settings-page.php:59 219 msgid "" 220 "Select default resort type (also can be set in the shortcode [airport-" 221 "transfers-form resort=\"summer/winter\"])" 222 msgstr "" 223 224 #: admin/views/settings-page.php:74 225 msgid "" 226 "Select default time-format (also can be set in the shortcode [airport-" 227 "transfers-form time-format=\"24\"])" 228 msgstr "" 229 230 #: public/views/form.php:217 231 msgid "Send" 232 msgstr "" 233 234 #: admin/views/settings-page.php:41 235 msgid "" 236 "Set the country (also can be set in the shortcode [airport-transfers-form " 237 "country=\"Earthsea\"])" 238 msgstr "" 239 240 #: admin/views/settings-page.php:5 241 msgid "Styling and functionality settings" 242 msgstr "" 243 244 #: public/class-airport-transfers.php:59 245 msgid "System Error" 246 msgstr "" 247 248 #: public/class-airport-transfers.php:206 249 msgid "System Error!" 250 msgstr "" 251 252 #: public/class-airport-transfers.php:210 253 msgid "Thank you for your submission! We will answer as soon as possible!" 254 msgstr "" 255 256 #: admin/views/settings-page.php:64 257 msgid "Time format" 258 msgstr "" 259 260 #: public/class-airport-transfers.php:172 public/views/form.php:90 261 msgid "Time of arrival" 262 msgstr "" 263 264 #: public/class-airport-transfers.php:183 public/views/form.php:148 265 msgid "Time of departure" 266 msgstr "" 267 268 #: public/views/form.php:47 public/views/form.php:138 269 msgid "To airport" 270 msgstr "" 271 272 #: public/class-airport-transfers.php:151 public/views/form.php:42 273 msgid "Transfer type" 274 msgstr "" 275 276 #: public/views/form.php:45 277 msgid "Two way" 278 msgstr "" 279 280 #: public/class-airport-transfers.php:55 public/class-airport-transfers.php:147 281 msgid "Your Name" 282 msgstr "" 283 284 #: public/views/form.php:11 285 msgid "Your name" 286 msgstr "" -
airport-transfers/tags/master/public/class-airport-transfers.php
r1725009 r2842501 1 1 <?php defined( 'ABSPATH' ) or die( 'I can\'t do anything alone! Sorry!' ); 2 2 3 if( !class_exists('NS_Airport_Transfers') ) { 4 5 class NS_Airport_Transfers { 6 7 private static $initiated = false; 8 9 private static $class = 'NS_Airport_Transfers'; 10 public static $textdomain = 'ns-airport-transfers'; 11 public static $prefix = 'ns_'; 12 13 public static function init() { 14 if ( !self::$initiated ) { 15 self::init_hooks(); 16 } 3 if( ! class_exists( 'NS_Airport_Transfers' ) ) { 4 5 class NS_Airport_Transfers { 6 7 private static $initiated = false; 8 9 /** 10 * Init. 11 */ 12 public static function init() { 13 if( ! self::$initiated ) { 14 self::init_hooks(); 15 } 16 } 17 18 19 /** 20 * Register hooks. 21 */ 22 private static function init_hooks() { 23 // Enqueue scripts. 24 add_action( 'wp_enqueue_scripts', array( '\NS_Airport_Transfers', 'enqueue_scripts' ) ); 25 26 // Register ajax functions for the fronend. 27 add_action( 'wp_ajax_send', array( '\NS_Airport_Transfers', 'send' ) ); 28 add_action( 'wp_ajax_nopriv_send', array( '\NS_Airport_Transfers', 'send' ) ); 29 30 // Shortcodes. 31 add_shortcode('airport-transfers-form', array( '\NS_Airport_Transfers', 'form' ) ); 32 33 self::$initiated = true; 34 } 35 36 37 /** 38 * Enqueue scripts. 39 */ 40 public static function enqueue_scripts() { 41 // Load css. 42 wp_enqueue_style( 'bootstrap', NS_AIRPORT_TRANSFERS_URL . 'assets/bootstrap/css/bootstrap.min.css', array(), '3.3.7' ); 43 wp_enqueue_style( 'jquery-ui', NS_AIRPORT_TRANSFERS_URL . 'assets/jquery-ui/jquery-ui.min.css', array(), '1.12.1' ); 44 wp_enqueue_style( 'ns-airport-transfers', NS_AIRPORT_TRANSFERS_URL . 'assets/css/styles.css', array( 'bootstrap', 'jquery-ui' ), NS_AIRPORT_TRANSFERS_VERSION ); 45 46 // Load scripts. 47 wp_enqueue_script( 'bootstrap', NS_AIRPORT_TRANSFERS_URL . 'assets/bootstrap/js/bootstrap.min.js', array( 'jquery', 'jquery-ui-datepicker' ), '3.3.7', true ); 48 wp_enqueue_script( 'ns-airport-transfers', NS_AIRPORT_TRANSFERS_URL . 'assets/js/index.js', array( 'bootstrap' ), NS_AIRPORT_TRANSFERS_VERSION, true ); 49 wp_localize_script( 50 'ns-airport-transfers', 51 'nsAirportTransfers', 52 array( 53 'adminUrl' => admin_url( 'admin-ajax.php' ), 54 'texts' => array( 55 'yourName' => esc_html__( 'Your Name', 'ns-airport-transfers' ), 56 'emailAddress' => esc_html__( 'Email Address', 'ns-airport-transfers' ), 57 'mobile' => esc_html__( 'Mobile', 'ns-airport-transfers' ), 58 'MandatoryField' => esc_html__( 'Mandatory Field', 'ns-airport-transfers' ), 59 'SystemError' => esc_html__( 'System Error', 'ns-airport-transfers' ), 60 ) 61 ) 62 ); 63 } 64 65 66 /** 67 * Main function to display and process the form. 68 * 69 * Option provided are: 70 * resort - if summer [no. of ski] field is skipped, 71 * country - concatenated with [Addres in] label, default is [add country option please] 72 * time-format - if 12 we use the 12 Hour format, default is 24 73 * 74 * @param array $atts Array of options. 75 * @param sring $content Content provides comma separeted airports for the dropdown, default is one option [add Airports in content please]. 76 * 77 * @return string 78 */ 79 public static function form( $atts, $content = '' ) { 80 81 $params = shortcode_atts( array( 82 'resort' => get_option( 'ns-airport-transfers-resort' ), 83 'time-format' => get_option( 'ns-airport-transfers-time-format' ), 84 'show-contacts' => '1' 85 ), $atts ); 86 87 // Adjust dropdowns depending on Time format (12 or 24 Hours). 88 if( strtolower( $params['time-format']) === '12' ) : 89 for($i=1; $i<=12; $i++) : 90 $hours[] = strval($i); 91 endfor; 92 $am_pm = '<option>AM/PM</option> 93 <option value="AM">AM</option> 94 <option value="PM">PM</option>'; 95 else : 96 for($i=0; $i<=23; $i++) : 97 $hours[] = ($i<10) ? '0' . strval($i) : strval($i); 98 endfor; 99 $am_pm = FALSE; 100 endif; 101 102 // Adjust minutes dropdown. 103 for($i=0; $i<=55; $i++) : 104 if($i%5===0) : 105 $minutes[] = ($i<10) ? '0' . strval($i) : strval($i); 106 endif; 107 endfor; 108 109 // Process the content from the shortcode. 110 $options = explode(",", $content); 111 $options = (sizeof($options)>0) ? $options : array(); 112 113 array_map( 'trim', $options ); 114 115 ob_start(); 116 117 require_once( NS_AIRPORT_TRANSFERS_PATH . 'public/views/form.php' ); 118 require_once( NS_AIRPORT_TRANSFERS_PATH . 'public/views/modal-error.php' ); 119 120 return ob_get_clean(); 121 } 122 123 124 /** 125 * Ajax form handler. 126 */ 127 public static function send() { 128 try { 129 // Check post at all. 130 if( empty( $_POST ) ) { 131 throw new \Exception( esc_html__( 'Incorrect data!', 'ns-airport-transfers' ) ); 132 } 133 134 // Check email. 135 $email = filter_var( sanitize_email( $_POST['email'] ), FILTER_VALIDATE_EMAIL ); 136 if ( ! $email ) { 137 throw new \Exception(esc_html__( 'Invalid email address!', 'ns-airport-transfers' ) ); 138 } 139 140 // Subject. 141 $subject = esc_html__( 'Request', 'ns-airport-transfers' ); 142 143 // Message. 144 $message = ''; 145 146 // Information. 147 $message .= esc_html__( 'Your Name', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['name'] ) ) . PHP_EOL; 148 $message .= esc_html__( 'Email Address', 'ns-airport-transfers' ).": " . $email . PHP_EOL; 149 $message .= esc_html__( 'Mobile', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field($_POST['phone'] ) ) . PHP_EOL; 150 $message .= esc_html__( 'I would like to', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['like_to'] ) . PHP_EOL; 151 $message .= esc_html__( 'Transfer type', 'ns-airport-transfers' ).": " . sanitize_text_field( $_POST['transfer_type'] ) . PHP_EOL; 152 $message .= esc_html__( 'No. of adults', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['adults'] ) ) . PHP_EOL; 153 $message .= esc_html__( 'No. of children', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['children'] ) ) . PHP_EOL; 154 $message .= esc_html__( 'No. of koffers', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['koffers'] ) ) . PHP_EOL; 155 if(sanitize_text_field( $_POST['resort'])==='winter' ) { 156 $message .= esc_html__( 'No. of ski/snowboards', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field($_POST['ski'] ) ) . PHP_EOL; 157 } 158 159 $message .= PHP_EOL; 160 161 // transfer_type 162 $transfer_type = sanitize_text_field( $_POST['transfer_type'] ); 163 164 // time format 165 $time_format = sanitize_text_field( $_POST['time_format']); 166 167 // arrival 168 $post_arrival_us_time = sanitize_text_field( $_POST['arrival_us_time']); 169 $arrival_us_time = ($time_format==='12'&&$post_arrival_us_time!=='') ? $post_arrival_us_time : ''; 170 if($transfer_type==='two_way' || $transfer_type==='from_airport') { 171 $message .= esc_html__( 'Date of arrival', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['arrival_date'] ) ) . PHP_EOL; 172 $message .= esc_html__( 'Time of arrival', 'ns-airport-transfers' ).": " . sanitize_text_field( $_POST['arrival_hour'] ) . ':' . sanitize_text_field( $_POST['arrival_minutes']).$arrival_us_time . PHP_EOL; 173 $message .= esc_html__( 'Airport', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['arrival_airport'] ) . PHP_EOL; 174 $message .= esc_html__( 'Flight number', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['arrival_flight'] ) ) . PHP_EOL; 175 $message .= PHP_EOL; 176 } 177 178 // departure 179 $post_out_us_time = sanitize_text_field( $_POST['out_us_time'] ); 180 $out_us_time = ($time_format==='12'&&$post_out_us_time!=='') ? $post_out_us_time : ''; 181 if($transfer_type==='two_way' || $transfer_type==='to_airport') { 182 $message .= esc_html__( 'Date of departure', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['out_date'])) . PHP_EOL; 183 $message .= esc_html__( 'Time of departure', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['out_hour']).':'.sanitize_text_field( $_POST['out_minutes']).$out_us_time . PHP_EOL; 184 $message .= esc_html__( 'Airport', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['out_airport']) . PHP_EOL; 185 $message .= esc_html__( 'Flight number', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['out_flight'])) . PHP_EOL; 186 $message .= PHP_EOL; 187 } 188 189 // address in destination country 190 $message .= esc_html__( 'Address in', 'ns-airport-transfers' ).' '.esc_html__( get_option( 'ns-airport-transfers-country' ), 'ns-airport-transfers' ) . PHP_EOL; 191 $message .= esc_html__( 'Address of hotel/accommodation', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['adress'])) . PHP_EOL; 192 193 // instructions 194 $message .= esc_html__( 'Remarks/instructions', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['instructions'])) . PHP_EOL; 195 196 // Headers 197 $headers = 'MIME-Version: 1.0' . PHP_EOL; 198 $headers .= 'Content-type: text/plain; charset=utf-8' . PHP_EOL; 199 $headers .= 'Content-Transfer-Encoding: 7bit' . PHP_EOL; 200 $headers .= 'Message-ID: <' . time() . '-'. md5($email).'>' . PHP_EOL; 201 $headers .= 'From: '.get_option('blogname').' <'.get_option('admin_email').'>' . PHP_EOL; 202 $headers .= 'Return-Path: <'.get_option('admin_email').'>' . PHP_EOL; 203 204 // get administrative emails for the form 205 if( ! wp_mail( get_option('ns-airport-transfers-admin-email'), $subject, $message, $headers ) ) { 206 throw new \Exception(esc_html__( 'System Error!', 'ns-airport-transfers' )); 207 } 208 209 $result['status'] = 'success'; 210 $result['data'] = esc_html__( 'Thank you for your submission! We will answer as soon as possible!', 'ns-airport-transfers' ); 211 212 } catch (Exception $e) { 213 $result['status'] = 'error'; 214 $result['data'] = $e->getMessage(); 215 216 $error_message = 'Sending mail failed!'.PHP_EOL . PHP_EOL; 217 $error_message .= 'Form message:'.PHP_EOL . PHP_EOL; 218 $error_message .= print_r($e->getMessage(),TRUE) . PHP_EOL; 219 220 wp_mail( get_option('admin_email'), 'Airport Transfers Error', $error_message, $headers ); 221 } finally { 222 echo json_encode($result); 223 } 224 wp_die(); 225 } 226 17 227 } 18 19 /**20 * Initializes WordPress hooks21 */22 private static function init_hooks() {23 // add javascript for the form24 add_action('wp_footer', array(self::$class, self::$prefix.'form_js'));25 // form shortcode26 add_shortcode('airport-transfers-form', array(self::$class, self::$prefix.'form'));27 self::$initiated = true;28 }29 30 31 public static function ns_form_js() { ?>32 <script type="text/javascript">33 34 jQuery(document).ready(function($) {35 36 var prefix = '#ns-airport-transfer-form ';37 38 // load datepicker39 if((prefix+".date").length > 0 ){40 $(prefix+".date" ).datepicker();41 }42 43 $(prefix+'#transfer_type').on('change', function(){44 let val= $(prefix+'#transfer_type option:selected').val();45 if(val==='from_airport') {46 $(prefix+"#arrival").css('display','block');47 $(prefix+"#departure").css('display','none');48 } else if(val==='to_airport') {49 $(prefix+"#arrival").css('display','none');50 $(prefix+"#departure").css('display','block');51 } else {52 $(prefix+"#arrival").css('display','block');53 $(prefix+"#departure").css('display','block');54 }55 });56 57 58 $(prefix+'#submit').on('click', function(){59 60 if(!ns_form_validate(prefix+'#name','<?=airport_transfers_lang_e('Your Name')?>')) {61 return;62 }63 64 if(!ns_form_validate(prefix+'#email','<?=airport_transfers_lang_e('Email Address')?>')) {65 return;66 }67 68 if(!ns_form_validate(prefix+'#phone','<?=airport_transfers_lang_e('Mobile')?>')) {69 return;70 }71 72 $('body').last('div').after('<div id="loading" class="loading"></div>');73 74 $.post( '<?=admin_url('admin-ajax.php?action=send')?>', {75 76 // form data77 lang: '<?php echo function_exists('pll_current_language')?pll_current_language('locale'):get_locale(); ?>',78 resort: $(prefix+"#resort").val(),79 time_format: $(prefix+"#time_format").val(),80 81 // personal data82 name: $(prefix+"#name").val(),83 email: $(prefix+"#email").val(),84 phone: $(prefix+"#phone").val(),85 like_to: $(prefix+'input[name=like_to]:checked').val(),86 transfer_type: $(prefix+"#transfer_type option:selected").val(),87 adults: $(prefix+"#adults").val(),88 children: $(prefix+"#children").val(),89 koffers: $(prefix+"#koffers").val(),90 ski: ($(prefix+"#ski").length>0) ? $("#ski").val() : '',91 92 // arrival data93 arrival_date: $(prefix+"#arrival_date").val(),94 arrival_hour: $(prefix+"#arrival_hour option:selected").val(),95 arrival_minutes: $(prefix+"#arrival_minutes option:selected").val(),96 arrival_us_time: ($(prefix+"#arrival_us_time").length>0) ? $("#arrival_us_time option:selected").val() : '',97 arrival_airport: $(prefix+"#arrival_airport option:selected").val(),98 arrival_flight: $(prefix+"#arrival_flight").val(),99 100 // departure data101 out_date: $(prefix+"#out_date").val(),102 out_hour: $(prefix+"#out_hour option:selected").val(),103 out_minutes: $(prefix+"#out_minutes option:selected").val(),104 out_us_time: ($(prefix+"#out_us_time").length>0) ? $("#out_us_time option:selected").val() : '',105 out_airport: $(prefix+"#out_airport option:selected").val(),106 out_flight: $(prefix+"#out_flight").val(),107 108 // address and instructions109 adress: $(prefix+"#adress").val(),110 instructions: $(prefix+"#instructions").val()111 }).done(function(data) {112 let response = $.parseJSON(data);113 if(response.status==='error') {114 $('#modal-error-message').text(response.data);115 $('#modal-error').modal();116 return;117 }118 119 $('html, body').animate({120 scrollTop: $(".main-container").offset().top121 }, 500);122 123 setTimeout(function(){124 $("#ns-airport-transfer-form").empty();125 $("#ns-airport-transfer-form").html('<h3 class="text-success">'+response.data+'</h3>');126 },500);127 }).fail(function() {128 $('#modal-error-message').text('<?=airport_transfers_lang_e('System Error!')?>');129 $('#modal-error').modal();130 })131 .always(function() {132 $("#loading").remove();133 });134 });135 136 function ns_form_validate(el,message) {137 if($(el).val()==='') {138 $('html, body').animate({139 scrollTop: $(".main-container").offset().top140 }, 500);141 $('#modal-error-message').text('<?=airport_transfers_lang_e('Please input')?> '+message);142 $('#modal-error').modal();143 return false;144 }145 return true;146 }147 148 });149 150 </script>151 <?php }152 153 /**154 * Main function to display and process the form155 *156 * option provided are:157 * resort - if summer [no. of ski] field is skipped,158 * country - concatenated with [Addres in] label, default is [add country option please]159 * time-format - if 12 we use the 12 Hour format, default is 24160 *161 * content provides comma separeted airports for the dropdown, default is one option [add Airports in content please]162 */163 public static function ns_form($atts, $content = '') {164 165 $params = shortcode_atts( array(166 'resort' => get_option('ns-airport-transfers-resort'),167 'time-format' => get_option('ns-airport-transfers-time-format'),168 'show-contacts' => 'true'169 ), $atts);170 171 // adjust dropdowns depending on Time format (12 or 24 Hours)172 if(strtolower($params['time-format'])==='12') :173 for($i=1; $i<=12; $i++) :174 $hours[] = strval($i);175 endfor;176 $am_pm = '<option>AM/PM</option>177 <option value="AM">AM</option>178 <option value="PM">PM</option>';179 else :180 for($i=0; $i<=23; $i++) :181 $hours[] = ($i<10) ? '0' . strval($i) : strval($i);182 endfor;183 $am_pm = FALSE;184 endif;185 186 // adjust minutes dropdown187 for($i=0; $i<=55; $i++) :188 if($i%5===0) :189 $minutes[] = ($i<10) ? '0' . strval($i) : strval($i);190 endif;191 endfor;192 193 // process the content from the shortcode194 $options = explode(",", $content);195 $options = (sizeof($options)>0) ? $options : array();196 197 ob_start();198 require_once( plugin_dir_path(__FILE__) . 'views/form.php' );199 require_once( plugin_dir_path(__FILE__) . 'views/modal-error.php' );200 return ob_get_clean();201 }202 203 } // class ends here204 228 } 205 -
airport-transfers/tags/master/public/views/form.php
r1725009 r2842501 2 2 3 3 <form id="ns-airport-transfer-form" action="<?=get_permalink()?>" class="form-horizontal" method="post" accept-charset="utf-8"> 4 <noscript><? =airport_transfers_lang_e('Javascript must be enabled!');?></noscript><br><br>4 <noscript><?php esc_html_e( 'Javascript must be enabled!', 'ns-airport-transfers' ); ?></noscript><br><br> 5 5 <input type="hidden" id="resort" value="<?=$params['resort']?>"> 6 6 <input type="hidden" id="time_format" value="<?=$params['time-format']?>"> 7 7 8 <h4 class="text-success"><? =airport_transfers_lang_e('Information about you');?></h4>9 10 <div class="form-group"> 11 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Your name');?><span class="text-danger">*</span></label>8 <h4 class="text-success"><?php esc_html_e( 'Information about you', 'ns-airport-transfers' ); ?></h4> 9 10 <div class="form-group"> 11 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Your name', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 12 12 <div class="col-sm-8 col-xs-12"> 13 13 <input type="text" id="name" class="form-control" value="" placeholder=""> … … 16 16 <div class="clear"><br></div> 17 17 <div class="form-group"> 18 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Email address');?><span class="text-danger">*</span></label>18 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Email address', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 19 19 <div class="col-sm-8 col-xs-12"> 20 20 <input type="text" id="email" class="form-control" value="" placeholder=""> 21 <span class="explanation">(<? =airport_transfers_lang_e('On this Email you will recieve confirmation');?>)</span>22 </div> 23 </div> 24 <div class="clear"></div> 25 <div class="form-group"> 26 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Mobile');?><span class="text-danger">*</span></label>21 <span class="explanation">(<?php esc_html_e( 'On this Email you will recieve confirmation', 'ns-airport-transfers' ); ?>)</span> 22 </div> 23 </div> 24 <div class="clear"></div> 25 <div class="form-group"> 26 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Mobile', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 27 27 <div class="col-sm-8 col-xs-12"> 28 28 <input type="text" id="phone" class="form-control" value="" placeholder=""> 29 <span class="explanation">(<? =airport_transfers_lang_e('It\'s mandatory to input your phone number');?>)</span>30 </div> 31 </div> 32 <div class="clear"></div> 33 <div class="form-group"> 34 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('I would like to');?>:<span class="text-danger">*</span></label>35 <div class="col-sm-8 col-xs-12"> 36 <input type="radio" name="like_to" value="<? =airport_transfers_lang_e('Make reservation');?>" checked> <?=airport_transfers_lang_e('Make reservation');?><br>37 <input type="radio" name="like_to" value="<? =airport_transfers_lang_e('Request more information');?>"> <?=airport_transfers_lang_e('Request more information');?>38 </div> 29 <span class="explanation">(<?php esc_html_e( 'It\'s mandatory to input your phone number', 'ns-airport-transfers' ); ?>)</span> 30 </div> 31 </div> 32 <div class="clear"></div> 33 <div class="form-group"> 34 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'I would like to', 'ns-airport-transfers' ); ?>:<span class="text-danger">*</span></label> 35 <div class="col-sm-8 col-xs-12"> 36 <input type="radio" name="like_to" value="<?php esc_html_e( 'Make reservation', 'ns-airport-transfers' ); ?>" checked> <?php esc_html_e( 'Make reservation', 'ns-airport-transfers' ); ?><br> 37 <input type="radio" name="like_to" value="<?php esc_html_e( 'Request more information', 'ns-airport-transfers' ); ?>"> <?php esc_html_e( 'Request more information', 'ns-airport-transfers' ); ?> 38 </div> 39 39 </div><hr> 40 40 <div class="clear"></div> 41 41 <div class="form-group"> 42 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Transfer type');?><span class="text-danger">*</span></label>42 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Transfer type', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 43 43 <div class="col-sm-8 col-xs-12"> 44 44 <select id="transfer_type" class="form-control"> 45 <option value="two_way"><? =airport_transfers_lang_e('Two way');?></option>46 <option value="from_airport"><? =airport_transfers_lang_e('One way');?> (<?=airport_transfers_lang_e('From airport');?>)</option>47 <option value="to_airport"><? =airport_transfers_lang_e('One way');?> (<?=airport_transfers_lang_e('To airport');?>)</option>45 <option value="two_way"><?php esc_html_e( 'Two way', 'ns-airport-transfers' ); ?></option> 46 <option value="from_airport"><?php esc_html_e( 'One way', 'ns-airport-transfers' ); ?> (<?php esc_html_e( 'From airport', 'ns-airport-transfers' ); ?>)</option> 47 <option value="to_airport"><?php esc_html_e( 'One way', 'ns-airport-transfers' ); ?> (<?php esc_html_e( 'To airport', 'ns-airport-transfers' ); ?>)</option> 48 48 </select> 49 49 </div> … … 51 51 <div class="clear"></div><br> 52 52 <div class="form-group"> 53 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of adults');?><span class="text-danger">*</span></label>53 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of adults', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 54 54 <div class="col-md-2 col-sm-2 col-xs-4"> 55 55 <input type="text" id="adults" class="form-control" value="" placeholder=""> 56 </div> 57 58 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of children');?><span class="text-danger">*</span></label>56 </div> 57 58 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of children', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 59 59 <div class="col-md-2 col-sm-2 col-xs-4"> 60 60 <input type="text" id="children" class="form-control" value="" placeholder=""> … … 62 62 </div> 63 63 <div class="clear"></div><br> 64 <div class="form-group"> 65 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of koffers');?><span class="text-danger">*</span></label>64 <div class="form-group"> 65 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of koffers', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 66 66 <div class="col-md-2 col-sm-2 col-xs-4"> 67 67 <input type="text" id="koffers" class="form-control" value="" placeholder=""> 68 </div> 69 68 </div> 69 70 70 <?php if(strtolower($params['resort'])==='winter') : ?> 71 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of ski/snowboards');?><span class="text-danger">*</span></label>71 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of ski/snowboards', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 72 72 <div class="col-md-2 col-sm-2 col-xs-4"> 73 73 <input type="text" id="ski" class="form-control" value="" placeholder=""> 74 </div> 74 </div> 75 75 <?php endif; ?> 76 76 </div> 77 77 <div class="clear"></div><hr> 78 78 79 79 <div id="arrival"> 80 <h4><span class="text-success"><? =airport_transfers_lang_e('After arrival');?></span> <span class="small">(<?=airport_transfers_lang_e('From airport');?>)</span></h4>81 82 <div class="form-group"> 83 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Date of arrival');?><span class="text-danger">*</span></label>80 <h4><span class="text-success"><?php esc_html_e( 'After arrival', 'ns-airport-transfers' ); ?></span> <span class="small">(<?php esc_html_e( 'From airport', 'ns-airport-transfers' ); ?>)</span></h4> 81 82 <div class="form-group"> 83 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Date of arrival', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 84 84 <div class="col-sm-3 col-xs-4"> 85 85 <input type="text" id="arrival_date" value="" class="date form-control" placeholder=""> … … 88 88 <div class="clear"></div><br> 89 89 <div class="form-group"> 90 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Time of arrival');?><span class="text-danger">*</span></label>90 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Time of arrival', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 91 91 <div class="col-sm-3 col-xs-4"> 92 92 <select id="arrival_hour" class="form-control"> 93 <option value="-"><? =airport_transfers_lang_e('Hour')?></option>93 <option value="-"><?php esc_html_e( 'Hour', 'ns-airport-transfers' ); ?></option> 94 94 <?php foreach ($hours as $hour) : ?> 95 95 <option value="<?=$hour?>"><?=$hour?></option> … … 99 99 <div class="col-sm-3 col-xs-4"> 100 100 <select id="arrival_minutes" class="form-control"> 101 <option value="-"><? =airport_transfers_lang_e('Min')?></option>101 <option value="-"><?php esc_html_e( 'Min', 'ns-airport-transfers' ); ?></option> 102 102 <?php foreach ($minutes as $minute) : ?> 103 103 <option value="<?=$minute?>"><?=$minute?></option> … … 115 115 <div class="clear"></div><br> 116 116 <div class="form-group"> 117 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Airport')?><span class="text-danger">*</span></label>118 <div class="col-sm-6 col-xs-12"> 119 <select id="arrival_airport" class="form-control"> 120 <option value="-"><? =airport_transfers_lang_e('select')?></option>117 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Airport', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 118 <div class="col-sm-6 col-xs-12"> 119 <select id="arrival_airport" class="form-control"> 120 <option value="-"><?php esc_html_e( 'select', 'ns-airport-transfers' ); ?></option> 121 121 <?php foreach ($options as $option) : ?> 122 122 <option value="<?=$option?>"><?=$option?></option> … … 127 127 <div class="clear"></div><br> 128 128 <div class="form-group"> 129 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Flight number')?><span class="text-danger">*</span></label>129 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Flight number', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 130 130 <div class="col-sm-6 col-xs-12"> 131 131 <input type="text" class="form-control" id="arrival_flight" value="" placeholder=""> … … 134 134 <div class="clear"></div><br> 135 135 </div> 136 136 137 137 <div id="departure"> 138 <h4><span class="text-success"><? =airport_transfers_lang_e('Leaving')?></span> <span class="small">(<?=airport_transfers_lang_e('To airport');?>)</span></h4>139 140 <div class="form-group"> 141 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Date of departure')?><span class="text-danger">*</span></label>138 <h4><span class="text-success"><?php esc_html_e( 'Leaving', 'ns-airport-transfers' ); ?></span> <span class="small">(<?php esc_html_e( 'To airport', 'ns-airport-transfers' ); ?>)</span></h4> 139 140 <div class="form-group"> 141 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Date of departure', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 142 142 <div class="col-sm-3 col-xs-4"> 143 143 <input type="text" id="out_date" value="" class="date form-control" placeholder=""> … … 146 146 <div class="clear"></div><br> 147 147 <div class="form-group"> 148 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Time of departure');?><span class="text-danger">*</span></label>148 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Time of departure', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 149 149 <div class="col-sm-3 col-xs-4"> 150 150 <select id="out_hour" class="form-control"> 151 <option value="-"><? =airport_transfers_lang_e('Hour')?></option>151 <option value="-"><?php esc_html_e( 'Hour', 'ns-airport-transfers' ); ?></option> 152 152 <?php foreach ($hours as $hour) : ?> 153 153 <option value="<?=$hour?>"><?=$hour?></option> … … 157 157 <div class="col-sm-3 col-xs-4"> 158 158 <select id="out_minutes" class="form-control"> 159 <option value="-"><? =airport_transfers_lang_e('Min')?></option>159 <option value="-"><?php esc_html_e( 'Min', 'ns-airport-transfers' ); ?></option> 160 160 <?php foreach ($minutes as $minute) : ?> 161 161 <option value="<?=$minute?>"><?=$minute?></option> … … 173 173 <div class="clear"></div><br> 174 174 <div class="form-group"> 175 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Airport')?><span class="text-danger">*</span></label>176 <div class="col-sm-6 col-xs-12"> 177 <select id="out_airport" class="form-control"> 178 <option value="-"><? =airport_transfers_lang_e('select')?></option>175 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Airport', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 176 <div class="col-sm-6 col-xs-12"> 177 <select id="out_airport" class="form-control"> 178 <option value="-"><?php esc_html_e( 'select', 'ns-airport-transfers' ); ?></option> 179 179 <?php foreach ($options as $option) : ?> 180 180 <option value="<?=$option?>"><?=$option?></option> … … 185 185 <div class="clear"></div><br> 186 186 <div class="form-group"> 187 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Flight number')?><span class="text-danger">*</span></label>187 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Flight number', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 188 188 <div class="col-sm-6 col-xs-12"> 189 189 <input type="text" id="out_flight" class="form-control" value="" placeholder=""> … … 192 192 <div class="clear"></div><br> 193 193 </div> 194 194 195 195 <div class="clear"></div><hr> 196 196 197 <h4 class="text-success"><? =airport_transfers_lang_e('Address in')?> <?=airport_transfers_lang_e(get_option('ns-airport-transfers-country'))?></h4>198 199 <div class="clear"></div> 200 201 <div class="form-group"> 202 <label class="col-md-4 col-sm-12 col-xs-12"><? =airport_transfers_lang_e('Address of hotel/accommodation')?>: <span class="text-danger">*</span></label>197 <h4 class="text-success"><?php esc_html_e( 'Address in', 'ns-airport-transfers' ); ?> <?php esc_html_e( get_option('ns-airport-transfers-country'))?></h4> 198 199 <div class="clear"></div> 200 201 <div class="form-group"> 202 <label class="col-md-4 col-sm-12 col-xs-12"><?php esc_html_e( 'Address of hotel/accommodation', 'ns-airport-transfers' ); ?>: <span class="text-danger">*</span></label> 203 203 <div class="col-md-8 col-sm-12 col-xs-12"> 204 204 <textarea id="adress" class="form-control" rows="2" placeholder=""></textarea> 205 </div> 206 </div> 207 205 </div> 206 </div> 207 208 208 <div class="clear"></div><br> 209 210 <div class="form-group"> 211 <label class="col-md-4 col-sm-12 col-xs-12"><? =airport_transfers_lang_e('Remarks/instructions')?>:</label>209 210 <div class="form-group"> 211 <label class="col-md-4 col-sm-12 col-xs-12"><?php esc_html_e( 'Remarks/instructions', 'ns-airport-transfers' ); ?>:</label> 212 212 <div class="col-md-8 col-sm-12 col-xs-12"> 213 213 <textarea id="instructions" class="form-control" rows="2" placeholder=""></textarea> … … 215 215 </div> 216 216 <br><br> 217 <div id="submit" class="btn btn-default"><? =airport_transfers_lang_e('Send')?></div>218 217 <div id="submit" class="btn btn-default"><?php esc_html_e( 'Send', 'ns-airport-transfers' ); ?></div> 218 219 219 </form> 220 220 221 <?php if($params['show-contacts']===' true') : ?>221 <?php if($params['show-contacts']==='1') : ?> 222 222 <div class="clear"></div><br> 223 <i><?php printf(airport_transfers_lang('If you need transfer from airport to another destination, wich is not specified please call us at %s or send an e-mail to %s'), get_option('ns-airport-transfers-contact-phone'), get_option('ns-airport-transfers-contact-email'))?></i> 223 <i><?php 224 printf( 225 esc_html__( 'If you need transfer from airport to another destination, wich is not specified please call us at %s or send an e-mail to %s' ), 226 get_option( 'ns-airport-transfers-contact-phone' ), 227 get_option( 'ns-airport-transfers-contact-email' ) 228 ); ?></i> 224 229 <?php endif; ?> -
airport-transfers/tags/master/public/views/modal-error.php
r1725009 r2842501 5 5 <div class="modal-content"> 6 6 <div class="modal-header"> 7 <button type="button" class="close" data-dismiss="modal" aria-label="<? =airport_transfers_lang_e('close'); ?>"><span aria-hidden="true">×</span></button>8 <h4 class="modal-title" id="modal-error-title"><? =airport_transfers_lang_e('Error'); ?></h4>7 <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( 'Close', 'ns-airport-transfers' ); ?>"><span aria-hidden="true">×</span></button> 8 <h4 class="modal-title" id="modal-error-title"><?php esc_html_e( 'Error', 'ns-airport-transfers' ); ?></h4> 9 9 </div> 10 10 <div class="modal-body"> 11 11 <div class="box box-danger"> 12 <div class="box-body"> 12 <div class="box-body"> 13 13 <div class="row"> 14 14 <div class="col-xs-12"> … … 20 20 </div> 21 21 <div class="modal-footer"> 22 <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal"><? =airport_transfers_lang_e('close'); ?></button>22 <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal"><?php esc_html_e( 'Close', 'ns-airport-transfers' ); ?></button> 23 23 </div> 24 24 </div> -
airport-transfers/trunk/README.md
r1959832 r2842501 1 === Airport Transfers === 2 Contributors: atanasantonov 3 Receive orders for transfer with this simple plugin. Easy to install and configure for your needs. Unlimited airports. Polylang compatible and fully translatable! 4 Tags: transfer, airport, arrival, departure 5 Requires at least: 3.0.1 6 Tested up to: 5.0 7 Requires PHP: 5.6 8 Stable tag: trunk 9 License: GPLv2 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 1 # Airport Transfers 2 12 3 Special airport transfers form that delivers mail to an administrator with customer's data. 13 14 == Description ==15 16 Receive orders for transfer with this simple plugin. Easy to install and configure for your needs. Form is designed to serve as transfer order tool.17 4 18 The plugin has full localisation and internationalisation support. Polylang compatible! 19 5 Form is designed to serve as transfer order tool. Design is airport transfers ready. 6 7 The plugin has full l10n and i18n support. 8 20 9 There are several options like mails for the delivery and default settings. 21 22 == Installation == 10 11 = Features = 12 * Simple & Intuitive 13 * Flexible transfer reservation form 14 * Multiple emails can be used for notifications 15 16 ## Installation 23 17 24 18 Download and activate the plugin. The plugin works with shortcode: … … 33 27 34 28 After the settings are done and the shortcode is placed on the desired pages you are ready to operate. 35 36 == Frequently Asked Questions ==37 29 38 = Can I customize where the emails will be delivered? = 39 30 ## Screenshots 31 32  33 34  35 36 ## Frequently Asked Questions 37 38 ### Can I customize where the emails will be delivered? 39 40 40 Yes, you can add as many emails for delivery as you want. The only rule is that they must be comma separated. 41 41 42 = Can I place a custom contact information? = 43 42 ### Can I place a custom contact information? 43 44 44 Yes, you can place your phone/phones and email. 45 45 46 = Can I customize the destination country? = 47 46 ### Can I customize the destination country? 47 48 48 Yes, you can set any country you want. It can be a default one and as option in every page where the shorcode is placed. 49 49 50 = Can I switch between 12 and 24 hour format? = 51 50 ### Can I switch between 12 and 24 hour format? 51 52 52 Yes, you can choose default the format in the settings page and also as option in every page where the shorcode is placed.. 53 54 = Is there a limitation of airports number? = 55 53 54 ### Is there a limitation of airports number? 55 56 56 No, you can add as many airports in the dropdown as you wish. 57 58 = What about the number of request? = 59 57 58 ### What about the number of request? 59 60 60 There is no limitation. You can recieve as many orders as they are submitted. 61 61 62 = Is there a mandatory fields verification? = 63 62 ### Is there a mandatory fields verification? 63 64 64 Yes, the most important fields are validated twice - both on client's machine and on the server. Especially the email address. 65 65 66 = How can the customer understand that is missing something? = 67 66 ### How can the customer understand that is missing something? 67 68 68 There is a nice gentle modal window that is opened when mandatory field is empty. 69 69 70 == Screenshots == 71 72 1. This screen shows the settings page. 70 ## Changelog 73 71 74 2. This is the second screens shows the form in the page on frontend. 72 ### 1.1 73 * Security fixes. 75 74 76 == Donations == 77 78 If you like the plugin and it helps you to offer better services at your clients you can buy me a fruit! 79 80 (BTC) 1ATAnAsK2wwDGK6UKrUewJDWtZ6kgJXEYu 81 (LTC) LdoQwdNn2FQAap8QBYDP8H4TetGmhhx3vj 82 (ZEC) t1VXcnmXZPaEfXtkshmhBtWEHy1CHqETh1V 83 84 == Changelog == 85 86 = 1.0 = 75 ### 1.0 87 76 * First release. 88 77 * No changes. 89 90 == Upgrade Notice ==91 92 = 1.0 =93 94 No upgrades needed at this time. -
airport-transfers/trunk/admin/class-airport-transfers-admin.php
r1725009 r2842501 4 4 5 5 class NS_Airport_Transfers_Admin { 6 7 private static $initiated = FALSE;8 private static $class = 'NS_Airport_Transfers_Admin';9 public static $prefix = 'ns_admin_';10 public static $textdomain = 'ns-airport-transfers';11 public static $settings = 'ns-airport-transfers-group';12 6 13 public static function init() { 14 if(!self::$initiated) { 15 self::ns_admin_init_hooks(); 16 } 17 } 7 private static $initiated = FALSE; 8 public static $settings = 'ns-airport-transfers-group'; 18 9 19 /** 20 * Initializes WordPress hooks 21 */ 22 private static function ns_admin_init_hooks() { 23 add_action( 'admin_init', array( self::$class, self::$prefix.'init' ) ); 24 add_action( 'admin_init', array( self::$class, self::$prefix.'texts' ) ); 25 add_action( 'admin_menu', array( self::$class, self::$prefix.'menu' ) ); 26 add_action( 'admin_init', array( self::$class, self::$prefix.'register_settings' ) ); 27 28 self::$initiated = TRUE; 29 } 10 /** 11 * Init. 12 */ 13 public static function init() { 14 if( ! self::$initiated ) { 15 self::init_hooks(); 16 } 17 } 30 18 31 public static function ns_admin_init() {32 19 33 } 34 35 public static function ns_admin_menu() { 36 add_menu_page('Airport Transfers', 'Airport Transfers', 'edit_posts', self::$textdomain.'-settings', array( self::$class, self::$prefix.'settings_page' ),'dashicons-admin-generic'); 37 } 38 39 public static function ns_admin_register_settings() { 40 register_setting( self::$settings, 'ns-airport-transfers-admin-email' ); 41 register_setting( self::$settings, 'ns-airport-transfers-contact-email' ); 42 register_setting( self::$settings, 'ns-airport-transfers-contact-phone' ); 43 register_setting( self::$settings, 'ns-airport-transfers-country' ); 44 register_setting( self::$settings, 'ns-airport-transfers-resort' ); 45 register_setting( self::$settings, 'ns-airport-transfers-time-format' ); 46 } 47 48 public static function ns_admin_settings_page() { 49 require_once( plugin_dir_path(__FILE__) . 'views/settings-page.php' ); 50 } 20 /** 21 * Register hooks. 22 */ 23 private static function init_hooks() { 24 add_action( 'admin_init', array( '\NS_Airport_Transfers_Admin', 'init' ) ); 25 add_action( 'admin_menu', array( '\NS_Airport_Transfers_Admin', 'admin_menu' ) ); 26 add_action( 'admin_init', array( '\NS_Airport_Transfers_Admin', 'register_settings' ) ); 51 27 52 public static function ns_admin_texts() { 28 self::$initiated = TRUE; 29 } 53 30 54 // prepare the texts55 global $texts;56 31 57 foreach ($texts as $text) 58 { 59 __($text,self::$textdomain); 60 if(function_exists('pll_register_string')) 61 { 62 pll_register_string(__('Form elements',self::$textdomain), $text, 'Airport Transfers'); 63 } 64 } 65 } 66 67 // ajax form handler 68 public static function ns_admin_send() { 69 try { 70 // check post at all 71 if(empty($_POST)) { 72 throw new Exception(airport_transfers_lang('Incorrect data!')); 73 } 74 75 $post = $_POST; 32 /** 33 * Admin menu. 34 */ 35 public static function admin_menu() { 36 add_submenu_page( 37 'options-general.php', 38 'Airport Transfers', 39 'Airport Transfers', 40 'edit_posts', 41 'ns-airport-transfers-settings', 42 array( '\NS_Airport_Transfers_Admin', 'settings_page' ), 43 100 44 ); 45 } 76 46 77 78 $lang = sanitize_text_field($post['lang']);79 80 // check email81 $email = filter_var(sanitize_email($post['email']), FILTER_VALIDATE_EMAIL);82 if (!$email) {83 throw new Exception(airport_transfers_lang('Invalid email address!'));84 }85 86 // Subject87 $subject = airport_transfers_lang('Request');88 47 89 // Message 90 $message = ''; 91 92 // information 93 $message .= airport_transfers_lang('Your Name', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['name'])).PHP_EOL; 94 $message .= airport_transfers_lang('Email Address', $lang).": ".$email.PHP_EOL; 95 $message .= airport_transfers_lang('Mobile', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['phone'])).PHP_EOL; 96 $message .= airport_transfers_lang('I would like to', $lang).": ".sanitize_text_field($post['like_to']).PHP_EOL; 97 $message .= airport_transfers_lang('Transfer type', $lang).": ".airport_transfers_lang(sanitize_text_field($post['transfer_type']), $lang).PHP_EOL; 98 $message .= airport_transfers_lang('No. of adults', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['adults'])).PHP_EOL; 99 $message .= airport_transfers_lang('No. of children', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['children'])).PHP_EOL; 100 $message .= airport_transfers_lang('No. of koffers', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['koffers'])).PHP_EOL; 101 if(sanitize_text_field($post['resort'])==='winter') { 102 $message .= airport_transfers_lang('No. of ski/snowboards', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['ski'])).PHP_EOL; 103 } 104 105 $message .= PHP_EOL; 106 107 // transfer_type 108 $transfer_type = sanitize_text_field($post['transfer_type']); 109 110 // time format 111 $time_format = sanitize_text_field($post['time_format']); 112 113 // arrival 114 $post_arrival_us_time = sanitize_text_field($post['arrival_us_time']); 115 $arrival_us_time = ($time_format==='12'&&$post_arrival_us_time!=='') ? $post_arrival_us_time : ''; 116 if($transfer_type==='two_way' || $transfer_type==='from_airport') { 117 $message .= airport_transfers_lang('Date of arrival', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['arrival_date'])).PHP_EOL; 118 $message .= airport_transfers_lang('Time of arrival', $lang).": ".sanitize_text_field($post['arrival_hour']).':'.sanitize_text_field($post['arrival_minutes']).$arrival_us_time.PHP_EOL; 119 $message .= airport_transfers_lang('Airport', $lang).": ".sanitize_text_field($post['arrival_airport']).PHP_EOL; 120 $message .= airport_transfers_lang('Flight number', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['arrival_flight'])).PHP_EOL; 121 $message .= PHP_EOL; 122 } 123 124 // departure 125 $post_out_us_time = sanitize_text_field($post['out_us_time']); 126 $out_us_time = ($time_format==='12'&&$post_out_us_time!=='') ? $post_out_us_time : ''; 127 if($transfer_type==='two_way' || $transfer_type==='to_airport') { 128 $message .= airport_transfers_lang('Date of departure', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['out_date'])).PHP_EOL; 129 $message .= airport_transfers_lang('Time of departure', $lang).": ".sanitize_text_field($post['out_hour']).':'.sanitize_text_field($post['out_minutes']).$out_us_time.PHP_EOL; 130 $message .= airport_transfers_lang('Airport', $lang).": ".sanitize_text_field($post['out_airport']).PHP_EOL; 131 $message .= airport_transfers_lang('Flight number', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['out_flight'])).PHP_EOL; 132 $message .= PHP_EOL; 133 } 134 135 // address in destination country 136 $message .= airport_transfers_lang('Address in', $lang).' '.airport_transfers_lang(get_option('ns-airport-transfers-country'), $lang).PHP_EOL; 137 $message .= airport_transfers_lang('Address of hotel/accommodation', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['adress'])).PHP_EOL; 138 139 // instructions 140 $message .= airport_transfers_lang('Remarks/instructions', $lang).": ".airport_transfers_check_val(sanitize_text_field($post['instructions'])).PHP_EOL; 141 142 // Headers 143 $headers = 'MIME-Version: 1.0' . PHP_EOL; 144 $headers .= 'Content-type: text/plain; charset=utf-8' . PHP_EOL; 145 $headers .= 'Content-Transfer-Encoding: 7bit' . PHP_EOL; 146 $headers .= 'Message-ID: <' . time() . '-'. md5($email).'>' . PHP_EOL; 147 $headers .= 'From: '.get_option('blogname').' <'.get_option('admin_email').'>' . PHP_EOL; 148 $headers .= 'Return-Path: <'.get_option('admin_email').'>' . PHP_EOL; 149 150 // get administrative emails for the form 151 if(!mail(get_option('ns-airport-transfers-admin-email'), $subject, $message, $headers)) { 152 $error_message = 'Sending mail failed!'.PHP_EOL.PHP_EOL; 153 $error_message = 'Form message:'.PHP_EOL.PHP_EOL; 154 $error_message .= print_r($message,TRUE).PHP_EOL; 155 mail(get_option('admin_email'), 'Airport Transfers Plugin', $error_message, $headers); 156 throw new Exception(airport_transfers_lang('System Error!', $lang)); 157 } 158 159 $result['status'] = 'success'; 160 $result['data'] = airport_transfers_lang('Thank you for your submission! We will answer as soon as possible!', $lang); 161 162 } catch (Exception $e) { 163 $result['status'] = 'error'; 164 $result['data'] = $e->getMessage(); 165 } finally { 166 echo json_encode($result); 167 } 168 wp_die(); 169 } 48 /** 49 * Register settings. 50 */ 51 public static function register_settings() { 52 register_setting( self::$settings, 'ns-airport-transfers-admin-email' ); 53 register_setting( self::$settings, 'ns-airport-transfers-contact-email' ); 54 register_setting( self::$settings, 'ns-airport-transfers-contact-phone' ); 55 register_setting( self::$settings, 'ns-airport-transfers-country' ); 56 register_setting( self::$settings, 'ns-airport-transfers-resort' ); 57 register_setting( self::$settings, 'ns-airport-transfers-time-format' ); 58 } 59 60 61 /** 62 * Settings page. 63 */ 64 public static function settings_page() { 65 require_once( NS_AIRPORT_TRANSFERS_PATH . 'admin/views/settings-page.php' ); 66 } 170 67 } 171 68 -
airport-transfers/trunk/admin/views/settings-page.php
r1725009 r2842501 3 3 <div class="wrap"> 4 4 <h1>Airport Transfers</h1> 5 <p class="description"><span class="dashicons dashicons-admin-settings"></span> <?php e cho __('Styling and functionality settings',self::$textdomain); ?>.</p>5 <p class="description"><span class="dashicons dashicons-admin-settings"></span> <?php esc_html_e('Styling and functionality settings','ns-airport-transfers'); ?>.</p> 6 6 7 7 <form method="post" action="options.php"> 8 8 <?php settings_fields( self::$settings ); ?> 9 9 <?php do_settings_sections( self::$settings ); ?> 10 11 <table class="form-table"> 12 10 11 <table class="form-table"> 12 13 13 <tr> 14 <th scope="row"><?php e cho __('Admin email/emails',self::$textdomain); ?></th>14 <th scope="row"><?php esc_html_e('Admin email/emails','ns-airport-transfers'); ?></th> 15 15 <td> 16 16 <input type="text" name="ns-airport-transfers-admin-email" value="<?php echo esc_attr( get_option('ns-airport-transfers-admin-email') ); ?>" class="large-text" /> 17 <p class="description"><?php e cho __('Email/emails for delivery. Comma separated if more than one (admin1@example.com, admin2@example.com, ...)',self::$textdomain); ?></p>17 <p class="description"><?php esc_html_e('Email/emails for delivery. Comma separated if more than one (admin1@example.com, admin2@example.com, ...)','ns-airport-transfers'); ?></p> 18 18 <br><hr></td> 19 19 </tr> 20 20 21 21 <tr> 22 <th scope="row"><?php e cho __('Contact email',self::$textdomain); ?></th>22 <th scope="row"><?php esc_html_e('Contact email','ns-airport-transfers'); ?></th> 23 23 <td> 24 24 <input type="text" name="ns-airport-transfers-contact-email" value="<?php echo esc_attr( get_option('ns-airport-transfers-contact-email') ); ?>" class="large-text" /> 25 <p class="description"><?php e cho __('Contact email.',self::$textdomain); ?></p>25 <p class="description"><?php esc_html_e('Contact email.','ns-airport-transfers'); ?></p> 26 26 <br><hr></td> 27 27 </tr> 28 28 29 29 <tr> 30 <th scope="row"><?php e cho __('Contact phone/phones',self::$textdomain); ?></th>30 <th scope="row"><?php esc_html_e('Contact phone/phones','ns-airport-transfers'); ?></th> 31 31 <td> 32 32 <input type="text" name="ns-airport-transfers-contact-phone" value="<?php echo esc_attr( get_option('ns-airport-transfers-contact-phone') ); ?>" class="large-text" /> 33 <p class="description"><?php e cho __('Contact phone/phones.',self::$textdomain); ?></p>33 <p class="description"><?php esc_html_e('Contact phone/phones.','ns-airport-transfers'); ?></p> 34 34 <br><hr></td> 35 35 </tr> 36 36 37 37 <tr> 38 <th scope="row"><?php e cho __('Default destination country',self::$textdomain); ?></th>38 <th scope="row"><?php esc_html_e('Default destination country','ns-airport-transfers'); ?></th> 39 39 <td> 40 40 <input type="text" name="ns-airport-transfers-country" value="<?php echo esc_attr( get_option('ns-airport-transfers-country') ); ?>" /> 41 <p class="description"><?php e cho __('Set the country (also can be set in the shortcode [airport-transfers-form country="Earthsea"])',self::$textdomain); ?></p>41 <p class="description"><?php esc_html_e('Set the country (also can be set in the shortcode [airport-transfers-form country="Earthsea"])','ns-airport-transfers'); ?></p> 42 42 </td> 43 43 </tr> 44 44 45 45 <tr> 46 <th scope="row"><?php e cho __('Resort type',self::$textdomain); ?></th>46 <th scope="row"><?php esc_html_e('Resort type','ns-airport-transfers'); ?></th> 47 47 <td> 48 48 <select name="ns-airport-transfers-resort"> … … 54 54 <?php foreach ($options as $value => $name) : ?> 55 55 <?php $selected = ($format===$value) ? ' selected="selected"' : ''; ?> 56 <option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php e cho __($name,self::$textdomain); ?></option>56 <option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php esc_html_e($name,'ns-airport-transfers'); ?></option> 57 57 <?php endforeach; ?> 58 58 </select> 59 <p class="description"><?php e cho __('Select default resort type (also can be set in the shortcode [airport-transfers-form resort="summer/winter"])',self::$textdomain); ?></p>59 <p class="description"><?php esc_html_e('Select default resort type (also can be set in the shortcode [airport-transfers-form resort="summer/winter"])','ns-airport-transfers'); ?></p> 60 60 </td> 61 61 </tr> 62 62 63 63 <tr> 64 <th scope="row"><?php e cho __('Time format',self::$textdomain); ?></th>64 <th scope="row"><?php esc_html_e('Time format','ns-airport-transfers'); ?></th> 65 65 <td> 66 66 <select name="ns-airport-transfers-time-format"> … … 69 69 <?php foreach ($options as $option) : ?> 70 70 <?php $selected = ($format===$option) ? ' selected="selected"' : ''; ?> 71 <option value="<?php echo $option; ?>"<?php echo $selected; ?>><?php echo $option; ?> <?php e cho __('Hours',self::$textdomain); ?></option>71 <option value="<?php echo $option; ?>"<?php echo $selected; ?>><?php echo $option; ?> <?php esc_html_e('Hours','ns-airport-transfers'); ?></option> 72 72 <?php endforeach; ?> 73 73 </select> 74 <p class="description"><?php e cho __('Select default time-format (also can be set in the shortcode [airport-transfers-form time-format="24"])',self::$textdomain); ?></p>74 <p class="description"><?php esc_html_e('Select default time-format (also can be set in the shortcode [airport-transfers-form time-format="24"])','ns-airport-transfers'); ?></p> 75 75 </td> 76 76 </tr> -
airport-transfers/trunk/airport-transfers.php
r1725009 r2842501 1 <?php 1 <?php 2 2 /* 3 3 Plugin Name: Airport Transfers 4 Plugin URI: https://github.com/atanasantonov/ wordpress-plugins/tree/master/airport-transfers4 Plugin URI: https://github.com/atanasantonov/airport-transfers 5 5 Description: Plugin delivers multilingual form for airport transfers 6 Version: 1.06 Version: master 7 7 Author: Atanas Antonov 8 Author URI: http ://nantstudio.eu/8 Author URI: https://unax.org 9 9 License: GPL2 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 11 Text Domain: ns-airport-transfers 12 Domain Path: /languages 12 Domain Path: /languages/ 13 13 */ 14 14 15 15 defined( 'ABSPATH' ) or die( 'I can\'t do anything alone! Sorry!' ); 16 16 17 define( 'NS_AIRPORT_TRANSFERS_VERSION', 'master' ); 18 define( 'NS_AIRPORT_TRANSFERS_PATH', plugin_dir_path( __FILE__ ) ); 19 define( 'NS_AIRPORT_TRANSFERS_URL', plugins_url( '/', __FILE__ ) ); 20 21 load_plugin_textdomain('ns-airport-transfers', false, basename( dirname( __FILE__ ) ) . '/languages' ); 22 23 require_once( NS_AIRPORT_TRANSFERS_PATH . 'functions.php' ); 24 require_once( NS_AIRPORT_TRANSFERS_PATH . 'admin/class-airport-transfers-admin.php' ); 25 require_once( NS_AIRPORT_TRANSFERS_PATH . 'public/class-airport-transfers.php' ); 26 17 27 register_activation_hook( __FILE__, 'ns_airport_transfers_activate' ); 18 28 register_deactivation_hook( __FILE__, 'ns_airport_transfers_uninstall' ); 19 29 20 // add the options defaults 21 function ns_airport_transfers_activate() { 22 add_option( 'ns-airport-transfers-admin-email', get_option('admin_email')); // Admin email delivery and contact address 23 add_option( 'ns-airport-transfers-contact-email', '' ); // Contant email 24 add_option( 'ns-airport-transfers-contact-phone', '' ); // Contant phone 25 add_option( 'ns-airport-transfers-country', 'Earthsea' ); // Can be set in plugin's settings page or trough the shortcode 26 add_option( 'ns-airport-transfers-resort', 'summer' ); // Include ski field or not. Can be set in plugin's settings page or trough the shortcode 27 add_option( 'ns-airport-transfers-time-format', '24' ); // 12 or 24 Hours time format. Can be set in plugin's settings page or trough the shortcode 30 if ( is_admin() ) { 31 \NS_Airport_Transfers_Admin::init(); 32 add_action( 'init', array( '\NS_Airport_Transfers_Admin', 'init' ) ); 28 33 } 29 34 30 // delete the unnecessary options from the database 31 function ns_airport_transfers_uninstall() { 32 delete_option('ns-airport-transfers-admin-email'); 33 delete_option('ns-airport-transfers-contact-email'); 34 delete_option('ns-airport-transfers-contact-phone'); 35 delete_option('ns-airport-transfers-country'); 36 delete_option('ns-airport-transfers-resort'); 37 delete_option('ns-airport-transfers-time-format'); 38 } 39 40 load_plugin_textdomain('ns-airport-transfers', false, basename( dirname( __FILE__ ) ) . '/languages' ); 41 require_once( plugin_dir_path(__FILE__) . 'texts.php' ); 42 43 /** 44 * airport_transfers_lang 45 * 46 * returns translation of the string 47 * @param string $string - string to be translated 48 * @param string $lang - desired language 49 * Function check if Polylang plugin's 'pll_translate_string' function 50 * is available. If so the plugin's function will be used. Otherwise Wordpress translation system will be used. 51 */ 52 function airport_transfers_lang($string='',$lang=null) { 53 if(function_exists('pll_translate_string')) { 54 $string = isset($lang) ? pll_translate_string($string, $lang) : pll__($string); 55 } else { 56 $string = __($string, 'ns-airport-transfers'); 57 } 58 return $string; 59 } 60 61 /** 62 * airport_transfers_lang_e 63 * 64 * returns translation of the string with echo 65 * @param string $string - string to be translated 66 * @param string $lang - desired language 67 * same as airport_transfers_lang but with echo 68 */ 69 function airport_transfers_lang_e($string='',$lang=null) { 70 if(function_exists('pll_translate_string')) { 71 $string = isset($lang) ? pll_translate_string($string, $lang) : pll__($string); 72 } else { 73 $string = __($string, 'ns-airport-transfers'); 74 } 75 echo $string; 76 return; 77 } 78 79 /** 80 * airport_transfers_check_val 81 * 82 * returns '-' if param is empty string 83 * @param string $string 84 */ 85 function airport_transfers_check_val($string='') { 86 $string = ($string!='') ? $string : '-'; 87 return $string; 88 } 89 90 if (is_admin()) { 91 require_once( plugin_dir_path(__FILE__) . 'admin/class-airport-transfers-admin.php' ); 92 add_action( 'init', array( 'NS_Airport_Transfers_Admin', 'init' ) ); 93 94 // register ajax functions for the fronend 95 add_action( 'wp_ajax_send', array( 'NS_Airport_Transfers_Admin', 'ns_admin_send' )); 96 add_action( 'wp_ajax_nopriv_send', array( 'NS_Airport_Transfers_Admin', 'ns_admin_send' )); 97 } 98 else 99 { 100 function ns_enqueue_scripts() { 101 // load css 102 wp_enqueue_style( 'bootstrap', plugins_url('assets/bootstrap/css/bootstrap.min.css', __FILE__)); 103 wp_enqueue_style( 'jquery-ui', plugins_url('assets/jquery-ui/jquery-ui.min.css', __FILE__)); 104 wp_enqueue_style( 'ns-airport-transfers', plugins_url('assets/css/styles.css', __FILE__)); 105 106 // load scripts 107 wp_enqueue_script('jquery'); 108 wp_enqueue_script('jquery-ui-datepicker'); 109 wp_enqueue_script('bootstrap', plugins_url('assets/bootstrap/js/bootstrap.min.js', __FILE__ ),array('jquery')); 110 } 111 add_action( 'wp_enqueue_scripts','ns_enqueue_scripts'); 112 113 require_once( plugin_dir_path(__FILE__) . 'public/class-airport-transfers.php' ); 114 add_action( 'init', array( 'NS_Airport_Transfers', 'init' ) ); 115 } 35 \NS_Airport_Transfers::init(); -
airport-transfers/trunk/languages/ns-airport-transfers.pot
r1725009 r2842501 2 2 msgid "" 3 3 msgstr "" 4 "Project-Id-Version: PACKAGE VERSION\n"4 "Project-Id-Version: Airport Transfers\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 20 17-08-30 11:45+0000\n"6 "POT-Creation-Date: 2023-01-02 17:48+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 9 9 "Language-Team: \n" 10 10 "Language: \n" 11 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION \n"11 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 12 12 "MIME-Version: 1.0\n" 13 13 "Content-Type: text/plain; charset=UTF-8\n" 14 14 "Content-Transfer-Encoding: 8bit\n" 15 "X-Generator: Loco - https://localise.biz/" 15 "X-Generator: Loco https://localise.biz/\n" 16 "X-Loco-Version: 2.6.2; wp-6.0.3\n" 17 "X-Domain: ns-airport-transfers" 18 19 #: public/class-airport-transfers.php:190 public/views/form.php:197 20 msgid "Address in" 21 msgstr "" 22 23 #: public/class-airport-transfers.php:191 public/views/form.php:202 24 msgid "Address of hotel/accommodation" 25 msgstr "" 26 27 #: admin/views/settings-page.php:14 28 msgid "Admin email/emails" 29 msgstr "" 30 31 #: public/views/form.php:80 32 msgid "After arrival" 33 msgstr "" 34 35 #: public/class-airport-transfers.php:173 36 #: public/class-airport-transfers.php:184 public/views/form.php:117 37 #: public/views/form.php:175 38 msgid "Airport" 39 msgstr "" 40 41 #. Name of the plugin 42 msgid "Airport Transfers" 43 msgstr "" 44 45 #. Author of the plugin 46 msgid "Atanas Antonov" 47 msgstr "" 48 49 #: public/views/modal-error.php:7 public/views/modal-error.php:22 50 msgid "Close" 51 msgstr "" 52 53 #: admin/views/settings-page.php:22 54 msgid "Contact email" 55 msgstr "" 56 57 #: admin/views/settings-page.php:25 58 msgid "Contact email." 59 msgstr "" 60 61 #: admin/views/settings-page.php:30 62 msgid "Contact phone/phones" 63 msgstr "" 64 65 #: admin/views/settings-page.php:33 66 msgid "Contact phone/phones." 67 msgstr "" 68 69 #: public/class-airport-transfers.php:171 public/views/form.php:83 70 msgid "Date of arrival" 71 msgstr "" 72 73 #: public/class-airport-transfers.php:182 public/views/form.php:141 74 msgid "Date of departure" 75 msgstr "" 76 77 #: admin/views/settings-page.php:38 78 msgid "Default destination country" 79 msgstr "" 80 81 #: public/class-airport-transfers.php:56 public/class-airport-transfers.php:148 82 msgid "Email Address" 83 msgstr "" 84 85 #: public/views/form.php:18 86 msgid "Email address" 87 msgstr "" 88 89 #: admin/views/settings-page.php:17 90 msgid "" 91 "Email/emails for delivery. Comma separated if more than one (admin1@example." 92 "com, admin2@example.com, ...)" 93 msgstr "" 94 95 #: public/views/modal-error.php:8 96 msgid "Error" 97 msgstr "" 98 99 #: public/class-airport-transfers.php:174 100 #: public/class-airport-transfers.php:185 public/views/form.php:129 101 #: public/views/form.php:187 102 msgid "Flight number" 103 msgstr "" 104 105 #: public/views/form.php:46 public/views/form.php:80 106 msgid "From airport" 107 msgstr "" 108 109 #: public/views/form.php:93 public/views/form.php:151 110 msgid "Hour" 111 msgstr "" 112 113 #: admin/views/settings-page.php:71 114 msgid "Hours" 115 msgstr "" 116 117 #. URI of the plugin 118 msgid "https://github.com/atanasantonov/airport-transfers" 119 msgstr "" 120 121 #. Author URI of the plugin 122 msgid "https://unax.org" 123 msgstr "" 124 125 #: public/class-airport-transfers.php:150 public/views/form.php:34 126 msgid "I would like to" 127 msgstr "" 128 129 #: public/class-airport-transfers.php:131 130 msgid "Incorrect data!" 131 msgstr "" 132 133 #: public/views/form.php:8 134 msgid "Information about you" 135 msgstr "" 136 137 #: public/class-airport-transfers.php:137 138 msgid "Invalid email address!" 139 msgstr "" 140 141 #: public/views/form.php:29 142 msgid "It's mandatory to input your phone number" 143 msgstr "" 144 145 #: public/views/form.php:4 146 msgid "Javascript must be enabled!" 147 msgstr "" 148 149 #: public/views/form.php:138 150 msgid "Leaving" 151 msgstr "" 152 153 #: public/views/form.php:36 154 msgid "Make reservation" 155 msgstr "" 156 157 #: public/class-airport-transfers.php:58 158 msgid "Mandatory Field" 159 msgstr "" 160 161 #: public/views/form.php:101 public/views/form.php:159 162 msgid "Min" 163 msgstr "" 164 165 #: public/class-airport-transfers.php:57 public/class-airport-transfers.php:149 166 #: public/views/form.php:26 167 msgid "Mobile" 168 msgstr "" 169 170 #: public/class-airport-transfers.php:152 public/views/form.php:53 171 msgid "No. of adults" 172 msgstr "" 173 174 #: public/class-airport-transfers.php:153 public/views/form.php:58 175 msgid "No. of children" 176 msgstr "" 177 178 #: public/class-airport-transfers.php:154 public/views/form.php:65 179 msgid "No. of koffers" 180 msgstr "" 181 182 #: public/class-airport-transfers.php:156 public/views/form.php:71 183 msgid "No. of ski/snowboards" 184 msgstr "" 185 186 #: public/views/form.php:21 187 msgid "On this Email you will recieve confirmation" 188 msgstr "" 189 190 #: public/views/form.php:46 public/views/form.php:47 191 msgid "One way" 192 msgstr "" 193 194 #. Description of the plugin 195 msgid "Plugin delivers multilingual form for airport transfers" 196 msgstr "" 197 198 #: public/class-airport-transfers.php:194 public/views/form.php:211 199 msgid "Remarks/instructions" 200 msgstr "" 201 202 #: public/class-airport-transfers.php:141 203 msgid "Request" 204 msgstr "" 205 206 #: public/views/form.php:37 207 msgid "Request more information" 208 msgstr "" 209 210 #: admin/views/settings-page.php:46 211 msgid "Resort type" 212 msgstr "" 213 214 #: public/views/form.php:120 public/views/form.php:178 215 msgid "select" 216 msgstr "" 217 218 #: admin/views/settings-page.php:59 219 msgid "" 220 "Select default resort type (also can be set in the shortcode [airport-" 221 "transfers-form resort=\"summer/winter\"])" 222 msgstr "" 223 224 #: admin/views/settings-page.php:74 225 msgid "" 226 "Select default time-format (also can be set in the shortcode [airport-" 227 "transfers-form time-format=\"24\"])" 228 msgstr "" 229 230 #: public/views/form.php:217 231 msgid "Send" 232 msgstr "" 233 234 #: admin/views/settings-page.php:41 235 msgid "" 236 "Set the country (also can be set in the shortcode [airport-transfers-form " 237 "country=\"Earthsea\"])" 238 msgstr "" 239 240 #: admin/views/settings-page.php:5 241 msgid "Styling and functionality settings" 242 msgstr "" 243 244 #: public/class-airport-transfers.php:59 245 msgid "System Error" 246 msgstr "" 247 248 #: public/class-airport-transfers.php:206 249 msgid "System Error!" 250 msgstr "" 251 252 #: public/class-airport-transfers.php:210 253 msgid "Thank you for your submission! We will answer as soon as possible!" 254 msgstr "" 255 256 #: admin/views/settings-page.php:64 257 msgid "Time format" 258 msgstr "" 259 260 #: public/class-airport-transfers.php:172 public/views/form.php:90 261 msgid "Time of arrival" 262 msgstr "" 263 264 #: public/class-airport-transfers.php:183 public/views/form.php:148 265 msgid "Time of departure" 266 msgstr "" 267 268 #: public/views/form.php:47 public/views/form.php:138 269 msgid "To airport" 270 msgstr "" 271 272 #: public/class-airport-transfers.php:151 public/views/form.php:42 273 msgid "Transfer type" 274 msgstr "" 275 276 #: public/views/form.php:45 277 msgid "Two way" 278 msgstr "" 279 280 #: public/class-airport-transfers.php:55 public/class-airport-transfers.php:147 281 msgid "Your Name" 282 msgstr "" 283 284 #: public/views/form.php:11 285 msgid "Your name" 286 msgstr "" -
airport-transfers/trunk/public/class-airport-transfers.php
r1725009 r2842501 1 1 <?php defined( 'ABSPATH' ) or die( 'I can\'t do anything alone! Sorry!' ); 2 2 3 if( !class_exists('NS_Airport_Transfers') ) { 4 5 class NS_Airport_Transfers { 6 7 private static $initiated = false; 8 9 private static $class = 'NS_Airport_Transfers'; 10 public static $textdomain = 'ns-airport-transfers'; 11 public static $prefix = 'ns_'; 12 13 public static function init() { 14 if ( !self::$initiated ) { 15 self::init_hooks(); 16 } 3 if( ! class_exists( 'NS_Airport_Transfers' ) ) { 4 5 class NS_Airport_Transfers { 6 7 private static $initiated = false; 8 9 /** 10 * Init. 11 */ 12 public static function init() { 13 if( ! self::$initiated ) { 14 self::init_hooks(); 15 } 16 } 17 18 19 /** 20 * Register hooks. 21 */ 22 private static function init_hooks() { 23 // Enqueue scripts. 24 add_action( 'wp_enqueue_scripts', array( '\NS_Airport_Transfers', 'enqueue_scripts' ) ); 25 26 // Register ajax functions for the fronend. 27 add_action( 'wp_ajax_send', array( '\NS_Airport_Transfers', 'send' ) ); 28 add_action( 'wp_ajax_nopriv_send', array( '\NS_Airport_Transfers', 'send' ) ); 29 30 // Shortcodes. 31 add_shortcode('airport-transfers-form', array( '\NS_Airport_Transfers', 'form' ) ); 32 33 self::$initiated = true; 34 } 35 36 37 /** 38 * Enqueue scripts. 39 */ 40 public static function enqueue_scripts() { 41 // Load css. 42 wp_enqueue_style( 'bootstrap', NS_AIRPORT_TRANSFERS_URL . 'assets/bootstrap/css/bootstrap.min.css', array(), '3.3.7' ); 43 wp_enqueue_style( 'jquery-ui', NS_AIRPORT_TRANSFERS_URL . 'assets/jquery-ui/jquery-ui.min.css', array(), '1.12.1' ); 44 wp_enqueue_style( 'ns-airport-transfers', NS_AIRPORT_TRANSFERS_URL . 'assets/css/styles.css', array( 'bootstrap', 'jquery-ui' ), NS_AIRPORT_TRANSFERS_VERSION ); 45 46 // Load scripts. 47 wp_enqueue_script( 'bootstrap', NS_AIRPORT_TRANSFERS_URL . 'assets/bootstrap/js/bootstrap.min.js', array( 'jquery', 'jquery-ui-datepicker' ), '3.3.7', true ); 48 wp_enqueue_script( 'ns-airport-transfers', NS_AIRPORT_TRANSFERS_URL . 'assets/js/index.js', array( 'bootstrap' ), NS_AIRPORT_TRANSFERS_VERSION, true ); 49 wp_localize_script( 50 'ns-airport-transfers', 51 'nsAirportTransfers', 52 array( 53 'adminUrl' => admin_url( 'admin-ajax.php' ), 54 'texts' => array( 55 'yourName' => esc_html__( 'Your Name', 'ns-airport-transfers' ), 56 'emailAddress' => esc_html__( 'Email Address', 'ns-airport-transfers' ), 57 'mobile' => esc_html__( 'Mobile', 'ns-airport-transfers' ), 58 'MandatoryField' => esc_html__( 'Mandatory Field', 'ns-airport-transfers' ), 59 'SystemError' => esc_html__( 'System Error', 'ns-airport-transfers' ), 60 ) 61 ) 62 ); 63 } 64 65 66 /** 67 * Main function to display and process the form. 68 * 69 * Option provided are: 70 * resort - if summer [no. of ski] field is skipped, 71 * country - concatenated with [Addres in] label, default is [add country option please] 72 * time-format - if 12 we use the 12 Hour format, default is 24 73 * 74 * @param array $atts Array of options. 75 * @param sring $content Content provides comma separeted airports for the dropdown, default is one option [add Airports in content please]. 76 * 77 * @return string 78 */ 79 public static function form( $atts, $content = '' ) { 80 81 $params = shortcode_atts( array( 82 'resort' => get_option( 'ns-airport-transfers-resort' ), 83 'time-format' => get_option( 'ns-airport-transfers-time-format' ), 84 'show-contacts' => '1' 85 ), $atts ); 86 87 // Adjust dropdowns depending on Time format (12 or 24 Hours). 88 if( strtolower( $params['time-format']) === '12' ) : 89 for($i=1; $i<=12; $i++) : 90 $hours[] = strval($i); 91 endfor; 92 $am_pm = '<option>AM/PM</option> 93 <option value="AM">AM</option> 94 <option value="PM">PM</option>'; 95 else : 96 for($i=0; $i<=23; $i++) : 97 $hours[] = ($i<10) ? '0' . strval($i) : strval($i); 98 endfor; 99 $am_pm = FALSE; 100 endif; 101 102 // Adjust minutes dropdown. 103 for($i=0; $i<=55; $i++) : 104 if($i%5===0) : 105 $minutes[] = ($i<10) ? '0' . strval($i) : strval($i); 106 endif; 107 endfor; 108 109 // Process the content from the shortcode. 110 $options = explode(",", $content); 111 $options = (sizeof($options)>0) ? $options : array(); 112 113 array_map( 'trim', $options ); 114 115 ob_start(); 116 117 require_once( NS_AIRPORT_TRANSFERS_PATH . 'public/views/form.php' ); 118 require_once( NS_AIRPORT_TRANSFERS_PATH . 'public/views/modal-error.php' ); 119 120 return ob_get_clean(); 121 } 122 123 124 /** 125 * Ajax form handler. 126 */ 127 public static function send() { 128 try { 129 // Check post at all. 130 if( empty( $_POST ) ) { 131 throw new \Exception( esc_html__( 'Incorrect data!', 'ns-airport-transfers' ) ); 132 } 133 134 // Check email. 135 $email = filter_var( sanitize_email( $_POST['email'] ), FILTER_VALIDATE_EMAIL ); 136 if ( ! $email ) { 137 throw new \Exception(esc_html__( 'Invalid email address!', 'ns-airport-transfers' ) ); 138 } 139 140 // Subject. 141 $subject = esc_html__( 'Request', 'ns-airport-transfers' ); 142 143 // Message. 144 $message = ''; 145 146 // Information. 147 $message .= esc_html__( 'Your Name', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['name'] ) ) . PHP_EOL; 148 $message .= esc_html__( 'Email Address', 'ns-airport-transfers' ).": " . $email . PHP_EOL; 149 $message .= esc_html__( 'Mobile', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field($_POST['phone'] ) ) . PHP_EOL; 150 $message .= esc_html__( 'I would like to', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['like_to'] ) . PHP_EOL; 151 $message .= esc_html__( 'Transfer type', 'ns-airport-transfers' ).": " . sanitize_text_field( $_POST['transfer_type'] ) . PHP_EOL; 152 $message .= esc_html__( 'No. of adults', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['adults'] ) ) . PHP_EOL; 153 $message .= esc_html__( 'No. of children', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['children'] ) ) . PHP_EOL; 154 $message .= esc_html__( 'No. of koffers', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['koffers'] ) ) . PHP_EOL; 155 if(sanitize_text_field( $_POST['resort'])==='winter' ) { 156 $message .= esc_html__( 'No. of ski/snowboards', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field($_POST['ski'] ) ) . PHP_EOL; 157 } 158 159 $message .= PHP_EOL; 160 161 // transfer_type 162 $transfer_type = sanitize_text_field( $_POST['transfer_type'] ); 163 164 // time format 165 $time_format = sanitize_text_field( $_POST['time_format']); 166 167 // arrival 168 $post_arrival_us_time = sanitize_text_field( $_POST['arrival_us_time']); 169 $arrival_us_time = ($time_format==='12'&&$post_arrival_us_time!=='') ? $post_arrival_us_time : ''; 170 if($transfer_type==='two_way' || $transfer_type==='from_airport') { 171 $message .= esc_html__( 'Date of arrival', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['arrival_date'] ) ) . PHP_EOL; 172 $message .= esc_html__( 'Time of arrival', 'ns-airport-transfers' ).": " . sanitize_text_field( $_POST['arrival_hour'] ) . ':' . sanitize_text_field( $_POST['arrival_minutes']).$arrival_us_time . PHP_EOL; 173 $message .= esc_html__( 'Airport', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['arrival_airport'] ) . PHP_EOL; 174 $message .= esc_html__( 'Flight number', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['arrival_flight'] ) ) . PHP_EOL; 175 $message .= PHP_EOL; 176 } 177 178 // departure 179 $post_out_us_time = sanitize_text_field( $_POST['out_us_time'] ); 180 $out_us_time = ($time_format==='12'&&$post_out_us_time!=='') ? $post_out_us_time : ''; 181 if($transfer_type==='two_way' || $transfer_type==='to_airport') { 182 $message .= esc_html__( 'Date of departure', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['out_date'])) . PHP_EOL; 183 $message .= esc_html__( 'Time of departure', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['out_hour']).':'.sanitize_text_field( $_POST['out_minutes']).$out_us_time . PHP_EOL; 184 $message .= esc_html__( 'Airport', 'ns-airport-transfers' ).": ".sanitize_text_field( $_POST['out_airport']) . PHP_EOL; 185 $message .= esc_html__( 'Flight number', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['out_flight'])) . PHP_EOL; 186 $message .= PHP_EOL; 187 } 188 189 // address in destination country 190 $message .= esc_html__( 'Address in', 'ns-airport-transfers' ).' '.esc_html__( get_option( 'ns-airport-transfers-country' ), 'ns-airport-transfers' ) . PHP_EOL; 191 $message .= esc_html__( 'Address of hotel/accommodation', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['adress'])) . PHP_EOL; 192 193 // instructions 194 $message .= esc_html__( 'Remarks/instructions', 'ns-airport-transfers' ).": " . airport_transfers_check_val( sanitize_text_field( $_POST['instructions'])) . PHP_EOL; 195 196 // Headers 197 $headers = 'MIME-Version: 1.0' . PHP_EOL; 198 $headers .= 'Content-type: text/plain; charset=utf-8' . PHP_EOL; 199 $headers .= 'Content-Transfer-Encoding: 7bit' . PHP_EOL; 200 $headers .= 'Message-ID: <' . time() . '-'. md5($email).'>' . PHP_EOL; 201 $headers .= 'From: '.get_option('blogname').' <'.get_option('admin_email').'>' . PHP_EOL; 202 $headers .= 'Return-Path: <'.get_option('admin_email').'>' . PHP_EOL; 203 204 // get administrative emails for the form 205 if( ! wp_mail( get_option('ns-airport-transfers-admin-email'), $subject, $message, $headers ) ) { 206 throw new \Exception(esc_html__( 'System Error!', 'ns-airport-transfers' )); 207 } 208 209 $result['status'] = 'success'; 210 $result['data'] = esc_html__( 'Thank you for your submission! We will answer as soon as possible!', 'ns-airport-transfers' ); 211 212 } catch (Exception $e) { 213 $result['status'] = 'error'; 214 $result['data'] = $e->getMessage(); 215 216 $error_message = 'Sending mail failed!'.PHP_EOL . PHP_EOL; 217 $error_message .= 'Form message:'.PHP_EOL . PHP_EOL; 218 $error_message .= print_r($e->getMessage(),TRUE) . PHP_EOL; 219 220 wp_mail( get_option('admin_email'), 'Airport Transfers Error', $error_message, $headers ); 221 } finally { 222 echo json_encode($result); 223 } 224 wp_die(); 225 } 226 17 227 } 18 19 /**20 * Initializes WordPress hooks21 */22 private static function init_hooks() {23 // add javascript for the form24 add_action('wp_footer', array(self::$class, self::$prefix.'form_js'));25 // form shortcode26 add_shortcode('airport-transfers-form', array(self::$class, self::$prefix.'form'));27 self::$initiated = true;28 }29 30 31 public static function ns_form_js() { ?>32 <script type="text/javascript">33 34 jQuery(document).ready(function($) {35 36 var prefix = '#ns-airport-transfer-form ';37 38 // load datepicker39 if((prefix+".date").length > 0 ){40 $(prefix+".date" ).datepicker();41 }42 43 $(prefix+'#transfer_type').on('change', function(){44 let val= $(prefix+'#transfer_type option:selected').val();45 if(val==='from_airport') {46 $(prefix+"#arrival").css('display','block');47 $(prefix+"#departure").css('display','none');48 } else if(val==='to_airport') {49 $(prefix+"#arrival").css('display','none');50 $(prefix+"#departure").css('display','block');51 } else {52 $(prefix+"#arrival").css('display','block');53 $(prefix+"#departure").css('display','block');54 }55 });56 57 58 $(prefix+'#submit').on('click', function(){59 60 if(!ns_form_validate(prefix+'#name','<?=airport_transfers_lang_e('Your Name')?>')) {61 return;62 }63 64 if(!ns_form_validate(prefix+'#email','<?=airport_transfers_lang_e('Email Address')?>')) {65 return;66 }67 68 if(!ns_form_validate(prefix+'#phone','<?=airport_transfers_lang_e('Mobile')?>')) {69 return;70 }71 72 $('body').last('div').after('<div id="loading" class="loading"></div>');73 74 $.post( '<?=admin_url('admin-ajax.php?action=send')?>', {75 76 // form data77 lang: '<?php echo function_exists('pll_current_language')?pll_current_language('locale'):get_locale(); ?>',78 resort: $(prefix+"#resort").val(),79 time_format: $(prefix+"#time_format").val(),80 81 // personal data82 name: $(prefix+"#name").val(),83 email: $(prefix+"#email").val(),84 phone: $(prefix+"#phone").val(),85 like_to: $(prefix+'input[name=like_to]:checked').val(),86 transfer_type: $(prefix+"#transfer_type option:selected").val(),87 adults: $(prefix+"#adults").val(),88 children: $(prefix+"#children").val(),89 koffers: $(prefix+"#koffers").val(),90 ski: ($(prefix+"#ski").length>0) ? $("#ski").val() : '',91 92 // arrival data93 arrival_date: $(prefix+"#arrival_date").val(),94 arrival_hour: $(prefix+"#arrival_hour option:selected").val(),95 arrival_minutes: $(prefix+"#arrival_minutes option:selected").val(),96 arrival_us_time: ($(prefix+"#arrival_us_time").length>0) ? $("#arrival_us_time option:selected").val() : '',97 arrival_airport: $(prefix+"#arrival_airport option:selected").val(),98 arrival_flight: $(prefix+"#arrival_flight").val(),99 100 // departure data101 out_date: $(prefix+"#out_date").val(),102 out_hour: $(prefix+"#out_hour option:selected").val(),103 out_minutes: $(prefix+"#out_minutes option:selected").val(),104 out_us_time: ($(prefix+"#out_us_time").length>0) ? $("#out_us_time option:selected").val() : '',105 out_airport: $(prefix+"#out_airport option:selected").val(),106 out_flight: $(prefix+"#out_flight").val(),107 108 // address and instructions109 adress: $(prefix+"#adress").val(),110 instructions: $(prefix+"#instructions").val()111 }).done(function(data) {112 let response = $.parseJSON(data);113 if(response.status==='error') {114 $('#modal-error-message').text(response.data);115 $('#modal-error').modal();116 return;117 }118 119 $('html, body').animate({120 scrollTop: $(".main-container").offset().top121 }, 500);122 123 setTimeout(function(){124 $("#ns-airport-transfer-form").empty();125 $("#ns-airport-transfer-form").html('<h3 class="text-success">'+response.data+'</h3>');126 },500);127 }).fail(function() {128 $('#modal-error-message').text('<?=airport_transfers_lang_e('System Error!')?>');129 $('#modal-error').modal();130 })131 .always(function() {132 $("#loading").remove();133 });134 });135 136 function ns_form_validate(el,message) {137 if($(el).val()==='') {138 $('html, body').animate({139 scrollTop: $(".main-container").offset().top140 }, 500);141 $('#modal-error-message').text('<?=airport_transfers_lang_e('Please input')?> '+message);142 $('#modal-error').modal();143 return false;144 }145 return true;146 }147 148 });149 150 </script>151 <?php }152 153 /**154 * Main function to display and process the form155 *156 * option provided are:157 * resort - if summer [no. of ski] field is skipped,158 * country - concatenated with [Addres in] label, default is [add country option please]159 * time-format - if 12 we use the 12 Hour format, default is 24160 *161 * content provides comma separeted airports for the dropdown, default is one option [add Airports in content please]162 */163 public static function ns_form($atts, $content = '') {164 165 $params = shortcode_atts( array(166 'resort' => get_option('ns-airport-transfers-resort'),167 'time-format' => get_option('ns-airport-transfers-time-format'),168 'show-contacts' => 'true'169 ), $atts);170 171 // adjust dropdowns depending on Time format (12 or 24 Hours)172 if(strtolower($params['time-format'])==='12') :173 for($i=1; $i<=12; $i++) :174 $hours[] = strval($i);175 endfor;176 $am_pm = '<option>AM/PM</option>177 <option value="AM">AM</option>178 <option value="PM">PM</option>';179 else :180 for($i=0; $i<=23; $i++) :181 $hours[] = ($i<10) ? '0' . strval($i) : strval($i);182 endfor;183 $am_pm = FALSE;184 endif;185 186 // adjust minutes dropdown187 for($i=0; $i<=55; $i++) :188 if($i%5===0) :189 $minutes[] = ($i<10) ? '0' . strval($i) : strval($i);190 endif;191 endfor;192 193 // process the content from the shortcode194 $options = explode(",", $content);195 $options = (sizeof($options)>0) ? $options : array();196 197 ob_start();198 require_once( plugin_dir_path(__FILE__) . 'views/form.php' );199 require_once( plugin_dir_path(__FILE__) . 'views/modal-error.php' );200 return ob_get_clean();201 }202 203 } // class ends here204 228 } 205 -
airport-transfers/trunk/public/views/form.php
r1725009 r2842501 2 2 3 3 <form id="ns-airport-transfer-form" action="<?=get_permalink()?>" class="form-horizontal" method="post" accept-charset="utf-8"> 4 <noscript><? =airport_transfers_lang_e('Javascript must be enabled!');?></noscript><br><br>4 <noscript><?php esc_html_e( 'Javascript must be enabled!', 'ns-airport-transfers' ); ?></noscript><br><br> 5 5 <input type="hidden" id="resort" value="<?=$params['resort']?>"> 6 6 <input type="hidden" id="time_format" value="<?=$params['time-format']?>"> 7 7 8 <h4 class="text-success"><? =airport_transfers_lang_e('Information about you');?></h4>9 10 <div class="form-group"> 11 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Your name');?><span class="text-danger">*</span></label>8 <h4 class="text-success"><?php esc_html_e( 'Information about you', 'ns-airport-transfers' ); ?></h4> 9 10 <div class="form-group"> 11 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Your name', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 12 12 <div class="col-sm-8 col-xs-12"> 13 13 <input type="text" id="name" class="form-control" value="" placeholder=""> … … 16 16 <div class="clear"><br></div> 17 17 <div class="form-group"> 18 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Email address');?><span class="text-danger">*</span></label>18 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Email address', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 19 19 <div class="col-sm-8 col-xs-12"> 20 20 <input type="text" id="email" class="form-control" value="" placeholder=""> 21 <span class="explanation">(<? =airport_transfers_lang_e('On this Email you will recieve confirmation');?>)</span>22 </div> 23 </div> 24 <div class="clear"></div> 25 <div class="form-group"> 26 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Mobile');?><span class="text-danger">*</span></label>21 <span class="explanation">(<?php esc_html_e( 'On this Email you will recieve confirmation', 'ns-airport-transfers' ); ?>)</span> 22 </div> 23 </div> 24 <div class="clear"></div> 25 <div class="form-group"> 26 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Mobile', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 27 27 <div class="col-sm-8 col-xs-12"> 28 28 <input type="text" id="phone" class="form-control" value="" placeholder=""> 29 <span class="explanation">(<? =airport_transfers_lang_e('It\'s mandatory to input your phone number');?>)</span>30 </div> 31 </div> 32 <div class="clear"></div> 33 <div class="form-group"> 34 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('I would like to');?>:<span class="text-danger">*</span></label>35 <div class="col-sm-8 col-xs-12"> 36 <input type="radio" name="like_to" value="<? =airport_transfers_lang_e('Make reservation');?>" checked> <?=airport_transfers_lang_e('Make reservation');?><br>37 <input type="radio" name="like_to" value="<? =airport_transfers_lang_e('Request more information');?>"> <?=airport_transfers_lang_e('Request more information');?>38 </div> 29 <span class="explanation">(<?php esc_html_e( 'It\'s mandatory to input your phone number', 'ns-airport-transfers' ); ?>)</span> 30 </div> 31 </div> 32 <div class="clear"></div> 33 <div class="form-group"> 34 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'I would like to', 'ns-airport-transfers' ); ?>:<span class="text-danger">*</span></label> 35 <div class="col-sm-8 col-xs-12"> 36 <input type="radio" name="like_to" value="<?php esc_html_e( 'Make reservation', 'ns-airport-transfers' ); ?>" checked> <?php esc_html_e( 'Make reservation', 'ns-airport-transfers' ); ?><br> 37 <input type="radio" name="like_to" value="<?php esc_html_e( 'Request more information', 'ns-airport-transfers' ); ?>"> <?php esc_html_e( 'Request more information', 'ns-airport-transfers' ); ?> 38 </div> 39 39 </div><hr> 40 40 <div class="clear"></div> 41 41 <div class="form-group"> 42 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Transfer type');?><span class="text-danger">*</span></label>42 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Transfer type', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 43 43 <div class="col-sm-8 col-xs-12"> 44 44 <select id="transfer_type" class="form-control"> 45 <option value="two_way"><? =airport_transfers_lang_e('Two way');?></option>46 <option value="from_airport"><? =airport_transfers_lang_e('One way');?> (<?=airport_transfers_lang_e('From airport');?>)</option>47 <option value="to_airport"><? =airport_transfers_lang_e('One way');?> (<?=airport_transfers_lang_e('To airport');?>)</option>45 <option value="two_way"><?php esc_html_e( 'Two way', 'ns-airport-transfers' ); ?></option> 46 <option value="from_airport"><?php esc_html_e( 'One way', 'ns-airport-transfers' ); ?> (<?php esc_html_e( 'From airport', 'ns-airport-transfers' ); ?>)</option> 47 <option value="to_airport"><?php esc_html_e( 'One way', 'ns-airport-transfers' ); ?> (<?php esc_html_e( 'To airport', 'ns-airport-transfers' ); ?>)</option> 48 48 </select> 49 49 </div> … … 51 51 <div class="clear"></div><br> 52 52 <div class="form-group"> 53 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of adults');?><span class="text-danger">*</span></label>53 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of adults', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 54 54 <div class="col-md-2 col-sm-2 col-xs-4"> 55 55 <input type="text" id="adults" class="form-control" value="" placeholder=""> 56 </div> 57 58 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of children');?><span class="text-danger">*</span></label>56 </div> 57 58 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of children', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 59 59 <div class="col-md-2 col-sm-2 col-xs-4"> 60 60 <input type="text" id="children" class="form-control" value="" placeholder=""> … … 62 62 </div> 63 63 <div class="clear"></div><br> 64 <div class="form-group"> 65 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of koffers');?><span class="text-danger">*</span></label>64 <div class="form-group"> 65 <label class="col-md-4 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of koffers', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 66 66 <div class="col-md-2 col-sm-2 col-xs-4"> 67 67 <input type="text" id="koffers" class="form-control" value="" placeholder=""> 68 </div> 69 68 </div> 69 70 70 <?php if(strtolower($params['resort'])==='winter') : ?> 71 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('No. of ski/snowboards');?><span class="text-danger">*</span></label>71 <label class="col-md-3 col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'No. of ski/snowboards', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 72 72 <div class="col-md-2 col-sm-2 col-xs-4"> 73 73 <input type="text" id="ski" class="form-control" value="" placeholder=""> 74 </div> 74 </div> 75 75 <?php endif; ?> 76 76 </div> 77 77 <div class="clear"></div><hr> 78 78 79 79 <div id="arrival"> 80 <h4><span class="text-success"><? =airport_transfers_lang_e('After arrival');?></span> <span class="small">(<?=airport_transfers_lang_e('From airport');?>)</span></h4>81 82 <div class="form-group"> 83 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Date of arrival');?><span class="text-danger">*</span></label>80 <h4><span class="text-success"><?php esc_html_e( 'After arrival', 'ns-airport-transfers' ); ?></span> <span class="small">(<?php esc_html_e( 'From airport', 'ns-airport-transfers' ); ?>)</span></h4> 81 82 <div class="form-group"> 83 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Date of arrival', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 84 84 <div class="col-sm-3 col-xs-4"> 85 85 <input type="text" id="arrival_date" value="" class="date form-control" placeholder=""> … … 88 88 <div class="clear"></div><br> 89 89 <div class="form-group"> 90 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Time of arrival');?><span class="text-danger">*</span></label>90 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Time of arrival', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 91 91 <div class="col-sm-3 col-xs-4"> 92 92 <select id="arrival_hour" class="form-control"> 93 <option value="-"><? =airport_transfers_lang_e('Hour')?></option>93 <option value="-"><?php esc_html_e( 'Hour', 'ns-airport-transfers' ); ?></option> 94 94 <?php foreach ($hours as $hour) : ?> 95 95 <option value="<?=$hour?>"><?=$hour?></option> … … 99 99 <div class="col-sm-3 col-xs-4"> 100 100 <select id="arrival_minutes" class="form-control"> 101 <option value="-"><? =airport_transfers_lang_e('Min')?></option>101 <option value="-"><?php esc_html_e( 'Min', 'ns-airport-transfers' ); ?></option> 102 102 <?php foreach ($minutes as $minute) : ?> 103 103 <option value="<?=$minute?>"><?=$minute?></option> … … 115 115 <div class="clear"></div><br> 116 116 <div class="form-group"> 117 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Airport')?><span class="text-danger">*</span></label>118 <div class="col-sm-6 col-xs-12"> 119 <select id="arrival_airport" class="form-control"> 120 <option value="-"><? =airport_transfers_lang_e('select')?></option>117 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Airport', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 118 <div class="col-sm-6 col-xs-12"> 119 <select id="arrival_airport" class="form-control"> 120 <option value="-"><?php esc_html_e( 'select', 'ns-airport-transfers' ); ?></option> 121 121 <?php foreach ($options as $option) : ?> 122 122 <option value="<?=$option?>"><?=$option?></option> … … 127 127 <div class="clear"></div><br> 128 128 <div class="form-group"> 129 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Flight number')?><span class="text-danger">*</span></label>129 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Flight number', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 130 130 <div class="col-sm-6 col-xs-12"> 131 131 <input type="text" class="form-control" id="arrival_flight" value="" placeholder=""> … … 134 134 <div class="clear"></div><br> 135 135 </div> 136 136 137 137 <div id="departure"> 138 <h4><span class="text-success"><? =airport_transfers_lang_e('Leaving')?></span> <span class="small">(<?=airport_transfers_lang_e('To airport');?>)</span></h4>139 140 <div class="form-group"> 141 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Date of departure')?><span class="text-danger">*</span></label>138 <h4><span class="text-success"><?php esc_html_e( 'Leaving', 'ns-airport-transfers' ); ?></span> <span class="small">(<?php esc_html_e( 'To airport', 'ns-airport-transfers' ); ?>)</span></h4> 139 140 <div class="form-group"> 141 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Date of departure', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 142 142 <div class="col-sm-3 col-xs-4"> 143 143 <input type="text" id="out_date" value="" class="date form-control" placeholder=""> … … 146 146 <div class="clear"></div><br> 147 147 <div class="form-group"> 148 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Time of departure');?><span class="text-danger">*</span></label>148 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Time of departure', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 149 149 <div class="col-sm-3 col-xs-4"> 150 150 <select id="out_hour" class="form-control"> 151 <option value="-"><? =airport_transfers_lang_e('Hour')?></option>151 <option value="-"><?php esc_html_e( 'Hour', 'ns-airport-transfers' ); ?></option> 152 152 <?php foreach ($hours as $hour) : ?> 153 153 <option value="<?=$hour?>"><?=$hour?></option> … … 157 157 <div class="col-sm-3 col-xs-4"> 158 158 <select id="out_minutes" class="form-control"> 159 <option value="-"><? =airport_transfers_lang_e('Min')?></option>159 <option value="-"><?php esc_html_e( 'Min', 'ns-airport-transfers' ); ?></option> 160 160 <?php foreach ($minutes as $minute) : ?> 161 161 <option value="<?=$minute?>"><?=$minute?></option> … … 173 173 <div class="clear"></div><br> 174 174 <div class="form-group"> 175 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Airport')?><span class="text-danger">*</span></label>176 <div class="col-sm-6 col-xs-12"> 177 <select id="out_airport" class="form-control"> 178 <option value="-"><? =airport_transfers_lang_e('select')?></option>175 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Airport', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 176 <div class="col-sm-6 col-xs-12"> 177 <select id="out_airport" class="form-control"> 178 <option value="-"><?php esc_html_e( 'select', 'ns-airport-transfers' ); ?></option> 179 179 <?php foreach ($options as $option) : ?> 180 180 <option value="<?=$option?>"><?=$option?></option> … … 185 185 <div class="clear"></div><br> 186 186 <div class="form-group"> 187 <label class="col-sm-4 col-xs-12 control-label"><? =airport_transfers_lang_e('Flight number')?><span class="text-danger">*</span></label>187 <label class="col-sm-4 col-xs-12 control-label"><?php esc_html_e( 'Flight number', 'ns-airport-transfers' ); ?><span class="text-danger">*</span></label> 188 188 <div class="col-sm-6 col-xs-12"> 189 189 <input type="text" id="out_flight" class="form-control" value="" placeholder=""> … … 192 192 <div class="clear"></div><br> 193 193 </div> 194 194 195 195 <div class="clear"></div><hr> 196 196 197 <h4 class="text-success"><? =airport_transfers_lang_e('Address in')?> <?=airport_transfers_lang_e(get_option('ns-airport-transfers-country'))?></h4>198 199 <div class="clear"></div> 200 201 <div class="form-group"> 202 <label class="col-md-4 col-sm-12 col-xs-12"><? =airport_transfers_lang_e('Address of hotel/accommodation')?>: <span class="text-danger">*</span></label>197 <h4 class="text-success"><?php esc_html_e( 'Address in', 'ns-airport-transfers' ); ?> <?php esc_html_e( get_option('ns-airport-transfers-country'))?></h4> 198 199 <div class="clear"></div> 200 201 <div class="form-group"> 202 <label class="col-md-4 col-sm-12 col-xs-12"><?php esc_html_e( 'Address of hotel/accommodation', 'ns-airport-transfers' ); ?>: <span class="text-danger">*</span></label> 203 203 <div class="col-md-8 col-sm-12 col-xs-12"> 204 204 <textarea id="adress" class="form-control" rows="2" placeholder=""></textarea> 205 </div> 206 </div> 207 205 </div> 206 </div> 207 208 208 <div class="clear"></div><br> 209 210 <div class="form-group"> 211 <label class="col-md-4 col-sm-12 col-xs-12"><? =airport_transfers_lang_e('Remarks/instructions')?>:</label>209 210 <div class="form-group"> 211 <label class="col-md-4 col-sm-12 col-xs-12"><?php esc_html_e( 'Remarks/instructions', 'ns-airport-transfers' ); ?>:</label> 212 212 <div class="col-md-8 col-sm-12 col-xs-12"> 213 213 <textarea id="instructions" class="form-control" rows="2" placeholder=""></textarea> … … 215 215 </div> 216 216 <br><br> 217 <div id="submit" class="btn btn-default"><? =airport_transfers_lang_e('Send')?></div>218 217 <div id="submit" class="btn btn-default"><?php esc_html_e( 'Send', 'ns-airport-transfers' ); ?></div> 218 219 219 </form> 220 220 221 <?php if($params['show-contacts']===' true') : ?>221 <?php if($params['show-contacts']==='1') : ?> 222 222 <div class="clear"></div><br> 223 <i><?php printf(airport_transfers_lang('If you need transfer from airport to another destination, wich is not specified please call us at %s or send an e-mail to %s'), get_option('ns-airport-transfers-contact-phone'), get_option('ns-airport-transfers-contact-email'))?></i> 223 <i><?php 224 printf( 225 esc_html__( 'If you need transfer from airport to another destination, wich is not specified please call us at %s or send an e-mail to %s' ), 226 get_option( 'ns-airport-transfers-contact-phone' ), 227 get_option( 'ns-airport-transfers-contact-email' ) 228 ); ?></i> 224 229 <?php endif; ?> -
airport-transfers/trunk/public/views/modal-error.php
r1725009 r2842501 5 5 <div class="modal-content"> 6 6 <div class="modal-header"> 7 <button type="button" class="close" data-dismiss="modal" aria-label="<? =airport_transfers_lang_e('close'); ?>"><span aria-hidden="true">×</span></button>8 <h4 class="modal-title" id="modal-error-title"><? =airport_transfers_lang_e('Error'); ?></h4>7 <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( 'Close', 'ns-airport-transfers' ); ?>"><span aria-hidden="true">×</span></button> 8 <h4 class="modal-title" id="modal-error-title"><?php esc_html_e( 'Error', 'ns-airport-transfers' ); ?></h4> 9 9 </div> 10 10 <div class="modal-body"> 11 11 <div class="box box-danger"> 12 <div class="box-body"> 12 <div class="box-body"> 13 13 <div class="row"> 14 14 <div class="col-xs-12"> … … 20 20 </div> 21 21 <div class="modal-footer"> 22 <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal"><? =airport_transfers_lang_e('close'); ?></button>22 <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal"><?php esc_html_e( 'Close', 'ns-airport-transfers' ); ?></button> 23 23 </div> 24 24 </div>
Note: See TracChangeset
for help on using the changeset viewer.