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'
on:
schedule:
- cron: '0 21 * * *'
- cron: '21 0 * * *'
jobs:
stale:
@ -15,6 +15,6 @@ jobs:
days-before-issue-stale: 7
days-before-issue-close: 7
days-before-pr-close: -1
only-issue-label: 'needs feedback'
only-issue-labels: 'needs feedback'
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*
.idea
.vscode
.eslintcache
*.sublime-project
*.sublime-workspace
.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 {
margin-left: 0;
margin-right: 0;
@ -364,6 +401,12 @@
color: #fff;
}
.addons-button-expandable {
display: inline-block;
padding: 0 16px;
width: auto;
}
.addons-button-solid:hover {
color: #fff;
opacity: 0.8;
@ -2642,6 +2685,30 @@ ul.wc_coupon_list_block {
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 {

View File

@ -53,7 +53,7 @@
.on( 'click', css_class, function( evt ) {
evt.preventDefault();
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 );
} else {
$( '#copy-error' ).text( '' );
@ -69,10 +69,10 @@
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
} ).focus();
} ).trigger( 'focus' );
} )
.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 );
} );
},

View File

@ -72,7 +72,7 @@
_.bindAll( this, 'render' );
this.render();
$( window ).resize(function() {
$( window ).on( 'resize', function() {
view.resizeContent();
});
},
@ -88,7 +88,7 @@
}).append( this.$el );
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' );

View File

@ -61,7 +61,7 @@ jQuery(function( $ ) {
);
}
$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' );
}
};

View File

