Skip to content

Commit

Permalink
Merge branch 'trunk' into plugins/add/upload-by-zip
Browse files Browse the repository at this point in the history
  • Loading branch information
dd32 committed Dec 18, 2024
2 parents db9b0dd + 74a0578 commit b398712
Show file tree
Hide file tree
Showing 126 changed files with 4,303 additions and 2,486 deletions.
40 changes: 31 additions & 9 deletions api.wordpress.org/public_html/core/credits/wp-credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ private function _grab_validators( $gp_locale, $path ) {
if ( $user->user_nicename == 'nacin' ) // I stopped taking Spanish in 11th grade, don't show me as a validator when I'm testing things.
continue;
if ( $user->display_name && $user->display_name != $user->user_nicename && false === strpos( $user->display_name , '?') )
$validators[ $user->user_nicename ] = array( $this->_encode( $user->display_name ), md5( $user->user_email ), $user->user_nicename );
$validators[ $user->user_nicename ] = array( $this->_encode( $user->display_name ), $this->hash( $user->user_email ), $user->user_nicename );
else
$validators[ $user->user_nicename ] = array( $user->user_nicename, md5( $user->user_email ), $user->user_nicename );
$validators[ $user->user_nicename ] = array( $user->user_nicename, $this->hash( $user->user_email ), $user->user_nicename );
}

