Plugin Directory

Changeset 1628729


Ignore:
Timestamp:
04/03/2017 10:56:28 PM (9 years ago)
Author:
fareharbor
Message:

Update defaults for new installs, fix PHP error

Location:
fareharbor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fareharbor/trunk/fareharbor.php

    r1482056 r1628729  
    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.2
     6    Version: 3.3
    77    Author: FareHarbor
    88    Author URI: https://fareharbor.com
     
    4444    private function __construct() {}
    4545
    46     public static $version = '3.2';
     46    public static $version = '3.3';
    4747
    4848    // Update the saved version number in the wp_options table
     
    8383      add_action( 'wp_enqueue_scripts', array( 'fareharbor', 'maybe_enqueue_fh_kit_styles' ) );
    8484
    85       if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) )
    86         update_option( 'fareharbor_version', self::$version );
     85      $saved_version = get_option( 'fareharbor_version' );
     86      if ( $saved_version !== self::$version )
     87        self::upgrade( $saved_version );
     88
     89    }
     90
     91    // Upgrade
     92    // ===============================================
     93
     94    private static function upgrade( $from ) {
     95
     96      if ( !$from ) {
     97        // New install or upgrade from version before 3.0, before we saved
     98        // version numbers in the database.  No choice but to treat those
     99        // as a new install.
     100        // No settings should be saved but let's be careful not to override
     101        // just in case
     102        $saved_settings = get_option( 'fareharbor_settings', [] );
     103        if ( !is_array( $saved_settings ) )
     104          // Even less likely, but again just in case
     105          $saved_settings = [];
     106
     107        $defaults = [
     108          'fh_responsive_calendars' => 'on',
     109          'fh_default_fallback' => 'simple',
     110          'fh_auto_lightframe_enabled' => 'on',
     111        ];
     112        update_option( 'fareharbor_settings', $saved_settings + $defaults );
     113      }
     114      // elseif ( version_compare( $from, '3.2', '<=' ) ) {
     115        // Preserve old defaults; no action required
     116      // }
     117
     118      update_option( 'fareharbor_version', self::$version, true );
    87119
    88120    }
     
    476508        $query[ 'selected-items' ] = $args[ 'items' ];
    477509
    478       return self::embed_script_src( 'items', $args, $url_suffix, $query, true );
     510      return self::embed_script_src( 'items', $args, '', $query, true );
    479511
    480512    }
  • fareharbor/trunk/readme.txt

    r1482056 r1628729  
    33Tags: reservations, booking calendar, booking, reservation plugin, reservation calendar, booking system
    44Requires at least: 3.0
    5 Tested up to: 4.6
     5Tested up to: 4.7.3
    66Stable tag: trunk
    77License: GPLv2 or later
     
    4343
    4444== Changelog ==
     45
     46= 3.3 =
     47* Default to responsive calendars for new installs
     48* Default to simple fallback for new installs
     49* Enable Auto-Lightframe by default for new installs
    4550
    4651= 3.2 =
Note: See TracChangeset for help on using the changeset viewer.