public function run() { require_once 'modules/Administration/SugarSpriteBuilder.php'; $sb = new SugarSpriteBuilder(); $sb->cssMinify = true; $sb->fromSilentUpgrade = true; $sb->silentRun = true; // add common image directories $sb->addDirectory('default', 'include/images'); $sb->addDirectory('default', 'themes/default/images'); $sb->addDirectory('default', 'themes/default/images/SugarLogic'); // add all theme image directories foreach (array('themes', 'custom/themes') as $themedir) { if (!file_exists($themedir)) { continue; } foreach (new DirectoryIterator($themedir) as $fileInfo) { if ($fileInfo->isDot() || !$fileInfo->isDir()) { continue; } $dir = $fileInfo->getFilename(); if ($dir == 'default' || !is_dir("{$themedir}/{$dir}/images")) { continue; } $sb->addDirectory($dir, "{$themedir}/{$dir}/images"); } } // generate the sprite goodies // everything is saved into cache/sprites $sb->createSprites(); }
function rebuildSprites($fromUpgrade = true) { require_once 'modules/Administration/SugarSpriteBuilder.php'; $sb = new SugarSpriteBuilder(); $sb->cssMinify = true; $sb->fromSilentUpgrade = $fromUpgrade; $sb->silentRun = $fromUpgrade; // add common image directories $sb->addDirectory('default', 'include/images'); $sb->addDirectory('default', 'themes/default/images'); $sb->addDirectory('default', 'themes/default/images/SugarLogic'); // add all theme image directories if ($dh = opendir('themes')) { while (($dir = readdir($dh)) !== false) { if ($dir != "." && $dir != ".." && $dir != 'default' && is_dir('themes/' . $dir)) { $sb->addDirectory($dir, "themes/{$dir}/images"); } } closedir($dh); } // add all theme custom image directories $custom_themes_dir = "custom/themes"; if (is_dir($custom_themes_dir)) { if ($dh = opendir($custom_themes_dir)) { while (($dir = readdir($dh)) !== false) { //Since the custom theme directories don't require an images directory // we check for it implicitly if ($dir != "." && $dir != ".." && is_dir('custom/themes/' . $dir . "/images")) { $sb->addDirectory($dir, "custom/themes/{$dir}/images"); } } closedir($dh); } } // generate the sprite goodies // everything is saved into cache/sprites $sb->createSprites(); }