← All changes
|
jetpack_vendor/automattic/jetpack-licensing/src/class-licensing.php
+31
-0
16.2-beta
→
16.3-beta
View file →
| @@ -66,8 +66,39 @@ | ||
| 66 | 66 | add_action( 'rest_api_init', array( $this, 'initialize_endpoints' ) ); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | + * Register the hooks the package needs on every request. | |
| 71 | + * | |
| 72 | + * Separate from `initialize()`, which consumers call only when they offer the | |
| 73 | + * licensing UI: the activation screen also renders from the Jetpack plugin's | |
| 74 | + * own route, so the illustrations need a URL there too. | |
| 75 | + * | |
| 76 | + * @since 4.1.0 | |
| 77 | + * | |
| 78 | + * @return void | |
| 79 | + */ | |
| 80 | + public static function configure() { | |
| 81 | + add_filter( 'jetpack_admin_js_script_data', array( self::class, 'add_script_data' ) ); | |
| 82 | + } | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Add the package's image base URL to the admin script data. | |
| 86 | + * | |
| 87 | + * Other plugins' bundles request the activation screen's images from this copy, so never rename one. | |
| 88 | + * | |
| 89 | + * @since 4.1.0 | |
| 90 | + * | |
| 91 | + * @param array $data Script data. | |
| 92 | + * @return array | |
| 93 | + */ | |
| 94 | + public static function add_script_data( $data ) { | |
| 95 | + $data['licensing']['assetsUrl'] = trailingslashit( plugins_url( 'assets/images/', __DIR__ ) ); | |
| 96 | + | |
| 97 | + return $data; | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 70 | 101 | * Initialize endpoints required for Licensing package. |
| 71 | 102 | * |
| 72 | 103 | * @since 1.7.0 |
| 73 | 104 | * |