Merge branch 'trunk' into wc-admin-nonce

This commit is contained in:
Christopher Allford 2021-05-13 14:11:32 -07:00
commit dcec089e7e
294 changed files with 9266 additions and 1832 deletions

View File

@ -0,0 +1,30 @@
name: Build release zip file
on:
workflow_dispatch:
inputs:
ref:
description: 'By default the zip file is generated from the branch the workflow runs from, but you can specify an explicit reference to use instead here (e.g. refs/tags/tag_name). The resulting file will be available as an artifact on the workflow run.'
required: false
default: ''
jobs:
build:
name: Build release zip file
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref || github.ref }}
- name: Build the zip file
id: build
uses: woocommerce/action-build@v2
- name: Unzip the file (prevents double zip problem)
run: unzip ${{ steps.build.outputs.zip_path }} -d zipfile
- name: Upload the zip file as an artifact
uses: actions/upload-artifact@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: woocommerce
path: zipfile
retention-days: 7

View File

@ -0,0 +1,32 @@
name: "Pull request post-merge processing"
on:
pull_request:
types: [closed]
jobs:
assign-milestone:
name: "Assign milestone to merged pull request"
if: github.event.pull_request.merged == true && ! github.event.pull_request.milestone
runs-on: ubuntu-latest
steps:
- name: "Get the milestone changer script"
run: |
curl \
--silent \
--fail \
--header 'Authorization: bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'User-Agent: GitHub action to set the milestone for a pull request' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location $GITHUB_API_URL/repos/${{ github.repository }}/contents/.github/workflows/scripts/assign-milestone-to-merged-pr.php
env:
GITHUB_API_URL: ${{ env.GITHUB_API_URL }}
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: "Run the milestone changer script"
run: php assign-milestone-to-merged-pr.php
env:
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -0,0 +1,144 @@
<?php
/**
* Script to automatically assign a milestone to a pull request when it's merged.
*
* @package WooCommerce/GithubActions
*/
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.AlternativeFunctions
global $repo_owner, $repo_name, $github_token, $graphql_api_url;
/**
* Grab/process input.
*/
$repo_parts = explode( '/', getenv( 'GITHUB_REPOSITORY' ) );
$repo_owner = $repo_parts[0];
$repo_name = $repo_parts[1];
$pr_id = getenv( 'PULL_REQUEST_ID' );
$github_token = getenv( 'GITHUB_TOKEN' );
$graphql_api_url = getenv( 'GITHUB_GRAPHQL_URL' );
/**
* Select the milestone to be added:
*
* 1. Get the first 10 milestones sorted by creation date descending.
* (we'll never have more than 2 or 3 active milestones but let's get 10 to be sure).
* 2. Discard those not open or whose title is not a proper version number ("X.Y.Z").
* 3. Sort descending using version_compare.
* 4. Get the oldest one that does not have a corresponding "release/X.Y" branch.
*/
echo "Getting the list of milestones...\n";
$query = "
repository(owner:\"$repo_owner\", name:\"$repo_name\") {
milestones(first: 10, states: [OPEN], orderBy: {field: CREATED_AT, direction: DESC}) {
nodes {
id
title
state
}
}
}
";
$json = do_graphql_api_request( $query );
$milestones = $json['data']['repository']['milestones']['nodes'];
$milestones = array_map(
function( $x ) {
return 1 === preg_match( '/^\d+\.\d+\.\d+$/D', $x['title'] ) ? $x : null;
},
$milestones
);
$milestones = array_filter( $milestones );
usort(
$milestones,
function( $a, $b ) {
return version_compare( $b['title'], $a['title'] );
}
);
echo 'Latest open milestone: ' . $milestones[0]['title'] . "\n";
$chosen_milestone = null;
foreach ( $milestones as $milestone ) {
$milestone_title_parts = explode( '.', $milestone['title'] );
$milestone_release_branch = 'release/' . $milestone_title_parts[0] . '.' . $milestone_title_parts[1];
$query = "
repository(owner:\"$repo_owner\", name:\"$repo_name\") {
ref(qualifiedName: \"refs/heads/$milestone_release_branch\") {
id
}
}
";
$result = do_graphql_api_request( $query );
if ( is_null( $result['data']['repository']['ref'] ) ) {
$chosen_milestone = $milestone;
} else {
break;
}
}
// If all the milestones have a release branch, just take the newest one.
if ( is_null( $chosen_milestone ) ) {
$chosen_milestone = $milestones[0];
}
echo 'Milestone that will be assigned: ' . $chosen_milestone['title'] . "\n";
if ( getenv( 'DRY_RUN' ) ) {
echo "Dry run, skipping the actual milestone assignment\n";
return;
}
/*
* Assign the milestone to the pull request.
*/
echo "Assigning the milestone to the pull request...\n";
$milestone_id = $chosen_milestone['id'];
$mutation = "
updatePullRequest(input: {pullRequestId: \"$pr_id\", milestoneId: \"$milestone_id\"}) {
clientMutationId
}
";
do_graphql_api_request( $mutation, true );
/**
* Function to query the GitHub GraphQL API.
*
* @param string $body The GraphQL-formatted request body, without "query" or "mutation" wrapper.
* @param bool $is_mutation True if the request is a mutation, false if it's a query.
* @return array The json-decoded response.
*/
function do_graphql_api_request( $body, $is_mutation = false ) {
global $github_token, $graphql_api_url;
$keyword = $is_mutation ? 'mutation' : 'query';
$data = array( 'query' => "$keyword { $body }" );
$context = stream_context_create(
array(
'http' => array(
'method' => 'POST',
'header' => array(
'Accept: application/json',
'Content-Type: application/json',
'User-Agent: GitHub action to set the milestone for a pull request',
'Authorization: bearer ' . $github_token,
),
'content' => json_encode( $data ),
),
)
);
$result = file_get_contents( $graphql_api_url, false, $context );
return json_decode( $result, true );
}
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.AlternativeFunctions

42
.github/workflows/smoke-test-daily.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Smoke test daily
on:
schedule:
- cron: '25 3 * * *'
jobs:
login-run:
name: Daily smoke test on trunk.
runs-on: ubuntu-18.04
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Checkout code.
uses: actions/checkout@v2
with:
ref: trunk
- name: Install prerequisites.
run: |
npm install
composer install --no-dev
npm run build:assets
npm install jest
- name: Run smoke test.
env:
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
WC_E2E_SCREENSHOTS: 1
E2E_RETEST: 1
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
run: |
npx wc-e2e test:e2e

View File

@ -1,7 +1,7 @@
name: 'Close stale needs-feedback issues' name: 'Close stale needs-feedback issues'
on: on:
schedule: schedule:
- cron: '0 21 * * *' - cron: '21 0 * * *'
jobs: jobs:
stale: stale:
@ -15,6 +15,6 @@ jobs:
days-before-issue-stale: 7 days-before-issue-stale: 7
days-before-issue-close: 7 days-before-issue-close: 7
days-before-pr-close: -1 days-before-pr-close: -1
only-issue-label: 'needs feedback' only-issue-labels: 'needs feedback'
close-issue-label: "category: can't reproduce" close-issue-label: "category: can't reproduce"
debug-only: true ascending: true

View File

@ -0,0 +1,27 @@
name: 'Update contributor feedback labels on comment'
on: 'issue_comment'
jobs:
feedback:
if: |
github.actor != 'github-actions' &&
github.event.issue &&
github.event.issue.state == 'open' &&
contains(github.event.issue.labels.*.name, 'needs feedback')
runs-on: ubuntu-latest
steps:
- name: Add has feedback
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'has feedback'
- name: remove needs feedback
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'needs feedback'
- name: remove stale
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: Stale

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ project.properties
.settings* .settings*
.idea .idea
.vscode .vscode
.eslintcache
*.sublime-project *.sublime-project
*.sublime-workspace *.sublime-workspace
.sublimelinterrc .sublimelinterrc

View File

@ -161,6 +161,43 @@
} }
} }
.addons-promotion-block {
display: flex;
padding: 20px;
.addons-img {
height: auto;
width: 200px;
}
}
.addons-promotion-block-content {
display: flex;
flex-direction: column;
margin-left: 24px;
}
.addons-promotion-block-description {
margin-bottom: 20px;
}
.addons-promotion-block-title {
margin: 0 0 16px;
padding: 0;
}
.addons-promotion-block-buttons {
margin-top: auto;
.addons-button {
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
}
.addons-shipping-methods .addons-wcs-banner-block { .addons-shipping-methods .addons-wcs-banner-block {
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
@ -364,6 +401,12 @@
color: #fff; color: #fff;
} }
.addons-button-expandable {
display: inline-block;
padding: 0 16px;
width: auto;
}
.addons-button-solid:hover { .addons-button-solid:hover {
color: #fff; color: #fff;
opacity: 0.8; opacity: 0.8;
@ -2642,6 +2685,30 @@ ul.wc_coupon_list_block {
float: right; float: right;
} }
} }
.wc_addons_wrap {
.addons-promotion-block {
flex-direction: column;
padding: 24px;
.addons-img {
height: auto;
width: 100%;
max-width: 240px;
margin: 0 auto 20px;
}
}
.addons-promotion-block-content {
display: block;
margin-left: 0;
}
.addons-promotion-block-title {
margin-top: 4px;
}
}
} }
.column-customer_message .note-on { .column-customer_message .note-on {

View File

@ -53,7 +53,7 @@
.on( 'click', css_class, function( evt ) { .on( 'click', css_class, function( evt ) {
evt.preventDefault(); evt.preventDefault();
if ( ! document.queryCommandSupported( 'copy' ) ) { if ( ! document.queryCommandSupported( 'copy' ) ) {
$( css_class ).parent().find( 'input' ).focus().select(); $( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' );
$( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed ); $( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed );
} else { } else {
$( '#copy-error' ).text( '' ); $( '#copy-error' ).text( '' );
@ -69,10 +69,10 @@
'fadeIn': 50, 'fadeIn': 50,
'fadeOut': 50, 'fadeOut': 50,
'delay': 0 'delay': 0
} ).focus(); } ).trigger( 'focus' );
} ) } )
.on( 'aftercopyerror', css_class, function() { .on( 'aftercopyerror', css_class, function() {
$( css_class ).parent().find( 'input' ).focus().select(); $( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' );
$( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed ); $( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed );
} ); } );
}, },

View File

@ -72,7 +72,7 @@
_.bindAll( this, 'render' ); _.bindAll( this, 'render' );
this.render(); this.render();
$( window ).resize(function() { $( window ).on( 'resize', function() {
view.resizeContent(); view.resizeContent();
}); });
}, },
@ -88,7 +88,7 @@
}).append( this.$el ); }).append( this.$el );
this.resizeContent(); this.resizeContent();
this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).focus(); this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).trigger( 'focus' );
$( document.body ).trigger( 'init_tooltips' ); $( document.body ).trigger( 'init_tooltips' );

View File

@ -61,7 +61,7 @@ jQuery(function( $ ) {
); );
} }
$result = woocommerce_admin_meta_boxes_coupon.prefix + $result + woocommerce_admin_meta_boxes_coupon.suffix; $result = woocommerce_admin_meta_boxes_coupon.prefix + $result + woocommerce_admin_meta_boxes_coupon.suffix;
$coupon_code_field.focus().val( $result ); $coupon_code_field.trigger( 'focus' ).val( $result );
$coupon_code_label.addClass( 'screen-reader-text' ); $coupon_code_label.addClass( 'screen-reader-text' );
} }
}; };

View File

