public static function buildFlagFile() { $flags = wpi_get_dir(WPI_IMG_DIR . 'flags' . DIRSEP); $template = '#%selector%{background-image:url(\'images/flags/%tag%\')}' . PHP_EOL; $contents = "#translate{padding-top:6px}#translate small{margin-left:-4px;padding-right:3px}#translate a{background-repeat:no-repeat;display:block;float:left;height:11px;margin-right:3px;overflow:hidden;padding:0 !important;position:relative;text-indent:-999em;width:16px}" . PHP_EOL; foreach ($flags as $tag) { list($selector, $extension) = explode('.', $tag); $contents .= strtr($template, array('%selector%' => $selector, '%tag%' => $tag)); } wpi_fwrite(WPI_CSS_DIR . 'translator-image.css', $contents); }
function wpi_write_cache($file, $content) { wpi_fwrite(WPI_CACHE_DIR . DIRSEP . $file, $content, 'wb', 5); }