Skip to content

Commit e398954

Browse files
committed
Merge remote-tracking branch 'origin/develop' into add/donation-widget-license-pages-develop
2 parents 5175778 + bf3d09a commit e398954

31 files changed

Lines changed: 710 additions & 335 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ plugins/*
1616

1717
mu-plugins/*
1818
!mu-plugins/mu-autoloader.php
19+
!mu-plugins/activitypub-migration.php
1920
!mu-plugins/osi-event-list
2021
!mu-plugins/osi-sponsors-list
22+
!websub-compat.php
23+
!mu-plugins/osi-events-manager-tweaks
2124

2225
themes/*
2326
!themes/osi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Plugin Name: ActivityPub Migration
4+
* Plugin Description: Adds the `blog.opensource.org` to the Actors `alsoKnownAs` list.
5+
* Version: 1.0.0
6+
* Author: WordPress.com Special Projects
7+
* Author URI: https://wpspecialprojects.wordpress.com/
8+
*/
9+
10+
if ( ! defined( 'ABSPATH' ) ) {
11+
return;
12+
}
13+
14+
/**
15+
* Adds the `blog.opensource.org` to the Actors `alsoKnownAs` list.
16+
*
17+
* @param array $actor Actor as Array.
18+
*
19+
* @return array $actor Filtered Actor Array.
20+
*/
21+
function activitypub_actor_migration( array $actor ) {
22+
if ( ! $actor ) {
23+
return $actor;
24+
}
25+
26+
$host = wp_parse_url( get_home_url(), PHP_URL_HOST );
27+
$id = str_replace( $host, 'blog.' . $host, $actor['id'] );
28+
$id = str_replace( '/blog/', '/', $id );
29+
30+
$actor['alsoKnownAs'] = array( $id );
31+
return $actor;
32+
}
33+
add_filter( 'activitypub_activity_user_object_array', 'activitypub_actor_migration' );
34+
add_filter( 'activitypub_activity_blog_user_object_array', 'activitypub_actor_migration' );
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Plugin Name: OSI Events Manager Tweaks
4+
* Description: Customizations for the Events Manager plugin.
5+
* Version: 1.0.0
6+
* Author: WordPress.com Special Projects
7+
* Author URI: https://wpspecialprojects.wordpress.com/
8+
*/
9+
10+
/**
11+
* Remove the event time zone if the event is all day.
12+
*
13+
* @param string $replace The string to replace.
14+
* @param EM_Event $EM_Event The event object.
15+
* @param string $full_result The full result.
16+
* @param string $target The target.
17+
* @param array $placeholder_atts The placeholder attributes.
18+
*
19+
* @return string
20+
*/
21+
function osi_em_event_output_placeholder( $replace, $EM_Event, $full_result, $target, $placeholder_atts ) {
22+
if ( '#_EVENTTIMEZONE' === $full_result ) {
23+
$event_times = $EM_Event->output('#_EVENTTIMES');
24+
if ( 'All Day' === $event_times ) {
25+
$replace = '';
26+
}
27+
}
28+
return $replace;
29+
}
30+
add_filter('em_event_output_placeholder', 'osi_em_event_output_placeholder', 10, 5);
31+
32+
/**
33+
* Display "Free" for events with a price of 0.00.
34+
*
35+
* @param string $formatted_price The formatted price.
36+
* @param string $price The price.
37+
* @param string $currency The currency.
38+
* @param string $format The format.
39+
* @return void
40+
*/
41+
function osi_format_event_manager_price( $formatted_price, $price, $currency, $format ) {
42+
if( 0.00 === (float)$price ) {
43+
$formatted_price = 'Free';
44+
}
45+
46+
return $formatted_price;
47+
}
48+
add_filter('em_get_currency_formatted', 'osi_format_event_manager_price', 10, 4 );

mu-plugins/websub-compat.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* Plugin Name: WebSub Backwards Compatibility
4+
* Plugin Description: Still send pings for the old `blog.opensource.org` Feed-URLs.
5+
* Version: 1.0.0
6+
* Author: WordPress.com Special Projects
7+
* Author URI: https://wpspecialprojects.wordpress.com/
8+
*/
9+
10+
if ( ! defined( 'ABSPATH' ) ) {
11+
return;
12+
}
13+
14+
/**
15+
* Filter `pubsubhubbub_feed_urls` and `pubsubhubbub_comment_feed_urls`.
16+
*
17+
* Still send pings for the old `blog.opensource.org` Feed-URLs.
18+
*
19+
* @param array $links Array of Feed URLs.
20+
*
21+
* @return array $links Array of filtered Feed URLs.
22+
*/
23+
function websub_compat( array $links ) {
24+
if ( ! $links ) {
25+
return $links;
26+
}
27+
28+
$host = wp_parse_url( get_home_url(), PHP_URL_HOST );
29+
$compat_links = array();
30+
31+
foreach ( $links as $link ) {
32+
$compat_links[] = str_replace( $host, 'blog.' . $host, $link );
33+
}
34+
35+
return array_unique( array_merge( $links, $compat_links ) );
36+
}
37+
add_filter( 'pubsubhubbub_feed_urls', 'websub_compat' );
38+
add_filter( 'pubsubhubbub_comment_feed_urls', 'websub_compat' );

plugins/osi-features/inc/classes/post-types/class-base.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ public function get_args() {
7979
'has_archive' => true,
8080
'menu_position' => 6,
8181
'supports' => [ 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ],
82+
'rewrite' => array(
83+
'slug' => $this->get_slug(),
84+
'with_front' => false,
85+
)
8286
];
8387

8488
}

plugins/osi-features/inc/classes/post-types/class-post-type-press-mentions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function get_args() {
6262
'has_archive' => true,
6363
'menu_position' => 6,
6464
'supports' => [ 'title', 'author', 'excerpt' ],
65-
'rewrite' => [ 'slug' => 'press-mentions' ]
65+
'rewrite' => [ 'slug' => 'press-mentions', 'with_front' => false ]
6666
];
6767

6868
}

themes/osi/archive-sc_event.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@
77
* @package osi
88
*/
99

10-
1110
if ( ! class_exists( 'Sugar_Calendar\\Requirements_Check' ) ) {
12-
add_action('init',
13-
function() {
14-
wp_safe_redirect( home_url() );
15-
exit;
16-
}
17-
);
11+
add_action('init', function() {
12+
wp_safe_redirect( home_url() );
13+
exit;
14+
});
1815
}
1916

2017
$display_type = isset( $_GET['event-display'] ) ? sanitize_text_field( wp_unslash( $_GET['event-display'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended

themes/osi/assets/css/editor-style.css

Lines changed: 53 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)