Google Fonts BbCode [Deleted]

Lukas W.

Well-known member
katsulynx submitted a new resource:

Google Fonts BbCode - Extend XenForos [FONT]-Tag to support the full range of Google Fonts

Google Fonts BbCode
Description

Google Webfonts BbCode extends the default XenForo [FONT]-Tag to support the full range of Google Webfonts on your website. Of course each font is only loaded on request, to be more precise, even only the letters really used inside the tag are actually loaded to ensure maximum performance on page load....

Read more about this resource...
 
Would it be possible to do single requests based on all the fonts used on a page? As to prevent dozens of requests?
 
I don't really see any improvement this could bring. The fonts are required one by one from Google anyway as they are different files.
 
Hello,

I don't see the included readme in the files you provided. Might you know where I can find this?
 
Sorry, it got lost in the event of updating. If it is about deactivating the call to my server:

-> Head to your ACP -> Tools -> Cron Jobs and deactivate or delete the "Google Webfonts Build Cache" Cron Job.
 
Hi,

That wasn't the reason - just wanted to make sure I was doing everything correctly. Your addon works like a charm - thanks!
 
@DaniD I've read your review. What exactly do you mean with "save fonts for easier access"? Saving them on your webserver doesn't really grant any benefits, or do you want to load them with every page no matter if used? Or do you mean in the font list of the editor?
 
@katsulynx - I'm pretty sure you said it was impossible, but it'd be nice if a few fonts could be selected/used in the font list of the editor, so people can either use those fonts on their own, or so that someone can find them easier, as you have to refer to google's list in order to figure out which fonts you can even use.

Just wishful thinking, though!
 
The AddOn itself already maintains a list of the google webfonts, so that shouldn't be any problem. I was already thinking about expanding the font list, but wasn't sure on how to do it simply by the fact we have over 600 google fonts, which would be too much to add to the editor alltogether. I'll see what I can do however.
 
The AddOn itself already maintains a list of the google webfonts, so that shouldn't be any problem. I was already thinking about expanding the font list, but wasn't sure on how to do it simply by the fact we have over 600 google fonts, which would be too much to add to the editor alltogether. I'll see what I can do however.

I know it would be a crazy amount of load on the server to have all of those font preloaded and easily accessible, so I understand that is out of the question.

That was why I suggested maybe one or two fonts, like how the default fonts are readily accessible and there are only a few of them accessible (times, arial, etc). Being able to set your own default google font(s) for the editor would be nice, too. Like a max of 2, as to avoid load issues. I appreciate you looking into this feature, though. :)!
 
Just the default ones along with what's possible to achieve in combination with other BBCodes at the moment.
 
I installed this add-on a little while ago and it was working great at first. But now my members are reporting that it looks like the google font isn't being called for all letters it's being wrapped around.

I found this error in my error log:
Error Info
ErrorException: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 - library/GoogleWebfonts/CronEntry/Webfonts.php:5
Generated By: Unknown Account, Jul 25, 2015
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'file_get_conten...', '/home/pandorar/...', 5, Array)
#1 /home/pandorar/public_html/library/GoogleWebfonts/CronEntry/Webfonts.php(5): file_get_contents('http://rpgzone....')
#2 [internal function]: GoogleWebfonts_CronEntry_Webfonts::rebuildCache(Array)
#3 /home/pandorar/public_html/library/XenForo/Model/Cron.php(357): call_user_func(Array, Array)
#4 /home/pandorar/public_html/library/XenForo/Deferred/Cron.php(24): XenForo_Model_Cron->runEntry(Array)
#5 /home/pandorar/public_html/library/XenForo/Model/Deferred.php(294): XenForo_Deferred_Cron->execute(Array, Array, 7.99999904633, '')
#6 /home/pandorar/public_html/library/XenForo/Model/Deferred.php(428): XenForo_Model_Deferred->runDeferred(Array, 7.99999904633, '', false)
#7 /home/pandorar/public_html/library/XenForo/Model/Deferred.php(373): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#8 /home/pandorar/public_html/deferred.php(23): XenForo_Model_Deferred->run(false)
#9 {main}
Request State
array(3) {
["url"] => string(33) "http://pandorarp.com/deferred.php"
["_GET"] => array(0) {
}
["_POST"] => array(3) {
["_xfRequestUri"] => string(1) "/"
["_xfNoRedirect"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}

This is what the other admin on my board showed me:
2a8e34651423b846da30efcfbe7ed9bf.png
 
@katsulynx,

Code:
        if(in_array($tag['option'],$this->_webfonts)) {
            $webfont = str_replace(' ','+',$tag['option']);
            return $this->_wrapInHtml('
                <link href=\'https://fonts.googleapis.com/css?family='
                    .$webfont.'&text='.urlencode(preg_replace('/(<.*>)/sU','',$text))
                    .'\' rel=\'stylesheet\' type=\'text/css\'>
                <span style="font-family: ' . htmlspecialchars($tag['option']) . '">', '</span>', $text);

This code here in Base.php needs to use https for the link to the googleapis.com. Other wise it won't load on sites that use https unless the user allows "insecure content". Setting it to https should not have any side effects to sites that don't use ssl as Google Recommends to use https of their links.
 
Back
Top Bottom