Completed
Push — add-autoloader-loader-package ( 92b21b )
by
unknown
06:55
created

jetpack_admin_missing_autoloader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
3
namespace Jetpack\Assets;
4
5
class AutoloaderLoader {
6
7
	public function load_autoloader() {
8
		// Load all the packages.
9
		$jetpack_autoloader = plugin_dir_path( __FILE__ ) . '/vendor/autoload.php';
10
		if ( is_readable( $jetpack_autoloader ) ) {
11
			require $jetpack_autoloader;
12
		} else {
13
			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
14
				error_log(
15
					sprintf(
16
						/* translators: Placeholder is a link to a support document. */
17
						__( 'Your installation of Jetpack is incomplete. If you installed Jetpack from GitHub, please refer to <a href="%1$s" target="_blank" rel="noopener noreferrer">this document</a> to set up your development environment.', 'jetpack' ),
18
						esc_url( 'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md' )
19
					)
20
				);
21
			}
22
			add_action( 'admin_notices', array( $this, 'jetpack_admin_missing_autoloader' ) );
23
			return;
24
		}
25
	}
26
27
	/**
28
	 * Outputs an admin notice for folks running Jetpack without having run composer install.
29
	 *
30
	 * @since 7.4.0
31
	 */
32
	public function jetpack_admin_missing_autoloader() { ?>
33
		<div class="notice notice-error is-dismissible">
34
			<p>
35
				<?php
36
				printf(
37
					/* translators: Placeholder is a link to a support document. */
38
					__( 'Your installation of Jetpack is incomplete. If you installed Jetpack from GitHub, please refer to <a href="%1$s" target="_blank" rel="noopener noreferrer">this document</a> to set up your development environment.', 'jetpack' ),
39
					esc_url( 'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md' )
40
				);
41
				?>
42
			</p>
43
			</p>
44
		</div>
45
		<?php
46
	}
47
}
48