]> git.mxchange.org Git - friendica-addons.git/commitdiff
membersince addon works now with frio
authorrabuzarus <rabuzarus@t-online.de>
Tue, 6 Feb 2018 17:24:03 +0000 (18:24 +0100)
committerrabuzarus <rabuzarus@t-online.de>
Tue, 6 Feb 2018 17:24:03 +0000 (18:24 +0100)
membersince/membersince.php

index 63482579994fda4f3740646de9efca1e6fbc9002..de7519c9a5f54f556fdb5adc95828b74e0c17c03 100644 (file)
@@ -23,9 +23,37 @@ function membersince_uninstall()
 
 function membersince_display(&$a, &$b)
 {
-       // Works in Vier
-       $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
+       if (current_theme() == 'frio') {
+               // Works in Frio.
+               $doc = new DOMDocument();
+               $doc->loadHTML($b);
 
-       // Trying for Frio
-       //$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . L10n::t('Member since:') . "</div><div class=\"profile-entry\">" . DateTimeFormat::local($a->profile['register_date']) . "</div></div>", $b, 1);
+               $elm = $doc->getElementById('aprofile-fullname');
+
+               $div = $doc->createElement('div');
+               $div->setAttribute('id','aprofile-membersince');
+               $div->setAttribute('class','col-lg-12 col-md-12 col-sm-12 col-xs-12 aprofile');
+
+               // The seperator line.
+               $hr = $doc->createElement('hr','');
+               $hr->setAttribute('class','profile-separator');
+
+               // The label div.
+               $label = $doc->createElement('div', L10n::t('Member since:'));
+               $label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted');
+
+               // The div for the register date of the profile owner.
+               $entry = $doc->createElement('div', DateTimeFormat::local($a->profile['register_date']));
+               $entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry');
+
+               $div->appendChild($hr);
+               $div->appendChild($label);
+               $div->appendChild($entry);
+               $elm->parentNode->appendChild($div);
+
+               $b = $doc->saveHTML();
+       } else {
+               // Works in Vier.
+               $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
+       }
 }