Plugin Directory

Changeset 3390468


Ignore:
Timestamp:
11/05/2025 12:49:21 PM (5 months ago)
Author:
dreamfox
Message:

2.2.1

Location:
woocommerce-delivery-date
Files:
68 added
20 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-delivery-date/tags/2.2.1/readme.txt

    r3385776 r3390468  
    33Contributors: Dreamfox Media, freemius
    44Donate link: https://www.dreamfoxmedia.com
    5 Tags: woocommerce,delivery, delivery date,plugin,free
     5Tags: woocommerce,delivery, delivery date,free
    66Requires at least: 5.0
    77Tested up to: 6.8
    88Stable tag: 2.2.1
    99WC requires at least: 6.0.0
    10 WC tested up to: 10.2
    11 License: GPLv2 or later
     10WC tested up to: 10.3
     11License: GPLv3 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1313
  • woocommerce-delivery-date/tags/2.2.1/src/Admin/Backend.php

    r3385198 r3390468  
    2020    public function displayOrderDataInAdmin( $order ) {
    2121        $view = new AdminOrderView($this, $order->get_id());
    22         echo $view->render();
     22        echo wp_kses_post( $view->render() );
    2323    }
    2424
  • woocommerce-delivery-date/tags/2.2.1/src/Site/AssetsManager.php

    r3385198 r3390468  
    66class AssetsManager extends AbstractAssets
    77{
     8    /**
     9     * Frontend enqueue hook
     10     */
     11    protected function _getEventName() {
     12        return 'wp_enqueue_scripts';
     13    }
    814
    9   protected function _getEventName()
    10   {
    11     return 'wp_enqueue_scripts';
    12   }
     15    /**
     16     * Register styles that the AbstractAssets parent can handle.
     17     * Keep your existing frontend.css and add local jQuery UI theme CSS.
     18     */
     19    protected function _buildStyles() {
     20        return [
     21            'frontend' => [
     22                'src'  => $this->getAssetUrl('frontend.css'),
     23                'deps' => [],
     24                'ver'  => defined('WP_DEBUG') && WP_DEBUG ? time() : '1.0.0',
     25            ],
     26            // Local copy of the jQuery UI 1.12.1 "Smoothness" theme CSS
     27            'jquery-ui-theme' => [
     28                'src'  => $this->getAssetUrl('assets/jquery-ui/themes/smoothness/jquery-ui.min.css'),
     29                'deps' => [],
     30                'ver'  => '1.12.1',
     31            ],
     32        ];
     33    }
    1334
    14   protected function _buildStyles()
    15     {
    16         return [
    17             'frontend' => array(
    18                 'src'     => $this->getAssetUrl( 'frontend.css' ),
    19             ),
    20         ];
    21     }
     35    /**
     36     * No additional script files from your plugin right now.
     37     */
     38    protected function _buildScripts() {
     39        return [];
     40    }
    2241
    23   protected function _buildScripts()
    24     {
    25         return [];
    26     }
     42    /**
     43     * Enqueue WordPress-bundled jQuery UI and our local theme CSS.
     44     */
     45    public function registerScripts() {
     46        parent::registerScripts();
    2747
    28     public function registerScripts()
    29     {
    30         parent::registerScripts();
     48        // WordPress already bundles the JS parts of jQuery UI; just enqueue what you use.
     49        wp_enqueue_script('jquery-ui-core');
     50        wp_enqueue_script('jquery-ui-datepicker');
    3151
    32         // Load the datepicker script (pre-registered in WordPress).
    33     wp_enqueue_script( 'jquery-ui-datepicker' );
     52        // Enqueue our local theme CSS (registered via _buildStyles()).
     53        // Use a unique handle to avoid collisions with other plugins/themes.
     54        wp_enqueue_style('dreamfox-deliverydate-jquery-ui-theme');
    3455
    35     // You need styling for the datepicker. For simplicity I've linked to the jQuery UI CSS on a CDN.
    36     wp_register_style( 'jquery-ui', 'https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css' );
    37     wp_enqueue_style( 'jquery-ui' );
    38     }
     56        // Ensure your frontend CSS still loads.
     57        wp_enqueue_style('dreamfox-deliverydate-frontend');
     58    }
    3959
    40     protected function _getBuildType()
    41   {
    42     return 'free';
    43   }
     60    /**
     61     * Build type identifier unchanged.
     62     */
     63    protected function _getBuildType() {
     64        return 'free';
     65    }
    4466}
  • woocommerce-delivery-date/tags/2.2.1/src/Site/CheckoutFieldManager.php

    r3385198 r3390468  
    2121    $dateFormat = get_option('date_format');
    2222    $minDeliveryDate = date($dateFormat, strtotime('+' . ( $datesToDeliver ) . ' day', current_time('timestamp', 0)));
    23     $label = __('Select delivery date', 'dreamfox-wdd');
     23    $label = __('Select delivery date', 'woocommerce-delivery-date');
    2424    $required = false;
    2525        $this->_fields[DREAMFOX_WDD_FIELD_NAME] = array(
  • woocommerce-delivery-date/tags/2.2.1/src/Site/Frontend.php

    r3385198 r3390468  
    4141    public function outputDeliveryDate() {
    4242        $view = new DeliveryDateView($this);
    43         echo $view->render();
     43        echo wp_kses_post( $view->render() );
    4444    }
    4545
     
    6161    public function renderEmailWithDeliveryDate( $order, $is_admin_email ) {
    6262        $view = new EmailView($this, $order);
    63         echo $view->render();
     63        echo wp_kses_post( $view->render() );
    6464    }
    6565
    6666    public function renderOrderView( $order ) {
    6767        $view = new OrderView($this, $order);
    68         echo $view->render();
     68        echo wp_kses_post( $view->render() );
    6969    }
    7070
  • woocommerce-delivery-date/tags/2.2.1/src/Views/templates/admin_js_view.php

    r3385198 r3390468  
    11<script type="text/javascript">
    2   var wdd_static_url = <?php echo json_encode($this->getStaticUrl()); ?>;
     2  var wdd_static_url = <?php echo wp_json_encode( $this->getStaticUrl() ); ?>;
    33</script>
  • woocommerce-delivery-date/tags/2.2.1/src/Views/templates/admin_order_view.php

    r3385198 r3390468  
    44?>
    55<div class="order_data_column">
    6   <h4><?php echo __('Delivery Date'); ?></h4>
     6  <h4><?php esc_html_e( 'Delivery Date', 'woocommerce-delivery-date' ); ?></h4>
    77  <p><?php echo $deliveryDate; ?></p>
    88</div>
  • woocommerce-delivery-date/tags/2.2.1/src/Views/templates/delivery_date.php

    r3385198 r3390468  
    99?>
    1010<div class="dreamfox-delivery-date" id="dd__checkout_field">
    11   <h3><?php echo __('Delivery Info', 'dreamfox-wdd'); ?></h3>
     11  <h3><?php esc_html_e( 'Delivery Info', 'woocommerce-delivery-date' ); ?></h3>
    1212    <?php foreach ($checkout->checkout_fields[DREAMFOX_WDD_FIELD_NAME] as $key => $field) : ?>
    1313      <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?>
     
    1515</div>
    1616
    17 
    18 <script type="text/javascript">
    19   (function($){
    20     $(document).ready(function() {
    21       $('#<?php echo DREAMFOX_WDD_FIELD_NAME; ?>').datepicker({
    22         dateFormat : '<?php echo DateHelper::getJsDateFormat(get_option( 'date_format' )) ?>',
    23         minDate: <?php echo $this->getMinDate(); ?>,
    24       });
    25     })
    26   })(jQuery);
     17<script>
     18jQuery(function($) {
     19    $('#<?php echo esc_js( DREAMFOX_WDD_FIELD_NAME ); ?>').datepicker({
     20        dateFormat: <?php echo wp_json_encode( DateHelper::getJsDateFormat( get_option( 'date_format' ) ) ); ?>,
     21        minDate: <?php echo (int) $this->getMinDate(); ?>,
     22    });
     23});
    2724</script>
  • woocommerce-delivery-date/tags/2.2.1/src/Views/templates/email_view.php

    r3385198 r3390468  
    33$label = $this->getLabel();
    44if (!empty($deliveryDate)) {
    5   echo sprintf('<p><strong>%s:</strong>%s</p>', $label, $deliveryDate);
     5    echo sprintf(
     6        '<p><strong>%s:</strong> %s</p>',
     7        esc_html( $label ),
     8        esc_html( $deliveryDate )
     9    );
    610}
  • woocommerce-delivery-date/tags/2.2.1/woocommerce-delivery-date.php

    r3385198 r3390468  
    22
    33/**
    4  * Plugin Name: Woocommerce Delivery Date Premium
    5  * Plugin URI: https://dreamfoxmedia.com
     4 * Plugin Name: Delivery Date for WooCommerce
     5 * Plugin URI: https://github.com/WPPlugins/woocommerce-delivery-date
    66 * Version: 2.2.1
    77 * Author URI: https://dreamfoxmedia.com
    88 * Author: Dreamfox Media
    9  * Description: Extend Woocommerce plugin to add delivery date on checkout
     9 * Description: Extend WooCommerce plugin to add delivery date on checkout
    1010 * Requires at least: 5.0
    1111 * Tested up to: 6.8
    1212 * WC requires at least: 6.0.0
    13  * WC tested up to: 10.2
     13 * WC tested up to: 10.3
    1414 * License: GPLv3 or later
    1515 * License URI: http://www.opensource.org/licenses/gpl-license.php
    16  * Text Domain: woocommerce-delivery-date
    17  * Domain Path: /lang/
     16 * Text Domain: deliverydate-for-woocommerce
    1817 * @Developer : Marco van Loghum Slaterus / Hoang Xuan Hao ( Pamysoft )
    1918 */
     
    2423    define( 'DREAMFOX_WDD_PLUGIN_FILE', __FILE__ );
    2524}
     25/**
     26 * Resilient Freemius accessor:
     27 * - If your project exposes a Freemius function, return it (e.g., dreamfox_delivery_date()).
     28 * - Otherwise return a safe stub so calls like my_fs()->is__premium_only() won't fatally error.
     29 */
     30if ( !function_exists( 'my_fs' ) ) {
     31    function my_fs() {
     32        // If your Freemius accessor is a different one in other builds, check them here:
     33        if ( function_exists( 'dfm_sgppfw_fs' ) ) {
     34            return dfm_sgppfw_fs();
     35        }
     36        if ( function_exists( 'dreamfox_delivery_date' ) ) {
     37            return dreamfox_delivery_date();
     38        }
     39        static $stub = null;
     40        if ( !$stub ) {
     41            $stub = new class {
     42                public function add_filter() {
     43                    return null;
     44                }
     45
     46                public function __call( $name, $args ) {
     47                    return null;
     48                }
     49
     50                public function set_basename() {
     51                    return null;
     52                }
     53
     54            }
     55;
     56        }
     57        return $stub;
     58    }
     59
     60}
     61/**
     62 * If Freemius is already loaded elsewhere, sync the basename on premium.
     63 */
     64if ( function_exists( 'dfm_sgppfw_fs' ) || function_exists( 'dreamfox_delivery_date' ) ) {
     65}
    2666if ( function_exists( 'dreamfox_delivery_date' ) ) {
     67    // If helper already exists (e.g., after an update), keep basename in sync.
    2768    dreamfox_delivery_date()->set_basename( false, __FILE__ );
    2869} else {
    29     if ( !function_exists( 'dreamfox_delivery_date' ) ) {
    30         // Create a helper function for easy SDK access.
    31         function dreamfox_delivery_date() {
    32             global $dreamfox_delivery_date;
    33             if ( !isset( $dreamfox_delivery_date ) ) {
    34                 // Activate multisite network integration.
    35                 if ( !defined( 'WP_FS__PRODUCT_10651_MULTISITE' ) ) {
    36                     define( 'WP_FS__PRODUCT_10651_MULTISITE', true );
    37                 }
    38                 // Include Freemius SDK.
    39                 require_once dirname( __FILE__ ) . '/freemius/start.php';
    40                 $dreamfox_delivery_date = fs_dynamic_init( array(
    41                     'id'             => '10651',
    42                     'slug'           => 'dreamfox-deliverydate',
    43                     'premium_slug'   => 'dreamfox-deliverydate-premium',
    44                     'type'           => 'plugin',
    45                     'public_key'     => 'pk_cbd84d7abd43d4e1d2c4b5850c495',
    46                     'is_premium'     => false,
    47                     'premium_suffix' => 'Premium',
    48                     'has_addons'     => false,
    49                     'has_paid_plans' => true,
    50                     'menu'           => array(
    51                         'slug'       => 'woocommerce-delivery-date',
    52                         'first-path' => 'admin.php?page=woocommerce-delivery-date',
    53                         'support'    => false,
    54                         'network'    => true,
    55                         'parent'     => array(
    56                             'slug' => 'woocommerce',
    57                         ),
     70    // Create a helper for easy SDK access.
     71    function dreamfox_delivery_date() {
     72        global $dreamfox_delivery_date;
     73        if ( !isset( $dreamfox_delivery_date ) ) {
     74            // Activate multisite network integration.
     75            if ( !defined( 'WP_FS__PRODUCT_10651_MULTISITE' ) ) {
     76                define( 'WP_FS__PRODUCT_10651_MULTISITE', true );
     77            }
     78            // Include Freemius SDK.
     79            require_once dirname( __FILE__ ) . '/freemius/start.php';
     80            $dreamfox_delivery_date = fs_dynamic_init( array(
     81                'id'             => '10651',
     82                'slug'           => 'dreamfox-deliverydate',
     83                'premium_slug'   => 'dreamfox-deliverydate-premium',
     84                'type'           => 'plugin',
     85                'public_key'     => 'pk_cbd84d7abd43d4e1d2c4b5850c495',
     86                'is_premium'     => false,
     87                'premium_suffix' => 'Premium',
     88                'has_addons'     => false,
     89                'has_paid_plans' => true,
     90                'menu'           => array(
     91                    'slug'       => 'woocommerce-delivery-date',
     92                    'first-path' => 'admin.php?page=woocommerce-delivery-date',
     93                    'support'    => false,
     94                    'network'    => true,
     95                    'parent'     => array(
     96                        'slug' => 'woocommerce',
    5897                    ),
    59                     'is_live'        => true,
    60                 ) );
    61             }
    62             return $dreamfox_delivery_date;
     98                ),
     99                'is_live'        => true,
     100            ) );
    63101        }
     102        return $dreamfox_delivery_date;
     103    }
    64104
    65         // Init Freemius.
    66         dreamfox_delivery_date();
    67         // Signal that SDK was initiated.
    68         do_action( 'dreamfox_delivery_date_loaded' );
    69     }
    70     if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    71         include dirname( __FILE__ ) . '/bootstrap.php';
    72     }
     105    // Init Freemius (available to my_fs()).
     106    dreamfox_delivery_date();
     107    do_action( 'dreamfox_delivery_date_loaded' );
    73108}
     109/**
     110 * === FREE vs PREMIUM Freemius UI filters ===
     111 * Free  : hide account/contact/pricing menus, enable anonymous, disable branding.
     112 * Premium: show menus, disable anonymous, keep branding defaults.
     113 */
     114$fs = my_fs();
     115// FREE
     116$fs->add_filter( 'show_account', '__return_false' );
     117$fs->add_filter( 'show_contact', '__return_false' );
     118$fs->add_filter( 'show_pricing', '__return_false' );
     119$fs->add_filter( 'is_submenu_visible', '__return_false' );
     120$fs->add_filter( 'enable_anonymous', '__return_true' );
     121$fs->add_filter( 'disable_freemius_branding', '__return_true' );
     122/**
     123 * Load core plugin code for BOTH free & premium builds.
     124 * Premium-only files (e.g., /src/Premium) should be further gated INSIDE bootstrap.php
     125 * using `if ( my_fs()->is__premium_only() ) { ... }`.
     126 */
     127if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
     128    include dirname( __FILE__ ) . '/bootstrap.php';
     129}
  • woocommerce-delivery-date/trunk/readme.txt

    r3385776 r3390468  
    33Contributors: Dreamfox Media, freemius
    44Donate link: https://www.dreamfoxmedia.com
    5 Tags: woocommerce,delivery, delivery date,plugin,free
     5Tags: woocommerce,delivery, delivery date,free
    66Requires at least: 5.0
    77Tested up to: 6.8
    88Stable tag: 2.2.1
    99WC requires at least: 6.0.0
    10 WC tested up to: 10.2
    11 License: GPLv2 or later
     10WC tested up to: 10.3
     11License: GPLv3 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1313
  • woocommerce-delivery-date/trunk/src/Admin/Backend.php

    r3111568 r3390468  
    2020    public function displayOrderDataInAdmin( $order ) {
    2121        $view = new AdminOrderView($this, $order->get_id());
    22         echo $view->render();
     22        echo wp_kses_post( $view->render() );
    2323    }
    2424
  • woocommerce-delivery-date/trunk/src/Site/AssetsManager.php

    r2920091 r3390468  
    66class AssetsManager extends AbstractAssets
    77{
     8    /**
     9     * Frontend enqueue hook
     10     */
     11    protected function _getEventName() {
     12        return 'wp_enqueue_scripts';
     13    }
    814
    9   protected function _getEventName()
    10   {
    11     return 'wp_enqueue_scripts';
    12   }
     15    /**
     16     * Register styles that the AbstractAssets parent can handle.
     17     * Keep your existing frontend.css and add local jQuery UI theme CSS.
     18     */
     19    protected function _buildStyles() {
     20        return [
     21            'frontend' => [
     22                'src'  => $this->getAssetUrl('frontend.css'),
     23                'deps' => [],
     24                'ver'  => defined('WP_DEBUG') && WP_DEBUG ? time() : '1.0.0',
     25            ],
     26            // Local copy of the jQuery UI 1.12.1 "Smoothness" theme CSS
     27            'jquery-ui-theme' => [
     28                'src'  => $this->getAssetUrl('assets/jquery-ui/themes/smoothness/jquery-ui.min.css'),
     29                'deps' => [],
     30                'ver'  => '1.12.1',
     31            ],
     32        ];
     33    }
    1334
    14   protected function _buildStyles()
    15     {
    16         return [
    17             'frontend' => array(
    18                 'src'     => $this->getAssetUrl( 'frontend.css' ),
    19             ),
    20         ];
    21     }
     35    /**
     36     * No additional script files from your plugin right now.
     37     */
     38    protected function _buildScripts() {
     39        return [];
     40    }
    2241
    23   protected function _buildScripts()
    24     {
    25         return [];
    26     }
     42    /**
     43     * Enqueue WordPress-bundled jQuery UI and our local theme CSS.
     44     */
     45    public function registerScripts() {
     46        parent::registerScripts();
    2747
    28     public function registerScripts()
    29     {
    30         parent::registerScripts();
     48        // WordPress already bundles the JS parts of jQuery UI; just enqueue what you use.
     49        wp_enqueue_script('jquery-ui-core');
     50        wp_enqueue_script('jquery-ui-datepicker');
    3151
    32         // Load the datepicker script (pre-registered in WordPress).
    33     wp_enqueue_script( 'jquery-ui-datepicker' );
     52        // Enqueue our local theme CSS (registered via _buildStyles()).
     53        // Use a unique handle to avoid collisions with other plugins/themes.
     54        wp_enqueue_style('dreamfox-deliverydate-jquery-ui-theme');
    3455
    35     // You need styling for the datepicker. For simplicity I've linked to the jQuery UI CSS on a CDN.
    36     wp_register_style( 'jquery-ui', 'https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css' );
    37     wp_enqueue_style( 'jquery-ui' );
    38     }
     56        // Ensure your frontend CSS still loads.
     57        wp_enqueue_style('dreamfox-deliverydate-frontend');
     58    }
    3959
    40     protected function _getBuildType()
    41   {
    42     return 'free';
    43   }
     60    /**
     61     * Build type identifier unchanged.
     62     */
     63    protected function _getBuildType() {
     64        return 'free';
     65    }
    4466}
  • woocommerce-delivery-date/trunk/src/Site/CheckoutFieldManager.php

    r2920091 r3390468  
    2121    $dateFormat = get_option('date_format');
    2222    $minDeliveryDate = date($dateFormat, strtotime('+' . ( $datesToDeliver ) . ' day', current_time('timestamp', 0)));
    23     $label = __('Select delivery date', 'dreamfox-wdd');
     23    $label = __('Select delivery date', 'woocommerce-delivery-date');
    2424    $required = false;
    2525        $this->_fields[DREAMFOX_WDD_FIELD_NAME] = array(
  • woocommerce-delivery-date/trunk/src/Site/Frontend.php

    r3111568 r3390468  
    4141    public function outputDeliveryDate() {
    4242        $view = new DeliveryDateView($this);
    43         echo $view->render();
     43        echo wp_kses_post( $view->render() );
    4444    }
    4545
     
    6161    public function renderEmailWithDeliveryDate( $order, $is_admin_email ) {
    6262        $view = new EmailView($this, $order);
    63         echo $view->render();
     63        echo wp_kses_post( $view->render() );
    6464    }
    6565
    6666    public function renderOrderView( $order ) {
    6767        $view = new OrderView($this, $order);
    68         echo $view->render();
     68        echo wp_kses_post( $view->render() );
    6969    }
    7070
  • woocommerce-delivery-date/trunk/src/Views/templates/admin_js_view.php

    r2920091 r3390468  
    11<script type="text/javascript">
    2   var wdd_static_url = <?php echo json_encode($this->getStaticUrl()); ?>;
     2  var wdd_static_url = <?php echo wp_json_encode( $this->getStaticUrl() ); ?>;
    33</script>
  • woocommerce-delivery-date/trunk/src/Views/templates/admin_order_view.php

    r2920091 r3390468  
    44?>
    55<div class="order_data_column">
    6   <h4><?php echo __('Delivery Date'); ?></h4>
     6  <h4><?php esc_html_e( 'Delivery Date', 'woocommerce-delivery-date' ); ?></h4>
    77  <p><?php echo $deliveryDate; ?></p>
    88</div>
  • woocommerce-delivery-date/trunk/src/Views/templates/delivery_date.php

    r2920091 r3390468  
    99?>
    1010<div class="dreamfox-delivery-date" id="dd__checkout_field">
    11   <h3><?php echo __('Delivery Info', 'dreamfox-wdd'); ?></h3>
     11  <h3><?php esc_html_e( 'Delivery Info', 'woocommerce-delivery-date' ); ?></h3>
    1212    <?php foreach ($checkout->checkout_fields[DREAMFOX_WDD_FIELD_NAME] as $key => $field) : ?>
    1313      <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?>
     
    1515</div>
    1616
    17 
    18 <script type="text/javascript">
    19   (function($){
    20     $(document).ready(function() {
    21       $('#<?php echo DREAMFOX_WDD_FIELD_NAME; ?>').datepicker({
    22         dateFormat : '<?php echo DateHelper::getJsDateFormat(get_option( 'date_format' )) ?>',
    23         minDate: <?php echo $this->getMinDate(); ?>,
    24       });
    25     })
    26   })(jQuery);
     17<script>
     18jQuery(function($) {
     19    $('#<?php echo esc_js( DREAMFOX_WDD_FIELD_NAME ); ?>').datepicker({
     20        dateFormat: <?php echo wp_json_encode( DateHelper::getJsDateFormat( get_option( 'date_format' ) ) ); ?>,
     21        minDate: <?php echo (int) $this->getMinDate(); ?>,
     22    });
     23});
    2724</script>
  • woocommerce-delivery-date/trunk/src/Views/templates/email_view.php

    r2920091 r3390468  
    33$label = $this->getLabel();
    44if (!empty($deliveryDate)) {
    5   echo sprintf('<p><strong>%s:</strong>%s</p>', $label, $deliveryDate);
     5    echo sprintf(
     6        '<p><strong>%s:</strong> %s</p>',
     7        esc_html( $label ),
     8        esc_html( $deliveryDate )
     9    );
    610}
  • woocommerce-delivery-date/trunk/woocommerce-delivery-date.php

    r3385198 r3390468  
    22
    33/**
    4  * Plugin Name: Woocommerce Delivery Date Premium
    5  * Plugin URI: https://dreamfoxmedia.com
     4 * Plugin Name: Delivery Date for WooCommerce
     5 * Plugin URI: https://github.com/WPPlugins/woocommerce-delivery-date
    66 * Version: 2.2.1
    77 * Author URI: https://dreamfoxmedia.com
    88 * Author: Dreamfox Media
    9  * Description: Extend Woocommerce plugin to add delivery date on checkout
     9 * Description: Extend WooCommerce plugin to add delivery date on checkout
    1010 * Requires at least: 5.0
    1111 * Tested up to: 6.8
    1212 * WC requires at least: 6.0.0
    13  * WC tested up to: 10.2
     13 * WC tested up to: 10.3
    1414 * License: GPLv3 or later
    1515 * License URI: http://www.opensource.org/licenses/gpl-license.php
    16  * Text Domain: woocommerce-delivery-date
    17  * Domain Path: /lang/
     16 * Text Domain: deliverydate-for-woocommerce
    1817 * @Developer : Marco van Loghum Slaterus / Hoang Xuan Hao ( Pamysoft )
    1918 */
     
    2423    define( 'DREAMFOX_WDD_PLUGIN_FILE', __FILE__ );
    2524}
     25/**
     26 * Resilient Freemius accessor:
     27 * - If your project exposes a Freemius function, return it (e.g., dreamfox_delivery_date()).
     28 * - Otherwise return a safe stub so calls like my_fs()->is__premium_only() won't fatally error.
     29 */
     30if ( !function_exists( 'my_fs' ) ) {
     31    function my_fs() {
     32        // If your Freemius accessor is a different one in other builds, check them here:
     33        if ( function_exists( 'dfm_sgppfw_fs' ) ) {
     34            return dfm_sgppfw_fs();
     35        }
     36        if ( function_exists( 'dreamfox_delivery_date' ) ) {
     37            return dreamfox_delivery_date();
     38        }
     39        static $stub = null;
     40        if ( !$stub ) {
     41            $stub = new class {
     42                public function add_filter() {
     43                    return null;
     44                }
     45
     46                public function __call( $name, $args ) {
     47                    return null;
     48                }
     49
     50                public function set_basename() {
     51                    return null;
     52                }
     53
     54            }
     55;
     56        }
     57        return $stub;
     58    }
     59
     60}
     61/**
     62 * If Freemius is already loaded elsewhere, sync the basename on premium.
     63 */
     64if ( function_exists( 'dfm_sgppfw_fs' ) || function_exists( 'dreamfox_delivery_date' ) ) {
     65}
    2666if ( function_exists( 'dreamfox_delivery_date' ) ) {
     67    // If helper already exists (e.g., after an update), keep basename in sync.
    2768    dreamfox_delivery_date()->set_basename( false, __FILE__ );
    2869} else {
    29     if ( !function_exists( 'dreamfox_delivery_date' ) ) {
    30         // Create a helper function for easy SDK access.
    31         function dreamfox_delivery_date() {
    32             global $dreamfox_delivery_date;
    33             if ( !isset( $dreamfox_delivery_date ) ) {
    34                 // Activate multisite network integration.
    35                 if ( !defined( 'WP_FS__PRODUCT_10651_MULTISITE' ) ) {
    36                     define( 'WP_FS__PRODUCT_10651_MULTISITE', true );
    37                 }
    38                 // Include Freemius SDK.
    39                 require_once dirname( __FILE__ ) . '/freemius/start.php';
    40                 $dreamfox_delivery_date = fs_dynamic_init( array(
    41                     'id'             => '10651',
    42                     'slug'           => 'dreamfox-deliverydate',
    43                     'premium_slug'   => 'dreamfox-deliverydate-premium',
    44                     'type'           => 'plugin',
    45                     'public_key'     => 'pk_cbd84d7abd43d4e1d2c4b5850c495',
    46                     'is_premium'     => false,
    47                     'premium_suffix' => 'Premium',
    48                     'has_addons'     => false,
    49                     'has_paid_plans' => true,
    50                     'menu'           => array(
    51                         'slug'       => 'woocommerce-delivery-date',
    52                         'first-path' => 'admin.php?page=woocommerce-delivery-date',
    53                         'support'    => false,
    54                         'network'    => true,
    55                         'parent'     => array(
    56                             'slug' => 'woocommerce',
    57                         ),
     70    // Create a helper for easy SDK access.
     71    function dreamfox_delivery_date() {
     72        global $dreamfox_delivery_date;
     73        if ( !isset( $dreamfox_delivery_date ) ) {
     74            // Activate multisite network integration.
     75            if ( !defined( 'WP_FS__PRODUCT_10651_MULTISITE' ) ) {
     76                define( 'WP_FS__PRODUCT_10651_MULTISITE', true );
     77            }
     78            // Include Freemius SDK.
     79            require_once dirname( __FILE__ ) . '/freemius/start.php';
     80            $dreamfox_delivery_date = fs_dynamic_init( array(
     81                'id'             => '10651',
     82                'slug'           => 'dreamfox-deliverydate',
     83                'premium_slug'   => 'dreamfox-deliverydate-premium',
     84                'type'           => 'plugin',
     85                'public_key'     => 'pk_cbd84d7abd43d4e1d2c4b5850c495',
     86                'is_premium'     => false,
     87                'premium_suffix' => 'Premium',
     88                'has_addons'     => false,
     89                'has_paid_plans' => true,
     90                'menu'           => array(
     91                    'slug'       => 'woocommerce-delivery-date',
     92                    'first-path' => 'admin.php?page=woocommerce-delivery-date',
     93                    'support'    => false,
     94                    'network'    => true,
     95                    'parent'     => array(
     96                        'slug' => 'woocommerce',
    5897                    ),
    59                     'is_live'        => true,
    60                 ) );
    61             }
    62             return $dreamfox_delivery_date;
     98                ),
     99                'is_live'        => true,
     100            ) );
    63101        }
     102        return $dreamfox_delivery_date;
     103    }
    64104
    65         // Init Freemius.
    66         dreamfox_delivery_date();
    67         // Signal that SDK was initiated.
    68         do_action( 'dreamfox_delivery_date_loaded' );
    69     }
    70     if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    71         include dirname( __FILE__ ) . '/bootstrap.php';
    72     }
     105    // Init Freemius (available to my_fs()).
     106    dreamfox_delivery_date();
     107    do_action( 'dreamfox_delivery_date_loaded' );
    73108}
     109/**
     110 * === FREE vs PREMIUM Freemius UI filters ===
     111 * Free  : hide account/contact/pricing menus, enable anonymous, disable branding.
     112 * Premium: show menus, disable anonymous, keep branding defaults.
     113 */
     114$fs = my_fs();
     115// FREE
     116$fs->add_filter( 'show_account', '__return_false' );
     117$fs->add_filter( 'show_contact', '__return_false' );
     118$fs->add_filter( 'show_pricing', '__return_false' );
     119$fs->add_filter( 'is_submenu_visible', '__return_false' );
     120$fs->add_filter( 'enable_anonymous', '__return_true' );
     121$fs->add_filter( 'disable_freemius_branding', '__return_true' );
     122/**
     123 * Load core plugin code for BOTH free & premium builds.
     124 * Premium-only files (e.g., /src/Premium) should be further gated INSIDE bootstrap.php
     125 * using `if ( my_fs()->is__premium_only() ) { ... }`.
     126 */
     127if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
     128    include dirname( __FILE__ ) . '/bootstrap.php';
     129}
Note: See TracChangeset for help on using the changeset viewer.