PluginProbe
Bogo / 2.6
Bogo v2.6
3.9.3 trunk 1.0 1.1 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.6 2.6.1 2.7 2.8 2.8.1 2.9 3.0 3.0.1 All 52 releases
← All changes | admin/admin.php +89 -327 3.02.6 View file →
@@ -4,46 +4,21 @@
4 4 require_once BOGO_PLUGIN_DIR . '/admin/includes/post.php';
5 5 require_once BOGO_PLUGIN_DIR . '/admin/includes/nav-menu.php';
6 6 require_once BOGO_PLUGIN_DIR . '/admin/includes/widgets.php';
7 7
8 -add_action( 'admin_init', 'bogo_upgrade' );
9 -
10 -function bogo_upgrade() {
11 - $old_ver = bogo_get_prop( 'version' );
12 - $new_ver = BOGO_VERSION;
13 -
14 - if ( $old_ver != $new_ver ) {
15 - require_once BOGO_PLUGIN_DIR . '/admin/includes/upgrade.php';
16 - do_action( 'bogo_upgrade', $new_ver, $old_ver );
17 - bogo_set_prop( 'version', $new_ver );
18 - }
19 -}
20 -
21 8 add_action( 'admin_enqueue_scripts', 'bogo_admin_enqueue_scripts' );
22 9
23 10 function bogo_admin_enqueue_scripts( $hook_suffix ) {
24 - wp_enqueue_style( 'bogo-admin',
25 - plugins_url( 'admin/includes/css/admin.css', BOGO_PLUGIN_BASENAME ),
26 - array(), BOGO_VERSION, 'all' );
11 + if ( false !== strpos( $hook_suffix, 'bogo-tools' )
12 + || 'widgets.php' == $hook_suffix
13 + || 'user-edit.php' == $hook_suffix ) {
14 + wp_enqueue_style( 'bogo-admin',
15 + plugins_url( 'admin/includes/css/admin.css', BOGO_PLUGIN_BASENAME ),
16 + array(), BOGO_VERSION, 'all' );
27 17
28 - if ( is_rtl() ) {
29 - wp_enqueue_style( 'bogo-admin-rtl',
30 - plugins_url( 'admin/includes/css/admin-rtl.css', BOGO_PLUGIN_BASENAME ),
31 - array(), BOGO_VERSION, 'all' );
18 + return;
32 19 }
33 20
34 - wp_enqueue_script( 'bogo-admin',
35 - plugins_url( 'admin/includes/js/admin.js', BOGO_PLUGIN_BASENAME ),
36 - array( 'jquery' ), BOGO_VERSION, true );
37 -
38 - $local_args = array(
39 - 'saveAlert' => __(
40 - "The changes you made will be lost if you navigate away from this page.",
41 - 'bogo' ),
42 - 'rest_api' => array(
43 - 'url' => trailingslashit( rest_url( 'bogo/v1' ) ),
44 - 'nonce' => wp_create_nonce( 'wp_rest' ) ) );
45 -
46 21 if ( 'nav-menus.php' == $hook_suffix ) {
47 22 $nav_menu_id = absint( get_user_option( 'nav_menu_recently_edited' ) );
48 23 $nav_menu_items = wp_get_nav_menu_items( $nav_menu_id );
49 24 $locales = array();
@@ -51,51 +26,51 @@
51 26 foreach ( (array) $nav_menu_items as $item ) {
52 27 $locales[$item->db_id] = $item->bogo_locales;
53 28 }
54 29
55 - $local_args = array_merge( $local_args, array(
30 + $prefix = 'menu-item-bogo-locale';
31 +
32 + wp_enqueue_script( 'bogo-admin',
33 + plugins_url( 'admin/includes/js/admin.js', BOGO_PLUGIN_BASENAME ),
34 + array( 'jquery' ),
35 + BOGO_VERSION, true );
36 +
37 + wp_localize_script( 'bogo-admin', '_bogo', array(
56 38 'availableLanguages' => bogo_available_languages( array(
57 39 'exclude_enus_if_inactive' => true,
58 40 'orderby' => 'value' ) ),
59 41 'locales' => $locales,
60 42 'selectorLegend' => __( 'Displayed on pages in', 'bogo' ),
61 - 'cbPrefix' => 'menu-item-bogo-locale' ) );
43 + 'cbPrefix' => $prefix ) );
44 +
45 + wp_enqueue_style( 'bogo-admin',
46 + plugins_url( 'admin/includes/css/admin.css', BOGO_PLUGIN_BASENAME ),
47 + array(), BOGO_VERSION, 'all' );
48 +
49 + return;
62 50 }
63 51
64 52 if ( 'options-general.php' == $hook_suffix ) {
65 - $local_args = array_merge( $local_args, array(
53 + wp_enqueue_script( 'bogo-admin',
54 + plugins_url( 'admin/includes/js/admin.js', BOGO_PLUGIN_BASENAME ),
55 + array( 'jquery' ),
56 + BOGO_VERSION, true );
57 +
58 + wp_localize_script( 'bogo-admin', '_bogo', array(
66 59 'defaultLocale' => bogo_get_default_locale() ) );
67 - }
68 60
69 - if ( 'post.php' == $hook_suffix && ! empty( $GLOBALS['post'] ) ) {
70 - $post = $GLOBALS['post'];
71 - $local_args = array_merge( $local_args, array(
72 - 'post_id' => $post->ID ) );
61 + return;
73 62 }
74 -
75 - wp_localize_script( 'bogo-admin', '_bogo', $local_args );
76 63 }
77 64
78 65 add_action( 'admin_menu', 'bogo_admin_menu' );
79 66
80 67 function bogo_admin_menu() {
81 - add_menu_page( __( 'Languages', 'bogo' ), __( 'Languages', 'bogo' ),
82 - 'bogo_manage_language_packs', 'bogo', 'bogo_tools_page',
83 - 'dashicons-translation', 73 ); // between Users (70) and Tools (75)
68 + $tools = add_management_page(
69 + __( 'Bogo Tools', 'bogo' ), __( 'Bogo', 'bogo' ),
70 + 'update_core', 'bogo-tools', 'bogo_tools_page' );
84 71
85 - $tools = add_submenu_page( 'bogo',
86 - __( 'Language Packs', 'bogo' ),
87 - __( 'Language Packs', 'bogo' ),
88 - 'bogo_manage_language_packs', 'bogo', 'bogo_tools_page' );
89 -
90 72 add_action( 'load-' . $tools, 'bogo_load_tools_page' );
91 -
92 - $texts = add_submenu_page( 'bogo',
93 - __( 'Terms Translation', 'bogo' ),
94 - __( 'Terms Translation', 'bogo' ),
95 - 'bogo_edit_terms_translation', 'bogo-texts', 'bogo_texts_page' );
96 -
97 - add_action( 'load-' . $texts, 'bogo_load_texts_page' );
98 73 }
99 74
100 75 function bogo_load_tools_page() {
101 76 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
@@ -104,10 +79,10 @@
104 79
105 80 if ( 'install_translation' == $action ) {
106 81 check_admin_referer( 'bogo-tools' );
107 82
108 - if ( ! current_user_can( 'bogo_manage_language_packs' ) ) {
109 - wp_die( __( "You are not allowed to install translations.", 'bogo' ) );
83 + if ( ! current_user_can( 'update_core' ) ) {
84 + wp_die( __( 'You are not allowed to install translations.', 'bogo' ) );
110 85 }
111 86
112 87 $locale = isset( $_GET['locale'] ) ? $_GET['locale'] : null;
113 88
@@ -113,13 +88,13 @@
113 88
114 89 if ( wp_download_language_pack( $locale ) ) {
115 90 $redirect_to = add_query_arg(
116 91 array( 'locale' => $locale, 'message' => 'install_success' ),
117 - menu_page_url( 'bogo', false ) );
92 + menu_page_url( 'bogo-tools', false ) );
118 93 } else {
119 94 $redirect_to = add_query_arg(
120 95 array( 'locale' => $locale, 'message' => 'install_failed' ),
121 - menu_page_url( 'bogo', false ) );
96 + menu_page_url( 'bogo-tools', false ) );
122 97 }
123 98
124 99 wp_safe_redirect( $redirect_to );
125 100 exit();
@@ -124,40 +99,13 @@
124 99 wp_safe_redirect( $redirect_to );
125 100 exit();
126 101 }
127 102
128 - if ( 'set_site_lang' == $action ) {
129 - check_admin_referer( 'bogo-tools' );
130 -
131 - if ( ! current_user_can( 'bogo_manage_language_packs' ) ) {
132 - wp_die( __( "You are not allowed to manage translations.", 'bogo' ) );
133 - }
134 -
135 - $locale = isset( $_GET['locale'] ) ? $_GET['locale'] : null;
136 -
137 - if ( 'en_US' == $locale || ! bogo_is_available_locale( $locale ) ) {
138 - $locale = '';
139 - }
140 -
141 - if ( update_option( 'WPLANG', $locale ) ) {
142 - $redirect_to = add_query_arg(
143 - array( 'locale' => $locale, 'message' => 'site_lang_success' ),
144 - menu_page_url( 'bogo', false ) );
145 - } else {
146 - $redirect_to = add_query_arg(
147 - array( 'locale' => $locale, 'message' => 'site_lang_failed' ),
148 - menu_page_url( 'bogo', false ) );
149 - }
150 -
151 - wp_safe_redirect( $redirect_to );
152 - exit();
153 - }
154 -
155 103 if ( 'delete_translation' == $action ) {
156 104 check_admin_referer( 'bogo-tools' );
157 105
158 - if ( ! current_user_can( 'bogo_manage_language_packs' ) ) {
159 - wp_die( __( "You are not allowed to delete translations.", 'bogo' ) );
106 + if ( ! current_user_can( 'update_core' ) ) {
107 + wp_die( __( 'You are not allowed to delete translations.', 'bogo' ) );
160 108 }
161 109
162 110 $locale = isset( $_GET['locale'] ) ? $_GET['locale'] : null;
163 111
@@ -163,13 +111,13 @@
163 111
164 112 if ( bogo_delete_language_pack( $locale ) ) {
165 113 $redirect_to = add_query_arg(
166 114 array( 'locale' => $locale, 'message' => 'delete_success' ),
167 - menu_page_url( 'bogo', false ) );
115 + menu_page_url( 'bogo-tools', false ) );
168 116 } else {
169 117 $redirect_to = add_query_arg(
170 118 array( 'locale' => $locale, 'message' => 'delete_failed' ),
171 - menu_page_url( 'bogo', false ) );
119 + menu_page_url( 'bogo-tools', false ) );
172 120 }
173 121
174 122 wp_safe_redirect( $redirect_to );
175 123 exit();
@@ -181,9 +129,9 @@
181 129 bogo_set_prop( 'enus_deactivated', true );
182 130
183 131 $redirect_to = add_query_arg(
184 132 array( 'message' => 'enus_deactivated' ),
185 - menu_page_url( 'bogo', false ) );
133 + menu_page_url( 'bogo-tools', false ) );
186 134
187 135 wp_safe_redirect( $redirect_to );
188 136 exit();
189 137 }
@@ -194,9 +142,9 @@
194 142 bogo_set_prop( 'enus_deactivated', false );
195 143
196 144 $redirect_to = add_query_arg(
197 145 array( 'message' => 'enus_activated' ),
198 - menu_page_url( 'bogo', false ) );
146 + menu_page_url( 'bogo-tools', false ) );
199 147
200 148 wp_safe_redirect( $redirect_to );
201 149 exit();
202 150 }
@@ -201,51 +149,10 @@
201 149 exit();
202 150 }
203 151 }
204 152
205 -function bogo_load_texts_page() {
206 - $action = isset( $_POST['action'] ) ? $_POST['action'] : '';
207 -
208 - if ( 'save' == $action ) {
209 - check_admin_referer( 'bogo-edit-text-translation' );
210 -
211 - $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : null;
212 -
213 - if ( ! current_user_can( 'bogo_edit_terms_translation' ) ) {
214 - wp_die( __( "You are not allowed to edit translations.", 'bogo' ) );
215 - }
216 -
217 - $entries = array();
218 -
219 - foreach ( $_POST as $p_key => $p_val ) {
220 - if ( in_array( $p_key, array( 'action', 'locale', 'submit' ) )
221 - || substr( $p_key, 0, 1 ) == '_' ) {
222 - continue;
223 - }
224 -
225 - $entries[] = array(
226 - 'singular' => $p_key,
227 - 'translations' => array( $p_val ),
228 - 'context' => preg_replace( '/:.*$/', '', $p_key ) );
229 - }
230 -
231 - if ( Bogo_POMO::export( $locale, $entries ) ) {
232 - $message = 'translation_saved';
233 - } else {
234 - $message = 'translation_failed';
235 - }
236 -
237 - $redirect_to = add_query_arg(
238 - array( 'locale' => $locale, 'message' => $message ),
239 - menu_page_url( 'bogo-texts', false ) );
240 -
241 - wp_safe_redirect( $redirect_to );
242 - exit();
243 - }
244 -}
245 -
246 153 function bogo_tools_page() {
247 - $enus_deactivated = bogo_is_enus_deactivated();
154 + $enus_deactivated = bogo_get_prop( 'enus_deactivated' );
248 155 $can_install = wp_can_install_language_pack();
249 156
250 157 $default_locale = bogo_get_default_locale();
251 158 $available_locales = bogo_available_locales();
@@ -252,25 +159,27 @@
252 159
253 160 ?>
254 161 <div class="wrap">
255 162
256 -<h1><?php echo esc_html( __( 'Language Packs', 'bogo' ) ); ?></h1>
163 +<h2><?php echo esc_html( __( 'Bogo Tools', 'bogo' ) ); ?></h2>
257 164
258 165 <?php bogo_admin_notice(); ?>
259 166
167 +<h3 class="title"><?php echo esc_html( __( 'Available Languages', 'bogo' ) ); ?></h3>
168 +
260 169 <table id="bogo-languages-table" class="widefat">
261 170 <thead>
262 - <tr><th><?php echo esc_html( __( 'Language', 'bogo' ) ); ?></th></tr>
171 + <tr><th></th><th><?php echo esc_html( __( 'Language', 'bogo' ) ); ?></th></tr>
263 172 </thead>
264 173 <tfoot>
265 - <tr><th><?php echo esc_html( __( 'Language', 'bogo' ) ); ?></th></tr>
174 + <tr><th></th><th><?php echo esc_html( __( 'Language', 'bogo' ) ); ?></th></tr>
266 175 </tfoot>
267 176 <tbody id="translations">
268 - <tr class="active" id="language-1"><td>
177 + <tr class="active"><th>1</th><td><p>
269 178 <strong><?php echo esc_html( bogo_get_language( $default_locale ) ); ?></strong>
270 179 [<?php echo esc_html( $default_locale ); ?>]
271 - <div class="status"><?php echo esc_html( __( 'Site Language', 'bogo' ) ); ?></div>
272 - </td></tr>
180 + <div class="status"><span class="status"><?php echo esc_html( __( 'Site Default Language', 'bogo' ) ); ?></span></div>
181 + </p></td></tr>
273 182
274 183 <?php
275 184 $count = 1;
276 185
@@ -281,100 +190,77 @@
281 190
282 191 $count += 1;
283 192 $class = 'active';
284 193
285 - if ( ! $language = bogo_get_language( $locale ) ) {
286 - $language = $locale;
287 - }
288 -
289 194 if ( 'en_US' == $locale ) {
290 195 $status = $enus_deactivated
291 - ? __( 'Inactive', 'bogo' ) : __( 'Active', 'bogo' );
196 + ? esc_html( __( 'Inactive', 'bogo' ) )
197 + : esc_html( __( 'Active', 'bogo' ) );
292 198 } else {
293 - $status = __( 'Installed', 'bogo' );
199 + $status = esc_html( __( 'Installed', 'bogo' ) );
294 200 }
295 201
296 202 if ( 'en_US' == $locale ) {
297 203 if ( $enus_deactivated ) {
298 - $activate_link = menu_page_url( 'bogo', false );
204 + $activate_link = menu_page_url( 'bogo-tools', false );
299 205 $activate_link = add_query_arg(
300 206 array( 'action' => 'activate_enus' ),
301 207 $activate_link );
302 208 $activate_link = wp_nonce_url( $activate_link, 'bogo-tools' );
303 209 $activate_link = sprintf(
304 - '<a href="%1$s" class="activate" aria-label="%3$s">%2$s</a>',
210 + '<a href="%1$s" class="activate">%2$s</a>',
305 211 $activate_link,
306 - esc_html( __( 'Activate', 'bogo' ) ),
307 - esc_attr(
308 - sprintf( __( 'Activate %s language pack', 'bogo' ), $language ) ) );
212 + esc_html( __( 'Activate', 'bogo' ) ) );
309 213
310 - $row_actions = array( $activate_link );
311 -
214 + $status = sprintf(
215 + '<div class="status"><span class="status">%s</span> | %s</div>',
216 + $status, $activate_link );
312 217 $class = '';
313 218 } else {
314 - $sitelang_link = menu_page_url( 'bogo', false );
315 - $sitelang_link = add_query_arg(
316 - array( 'action' => 'set_site_lang', 'locale' => $locale ),
317 - $sitelang_link );
318 - $sitelang_link = wp_nonce_url( $sitelang_link, 'bogo-tools' );
319 - $sitelang_link = sprintf(
320 - '<a href="%1$s" class="sitelang" aria-label="%3$s">%2$s</a>',
321 - $sitelang_link,
322 - esc_html( __( 'Set as Site Language', 'bogo' ) ),
323 - esc_attr(
324 - sprintf( __( 'Set %s as Site Language', 'bogo' ), $language ) ) );
325 -
326 - $deactivate_link = menu_page_url( 'bogo', false );
219 + $deactivate_link = menu_page_url( 'bogo-tools', false );
327 220 $deactivate_link = add_query_arg(
328 221 array( 'action' => 'deactivate_enus' ),
329 222 $deactivate_link );
330 223 $deactivate_link = wp_nonce_url( $deactivate_link, 'bogo-tools' );
331 224 $deactivate_link = sprintf(
332 - '<a href="%1$s" class="deactivate" aria-label="%3$s">%2$s</a>',
225 + '<a href="%1$s" class="deactivate">%2$s</a>',
333 226 $deactivate_link,
334 - esc_html( __( 'Deactivate', 'bogo' ) ),
335 - esc_attr( sprintf(
336 - __( 'Deactivate %s language pack', 'bogo' ), $language ) ) );
227 + esc_html( __( 'Deactivate', 'bogo' ) ) );
337 228
338 - $row_actions = array( $sitelang_link, $deactivate_link );
229 + $status = sprintf(
230 + '<div class="status"><span class="status">%s</span> | %s</div>',
231 + $status, $deactivate_link );
339 232 }
340 233 } elseif ( $can_install ) {
341 - $sitelang_link = menu_page_url( 'bogo', false );
342 - $sitelang_link = add_query_arg(
343 - array( 'action' => 'set_site_lang', 'locale' => $locale ),
344 - $sitelang_link );
345 - $sitelang_link = wp_nonce_url( $sitelang_link, 'bogo-tools' );
346 - $sitelang_link = sprintf(
347 - '<a href="%1$s" class="sitelang" aria-label="%3$s">%2$s</a>',
348 - $sitelang_link,
349 - esc_html( __( 'Set as Site Language', 'bogo' ) ),
350 - esc_attr(
351 - sprintf( __( 'Set %s as Site Language', 'bogo' ), $language ) ) );
352 -
353 - $delete_link = menu_page_url( 'bogo', false );
234 + $delete_link = menu_page_url( 'bogo-tools', false );
354 235 $delete_link = add_query_arg(
355 236 array( 'action' => 'delete_translation', 'locale' => $locale ),
356 237 $delete_link );
357 238 $delete_link = wp_nonce_url( $delete_link, 'bogo-tools' );
358 239
359 - $delete_confirm = sprintf( __( "You are about to delete %s language pack.\n 'Cancel' to stop, 'OK' to delete.", 'bogo' ), $language );
240 + if ( ! $delete_language = bogo_get_language( $locale ) ) {
241 + $delete_language = $locale;
242 + }
360 243
361 - $delete_link = sprintf( '<a href="%1$s" class="delete" onclick="if (confirm(\'%3$s\')){return true;} return false;" aria-label="%4$s">%2$s</a>',
244 + $delete_confirm = sprintf( __( "You are about to delete %s language pack.\n 'Cancel' to stop, 'OK' to delete.", 'bogo' ), $delete_language );
245 +
246 + $delete_link = sprintf( '<a href="%1$s" class="delete" onclick="if (confirm(\'%3$s\')){return true;} return false;">%2$s</a>',
362 247 $delete_link,
363 248 esc_html( __( 'Delete', 'bogo' ) ),
364 - esc_js( $delete_confirm ),
365 - esc_attr(
366 - sprintf( __( 'Delete %s language pack', 'bogo' ), $language ) ) );
249 + esc_js( $delete_confirm ) );
367 250
368 - $row_actions = array( $sitelang_link, $delete_link );
251 + $status = sprintf(
252 + '<div class="status"><span class="status">%s</span> | %s</div>',
253 + $status, $delete_link );
369 254 }
370 255 ?>
371 - <tr class="<?php echo esc_attr( $class ); ?>" id="language-<?php echo absint( $count ); ?>">
372 - <td>
256 + <tr class="<?php echo esc_attr( $class ); ?>">
257 + <th><?php echo $count; ?></th>
258 + <td><p>
373 259 <strong><?php echo esc_html( bogo_get_language( $locale ) ); ?></strong>
374 260 [<?php echo esc_html( $locale ); ?>]
375 - <div class="status"><?php echo esc_html( $status ); ?></div>
376 - <div class="row-actions"><?php echo implode( ' | ', $row_actions ); ?></div>
261 + <?php echo $status; ?>
262 + </p>
377 263 </td>
378 264 </tr>
379 265 <?php
380 266 }
@@ -388,28 +274,22 @@
388 274
389 275 $install_link = '';
390 276
391 277 if ( $can_install ) {
392 - $install_link = menu_page_url( 'bogo', false );
278 + $install_link = menu_page_url( 'bogo-tools', false );
393 279 $install_link = add_query_arg(
394 280 array( 'action' => 'install_translation', 'locale' => $locale ),
395 281 $install_link );
396 282 $install_link = wp_nonce_url( $install_link, 'bogo-tools' );
397 - $install_link = sprintf( '<a href="%1$s" class="install" aria-label="%3$s">%2$s</a>',
398 - $install_link,
399 - esc_html( __( 'Install', 'bogo' ) ),
400 - esc_attr(
401 - sprintf( __( 'Install %s language pack', 'bogo' ),
402 - bogo_get_language( $locale ) ) ) );
403 -
404 - $row_actions = array( $install_link );
283 + $install_link = sprintf( '<a href="%1$s" class="install">%2$s</a>',
284 + $install_link, esc_html( __( 'Install', 'bogo' ) ) );
405 285 }
406 286 ?>
407 - <tr id="language-<?php echo absint( $count ); ?>"><td>
287 + <tr><th><?php echo $count; ?></th><td><p>
408 288 <strong><?php echo esc_html( bogo_get_language( $locale ) ); ?></strong>
409 289 [<?php echo esc_html( $locale ); ?>]
410 - <div class="row-actions"><?php echo implode( ' | ', $row_actions ); ?></div>
411 - </td></tr>
290 + <?php echo $install_link; ?>
291 + </p></td></tr>
412 292 <?php
413 293 }
414 294 ?>
415 295
@@ -419,118 +299,8 @@
419 299 </div>
420 300 <?php
421 301 }
422 302
423 -function bogo_texts_page() {
424 - $locale_to_edit = isset( $_GET['locale'] ) ? $_GET['locale'] : '';
425 -
426 - if ( ! Bogo_POMO::import( $locale_to_edit ) ) {
427 - Bogo_POMO::reset();
428 - }
429 -
430 -?>
431 -<div class="wrap">
432 -
433 -<h1><?php echo esc_html( __( 'Terms Translation', 'bogo' ) ); ?></h1>
434 -
435 -<?php bogo_admin_notice(); ?>
436 -
437 -<form action="" method="post" id="bogo-translatable-text-strings">
438 -<input type="hidden" name="action" value="save" />
439 -<?php wp_nonce_field( 'bogo-edit-text-translation' ); ?>
440 -
441 -<p>
442 -<select name="locale" id="select-locale">
443 - <option value=""><?php echo esc_html( __( '-- Select Language to Edit --', 'bogo' ) ); ?></option>
444 -<?php
445 - $available_locales = bogo_available_locales(
446 - array( 'current_user_can_access' => true ) );
447 -
448 - foreach ( $available_locales as $locale ) {
449 - echo sprintf( '<option value="%1$s"%3$s>%2$s</option>',
450 - esc_attr( $locale ),
451 - esc_html( bogo_get_language( $locale ) ),
452 - $locale == $locale_to_edit ? ' selected="selected"' : '' );
453 - }
454 -?>
455 -</select>
456 -</p>
457 -
458 -<?php
459 - if ( bogo_is_available_locale( $locale_to_edit ) ) :
460 - $strings = array(
461 - array(
462 - 'name' => 'blogname',
463 - 'original' => get_option( 'blogname' ),
464 - 'translated' => bogo_translate( 'blogname',
465 - 'blogname', get_option( 'blogname' ) ),
466 - 'context' => __( 'Site Title', 'bogo' ) ),
467 - array(
468 - 'name' => 'blogdescription',
469 - 'original' => get_option( 'blogdescription' ),
470 - 'translated' => bogo_translate( 'blogdescription',
471 - 'blogdescription', get_option( 'blogdescription' ) ),
472 - 'context' => __( 'Tagline', 'bogo' ) ) );
473 -
474 - remove_filter( 'get_term', 'bogo_get_term_filter' );
475 -
476 - foreach ( (array) get_taxonomies( array(), 'objects' ) as $taxonomy ) {
477 - $tax_labels = get_taxonomy_labels( $taxonomy );
478 - $terms = get_terms( array(
479 - 'taxonomy' => $taxonomy->name,
480 - 'orderby' => 'slug',
481 - 'hide_empty' => false ) );
482 -
483 - foreach ( (array) $terms as $term ) {
484 - $name = sprintf( '%s:%d', $taxonomy->name, $term->term_id );
485 - $strings[] = array(
486 - 'name' => $name,
487 - 'original' => $term->name,
488 - 'translated' => bogo_translate( $name,
489 - $taxonomy->name, $term->name ),
490 - 'context' => $tax_labels->name );
491 - }
492 - }
493 -?>
494 -<table class="wp-list-table widefat fixed striped" id="bogo-translation-table">
495 -<thead>
496 - <tr>
497 - <th scope="col"><?php echo esc_html( __( 'Original', 'bogo' ) ); ?></th>
498 - <th scope="col"><?php echo esc_html( __( 'Translation', 'bogo' ) ); ?></th>
499 - <th scope="col" style="width: 20%;"><?php echo esc_html( __( 'Context', 'bogo' ) ); ?></th>
500 - </tr>
501 -</thead>
502 -<tfoot>
503 - <tr>
504 - <th scope="col"><?php echo esc_html( __( 'Original', 'bogo' ) ); ?></th>
505 - <th scope="col"><?php echo esc_html( __( 'Translation', 'bogo' ) ); ?></th>
506 - <th scope="col"><?php echo esc_html( __( 'Context', 'bogo' ) ); ?></th>
507 - </tr>
508 -</tfoot>
509 -<tbody>
510 -<?php
511 - foreach( $strings as $string ) :
512 -?>
513 - <tr>
514 - <td><?php echo esc_html( $string['original'] ); ?></td>
515 - <td><input name="<?php echo esc_attr( $string['name'] ); ?>" type="text" id="<?php echo esc_attr( $string['name'] ); ?>" value="<?php echo esc_attr( $string['translated'] ); ?>" class="large-text" /></td>
516 - <td><?php echo esc_html( $string['context'] ); ?></td>
517 - </tr>
518 -<?php
519 - endforeach;
520 -?>
521 -</tbody>
522 -</table>
523 -
524 -<?php submit_button(); ?>
525 -<?php
526 - endif;
527 -?>
528 -</form>
529 -</div>
530 -<?php
531 -}
532 -
533 303 function bogo_admin_notice( $reason = '' ) {
534 304 if ( empty( $reason ) && isset( $_GET['message'] ) ) {
535 305 $reason = $_GET['message'];
536 306 }
@@ -538,12 +308,8 @@
538 308 if ( 'install_success' == $reason ) {
539 309 $message = __( "Translation installed successfully.", 'bogo' );
540 310 } elseif ( 'install_failed' == $reason ) {
541 311 $message = __( "Translation install failed.", 'bogo' );
542 - } elseif ( 'site_lang_success' == $reason ) {
543 - $message = __( "Site language set successfully.", 'bogo' );
544 - } elseif ( 'site_lang_failed' == $reason ) {
545 - $message = __( "Setting site language failed.", 'bogo' );
546 312 } elseif ( 'delete_success' == $reason ) {
547 313 $message = __( "Translation uninstalled successfully.", 'bogo' );
548 314 } elseif ( 'delete_failed' == $reason ) {
549 315 $message = __( "Translation uninstall failed.", 'bogo' );
@@ -550,17 +316,13 @@
550 316 } elseif ( 'enus_deactivated' == $reason ) {
551 317 $message = __( "English (United States) deactivated.", 'bogo' );
552 318 } elseif ( 'enus_activated' == $reason ) {
553 319 $message = __( "English (United States) activated.", 'bogo' );
554 - } elseif ( 'translation_saved' == $reason ) {
555 - $message = __( "Translation saved.", 'bogo' );
556 - } elseif ( 'translation_failed' == $reason ) {
557 - $message = __( "Saving translation failed.", 'bogo' );
558 320 } else {
559 321 return false;
560 322 }
561 323
562 - if ( '_failed' == substr( $reason, -7 ) ) {
324 + if ( 'install_failed' == $reason || 'delete_failed' == $reason ) {
563 325 echo sprintf(
564 326 '<div class="error notice notice-error is-dismissible"><p>%s</p></div>',
565 327 esc_html( $message ) );
566 328 } else {