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