You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.3KB

  1. <?php // Prismatic - Validate Settings
  2. if (!defined('ABSPATH')) exit;
  3. function prismatic_validate_general($input) {
  4. $library = prismatic_library();
  5. if (!isset($input['library'])) $input['library'] = null;
  6. if (!array_key_exists($input['library'], $library)) $input['library'] = null;
  7. return $input;
  8. }
  9. function prismatic_validate_prism($input) {
  10. $prism_theme = prismatic_prism_theme();
  11. if (!isset($input['prism_theme'])) $input['prism_theme'] = null;
  12. if (!array_key_exists($input['prism_theme'], $prism_theme)) $input['prism_theme'] = null;
  13. $location = prismatic_location();
  14. if (!isset($input['filter_content'])) $input['filter_content'] = null;
  15. if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null;
  16. if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null;
  17. if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null;
  18. if (!isset($input['filter_comments'])) $input['filter_comments'] = null;
  19. if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null;
  20. if (!isset($input['line_highlight'])) $input['line_highlight'] = null;
  21. $input['line_highlight'] = ($input['line_highlight'] == 1 ? 1 : 0);
  22. if (!isset($input['line_numbers'])) $input['line_numbers'] = null;
  23. $input['line_numbers'] = ($input['line_numbers'] == 1 ? 1 : 0);
  24. if (!isset($input['show_language'])) $input['show_language'] = null;
  25. $input['show_language'] = ($input['show_language'] == 1 ? 1 : 0);
  26. if (!isset($input['singular_only'])) $input['singular_only'] = null;
  27. $input['singular_only'] = ($input['singular_only'] == 1 ? 1 : 0);
  28. return $input;
  29. }
  30. function prismatic_validate_highlight($input) {
  31. $highlight_theme = prismatic_highlight_theme();
  32. if (!isset($input['highlight_theme'])) $input['highlight_theme'] = null;
  33. if (!array_key_exists($input['highlight_theme'], $highlight_theme)) $input['highlight_theme'] = null;
  34. $location = prismatic_location();
  35. if (!isset($input['filter_content'])) $input['filter_content'] = null;
  36. if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null;
  37. if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null;
  38. if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null;
  39. if (!isset($input['filter_comments'])) $input['filter_comments'] = null;
  40. if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null;
  41. if (isset($input['init_javascript'])) $input['init_javascript'] = $input['init_javascript'];
  42. if (!isset($input['singular_only'])) $input['singular_only'] = null;
  43. $input['singular_only'] = ($input['singular_only'] == 1 ? 1 : 0);
  44. return $input;
  45. }
  46. function prismatic_validate_plain($input) {
  47. $location = prismatic_location();
  48. if (!isset($input['filter_content'])) $input['filter_content'] = null;
  49. if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null;
  50. if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null;
  51. if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null;
  52. if (!isset($input['filter_comments'])) $input['filter_comments'] = null;
  53. if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null;
  54. return $input;
  55. }