functions.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2017 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. /// @param $selected What value should be selected.
  25. function get_theme_html_str( $selected, $add_empty = FALSE )
  26. {
  27. $themes = makefilelist("themes/", ".|..|.svn", true, "folders");
  28. $retval = "<select id='theme' name='theme'>";
  29. if ( empty($selected) )
  30. {
  31. $retval .= "<option value='' selected=selected >-</option>";
  32. }
  33. foreach ( $themes as $theme )
  34. {
  35. $retval .= "<option value='$theme'";
  36. if ( $theme === $selected )
  37. $retval .= ' selected=selected ';
  38. $retval .= ">$theme</option>";
  39. }
  40. if ( $add_empty )
  41. {
  42. $retval .= "<option value='' >-</option>";
  43. }
  44. $retval .= "</select>";
  45. return $retval;
  46. }
  47. ?>