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.

109 lines
3.8KB

  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. if (!isset($input['disable_block_styles'])) $input['disable_block_styles'] = null;
  8. $input['disable_block_styles'] = ($input['disable_block_styles'] == 1 ? 1 : 0);
  9. return $input;
  10. }
  11. function prismatic_validate_prism($input) {
  12. $prism_theme = prismatic_prism_theme();
  13. if (!isset($input['prism_theme'])) $input['prism_theme'] = null;
  14. if (!array_key_exists($input['prism_theme'], $prism_theme)) $input['prism_theme'] = null;
  15. $location = prismatic_location();
  16. if (!isset($input['filter_content'])) $input['filter_content'] = null;
  17. if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null;
  18. if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null;
  19. if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null;
  20. if (!isset($input['filter_comments'])) $input['filter_comments'] = null;
  21. if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null;
  22. if (!isset($input['line_highlight'])) $input['line_highlight'] = null;
  23. $input['line_highlight'] = ($input['line_highlight'] == 1 ? 1 : 0);
  24. if (!isset($input['line_numbers'])) $input['line_numbers'] = null;
  25. $input['line_numbers'] = ($input['line_numbers'] == 1 ? 1 : 0);
  26. if (!isset($input['show_language'])) $input['show_language'] = null;
  27. $input['show_language'] = ($input['show_language'] == 1 ? 1 : 0);
  28. if (!isset($input['copy_clipboard'])) $input['copy_clipboard'] = null;
  29. $input['copy_clipboard'] = ($input['copy_clipboard'] == 1 ? 1 : 0);
  30. if (!isset($input['command_line'])) $input['command_line'] = null;
  31. $input['command_line'] = ($input['command_line'] == 1 ? 1 : 0);
  32. if (!isset($input['singular_only'])) $input['singular_only'] = null;
  33. $input['singular_only'] = ($input['singular_only'] == 1 ? 1 : 0);
  34. return $input;
  35. }
  36. function prismatic_validate_highlight($input) {
  37. $highlight_theme = prismatic_highlight_theme();
  38. if (!isset($input['highlight_theme'])) $input['highlight_theme'] = null;
  39. if (!array_key_exists($input['highlight_theme'], $highlight_theme)) $input['highlight_theme'] = null;
  40. $location = prismatic_location();
  41. if (!isset($input['filter_content'])) $input['filter_content'] = null;
  42. if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null;
  43. if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null;
  44. if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null;
  45. if (!isset($input['filter_comments'])) $input['filter_comments'] = null;
  46. if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null;
  47. if (isset($input['init_javascript'])) $input['init_javascript'] = $input['init_javascript'];
  48. if (!isset($input['singular_only'])) $input['singular_only'] = null;
  49. $input['singular_only'] = ($input['singular_only'] == 1 ? 1 : 0);
  50. return $input;
  51. }
  52. function prismatic_validate_plain($input) {
  53. $location = prismatic_location();
  54. if (!isset($input['filter_content'])) $input['filter_content'] = null;
  55. if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null;
  56. if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null;
  57. if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null;
  58. if (!isset($input['filter_comments'])) $input['filter_comments'] = null;
  59. if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null;
  60. return $input;
  61. }