These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * Plugin Name: Jetpack by WordPress.com |
||
5 | * Plugin URI: https://jetpack.com |
||
6 | * Description: Bring the power of the WordPress.com cloud to your self-hosted WordPress. Jetpack enables you to connect your blog to a WordPress.com account to use the powerful features normally only available to WordPress.com users. |
||
7 | * Author: Automattic |
||
8 | * Version: 7.4-alpha |
||
9 | * Author URI: https://jetpack.com |
||
10 | * License: GPL2+ |
||
11 | * Text Domain: jetpack |
||
12 | * Domain Path: /languages/ |
||
13 | */ |
||
14 | error_log( 'loading jetpack ' ); |
||
15 | define( 'JETPACK__MINIMUM_WP_VERSION', '5.0' ); |
||
16 | |||
17 | define( 'JETPACK__VERSION', '7.4-alpha' ); |
||
18 | define( 'JETPACK_MASTER_USER', true ); |
||
19 | define( 'JETPACK__API_VERSION', 1 ); |
||
20 | define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
||
21 | define( 'JETPACK__PLUGIN_FILE', __FILE__ ); |
||
22 | |||
23 | defined( 'JETPACK_CLIENT__AUTH_LOCATION' ) or define( 'JETPACK_CLIENT__AUTH_LOCATION', 'header' ); |
||
24 | defined( 'JETPACK_CLIENT__HTTPS' ) or define( 'JETPACK_CLIENT__HTTPS', 'AUTO' ); |
||
25 | defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) or define( 'JETPACK__GLOTPRESS_LOCALES_PATH', JETPACK__PLUGIN_DIR . 'locales.php' ); |
||
26 | defined( 'JETPACK__API_BASE' ) or define( 'JETPACK__API_BASE', 'https://jetpack.wordpress.com/jetpack.' ); |
||
27 | defined( 'JETPACK_PROTECT__API_HOST' ) or define( 'JETPACK_PROTECT__API_HOST', 'https://api.bruteprotect.com/' ); |
||
28 | defined( 'JETPACK__WPCOM_JSON_API_HOST' ) or define( 'JETPACK__WPCOM_JSON_API_HOST', 'public-api.wordpress.com' ); |
||
29 | |||
30 | defined( 'JETPACK__SANDBOX_DOMAIN' ) or define( 'JETPACK__SANDBOX_DOMAIN', '' ); |
||
31 | |||
32 | defined( 'JETPACK__DEBUGGER_PUBLIC_KEY' ) or define( |
||
33 | 'JETPACK__DEBUGGER_PUBLIC_KEY', |
||
34 | "\r\n" . '-----BEGIN PUBLIC KEY-----' . "\r\n" |
||
35 | . 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm+uLLVoxGCY71LS6KFc6' . "\r\n" |
||
36 | . '1UnF6QGBAsi5XF8ty9kR3/voqfOkpW+gRerM2Kyjy6DPCOmzhZj7BFGtxSV2ZoMX' . "\r\n" |
||
37 | . '9ZwWxzXhl/Q/6k8jg8BoY1QL6L2K76icXJu80b+RDIqvOfJruaAeBg1Q9NyeYqLY' . "\r\n" |
||
38 | . 'lEVzN2vIwcFYl+MrP/g6Bc2co7Jcbli+tpNIxg4Z+Hnhbs7OJ3STQLmEryLpAxQO' . "\r\n" |
||
39 | . 'q8cbhQkMx+FyQhxzSwtXYI/ClCUmTnzcKk7SgGvEjoKGAmngILiVuEJ4bm7Q1yok' . "\r\n" |
||
40 | . 'xl9+wcfW6JAituNhml9dlHCWnn9D3+j8pxStHihKy2gVMwiFRjLEeD8K/7JVGkb/' . "\r\n" |
||
41 | . 'EwIDAQAB' . "\r\n" |
||
42 | . '-----END PUBLIC KEY-----' . "\r\n" |
||
43 | ); |
||
44 | |||
45 | /** |
||
46 | * Returns the location of Jetpack's lib directory. This filter is applied |
||
47 | * in require_lib(). |
||
48 | * |
||
49 | * @since 4.0.2 |
||
50 | * |
||
51 | * @return string Location of Jetpack library directory. |
||
52 | * |
||
53 | * @filter require_lib_dir |
||
54 | */ |
||
55 | function jetpack_require_lib_dir() { |
||
56 | return JETPACK__PLUGIN_DIR . '_inc/lib'; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * THIS CODE WOULD NEED TO BE DUPLICATED IN EACH PLUGIN... |
||
61 | */ |
||
62 | View Code Duplication | if ( ! function_exists( 'jetpack_enqueue_library' ) ) { |
|
63 | function jetpack_enqueue_library( $class_name, $version, $path ) { |
||
0 ignored issues
–
show
|
|||
64 | global $jetpack_libraries; |
||
65 | if ( ! is_array( $jetpack_libraries ) ) { |
||
66 | $jetpack_libraries = array(); |
||
67 | } |
||
68 | if ( ! isset( $jetpack_libraries[ $class_name ] ) ) { |
||
69 | $jetpack_libraries[ $class_name ] = array(); |
||
70 | } |
||
71 | $jetpack_libraries[ $class_name ][] = array( 'version' => $version, 'path' => $path ); |
||
72 | } |
||
73 | |||
74 | // add the autoloader |
||
75 | spl_autoload_register( function ($class_name) { |
||
76 | global $jetpack_libraries; |
||
77 | if ( ! isset( $jetpack_libraries[ $class_name ] ) ) { |
||
78 | // the library is not registered try a different autoloader |
||
79 | return; |
||
80 | } |
||
81 | |||
82 | if ( ! did_action( 'plugin_loaded' ) ) { |
||
83 | _doing_it_wrong( $class_name , 'Not all plugins have loaded yet!' ); |
||
84 | } |
||
85 | |||
86 | $initial = array_shift($jetpack_libraries[ $class_name ] ); |
||
87 | $max_version_info = array_reduce( $jetpack_libraries[ $class_name ], function( $carry_class_info, $class_info ) { |
||
88 | if ( version_compare( $class_info['version'], $carry_class_info['version'], '>' ) ) { |
||
89 | return $class_info; |
||
90 | } |
||
91 | return $carry_class_info; |
||
92 | }, $initial ); |
||
93 | |||
94 | require_once $max_version_info['path']; |
||
95 | } ); |
||
96 | } |
||
97 | /** |
||
98 | * END OF DUPLICATE CODE |
||
99 | */ |
||
100 | |||
101 | /** |
||
102 | * Checks if the code debug mode turned on, and returns false if it is. When Jetpack is in |
||
103 | * code debug mode, it shouldn't use minified assets. Note that this filter is not being used |
||
104 | * in every place where assets are enqueued. The filter is added at priority 9 to be overridden |
||
105 | * by any default priority filter that runs after it. |
||
106 | * |
||
107 | * @since 6.2.0 |
||
108 | * |
||
109 | * @return boolean |
||
110 | * |
||
111 | * @filter jetpack_should_use_minified_assets |
||
112 | */ |
||
113 | function jetpack_should_use_minified_assets() { |
||
114 | if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
||
115 | return false; |
||
116 | } |
||
117 | return true; |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Outputs for an admin notice about running Jetpack on outdated WordPress. |
||
122 | * |
||
123 | * @since 7.2.0 |
||
124 | */ |
||
125 | function jetpack_admin_unsupported_wp_notice() { ?> |
||
126 | <div class="notice notice-error is-dismissible"> |
||
127 | <p><?php esc_html_e( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ); ?></p> |
||
128 | </div> |
||
129 | <?php |
||
130 | } |
||
131 | |||
132 | if ( version_compare( $GLOBALS['wp_version'], JETPACK__MINIMUM_WP_VERSION, '<' ) ) { |
||
133 | add_action( 'admin_notices', 'jetpack_admin_unsupported_wp_notice' ); |
||
134 | return; |
||
135 | } |
||
136 | |||
137 | add_filter( 'jetpack_require_lib_dir', 'jetpack_require_lib_dir' ); |
||
138 | add_filter( 'jetpack_should_use_minified_assets', 'jetpack_should_use_minified_assets', 9 ); |
||
139 | |||
140 | // @todo: Abstract out the admin functions, and only include them if is_admin() |
||
141 | jetpack_enqueue_library( 'Jetpack', '7.3', JETPACK__PLUGIN_DIR . 'class.jetpack.php' ); |
||
142 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-network.php' ); |
||
143 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-client.php' ); |
||
144 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-data.php' ); |
||
145 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-client-server.php' ); |
||
146 | require_once( JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-actions.php' ); |
||
147 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-options.php' ); |
||
148 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-user-agent.php' ); |
||
149 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-post-images.php' ); |
||
150 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-error.php' ); |
||
151 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-heartbeat.php' ); |
||
152 | require_once( JETPACK__PLUGIN_DIR . 'class.photon.php' ); |
||
153 | require_once( JETPACK__PLUGIN_DIR . 'functions.photon.php' ); |
||
154 | require_once( JETPACK__PLUGIN_DIR . 'functions.global.php' ); |
||
155 | require_once( JETPACK__PLUGIN_DIR . 'functions.compat.php' ); |
||
156 | require_once( JETPACK__PLUGIN_DIR . 'functions.gallery.php' ); |
||
157 | require_once( JETPACK__PLUGIN_DIR . 'require-lib.php' ); |
||
158 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-autoupdate.php' ); |
||
159 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-tracks.php' ); |
||
160 | require_once( JETPACK__PLUGIN_DIR . 'class.frame-nonce-preview.php' ); |
||
161 | require_once( JETPACK__PLUGIN_DIR . 'modules/module-headings.php'); |
||
162 | jetpack_enqueue_library( 'Jetpack_Constants', '7.3', JETPACK__PLUGIN_DIR . 'class.jetpack-constants.php' ); |
||
163 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-idc.php' ); |
||
164 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-connection-banner.php' ); |
||
165 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-plan.php' ); |
||
166 | |||
167 | if ( is_admin() ) { |
||
168 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-admin.php' ); |
||
169 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-jitm.php' ); |
||
170 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-affiliate.php' ); |
||
171 | jetpack_require_lib( 'debugger' ); |
||
172 | } |
||
173 | |||
174 | // Play nice with http://wp-cli.org/ |
||
175 | if ( defined( 'WP_CLI' ) && WP_CLI ) { |
||
176 | require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-cli.php' ); |
||
177 | } |
||
178 | |||
179 | require_once( JETPACK__PLUGIN_DIR . '_inc/lib/class.core-rest-api-endpoints.php' ); |
||
180 | |||
181 | register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) ); |
||
182 | register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) ); |
||
183 | add_action( 'updating_jetpack_version', array( 'Jetpack', 'do_version_bump' ), 10, 2 ); |
||
184 | add_action( 'init', array( 'Jetpack', 'init' ) ); |
||
185 | add_action( 'plugins_loaded', array( 'Jetpack', 'plugin_textdomain' ), 99 ); |
||
186 | add_action( 'plugins_loaded', array( 'Jetpack', 'load_modules' ), 100 ); |
||
187 | add_filter( 'jetpack_static_url', array( 'Jetpack', 'staticize_subdomain' ) ); |
||
188 | add_filter( 'is_jetpack_site', '__return_true' ); |
||
189 | |||
190 | /** |
||
191 | * Add an easy way to photon-ize a URL that is safe to call even if Jetpack isn't active. |
||
192 | * |
||
193 | * See: http://jetpack.com/2013/07/11/photon-and-themes/ |
||
194 | */ |
||
195 | if ( Jetpack::is_module_active( 'photon' ) ) { |
||
196 | add_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 ); |
||
197 | } |
||
198 | |||
199 | if ( JETPACK__SANDBOX_DOMAIN ) { |
||
200 | require_once( JETPACK__PLUGIN_DIR . '_inc/jetpack-server-sandbox.php' ); |
||
201 | } |
||
202 | |||
203 | require_once( JETPACK__PLUGIN_DIR . '3rd-party/3rd-party.php' ); |
||
204 | |||
205 | Jetpack::init(); |
||
206 |
This check looks for functions that have already been defined in other files.
Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the
@ignore
annotation.See also the PhpDoc documentation for @ignore.