<?php

$id = $_GET['id'];
$width = $_GET['w'];
$height = $_GET['h'];
$mime_type = get_post_mime_type($id);
$image_url = thb_image_get_size($id, array($width, $height));
$res = thb_read_url($image_url);
if (!empty($res)) {
    switch ($mime_type) {
        case 'image/jpeg':
            header('Content-Type: image/jpeg');
        case 'image/png':
            header('Content-Type: image/png');
        case 'image/gif':
            header('Content-Type: image/gif');
    }
    echo $res;
} else {
    header('Content-Type: image/jpeg');
    echo '';
}
 * The theme instance.
 */
$thb_theme = thb_theme();
/**
 * The styles.
 */
$styles = $thb_theme->getFrontend()->getCompressedStyles();
/**
 * Building the output.
 */
$output = '';
foreach ($styles as $style) {
    $output .= "/* ======================================================= */" . "\n";
    $output .= "/* " . basename($style['path']) . " - " . $style['media'] . "*/ \n";
    $output .= "/* ======================================================= */" . "\n";
    $output .= "\n\n";
    if (!empty($style['media']) && $style['media'] != 'all' && $style['media'] != 'screen') {
        $output .= '@media ' . $style['media'] . "{\n";
        $file_output = thb_read_url($style['path']) . "\n}";
        $output .= str_replace('url("', 'url("' . str_replace(basename($style['path']), '', $style['path']), $file_output);
        $output .= "\n\n\n";
    } else {
        $file_output = thb_read_url($style['path']) . "\n";
        $output .= str_replace('url("', 'url("' . str_replace(basename($style['path']), '', $style['path']), $file_output);
        $output .= "\n\n\n";
    }
}
/**
 * Printing the output.
 */
echo $output;
 function thb_render_image($id, $width, $height, $crop = true)
 {
     if (!function_exists('wp_get_image_editor')) {
         return;
     }
     $img = wp_get_attachment_image_src($id, 'full');
     if (is_array($img) && isset($img[0])) {
         $image = wp_get_image_editor($img[0]);
         if (!is_wp_error($image)) {
             $image->resize($width, $height, $crop);
             $image->stream();
         } else {
             $res = thb_read_url($img[0]);
             if (!empty($res)) {
                 if (thb_text_endsWith($img[0], ".png")) {
                     header('Content-Type: image/png');
                 } elseif (thb_text_endsWith($img[0], ".gif")) {
                     header('Content-Type: image/gif');
                 } else {
                     header('Content-Type: image/jpeg');
                 }
                 echo $res;
             } else {
                 header('Content-Type: image/jpeg');
                 echo '';
             }
         }
     }
 }
<?php

header('Content-type: text/javascript');
if (!isset($_GET['location']) || !(thb_text_startsWith($_GET['location'], 'header') || thb_text_startsWith($_GET['location'], 'footer'))) {
    die;
}
/**
 * The theme instance.
 */
$thb_theme = thb_theme();
/**
 * The loading location.
 */
$location = $_GET['location'];
/**
 * The scripts.
 */
$scripts = $thb_theme->getFrontend()->getCompressedScripts($location);
/**
 * Building the output.
 */
$output = '';
foreach ($scripts as $script) {
    $output .= thb_read_url($script) . "\n\n";
}
/**
 * Printing the output.
 */
echo $output;