Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script enqueue que #2094

Merged
merged 8 commits into from May 26, 2016
Merged

Conversation

jtsternberg
Copy link
Contributor

@jtsternberg jtsternberg commented May 26, 2016

Update WPSC_Template_Engine to handle registering enqueued scripts.

Because of the output buffering, there are many cases where naked calls
to wp_enqueue_script will not work as it happens too early. This allows a
CRUD interface for dealing with those scripts and also allows us to
provide an interface for localizing variables within the WPSC namespace.

The 'sizes' parameter in the $metadata array passed through the
'wp_generate_attachment_metadata' is not guaranteed to be there, and
therefore can cause the following notices/warnings:

- PHP Notice:  Undefined index: sizes in
.../wp-e-commerce/wpsc-components/theme-engine-v2/helpers/template-engine.php
on line 481

- PHP Warning:  array_key_exists() expects parameter 2 to be array, null
given in
.../wp-e-commerce/wpsc-components/theme-engine-v2/helpers/template-engine.php
on line 481
Because of the output buffering, there are many cases where naked calls
to wp_enqueue_script will not work as it happens to early. This allows a
CRUD interface for dealing with those scripts.
As per the previous commit, we need a way to enqueue scripts before
they are registered. This allows us to do so as well as provide an
interface for localizing variables within the WPSC namespace.

Also includes a bit of cleanup in copy-billing.js
Serializes, ensures sane length and sanitizes.
@JustinSainton JustinSainton merged commit 145421e into wp-e-commerce:master May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants