Exemple #1
0
<?php

namespace infrajs\contacts;

use infrajs\router\Router;
use infrajs\ans\Ans;
use infrajs\config\Config;
use infrajs\cache\Cache;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../');
    //Согласно фактическому расположению файла
    require_once 'vendor/autoload.php';
    Router::init();
}
$conf = Config::get('contacts');
if ($conf['reCAPTCHA']) {
    $date = date('d.m.Y');
    $js = Cache::exec(array(), __FILE__, function ($date) {
        return file_get_contents('https://www.google.com/recaptcha/api.js?onload=grecaptchaOnload&render=explicit&hl=ru');
    }, array($date));
    $js .= 'window.grecaptchaOnload=function(){ Event.fire("reCAPTCHA") };';
} else {
    $js = '/* reCAPTCHA отключена */';
}
return Ans::js($js);
Exemple #2
0
<?php

use infrajs\nostore\Nostore;
use infrajs\ans\Ans;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../');
    require_once 'vendor/autoload.php';
}
Nostore::pubStat();
$text = file_get_contents('https://mc.yandex.ru/metrika/watch.js');
return Ans::js($text);
Exemple #3
0
    if (!Load::isphp()) {
        header('Infrajs-Cache: false');
    }
    if ($isjs) {
        $code = Collect::js($name);
    } else {
        $code = Collect::css($name);
    }
    if ($isjs) {
        $min = new Minify\JS($code);
    } else {
        $min = new Minify\CSS($code);
    }
    if ($isgzip) {
        $code = $min->gzip();
    } else {
        $code = $min->minify();
    }
    Mem::set($key, $code);
}
if (!Load::isphp()) {
    if ($isgzip) {
        header('Content-Encoding: gzip');
        header('Vary: accept-encoding');
        header('Content-Length: ' . strlen($code));
    }
}
if ($isjs) {
    return Ans::js($code);
}
return Ans::css($code);