Remove $cf[xhtml][endtags]

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Remove $cf[xhtml][endtags]

Post by cmb » Thu Feb 26, 2015 5:45 pm

I suggest the following patch:

Code: Select all

Index: cmsimple/cms.php
===================================================================
--- cmsimple/cms.php	(revision 1490)
+++ cmsimple/cms.php	(working copy)
@@ -300,9 +300,13 @@
     die("Config file {$pth['file']['config']} missing");
 }
 // removed from the core in XH 1.6, but left for compatibility with plugins.
-$cf['security']['type']='page';
-$cf['scripting']['regexp']='#CMSimple (.*?)#';
+$cf['security']['type'] = 'page';
+$cf['scripting']['regexp'] = '#CMSimple (.*?)#';
 
+// removed from the core in XH 1.7, but left for compatibility with extensions
+$cf['xhtml']['endtags'] = '';
+$cf['xhtml']['amp'] = 'true';
+
 foreach (array('userfiles', 'downloads', 'images', 'media') as $temp) {
     // for compatibility with older version's config files
     if (!isset($cf['folders'][$temp])) {
Index: cmsimple/config.php
===================================================================
--- cmsimple/config.php	(revision 1489)
+++ cmsimple/config.php	(working copy)
@@ -41,8 +41,6 @@
 $cf['uri']['seperator']="/";
 $cf['uri']['word_separator']="-";
 $cf['uri']['length']="200";
-$cf['xhtml']['endtags']="";
-$cf['xhtml']['amp']="true";
 $cf['editmenu']['scroll']="";
 $cf['editmenu']['external']="";
 $cf['title']['format']="{SITE} – {PAGE}";
Index: cmsimple/functions.php
===================================================================
--- cmsimple/functions.php	(revision 1490)
+++ cmsimple/functions.php	(working copy)
@@ -1250,16 +1250,17 @@
  *
  * @param string $s The contents of the tag.
  *
+ * @return string The (X)HTML.
+ *
  * @global array The configuration of the core.
  *
- * @return string The (X)HTML.
+ * @deprecated since 1.7
  */
 function tag($s)
 {
-    global $cf;
+    trigger_error('Function tag() is deprecated', E_USER_DEPRECATED);
 
-    $t = $cf['xhtml']['endtags'] == 'true' ? ' /' : '';
-    return '<' . $s . $t . '>';
+    return '<' . $s . '>';
 }
 
 /**
@@ -1447,8 +1448,8 @@
         $errtype = "Unknow error type [$errno]";
     }
 
-    $errors[] = "<b>$errtype:</b> $errstr" . tag('br') . "$errfile:$errline"
-        . tag('br') . "\n";
+    $errors[] = "<b>$errtype:</b> $errstr" . '<br>' . "$errfile:$errline"
+        . '<br>' . "\n";
 
     if ($errno === E_USER_ERROR) {
         die($errors[count($errors) - 1]);
Index: cmsimple/languages/de.php
===================================================================
--- cmsimple/languages/de.php	(revision 1489)
+++ cmsimple/languages/de.php	(working copy)
@@ -124,7 +124,6 @@
 $tx['help']['uri_seperator']="Das Zeichen, das die Namen von Seiten und Unterseiten in der URL trennt.";
 $tx['help']['uri_word_separator']="Das Zeichen, das Wörter in der URL trennt.";
 $tx['help']['uri_length']="Die URLs der Seiten werden ab dieser Länge abgeschnitten. Das könnte sich in einer zukünftigen Version ändern, so dass es das Beste ist, kürzere Seitenüberschriften zu verwenden (z.B. durch die Verwendung von Seite&rarr;Andere Seitenüberschrift).";
-$tx['help']['xhtml_endtags']="Anklicken wenn Sie XHTML-Ausgabe wünschen. Die für XHTML-Auszeichnungselemente erforderlichen Abschluss-Schrägstriche werden automatisch erzeugt.";
 
 $tx['help']['folders_userfiles']="Der Basisordner aller Benutzerdateien.";
 $tx['help']['folders_downloads']="Ein Unterordner der Benutzerdateien.";
Index: cmsimple/languages/en.php
===================================================================
--- cmsimple/languages/en.php	(revision 1489)
+++ cmsimple/languages/en.php	(working copy)
@@ -123,7 +123,6 @@
 $tx['help']['uri_seperator']="The character which separates names of pages and sub pages in the URL.";
 $tx['help']['uri_word_separator']="The character which separates words in the URL.";
 $tx['help']['uri_length']="The URLs of the pages will be truncated at this length. This might change in a future release, so it's best to use shorter page headings (e.g. by using Page&rarr;Alternative heading).";
-$tx['help']['xhtml_endtags']="Check this, if you want XHTML-output. The required endslashes in standalone tags will be created automatically.";
 
 $tx['help']['folders_userfiles']="The base folder of all userfiles.";
 $tx['help']['folders_downloads']="A subfolder of userfiles.";
Index: cmsimple/languages/metade.php
===================================================================
--- cmsimple/languages/metade.php	(revision 1489)
+++ cmsimple/languages/metade.php	(working copy)
@@ -1,6 +1,5 @@
 <?php
 
-$mtx['amp']="amp";
 $mtx['author']="Autor";
 $mtx['backup']="Sicherung";
 $mtx['captcha']="CAPTCHA";
@@ -10,7 +9,6 @@
 $mtx['editmenu']="Bearbeitungsmenü (Admin-Menü)";
 $mtx['editor']="Editor";
 $mtx['email']="E-Mail";
-$mtx['endtags']="konform";
 $mtx['external']="Name";
 $mtx['filebrowser']="Dateibrowser";
 $mtx['folders']="Ordner";
@@ -54,6 +52,5 @@
 $mtx['urichar']="URL-Zeichen";
 $mtx['userfiles']="Benutzerdateien";
 $mtx['word separator']="Worttrennzeichen";
-$mtx['xhtml']="XHTML";
 
 ?>
Index: cmsimple/metaconfig.php
===================================================================
--- cmsimple/metaconfig.php	(revision 1489)
+++ cmsimple/metaconfig.php	(working copy)
@@ -28,8 +28,6 @@
 $mcf['menu']['legal']="hidden";
 $mcf['menu']['sdoc']="enum:,parent";
 $mcf['uri']['length']="hidden";
-$mcf['xhtml']['endtags']="bool";
-$mcf['xhtml']['amp']="hidden";
 $mcf['editmenu']['scroll']="bool";
 $mcf['editmenu']['external']="xfunction:XH_registeredEditmenuPlugins";
 ?>
Note that the patch does not remove the tag() calls from the core, the bundled plugins nor the templates, and as such the unit tests will fail. Removing the tag() calls is a trivial routine piece of work, but I don't want to do it twice (the patch might well be conflicting with other proposed patches).

Furthermore the patch does not change the doctype of the bundled templates, but that's easy to do as well, and would not be necessary at all, if we will remove the templates from the standard distribution.
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Remove $cf[xhtml][endtags]

Post by svasti » Thu Feb 26, 2015 7:52 pm

I see, Christoph is killing the X-factor. :x No more tag('whatever')? This was the sacred hallmark of CMSimple_XH plugin development. Gert scrutinised my first plugins to see if I had properly used only tag('br') and no '<br>'. That was the prerequisite to list plugins officially. And now Christoph is tearing down all this! We should only agree if he comes up with a new explanation what XH stands for.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Remove $cf[xhtml][endtags]

Post by cmb » Thu Feb 26, 2015 8:44 pm

svasti wrote:I see, Christoph is killing the X-factor. :x
Well, I assume that Jon Frakes would even get more mad, if he knew what I'm going to do. ;)

Actually, I'm not killing the "X", but I'm rather proposing to get rid of it. And I'm not proposing to remove XHTML compatibility from CMSimple_XH, because it has never been there. XHTML delivered as text/html is actually nothing more than invalid (but working) HTML (even if others may deny the fact), and to my knowledge, there never has been a CMSimple(_XH/whatever) installation sending Content-Type: application/xhtml+xml. What I propose it to get rid of a configuration option that never made much sense (I've already elaborated on that in this thread so far), and to simplify the core and plugins respectively. tag() has been a doubtful invention, which especially has made templates harder to read, for instance:

Code: Select all

<img src="..." alt="...">
vs.

Code: Select all

<?php echo tag('img src="..." alt="..."')?>
svasti wrote:We should only agree if he comes up with a new explanation what XH stands for.
Well, we could stick with the old meaning. Formerly it has been false, now it is just falser. And alread being in one of my moods, why not simply rename CMSimple_XH to CMSimple_H then, or maybe to CMSimple_. ;)

Kidding aside: why not simply give the same answer to this crucial question (Gretchenfrage) as Dr. Faust: "Name ist Schall und Rauch." (what's in a name?)
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Remove $cf[xhtml][endtags]

Post by cmb » Mon Mar 23, 2015 2:24 pm

I've applied the patch, removed all tag() calls from the core and the plugins, and fixed the bundled templates accordingly (r1526).

I left the external plugins alone. They should be dealt by their respective maintainers.

And, well, maybe the deprecation notice of tag() might be removed again (and applied for XH 1.8). As it is now, it would be hard to write notice free code that is supposed to run under XH 1.7 as well as former versions.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Remove $cf[xhtml][endtags]

Post by cmb » Mon Mar 30, 2015 2:22 pm

Apparently, I have missed several (X)HTML related fixes. Most importantly the built-in template (used for the print view) still had the (X)HTML doctype switch. Furthermore there have been lots of comments talking about (X)HTML. Fixed now (r1529).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply