Skip to content

Commit d2a52b3

Browse files
committed
All: Move remaining mu-plugins/ to plugins/
1 parent 11ce1d6 commit d2a52b3

10 files changed

+278
-267
lines changed

mu-plugins/_loader.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3-
// Enabled everywhere
3+
// Plugins enabled everywhere for local dev (jquery-wp-docker) and old WP-MU servers.
4+
//
5+
// For production, plugin enablement is managed via Puppet:
6+
// https://github.com/jquery/infrastructure-puppet/blob/staging/modules/profile/manifests/wordpress/docs.pp
7+
48
require_once __DIR__ . '/../plugins/disable-emojis/disable-emojis.php';
59
require_once __DIR__ . '/../plugins/gilded-wordpress.php';
10+
require_once __DIR__ . '/../plugins/jquery-actions.php';
11+
require_once __DIR__ . '/../plugins/jquery-filters.php';
12+
require_once __DIR__ . '/../plugins/jquery-tags-on-pages.php';
13+
require_once __DIR__ . '/../plugins/redirects.php';

mu-plugins/jquery-actions.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

mu-plugins/jquery-actions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../plugins/jquery-actions.php

mu-plugins/jquery-filters.php

Lines changed: 0 additions & 159 deletions
This file was deleted.

mu-plugins/jquery-filters.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../plugins/jquery-filters.php

mu-plugins/jquery-tags-on-pages.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

mu-plugins/jquery-tags-on-pages.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../plugins/jquery-tags-on-pages.php

mu-plugins/redirects.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

mu-plugins/redirects.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../plugins/redirects.php

mu-plugins/relevanssi

Lines changed: 0 additions & 1 deletion
This file was deleted.

plugins/jquery-actions.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Plugin Name: jQuery Actions
4+
* Description: Default actions for all jQuery sites.
5+
*/
6+
7+
remove_action( 'wp_head', 'feed_links', 2 );
8+
remove_action( 'wp_head', 'feed_links_extra', 3 );
9+
remove_action( 'wp_head', 'rsd_link' );
10+
remove_action( 'wp_head', 'wlwmanifest_link' );
11+
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
12+
remove_action( 'wp_head', 'rel_canonical' );
13+
14+
// Remove shortlink <head> and header.
15+
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
16+
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
17+
18+
// Add rel=me link to HTML head for Mastodon domain verification
19+
//
20+
// Usage:
21+
//
22+
// Put one or more comma-separated URLs in the 'jquery_xfn_rel_me' WordPress option.
23+
//
24+
// Example:
25+
//
26+
// 'jquery_xfn_rel_me' => 'https://example.org/@foo,https://social.example/@bar'
27+
//
28+
// See also:
29+
//
30+
// - https://docs.joinmastodon.org/user/profile/#verification
31+
// - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/me
32+
// - https://microformats.org/wiki/rel-me
33+
// - https://gmpg.org/xfn/
34+
function jquery_xfnrelme_wp_head() {
35+
$option = get_option( 'jquery_xfn_rel_me' , '' );
36+
$links = $option !== '' ? explode( ',', $option ) : array();
37+
foreach ( $links as $url ) {
38+
// We use esc_attr instead of esc_url, as the latter would shorten
39+
// the URL to be scheme-less as "//example" instead of "https://example",
40+
// which prevents relation verification.
41+
echo '<link rel="me" href="' . esc_attr( trim( $url ) ) . '">' . "\n";
42+
}
43+
}
44+
45+
add_action('wp_head', 'jquery_xfnrelme_wp_head');

0 commit comments

Comments
 (0)