Prep Plugin for release on WordPress.org (#23)

* Update translation text domain
* Escape everything that should be escaped.
* Add nonce checks where needed.
* Sanitize all inputs.
* Apply Code style changes across the codebase.
* Correct many deprecation notices.
* Optimize load order of many filters.
* Add Proper Build script
* Use emojii flags
* Fix i18n deprecation  notice for translating too early
* Put all scripts in footer and load async
This commit is contained in:
David Stone
2025-04-14 11:36:46 -06:00
committed by GitHub
parent a31cfcb565
commit d88e50df38
1087 changed files with 12586 additions and 18535 deletions

View File

@ -74,9 +74,9 @@ function wu_get_days_ago($date_1, $date_2 = false) {
$datetime_2 = wu_date($date_2);
$dateIntervar = $datetime_1->diff($datetime_2, false);
$date_intervar = $datetime_1->diff($datetime_2, false);
return - $dateIntervar->days;
return - $date_intervar->days;
}
/**
@ -90,7 +90,7 @@ function wu_get_current_time($type = 'mysql', $gmt = false) {
switch_to_blog(wu_get_main_site_id());
$time = current_time($type, $gmt); // phpcs:ignore
$time = current_time($type, $gmt); // phpcs:ignore
restore_current_blog();
@ -112,16 +112,15 @@ function wu_filter_duration_unit($unit, $length) {
switch ($unit) {
case 'day':
$new_unit = $length > 1 ? __('Days', 'wp-ultimo') : __('Day', 'wp-ultimo');
$new_unit = $length > 1 ? __('Days', 'wp-multisite-waas') : __('Day', 'wp-multisite-waas');
break;
case 'month':
$new_unit = $length > 1 ? __('Months', 'wp-ultimo') : __('Month', 'wp-ultimo');
$new_unit = $length > 1 ? __('Months', 'wp-multisite-waas') : __('Month', 'wp-multisite-waas');
break;
case 'year':
$new_unit = $length > 1 ? __('Years', 'wp-ultimo') : __('Year', 'wp-ultimo');
$new_unit = $length > 1 ? __('Years', 'wp-multisite-waas') : __('Year', 'wp-multisite-waas');
break;
default:
$new_unit = $new_unit;
break;
}
@ -146,14 +145,14 @@ function wu_human_time_diff($from, $limit = '-5 days', $to = false): string {
if ($timestamp_from <= $limit) {
// translators: %s: date.
return sprintf(__('on %s', 'wp-ultimo'), date_i18n(get_option('date_format'), $timestamp_from));
return sprintf(__('on %s', 'wp-multisite-waas'), date_i18n(get_option('date_format'), $timestamp_from));
}
if (false === $to) {
$to = wu_get_current_time('timestamp'); // phpcs:ignore
}
$placeholder = wu_get_current_time('timestamp') > $timestamp_from ? __('%s ago', 'wp-ultimo') : __('In %s', 'wp-ultimo'); // phpcs:ignore
$placeholder = wu_get_current_time('timestamp') > $timestamp_from ? __('%s ago', 'wp-multisite-waas') : __('In %s', 'wp-multisite-waas'); // phpcs:ignore
return sprintf($placeholder, human_time_diff($timestamp_from, $to));
}
@ -181,10 +180,10 @@ function wu_convert_php_date_format_to_moment_js_format($php_date_format): strin
'g' => 'h',
'H' => 'HH',
'h' => 'hh',
'I' => '', // Daylight Saving Time? => moment().isDST();
'I' => '', // Daylight Saving Time?: moment().isDST().
'i' => 'mm',
'j' => 'D',
'L' => '', // Leap year? => moment().isLeapYear();
'L' => '', // Is Leap year?: moment().isLeapYear().
'l' => 'dddd',
'M' => 'MMM',
'm' => 'MM',