| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | protected function getContentToPrint(): string |
||
| 38 | { |
||
| 39 | // Enable "/" in the filename |
||
| 40 | add_filter( |
||
| 41 | 'sanitize_file_name_chars', |
||
| 42 | [$this, 'enableSpecialCharsForSanitization'] |
||
| 43 | ); |
||
| 44 | $doc = \sanitize_file_name($_REQUEST[RequestParams::DOC]) . '.md'; |
||
| 45 | remove_filter( |
||
| 46 | 'sanitize_file_name_chars', |
||
| 47 | [$this, 'enableSpecialCharsForSanitization'] |
||
| 48 | ); |
||
| 49 | $markdownContentParser = MarkdownContentParserFacade::getInstance(); |
||
| 50 | try { |
||
| 51 | return $markdownContentParser->getContent($doc); |
||
| 52 | } catch (InvalidArgumentException $e) { |
||
| 53 | return sprintf( |
||
| 54 | '<p>%s</p>', |
||
| 55 | sprintf( |
||
| 56 | \__('Page \'%s\' does not exist', 'graphql-api'), |
||
| 57 | $doc |
||
| 58 | ) |
||
| 63 |