Commit | Line | Data |
---|---|---|
3b7ceeb2 CW |
1 | <?php |
2 | /** | |
3 | * Scrape all config options from the CKEditor documentation site. | |
4 | */ | |
5 | $content = file_get_contents('http://docs.ckeditor.com/?print=/api/CKEDITOR.config'); | |
b7c0a88f | 6 | $matches = $output = []; |
3b7ceeb2 CW |
7 | preg_match_all("#name expandable'>([^<]+)</a>\s?:\s?(.*)<span.*'short'>([\s\S]*?)</div>#", $content, $matches); |
8 | foreach ($matches[1] as $i => $name) { | |
b7c0a88f | 9 | $output[] = [ |
3b7ceeb2 CW |
10 | 'id' => $name, |
11 | 'type' => strip_tags($matches[2][$i]), | |
b7c0a88f | 12 | 'description' => str_replace(["\n", '. ...'], [' ', '.'], $matches[3][$i]), |
13 | ]; | |
3b7ceeb2 CW |
14 | } |
15 | if ($output) { | |
16 | $location = str_replace('tools/bin/scripts', '', __DIR__); | |
17 | file_put_contents($location . '/js/wysiwyg/ck-options.json', json_encode($output, JSON_PRETTY_PRINT)); | |
18 | } | |
19 | print "\nTotal: " . count($output) . "\n"; |