$row)
{
unset($images_global[$key]);
}
// CSS replacements
$not_compatible = array(
'{T_TEMPLATE_PATH}',
'{T_IMAGESET_PATH}',
'{T_IMAGESET_LANG_PATH}',
'{T_STYLESHEET_NAME}',
'{S_USER_LANG}'
);
$replace = array(
'{T_THEME_PATH}' => '.',
);
// Enable/disable one of lines below to enable/disable replacement of English buttons
// $replace = array_merge($replace, get_replacements($images_global));
$replace = array_merge($replace, get_replacements($images_global), get_replacements($images_en));
// BIDI code
$bidi_code = css($images_global, './images/', true);
// Get all CSS files, parse them
$files = list_files($theme_path, 'css');
if ($files === false || !count($files))
{
echo 'No CSS files found in theme directory.
';
}
else for ($i=0; $i';
continue;
}
}
if (basename($file) == 'bidi.css' && strpos($data, '/* Former imageset */') === false && strlen($bidi_code))
{
// Add bidi data
$data .= "\n/* Former imageset */\n" . $bidi_code;
$bidi_code = '';
echo 'Note: RTL imageset entries were added at the end of file below:
';
}
if (md5($data) == $hash)
{
echo 'Nothing to replace in ', $file, '
';
}
else
{
echo 'Updated ', $file, ':', dump_code($data, $files[$i]);
}
}
// Check if there are invalid images in imageset
$list = array_merge($images_global, $images_en);
foreach ($list as $key => $row)
{
if ($row['skip'])
{
echo 'Unable to generate code to add to CSS files because some images are missing or invalid. See errors above.';
echo ob_get_clean();
return;
}
}
// Code to add to CSS files
$code = '
/* Former imageset */
span.imageset {
display: inline-block;
background: transparent none 0 0 no-repeat;
margin: 0;
padding: 0;
width: 0;
height: 0;
overflow: hidden;
}
/* Global imageset items */
' . css($images_global, './images/') . '
/* English images for fallback */
' . css($images_en, './en/');
if (strlen($bidi_code))
{
$code .= "\n/* RTL imageset entries */\n" . $bidi_code;
}
echo 'Code to add to CSS file:', dump_code($code, 'imageset.css');
$list = list_languages($imageset_path);
for ($i=0; $i';
$skip = true;
}
else
{
$size = @getimagesize($filename);
if ($size === false)
{
echo 'Error: file ', $filename, ' is not a valid image
';
$skip = true;
}
else
{
if(!$width) $width = intval($size[0]);
if(!$height) $height = intval($size[1]);
}
}
}
$result[$key] = array(
'lang' => $lang,
'file' => $file,
'height' => $height,
'width' => $width,
'skip' => $skip
);
}
return $result;
}
function get_replacements($list)
{
$result = array();
foreach ($list as $key => $row)
{
$key = '{' . strtoupper($key);
$result[$key . '_SRC}'] = strlen($row['file']) ? ($row['lang'] ? './' . $row['lang'] : './images') . '/' . $row['file'] : '';
$result[$key . '_WIDTH}'] = intval($row['width']);
$result[$key . '_HEIGHT}'] = intval($row['height']);
}
return $result;
}
function list_files($dir, $ext)
{
$res = @opendir($dir);
if ($res === false)
{
return false;
}
$files = array();
while (($file = readdir($res)) !== false)
{
$list = explode('.', $file);
if(count($list) > 1 && strtolower($list[count($list) - 1]) == $ext)
{
$files[] = $file;
}
}
closedir($res);
return $files;
}
function list_languages($dir)
{
$res = @opendir($dir);
if ($res === false)
{
return array();
}
$files = array();
while (($file = readdir($res)) !== false)
{
if (substr($file, 0, 1) == '.')
{
continue;
}
$filename = $dir . '/' . $file;
if (is_dir($filename) && file_exists($filename . '/imageset.cfg'))
{
$files[] = $file;
}
}
closedir($res);
return $files;
}
function dump_code($code, $filename = 'file.txt')
{
$hash = md5($code);
if (isset($_GET['download']) && $_GET['download'] === $hash)
{
// Download file
ob_end_clean();
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="' . $filename . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($code));
echo $code;
exit;
}
$list = explode("\n", $code);
$height = 15 * count($list);
echo ' [ download expand ]
';
echo '
';
}
function css($list, $path = './', $bidi = false)
{
$code = '';
// Change value to true if you want images to be grouped up by size
$group = $bidi;
if ($group)
{
// group up images by size
$groups = array();
foreach ($list as $key => $row)
{
if (!strlen($row['file']))
{
continue;
}
$groups[$row['width'] . '*' . $row['height']][] = $key;
}
foreach ($groups as $size => $keys)
{
$extra = '';
for ($i=0; $i $row)
{
if (!strlen($row['file']))
{
continue;
}
$code .= ($bidi ? '.rtl ' : '') . '.imageset.' . substr($key, 4) . ' {';
if ($bidi)
{
$code .= '
padding-right: ' . $row['width'] . 'px;
padding-left: 0;
}
';
}
else
{
$code .= '
background-image: url("' . $path . $row['file'] . '");
padding-left: ' . $row['width'] . 'px;
padding-top: ' . $row['height'] . 'px;
}
';
}
}
}
return $code;
}
kAx[>!ւ_} ֪ɶ܆.+ݧ=m1 D2)}~ʌX+tY=pA5g\5y
4|kR%/M FPBa~
;(*m4 ͚C" ɀFF;3PT#|
ۀ]WlkĬ"(Q*{M:=ܤqGA3J$DNa0w1H`6m55Y6H9 5N"Oc3qFMD'2 k^#11B0IBlG5=Itx@+g<ŝ5M3:osPCUspFjc4mT#RDliW[Rz:v$Ҕsf2XiizaQU<⢥vt,?L%1V+\ctVXaq:Tu7qX%t`ptEJ
7V6ᶗeSGnL;Z0;rvsSwlRw.|ʳꕃv z摕ˎ
]p-5ÝXsDJeO^X7ߊ1u
6ci\cAmrBoB&x`H3VXqs8,GsDh<_/6OݎP(E
Qp ԩ[ڔ^Ϸ7e~}ֱOGc:[.r]Y̓ gsR7_릯3QnkQRX{&K
Oy|癢9J2ԣz@e$UpzM46HA,Yb6oHvh4kLKrnF.X=2Oc.|&̔K$PYP#)vw/1,'+@YfϡI
)J|8']I2D,!В,ͱH3^haqoKE}+7ٽ/UQ狀 g$hPed/ b1+F탼#⏐&AF2qHȟ0Q+EEG$Hdyp`HÛ*:
q3_Ar$2g2hm
.IX>1NYL{>bT_B
a3 B0 3L&2 y_RR}4XV?ܬ! P94-'p}>Sg}Ά$v^pm&]#Sh^v/ΌlK|{Y\^lA $?27E'Gb 1 ۈ<
nMQn؏U#!yqlEh*DyChUk9,+)9kdGK"Aj5na}0t/ͩgq8F?l+"@ $ 4M$mS;P9?|!ڴkmVvJe/}&Ph(@aYcOVvMaP( R`,_&}~Md#v`@J!OT+L(} `qG' 3# Trcc&lm<C3 %h)-R;9wT.?)=OMAvt:UY ,mxb۸qu:Tg@-n
X#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