Code Duplication    Length = 46-46 lines in 2 locations

projects/plugins/beta/jetpack-beta.php 1 location

@@ 74-119 (lines=46) @@
71
 *   and where we add on to various hooks that we expect to always run.
72
 */
73
$jetpack_beta_autoloader = JPBETA__PLUGIN_DIR . 'vendor/autoload_packages.php';
74
if ( is_readable( $jetpack_beta_autoloader ) ) {
75
	require $jetpack_beta_autoloader;
76
} else {
77
	if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
78
		error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
79
			sprintf(
80
			/* translators: Placeholder is a link to a support document. */
81
				__( 'Your installation of Jetpack Beta is incomplete. If you installed Jetpack from GitHub, please refer to this document to set up your development environment: %1$s', 'jetpack' ),
82
				'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md'
83
			)
84
		);
85
	}
86
87
	/**
88
	 * Outputs an admin notice for folks running Jetpack without having run composer install.
89
	 *
90
	 * @since 7.4.0
91
	 */
92
	function jetpack_admin_missing_autoloader() {
93
		?>
94
		<div class="notice notice-error is-dismissible">
95
			<p>
96
				<?php
97
				printf(
98
					wp_kses(
99
					/* translators: Placeholder is a link to a support document. */
100
						__( 'Your installation of Jetpack Beta 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. Ensure you have run jetpack install plugins/beta.', 'jetpack' ),
101
						array(
102
							'a' => array(
103
								'href'   => array(),
104
								'target' => array(),
105
								'rel'    => array(),
106
							),
107
						)
108
					),
109
					'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md'
110
				);
111
				?>
112
			</p>
113
		</div>
114
		<?php
115
	}
116
117
	add_action( 'admin_notices', 'jetpack_admin_missing_autoloader' );
118
	return;
119
}
120
121
require_once 'class-jetpack-beta-autoupdate-self.php';
122
require_once 'class-jetpackbetaclicommand.php';

projects/plugins/jetpack/jetpack.php 1 location

@@ 139-184 (lines=46) @@
136
 *   and where we add on to various hooks that we expect to always run.
137
 */
138
$jetpack_autoloader = JETPACK__PLUGIN_DIR . 'vendor/autoload_packages.php';
139
if ( is_readable( $jetpack_autoloader ) ) {
140
	require $jetpack_autoloader;
141
} else {
142
	if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
143
		error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
144
			sprintf(
145
				/* translators: Placeholder is a link to a support document. */
146
				__( 'Your installation of Jetpack is incomplete. If you installed Jetpack from GitHub, please refer to this document to set up your development environment: %1$s', 'jetpack' ),
147
				'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md'
148
			)
149
		);
150
	}
151
152
	/**
153
	 * Outputs an admin notice for folks running Jetpack without having run composer install.
154
	 *
155
	 * @since 7.4.0
156
	 */
157
	function jetpack_admin_missing_autoloader() {
158
		?>
159
		<div class="notice notice-error is-dismissible">
160
			<p>
161
				<?php
162
				printf(
163
					wp_kses(
164
						/* translators: Placeholder is a link to a support document. */
165
						__( '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' ),
166
						array(
167
							'a' => array(
168
								'href'   => array(),
169
								'target' => array(),
170
								'rel'    => array(),
171
							),
172
						)
173
					),
174
					'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md'
175
				);
176
				?>
177
			</p>
178
		</div>
179
		<?php
180
	}
181
182
	add_action( 'admin_notices', 'jetpack_admin_missing_autoloader' );
183
	return;
184
}
185
186
register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) );
187
register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) );