Browse code

Initial commit

Benjamin Roth authored on29/08/2015 10:20:51
Showing4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+;;
2
+; List modules which are required to be loaded beforehand
3
+;;
4
+requires[] = "core"
5
+
6
+;;
7
+; Configure what you want the autoload creator to register
8
+;;
9
+register_namespaces = true
10
+register_classes    = true
11
+register_templates  = false
0 12
new file mode 100644
... ...
@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ *
6
+ * Copyright (c) 2005-2015 Leo Feyer
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+
12
+/**
13
+ * Register the namespaces
14
+ */
15
+ClassLoader::addNamespaces(array
16
+(
17
+	'eSM_icontags',
18
+));
19
+
20
+
21
+/**
22
+ * Register the classes
23
+ */
24
+ClassLoader::addClasses(array
25
+(
26
+	// Hooks
27
+	'eSM_icontags\IcontagsHooks' => 'system/modules/eSM_icontags/hooks/IcontagsHooks.php',
28
+));
0 29
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * eSales Media Icontags for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2015 eSalesMedia
7
+ *
8
+ * @package    eSM_icontags
9
+ * @link       http://www.esales-media.de
10
+ * @license    http://www.gnu.org/licenses/lgpl-3.0.html LGPL
11
+ *
12
+ * @author     Benjamin Roth <benjamin@esales-media.de>
13
+ */
14
+
15
+$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('\\IcontagsHooks','eSMReplaceInsertTags');
0 16
\ No newline at end of file
1 17
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+<?php
2
+
3
+/**
4
+ * eSales Media Icontags for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2015 eSalesMedia
7
+ *
8
+ * @package    eSM_icontags
9
+ * @link       http://www.esales-media.de
10
+ * @license    http://www.gnu.org/licenses/lgpl-3.0.html LGPL
11
+ *
12
+ * @author     Benjamin Roth <benjamin@esales-media.de>
13
+ */
14
+
15
+namespace eSM_icontags;
16
+
17
+class IcontagsHooks extends \Controller
18
+{
19
+	public function eSMReplaceInsertTags($strTag)
20
+	{
21
+		$elements = explode('::', $strTag);
22
+
23
+		if ($elements[0] == 'icon')
24
+		{
25
+			if ($elements[1])
26
+			{
27
+				$fragments = explode(':', $elements[1]);
28
+			}
29
+			if ($fragments[0] && $fragments[1])
30
+			{
31
+				$chunks = explode(' ',$fragments[1]);
32
+
33
+				$strPrefix = $fragments[0];
34
+				$strClasses = '';
35
+				foreach ($chunks as $chunk)
36
+				{
37
+					$strClasses .= ' '.$strPrefix.'-'.$chunk;
38
+				}
39
+
40
+				if ($fragments[2])
41
+				{
42
+					$strClasses .= ' '.$fragments[2];
43
+				}
44
+
45
+				return sprintf('<span class="%s%s"></span>',$strPrefix,$strClasses);
46
+			}
47
+		}
48
+
49
+		return false;
50
+	}
51
+}
0 52
\ No newline at end of file