-
Notifications
You must be signed in to change notification settings - Fork 44
Replace usage of deprecated wc_enqueue_js()
#800
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
07d5070
Replace usage of deprecated wc_enqueue_js
agibson-godaddy 9c6fe96
Separate out registration
agibson-godaddy 090e21f
Remove dependencies & add doing it wrong check
agibson-godaddy 34b009f
Update doing it wrong wording
agibson-godaddy 7fd562e
Add jQuery helper
agibson-godaddy 5939858
Merge branch 'mwc-19182' of github.com:godaddy-wordpress/wc-plugin-fr…
agibson-godaddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <?php | ||
| /** | ||
| * WooCommerce Plugin Framework | ||
| * | ||
| * This source file is subject to the GNU General Public License v3.0 | ||
| * that is bundled with this package in the file license.txt. | ||
| * It is also available through the world-wide-web at this URL: | ||
| * http://www.gnu.org/licenses/gpl-3.0.html | ||
| * If you did not receive a copy of the license and are unable to | ||
| * obtain it through the world-wide-web, please send an email | ||
| * to license@skyverge.com so we can send you a copy immediately. | ||
| * | ||
| * DISCLAIMER | ||
| * | ||
| * Do not edit or add to this file if you wish to upgrade the plugin to newer | ||
| * versions in the future. If you wish to customize the plugin for your | ||
| * needs please refer to http://www.skyverge.com | ||
| * | ||
| * @package SkyVerge/WooCommerce/Helpers | ||
| * @author SkyVerge | ||
| * @copyright Copyright (c) 2013-2026, SkyVerge, Inc. | ||
| * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 | ||
| */ | ||
|
|
||
| namespace SkyVerge\WooCommerce\PluginFramework\v6_0_1\Helpers; | ||
|
|
||
| class ScriptHelper | ||
| { | ||
| /** | ||
| * Adds inline JavaScript. | ||
| * | ||
| * @since 6.0.1 | ||
| * | ||
| * @param string $handle Handle name | ||
| * @param string $javaScriptString The JavaScript code to add inline | ||
| * @return bool True if successfully added | ||
| */ | ||
| public static function addInlineScript(string $handle, string $javaScriptString) : bool | ||
agibson-godaddy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| if (did_action('wp_print_footer_scripts')) { | ||
| _doing_it_wrong(__METHOD__, 'Inline scripts should be added before the wp_print_footer_scripts action.', '6.0.1'); | ||
| } | ||
|
|
||
| if (! wp_script_is($handle, 'registered')) { | ||
| wp_register_script($handle, false, [], false, true); | ||
| } | ||
|
|
||
| if (! wp_script_is($handle, 'enqueued')) { | ||
| wp_enqueue_script($handle); | ||
| } | ||
|
|
||
| return wp_add_inline_script($handle, $javaScriptString); | ||
| } | ||
|
|
||
| /** | ||
| * Adds inline jQuery. | ||
| * This calls {@see static::addInlineScript()} but with automatic jQuery wrapping. | ||
| * | ||
| * @since 6.0.1 | ||
| * | ||
| * @param string $handle Handle name | ||
| * @param string $javaScriptString The JavaScript code to add inline | ||
| * @return bool True if successfully added | ||
| */ | ||
| public static function addInlinejQuery(string $handle, string $javaScriptString) : bool | ||
| { | ||
| return static::addInlineScript( | ||
| $handle, | ||
| 'jQuery(function($) { '.$javaScriptString.' });' | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.