| 1 |
<?php // Prismatic - Validate Settings |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) exit; |
| 4 |
|
| 5 |
function prismatic_validate_general($input) { |
| 6 |
|
| 7 |
$library = prismatic_library(); |
| 8 |
|
| 9 |
if (!isset($input['library'])) $input['library'] = null; |
| 10 |
if (!array_key_exists($input['library'], $library)) $input['library'] = null; |
| 11 |
|
| 12 |
return $input; |
| 13 |
|
| 14 |
} |
| 15 |
|
| 16 |
function prismatic_validate_prism($input) { |
| 17 |
|
| 18 |
|
| 19 |
$prism_theme = prismatic_prism_theme(); |
| 20 |
|
| 21 |
if (!isset($input['prism_theme'])) $input['prism_theme'] = null; |
| 22 |
if (!array_key_exists($input['prism_theme'], $prism_theme)) $input['prism_theme'] = null; |
| 23 |
|
| 24 |
|
| 25 |
$location = prismatic_location(); |
| 26 |
|
| 27 |
if (!isset($input['filter_content'])) $input['filter_content'] = null; |
| 28 |
if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null; |
| 29 |
|
| 30 |
if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null; |
| 31 |
if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null; |
| 32 |
|
| 33 |
if (!isset($input['filter_comments'])) $input['filter_comments'] = null; |
| 34 |
if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null; |
| 35 |
|
| 36 |
|
| 37 |
if (!isset($input['line_highlight'])) $input['line_highlight'] = null; |
| 38 |
$input['line_highlight'] = ($input['line_highlight'] == 1 ? 1 : 0); |
| 39 |
|
| 40 |
if (!isset($input['line_numbers'])) $input['line_numbers'] = null; |
| 41 |
$input['line_numbers'] = ($input['line_numbers'] == 1 ? 1 : 0); |
| 42 |
|
| 43 |
if (!isset($input['show_language'])) $input['show_language'] = null; |
| 44 |
$input['show_language'] = ($input['show_language'] == 1 ? 1 : 0); |
| 45 |
|
| 46 |
if (!isset($input['singular_only'])) $input['singular_only'] = null; |
| 47 |
$input['singular_only'] = ($input['singular_only'] == 1 ? 1 : 0); |
| 48 |
|
| 49 |
|
| 50 |
return $input; |
| 51 |
|
| 52 |
} |
| 53 |
|
| 54 |
function prismatic_validate_highlight($input) { |
| 55 |
|
| 56 |
$highlight_theme = prismatic_highlight_theme(); |
| 57 |
|
| 58 |
if (!isset($input['highlight_theme'])) $input['highlight_theme'] = null; |
| 59 |
if (!array_key_exists($input['highlight_theme'], $highlight_theme)) $input['highlight_theme'] = null; |
| 60 |
|
| 61 |
|
| 62 |
$location = prismatic_location(); |
| 63 |
|
| 64 |
if (!isset($input['filter_content'])) $input['filter_content'] = null; |
| 65 |
if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null; |
| 66 |
|
| 67 |
if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null; |
| 68 |
if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null; |
| 69 |
|
| 70 |
if (!isset($input['filter_comments'])) $input['filter_comments'] = null; |
| 71 |
if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null; |
| 72 |
|
| 73 |
|
| 74 |
if (isset($input['init_javascript'])) $input['init_javascript'] = $input['init_javascript']; |
| 75 |
|
| 76 |
if (!isset($input['singular_only'])) $input['singular_only'] = null; |
| 77 |
$input['singular_only'] = ($input['singular_only'] == 1 ? 1 : 0); |
| 78 |
|
| 79 |
|
| 80 |
return $input; |
| 81 |
|
| 82 |
} |
| 83 |
|
| 84 |
function prismatic_validate_plain($input) { |
| 85 |
|
| 86 |
$location = prismatic_location(); |
| 87 |
|
| 88 |
if (!isset($input['filter_content'])) $input['filter_content'] = null; |
| 89 |
if (!array_key_exists($input['filter_content'], $location)) $input['filter_content'] = null; |
| 90 |
|
| 91 |
if (!isset($input['filter_excerpts'])) $input['filter_excerpts'] = null; |
| 92 |
if (!array_key_exists($input['filter_excerpts'], $location)) $input['filter_excerpts'] = null; |
| 93 |
|
| 94 |
if (!isset($input['filter_comments'])) $input['filter_comments'] = null; |
| 95 |
if (!array_key_exists($input['filter_comments'], $location)) $input['filter_comments'] = null; |
| 96 |
|
| 97 |
return $input; |
| 98 |
|
| 99 |
} |
| 100 |
|