Example #1
0
function pte_get_jpeg_quality($quality)
{
    $logger = PteLogger::singleton();
    $options = pte_get_options();
    $jpeg_compression = $options['pte_jpeg_compression'];
    if (isset($_GET['pte-jpeg-compression'])) {
        $tmp_jpeg = intval($_GET['pte-jpeg-compression']);
        if (0 <= $tmp_jpeg && $tmp_jpeg <= 100) {
            $jpeg_compression = $tmp_jpeg;
        }
    }
    $logger->debug("COMPRESSION: " . $jpeg_compression);
    return $jpeg_compression;
}
Example #2
0
function pte_rmdir($dir)
{
    $logger = PteLogger::singleton();
    if (!is_dir($dir) || !preg_match("/ptetmp/", $dir)) {
        $logger->warn("Tried to delete invalid directory: {$dir}");
        return;
    }
    foreach (scandir($dir) as $file) {
        if ("." == $file || ".." == $file) {
            continue;
        }
        $full_path_to_file = $dir . DIRECTORY_SEPARATOR . $file;
        $logger->debug("DELETING: {$full_path_to_file}");
        unlink($full_path_to_file);
    }
    rmdir($dir);
}
function pte_ajax()
{
    // Move all adjuntant functions to a separate file and include that here
    require_once PTE_PLUGINPATH . 'php/functions.php';
    $logger = PteLogger::singleton();
    $logger->debug("PARAMETERS: " . print_r($_REQUEST, true));
    switch ($_GET['pte-action']) {
        case "test":
            pte_test();
            break;
        case "launch":
            pte_launch();
            break;
        case "resize-images":
            pte_resize_images();
            break;
        case "confirm-images":
            pte_confirm_images();
            break;
        case "delete-images":
            pte_delete_images();
            break;
    }
    die;
}