summaryrefslogtreecommitdiff
path: root/ckeditor/editor.php
blob: 658000a093b208ea0ebfbd5fef616b31c46402d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

header("Content-Type: application/javascript");
$base = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/ckeditor/ckeditor-build.js");
$iconAmount = 87;

$icons = [];
$index = 0;

while (true) {
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/ckeditor/icons/delta/" . $index . ".svg")) {
        $icons[] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/ckeditor/icons/delta/" . $index . ".svg");
    } elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/ckeditor/icons/original/" . $index . ".svg")) {
        $icons[] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/ckeditor/icons/original/" . $index . ".svg");
    } else {
        $icons[] = "";
    }

    $iconAmount--; $index++;
    if ($iconAmount === 0) break;
}

foreach ($icons as $index => $icon) {
    $base = str_replace("$\${Delta.CKEditor.Icon[$index]}$$", $icon, $base);
}

die($base);