@ -22,7 +22,7 @@ jQuery( function ( $ ) {
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 ] );
$( document.body ).on( 'change', 'select.js_field-state', this.change_state );
$( '#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 );
$address.hide();
$this.parent().find( 'a' ).toggle();
$this.parent().find( 'a' ).trigger( 'toggle' );
if ( ! $country_input.val() ) {
$country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' );
@ -1470,7 +1470,7 @@ jQuery( function ( $ ) {
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
}).focus();
}).trigger( 'focus' );
},
/**
@ -1483,7 +1483,7 @@ jQuery( function ( $ ) {
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
}).focus();
}).trigger( 'focus' );
}
};

View File

@ -594,7 +594,7 @@ jQuery( function( $ ) {
$( '.woocommerce-notice-invalid-variation' ).remove();
$( '#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 );
wc_meta_boxes_product_variations_ajax.unblock();
});
@ -700,7 +700,7 @@ jQuery( function( $ ) {
.closest( '.woocommerce_variation' )
.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' );
},
@ -714,7 +714,7 @@ jQuery( function( $ ) {
.find( '.woocommerce_variation:first' )
.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' );
},

View File

@ -34,17 +34,23 @@ jQuery( function( $ ) {
}
$( function() {
// Prevent inputs in meta box headings opening/closing contents.
$( '#woocommerce-product-data' ).find( '.hndle' ).unbind( 'click.postboxes' );
var woocommerce_product_data = $( '#woocommerce-product-data' );
$( '#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 ( $( event.target ).filter( 'input, option, label, select' ).length ) {
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_featured = $( '#current_featured' ).val();
$( 'input[name=_visibility]' ).removeAttr( 'checked' );
$( 'input[name=_visibility]' ).prop( 'checked', false );
$( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' );
var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' );
@ -86,7 +92,7 @@ jQuery( function( $ ) {
label = label + ', ' + woocommerce_admin_meta_boxes.featured_label;
$( 'input[name=_featured]' ).attr( 'checked', 'checked' );
} else {
$( 'input[name=_featured]' ).removeAttr( 'checked' );
$( 'input[name=_featured]' ).prop( 'checked', false );
}
$( '#catalog-visibility-display' ).text( label );
@ -94,7 +100,7 @@ jQuery( function( $ ) {
});
// Product type specific options.
$( 'select#product-type' ).change( function() {
$( 'select#product-type' ).on( 'change', function() {
// Get value.
var select_val = $( this ).val();
@ -102,13 +108,13 @@ jQuery( function( $ ) {
if ( 'variable' === select_val ) {
$( 'input#_manage_stock' ).trigger( 'change' );
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
$( 'input#_virtual' ).prop( 'checked', false );
} else if ( 'grouped' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
$( 'input#_virtual' ).prop( 'checked', false );
} else if ( 'external' === select_val ) {
$( 'input#_downloadable' ).prop( 'checked', false );
$( 'input#_virtual' ).removeAttr( 'checked' );
$( 'input#_virtual' ).prop( 'checked', false );
}
show_and_hide_panels();
@ -119,7 +125,7 @@ jQuery( function( $ ) {
}).trigger( 'change' );
$( 'input#_downloadable, input#_virtual' ).change( function() {
$( 'input#_downloadable, input#_virtual' ).on( 'change', function() {
show_and_hide_panels();
});
@ -239,7 +245,7 @@ jQuery( function( $ ) {
});
// Stock options.
$( 'input#_manage_stock' ).change( function() {
$( 'input#_manage_stock' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( 'div.stock_fields' ).show();
$( 'p.stock_status_field' ).hide();
@ -361,7 +367,7 @@ jQuery( 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' );
return false;
});
@ -373,7 +379,7 @@ jQuery( function( $ ) {
if ( $parent.is( '.taxonomy' ) ) {
$parent.find( 'select, input[type=text]' ).val( '' );
$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 {
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();

View File

@ -17,7 +17,19 @@ jQuery( function ( $ ) {
runTipTip();
$( '.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

View File

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

View File

@ -167,7 +167,7 @@
// 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)
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' ) );
});

View File

@ -2,7 +2,7 @@
( function( $, params, wp ) {
$( function() {
// Sell Countries
$( 'select#woocommerce_allowed_countries' ).change( function() {
$( 'select#woocommerce_allowed_countries' ).on( 'change', function() {
if ( 'specific' === $( this ).val() ) {
$( this ).closest('tr').next( 'tr' ).hide();
$( this ).closest('tr').next().next( 'tr' ).show();
@ -16,7 +16,7 @@
}).trigger( 'change' );
// Ship Countries
$( 'select#woocommerce_ship_to_countries' ).change( function() {
$( 'select#woocommerce_ship_to_countries' ).on( 'change', function() {
if ( 'specific' === $( this ).val() ) {
$( this ).closest('tr').next( 'tr' ).show();
} else {
@ -25,7 +25,7 @@
}).trigger( 'change' );
// Stock management
$( 'input#woocommerce_manage_stock' ).change( function() {
$( 'input#woocommerce_manage_stock' ).on( 'change', function() {
if ( $( this ).is(':checked') ) {
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show();
} else {
@ -48,15 +48,15 @@
event.stopPropagation();
$( '.iris-picker' ).hide();
$( this ).closest( 'td' ).find( '.iris-picker' ).show();
$( this ).data( 'original-value', $( this ).val() );
$( this ).data( 'originalValue', $( this ).val() );
})
.on( 'change', function() {
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})$/ ) ) {
$( this ).val( $( this ).data( 'original-value' ) ).trigger( 'change' );
$( this ).val( $( this ).data( 'originalValue' ) ).trigger( 'change' );
} else {
$( this ).val( '' ).trigger( 'change' );
}
@ -71,7 +71,7 @@
$( function() {
var changed = false;
$( 'input, textarea, select, checkbox' ).change( function() {
$( 'input, textarea, select, checkbox' ).on( 'change', function() {
if ( ! changed ) {
window.onbeforeunload = function() {
return params.i18n_nav_warning;
@ -116,7 +116,7 @@
});
$( '.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' );
return false;
});
@ -126,7 +126,7 @@
var moveBtn = $( this ),
$row = moveBtn.closest( 'tr' );
moveBtn.focus();
moveBtn.trigger( 'focus' );
var isMoveUp = moveBtn.is( '.wc-move-up' ),
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' );
} );

View File

@ -33,11 +33,11 @@ jQuery( function ( $ ) {
$( '.wc_status_table thead, .wc_status_table tbody' ).each( function() {
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';
} else {
$( '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.
// Find value
@ -68,7 +68,7 @@ jQuery( function ( $ ) {
try {
$( '#debug-report' ).slideDown();
$( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).focus().select();
$( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).trigger( 'focus' ).trigger( 'select' );
$( this ).fadeOut();
return false;
} catch ( e ) {
@ -100,7 +100,7 @@ jQuery( function ( $ ) {
'fadeIn': 50,
'fadeOut': 50,
'delay': 0
}).focus();
}).trigger( 'focus' );
},
/**
@ -108,7 +108,7 @@ jQuery( function ( $ ) {
*/
copyFail: function() {
$( '.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, '"' ) );
}
$( '.js_field-country' ).selectWoo().change( this.change_country );
$( '.js_field-country' ).selectWoo().on( 'change', this.change_country );
$( '.js_field-country' ).trigger( 'change', [ true ] );
$( 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">' );
jQuery( 'body' ).append( $temp_input );
$temp_input.val( data ).select();
$temp_input.val( data ).trigger( 'select' );
$el.trigger( 'beforecopy' );
try {

View File

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

View File

@ -37,7 +37,7 @@ jQuery( 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 ) {
@ -46,7 +46,7 @@ jQuery( function( $ ) {
} );
$( '#wc_tracker_submit' ).on( 'click', function () {
form.unbind( 'submit' ).trigger( 'submit' );
form.off( 'submit' ).trigger( 'submit' );
} );
return true;
@ -96,7 +96,7 @@ jQuery( function( $ ) {
if ( $.isEmptyObject( country_postcode_obj ) || country_postcode_obj.required ) {
$store_postcode_input.attr( 'required', 'true' );
} 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() {
$( 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' )
.slideToggle()
.css( 'display', 'flex' );

View File

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

View File

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

View File

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

View File

@ -104,7 +104,7 @@
// KEYBOARD:
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;
if (!slider.animating && (keycode === 39 || keycode === 37)) {
var target = (slider.vars.rtl?
@ -121,7 +121,7 @@
}
// MOUSEWHEEL:
if (slider.vars.mousewheel) {
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
slider.on('mousewheel', function(event, delta, deltaX, deltaY) {
event.preventDefault();
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, slider.vars.pauseOnAction);
@ -137,9 +137,9 @@
// SLIDSESHOW
if (slider.vars.slideshow) {
if (slider.vars.pauseOnHover) {
slider.hover(function() {
slider.on( 'mouseenter', function() {
if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
}, function() {
} ).on( 'mouseleave', function() {
if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
});
}
@ -157,7 +157,7 @@
if (touch && slider.vars.touch) { methods.touch(); }
// 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");
@ -237,27 +237,27 @@
for (var i = 0; i < slider.pagingCount; i++) {
slide = slider.slides.eq(i);
if ( undefined === slide.attr( 'data-thumb-alt' ) ) {
slide.attr( 'data-thumb-alt', '' );
if ( undefined === slide.attr( 'data-thumb-alt' ) ) {
slide.attr( 'data-thumb-alt', '' );
}
item = $( '<a></a>' ).attr( 'href', '#' ).text( j );
if ( slider.vars.controlNav === "thumbnails" ) {
item = $( '<img/>' ).attr( 'src', slide.attr( 'data-thumb' ) );
}
if ( '' !== slide.attr( 'data-thumb-alt' ) ) {
item.attr( 'alt', slide.attr( 'data-thumb-alt' ) );
}
if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
var captn = slide.attr( 'data-thumbcaption' );
if ( '' !== captn && undefined !== captn ) {
if ( '' !== captn && undefined !== captn ) {
var caption = $('<span></span>' ).addClass( namespace + 'caption' ).text( captn );
item.append( caption );
}
}
var liElement = $( '<li>' );
item.appendTo( liElement );
liElement.append( '</li>' );
@ -274,7 +274,7 @@
methods.controlNav.active();
slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
slider.controlNavScaffold.on(eventType, 'a, img', function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
@ -299,7 +299,7 @@
slider.controlNav = slider.manualControls;
methods.controlNav.active();
slider.controlNav.bind(eventType, function(event) {
slider.controlNav.on(eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
@ -356,7 +356,7 @@
methods.directionNav.update();
slider.directionNav.bind(eventType, function(event) {
slider.directionNav.on(eventType, function(event) {
event.preventDefault();
var target;
@ -372,7 +372,7 @@
methods.setToClearWatchedEvent();
});
},
update: function() {
update: function() {console.log('updating...');
var disabledClass = namespace + 'disabled';
if (slider.pagingCount === 1) {
slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
@ -382,10 +382,10 @@
} else if (slider.animatingTo === slider.last) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
} else {
slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
slider.directionNav.removeClass(disabledClass).prop( 'tabindex', '-1' );
}
} 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');
slider.pausePlay.bind(eventType, function(event) {
slider.pausePlay.on(eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
@ -794,8 +794,8 @@
}
// Unbind previous transitionEnd events and re-bind new transitionEnd event
slider.container.unbind("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function() {
slider.container.off("webkitTransitionEnd transitionend");
slider.container.on("webkitTransitionEnd transitionend", function() {
clearTimeout(slider.ensureAnimationEnd);
slider.wrapup(dimension);
});
@ -1133,9 +1133,9 @@
};
// Ensure the slider isn't focussed if the window loses focus.
$( window ).blur( function ( e ) {
$( window ).on( 'blur', function ( e ) {
focused = false;
}).focus( function ( e ) {
}).on( 'focus', function ( e ) {
focused = true;
});

View File

@ -26,7 +26,7 @@ jQuery( function( $ ) {
// Trigger initial 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 } });
});

View File

@ -379,7 +379,7 @@
if ( ! current_attr_select.data( 'attribute_html' ) ) {
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.
current_attr_select.data(

View File

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

View File

@ -58,7 +58,7 @@ jQuery( function( $ ) {
$( document.body ).trigger( 'init_checkout' );
}
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() {
@ -449,12 +449,12 @@ jQuery( function( $ ) {
$( window ).on('beforeunload', this.handleUnloadEvent);
},
detachUnloadEventsOnSubmit: function() {
$( window ).unbind('beforeunload', this.handleUnloadEvent);
$( window ).off('beforeunload', this.handleUnloadEvent);
},
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({
message: null,
overlayCSS: {
@ -589,11 +589,11 @@ jQuery( function( $ ) {
init: function() {
$( document.body ).on( 'click', 'a.showcoupon', this.show_coupon_form );
$( 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() {
$( '.checkout_coupon' ).slideToggle( 400, function() {
$( '.checkout_coupon' ).find( ':input:eq(0)' ).focus();
$( '.checkout_coupon' ).find( ':input:eq(0)' ).trigger( 'focus' );
});
return false;
},

View File

@ -55,14 +55,17 @@ jQuery( function( $ ) {
var wc_country_select_select2 = function() {
$( 'select.country_select:visible, select.state_select:visible' ).each( function() {
var $this = $( this );
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%'
}, getEnhancedSelectFormatString() );
$( this )
.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 );
});

View File

@ -48,7 +48,7 @@
) {
submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
} 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
);
if ( hasSelectiveRefresh ) {
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
wp.customize.selectiveRefresh.on( 'partial-content-rendered', function() {
init_price_filter();
} );
}

View File

@ -30,7 +30,7 @@ jQuery( function( $ ) {
);
// OR if create account is checked.
$( 'input#createaccount' ).change( { tokenizationForm: this }, this.onCreateAccountChange );
$( 'input#createaccount' ).on( 'change', { tokenizationForm: this }, this.onCreateAccountChange );
// First display.
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;
// Check the value of that cookie and show/hide the notice accordingly
@ -87,7 +87,11 @@ jQuery( function( $ ) {
$( '.show-password-input' ).on( 'click',
function() {
$( this ).toggleClass( 'display-password' );
if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).removeClass( 'display-password' );
} else {
$( this ).addClass( 'display-password' );
}
if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).siblings( ['input[type="password"]'] ).prop( 'type', 'text' );
} else {

View File

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

View File

@ -49,14 +49,14 @@
function read(s, converter) {
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) {
// Write
if (value !== undefined && !$.isFunction(value)) {
if (value !== undefined && 'function' !== typeof value) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
@ -114,4 +114,4 @@
return !$.cookie(key);
};
}));
}));

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
* 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
(function($) {
@ -1265,7 +1265,7 @@ Licensed under the MIT license.
octx = overlay.context;
// 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
@ -1291,11 +1291,11 @@ Licensed under the MIT license.
// was fixed somewhere around 1.3.x. We can return to using
// .mouseleave when we drop support for 1.2.6.
eventHolder.bind("mouseleave", onMouseLeave);
eventHolder.on("mouseleave", onMouseLeave);
}
if (options.grid.clickable)
eventHolder.click(onClick);
eventHolder.on( 'click', onClick );
executeHooks(hooks.bindEvents, [eventHolder]);
}
@ -1304,9 +1304,9 @@ Licensed under the MIT license.
if (redrawTimeout)
clearTimeout(redrawTimeout);
eventHolder.unbind("mousemove", onMouseMove);
eventHolder.unbind("mouseleave", onMouseLeave);
eventHolder.unbind("click", onClick);
eventHolder.off("mousemove", onMouseMove);
eventHolder.off("mouseleave", onMouseLeave);
eventHolder.off("click", onClick);
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); };
if (opts.alignTicksWithAxis != null) {
@ -1751,7 +1751,7 @@ Licensed under the MIT license.
if (oticks == null || (typeof oticks == "number" && oticks > 0))
ticks = axis.tickGenerator(axis);
else if (oticks) {
if ($.isFunction(oticks))
if ( 'function' === typeof oticks )
// generate the ticks
ticks = oticks(axis);
else
@ -1875,7 +1875,7 @@ Licensed under the MIT license.
// draw markings
var markings = options.grid.markings;
if (markings) {
if ($.isFunction(markings)) {
if ( 'function' === typeof markings ) {
axes = plot.getAxes();
// xmin etc. is backwards compatibility, to be
// removed in the future
@ -2439,9 +2439,9 @@ Licensed under the MIT license.
radius = series.points.radius,
symbol = series.points.symbol;
// If the user sets the line width to 0, we change it to a very
// If the user sets the line width to 0, we change it to a very
// small value. A line width of 0 seems to force the default of 1.
// Doing the conditional here allows the shadow setting to still be
// Doing the conditional here allows the shadow setting to still be
// optional even with a lineWidth of 0.
if( lw == 0 )
@ -2659,7 +2659,7 @@ Licensed under the MIT license.
// Sort the legend using either the default or a custom comparator
if (options.legend.sorted) {
if ($.isFunction(options.legend.sorted)) {
if ( 'function' === typeof options.legend.sorted ) {
entries.sort(options.legend.sorted);
} else if (options.legend.sorted == "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();
if (options.series.pie.show) {
if (options.grid.hoverable) {
eventHolder.unbind("mousemove").mousemove(onMouseMove);
eventHolder.off("mousemove").on( 'mousemove', onMouseMove );
}
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
// 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];
}
if ($.isArray(value)) {
if (Array.isArray(value)) {
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
value[1] = +value[1];
@ -814,4 +814,4 @@ More detail and specific examples can be found in the included HTML file.
version: "1.1"
});
})(jQuery);
})(jQuery);

View File

@ -20,7 +20,7 @@ can just fix the size of their placeholders.
* 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 ($) {
var options = { }; // no options
@ -38,19 +38,19 @@ can just fix the size of their placeholders.
plot.setupGrid();
plot.draw();
}
function bindEvents(plot, eventHolder) {
plot.getPlaceholder().resize(onResize);
plot.getPlaceholder().on( 'resize', onResize );
}
function shutdown(plot, eventHolder) {
plot.getPlaceholder().unbind("resize", onResize);
plot.getPlaceholder().off("resize", onResize);
}
plot.hooks.bindEvents.push(bindEvents);
plot.hooks.shutdown.push(shutdown);
}
$.plot.plugins.push({
init: init,
options: options,

View File

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

View File

@ -131,7 +131,7 @@
if (opts.typeFunctions && type && opts.typeFunctions[type]) { // use a type if available
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);
} else if (opts.parseBooleans && (valStr === "true" || valStr === "false")) { // auto: boolean
parsedVal = (valStr === "true");
@ -201,17 +201,17 @@
// depending on the options to skip values by name or type, and the data-skip-falsy attribute.
shouldSkipFalsy: function($form, name, nameWithNoType, type, opts) {
var f = $.serializeJSON;
var skipFromDataAttr = f.attrFromInputWithName($form, name, 'data-skip-falsy');
if (skipFromDataAttr != null) {
return skipFromDataAttr !== 'false'; // any value is true, except if explicitly using 'false'
return skipFromDataAttr !== 'false'; // any value is true, except if explicitly using 'false'
}
var optForFields = opts.skipFalsyValuesForFields;
if (optForFields && (optForFields.indexOf(nameWithNoType) !== -1 || optForFields.indexOf(name) !== -1)) {
return true;
}
var optForTypes = opts.skipFalsyValuesForTypes;
if (type == null) type = 'string'; // assume fields with no type are targeted as string
if (optForTypes && optForTypes.indexOf(type) !== -1) {
@ -314,12 +314,12 @@
// '' is used to push values into the array "array[]"
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
}
} else {
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
}
} 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(!opts.content){
org_elem.removeAttr(opts.attribute); //remove original Attribute
org_elem.prop(opts.attribute, false); //remove original Attribute
}
var timeout = false;
if(opts.activation == "hover"){
org_elem.hover(function(){
org_elem.on( 'mouseenter', function(){
active_tiptip();
}, function(){
} ).on( 'mouseleave', function(){
if(!opts.keepAlive || !tiptip_holder.is(':hover')){
deactive_tiptip();
}
});
if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){
tiptip_holder.on( 'mouseenter', function(){} ).on( 'mouseleave', function(){
deactive_tiptip();
});
}
} else if(opts.activation == "focus"){
org_elem.focus(function(){
org_elem.on( 'focus', function(){
active_tiptip();
}).blur(function(){
}).on( 'blur', function(){
deactive_tiptip();
});
} else if(opts.activation == "click"){
org_elem.click(function(){
org_elem.on( 'click', function(){
active_tiptip();
return false;
}).hover(function(){},function(){
}).on( 'mouseenter', function(){} ).on( 'mouseleave' ,function(){
if(!opts.keepAlive){
deactive_tiptip();
}
});
if(opts.keepAlive){
tiptip_holder.hover(function(){}, function(){
tiptip_holder.on( 'mouseenter', function(){} ).on( 'mouseleave', function(){
deactive_tiptip();
});
}
@ -100,7 +100,8 @@
function active_tiptip(){
opts.enter.call(this);
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");
var top = parseInt(org_elem.offset()['top']);

View File

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

View File

@ -108,10 +108,10 @@
doresize = true, scroll_pos = _get_scroll();
// 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) {
$(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($pp_pic_holder.is(':visible')){
switch(e.keyCode){
@ -162,7 +162,7 @@
_build_overlay(this); // Build the overlay {this} being the caller
if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
$(window).on('scroll.prettyphoto',function(){ _center_overlay(); });
$.prettyPhoto.open();
@ -431,7 +431,7 @@
*/
$.prettyPhoto.startSlideshow = function(){
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();
return false;
});
@ -446,7 +446,7 @@
* Stop the slideshow...
*/
$.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();
return false;
});
@ -473,7 +473,7 @@
$(this).remove(); // No more need for the prettyPhoto markup
$(window).unbind('scroll.prettyphoto');
$(window).off('scroll.prettyphoto');
clearHashtag();
@ -739,7 +739,7 @@
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
}else{
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
$pp_pic_holder.find('.pp_content').off('mouseenter mouseleave');
// $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.find('.pp_arrow_next').click(function(){
$pp_gallery.find('.pp_arrow_next').on( 'click', function(){
$.prettyPhoto.changeGalleryPage('next');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_gallery.find('.pp_arrow_previous').click(function(){
$pp_gallery.find('.pp_arrow_previous').on( 'click', function(){
$.prettyPhoto.changeGalleryPage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_content').hover(
$pp_pic_holder.find('.pp_content').on( 'mouseenter',
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
},
} ).on( 'mouseleave',
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
});
@ -800,7 +800,7 @@
$pp_gallery_li.each(function(i){
$(this)
.find('a')
.click(function(){
.on( 'click', function(){
$.prettyPhoto.changePage(i);
$.prettyPhoto.stopSlideshow();
return false;
@ -812,7 +812,7 @@
// Inject the play/pause if it's a slideshow
if(settings.slideshow){
$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();
return false;
});
@ -826,15 +826,15 @@
'height':$(document).height(),
'width':$(window).width()
})
.bind('click',function(){
.on('click',function(){
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) {
$('a.pp_expand').bind('click',function(e){
$('a.pp_expand').on('click',function(e){
// Expand the image
if($(this).hasClass('pp_expand')){
$(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.stopSlideshow();
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.stopSlideshow();
return false;
@ -879,7 +879,7 @@
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(){

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,41 @@
/*!
* Select2 4.0.3
* https://select2.github.io
* SelectWoo 1.0.9
* https://github.com/woocommerce/selectWoo
*
* 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) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
} else if (typeof module === 'object' && module.exports) {
// 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 {
// Browser globals
factory(jQuery);
}
}(function (jQuery) {
} (function (jQuery) {
// 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
// returns the AMD loader references.
var S2 =
(function () {
var S2 =(function () {
// Restore the Select2 AMD loader so it can be used
// Needed mostly in the language files, where the loader is not inserted
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
@ -30,13 +44,11 @@
var S2;(function () { if (!S2 || !S2.requirejs) {
if (!S2) { S2 = {}; } else { require = S2; }
/**
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
* Released under MIT license, http://github.com/requirejs/almond/LICENSE
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */
var requirejs, require, define;
@ -64,60 +76,58 @@ var requirejs, require, define;
*/
function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
foundI, foundStarMap, starI, i, j, part,
foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
baseParts = baseName && baseName.split("/"),
map = config.map,
starMap = (map && map['*']) || {};
//Adjust any relative paths.
if (name && name.charAt(0) === ".") {
//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('/');
lastIndex = name.length - 1;
if (name) {
name = name.split('/');
lastIndex = name.length - 1;
// Node .js allowance:
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
}
// 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])) {
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
}
//Lop off the last part of baseParts, so that . matches the
//"directory" and not name of the baseName's module. For instance,
//baseName of "one/two/three", maps to "one/two/three.js", but we
//want the directory, "one/two" for this normalization.
name = baseParts.slice(0, baseParts.length - 1).concat(name);
// Starts with a '.' so need the baseName
if (name[0].charAt(0) === '.' && baseParts) {
//Convert baseName to array, and lop off the last part,
//so that . matches that 'directory' and not name of the baseName's
//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
for (i = 0; i < name.length; i += 1) {
part = name[i];
if (part === ".") {
name.splice(i, 1);
i -= 1;
} else if (part === "..") {
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
name.splice(i - 1, 2);
i -= 2;
}
//start trimDots
for (i = 0; i < name.length; i++) {
part = name[i];
if (part === '.') {
name.splice(i, 1);
i -= 1;
} else if (part === '..') {
// If at the start, or previous value is still ..,
// keep them so that when converted to a path it may
// still work when converted to a path, even though
// as an ID it is less than ideal. In larger point
// releases, may be better to just kick out an error.
if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
continue;
} else if (i > 0) {
name.splice(i - 1, 2);
i -= 2;
}
}
//end trimDots
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);
}
//end trimDots
name = name.join('/');
}
//Apply map config if available.
@ -230,32 +240,39 @@ var requirejs, require, define;
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
* for normalization if necessary. Grabs a ref to plugin
* too, as an optimization.
*/
makeMap = function (name, relName) {
makeMap = function (name, relParts) {
var plugin,
parts = splitPrefix(name),
prefix = parts[0];
prefix = parts[0],
relResourceName = relParts[1];
name = parts[1];
if (prefix) {
prefix = normalize(prefix, relName);
prefix = normalize(prefix, relResourceName);
plugin = callDep(prefix);
}
//Normalize according
if (prefix) {
if (plugin && plugin.normalize) {
name = plugin.normalize(name, makeNormalize(relName));
name = plugin.normalize(name, makeNormalize(relResourceName));
} else {
name = normalize(name, relName);
name = normalize(name, relResourceName);
}
} else {
name = normalize(name, relName);
name = normalize(name, relResourceName);
parts = splitPrefix(name);
prefix = parts[0];
name = parts[1];
@ -302,13 +319,14 @@ var requirejs, require, define;
};
main = function (name, deps, callback, relName) {
var cjsModule, depName, ret, map, i,
var cjsModule, depName, ret, map, i, relParts,
args = [],
callbackType = typeof callback,
usingExports;
//Use name if no relName
relName = relName || name;
relParts = makeRelParts(relName);
//Call the callback to define the module, if necessary.
if (callbackType === 'undefined' || callbackType === 'function') {
@ -317,7 +335,7 @@ var requirejs, require, define;
//Default to [require, exports, module] if no deps
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
for (i = 0; i < deps.length; i += 1) {
map = makeMap(deps[i], relName);
map = makeMap(deps[i], relParts);
depName = map.f;
//Fast path CommonJS standard dependencies.
@ -373,7 +391,7 @@ var requirejs, require, define;
//deps arg is the module name, and second arg (if passed)
//is just the relName.
//Normalize module name, if it contains . or ..
return callDep(makeMap(deps, callback).f);
return callDep(makeMap(deps, makeRelParts(callback)).f);
} else if (!deps.splice) {
//deps is a config object, not an array.
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.
Utils.appendMany = function ($element, $nodes) {
// jQuery 1.7.x does not support $.fn.append() with an array
@ -754,6 +778,14 @@ S2.define('select2/utils',[
$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;
});
@ -773,7 +805,7 @@ S2.define('select2/results',[
Results.prototype.render = function () {
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')) {
@ -796,7 +828,7 @@ S2.define('select2/results',[
this.hideLoading();
var $message = $(
'<li role="treeitem" aria-live="assertive"' +
'<li role="alert" aria-live="assertive"' +
' class="select2-results__option"></li>'
);
@ -858,9 +890,9 @@ S2.define('select2/results',[
Results.prototype.highlightFirstItem = function () {
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
if ($selected.length > 0) {
@ -884,7 +916,7 @@ S2.define('select2/results',[
});
var $options = self.$results
.find('.select2-results__option[aria-selected]');
.find('.select2-results__option[data-selected]');
$options.each(function () {
var $option = $(this);
@ -896,9 +928,9 @@ S2.define('select2/results',[
if ((item.element != null && item.element.selected) ||
(item.element == null && $.inArray(id, selectedIds) > -1)) {
$option.attr('aria-selected', 'true');
$option.attr('data-selected', 'true');
} else {
$option.attr('aria-selected', 'false');
$option.attr('data-selected', 'false');
}
});
@ -930,17 +962,18 @@ S2.define('select2/results',[
option.className = 'select2-results__option';
var attrs = {
'role': 'treeitem',
'aria-selected': 'false'
'role': 'option',
'data-selected': 'false',
'tabindex': -1
};
if (data.disabled) {
delete attrs['aria-selected'];
delete attrs['data-selected'];
attrs['aria-disabled'] = 'true';
}
if (data.id == null) {
delete attrs['aria-selected'];
delete attrs['data-selected'];
}
if (data._resultId != null) {
@ -952,9 +985,8 @@ S2.define('select2/results',[
}
if (data.children) {
attrs.role = 'group';
attrs['aria-label'] = data.text;
delete attrs['aria-selected'];
delete attrs['data-selected'];
}
for (var attr in attrs) {
@ -971,6 +1003,7 @@ S2.define('select2/results',[
var $label = $(label);
this.template(data, label);
$label.attr('role', 'presentation');
var $children = [];
@ -983,10 +1016,11 @@ S2.define('select2/results',[
}
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);
$option.attr('role', 'list');
$option.append(label);
$option.append($childrenContainer);
@ -1082,7 +1116,7 @@ S2.define('select2/results',[
var data = $highlighted.data('data');
if ($highlighted.attr('aria-selected') == 'true') {
if ($highlighted.attr('data-selected') == 'true') {
self.trigger('close', {});
} else {
self.trigger('select', {
@ -1094,7 +1128,7 @@ S2.define('select2/results',[
container.on('results:previous', function () {
var $highlighted = self.getHighlightedResults();
var $options = self.$results.find('[aria-selected]');
var $options = self.$results.find('[data-selected]');
var currentIndex = $options.index($highlighted);
@ -1128,7 +1162,7 @@ S2.define('select2/results',[
container.on('results:next', function () {
var $highlighted = self.getHighlightedResults();
var $options = self.$results.find('[aria-selected]');
var $options = self.$results.find('[data-selected]');
var currentIndex = $options.index($highlighted);
@ -1156,7 +1190,8 @@ S2.define('select2/results',[
});
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) {
@ -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) {
var $this = $(this);
var data = $this.data('data');
if ($this.attr('aria-selected') === 'true') {
if ($this.attr('data-selected') === 'true') {
if (self.options.get('multiple')) {
self.trigger('unselect', {
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) {
var data = $(this).data('data');
self.getHighlightedResults()
.removeClass('select2-results__option--highlighted');
.removeClass('select2-results__option--highlighted')
.attr('aria-selected', 'false');
self.trigger('results:focus', {
data: data,
@ -1245,7 +1281,7 @@ S2.define('select2/results',[
return;
}
var $options = this.$results.find('[aria-selected]');
var $options = this.$results.find('[data-selected]');
var currentIndex = $options.index($highlighted);
@ -1323,7 +1359,7 @@ S2.define('select2/selection/base',[
BaseSelection.prototype.render = function () {
var $selection = $(
'<span class="select2-selection" role="combobox" ' +
'<span class="select2-selection" ' +
' aria-haspopup="true" aria-expanded="false">' +
'</span>'
);
@ -1349,6 +1385,7 @@ S2.define('select2/selection/base',[
var id = container.id + '-container';
var resultsId = container.id + '-results';
var searchHidden = this.options.get('minimumResultsForSearch') === Infinity;
this.container = container;
@ -1390,7 +1427,11 @@ S2.define('select2/selection/base',[
self.$selection.removeAttr('aria-activedescendant');
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);
});
@ -1440,8 +1481,14 @@ S2.define('select2/selection/base',[
}
var $element = $this.data('element');
$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';
this.$selection.find('.select2-selection__rendered').attr('id', id);
this.$selection.attr('aria-labelledby', id);
this.$selection.find('.select2-selection__rendered')
.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) {
// Only respond to left clicks
@ -1518,13 +1578,20 @@ S2.define('select2/selection/single',[
// 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) {
// User exits the container
});
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}
});
@ -1557,9 +1624,9 @@ S2.define('select2/selection/single',[
var selection = data[0];
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);
};
@ -1583,7 +1650,7 @@ S2.define('select2/selection/multiple',[
$selection.addClass('select2-selection--multiple');
$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;
@ -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 () {
@ -1636,7 +1715,7 @@ S2.define('select2/selection/multiple',[
MultipleSelection.prototype.selectionContainer = function () {
var $container = $(
'<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;' +
'</span>' +
'</li>'
@ -1645,6 +1724,24 @@ S2.define('select2/selection/multiple',[
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) {
this.clear();
@ -1658,9 +1755,14 @@ S2.define('select2/selection/multiple',[
var selection = data[d];
var $selection = this.selectionContainer();
var removeItemTag = $selection.html();
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.data('data', selection);
@ -1699,7 +1801,7 @@ S2.define('select2/selection/placeholder',[
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
var $placeholder = this.selectionContainer();
$placeholder.html(this.display(placeholder));
$placeholder.text(Utils.entityDecode(this.display(placeholder)));
$placeholder.addClass('select2-selection__placeholder')
.removeClass('select2-selection__choice');
@ -1836,8 +1938,8 @@ S2.define('select2/selection/search',[
Search.prototype.render = function (decorated) {
var $search = $(
'<li class="select2-search select2-search--inline">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
'<input class="select2-search__field" type="text" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
'</li>'
);
@ -1854,16 +1956,19 @@ S2.define('select2/selection/search',[
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
var resultsId = container.id + '-results';
decorated.call(this, container, $container);
container.on('open', function () {
self.$search.attr('aria-owns', resultsId);
self.$search.trigger('focus');
});
container.on('close', function () {
self.$search.val('');
self.$search.removeAttr('aria-activedescendant');
self.$search.removeAttr('aria-owns');
self.$search.trigger('focus');
});
@ -1882,7 +1987,7 @@ S2.define('select2/selection/search',[
});
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) {
@ -1913,6 +2018,9 @@ S2.define('select2/selection/search',[
evt.preventDefault();
}
} else if (evt.which === KEYS.ENTER) {
container.open();
evt.preventDefault();
}
});
@ -2001,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
this.$search.trigger( 'focus' );
}
};
@ -3004,8 +3112,15 @@ S2.define('select2/data/base',[
};
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);
if (data.id != null) {
@ -3191,7 +3306,7 @@ S2.define('select2/data/select',[
}
}
if (data.id) {
if (data.id !== undefined) {
option.value = data.id;
}
@ -3289,7 +3404,7 @@ S2.define('select2/data/select',[
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);
}
@ -3432,7 +3547,7 @@ S2.define('select2/data/ajax',[
if (this._request != null) {
// JSONP requests cannot always be aborted
if ($.isFunction(this._request.abort)) {
if ( typeof this._request.abort === 'function' ) {
this._request.abort();
}
@ -3457,7 +3572,7 @@ S2.define('select2/data/ajax',[
if (self.options.get('debug') && window.console && console.error) {
// 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(
'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
@ -3466,6 +3581,7 @@ S2.define('select2/data/ajax',[
}
callback(results);
self.container.focusOnActiveElement();
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
@ -3515,7 +3631,7 @@ S2.define('select2/data/tags',[
decorated.call(this, $element, options);
if ($.isArray(tags)) {
if ( Array.isArray( tags ) ) {
for (var t = 0; t < tags.length; t++) {
var tag = tags[t];
var item = this._normalizeItem(tag);
@ -3550,7 +3666,10 @@ S2.define('select2/data/tags',[
}, 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 (child) {
@ -3588,7 +3707,7 @@ S2.define('select2/data/tags',[
};
Tags.prototype.createTag = function (decorated, params) {
var term = $.trim(params.term);
var term = params.term.trim();
if (term === '') {
return null;
@ -3681,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
this.$search.trigger( 'focus' );
}
params.term = tokenData.term;
@ -3887,9 +4006,9 @@ S2.define('select2/dropdown/search',[
var $search = $(
'<span class="select2-search select2-search--dropdown">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' spellcheck="false" role="textbox" />' +
'<input class="select2-search__field" type="text" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />' +
'</span>'
);
@ -3903,6 +4022,7 @@ S2.define('select2/dropdown/search',[
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
var resultsId = container.id + '-results';
decorated.call(this, container, $container);
@ -3926,23 +4046,24 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.focus();
self.$search.attr('aria-owns', resultsId);
self.$search.trigger( 'focus' );
window.setTimeout(function () {
self.$search.focus();
self.$search.trigger( 'focus' );
}, 0);
});
container.on('close', function () {
self.$search.attr('tabindex', -1);
self.$search.removeAttr('aria-activedescendant');
self.$search.removeAttr('aria-owns');
self.$search.val('');
});
container.on('focus', function () {
if (container.isOpen()) {
self.$search.focus();
if (!container.isOpen()) {
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) {
@ -4098,7 +4223,7 @@ S2.define('select2/dropdown/infiniteScroll',[
var $option = $(
'<li ' +
'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');
@ -4753,7 +4878,7 @@ S2.define('select2/defaults',[
}
}
if ($.isArray(options.language)) {
if ( Array.isArray( options.language ) ) {
var languages = new Translation();
options.language.push('en');
@ -4816,7 +4941,7 @@ S2.define('select2/defaults',[
function matcher (params, data) {
// Always return the object if there is nothing to compare
if ($.trim(params.term) === '') {
if ( params.term.trim() === '' ) {
return data;
}
@ -5344,16 +5469,22 @@ S2.define('select2/core',[
});
});
this.on('keypress', function (evt) {
var key = evt.which;
this.on('open', function(){
// 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 (key === KEYS.ESC || key === KEYS.TAB ||
(key === KEYS.UP && evt.altKey)) {
if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {
self.close();
evt.preventDefault();
} else if (key === KEYS.ENTER) {
} else if (key === KEYS.ENTER || key === KEYS.TAB) {
self.trigger('results:select', {});
evt.preventDefault();
@ -5370,17 +5501,42 @@ S2.define('select2/core',[
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();
}
}
});
};
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 () {
this.options.set('disabled', this.$element.prop('disabled'));
@ -5568,7 +5724,7 @@ S2.define('select2/core',[
var newVal = args[0];
if ($.isArray(newVal)) {
if ( Array.isArray( newVal ) ) {
newVal = $.map(newVal, function (obj) {
return obj.toString();
});
@ -5653,11 +5809,11 @@ S2.define('jquery.select2',[
'./select2/core',
'./select2/defaults'
], function ($, _, Select2, Defaults) {
if ($.fn.select2 == null) {
if ($.fn.selectWoo == null) {
// All methods that should return the element
var thisMethods = ['open', 'close', 'destroy'];
$.fn.select2 = function (options) {
$.fn.selectWoo = function (options) {
options = options || {};
if (typeof options === 'object') {
@ -5697,10 +5853,17 @@ S2.define('jquery.select2',[
};
}
if ($.fn.select2.defaults == null) {
$.fn.select2.defaults = Defaults;
if ($.fn.select2 != null && $.fn.select2.defaults != null) {
$.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;
});
@ -5719,6 +5882,7 @@ S2.define('jquery.select2',[
// This allows Select2 to use the internal loader outside of this file, such
// as in the language files.
jQuery.fn.select2.amd = S2;
jQuery.fn.selectWoo.amd = S2;
// Return the Select2 instance for anyone who is importing it.
return select2;

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*!
* jquery.zeroclipboard
* Bind to the `beforecopy`, `copy`, `aftercopy`, and `copy-error` events, custom DOM-like events for clipboard injection generated using jQuery's Special Events API and ZeroClipboard's Core module.
* Copyright (c) 2014
* Copyright (c) 2014
* Licensed MIT
* https://github.com/zeroclipboard/jquery.zeroclipboard
* v0.2.0
@ -1878,4 +1878,4 @@
}
})(jQuery, function() {
return this || window;
}());
}());

View File

@ -125,12 +125,12 @@
// Skip the fade-in for IE8 and lower since it chokes on fading-in
// and changing position based on mousemovement at the same time.
$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() {
$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
@ -221,8 +221,8 @@
}
});
}
if ($.isFunction(settings.callback)) {
if ('function' === typeof settings.callback) {
settings.callback.call(img);
}
};

View File

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

View File

@ -71,6 +71,10 @@
"stylecheck",
"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"
},
{
@ -129,6 +133,10 @@
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
"time": "2019-12-27T09:44:58+00:00"
},
{
@ -181,6 +189,10 @@
"polyfill",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
},
"time": "2021-02-15T10:24:51+00:00"
},
{
@ -231,20 +243,24 @@
"standards",
"wordpress"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
},
"time": "2019-08-28T14:22:28+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.8",
"version": "3.6.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
"reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
"shasum": ""
},
"require": {
@ -282,7 +298,12 @@
"phpcs",
"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",
@ -322,6 +343,10 @@
"woocommerce",
"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"
},
{
@ -368,6 +393,11 @@
"standards",
"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"
}
],
@ -381,5 +411,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -59,6 +59,10 @@
"constructor",
"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"
},
{
@ -104,6 +108,10 @@
"object",
"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"
},
{
@ -159,6 +167,10 @@
}
],
"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"
},
{
@ -206,6 +218,10 @@
}
],
"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"
},
{
@ -260,6 +276,10 @@
"reflection",
"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"
},
{
@ -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.",
"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"
},
{
@ -357,6 +381,10 @@
"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"
},
{
@ -420,6 +448,10 @@
"spy",
"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"
},
{
@ -483,6 +515,10 @@
"testing",
"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"
},
{
@ -530,6 +566,11 @@
"filesystem",
"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"
},
{
@ -571,6 +612,10 @@
"keywords": [
"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"
},
{
@ -620,6 +665,10 @@
"keywords": [
"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"
},
{
@ -669,6 +718,10 @@
"keywords": [
"tokenizer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
},
"abandoned": true,
"time": "2017-11-27T05:48:46+00:00"
},
@ -754,6 +807,10 @@
"testing",
"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"
},
{
@ -813,6 +870,10 @@
"mock",
"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,
"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",
"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": [
{
"url": "https://github.com/sebastianbergmann",
@ -929,6 +994,10 @@
"compare",
"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"
},
{
@ -981,6 +1050,10 @@
"keywords": [
"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"
},
{
@ -1031,6 +1104,10 @@
"environment",
"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"
},
{
@ -1098,6 +1175,10 @@
"export",
"exporter"
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1155,6 +1236,10 @@
"keywords": [
"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"
},
{
@ -1202,6 +1287,10 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"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": [
{
"url": "https://github.com/sebastianbergmann",
@ -1253,6 +1342,10 @@
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"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": [
{
"url": "https://github.com/sebastianbergmann",
@ -1312,6 +1405,10 @@
],
"description": "Provides functionality to recursively process PHP variables",
"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": [
{
"url": "https://github.com/sebastianbergmann",
@ -1360,6 +1457,10 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"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"
},
{
@ -1403,6 +1504,10 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"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"
},
{
@ -1465,6 +1570,9 @@
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0"
},
"funding": [
{
"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",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master"
},
"time": "2019-06-13T22:48:21+00:00"
},
{
@ -1568,6 +1680,10 @@
"check",
"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"
}
],
@ -1581,5 +1697,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -9,16 +9,16 @@
"packages-dev": [
{
"name": "gettext/gettext",
"version": "v4.8.3",
"version": "v4.8.4",
"source": {
"type": "git",
"url": "https://github.com/php-gettext/Gettext.git",
"reference": "57ff4fb16647e78e80a5909fe3c190f1c3110321"
"reference": "58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-gettext/Gettext/zipball/57ff4fb16647e78e80a5909fe3c190f1c3110321",
"reference": "57ff4fb16647e78e80a5909fe3c190f1c3110321",
"url": "https://api.github.com/repos/php-gettext/Gettext/zipball/58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1",
"reference": "58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1",
"shasum": ""
},
"require": {
@ -67,7 +67,26 @@
"po",
"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",
@ -128,6 +147,10 @@
"translations",
"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"
},
{
@ -173,6 +196,10 @@
}
],
"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"
},
{
@ -219,27 +246,38 @@
"mustache",
"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"
},
{
"name": "rmccue/requests",
"version": "v1.7.0",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/rmccue/Requests.git",
"reference": "87932f52ffad70504d93f04f15690cf16a089546"
"url": "https://github.com/WordPress/Requests.git",
"reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546",
"reference": "87932f52ffad70504d93f04f15690cf16a089546",
"url": "https://api.github.com/repos/WordPress/Requests/zipball/afbe4790e4def03581c4a0963a1e8aa01f6030f1",
"reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"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",
"autoload": {
@ -258,7 +296,7 @@
}
],
"description": "A HTTP library written in PHP, for human beings.",
"homepage": "http://github.com/rmccue/Requests",
"homepage": "http://github.com/WordPress/Requests",
"keywords": [
"curl",
"fsockopen",
@ -268,7 +306,11 @@
"iri",
"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",
@ -317,30 +359,33 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/3.3"
},
"time": "2017-06-01T21:01:25+00:00"
},
{
"name": "wp-cli/i18n-command",
"version": "v2.2.6",
"version": "v2.2.8",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/i18n-command.git",
"reference": "a66da3f09f6a728832381012848c3074bf1635c8"
"reference": "8bc234617edc533590ac0f41080164a8d85ec9ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/a66da3f09f6a728832381012848c3074bf1635c8",
"reference": "a66da3f09f6a728832381012848c3074bf1635c8",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/8bc234617edc533590ac0f41080164a8d85ec9ce",
"reference": "8bc234617edc533590ac0f41080164a8d85ec9ce",
"shasum": ""
},
"require": {
"gettext/gettext": "^4.8",
"mck89/peast": "^1.8",
"wp-cli/wp-cli": "^2"
"wp-cli/wp-cli": "^2.5"
},
"require-dev": {
"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",
"extra": {
@ -374,7 +419,11 @@
],
"description": "Provides internationalization tools for WordPress projects.",
"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",
@ -422,6 +471,9 @@
],
"description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)",
"homepage": "https://github.com/mustangostang/spyc/",
"support": {
"source": "https://github.com/wp-cli/spyc/tree/autoload"
},
"time": "2017-04-25T11:26:20+00:00"
},
{
@ -472,27 +524,31 @@
"cli",
"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"
},
{
"name": "wp-cli/wp-cli",
"version": "v2.4.1",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/wp-cli.git",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b"
"reference": "4c4746d06640af7698f3792cc4c327a8482dc40f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/ceb18598e79befa9b2a37a51efbb34910628988b",
"reference": "ceb18598e79befa9b2a37a51efbb34910628988b",
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/4c4746d06640af7698f3792cc4c327a8482dc40f",
"reference": "4c4746d06640af7698f3792cc4c327a8482dc40f",
"shasum": ""
},
"require": {
"ext-curl": "*",
"mustache/mustache": "~2.13",
"php": "^5.4 || ^7.0",
"rmccue/requests": "~1.6",
"php": "^5.6 || ^7.0 || ^8.0",
"rmccue/requests": "^1.8",
"symfony/finder": ">2.7",
"wp-cli/mustangostang-spyc": "^0.6.3",
"wp-cli/php-cli-tools": "~0.11.2"
@ -503,12 +559,13 @@
"wp-cli/entity-command": "^1.2 || ^2",
"wp-cli/extension-command": "^1.1 || ^2",
"wp-cli/package-command": "^1 || ^2",
"wp-cli/wp-cli-tests": "^2.1"
"wp-cli/wp-cli-tests": "^3.0.7"
},
"suggest": {
"ext-readline": "Include for a better --prompt implementation",
"ext-zip": "Needed to support extraction of ZIP archives when doing downloads or updates"
},
"default-branch": true,
"bin": [
"bin/wp",
"bin/wp.bat"
@ -516,13 +573,17 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4.x-dev"
"dev-master": "2.5.x-dev"
}
},
"autoload": {
"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/",
"license": [
@ -534,7 +595,12 @@
"cli",
"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": [],
@ -547,5 +613,5 @@
"platform-overrides": {
"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 -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"
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 ==
= 5.2.0 RC 2021-03-30 =
* Update - WooCommerce Admin package 2.1.4. #29520
* 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
**WooCommerce Admin - 2.1.4**
* Fix - Adding New Zealand and Ireland to selective bundle option, previously missed. #6649
= 5.2.0 beta 2021-03-23 =
= 5.3.0 2021-05-11 =
**WooCommerce**
* 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
* 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 - 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
* 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**
* 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 - 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
@ -54,11 +189,21 @@
* 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 - 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 - Update the contributor guidelines. #29150
* 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 - CES track settings tab on updating settings #6368
@ -85,6 +230,7 @@
* Fix - Add check for navigating being enabled. #6462
* Fix - Add customer name column to CSV export #6556
* 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 - 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
@ -108,11 +254,12 @@
* Tweak - New Settings: Turn off in dev mode #6348
* Tweak - Order and styles updates to nav footer #6373
* 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 - Update inline documentation for navigation Screen class #6173
* 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 - 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",
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "2.1.4",
"woocommerce/woocommerce-blocks": "4.7.0"
"woocommerce/woocommerce-admin": "2.3.0",
"woocommerce/woocommerce-blocks": "5.1.0"
},
"require-dev": {
"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",
"This file is @generated automatically"
],
"content-hash": "b1d6d94c8cfae572ab27c288c6865787",
"content-hash": "ac338dadb8929c73ad9606426621f9ba",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -92,16 +92,16 @@
},
{
"name": "composer/installers",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d"
"reference": "ae03311f45dfe194412081526be2e003960df74b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d",
"reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d",
"url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b",
"reference": "ae03311f45dfe194412081526be2e003960df74b",
"shasum": ""
},
"require": {
@ -195,6 +195,7 @@
"majima",
"mako",
"mediawiki",
"miaoxing",
"modulework",
"modx",
"moodle",
@ -212,6 +213,7 @@
"sydes",
"sylius",
"symfony",
"tastyigniter",
"typo3",
"wordpress",
"yawik",
@ -220,7 +222,7 @@
],
"support": {
"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": [
{
@ -236,7 +238,7 @@
"type": "tidelift"
}
],
"time": "2021-01-14T11:07:16+00:00"
"time": "2021-04-28T06:42:17+00:00"
},
{
"name": "maxmind-db/reader",
@ -530,16 +532,16 @@
},
{
"name": "woocommerce/woocommerce-admin",
"version": "2.1.4",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "f992b8c8664e72b00ee7283ba1d34e74e4b67ab0"
"reference": "c690969d301ddb7145b43e72e4dd99c84cc8ba66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/f992b8c8664e72b00ee7283ba1d34e74e4b67ab0",
"reference": "f992b8c8664e72b00ee7283ba1d34e74e4b67ab0",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/c690969d301ddb7145b43e72e4dd99c84cc8ba66",
"reference": "c690969d301ddb7145b43e72e4dd99c84cc8ba66",
"shasum": ""
},
"require": {
@ -548,7 +550,7 @@
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
"bamarni/composer-bin-plugin": "^1.4",
"suin/phpcs-psr4-sniff": "^2.2",
"woocommerce/woocommerce-sniffs": "0.1.0"
},
@ -558,6 +560,9 @@
"test": "Run unit tests",
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
},
"bamarni-bin": {
"target-directory": "bin/composer"
}
},
"autoload": {
@ -573,22 +578,22 @@
"homepage": "https://github.com/woocommerce/woocommerce-admin",
"support": {
"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",
"version": "v4.7.0",
"version": "v5.1.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "bf9f70607e718c5f83785cad29b33746db0282d3"
"reference": "a4f168596f3832e161b26dec636b69293039ee51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/bf9f70607e718c5f83785cad29b33746db0282d3",
"reference": "bf9f70607e718c5f83785cad29b33746db0282d3",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/a4f168596f3832e161b26dec636b69293039ee51",
"reference": "a4f168596f3832e161b26dec636b69293039ee51",
"shasum": ""
},
"require": {
@ -596,7 +601,7 @@
"composer/installers": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "6.5.14",
"phpunit/phpunit": "7.5.20",
"woocommerce/woocommerce-sniffs": "0.1.0"
},
"type": "wordpress-plugin",
@ -624,9 +629,9 @@
],
"support": {
"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": [

View File

@ -1792,6 +1792,33 @@ return array(
'AE' => __( 'Armed Forces (AE)', '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(),
'YT' => array(),
'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.
if ( 0 < $order_id ) {
$order = wc_get_order( $order_id );
$total = (float) $order->get_total();
if ( $order ) {
$total = (float) $order->get_total();
}
// Gets order total from cart/checkout.
} elseif ( 0 < WC()->cart->total ) {

View File

@ -696,6 +696,7 @@ abstract class WC_Settings_API {
);
$data = wp_parse_args( $data, $defaults );
$value = $this->get_option( $key );
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>
<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 ) : ?>
<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; ?>
</select>
<?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>

View File

@ -534,6 +534,73 @@ class WC_Admin_Addons {
<?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
*
@ -566,6 +633,9 @@ class WC_Admin_Addons {
case 'wcpay_banner_block':
self::output_wcpay_banner_block( (array) $section );
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
*/
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() {
$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.
if ( ! $is_woo_payment_installed || 'US' !== $country ) {

View File

@ -63,6 +63,10 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
* @return bool
*/
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' );
$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;
@ -127,11 +131,11 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
$reports = new WC_Admin_Report();
$net_sales_link = 'admin.php?page=wc-reports&tab=orders&range=month';
$net_sales_link = 'admin.php?page=wc-reports&tab=orders&range=month';
$top_seller_link = 'admin.php?page=wc-reports&tab=orders&report=sales_by_product&range=month&product_ids=';
$report_data = $is_wc_admin_disabled ? $this->get_sales_report_data() : $this->get_wc_admin_performance_data();
$report_data = $is_wc_admin_disabled ? $this->get_sales_report_data() : $this->get_wc_admin_performance_data();
if ( ! $is_wc_admin_disabled ) {
$net_sales_link = 'admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period';
$net_sales_link = 'admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period';
$top_seller_link = 'admin.php?page=wc-admin&filter=single_product&path=%2Fanalytics%2Fproducts&products=';
}

View File

@ -3,8 +3,6 @@
* Adds settings to the permalinks admin settings page
*
* @class WC_Admin_Permalink_Settings
* @author WooThemes
* @category Admin
* @package WooCommerce\Admin
* @version 2.3.0
*/
@ -140,23 +138,23 @@ class WC_Admin_Permalink_Settings {
<?php wp_nonce_field( 'wc-permalinks', 'wc-permalinks-nonce' ); ?>
<script type="text/javascript">
jQuery( function() {
jQuery('input.wctog').change(function() {
jQuery('input.wctog').on( 'change', function() {
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();
if ( jQuery(this).val() ) {
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 {
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('.permalink-structure input:checked').change();
jQuery('#woocommerce_permalink_structure').focus( function(){
jQuery('#woocommerce_custom_selection').click();
jQuery('.permalink-structure input:checked').trigger( 'change' );
jQuery('#woocommerce_permalink_structure').on( 'focus', function(){
jQuery('#woocommerce_custom_selection').trigger( 'click' );
} );
} );
</script>

View File

@ -254,12 +254,12 @@ class WC_Admin_Pointers {
button2 = $( '<a class=\"button button-primary\" href=\"#\">' + next + '</a>' ),
wrapper = $( '<div class=\"wc-pointer-buttons\" />' );
button.bind( 'click.pointer', function(e) {
button.on( 'click.pointer', function(e) {
e.preventDefault();
t.element.pointer('destroy');
});
button2.bind( 'click.pointer', function(e) {
button2.on( 'click.pointer', function(e) {
e.preventDefault();
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
$product->set_manage_stock( $manage_stock );
$product->set_backorders( $backorders );
if ( 'external' !== $product->get_type() ) {
$product->set_backorders( $backorders );
}
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'] ) ) : '';
@ -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();
$product->set_manage_stock( $manage_stock );
$product->set_backorders( $backorders );
if ( 'external' !== $product->get_type() ) {
$product->set_backorders( $backorders );
}
if ( 'yes' === get_option( 'woocommerce_manage_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();
$country = WC()->countries->get_base_country();
$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' );
$sell_in_person = get_option( 'woocommerce_sell_in_person', 'none_selected' );

View File

@ -7,6 +7,7 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Utilities\ArrayUtil;
defined( 'ABSPATH' ) || exit;
@ -37,7 +38,8 @@ class WC_Admin_Status {
wp_die( 'Cannot load the REST API to access WC_REST_System_Status_Tools_Controller.' );
}
$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.
$tools_controller = new WC_REST_System_Status_Tools_Controller();
@ -46,14 +48,16 @@ class WC_Admin_Status {
if ( array_key_exists( $action, $tools ) ) {
$response = $tools_controller->execute_tool( $action );
$tool = $tools[ $action ];
$tool = array(
$tool = $tools[ $action ];
$tool_requires_refresh = ArrayUtil::get_value_or_default( $tool, 'requires_refresh', false );
$tool = array(
'id' => $action,
'name' => $tool['name'],
'action' => $tool['button'],
'description' => $tool['desc'],
'disabled' => ArrayUtil::get_value_or_default( $tool, 'disabled', false ),
);
$tool = array_merge( $tool, $response );
$tool = array_merge( $tool, $response );
/**
* Fires after a WooCommerce system status tool has been executed.
@ -80,6 +84,10 @@ class WC_Admin_Status {
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';
}

View File

@ -11,6 +11,8 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
/**
* WC_Admin_Taxonomies class.
*/
@ -49,6 +51,12 @@ class WC_Admin_Taxonomies {
// Category/term ordering.
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_action( 'product_cat_add_form_fields', array( $this, 'add_category_fields' ) );
@ -91,7 +99,7 @@ class WC_Admin_Taxonomies {
* @param string $taxonomy Taxonomy slug.
*/
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;
}

View File

@ -189,7 +189,10 @@ if ( wc_tax_enabled() ) {
<td class="label"><?php echo esc_html( $tax_total->label ); ?>:</td>
<td width="1%"></td>
<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>
</tr>
<?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.addClass( 'update-link' );
$update_link.attr( 'href', update_url );
$update_link.click();
$update_link.trigger( 'click' );
});
$( '#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"]' );
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() {
<?php if ( empty( $this->coupon_codes ) ) : ?>
jQuery( '.section_title:eq(1)' ).click();
jQuery( '.section_title:eq(1)' ).trigger( 'click' );
<?php else : ?>
jQuery( '.section_title:eq(0)' ).click();
jQuery( '.section_title:eq(0)' ).trigger( 'click' );
<?php endif; ?>
} );
</script>
@ -551,15 +551,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
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>
<?php
@ -412,15 +412,15 @@ class WC_Report_Customers extends WC_Admin_Report {
],
}
);
jQuery('.chart-placeholder').resize();
jQuery('.chart-placeholder').trigger( 'resize' );
}
drawGraph();
jQuery('.highlight_series').hover(
jQuery('.highlight_series').on( 'mouseenter',
function() {
drawGraph( jQuery(this).data('series') );
},
} ).on( 'mouseleave',
function() {
drawGraph();
}

View File

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

View File

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

View File

@ -46,12 +46,19 @@ class WC_Settings_Emails extends WC_Settings_Page {
* @return array
*/
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(
'woocommerce_email_settings',
array(
array(
'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',
'id' => 'email_notification_settings',
),

View File

@ -81,7 +81,7 @@ class WC_Settings_General extends WC_Settings_Page {
'title' => __( 'Country / State', 'woocommerce' ),
'desc' => __( 'The country and state or province, if any, in which your business is located.', 'woocommerce' ),
'id' => 'woocommerce_default_country',
'default' => 'GB',
'default' => 'US:CA',
'type' => 'single_select_country',
'desc_tip' => true,
),
@ -229,7 +229,7 @@ class WC_Settings_General extends WC_Settings_Page {
'title' => __( 'Currency', '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',
'default' => 'GBP',
'default' => 'USD',
'type' => 'select',
'class' => 'wc-enhanced-select',
'desc_tip' => true,

View File

@ -63,7 +63,8 @@ if ( ! defined( 'ABSPATH' ) ) {
$topic_data = WC_Admin_Webhooks::get_topic_data( $webhook );
$topics = apply_filters(
'woocommerce_webhook_topics', array(
'woocommerce_webhook_topics',
array(
'' => __( 'Select an option&hellip;', 'woocommerce' ),
'coupon.created' => __( 'Coupon created', 'woocommerce' ),
'coupon.updated' => __( 'Coupon updated', 'woocommerce' ),
@ -197,8 +198,10 @@ if ( ! defined( 'ABSPATH' ) ) {
add_query_arg(
array(
'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>
@ -221,6 +224,6 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( 'action' === current ) {
action_event_field.show();
}
}).change();
}).trigger( 'change' );
});
</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 ?>"
placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
<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="<?php echo esc_attr( $page_section ); ?>">
<input type="hidden" name="section" value="_all">
</form>
<?php if ( '_featured' === $current_section ) : ?>
<div class="addons-featured">

View File

@ -1,8 +1,12 @@
<?php
/**
* Admin View: Page - Status Tools
*
* @package WooCommerce
*/
use Automattic\WooCommerce\Utilities\ArrayUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -12,14 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php settings_fields( 'woocommerce_status_settings_fields' ); ?>
<table class="wc_status_table wc_status_table--tools widefat" cellspacing="0">
<tbody class="tools">
<?php foreach ( $tools as $action => $tool ) : ?>
<tr class="<?php echo sanitize_html_class( $action ); ?>">
<?php foreach ( $tools as $action_name => $tool ) : ?>
<tr class="<?php echo sanitize_html_class( $action_name ); ?>">
<th>
<strong class="name"><?php echo esc_html( $tool['name'] ); ?></strong>
<p class="description"><?php echo wp_kses_post( $tool['desc'] ); ?></p>
</th>
<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>
</tr>
<?php endforeach; ?>

View File

@ -810,7 +810,7 @@ class WC_AJAX {
if ( ! empty( $files ) ) {
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 ) {
$download = new WC_Customer_Download( $inserted_id );
$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' ) );
$this->set_total( 'items_subtotal', NumberUtil::round( $items_subtotal ) );
$this->set_total( 'items_subtotal_tax', wc_round_tax_total( array_sum( $merged_subtotal_taxes ), 0 ) );
// 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', $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_tax( $this->get_total( 'items_subtotal_tax' ) );
@ -788,7 +789,7 @@ final class WC_Cart_Totals {
if ( $item->product->is_taxable() ) {
// 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.
$coupon_discount_tax_amounts[ $coupon_code ] += $item_tax;
@ -862,7 +863,10 @@ final class WC_Cart_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->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.
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.
*/
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.
*/
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.
*/
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.
*/
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();
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(
sprintf(
'<a href="%s" class="button wc-forward">%s</a> %s',
wc_get_cart_url(),
__( 'View cart', 'woocommerce' ),
/* 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 ) )
)
$stock_quantity = $product_data->get_stock_quantity();
$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',
wc_get_cart_url(),
__( 'View cart', 'woocommerce' ),
/* 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( $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'] : '';
if ( $validate_fieldset &&
( isset( $field['type'] ) && 'country' === $field['type'] ) &&
( isset( $field['type'] ) && 'country' === $field['type'] && '' !== $data[ $key ] ) &&
! WC()->countries->country_exists( $data[ $key ] ) ) {
/* translators: ISO 3166-1 alpha-2 country code */
$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();
}
/**
* 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?
*
@ -449,7 +470,19 @@ class WC_Customer extends WC_Legacy_Customer {
* @return array
*/
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
*/
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(
'src' => self::get_asset_url( 'assets/js/selectWoo/selectWoo.full' . $suffix . '.js' ),
'deps' => array( 'jquery' ),
'version' => '1.0.6',
'version' => '1.0.9',
),
'wc-address-i18n' => array(
'src' => self::get_asset_url( 'assets/js/frontend/address-i18n' . $suffix . '.js' ),

View File

@ -139,11 +139,23 @@ class WC_Logger implements WC_Logger_Interface {
}
if ( $this->should_handle( $level ) ) {
$timestamp = current_time( 'timestamp', 1 );
$message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context );
$timestamp = time();
foreach ( $this->handlers as $handler ) {
$handler->handle( $timestamp, $level, $message, $context );
/**
* 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 );
}
}
}
}

View File

@ -179,7 +179,7 @@ class WC_Order extends WC_Abstract_Order {
}
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 {
$formatted_total .= $tax_string;
}

View File

@ -82,7 +82,13 @@ class WC_Tax {
* @return array
*/
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 );
return apply_filters( 'woocommerce_calc_shipping_tax', $taxes, $price, $rates );
}

View File

@ -139,7 +139,7 @@ class WC_Template_Loader {
if ( 0 === $validated_file ) {
$templates[] = $page_template;
} 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.
if ( ! empty( $queried_object->description ) && ( empty( $_GET['product-page'] ) || 1 === absint( $_GET['product-page'] ) ) ) { // WPCS: input var ok, CSRF ok.
$prefix = '<div class="term-description">' . wc_format_content( $queried_object->description ) . '</div>'; // WPCS: XSS 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( wp_kses_post( $queried_object->description ) ) . '</div>';
} else {
$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
*/
private static function get_orders() {
$args = array(
'type' => array( 'shop_order', 'shop_order_refund' ),
'limit' => get_option( 'posts_per_page' ),
'paged' => 1,
$order_dates = self::get_order_dates();
$order_counts = self::get_order_counts();
$order_totals = self::get_order_totals();
$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();
$processing_first = $first;
$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.
$status = 'wc-' . $status;
if ( ! isset( $order_data[ $status ] ) ) {
$order_data[ $status ] = 1;
} else {
$order_data[ $status ] += 1;
}
// Count number of orders by gateway used.
$gateway = $order->get_payment_method();
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();
if ( in_array( $status, array( 'wc-completed', 'wc-refunded' ) ) ) {
if ( ! isset( $order_data['gross'] ) ) {
$order_data['gross'] = $total;
} else {
$order_data['gross'] += $total;
}
} elseif ( 'wc-processing' == $status ) {
if ( ! isset( $order_data['processing_gross'] ) ) {
$order_data['processing_gross'] = $total;
} else {
$order_data['processing_gross'] += $total;
}
}
}
$args['paged']++;
$orders = wc_get_orders( $args );
$orders_count = count( $orders );
if ( is_null( $gross_total ) ) {
$gross_total = 0;
}
if ( $first !== $first_time ) {
$order_data['first'] = gmdate( 'Y-m-d H:i:s', $first );
$processing_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 = 'wc-processing'
GROUP BY order_meta.meta_key
"
);
if ( is_null( $processing_gross_total ) ) {
$processing_gross_total = 0;
}
if ( $processing_first !== $first_time ) {
$order_data['processing_first'] = gmdate( 'Y-m-d H:i:s', $processing_first );
return array(
'gross' => $gross_total,
'processing_gross' => $processing_gross_total,
);
}
/**
* Get last order date.
*
* @return string
*/
private static function get_order_dates() {
global $wpdb;
$min_max = $wpdb->get_row(
"
SELECT
MIN( post_date_gmt ) as 'first', MAX( post_date_gmt ) as 'last'
FROM {$wpdb->prefix}posts
WHERE post_type = 'shop_order'
AND post_status = 'wc-completed'
",
ARRAY_A
);
if ( is_null( $min_max ) ) {
$min_max = array(
'first' => '-',
'last' => '-',
);
}
if ( $last ) {
$order_data['last'] = gmdate( 'Y-m-d H:i:s', $last );
$processing_min_max = $wpdb->get_row(
"
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_last ) {
$order_data['processing_last'] = gmdate( 'Y-m-d H:i:s', $processing_last );
return array_merge( $min_max, $processing_min_max );
}
/**
* 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;
}
foreach ( $order_data as $key => $value ) {
$order_data[ $key ] = (string) $value;
}
return $order_data;
return $orders_by_gateway_currency;
}
/**
@ -635,17 +683,6 @@ class WC_Tracker {
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.
*

View File

@ -9,6 +9,8 @@
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster;
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
use Automattic\WooCommerce\Proxies\LegacyProxy;
/**
@ -206,6 +208,8 @@ final class WooCommerce {
// These classes set up hooks on instantiation.
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
*/
use Automattic\WooCommerce\Internal\ThemeSupport;
defined( 'ABSPATH' ) || exit;
/**
@ -13,10 +15,19 @@ defined( 'ABSPATH' ) || exit;
*/
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.
*/
public function __construct() {
$this->theme_support = wc_get_container()->get( ThemeSupport::class );
add_action( 'customize_register', array( $this, 'add_sections' ) );
add_action( 'customize_controls_print_styles', array( $this, 'add_styles' ) );
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?
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).change();
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).trigger( 'change' );
} );
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(
'woocommerce_single_image_width',
array(
'default' => 600,
'default' => $this->theme_support->get_option( 'single_image_width', 600 ),
'type' => 'option',
'capability' => 'manage_woocommerce',
'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(
'woocommerce_thumbnail_image_width',
array(
'default' => 300,
'default' => $this->theme_support->get_option( 'thumbnail_image_width', 300 ),
'type' => 'option',
'capability' => 'manage_woocommerce',
'sanitize_callback' => 'absint',
@ -769,7 +780,7 @@ class WC_Shop_Customizer {
);
} else {
$choose_pages = array(
'woocommerce_terms_page_id' => __( 'Terms and conditions', 'woocommerce' ),
'woocommerce_terms_page_id' => __( 'Terms and conditions', 'woocommerce' ),
);
}
$pages = get_pages(

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 ) {
try {
$default = wc_get_customer_default_location();
$has_shipping_address = $customer->has_shipping_address();
if ( ! $customer->get_billing_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() );
}
@ -139,7 +140,7 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust
$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() );
}

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