[wp-trac] [WordPress Trac] #9716: Wordpress Theme/Plugin editor adds blank lines

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 19 01:00:54 UTC 2012


#9716: Wordpress Theme/Plugin editor adds blank lines
-------------------------------------------+------------------------------
 Reporter:  Vistronic                      |       Owner:  anonymous
     Type:  defect (bug)                   |      Status:  reopened
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Editor                         |     Version:  2.7.1
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback needs-patch  |
-------------------------------------------+------------------------------
Changes (by HallMarc):

 * cc: HallMarc (added)
 * keywords:  has-patch reporter-feedback => reporter-feedback needs-patch


Comment:

 I have found a way to normalize the contents before they get written back
 to the file. In both wp-admin/theme-editor.php and wp-admin/plugin-
 editor.php you need to change one line of code:

 Find:
         $newcontent = stripslashes($_POST['newcontent']);
 And replace it with this:
         $newcontent = ereg_replace("\r\n?", "\n",
 stripslashes($_POST['newcontent']));
 And all is well.
 I hope this gets included in the next update.
 Since I am unsure as of yet as to why the extra CR gets added or when; the
 ability for the end-user to turn this on/off may be a good addition.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9716#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list