save.php 954 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Save menu items.
  4. *
  5. * @package Elgg
  6. * @subpackage Core
  7. */
  8. // featured menu items
  9. $featured_names = get_input('featured_menu_names', array());
  10. $featured_names = array_unique($featured_names);
  11. if (in_array(' ', $featured_names)) {
  12. unset($featured_names[array_search(' ', $featured_names)]);
  13. }
  14. elgg_save_config('site_featured_menu_names', $featured_names);
  15. // custom menu items
  16. $custom_menu_titles = get_input('custom_menu_titles', array());
  17. $custom_menu_urls = get_input('custom_menu_urls', array());
  18. $num_menu_items = count($custom_menu_titles);
  19. $custom_menu_items = array();
  20. for ($i = 0; $i < $num_menu_items; $i++) {
  21. if (trim($custom_menu_urls[$i]) && trim($custom_menu_titles[$i])) {
  22. $url = $custom_menu_urls[$i];
  23. $title = $custom_menu_titles[$i];
  24. $custom_menu_items[$title] = $url;
  25. }
  26. }
  27. elgg_save_config('site_custom_menu_items', $custom_menu_items);
  28. system_message(elgg_echo('admin:menu_items:saved'));
  29. forward(REFERER);