Beispiel #1
0
<?php

/**
 * $file : file full path 
 * $dir :  root directory 
 * $id : repository id 
 * $cache_file : cache file path 
 * $url_root : url based root path 
 * $relative_path : relative path of file 
 * 
 */
header('Content-Type: text/html');
if (!hasCache($file) || $is_new) {
    generateCache($file, HtmlPreprocessor(file_get_contents($file), 'markdown'));
}
outputCache($file);
) );

$script->startup();
$script->initialize();

if(!isset($options['cluster']) || empty($options['cluster']) || is_null($options['cluster'])) {
    echo "\nError : Cluster must be set, consult help for more informations\n";
    $script->shutdown();
    exit;
}

if(isset($options['cluster']) && !empty($options['cluster'])) {
    generateCache(array($options['cluster']), $options);
} else {
    $clusters = array_keys( SolrSafeOperatorHelper::clusterIni('DomainMappingSettings', 'ClusterDomains', 'merck.ini') );
    generateCache($clusters, $options);
}

$script->shutdown();

/**
 * @param $clusters
 * @param $options
 * @return void
 */
function generateCache($clusters, $options) {
    $cli = eZCLI::instance();

    foreach ( $clusters as $clusterPath )
    {
        $clusterIdentifier = basename( $clusterPath );
Beispiel #3
0
<?php

// SCSS Preprocessor
header('Content-Type: text/css');
if (!hasCache($file) || $is_new) {
    $scss = new scssc();
    $scss->setFormatter("scss_formatter");
    $scss->setImportPaths($dir);
    generateCache($file, $scss->compile(file_get_contents($file)));
}
outputCache($file);
Beispiel #4
0
    $expires = "Expires: " . gmdate("D, d M Y H:i:s", $cacheTime + CACHE_LIFE) . " GMT";
    header($expires);
    if (!$cacheTime or time() - $cacheTime >= CACHE_LIFE) {
        // Generate a cache
        generateCache($cacheFile);
        //require_once CACHED_FILE;
        include_once $cacheFile;
    } else {
        // It has not expired, so load it
        require_once "" . $cacheFile;
    }
} else {
    $expires = "Expires: " . gmdate("D, d M Y H:i:s", time() + CACHE_LIFE) . " GMT";
    header($expires);
    // It doesn't exist so create it & then include it
    generateCache($cacheFile);
    require_once $cacheFile;
}
/**
* Generate the cache file
*
*/
function generateCache($cacheFile = 'cache.css')
{
    $cssArray = array("layout.css", "common2.css", "htmlelements.css", "creativecommons.css", "forum.css", "calendar.css", "cms.css", "stepmenu.css", "switchmenu.css", "colorboxes.css", "manageblocks.css", "facebox.css", "modernbrickmenu.css", "jquerytags.css", "overlappingtabs.css", "login.css", "navigationmenu.css", "modulespecific.css", "cssdropdownmenu.css", "sexybuttons.css", "chisimbacanvas.css", "filemanager.css");
    //load up all of the CSS files into an array
    $cssFiles = glob("*.css");
    $counter = 1;
    foreach ($cssArray as $cssFile) {
        if (file_exists($cssFile)) {
            $css = file_get_contents($cssFile);
Beispiel #5
0
<?php

/**
 *  Implement QRCode generator 
 * 
 * 
 */
use Endroid\QrCode\QrCode;
header('Content-Type: image/png');
if (!hasCache($file)) {
    $obj = file_get_contents($file);
    $qrCode = new QrCode();
    $qrCode->setText($obj)->setSize(300)->setPadding(10)->setErrorCorrection('high')->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))->setLabelFontSize(10)->setImageType(QrCode::IMAGE_TYPE_PNG);
    ob_start();
    // output image
    $qrCode->render();
    $content = ob_get_contents();
    ob_end_clean();
    generateCache($file, $content);
}
outputCache($file);
Beispiel #6
0
/**
 * Overwrite this file and add the cache
 * @param array $content to put in cache
 */
function put_in_cache($content)
{
    $file = file_get_contents(__FILE__);
    $file_begin = substr($file, 0, strpos($file, '//' . ' end cache'));
    $file_end = substr($file, strpos($file, '//' . ' end cache'));
    $new_cache = generateCache($content);
    file_put_contents(__FILE__, $file_begin . $new_cache . $file_end);
}
Beispiel #7
0
<?php

// Less Preprocessor
header('Content-Type: text/css');
if (!hasCache($file) || $is_new) {
    $parser = new Less_Parser(array('compress' => false));
    $parser->parseFile($file, $url_root);
    generateCache($file, $parser->getCss());
}
outputCache($file);