Exemple #1
0
function est_shortcode($atts)
{
    // Attributes
    extract(shortcode_atts(array('id' => ''), $atts));
    require_once plugin_dir_path(__FILE__) . '/twig/init.php';
    $site = new OurTwigProxy();
    $loader = new Twig_Loader_Filesystem(dirname(__FILE__) . '/templates');
    $twig = new Twig_Environment($loader, array('cache' => false));
    global $wp_query;
    if ($id != "") {
        echo file_handler($id);
        $template = get_field('twig_template', $id, false);
        $twig = new \Twig_Environment(new \Twig_Loader_String(), array('debug' => true));
        $twig->addExtension(new Twig_Extension_Debug());
        return $rendered = $twig->render($template, array('site' => $site));
    }
}
Exemple #2
0
<?php

define('API_RUN', true);
require 'engine.php';
if (!isset($_SERVER['HTTP_REFERER']) && !isset($_GET['apikey'])) {
    header('HTTP/1.1 403 Forbidden');
    exit('API cannot be direct accessed!');
}
if (isset($_GET['gettoken']) && $_GET['gettoken'] == 'file') {
    $result = get_token('file');
} else {
    if (isset($_GET['gettoken']) && $_GET['gettoken'] == 'url') {
        $result = get_token('url');
    } else {
        if (isset($_GET['type']) && $_GET['type'] == 'url') {
            $result = url_handler();
        } else {
            if (isset($_GET['type']) && $_GET['type'] == 'file') {
                $result = array_pop(file_handler());
            } else {
                header('HTTP/1.1 400 Bad Request');
                exit('You must set "type" in the query string.');
            }
        }
    }
}
header('Content-Type: application/json');
echo json_encode($result);
Exemple #3
0
<?php

define('INDEX_RUN', true);
/* Load Functions */
require 'engine.php';
if (isset($_GET['err']) && $_GET['err'] != '') {
    /* 404 and 403 picture */
    switch ($_GET['err']) {
        case '404':
            header('Content-Type: image/jpeg', true, 404);
            echo file_get_contents('site-img/404.jpg');
            break;
        case '403':
            header('Content-Type: image/jpeg', true, 403);
            echo file_get_contents('site-img/403.jpg');
            break;
    }
} else {
    if (isset($_POST['normal']) && $_POST['normal'] == 'upload') {
        $results = file_handler();
    } else {
        $results = null;
    }
    load_theme($results);
}
Exemple #4
0
<?php

define('API_RUN', true);
require 'engine.php';
if (!isset($_SERVER['HTTP_REFERER']) && !isset($_GET['apikey'])) {
    header('HTTP/1.1 403 Forbidden');
    exit('API cannot be direct accessed!');
}
if (isset($_GET['type']) && $_GET['type'] == 'url') {
    $result = url_handler();
} else {
    if (isset($_GET['type']) && $_GET['type'] == 'file') {
        list($result) = file_handler();
    } else {
        header('HTTP/1.1 400 Bad Request');
        exit('You must set "type" in the query string.');
    }
}
header('Content-Type: application/json');
echo json_encode($result);