| 1 |
<?php |
| 2 |
|
| 3 |
require_once BOGO_PLUGIN_DIR . '/admin/user.php'; |
| 4 |
require_once BOGO_PLUGIN_DIR . '/admin/post.php'; |
| 5 |
require_once BOGO_PLUGIN_DIR . '/admin/nav-menu.php'; |
| 6 |
require_once BOGO_PLUGIN_DIR . '/admin/widgets.php'; |
| 7 |
|
| 8 |
add_action( 'admin_enqueue_scripts', 'bogo_admin_enqueue_scripts' ); |
| 9 |
|
| 10 |
function bogo_admin_enqueue_scripts( $hook_suffix ) { |
| 11 |
if ( 'widgets.php' == $hook_suffix || 'user-edit.php' == $hook_suffix ) { |
| 12 |
wp_enqueue_style( 'bogo-admin', |
| 13 |
plugins_url( 'admin/admin.css', BOGO_PLUGIN_BASENAME ), |
| 14 |
array(), BOGO_VERSION, 'all' ); |
| 15 |
|
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
if ( 'nav-menus.php' == $hook_suffix ) { |
| 20 |
$nav_menu_id = absint( get_user_option( 'nav_menu_recently_edited' ) ); |
| 21 |
$nav_menu_items = wp_get_nav_menu_items( $nav_menu_id ); |
| 22 |
$locales = array(); |
| 23 |
|
| 24 |
foreach ( (array) $nav_menu_items as $item ) { |
| 25 |
$locales[$item->db_id] = $item->bogo_locales; |
| 26 |
} |
| 27 |
|
| 28 |
$prefix = 'menu-item-bogo-locale'; |
| 29 |
|
| 30 |
wp_enqueue_script( 'bogo-admin', |
| 31 |
plugins_url( 'admin/admin.js', BOGO_PLUGIN_BASENAME ), |
| 32 |
array( 'jquery' ), |
| 33 |
BOGO_VERSION, true ); |
| 34 |
|
| 35 |
wp_localize_script( 'bogo-admin', '_bogo', array( |
| 36 |
'availableLanguages' => bogo_available_languages( 'orderby=value' ), |
| 37 |
'locales' => $locales, |
| 38 |
'selectorLegend' => __( 'Displayed on pages in', 'bogo' ), |
| 39 |
'cbPrefix' => $prefix ) ); |
| 40 |
|
| 41 |
wp_enqueue_style( 'bogo-admin', |
| 42 |
plugins_url( 'admin/admin.css', BOGO_PLUGIN_BASENAME ), |
| 43 |
array(), BOGO_VERSION, 'all' ); |
| 44 |
|
| 45 |
return; |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
?> |