Plugin Directory

Changeset 1785859


Ignore:
Timestamp:
12/13/2017 01:44:25 AM (8 years ago)
Author:
fareharbor
Message:

Add support for booking flows

Location:
fareharbor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fareharbor/trunk/fareharbor.php

    r1655387 r1785859  
    44    Plugin URI: https://fareharbor.com/help/setup/wordpress-plugin/
    55    Description: Easily add FareHarbor reservation calendars and buttons to your site
    6     Version: 3.4
     6    Version: 3.5
    77    Author: FareHarbor
    88    Author URI: https://fareharbor.com
     
    4444    private function __construct() {}
    4545
    46     public static $version = '3.4';
     46    public static $version = '3.5';
    4747
    4848    // Update the saved version number in the wp_options table
     
    115115        update_option( 'fareharbor_kit_version', 'v2' );
    116116      }
    117       elseif ( version_compare( $from, '3.4', '<=' ) ) {
     117      elseif ( version_compare( $from, '3.4', '<' ) ) {
    118118        // Can't swap version of old sites that might already be using v1
    119119        // of the stylesheet!
     
    192192    $bookembed_defaults;
    193193
     194    public static function _clear_options() {
     195      // This method exists for testing only.
     196      self::$options = null;
     197      self::$shared_defaults = null;
     198      self::$lightframe_defaults = null;
     199      self::$calendar_defaults = null;
     200      self::$partners_defaults = null;
     201      self::$itemgrid_defaults = null;
     202      self::$bookembed_defaults = null;
     203    }
     204
    194205    private static function init_defaults() {
    195206
     
    208219        'sheet' => self::get_option( 'fh_default_sheet', '' ),
    209220        'fallback' => self::get_option( 'fh_default_fallback', '' ),
     221        'flow' => '',
    210222
    211223      );
     
    287299
    288300      if ( $args[ 'view_availability' ] && !$args[ 'view_item' ] )
    289         return array( 'error' => 'view_availability but no view_item' ); 
     301        return array( 'error' => 'view_availability but no view_item' );
    290302
    291303      $fallback_url = self::lightframe_fallback_url( $args );
     
    338350      }
    339351
    340       $query = self::get_shared_args_array( $args, 'dash', $is_simple_fallback, false );
     352      $query = self::get_shared_args_array( $args, 'dash', $is_simple_fallback, false, true );
    341353
    342354      if ( $is_simple_fallback && $args[ 'items' ] )
     
    392404
    393405      // Modifiers: shared args like fallback, asn, asn_ref, etc.
    394       $lo += self::get_shared_args_array( $args, 'camel', true, true );
     406      $lo += self::get_shared_args_array( $args, 'camel', true, true, true );
    395407
    396408      return $lo;
     
    450462      if ( isset( $args[ 'error' ] ) )
    451463        return $args;
    452      
     464
    453465      $type = $args[ 'type' ];
    454466      if ( $type === 'small' )
     
    461473        $url_suffix = 'items/' . $args[ 'items' ] . '/';
    462474
    463       return self::embed_script_src( $type, $args, $url_suffix, array(), false );     
     475      return self::embed_script_src( $type, $args, $url_suffix, array(), false, true );
    464476
    465477    }
     
    492504        $query[ 'include' ] = $args[ 'include' ];
    493505
    494       return self::embed_script_src( 'partners', $args, '', $query, true );
     506      return self::embed_script_src( 'partners', $args, '', $query, true, false );
    495507
    496508    }
     
    524536        $query[ 'selected-items' ] = $args[ 'items' ];
    525537
    526       return self::embed_script_src( 'items', $args, '', $query, true );
     538      return self::embed_script_src( 'items', $args, '', $query, true, true );
    527539
    528540    }
     
    559571
    560572      // Confirm there's a shortname.  All of our shortcodes require this
    561       if ( !$args[ 'shortname' ] ) 
     573      if ( !$args[ 'shortname' ] )
    562574        return array( 'error' => 'no shortname' );
    563575
     
    633645    // -----------------------------------------------
    634646
    635     private static function embed_script_src( $type, $args, $url_suffix, $query, $include_full_items ) {
     647    private static function embed_script_src( $type, $args, $url_suffix, $query, $include_full_items, $include_flow ) {
    636648
    637649      $script_src = 'https://' . self::url() . '/embeds/script/'
     
    646658        $query += array( 'lightframe' => $args[ 'lightframe' ] );
    647659
    648       $query += self::get_shared_args_array( $args, 'dash', $include_full_items, true );
     660      $query += self::get_shared_args_array( $args, 'dash', $include_full_items, true, $include_flow );
    649661
    650662      $query_string = http_build_query( $query );
     
    658670    // -----------------------------------------------
    659671
    660     private static function get_shared_args_array( $args, $casing, $include_full_items, $include_fallback ) {
     672    private static function get_shared_args_array( $args, $casing, $include_full_items, $include_fallback, $include_flow ) {
    661673
    662674      $out = array();
     
    682694      if ( $args[ 'sheet' ] )
    683695        $out[ 'sheet' ] = $args[ 'sheet' ];
     696
     697      if ( $include_flow && $args[ 'flow' ] )
     698        $out[ 'flow' ] = $args[ 'flow' ];
    684699
    685700      return self::fix_array_key_casing( $out, $casing );
     
    822837      );
    823838
    824       add_settings_field( 
     839      add_settings_field(
    825840        'fh_default_shortname',
    826841        'shortname',
     
    834849      );
    835850
    836       add_settings_field( 
     851      add_settings_field(
    837852        'fh_responsive_calendars',
    838853        'Responsive Calendars',
     
    848863      );
    849864
    850       add_settings_field( 
     865      add_settings_field(
    851866        'fh_default_fallback',
    852867        'fallback',
     
    864879      );
    865880
    866       add_settings_field( 
     881      add_settings_field(
    867882        'fh_default_asn',
    868883        'asn',
     
    888903      );
    889904
    890       add_settings_field( 
     905      add_settings_field(
    891906        'fh_default_ref',
    892907        'ref',
     
    900915      );
    901916
    902       add_settings_field( 
     917      add_settings_field(
    903918        'fh_default_sheet',
    904919        'sheet',
     
    912927      );
    913928
    914       add_settings_field( 
     929      add_settings_field(
    915930        'fh_default_full_items',
    916931        'full_items',
     
    928943      );
    929944
    930       add_settings_field( 
     945      add_settings_field(
    931946        'fh_default_lightframe',
    932947        'lightframe',
     
    944959      );
    945960
    946       add_settings_field( 
     961      add_settings_field(
    947962        'fh_default_class',
    948963        'class',
     
    977992
    978993      add_settings_section(
    979         'fh_buttons_section', 
     994        'fh_buttons_section',
    980995        'FareHarbor Buttons',
    981996        array( __CLASS__, 'render_fh_buttons_section_text' ),
     
    983998      );
    984999
    985       add_settings_field( 
     1000      add_settings_field(
    9861001        'fh_buttons_active',
    9871002        'FH Buttons Activation',
     
    9961011      );
    9971012
    998       add_settings_field( 
    999         'fh_buttons_query', 
     1013      add_settings_field(
     1014        'fh_buttons_query',
    10001015        'Button Colors',
    1001         array( __CLASS__, 'render_input_field' ), 
     1016        array( __CLASS__, 'render_input_field' ),
    10021017        __FILE__,
    10031018        'fh_buttons_section',
     
    10271042
    10281043    public static function render_options_page() {
    1029    
     1044
    10301045      ?>
    10311046
     
    10431058            <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes' ); ?>" />
    10441059          </p>
    1045          
     1060
    10461061        </form>
    10471062
  • fareharbor/trunk/readme.txt

    r1655387 r1785859  
    33Tags: reservations, booking calendar, booking, reservation plugin, reservation calendar, booking system
    44Requires at least: 3.0
    5 Tested up to: 4.7.3
     5Tested up to: 4.9.1
    66Stable tag: trunk
    77License: GPLv2 or later
     
    4343
    4444== Changelog ==
     45
     46= 3.5 =
     47* Add support for Booking Flows via `flow` shortcode option
    4548
    4649= 3.4 =
Note: See TracChangeset for help on using the changeset viewer.