Plugin Directory

Changeset 2814758


Ignore:
Timestamp:
11/09/2022 12:23:20 AM (3 years ago)
Author:
checkfront
Message:

Git sync: remove sidebar widget, improve escaping, improve shortcode widget_id
Git commit: 062599090f54a954cd5be8c1bb0f880aeb349d1e

Location:
checkfront-wp-booking/trunk
Files:
4 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • checkfront-wp-booking/trunk/CheckfrontWidget.php

    r2806003 r2814758  
    55 *
    66 * @package     CheckfrontWidget
    7  * @version     3.0 
     7 * @version     3.0
    88 * @author      Checkfront <[email protected]>
    9  * @copyright   2008-2018 Checkfront Inc 
     9 * @copyright   2008-2018 Checkfront Inc
    1010 * @license     http://opensource.org/licenses/bsd-license.php New BSD License
    1111 * @link        http://www.checkfront.com/developers/
     
    6060    public $src = '';
    6161    public $plugin_url = '';
     62    private $nextDropletId = 1;
    6263
    6364
     
    151152
    152153    /**
    153      * clean short code params
     154     * clean shortcode params
    154155     *
    155156     * @param array $cnf shortcode paramaters
     
    209210        }
    210211
    211         $cnf['widget_id'] = (isset($cnf['widget_id']) and $cnf['widget_id'] > 0) ? $cnf['widget_id'] : '01';
     212        $cnf['widget_id'] = (isset($cnf['widget_id']) and $cnf['widget_id'] > 0)
     213            ? (int)$cnf['widget_id']
     214            : $this->nextDropletId++;
    212215        $html = "\n<!-- CHECKFRONT BOOKING PLUGIN v{$this->interface_version}-->\n";
    213216        $html .= '<div id="CHECKFRONT_WIDGET_' . $cnf['widget_id'] . '"><p id="CHECKFRONT_LOADER" style="background: url(\'//' . $this->host . '/images/loader.gif\') left center no-repeat; padding: 5px 5px 5px 20px">' . $this->load_msg . '...</p></div>';
  • checkfront-wp-booking/trunk/checkfront.php

    r2806063 r2814758  
    55Plugin URI: https://www.checkfront.com/wordpress
    66Description: Connects Wordpress to the Checkfront Online Booking System.  Checkfront allows Tour, Activity, Accommodation, and Rental businesses to manage their availability, track inventories, centralize reservations, and process online payments. This plugin connects your WordPress site to your Checkfront account, and provides a powerful real-time booking interface – right within your existing website.
    7 Version: 3.5
     7Version: 3.6
    88Author: Checkfront Inc.
    99Author URI: https://www.checkfront.com/
     
    3636        'partner_id' => '',
    3737        'popup'      => '',
     38        'widget_id'  => '',
    3839    ], $cnf);
    3940    return checkfront($cnf);
     
    6465{
    6566    global $Checkfront;
    66     wp_enqueue_script('jquery');
    67     wp_enqueue_script(WP_PLUGIN_URL . '/setup.js');
    6867    include(dirname(__FILE__).'/setup.php');
    6968}
    7069
    71 // Init Checkfront, include any required js / css only when required
    72 function checkfront_head()
     70// include required js, if the page will use it
     71function checkfront_enqueue_scripts()
    7372{
    74     $embedded = 0;
    75 
    7673    global $post, $Checkfront;
    7774    if (!isset($Checkfront->host)) {
     
    8077   
    8178    // does this page have any shortcode. If not, back out.
    82     $pos = stripos($post->post_content, '[checkfront');
    83     if ($pos || $pos === 0) {
    84         $embedded = 1;
     79    if (stripos($post->post_content, '[checkfront') === false) {
     80        return;
    8581    }
    8682
    87     // calendar widget
    88     if ($Checkfront->arg['widget']) {
    89         $checkfront_widget_post = get_option("checkfront_widget_post");
    90         $checkfront_widget_page = get_option("checkfront_widget_page");
    91         $checkfront_widget_booking = get_option("checkfront_widget_booking");
     83    wp_enqueue_script('cf/interface.js', "//{$Checkfront->host}/lib/interface--{$Checkfront->interface_version}.js", ['jquery']);
     84    // Disable Comments
     85    add_filter('comments_open', 'checkfront_comments_open_filter', 10, 2);
     86    add_filter('comments_template', 'checkfront_comments_template_filter', 10, 1);
    9287
    93         if ($embedded && !$checkfront_widget_booking) {
    94             $Checkfront->arg['widget'] = 0;
    95         } else {
    96             if (is_page() && !$checkfront_widget_page) {
    97                 $Checkfront->arg['widget'] = 0;
    98             }
    99             if (is_single() && !$checkfront_widget_post) {
    100                 $Checkfront->arg['widget'] = 0;
    101             }
    102         }
    103     }
     88    // disable auto p
     89    // remove_filter ('the_content', 'wpautop');
    10490
    105     if ($Checkfront->arg['widget'] || $embedded) {
    106         echo ' <script src="//' . $Checkfront->host . '/lib/interface--' . $Checkfront->interface_version . '.js" type="text/javascript"></script>' ."\n";
    107         if ($embedded) {
    108             // Disable Comments
    109             add_filter('comments_open', 'checkfront_comments_open_filter', 10, 2);
    110             add_filter('comments_template', 'checkfront_comments_template_filter', 10, 1);
    111 
    112             // disable auto p
    113             // remove_filter ('the_content', 'wpautop');
    114 
    115             // disable wptexturize
    116             remove_filter('the_content', 'wptexturize');
    117         }
    118     }
     91    // disable wptexturize
     92    remove_filter('the_content', 'wptexturize');
    11993}
    12094
    121 // disable comments on booking pagfe
     95// disable comments on booking page
    12296function checkfront_comments_open_filter($open, $post_id=null)
    12397{
     
    134108function checkfront_init()
    135109{
    136     global $Checkfront;
    137     wp_register_sidebar_widget(
    138         'checkfront_widget',
    139         'Checkfront',
    140         'checkfront_widget',
    141         ['description' => __('Availability calendar and search')]
    142     );
    143 
    144     wp_register_widget_control('checkfront_widget', 'Checkfront', 'checkfront_widget_ctrl');
    145     add_action('wp_head', 'checkfront_head');
    146     // required includes
    147110    wp_enqueue_script('jquery');
    148     if (!isset($Checkfront->arg)) {
    149         $Checkfront->arg = [];
    150     }
    151 
    152     $Checkfront->arg['widget'] = (is_active_widget('checkfront_widget')) ? 1 : 0;
     111    add_action('wp_enqueue_scripts', 'checkfront_enqueue_scripts');
    153112}
    154113
     
    168127    }
    169128    return $links;
    170 }
    171 
    172 // Show widget
    173 function checkfront_widget()
    174 {
    175     global $Checkfront;
    176     if (!$Checkfront->arg['widget']) {
    177         return;
    178     }
    179     $checkfront_widget_title = get_option("checkfront_widget_title");
    180     if ($checkfront_book_url = get_option("checkfront_book_url")) {
    181         if (!(strpos('http', $checkfront_book_url) === 0)) {
    182             $checkfront_book_url = 'http://' . $_SERVER['HTTP_HOST'] . $checkfront_book_url;
    183         }
    184     }
    185     if (!empty($checkfront_widget_title)) {
    186         echo '<h2 class="widgettitle">' . $checkfront_widget_title . '</h2>';
    187     }
    188     echo '<div id="checkfront-cal"><iframe allowTransparency=true border=0 style="border:0; height: 260px;" src="//' . $Checkfront->host . '/reserve/widget/calendar/?return=' . urlencode($checkfront_book_url) . '"></iframe></div>';
    189 }
    190 
    191 // Widget control
    192 function checkfront_widget_ctrl()
    193 {
    194     if ($_POST['checkfront_update']) {
    195         update_option("checkfront_book_url", $_POST['checkfront_book_url']);
    196         update_option("checkfront_widget_title", $_POST['checkfront_widget_title']);
    197         update_option("checkfront_widget_post ", $_POST['checkfront_widget_post']);
    198         update_option("checkfront_widget_page ", $_POST['checkfront_widget_page']);
    199         update_option("checkfront_widget_booking", $_POST['checkfront_widget_booking']);
    200     }
    201 
    202     $checkfront_book_url = get_option("checkfront_book_url");
    203 
    204     // try and find booking page in content
    205     if (!$checkfront_book_url) {
    206         global $wpdb;
    207         $checkfront_book_url = $wpdb->get_var("select guid FROM `{$wpdb->prefix}posts` where post_content like '%[checkfront%' and post_type = 'page' limit 1");
    208         update_option("checkfront_widget_url", $checkfront_book_url);
    209     }
    210 
    211     $checkfront_widget_title = get_option("checkfront_widget_title");
    212     $checkfront_widget_post = (get_option("checkfront_widget_post")) ? ' checked="checked"' : '';
    213     $checkfront_widget_page = (get_option("checkfront_widget_page")) ? ' checked="checked"' : '';
    214     $checkfront_widget_booking  = (get_option("checkfront_widget_booking")) ? ' checked="checked"' : '';
    215 
    216     echo '<input type="hidden" name="checkfront_update" value="1" />'; 
    217     echo '<ul>';
    218     echo '<li><label for="checkfront_book_url">' . __('Internal Booking Page (URL)') . ': </label><input type="text" id="checkfront_book_url" name="checkfront_book_url" value="' . $checkfront_book_url . '" /> </li>';
    219     echo '<li><label for="checkfront_widget_title">' . __('Title') . ': </label><input type="text" id="checkfront_widget_title" name="checkfront_widget_title" value="' . $checkfront_widget_title . '" /> </li>';
    220     echo '<li style="color: firebrick">It is not recommended to use this with the v2 interface.</li>';
    221     echo '<li><input type="checkbox" id="checkfront_widget_post" name="checkfront_widget_post" value="1"' . $checkfront_widget_post . '/><label for="checkfront_widget_post" />' . __('Show on posts') . '</li>';
    222     echo '<li><input type="checkbox" id="checkfront_widget_page" name="checkfront_widget_page" value="1"' .  $checkfront_widget_page . '/><label for="checkfront_widget_post" />' . __('Show on pages') . '</li>';
    223     echo '<li><input type="checkbox" id="checkfront_widget_booking" name="checkfront_widget_booking" value="1"' . $checkfront_widget_booking . '/><label for="checkfront_widget_booking" />' . __('Show on booking page') . '</li>';
    224     echo '</ul>';
    225129}
    226130
     
    243147add_action('admin_menu', 'checkfront_conf');
    244148add_action('init', 'checkfront_init');
    245 
    246 ?>
  • checkfront-wp-booking/trunk/pipe.html

    r780597 r2814758  
    1919        <pre>
    2020        This is a static helper file that improves performance, rendering and sizing of the Checkfront Booking System.
    21         It should be placed on the same server where the booking portal is hosted and referenced in the embed code. 
     21        It should be placed on the same server where the booking portal is hosted and referenced in the embed code.
    2222        For more information see: <a href="http://www.checkfront.com/support/droplet#helper">http://www.checkfront.com/support/droplet#helper</a>
    2323        </pre>
  • checkfront-wp-booking/trunk/readme.txt

    r2806003 r2814758  
    22
    33Contributors: checkfront
    4 Stable tag: trunk
     4Stable tag: 3.6
    55Tags: Booking, Booking System, Reservation, Reservation System, Online Booking, Booking Engine, Tours, Tour Operator, Booking Plugin, Reservation Plugin, Booking Software, Reservation Payment System, Activity Booking, Rental Booking, Reservation Payments, Tour Booking, Passbook, Availability, Payments, Bookings
    66Requires at least: 2.0
     
    3232* Multi-gateway payment processing including Stripe, Square, Paypal, Authorize.net, SagePay & dozens more
    3333* SSL support keeps the customer on your website while making payment
    34 * Support for short codes, or custom theme pages in Wordpress.
     34* Support for shortcodes, or custom theme pages in Wordpress.
    3535* Tailored onboarding session and a 24/7 support team
    3636* **No commissions!**
     
    7373### Changelog
    7474
     75* *November 2nd 2022:*
     76  * Wordpress 6.1 compatibility
     77  * Removed deprecated sidebar widget
    7578* *February 25th 2021:*
    7679  * Fixed broken image links in plugin setup
  • checkfront-wp-booking/trunk/setup.php

    r2806063 r2814758  
    11<?php
    2 if (isset($_POST['checkfront_host'])) {
     2if (!empty($_POST['checkfront_host'])) {
    33    if ($host = $Checkfront->valid_host($_POST['checkfront_host'])) {
    44        update_option('checkfront_host', trim($host));
     
    1111?>
    1212<div style="width: 800px">
    13     <script type="text/javascript">
    14         jQuery(document).ready(function() {
    15 
    16             function clean(str) {
    17                 return str.replace(/[^\d\w\-\_ , "]/ig, '');
    18             }
    19 
    20             jQuery('#shortcode_generator').click(function() {
    21                 height = 600;
    22                 width = 1150;
    23                 var cwidth = (window.screen.width - width) / 2;
    24                 var cheight = (window.screen.height - height) / 2;
    25                 var param = "location=yes,status=yes,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,width=" + width + ',height=' + height + ',left=' + cwidth + ',top=' + cheight;
    26                 var sw = window.open(this.href, '', param);
    27                 sw.focus();
    28                 return false;
    29             });
    30         });
    31     </script>
    3213    <div style="width: 500px; float: left">
    3314        <h1>Online Bookings For Wordpress</h1>
     
    3819            <li style="padding: 5px 0; height: 25px; line-height: 25px;"><strong style="margin-right: 10px; background-color: #ccc; border-radius: 20px; clear: none; color: #000; display: inline-block; float: left; font-style: normal; height: 25px; font-weight: bold; line-height: 25px;font-size:14px; text-align: center; width: 25px;">1</strong> Create and configure <a href="https://www.checkfront.com/start/?src=wp-setup" target="_blank">your Checkfront account</a>.</li>
    3920            <li style="padding: 5px 0; height: 25px; line-height: 25px;"><strong style="margin-right: 10px; background-color: #ccc; border-radius: 20px; clear: none; color: #000; display: inline-block; float: left; font-style: normal; height: 25px; font-weight: bold; line-height: 25px;font-size:14px; text-align: center; width: 25px;">2</strong> Supply your Checkfront URL and optional settings <a href="#checkfront_setup">below</a>.</li>
    40             <li style="padding: 5px 0; height: 25px; line-height: 25px;"><strong style="margin-right: 10px; background-color: #ccc; border-radius: 20px; clear: none; color: #000; display: inline-block; float: left; font-style: normal; height: 25px; font-weight: bold; line-height: 25px;font-size:14px; text-align: center; width: 25px;">3</strong> Create a new page and supply the <a href="#shortcode">short code</a> you created.</li>
     21            <li style="padding: 5px 0; height: 25px; line-height: 25px;"><strong style="margin-right: 10px; background-color: #ccc; border-radius: 20px; clear: none; color: #000; display: inline-block; float: left; font-style: normal; height: 25px; font-weight: bold; line-height: 25px;font-size:14px; text-align: center; width: 25px;">3</strong> Create a new page and supply the <a href="#shortcode">shortcode</a> you created.</li>
    4122            <li style="padding: 5px 0; height: 25px; line-height: 25px;"><strong style="margin-right: 10px; background-color: #ccc; border-radius: 20px; clear: none; color: #000; display: inline-block; float: left; font-style: normal; height: 25px; font-weight: bold; line-height: 25px;font-size:14px; text-align: center; width: 25px;">4</strong> Start accepting online bookings.</li>
    4223            <li style="padding: 5px 0; height: 25px; line-height: 25px;"><strong style="margin-right: 10px; background-color: #ccc; border-radius: 20px; clear: none; color: #000; display: inline-block; float: left; font-style: normal; height: 25px; font-weight: bold; line-height: 25px;font-size:14px; text-align: center; width: 25px;">5</strong> Have questions? <a href="https://www.checkfront.com/support/?src=wp-setup">We're here to help</a>.</li>
     
    4829            <strong>Smart, Simplified Online Bookings</strong><br /><br />
    4930        </div>
    50         <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fcheckfront.bookings&amp;send=false&amp;layout=button_count&amp;width=250&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=132896805841" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:290px; margin-bottom: 10px; height:21px;" allowTransparency="true"></iframe>
    51         <!-- Place this tag in your head or just before your close body tag -->
    52         <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    53         <!-- Place this tag where you want the +1 button to render -->
    54         <div class="g-plusone" data-size="small" data-annotation="inline" data-href="https://www.checkfront.com/?src=wp-setup"></div>
    5531        <br />
    5632        <br />
     
    6541                <h3 class="hndle">Setup</h3>
    6642                <?php
    67                 if (isset($cf_msg)) { ?>
     43                if (!empty($cf_msg)) { ?>
    6844                    <div style="background-color: rgb(255, 251, 204); margin:1em 1em 0em 1em" id="message" class="updated fade">
    69                         <p><strong><?php echo $cf_msg ?></strong></p>
     45                        <p><strong><?php echo esc_html($cf_msg) ?></strong></p>
    7046                    </div>
    7147                <?php } ?>
     
    7551                            <tr valign="top">
    7652                                <th scope="row"><label for="checkfront_email">Checkfront Host Url:</label></th>
    77                                 <td nowrap>https://<input name="checkfront_host" style="width: 15em;font-weight: bold" id="CF_id" value="<?php echo $Checkfront->host ?>" class="regular-text" type="text" /><br /><em style="color: #888">Eg: demo.checkfront.com</em> </td>
     53                                <td nowrap>https://<input name="checkfront_host" style="width: 15em;font-weight: bold" id="CF_id" value="<?php echo esc_attr($Checkfront->host) ?>" class="regular-text" type="text" /><br /><em style="color: #888">Eg: demo.checkfront.com</em> </td>
    7854                                <td id="CF_status"><em>Location of your Checkfront Admin</td>
    7955                            </tr>
Note: See TracChangeset for help on using the changeset viewer.