PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-connection/src/class-urls.php +26 -2 13.2.4 → 16.3 View file →
@@ -81,10 +81,10 @@
81 81
82 82 /**
83 83 * Return URL with a normalized protocol.
84 84 *
85 - * @param callable $callable Function to retrieve URL option.
86 - * @param string $new_value URL Protocol to set URLs to.
85 + * @param string $callable Function name that was used to retrieve URL option.
86 + * @param string $new_value URL Protocol to set URLs to.
87 87 * @return string Normalized URL.
88 88 */
89 89 public static function get_protocol_normalized_url( $callable, $new_value ) {
90 90 $option_key = self::HTTPS_CHECK_OPTION_PREFIX . $callable;
@@ -187,6 +187,30 @@
187 187 * @return string
188 188 */
189 189 public static function main_network_site_url() {
190 190 return self::get_protocol_normalized_url( 'main_network_site_url', network_site_url() );
191 + }
192 +
193 + /**
194 + * Maybe add the origin_site_id query parameter to a URL.
195 + *
196 + * The parameter is only added for users who are members of the current blog.
197 + *
198 + * @since 7.1.0
199 + *
200 + * @param string $url The URL to add the query param to.
201 + * @return string The URL with the origin_site_id query parameter maybe added.
202 + */
203 + public static function maybe_add_origin_site_id( $url ) {
204 + $site_id = Manager::get_site_id();
205 + if ( is_wp_error( $site_id ) ) {
206 + return $url;
207 + }
208 +
209 + // Add query param to URL only for users who can access wp-admin.
210 + if ( ! is_user_member_of_blog() ) {
211 + return $url;
212 + }
213 +
214 + return add_query_arg( 'origin_site_id', $site_id, $url );
191 215 }
192 216 }