Skip to content
Browse files

* add support for google font for tagcloud

  • Loading branch information...
1 parent 668277f commit 1b02078d786568b45520d890418f8b6a69b33b41 @cedricwalter committed
View
16 com_cedTag/admin/config.xml
@@ -34,6 +34,22 @@
</fieldset>
+
+ <fieldset name="Fonts" label="Fonts">
+ <field name="useGoogleFonts" type="list" default="1" label="Use Google Fonts"
+ description="Use Google Fonts, visit http://www.google.com/webfonts">
+ <option value="1">JYES</option>
+ <option value="0">JNO</option>
+ </field>
+
+ <field name="googleFonts" type="list" default="font-family: 'Open Sans', sans-serif;|Open+Sans" label="Google Fonts *"
+ description="Google Fonts, hit save css if changing this settings!">
+ <option value="font-family: 'Just Me Again Down Here', cursive;|Just+Me+Again+Down+Here">Just Me Again Down Here</option>
+ <option value="font-family: 'Great Vibes', cursive;|Great+Vibes">Great Vibes cursive</option>
+ <option value="font-family: 'Open Sans', sans-serif;|Open+Sans">Open Sans</option>
+ </field>
+ </fieldset>
+
<fieldset name="Backend" label="Backend">
<field name="tag_page_limit" type="text" default="30" label="Tag/Term Page Limit" size="4"
description="How many tags/terms to show on each page.">
View
15 com_cedTag/admin/controllers/css.php
@@ -12,7 +12,7 @@
jimport('joomla.filesystem.file');
require_once (JPATH_COMPONENT . '/controllers/file.php');
-
+require_once JPATH_COMPONENT_SITE . '/helper/helper.php';
class CedTagControllerCss extends CedTagControllerFile
{
@@ -46,11 +46,24 @@ public function getDefaultView()
public function save()
{
$updatedFileContent = JFactory::getApplication()->input->get('content', '', 'STRING');
+
+ $updatedFileContent = $this->transform($updatedFileContent);
+
JFile::write($this->getFile(), trim($updatedFileContent));
JFactory::getApplication()->input->set('view', $this->getDefaultView());
parent::display();
}
+ public function transform($fileContent)
+ {
+ $useGoogleFonts = CedTagsHelper::param('useGoogleFonts','1');
+ if ($useGoogleFonts) {
+ $googleFonts = explode("|",CedTagsHelper::param('googleFonts',"font-family: 'Open Sans', sans-serif;|Open+Sans"));
+ $fileContent = preg_replace ("/(font-family:.*;)/i", $googleFonts[0], $fileContent);
+ }
+
+ return $fileContent;
+ }
}
View
7 com_cedTag/admin/controllers/file.php
@@ -32,11 +32,18 @@ public function display()
public function save()
{
$updatedFileContent = JFactory::getApplication()->input->get('content', '', 'STRING');
+ $updatedFileContent = $this->transform($updatedFileContent);
+
JFile::write($this->getFile(), trim($updatedFileContent));
JFactory::getApplication()->input->set('view', $this->getDefaultView());
parent::display();
}
+ public function transform($fileContent)
+ {
+ return $fileContent;
+ }
+
public function getDefaultFile()
{
}
View
9 com_cedTag/css/tagcloud.css
@@ -54,6 +54,7 @@
}
.alltags .cloud {
+ font-family: 'Open Sans', sans-serif;
/* border: 1px solid #2484B0;*/
/* border-radius: 9px;*/
}
@@ -101,6 +102,7 @@
border: 1px solid #2484B0;
border-radius: 9px;
+
cursor: auto;
color: #2484B0;
@@ -228,8 +230,10 @@ only this css class is used
/* box around term */
padding: 0px 6px 0px 6px !important;
+ /*
border: 1px solid #2484B0;
border-radius: 9px;
+ */
/* end box around term */
cursor: auto;
@@ -356,7 +360,4 @@ all these 7 css class are used
/* end box around term */
cursor: auto;
-}
-
-
-
+}
View
10 com_cedTag/site/helper/helper.php
@@ -36,7 +36,7 @@ function getAllTagModel($count = 25, $sorting = 'sizeasort', $reverse = 1)
$rows = $dbo->loadObjectList();
CedTagsHelper::addCss();
- $rows = $this->mappingFrequencyToSize($rows);
+ $rows = $this->mappingFrequencyToSize($rows);
$this->cache->store($rows, "getAllTagModel");
}
@@ -230,6 +230,14 @@ static function addCss()
{
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'media/com_cedtag/css/tagcloud.css');
+
+ $useGoogleFonts = CedTagsHelper::param('useGoogleFonts', '1');
+ if ($useGoogleFonts) {
+ $googleFonts = explode("|", CedTagsHelper::param('googleFonts', "font-family: 'Open Sans', sans-serif;|Open+Sans"));
+ $document->addStyleSheet('http://fonts.googleapis.com/css?family='.$googleFonts[1]);
+ }
+
+
}

0 comments on commit 1b02078

Please sign in to comment.
Something went wrong with that request. Please try again.