@ -22,7 +22,7 @@ jQuery( function ( $ ) {
this.states = JSON.parse( woocommerce_admin_meta_boxes_order.countries.replace( /&quot;/g, '"' ) ); this.states = JSON.parse( woocommerce_admin_meta_boxes_order.countries.replace( /&quot;/g, '"' ) );
} }
$( '.js_field-country' ).selectWoo().change( this.change_country ); $( '.js_field-country' ).selectWoo().on( 'change', this.change_country );
$( '.js_field-country' ).trigger( 'change', [ true ] ); $( '.js_field-country' ).trigger( 'change', [ true ] );
$( document.body ).on( 'change', 'select.js_field-state', this.change_state ); $( document.body ).on( 'change', 'select.js_field-state', this.change_state );
$( '#woocommerce-order-actions input, #woocommerce-order-actions a' ).on( 'click', function() { $( '#woocommerce-order-actions input, #woocommerce-order-actions a' ).on( 'click', function() {
@ -140,7 +140,7 @@ jQuery( function ( $ ) {
is_billing = Boolean( $edit_address.find( 'input[name^="_billing_"]' ).length ); is_billing = Boolean( $edit_address.find( 'input[name^="_billing_"]' ).length );
$address.hide(); $address.hide();
$this.parent().find( 'a' ).toggle(); $this.parent().find( 'a' ).trigger( 'toggle' );
if ( ! $country_input.val() ) { if ( ! $country_input.val() ) {
$country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' ); $country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' );
@ -1470,7 +1470,7 @@ jQuery( function ( $ ) {
'fadeIn': 50, 'fadeIn': 50,
'fadeOut': 50, 'fadeOut': 50,
'delay': 0 'delay': 0
}).focus(); }).trigger( 'focus' );
}, },
/** /**
@ -1483,7 +1483,7 @@ jQuery( function ( $ ) {
'fadeIn': 50, 'fadeIn': 50,
'fadeOut': 50, 'fadeOut': 50,
'delay': 0 'delay': 0
}).focus(); }).trigger( 'focus' );
} }
}; };

View File

@ -594,7 +594,7 @@ jQuery( function( $ ) {
$( '.woocommerce-notice-invalid-variation' ).remove(); $( '.woocommerce-notice-invalid-variation' ).remove();
$( '#variable_product_options' ).find( '.woocommerce_variations' ).prepend( variation ); $( '#variable_product_options' ).find( '.woocommerce_variations' ).prepend( variation );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
$( '#variable_product_options' ).trigger( 'woocommerce_variations_added', 1 ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_added', 1 );
wc_meta_boxes_product_variations_ajax.unblock(); wc_meta_boxes_product_variations_ajax.unblock();
}); });
@ -700,7 +700,7 @@ jQuery( function( $ ) {
.closest( '.woocommerce_variation' ) .closest( '.woocommerce_variation' )
.addClass( 'variation-needs-update' ); .addClass( 'variation-needs-update' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
$( '#variable_product_options' ).trigger( 'woocommerce_variations_input_changed' ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_input_changed' );
}, },
@ -714,7 +714,7 @@ jQuery( function( $ ) {
.find( '.woocommerce_variation:first' ) .find( '.woocommerce_variation:first' )
.addClass( 'variation-needs-update' ); .addClass( 'variation-needs-update' );
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
$( '#variable_product_options' ).trigger( 'woocommerce_variations_defaults_changed' ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_defaults_changed' );
}, },

View File

@ -34,17 +34,23 @@ jQuery( function( $ ) {
} }
$( function() { $( function() {
// Prevent inputs in meta box headings opening/closing contents. var woocommerce_product_data = $( '#woocommerce-product-data' );
$( '#woocommerce-product-data' ).find( '.hndle' ).unbind( 'click.postboxes' );
$( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) { // Prevent inputs in meta box headings opening/closing contents.
woocommerce_product_data.find( '.hndle' ).off( 'click.postboxes' );
woocommerce_product_data.on( 'click', '.hndle', function( event ) {
// If the user clicks on some form input inside the h3 the box should not be toggled. // If the user clicks on some form input inside the h3 the box should not be toggled.
if ( $( event.target ).filter( 'input, option, label, select' ).length ) { if ( $( event.target ).filter( 'input, option, label, select' ).length ) {
return; return;
} }
$( '#woocommerce-product-data' ).toggleClass( 'closed' ); if ( woocommerce_product_data.hasClass( 'closed' ) ) {
woocommerce_product_data.removeClass( 'closed' );
} else {
woocommerce_product_data.addClass( 'closed' );
}
}); });
}); });
@ -77,7 +83,7 @@ jQuery( function( $ ) {
var current_visibility = $( '#current_visibility' ).val(); var current_visibility = $( '#current_visibility' ).val();
var current_featured = $( '#current_featured' ).val(); var current_featured = $( '#current_featured' ).val();
$( 'input[name=_visibility]' ).removeAttr( 'checked' ); $( 'input[name=_visibility]' ).prop( 'checked', false );
$( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' ); $( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' );
var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' ); var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' );
@ -86,7 +92,7 @@ jQuery( function( $ ) {
label = label + ', ' + woocommerce_admin_meta_boxes.featured_label; label = label + ', ' + woocommerce_admin_meta_boxes.featured_label;
$( 'input[name=_featured]' ).attr( 'checked', 'checked' ); $( 'input[name=_featured]' ).attr( 'checked', 'checked' );
} else { } else {
$( 'input[name=_featured]' ).removeAttr( 'checked' ); $( 'input[name=_featured]' ).prop( 'checked', false );
} }
$( '#catalog-visibility-display' ).text( label ); $( '#catalog-visibility-display' ).text( label );
@ -94,7 +100,7 @@ jQuery( function( $ ) {
}); });
// Product type specific options. // Product type specific options.
$( 'select#product-type' ).change( function() { $( 'select#product-type' ).on( 'change', function() {
// Get value. // Get value.
var select_val = $( this ).val(); var select_val = $( this ).val();
@ -102,13 +108,13 @@ jQuery( function( $ ) {
if ( 'variable' === select_val ) { if ( 'variable' === select_val ) {
$( 'input#_manage_stock' ).trigger( 'change' ); $( 'input#_manage_stock' ).trigger( 'change' );
$( 'input#_downloadable' ).prop( 'checked', false ); $( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' ); $( 'input#_virtual' ).prop( 'checked', false );
} else if ( 'grouped' === select_val ) { } else if ( 'grouped' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false ); $( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' ); $( 'input#_virtual' ).prop( 'checked', false );
} else if ( 'external' === select_val ) { } else if ( 'external' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false ); $( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' ); $( 'input#_virtual' ).prop( 'checked', false );
} }
show_and_hide_panels(); show_and_hide_panels();
@ -119,7 +125,7 @@ jQuery( function( $ ) {
}).trigger( 'change' ); }).trigger( 'change' );
$( 'input#_downloadable, input#_virtual' ).change( function() { $( 'input#_downloadable, input#_virtual' ).on( 'change', function() {
show_and_hide_panels(); show_and_hide_panels();
}); });
@ -239,7 +245,7 @@ jQuery( function( $ ) {
}); });
// Stock options. // Stock options.
$( 'input#_manage_stock' ).change( function() { $( 'input#_manage_stock' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) { if ( $( this ).is( ':checked' ) ) {
$( 'div.stock_fields' ).show(); $( 'div.stock_fields' ).show();
$( 'p.stock_status_field' ).hide(); $( 'p.stock_status_field' ).hide();
@ -361,7 +367,7 @@ jQuery( function( $ ) {
}); });
$( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() { $( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() {
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' ); $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false );
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
return false; return false;
}); });
@ -373,7 +379,7 @@ jQuery( function( $ ) {
if ( $parent.is( '.taxonomy' ) ) { if ( $parent.is( '.taxonomy' ) ) {
$parent.find( 'select, input[type=text]' ).val( '' ); $parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide(); $parent.hide();
$( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).removeAttr( 'disabled' ); $( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).prop( 'disabled', false );
} else { } else {
$parent.find( 'select, input[type=text]' ).val( '' ); $parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide(); $parent.hide();

View File

@ -17,7 +17,19 @@ jQuery( function ( $ ) {
runTipTip(); runTipTip();
$( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() { $( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() {
$( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' ); var metabox = $( this ).parent( '.wc-metabox' );
if ( metabox.hasClass( 'closed' ) ) {
metabox.removeClass( 'closed' );
} else {
metabox.addClass( 'closed' );
}
if ( metabox.hasClass( 'open' ) ) {
metabox.removeClass( 'open' );
} else {
metabox.addClass( 'open' );
}
}); });
// Tabbed Panels // Tabbed Panels

View File

@ -57,7 +57,7 @@ jQuery(
'select[name="_visibility"] option, ' + 'select[name="_visibility"] option, ' +
'select[name="_stock_status"] option, ' + 'select[name="_stock_status"] option, ' +
'select[name="_backorders"] option' 'select[name="_backorders"] option'
).removeAttr( 'selected' ); ).prop( 'selected', false );
var is_variable_product = 'variable' === product_type; var is_variable_product = 'variable' === product_type;
$( 'select[name="_stock_status"] ~ .wc-quick-edit-warning', '.inline-edit-row' ).toggle( is_variable_product ); $( 'select[name="_stock_status"] ~ .wc-quick-edit-warning', '.inline-edit-row' ).toggle( is_variable_product );
@ -72,7 +72,7 @@ jQuery(
if ( 'yes' === featured ) { if ( 'yes' === featured ) {
$( 'input[name="_featured"]', '.inline-edit-row' ).attr( 'checked', 'checked' ); $( 'input[name="_featured"]', '.inline-edit-row' ).attr( 'checked', 'checked' );
} else { } else {
$( 'input[name="_featured"]', '.inline-edit-row' ).removeAttr( 'checked' ); $( 'input[name="_featured"]', '.inline-edit-row' ).prop( 'checked', false );
} }
// Conditional display. // Conditional display.

View File

@ -167,7 +167,7 @@
// Postcode and city don't have `name` values by default. // Postcode and city don't have `name` values by default.
// They're only created if the contents changes, to save on database queries (I think) // They're only created if the contents changes, to save on database queries (I think)
this.$el.find( 'td.postcode input, td.city input' ).change( function() { this.$el.find( 'td.postcode input, td.city input' ).on( 'change', function() {
$( this ).attr( 'name', $( this ).data( 'name' ) ); $( this ).attr( 'name', $( this ).data( 'name' ) );
}); });

View File

@ -2,7 +2,7 @@
( function( $, params, wp ) { ( function( $, params, wp ) {
$( function() { $( function() {
// Sell Countries // Sell Countries
$( 'select#woocommerce_allowed_countries' ).change( function() { $( 'select#woocommerce_allowed_countries' ).on( 'change', function() {
if ( 'specific' === $( this ).val() ) { if ( 'specific' === $( this ).val() ) {
$( this ).closest('tr').next( 'tr' ).hide(); $( this ).closest('tr').next( 'tr' ).hide();
$( this ).closest('tr').next().next( 'tr' ).show(); $( this ).closest('tr').next().next( 'tr' ).show();
@ -16,7 +16,7 @@
}).trigger( 'change' ); }).trigger( 'change' );
// Ship Countries // Ship Countries
$( 'select#woocommerce_ship_to_countries' ).change( function() { $( 'select#woocommerce_ship_to_countries' ).on( 'change', function() {
if ( 'specific' === $( this ).val() ) { if ( 'specific' === $( this ).val() ) {
$( this ).closest('tr').next( 'tr' ).show(); $( this ).closest('tr').next( 'tr' ).show();
} else { } else {
@ -25,7 +25,7 @@
}).trigger( 'change' ); }).trigger( 'change' );
// Stock management // Stock management
$( 'input#woocommerce_manage_stock' ).change( function() { $( 'input#woocommerce_manage_stock' ).on( 'change', function() {
if ( $( this ).is(':checked') ) { if ( $( this ).is(':checked') ) {
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show(); $( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
} else { } else {
@ -48,15 +48,15 @@
event.stopPropagation(); event.stopPropagation();
$( '.iris-picker' ).hide(); $( '.iris-picker' ).hide();
$( this ).closest( 'td' ).find( '.iris-picker' ).show(); $( this ).closest( 'td' ).find( '.iris-picker' ).show();
$( this ).data( 'original-value', $( this ).val() ); $( this ).data( 'originalValue', $( this ).val() );
}) })
.on( 'change', function() { .on( 'change', function() {
if ( $( this ).is( '.iris-error' ) ) { if ( $( this ).is( '.iris-error' ) ) {
var original_value = $( this ).data( 'original-value' ); var original_value = $( this ).data( 'originalValue' );
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) { if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
$( this ).val( $( this ).data( 'original-value' ) ).trigger( 'change' ); $( this ).val( $( this ).data( 'originalValue' ) ).trigger( 'change' );
} else { } else {
$( this ).val( '' ).trigger( 'change' ); $( this ).val( '' ).trigger( 'change' );
} }
@ -71,7 +71,7 @@
$( function() { $( function() {
var changed = false; var changed = false;
$( 'input, textarea, select, checkbox' ).change( function() { $( 'input, textarea, select, checkbox' ).on( 'change', function() {
if ( ! changed ) { if ( ! changed ) {
window.onbeforeunload = function() { window.onbeforeunload = function() {
return params.i18n_nav_warning; return params.i18n_nav_warning;
@ -116,7 +116,7 @@
}); });
$( '.woocommerce' ).on( 'click', '.select_none', function() { $( '.woocommerce' ).on( 'click', '.select_none', function() {
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' ); $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false );
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
return false; return false;
}); });
@ -126,7 +126,7 @@
var moveBtn = $( this ), var moveBtn = $( this ),
$row = moveBtn.closest( 'tr' ); $row = moveBtn.closest( 'tr' );
moveBtn.focus(); moveBtn.trigger( 'focus' );
var isMoveUp = moveBtn.is( '.wc-move-up' ), var isMoveUp = moveBtn.is( '.wc-move-up' ),
isMoveDown = moveBtn.is( '.wc-move-down' ); isMoveDown = moveBtn.is( '.wc-move-down' );
@ -147,7 +147,7 @@
} }
} }
moveBtn.focus(); // Re-focus after the container was moved. moveBtn.trigger( 'focus' ); // Re-focus after the container was moved.
moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' ); moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' );
} ); } );

View File

@ -33,11 +33,11 @@ jQuery( function ( $ ) {
$( '.wc_status_table thead, .wc_status_table tbody' ).each( function() { $( '.wc_status_table thead, .wc_status_table tbody' ).each( function() {
if ( $( this ).is( 'thead' ) ) { if ( $( this ).is( 'thead' ) ) {
var label = $( this ).find( 'th:eq(0)' ).data( 'export-label' ) || $( this ).text(); var label = $( this ).find( 'th:eq(0)' ).data( 'exportLabel' ) || $( this ).text();
report = report + '\n### ' + label.trim() + ' ###\n\n'; report = report + '\n### ' + label.trim() + ' ###\n\n';
} else { } else {
$( 'tr', $( this ) ).each( function() { $( 'tr', $( this ) ).each( function() {
var label = $( this ).find( 'td:eq(0)' ).data( 'export-label' ) || $( this ).find( 'td:eq(0)' ).text(); var label = $( this ).find( 'td:eq(0)' ).data( 'exportLabel' ) || $( this ).find( 'td:eq(0)' ).text();
var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML. var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML.
// Find value // Find value
@ -68,7 +68,7 @@ jQuery( function ( $ ) {
try { try {
$( '#debug-report' ).slideDown(); $( '#debug-report' ).slideDown();
$( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).focus().select(); $( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).trigger( 'focus' ).trigger( 'select' );
$( this ).fadeOut(); $( this ).fadeOut();
return false; return false;
} catch ( e ) { } catch ( e ) {
@ -100,7 +100,7 @@ jQuery( function ( $ ) {
'fadeIn': 50, 'fadeIn': 50,
'fadeOut': 50, 'fadeOut': 50,
'delay': 0 'delay': 0
}).focus(); }).trigger( 'focus' );
}, },
/** /**
@ -108,7 +108,7 @@ jQuery( function ( $ ) {
*/ */
copyFail: function() { copyFail: function() {
$( '.copy-error' ).removeClass( 'hidden' ); $( '.copy-error' ).removeClass( 'hidden' );
$( '#debug-report' ).find( 'textarea' ).focus().select(); $( '#debug-report' ).find( 'textarea' ).trigger( 'focus' ).trigger( 'select' );
} }
}; };

View File

@ -12,7 +12,7 @@ jQuery( function ( $ ) {
this.states = JSON.parse( wc_users_params.countries.replace( /&quot;/g, '"' ) ); this.states = JSON.parse( wc_users_params.countries.replace( /&quot;/g, '"' ) );
} }
$( '.js_field-country' ).selectWoo().change( this.change_country ); $( '.js_field-country' ).selectWoo().on( 'change', this.change_country );
$( '.js_field-country' ).trigger( 'change', [ true ] ); $( '.js_field-country' ).trigger( 'change', [ true ] );
$( document.body ).on( 'change', 'select.js_field-state', this.change_state ); $( document.body ).on( 'change', 'select.js_field-state', this.change_state );

View File

@ -17,7 +17,7 @@ function wcSetClipboard( data, $el ) {
} }
var $temp_input = jQuery( '<textarea style="opacity:0">' ); var $temp_input = jQuery( '<textarea style="opacity:0">' );
jQuery( 'body' ).append( $temp_input ); jQuery( 'body' ).append( $temp_input );
$temp_input.val( data ).select(); $temp_input.val( data ).trigger( 'select' );
$el.trigger( 'beforecopy' ); $el.trigger( 'beforecopy' );
try { try {

View File

@ -45,12 +45,12 @@ jQuery( function( $ ) {
*/ */
WCOrdersTable.prototype.onPreview = function() { WCOrdersTable.prototype.onPreview = function() {
var $previewButton = $( this ), var $previewButton = $( this ),
$order_id = $previewButton.data( 'order-id' ); $order_id = $previewButton.data( 'orderId' );
if ( $previewButton.data( 'order-data' ) ) { if ( $previewButton.data( 'order-data' ) ) {
$( this ).WCBackboneModal({ $( this ).WCBackboneModal({
template: 'wc-modal-view-order', template: 'wc-modal-view-order',
variable : $previewButton.data( 'order-data' ) variable : $previewButton.data( 'orderData' )
}); });
} else { } else {
$previewButton.addClass( 'disabled' ); $previewButton.addClass( 'disabled' );
@ -67,7 +67,7 @@ jQuery( function( $ ) {
$( '.order-preview' ).removeClass( 'disabled' ); $( '.order-preview' ).removeClass( 'disabled' );
if ( response.success ) { if ( response.success ) {
$previewButton.data( 'order-data', response.data ); $previewButton.data( 'orderData', response.data );
$( this ).WCBackboneModal({ $( this ).WCBackboneModal({
template: 'wc-modal-view-order', template: 'wc-modal-view-order',

View File

@ -37,7 +37,7 @@ jQuery( function( $ ) {
} ); } );
$( document.body ).on( 'wc_backbone_modal_response', function() { $( document.body ).on( 'wc_backbone_modal_response', function() {
form.unbind( 'submit' ).trigger( 'submit' ); form.off( 'submit' ).trigger( 'submit' );
} ); } );
$( '#wc_tracker_checkbox_dialog' ).on( 'change', function( e ) { $( '#wc_tracker_checkbox_dialog' ).on( 'change', function( e ) {
@ -46,7 +46,7 @@ jQuery( function( $ ) {
} ); } );
$( '#wc_tracker_submit' ).on( 'click', function () { $( '#wc_tracker_submit' ).on( 'click', function () {
form.unbind( 'submit' ).trigger( 'submit' ); form.off( 'submit' ).trigger( 'submit' );
} ); } );
return true; return true;
@ -96,7 +96,7 @@ jQuery( function( $ ) {
if ( $.isEmptyObject( country_postcode_obj ) || country_postcode_obj.required ) { if ( $.isEmptyObject( country_postcode_obj ) || country_postcode_obj.required ) {
$store_postcode_input.attr( 'required', 'true' ); $store_postcode_input.attr( 'required', 'true' );
} else { } else {
$store_postcode_input.removeAttr( 'required' ); $store_postcode_input.prop( 'required', false );
} }
} ); } );
@ -139,7 +139,14 @@ jQuery( function( $ ) {
} ); } );
$( '.wc-wizard-services-list-toggle' ).on( 'click', function() { $( '.wc-wizard-services-list-toggle' ).on( 'click', function() {
$( this ).closest( '.wc-wizard-services-list-toggle' ).toggleClass( 'closed' ); var listToggle = $( this ).closest( '.wc-wizard-services-list-toggle' );
if ( listToggle.hasClass( 'closed' ) ) {
listToggle.removeClass( 'closed' );
} else {
listToggle.addClass( 'closed' );
}
$( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' ) $( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' )
.slideToggle() .slideToggle()
.css( 'display', 'flex' ); .css( 'display', 'flex' );

View File

@ -202,7 +202,7 @@
}, },
setUnloadConfirmation: function() { setUnloadConfirmation: function() {
this.needsUnloadConfirm = true; this.needsUnloadConfirm = true;
$save_button.removeAttr( 'disabled' ); $save_button.prop( 'disabled', false );
}, },
clearUnloadConfirmation: function() { clearUnloadConfirmation: function() {
this.needsUnloadConfirm = false; this.needsUnloadConfirm = false;

View File

@ -221,7 +221,7 @@
}, },
setUnloadConfirmation: function() { setUnloadConfirmation: function() {
this.needsUnloadConfirm = true; this.needsUnloadConfirm = true;
$save_button.removeAttr( 'disabled' ); $save_button.prop( 'disabled', false );
}, },
clearUnloadConfirmation: function() { clearUnloadConfirmation: function() {
this.needsUnloadConfirm = false; this.needsUnloadConfirm = false;

View File

@ -232,7 +232,7 @@
}); });
// Focus on inputs within the table if clicked instead of trying to sort. // Focus on inputs within the table if clicked instead of trying to sort.
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() { $( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
$( this ).focus(); $( this ).trigger( 'focus' );
} ); } );
$( '.wc_input_table .remove_rows' ).on( 'click', function() { $( '.wc_input_table .remove_rows' ).on( 'click', function() {
@ -309,7 +309,7 @@
}); });
// Select availability // Select availability
$( 'select.availability' ).change( function() { $( 'select.availability' ).on( 'change', function() {
if ( $( this ).val() === 'all' ) { if ( $( this ).val() === 'all' ) {
$( this ).closest( 'tr' ).next( 'tr' ).hide(); $( this ).closest( 'tr' ).next( 'tr' ).hide();
} else { } else {
@ -319,7 +319,7 @@
// Hidden options // Hidden options
$( '.hide_options_if_checked' ).each( function() { $( '.hide_options_if_checked' ).each( function() {
$( this ).find( 'input:eq(0)' ).change( function() { $( this ).find( 'input:eq(0)' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) { if ( $( this ).is( ':checked' ) ) {
$( this ) $( this )
.closest( 'fieldset, tr' ) .closest( 'fieldset, tr' )
@ -335,7 +335,7 @@
}); });
$( '.show_options_if_checked' ).each( function() { $( '.show_options_if_checked' ).each( function() {
$( this ).find( 'input:eq(0)' ).change( function() { $( this ).find( 'input:eq(0)' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) { if ( $( this ).is( ':checked' ) ) {
$( this ) $( this )
.closest( 'fieldset, tr' ) .closest( 'fieldset, tr' )
@ -351,7 +351,7 @@
}); });
// Reviews. // Reviews.
$( 'input#woocommerce_enable_reviews' ).change(function() { $( 'input#woocommerce_enable_reviews' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) { if ( $( this ).is( ':checked' ) ) {
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show(); $( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
} else { } else {

View File

@ -104,7 +104,7 @@
// KEYBOARD: // KEYBOARD:
if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) { if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
$(document).bind('keyup', function(event) { $(document).on('keyup', function(event) {
var keycode = event.keyCode; var keycode = event.keyCode;
if (!slider.animating && (keycode === 39 || keycode === 37)) { if (!slider.animating && (keycode === 39 || keycode === 37)) {
var target = (slider.vars.rtl? var target = (slider.vars.rtl?
@ -121,7 +121,7 @@
} }
// MOUSEWHEEL: // MOUSEWHEEL:
if (slider.vars.mousewheel) { if (slider.vars.mousewheel) {
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) { slider.on('mousewheel', function(event, delta, deltaX, deltaY) {
event.preventDefault(); event.preventDefault();
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev'); var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, slider.vars.pauseOnAction); slider.flexAnimate(target, slider.vars.pauseOnAction);
@ -137,9 +137,9 @@
// SLIDSESHOW // SLIDSESHOW
if (slider.vars.slideshow) { if (slider.vars.slideshow) {
if (slider.vars.pauseOnHover) { if (slider.vars.pauseOnHover) {
slider.hover(function() { slider.on( 'mouseenter', function() {
if (!slider.manualPlay && !slider.manualPause) { slider.pause(); } if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
}, function() { } ).on( 'mouseleave', function() {
if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); } if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
}); });
} }
@ -157,7 +157,7 @@
if (touch && slider.vars.touch) { methods.touch(); } if (touch && slider.vars.touch) { methods.touch(); }
// FADE&&SMOOTHHEIGHT || SLIDE: // FADE&&SMOOTHHEIGHT || SLIDE:
if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); } if (!fade || (fade && slider.vars.smoothHeight)) { $(window).on("resize orientationchange focus", methods.resize); }
slider.find("img").attr("draggable", "false"); slider.find("img").attr("draggable", "false");
@ -274,7 +274,7 @@
methods.controlNav.active(); methods.controlNav.active();
slider.controlNavScaffold.delegate('a, img', eventType, function(event) { slider.controlNavScaffold.on(eventType, 'a, img', function(event) {
event.preventDefault(); event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) { if (watchedEvent === "" || watchedEvent === event.type) {
@ -299,7 +299,7 @@
slider.controlNav = slider.manualControls; slider.controlNav = slider.manualControls;
methods.controlNav.active(); methods.controlNav.active();
slider.controlNav.bind(eventType, function(event) { slider.controlNav.on(eventType, function(event) {
event.preventDefault(); event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) { if (watchedEvent === "" || watchedEvent === event.type) {
@ -356,7 +356,7 @@
methods.directionNav.update(); methods.directionNav.update();
slider.directionNav.bind(eventType, function(event) { slider.directionNav.on(eventType, function(event) {
event.preventDefault(); event.preventDefault();
var target; var target;
@ -372,7 +372,7 @@
methods.setToClearWatchedEvent(); methods.setToClearWatchedEvent();
}); });
}, },
update: function() { update: function() {console.log('updating...');
var disabledClass = namespace + 'disabled'; var disabledClass = namespace + 'disabled';
if (slider.pagingCount === 1) { if (slider.pagingCount === 1) {
slider.directionNav.addClass(disabledClass).attr('tabindex', '-1'); slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
@ -382,10 +382,10 @@
} else if (slider.animatingTo === slider.last) { } else if (slider.animatingTo === slider.last) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1'); slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
} else { } else {
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex'); slider.directionNav.removeClass(disabledClass).prop( 'tabindex', '-1' );
} }
} else { } else {
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex'); slider.directionNav.removeClass(disabledClass).prop( 'tabindex', '-1' );
} }
} }
}, },
@ -404,7 +404,7 @@
methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play'); methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
slider.pausePlay.bind(eventType, function(event) { slider.pausePlay.on(eventType, function(event) {
event.preventDefault(); event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) { if (watchedEvent === "" || watchedEvent === event.type) {
@ -794,8 +794,8 @@
} }
// Unbind previous transitionEnd events and re-bind new transitionEnd event // Unbind previous transitionEnd events and re-bind new transitionEnd event
slider.container.unbind("webkitTransitionEnd transitionend"); slider.container.off("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function() { slider.container.on("webkitTransitionEnd transitionend", function() {
clearTimeout(slider.ensureAnimationEnd); clearTimeout(slider.ensureAnimationEnd);
slider.wrapup(dimension); slider.wrapup(dimension);
}); });
@ -1133,9 +1133,9 @@
}; };
// Ensure the slider isn't focussed if the window loses focus. // Ensure the slider isn't focussed if the window loses focus.
$( window ).blur( function ( e ) { $( window ).on( 'blur', function ( e ) {
focused = false; focused = false;
}).focus( function ( e ) { }).on( 'focus', function ( e ) {
focused = true; focused = true;
}); });

View File

@ -26,7 +26,7 @@ jQuery( function( $ ) {
// Trigger initial click // Trigger initial click
.find( 'input[name=payment_method]:checked' ).trigger( 'click' ); .find( 'input[name=payment_method]:checked' ).trigger( 'click' );
$( '#add_payment_method' ).submit( function() { $( '#add_payment_method' ).on( 'submit', function() {
$( '#add_payment_method' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); $( '#add_payment_method' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
}); });

View File

@ -379,7 +379,7 @@
if ( ! current_attr_select.data( 'attribute_html' ) ) { if ( ! current_attr_select.data( 'attribute_html' ) ) {
var refSelect = current_attr_select.clone(); var refSelect = current_attr_select.clone();
refSelect.find( 'option' ).prop( 'disabled attached', false ).prop( 'selected', false ); refSelect.find( 'option' ).removeAttr( 'attached' ).prop( 'disabled', false ).prop( 'selected', false );
// Legacy data attribute. // Legacy data attribute.
current_attr_select.data( current_attr_select.data(

View File

@ -180,7 +180,7 @@ jQuery( function( $ ) {
wp.customize.widgetsPreview.WidgetPartial wp.customize.widgetsPreview.WidgetPartial
); );
if ( hasSelectiveRefresh ) { if ( hasSelectiveRefresh ) {
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() { wp.customize.selectiveRefresh.on( 'partial-content-rendered', function() {
refresh_cart_fragment(); refresh_cart_fragment();
} ); } );
} }

View File

@ -58,7 +58,7 @@ jQuery( function( $ ) {
$( document.body ).trigger( 'init_checkout' ); $( document.body ).trigger( 'init_checkout' );
} }
if ( wc_checkout_params.option_guest_checkout === 'yes' ) { if ( wc_checkout_params.option_guest_checkout === 'yes' ) {
$( 'input#createaccount' ).change( this.toggle_create_account ).trigger( 'change' ); $( 'input#createaccount' ).on( 'change', this.toggle_create_account ).trigger( 'change' );
} }
}, },
init_payment_methods: function() { init_payment_methods: function() {
@ -449,12 +449,12 @@ jQuery( function( $ ) {
$( window ).on('beforeunload', this.handleUnloadEvent); $( window ).on('beforeunload', this.handleUnloadEvent);
}, },
detachUnloadEventsOnSubmit: function() { detachUnloadEventsOnSubmit: function() {
$( window ).unbind('beforeunload', this.handleUnloadEvent); $( window ).off('beforeunload', this.handleUnloadEvent);
}, },
blockOnSubmit: function( $form ) { blockOnSubmit: function( $form ) {
var form_data = $form.data(); var isBlocked = $form.data( 'blockUI.isBlocked' );
if ( 1 !== form_data['blockUI.isBlocked'] ) { if ( 1 !== isBlocked ) {
$form.block({ $form.block({
message: null, message: null,
overlayCSS: { overlayCSS: {
@ -589,11 +589,11 @@ jQuery( function( $ ) {
init: function() { init: function() {
$( document.body ).on( 'click', 'a.showcoupon', this.show_coupon_form ); $( document.body ).on( 'click', 'a.showcoupon', this.show_coupon_form );
$( document.body ).on( 'click', '.woocommerce-remove-coupon', this.remove_coupon ); $( document.body ).on( 'click', '.woocommerce-remove-coupon', this.remove_coupon );
$( 'form.checkout_coupon' ).hide().submit( this.submit ); $( 'form.checkout_coupon' ).hide().on( 'submit', this.submit );
}, },
show_coupon_form: function() { show_coupon_form: function() {
$( '.checkout_coupon' ).slideToggle( 400, function() { $( '.checkout_coupon' ).slideToggle( 400, function() {
$( '.checkout_coupon' ).find( ':input:eq(0)' ).focus(); $( '.checkout_coupon' ).find( ':input:eq(0)' ).trigger( 'focus' );
}); });
return false; return false;
}, },

View File

@ -55,14 +55,17 @@ jQuery( function( $ ) {
var wc_country_select_select2 = function() { var wc_country_select_select2 = function() {
$( 'select.country_select:visible, select.state_select:visible' ).each( function() { $( 'select.country_select:visible, select.state_select:visible' ).each( function() {
var $this = $( this );
var select2_args = $.extend({ var select2_args = $.extend({
placeholder: $( this ).attr( 'data-placeholder' ) || $( this ).attr( 'placeholder' ) || '', placeholder: $this.attr( 'data-placeholder' ) || $this.attr( 'placeholder' ) || '',
label: $this.attr( 'data-label' ) || null,
width: '100%' width: '100%'
}, getEnhancedSelectFormatString() ); }, getEnhancedSelectFormatString() );
$( this ) $( this )
.on( 'select2:select', function() { .on( 'select2:select', function() {
$( this ).focus(); // Maintain focus after select https://github.com/select2/select2/issues/4384 $( this ).trigger( 'focus' ); // Maintain focus after select https://github.com/select2/select2/issues/4384
} ) } )
.selectWoo( select2_args ); .selectWoo( select2_args );
}); });

View File

@ -48,7 +48,7 @@
) { ) {
submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' ); submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
} else { } else {
submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' ); submit.prop( 'disabled', false ).removeClass( 'disabled' );
} }
}, },

View File

@ -76,7 +76,7 @@ jQuery( function( $ ) {
wp.customize.widgetsPreview.WidgetPartial wp.customize.widgetsPreview.WidgetPartial
); );
if ( hasSelectiveRefresh ) { if ( hasSelectiveRefresh ) {
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() { wp.customize.selectiveRefresh.on( 'partial-content-rendered', function() {
init_price_filter(); init_price_filter();
} ); } );
} }

View File

@ -30,7 +30,7 @@ jQuery( function( $ ) {
); );
// OR if create account is checked. // OR if create account is checked.
$( 'input#createaccount' ).change( { tokenizationForm: this }, this.onCreateAccountChange ); $( 'input#createaccount' ).on( 'change', { tokenizationForm: this }, this.onCreateAccountChange );
// First display. // First display.
this.onDisplay(); this.onDisplay();

View File

@ -14,7 +14,7 @@ jQuery( function( $ ) {
} }
}); });
var noticeID = $( '.woocommerce-store-notice' ).data( 'notice-id' ) || '', var noticeID = $( '.woocommerce-store-notice' ).data( 'noticeId' ) || '',
cookieName = 'store_notice' + noticeID; cookieName = 'store_notice' + noticeID;
// Check the value of that cookie and show/hide the notice accordingly // Check the value of that cookie and show/hide the notice accordingly
@ -87,7 +87,11 @@ jQuery( function( $ ) {
$( '.show-password-input' ).on( 'click', $( '.show-password-input' ).on( 'click',
function() { function() {
$( this ).toggleClass( 'display-password' ); if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).removeClass( 'display-password' );
} else {
$( this ).addClass( 'display-password' );
}
if ( $( this ).hasClass( 'display-password' ) ) { if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).siblings( ['input[type="password"]'] ).prop( 'type', 'text' ); $( this ).siblings( ['input[type="password"]'] ).prop( 'type', 'text' );
} else { } else {

View File

@ -25,7 +25,7 @@
var msie = /MSIE/.test(navigator.userAgent); var msie = /MSIE/.test(navigator.userAgent);
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent); var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
var mode = document.documentMode || 0; var mode = document.documentMode || 0;
var setExpr = $.isFunction( document.createElement('div').style.setExpression ); var setExpr = 'function' === typeof document.createElement('div').style.setExpression ? document.createElement('div').style.setExpression : false;
// global $ methods for blocking/unblocking the entire page // global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); }; $.blockUI = function(opts) { install(window, opts); };
@ -56,7 +56,7 @@
callBlock(); callBlock();
var nonmousedOpacity = $m.css('opacity'); var nonmousedOpacity = $m.css('opacity');
$m.mouseover(function() { $m.on( 'mouseover', function() {
callBlock({ callBlock({
fadeIn: 0, fadeIn: 0,
timeout: 30000 timeout: 30000
@ -65,7 +65,7 @@
var displayBlock = $('.blockMsg'); var displayBlock = $('.blockMsg');
displayBlock.stop(); // cancel fadeout if it has started displayBlock.stop(); // cancel fadeout if it has started
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
}).mouseout(function() { }).on( 'mouseout', function() {
$('.blockMsg').fadeOut(1000); $('.blockMsg').fadeOut(1000);
}); });
// End konapun additions // End konapun additions
@ -550,9 +550,9 @@
// bind anchors and inputs for mouse and key events // bind anchors and inputs for mouse and key events
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
if (b) if (b)
$(document).bind(events, opts, handler); $(document).on(events, opts, handler);
else else
$(document).unbind(events, handler); $(document).off(events, handler);
// former impl... // former impl...
// var $e = $('a,:input'); // var $e = $('a,:input');
@ -591,7 +591,7 @@
return; return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e) if (e)
e.focus(); e.trigger( 'focus' );
} }
function center(el, x, y) { function center(el, x, y) {

View File

@ -49,14 +49,14 @@
function read(s, converter) { function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s); var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value; return 'function' === typeof converter ? converter(value) : value;
} }
var config = $.cookie = function (key, value, options) { var config = $.cookie = function (key, value, options) {
// Write // Write
if (value !== undefined && !$.isFunction(value)) { if (value !== undefined && 'function' !== typeof value) {
options = $.extend({}, config.defaults, options); options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') { if (typeof options.expires === 'number') {

View File

@ -29,7 +29,7 @@ Licensed under the MIT license.
* V. 1.1: Fix error handling so e.g. parsing an empty string does * V. 1.1: Fix error handling so e.g. parsing an empty string does
* produce a color rather than just crashing. * produce a color rather than just crashing.
*/ */
(function(B){B.color={};B.color.make=function(F,E,C,D){var G={};G.r=F||0;G.g=E||0;G.b=C||0;G.a=D!=null?D:1;G.add=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]+=I}return G.normalize()};G.scale=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]*=I}return G.normalize()};G.toString=function(){if(G.a>=1){return"rgb("+[G.r,G.g,G.b].join(",")+")"}else{return"rgba("+[G.r,G.g,G.b,G.a].join(",")+")"}};G.normalize=function(){function H(J,K,I){return K<J?J:(K>I?I:K)}G.r=H(0,parseInt(G.r),255);G.g=H(0,parseInt(G.g),255);G.b=H(0,parseInt(G.b),255);G.a=H(0,G.a,1);return G};G.clone=function(){return B.color.make(G.r,G.b,G.g,G.a)};return G.normalize()};B.color.extract=function(D,C){var E;do{E=D.css(C).toLowerCase();if(E!=""&&E!="transparent"){break}D=D.parent()}while(!B.nodeName(D.get(0),"body"));if(E=="rgba(0, 0, 0, 0)"){E="transparent"}return B.color.parse(E)};B.color.parse=function(F){var E,C=B.color.make;if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10))}if(E=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10),parseFloat(E[4]))}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55)}if(E=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55,parseFloat(E[4]))}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return C(parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16))}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return C(parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16))}var D=B.trim(F).toLowerCase();if(D=="transparent"){return C(255,255,255,0)}else{E=A[D]||[0,0,0];return C(E[0],E[1],E[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery); (function(B){B.color={};B.color.make=function(F,E,C,D){var G={};G.r=F||0;G.g=E||0;G.b=C||0;G.a=D!=null?D:1;G.add=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]+=I}return G.normalize()};G.scale=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]*=I}return G.normalize()};G.toString=function(){if(G.a>=1){return"rgb("+[G.r,G.g,G.b].join(",")+")"}else{return"rgba("+[G.r,G.g,G.b,G.a].join(",")+")"}};G.normalize=function(){function H(J,K,I){return K<J?J:(K>I?I:K)}G.r=H(0,parseInt(G.r),255);G.g=H(0,parseInt(G.g),255);G.b=H(0,parseInt(G.b),255);G.a=H(0,G.a,1);return G};G.clone=function(){return B.color.make(G.r,G.b,G.g,G.a)};return G.normalize()};B.color.extract=function(D,C){var E;do{E=D.css(C).toLowerCase();if(E!=""&&E!="transparent"){break}D=D.parent()}while(!B.nodeName(D.get(0),"body"));if(E=="rgba(0, 0, 0, 0)"){E="transparent"}return B.color.parse(E)};B.color.parse=function(F){var E,C=B.color.make;if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10))}if(E=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10),parseFloat(E[4]))}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55)}if(E=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55,parseFloat(E[4]))}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return C(parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16))}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return C(parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16))}if('string'===typeof F){var D=F.trim().toLowerCase()}else{var D=''};if(D=="transparent"){return C(255,255,255,0)}else{E=A[D]||[0,0,0];return C(E[0],E[1],E[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
// the actual Flot code // the actual Flot code
(function($) { (function($) {
@ -1265,7 +1265,7 @@ Licensed under the MIT license.
octx = overlay.context; octx = overlay.context;
// define which element we're listening for events on // define which element we're listening for events on
eventHolder = $(overlay.element).unbind(); eventHolder = $(overlay.element).off();
// If we're re-using a plot object, shut down the old one // If we're re-using a plot object, shut down the old one
@ -1291,11 +1291,11 @@ Licensed under the MIT license.
// was fixed somewhere around 1.3.x. We can return to using // was fixed somewhere around 1.3.x. We can return to using
// .mouseleave when we drop support for 1.2.6. // .mouseleave when we drop support for 1.2.6.
eventHolder.bind("mouseleave", onMouseLeave); eventHolder.on("mouseleave", onMouseLeave);
} }
if (options.grid.clickable) if (options.grid.clickable)
eventHolder.click(onClick); eventHolder.on( 'click', onClick );
executeHooks(hooks.bindEvents, [eventHolder]); executeHooks(hooks.bindEvents, [eventHolder]);
} }
@ -1304,9 +1304,9 @@ Licensed under the MIT license.
if (redrawTimeout) if (redrawTimeout)
clearTimeout(redrawTimeout); clearTimeout(redrawTimeout);
eventHolder.unbind("mousemove", onMouseMove); eventHolder.off("mousemove", onMouseMove);
eventHolder.unbind("mouseleave", onMouseLeave); eventHolder.off("mouseleave", onMouseLeave);
eventHolder.unbind("click", onClick); eventHolder.off("click", onClick);
executeHooks(hooks.shutdown, [eventHolder]); executeHooks(hooks.shutdown, [eventHolder]);
} }
@ -1704,7 +1704,7 @@ Licensed under the MIT license.
}; };
} }
if ($.isFunction(opts.tickFormatter)) if ( 'function' === typeof opts.tickFormatter )
axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); }; axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };
if (opts.alignTicksWithAxis != null) { if (opts.alignTicksWithAxis != null) {
@ -1751,7 +1751,7 @@ Licensed under the MIT license.
if (oticks == null || (typeof oticks == "number" && oticks > 0)) if (oticks == null || (typeof oticks == "number" && oticks > 0))
ticks = axis.tickGenerator(axis); ticks = axis.tickGenerator(axis);
else if (oticks) { else if (oticks) {
if ($.isFunction(oticks)) if ( 'function' === typeof oticks )
// generate the ticks // generate the ticks
ticks = oticks(axis); ticks = oticks(axis);
else else
@ -1875,7 +1875,7 @@ Licensed under the MIT license.
// draw markings // draw markings
var markings = options.grid.markings; var markings = options.grid.markings;
if (markings) { if (markings) {
if ($.isFunction(markings)) { if ( 'function' === typeof markings ) {
axes = plot.getAxes(); axes = plot.getAxes();
// xmin etc. is backwards compatibility, to be // xmin etc. is backwards compatibility, to be
// removed in the future // removed in the future
@ -2659,7 +2659,7 @@ Licensed under the MIT license.
// Sort the legend using either the default or a custom comparator // Sort the legend using either the default or a custom comparator
if (options.legend.sorted) { if (options.legend.sorted) {
if ($.isFunction(options.legend.sorted)) { if ( 'function' === typeof options.legend.sorted ) {
entries.sort(options.legend.sorted); entries.sort(options.legend.sorted);
} else if (options.legend.sorted == "reverse") { } else if (options.legend.sorted == "reverse") {
entries.reverse(); entries.reverse();

View File

@ -120,10 +120,10 @@ More detail and specific examples can be found in the included HTML file.
var options = plot.getOptions(); var options = plot.getOptions();
if (options.series.pie.show) { if (options.series.pie.show) {
if (options.grid.hoverable) { if (options.grid.hoverable) {
eventHolder.unbind("mousemove").mousemove(onMouseMove); eventHolder.off("mousemove").on( 'mousemove', onMouseMove );
} }
if (options.grid.clickable) { if (options.grid.clickable) {
eventHolder.unbind("click").click(onClick); eventHolder.off("click").on( 'click', onClick );
} }
} }
}); });
@ -180,11 +180,11 @@ More detail and specific examples can be found in the included HTML file.
// new one; this is more efficient and preserves any extra data // new one; this is more efficient and preserves any extra data
// that the user may have stored in higher indexes. // that the user may have stored in higher indexes.
if ($.isArray(value) && value.length == 1) { if (Array.isArray(value) && value.length == 1) {
value = value[0]; value = value[0];
} }
if ($.isArray(value)) { if (Array.isArray(value)) {
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7 // Equivalent to $.isNumeric() but compatible with jQuery < 1.7
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) { if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
value[1] = +value[1]; value[1] = +value[1];

View File

@ -20,7 +20,7 @@ can just fix the size of their placeholders.
* http://benalman.com/about/license/ * http://benalman.com/about/license/
*/ */
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this); (function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if('function'===typeof l){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
(function ($) { (function ($) {
var options = { }; // no options var options = { }; // no options
@ -40,11 +40,11 @@ can just fix the size of their placeholders.
} }
function bindEvents(plot, eventHolder) { function bindEvents(plot, eventHolder) {
plot.getPlaceholder().resize(onResize); plot.getPlaceholder().on( 'resize', onResize );
} }
function shutdown(plot, eventHolder) { function shutdown(plot, eventHolder) {
plot.getPlaceholder().unbind("resize", onResize); plot.getPlaceholder().off("resize", onResize);
} }
plot.hooks.bindEvents.push(bindEvents); plot.hooks.bindEvents.push(bindEvents);

View File

@ -554,8 +554,8 @@ jQuery( function( $ ) {
if (!(month && year)) { if (!(month && year)) {
return false; return false;
} }
month = $.trim(month); month = 'string' === typeof month ? month.trim() : '';
year = $.trim(year); year = 'string' === typeof year ? year.trim() : '';
if (!/^\d+$/.test(month)) { if (!/^\d+$/.test(month)) {
return false; return false;
} }
@ -584,7 +584,7 @@ jQuery( function( $ ) {
$.payment.validateCardCVC = function(cvc, type) { $.payment.validateCardCVC = function(cvc, type) {
var card, _ref; var card, _ref;
cvc = $.trim(cvc); cvc = 'string' === typeof cvc ? cvc.trim() : '';
if (!/^\d+$/.test(cvc)) { if (!/^\d+$/.test(cvc)) {
return false; return false;
} }

View File

@ -131,7 +131,7 @@
if (opts.typeFunctions && type && opts.typeFunctions[type]) { // use a type if available if (opts.typeFunctions && type && opts.typeFunctions[type]) { // use a type if available
parsedVal = opts.typeFunctions[type](valStr); parsedVal = opts.typeFunctions[type](valStr);
} else if (opts.parseNumbers && f.isNumeric(valStr)) { // auto: number } else if (opts.parseNumbers && (! isNaN(valStr) && isFinite(valStr))) { // auto: number
parsedVal = Number(valStr); parsedVal = Number(valStr);
} else if (opts.parseBooleans && (valStr === "true" || valStr === "false")) { // auto: boolean } else if (opts.parseBooleans && (valStr === "true" || valStr === "false")) { // auto: boolean
parsedVal = (valStr === "true"); parsedVal = (valStr === "true");
@ -314,12 +314,12 @@
// '' is used to push values into the array "array[]" // '' is used to push values into the array "array[]"
if (nextKey === '') { if (nextKey === '') {
if (f.isUndefined(o[key]) || !$.isArray(o[key])) { if (f.isUndefined(o[key]) || !Array.isArray(o[key])) {
o[key] = []; // define (or override) as array to push values o[key] = []; // define (or override) as array to push values
} }
} else { } else {
if (opts.useIntKeysAsArrayIndex && f.isValidArrayIndex(nextKey)) { // if 1, 2, 3 ... then use an array, where nextKey is the index if (opts.useIntKeysAsArrayIndex && f.isValidArrayIndex(nextKey)) { // if 1, 2, 3 ... then use an array, where nextKey is the index
if (f.isUndefined(o[key]) || !$.isArray(o[key])) { if (f.isUndefined(o[key]) || !Array.isArray(o[key])) {
o[key] = []; // define (or override) as array, to insert values using int keys as array indexes o[key] = []; // define (or override) as array, to insert values using int keys as array indexes
} }
} else { // for anything else, use an object, where nextKey is going to be the attribute name } else { // for anything else, use an object, where nextKey is going to be the attribute name

View File

@ -58,40 +58,40 @@
} }
if(org_title != ""){ if(org_title != ""){
if(!opts.content){ if(!opts.content){
org_elem.removeAttr(opts.attribute); //remove original Attribute org_elem.prop(opts.attribute, false); //remove original Attribute
} }
var timeout = false; var timeout = false;
if(opts.activation == "hover"){ if(opts.activation == "hover"){
org_elem.hover(function(){ org_elem.on( 'mouseenter', function(){
active_tiptip(); active_tiptip();
}, function(){ } ).on( 'mouseleave', function(){
if(!opts.keepAlive || !tiptip_holder.is(':hover')){ if(!opts.keepAlive || !tiptip_holder.is(':hover')){
deactive_tiptip(); deactive_tiptip();
} }
}); });
if(opts.keepAlive){ if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){ tiptip_holder.on( 'mouseenter', function(){} ).on( 'mouseleave', function(){
deactive_tiptip(); deactive_tiptip();
}); });
} }
} else if(opts.activation == "focus"){ } else if(opts.activation == "focus"){
org_elem.focus(function(){ org_elem.on( 'focus', function(){
active_tiptip(); active_tiptip();
}).blur(function(){ }).on( 'blur', function(){
deactive_tiptip(); deactive_tiptip();
}); });
} else if(opts.activation == "click"){ } else if(opts.activation == "click"){
org_elem.click(function(){ org_elem.on( 'click', function(){
active_tiptip(); active_tiptip();
return false; return false;
}).hover(function(){},function(){ }).on( 'mouseenter', function(){} ).on( 'mouseleave' ,function(){
if(!opts.keepAlive){ if(!opts.keepAlive){
deactive_tiptip(); deactive_tiptip();
} }
}); });
if(opts.keepAlive){ if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){ tiptip_holder.on( 'mouseenter', function(){} ).on( 'mouseleave', function(){
deactive_tiptip(); deactive_tiptip();
}); });
} }
@ -100,7 +100,8 @@
function active_tiptip(){ function active_tiptip(){
opts.enter.call(this); opts.enter.call(this);
tiptip_content.html(org_title); tiptip_content.html(org_title);
tiptip_holder.hide().removeAttr("class").css("margin","0"); tiptip_holder.hide().css("margin","0");
tiptip_holder.removeAttr('class');
tiptip_arrow.removeAttr("style"); tiptip_arrow.removeAttr("style");
var top = parseInt(org_elem.offset()['top']); var top = parseInt(org_elem.offset()['top']);

View File

@ -149,7 +149,7 @@
var self = this; var self = this;
// Delegate the touch handlers to the widget's element // Delegate the touch handlers to the widget's element
self.element.bind({ self.element.on({
touchstart: $.proxy(self, '_touchStart'), touchstart: $.proxy(self, '_touchStart'),
touchmove: $.proxy(self, '_touchMove'), touchmove: $.proxy(self, '_touchMove'),
touchend: $.proxy(self, '_touchEnd') touchend: $.proxy(self, '_touchEnd')
@ -167,7 +167,7 @@
var self = this; var self = this;
// Delegate the touch handlers to the widget's element // Delegate the touch handlers to the widget's element
self.element.unbind({ self.element.off({
touchstart: $.proxy(self, '_touchStart'), touchstart: $.proxy(self, '_touchStart'),
touchmove: $.proxy(self, '_touchMove'), touchmove: $.proxy(self, '_touchMove'),
touchend: $.proxy(self, '_touchEnd') touchend: $.proxy(self, '_touchEnd')

View File

@ -108,10 +108,10 @@
doresize = true, scroll_pos = _get_scroll(); doresize = true, scroll_pos = _get_scroll();
// Window/Keyboard events // Window/Keyboard events
$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); }); $(window).off('resize.prettyphoto').on('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
if(pp_settings.keyboard_shortcuts) { if(pp_settings.keyboard_shortcuts) {
$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){ $(document).off('keydown.prettyphoto').on('keydown.prettyphoto',function(e){
if(typeof $pp_pic_holder != 'undefined'){ if(typeof $pp_pic_holder != 'undefined'){
if($pp_pic_holder.is(':visible')){ if($pp_pic_holder.is(':visible')){
switch(e.keyCode){ switch(e.keyCode){
@ -162,7 +162,7 @@
_build_overlay(this); // Build the overlay {this} being the caller _build_overlay(this); // Build the overlay {this} being the caller
if(settings.allow_resize) if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); }); $(window).on('scroll.prettyphoto',function(){ _center_overlay(); });
$.prettyPhoto.open(); $.prettyPhoto.open();
@ -431,7 +431,7 @@
*/ */
$.prettyPhoto.startSlideshow = function(){ $.prettyPhoto.startSlideshow = function(){
if(typeof pp_slideshow == 'undefined'){ if(typeof pp_slideshow == 'undefined'){
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){ $pp_pic_holder.find('.pp_play').off('click').removeClass('pp_play').addClass('pp_pause').on( 'click', function(){
$.prettyPhoto.stopSlideshow(); $.prettyPhoto.stopSlideshow();
return false; return false;
}); });
@ -446,7 +446,7 @@
* Stop the slideshow... * Stop the slideshow...
*/ */
$.prettyPhoto.stopSlideshow = function(){ $.prettyPhoto.stopSlideshow = function(){
$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){ $pp_pic_holder.find('.pp_pause').off('click').removeClass('pp_pause').addClass('pp_play').on( 'click', function(){
$.prettyPhoto.startSlideshow(); $.prettyPhoto.startSlideshow();
return false; return false;
}); });
@ -473,7 +473,7 @@
$(this).remove(); // No more need for the prettyPhoto markup $(this).remove(); // No more need for the prettyPhoto markup
$(window).unbind('scroll.prettyphoto'); $(window).off('scroll.prettyphoto');
clearHashtag(); clearHashtag();
@ -739,7 +739,7 @@
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected'); $pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
}else{ }else{
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave'); $pp_pic_holder.find('.pp_content').off('mouseenter mouseleave');
// $pp_gallery.hide(); // $pp_gallery.hide();
} }
} }
@ -776,22 +776,22 @@
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors $pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
$pp_gallery.find('.pp_arrow_next').click(function(){ $pp_gallery.find('.pp_arrow_next').on( 'click', function(){
$.prettyPhoto.changeGalleryPage('next'); $.prettyPhoto.changeGalleryPage('next');
$.prettyPhoto.stopSlideshow(); $.prettyPhoto.stopSlideshow();
return false; return false;
}); });
$pp_gallery.find('.pp_arrow_previous').click(function(){ $pp_gallery.find('.pp_arrow_previous').on( 'click', function(){
$.prettyPhoto.changeGalleryPage('previous'); $.prettyPhoto.changeGalleryPage('previous');
$.prettyPhoto.stopSlideshow(); $.prettyPhoto.stopSlideshow();
return false; return false;
}); });
$pp_pic_holder.find('.pp_content').hover( $pp_pic_holder.find('.pp_content').on( 'mouseenter',
function(){ function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn(); $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
}, } ).on( 'mouseleave',
function(){ function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut(); $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
}); });
@ -800,7 +800,7 @@
$pp_gallery_li.each(function(i){ $pp_gallery_li.each(function(i){
$(this) $(this)
.find('a') .find('a')
.click(function(){ .on( 'click', function(){
$.prettyPhoto.changePage(i); $.prettyPhoto.changePage(i);
$.prettyPhoto.stopSlideshow(); $.prettyPhoto.stopSlideshow();
return false; return false;
@ -812,7 +812,7 @@
// Inject the play/pause if it's a slideshow // Inject the play/pause if it's a slideshow
if(settings.slideshow){ if(settings.slideshow){
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>') $pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){ $pp_pic_holder.find('.pp_nav .pp_play').on( 'click', function(){
$.prettyPhoto.startSlideshow(); $.prettyPhoto.startSlideshow();
return false; return false;
}); });
@ -826,15 +826,15 @@
'height':$(document).height(), 'height':$(document).height(),
'width':$(window).width() 'width':$(window).width()
}) })
.bind('click',function(){ .on('click',function(){
if(!settings.modal) $.prettyPhoto.close(); if(!settings.modal) $.prettyPhoto.close();
}); });
$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; }); $('a.pp_close').on('click',function(){ $.prettyPhoto.close(); return false; });
if(settings.allow_expand) { if(settings.allow_expand) {
$('a.pp_expand').bind('click',function(e){ $('a.pp_expand').on('click',function(e){
// Expand the image // Expand the image
if($(this).hasClass('pp_expand')){ if($(this).hasClass('pp_expand')){
$(this).removeClass('pp_expand').addClass('pp_contract'); $(this).removeClass('pp_expand').addClass('pp_contract');
@ -850,13 +850,13 @@
}); });
} }
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){ $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').on('click',function(){
$.prettyPhoto.changePage('previous'); $.prettyPhoto.changePage('previous');
$.prettyPhoto.stopSlideshow(); $.prettyPhoto.stopSlideshow();
return false; return false;
}); });
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){ $pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').on('click',function(){
$.prettyPhoto.changePage('next'); $.prettyPhoto.changePage('next');
$.prettyPhoto.stopSlideshow(); $.prettyPhoto.stopSlideshow();
return false; return false;
@ -879,7 +879,7 @@
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50); setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
} }
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once return this.off('click.prettyphoto').on('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
}; };
function getHashtag(){ function getHashtag(){

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,41 @@
/*! /*!
* Select2 4.0.3 * SelectWoo 1.0.9
* https://select2.github.io * https://github.com/woocommerce/selectWoo
* *
* Released under the MIT license * Released under the MIT license
* https://github.com/select2/select2/blob/master/LICENSE.md * https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
*/ */
(function (factory) { (function (factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define(['jquery'], factory); define(['jquery'], factory);
} else if (typeof exports === 'object') { } else if (typeof module === 'object' && module.exports) {
// Node/CommonJS // Node/CommonJS
factory(require('jquery')); module.exports = function (root, jQuery) {
if (jQuery === undefined) {
// require('jQuery') returns a factory that requires window to
// build a jQuery instance, we normalize how we use modules
// that require this pattern but the window provided is a noop
// if it's defined (how jquery works)
if (typeof window !== 'undefined') {
jQuery = require('jquery');
}
else {
jQuery = require('jquery')(root);
}
}
factory(jQuery);
return jQuery;
};
} else { } else {
// Browser globals // Browser globals
factory(jQuery); factory(jQuery);
} }
}(function (jQuery) { } (function (jQuery) {
// This is needed so we can catch the AMD loader configuration and use it // This is needed so we can catch the AMD loader configuration and use it
// The inner file should be wrapped (by `banner.start.js`) in a function that // The inner file should be wrapped (by `banner.start.js`) in a function that
// returns the AMD loader references. // returns the AMD loader references.
var S2 = var S2 =(function () {
(function () {
// Restore the Select2 AMD loader so it can be used // Restore the Select2 AMD loader so it can be used
// Needed mostly in the language files, where the loader is not inserted // Needed mostly in the language files, where the loader is not inserted
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
@ -30,13 +44,11 @@
var S2;(function () { if (!S2 || !S2.requirejs) { var S2;(function () { if (!S2 || !S2.requirejs) {
if (!S2) { S2 = {}; } else { require = S2; } if (!S2) { S2 = {}; } else { require = S2; }
/** /**
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
* Available via the MIT or new BSD license. * Released under MIT license, http://github.com/requirejs/almond/LICENSE
* see: http://github.com/jrburke/almond for details
*/ */
//Going sloppy to avoid 'use strict' string cost, but strict practices should //Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed. //be followed.
/*jslint sloppy: true */
/*global setTimeout: false */ /*global setTimeout: false */
var requirejs, require, define; var requirejs, require, define;
@ -64,46 +76,49 @@ var requirejs, require, define;
*/ */
function normalize(name, baseName) { function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap, lastIndex, var nameParts, nameSegment, mapValue, foundMap, lastIndex,
foundI, foundStarMap, starI, i, j, part, foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
baseParts = baseName && baseName.split("/"), baseParts = baseName && baseName.split("/"),
map = config.map, map = config.map,
starMap = (map && map['*']) || {}; starMap = (map && map['*']) || {};
//Adjust any relative paths. //Adjust any relative paths.
if (name && name.charAt(0) === ".") { if (name) {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
name = name.split('/'); name = name.split('/');
lastIndex = name.length - 1; lastIndex = name.length - 1;
// Node .js allowance: // If wanting node ID compatibility, strip .js from end
// of IDs. Have to do this here, and not in nameToUrl
// because node allows either .js or non .js to map
// to same file.
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
} }
//Lop off the last part of baseParts, so that . matches the // Starts with a '.' so need the baseName
//"directory" and not name of the baseName's module. For instance, if (name[0].charAt(0) === '.' && baseParts) {
//baseName of "one/two/three", maps to "one/two/three.js", but we //Convert baseName to array, and lop off the last part,
//want the directory, "one/two" for this normalization. //so that . matches that 'directory' and not name of the baseName's
name = baseParts.slice(0, baseParts.length - 1).concat(name); //module. For instance, baseName of 'one/two/three', maps to
//'one/two/three.js', but we want the directory, 'one/two' for
//this normalization.
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
name = normalizedBaseParts.concat(name);
}
//start trimDots //start trimDots
for (i = 0; i < name.length; i += 1) { for (i = 0; i < name.length; i++) {
part = name[i]; part = name[i];
if (part === ".") { if (part === '.') {
name.splice(i, 1); name.splice(i, 1);
i -= 1; i -= 1;
} else if (part === "..") { } else if (part === '..') {
if (i === 1 && (name[2] === '..' || name[0] === '..')) { // If at the start, or previous value is still ..,
//End of the line. Keep at least one non-dot // keep them so that when converted to a path it may
//path segment at the front so it can be mapped // still work when converted to a path, even though
//correctly to disk. Otherwise, there is likely // as an ID it is less than ideal. In larger point
//no path mapping for a path starting with '..'. // releases, may be better to just kick out an error.
//This can still fail, but catches the most reasonable if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
//uses of .. continue;
break;
} else if (i > 0) { } else if (i > 0) {
name.splice(i - 1, 2); name.splice(i - 1, 2);
i -= 2; i -= 2;
@ -112,12 +127,7 @@ var requirejs, require, define;
} }
//end trimDots //end trimDots
name = name.join("/"); name = name.join('/');
} else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
} }
//Apply map config if available. //Apply map config if available.
@ -230,32 +240,39 @@ var requirejs, require, define;
return [prefix, name]; return [prefix, name];
} }
//Creates a parts array for a relName where first part is plugin ID,
//second part is resource ID. Assumes relName has already been normalized.
function makeRelParts(relName) {
return relName ? splitPrefix(relName) : [];
}
/** /**
* Makes a name map, normalizing the name, and using a plugin * Makes a name map, normalizing the name, and using a plugin
* for normalization if necessary. Grabs a ref to plugin * for normalization if necessary. Grabs a ref to plugin
* too, as an optimization. * too, as an optimization.
*/ */
makeMap = function (name, relName) { makeMap = function (name, relParts) {
var plugin, var plugin,
parts = splitPrefix(name), parts = splitPrefix(name),
prefix = parts[0]; prefix = parts[0],
relResourceName = relParts[1];
name = parts[1]; name = parts[1];
if (prefix) { if (prefix) {
prefix = normalize(prefix, relName); prefix = normalize(prefix, relResourceName);
plugin = callDep(prefix); plugin = callDep(prefix);
} }
//Normalize according //Normalize according
if (prefix) { if (prefix) {
if (plugin && plugin.normalize) { if (plugin && plugin.normalize) {
name = plugin.normalize(name, makeNormalize(relName)); name = plugin.normalize(name, makeNormalize(relResourceName));
} else { } else {
name = normalize(name, relName); name = normalize(name, relResourceName);
} }
} else { } else {
name = normalize(name, relName); name = normalize(name, relResourceName);
parts = splitPrefix(name); parts = splitPrefix(name);
prefix = parts[0]; prefix = parts[0];
name = parts[1]; name = parts[1];
@ -302,13 +319,14 @@ var requirejs, require, define;
}; };
main = function (name, deps, callback, relName) { main = function (name, deps, callback, relName) {
var cjsModule, depName, ret, map, i, var cjsModule, depName, ret, map, i, relParts,
args = [], args = [],
callbackType = typeof callback, callbackType = typeof callback,
usingExports; usingExports;
//Use name if no relName //Use name if no relName
relName = relName || name; relName = relName || name;
relParts = makeRelParts(relName);
//Call the callback to define the module, if necessary. //Call the callback to define the module, if necessary.
if (callbackType === 'undefined' || callbackType === 'function') { if (callbackType === 'undefined' || callbackType === 'function') {
@ -317,7 +335,7 @@ var requirejs, require, define;
//Default to [require, exports, module] if no deps //Default to [require, exports, module] if no deps
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
for (i = 0; i < deps.length; i += 1) { for (i = 0; i < deps.length; i += 1) {
map = makeMap(deps[i], relName); map = makeMap(deps[i], relParts);
depName = map.f; depName = map.f;
//Fast path CommonJS standard dependencies. //Fast path CommonJS standard dependencies.
@ -373,7 +391,7 @@ var requirejs, require, define;
//deps arg is the module name, and second arg (if passed) //deps arg is the module name, and second arg (if passed)
//is just the relName. //is just the relName.
//Normalize module name, if it contains . or .. //Normalize module name, if it contains . or ..
return callDep(makeMap(deps, callback).f); return callDep(makeMap(deps, makeRelParts(callback)).f);
} else if (!deps.splice) { } else if (!deps.splice) {
//deps is a config object, not an array. //deps is a config object, not an array.
config = deps; config = deps;
@ -737,6 +755,12 @@ S2.define('select2/utils',[
}); });
}; };
Utils.entityDecode = function (html) {
var txt = document.createElement('textarea');
txt.innerHTML = html;
return txt.value;
}
// Append an array of jQuery nodes to a given element. // Append an array of jQuery nodes to a given element.
Utils.appendMany = function ($element, $nodes) { Utils.appendMany = function ($element, $nodes) {
// jQuery 1.7.x does not support $.fn.append() with an array // jQuery 1.7.x does not support $.fn.append() with an array
@ -754,6 +778,14 @@ S2.define('select2/utils',[
$element.append($nodes); $element.append($nodes);
}; };
// Determine whether the browser is on a touchscreen device.
Utils.isTouchscreen = function() {
if ('undefined' === typeof Utils._isTouchscreenCache) {
Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
}
return Utils._isTouchscreenCache;
}
return Utils; return Utils;
}); });
@ -773,7 +805,7 @@ S2.define('select2/results',[
Results.prototype.render = function () { Results.prototype.render = function () {
var $results = $( var $results = $(
'<ul class="select2-results__options" role="tree"></ul>' '<ul class="select2-results__options" role="listbox" tabindex="-1"></ul>'
); );
if (this.options.get('multiple')) { if (this.options.get('multiple')) {
@ -796,7 +828,7 @@ S2.define('select2/results',[
this.hideLoading(); this.hideLoading();
var $message = $( var $message = $(
'<li role="treeitem" aria-live="assertive"' + '<li role="alert" aria-live="assertive"' +
' class="select2-results__option"></li>' ' class="select2-results__option"></li>'
); );
@ -858,9 +890,9 @@ S2.define('select2/results',[
Results.prototype.highlightFirstItem = function () { Results.prototype.highlightFirstItem = function () {
var $options = this.$results var $options = this.$results
.find('.select2-results__option[aria-selected]'); .find('.select2-results__option[data-selected]');
var $selected = $options.filter('[aria-selected=true]'); var $selected = $options.filter('[data-selected=true]');
// Check if there are any selected options // Check if there are any selected options
if ($selected.length > 0) { if ($selected.length > 0) {
@ -884,7 +916,7 @@ S2.define('select2/results',[
}); });
var $options = self.$results var $options = self.$results
.find('.select2-results__option[aria-selected]'); .find('.select2-results__option[data-selected]');
$options.each(function () { $options.each(function () {
var $option = $(this); var $option = $(this);
@ -896,9 +928,9 @@ S2.define('select2/results',[
if ((item.element != null && item.element.selected) || if ((item.element != null && item.element.selected) ||
(item.element == null && $.inArray(id, selectedIds) > -1)) { (item.element == null && $.inArray(id, selectedIds) > -1)) {
$option.attr('aria-selected', 'true'); $option.attr('data-selected', 'true');
} else { } else {
$option.attr('aria-selected', 'false'); $option.attr('data-selected', 'false');
} }
}); });
@ -930,17 +962,18 @@ S2.define('select2/results',[
option.className = 'select2-results__option'; option.className = 'select2-results__option';
var attrs = { var attrs = {
'role': 'treeitem', 'role': 'option',
'aria-selected': 'false' 'data-selected': 'false',
'tabindex': -1
}; };
if (data.disabled) { if (data.disabled) {
delete attrs['aria-selected']; delete attrs['data-selected'];
attrs['aria-disabled'] = 'true'; attrs['aria-disabled'] = 'true';
} }
if (data.id == null) { if (data.id == null) {
delete attrs['aria-selected']; delete attrs['data-selected'];
} }
if (data._resultId != null) { if (data._resultId != null) {
@ -952,9 +985,8 @@ S2.define('select2/results',[
} }
if (data.children) { if (data.children) {
attrs.role = 'group';
attrs['aria-label'] = data.text; attrs['aria-label'] = data.text;
delete attrs['aria-selected']; delete attrs['data-selected'];
} }
for (var attr in attrs) { for (var attr in attrs) {
@ -971,6 +1003,7 @@ S2.define('select2/results',[
var $label = $(label); var $label = $(label);
this.template(data, label); this.template(data, label);
$label.attr('role', 'presentation');
var $children = []; var $children = [];
@ -983,10 +1016,11 @@ S2.define('select2/results',[
} }
var $childrenContainer = $('<ul></ul>', { var $childrenContainer = $('<ul></ul>', {
'class': 'select2-results__options select2-results__options--nested' 'class': 'select2-results__options select2-results__options--nested',
'role': 'listbox'
}); });
$childrenContainer.append($children); $childrenContainer.append($children);
$option.attr('role', 'list');
$option.append(label); $option.append(label);
$option.append($childrenContainer); $option.append($childrenContainer);
@ -1082,7 +1116,7 @@ S2.define('select2/results',[
var data = $highlighted.data('data'); var data = $highlighted.data('data');
if ($highlighted.attr('aria-selected') == 'true') { if ($highlighted.attr('data-selected') == 'true') {
self.trigger('close', {}); self.trigger('close', {});
} else { } else {
self.trigger('select', { self.trigger('select', {
@ -1094,7 +1128,7 @@ S2.define('select2/results',[
container.on('results:previous', function () { container.on('results:previous', function () {
var $highlighted = self.getHighlightedResults(); var $highlighted = self.getHighlightedResults();
var $options = self.$results.find('[aria-selected]'); var $options = self.$results.find('[data-selected]');
var currentIndex = $options.index($highlighted); var currentIndex = $options.index($highlighted);
@ -1128,7 +1162,7 @@ S2.define('select2/results',[
container.on('results:next', function () { container.on('results:next', function () {
var $highlighted = self.getHighlightedResults(); var $highlighted = self.getHighlightedResults();
var $options = self.$results.find('[aria-selected]'); var $options = self.$results.find('[data-selected]');
var currentIndex = $options.index($highlighted); var currentIndex = $options.index($highlighted);
@ -1156,7 +1190,8 @@ S2.define('select2/results',[
}); });
container.on('results:focus', function (params) { container.on('results:focus', function (params) {
params.element.addClass('select2-results__option--highlighted'); params.element.addClass('select2-results__option--highlighted').attr('aria-selected', 'true');
self.$results.attr('aria-activedescendant', params.element.attr('id'));
}); });
container.on('results:message', function (params) { container.on('results:message', function (params) {
@ -1188,13 +1223,13 @@ S2.define('select2/results',[
}); });
} }
this.$results.on('mouseup', '.select2-results__option[aria-selected]', this.$results.on('mouseup', '.select2-results__option[data-selected]',
function (evt) { function (evt) {
var $this = $(this); var $this = $(this);
var data = $this.data('data'); var data = $this.data('data');
if ($this.attr('aria-selected') === 'true') { if ($this.attr('data-selected') === 'true') {
if (self.options.get('multiple')) { if (self.options.get('multiple')) {
self.trigger('unselect', { self.trigger('unselect', {
originalEvent: evt, originalEvent: evt,
@ -1213,12 +1248,13 @@ S2.define('select2/results',[
}); });
}); });
this.$results.on('mouseenter', '.select2-results__option[aria-selected]', this.$results.on('mouseenter', '.select2-results__option[data-selected]',
function (evt) { function (evt) {
var data = $(this).data('data'); var data = $(this).data('data');
self.getHighlightedResults() self.getHighlightedResults()
.removeClass('select2-results__option--highlighted'); .removeClass('select2-results__option--highlighted')
.attr('aria-selected', 'false');
self.trigger('results:focus', { self.trigger('results:focus', {
data: data, data: data,
@ -1245,7 +1281,7 @@ S2.define('select2/results',[
return; return;
} }
var $options = this.$results.find('[aria-selected]'); var $options = this.$results.find('[data-selected]');
var currentIndex = $options.index($highlighted); var currentIndex = $options.index($highlighted);
@ -1323,7 +1359,7 @@ S2.define('select2/selection/base',[
BaseSelection.prototype.render = function () { BaseSelection.prototype.render = function () {
var $selection = $( var $selection = $(
'<span class="select2-selection" role="combobox" ' + '<span class="select2-selection" ' +
' aria-haspopup="true" aria-expanded="false">' + ' aria-haspopup="true" aria-expanded="false">' +
'</span>' '</span>'
); );
@ -1349,6 +1385,7 @@ S2.define('select2/selection/base',[
var id = container.id + '-container'; var id = container.id + '-container';
var resultsId = container.id + '-results'; var resultsId = container.id + '-results';
var searchHidden = this.options.get('minimumResultsForSearch') === Infinity;
this.container = container; this.container = container;
@ -1390,7 +1427,11 @@ S2.define('select2/selection/base',[
self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-activedescendant');
self.$selection.removeAttr('aria-owns'); self.$selection.removeAttr('aria-owns');
self.$selection.focus(); // This needs to be delayed as the active element is the body when the
// key is pressed.
window.setTimeout(function () {
self.$selection.trigger( 'focus' );
}, 1);
self._detachCloseHandler(container); self._detachCloseHandler(container);
}); });
@ -1440,8 +1481,14 @@ S2.define('select2/selection/base',[
} }
var $element = $this.data('element'); var $element = $this.data('element');
$element.select2('close'); $element.select2('close');
// Remove any focus when dropdown is closed by clicking outside the select area.
// Timeout of 1 required for close to finish wrapping up.
setTimeout(function(){
$this.find('*:focus').blur();
$target.focus();
}, 1);
}); });
}); });
}; };
@ -1500,8 +1547,21 @@ S2.define('select2/selection/single',[
var id = container.id + '-container'; var id = container.id + '-container';
this.$selection.find('.select2-selection__rendered').attr('id', id); this.$selection.find('.select2-selection__rendered')
this.$selection.attr('aria-labelledby', id); .attr('id', id)
.attr('role', 'textbox')
.attr('aria-readonly', 'true');
var label = this.options.get( 'label' );
if ( typeof( label ) === 'string' ) {
this.$selection.attr( 'aria-label', label );
} else {
this.$selection.attr( 'aria-labelledby', id );
}
// This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
this.$selection.attr('role', 'combobox');
this.$selection.on('mousedown', function (evt) { this.$selection.on('mousedown', function (evt) {
// Only respond to left clicks // Only respond to left clicks
@ -1518,13 +1578,20 @@ S2.define('select2/selection/single',[
// User focuses on the container // User focuses on the container
}); });
this.$selection.on('keydown', function (evt) {
// If user starts typing an alphanumeric key on the keyboard, open if not opened.
if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
container.open();
}
});
this.$selection.on('blur', function (evt) { this.$selection.on('blur', function (evt) {
// User exits the container // User exits the container
}); });
container.on('focus', function (evt) { container.on('focus', function (evt) {
if (!container.isOpen()) { if (!container.isOpen()) {
self.$selection.focus(); self.$selection.trigger( 'focus' );
} }
}); });
@ -1557,9 +1624,9 @@ S2.define('select2/selection/single',[
var selection = data[0]; var selection = data[0];
var $rendered = this.$selection.find('.select2-selection__rendered'); var $rendered = this.$selection.find('.select2-selection__rendered');
var formatted = this.display(selection, $rendered); var formatted = Utils.entityDecode(this.display(selection, $rendered));
$rendered.empty().append(formatted); $rendered.empty().text(formatted);
$rendered.prop('title', selection.title || selection.text); $rendered.prop('title', selection.title || selection.text);
}; };
@ -1583,7 +1650,7 @@ S2.define('select2/selection/multiple',[
$selection.addClass('select2-selection--multiple'); $selection.addClass('select2-selection--multiple');
$selection.html( $selection.html(
'<ul class="select2-selection__rendered"></ul>' '<ul class="select2-selection__rendered" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></ul>'
); );
return $selection; return $selection;
@ -1620,6 +1687,18 @@ S2.define('select2/selection/multiple',[
}); });
} }
); );
this.$selection.on('keydown', function (evt) {
// If user starts typing an alphanumeric key on the keyboard, open if not opened.
if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
container.open();
}
});
// Focus on the search field when the container is focused instead of the main container.
container.on( 'focus', function(){
self.focusOnSearch();
});
}; };
MultipleSelection.prototype.clear = function () { MultipleSelection.prototype.clear = function () {
@ -1636,7 +1715,7 @@ S2.define('select2/selection/multiple',[
MultipleSelection.prototype.selectionContainer = function () { MultipleSelection.prototype.selectionContainer = function () {
var $container = $( var $container = $(
'<li class="select2-selection__choice">' + '<li class="select2-selection__choice">' +
'<span class="select2-selection__choice__remove" role="presentation">' + '<span class="select2-selection__choice__remove" role="presentation" aria-hidden="true">' +
'&times;' + '&times;' +
'</span>' + '</span>' +
'</li>' '</li>'
@ -1645,6 +1724,24 @@ S2.define('select2/selection/multiple',[
return $container; return $container;
}; };
/**
* Focus on the search field instead of the main multiselect container.
*/
MultipleSelection.prototype.focusOnSearch = function() {
var self = this;
if ('undefined' !== typeof self.$search) {
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
setTimeout(function(){
// Prevent the dropdown opening again when focused from this.
// This gets reset automatically when focus is triggered.
self._keyUpPrevented = true;
self.$search.focus();
}, 1);
}
}
MultipleSelection.prototype.update = function (data) { MultipleSelection.prototype.update = function (data) {
this.clear(); this.clear();
@ -1658,9 +1755,14 @@ S2.define('select2/selection/multiple',[
var selection = data[d]; var selection = data[d];
var $selection = this.selectionContainer(); var $selection = this.selectionContainer();
var removeItemTag = $selection.html();
var formatted = this.display(selection, $selection); var formatted = this.display(selection, $selection);
if ('string' === typeof formatted) {
formatted = Utils.entityDecode(formatted.trim());
}
$selection.append(formatted); $selection.text(formatted);
$selection.prepend(removeItemTag);
$selection.prop('title', selection.title || selection.text); $selection.prop('title', selection.title || selection.text);
$selection.data('data', selection); $selection.data('data', selection);
@ -1699,7 +1801,7 @@ S2.define('select2/selection/placeholder',[
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
var $placeholder = this.selectionContainer(); var $placeholder = this.selectionContainer();
$placeholder.html(this.display(placeholder)); $placeholder.text(Utils.entityDecode(this.display(placeholder)));
$placeholder.addClass('select2-selection__placeholder') $placeholder.addClass('select2-selection__placeholder')
.removeClass('select2-selection__choice'); .removeClass('select2-selection__choice');
@ -1836,8 +1938,8 @@ S2.define('select2/selection/search',[
Search.prototype.render = function (decorated) { Search.prototype.render = function (decorated) {
var $search = $( var $search = $(
'<li class="select2-search select2-search--inline">' + '<li class="select2-search select2-search--inline">' +
'<input class="select2-search__field" type="search" tabindex="-1"' + '<input class="select2-search__field" type="text" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' + ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="textbox" aria-autocomplete="list" />' + ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
'</li>' '</li>'
); );
@ -1854,16 +1956,19 @@ S2.define('select2/selection/search',[
Search.prototype.bind = function (decorated, container, $container) { Search.prototype.bind = function (decorated, container, $container) {
var self = this; var self = this;
var resultsId = container.id + '-results';
decorated.call(this, container, $container); decorated.call(this, container, $container);
container.on('open', function () { container.on('open', function () {
self.$search.attr('aria-owns', resultsId);
self.$search.trigger('focus'); self.$search.trigger('focus');
}); });
container.on('close', function () { container.on('close', function () {
self.$search.val(''); self.$search.val('');
self.$search.removeAttr('aria-activedescendant'); self.$search.removeAttr('aria-activedescendant');
self.$search.removeAttr('aria-owns');
self.$search.trigger('focus'); self.$search.trigger('focus');
}); });
@ -1882,7 +1987,7 @@ S2.define('select2/selection/search',[
}); });
container.on('results:focus', function (params) { container.on('results:focus', function (params) {
self.$search.attr('aria-activedescendant', params.id); self.$search.attr('aria-activedescendant', params.data._resultId);
}); });
this.$selection.on('focusin', '.select2-search--inline', function (evt) { this.$selection.on('focusin', '.select2-search--inline', function (evt) {
@ -1913,6 +2018,9 @@ S2.define('select2/selection/search',[
evt.preventDefault(); evt.preventDefault();
} }
} else if (evt.which === KEYS.ENTER) {
container.open();
evt.preventDefault();
} }
}); });
@ -2001,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch(); this.resizeSearch();
if (searchHadFocus) { if (searchHadFocus) {
this.$search.focus(); this.$search.trigger( 'focus' );
} }
}; };
@ -3004,8 +3112,15 @@ S2.define('select2/data/base',[
}; };
BaseAdapter.prototype.generateResultId = function (container, data) { BaseAdapter.prototype.generateResultId = function (container, data) {
var id = container.id + '-result-'; var id = '';
if (container != null) {
id += container.id
} else {
id += Utils.generateChars(4);
}
id += '-result-';
id += Utils.generateChars(4); id += Utils.generateChars(4);
if (data.id != null) { if (data.id != null) {
@ -3191,7 +3306,7 @@ S2.define('select2/data/select',[
} }
} }
if (data.id) { if (data.id !== undefined) {
option.value = data.id; option.value = data.id;
} }
@ -3289,7 +3404,7 @@ S2.define('select2/data/select',[
item.text = item.text.toString(); item.text = item.text.toString();
} }
if (item._resultId == null && item.id && this.container != null) { if (item._resultId == null && item.id) {
item._resultId = this.generateResultId(this.container, item); item._resultId = this.generateResultId(this.container, item);
} }
@ -3432,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) { if (this._request != null) {
// JSONP requests cannot always be aborted // JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) { if ( typeof this._request.abort === 'function' ) {
this._request.abort(); this._request.abort();
} }
@ -3457,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) { if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key. // Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) { if (!results || !results.results || ! Array.isArray( results.results ) ) {
console.error( console.error(
'Select2: The AJAX results did not return an array in the ' + 'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.' '`results` key of the response.'
@ -3466,6 +3581,7 @@ S2.define('select2/data/ajax',[
} }
callback(results); callback(results);
self.container.focusOnActiveElement();
}, function () { }, function () {
// Attempt to detect if a request was aborted // Attempt to detect if a request was aborted
// Only works if the transport exposes a status property // Only works if the transport exposes a status property
@ -3515,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options); decorated.call(this, $element, options);
if ($.isArray(tags)) { if ( Array.isArray( tags ) ) {
for (var t = 0; t < tags.length; t++) { for (var t = 0; t < tags.length; t++) {
var tag = tags[t]; var tag = tags[t];
var item = this._normalizeItem(tag); var item = this._normalizeItem(tag);
@ -3550,7 +3666,10 @@ S2.define('select2/data/tags',[
}, true) }, true)
); );
var checkText = option.text === params.term; var optionText = (option.text || '').toUpperCase();
var paramsTerm = (params.term || '').toUpperCase();
var checkText = optionText === paramsTerm;
if (checkText || checkChildren) { if (checkText || checkChildren) {
if (child) { if (child) {
@ -3588,7 +3707,7 @@ S2.define('select2/data/tags',[
}; };
Tags.prototype.createTag = function (decorated, params) { Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term); var term = params.term.trim();
if (term === '') { if (term === '') {
return null; return null;
@ -3681,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box // Replace the search term if we have the search box
if (this.$search.length) { if (this.$search.length) {
this.$search.val(tokenData.term); this.$search.val(tokenData.term);
this.$search.focus(); this.$search.trigger( 'focus' );
} }
params.term = tokenData.term; params.term = tokenData.term;
@ -3887,9 +4006,9 @@ S2.define('select2/dropdown/search',[
var $search = $( var $search = $(
'<span class="select2-search select2-search--dropdown">' + '<span class="select2-search select2-search--dropdown">' +
'<input class="select2-search__field" type="search" tabindex="-1"' + '<input class="select2-search__field" type="text" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' + ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="textbox" />' + ' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />' +
'</span>' '</span>'
); );
@ -3903,6 +4022,7 @@ S2.define('select2/dropdown/search',[
Search.prototype.bind = function (decorated, container, $container) { Search.prototype.bind = function (decorated, container, $container) {
var self = this; var self = this;
var resultsId = container.id + '-results';
decorated.call(this, container, $container); decorated.call(this, container, $container);
@ -3926,23 +4046,24 @@ S2.define('select2/dropdown/search',[
container.on('open', function () { container.on('open', function () {
self.$search.attr('tabindex', 0); self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId);
self.$search.focus(); self.$search.trigger( 'focus' );
window.setTimeout(function () { window.setTimeout(function () {
self.$search.focus(); self.$search.trigger( 'focus' );
}, 0); }, 0);
}); });
container.on('close', function () { container.on('close', function () {
self.$search.attr('tabindex', -1); self.$search.attr('tabindex', -1);
self.$search.removeAttr('aria-activedescendant');
self.$search.removeAttr('aria-owns');
self.$search.val(''); self.$search.val('');
}); });
container.on('focus', function () { container.on('focus', function () {
if (container.isOpen()) { if (!container.isOpen()) {
self.$search.focus(); self.$search.trigger( 'focus' );
} }
}); });
@ -3957,6 +4078,10 @@ S2.define('select2/dropdown/search',[
} }
} }
}); });
container.on('results:focus', function (params) {
self.$search.attr('aria-activedescendant', params.data._resultId);
});
}; };
Search.prototype.handleSearch = function (evt) { Search.prototype.handleSearch = function (evt) {
@ -4098,7 +4223,7 @@ S2.define('select2/dropdown/infiniteScroll',[
var $option = $( var $option = $(
'<li ' + '<li ' +
'class="select2-results__option select2-results__option--load-more"' + 'class="select2-results__option select2-results__option--load-more"' +
'role="treeitem" aria-disabled="true"></li>' 'role="option" aria-disabled="true"></li>'
); );
var message = this.options.get('translations').get('loadingMore'); var message = this.options.get('translations').get('loadingMore');
@ -4753,7 +4878,7 @@ S2.define('select2/defaults',[
} }
} }
if ($.isArray(options.language)) { if ( Array.isArray( options.language ) ) {
var languages = new Translation(); var languages = new Translation();
options.language.push('en'); options.language.push('en');
@ -4816,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) { function matcher (params, data) {
// Always return the object if there is nothing to compare // Always return the object if there is nothing to compare
if ($.trim(params.term) === '') { if ( params.term.trim() === '' ) {
return data; return data;
} }
@ -5344,16 +5469,22 @@ S2.define('select2/core',[
}); });
}); });
this.on('keypress', function (evt) { this.on('open', function(){
var key = evt.which; // Focus on the active element when opening dropdown.
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
setTimeout(function(){
self.focusOnActiveElement();
}, 1);
});
$(document).on('keydown', function (evt) {
var key = evt.which;
if (self.isOpen()) { if (self.isOpen()) {
if (key === KEYS.ESC || key === KEYS.TAB || if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {
(key === KEYS.UP && evt.altKey)) {
self.close(); self.close();
evt.preventDefault(); evt.preventDefault();
} else if (key === KEYS.ENTER) { } else if (key === KEYS.ENTER || key === KEYS.TAB) {
self.trigger('results:select', {}); self.trigger('results:select', {});
evt.preventDefault(); evt.preventDefault();
@ -5370,17 +5501,42 @@ S2.define('select2/core',[
evt.preventDefault(); evt.preventDefault();
} }
} else {
if (key === KEYS.ENTER || key === KEYS.SPACE ||
(key === KEYS.DOWN && evt.altKey)) {
self.open();
var $searchField = self.$dropdown.find('.select2-search__field');
if (! $searchField.length) {
$searchField = self.$container.find('.select2-search__field');
}
// Move the focus to the selected element on keyboard navigation.
// Required for screen readers to work properly.
if (key === KEYS.DOWN || key === KEYS.UP) {
self.focusOnActiveElement();
} else {
// Focus on the search if user starts typing.
$searchField.focus();
// Focus back to active selection when finished typing.
// Small delay so typed character can be read by screen reader.
setTimeout(function(){
self.focusOnActiveElement();
}, 1000);
}
} else if (self.hasFocus()) {
if (key === KEYS.ENTER || key === KEYS.SPACE ||
key === KEYS.DOWN) {
self.open();
evt.preventDefault(); evt.preventDefault();
} }
} }
}); });
}; };
Select2.prototype.focusOnActiveElement = function () {
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (this.isOpen() && ! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus();
}
};
Select2.prototype._syncAttributes = function () { Select2.prototype._syncAttributes = function () {
this.options.set('disabled', this.$element.prop('disabled')); this.options.set('disabled', this.$element.prop('disabled'));
@ -5568,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0]; var newVal = args[0];
if ($.isArray(newVal)) { if ( Array.isArray( newVal ) ) {
newVal = $.map(newVal, function (obj) { newVal = $.map(newVal, function (obj) {
return obj.toString(); return obj.toString();
}); });
@ -5653,11 +5809,11 @@ S2.define('jquery.select2',[
'./select2/core', './select2/core',
'./select2/defaults' './select2/defaults'
], function ($, _, Select2, Defaults) { ], function ($, _, Select2, Defaults) {
if ($.fn.select2 == null) { if ($.fn.selectWoo == null) {
// All methods that should return the element // All methods that should return the element
var thisMethods = ['open', 'close', 'destroy']; var thisMethods = ['open', 'close', 'destroy'];
$.fn.select2 = function (options) { $.fn.selectWoo = function (options) {
options = options || {}; options = options || {};
if (typeof options === 'object') { if (typeof options === 'object') {
@ -5697,10 +5853,17 @@ S2.define('jquery.select2',[
}; };
} }
if ($.fn.select2.defaults == null) { if ($.fn.select2 != null && $.fn.select2.defaults != null) {
$.fn.select2.defaults = Defaults; $.fn.selectWoo.defaults = $.fn.select2.defaults;
} }
if ($.fn.selectWoo.defaults == null) {
$.fn.selectWoo.defaults = Defaults;
}
// Also register selectWoo under select2 if select2 is not already present.
$.fn.select2 = $.fn.select2 || $.fn.selectWoo;
return Select2; return Select2;
}); });
@ -5719,6 +5882,7 @@ S2.define('jquery.select2',[
// This allows Select2 to use the internal loader outside of this file, such // This allows Select2 to use the internal loader outside of this file, such
// as in the language files. // as in the language files.
jQuery.fn.select2.amd = S2; jQuery.fn.select2.amd = S2;
jQuery.fn.selectWoo.amd = S2;
// Return the Select2 instance for anyone who is importing it. // Return the Select2 instance for anyone who is importing it.
return select2; return select2;

View File

@ -1,5 +1,5 @@
/*! /*!
* SelectWoo 1.0.6 * SelectWoo 1.0.9
* https://github.com/woocommerce/selectWoo * https://github.com/woocommerce/selectWoo
* *
* Released under the MIT license * Released under the MIT license
@ -755,8 +755,8 @@ S2.define('select2/utils',[
}); });
}; };
Utils.entityDecode = function(html) { Utils.entityDecode = function (html) {
var txt = document.createElement("textarea"); var txt = document.createElement('textarea');
txt.innerHTML = html; txt.innerHTML = html;
return txt.value; return txt.value;
} }
@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the // This needs to be delayed as the active element is the body when the
// key is pressed. // key is pressed.
window.setTimeout(function () { window.setTimeout(function () {
self.$selection.focus(); self.$selection.trigger( 'focus' );
}, 1); }, 1);
self._detachCloseHandler(container); self._detachCloseHandler(container);
@ -1486,8 +1486,8 @@ S2.define('select2/selection/base',[
// Remove any focus when dropdown is closed by clicking outside the select area. // Remove any focus when dropdown is closed by clicking outside the select area.
// Timeout of 1 required for close to finish wrapping up. // Timeout of 1 required for close to finish wrapping up.
setTimeout(function(){ setTimeout(function(){
$this.find('*:focus').blur(); $this.find('*:focus').trigger( 'blur' );
$target.focus(); $target.trigger( 'focus' );
}, 1); }, 1);
}); });
}); });
@ -1551,7 +1551,14 @@ S2.define('select2/selection/single',[
.attr('id', id) .attr('id', id)
.attr('role', 'textbox') .attr('role', 'textbox')
.attr('aria-readonly', 'true'); .attr('aria-readonly', 'true');
this.$selection.attr('aria-labelledby', id);
var label = this.options.get( 'label' );
if ( typeof( label ) === 'string' ) {
this.$selection.attr( 'aria-label', label );
} else {
this.$selection.attr( 'aria-labelledby', id );
}
// This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove. // This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
this.$selection.attr('role', 'combobox'); this.$selection.attr('role', 'combobox');
@ -1584,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) { container.on('focus', function (evt) {
if (!container.isOpen()) { if (!container.isOpen()) {
self.$selection.focus(); self.$selection.trigger( 'focus' );
} }
}); });
@ -1730,7 +1737,7 @@ S2.define('select2/selection/multiple',[
// This gets reset automatically when focus is triggered. // This gets reset automatically when focus is triggered.
self._keyUpPrevented = true; self._keyUpPrevented = true;
self.$search.focus(); self.$search.trigger( 'focus' );
}, 1); }, 1);
} }
} }
@ -2102,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch(); this.resizeSearch();
if (searchHadFocus) { if (searchHadFocus) {
this.$search.focus(); this.$search.trigger( 'focus' );
} }
}; };
@ -3540,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) { if (this._request != null) {
// JSONP requests cannot always be aborted // JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) { if ('function' === typeof this._request.abort) {
this._request.abort(); this._request.abort();
} }
@ -3565,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) { if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key. // Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) { if (!results || !results.results || !Array.isArray(results.results)) {
console.error( console.error(
'Select2: The AJAX results did not return an array in the ' + 'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.' '`results` key of the response.'
@ -3624,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options); decorated.call(this, $element, options);
if ($.isArray(tags)) { if (Array.isArray(tags)) {
for (var t = 0; t < tags.length; t++) { for (var t = 0; t < tags.length; t++) {
var tag = tags[t]; var tag = tags[t];
var item = this._normalizeItem(tag); var item = this._normalizeItem(tag);
@ -3700,7 +3707,7 @@ S2.define('select2/data/tags',[
}; };
Tags.prototype.createTag = function (decorated, params) { Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term); var term = 'string' === typeof params.term ? params.term.trim() : '';
if (term === '') { if (term === '') {
return null; return null;
@ -3793,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box // Replace the search term if we have the search box
if (this.$search.length) { if (this.$search.length) {
this.$search.val(tokenData.term); this.$search.val(tokenData.term);
this.$search.focus(); this.$search.trigger( 'focus' );
} }
params.term = tokenData.term; params.term = tokenData.term;
@ -4040,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () { container.on('open', function () {
self.$search.attr('tabindex', 0); self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId); self.$search.attr('aria-owns', resultsId);
self.$search.focus(); self.$search.trigger( 'focus' );
window.setTimeout(function () { window.setTimeout(function () {
self.$search.focus(); self.$search.trigger( 'focus' );
}, 0); }, 0);
}); });
@ -4056,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () { container.on('focus', function () {
if (!container.isOpen()) { if (!container.isOpen()) {
self.$search.focus(); self.$search.trigger( 'focus' );
} }
}); });
@ -4398,6 +4405,7 @@ S2.define('select2/dropdown/attachBody',[
var parentOffset = $offsetParent.offset(); var parentOffset = $offsetParent.offset();
css.top -= parentOffset.top;
css.left -= parentOffset.left; css.left -= parentOffset.left;
if (!isCurrentlyAbove && !isCurrentlyBelow) { if (!isCurrentlyAbove && !isCurrentlyBelow) {
@ -4412,7 +4420,7 @@ S2.define('select2/dropdown/attachBody',[
if (newDirection == 'above' || if (newDirection == 'above' ||
(isCurrentlyAbove && newDirection !== 'below')) { (isCurrentlyAbove && newDirection !== 'below')) {
css.top = container.top - dropdown.height; css.top = container.top - parentOffset.top - dropdown.height;
} }
if (newDirection != null) { if (newDirection != null) {
@ -4870,7 +4878,7 @@ S2.define('select2/defaults',[
} }
} }
if ($.isArray(options.language)) { if (Array.isArray(options.language)) {
var languages = new Translation(); var languages = new Translation();
options.language.push('en'); options.language.push('en');
@ -4933,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) { function matcher (params, data) {
// Always return the object if there is nothing to compare // Always return the object if there is nothing to compare
if ($.trim(params.term) === '') { if ( 'undefined' === typeof params.term || ( 'string' === typeof params.term && '' === params.term.trim() ) ) {
return data; return data;
} }
@ -5505,7 +5513,7 @@ S2.define('select2/core',[
self.focusOnActiveElement(); self.focusOnActiveElement();
} else { } else {
// Focus on the search if user starts typing. // Focus on the search if user starts typing.
$searchField.focus(); $searchField.trigger( 'focus' );
// Focus back to active selection when finished typing. // Focus back to active selection when finished typing.
// Small delay so typed character can be read by screen reader. // Small delay so typed character can be read by screen reader.
setTimeout(function(){ setTimeout(function(){
@ -5525,7 +5533,7 @@ S2.define('select2/core',[
Select2.prototype.focusOnActiveElement = function () { Select2.prototype.focusOnActiveElement = function () {
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards. // Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (this.isOpen() && ! Utils.isTouchscreen()) { if (this.isOpen() && ! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus(); this.$results.find('li.select2-results__option--highlighted').trigger( 'focus' );
} }
}; };
@ -5716,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0]; var newVal = args[0];
if ($.isArray(newVal)) { if (Array.isArray(newVal)) {
newVal = $.map(newVal, function (obj) { newVal = $.map(newVal, function (obj) {
return obj.toString(); return obj.toString();
}); });
@ -5793,7 +5801,7 @@ S2.define('select2/compat/utils',[
function syncCssClasses ($dest, $src, adapter) { function syncCssClasses ($dest, $src, adapter) {
var classes, replacements = [], adapted; var classes, replacements = [], adapted;
classes = $.trim($dest.attr('class')); classes = 'string' === typeof $dest.attr('class') ? $dest.attr('class').trim() : '';
if (classes) { if (classes) {
classes = '' + classes; // for IE which returns object classes = '' + classes; // for IE which returns object
@ -5806,7 +5814,7 @@ S2.define('select2/compat/utils',[
}); });
} }
classes = $.trim($src.attr('class')); classes = 'string' === typeof $src.attr('class') ? $src.attr('class').trim() : '';
if (classes) { if (classes) {
classes = '' + classes; // for IE which returns object classes = '' + classes; // for IE which returns object
@ -5847,7 +5855,7 @@ S2.define('select2/compat/containerCss',[
var containerCssClass = this.options.get('containerCssClass') || ''; var containerCssClass = this.options.get('containerCssClass') || '';
if ($.isFunction(containerCssClass)) { if ('function' === typeof containerCssClass) {
containerCssClass = containerCssClass(this.$element); containerCssClass = containerCssClass(this.$element);
} }
@ -5873,7 +5881,7 @@ S2.define('select2/compat/containerCss',[
var containerCss = this.options.get('containerCss') || {}; var containerCss = this.options.get('containerCss') || {};
if ($.isFunction(containerCss)) { if ('function' === typeof containerCss) {
containerCss = containerCss(this.$element); containerCss = containerCss(this.$element);
} }
@ -5904,7 +5912,7 @@ S2.define('select2/compat/dropdownCss',[
var dropdownCssClass = this.options.get('dropdownCssClass') || ''; var dropdownCssClass = this.options.get('dropdownCssClass') || '';
if ($.isFunction(dropdownCssClass)) { if ('function' === typeof dropdownCssClass) {
dropdownCssClass = dropdownCssClass(this.$element); dropdownCssClass = dropdownCssClass(this.$element);
} }
@ -5930,7 +5938,7 @@ S2.define('select2/compat/dropdownCss',[
var dropdownCss = this.options.get('dropdownCss') || {}; var dropdownCss = this.options.get('dropdownCss') || {};
if ($.isFunction(dropdownCss)) { if ('function' === typeof dropdownCss) {
dropdownCss = dropdownCss(this.$element); dropdownCss = dropdownCss(this.$element);
} }
@ -5977,7 +5985,7 @@ S2.define('select2/compat/initSelection',[
this.initSelection.call(null, this.$element, function (data) { this.initSelection.call(null, this.$element, function (data) {
self._isInitialized = true; self._isInitialized = true;
if (!$.isArray(data)) { if (!Array.isArray(data)) {
data = [data]; data = [data];
} }
@ -6123,7 +6131,7 @@ S2.define('select2/compat/matcher',[
function wrappedMatcher (params, data) { function wrappedMatcher (params, data) {
var match = $.extend(true, {}, data); var match = $.extend(true, {}, data);
if (params.term == null || $.trim(params.term) === '') { if ( params.term == null || ( 'string' === typeof params.term && '' === params.term.trim() ) ) {
return match; return match;
} }
@ -6366,11 +6374,11 @@ S2.define('select2/selection/stopPropagation',[
$.fn.extend({ $.fn.extend({
mousewheel: function(fn) { mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); return fn ? this.on('mousewheel', fn) : this.trigger('mousewheel');
}, },
unmousewheel: function(fn) { unmousewheel: function(fn) {
return this.unbind('mousewheel', fn); return this.off('mousewheel', fn);
} }
}); });

View File

@ -1,5 +1,5 @@
/*! /*!
* SelectWoo 1.0.6 * SelectWoo 1.0.9
* https://github.com/woocommerce/selectWoo * https://github.com/woocommerce/selectWoo
* *
* Released under the MIT license * Released under the MIT license
@ -755,8 +755,8 @@ S2.define('select2/utils',[
}); });
}; };
Utils.entityDecode = function(html) { Utils.entityDecode = function (html) {
var txt = document.createElement("textarea"); var txt = document.createElement('textarea');
txt.innerHTML = html; txt.innerHTML = html;
return txt.value; return txt.value;
} }
@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the // This needs to be delayed as the active element is the body when the
// key is pressed. // key is pressed.
window.setTimeout(function () { window.setTimeout(function () {
self.$selection.focus(); self.$selection.trigger( 'focus' );
}, 1); }, 1);
self._detachCloseHandler(container); self._detachCloseHandler(container);
@ -1486,8 +1486,8 @@ S2.define('select2/selection/base',[
// Remove any focus when dropdown is closed by clicking outside the select area. // Remove any focus when dropdown is closed by clicking outside the select area.
// Timeout of 1 required for close to finish wrapping up. // Timeout of 1 required for close to finish wrapping up.
setTimeout(function(){ setTimeout(function(){
$this.find('*:focus').blur(); $this.find('*:focus').trigger( 'blur' );
$target.focus(); $target.trigger( 'focus' );
}, 1); }, 1);
}); });
}); });
@ -1551,7 +1551,14 @@ S2.define('select2/selection/single',[
.attr('id', id) .attr('id', id)
.attr('role', 'textbox') .attr('role', 'textbox')
.attr('aria-readonly', 'true'); .attr('aria-readonly', 'true');
this.$selection.attr('aria-labelledby', id);
var label = this.options.get( 'label' );
if ( typeof( label ) === 'string' ) {
this.$selection.attr( 'aria-label', label );
} else {
this.$selection.attr( 'aria-labelledby', id );
}
// This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove. // This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
this.$selection.attr('role', 'combobox'); this.$selection.attr('role', 'combobox');
@ -1584,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) { container.on('focus', function (evt) {
if (!container.isOpen()) { if (!container.isOpen()) {
self.$selection.focus(); self.$selection.trigger( 'focus' );
} }
}); });
@ -1730,7 +1737,7 @@ S2.define('select2/selection/multiple',[
// This gets reset automatically when focus is triggered. // This gets reset automatically when focus is triggered.
self._keyUpPrevented = true; self._keyUpPrevented = true;
self.$search.focus(); self.$search.trigger( 'focus' );
}, 1); }, 1);
} }
} }
@ -2102,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch(); this.resizeSearch();
if (searchHadFocus) { if (searchHadFocus) {
this.$search.focus(); this.$search.trigger( 'focus' );
} }
}; };
@ -3540,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) { if (this._request != null) {
// JSONP requests cannot always be aborted // JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) { if ( typeof this._request.abort === 'function' ) {
this._request.abort(); this._request.abort();
} }
@ -3565,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) { if (self.options.get('debug') && window.console && console.error) {
// Check to make sure that the response included a `results` key. // Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) { if (!results || !results.results || ! Array.isArray( results.results ) ) {
console.error( console.error(
'Select2: The AJAX results did not return an array in the ' + 'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.' '`results` key of the response.'
@ -3624,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options); decorated.call(this, $element, options);
if ($.isArray(tags)) { if ( Array.isArray( tags ) ) {
for (var t = 0; t < tags.length; t++) { for (var t = 0; t < tags.length; t++) {
var tag = tags[t]; var tag = tags[t];
var item = this._normalizeItem(tag); var item = this._normalizeItem(tag);
@ -3700,7 +3707,7 @@ S2.define('select2/data/tags',[
}; };
Tags.prototype.createTag = function (decorated, params) { Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term); var term = params.term.trim();
if (term === '') { if (term === '') {
return null; return null;
@ -3793,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box // Replace the search term if we have the search box
if (this.$search.length) { if (this.$search.length) {
this.$search.val(tokenData.term); this.$search.val(tokenData.term);
this.$search.focus(); this.$search.trigger( 'focus' );
} }
params.term = tokenData.term; params.term = tokenData.term;
@ -4040,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () { container.on('open', function () {
self.$search.attr('tabindex', 0); self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId); self.$search.attr('aria-owns', resultsId);
self.$search.focus(); self.$search.trigger( 'focus' );
window.setTimeout(function () { window.setTimeout(function () {
self.$search.focus(); self.$search.trigger( 'focus' );
}, 0); }, 0);
}); });
@ -4056,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () { container.on('focus', function () {
if (!container.isOpen()) { if (!container.isOpen()) {
self.$search.focus(); self.$search.trigger( 'focus' );
} }
}); });
@ -4871,7 +4878,7 @@ S2.define('select2/defaults',[
} }
} }
if ($.isArray(options.language)) { if ( Array.isArray( options.language ) ) {
var languages = new Translation(); var languages = new Translation();
options.language.push('en'); options.language.push('en');
@ -4934,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) { function matcher (params, data) {
// Always return the object if there is nothing to compare // Always return the object if there is nothing to compare
if ($.trim(params.term) === '') { if ( params.term.trim() === '' ) {
return data; return data;
} }
@ -5506,7 +5513,7 @@ S2.define('select2/core',[
self.focusOnActiveElement(); self.focusOnActiveElement();
} else { } else {
// Focus on the search if user starts typing. // Focus on the search if user starts typing.
$searchField.focus(); $searchField.trigger( 'focus' );
// Focus back to active selection when finished typing. // Focus back to active selection when finished typing.
// Small delay so typed character can be read by screen reader. // Small delay so typed character can be read by screen reader.
setTimeout(function(){ setTimeout(function(){
@ -5526,7 +5533,7 @@ S2.define('select2/core',[
Select2.prototype.focusOnActiveElement = function () { Select2.prototype.focusOnActiveElement = function () {
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards. // Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (this.isOpen() && ! Utils.isTouchscreen()) { if (this.isOpen() && ! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus(); this.$results.find('li.select2-results__option--highlighted').trigger( 'focus' );
} }
}; };
@ -5717,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0]; var newVal = args[0];
if ($.isArray(newVal)) { if ( Array.isArray( newVal ) ) {
newVal = $.map(newVal, function (obj) { newVal = $.map(newVal, function (obj) {
return obj.toString(); return obj.toString();
}); });

View File

@ -32,9 +32,9 @@
th_index = th_index - 1; th_index = th_index - 1;
// Determine (and/or reverse) sorting direction, default `asc` // Determine (and/or reverse) sorting direction, default `asc`
var sort_dir = $this.data("sort-default") || dir.ASC; var sort_dir = $this.data("sortDefault") || dir.ASC;
if ($this.data("sort-dir")) if ($this.data("sortDir"))
sort_dir = $this.data("sort-dir") === dir.ASC ? dir.DESC : dir.ASC; sort_dir = $this.data("sortDir") === dir.ASC ? dir.DESC : dir.ASC;
// Choose appropriate sorting function. // Choose appropriate sorting function.
var type = $this.data("sort") || null; var type = $this.data("sort") || null;
@ -65,7 +65,7 @@
// with the TR itself into a tuple // with the TR itself into a tuple
trs.each(function(index,tr) { trs.each(function(index,tr) {
var $e = $(tr).children().eq(th_index); var $e = $(tr).children().eq(th_index);
var sort_val = $e.data("sort-value"); var sort_val = $e.data("sortValue");
var order_by = typeof(sort_val) !== "undefined" ? sort_val : $e.text(); var order_by = typeof(sort_val) !== "undefined" ? sort_val : $e.text();
column.push([order_by, tr]); column.push([order_by, tr]);
}); });
@ -83,8 +83,8 @@
}); });
// Reset siblings // Reset siblings
$table.find("th").data("sort-dir", null).removeClass("sorting-desc sorting-asc"); $table.find("th").data("sortDir", null).removeClass("sorting-desc sorting-asc");
$this.data("sort-dir", sort_dir).addClass("sorting-"+sort_dir); $this.data("sortDir", sort_dir).addClass("sorting-"+sort_dir);
// Trigger `aftertablesort` event. Similar to `beforetablesort` // Trigger `aftertablesort` event. Similar to `beforetablesort`
$table.trigger("aftertablesort", {column: $this.index(), direction: sort_dir}); $table.trigger("aftertablesort", {column: $this.index(), direction: sort_dir});

View File

@ -125,12 +125,12 @@
// Skip the fade-in for IE8 and lower since it chokes on fading-in // Skip the fade-in for IE8 and lower since it chokes on fading-in
// and changing position based on mousemovement at the same time. // and changing position based on mousemovement at the same time.
$img.stop() $img.stop()
.fadeTo($.support.opacity ? settings.duration : 0, 1, $.isFunction(settings.onZoomIn) ? settings.onZoomIn.call(img) : false); .fadeTo($.support.opacity ? settings.duration : 0, 1, 'function' === typeof settings.onZoomIn ? settings.onZoomIn.call(img) : false);
} }
function stop() { function stop() {
$img.stop() $img.stop()
.fadeTo(settings.duration, 0, $.isFunction(settings.onZoomOut) ? settings.onZoomOut.call(img) : false); .fadeTo(settings.duration, 0, 'function' === typeof settings.onZoomOut ? settings.onZoomOut.call(img) : false);
} }
// Mouse events // Mouse events
@ -222,7 +222,7 @@
}); });
} }
if ($.isFunction(settings.callback)) { if ('function' === typeof settings.callback) {
settings.callback.call(img); settings.callback.call(img);
} }
}; };

View File

@ -33,6 +33,7 @@
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.4" "vimeo/psalm": "^4.4"
}, },
"default-branch": true,
"bin": [ "bin": [
"bin/mozart" "bin/mozart"
], ],
@ -53,6 +54,10 @@
} }
], ],
"description": "Composes all dependencies as a package inside a WordPress plugin", "description": "Composes all dependencies as a package inside a WordPress plugin",
"support": {
"issues": "https://github.com/coenjacobs/mozart/issues",
"source": "https://github.com/coenjacobs/mozart/tree/master"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/coenjacobs", "url": "https://github.com/coenjacobs",
@ -144,6 +149,10 @@
"sftp", "sftp",
"storage" "storage"
], ],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/1.x"
},
"funding": [ "funding": [
{ {
"url": "https://offset.earth/frankdejonge", "url": "https://offset.earth/frankdejonge",
@ -192,6 +201,10 @@
} }
], ],
"description": "Mime-type detection for Flysystem", "description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/frankdejonge", "url": "https://github.com/frankdejonge",
@ -246,20 +259,24 @@
"container-interop", "container-interop",
"psr" "psr"
], ],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1"
},
"time": "2021-03-05T17:36:06+00:00" "time": "2021-03-05T17:36:06+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.2.4", "version": "v5.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "d6d0cc30d8c0fda4e7b213c20509b0159a8f4556" "reference": "864568fdc0208b3eba3638b6000b69d2386e6768"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/d6d0cc30d8c0fda4e7b213c20509b0159a8f4556", "url": "https://api.github.com/repos/symfony/console/zipball/864568fdc0208b3eba3638b6000b69d2386e6768",
"reference": "d6d0cc30d8c0fda4e7b213c20509b0159a8f4556", "reference": "864568fdc0208b3eba3638b6000b69d2386e6768",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -326,6 +343,9 @@
"console", "console",
"terminal" "terminal"
], ],
"support": {
"source": "https://github.com/symfony/console/tree/v5.2.8"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -340,20 +360,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-23T10:08:49+00:00" "time": "2021-05-11T15:45:21+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v5.2.4", "version": "v5.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "0d639a0943822626290d169965804f79400e6a04" "reference": "eccb8be70d7a6a2230d05f6ecede40f3fdd9e252"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/0d639a0943822626290d169965804f79400e6a04", "url": "https://api.github.com/repos/symfony/finder/zipball/eccb8be70d7a6a2230d05f6ecede40f3fdd9e252",
"reference": "0d639a0943822626290d169965804f79400e6a04", "reference": "eccb8be70d7a6a2230d05f6ecede40f3fdd9e252",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -384,6 +404,9 @@
], ],
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v5.2.8"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -398,7 +421,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-15T18:55:04+00:00" "time": "2021-05-10T14:39:23+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@ -460,6 +483,9 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -538,6 +564,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -619,6 +648,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -696,6 +728,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -772,6 +807,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -852,6 +890,9 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -870,21 +911,21 @@
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
"version": "v2.2.0", "version": "v2.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/service-contracts.git", "url": "https://github.com/symfony/service-contracts.git",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"psr/container": "^1.0" "psr/container": "^1.1"
}, },
"suggest": { "suggest": {
"symfony/service-implementation": "" "symfony/service-implementation": ""
@ -892,7 +933,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.2-dev" "dev-main": "2.4-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/contracts", "name": "symfony/contracts",
@ -928,6 +969,9 @@
"interoperability", "interoperability",
"standards" "standards"
], ],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -942,20 +986,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-09-07T11:33:47+00:00" "time": "2021-04-01T10:43:52+00:00"
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.2.4", "version": "v5.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "4e78d7d47061fa183639927ec40d607973699609" "reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/4e78d7d47061fa183639927ec40d607973699609", "url": "https://api.github.com/repos/symfony/string/zipball/01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db",
"reference": "4e78d7d47061fa183639927ec40d607973699609", "reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1008,6 +1052,9 @@
"utf-8", "utf-8",
"utf8" "utf8"
], ],
"support": {
"source": "https://github.com/symfony/string/tree/v5.2.8"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -1022,7 +1069,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-16T10:20:28+00:00" "time": "2021-05-10T14:56:10+00:00"
} }
], ],
"aliases": [], "aliases": [],
@ -1037,5 +1084,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.3" "php": "7.3"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -71,6 +71,10 @@
"stylecheck", "stylecheck",
"tests" "tests"
], ],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2020-06-25T14:57:39+00:00" "time": "2020-06-25T14:57:39+00:00"
}, },
{ {
@ -129,6 +133,10 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
"time": "2019-12-27T09:44:58+00:00" "time": "2019-12-27T09:44:58+00:00"
}, },
{ {
@ -181,6 +189,10 @@
"polyfill", "polyfill",
"standards" "standards"
], ],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
},
"time": "2021-02-15T10:24:51+00:00" "time": "2021-02-15T10:24:51+00:00"
}, },
{ {
@ -231,20 +243,24 @@
"standards", "standards",
"wordpress" "wordpress"
], ],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
},
"time": "2019-08-28T14:22:28+00:00" "time": "2019-08-28T14:22:28+00:00"
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.5.8", "version": "3.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4" "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4", "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -282,7 +298,12 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2020-10-23T02:01:07+00:00" "support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2021-04-09T00:54:41+00:00"
}, },
{ {
"name": "woocommerce/woocommerce-sniffs", "name": "woocommerce/woocommerce-sniffs",
@ -322,6 +343,10 @@
"woocommerce", "woocommerce",
"wordpress" "wordpress"
], ],
"support": {
"issues": "https://github.com/woocommerce/woocommerce-sniffs/issues",
"source": "https://github.com/woocommerce/woocommerce-sniffs/tree/master"
},
"time": "2020-08-06T18:23:45+00:00" "time": "2020-08-06T18:23:45+00:00"
}, },
{ {
@ -368,6 +393,11 @@
"standards", "standards",
"wordpress" "wordpress"
], ],
"support": {
"issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
"source": "https://github.com/WordPress/WordPress-Coding-Standards",
"wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
},
"time": "2020-05-13T23:57:56+00:00" "time": "2020-05-13T23:57:56+00:00"
} }
], ],
@ -381,5 +411,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -59,6 +59,10 @@
"constructor", "constructor",
"instantiate" "instantiate"
], ],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/master"
},
"time": "2015-06-14T21:17:01+00:00" "time": "2015-06-14T21:17:01+00:00"
}, },
{ {
@ -104,6 +108,10 @@
"object", "object",
"object graph" "object graph"
], ],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.x"
},
"time": "2017-10-19T19:58:43+00:00" "time": "2017-10-19T19:58:43+00:00"
}, },
{ {
@ -159,6 +167,10 @@
} }
], ],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/master"
},
"time": "2017-03-05T18:14:27+00:00" "time": "2017-03-05T18:14:27+00:00"
}, },
{ {
@ -206,6 +218,10 @@
} }
], ],
"description": "Library for handling version information and constraints", "description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/master"
},
"time": "2017-03-05T17:38:23+00:00" "time": "2017-03-05T17:38:23+00:00"
}, },
{ {
@ -260,6 +276,10 @@
"reflection", "reflection",
"static analysis" "static analysis"
], ],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master"
},
"time": "2017-09-11T18:02:19+00:00" "time": "2017-09-11T18:02:19+00:00"
}, },
{ {
@ -312,6 +332,10 @@
} }
], ],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x"
},
"time": "2019-12-28T18:55:12+00:00" "time": "2019-12-28T18:55:12+00:00"
}, },
{ {
@ -357,6 +381,10 @@
"email": "me@mikevanriel.com" "email": "me@mikevanriel.com"
} }
], ],
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/master"
},
"time": "2017-12-30T13:23:38+00:00" "time": "2017-12-30T13:23:38+00:00"
}, },
{ {
@ -420,6 +448,10 @@
"spy", "spy",
"stub" "stub"
], ],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
},
"time": "2020-03-05T15:02:03+00:00" "time": "2020-03-05T15:02:03+00:00"
}, },
{ {
@ -483,6 +515,10 @@
"testing", "testing",
"xunit" "xunit"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/5.3"
},
"time": "2018-04-06T15:36:58+00:00" "time": "2018-04-06T15:36:58+00:00"
}, },
{ {
@ -530,6 +566,11 @@
"filesystem", "filesystem",
"iterator" "iterator"
], ],
"support": {
"irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5"
},
"time": "2017-11-27T13:52:08+00:00" "time": "2017-11-27T13:52:08+00:00"
}, },
{ {
@ -571,6 +612,10 @@
"keywords": [ "keywords": [
"template" "template"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
},
"time": "2015-06-21T13:50:34+00:00" "time": "2015-06-21T13:50:34+00:00"
}, },
{ {
@ -620,6 +665,10 @@
"keywords": [ "keywords": [
"timer" "timer"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
"source": "https://github.com/sebastianbergmann/php-timer/tree/master"
},
"time": "2017-02-26T11:10:40+00:00" "time": "2017-02-26T11:10:40+00:00"
}, },
{ {
@ -669,6 +718,10 @@
"keywords": [ "keywords": [
"tokenizer" "tokenizer"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
},
"abandoned": true, "abandoned": true,
"time": "2017-11-27T05:48:46+00:00" "time": "2017-11-27T05:48:46+00:00"
}, },
@ -754,6 +807,10 @@
"testing", "testing",
"xunit" "xunit"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/6.5.14"
},
"time": "2019-02-01T05:22:47+00:00" "time": "2019-02-01T05:22:47+00:00"
}, },
{ {
@ -813,6 +870,10 @@
"mock", "mock",
"xunit" "xunit"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
"source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/5.0.10"
},
"abandoned": true, "abandoned": true,
"time": "2018-08-09T05:50:03+00:00" "time": "2018-08-09T05:50:03+00:00"
}, },
@ -859,6 +920,10 @@
], ],
"description": "Looks up which function or method a line of code belongs to", "description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
@ -929,6 +994,10 @@
"compare", "compare",
"equality" "equality"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/master"
},
"time": "2018-02-01T13:46:46+00:00" "time": "2018-02-01T13:46:46+00:00"
}, },
{ {
@ -981,6 +1050,10 @@
"keywords": [ "keywords": [
"diff" "diff"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/master"
},
"time": "2017-08-03T08:09:46+00:00" "time": "2017-08-03T08:09:46+00:00"
}, },
{ {
@ -1031,6 +1104,10 @@
"environment", "environment",
"hhvm" "hhvm"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/master"
},
"time": "2017-07-01T08:51:00+00:00" "time": "2017-07-01T08:51:00+00:00"
}, },
{ {
@ -1098,6 +1175,10 @@
"export", "export",
"exporter" "exporter"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
@ -1155,6 +1236,10 @@
"keywords": [ "keywords": [
"global state" "global state"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0"
},
"time": "2017-04-27T15:39:26+00:00" "time": "2017-04-27T15:39:26+00:00"
}, },
{ {
@ -1202,6 +1287,10 @@
], ],
"description": "Traverses array structures and object graphs to enumerate all referenced objects", "description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/", "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
@ -1253,6 +1342,10 @@
], ],
"description": "Allows reflection of object attributes, including inherited and non-public ones", "description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/", "homepage": "https://github.com/sebastianbergmann/object-reflector/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
"source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
@ -1312,6 +1405,10 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1"
},
"funding": [ "funding": [
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
@ -1360,6 +1457,10 @@
], ],
"description": "Provides a list of PHP built-in functions that operate on resources", "description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations", "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"support": {
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
"source": "https://github.com/sebastianbergmann/resource-operations/tree/master"
},
"time": "2015-07-28T20:34:47+00:00" "time": "2015-07-28T20:34:47+00:00"
}, },
{ {
@ -1403,6 +1504,10 @@
], ],
"description": "Library that helps with managing the version number of Git-hosted PHP projects", "description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"support": {
"issues": "https://github.com/sebastianbergmann/version/issues",
"source": "https://github.com/sebastianbergmann/version/tree/master"
},
"time": "2016-10-03T07:35:21+00:00" "time": "2016-10-03T07:35:21+00:00"
}, },
{ {
@ -1465,6 +1570,9 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@ -1519,6 +1627,10 @@
} }
], ],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master"
},
"time": "2019-06-13T22:48:21+00:00" "time": "2019-06-13T22:48:21+00:00"
}, },
{ {
@ -1568,6 +1680,10 @@
"check", "check",
"validate" "validate"
], ],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.9.1"
},
"time": "2020-07-08T17:02:28+00:00" "time": "2020-07-08T17:02:28+00:00"
} }
], ],
@ -1581,5 +1697,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -9,16 +9,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "gettext/gettext", "name": "gettext/gettext",
"version": "v4.8.3", "version": "v4.8.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-gettext/Gettext.git", "url": "https://github.com/php-gettext/Gettext.git",
"reference": "57ff4fb16647e78e80a5909fe3c190f1c3110321" "reference": "58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-gettext/Gettext/zipball/57ff4fb16647e78e80a5909fe3c190f1c3110321", "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1",
"reference": "57ff4fb16647e78e80a5909fe3c190f1c3110321", "reference": "58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -67,7 +67,26 @@
"po", "po",
"translation" "translation"
], ],
"time": "2020-11-18T22:35:49+00:00" "support": {
"email": "oom@oscarotero.com",
"issues": "https://github.com/oscarotero/Gettext/issues",
"source": "https://github.com/php-gettext/Gettext/tree/v4.8.4"
},
"funding": [
{
"url": "https://paypal.me/oscarotero",
"type": "custom"
},
{
"url": "https://github.com/oscarotero",
"type": "github"
},
{
"url": "https://www.patreon.com/misteroom",
"type": "patreon"
}
],
"time": "2021-03-10T19:35:49+00:00"
}, },
{ {
"name": "gettext/languages", "name": "gettext/languages",
@ -128,6 +147,10 @@
"translations", "translations",
"unicode" "unicode"
], ],
"support": {
"issues": "https://github.com/php-gettext/Languages/issues",
"source": "https://github.com/php-gettext/Languages/tree/2.6.0"
},
"time": "2019-11-13T10:30:21+00:00" "time": "2019-11-13T10:30:21+00:00"
}, },
{ {
@ -173,6 +196,10 @@
} }
], ],
"description": "Peast is PHP library that generates AST for JavaScript code", "description": "Peast is PHP library that generates AST for JavaScript code",
"support": {
"issues": "https://github.com/mck89/peast/issues",
"source": "https://github.com/mck89/peast/tree/v1.12.0"
},
"time": "2021-01-08T15:16:19+00:00" "time": "2021-01-08T15:16:19+00:00"
}, },
{ {
@ -219,27 +246,38 @@
"mustache", "mustache",
"templating" "templating"
], ],
"support": {
"issues": "https://github.com/bobthecow/mustache.php/issues",
"source": "https://github.com/bobthecow/mustache.php/tree/master"
},
"time": "2019-11-23T21:40:31+00:00" "time": "2019-11-23T21:40:31+00:00"
}, },
{ {
"name": "rmccue/requests", "name": "rmccue/requests",
"version": "v1.7.0", "version": "v1.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rmccue/Requests.git", "url": "https://github.com/WordPress/Requests.git",
"reference": "87932f52ffad70504d93f04f15690cf16a089546" "reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546", "url": "https://api.github.com/repos/WordPress/Requests/zipball/afbe4790e4def03581c4a0963a1e8aa01f6030f1",
"reference": "87932f52ffad70504d93f04f15690cf16a089546", "reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.2" "php": ">=5.2"
}, },
"require-dev": { "require-dev": {
"requests/test-server": "dev-master" "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.0",
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5",
"requests/test-server": "dev-master",
"squizlabs/php_codesniffer": "^3.5",
"wp-coding-standards/wpcs": "^2.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -258,7 +296,7 @@
} }
], ],
"description": "A HTTP library written in PHP, for human beings.", "description": "A HTTP library written in PHP, for human beings.",
"homepage": "http://github.com/rmccue/Requests", "homepage": "http://github.com/WordPress/Requests",
"keywords": [ "keywords": [
"curl", "curl",
"fsockopen", "fsockopen",
@ -268,7 +306,11 @@
"iri", "iri",
"sockets" "sockets"
], ],
"time": "2016-10-13T00:11:37+00:00" "support": {
"issues": "https://github.com/WordPress/Requests/issues",
"source": "https://github.com/WordPress/Requests/tree/v1.8.0"
},
"time": "2021-04-27T11:05:25+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
@ -317,30 +359,33 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/3.3"
},
"time": "2017-06-01T21:01:25+00:00" "time": "2017-06-01T21:01:25+00:00"
}, },
{ {
"name": "wp-cli/i18n-command", "name": "wp-cli/i18n-command",
"version": "v2.2.6", "version": "v2.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/wp-cli/i18n-command.git", "url": "https://github.com/wp-cli/i18n-command.git",
"reference": "a66da3f09f6a728832381012848c3074bf1635c8" "reference": "8bc234617edc533590ac0f41080164a8d85ec9ce"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/a66da3f09f6a728832381012848c3074bf1635c8", "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/8bc234617edc533590ac0f41080164a8d85ec9ce",
"reference": "a66da3f09f6a728832381012848c3074bf1635c8", "reference": "8bc234617edc533590ac0f41080164a8d85ec9ce",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"gettext/gettext": "^4.8", "gettext/gettext": "^4.8",
"mck89/peast": "^1.8", "mck89/peast": "^1.8",
"wp-cli/wp-cli": "^2" "wp-cli/wp-cli": "^2.5"
}, },
"require-dev": { "require-dev": {
"wp-cli/scaffold-command": "^1.2 || ^2", "wp-cli/scaffold-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^2.1.3" "wp-cli/wp-cli-tests": "^3.0.11"
}, },
"type": "wp-cli-package", "type": "wp-cli-package",
"extra": { "extra": {
@ -374,7 +419,11 @@
], ],
"description": "Provides internationalization tools for WordPress projects.", "description": "Provides internationalization tools for WordPress projects.",
"homepage": "https://github.com/wp-cli/i18n-command", "homepage": "https://github.com/wp-cli/i18n-command",
"time": "2020-12-07T19:28:27+00:00" "support": {
"issues": "https://github.com/wp-cli/i18n-command/issues",
"source": "https://github.com/wp-cli/i18n-command/tree/v2.2.8"
},
"time": "2021-05-10T10:24:16+00:00"
}, },
{ {
"name": "wp-cli/mustangostang-spyc", "name": "wp-cli/mustangostang-spyc",
@ -422,6 +471,9 @@
], ],
"description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)",
"homepage": "https://github.com/mustangostang/spyc/", "homepage": "https://github.com/mustangostang/spyc/",
"support": {
"source": "https://github.com/wp-cli/spyc/tree/autoload"
},
"time": "2017-04-25T11:26:20+00:00" "time": "2017-04-25T11:26:20+00:00"
}, },
{ {
@ -472,27 +524,31 @@
"cli", "cli",
"console" "console"
], ],
"support": {
"issues": "https://github.com/wp-cli/php-cli-tools/issues",
"source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.12"
},
"time": "2021-03-03T12:43:49+00:00" "time": "2021-03-03T12:43:49+00:00"
}, },
{ {
"name": "wp-cli/wp-cli", "name": "wp-cli/wp-cli",
"version": "v2.4.1", "version": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/wp-cli/wp-cli.git", "url": "https://github.com/wp-cli/wp-cli.git",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b" "reference": "4c4746d06640af7698f3792cc4c327a8482dc40f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/ceb18598e79befa9b2a37a51efbb34910628988b", "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/4c4746d06640af7698f3792cc4c327a8482dc40f",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b", "reference": "4c4746d06640af7698f3792cc4c327a8482dc40f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-curl": "*", "ext-curl": "*",
"mustache/mustache": "~2.13", "mustache/mustache": "~2.13",
"php": "^5.4 || ^7.0", "php": "^5.6 || ^7.0 || ^8.0",
"rmccue/requests": "~1.6", "rmccue/requests": "^1.8",
"symfony/finder": ">2.7", "symfony/finder": ">2.7",
"wp-cli/mustangostang-spyc": "^0.6.3", "wp-cli/mustangostang-spyc": "^0.6.3",
"wp-cli/php-cli-tools": "~0.11.2" "wp-cli/php-cli-tools": "~0.11.2"
@ -503,12 +559,13 @@
"wp-cli/entity-command": "^1.2 || ^2", "wp-cli/entity-command": "^1.2 || ^2",
"wp-cli/extension-command": "^1.1 || ^2", "wp-cli/extension-command": "^1.1 || ^2",
"wp-cli/package-command": "^1 || ^2", "wp-cli/package-command": "^1 || ^2",
"wp-cli/wp-cli-tests": "^2.1" "wp-cli/wp-cli-tests": "^3.0.7"
}, },
"suggest": { "suggest": {
"ext-readline": "Include for a better --prompt implementation", "ext-readline": "Include for a better --prompt implementation",
"ext-zip": "Needed to support extraction of ZIP archives when doing downloads or updates" "ext-zip": "Needed to support extraction of ZIP archives when doing downloads or updates"
}, },
"default-branch": true,
"bin": [ "bin": [
"bin/wp", "bin/wp",
"bin/wp.bat" "bin/wp.bat"
@ -516,13 +573,17 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.4.x-dev" "dev-master": "2.5.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-0": {
"WP_CLI": "php" "WP_CLI\\": "php/"
} },
"classmap": [
"php/class-wp-cli.php",
"php/class-wp-cli-command.php"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -534,7 +595,12 @@
"cli", "cli",
"wordpress" "wordpress"
], ],
"time": "2020-02-18T08:15:37+00:00" "support": {
"docs": "https://make.wordpress.org/cli/handbook/",
"issues": "https://github.com/wp-cli/wp-cli/issues",
"source": "https://github.com/wp-cli/wp-cli"
},
"time": "2021-05-13T09:36:33+00:00"
} }
], ],
"aliases": [], "aliases": [],
@ -547,5 +613,5 @@
"platform-overrides": { "platform-overrides": {
"php": "7.0" "php": "7.0"
}, },
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -3,7 +3,7 @@
read -p 'What date (YYYY-MM-DD) should we get contributions since? (i.e. date of previous release): ' from_date read -p 'What date (YYYY-MM-DD) should we get contributions since? (i.e. date of previous release): ' from_date
read -sp 'Provide a personal access token (you must): ' auth_token read -sp 'Provide a personal access token (you must): ' auth_token
ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot],github-actions[bot]" ignored_users="renovate-bot,apps/renovate,renovate,renovate[bot],github-actions[bot],dependabot,dependabot[bot]"
output_file="contributors.html" output_file="contributors.html"
common_arguments="--owner woocommerce --fromDate $from_date --authToken $auth_token --cols 6 --sortBy contributions --format html --sortOrder desc --showlogin true --filter $ignored_users" common_arguments="--owner woocommerce --fromDate $from_date --authToken $auth_token --cols 6 --sortBy contributions --format html --sortOrder desc --showlogin true --filter $ignored_users"

View File

@ -1,21 +1,156 @@
== Changelog == == Changelog ==
= 5.2.0 RC 2021-03-30 = = 5.3.0 2021-05-11 =
* Update - WooCommerce Admin package 2.1.4. #29520 **WooCommerce**
* Fix - Don't remove existing coupons from order when an invalid REST API request for updating coupons is submitted. #29474
* Fix - Wrong logic for including or excluding the payments step in the list of completed tasks in the onboarding wizard. #29518 * Dev - Add support for "cities" and "postcodes" fields to the REST API endpoints to create/update tax rates. #29495
* Dev - The taxes GET endpoint now supports sorting by priority. #29495
**WooCommerce Admin - 2.1.4** * Enhancement - Add a new `woocommerce_cart_product_not_enough_stock_already_in_cart_message` filter to allow developers to filter an add-to-cart error when there isn't enough in stock taking into account what's already in the cart. #29304
* Enhancement - Pass `$handler`, and prevent logging from `woocommerce_logger_log_message` filter when the message is null. #29572
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649 * Fix - Added parameter `$item` (instance of WC_Order_Item) to both the function `wc_downloadable_file_permission` and the filter hook `woocommerce_downloadable_file_permission`. #23188
* Fix - Add array-typed "cities" and "postcodes" to the response of the "tax" endpoint in the REST API to overcome the limitation of "city" and "postcode" returning always one single value. #27751
= 5.2.0 beta 2021-03-23 = * Fix - Update tax rate for existing taxes when recalculating order totals. #27985
* Fix - Replace page setup dropdowns with AJAX powered search selects. #29181
* Fix - Return 0 if order isn't available in `WC_Payment_Gateway::get_order_total()`. #29314
* Fix - Fix console error on IE11 when opening admin pages. #29322
* Fix - Prevent crash when log file can't be opened for writing. #29396
* Fix - Closes the section "Store management insights" in email settings. #29447
* Fix - Fixed return type of `WC_Shortcode_Products::get_type()`. #29452
* Fix - Fix syntax error in the admin (products/orders) list table. #29469
* Fix - Cart duplicate debug shipping notices in certain situations. #29480
* Fix - Trying to update the cities or postcodes (only) or a tax rate via REST API returned an error. #29495
* Fix - Unneeded browser popup message of unsaved changes when adding a shipping zone with a shipping method. #29510
* Fix - Update the persistent cart after it's loaded on customer login. Fixes an issue whereby unavailable products would be validated on every login. #29517
* Fix - Updated `$customer->get_shipping()` and `$customer->get_billing()` to return the full address after updating individual fields. #29538
* Fix - Prevent cart to reset all nonce in front-end. #29542
* Fix - Bump the version of the "Grouped product add to cart" template to 4.8.0 (was still at 4.0.0 by mistake). #29601
* Fix - If we have a non-empty shipping address then do not overwrite the state or country fields with billing address data. #29605
* Tweak - Add the support to `optgroups` in single select on Settings API. #29145
* Tweak - Improves performance by avoiding an unnecessary redirect if custom permalink structure does not contain trailing slashes. #29422
* Tweak - Update SSR db version tooltip to more accurately state the db version. #29438
* Tweak - Adjust Twenty Twenty One order items header alignment. #29485
* Tweak - Lost password form alignment issues. #29496
* Tweak - Improve accessibility by adding `aria-hidden="true"` on strikethrough prices. #29603
* Tweak - Default store location to US California. #29654
* Tweak - Default store currency to USD. #29752
** WooCommerce Blocks - 4.8.0 & 4.9.0 & 4.9.1 **
* Dev - Removed legacy handling for SSR blocks that rendered shortcodes. #4010
* Fix - Customer address country saving to orders in certain circumstances. #4013
* Fix - Prevent error messages returned by the API from displaying raw HTML. #4005
* Fix - Proceed to checkout button click bug happening when the Coupon error is visible in the Cart block. #3996
* Fix - Use font color in payment methods border. #4051
* Fix - Load translation file for JS files that has translatable strings. #4050
* Fix - Stop shipping package titles line-breaks occurring in the middle of a word. #4049
* Fix - Fixed styling issues on the cart and checkout page in Twenty(X) themes. #4046
* Fix - Fix headline alignment in the empty state of the cart block. #4044
* Fix - Fix button alignment in Featured Product and Featured Category blocks. #4028
* Fix - Check if Cart and Checkout are registered before removing payment methods. #4056
* Enhancement - Registered payment methods now have access to the `shouldSavePayment` prop in their components (which indicates whether the shopper has checked the save payment method checkbox. #3990
* Enhancement - Payment methods implementing the `savedTokenComponent` configuration property will now have the `onPaymentProcessing` event available to the registered component. #3982
** WooCommerce Admin - 2.2.0 & 2.2.1 & 2.2.2 & 2.2.3 & 2.2.4 & 2.2.5 & 2.2.6 **
* Add - Next new novel navigation nudge note #6610
* Add - Add legacy report items to new navigation #6507
* Add - Add preview site button on the appearance task #6457
* Add - Back button to go to home screen from tasks in the task list. #6397
* Add - Add a "rather not say" option to revenue in the profile wizard. #6475
* Add - Remove Mollie promo note on install #6510
* Add - Remote Inbox Notifications rule to trigger when WooCommerce Admin is upgraded. #6040
* Add - CES survey for search product, order, customer #6420
* Add - CES survey for importing products #6419
* Add - CES survey for adding product categories, tags, and attributes #6418
* Add - Additional analytics tracking for the business details step. #6575
* Add - Include tracking for mail poet installs in the selective bundle install #6603
* Add - Paystack payment provider to several african countries. #6579
* Dev - Close activity panel tabs by default and track #6566
* Dev - Update undefined task name properties for help panel tracks #6565
* Dev - Refactor profile wizard benefits step and add tests #6583
* Dev - Add filter to profile wizard steps #6564
* Dev - Add nav intro modal tests #6518
* Dev - Use wc filter to get status tabs for tools category #6525
* Dev - Add nav header component tests #6509
* Dev - Add initial tests for navigation Menu class #6492
* Dev - Remove active item from navigation store #6486
* Dev - Add navigation container tests #6464
* Dev - Add nav favorite button tests #6446
* Dev - Add a changelog lint check to PRs. #6414
* Dev - Add navigation favorites tests #6409
* Dev - support use of Array.flat in client and packages. #6411
* Dev - Deprecate Onboarding::has_woocommerce_support. #6401
* Dev - Add Dependency Extraction Webpack Plugin #5762
* Dev - Add client-side filter for Navigation rootBackUrl #6505
* Dev - Remove `items_purchased` and `account_type` props from onboarding profile API. #6520
* Dev - Added warning when WC-Admin is active but not being used #6453
* Dev - Store profiler - Added MailPoet to Business Details step #6503
* Dev - Store profiler - Added MailPoet to new Business Details step #6515
* Dev - Add tilde (~) to represent client root directory for imports. #6517
* Dev - Add script automation for gathering hooks and filters. #6454
* Dev - Add TypeScript and page objects to the E2E test suite. #6582
* Dev - Introduce Typescript to Navigation utils #6477
* Dev - Payments task: include Mercado Pago #6572
* Dev - Ensure script asset.php files are included in builds #6635
* Dev - Ensure production script asset names don't include .min suffix #6681
* Dev - Do a git clean before the core release. #6945
* Dev - Fix a bug where trying to load an asset registry causes a crash. #6951
* Fix - Add check for navigating being enabled. #6462
* Fix - Move the shipping input and text 1px lower. #6408
* Fix - Correct the Klarna slug #6440
* Fix - Broken link anchors to online documentation. #6455
* Fix - Update payment card style on mobile #6413
* Fix - Missing i18n in Welcome modal. #6456
* Fix - Restore visual styles back to Analytics tabs. #5913
* Fix - Update contrast and hover / active colors for analytics dropdown buttons #6504
* Fix - Associated Order Number for refunds was hidden #6428
* Fix - Fix issue where Loader::is_admin_page() would error if WooCommerce admin is disabled. #6563
* Fix - Correct a bug where the JP connection flow would not happen when installing JP in the OBW. #6521
* Fix - Show management links when the task list is complete (even if its not hidden). #6657
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
* Fix - Update the Mercado option used for enabling/disabling. #6677
* Fix - Improve AddFirstProduct email note contents. #6617
* Fix - Check if features are currently being enabled #6688
* Fix - Fix the activity panel toggle not closing on click #6679
* Fix - Fix use of feature checks and remove deprecated method calls #6687
* Fix - Allow the manager role to query certain options #6577
* Fix - Delete customer data on network user deletion #6574
* Fix - Fix Themes step visibility in IE 11 #6578
* Fix - Fix hidden menu title on smaller screens #6562
* Fix - Add gross sales column to CSV export #6567
* Fix - Disable the continue btn on OBW when requested are being made #6838
* Fix - Calling of get_script_asset_filename with extra parameter #6955
* Fix - Address an issue with OBW when installing only WooCommerce payments and Jetpack. #6957
* Tweak - Add default value for contains op #6622
* Tweak - Adjust targeting store age for the Add First Product note #6554
* Tweak - Improve WC Shipping & Tax logic #6547
* Tweak - Update Insight inbox note content #6555
* Tweak - Remove mobile activity panel toggle #6539
* Tweak - Refactor autoloader to remove global variable. #6412
* Tweak - Revert WCPay international support for bundled package #6901
* Tweak - Store profiler - Changed MailPoet's title and description #6886
* Tweak - Update PayU logo #6829
= 5.2.2 2021-04-15 =
**WooCommerce**
* Fix - Can't grant permission for download from order details page. #29691
= 5.2.1 2021-04-14 =
**WooCommerce**
* Update - WooCommerce Blocks package 4.7.2. #29660
**WooCommerce Blocks - 4.7.2**
* Fix - Check if Cart and Checkout are registered before removing payment methods. ([4056](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4056))
= 5.2.0 2021-04-13 =
**WooCommerce** **WooCommerce**
* Update - WooCommerce Blocks package 4.7.0. #29406
* Update - WooCommerce Admin package 2.1.3. #29283
* Add - Filter woocommerce_product_recount_terms to allow/prevent recounting of product terms. #29281 * Add - Filter woocommerce_product_recount_terms to allow/prevent recounting of product terms. #29281
* Add - Result return array to the checkout_place_order_success callback to allow 3rd party to manipulate results. #29232 * Add - Result return array to the checkout_place_order_success callback to allow 3rd party to manipulate results. #29232
* Dev - Fix miscellaneous typos in docblocks. #29285 * Dev - Fix miscellaneous typos in docblocks. #29285
@ -54,11 +189,21 @@
* Fix - Invalid refund amount error on $0 refund when number of decimals is equal to 0. #27277 * Fix - Invalid refund amount error on $0 refund when number of decimals is equal to 0. #27277
* Fix - "Sale" badge misaligned on products when displaying 1 item per row. #29425 * Fix - "Sale" badge misaligned on products when displaying 1 item per row. #29425
* Fix - Revert a replacement of wp_redirect to wp_safe_redirect in WC_Checkout::process_order_payment that caused issues in the default PayPal interface. #29459 * Fix - Revert a replacement of wp_redirect to wp_safe_redirect in WC_Checkout::process_order_payment that caused issues in the default PayPal interface. #29459
* Fix - Don't remove existing coupons from order when an invalid REST API request for updating coupons is submitted. #29474
* Fix - Wrong logic for including or excluding the payments step in the list of completed tasks in the onboarding wizard. #29518
* Fix - Error when loading the admin dashboard while the admin package was disabled. #29613
* Fix - "'' is not a valid country code" error when no billing/shipping country specified (e.g. when using PayPal checkout). #29606
* Fix - Sanitize tax class and display errors in admin while creating tax classes.
* Fix - Check if a verified product owner is required before placing a review.
* Fix - Make product name escaping consistent in the front-end.
* Tweak - Added the Mercado Pago logo into the assets/images folder in order to use it in the payments setup task. #29365 * Tweak - Added the Mercado Pago logo into the assets/images folder in order to use it in the payments setup task. #29365
* Tweak - Update the contributor guidelines. #29150 * Tweak - Update the contributor guidelines. #29150
* Tweak - Introduced phone number input validation. #27242 * Tweak - Introduced phone number input validation. #27242
* Tweak - Escape short description.
* Update - WooCommerce Admin package 2.1.5. #29577
* Update - WooCommerce Blocks package 4.7.0. #29406
**WooCommerce Admin - 2.1.0 & 2.1.1 & 2.1.2 & 2.1.3** **WooCommerce Admin - 2.1.0 & 2.1.1 & 2.1.2 & 2.1.3 & 2.1.4 & 2.1.5**
* Add - Add navigation intro modal. #6367 * Add - Add navigation intro modal. #6367
* Add - CES track settings tab on updating settings #6368 * Add - CES track settings tab on updating settings #6368
@ -85,6 +230,7 @@
* Fix - Add check for navigating being enabled. #6462 * Fix - Add check for navigating being enabled. #6462
* Fix - Add customer name column to CSV export #6556 * Fix - Add customer name column to CSV export #6556
* Fix - Add guard to "Deactivate Plugin" note handlers to prevent fatal error. #6532 * Fix - Add guard to "Deactivate Plugin" note handlers to prevent fatal error. #6532
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
* Fix - Broken link anchors to online documentation. #6455 * Fix - Broken link anchors to online documentation. #6455
* Fix - Check if tax was successfully added before displaying notice #6229 * Fix - Check if tax was successfully added before displaying notice #6229
* Fix - Correct a bug where the JP connection flow would not happen when installing JP in the OBW. #6521 * Fix - Correct a bug where the JP connection flow would not happen when installing JP in the OBW. #6521
@ -108,11 +254,12 @@
* Tweak - New Settings: Turn off in dev mode #6348 * Tweak - New Settings: Turn off in dev mode #6348
* Tweak - Order and styles updates to nav footer #6373 * Tweak - Order and styles updates to nav footer #6373
* Tweak - Remove categories without menu items #6329 * Tweak - Remove categories without menu items #6329
* Tweak - Set international country feature flag off
* Tweak - Set `is_deleted` from the database when instantiating a `Note` #6322 * Tweak - Set `is_deleted` from the database when instantiating a `Note` #6322
* Tweak - Update inline documentation for navigation Screen class #6173 * Tweak - Update inline documentation for navigation Screen class #6173
* Tweak - Updates to copy and punctuation to be more conversational and consistent. #6298 * Tweak - Updates to copy and punctuation to be more conversational and consistent. #6298
**WooCommerce Blocks - 4.5.0 & 4.6.0 & 4.7.0** **WooCommerce Blocks - 4.5.0 & 4.6.0 & 4.7.0 & 4.7.1**
* Enhancement - Login links on the checkout should use the account page. ([3844](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3844)) * Enhancement - Login links on the checkout should use the account page. ([3844](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3844))
* Enhancement - Prevent checkout linking to trashed terms and policy pages. ([3843](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3843)) * Enhancement - Prevent checkout linking to trashed terms and policy pages. ([3843](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3843))

View File

@ -21,8 +21,8 @@
"pelago/emogrifier": "3.1.0", "pelago/emogrifier": "3.1.0",
"psr/container": "1.0.0", "psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.1.6", "woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "2.1.4", "woocommerce/woocommerce-admin": "2.3.0",
"woocommerce/woocommerce-blocks": "4.7.0" "woocommerce/woocommerce-blocks": "5.1.0"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.4" "bamarni/composer-bin-plugin": "^1.4"

47
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "b1d6d94c8cfae572ab27c288c6865787", "content-hash": "ac338dadb8929c73ad9606426621f9ba",
"packages": [ "packages": [
{ {
"name": "automattic/jetpack-autoloader", "name": "automattic/jetpack-autoloader",
@ -92,16 +92,16 @@
}, },
{ {
"name": "composer/installers", "name": "composer/installers",
"version": "v1.10.0", "version": "v1.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/installers.git", "url": "https://github.com/composer/installers.git",
"reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d" "reference": "ae03311f45dfe194412081526be2e003960df74b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d", "url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b",
"reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d", "reference": "ae03311f45dfe194412081526be2e003960df74b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -195,6 +195,7 @@
"majima", "majima",
"mako", "mako",
"mediawiki", "mediawiki",
"miaoxing",
"modulework", "modulework",
"modx", "modx",
"moodle", "moodle",
@ -212,6 +213,7 @@
"sydes", "sydes",
"sylius", "sylius",
"symfony", "symfony",
"tastyigniter",
"typo3", "typo3",
"wordpress", "wordpress",
"yawik", "yawik",
@ -220,7 +222,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/composer/installers/issues", "issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v1.10.0" "source": "https://github.com/composer/installers/tree/v1.11.0"
}, },
"funding": [ "funding": [
{ {
@ -236,7 +238,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-01-14T11:07:16+00:00" "time": "2021-04-28T06:42:17+00:00"
}, },
{ {
"name": "maxmind-db/reader", "name": "maxmind-db/reader",
@ -530,16 +532,16 @@
}, },
{ {
"name": "woocommerce/woocommerce-admin", "name": "woocommerce/woocommerce-admin",
"version": "2.1.4", "version": "2.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git", "url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "f992b8c8664e72b00ee7283ba1d34e74e4b67ab0" "reference": "c690969d301ddb7145b43e72e4dd99c84cc8ba66"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/f992b8c8664e72b00ee7283ba1d34e74e4b67ab0", "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/c690969d301ddb7145b43e72e4dd99c84cc8ba66",
"reference": "f992b8c8664e72b00ee7283ba1d34e74e4b67ab0", "reference": "c690969d301ddb7145b43e72e4dd99c84cc8ba66",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -548,7 +550,7 @@
"php": ">=7.0" "php": ">=7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "7.5.20", "bamarni/composer-bin-plugin": "^1.4",
"suin/phpcs-psr4-sniff": "^2.2", "suin/phpcs-psr4-sniff": "^2.2",
"woocommerce/woocommerce-sniffs": "0.1.0" "woocommerce/woocommerce-sniffs": "0.1.0"
}, },
@ -558,6 +560,9 @@
"test": "Run unit tests", "test": "Run unit tests",
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer", "phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier" "phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
},
"bamarni-bin": {
"target-directory": "bin/composer"
} }
}, },
"autoload": { "autoload": {
@ -573,22 +578,22 @@
"homepage": "https://github.com/woocommerce/woocommerce-admin", "homepage": "https://github.com/woocommerce/woocommerce-admin",
"support": { "support": {
"issues": "https://github.com/woocommerce/woocommerce-admin/issues", "issues": "https://github.com/woocommerce/woocommerce-admin/issues",
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.1.4" "source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.3.0"
}, },
"time": "2021-03-29T11:59:33+00:00" "time": "2021-05-12T15:20:07+00:00"
}, },
{ {
"name": "woocommerce/woocommerce-blocks", "name": "woocommerce/woocommerce-blocks",
"version": "v4.7.0", "version": "v5.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "bf9f70607e718c5f83785cad29b33746db0282d3" "reference": "a4f168596f3832e161b26dec636b69293039ee51"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/bf9f70607e718c5f83785cad29b33746db0282d3", "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/a4f168596f3832e161b26dec636b69293039ee51",
"reference": "bf9f70607e718c5f83785cad29b33746db0282d3", "reference": "a4f168596f3832e161b26dec636b69293039ee51",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -596,7 +601,7 @@
"composer/installers": "^1.7.0" "composer/installers": "^1.7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "6.5.14", "phpunit/phpunit": "7.5.20",
"woocommerce/woocommerce-sniffs": "0.1.0" "woocommerce/woocommerce-sniffs": "0.1.0"
}, },
"type": "wordpress-plugin", "type": "wordpress-plugin",
@ -624,9 +629,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues", "issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v4.7.0" "source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v5.1.0"
}, },
"time": "2021-03-16T16:09:55+00:00" "time": "2021-05-10T15:01:42+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

View File

@ -1792,6 +1792,33 @@ return array(
'AE' => __( 'Armed Forces (AE)', 'woocommerce' ), 'AE' => __( 'Armed Forces (AE)', 'woocommerce' ),
'AP' => __( 'Armed Forces (AP)', 'woocommerce' ), 'AP' => __( 'Armed Forces (AP)', 'woocommerce' ),
), ),
'VE' => array( // Venezuela States. Ref: https://github.com/unicode-org/cldr/blob/release-38-1/common/subdivisions/en.xml#L5426-L5451
'A' => __( 'Capital', 'woocommerce' ),
'B' => __( 'Anzoátegui', 'woocommerce' ),
'C' => __( 'Apure', 'woocommerce' ),
'D' => __( 'Aragua', 'woocommerce' ),
'E' => __( 'Barinas', 'woocommerce' ),
'F' => __( 'Bolívar', 'woocommerce' ),
'G' => __( 'Carabobo', 'woocommerce' ),
'H' => __( 'Cojedes', 'woocommerce' ),
'I' => __( 'Falcón', 'woocommerce' ),
'J' => __( 'Guárico', 'woocommerce' ),
'K' => __( 'Lara', 'woocommerce' ),
'L' => __( 'Mérida', 'woocommerce' ),
'M' => __( 'Miranda', 'woocommerce' ),
'N' => __( 'Monagas', 'woocommerce' ),
'O' => __( 'Nueva Esparta', 'woocommerce' ),
'P' => __( 'Portuguesa', 'woocommerce' ),
'R' => __( 'Sucre', 'woocommerce' ),
'S' => __( 'Táchira', 'woocommerce' ),
'T' => __( 'Trujillo', 'woocommerce' ),
'U' => __( 'Yaracuy', 'woocommerce' ),
'V' => __( 'Zulia', 'woocommerce' ),
'W' => __( 'Federal Dependencies', 'woocommerce' ),
'X' => __( 'Vargas', 'woocommerce' ),
'Y' => __( 'Delta Amacuro', 'woocommerce' ),
'Z' => __( 'Amazonas', 'woocommerce' )
),
'VN' => array(), 'VN' => array(),
'YT' => array(), 'YT' => array(),
'ZA' => array( // South African states. 'ZA' => array( // South African states.

View File

@ -262,7 +262,9 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
// Gets order total from "pay for order" page. // Gets order total from "pay for order" page.
if ( 0 < $order_id ) { if ( 0 < $order_id ) {
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
if ( $order ) {
$total = (float) $order->get_total(); $total = (float) $order->get_total();
}
// Gets order total from cart/checkout. // Gets order total from cart/checkout.
} elseif ( 0 < WC()->cart->total ) { } elseif ( 0 < WC()->cart->total ) {

View File

@ -696,6 +696,7 @@ abstract class WC_Settings_API {
); );
$data = wp_parse_args( $data, $defaults ); $data = wp_parse_args( $data, $defaults );
$value = $this->get_option( $key );
ob_start(); ob_start();
?> ?>
@ -708,7 +709,15 @@ abstract class WC_Settings_API {
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
<select class="select <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>> <select class="select <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?>>
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?> <?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( (string) $option_key, esc_attr( $this->get_option( $key ) ) ); ?>><?php echo esc_html( $option_value ); ?></option> <?php if ( is_array( $option_value ) ) : ?>
<optgroup label="<?php echo esc_attr( $option_key ); ?>">
<?php foreach ( $option_value as $option_key_inner => $option_value_inner ) : ?>
<option value="<?php echo esc_attr( $option_key_inner ); ?>" <?php selected( (string) $option_key_inner, esc_attr( $value ) ); ?>><?php echo esc_html( $option_value_inner ); ?></option>
<?php endforeach; ?>
</optgroup>
<?php else : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( (string) $option_key, esc_attr( $value ) ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?> <?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>

View File

@ -534,6 +534,73 @@ class WC_Admin_Addons {
<?php <?php
} }
/**
* Handles the output of a full-width block.
*
* @param array $section Section data.
*/
public static function output_promotion_block( $section ) {
if (
! current_user_can( 'install_plugins' ) ||
! current_user_can( 'activate_plugins' )
) {
return;
}
$section_object = (object) $section;
if ( ! empty( $section_object->geowhitelist ) ) {
$section_object->geowhitelist = explode( ',', $section_object->geowhitelist );
}
if ( ! empty( $section_object->geoblacklist ) ) {
$section_object->geoblacklist = explode( ',', $section_object->geoblacklist );
}
if ( ! self::show_extension( $section_object ) ) {
return;
}
?>
<div class="addons-banner-block addons-promotion-block">
<img
class="addons-img"
src="<?php echo esc_url( $section['image'] ); ?>"
alt="<?php echo esc_attr( $section['image_alt'] ); ?>"
/>
<div class="addons-promotion-block-content">
<h1 class="addons-promotion-block-title"><?php echo esc_html( $section['title'] ); ?></h1>
<div class="addons-promotion-block-description">
<?php echo wp_kses_post( $section['description'] ); ?>
</div>
<div class="addons-promotion-block-buttons">
<?php
if ( $section['button_1'] ) {
self::output_button(
$section['button_1_href'],
$section['button_1'],
'addons-button-expandable addons-button-solid',
$section['plugin']
);
}
if ( $section['button_2'] ) {
self::output_button(
$section['button_2_href'],
$section['button_2'],
'addons-button-expandable addons-button-outline-purple',
$section['plugin']
);
}
?>
</div>
</div>
</div>
<?php
}
/** /**
* Handles the outputting of featured sections * Handles the outputting of featured sections
* *
@ -566,6 +633,9 @@ class WC_Admin_Addons {
case 'wcpay_banner_block': case 'wcpay_banner_block':
self::output_wcpay_banner_block( (array) $section ); self::output_wcpay_banner_block( (array) $section );
break; break;
case 'promotion_block':
self::output_promotion_block( (array) $section );
break;
} }
} }
} }

View File

@ -162,7 +162,9 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
* @return bool * @return bool
*/ */
private function should_display_widget() { private function should_display_widget() {
return 'yes' !== get_option( 'woocommerce_task_list_complete' ) && 'yes' !== get_option( 'woocommerce_task_list_hidden' ); return WC()->is_wc_admin_active() &&
'yes' !== get_option( 'woocommerce_task_list_complete' ) &&
'yes' !== get_option( 'woocommerce_task_list_hidden' );
} }
/** /**
@ -170,7 +172,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
*/ */
private function populate_payment_tasks() { private function populate_payment_tasks() {
$is_woo_payment_installed = is_plugin_active( 'woocommerce-payments/woocommerce-payments.php' ); $is_woo_payment_installed = is_plugin_active( 'woocommerce-payments/woocommerce-payments.php' );
$country = explode( ':', get_option( 'woocommerce_default_country', '' ) )[0]; $country = explode( ':', get_option( 'woocommerce_default_country', 'US:CA' ) )[0];
// woocommerce-payments requires its plugin activated and country must be US. // woocommerce-payments requires its plugin activated and country must be US.
if ( ! $is_woo_payment_installed || 'US' !== $country ) { if ( ! $is_woo_payment_installed || 'US' !== $country ) {

View File

@ -63,6 +63,10 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
* @return bool * @return bool
*/ */
private function should_display_widget() { private function should_display_widget() {
if ( ! WC()->is_wc_admin_active() ) {
return false;
}
$has_permission = current_user_can( 'view_woocommerce_reports' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'publish_shop_orders' ); $has_permission = current_user_can( 'view_woocommerce_reports' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'publish_shop_orders' );
$task_completed_or_hidden = 'yes' === get_option( 'woocommerce_task_list_complete' ) || 'yes' === get_option( 'woocommerce_task_list_hidden' ); $task_completed_or_hidden = 'yes' === get_option( 'woocommerce_task_list_complete' ) || 'yes' === get_option( 'woocommerce_task_list_hidden' );
return $task_completed_or_hidden && $has_permission; return $task_completed_or_hidden && $has_permission;

View File

@ -3,8 +3,6 @@
* Adds settings to the permalinks admin settings page * Adds settings to the permalinks admin settings page
* *
* @class WC_Admin_Permalink_Settings * @class WC_Admin_Permalink_Settings
* @author WooThemes
* @category Admin
* @package WooCommerce\Admin * @package WooCommerce\Admin
* @version 2.3.0 * @version 2.3.0
*/ */
@ -140,23 +138,23 @@ class WC_Admin_Permalink_Settings {
<?php wp_nonce_field( 'wc-permalinks', 'wc-permalinks-nonce' ); ?> <?php wp_nonce_field( 'wc-permalinks', 'wc-permalinks-nonce' ); ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery( function() { jQuery( function() {
jQuery('input.wctog').change(function() { jQuery('input.wctog').on( 'change', function() {
jQuery('#woocommerce_permalink_structure').val( jQuery( this ).val() ); jQuery('#woocommerce_permalink_structure').val( jQuery( this ).val() );
}); });
jQuery('.permalink-structure input').change(function() { jQuery('.permalink-structure input').on( 'change', function() {
jQuery('.wc-permalink-structure').find('code.non-default-example, code.default-example').hide(); jQuery('.wc-permalink-structure').find('code.non-default-example, code.default-example').hide();
if ( jQuery(this).val() ) { if ( jQuery(this).val() ) {
jQuery('.wc-permalink-structure code.non-default-example').show(); jQuery('.wc-permalink-structure code.non-default-example').show();
jQuery('.wc-permalink-structure input').removeAttr('disabled'); jQuery('.wc-permalink-structure input').prop('disabled', false);
} else { } else {
jQuery('.wc-permalink-structure code.default-example').show(); jQuery('.wc-permalink-structure code.default-example').show();
jQuery('.wc-permalink-structure input:eq(0)').click(); jQuery('.wc-permalink-structure input:eq(0)').trigger( 'click' );
jQuery('.wc-permalink-structure input').attr('disabled', 'disabled'); jQuery('.wc-permalink-structure input').attr('disabled', 'disabled');
} }
}); });
jQuery('.permalink-structure input:checked').change(); jQuery('.permalink-structure input:checked').trigger( 'change' );
jQuery('#woocommerce_permalink_structure').focus( function(){ jQuery('#woocommerce_permalink_structure').on( 'focus', function(){
jQuery('#woocommerce_custom_selection').click(); jQuery('#woocommerce_custom_selection').trigger( 'click' );
} ); } );
} ); } );
</script> </script>

View File

@ -254,12 +254,12 @@ class WC_Admin_Pointers {
button2 = $( '<a class=\"button button-primary\" href=\"#\">' + next + '</a>' ), button2 = $( '<a class=\"button button-primary\" href=\"#\">' + next + '</a>' ),
wrapper = $( '<div class=\"wc-pointer-buttons\" />' ); wrapper = $( '<div class=\"wc-pointer-buttons\" />' );
button.bind( 'click.pointer', function(e) { button.on( 'click.pointer', function(e) {
e.preventDefault(); e.preventDefault();
t.element.pointer('destroy'); t.element.pointer('destroy');
}); });
button2.bind( 'click.pointer', function(e) { button2.on( 'click.pointer', function(e) {
e.preventDefault(); e.preventDefault();
t.element.pointer('close'); t.element.pointer('close');
}); });

View File

@ -430,7 +430,10 @@ class WC_Admin_Post_Types {
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$product->set_manage_stock( $manage_stock ); $product->set_manage_stock( $manage_stock );
if ( 'external' !== $product->get_type() ) {
$product->set_backorders( $backorders ); $product->set_backorders( $backorders );
}
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) { if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
$stock_amount = 'yes' === $manage_stock && isset( $request_data['_stock'] ) && is_numeric( wp_unslash( $request_data['_stock'] ) ) ? wc_stock_amount( wp_unslash( $request_data['_stock'] ) ) : ''; $stock_amount = 'yes' === $manage_stock && isset( $request_data['_stock'] ) && is_numeric( wp_unslash( $request_data['_stock'] ) ) ? wc_stock_amount( wp_unslash( $request_data['_stock'] ) ) : '';
@ -550,7 +553,10 @@ class WC_Admin_Post_Types {
$stock_amount = 'yes' === $manage_stock && ! empty( $request_data['change_stock'] ) && isset( $request_data['_stock'] ) ? wc_stock_amount( $request_data['_stock'] ) : $product->get_stock_quantity(); $stock_amount = 'yes' === $manage_stock && ! empty( $request_data['change_stock'] ) && isset( $request_data['_stock'] ) ? wc_stock_amount( $request_data['_stock'] ) : $product->get_stock_quantity();
$product->set_manage_stock( $manage_stock ); $product->set_manage_stock( $manage_stock );
if ( 'external' !== $product->get_type() ) {
$product->set_backorders( $backorders ); $product->set_backorders( $backorders );
}
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) { if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
$change_stock = absint( $request_data['change_stock'] ); $change_stock = absint( $request_data['change_stock'] );

View File

@ -481,7 +481,7 @@ class WC_Admin_Setup_Wizard {
$state = WC()->countries->get_base_state(); $state = WC()->countries->get_base_state();
$country = WC()->countries->get_base_country(); $country = WC()->countries->get_base_country();
$postcode = WC()->countries->get_base_postcode(); $postcode = WC()->countries->get_base_postcode();
$currency = get_option( 'woocommerce_currency', 'GBP' ); $currency = get_option( 'woocommerce_currency', 'USD' );
$product_type = get_option( 'woocommerce_product_type', 'both' ); $product_type = get_option( 'woocommerce_product_type', 'both' );
$sell_in_person = get_option( 'woocommerce_sell_in_person', 'none_selected' ); $sell_in_person = get_option( 'woocommerce_sell_in_person', 'none_selected' );

View File

@ -7,6 +7,7 @@
*/ */
use Automattic\Jetpack\Constants; use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Utilities\ArrayUtil;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
@ -38,6 +39,7 @@ class WC_Admin_Status {
} }
$tools = self::get_tools(); $tools = self::get_tools();
$tool_requires_refresh = false;
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'debug_action' ) ) { // WPCS: input var ok, sanitization ok. if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'debug_action' ) ) { // WPCS: input var ok, sanitization ok.
$tools_controller = new WC_REST_System_Status_Tools_Controller(); $tools_controller = new WC_REST_System_Status_Tools_Controller();
@ -47,11 +49,13 @@ class WC_Admin_Status {
$response = $tools_controller->execute_tool( $action ); $response = $tools_controller->execute_tool( $action );
$tool = $tools[ $action ]; $tool = $tools[ $action ];
$tool_requires_refresh = ArrayUtil::get_value_or_default( $tool, 'requires_refresh', false );
$tool = array( $tool = array(
'id' => $action, 'id' => $action,
'name' => $tool['name'], 'name' => $tool['name'],
'action' => $tool['button'], 'action' => $tool['button'],
'description' => $tool['desc'], 'description' => $tool['desc'],
'disabled' => ArrayUtil::get_value_or_default( $tool, 'disabled', false ),
); );
$tool = array_merge( $tool, $response ); $tool = array_merge( $tool, $response );
@ -80,6 +84,10 @@ class WC_Admin_Status {
echo '<div class="updated inline"><p>' . esc_html__( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>'; echo '<div class="updated inline"><p>' . esc_html__( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
} }
if ( $tool_requires_refresh ) {
$tools = self::get_tools();
}
include_once __DIR__ . '/views/html-admin-page-status-tools.php'; include_once __DIR__ . '/views/html-admin-page-status-tools.php';
} }

View File

@ -11,6 +11,8 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
/** /**
* WC_Admin_Taxonomies class. * WC_Admin_Taxonomies class.
*/ */
@ -49,6 +51,12 @@ class WC_Admin_Taxonomies {
// Category/term ordering. // Category/term ordering.
add_action( 'create_term', array( $this, 'create_term' ), 5, 3 ); add_action( 'create_term', array( $this, 'create_term' ), 5, 3 );
add_action(
'delete_product_cat',
function() {
wc_get_container()->get( AssignDefaultCategory::class )->schedule_action();
}
);
// Add form. // Add form.
add_action( 'product_cat_add_form_fields', array( $this, 'add_category_fields' ) ); add_action( 'product_cat_add_form_fields', array( $this, 'add_category_fields' ) );
@ -91,7 +99,7 @@ class WC_Admin_Taxonomies {
* @param string $taxonomy Taxonomy slug. * @param string $taxonomy Taxonomy slug.
*/ */
public function create_term( $term_id, $tt_id = '', $taxonomy = '' ) { public function create_term( $term_id, $tt_id = '', $taxonomy = '' ) {
if ( 'product_cat' != $taxonomy && ! taxonomy_is_product_attribute( $taxonomy ) ) { if ( 'product_cat' !== $taxonomy && ! taxonomy_is_product_attribute( $taxonomy ) ) {
return; return;
} }

View File

@ -189,7 +189,10 @@ if ( wc_tax_enabled() ) {
<td class="label"><?php echo esc_html( $tax_total->label ); ?>:</td> <td class="label"><?php echo esc_html( $tax_total->label ); ?>:</td>
<td width="1%"></td> <td width="1%"></td>
<td class="total"> <td class="total">
<?php echo wc_price( $tax_total->amount, array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> <?php
// We use wc_round_tax_total here because tax may need to be round up or round down depending upon settings, whereas wc_price alone will always round it down.
echo wc_price( wc_round_tax_total( $tax_total->amount ), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -157,7 +157,7 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
$update_link.removeClass( 'wc-thickbox open-plugin-details-modal' ); $update_link.removeClass( 'wc-thickbox open-plugin-details-modal' );
$update_link.addClass( 'update-link' ); $update_link.addClass( 'update-link' );
$update_link.attr( 'href', update_url ); $update_link.attr( 'href', update_url );
$update_link.click(); $update_link.trigger( 'click' );
}); });
$( '#wc_untested_extensions_modal .cancel' ).on( 'click', function( evt ) { $( '#wc_untested_extensions_modal .cancel' ).on( 'click', function( evt ) {

View File

@ -69,7 +69,7 @@ class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
} }
var $checkbox = $( 'input[value="woocommerce/woocommerce.php"]' ); var $checkbox = $( 'input[value="woocommerce/woocommerce.php"]' );
if ( $checkbox.prop( 'checked' ) ) { if ( $checkbox.prop( 'checked' ) ) {
$( '#wc-upgrade-warning' ).click(); $( '#wc-upgrade-warning' ).trigger( 'click' );
} }
} }

View File

@ -343,9 +343,9 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
} ); } );
jQuery( '.section' ).slideUp( 100, function() { jQuery( '.section' ).slideUp( 100, function() {
<?php if ( empty( $this->coupon_codes ) ) : ?> <?php if ( empty( $this->coupon_codes ) ) : ?>
jQuery( '.section_title:eq(1)' ).click(); jQuery( '.section_title:eq(1)' ).trigger( 'click' );
<?php else : ?> <?php else : ?>
jQuery( '.section_title:eq(0)' ).click(); jQuery( '.section_title:eq(0)' ).trigger( 'click' );
<?php endif; ?> <?php endif; ?>
} ); } );
</script> </script>
@ -551,15 +551,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
} }
); );
jQuery('.chart-placeholder').resize(); jQuery('.chart-placeholder').trigger( 'resize' );
} }
drawGraph(); drawGraph();
jQuery('.highlight_series').hover( jQuery('.highlight_series').on( 'mouseenter',
function() { function() {
drawGraph( jQuery(this).data('series') ); drawGraph( jQuery(this).data('series') );
}, } ).on( 'mouseleave',
function() { function() {
drawGraph(); drawGraph();
} }

View File

@ -155,7 +155,7 @@ class WC_Report_Customers extends WC_Admin_Report {
} }
); );
jQuery('.chart-placeholder.customers_vs_guests').resize(); jQuery('.chart-placeholder.customers_vs_guests').trigger( 'resize' );
}); });
</script> </script>
<?php <?php
@ -412,15 +412,15 @@ class WC_Report_Customers extends WC_Admin_Report {
], ],
} }
); );
jQuery('.chart-placeholder').resize(); jQuery('.chart-placeholder').trigger( 'resize' );
} }
drawGraph(); drawGraph();
jQuery('.highlight_series').hover( jQuery('.highlight_series').on( 'mouseenter',
function() { function() {
drawGraph( jQuery(this).data('series') ); drawGraph( jQuery(this).data('series') );
}, } ).on( 'mouseleave',
function() { function() {
drawGraph(); drawGraph();
} }

View File

@ -12,8 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) {
/** /**
* WC_Report_Sales_By_Category * WC_Report_Sales_By_Category
* *
* @author WooThemes
* @category Admin
* @package WooCommerce\Admin\Reports * @package WooCommerce\Admin\Reports
* @version 2.1.0 * @version 2.1.0
*/ */
@ -171,11 +169,11 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
switch ( $this->chart_groupby ) { switch ( $this->chart_groupby ) {
case 'day': case 'day':
$time = strtotime( date( 'Ymd', strtotime( $order_item->post_date ) ) ) * 1000; $time = strtotime( gmdate( 'Ymd', strtotime( $order_item->post_date ) ) ) * 1000;
break; break;
case 'month': case 'month':
default: default:
$time = strtotime( date( 'Ym', strtotime( $order_item->post_date ) ) . '01' ) * 1000; $time = strtotime( gmdate( 'Ym', strtotime( $order_item->post_date ) ) . '01' ) * 1000;
break; break;
} }
@ -244,13 +242,13 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
// Select all/None // Select all/None
jQuery( '.chart-widget' ).on( 'click', '.select_all', function() { jQuery( '.chart-widget' ).on( 'click', '.select_all', function() {
jQuery(this).closest( 'div' ).find( 'select option' ).attr( 'selected', 'selected' ); jQuery(this).closest( 'div' ).find( 'select option' ).attr( 'selected', 'selected' );
jQuery(this).closest( 'div' ).find('select').change(); jQuery(this).closest( 'div' ).find('select').trigger( 'change' );
return false; return false;
}); });
jQuery( '.chart-widget').on( 'click', '.select_none', function() { jQuery( '.chart-widget').on( 'click', '.select_none', function() {
jQuery(this).closest( 'div' ).find( 'select option' ).removeAttr( 'selected' ); jQuery(this).closest( 'div' ).find( 'select option' ).prop( 'selected', false );
jQuery(this).closest( 'div' ).find('select').change(); jQuery(this).closest( 'div' ).find('select').trigger( 'change' );
return false; return false;
}); });
}); });
@ -307,11 +305,11 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
switch ( $this->chart_groupby ) { switch ( $this->chart_groupby ) {
case 'day': case 'day':
$time = strtotime( date( 'Ymd', strtotime( "+{$i} DAY", $this->start_date ) ) ) * 1000; $time = strtotime( gmdate( 'Ymd', strtotime( "+{$i} DAY", $this->start_date ) ) ) * 1000;
break; break;
case 'month': case 'month':
default: default:
$time = strtotime( date( 'Ym', strtotime( "+{$i} MONTH", $this->start_date ) ) . '01' ) * 1000; $time = strtotime( gmdate( 'Ym', strtotime( "+{$i} MONTH", $this->start_date ) ) . '01' ) * 1000;
break; break;
} }
@ -430,16 +428,16 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
} }
); );
jQuery('.chart-placeholder').resize(); jQuery('.chart-placeholder').trigger( 'resize' );
} }
drawGraph(); drawGraph();
jQuery('.highlight_series').hover( jQuery('.highlight_series').on( 'mouseenter',
function() { function() {
drawGraph( jQuery(this).data('series') ); drawGraph( jQuery(this).data('series') );
}, } ).on( 'mouseleave',
function() { function() {
drawGraph(); drawGraph();
} }

View File

@ -849,15 +849,15 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
} }
); );
jQuery('.chart-placeholder').resize(); jQuery('.chart-placeholder').trigger( 'resize' );
} }
drawGraph(); drawGraph();
jQuery('.highlight_series').hover( jQuery('.highlight_series').on( 'mouseenter',
function() { function() {
drawGraph( jQuery(this).data('series') ); drawGraph( jQuery(this).data('series') );
}, } ).on( 'mouseleave',
function() { function() {
drawGraph(); drawGraph();
} }

View File

@ -389,7 +389,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
} ); } );
jQuery( '.section' ).slideUp( 100, function() { jQuery( '.section' ).slideUp( 100, function() {
<?php if ( empty( $this->product_ids ) ) : ?> <?php if ( empty( $this->product_ids ) ) : ?>
jQuery( '.section_title:eq(1)' ).click(); jQuery( '.section_title:eq(1)' ).trigger( 'click' );
<?php endif; ?> <?php endif; ?>
} ); } );
</script> </script>
@ -610,15 +610,15 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
} }
); );
jQuery('.chart-placeholder').resize(); jQuery('.chart-placeholder').trigger( 'resize' );
} }
drawGraph(); drawGraph();
jQuery('.highlight_series').hover( jQuery('.highlight_series').on( 'mouseenter',
function() { function() {
drawGraph( jQuery(this).data('series') ); drawGraph( jQuery(this).data('series') );
}, } ).on( 'mouseleave',
function() { function() {
drawGraph(); drawGraph();
} }

View File

@ -46,12 +46,19 @@ class WC_Settings_Emails extends WC_Settings_Page {
* @return array * @return array
*/ */
public function get_settings() { public function get_settings() {
$desc_help_text = sprintf(
/* translators: %1$s: Link to WP Mail Logging plugin, %2$s: Link to Email FAQ support page. */
__( 'To ensure your store&rsquo;s notifications arrive in your and your customers&rsquo; inboxes, we recommend connecting your email address to your domain and setting up a dedicated SMTP server. If something doesn&rsquo;t seem to be sending correctly, install the <a href="%1$s">WP Mail Logging Plugin</a> or check the <a href="%2$s">Email FAQ page</a>.', 'woocommerce' ),
'https://wordpress.org/plugins/wp-mail-logging/',
'https://docs.woocommerce.com/document/email-faq'
);
$settings = apply_filters( $settings = apply_filters(
'woocommerce_email_settings', 'woocommerce_email_settings',
array( array(
array( array(
'title' => __( 'Email notifications', 'woocommerce' ), 'title' => __( 'Email notifications', 'woocommerce' ),
'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', 'woocommerce' ), /* translators: %s: help description with link to WP Mail logging and support page. */
'desc' => sprintf( __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.<br>%s', 'woocommerce' ), $desc_help_text ),
'type' => 'title', 'type' => 'title',
'id' => 'email_notification_settings', 'id' => 'email_notification_settings',
), ),

View File

@ -81,7 +81,7 @@ class WC_Settings_General extends WC_Settings_Page {
'title' => __( 'Country / State', 'woocommerce' ), 'title' => __( 'Country / State', 'woocommerce' ),
'desc' => __( 'The country and state or province, if any, in which your business is located.', 'woocommerce' ), 'desc' => __( 'The country and state or province, if any, in which your business is located.', 'woocommerce' ),
'id' => 'woocommerce_default_country', 'id' => 'woocommerce_default_country',
'default' => 'GB', 'default' => 'US:CA',
'type' => 'single_select_country', 'type' => 'single_select_country',
'desc_tip' => true, 'desc_tip' => true,
), ),
@ -229,7 +229,7 @@ class WC_Settings_General extends WC_Settings_Page {
'title' => __( 'Currency', 'woocommerce' ), 'title' => __( 'Currency', 'woocommerce' ),
'desc' => __( 'This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce' ), 'desc' => __( 'This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.', 'woocommerce' ),
'id' => 'woocommerce_currency', 'id' => 'woocommerce_currency',
'default' => 'GBP', 'default' => 'USD',
'type' => 'select', 'type' => 'select',
'class' => 'wc-enhanced-select', 'class' => 'wc-enhanced-select',
'desc_tip' => true, 'desc_tip' => true,

View File

@ -63,7 +63,8 @@ if ( ! defined( 'ABSPATH' ) ) {
$topic_data = WC_Admin_Webhooks::get_topic_data( $webhook ); $topic_data = WC_Admin_Webhooks::get_topic_data( $webhook );
$topics = apply_filters( $topics = apply_filters(
'woocommerce_webhook_topics', array( 'woocommerce_webhook_topics',
array(
'' => __( 'Select an option&hellip;', 'woocommerce' ), '' => __( 'Select an option&hellip;', 'woocommerce' ),
'coupon.created' => __( 'Coupon created', 'woocommerce' ), 'coupon.created' => __( 'Coupon created', 'woocommerce' ),
'coupon.updated' => __( 'Coupon updated', 'woocommerce' ), 'coupon.updated' => __( 'Coupon updated', 'woocommerce' ),
@ -197,8 +198,10 @@ if ( ! defined( 'ABSPATH' ) ) {
add_query_arg( add_query_arg(
array( array(
'delete' => $webhook->get_id(), 'delete' => $webhook->get_id(),
), admin_url( 'admin.php?page=wc-settings&tab=advanced&section=webhooks' ) ),
), 'delete-webhook' admin_url( 'admin.php?page=wc-settings&tab=advanced&section=webhooks' )
),
'delete-webhook'
); );
?> ?>
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( $delete_url ); ?>"><?php esc_html_e( 'Delete permanently', 'woocommerce' ); ?></a> <a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( $delete_url ); ?>"><?php esc_html_e( 'Delete permanently', 'woocommerce' ); ?></a>
@ -221,6 +224,6 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( 'action' === current ) { if ( 'action' === current ) {
action_event_field.show(); action_event_field.show();
} }
}).change(); }).trigger( 'change' );
}); });
</script> </script>

View File

@ -56,8 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>" value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>"
placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>"> placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
<input type="hidden" name="page" value="wc-addons"> <input type="hidden" name="page" value="wc-addons">
<?php $page_section = ( isset( $_GET['section'] ) && '_featured' !== $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '_all'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> <input type="hidden" name="section" value="_all">
<input type="hidden" name="section" value="<?php echo esc_attr( $page_section ); ?>">
</form> </form>
<?php if ( '_featured' === $current_section ) : ?> <?php if ( '_featured' === $current_section ) : ?>
<div class="addons-featured"> <div class="addons-featured">

View File

@ -1,8 +1,12 @@
<?php <?php
/** /**
* Admin View: Page - Status Tools * Admin View: Page - Status Tools
*
* @package WooCommerce
*/ */
use Automattic\WooCommerce\Utilities\ArrayUtil;
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -12,14 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php settings_fields( 'woocommerce_status_settings_fields' ); ?> <?php settings_fields( 'woocommerce_status_settings_fields' ); ?>
<table class="wc_status_table wc_status_table--tools widefat" cellspacing="0"> <table class="wc_status_table wc_status_table--tools widefat" cellspacing="0">
<tbody class="tools"> <tbody class="tools">
<?php foreach ( $tools as $action => $tool ) : ?> <?php foreach ( $tools as $action_name => $tool ) : ?>
<tr class="<?php echo sanitize_html_class( $action ); ?>"> <tr class="<?php echo sanitize_html_class( $action_name ); ?>">
<th> <th>
<strong class="name"><?php echo esc_html( $tool['name'] ); ?></strong> <strong class="name"><?php echo esc_html( $tool['name'] ); ?></strong>
<p class="description"><?php echo wp_kses_post( $tool['desc'] ); ?></p> <p class="description"><?php echo wp_kses_post( $tool['desc'] ); ?></p>
</th> </th>
<td class="run-tool"> <td class="run-tool">
<a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=' . $action ), 'debug_action' ); ?>" class="button button-large <?php echo esc_attr( $action ); ?>"><?php echo esc_html( $tool['button'] ); ?></a> <a <?php echo ArrayUtil::is_truthy( $tool, 'disabled' ) ? 'disabled' : ''; ?> href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=' . $action_name ), 'debug_action' ) ); ?>" class="button button-large <?php echo esc_attr( $action_name ); ?>"><?php echo esc_html( $tool['button'] ); ?></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -810,7 +810,7 @@ class WC_AJAX {
if ( ! empty( $files ) ) { if ( ! empty( $files ) ) {
foreach ( $files as $download_id => $file ) { foreach ( $files as $download_id => $file ) {
$inserted_id = wc_downloadable_file_permission( $download_id, $product_id, $order, $item->get_quantity(), $item ); $inserted_id = wc_downloadable_file_permission( $download_id, $product->get_id(), $order, $item->get_quantity(), $item );
if ( $inserted_id ) { if ( $inserted_id ) {
$download = new WC_Customer_Download( $inserted_id ); $download = new WC_Customer_Download( $inserted_id );
$loop ++; $loop ++;

View File

@ -750,8 +750,9 @@ final class WC_Cart_Totals {
$items_subtotal = $this->get_rounded_items_total( $this->get_values_for_total( 'subtotal' ) ); $items_subtotal = $this->get_rounded_items_total( $this->get_values_for_total( 'subtotal' ) );
$this->set_total( 'items_subtotal', NumberUtil::round( $items_subtotal ) ); // Prices are not rounded here because they should already be rounded based on settings in `get_rounded_items_total` and in `round_line_tax` method calls.
$this->set_total( 'items_subtotal_tax', wc_round_tax_total( array_sum( $merged_subtotal_taxes ), 0 ) ); $this->set_total( 'items_subtotal', $items_subtotal );
$this->set_total( 'items_subtotal_tax', array_sum( $merged_subtotal_taxes ), 0 );
$this->cart->set_subtotal( $this->get_total( 'items_subtotal' ) ); $this->cart->set_subtotal( $this->get_total( 'items_subtotal' ) );
$this->cart->set_subtotal_tax( $this->get_total( 'items_subtotal_tax' ) ); $this->cart->set_subtotal_tax( $this->get_total( 'items_subtotal_tax' ) );
@ -788,7 +789,7 @@ final class WC_Cart_Totals {
if ( $item->product->is_taxable() ) { if ( $item->product->is_taxable() ) {
// Item subtotals were sent, so set 3rd param. // Item subtotals were sent, so set 3rd param.
$item_tax = wc_round_tax_total( array_sum( WC_Tax::calc_tax( $coupon_discount, $item->tax_rates, $item->price_includes_tax ) ), 0 ); $item_tax = array_sum( WC_Tax::calc_tax( $coupon_discount, $item->tax_rates, $item->price_includes_tax ) );
// Sum total tax. // Sum total tax.
$coupon_discount_tax_amounts[ $coupon_code ] += $item_tax; $coupon_discount_tax_amounts[ $coupon_code ] += $item_tax;
@ -862,7 +863,10 @@ final class WC_Cart_Totals {
*/ */
protected function calculate_totals() { protected function calculate_totals() {
$this->set_total( 'total', NumberUtil::round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) ); $this->set_total( 'total', NumberUtil::round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) );
$this->cart->set_total_tax( array_sum( $this->get_merged_taxes( false ) ) ); $items_tax = array_sum( $this->get_merged_taxes( false, array( 'items' ) ) );
// Shipping and fee taxes are rounded seperately because they were entered excluding taxes (as opposed to item prices, which may or may not be including taxes depending upon settings).
$shipping_and_fee_taxes = NumberUtil::round( array_sum( $this->get_merged_taxes( false, array( 'fees', 'shipping' ) ) ), wc_get_price_decimals() );
$this->cart->set_total_tax( $items_tax + $shipping_and_fee_taxes );
// Allow plugins to hook and alter totals before final total is calculated. // Allow plugins to hook and alter totals before final total is calculated.
if ( has_action( 'woocommerce_calculate_totals' ) ) { if ( has_action( 'woocommerce_calculate_totals' ) ) {

View File

@ -430,7 +430,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set. * @param string $value Value to set.
*/ */
public function set_subtotal( $value ) { public function set_subtotal( $value ) {
$this->totals['subtotal'] = wc_format_decimal( $value, wc_get_price_decimals() ); $this->totals['subtotal'] = wc_format_decimal( $value );
} }
/** /**
@ -470,7 +470,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set. * @param string $value Value to set.
*/ */
public function set_shipping_total( $value ) { public function set_shipping_total( $value ) {
$this->totals['shipping_total'] = wc_format_decimal( $value, wc_get_price_decimals() ); $this->totals['shipping_total'] = wc_format_decimal( $value );
} }
/** /**
@ -490,7 +490,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set. * @param string $value Value to set.
*/ */
public function set_cart_contents_total( $value ) { public function set_cart_contents_total( $value ) {
$this->totals['cart_contents_total'] = wc_format_decimal( $value, wc_get_price_decimals() ); $this->totals['cart_contents_total'] = wc_format_decimal( $value );
} }
/** /**
@ -531,7 +531,7 @@ class WC_Cart extends WC_Legacy_Cart {
* @param string $value Value to set. * @param string $value Value to set.
*/ */
public function set_fee_total( $value ) { public function set_fee_total( $value ) {
$this->totals['fee_total'] = wc_format_decimal( $value, wc_get_price_decimals() ); $this->totals['fee_total'] = wc_format_decimal( $value );
} }
/** /**
@ -1218,15 +1218,30 @@ class WC_Cart extends WC_Legacy_Cart {
$products_qty_in_cart = $this->get_cart_item_quantities(); $products_qty_in_cart = $this->get_cart_item_quantities();
if ( isset( $products_qty_in_cart[ $product_data->get_stock_managed_by_id() ] ) && ! $product_data->has_enough_stock( $products_qty_in_cart[ $product_data->get_stock_managed_by_id() ] + $quantity ) ) { if ( isset( $products_qty_in_cart[ $product_data->get_stock_managed_by_id() ] ) && ! $product_data->has_enough_stock( $products_qty_in_cart[ $product_data->get_stock_managed_by_id() ] + $quantity ) ) {
throw new Exception( $stock_quantity = $product_data->get_stock_quantity();
sprintf( $stock_quantity_in_cart = $products_qty_in_cart[ $product_data->get_stock_managed_by_id() ];
$message = sprintf(
'<a href="%s" class="button wc-forward">%s</a> %s', '<a href="%s" class="button wc-forward">%s</a> %s',
wc_get_cart_url(), wc_get_cart_url(),
__( 'View cart', 'woocommerce' ), __( 'View cart', 'woocommerce' ),
/* translators: 1: quantity in stock 2: current quantity */ /* translators: 1: quantity in stock 2: current quantity */
sprintf( __( 'You cannot add that amount to the cart &mdash; we have %1$s in stock and you already have %2$s in your cart.', 'woocommerce' ), wc_format_stock_quantity_for_display( $product_data->get_stock_quantity(), $product_data ), wc_format_stock_quantity_for_display( $products_qty_in_cart[ $product_data->get_stock_managed_by_id() ], $product_data ) ) sprintf( __( 'You cannot add that amount to the cart &mdash; we have %1$s in stock and you already have %2$s in your cart.', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_quantity, $product_data ), wc_format_stock_quantity_for_display( $stock_quantity_in_cart, $product_data ) )
)
); );
/**
* Filters message about product not having enough stock accounting for what's already in the cart.
*
* @param string $message Message.
* @param WC_Product $product_data Product data.
* @param int $stock_quantity Quantity remaining.
* @param int $stock_quantity_in_cart
*
* @since 5.3.0
*/
$message = apply_filters( 'woocommerce_cart_product_not_enough_stock_already_in_cart_message', $message, $product_data, $stock_quantity, $stock_quantity_in_cart );
throw new Exception( $message );
} }
} }

View File

@ -747,7 +747,7 @@ class WC_Checkout {
$field_label = isset( $field['label'] ) ? $field['label'] : ''; $field_label = isset( $field['label'] ) ? $field['label'] : '';
if ( $validate_fieldset && if ( $validate_fieldset &&
( isset( $field['type'] ) && 'country' === $field['type'] ) && ( isset( $field['type'] ) && 'country' === $field['type'] && '' !== $data[ $key ] ) &&
! WC()->countries->country_exists( $data[ $key ] ) ) { ! WC()->countries->country_exists( $data[ $key ] ) ) {
/* translators: ISO 3166-1 alpha-2 country code */ /* translators: ISO 3166-1 alpha-2 country code */
$errors->add( $key . '_validation', sprintf( __( "'%s' is not a valid country code.", 'woocommerce' ), $data[ $key ] ) ); $errors->add( $key . '_validation', sprintf( __( "'%s' is not a valid country code.", 'woocommerce' ), $data[ $key ] ) );

View File

@ -242,6 +242,27 @@ class WC_Customer extends WC_Legacy_Customer {
return $this->get_calculated_shipping(); return $this->get_calculated_shipping();
} }
/**
* Indicates if the customer has a non-empty shipping address.
*
* Note that this does not indicate if the customer's shipping address
* is complete, only that one or more fields are populated.
*
* @since 5.3.0
*
* @return bool
*/
public function has_shipping_address() {
foreach ( $this->get_shipping() as $address_field ) {
// Trim guards against a case where a subset of saved shipping address fields contain whitespace.
if ( strlen( trim( $address_field ) ) > 0 ) {
return true;
}
}
return false;
}
/** /**
* Get if customer is VAT exempt? * Get if customer is VAT exempt?
* *
@ -449,7 +470,19 @@ class WC_Customer extends WC_Legacy_Customer {
* @return array * @return array
*/ */
public function get_billing( $context = 'view' ) { public function get_billing( $context = 'view' ) {
return $this->get_prop( 'billing', $context ); $value = null;
$prop = 'billing';
if ( array_key_exists( $prop, $this->data ) ) {
$changes = array_key_exists( $prop, $this->changes ) ? $this->changes[ $prop ] : array();
$value = array_merge( $this->data[ $prop ], $changes );
if ( 'view' === $context ) {
$value = apply_filters( $this->get_hook_prefix() . $prop, $value, $this );
}
}
return $value;
} }
/** /**
@ -580,7 +613,19 @@ class WC_Customer extends WC_Legacy_Customer {
* @return array * @return array
*/ */
public function get_shipping( $context = 'view' ) { public function get_shipping( $context = 'view' ) {
return $this->get_prop( 'shipping', $context ); $value = null;
$prop = 'shipping';
if ( array_key_exists( $prop, $this->data ) ) {
$changes = array_key_exists( $prop, $this->changes ) ? $this->changes[ $prop ] : array();
$value = array_merge( $this->data[ $prop ], $changes );
if ( 'view' === $context ) {
$value = apply_filters( $this->get_hook_prefix() . $prop, $value, $this );
}
}
return $value;
} }
/** /**

View File

@ -224,7 +224,7 @@ class WC_Frontend_Scripts {
'selectWoo' => array( 'selectWoo' => array(
'src' => self::get_asset_url( 'assets/js/selectWoo/selectWoo.full' . $suffix . '.js' ), 'src' => self::get_asset_url( 'assets/js/selectWoo/selectWoo.full' . $suffix . '.js' ),
'deps' => array( 'jquery' ), 'deps' => array( 'jquery' ),
'version' => '1.0.6', 'version' => '1.0.9',
), ),
'wc-address-i18n' => array( 'wc-address-i18n' => array(
'src' => self::get_asset_url( 'assets/js/frontend/address-i18n' . $suffix . '.js' ), 'src' => self::get_asset_url( 'assets/js/frontend/address-i18n' . $suffix . '.js' ),

View File

@ -139,14 +139,26 @@ class WC_Logger implements WC_Logger_Interface {
} }
if ( $this->should_handle( $level ) ) { if ( $this->should_handle( $level ) ) {
$timestamp = current_time( 'timestamp', 1 ); $timestamp = time();
$message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context );
foreach ( $this->handlers as $handler ) { foreach ( $this->handlers as $handler ) {
/**
* Filter the logging message. Returning null will prevent logging from occuring since 5.3.
*
* @since 3.1
* @param string $message Log message.
* @param string $level One of: emergency, alert, critical, error, warning, notice, info, or debug.
* @param array $context Additional information for log handlers.
* @param object $handler The handler object, such as WC_Log_Handler_File. Available since 5.3.
*/
$message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context, $handler );
if ( null !== $message ) {
$handler->handle( $timestamp, $level, $message, $context ); $handler->handle( $timestamp, $level, $message, $context );
} }
} }
} }
}
/** /**
* Adds an emergency level message. * Adds an emergency level message.

View File

@ -179,7 +179,7 @@ class WC_Order extends WC_Abstract_Order {
} }
if ( $total_refunded && $display_refunded ) { if ( $total_refunded && $display_refunded ) {
$formatted_total = '<del>' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_currency() ) ) . $tax_string . '</ins>'; $formatted_total = '<del aria-hidden="true">' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $this->get_currency() ) ) . $tax_string . '</ins>';
} else { } else {
$formatted_total .= $tax_string; $formatted_total .= $tax_string;
} }

View File

@ -82,7 +82,13 @@ class WC_Tax {
* @return array * @return array
*/ */
public static function calc_shipping_tax( $price, $rates ) { public static function calc_shipping_tax( $price, $rates ) {
// Backwards compatible from WC_Shipping_Rate::get_cost().
if ( has_filter( 'woocommerce_shipping_rate_cost' ) ) {
$rate = new WC_Shipping_Rate();
$price = $rate->get_cost();
}
$taxes = self::calc_exclusive_tax( $price, $rates ); $taxes = self::calc_exclusive_tax( $price, $rates );
return apply_filters( 'woocommerce_calc_shipping_tax', $taxes, $price, $rates ); return apply_filters( 'woocommerce_calc_shipping_tax', $taxes, $price, $rates );
} }

View File

@ -139,7 +139,7 @@ class WC_Template_Loader {
if ( 0 === $validated_file ) { if ( 0 === $validated_file ) {
$templates[] = $page_template; $templates[] = $page_template;
} else { } else {
error_log( "WooCommerce: Unable to validate template path: \"$page_template\". Error Code: $validated_file." ); error_log( "WooCommerce: Unable to validate template path: \"$page_template\". Error Code: $validated_file." ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
} }
} }
} }
@ -294,8 +294,8 @@ class WC_Template_Loader {
} }
// Description handling. // Description handling.
if ( ! empty( $queried_object->description ) && ( empty( $_GET['product-page'] ) || 1 === absint( $_GET['product-page'] ) ) ) { // WPCS: input var ok, CSRF ok. if ( ! empty( $queried_object->description ) && ( empty( $_GET['product-page'] ) || 1 === absint( $_GET['product-page'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$prefix = '<div class="term-description">' . wc_format_content( $queried_object->description ) . '</div>'; // WPCS: XSS ok. $prefix = '<div class="term-description">' . wc_format_content( wp_kses_post( $queried_object->description ) ) . '</div>';
} else { } else {
$prefix = ''; $prefix = '';
} }

View File

@ -355,122 +355,170 @@ class WC_Tracker {
} }
/** /**
* Get all order data. * Get order counts.
*
* @return array
*/
private static function get_order_counts() {
$order_count = array();
$order_count_data = wp_count_posts( 'shop_order' );
foreach ( wc_get_order_statuses() as $status_slug => $status_name ) {
$order_count[ $status_slug ] = $order_count_data->{ $status_slug };
}
return $order_count;
}
/**
* Combine all order data.
* *
* @return array * @return array
*/ */
private static function get_orders() { private static function get_orders() {
$args = array( $order_dates = self::get_order_dates();
'type' => array( 'shop_order', 'shop_order_refund' ), $order_counts = self::get_order_counts();
'limit' => get_option( 'posts_per_page' ), $order_totals = self::get_order_totals();
'paged' => 1, $order_gateways = self::get_orders_by_gateway();
return array_merge( $order_dates, $order_counts, $order_totals, $order_gateways );
}
/**
* Get order totals.
*
* @since 5.4.0
* @return array
*/
private static function get_order_totals() {
global $wpdb;
$gross_total = $wpdb->get_var(
"
SELECT
SUM( order_meta.meta_value ) AS 'gross_total'
FROM {$wpdb->prefix}posts AS orders
LEFT JOIN {$wpdb->prefix}postmeta AS order_meta ON order_meta.post_id = orders.ID
WHERE order_meta.meta_key = '_order_total'
AND orders.post_status in ( 'wc-completed', 'wc-refunded' )
GROUP BY order_meta.meta_key
"
); );
$first = time(); if ( is_null( $gross_total ) ) {
$processing_first = $first; $gross_total = 0;
$first_time = $first;
$last = 0;
$processing_last = 0;
$order_data = array();
$orders = wc_get_orders( $args );
$orders_count = count( $orders );
while ( $orders_count ) {
foreach ( $orders as $order ) {
$date_created = (int) $order->get_date_created()->getTimestamp();
$type = $order->get_type();
$status = $order->get_status();
if ( 'shop_order' == $type ) {
// Find the first and last order dates for completed and processing statuses.
if ( 'completed' == $status && $date_created < $first ) {
$first = $date_created;
}
if ( 'completed' == $status && $date_created > $last ) {
$last = $date_created;
}
if ( 'processing' == $status && $date_created < $processing_first ) {
$processing_first = $date_created;
}
if ( 'processing' == $status && $date_created > $processing_last ) {
$processing_last = $date_created;
} }
// Get order counts by status. $processing_gross_total = $wpdb->get_var(
$status = 'wc-' . $status; "
SELECT
SUM( order_meta.meta_value ) AS 'gross_total'
FROM {$wpdb->prefix}posts AS orders
LEFT JOIN {$wpdb->prefix}postmeta AS order_meta ON order_meta.post_id = orders.ID
WHERE order_meta.meta_key = '_order_total'
AND orders.post_status = 'wc-processing'
GROUP BY order_meta.meta_key
"
);
if ( ! isset( $order_data[ $status ] ) ) { if ( is_null( $processing_gross_total ) ) {
$order_data[ $status ] = 1; $processing_gross_total = 0;
} else {
$order_data[ $status ] += 1;
} }
// Count number of orders by gateway used. return array(
$gateway = $order->get_payment_method(); 'gross' => $gross_total,
'processing_gross' => $processing_gross_total,
if ( ! empty( $gateway ) && in_array( $status, array( 'wc-completed', 'wc-refunded', 'wc-processing' ) ) ) { );
$gateway = 'gateway_' . $gateway;
if ( ! isset( $order_data[ $gateway ] ) ) {
$order_data[ $gateway ] = 1;
} else {
$order_data[ $gateway ] += 1;
}
}
} else {
// If it is a refunded order (shop_order_refunnd type), add the prefix as this prefix gets
// added midway in the if clause.
$status = 'wc-' . $status;
} }
// Calculate the gross total for 'completed' and 'processing' orders. /**
$total = $order->get_total(); * Get last order date.
*
* @return string
*/
private static function get_order_dates() {
global $wpdb;
if ( in_array( $status, array( 'wc-completed', 'wc-refunded' ) ) ) { $min_max = $wpdb->get_row(
if ( ! isset( $order_data['gross'] ) ) { "
$order_data['gross'] = $total; SELECT
} else { MIN( post_date_gmt ) as 'first', MAX( post_date_gmt ) as 'last'
$order_data['gross'] += $total; FROM {$wpdb->prefix}posts
} WHERE post_type = 'shop_order'
} elseif ( 'wc-processing' == $status ) { AND post_status = 'wc-completed'
if ( ! isset( $order_data['processing_gross'] ) ) { ",
$order_data['processing_gross'] = $total; ARRAY_A
} else { );
$order_data['processing_gross'] += $total;
}
}
}
$args['paged']++;
$orders = wc_get_orders( $args ); if ( is_null( $min_max ) ) {
$orders_count = count( $orders ); $min_max = array(
'first' => '-',
'last' => '-',
);
} }
if ( $first !== $first_time ) { $processing_min_max = $wpdb->get_row(
$order_data['first'] = gmdate( 'Y-m-d H:i:s', $first ); "
SELECT
MIN( post_date_gmt ) as 'processing_first', MAX( post_date_gmt ) as 'processing_last'
FROM {$wpdb->prefix}posts
WHERE post_type = 'shop_order'
AND post_status = 'wc-processing'
",
ARRAY_A
);
if ( is_null( $processing_min_max ) ) {
$processing_min_max = array(
'processing_first' => '-',
'processing_last' => '-',
);
} }
if ( $processing_first !== $first_time ) { return array_merge( $min_max, $processing_min_max );
$order_data['processing_first'] = gmdate( 'Y-m-d H:i:s', $processing_first );
} }
if ( $last ) { /**
$order_data['last'] = gmdate( 'Y-m-d H:i:s', $last ); * Get order details by gateway.
*
* @return array
*/
private static function get_orders_by_gateway() {
global $wpdb;
$orders_by_gateway = $wpdb->get_results(
"
SELECT
gateway, currency, SUM(total) AS totals, COUNT(order_id) AS counts
FROM (
SELECT
orders.id AS order_id,
MAX(CASE WHEN meta_key = '_payment_method' THEN meta_value END) gateway,
MAX(CASE WHEN meta_key = '_order_total' THEN meta_value END) total,
MAX(CASE WHEN meta_key = '_order_currency' THEN meta_value END) currency
FROM
{$wpdb->prefix}posts orders
LEFT JOIN
{$wpdb->prefix}postmeta order_meta ON order_meta.post_id = orders.id
WHERE orders.post_type = 'shop_order'
AND orders.post_status in ( 'wc-completed', 'wc-processing', 'wc-refunded' )
AND meta_key in( '_payment_method','_order_total','_order_currency')
GROUP BY orders.id
) order_gateways
GROUP BY gateway, currency
"
);
$orders_by_gateway_currency = array();
foreach ( $orders_by_gateway as $orders_details ) {
$gateway = 'gateway_' . $orders_details->gateway;
$currency = $orders_details->currency;
$count = $gateway . '_' . $currency . '_count';
$total = $gateway . '_' . $currency . '_total';
$orders_by_gateway_currency[ $count ] = $orders_details->counts;
$orders_by_gateway_currency[ $total ] = $orders_details->totals;
} }
if ( $processing_last ) { return $orders_by_gateway_currency;
$order_data['processing_last'] = gmdate( 'Y-m-d H:i:s', $processing_last );
}
foreach ( $order_data as $key => $value ) {
$order_data[ $key ] = (string) $value;
}
return $order_data;
} }
/** /**
@ -635,17 +683,6 @@ class WC_Tracker {
return array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) ); return array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) );
} }
/**
* Get order totals
*
* @deprecated 5.1.0 Logic moved to get_orders.
* @return array
*/
public static function get_order_totals() {
wc_deprecated_function( 'WC_Tracker::get_order_totals', '5.1.0', '' );
return self::get_orders();
}
/** /**
* Search a specific post for text content. * Search a specific post for text content.
* *

View File

@ -9,6 +9,8 @@
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster; use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster;
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
use Automattic\WooCommerce\Proxies\LegacyProxy; use Automattic\WooCommerce\Proxies\LegacyProxy;
/** /**
@ -206,6 +208,8 @@ final class WooCommerce {
// These classes set up hooks on instantiation. // These classes set up hooks on instantiation.
wc_get_container()->get( DownloadPermissionsAdjuster::class ); wc_get_container()->get( DownloadPermissionsAdjuster::class );
wc_get_container()->get( AssignDefaultCategory::class );
wc_get_container()->get( DataRegenerator::class );
} }
/** /**

View File

@ -6,6 +6,8 @@
* @package WooCommerce * @package WooCommerce
*/ */
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
@ -13,10 +15,19 @@ defined( 'ABSPATH' ) || exit;
*/ */
class WC_Shop_Customizer { class WC_Shop_Customizer {
/**
* Holds the instance of ThemeSupport to use.
*
* @var ThemeSupport $theme_support The instance of ThemeSupport to use.
*/
private $theme_support;
/** /**
* Constructor. * Constructor.
*/ */
public function __construct() { public function __construct() {
$this->theme_support = wc_get_container()->get( ThemeSupport::class );
add_action( 'customize_register', array( $this, 'add_sections' ) ); add_action( 'customize_register', array( $this, 'add_sections' ) );
add_action( 'customize_controls_print_styles', array( $this, 'add_styles' ) ); add_action( 'customize_controls_print_styles', array( $this, 'add_styles' ) );
add_action( 'customize_controls_print_scripts', array( $this, 'add_scripts' ), 30 ); add_action( 'customize_controls_print_scripts', array( $this, 'add_scripts' ), 30 );
@ -117,7 +128,7 @@ class WC_Shop_Customizer {
} ); } );
wp.customize.bind( 'ready', function() { // Ready? wp.customize.bind( 'ready', function() { // Ready?
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).change(); $( '.woocommerce-cropping-control' ).find( 'input:checked' ).trigger( 'change' );
} ); } );
wp.customize( 'woocommerce_demo_store', function( setting ) { wp.customize( 'woocommerce_demo_store', function( setting ) {
@ -545,11 +556,11 @@ class WC_Shop_Customizer {
) )
); );
if ( ! wc_get_theme_support( 'single_image_width' ) ) { if ( ! $this->theme_support->has_option( 'single_image_width', false ) ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'woocommerce_single_image_width', 'woocommerce_single_image_width',
array( array(
'default' => 600, 'default' => $this->theme_support->get_option( 'single_image_width', 600 ),
'type' => 'option', 'type' => 'option',
'capability' => 'manage_woocommerce', 'capability' => 'manage_woocommerce',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -573,11 +584,11 @@ class WC_Shop_Customizer {
); );
} }
if ( ! wc_get_theme_support( 'thumbnail_image_width' ) ) { if ( ! $this->theme_support->has_option( 'thumbnail_image_width', false ) ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'woocommerce_thumbnail_image_width', 'woocommerce_thumbnail_image_width',
array( array(
'default' => 300, 'default' => $this->theme_support->get_option( 'thumbnail_image_width', 300 ),
'type' => 'option', 'type' => 'option',
'capability' => 'manage_woocommerce', 'capability' => 'manage_woocommerce',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',

View File

@ -126,12 +126,13 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
protected function set_defaults( &$customer ) { protected function set_defaults( &$customer ) {
try { try {
$default = wc_get_customer_default_location(); $default = wc_get_customer_default_location();
$has_shipping_address = $customer->has_shipping_address();
if ( ! $customer->get_billing_country() ) { if ( ! $customer->get_billing_country() ) {
$customer->set_billing_country( $default['country'] ); $customer->set_billing_country( $default['country'] );
} }
if ( ! $customer->get_shipping_country() ) { if ( ! $customer->get_shipping_country() && ! $has_shipping_address ) {
$customer->set_shipping_country( $customer->get_billing_country() ); $customer->set_shipping_country( $customer->get_billing_country() );
} }
@ -139,7 +140,7 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
$customer->set_billing_state( $default['state'] ); $customer->set_billing_state( $default['state'] );
} }
if ( ! $customer->get_shipping_state() ) { if ( ! $customer->get_shipping_state() && ! $has_shipping_address ) {
$customer->set_shipping_state( $customer->get_billing_state() ); $customer->set_shipping_state( $customer->get_billing_state() );
} }

View File

@ -600,7 +600,8 @@ class WC_Email extends WC_Settings_API {
* @return string * @return string
*/ */
public function get_content_plain() { public function get_content_plain() {
return ''; } return '';
}
/** /**
* Get the email content in HTML format. * Get the email content in HTML format.
@ -608,7 +609,8 @@ class WC_Email extends WC_Settings_API {
* @return string * @return string
*/ */
public function get_content_html() { public function get_content_html() {
return ''; } return '';
}
/** /**
* Get the from name for outgoing emails. * Get the from name for outgoing emails.
@ -1029,7 +1031,7 @@ class WC_Email extends WC_Settings_API {
<?php <?php
wc_enqueue_js( wc_enqueue_js(
"jQuery( 'select.email_type' ).change( function() { "jQuery( 'select.email_type' ).on( 'change', function() {
var val = jQuery( this ).val(); var val = jQuery( this ).val();
@ -1043,7 +1045,7 @@ class WC_Email extends WC_Settings_API {
jQuery('.template_plain').hide(); jQuery('.template_plain').hide();
} }
}).change(); }).trigger( 'change' );
var view = '" . esc_js( __( 'View template', 'woocommerce' ) ) . "'; var view = '" . esc_js( __( 'View template', 'woocommerce' ) ) . "';
var hide = '" . esc_js( __( 'Hide template', 'woocommerce' ) ) . "'; var hide = '" . esc_js( __( 'Hide template', 'woocommerce' ) ) . "';
@ -1067,7 +1069,7 @@ class WC_Email extends WC_Settings_API {
return false; return false;
}); });
jQuery( '.editor textarea' ).change( function() { jQuery( '.editor textarea' ).on( 'change', function() {
var name = jQuery( this ).attr( 'data-name' ); var name = jQuery( this ).attr( 'data-name' );
if ( name ) { if ( name ) {

Some files were not shown because too many files have changed in this diff Show More