return $validators;
Expand Down Expand Up @@ -299,14 +299,14 @@ private function _groups() {
$this->names_in_groups[] = strtolower( $k );

if ( ! empty( $person[2] ) ) {
// array( 'Andrew Nacin', 'Lead Developer', 'md5 hash' )
// array( 'Andrew Nacin', 'Lead Developer', 'gravatar hash' )
$new_data['title'] = $person[1];
$new_data['hash'] = $person[2];
} elseif ( empty( $person[1] ) ) {
// array( 'Andrew Nacin' )
$fetch_emails_from_user_cache[ $k ] = $group_slug;
} elseif ( strlen( $person[1] ) === 32 && preg_match('/^[a-f0-9]{32}$/', $person[1] ) ) {
// array( 'Andrew Nacin', 'md5 hash' )
} elseif ( $this->is_hashed( $person[1] ) ) {
// array( 'Andrew Nacin', 'gravatar hash' )
$new_data['hash'] = $person[1];
} else {
// array( 'Andrew Nacin', 'Lead Developer' )
Expand All @@ -315,8 +315,8 @@ private function _groups() {
}

// Temporary:
if ( strlen( $new_data['hash'] ) != 32 || strpos( $new_data['hash'], '@' ) ) {
$new_data['hash'] = md5( $new_data['hash'] );
if ( ! $this->is_hashed( $new_data['hash'] ) ) {
$new_data['hash'] = $this->hash( $new_data['hash'] );
}

$group_data['data'][ $k ] = array_values( $new_data );
Expand All @@ -330,7 +330,7 @@ private function _groups() {
$user_id = wp_cache_get( $username, 'userlogins' );
if ( $user_id ) {
if ( $user_object = wp_cache_get( $user_id, 'users' ) ) {
$groups[ $group ]['data'][ $username ][1] = md5( strtolower( $user_object->user_email ) );
$groups[ $group ]['data'][ $username ][1] = $this->hash( $user_object->user_email );
} else {
$fetch_emails_from_db[ $username ] = $group;
}
Expand All @@ -341,7 +341,7 @@ private function _groups() {
if ( $fetch_emails_from_db ) {
$fetched = $wpdb->get_results( "SELECT user_login, ID, user_email FROM $wpdb->users WHERE user_login IN ('" . implode( "', '", array_keys( $fetch_emails_from_db ) ) . "')", OBJECT_K );
foreach ( $fetched as $username => $row ) {
$groups[ $fetch_emails_from_db[ $username ] ]['data'][ $username ][1] = md5( strtolower( $row->user_email ) );
$groups[ $fetch_emails_from_db[ $username ] ]['data'][ $username ][1] = $this->hash( $row->user_email );
wp_cache_add( $username, $row->ID, 'userlogins' );
}
}
Expand Down Expand Up @@ -445,4 +445,26 @@ final public function execute() {
}
}

private function is_hashed( $maybe_hash ) {
if (
! is_string( $maybe_hash ) ||
strpos( $maybe_hash, '@' ) !== false
) {
return false;
}

switch ( strlen( $maybe_hash ) ) {
case 32:
return preg_match( '/^[a-f0-9]{32}$/', $maybe_hash );
case 64:
return preg_match( '/^[a-f0-9]{64}$/', $maybe_hash );
}

return false;
}

private function hash( $email ) {
return hash( 'sha256', strtolower( $email ) );
}

}
2 changes: 1 addition & 1 deletion api.wordpress.org/public_html/dotorg/slack/announce.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function get_avatar( $username, $slack_id, $team_id ) {
$wp_user_id
) );

$hash = md5( strtolower( trim( $email ) ) );
$hash = hash( 'sha256', strtolower( trim( $email ) ) );
return sprintf( 'https://secure.gravatar.com/avatar/%s?s=96d=mm&r=G&%s', $hash, time() );
}

Expand Down
30 changes: 13 additions & 17 deletions api.wordpress.org/public_html/events/1.0/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1588,35 +1588,31 @@ function pin_next_workshop_discussion_group( $events, $user_agent ) {
* Pin one-off events.
*/
function pin_one_off_events( $events, $current_time ) {
$madrid_utc_offset = 1 * HOUR_IN_SECONDS; // Central European Standard Time - GMT+1
$tokyo_utc_offset = 9 * HOUR_IN_SECONDS; // JST: UTC+9

$sotw = array(
'type' => 'wordcamp',
'title' => 'State of the Word - Watch Now', // Remove "watch now" next year, see date note below.
'title' => 'State of the Word 2024 – Tokyo, Japan',
// `utm_source` is `private` because it would have to be set by the WP install, we don't need it, and tracking it could be a privacy concern.
'url' => 'https://wordpress.org/state-of-the-word/?utm_source=private&utm_medium=events_widget&utm_campaign=sotw2023',
'url' => 'https://wordpress.org/state-of-the-word/?utm_source=private&utm_medium=events_widget&utm_campaign=sotw2024',
'meetup' => '',
'meetup_url' => '',

// This year they requested the event to show up for a few days after it was over. The API does that no
// problem, but in Core `WP_Community_Events::trim_events()` will remove it. This is a hack to make the
// event show up, but it will probably confuse people about when it actual was, because the date will be
// wrong. Don't do this again next year, only show the event in the lead up to it. The pinned News item
// will still show it to people after the event.
'date' => '2023-12-14 15:00:00',
'end_date' => '2023-12-14 16:30:00',
'start_unix_timestamp' => strtotime( '2023-12-14 15:00:00' ) - $madrid_utc_offset,
'end_unix_timestamp' => strtotime( '2023-12-14 16:30:00' ) - $madrid_utc_offset,
// Local time for the event location.
'date' => '2024-12-16 18:00:00',
'end_date' => '2024-12-16 20:00:00',
// Unix timestamp (UTC).
'start_unix_timestamp' => strtotime( '2024-12-16 18:00:00' ) - $tokyo_utc_offset,
'end_unix_timestamp' => strtotime( '2024-12-16 20:00:00' ) - $tokyo_utc_offset,

'location' => array(
'location' => 'Online',
'country' => 'ES',
'latitude' => 40.41446998218856,
'longitude' => -3.695042334019202,
'country' => 'JP',
'latitude' => 35.652832,
'longitude' => 139.839478,
),
);

if ( $current_time > strtotime( 'December 9, 2023' ) && $current_time < strtotime( 'December 14, 2023' ) ) {
if ( $current_time > strtotime( 'December 11, 2024' ) && $current_time < strtotime( 'December 17, 2024' ) ) {
array_unshift( $events, $sotw );
}

Expand Down
125 changes: 13 additions & 112 deletions buddypress.org/public_html/wp-content/plugins/bbpress-org/toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
* @since 1.0.1
*/
function bborg_toolbar_tweaks() {
remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 );
remove_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 9999 );
}
add_action( 'add_admin_bar_menus', 'bborg_toolbar_tweaks', 11 );

Expand Down Expand Up @@ -254,52 +254,29 @@ function bbporg_new_admin_bar_wp_menu( $wp_admin_bar ) {
*/
function bbporg_new_admin_bar_site_menu( $wp_admin_bar ) {

$wp_admin_bar->add_menu( array(
'id' => 'bbp-site-name',
'title' => __( 'bbPress.org' ),
'href' => home_url( '/' )
) );

// Create submenu items.

if ( is_user_logged_in() ) {

// Add a link to create a new topic.
$wp_admin_bar->add_menu( array(
'id' => 'bbp-new-topic',
'parent' => 'top-secondary',
'title' => __( 'Create New Topic' ),
'href' => 'https://bbpress.org/forums/new-topic/'
) );

// Add an option to visit the admin dashboard
if ( is_super_admin() ) {

$wp_admin_bar->add_group( array(
'parent' => 'bbp-site-name',
'id' => 'bbp-site-name-super-admin',
'meta' => array(
'class' => 'ab-sub-secondary',
),
) );

$wp_admin_bar->add_menu( array(
'parent' => 'bbp-site-name-super-admin',
'id' => 'bbp-admin-link',
'title' => __( 'Admin Dashbooard' ),
'href' => get_admin_url()
) );
}

// Not logged in
} else {
$wp_admin_bar->add_menu( array(
'id' => 'bbp-login',
'parent' => 'top-secondary',
'title' => __( 'Log in' ),
'href' => wp_login_url()
) );
}
}
add_action( 'admin_bar_menu', 'bbporg_new_admin_bar_site_menu', 20 );
add_action( 'admin_bar_menu', 'bbporg_new_admin_bar_site_menu', 2 );

/**
* Add the "My Account" item.
Expand Down Expand Up @@ -344,7 +321,7 @@ function bbporg_admin_bar_my_account_item( $wp_admin_bar ) {
) );
}
}
add_action( 'admin_bar_menu', 'bbporg_admin_bar_my_account_item', 0 );
add_action( 'admin_bar_menu', 'bbporg_admin_bar_my_account_item', 4 );

/**
* Add the "My Account" submenu items.
Expand Down Expand Up @@ -472,79 +449,3 @@ function bbporg_admin_bar_my_account_menu( $wp_admin_bar ) {
}
}
add_action( 'admin_bar_menu', 'bbporg_admin_bar_my_account_menu', 7 );

/**
* Force toolbar styling into looking like sub-navigation
*
* Note: slightly experimental - kind of a hack
*
* @author johnjamesjacoby
* @since 1.0.3
*/
function bbporg_toolbar_css_overrides() {
?>
<style type="text/css">
/* Admin Bar */
<?php if ( is_main_site() && is_front_page() ) : ?>
#wpadminbar { display: none !important; }
<?php else : ?>
#wpadminbar { color: #555; background: #eee; top: 81px; border-bottom: 1px solid #ddd; height: 42px; }
#wpadminbar #wp-toolbar a.ab-item, #wpadminbar .quicklinks li#wp-admin-bar-bp-notifications > a { padding: 5px; }
#wpadminbar #wp-toolbar ul.ab-submenu a.ab-item { padding: 0 2em 0 1em; }
#wpadminbar #wp-toolbar .ab-top-secondary .menupop .menupop > a.ab-item { padding: 0 1em 0 2em; }
#wpadminbar a.ab-item, #wpadminbar > #wp-toolbar span.ab-label, #wpadminbar > #wp-toolbar span.noticon { color: #555; }
#wpadminbar .ab-icon, #wpadminbar .ab-icon:before, #wpadminbar .ab-item:before, #wpadminbar .ab-item:after { color: #328C00; }
#wpadminbar .ab-top-menu > li:hover > .ab-item,
#wpadminbar .ab-top-menu > li.hover > .ab-item,
#wpadminbar .ab-top-menu > li > .ab-item:focus,
#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
#wpadminbar-nojs .ab-top-menu > li.menupop:hover > .ab-item,
#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item,
#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item { color: #555; background: #e2e2e2; }
#wpadminbar > #wp-toolbar li:hover span.ab-label, #wpadminbar > #wp-toolbar li.hover span.ab-label, #wpadminbar > #wp-toolbar a:focus span.ab-label { color: #555; }
#wpadminbar li:hover .ab-icon:before, #wpadminbar li:hover .ab-item:before, #wpadminbar li:hover .ab-item:after, #wpadminbar li:hover #adminbarsearch:before { color: #999; }

/* Admin Bar: submenu */
#wpadminbar .menupop .ab-sub-wrapper { background: #eee; }
#wpadminbar .quicklinks .menupop .ab-submenu { background: #eee; }
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary, #wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu { background: #ddd; }
#wpadminbar .ab-submenu .ab-item, #wpadminbar .quicklinks .menupop ul li a, #wpadminbar .quicklinks .menupop.hover ul li a, #wpadminbar-nojs .quicklinks .menupop:hover ul li a { color: #555; }
#wpadminbar .quicklinks li .blavatar, #wpadminbar .menupop .menupop > .ab-item:before { color: #f1f1f3; }
#wpadminbar .quicklinks .menupop ul li a:hover,
#wpadminbar .quicklinks .menupop ul li a:focus,
#wpadminbar .quicklinks .menupop ul li a:hover strong,
#wpadminbar .quicklinks .menupop ul li a:focus strong,
#wpadminbar .quicklinks .menupop.hover ul li a:hover,
#wpadminbar .quicklinks .menupop.hover ul li a:focus,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
#wpadminbar li:hover .ab-icon:before,
#wpadminbar li:hover .ab-item:before,
#wpadminbar li a:focus .ab-icon:before,
#wpadminbar li .ab-item:focus:before,
#wpadminbar li.hover .ab-icon:before,
#wpadminbar li.hover .ab-item:before,
#wpadminbar li:hover .ab-item:after,
#wpadminbar li.hover .ab-item:after,
#wpadminbar li:hover #adminbarsearch:before { color: #328C00; }
#wpadminbar .quicklinks li a:hover .blavatar, #wpadminbar .menupop .menupop > .ab-item:hover:before { color: #328C00; }

/* Admin Bar: my account */
#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img { border-color: #eee; background-color: #eee; }
#wpadminbar #wp-admin-bar-user-info .display-name { color: #555; }
#wpadminbar #wp-admin-bar-user-info a:hover .display-name { color: #328C00; }
#wpadminbar #wp-admin-bar-user-info .username { color: #000; }

/* Some responsive'ish tweaks */
@media screen and ( max-width: 460px ) {
#wpadminbar {
height: 56px;
}
#wpadminbar #wp-toolbar a.ab-item,
#wpadminbar .quicklinks li#wp-admin-bar-bp-notifications > a { padding: 0; }
}
<?php endif; ?>
</style>
<?php
}
add_theme_support( 'admin-bar', array( 'callback' => 'bbporg_toolbar_css_overrides' ) );
Loading

0 comments on commit b398712

Please sign in to comment.