Skip to content

Commit 89a9af9

Browse files
gravityrailgititon
authored andcommitted
Statically access asset tools (#12744)
Statically access asset tools (#12744)
1 parent 5f09806 commit 89a9af9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+516
-316
lines changed

_inc/client/components/settings-card/index.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ export const SettingsCard = props => {
150150
return (
151151
<JetpackBanner
152152
callToAction={ upgradeLabel }
153-
title={ __( 'Connect your site to Google Analytics in seconds with Jetpack Premium or Professional.' ) }
153+
title={ __(
154+
'Connect your site to Google Analytics in seconds with Jetpack Premium or Professional.'
155+
) }
154156
plan={ PLAN_JETPACK_PREMIUM }
155157
feature={ feature }
156158
onClick={ handleClickForTracking( feature ) }

_inc/client/my-plan/my-plan-header/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class MyPlanHeader extends React.Component {
5858
'Worried about security? Get backups, automated security fixes and more: {{a}}Upgrade now{{/a}}',
5959
{
6060
components: {
61-
a: <UpgradeLink source="myplan-header-free-plan-text-link" />
62-
}
61+
a: <UpgradeLink source="myplan-header-free-plan-text-link" />,
62+
},
6363
}
6464
) }
6565
</p>

_inc/lib/admin-pages/class.jetpack-settings-page.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Automattic\Jetpack\Tracking;
4+
use Automattic\Jetpack\Assets;
45

56
include_once( 'class.jetpack-admin-page.php' );
67
include_once( JETPACK__PLUGIN_DIR . 'class.jetpack-modules-list-table.php' );
@@ -137,7 +138,7 @@ function additional_styles() {
137138
function page_admin_scripts() {
138139
wp_enqueue_script(
139140
'jetpack-admin-js',
140-
Jetpack::get_file_url_for_environment( '_inc/build/jetpack-admin.min.js', '_inc/jetpack-admin.js' ),
141+
Assets::get_file_url_for_environment( '_inc/build/jetpack-admin.min.js', '_inc/jetpack-admin.js' ),
141142
array( 'jquery' ),
142143
JETPACK__VERSION
143144
);

class.jetpack-connection-banner.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Automattic\Jetpack\Assets\Logo;
4+
use Automattic\Jetpack\Assets;
45

56
class Jetpack_Connection_Banner {
67
/**
@@ -105,7 +106,7 @@ function maybe_initialize_hooks( $current_screen ) {
105106
public static function enqueue_banner_scripts() {
106107
wp_enqueue_script(
107108
'jetpack-connection-banner-js',
108-
Jetpack::get_file_url_for_environment(
109+
Assets::get_file_url_for_environment(
109110
'_inc/build/jetpack-connection-banner.min.js',
110111
'_inc/jetpack-connection-banner.js'
111112
),

class.jetpack-idc.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Automattic\Jetpack\Assets;
34
use Automattic\Jetpack\Logo as Jetpack_Logo;
45

56
/**
@@ -256,7 +257,7 @@ function enqueue_idc_notice_files() {
256257

257258
wp_enqueue_script(
258259
'jetpack-idc-js',
259-
Jetpack::get_file_url_for_environment( '_inc/build/idc-notice.min.js', '_inc/idc-notice.js' ),
260+
Assets::get_file_url_for_environment( '_inc/build/idc-notice.min.js', '_inc/idc-notice.js' ),
260261
array( 'jquery' ),
261262
JETPACK__VERSION,
262263
true

class.jetpack-modules-list-table.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use Automattic\Jetpack\Assets;
4+
35
if ( ! class_exists( 'WP_List_Table' ) )
46
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
57

@@ -29,7 +31,7 @@ function __construct() {
2931

3032
wp_register_script(
3133
'models.jetpack-modules',
32-
Jetpack::get_file_url_for_environment(
34+
Assets::get_file_url_for_environment(
3335
'_inc/build/jetpack-modules.models.min.js',
3436
'_inc/jetpack-modules.models.js'
3537
),
@@ -38,7 +40,7 @@ function __construct() {
3840
);
3941
wp_register_script(
4042
'views.jetpack-modules',
41-
Jetpack::get_file_url_for_environment(
43+
Assets::get_file_url_for_environment(
4244
'_inc/build/jetpack-modules.views.min.js',
4345
'_inc/jetpack-modules.views.js'
4446
),
@@ -47,7 +49,7 @@ function __construct() {
4749
);
4850
wp_register_script(
4951
'jetpack-modules-list-table',
50-
Jetpack::get_file_url_for_environment(
52+
Assets::get_file_url_for_environment(
5153
'_inc/build/jetpack-modules.min.js',
5254
'_inc/jetpack-modules.js'
5355
),

class.jetpack.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Automattic\Jetpack\Sync\Sender;
1111
use Automattic\Jetpack\Sync\Users;
1212
use Automattic\Jetpack\Tracking;
13+
use Automattic\Jetpack\Assets;
1314

1415
/*
1516
Options:
@@ -1086,7 +1087,7 @@ public function register_assets() {
10861087
if ( ! wp_script_is( 'spin', 'registered' ) ) {
10871088
wp_register_script(
10881089
'spin',
1089-
self::get_file_url_for_environment( '_inc/build/spin.min.js', '_inc/spin.js' ),
1090+
Assets::get_file_url_for_environment( '_inc/build/spin.min.js', '_inc/spin.js' ),
10901091
false,
10911092
'1.3'
10921093
);
@@ -1095,7 +1096,7 @@ public function register_assets() {
10951096
if ( ! wp_script_is( 'jquery.spin', 'registered' ) ) {
10961097
wp_register_script(
10971098
'jquery.spin',
1098-
self::get_file_url_for_environment( '_inc/build/jquery.spin.min.js', '_inc/jquery.spin.js' ),
1099+
Assets::get_file_url_for_environment( '_inc/build/jquery.spin.min.js', '_inc/jquery.spin.js' ),
10991100
array( 'jquery', 'spin' ),
11001101
'1.3'
11011102
);
@@ -1104,7 +1105,7 @@ public function register_assets() {
11041105
if ( ! wp_script_is( 'jetpack-gallery-settings', 'registered' ) ) {
11051106
wp_register_script(
11061107
'jetpack-gallery-settings',
1107-
self::get_file_url_for_environment( '_inc/build/gallery-settings.min.js', '_inc/gallery-settings.js' ),
1108+
Assets::get_file_url_for_environment( '_inc/build/gallery-settings.min.js', '_inc/gallery-settings.js' ),
11081109
array( 'media-views' ),
11091110
'20121225'
11101111
);
@@ -1113,7 +1114,7 @@ public function register_assets() {
11131114
if ( ! wp_script_is( 'jetpack-twitter-timeline', 'registered' ) ) {
11141115
wp_register_script(
11151116
'jetpack-twitter-timeline',
1116-
self::get_file_url_for_environment( '_inc/build/twitter-timeline.min.js', '_inc/twitter-timeline.js' ),
1117+
Assets::get_file_url_for_environment( '_inc/build/twitter-timeline.min.js', '_inc/twitter-timeline.js' ),
11171118
array( 'jquery' ),
11181119
'4.0.0',
11191120
true
@@ -1123,7 +1124,7 @@ public function register_assets() {
11231124
if ( ! wp_script_is( 'jetpack-facebook-embed', 'registered' ) ) {
11241125
wp_register_script(
11251126
'jetpack-facebook-embed',
1126-
self::get_file_url_for_environment( '_inc/build/facebook-embed.min.js', '_inc/facebook-embed.js' ),
1127+
Assets::get_file_url_for_environment( '_inc/build/facebook-embed.min.js', '_inc/facebook-embed.js' ),
11271128
array( 'jquery' ),
11281129
null,
11291130
true
@@ -6993,11 +6994,7 @@ public static function is_function_in_backtrace( $names ) {
69936994
* @return string The URL to the file
69946995
*/
69956996
public static function get_file_url_for_environment( $min_path, $non_min_path ) {
6996-
$path = ( Constants::is_defined( 'SCRIPT_DEBUG' ) && Constants::get_constant( 'SCRIPT_DEBUG' ) )
6997-
? $non_min_path
6998-
: $min_path;
6999-
7000-
return plugins_url( $path, JETPACK__PLUGIN_FILE );
6997+
return Assets::get_file_url_for_environment( $min_path, $non_min_path );
70016998
}
70026999

70037000
/**

class.photon.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use Automattic\Jetpack\Assets;
4+
35
class Jetpack_Photon {
46
/**
57
* Class variables
@@ -1184,7 +1186,7 @@ public function action_wp_enqueue_scripts() {
11841186
}
11851187
wp_enqueue_script(
11861188
'jetpack-photon',
1187-
Jetpack::get_file_url_for_environment(
1189+
Assets::get_file_url_for_environment(
11881190
'_inc/build/photon/photon.min.js',
11891191
'modules/photon/photon.js'
11901192
),

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"automattic/jetpack-logo": "@dev",
1515
"automattic/jetpack-constants": "@dev",
1616
"automattic/jetpack-jitm": "@dev",
17-
"automattic/jetpack-asset-tools": "@dev",
17+
"automattic/jetpack-assets": "@dev",
1818
"automattic/jetpack-sync": "@dev",
1919
"automattic/jetpack-tracking": "@dev",
2020
"automattic/jetpack-autoloader": "@dev"

0 commit comments

Comments
 (0)