Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schwirjow authored and Alexander Schwirjow committed Jul 17, 2018
1 parent 7a1f479 commit f1ae0dc
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/Resources/contao/classes/FontImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

class FontImport extends \Backend
{
/**
* Import the database class and set default template
*/
public function __construct()
{
parent::__construct();
$this->strTemplate = 'be_font_import';
$this->import('Database');
}

/**
* Either show the upload form or handle the data
*/
public function importFont()
{
if (\Input::get('key') != 'import') {
Expand Down Expand Up @@ -137,6 +143,12 @@ public function importFont()
return \Message::generate().$template->parse();
}

/**
* Parse @font-family rules from a CSS file
*
* @param string $strCSS
* @return array
*/
private function parseFontFaces($strCSS)
{
$regEx = '/@font\-face\s*{[^}]+}/m';
Expand All @@ -146,6 +158,14 @@ private function parseFontFaces($strCSS)
}
}

/**
* Parse a CSS rule using regex
*
* @param string $strCSS
* @param string $rule
* @param string $default
* @return string
*/
private function parseRule($strCSS, $rule, $default = '')
{
$regEx = sprintf('/%s:[\'"\s]*([^;\'"]+)[\'"]*/m', $rule);
Expand All @@ -157,6 +177,12 @@ private function parseRule($strCSS, $rule, $default = '')
return $default;
}

/**
* Parse font source rules using regex
*
* @param string $strCSS
* @return array
*/
private function parseFontSources($strCSS)
{
$regEx = '/url\s*[(\'"]*([^\'"\s)]+)[\')\s]*format\s*[(\'"]*([^\'"]+)[\')\s]*[;,]/m';
Expand All @@ -170,8 +196,4 @@ private function parseFontSources($strCSS)

return $sources;
}

private function sanitizeArray($arrData)
{
}
}

0 comments on commit f1ae0dc

Please sign in to comment.