tplPath = ANYFONT_ROOT."/tpl";
if(is_array($config) && isset($config['page'])){
$this->page = $config['page'];
$this->page_title = $config['title'];
$this->get_page();
}
}
function printPage(){
print($this->page_html);
}
function get_page(){
$url = get_option('siteurl');
$this->helptext = array(
"default" => __("Help for this setting is not yet available.", 'anyfont'),
"settings_menu_text" => __("Enables replacement of the text in your page menus with the styles chosen below.", 'anyfont'),
"image-padding" => __("Enable this setting if the text in your generated images is cut off.", 'anyfont'),
"image-padding-top" => __("Amount of empty space at the top of the generated image.", 'anyfont'),
"image-padding-bottom" => __("Amount of empty space at the bottom of the generated image.", 'anyfont'),
"image-padding-right" => __("Amount of empty space on the right of the generated image.", 'anyfont'),
"image-padding-left" => __("Amount of empty space on the left of the generated image.", 'anyfont'),
"anyfont-use-htaccess" => __("Unless you are using an alternative mod_rewrite method you should NEVER disable this setting.", 'anyfont'),
"anyfont-enable-custom-fontdir" => __("Enabling this setting will allow you to set the folder for uploaded font files. Note: Changing this setting will automatically move any fonts you have already uploaded to the new folder.", 'anyfont'),
"anyfont-enable-custom-cache" => __("Enabling this setting will allow you to set the folder which is used to store generated images. Note: Changing this setting will automatically move any images already cached to the new folder.", 'anyfont'),
"anyfont_enable_tinymce" => __("When this setting is enabled, a button will be added to the editor for posts/pages which allows you to apply AnyFont styles to text in your post.", 'anyfont'),
"anyfont_enable_gzip" => __("Enable this setting if you would like to compress AnyFont generated images using gzip before they sent to the browser. Note: In some cases this may actually increase the size of the image as all generated images are already optimized. Use at your own discretion.", 'anyfont'),
"anyfont_disable_hotlinking" => __("This will prevent any unauthorized websites from using your generated images on their own pages. Disabling this setting is not recommended.", 'anyfont'),
"anyfont_cache_show_bytes" => __("When enabled, Disk usage will be shown in bytes. This was the default behaviour prior to version 1.0 so this setting is here just in case someone actually liked it that way! ;)", 'anyfont'),
"anyfont_cache_dashboard_widget" => __("Enabling this will add an admin widget to your dashboard showing disk usage information for AnyFont", 'anyfont'),
"anyfont-limit-cache-size" => __("If you want to make sure AnyFont doesn't use more disk space than what you're allowed, enabling this setting will allow you to set a size limit. If enabled, the cache will be checked once every day and cleaned only if it is found to be larger than the set limit", 'anyfont'),
"anyfont-cache-size-limit" => __("Enter the maximum amount of disk space AnyFont is allowed to use in MB", 'anyfont'),
"post-titles" => __("When this setting is enabled, the primary text heading of your blog posts will automatically be replaced with a dynamically generated image which is 100% SEO friendly. Dont forget to select a style from the dropdown list after enabling this setting.", 'anyfont'),
"page-titles" => __("When this setting is enabled, the primary text heading of your blog pages will automatically be replaced with a dynamically generated image which is 100% SEO friendly. Dont forget to select a style from the dropdown list after enabling this setting.", 'anyfont'),
"tag-titles" => __("When this setting is enabled, the tag name, which is normally displayed at the top of the page when browsing a specific tag, will automatically be replaced with a dynamically generated image which is 100% SEO friendly. Dont forget to select a styles from the dropdown list after enabling this setting.", 'anyfont'),
"cat-titles" => __("When this setting is enabled, the category name, which is normally displayed at the top of the page when browsing a specific category, will automatically be replaced with a dynamically generated image which is 100% SEO friendly. Dont forget to select a styles from the dropdown list after enabling this setting.", 'anyfont'),
"widget-titles" => __("When this setting is enabled, widget titles will automatically be replaced with a dynamically generated image. NOTE: Widget title images are NOT SEO friendly. Dont forget to select a styles from the dropdown list after enabling this setting.", 'anyfont'),
"blog-title" => __("When enabled, AnyFont will attempt to style your Blogs Name in the site header using the chosen style. Note: Results may vary depending on the theme.", 'anyfont'),
"blog-desc" => __("When enabled, AnyFont will attempt to style your Blogs Description in the site header using the chosen style. Note: Results may vary depending on the theme.", 'anyfont'),
"menus" => __("Enabling this setting will allow you to set styles for menus generated with the wp_list_pages or wp_page_menu WordPress functions and the new menu builder available in WordPress 3(Requires the 'Title Attribute' to be set for each entry on the WordPress menus admin page). Note: Results may vary depending on the theme.", 'anyfont'),
"name" => __("The name of the style. Acceptable characters to use include letters, numbers, spaces, underscores and dashes.", 'anyfont'),
"color" => __("The main color of the font face, Select a color by clicking the color square and choosing a preset or type in your own color code in hex format", 'anyfont'),
"font-name" => __("Select an uploaded font from the list, if you have not yet uploaded any fonts, you should do so before attempting to create a style.", 'anyfont'),
"font-size" => __("Select a size from the dropdown or type in a custom size.", 'anyfont'),
"limit-width" => __("Enabling this setting will allow you to set a character limit for the width of the image, after which the text will then continue on a new line.", 'anyfont'),
"max-width" => __("Set the pixel width for the generated images", 'anyfont'),
"text-align" => __("Align the text to display either centered or left aligned(default) in the generated image.", 'anyfont'),
"line-height" => __("Adjust the height for each line of text on multi-line images. NOTE: When set to '0px', this setting will be ignored and the default line height will be used", 'anyfont'),
"shadow" => __("Enabling this setting will allow you to add shadow effects to the text", 'anyfont'),
"shadow-color" => __("Set the color for the text shadow by clicking the color square and choosing a preset or type in your own color code in hex format", 'anyfont'),
"shadow-distance" => __("This controls how far the shadow is from the text. The higher the value, the further down and to the right the shadow will appear.", 'anyfont'),
"shadow-spread" => __("Control the amount of blur/stretch that is applied to the shadow.", 'anyfont'),
"soften-shadow" => __("Enabling this setting will blur the shadow slightly and smoothly merge it into the background.", 'anyfont'),
"background-color" => __("This must be set to the background color that the image will be placed on when used on your site. ie: If your site has a white background, this color should then be set to white.", 'anyfont')
);
$jslang_array = array(
"del_style_note" => __("Please note that once a style is deleted, any generated images that are assosiated with the style will no longer load.", 'anyfont'),
"chk_del_style" => __("Are you sure you want to delete this style?", 'anyfont'),
"chk_del_styles" => __("Are you sure you want to delete the selected styles?", 'anyfont'),
"chk_del_fonts" => __("Are you sure you want to delete the selected font(s)?", 'anyfont'),
"del_font_note" => __("Please note that once a font is deleted, any styles which are using the font will break.", 'anyfont'),
"msg_del_fonts" => __("Deleting Selected Fonts...", 'anyfont'),
"msg_del_styles" => __("Deleting Selected Styles...", 'anyfont'),
"msg_del" => __("Deleting", 'anyfont'),
"err_select_font" => __("No Fonts Selected!", 'anyfont'),
"err_select_style" => __("No Styles Selected!", 'anyfont'),
"chk_clear_cache" => __("Are you sure you want to clear the cache?\nNote: this action will not delete any uploaded font files.", 'anyfont'),
"msg_clear_cache" => __("Clearing the cache...", 'anyfont'),
"msg_no_images" => __("no images", 'anyfont'),
"msg_upload_success" => __("was uploaded successfully", 'anyfont'),
"err_upload_failed" => __("Upload Failed:", 'anyfont'),
"err_saving_style" => __("Save Failed! Please ensure that the font folder and all files inside are writable by the webserver.", 'anyfont'),
"msg_saved_style" => __("Style has been saved.", 'anyfont'),
"msg_saving_style" => __("Saving Style...", 'anyfont'),
"msg_preview_style" => __("Loading Preview...", 'anyfont'),
"msg_upload_start" => __("Uploading Font...", 'anyfont'),
"msg_saving_settings" => __("Saving Settings...", 'anyfont')
);
if (function_exists('json_encode')) {
$jslang = json_encode($jslang_array);
} else {
require_once(ANYFONT_ROOT.'/lib/class.json.php');
$JSON = new serviceJSON();
$jslang = $JSON->encode($jslang_array);
}
$this->tpl = new fastTPL($this->tplPath);
$this->tpl->define(array($this->page => "{$this->page}.html",
"header" => "header.html",
"footer" => "footer.html",
));
$this->tpl->assign("STYLE", file_get_contents(ANYFONT_ROOT."/styles.css"));
$this->tpl->assign("URL", $url."/");
$this->tpl->assign("JSLANG", $jslang);
$this->tpl->assign("ICON_CLASS", $this->page);
$this->tpl->assign("SETTINGS_PAGE_TITLE", __("AnyFont Settings", 'anyfont'));
$this->tpl->assign("FONTS_PAGE_TITLE", __("Install Fonts", 'anyfont'));
$this->tpl->assign("STYLES_PAGE_TITLE", __("Create Styles", 'anyfont'));
$this->checkAnyFontHealth();
switch($this->page){
case 'settings':
$this->tpl->assign("SETTINGS_ACTIVE_NAV", " nav-tab-active");
$this->getSettings();
break;
case 'fonts':
$this->tpl->assign("FONTS_ACTIVE_NAV", " nav-tab-active");
$this->readFontDir() ? $this->getFonts() : 0;
break;
case 'styles':
$this->tpl->assign("STYLES_ACTIVE_NAV", " nav-tab-active");
($this->readFontDir() && $this->readStyles()) ? $this->getStyles() : 0;
break;
}
$this->tpl->assign("HEADER", $this->tpl->fetchParsed("header"));
$this->tpl->assign("VERSION", ANYFONT_VERSION);
$this->tpl->assign("FOOTER_TXT", __("If you require commercial support for this plugin, custom features added or if you just looking for the services of a freelance WordPress developer, contact me here.", 'anyfont'));
$this->tpl->assign("FOOTER", $this->tpl->fetchParsed("footer"));
$this->page_html = $this->tpl->fetchParsed($this->page);
}
function getSettings(){
$tpl = new fastTPL($this->tplPath);
$tpl->define(array("autoreplace" => "inserts.html",
"cache" => "cache.html",
"css" => "css.html",
"advanced" => "advanced.html"
));
$opt = array("auto(Default)" => "auto", "gd" => "php4", "imagick" => "php5", "cairo" => "php5_cairo");
$imageopt = "";
foreach($opt as $mod => $val){
$selected = ($val == get_option('anyfont_image_module')) ? "selected=\"selected\"" : "";
if($val == "auto"){
$imageopt .= "";
}else if(extension_loaded($mod)){
$imageopt .= "";
}
}
$this->isReplaceEnabled($tpl, 'anyfont_page_title', "PAGE");
$this->isReplaceEnabled($tpl, 'anyfont_post_title', "POST");
$this->isReplaceEnabled($tpl, 'anyfont_cat_title', "CAT");
$this->isReplaceEnabled($tpl, 'anyfont_tag_title', "TAG");
$this->isReplaceEnabled($tpl, 'anyfont_widget_title', "WIDGET");
$this->isReplaceEnabled($tpl, 'anyfont_blog_title', "BLOG_TITLE");
$this->isReplaceEnabled($tpl, 'anyfont_blog_desc', "BLOG_DESC");
$this->isReplaceEnabled($tpl, 'anyfont_menu', "MENU");
$this->isReplaceEnabled($tpl, 'anyfont_disable_hotlinking', "DISABLE_HOTLINKING");
$this->isReplaceEnabled($tpl, 'anyfont-limit-cache-size', 'CACHE_LIMIT');
$this->isReplaceEnabled($tpl, 'anyfont_cache_show_bytes', 'CACHE_SHOW_BYTES');
$this->isReplaceEnabled($tpl, 'anyfont_cache_dashboard_widget', 'CACHE_DASHBOARD');
$this->isReplaceEnabled($tpl, 'anyfont_enable_gzip', 'ENABLE_GZIP');
$this->isReplaceEnabled($tpl, 'anyfont_enable_tinymce', 'ENABLE_TINYMCE');
$this->isReplaceEnabled($tpl, 'anyfont-enable-custom-fontdir', 'ENABLE_CUSTOM_FONTDIR');
$this->isReplaceEnabled($tpl, 'anyfont-enable-custom-cache', 'ENABLE_CUSTOM_CACHEDIR');
$this->isReplaceEnabled($tpl, 'anyfont-use-htaccess', 'ENABLE_HTACCESS');
$tpl->assign("REPLACE_H2", __("AutoReplace Titles", 'anyfont'));
$tpl->assign("HELP_MSG", __("To replace certain plain text titles with images in your wordpress blog, enable the appropriate section below and then assign it one of your styles.", 'anyfont'));
$tpl->assign("SEO_NOTE", __("The post title, page title, blog name and blog description image replacements are SEO compatible.", 'anyfont'));
$tpl->assign("DISCLAIMER", __("PLEASE NOTE: The above options may not be compatible with ALL themes and/or custom widgets.", 'anyfont'));
$tpl->assign("DISCLAIMER_CONT", __("If you encounter any problems:
Please check the FAQ for known issues with certain themes.
Check with the theme developer
See message below to contact me for support.
", 'anyfont'));
if($this->readStyles()){
$tpl->assign("POST_TITLE_STYLES", $this->titleStyleConfig( get_option('anyfont_post_title_style')));
$tpl->assign("PAGE_TITLE_STYLES", $this->titleStyleConfig(get_option('anyfont_page_title_style')));
$tpl->assign("TAG_TITLE_STYLES", $this->titleStyleConfig(get_option('anyfont_tag_title_style')));
$tpl->assign("CAT_TITLE_STYLES", $this->titleStyleConfig(get_option('anyfont_cat_title_style')));
$tpl->assign("WIDGET_TITLE_STYLES", $this->titleStyleConfig(get_option('anyfont_widget_title_style')));
$tpl->assign("BLOG_TITLE_STYLES", $this->titleStyleConfig(get_option('anyfont_blog_title_style')));
$tpl->assign("BLOG_DESC_STYLES", $this->titleStyleConfig(get_option('anyfont_blog_desc_style')));
$tpl->assign("MENU_STYLES", $this->titleStyleConfig(get_option('anyfont_menu_style')));
$tpl->assign("HOVER_STYLES", $this->titleStyleConfig(get_option('anyfont_menu_hover')));
$tpl->assign("ACTIVE_STYLES", $this->titleStyleConfig(get_option('anyfont_menu_active')));
}
$tpl->assign("POST_HELP", $this->helptext['post-titles']);
$tpl->assign("PAGE_HELP", $this->helptext['page-titles']);
$tpl->assign("TAG_HELP", $this->helptext["tag-titles"]);
$tpl->assign("CAT_HELP", $this->helptext['cat-titles']);
$tpl->assign("WIDGET_HELP", $this->helptext['widget-titles']);
$tpl->assign("BLOG_TITLE_HELP", $this->helptext['blog-title']);
$tpl->assign("BLOG_DESC_HELP", $this->helptext['blog-desc']);
$tpl->assign("MENU_HELP", $this->helptext['menus']);
$tpl->assign("STYLE_URL", WP_ADMIN_URL."/admin.php?page=anyfont-styles");
$tpl->assign("ANYFONT_CACHE_DIR", ANYFONT_CACHE);
$tpl->assign("ANYFONT_FONTDIR", ANYFONT_FONTDIR);
$tpl->assign("CACHE_SETTINGS_H2", __("Disk Cache Options", 'anyfont'));
$tpl->assign("ADVANCED_H2", __("Advanced Settings", 'anyfont'));
$tpl->assign("ADVANCED_MSG", __("It is recommended that the following options are left on their default settings.", 'anyfont'));
$tpl->assign("IMAGE_MODULE_OPTIONS", $imageopt);
$tpl->assign("CACHE_MAX_SIZE", get_option('anyfont-cache-size-limit'));
$tpl->assign("CACHE_MAX_SIZE_HELP", $this->helptext['anyfont-cache-size-limit']);
$tpl->assign("DISK_CACHE_BLOCK", $this->getDiskCache(true));
$this->tpl->assign("AUTOTEXT_BLOCK", $tpl->fetchParsed("autoreplace"));
$this->tpl->assign("CACHE_BLOCK", $tpl->fetchParsed("cache"));
$this->tpl->assign("ADVTEXT_BLOCK", $tpl->fetchParsed("css"));
$this->tpl->assign("ADVOPT_BLOCK", $tpl->fetchParsed("advanced"));
}
function getDiskCache($button=false){
$tpl = new fastTPL($this->tplPath);
$tpl->define(array("disk_cache" => "disk_cache.html"));
$totalsize = 0;
$imagecount = 0;
$admincount = 0;
$adminsize = 0;
if($this->cachedir){
$dir = opendir(ANYFONT_CACHE);
while ($filename = readdir($dir)) {
$fileinfo = explode(".", $filename);
if ($fileinfo[1] == "png") {
$split = explode("-", $fileinfo[0]);
if($split[1] == "admin"){
$admincount++;
$adminsize += filesize(ANYFONT_CACHE."/".$filename);
}else{
$imagecount++;
$totalsize += filesize(ANYFONT_CACHE."/".$filename);
}
}
}
}
$fontcount = 0;
$fontsize = 0;
if($this->fontdir){
$dir = opendir(ANYFONT_FONTDIR);
while ($filename = readdir($dir)) {
$fileinfo = explode(".", $filename);
if ($fileinfo[1] == "ttf" || $fileinfo[1] == "otf") {
$fontcount++;
$fontsize += filesize(ANYFONT_FONTDIR."/".$filename);
}
}
}
$imagecount == 0 ? $imagecount = "no" : 0;
$admincount == 0 ? $admincount = "no" : 0;
$total = $totalsize+$adminsize;
$tpl->assign("CACHE_DISK_H2", __("Disk Usage", 'anyfont'));
// $tpl->assign("SITE_IMAGES_HELP", __("All images which are generated for your sites public pages and posts"));
// $tpl->assign("ADMIN_IMAGES_HELP", __("All images generated while using the AnyFont Style Manager or Font Manager"));
$tpl->assign("IMAGE_COUNT", $imagecount);
$tpl->assign("TOTAL_SIZE", $this->bytecalc($totalsize));
$tpl->assign("IMAGE_COUNT_ADMIN", $admincount);
$tpl->assign("FONT_COUNT", $fontcount);
$tpl->assign("FONT_SIZE", $this->bytecalc($fontsize));
$tpl->assign("TOTAL_SIZE_ALL", $this->bytecalc($total));
$tpl->assign("TOTAL_SIZE_ADMIN", $this->bytecalc($adminsize));
$tpl->assign("CACHE_LIMIT", get_option('anyfont-limit-cache-size') == "on" ? $this->bytecalc(1048576*(int)get_option('anyfont-cache-size-limit')) : "unlimited");
get_option('anyfont-limit-cache-size') == "on" ? $tpl->assign("CACHE_PERCENTAGE", "(".round((($total)*100)/(1048576*(int)get_option('anyfont-cache-size-limit')))."% full)") : 0;
!$button ? 0 : $tpl->assign("CLEAR_CACHE_BUTTON", "");
return $tpl->fetchParsed("disk_cache");
}
function isReplaceEnabled($tpl, $section, $assign){
$tpl->assign("{$assign}_HELP", $this->helptext[$section]);
if(get_option($section)){
$tpl->assign("{$assign}_CHECKED", "checked=\"checked\"");
$tpl->assign("{$assign}_ON_CLASS", " anyfont_checkbox_on");
} else {
$tpl->assign("{$assign}_DISABLED", "disabled=\"disabled\"");
}
}
function titleStyleConfig($section){
$styleoptions = '';
if(is_array($this->styles)){
foreach($this->styles as $style => $option){
if($style!=="Preview"){
$selected = $style == $section ? "selected=\"selected\"" : '';
$styleoptions .= "";
}
}
}
return $styleoptions;
}
function checkAnyFontHealth($showerror=true){
if(anyfont_check_apache_module("mod_rewrite") === false){
$showerror ? $this->showError("The Apache Module \"mod_rewrite\" could not be found. AnyFont requires this module to operate correctly. Please ask your webhost to enable mod_rewrite and ensure that \"AllowOverride FileInfo\" is set for your domain.") : 0;
return false;
}
if(!anyfont_check_permalink_status()){
if(!file_exists(ABSPATH.".htaccess") || !is_writable(ABSPATH.".htaccess")){
$showerror ? $this->showError("AnyFont could not update your .htaccess file. Please ensure ".ABSPATH.".htaccess is writable by the server and then reactivate AnyFont. If you are using an alternative mod_rewrite method, you can disable this message in Advanced Settings.") : 0;
return false;
}
}
if(!is_dir(ANYFONT_CACHE)){
if(!wp_mkdir_p(ANYFONT_CACHE)){
$this->cachedir = false;
$showerror ? $this->showError("The AnyFont cache directory could not be found and attempts to create it failed! Please create the folder \"".ANYFONT_CACHE."\" and ensure that it is writable by the server.") : 0;
return false;
}
}
if(is_dir(ANYFONT_CACHE) && !is_writable(ANYFONT_CACHE)){
$this->cachedir = false;
$showerror ? $this->showError("AnyFont is currently unable to save any files to the cache folder! Please check the permissions for the folder \"".ANYFONT_CACHE."\" and ensure that it is writable by the server.") : 0;
return false;
}
if(!is_dir(ANYFONT_FONTDIR)){
if(!wp_mkdir_p(ANYFONT_FONTDIR)){
$this->fontdir = false;
$showerror ? $this->showError("AnyFont was unable to create a font folder to store uploaded font files! Please manually create \"".ANYFONT_FONTDIR."\" and ensure that is writable by the server.") : 0;
return false;
} else{
if(!$this->checkHealthStyles())
return false;
}
} else if(!is_writable(ANYFONT_FONTDIR)){
$this->fontdir = false;
$showerror ? $this->showError("AnyFont is currently unable to save any files to the font folder! Please check the permissions for the folder \"".ANYFONT_FONTDIR."\" and ensure that is writable by the server.") : 0;
return false;
}else{
if(!$this->checkHealthStyles())
return false;
}
return true;
}
function checkHealthStyles(){
if(!file_exists(ANYFONT_FONTDIR."/styles.ini")){
if(!is_writable(ANYFONT_FONTDIR)){
$this->styleconfig = false;
$this->showError("Could not write styles.ini!! (AnyFont styles config file) Please ensure that the folder \"".ANYFONT_FONTDIR."\" exists and is writable by the server, then reload this page.");
return false;
} else if(!touch(ANYFONT_FONTDIR."/styles.ini")){
$this->styleconfig = false;
$this->showError("The AnyFont styles config file was not found and all attempts to automatically create it failed! Please ensure that the folder \"".ANYFONT_FONTDIR."\" exists and is writable by the server, then reload this page.");
return false;
}
}
return true;
}
function getFonts(){
$list = "";
$tpl = new fastTPL($this->tplPath);
$tpl->define(array("font_block" => "fonts-block.html"));
foreach($this->fontlist as $displayname => $fontdetail){
$fontname = urlencode($fontdetail['filename']);
$fonttypes = "";
$i = 1;
$t = count($fontdetail["type"]);
foreach($fontdetail["type"] as $type){
$i != 1 && $i <= $t ? $fonttypes .= ", " : 0;
$fonttypes .= "{$type['ftype']}";
$i++;
}
$tpl->assign('FONTID', preg_replace('/\s+/', "", $displayname));
$tpl->assign('FONT_NAME', $fontname);
$tpl->assign('FONT_DISPLAY_NAME', $displayname);
$tpl->assign('FONT_TYPES', $fonttypes);
$tpl->assign('DISPLAY_NAME', $displayname);
$tpl->assign('COPYRIGHT', $fontdetail['copyright']);
$tpl->assign('FONT_URL', get_bloginfo('wpurl')."/images/admin/$fontname/".urlencode("The quick brown fox jumps over the lazy dog").".png");
$tpl->assign('FONT_INFO_ICON', ANYFONT_URL."/img/icon-fontinfo.png");
$tpl->assign('WEBFONT_ICON', ANYFONT_URL."/img/icon-fontinfo.png");
$tpl->assign('CHARMAP_ICON', ANYFONT_URL."/img/icon-charmap.png");
$tpl->assign('DELETE_ICON', ANYFONT_URL."/img/icon-delete.png");
$list .= $tpl->fetchParsed("font_block");
}
$this->tpl->assign("FONTS", $list);
$this->tpl->assign("UPLOAD_URL", ANYFONT_URL."/upload.php");
}
function readFontDir() {
$this->fontlist = array();
$filelist = array();
$sortlist = array();
$buildlist = array();
if(!$this->fontdir){
return false;
}else{
$dir = dir(ANYFONT_FONTDIR);
while (false !== ($e = $dir->read())){
if($e != '.' && $e != '..' && $this->is_font($e) === true){
$fontdetails = $this->getFontInfo( ANYFONT_FONTDIR ."/". $e);
$buildlist[$fontdetails[1]]["name"] = $fontdetails[1];
if(!$buildlist[$fontdetails[1]]["type"]){
$buildlist[$fontdetails[1]]["type"] = array();
}
array_push($buildlist[$fontdetails[1]]["type"], array("ftype" => $fontdetails[2], "filename" => $this->getFontName($e)));
$buildlist[$fontdetails[1]]["trademark"] = $fontdetails[7];
$buildlist[$fontdetails[1]]["copyright"] = $fontdetails[10];
$buildlist[$fontdetails[1]]["version"] = $fontdetails[5];
$buildlist[$fontdetails[1]]["author"] = !isset($fontdetails[8]) ? $fontdetails[9] : $fontdetails[8];
$buildlist[$fontdetails[1]]["url"] = $fontdetails[11];
$buildlist[$fontdetails[1]]["license"] = $fontdetails[13];
$buildlist[$fontdetails[1]]["filename"] = $this->getFontName($e);
array_push($sortlist, $fontdetails[1]);
}
}
natcasesort($sortlist);
foreach($sortlist as $fontname){
$this->fontlist[$fontname] = $buildlist[$fontname];
}
return true;
}
}
function readStyles(){
if($this->styleconfig && $this->checkHealthStyles()){
$this->styles = parse_ini_file(ANYFONT_FONTDIR."/styles.ini", true);
$this->styleconfig = false;
return true;
}
return false;
}
function getStyles(){
if(is_array($this->styles)){
$styles = "";
foreach($this->styles as $style => $option){
if($style != "Preview"){
// ksort($option);
$styles.=$this->getStyleBlock($style, $option);
}
}
$new_style = "
".$this->getHelpText('name')."