CodeEditor final class
Minn\Admin\CodeEditor · public/minn/src/Minn/Admin/CodeEditor.php · 96 lines
The code editor's settings as wp_get_code_editor_settings gives them (probe admin-doubts): CodeMirror's defaults and the three linters', the mode and its helpers from the content type (named, or worked out from the file's extension), then the caller's own settings merged over each part.
Constants and properties
| private | EXTENSIONS = array ( 'css' => 'text/css', 'scss' => 'text/x-scss', 'less' => 'text/x-less', 'sass' => 'text/x-sass', 'js' => 'text/javascript', 'mjs' => 'text/javascript', 'jsx' => 'text/jsx', 'json' => 'application/json', 'php' => 'application/x-httpd-php', 'phtml' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php', 'php4' => 'application/x-httpd-php', 'php5' => 'application/x-httpd-php', 'php7' => 'application/x-httpd-php', 'phps' => 'application/x-httpd-php', 'svg' => 'application/svg+xml', 'xml' => 'text/xml', 'md' => 'text/x-gfm', 'sh' => 'text/x-sh', 'bash' => 'text/x-sh', 'sql' => 'text/x-sql', 'html' => 'text/html', 'htm' => 'text/html', 'yml' => 'text/x-yaml', 'yaml' => 'text/x-yaml', 'diff' => 'text/x-diff', 'patch' => 'text/x-diff', 'conf' => 'text/nginx', ) | A file extension => the content type it is edited as. |
Public
| static | settings(array $args, string $espreeUrl, Closure $mimeOf): array# | The settings for one editor: $args' type, else its file's (the extension, else $mimeOf the file, else text/plain); the caller's codemirror, csslint, jshint and htmlhint settings merged over the defaults.
@return array<string, array<string, mixed>> |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | mode(array $codemirror, string $type): array# | CodeMirror's settings with the mode for a content type and the helpers that mode takes.
@return array<string, mixed> | |||
| private | defaults(string $espreeUrl): array# | The defaults: CodeMirror's, then CSSLint's, JSHint's (with the module parser's address) and HTMLHint's rules. @return array<string, array<string, mixed>> |
Nothing matches.