<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12252] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse: Openverse: Prepare for a migration to a standalone Openverse domain.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/12252">12252</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/12252","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-11-18 01:48:31 +0000 (Fri, 18 Nov 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Openverse: Prepare for a migration to a standalone Openverse domain.
Props dhruvkb, zackkrida, sarayourfriend, olgabulat.
Closes https://github.com/WordPress/wordpress.org/pull/98.
Fixes <a href="http://meta.trac.wordpress.org/ticket/6578">#6578</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenversewpenvjson">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/.wp-env.json</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenverseREADMEmd">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenversefunctionsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenverseindexphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/index.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenversewpenvjson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/.wp-env.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/.wp-env.json 2022-11-17 23:59:14 UTC (rev 12251)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/.wp-env.json 2022-11-18 01:48:31 UTC (rev 12252)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "core": "WordPress/WordPress#master",
</del><span class="cx" style="display: block; padding: 0 10px"> "themes": [
</span><span class="cx" style="display: block; padding: 0 10px"> ".",
</span><span class="cx" style="display: block; padding: 0 10px"> "../wporg"
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenverseREADMEmd"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md 2022-11-17 23:59:14 UTC (rev 12251)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/README.md 2022-11-18 01:48:31 UTC (rev 12252)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,9 +8,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> 0. Install all the prerequisites.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 1. **Required:** Node.js 14.
- 2. **Required:** Composer.
- 3. **Recommended:** Docker (to use the automatic setup)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 1. **Required:** Node.js 14
+ 2. **Required:** Composer
+ 3. **Required:** Subversion
+ 4. **Recommended:** Docker (to use the automatic setup)
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> 1. Build the parent theme WordPress.org theme.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,6 +21,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ```bash
</span><span class="cx" style="display: block; padding: 0 10px"> $ npm install
</span><span class="cx" style="display: block; padding: 0 10px"> ```
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ If you face issues installing Sass, try the following command, and
+ `npm install` again.
+ ```bash
+ $ npm install node-sass@npm:sass
+ $ npm install
+ ```
</ins><span class="cx" style="display: block; padding: 0 10px"> 3. Build the theme assets.
</span><span class="cx" style="display: block; padding: 0 10px"> ```bash
</span><span class="cx" style="display: block; padding: 0 10px"> $ npm run build
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,6 +83,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> your WordPress install. This site will have the `wporg` (parent) and
</span><span class="cx" style="display: block; padding: 0 10px"> `wporg-openverse` (child) themes installed. For detailed instructions,
</span><span class="cx" style="display: block; padding: 0 10px"> please read [the wp-env docs](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/).
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 4. Edit the `.htaccess` file to prevent Apache 404 errors.
+ ```bash
+ $ wp-env run cli bash
+ bash-5.1$ printf "RewriteEngine on\nFallbackResource /index.php\n" > .htaccess
+ bash-5.1$ exit
+ ```
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> **Manual:**
</span><span class="cx" style="display: block; padding: 0 10px"> If you prefer a manual approach, you can also set up your own WordPress
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,7 +109,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> 6. Activate and customize the theme.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 1. Log into `/wp-admin`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 1. Log into `/wp-admin`. If you used `@wordpress/env`, your username will
+ be 'admin' and password will be 'password'.
</ins><span class="cx" style="display: block; padding: 0 10px"> 2. Under Appearance > Themes, activate the theme 'WordPress.org Openverse'.
</span><span class="cx" style="display: block; padding: 0 10px"> 3. To change the embed URL, open the customizer at Appearance > Customize
</span><span class="cx" style="display: block; padding: 0 10px"> and update the value in the 'Openverse embed' panel.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,6 +121,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> `/wp-content/themes/wporg-openverse/js/message_test.html`.
</span><span class="cx" style="display: block; padding: 0 10px"> 2. Visit the site and interactively test the messages.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+8. Test redirects.
+
+ 1. Visit some test URLs.
+ 1. https://ru.wordpress.org/openverse → ...
+ 2. https://wordpress.org/openverse/search/?q=dog → ...
+ 2. See the target redirect URL as a comment inside the dev tools.
+ 1. ... → https://openverse.wordpress.net/ru/
+ 2. ... → https://openverse.wordpress.net/search/?q=dog
+ 3. Change the language in Settings > General to see how the locale factors
+ into the redirect path.
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ## Related links
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> - Source code
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenversefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/functions.php 2022-11-17 23:59:14 UTC (rev 12251)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/functions.php 2022-11-18 01:48:31 UTC (rev 12252)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,6 +17,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * This is subdirectory on WordPress.org which loads the Openverse site. This is
</span><span class="cx" style="display: block; padding: 0 10px"> * prefixed in front of all path changes sent by the embedded `iframe`.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * When used with the standalone redirect, it is removed from the path forwarded
+ * to the standalone site.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !defined( 'OPENVERSE_SUBPATH' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> define( 'OPENVERSE_SUBPATH', '/openverse' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,6 +85,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'do_parse_request', __NAMESPACE__ . '\disable_parse_request', 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get the slug of the given WP locale. This function returns a blank string if
+ * the locale is `en_US` because that is considered the default and is not
+ * prefixed in the URL paths. It also returns a blank string if `$wp_locale` is
+ * not found in the locales list.
+ */
+function get_locale_slug( $curr_locale ) {
+ if ( $curr_locale === 'en_US' ) {
+ return '';
+ }
+
+ return get_locales()[ $curr_locale ]->slug ?? '';
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Enqueue styles & scripts.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The wporg theme registers these with static versions, so we need to override
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,15 +122,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $use_path_based_locale_forwarding = get_theme_mod( 'ov_path_based_i18n', false );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_locale = get_locale();
- $locale = get_locales()[ $wp_locale ];
- $locale_slug = $use_path_based_locale_forwarding && $wp_locale !== 'en_US' ? $locale->slug : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $curr_locale = get_locale();
+ $locale_slug = '';
+ if ( $use_path_based_locale_forwarding ) {
+ $locale_slug = get_locale_slug( $curr_locale );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> wp_add_inline_script(
</span><span class="cx" style="display: block; padding: 0 10px"> /* handle */ 'openverse-message',
</span><span class="cx" style="display: block; padding: 0 10px"> /* JS */ 'const openverseUrl = ' . wp_json_encode( get_theme_mod( 'ov_src_url', OPENVERSE_URL ) ) . ";\n" .
</span><span class="cx" style="display: block; padding: 0 10px"> /* JS */ 'const openverseSubpath = ' . wp_json_encode( OPENVERSE_SUBPATH ) . ";\n" .
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* JS */ 'const currentLocale = ' . wp_json_encode( $wp_locale ) . ";\n" . /* Used for legacy cookie based locale forwarding */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* JS */ 'const currentLocale = ' . wp_json_encode( $curr_locale ) . ";\n" . /* Used for legacy cookie based locale forwarding */
</ins><span class="cx" style="display: block; padding: 0 10px"> /* JS */ 'const localeSlug = ' . wp_json_encode( $locale_slug ) . ";\n",
</span><span class="cx" style="display: block; padding: 0 10px"> /* position */ 'before'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,6 +170,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'document_title_parts', __NAMESPACE__ . '\title_no_title' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*
+ TODO: Delete this and everything related to it
+ ======================
+ Openverse iframe embed
+ ======================
+ */
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Enable the option to set the URL for the Openverse embed via a GUI.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -203,3 +229,108 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'customize_register', __NAMESPACE__ . '\wporg_ov_customizer' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/*
+ =====================================
+ Openverse standalone site redirection
+ =====================================
+ */
+
+/**
+ * This is the URL at which the standalone Openverse site is hosted. When
+ * redirect is enabled (see setting `ov_is_redirect_enabled`), the theme
+ * redirects all incoming requests to the right URL on this domain.
+ *
+ * Note: Do not put a trailing slash '/' in this URL. Paths start with a leading
+ * slash so a trailing slash here will lead to two slashes in the final URL.
+ */
+if ( !defined( 'OPENVERSE_STANDALONE_URL' ) ) {
+ define( 'OPENVERSE_STANDALONE_URL', 'https://openverse.wordpress.net' );
+}
+
+/**
+ * Determine the target URL of the redirect based on the Openverse standalone
+ * URL, the requested path and the current locale.
+ *
+ * Examples:
+ * - https://ru.wordpress.org/openverse → {ov_redirect_url}/ru/
+ * - https://wordpress.org/openverse/search/?q=dog → {ov_redirect_url}/search/?q=dog
+ */
+function get_target_url() {
+ $target_url = get_theme_mod( 'ov_redirect_url', OPENVERSE_STANDALONE_URL );
+
+ $curr_locale = get_locale();
+ $locale = get_locale_slug( $curr_locale );
+ if ( $locale !== '' ) {
+ $target_url .= '/' . $locale;
+ }
+
+ $path = $_SERVER['REQUEST_URI'];
+ if ( $path ) {
+ $count = 1; // Only replace the leading Openverse subpath.
+ $target_url .= str_replace( OPENVERSE_SUBPATH, '', $path, $count );
+ }
+
+ return $target_url;
+}
+
+/**
+* Provide configuration for the theme to redirect to the given standalone
+* Openverse site. The destination URL can be configured and the behaviour can
+* be dormant unless enabled.
+*
+* @param \WP_Customize_Manager $wp_customize Theme Customizer object.
+*/
+function wporg_ov_redir_customizer( $wp_customize ) {
+ $wp_customize->add_section( 'ov_redir', array(
+ 'priority' => 10,
+ 'capability' => 'edit_theme_options',
+ 'title' => 'Openverse Redirect',
+ 'description' => 'Configure the redirection to the standalone Openverse site.'
+ ) );
+
+ $wp_customize->add_setting( 'ov_redirect_url', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => OPENVERSE_STANDALONE_URL,
+ 'sanitize_callback' => function( $val, $setting ) {
+ if ( substr( $val, -1 ) == '/' ) { // If the last character is a slash '/',...
+ $val = substr( $val, 0, -1 ); // ...remove it.
+ }
+ if ( empty( $val ) ) {
+ return $setting->default;
+ }
+ return $val;
+ }
+ ) );
+
+ $wp_customize->add_control( 'ov_redirect_url', array(
+ 'section' => 'ov_redir',
+ 'type' => 'url',
+ 'id' => 'ov_redirect_url',
+ 'label' => 'Redirect URL',
+ 'description' => '<b>Note</b>: '
+ . 'Do not put a trailing slash \'/\' in this URL.<br/>'
+ . '<b>Default</b>: '
+ . esc_html( OPENVERSE_STANDALONE_URL ),
+ 'priority' => 10,
+ 'input_attrs' => array(
+ 'placeholder' => 'URL'
+ )
+ ) );
+
+ $wp_customize->add_setting( 'ov_is_redirect_enabled', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => false
+ ) );
+
+ $wp_customize->add_control( 'ov_is_redirect_enabled', array(
+ 'section' => 'ov_redir',
+ 'type' => 'checkbox',
+ 'id' => 'ov_is_redirect_enabled',
+ 'label' => 'Redirect to the standalone Openverse site.',
+ 'priority' => 10
+ ) );
+}
+add_action( 'customize_register', __NAMESPACE__ . '\wporg_ov_redir_customizer' );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgopenverseindexphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/index.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/index.php 2022-11-17 23:59:14 UTC (rev 12251)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/index.php 2022-11-18 01:48:31 UTC (rev 12252)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,6 +14,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Openverse\Theme;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*
+ If the theme mod `ov_is_redirect_enabled` is set to `true`, redirect to the
+ standalone site and exit immediately. If not, print what would have been the
+ redirect URL to the HTML as a comment.
+ */
+
+$is_redirect_enabled = get_theme_mod( 'ov_is_redirect_enabled' );
+$target_url = get_target_url();
+
+if ( $is_redirect_enabled ) {
+ wp_redirect( $target_url );
+ exit;
+} else {
+ echo "<!-- " . $target_url . " -->";
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> get_header();
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>