public function optionCache() { ?> <ol class="r mtb options-item"> <li class="ss"><h4 class="title-"> <?php _e('Manage Cached files', WPI_META); ?> </h4> <div class="dn"> <ul class="mtb"> <li class="last"> <h4><?php _e('Stylesheet', WPI_META); ?> </h4> <?php $css = wpi_get_dir(WPI_CACHE_CSS_DIR); ?> <?php if (has_count($css) && !empty($css)) { ?> <dl> <?php $size = 0; $n = 1; foreach ($css as $tag) { $s = filesize(WPI_CACHE_CSS_DIR . $tag); $size += $s; $s = format_filesize($s); $s = _t('small', ' - ' . $s); $t = str_rem('.css', $tag); $a = _t('a', $tag, array('href' => wpi_get_stylesheets_url($t), 'target' => '_blank')); $c = _t('small', $n . '. '); t('dd', $c . $a . $s, array('style' => 'display:block;clear:both')); $n++; } ?> <small> Cache directory size : <?php echo format_filesize($size); ?> </small> </dl> <button class="sbtn" type="submit" name="wpi_flush_css" id="wpi_flush_css" value="1">Erase Cache</button> <?php } else { ?> <p>No cached files.</p> <?php } ?> </li> </ul> </div> </li> </ol> <?php }
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_get_random_avatar_uri() { $ava = wpi_get_dir(WPI_IMG_IMPORT_DIR . 'avatar' . DIRSEP); $ava = apply_filters(wpiFilter::RANDOM_COMMENT_AVA, $ava); if (has_count($ava)) { $index = rand(0, count($ava)); $path = 'import/avatar/'; $ava = isset($ava[$index]) ? $ava[$index] : $ava[0]; return wpi_img_url($path . $ava); } return false; }