2 if (!(php_sapi_name() == 'cli' ||
(is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0))) {
3 header("HTTP/1.0 404 Not Found");
7 * Scrape all config options from the CKEditor documentation site.
9 $content = file_get_contents('http://docs.ckeditor.com/?print=/api/CKEDITOR.config');
10 $matches = $output = [];
11 preg_match_all("#name expandable'>([^<]+)</a>\s?:\s?(.*)<span.*'short'>([\s\S]*?)</div>#", $content, $matches);
12 foreach ($matches[1] as $i => $name) {
15 'type' => strip_tags($matches[2][$i]),
16 'description' => str_replace(["\n", '. ...'], [' ', '.'], $matches[3][$i]),
20 $location = str_replace('tools/bin/scripts', '', __DIR__
);
21 file_put_contents($location . '/js/wysiwyg/ck-options.json', json_encode($output, JSON_PRETTY_PRINT
));
23 print "\nTotal: " . count($output) . "\n";