Example #1
0
function updateSub($sub)
{
    global $lastPrint;
    if ($lastPrint != "sub") {
        echo "\nUpdated {$sub}";
    } else {
        echo ", {$sub}";
    }
    $lastPrint = "sub";
    $css = getStyle($sub);
    if (!$css) {
        touch("subs/{$sub}.min.css");
        return;
    }
    file_put_contents("cachedsubs/{$sub}.css", $css);
    $cT = new cssEmoteParser();
    $cT->parseString($css, $sub, true);
    $cT->finalize();
    $d = $cT->toString();
    if (!$d && file_exists("subs/{$sub}.min.css")) {
        unlink("subs/{$sub}.min.css");
        $lastPrint = "delete";
        echo "\nDeleted {$sub} - empty!";
        return;
    }
    file_put_contents("subs/{$sub}.min.css", $d);
    file_put_contents("subs/{$sub}.count", $cT->emoteCount);
}
Example #2
0
$subs = unique_order($subs);
if (count($subs) < 1) {
    //die();
    die('{"cssKey": "broken"}');
}
$nsfw = @$_GET['nsfw'] === '1';
$compact = implode(",", $subs) . ",nsfw=" . ($nsfw ? "1" : "0");
$key = md5($compact);
$d = @file_get_contents("cache/{$key}.name");
touch("keys/{$key}.key");
file_put_contents("keys/{$key}.key", $compact);
if ($d) {
    echo $d;
    die;
}
die('{"cssKey": "generating"}');
require "cssEmoteParser.php";
$cT = new cssEmoteParser();
if (!$nsfw) {
    $cT->nsfw = array_merge($cT->nsfw, array("horsecock", "dick", "j**z", "dashurbate"));
}
foreach ($subs as &$s) {
    $d = @file_get_contents("subs/{$s}.min.css");
    if (!$d) {
        file_put_contents("subs/{$s}.min.css", "/*Not yet retrieved from queue.*/");
    }
    $cT->parseString($d, $s, false, false);
}
$d = $cT->getEmoteNames($key);
echo $d;
file_put_contents("cache/{$key}.name", $d);
Example #3
0
            }
        }
        $str .= "}";
        return $str;
    }
}
if (@$argv[1] == "-ilcss") {
    $argv[1] = "-cssd";
    cssEmoteParser::$testStr = $argv[2];
}
if (@$argv[1] == "-cssf") {
    $argv[1] = "-cssd";
    cssEmoteParser::$testFile = $argv[2];
}
if (@$argv[1] == "-cssd") {
    $cT = new cssEmoteParser();
    try {
        if (cssEmoteParser::$testStr === null) {
            $cT->parseFile(cssEmoteParser::$testFile);
        } else {
            $cT->parseString(cssEmoteParser::$testStr);
        }
    } catch (cssParseException $e) {
        die($e->getMessage());
    }
    $cT->finalize();
    var_dump($cT->tokens);
    //die();
    echo @$cT->toString();
    unset($cT);
}
Example #4
0
        file_put_contents("{$k}.min.css", 'body::after{content:"Your GrEmB is out of date, or you have multiple versions installed. Please go to http://nallar.me/scripts/ and update it!"; width: 400px; display:block; height: 40px; background-color: white; position: fixed; left:20px; top: 100px; border: 1px solid #E1B000;}' . $cT->toString());
        file_put_contents("{$k}.names", implode("\n", $cT->getEmoteNames(false, true)));
        file_put_contents("unstable/{$k}.min.css", $cT->toString());
        file_put_contents("{$k}.count", $cT->emoteCount);
        if (isset($subss[$k . "_nsfw"])) {
            $nsfwMin[$k . "_nsfw"] = array();
            foreach ($cT->emotePriorities as $ek => $ignored) {
                $nsfwMin[$k . "_nsfw"][$ek] = 999;
            }
        }
    }
    echo "Done {$k} with {$cT->emoteCount} emotes.\n";
    sleep(60);
    continue;
    $cT = new cssEmoteParser();
    $cT->gremb = false;
    if (stripos($k, "_nsfw") === false) {
        $cT->nsfw = array_merge($cT->nsfw, array("horsecock", "dick", "j**z", "dashurbate"));
    } else {
        if (isset($nsfwMin[$k])) {
            $cT->emotePriorities = $nsfwMin[$k];
        }
    }
    foreach ($subs as $s) {
        $cT->parseString(@file_get_contents("cachedsubs/{$s}.css"), $s, true, in_array($s, $noCompress));
    }
    $cT->finalize();
    if ($cT->emoteCount > 0) {
        file_put_contents("{$k}.style.css", $cT->toString());
    }
}