| @@ -7,36 +7,18 @@ | ||
| 7 | 7 | |
| 8 | 8 | add_action( 'admin_enqueue_scripts', 'bogo_admin_enqueue_scripts' ); |
| 9 | 9 | |
| 10 | 10 | function bogo_admin_enqueue_scripts( $hook_suffix ) { |
| 11 | - $pages_need_style = array( | |
| 12 | - 'tools_page_bogo-tools', | |
| 13 | - 'widgets.php', | |
| 14 | - 'user-edit.php', | |
| 15 | - 'nav-menus.php' ); | |
| 16 | - | |
| 17 | - if ( in_array( $hook_suffix, $pages_need_style ) ) { | |
| 11 | + if ( false !== strpos( $hook_suffix, 'bogo-tools' ) | |
| 12 | + || 'widgets.php' == $hook_suffix | |
| 13 | + || 'user-edit.php' == $hook_suffix ) { | |
| 18 | 14 | wp_enqueue_style( 'bogo-admin', |
| 19 | 15 | plugins_url( 'admin/includes/css/admin.css', BOGO_PLUGIN_BASENAME ), |
| 20 | 16 | array(), BOGO_VERSION, 'all' ); |
| 21 | 17 | |
| 22 | - if ( is_rtl() ) { | |
| 23 | - wp_enqueue_style( 'bogo-admin-rtl', | |
| 24 | - plugins_url( 'admin/includes/css/admin-rtl.css', BOGO_PLUGIN_BASENAME ), | |
| 25 | - array(), BOGO_VERSION, 'all' ); | |
| 26 | - } | |
| 18 | + return; | |
| 27 | 19 | } |
| 28 | 20 | |
| 29 | - $pages_need_script = array( | |
| 30 | - 'nav-menus.php', | |
| 31 | - 'options-general.php' ); | |
| 32 | - | |
| 33 | - if ( in_array( $hook_suffix, $pages_need_script ) ) { | |
| 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 | - | |
| 39 | 21 | if ( 'nav-menus.php' == $hook_suffix ) { |
| 40 | 22 | $nav_menu_id = absint( get_user_option( 'nav_menu_recently_edited' ) ); |
| 41 | 23 | $nav_menu_items = wp_get_nav_menu_items( $nav_menu_id ); |
| 42 | 24 | $locales = array(); |
| @@ -44,8 +26,15 @@ | ||
| 44 | 26 | foreach ( (array) $nav_menu_items as $item ) { |
| 45 | 27 | $locales[$item->db_id] = $item->bogo_locales; |
| 46 | 28 | } |
| 47 | 29 | |
| 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 | + | |
| 48 | 37 | wp_localize_script( 'bogo-admin', '_bogo', array( |
| 49 | 38 | 'availableLanguages' => bogo_available_languages( array( |
| 50 | 39 | 'exclude_enus_if_inactive' => true, |
| 51 | 40 | 'orderby' => 'value' ) ), |
| @@ -50,14 +39,27 @@ | ||
| 50 | 39 | 'exclude_enus_if_inactive' => true, |
| 51 | 40 | 'orderby' => 'value' ) ), |
| 52 | 41 | 'locales' => $locales, |
| 53 | 42 | 'selectorLegend' => __( 'Displayed on pages in', 'bogo' ), |
| 54 | - '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; | |
| 55 | 50 | } |
| 56 | 51 | |
| 57 | 52 | if ( 'options-general.php' == $hook_suffix ) { |
| 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 | 58 | wp_localize_script( 'bogo-admin', '_bogo', array( |
| 59 | 59 | 'defaultLocale' => bogo_get_default_locale() ) ); |
| 60 | + | |
| 61 | + return; | |
| 60 | 62 | } |
| 61 | 63 | } |
| 62 | 64 | |
| 63 | 65 | add_action( 'admin_menu', 'bogo_admin_menu' ); |
| @@ -171,13 +173,13 @@ | ||
| 171 | 173 | <tfoot> |
| 172 | 174 | <tr><th></th><th><?php echo esc_html( __( 'Language', 'bogo' ) ); ?></th></tr> |
| 173 | 175 | </tfoot> |
| 174 | 176 | <tbody id="translations"> |
| 175 | - <tr class="active"><th>1</th><td> | |
| 177 | + <tr class="active"><th>1</th><td><p> | |
| 176 | 178 | <strong><?php echo esc_html( bogo_get_language( $default_locale ) ); ?></strong> |
| 177 | 179 | [<?php echo esc_html( $default_locale ); ?>] |
| 178 | 180 | <div class="status"><span class="status"><?php echo esc_html( __( 'Site Default Language', 'bogo' ) ); ?></span></div> |
| 179 | - </td></tr> | |
| 181 | + </p></td></tr> | |
| 180 | 182 | |
| 181 | 183 | <?php |
| 182 | 184 | $count = 1; |
| 183 | 185 | |
| @@ -252,12 +254,13 @@ | ||
| 252 | 254 | } |
| 253 | 255 | ?> |
| 254 | 256 | <tr class="<?php echo esc_attr( $class ); ?>"> |
| 255 | 257 | <th><?php echo $count; ?></th> |
| 256 | - <td> | |
| 258 | + <td><p> | |
| 257 | 259 | <strong><?php echo esc_html( bogo_get_language( $locale ) ); ?></strong> |
| 258 | 260 | [<?php echo esc_html( $locale ); ?>] |
| 259 | 261 | <?php echo $status; ?> |
| 262 | + </p> | |
| 260 | 263 | </td> |
| 261 | 264 | </tr> |
| 262 | 265 | <?php |
| 263 | 266 | } |
| @@ -280,13 +283,13 @@ | ||
| 280 | 283 | $install_link = sprintf( '<a href="%1$s" class="install">%2$s</a>', |
| 281 | 284 | $install_link, esc_html( __( 'Install', 'bogo' ) ) ); |
| 282 | 285 | } |
| 283 | 286 | ?> |
| 284 | - <tr><th><?php echo $count; ?></th><td> | |
| 287 | + <tr><th><?php echo $count; ?></th><td><p> | |
| 285 | 288 | <strong><?php echo esc_html( bogo_get_language( $locale ) ); ?></strong> |
| 286 | 289 | [<?php echo esc_html( $locale ); ?>] |
| 287 | 290 | <?php echo $install_link; ?> |
| 288 | - </td></tr> | |
| 291 | + </p></td></tr> | |
| 289 | 292 | <?php |
| 290 | 293 | } |
| 291 | 294 | ?> |
| 292 | 295 | |