Skip to content

Commit 8e57b98

Browse files
Merge pull request #875 from sillsdev/develop
Fix javascript sprintf error introduced in WordPress 6.9
2 parents dda35be + 4601e31 commit 8e57b98

File tree

8 files changed

+87
-55
lines changed

8 files changed

+87
-55
lines changed

.idea/php.xml

Lines changed: 41 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/webonary.iml

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer-deploy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"ext-simplexml": "*",
4545
"ext-zlib": "*",
4646
"kcs/class-finder": "^0.6",
47-
"johnpbloch/wordpress": "^6.7",
47+
"johnpbloch/wordpress": "v6.9",
4848
"mdsimpson/contact-form-7-to-database-extension": "@stable",
4949
"mongodb/mongodb": "@stable",
5050
"phpoffice/phpspreadsheet": "^1.17",

get-wordpress-files.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ thisDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44
wordpress_dir="${thisDir}/wordpress-develop"
55

66
if [[ ! -d "${wordpress_dir}" ]]; then
7-
git clone --depth 1 -b trunk git://develop.git.wordpress.org/ "${wordpress_dir}"
7+
#git clone --depth 1 -b trunk git://develop.git.wordpress.org/ "${wordpress_dir}"
8+
git clone --depth 1 -b 6.9.1 git://develop.git.wordpress.org/ "${wordpress_dir}"
89
else
910
cd "${wordpress_dir}"
1011
git pull
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
document.addEventListener('DOMContentLoaded', () => {
3+
4+
// Make sure sprintf is available
5+
window.setTimeout(() => {
6+
7+
if (typeof window.sprintf === 'undefined' && typeof wp.i18n.sprintf === 'function')
8+
window.sprintf = wp.i18n.sprintf;
9+
10+
}, 500);
11+
});
12+

plugins/sil/sil-dictionary-webonary/src/Admin.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ public static function IsAdminAllowed(): bool
4343

4444
public static function EnqueueAdminScripts(): void
4545
{
46+
wp_register_script(
47+
'webonary_old_admin_script',
48+
WBNY_PLUGIN_URL . 'js/admin_script.js',
49+
[],
50+
false,
51+
true
52+
);
53+
wp_enqueue_script('webonary_old_admin_script');
54+
4655
wp_register_script(
4756
'webonary_admin_script',
4857
WBNY_PLUGIN_URL . 'js/webonary-admin.js',

plugins/sil/sil-dictionary-webonary/src/Hooks.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ private static function SetAdminHooks(): int
4848
*/
4949
$hooks_set += (int)add_filter('monsterinsights_show_dashboard_widget', '__return_false');
5050

51+
$hooks_set += (int)add_action('admin_enqueue_scripts', [Webonary_Utility::class, 'EnqueueFinalJs'], 999995);
52+
5153
return $hooks_set;
5254
}
5355

@@ -90,6 +92,8 @@ private static function SetAllPageHooks(): int
9092

9193
// $hooks_set += (int)add_action('switch_blog', 'SIL\Webonary\Dictionaries::BlogWasSwitched');
9294

95+
$hooks_set += (int)add_action('wp_enqueue_scripts', [Webonary_Utility::class, 'EnqueueFinalJs'], 999995);
96+
9397
return $hooks_set;
9498
}
9599

plugins/sil/sil-dictionary-webonary/webonary/Webonary_Utility.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,18 @@ public static function EnqueueJsAndCss()
568568
}
569569
}
570570

571+
public static function EnqueueFinalJs()
572+
{
573+
wp_register_script(
574+
'webonary_final_script',
575+
WBNY_PLUGIN_URL . 'js/webonary-final.js',
576+
[],
577+
false,
578+
true
579+
);
580+
wp_enqueue_script('webonary_final_script');
581+
}
582+
571583
/**
572584
* Returns the $_GET[$variable_name] value as a string
573585
* @param string $variable_name

0 commit comments

Comments
 (0)