Plugin Directory

Changeset 3374441


Ignore:
Timestamp:
10/07/2025 01:31:45 PM (5 months ago)
Author:
sormano
Message:

1.1.7.1

Location:
woocommerce-advanced-free-shipping
Files:
4 added
2 deleted
42 edited
28 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/includes/admin/views/conditions-table.php

    r2781222 r3374441  
    66 *
    77 * @author      Jeroen Sormani
    8  * @package     WooCommerce Advanced Free Shipping
     8 * @package     Advanced Free Shipping for WooCommerce
    99 * @version     1.0.0
    1010 */
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/includes/admin/views/meta-box-settings.php

    r2067256 r3374441  
    66 *
    77 * @author      Jeroen Sormani
    8  * @package     WooCommerce Advanced Free Shipping
     8 * @package     Advanced Free Shipping for WooCommerce
    99 * @version     1.0.0
    1010 */
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/includes/class-wafs-match-conditions.php

    r1609491 r3374441  
    88 * @class       WAFS_Match_Conditions
    99 * @author      Jeroen Sormani
    10  * @package     WooCommerce Advanced Free Shipping
     10 * @package     Advanced Free Shipping for WooCommerce
    1111 * @version     1.0.0
    1212 */
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/includes/class-wafs-post-type.php

    r1736369 r3374441  
    88 * @class       WAFS_post_type
    99 * @author      Jeroen Sormani
    10  * @package     WooCommerce Advanced Free Shipping
     10 * @package     Advanced Free Shipping for WooCommerce
    1111 * @version     1.0.0
    1212 */
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/admin-functions.php

    r2781222 r3374441  
    108108                if ( empty( $options ) ) :
    109109                    ?><option readonly disabled><?php
    110                         _e( 'There are no options available', 'wp-conditions' );
     110                        _e( 'There are no options available', 'wpc-conditions' );
    111111                    ?></option><?php
    112112                endif;
     
    148148     */
    149149    function wpc_ajax_save_post_order() {
    150 
    151150        global $wpdb;
     151
     152        if ( ! current_user_can( 'manage_woocommerce' ) ) {
     153            return;
     154        }
    152155
    153156        check_ajax_referer( 'wpc-ajax-nonce', 'nonce' );
     
    159162        }
    160163
    161         $menu_order = 0;
     164        $menu_order = 1;
    162165        foreach ( $args['sort'] as $sort ) :
    163166
     
    180183
    181184}
     185
     186
     187if ( ! function_exists( 'wpc_ajax_toggle_enabled' ) ) {
     188
     189    /**
     190     * Toggle enabled.
     191     *
     192     * Toggle the enabled (post status) of a post.
     193     *
     194     * @since 1.0.15
     195     */
     196    function wpc_ajax_toggle_enabled() {
     197        if ( ! current_user_can( 'manage_woocommerce' ) ) {
     198            return;
     199        }
     200
     201        check_ajax_referer( 'wpc-ajax-nonce', 'nonce' );
     202
     203        if ( ! isset( $_POST['id'] ) ) {
     204            die( '-1' );
     205        }
     206
     207        $post = get_post( $_POST['id'] );
     208
     209        if ( ! $post instanceof WP_Post ) {
     210            die( '-1' );
     211        }
     212
     213        wp_update_post( array(
     214            'ID' => $post->ID,
     215            'post_status' => $post->post_status !== 'publish' ? 'publish' : 'draft',
     216        ) );
     217
     218        $post = get_post( $_POST['id'] );
     219
     220        wp_send_json( array(
     221            'enabled' => $post->post_status == 'publish' ? 'yes' : 'no',
     222        ) );
     223    }
     224    add_action( 'wp_ajax_wpc_toggle_enabled', 'wpc_ajax_toggle_enabled' );
     225
     226}
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/assets/css/wp-conditions.min.css

    r2781222 r3374441  
    1 .wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px);max-width:unset;height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:'dashicons';content:"\f502";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:'dashicons';content:"\f460";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .select2-container{vertical-align:top}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px;margin:1px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px;height:28px}@media screen and (max-width: 782px){.wpc-condition-wrap .select2-container .select2-selection--single{height:36px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:36px;height:36px}}.wpc-condition-wrap .select2-container .select2-selection--multiple .select2-selection__choice{margin:4px 5px 0 0;line-height:12px;font-size:11px;font-weight:600}.wpc-condition-wrap .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#aaa}.wpc-condition-wrap .select2-container .select2-selection--multiple{line-height:0.7}.wpc-conditions-post-table .sort{padding:0 4px;cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"\e032";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:"\e007"}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:30px;box-sizing:border-box;color:#555;text-align:center;background-color:#EEE;border:1px solid #8c8f94;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block;vertical-align:middle}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important;border-left:unset;border-radius:0 4px 4px 0;vertical-align:middle}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}
     1.wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:red}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc(42.5% - 75px);max-width:unset;height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:"dashicons";content:"";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:"dashicons";content:"";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .select2-container{vertical-align:top}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px;margin:1px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px;height:28px}@media screen and (max-width: 782px){.wpc-condition-wrap .select2-container .select2-selection--single{height:36px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:36px;height:36px}}.wpc-condition-wrap .select2-container .select2-selection--multiple .select2-selection__choice{margin:4px 5px 0 0;line-height:12px;font-size:11px;font-weight:600}.wpc-condition-wrap .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#aaa}.wpc-condition-wrap .select2-container .select2-selection--multiple{line-height:.7}.wpc-conditions-post-table .sort{cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:""}.wpc-conditions-post-table .wpc-toggle-enabled{cursor:pointer}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:30px;box-sizing:border-box;color:#555;text-align:center;background-color:#eee;border:1px solid #8c8f94;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block;vertical-align:middle}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important;border-left:unset;border-radius:0 4px 4px 0;vertical-align:middle}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}.wpc-card{background-color:#fff;color:#1e1e1e;position:relative;box-shadow:rgba(0,0,0,.1) 0px 0px 0px 1px;border-radius:1px;padding:1em;display:flex;flex-direction:row;padding-right:16px !important;margin:1em}.wpc-card .card-body-text p{margin:0}.wpc-card a.card-button-link{padding:6px 12px}.wpc-card .card-body-actions{margin-top:1em}.wpc-card .wpc-warning-icon{flex-shrink:0}.wpc-warning-icon{width:20px;height:20px;background-image:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNTc0NjUgMy4yMTYzNUwxLjUxNjMyIDE0Ljk5OTdDMS4zNzA3OSAxNS4yNTE3IDEuMjkzNzkgMTUuNTM3NCAxLjI5Mjk4IDE1LjgyODRDMS4yOTIxNiAxNi4xMTk1IDEuMzY3NTYgMTYuNDA1NiAxLjUxMTY3IDE2LjY1ODVDMS42NTU3OSAxNi45MTEzIDEuODYzNTkgMTcuMTIyIDIuMTE0NDEgMTcuMjY5NkMyLjM2NTIzIDE3LjQxNzEgMi42NTAzMiAxNy40OTY1IDIuOTQxMzIgMTcuNDk5N0gxNy4wNThDMTcuMzQ5IDE3LjQ5NjUgMTcuNjM0MSAxNy40MTcxIDE3Ljg4NDkgMTcuMjY5NkMxOC4xMzU3IDE3LjEyMiAxOC4zNDM1IDE2LjkxMTMgMTguNDg3NiAxNi42NTg1QzE4LjYzMTcgMTYuNDA1NiAxOC43MDcxIDE2LjExOTUgMTguNzA2MyAxNS44Mjg0QzE4LjcwNTUgMTUuNTM3NCAxOC42Mjg1IDE1LjI1MTcgMTguNDgzIDE0Ljk5OTdMMTEuNDI0NyAzLjIxNjM1QzExLjI3NjEgMi45NzE0NCAxMS4wNjY5IDIuNzY4OTUgMTAuODE3MyAyLjYyODQyQzEwLjU2NzcgMi40ODc4OSAxMC4yODYxIDIuNDE0MDYgOS45OTk2NSAyLjQxNDA2QzkuNzEzMjEgMi40MTQwNiA5LjQzMTU5IDIuNDg3ODkgOS4xODE5OSAyLjYyODQyQzguOTMyMzggMi43Njg5NSA4LjcyMzIxIDIuOTcxNDQgOC41NzQ2NSAzLjIxNjM1VjMuMjE2MzVaIiBzdHJva2U9IiNFNjUwNTQiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMCA3LjVWMTAuODMzMyIgc3Ryb2tlPSIjRTY1MDU0IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMTQuMTY4SDEwLjAwODMiIHN0cm9rZT0iI0U2NTA1NCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==");margin:5px 10px 0 0}
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/assets/css/wp-conditions.scss

    r2781222 r3374441  
    202202
    203203    .sort {
    204         padding: 0 4px;
    205204        cursor: move;
    206205        text-align: center;
     
    239238        margin-right: 7px;
    240239        content: "\e007";
     240    }
     241
     242    .wpc-toggle-enabled {
     243        cursor: pointer;
    241244    }
    242245}
     
    289292    }
    290293}
     294
     295
     296/**************************************************************
     297 *  Card
     298 *************************************************************/
     299.wpc-card {
     300    background-color: rgb(255, 255, 255);
     301    color: rgb(30, 30, 30);
     302    position: relative;
     303    box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 0px 1px;
     304    border-radius: calc(1px);
     305    padding: 1em;
     306    display: flex;
     307    flex-direction: row;
     308    padding-right: 16px!important;
     309    margin: 1em;
     310
     311    .card-body-text {
     312
     313        p {
     314            margin: 0;
     315        }
     316    }
     317    a.card-button-link {
     318        padding: 6px 12px;
     319    }
     320
     321    .card-body-actions {
     322        margin-top: 1em;
     323    }
     324    .wpc-warning-icon {
     325        flex-shrink: 0;
     326    }
     327}
     328
     329// Warning icon
     330.wpc-warning-icon {
     331    width: 20px;
     332    height: 20px;
     333    background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNTc0NjUgMy4yMTYzNUwxLjUxNjMyIDE0Ljk5OTdDMS4zNzA3OSAxNS4yNTE3IDEuMjkzNzkgMTUuNTM3NCAxLjI5Mjk4IDE1LjgyODRDMS4yOTIxNiAxNi4xMTk1IDEuMzY3NTYgMTYuNDA1NiAxLjUxMTY3IDE2LjY1ODVDMS42NTU3OSAxNi45MTEzIDEuODYzNTkgMTcuMTIyIDIuMTE0NDEgMTcuMjY5NkMyLjM2NTIzIDE3LjQxNzEgMi42NTAzMiAxNy40OTY1IDIuOTQxMzIgMTcuNDk5N0gxNy4wNThDMTcuMzQ5IDE3LjQ5NjUgMTcuNjM0MSAxNy40MTcxIDE3Ljg4NDkgMTcuMjY5NkMxOC4xMzU3IDE3LjEyMiAxOC4zNDM1IDE2LjkxMTMgMTguNDg3NiAxNi42NTg1QzE4LjYzMTcgMTYuNDA1NiAxOC43MDcxIDE2LjExOTUgMTguNzA2MyAxNS44Mjg0QzE4LjcwNTUgMTUuNTM3NCAxOC42Mjg1IDE1LjI1MTcgMTguNDgzIDE0Ljk5OTdMMTEuNDI0NyAzLjIxNjM1QzExLjI3NjEgMi45NzE0NCAxMS4wNjY5IDIuNzY4OTUgMTAuODE3MyAyLjYyODQyQzEwLjU2NzcgMi40ODc4OSAxMC4yODYxIDIuNDE0MDYgOS45OTk2NSAyLjQxNDA2QzkuNzEzMjEgMi40MTQwNiA5LjQzMTU5IDIuNDg3ODkgOS4xODE5OSAyLjYyODQyQzguOTMyMzggMi43Njg5NSA4LjcyMzIxIDIuOTcxNDQgOC41NzQ2NSAzLjIxNjM1VjMuMjE2MzVaIiBzdHJva2U9IiNFNjUwNTQiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMCA3LjVWMTAuODMzMyIgc3Ryb2tlPSIjRTY1MDU0IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMTQuMTY4SDEwLjAwODMiIHN0cm9rZT0iI0U2NTA1NCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==");
     334    margin: 5px 10px 0 0;
     335}
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/assets/js/wp-conditions.js

    r2781222 r3374441  
    99            elementWrap: '.wpc-condition-group-wrap',
    1010            elementsContainer: '.wpc-condition-groups',
    11             onAddElement: function (template, container, $self) {
    12                 var new_id = Math.floor(Math.random() * 899999999 + 100000000); // Random number sequence of 9 length
    13                 template.find('input[name], select[name]').attr('name', function (index, value) {
    14                     return (value.replace('9999', new_id)) || value;
    15                 });
    16                 template.find('.wpc-condition[data-id]').attr('data-id', function (index, value) {
    17                     return (value.replace('9999', new_id)) || value;
    18                 });
    19                 // Fix #20 - condition IDs being replaced by group IDs
    20                 template.find('.wpc-condition-template .wpc-condition[data-id]').attr('data-id', '9999');
    21 
    22                 template.find('[data-group]').attr('data-group', function (index, value) {
    23                     return (value.replace('9999', new_id)) || value;
    24                 });
    25 
    26                 template.find('.repeater-active').removeClass('repeater-active');
    27 
    28                 // Init condition group repeater
    29                 wpc_condition_row_repeater();
    30             },
     11            onAddElement: function (template, container, $self) {
     12                var new_id = Math.floor(Math.random() * 899999999 + 100000000); // Random number sequence of 9 length
     13                template.find('input[name], select[name]').attr('name', function (index, value) {
     14                    return (value.replace('9999', new_id)) || value;
     15                });
     16                template.find('.wpc-condition[data-id]').attr('data-id', function (index, value) {
     17                    return (value.replace('9999', new_id)) || value;
     18                });
     19                // Fix #20 - condition IDs being replaced by group IDs
     20                template.find('.wpc-condition-template .wpc-condition[data-id]').attr('data-id', '9999');
     21
     22                template.find('[data-group]').attr('data-group', function (index, value) {
     23                    return (value.replace('9999', new_id)) || value;
     24                });
     25
     26                template.find('.repeater-active').removeClass('repeater-active');
     27
     28                // Init condition group repeater
     29                wpc_condition_row_repeater();
     30            },
    3131            removeElement: function( el ) {
    3232                el.remove();
     
    162162
    163163    });
     164
     165    // Toggle a
     166    function toggle_enabled(id, callback) {
     167         var data = {
     168            action: 'wpc_toggle_enabled',
     169            id: id,
     170            nonce: wpc.nonce
     171        };
     172
     173        $.post(ajaxurl, data, callback);
     174    }
     175
     176    // Toggle enabled from overview
     177    $(document.body).on('click', '.wpc-conditions-post-table .wpc-toggle-enabled', function (e) {
     178        e.preventDefault();
     179
     180        var $row = $(this).closest('tr');
     181        toggle_enabled($row.attr('data-id'), function(response) {
     182            if (response.enabled == 'yes') {
     183                $row.find('.woocommerce-input-toggle').removeClass('woocommerce-input-toggle--disabled').addClass('woocommerce-input-toggle--enabled');
     184            } else {
     185                $row.find('.woocommerce-input-toggle').removeClass('woocommerce-input-toggle--enabled').addClass('woocommerce-input-toggle--disabled');
     186            }
     187        });
     188    });
     189
     190    // Enable from notice card
     191    $(document.body).on('click', '.wpc-card .wpc-toggle-enabled', function (e) {
     192        const card = $(this).parents('.wpc-card');
     193
     194        toggle_enabled($(this).attr('data-id'), function(response) {
     195            if (response.enabled == 'yes') {
     196                card.hide();
     197            } else {
     198                console.error(error);
     199            }
     200        });
     201    });
     202
    164203
    165204
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/assets/js/wp-conditions.min.js

    r2781222 r3374441  
    1 "use strict";jQuery(function(a){function c(){a(".wpc-condition-group").repeater({addTrigger:".wpc-condition-add",removeTrigger:".wpc-condition-delete",template:".wpc-condition-template .wpc-condition-wrap",elementWrap:".wpc-condition-wrap",elementsContainer:".wpc-conditions-list",onAddElement:function(t,e,o,n){var i=Math.floor(899999999*Math.random()+1e8);e.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",i)||e}),e.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",i)||e}),e.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),e.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",i)||e}),e.find(".repeater-active").removeClass("repeater-active"),c()}})}a(".wpc-conditions").repeater({addTrigger:".wpc-condition-group-add",removeTrigger:".wpc-condition-group .delete",template:".wpc-condition-group-template .wpc-condition-group-wrap",elementWrap:".wpc-condition-group-wrap",elementsContainer:".wpc-condition-groups",onAddElement:function(t,e,o){var n=Math.floor(899999999*Math.random()+1e8);t.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),t.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",n)||e}),t.find(".repeater-active").removeClass("repeater-active"),c()},removeElement:function(t){t.remove()}}),c(),a(document.body).on("click",".wpc-conditions .duplicate",function(){var t=a(this).parents(".wpc-condition-group-wrap"),o=t.find(".wpc-condition-group").attr("data-group"),e=a(this).parents(".wpc-condition-groups"),n=Math.floor(899999999*Math.random()+1e8);t.find(".enhanced").select2("destroy").removeClass("enhanced");var i=t.clone();a(t).find("select").each(function(t){a(i).find("select").eq(t).val(a(this).val())}),i.find(".wpc-condition-group").attr("data-group",n),i.find("input[name], select[name]").attr("name",function(t,e){return e.replace("conditions["+o+"]","conditions["+n+"]")}),i.find(".repeater-active").removeClass("repeater-active"),e.append(i),a(document.body).trigger("wc-enhanced-select-init"),c(),a("html, body").on("scroll mousedown DOMMouseScroll mousewheel keydown touchmove",function(t){a("html, body").stop().off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")}),a("body, html").animate({scrollTop:a(i).offset().top-50},750,function(){a("html, body").off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")})}),a(document.body).on("change",".wpc-condition",function(){var e={action:wpc2.action_prefix+"update_condition_value",id:a(this).attr("data-id"),group:a(this).parents(".wpc-condition-group").attr("data-group"),condition:a(this).val(),nonce:wpc.nonce},o=a(this).parents(".wpc-condition-wrap").first(),n=".wpc-value-field-wrap";o.find(n).html('<span class="wpc-loading" style="width: calc( 42.5% - 75px ); border: 1px solid transparent; display: inline-block;">&nbsp;</span>').block({message:null,overlayCSS:{background:"",opacity:.6}}),a.post(ajaxurl,e,function(t){o.find(n).replaceWith(t),a(document.body).trigger("wc-enhanced-select-init")});var i=o.find(".wpc-operator").val();o.find(".wpc-operator").empty().html(function(){var o=a(this),t=wpc.condition_operators[e.condition]||wpc.condition_operators.default;a.each(t,function(t,e){o.append(a("<option/>").attr("value",t).text(e)),o.val(i).val()||o.val(o.find("option:first").val())})}),o.find(".wpc-description").html(function(){return a('<span class="woocommerce-help-tip" />').attr("data-tip",wpc.condition_descriptions[e.condition]||"")}),a(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style")}),a(".wpc-conditions-post-table.wpc-sortable-post-table tbody").sortable({items:"tr",handle:".sort",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style")},update:function(t,e){var o=a(this).closest("table");o.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={action:"wpc_save_post_order",form:a(this).closest("form").serialize(),nonce:wpc.nonce};a.post(ajaxurl,n,function(t){a(".wpc-conditions-post-table tbody tr:even").addClass("alternate"),a(".wpc-conditions-post-table tbody tr:odd").removeClass("alternate"),o.unblock()})}})});
     1"use strict";jQuery(function(i){function c(){i(".wpc-condition-group").repeater({addTrigger:".wpc-condition-add",removeTrigger:".wpc-condition-delete",template:".wpc-condition-template .wpc-condition-wrap",elementWrap:".wpc-condition-wrap",elementsContainer:".wpc-conditions-list",onAddElement:function(t,e,o,n){var a=Math.floor(899999999*Math.random()+1e8);e.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",a)||e}),e.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",a)||e}),e.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),e.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",a)||e}),e.find(".repeater-active").removeClass("repeater-active"),c()}})}function o(t,e){var o={action:"wpc_toggle_enabled",id:t,nonce:wpc.nonce};i.post(ajaxurl,o,e)}i(".wpc-conditions").repeater({addTrigger:".wpc-condition-group-add",removeTrigger:".wpc-condition-group .delete",template:".wpc-condition-group-template .wpc-condition-group-wrap",elementWrap:".wpc-condition-group-wrap",elementsContainer:".wpc-condition-groups",onAddElement:function(t,e,o){var n=Math.floor(899999999*Math.random()+1e8);t.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),t.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",n)||e}),t.find(".repeater-active").removeClass("repeater-active"),c()},removeElement:function(t){t.remove()}}),c(),i(document.body).on("click",".wpc-conditions .duplicate",function(){var t=i(this).parents(".wpc-condition-group-wrap"),o=t.find(".wpc-condition-group").attr("data-group"),e=i(this).parents(".wpc-condition-groups"),n=Math.floor(899999999*Math.random()+1e8);t.find(".enhanced").select2("destroy").removeClass("enhanced");var a=t.clone();i(t).find("select").each(function(t){i(a).find("select").eq(t).val(i(this).val())}),a.find(".wpc-condition-group").attr("data-group",n),a.find("input[name], select[name]").attr("name",function(t,e){return e.replace("conditions["+o+"]","conditions["+n+"]")}),a.find(".repeater-active").removeClass("repeater-active"),e.append(a),i(document.body).trigger("wc-enhanced-select-init"),c(),i("html, body").on("scroll mousedown DOMMouseScroll mousewheel keydown touchmove",function(t){i("html, body").stop().off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")}),i("body, html").animate({scrollTop:i(a).offset().top-50},750,function(){i("html, body").off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")})}),i(document.body).on("change",".wpc-condition",function(){var e={action:wpc2.action_prefix+"update_condition_value",id:i(this).attr("data-id"),group:i(this).parents(".wpc-condition-group").attr("data-group"),condition:i(this).val(),nonce:wpc.nonce},o=i(this).parents(".wpc-condition-wrap").first(),n=".wpc-value-field-wrap";o.find(n).html('<span class="wpc-loading" style="width: calc( 42.5% - 75px ); border: 1px solid transparent; display: inline-block;">&nbsp;</span>').block({message:null,overlayCSS:{background:"",opacity:.6}}),i.post(ajaxurl,e,function(t){o.find(n).replaceWith(t),i(document.body).trigger("wc-enhanced-select-init")});var a=o.find(".wpc-operator").val();o.find(".wpc-operator").empty().html(function(){var o=i(this),t=wpc.condition_operators[e.condition]||wpc.condition_operators.default;i.each(t,function(t,e){o.append(i("<option/>").attr("value",t).text(e)),o.val(a).val()||o.val(o.find("option:first").val())})}),o.find(".wpc-description").html(function(){return i('<span class="woocommerce-help-tip" />').attr("data-tip",wpc.condition_descriptions[e.condition]||"")}),i(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),i("#tiptip_holder").removeAttr("style"),i("#tiptip_arrow").removeAttr("style")}),i(document.body).on("click",".wpc-conditions-post-table .wpc-toggle-enabled",function(t){t.preventDefault();var e=i(this).closest("tr");o(e.attr("data-id"),function(t){"yes"==t.enabled?e.find(".woocommerce-input-toggle").removeClass("woocommerce-input-toggle--disabled").addClass("woocommerce-input-toggle--enabled"):e.find(".woocommerce-input-toggle").removeClass("woocommerce-input-toggle--enabled").addClass("woocommerce-input-toggle--disabled")})}),i(document.body).on("click",".wpc-card .wpc-toggle-enabled",function(t){var e=i(this).parents(".wpc-card");o(i(this).attr("data-id"),function(t){"yes"==t.enabled?e.hide():console.error(error)})}),i(".wpc-conditions-post-table.wpc-sortable-post-table tbody").sortable({items:"tr",handle:".sort",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style")},update:function(t,e){var o=i(this).closest("table");o.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={action:"wpc_save_post_order",form:i(this).closest("form").serialize(),nonce:wpc.nonce};i.post(ajaxurl,n,function(t){i(".wpc-conditions-post-table tbody tr:even").addClass("alternate"),i(".wpc-conditions-post-table tbody tr:odd").removeClass("alternate"),o.unblock()})}})});
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-contains-product-condition.php

    r2067256 r3374441  
    5959                'type' => 'select',
    6060                'custom_attributes' => array(
    61                     'data-placeholder' => __( 'Search for a product', 'wp-conditions' ),
     61                    'data-placeholder' => __( 'Search for a product', 'wpc-conditions' ),
    6262                ),
    6363                'class' => array( 'wpc-value', 'wc-product-search' ),
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-height-condition.php

    r1647397 r3374441  
    1313
    1414            parent::__construct();
     15        }
     16
     17        public function validate() {
     18            return ! empty( WC()->cart->get_cart() );
    1519        }
    1620
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-length-condition.php

    r1647397 r3374441  
    1313
    1414            parent::__construct();
     15        }
     16
     17        public function validate() {
     18            return ! empty( WC()->cart->get_cart() );
    1519        }
    1620
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-page-condition.php

    r2781222 r3374441  
    2525            if ( '==' == $operator ) :
    2626
    27                 if ( is_array( term_exists ( $value, 'product_cat' ) ) ) : // term_exists return array when true
    28                     $match = ( $wp_query->is_archive() && isset( $wp_query->query_vars['product_cat'] ) && $value == $wp_query->query_vars['product_cat'] );
     27                if ( $wp_query->is_archive() && is_array( term_exists( $value, 'product_cat' ) ) ) : // term_exists return array when true
     28                    $match = ( isset( $wp_query->query_vars['product_cat'] ) && $value == $wp_query->query_vars['product_cat'] );
    2929                elseif ( wc_get_page_id( 'shop' ) == $value ) : // Shop page
    30                     $match = ( 'product' == $wp_query->query_vars['post_type'] && $wp_query->is_archive() );
     30                    $match = is_shop();
    3131                else :
    32                     $match = ( $post_id == $value );
     32                    // #29 - page/single check added to prevent issue with archive pages where $post->ID is set to the first product
     33                    $match = ( ( is_page( $post_id ) || is_single( $post_id ) ) && $post_id == $value );
    3334                endif;
    3435
    3536            elseif ( '!=' == $operator ) :
    3637
    37                 if ( is_array( term_exists ( $value, 'product_cat' ) ) ) : // term_exists return array when true
    38                     $match = ( $wp_query->is_archive() && isset( $wp_query->query_vars['product_cat'] ) && $value != $wp_query->query_vars['product_cat'] );
     38                if ( $wp_query->is_archive() && is_array( term_exists( $value, 'product_cat' ) ) ) : // term_exists return array when true
     39                    $match = ( isset( $wp_query->query_vars['product_cat'] ) && $value != $wp_query->query_vars['product_cat'] );
    3940                elseif ( wc_get_page_id( 'shop' ) == $value ) : // Shop page
    40                     $match = ! ( 'product' == $wp_query->query_vars['post_type'] && $wp_query->is_archive() );
     41                    $match = ! is_shop();
    4142                else :
    42                     $match = ( $post_id != $value );
     43                    $match = ( ( is_page( $post_id ) || is_single( $post_id ) ) && $post_id != $value );
    4344                endif;
    4445
     
    6869
    6970            $wc_pages = array(
    70                 get_option( 'woocommerce_shop_page_id' )      => __( 'Shop page', 'woocommerce-advanced-messages' ),
    71                 get_option( 'woocommerce_cart_page_id' )      => __( 'Cart', 'woocommerce-advanced-messages' ),
    72                 get_option( 'woocommerce_checkout_page_id' )  => __( 'Checkout', 'woocommerce-advanced-messages' ),
    73                 get_option( 'woocommerce_terms_page_id' )     => __( 'Terms & conditions', 'woocommerce-advanced-messages' ),
    74                 get_option( 'woocommerce_myaccount_page_id' ) => __( 'My account', 'woocommerce-advanced-messages' ),
     71                get_option( 'woocommerce_shop_page_id' )      => __( 'Shop page', 'wpc-conditions' ),
     72                get_option( 'woocommerce_cart_page_id' )      => __( 'Cart', 'wpc-conditions' ),
     73                get_option( 'woocommerce_checkout_page_id' )  => __( 'Checkout', 'wpc-conditions' ),
     74                get_option( 'woocommerce_terms_page_id' )     => __( 'Terms & conditions', 'wpc-conditions' ),
     75                get_option( 'woocommerce_myaccount_page_id' ) => __( 'My account', 'wpc-conditions' ),
    7576            );
    7677            $wc_categories = get_terms( 'product_cat', array( 'hide_empty' => false ) );
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-product-age-condition.php

    r1647397 r3374441  
    3030                $match = ( $compare_value != $value );
    3131            elseif ( '>=' == $operator ) :
    32                 if ( date( 'Y-m-d', strtotime( $raw_value ) ) > 1970 ) {
     32                if ( is_numeric( $raw_value ) ) {
     33                    $match = ( $compare_value <= $value );
     34                } else {
     35                    $match = ( $compare_value >= $value ); // Reversed operator intentional
     36                }
     37            elseif ( '<=' == $operator ) :
     38                if ( is_numeric( $raw_value ) ) {
    3339                    $match = ( $compare_value >= $value ); // Reversed operator intentional
    3440                } else {
    3541                    $match = ( $compare_value <= $value );
    36                 }
    37             elseif ( '<=' == $operator ) :
    38                 if ( date( 'Y-m-d', strtotime( $raw_value ) ) > 1970 ) {
    39                     $match = ( $compare_value <= $value );
    40                 } else {
    41                     $match = ( $compare_value >= $value ); // Reversed operator intentional
    4242                }
    4343            endif;
     
    4949        public function get_value( $value ) {
    5050
    51             if ( date( 'Y-m-d', strtotime( $value ) ) > 1970 ) {
     51            if ( is_numeric( $value ) ) {
     52                $value = date( 'Y-m-d', strtotime( "-$value days", time() ) );
     53            } else {
    5254                $value = date( 'Y-m-d', strtotime( $value ) );
    53             } else {
    54                 $value = date( 'Y-m-d', strtotime( "-$value days", time() ) );
    5555            }
    5656
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-product-category-condition.php

    r2067256 r3374441  
    1919        }
    2020
     21        public function get_value( $value ) {
     22            $term = get_term_by( 'slug', $value, 'product_cat' );
     23            return apply_filters( 'wpml_object_id', $term->term_id ?? null, 'product_cat', true );
     24        }
     25
    2126        public function match( $match, $operator, $value ) {
    2227
     
    3035            $value = $this->get_value( $value );
    3136
     37            // Category not found, so return false
     38            if ( ! $value ) {
     39                return false;
     40            }
     41
    3242            if ( '==' == $operator ) {
    33                 $match = $match = ( has_term( $value, 'product_cat', $product->get_id() ) );
     43                $match = ( has_term( $value, 'product_cat', $product->get_id() ) );
    3444            } elseif ( '!=' == $operator ) {
    35                 $match = ! $match = ( has_term( $value, 'product_cat', $product->get_id() ) );
     45                $match = ! ( has_term( $value, 'product_cat', $product->get_id() ) );
    3646            }
    3747
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-product-condition.php

    r1647397 r3374441  
    2222            /** @var $product WC_Product */
    2323            global $product;
    24             return $product->get_id();
     24            return apply_filters( 'wpml_object_id', $product->get_id(), 'product', true );
     25        }
     26
     27        public function get_value( $value ) {
     28            return apply_filters( 'wpml_object_id', $value, 'product', true );
    2529        }
    2630
     
    3943
    4044            $field_args = array(
    41                 'type' => 'text',
     45                'type' => 'select',
    4246                'custom_attributes' => array(
    43                     'data-placeholder' => __( 'Search for a product', 'wp-conditions' ),
     47                    'data-placeholder' => __( 'Search for a product', 'wpc-conditions' ),
    4448                ),
    4549                'class' => array( 'wpc-value', 'wc-product-search' ),
    4650                'options' => array(),
    4751            );
    48 
    49             // Should be a select field in WC 2.7+
    50             if ( version_compare( WC()->version, '2.7', '>=' ) ) {
    51                 $field_args['type'] = 'select';
    52             }
    5352
    5453            return $field_args;
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-product-tag-condition.php

    r1647397 r3374441  
    1919        }
    2020
     21        public function get_value( $value ) {
     22            $term = get_term_by( 'slug', $value, 'product_tag' );
     23            return apply_filters( 'wpml_object_id', $term->term_id ?? null, 'product_tag', true );
     24        }
     25
    2126        public function match( $match, $operator, $value ) {
    2227
     
    2833            global $product;
    2934            $value = $this->get_value( $value );
     35
     36            // Tag not found
     37            if ( ! $value ) {
     38                return false;
     39            }
    3040
    3141            if ( $operator == '==' ) {
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-role-condition.php

    r1687709 r3374441  
    5353        public function get_value_field_args() {
    5454
    55             $user_roles = array_keys( get_editable_roles() );
     55            $user_roles = array_keys( wp_roles()->roles );
    5656            $user_roles = array_combine( $user_roles, $user_roles );
    57             $user_roles['not_logged_in'] = __( 'Guest user', 'wp-conditions' );
     57            $user_roles['not_logged_in'] = __( 'Guest user', 'wpc-conditions' );
    5858
    5959            $field_args = array(
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-stock-status-condition.php

    r2067256 r3374441  
    1818
    1919            $value = $this->get_value( $value );
     20            $value = $value === '1' ? 'instock' : $value;
     21            $value = $value === '0' ? 'outofstock' : $value;
    2022
    2123            if ( '==' == $operator ) :
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-time-condition.php

    r1647397 r3374441  
    1010            $this->slug        = __( 'time', 'wpc-conditions' );
    1111            $this->group       = __( 'General', 'wpc-conditions' );
    12             $this->description = sprintf( __( 'Compares current server time to user given time. Current time: %s', 'woocommerce-advanced-messages' ), date_i18n( get_option( 'time_format' ) ) );
     12            $this->description = sprintf( __( 'Compares current server time to user given time. Current time: %s', 'wpc-conditions' ), date_i18n( get_option( 'time_format' ) ) );
    1313
    1414            parent::__construct();
     
    2828                'type' => 'text',
    2929                'class' => array( 'wpc-value' ),
    30                 'placeholder' => sprintf( __( 'Current time is: %s', 'woocommerce-advanced-messages' ), current_time( 'H:i' ) ),
     30                'placeholder' => sprintf( __( 'Current time is: %s', 'wpc-conditions' ), current_time( 'H:i' ) ),
    3131            );
    3232
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-weight-condition.php

    r2781222 r3374441  
    1616
    1717        public function get_value( $value ) {
    18             return str_replace( ',', '.', $value );
     18            return (float) str_replace( ',', '.', $value );
    1919        }
    2020
     
    2424
    2525        public function match( $match, $operator, $value ) {
    26             $value         = number_format( $this->get_value( $value ), 5 );
    27             $compare_value = number_format( $this->get_compare_value(), 5 );
     26            $value         = (float) number_format( $this->get_value( $value ), 5, '.', '' );
     27            $compare_value = (float) number_format( $this->get_compare_value(), 5, '.', '' );
    2828
    2929            if ( '==' == $operator ) :
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/conditions/wpc-width-condition.php

    r1647397 r3374441  
    1313
    1414            parent::__construct();
     15        }
     16
     17        public function validate() {
     18            return ! empty( WC()->cart->get_cart() );
    1519        }
    1620
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/functions.php

    r1647397 r3374441  
    137137    function wpc_get_condition( $condition ) {
    138138
    139         $class_name = 'WPC_' . implode( '_', array_map( 'ucfirst', explode( '_', $condition ) ) ) . '_Condition';
     139        $class_name = 'WPC_' . implode( '_', array_map( 'ucfirst', explode( '_', $condition ?? '' ) ) ) . '_Condition';
    140140        $class_name = apply_filters( 'wpc_get_condition_class_name', $class_name, $condition );
    141141
     
    193193                if ( false == $match ) :
    194194                    $match_condition_group = false;
     195                    break; // No point to going over additional conditions when a condition is matching false in a group.
    195196                endif;
    196197
     
    250251
    251252                        case 'value' :
    252                             if ( is_array( $condition_value ) ) :
    253                                 $condition_value = array_map( 'sanitize_text_field', $condition_value );
    254                             elseif ( is_string( $condition_value ) ) :
    255                                 $condition_value = sanitize_text_field( $condition_value );
    256                             endif;
     253                            $condition_value = wpc_clean( $condition_value );
    257254                            break;
    258255
     
    271268    }
    272269
     270}
     271
     272if ( ! function_exists( 'wpc_clean' ) ) {
     273    /**
     274     * Clean variables using sanitize_text_field. Arrays are cleaned recursively.
     275     * Non-scalar values are ignored.
     276     * Copy of wc_clean() from WooCommerce.
     277     *
     278     * @since 1.0.13
     279     *
     280     * @param  string|array $var Data to sanitize.
     281     * @return string|array
     282     */
     283    function wpc_clean( $var ) {
     284        if ( is_array( $var ) ) {
     285            return array_map( 'wpc_clean', $var );
     286        } else {
     287            return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
     288        }
     289    }
    273290}
    274291
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/package.json

    r2781222 r3374441  
    66  "dependencies": {},
    77  "devDependencies": {
    8     "@babel/core": "^7.14.3",
    9     "@babel/preset-env": "^7.14.4",
     8    "@babel/core": "^7.4.0",
     9    "@babel/preset-env": "^7.4.2",
    1010    "browser-sync": "^2.26.14",
    11     "gulp": "^4.0.0",
     11    "gulp": "^4.0.2",
    1212    "gulp-babel": "^8.0.0",
    1313    "gulp-rename": "^1.4.0",
    14     "gulp-sass": "^4.1.0",
     14    "gulp-sass": "^5.1.0",
    1515    "gulp-sourcemaps": "^2.6.5",
    16     "gulp-uglify": "^3.0.2"
     16    "gulp-uglify": "^3.0.2",
     17    "sass": "^1.54.5"
    1718  },
    1819  "scripts": {
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/libraries/wp-conditions/readme.txt

    r2781222 r3374441  
    55
    66
    7 # Current version: 1.0.12
     7# Current version: 1.0.15.1
    88
    99# Changelog
     10
     11= 1.0.15.1 - 06/03/2024 =
     12
     13* [Add] - Cards / notice to show when a object is not enabled
     14
     15= 1.0.15 - 19/02/2024 =
     16
     17* [Add] - Toggle functionality
     18* [Fix] - Add missing capability check
     19
     20= 1.0.14 - 10/07/2023 =
     21
     22* [Improvement] - Condition group matching performance
     23* [Fix] - Incorrect textdomains
     24* [Fix] - Fatal error when Weight/Width/Height/Length condition values are empty in PHP 8+
     25* [Fix] - #32 - Weight issue
     26
     27= 1.0.13 - 03/01/2023 =
     28
     29* [Add] - Introduced the function wpc_clean() to recursively sanitize
     30* [Update] - To new Gulp structure
     31* [Fix] - 'Page' condition when matching for product X, matched for archive page as well when product X was first.
     32* [Fix] - 'User role' condition allow selecting all user roles, not just 'Editable' for current user.
     33* [Fix] - 'Stock status' condition not working as expected in certain situations
    1034
    1135= 1.0.12 - 30/12/2021 =
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/readme.txt

    r3018707 r3374441  
    44Requires at least: 5.0
    55Tested up to: 6.4
    6 Stable tag: 1.1.7
     6Stable tag: 1.1.7.1
    77Requires PHP: 7.0
    88License: GPLv3 or later
     
    110110== Changelog ==
    111111
     112= 1.1.7.1 - 07-10-2025 =
     113
     114* [Update] - Plugin name from WooCommerce Advanced Free Shipping to Advanced Free Shipping for WooCommerce
     115
    112116= 1.1.7 - 08-01-2024 =
    113117
  • woocommerce-advanced-free-shipping/tags/1.1.7.1/woocommerce-advanced-free-shipping.php

    r3018707 r3374441  
    11<?php
    22/*
    3  * Plugin Name:     WooCommerce Advanced Free Shipping
     3 * Plugin Name:     Advanced Free Shipping for WooCommerce
    44 * Plugin URI:      https://wordpress.org/plugins/woocommerce-advanced-free-shipping/
    5  * Description:     WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
     5 * Description:     Advanced Free Shipping for WooCommerce is an plugin which allows you to set up advanced free shipping conditions.
    66 * Version:         1.1.7
    77 * Author:          Jeroen Sormani
     
    1313 * Copyright Jeroen Sormani
    1414 *
    15  *     This file is part of Woocommerce Advanced Free Shipping,
     15 *     This file is part of Advanced Free Shipping for WooCommerce,
    1616 *     a plugin for WordPress.
    1717 *
    18  *     Woocommerce Advanced Free Shipping is free software:
     18 *     Advanced Free Shipping for WooCommerce is free software:
    1919 *     You can redistribute it and/or modify it under the terms of the
    2020 *     GNU General Public License as published by the Free Software
     
    2222 *     any later version.
    2323 *
    24  *     Woocommerce Advanced Free Shipping is distributed in the hope that
     24 *     Advanced Free Shipping for WooCommerce is distributed in the hope that
    2525 *     it will be useful, but WITHOUT ANY WARRANTY; without even the
    2626 *     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  • woocommerce-advanced-free-shipping/trunk/includes/admin/views/conditions-table.php

    r2781222 r3374441  
    66 *
    77 * @author      Jeroen Sormani
    8  * @package     WooCommerce Advanced Free Shipping
     8 * @package     Advanced Free Shipping for WooCommerce
    99 * @version     1.0.0
    1010 */
  • woocommerce-advanced-free-shipping/trunk/includes/admin/views/meta-box-settings.php

    r2067256 r3374441  
    66 *
    77 * @author      Jeroen Sormani
    8  * @package     WooCommerce Advanced Free Shipping
     8 * @package     Advanced Free Shipping for WooCommerce
    99 * @version     1.0.0
    1010 */
  • woocommerce-advanced-free-shipping/trunk/includes/class-wafs-match-conditions.php

    r1609491 r3374441  
    88 * @class       WAFS_Match_Conditions
    99 * @author      Jeroen Sormani
    10  * @package     WooCommerce Advanced Free Shipping
     10 * @package     Advanced Free Shipping for WooCommerce
    1111 * @version     1.0.0
    1212 */
  • woocommerce-advanced-free-shipping/trunk/includes/class-wafs-post-type.php

    r1736369 r3374441  
    88 * @class       WAFS_post_type
    99 * @author      Jeroen Sormani
    10  * @package     WooCommerce Advanced Free Shipping
     10 * @package     Advanced Free Shipping for WooCommerce
    1111 * @version     1.0.0
    1212 */
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/admin-functions.php

    r2781222 r3374441  
    108108                if ( empty( $options ) ) :
    109109                    ?><option readonly disabled><?php
    110                         _e( 'There are no options available', 'wp-conditions' );
     110                        _e( 'There are no options available', 'wpc-conditions' );
    111111                    ?></option><?php
    112112                endif;
     
    148148     */
    149149    function wpc_ajax_save_post_order() {
    150 
    151150        global $wpdb;
     151
     152        if ( ! current_user_can( 'manage_woocommerce' ) ) {
     153            return;
     154        }
    152155
    153156        check_ajax_referer( 'wpc-ajax-nonce', 'nonce' );
     
    159162        }
    160163
    161         $menu_order = 0;
     164        $menu_order = 1;
    162165        foreach ( $args['sort'] as $sort ) :
    163166
     
    180183
    181184}
     185
     186
     187if ( ! function_exists( 'wpc_ajax_toggle_enabled' ) ) {
     188
     189    /**
     190     * Toggle enabled.
     191     *
     192     * Toggle the enabled (post status) of a post.
     193     *
     194     * @since 1.0.15
     195     */
     196    function wpc_ajax_toggle_enabled() {
     197        if ( ! current_user_can( 'manage_woocommerce' ) ) {
     198            return;
     199        }
     200
     201        check_ajax_referer( 'wpc-ajax-nonce', 'nonce' );
     202
     203        if ( ! isset( $_POST['id'] ) ) {
     204            die( '-1' );
     205        }
     206
     207        $post = get_post( $_POST['id'] );
     208
     209        if ( ! $post instanceof WP_Post ) {
     210            die( '-1' );
     211        }
     212
     213        wp_update_post( array(
     214            'ID' => $post->ID,
     215            'post_status' => $post->post_status !== 'publish' ? 'publish' : 'draft',
     216        ) );
     217
     218        $post = get_post( $_POST['id'] );
     219
     220        wp_send_json( array(
     221            'enabled' => $post->post_status == 'publish' ? 'yes' : 'no',
     222        ) );
     223    }
     224    add_action( 'wp_ajax_wpc_toggle_enabled', 'wpc_ajax_toggle_enabled' );
     225
     226}
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/assets/css/wp-conditions.min.css

    r2781222 r3374441  
    1 .wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px);max-width:unset;height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:'dashicons';content:"\f502";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:'dashicons';content:"\f460";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .select2-container{vertical-align:top}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px;margin:1px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px;height:28px}@media screen and (max-width: 782px){.wpc-condition-wrap .select2-container .select2-selection--single{height:36px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:36px;height:36px}}.wpc-condition-wrap .select2-container .select2-selection--multiple .select2-selection__choice{margin:4px 5px 0 0;line-height:12px;font-size:11px;font-weight:600}.wpc-condition-wrap .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#aaa}.wpc-condition-wrap .select2-container .select2-selection--multiple{line-height:0.7}.wpc-conditions-post-table .sort{padding:0 4px;cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"\e032";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:"\e007"}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:30px;box-sizing:border-box;color:#555;text-align:center;background-color:#EEE;border:1px solid #8c8f94;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block;vertical-align:middle}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important;border-left:unset;border-radius:0 4px 4px 0;vertical-align:middle}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}
     1.wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:red}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc(42.5% - 75px);max-width:unset;height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:"dashicons";content:"";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:"dashicons";content:"";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .select2-container{vertical-align:top}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px;margin:1px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px;height:28px}@media screen and (max-width: 782px){.wpc-condition-wrap .select2-container .select2-selection--single{height:36px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__rendered,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:36px;height:36px}}.wpc-condition-wrap .select2-container .select2-selection--multiple .select2-selection__choice{margin:4px 5px 0 0;line-height:12px;font-size:11px;font-weight:600}.wpc-condition-wrap .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#aaa}.wpc-condition-wrap .select2-container .select2-selection--multiple{line-height:.7}.wpc-conditions-post-table .sort{cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:""}.wpc-conditions-post-table .wpc-toggle-enabled{cursor:pointer}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:30px;box-sizing:border-box;color:#555;text-align:center;background-color:#eee;border:1px solid #8c8f94;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block;vertical-align:middle}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important;border-left:unset;border-radius:0 4px 4px 0;vertical-align:middle}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}.wpc-card{background-color:#fff;color:#1e1e1e;position:relative;box-shadow:rgba(0,0,0,.1) 0px 0px 0px 1px;border-radius:1px;padding:1em;display:flex;flex-direction:row;padding-right:16px !important;margin:1em}.wpc-card .card-body-text p{margin:0}.wpc-card a.card-button-link{padding:6px 12px}.wpc-card .card-body-actions{margin-top:1em}.wpc-card .wpc-warning-icon{flex-shrink:0}.wpc-warning-icon{width:20px;height:20px;background-image:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNTc0NjUgMy4yMTYzNUwxLjUxNjMyIDE0Ljk5OTdDMS4zNzA3OSAxNS4yNTE3IDEuMjkzNzkgMTUuNTM3NCAxLjI5Mjk4IDE1LjgyODRDMS4yOTIxNiAxNi4xMTk1IDEuMzY3NTYgMTYuNDA1NiAxLjUxMTY3IDE2LjY1ODVDMS42NTU3OSAxNi45MTEzIDEuODYzNTkgMTcuMTIyIDIuMTE0NDEgMTcuMjY5NkMyLjM2NTIzIDE3LjQxNzEgMi42NTAzMiAxNy40OTY1IDIuOTQxMzIgMTcuNDk5N0gxNy4wNThDMTcuMzQ5IDE3LjQ5NjUgMTcuNjM0MSAxNy40MTcxIDE3Ljg4NDkgMTcuMjY5NkMxOC4xMzU3IDE3LjEyMiAxOC4zNDM1IDE2LjkxMTMgMTguNDg3NiAxNi42NTg1QzE4LjYzMTcgMTYuNDA1NiAxOC43MDcxIDE2LjExOTUgMTguNzA2MyAxNS44Mjg0QzE4LjcwNTUgMTUuNTM3NCAxOC42Mjg1IDE1LjI1MTcgMTguNDgzIDE0Ljk5OTdMMTEuNDI0NyAzLjIxNjM1QzExLjI3NjEgMi45NzE0NCAxMS4wNjY5IDIuNzY4OTUgMTAuODE3MyAyLjYyODQyQzEwLjU2NzcgMi40ODc4OSAxMC4yODYxIDIuNDE0MDYgOS45OTk2NSAyLjQxNDA2QzkuNzEzMjEgMi40MTQwNiA5LjQzMTU5IDIuNDg3ODkgOS4xODE5OSAyLjYyODQyQzguOTMyMzggMi43Njg5NSA4LjcyMzIxIDIuOTcxNDQgOC41NzQ2NSAzLjIxNjM1VjMuMjE2MzVaIiBzdHJva2U9IiNFNjUwNTQiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMCA3LjVWMTAuODMzMyIgc3Ryb2tlPSIjRTY1MDU0IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMTQuMTY4SDEwLjAwODMiIHN0cm9rZT0iI0U2NTA1NCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==");margin:5px 10px 0 0}
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/assets/css/wp-conditions.scss

    r2781222 r3374441  
    202202
    203203    .sort {
    204         padding: 0 4px;
    205204        cursor: move;
    206205        text-align: center;
     
    239238        margin-right: 7px;
    240239        content: "\e007";
     240    }
     241
     242    .wpc-toggle-enabled {
     243        cursor: pointer;
    241244    }
    242245}
     
    289292    }
    290293}
     294
     295
     296/**************************************************************
     297 *  Card
     298 *************************************************************/
     299.wpc-card {
     300    background-color: rgb(255, 255, 255);
     301    color: rgb(30, 30, 30);
     302    position: relative;
     303    box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 0px 1px;
     304    border-radius: calc(1px);
     305    padding: 1em;
     306    display: flex;
     307    flex-direction: row;
     308    padding-right: 16px!important;
     309    margin: 1em;
     310
     311    .card-body-text {
     312
     313        p {
     314            margin: 0;
     315        }
     316    }
     317    a.card-button-link {
     318        padding: 6px 12px;
     319    }
     320
     321    .card-body-actions {
     322        margin-top: 1em;
     323    }
     324    .wpc-warning-icon {
     325        flex-shrink: 0;
     326    }
     327}
     328
     329// Warning icon
     330.wpc-warning-icon {
     331    width: 20px;
     332    height: 20px;
     333    background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNTc0NjUgMy4yMTYzNUwxLjUxNjMyIDE0Ljk5OTdDMS4zNzA3OSAxNS4yNTE3IDEuMjkzNzkgMTUuNTM3NCAxLjI5Mjk4IDE1LjgyODRDMS4yOTIxNiAxNi4xMTk1IDEuMzY3NTYgMTYuNDA1NiAxLjUxMTY3IDE2LjY1ODVDMS42NTU3OSAxNi45MTEzIDEuODYzNTkgMTcuMTIyIDIuMTE0NDEgMTcuMjY5NkMyLjM2NTIzIDE3LjQxNzEgMi42NTAzMiAxNy40OTY1IDIuOTQxMzIgMTcuNDk5N0gxNy4wNThDMTcuMzQ5IDE3LjQ5NjUgMTcuNjM0MSAxNy40MTcxIDE3Ljg4NDkgMTcuMjY5NkMxOC4xMzU3IDE3LjEyMiAxOC4zNDM1IDE2LjkxMTMgMTguNDg3NiAxNi42NTg1QzE4LjYzMTcgMTYuNDA1NiAxOC43MDcxIDE2LjExOTUgMTguNzA2MyAxNS44Mjg0QzE4LjcwNTUgMTUuNTM3NCAxOC42Mjg1IDE1LjI1MTcgMTguNDgzIDE0Ljk5OTdMMTEuNDI0NyAzLjIxNjM1QzExLjI3NjEgMi45NzE0NCAxMS4wNjY5IDIuNzY4OTUgMTAuODE3MyAyLjYyODQyQzEwLjU2NzcgMi40ODc4OSAxMC4yODYxIDIuNDE0MDYgOS45OTk2NSAyLjQxNDA2QzkuNzEzMjEgMi40MTQwNiA5LjQzMTU5IDIuNDg3ODkgOS4xODE5OSAyLjYyODQyQzguOTMyMzggMi43Njg5NSA4LjcyMzIxIDIuOTcxNDQgOC41NzQ2NSAzLjIxNjM1VjMuMjE2MzVaIiBzdHJva2U9IiNFNjUwNTQiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMCA3LjVWMTAuODMzMyIgc3Ryb2tlPSIjRTY1MDU0IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMTQuMTY4SDEwLjAwODMiIHN0cm9rZT0iI0U2NTA1NCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==");
     334    margin: 5px 10px 0 0;
     335}
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/assets/js/wp-conditions.js

    r2781222 r3374441  
    99            elementWrap: '.wpc-condition-group-wrap',
    1010            elementsContainer: '.wpc-condition-groups',
    11             onAddElement: function (template, container, $self) {
    12                 var new_id = Math.floor(Math.random() * 899999999 + 100000000); // Random number sequence of 9 length
    13                 template.find('input[name], select[name]').attr('name', function (index, value) {
    14                     return (value.replace('9999', new_id)) || value;
    15                 });
    16                 template.find('.wpc-condition[data-id]').attr('data-id', function (index, value) {
    17                     return (value.replace('9999', new_id)) || value;
    18                 });
    19                 // Fix #20 - condition IDs being replaced by group IDs
    20                 template.find('.wpc-condition-template .wpc-condition[data-id]').attr('data-id', '9999');
    21 
    22                 template.find('[data-group]').attr('data-group', function (index, value) {
    23                     return (value.replace('9999', new_id)) || value;
    24                 });
    25 
    26                 template.find('.repeater-active').removeClass('repeater-active');
    27 
    28                 // Init condition group repeater
    29                 wpc_condition_row_repeater();
    30             },
     11            onAddElement: function (template, container, $self) {
     12                var new_id = Math.floor(Math.random() * 899999999 + 100000000); // Random number sequence of 9 length
     13                template.find('input[name], select[name]').attr('name', function (index, value) {
     14                    return (value.replace('9999', new_id)) || value;
     15                });
     16                template.find('.wpc-condition[data-id]').attr('data-id', function (index, value) {
     17                    return (value.replace('9999', new_id)) || value;
     18                });
     19                // Fix #20 - condition IDs being replaced by group IDs
     20                template.find('.wpc-condition-template .wpc-condition[data-id]').attr('data-id', '9999');
     21
     22                template.find('[data-group]').attr('data-group', function (index, value) {
     23                    return (value.replace('9999', new_id)) || value;
     24                });
     25
     26                template.find('.repeater-active').removeClass('repeater-active');
     27
     28                // Init condition group repeater
     29                wpc_condition_row_repeater();
     30            },
    3131            removeElement: function( el ) {
    3232                el.remove();
     
    162162
    163163    });
     164
     165    // Toggle a
     166    function toggle_enabled(id, callback) {
     167         var data = {
     168            action: 'wpc_toggle_enabled',
     169            id: id,
     170            nonce: wpc.nonce
     171        };
     172
     173        $.post(ajaxurl, data, callback);
     174    }
     175
     176    // Toggle enabled from overview
     177    $(document.body).on('click', '.wpc-conditions-post-table .wpc-toggle-enabled', function (e) {
     178        e.preventDefault();
     179
     180        var $row = $(this).closest('tr');
     181        toggle_enabled($row.attr('data-id'), function(response) {
     182            if (response.enabled == 'yes') {
     183                $row.find('.woocommerce-input-toggle').removeClass('woocommerce-input-toggle--disabled').addClass('woocommerce-input-toggle--enabled');
     184            } else {
     185                $row.find('.woocommerce-input-toggle').removeClass('woocommerce-input-toggle--enabled').addClass('woocommerce-input-toggle--disabled');
     186            }
     187        });
     188    });
     189
     190    // Enable from notice card
     191    $(document.body).on('click', '.wpc-card .wpc-toggle-enabled', function (e) {
     192        const card = $(this).parents('.wpc-card');
     193
     194        toggle_enabled($(this).attr('data-id'), function(response) {
     195            if (response.enabled == 'yes') {
     196                card.hide();
     197            } else {
     198                console.error(error);
     199            }
     200        });
     201    });
     202
    164203
    165204
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/assets/js/wp-conditions.min.js

    r2781222 r3374441  
    1 "use strict";jQuery(function(a){function c(){a(".wpc-condition-group").repeater({addTrigger:".wpc-condition-add",removeTrigger:".wpc-condition-delete",template:".wpc-condition-template .wpc-condition-wrap",elementWrap:".wpc-condition-wrap",elementsContainer:".wpc-conditions-list",onAddElement:function(t,e,o,n){var i=Math.floor(899999999*Math.random()+1e8);e.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",i)||e}),e.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",i)||e}),e.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),e.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",i)||e}),e.find(".repeater-active").removeClass("repeater-active"),c()}})}a(".wpc-conditions").repeater({addTrigger:".wpc-condition-group-add",removeTrigger:".wpc-condition-group .delete",template:".wpc-condition-group-template .wpc-condition-group-wrap",elementWrap:".wpc-condition-group-wrap",elementsContainer:".wpc-condition-groups",onAddElement:function(t,e,o){var n=Math.floor(899999999*Math.random()+1e8);t.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),t.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",n)||e}),t.find(".repeater-active").removeClass("repeater-active"),c()},removeElement:function(t){t.remove()}}),c(),a(document.body).on("click",".wpc-conditions .duplicate",function(){var t=a(this).parents(".wpc-condition-group-wrap"),o=t.find(".wpc-condition-group").attr("data-group"),e=a(this).parents(".wpc-condition-groups"),n=Math.floor(899999999*Math.random()+1e8);t.find(".enhanced").select2("destroy").removeClass("enhanced");var i=t.clone();a(t).find("select").each(function(t){a(i).find("select").eq(t).val(a(this).val())}),i.find(".wpc-condition-group").attr("data-group",n),i.find("input[name], select[name]").attr("name",function(t,e){return e.replace("conditions["+o+"]","conditions["+n+"]")}),i.find(".repeater-active").removeClass("repeater-active"),e.append(i),a(document.body).trigger("wc-enhanced-select-init"),c(),a("html, body").on("scroll mousedown DOMMouseScroll mousewheel keydown touchmove",function(t){a("html, body").stop().off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")}),a("body, html").animate({scrollTop:a(i).offset().top-50},750,function(){a("html, body").off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")})}),a(document.body).on("change",".wpc-condition",function(){var e={action:wpc2.action_prefix+"update_condition_value",id:a(this).attr("data-id"),group:a(this).parents(".wpc-condition-group").attr("data-group"),condition:a(this).val(),nonce:wpc.nonce},o=a(this).parents(".wpc-condition-wrap").first(),n=".wpc-value-field-wrap";o.find(n).html('<span class="wpc-loading" style="width: calc( 42.5% - 75px ); border: 1px solid transparent; display: inline-block;">&nbsp;</span>').block({message:null,overlayCSS:{background:"",opacity:.6}}),a.post(ajaxurl,e,function(t){o.find(n).replaceWith(t),a(document.body).trigger("wc-enhanced-select-init")});var i=o.find(".wpc-operator").val();o.find(".wpc-operator").empty().html(function(){var o=a(this),t=wpc.condition_operators[e.condition]||wpc.condition_operators.default;a.each(t,function(t,e){o.append(a("<option/>").attr("value",t).text(e)),o.val(i).val()||o.val(o.find("option:first").val())})}),o.find(".wpc-description").html(function(){return a('<span class="woocommerce-help-tip" />').attr("data-tip",wpc.condition_descriptions[e.condition]||"")}),a(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style")}),a(".wpc-conditions-post-table.wpc-sortable-post-table tbody").sortable({items:"tr",handle:".sort",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style")},update:function(t,e){var o=a(this).closest("table");o.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={action:"wpc_save_post_order",form:a(this).closest("form").serialize(),nonce:wpc.nonce};a.post(ajaxurl,n,function(t){a(".wpc-conditions-post-table tbody tr:even").addClass("alternate"),a(".wpc-conditions-post-table tbody tr:odd").removeClass("alternate"),o.unblock()})}})});
     1"use strict";jQuery(function(i){function c(){i(".wpc-condition-group").repeater({addTrigger:".wpc-condition-add",removeTrigger:".wpc-condition-delete",template:".wpc-condition-template .wpc-condition-wrap",elementWrap:".wpc-condition-wrap",elementsContainer:".wpc-conditions-list",onAddElement:function(t,e,o,n){var a=Math.floor(899999999*Math.random()+1e8);e.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",a)||e}),e.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",a)||e}),e.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),e.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",a)||e}),e.find(".repeater-active").removeClass("repeater-active"),c()}})}function o(t,e){var o={action:"wpc_toggle_enabled",id:t,nonce:wpc.nonce};i.post(ajaxurl,o,e)}i(".wpc-conditions").repeater({addTrigger:".wpc-condition-group-add",removeTrigger:".wpc-condition-group .delete",template:".wpc-condition-group-template .wpc-condition-group-wrap",elementWrap:".wpc-condition-group-wrap",elementsContainer:".wpc-condition-groups",onAddElement:function(t,e,o){var n=Math.floor(899999999*Math.random()+1e8);t.find("input[name], select[name]").attr("name",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition[data-id]").attr("data-id",function(t,e){return e.replace("9999",n)||e}),t.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),t.find("[data-group]").attr("data-group",function(t,e){return e.replace("9999",n)||e}),t.find(".repeater-active").removeClass("repeater-active"),c()},removeElement:function(t){t.remove()}}),c(),i(document.body).on("click",".wpc-conditions .duplicate",function(){var t=i(this).parents(".wpc-condition-group-wrap"),o=t.find(".wpc-condition-group").attr("data-group"),e=i(this).parents(".wpc-condition-groups"),n=Math.floor(899999999*Math.random()+1e8);t.find(".enhanced").select2("destroy").removeClass("enhanced");var a=t.clone();i(t).find("select").each(function(t){i(a).find("select").eq(t).val(i(this).val())}),a.find(".wpc-condition-group").attr("data-group",n),a.find("input[name], select[name]").attr("name",function(t,e){return e.replace("conditions["+o+"]","conditions["+n+"]")}),a.find(".repeater-active").removeClass("repeater-active"),e.append(a),i(document.body).trigger("wc-enhanced-select-init"),c(),i("html, body").on("scroll mousedown DOMMouseScroll mousewheel keydown touchmove",function(t){i("html, body").stop().off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")}),i("body, html").animate({scrollTop:i(a).offset().top-50},750,function(){i("html, body").off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")})}),i(document.body).on("change",".wpc-condition",function(){var e={action:wpc2.action_prefix+"update_condition_value",id:i(this).attr("data-id"),group:i(this).parents(".wpc-condition-group").attr("data-group"),condition:i(this).val(),nonce:wpc.nonce},o=i(this).parents(".wpc-condition-wrap").first(),n=".wpc-value-field-wrap";o.find(n).html('<span class="wpc-loading" style="width: calc( 42.5% - 75px ); border: 1px solid transparent; display: inline-block;">&nbsp;</span>').block({message:null,overlayCSS:{background:"",opacity:.6}}),i.post(ajaxurl,e,function(t){o.find(n).replaceWith(t),i(document.body).trigger("wc-enhanced-select-init")});var a=o.find(".wpc-operator").val();o.find(".wpc-operator").empty().html(function(){var o=i(this),t=wpc.condition_operators[e.condition]||wpc.condition_operators.default;i.each(t,function(t,e){o.append(i("<option/>").attr("value",t).text(e)),o.val(a).val()||o.val(o.find("option:first").val())})}),o.find(".wpc-description").html(function(){return i('<span class="woocommerce-help-tip" />').attr("data-tip",wpc.condition_descriptions[e.condition]||"")}),i(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),i("#tiptip_holder").removeAttr("style"),i("#tiptip_arrow").removeAttr("style")}),i(document.body).on("click",".wpc-conditions-post-table .wpc-toggle-enabled",function(t){t.preventDefault();var e=i(this).closest("tr");o(e.attr("data-id"),function(t){"yes"==t.enabled?e.find(".woocommerce-input-toggle").removeClass("woocommerce-input-toggle--disabled").addClass("woocommerce-input-toggle--enabled"):e.find(".woocommerce-input-toggle").removeClass("woocommerce-input-toggle--enabled").addClass("woocommerce-input-toggle--disabled")})}),i(document.body).on("click",".wpc-card .wpc-toggle-enabled",function(t){var e=i(this).parents(".wpc-card");o(i(this).attr("data-id"),function(t){"yes"==t.enabled?e.hide():console.error(error)})}),i(".wpc-conditions-post-table.wpc-sortable-post-table tbody").sortable({items:"tr",handle:".sort",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style")},update:function(t,e){var o=i(this).closest("table");o.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={action:"wpc_save_post_order",form:i(this).closest("form").serialize(),nonce:wpc.nonce};i.post(ajaxurl,n,function(t){i(".wpc-conditions-post-table tbody tr:even").addClass("alternate"),i(".wpc-conditions-post-table tbody tr:odd").removeClass("alternate"),o.unblock()})}})});
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-contains-product-condition.php

    r2067256 r3374441  
    5959                'type' => 'select',
    6060                'custom_attributes' => array(
    61                     'data-placeholder' => __( 'Search for a product', 'wp-conditions' ),
     61                    'data-placeholder' => __( 'Search for a product', 'wpc-conditions' ),
    6262                ),
    6363                'class' => array( 'wpc-value', 'wc-product-search' ),
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-height-condition.php

    r1647397 r3374441  
    1313
    1414            parent::__construct();
     15        }
     16
     17        public function validate() {
     18            return ! empty( WC()->cart->get_cart() );
    1519        }
    1620
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-length-condition.php

    r1647397 r3374441  
    1313
    1414            parent::__construct();
     15        }
     16
     17        public function validate() {
     18            return ! empty( WC()->cart->get_cart() );
    1519        }
    1620
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-page-condition.php

    r2781222 r3374441  
    2525            if ( '==' == $operator ) :
    2626
    27                 if ( is_array( term_exists ( $value, 'product_cat' ) ) ) : // term_exists return array when true
    28                     $match = ( $wp_query->is_archive() && isset( $wp_query->query_vars['product_cat'] ) && $value == $wp_query->query_vars['product_cat'] );
     27                if ( $wp_query->is_archive() && is_array( term_exists( $value, 'product_cat' ) ) ) : // term_exists return array when true
     28                    $match = ( isset( $wp_query->query_vars['product_cat'] ) && $value == $wp_query->query_vars['product_cat'] );
    2929                elseif ( wc_get_page_id( 'shop' ) == $value ) : // Shop page
    30                     $match = ( 'product' == $wp_query->query_vars['post_type'] && $wp_query->is_archive() );
     30                    $match = is_shop();
    3131                else :
    32                     $match = ( $post_id == $value );
     32                    // #29 - page/single check added to prevent issue with archive pages where $post->ID is set to the first product
     33                    $match = ( ( is_page( $post_id ) || is_single( $post_id ) ) && $post_id == $value );
    3334                endif;
    3435
    3536            elseif ( '!=' == $operator ) :
    3637
    37                 if ( is_array( term_exists ( $value, 'product_cat' ) ) ) : // term_exists return array when true
    38                     $match = ( $wp_query->is_archive() && isset( $wp_query->query_vars['product_cat'] ) && $value != $wp_query->query_vars['product_cat'] );
     38                if ( $wp_query->is_archive() && is_array( term_exists( $value, 'product_cat' ) ) ) : // term_exists return array when true
     39                    $match = ( isset( $wp_query->query_vars['product_cat'] ) && $value != $wp_query->query_vars['product_cat'] );
    3940                elseif ( wc_get_page_id( 'shop' ) == $value ) : // Shop page
    40                     $match = ! ( 'product' == $wp_query->query_vars['post_type'] && $wp_query->is_archive() );
     41                    $match = ! is_shop();
    4142                else :
    42                     $match = ( $post_id != $value );
     43                    $match = ( ( is_page( $post_id ) || is_single( $post_id ) ) && $post_id != $value );
    4344                endif;
    4445
     
    6869
    6970            $wc_pages = array(
    70                 get_option( 'woocommerce_shop_page_id' )      => __( 'Shop page', 'woocommerce-advanced-messages' ),
    71                 get_option( 'woocommerce_cart_page_id' )      => __( 'Cart', 'woocommerce-advanced-messages' ),
    72                 get_option( 'woocommerce_checkout_page_id' )  => __( 'Checkout', 'woocommerce-advanced-messages' ),
    73                 get_option( 'woocommerce_terms_page_id' )     => __( 'Terms & conditions', 'woocommerce-advanced-messages' ),
    74                 get_option( 'woocommerce_myaccount_page_id' ) => __( 'My account', 'woocommerce-advanced-messages' ),
     71                get_option( 'woocommerce_shop_page_id' )      => __( 'Shop page', 'wpc-conditions' ),
     72                get_option( 'woocommerce_cart_page_id' )      => __( 'Cart', 'wpc-conditions' ),
     73                get_option( 'woocommerce_checkout_page_id' )  => __( 'Checkout', 'wpc-conditions' ),
     74                get_option( 'woocommerce_terms_page_id' )     => __( 'Terms & conditions', 'wpc-conditions' ),
     75                get_option( 'woocommerce_myaccount_page_id' ) => __( 'My account', 'wpc-conditions' ),
    7576            );
    7677            $wc_categories = get_terms( 'product_cat', array( 'hide_empty' => false ) );
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-product-age-condition.php

    r1647397 r3374441  
    3030                $match = ( $compare_value != $value );
    3131            elseif ( '>=' == $operator ) :
    32                 if ( date( 'Y-m-d', strtotime( $raw_value ) ) > 1970 ) {
     32                if ( is_numeric( $raw_value ) ) {
     33                    $match = ( $compare_value <= $value );
     34                } else {
     35                    $match = ( $compare_value >= $value ); // Reversed operator intentional
     36                }
     37            elseif ( '<=' == $operator ) :
     38                if ( is_numeric( $raw_value ) ) {
    3339                    $match = ( $compare_value >= $value ); // Reversed operator intentional
    3440                } else {
    3541                    $match = ( $compare_value <= $value );
    36                 }
    37             elseif ( '<=' == $operator ) :
    38                 if ( date( 'Y-m-d', strtotime( $raw_value ) ) > 1970 ) {
    39                     $match = ( $compare_value <= $value );
    40                 } else {
    41                     $match = ( $compare_value >= $value ); // Reversed operator intentional
    4242                }
    4343            endif;
     
    4949        public function get_value( $value ) {
    5050
    51             if ( date( 'Y-m-d', strtotime( $value ) ) > 1970 ) {
     51            if ( is_numeric( $value ) ) {
     52                $value = date( 'Y-m-d', strtotime( "-$value days", time() ) );
     53            } else {
    5254                $value = date( 'Y-m-d', strtotime( $value ) );
    53             } else {
    54                 $value = date( 'Y-m-d', strtotime( "-$value days", time() ) );
    5555            }
    5656
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-product-category-condition.php

    r2067256 r3374441  
    1919        }
    2020
     21        public function get_value( $value ) {
     22            $term = get_term_by( 'slug', $value, 'product_cat' );
     23            return apply_filters( 'wpml_object_id', $term->term_id ?? null, 'product_cat', true );
     24        }
     25
    2126        public function match( $match, $operator, $value ) {
    2227
     
    3035            $value = $this->get_value( $value );
    3136
     37            // Category not found, so return false
     38            if ( ! $value ) {
     39                return false;
     40            }
     41
    3242            if ( '==' == $operator ) {
    33                 $match = $match = ( has_term( $value, 'product_cat', $product->get_id() ) );
     43                $match = ( has_term( $value, 'product_cat', $product->get_id() ) );
    3444            } elseif ( '!=' == $operator ) {
    35                 $match = ! $match = ( has_term( $value, 'product_cat', $product->get_id() ) );
     45                $match = ! ( has_term( $value, 'product_cat', $product->get_id() ) );
    3646            }
    3747
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-product-condition.php

    r1647397 r3374441  
    2222            /** @var $product WC_Product */
    2323            global $product;
    24             return $product->get_id();
     24            return apply_filters( 'wpml_object_id', $product->get_id(), 'product', true );
     25        }
     26
     27        public function get_value( $value ) {
     28            return apply_filters( 'wpml_object_id', $value, 'product', true );
    2529        }
    2630
     
    3943
    4044            $field_args = array(
    41                 'type' => 'text',
     45                'type' => 'select',
    4246                'custom_attributes' => array(
    43                     'data-placeholder' => __( 'Search for a product', 'wp-conditions' ),
     47                    'data-placeholder' => __( 'Search for a product', 'wpc-conditions' ),
    4448                ),
    4549                'class' => array( 'wpc-value', 'wc-product-search' ),
    4650                'options' => array(),
    4751            );
    48 
    49             // Should be a select field in WC 2.7+
    50             if ( version_compare( WC()->version, '2.7', '>=' ) ) {
    51                 $field_args['type'] = 'select';
    52             }
    5352
    5453            return $field_args;
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-product-tag-condition.php

    r1647397 r3374441  
    1919        }
    2020
     21        public function get_value( $value ) {
     22            $term = get_term_by( 'slug', $value, 'product_tag' );
     23            return apply_filters( 'wpml_object_id', $term->term_id ?? null, 'product_tag', true );
     24        }
     25
    2126        public function match( $match, $operator, $value ) {
    2227
     
    2833            global $product;
    2934            $value = $this->get_value( $value );
     35
     36            // Tag not found
     37            if ( ! $value ) {
     38                return false;
     39            }
    3040
    3141            if ( $operator == '==' ) {
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-role-condition.php

    r1687709 r3374441  
    5353        public function get_value_field_args() {
    5454
    55             $user_roles = array_keys( get_editable_roles() );
     55            $user_roles = array_keys( wp_roles()->roles );
    5656            $user_roles = array_combine( $user_roles, $user_roles );
    57             $user_roles['not_logged_in'] = __( 'Guest user', 'wp-conditions' );
     57            $user_roles['not_logged_in'] = __( 'Guest user', 'wpc-conditions' );
    5858
    5959            $field_args = array(
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-stock-status-condition.php

    r2067256 r3374441  
    1818
    1919            $value = $this->get_value( $value );
     20            $value = $value === '1' ? 'instock' : $value;
     21            $value = $value === '0' ? 'outofstock' : $value;
    2022
    2123            if ( '==' == $operator ) :
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-time-condition.php

    r1647397 r3374441  
    1010            $this->slug        = __( 'time', 'wpc-conditions' );
    1111            $this->group       = __( 'General', 'wpc-conditions' );
    12             $this->description = sprintf( __( 'Compares current server time to user given time. Current time: %s', 'woocommerce-advanced-messages' ), date_i18n( get_option( 'time_format' ) ) );
     12            $this->description = sprintf( __( 'Compares current server time to user given time. Current time: %s', 'wpc-conditions' ), date_i18n( get_option( 'time_format' ) ) );
    1313
    1414            parent::__construct();
     
    2828                'type' => 'text',
    2929                'class' => array( 'wpc-value' ),
    30                 'placeholder' => sprintf( __( 'Current time is: %s', 'woocommerce-advanced-messages' ), current_time( 'H:i' ) ),
     30                'placeholder' => sprintf( __( 'Current time is: %s', 'wpc-conditions' ), current_time( 'H:i' ) ),
    3131            );
    3232
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-weight-condition.php

    r2781222 r3374441  
    1616
    1717        public function get_value( $value ) {
    18             return str_replace( ',', '.', $value );
     18            return (float) str_replace( ',', '.', $value );
    1919        }
    2020
     
    2424
    2525        public function match( $match, $operator, $value ) {
    26             $value         = number_format( $this->get_value( $value ), 5 );
    27             $compare_value = number_format( $this->get_compare_value(), 5 );
     26            $value         = (float) number_format( $this->get_value( $value ), 5, '.', '' );
     27            $compare_value = (float) number_format( $this->get_compare_value(), 5, '.', '' );
    2828
    2929            if ( '==' == $operator ) :
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/conditions/wpc-width-condition.php

    r1647397 r3374441  
    1313
    1414            parent::__construct();
     15        }
     16
     17        public function validate() {
     18            return ! empty( WC()->cart->get_cart() );
    1519        }
    1620
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/functions.php

    r1647397 r3374441  
    137137    function wpc_get_condition( $condition ) {
    138138
    139         $class_name = 'WPC_' . implode( '_', array_map( 'ucfirst', explode( '_', $condition ) ) ) . '_Condition';
     139        $class_name = 'WPC_' . implode( '_', array_map( 'ucfirst', explode( '_', $condition ?? '' ) ) ) . '_Condition';
    140140        $class_name = apply_filters( 'wpc_get_condition_class_name', $class_name, $condition );
    141141
     
    193193                if ( false == $match ) :
    194194                    $match_condition_group = false;
     195                    break; // No point to going over additional conditions when a condition is matching false in a group.
    195196                endif;
    196197
     
    250251
    251252                        case 'value' :
    252                             if ( is_array( $condition_value ) ) :
    253                                 $condition_value = array_map( 'sanitize_text_field', $condition_value );
    254                             elseif ( is_string( $condition_value ) ) :
    255                                 $condition_value = sanitize_text_field( $condition_value );
    256                             endif;
     253                            $condition_value = wpc_clean( $condition_value );
    257254                            break;
    258255
     
    271268    }
    272269
     270}
     271
     272if ( ! function_exists( 'wpc_clean' ) ) {
     273    /**
     274     * Clean variables using sanitize_text_field. Arrays are cleaned recursively.
     275     * Non-scalar values are ignored.
     276     * Copy of wc_clean() from WooCommerce.
     277     *
     278     * @since 1.0.13
     279     *
     280     * @param  string|array $var Data to sanitize.
     281     * @return string|array
     282     */
     283    function wpc_clean( $var ) {
     284        if ( is_array( $var ) ) {
     285            return array_map( 'wpc_clean', $var );
     286        } else {
     287            return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
     288        }
     289    }
    273290}
    274291
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/package.json

    r2781222 r3374441  
    66  "dependencies": {},
    77  "devDependencies": {
    8     "@babel/core": "^7.14.3",
    9     "@babel/preset-env": "^7.14.4",
     8    "@babel/core": "^7.4.0",
     9    "@babel/preset-env": "^7.4.2",
    1010    "browser-sync": "^2.26.14",
    11     "gulp": "^4.0.0",
     11    "gulp": "^4.0.2",
    1212    "gulp-babel": "^8.0.0",
    1313    "gulp-rename": "^1.4.0",
    14     "gulp-sass": "^4.1.0",
     14    "gulp-sass": "^5.1.0",
    1515    "gulp-sourcemaps": "^2.6.5",
    16     "gulp-uglify": "^3.0.2"
     16    "gulp-uglify": "^3.0.2",
     17    "sass": "^1.54.5"
    1718  },
    1819  "scripts": {
  • woocommerce-advanced-free-shipping/trunk/libraries/wp-conditions/readme.txt

    r2781222 r3374441  
    55
    66
    7 # Current version: 1.0.12
     7# Current version: 1.0.15.1
    88
    99# Changelog
     10
     11= 1.0.15.1 - 06/03/2024 =
     12
     13* [Add] - Cards / notice to show when a object is not enabled
     14
     15= 1.0.15 - 19/02/2024 =
     16
     17* [Add] - Toggle functionality
     18* [Fix] - Add missing capability check
     19
     20= 1.0.14 - 10/07/2023 =
     21
     22* [Improvement] - Condition group matching performance
     23* [Fix] - Incorrect textdomains
     24* [Fix] - Fatal error when Weight/Width/Height/Length condition values are empty in PHP 8+
     25* [Fix] - #32 - Weight issue
     26
     27= 1.0.13 - 03/01/2023 =
     28
     29* [Add] - Introduced the function wpc_clean() to recursively sanitize
     30* [Update] - To new Gulp structure
     31* [Fix] - 'Page' condition when matching for product X, matched for archive page as well when product X was first.
     32* [Fix] - 'User role' condition allow selecting all user roles, not just 'Editable' for current user.
     33* [Fix] - 'Stock status' condition not working as expected in certain situations
    1034
    1135= 1.0.12 - 30/12/2021 =
  • woocommerce-advanced-free-shipping/trunk/readme.txt

    r3018707 r3374441  
    44Requires at least: 5.0
    55Tested up to: 6.4
    6 Stable tag: 1.1.7
     6Stable tag: 1.1.7.1
    77Requires PHP: 7.0
    88License: GPLv3 or later
     
    110110== Changelog ==
    111111
     112= 1.1.7.1 - 07-10-2025 =
     113
     114* [Update] - Plugin name from WooCommerce Advanced Free Shipping to Advanced Free Shipping for WooCommerce
     115
    112116= 1.1.7 - 08-01-2024 =
    113117
  • woocommerce-advanced-free-shipping/trunk/woocommerce-advanced-free-shipping.php

    r3018707 r3374441  
    11<?php
    22/*
    3  * Plugin Name:     WooCommerce Advanced Free Shipping
     3 * Plugin Name:     Advanced Free Shipping for WooCommerce
    44 * Plugin URI:      https://wordpress.org/plugins/woocommerce-advanced-free-shipping/
    5  * Description:     WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
     5 * Description:     Advanced Free Shipping for WooCommerce is an plugin which allows you to set up advanced free shipping conditions.
    66 * Version:         1.1.7
    77 * Author:          Jeroen Sormani
     
    1313 * Copyright Jeroen Sormani
    1414 *
    15  *     This file is part of Woocommerce Advanced Free Shipping,
     15 *     This file is part of Advanced Free Shipping for WooCommerce,
    1616 *     a plugin for WordPress.
    1717 *
    18  *     Woocommerce Advanced Free Shipping is free software:
     18 *     Advanced Free Shipping for WooCommerce is free software:
    1919 *     You can redistribute it and/or modify it under the terms of the
    2020 *     GNU General Public License as published by the Free Software
     
    2222 *     any later version.
    2323 *
    24  *     Woocommerce Advanced Free Shipping is distributed in the hope that
     24 *     Advanced Free Shipping for WooCommerce is distributed in the hope that
    2525 *     it will be useful, but WITHOUT ANY WARRANTY; without even the
    2626 *     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
Note: See TracChangeset for help on using the changeset viewer.