From f1ae0dc8cf4573381c99a20381973b2d8095f7cf Mon Sep 17 00:00:00 2001 From: Alexander Schwirjow Date: Tue, 17 Jul 2018 16:36:04 +0200 Subject: [PATCH] add some comments --- src/Resources/contao/classes/FontImport.php | 30 ++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Resources/contao/classes/FontImport.php b/src/Resources/contao/classes/FontImport.php index d4fcd0c..de4ad56 100644 --- a/src/Resources/contao/classes/FontImport.php +++ b/src/Resources/contao/classes/FontImport.php @@ -4,6 +4,9 @@ class FontImport extends \Backend { + /** + * Import the database class and set default template + */ public function __construct() { parent::__construct(); @@ -11,6 +14,9 @@ public function __construct() $this->import('Database'); } + /** + * Either show the upload form or handle the data + */ public function importFont() { if (\Input::get('key') != 'import') { @@ -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'; @@ -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); @@ -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'; @@ -170,8 +196,4 @@ private function parseFontSources($strCSS) return $sources; } - - private function sanitizeArray($arrData) - { - } }