/**
  * Gets called when resources are requested like JS or CSS files. This event enables a plugin to add resources dynamically.
  *
  * @param ManagerEngine $man ManagerEngine reference that the plugin is assigned to.
  * @param string $theme Resource type CSS or JS.
  * @param string $package Resource type CSS or JS.
  * @param string $type Resource type CSS or JS.
  * @param string $content_type Resource type CSS or JS.
  * @param Moxiecode_ClientResources $resources Resources class that is used to handle client resources.
  * @return bool true/false if the execution of the event chain should continue.
  */
 function onRequestResources(&$man, $theme, $package, $type, $content_type, &$resources)
 {
     global $moozCMS;
     if ($type == "fm" || $type == "im") {
         $resources->load('../plugins/MoozCMSIntegration/' . $type . '_' . $moozCMS->getSetting('general.theme') . '_resources.xml');
     }
 }
require_once "../classes/Utils/JSON.php";
require_once "../classes/Utils/Error.php";
@set_time_limit(5 * 60);
// 5 minutes execution time
$MCErrorHandler = new Moxiecode_Error(false);
set_error_handler("StreamErrorHandler");
require_once "../includes/general.php";
require_once "../classes/ManagerEngine.php";
$cmd = getRequestParam("cmd", "");
$theme = getRequestParam("theme", "", true);
$package = getRequestParam("package", "", true);
$type = getRequestParam("type", "", true);
$file = getRequestParam("file", "", true);
if ($package) {
    require_once '../classes/Utils/ClientResources.php';
    $resources = new Moxiecode_ClientResources();
    $resources->load('../pages/' . $theme . '/resources.xml');
    if ($type) {
        $man = new Moxiecode_ManagerEngine($type);
        require_once MCMANAGER_ABSPATH . "CorePlugin.php";
        require_once "../config.php";
        $man->dispatchEvent("onPreInit", array($type));
        $mcConfig = $man->getConfig();
        // Load plugin resources
        $plugins = explode(',', $mcConfig["general.plugins"]);
        foreach ($plugins as $plugin) {
            $resources->load('../plugins/' . $plugin . '/resources.xml');
        }
    }
    $file = $resources->getFile($package, $file);
    header('Content-type: ' . $file->getContentType());
Esempio n. 3
0
require_once '../classes/Utils/ClientResources.php';
require_once '../classes/Utils/CSSCompressor.php';
require_once "../classes/ManagerEngine.php";
// Set the error reporting to minimal
@error_reporting(E_ERROR | E_WARNING | E_PARSE);
$theme = getRequestParam("theme", "", true);
$package = getRequestParam("package", "", true);
$type = getRequestParam("type", "", true);
// Include Base and Core and Config.
$man = new Moxiecode_ManagerEngine($type);
require_once $basepath . "CorePlugin.php";
require_once "../config.php";
$man->dispatchEvent("onPreInit", array($type));
$config = $man->getConfig();
$compressor = new Moxiecode_CSSCompressor(array('expires_offset' => 3600 * 24 * 10, 'disk_cache' => true, 'cache_dir' => '_cache', 'gzip_compress' => true, 'remove_whitespace' => false, 'charset' => 'UTF-8', 'name' => $theme . "_" . $package, 'convert_urls' => true));
$resources = new Moxiecode_ClientResources();
// Load theme resources
$resources->load('../pages/' . $theme . '/resources.xml');
// Load plugin resources
$plugins = explode(',', $config["general.plugins"]);
foreach ($plugins as $plugin) {
    $resources->load('../plugins/' . $plugin . '/resources.xml');
}
$files = $resources->getFiles($package);
if ($resources->isDebugEnabled() || checkBool($config["general.debug"])) {
    header('Content-type: text/css');
    $pagePath = dirname($_SERVER['SCRIPT_NAME']);
    echo "/* Debug enabled, css files will be loaded without compression */\n";
    foreach ($files as $file) {
        echo '@import url("' . $pagePath . '/' . $file->getPath() . '");' . "\n";
    }