Complied source cleaning (16 posts)

  1. Maybe I'm just being a stickly-sticklerson, but I like to make sure that if someone views the code on my site (namely myself or any other curious party) that all of it is properly indented and spaced out and line fed in the places that I can control it.

    That being said, WordPress is another opensource application that falls victim to different mindsets working on different areas resulting in inconsistent display of HTML and CSS.

    Lets just say, that someone was to go through and clean up all the tabs and new line feeds to spit out near perfect code... How does this someone go about suggesting/updating the existing template files to include these changes so that he/she wouldn't need to re-edit 6 template files everytime there is a new WordPress version? :) :)

  2. mttcrlsn
    Posted 8 years ago #

    Well some said it before I did and I would have to agree WordPress does not have clean coding. Maybe it is just cause I do and was taught old-school coding. One thing that bugs me even more than the code formating (as in readabilty) is the lack of a header to id things such as date/time modified and which version/build of each file.

    Old School Coder - age 33 (we don need no stinkin WYSIWYG)

  3. The way I see it, just because no one is looking doesn't mean I don't wear clean underwear. :)

    I also have to agree with the version suggestion. There's no real mechanism in place for me to know what version of which file I'm using compared to the SVN or TRAC, other than comparing them side by side... Ugh...

    I feel like WordPress is super amazing, but the project could really use a solid information architect to reel everything in and make it a little easier for the rest of us...

    I went ahead and cleaned up some parts of the 2.5 template files myself; a brief look at the source of...


    ...will hopefully show what I mean... I cleaned up the widget code to work with the template I'm using, and although I realize that not every template is the same, keeping the output clean at least helps keep my underwear clean... ;)

  4. mttcrlsn
    Posted 8 years ago #

    I'll have to remember that line about wearing clean underwear. :)

  5. mttcrlsn
    Posted 8 years ago #

    How about addng something like this to the beginging of all WordPress files (after the php tag)?

    WordPress Publishing Platform
    Copyright (c) 2003-2008

    WordPress is released under the GPL; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation, Inc.

    WordPress version: 2.5.0 {Overall WordPress version}
    Build: 7600 {build version as a whole}
    Date: 2008-1-1 01:00:00 -0500 (Tues, 1 Jan 2008) {date/time file was revised}

  6. That is perfect in my opinion... Heck I'd settle for just the last 5 lines!

  7. mttcrlsn
    Posted 8 years ago #

    Tells one what project it is, what the licensing is for the code and the version information. Anyone is welcome to use it here or of other projects.

  8. fitztrev
    Posted 8 years ago #


    That's what trac is for.

  9. mttcrlsn
    Posted 8 years ago #


    If I have a php file or a css file from WordPress and I open it up in a text editor how do I know what version it is, if it is current, etc? One should not have to run another program or look elsewhere to figure this out. Time is precious enough. WordPress is a great program but the lack of programming documentation within the code knocks it down a peg from being professional.

  10. I totally agree, and fitstrev I think you're missing our point slightly...

    The idea for the trac (to be an efficient to a community of project developers) should be to compare the file version in the trac to what the users are already using, check to see if there is a difference, and perform those changes.

    At this point, I have no idea which version I have installed on my server because there is no file information to compare to the trac. :(

  11. fitztrev
    Posted 8 years ago #

    With the release of 2.5, there is a lot of inline code documentation. That shouldn't be that much of a problem any more. There is phpdoc reference almost everywhere.

    You can easily figure out your WordPress version by looking at your dashboard, viewing the source code, or opening wp-includes/version.php.

    And even if that header were added, wouldn't you still have to refer to trac to compare the build info and date info of the file to make sure it's the latest?

    Also, it would add an extra step for the developers, too--to update the file's header info before each commit.

  12. whooami
    Posted 8 years ago #

    I agree with fitztrev on this, and here is why. Under ideal circumstances, your file versions ought to match the WP version you are running.

    Look at phpBB 2 -- every file had a version #, that to the normal user was greek. Of course, phpBB 2 also uses mods, that hack away at core files. So keeping track when things changed was more important.

    WP has gone out of their way to insure that core files dont have to be hacked. Consequently, unless youre making your own changes to the files, and need to reference back to them, what you are running out to match your files.

    Furthermore, file versioning would be a step closer to releasing patches, which, for whatever reason, WP doesnt do under normal circumstances. It's an all or nothing deal.

  13. And even if that header were added, wouldn't you still have to refer to trac to compare the build info and date info of the file to make sure it's the latest?

    That would be nice actually, because the html that WordPress spits out isn't very consistent so the core needs to be modified to produce the results I want... :/

    It would be nice to see a bit more separation between template output and theme so that output doesn't make my code look like code pizza.

  14. mttcrlsn
    Posted 8 years ago #

    The point of the header is also to id "what do I have here". If you were looking for the latest and greatest yes one whould have to know that. But with the header if I get code for say a modification then I would know what base was started with. It also is a way of giving credit. And does not matter if things are designed not to need "hacking", one needs it for troubleshooting especially with test versions. Look at any program files on a computer be it Windows, Mac, Linux or some other program - they have a build id on each file.

  15. I'm bringing this out of the archives because I feel it's an important issue that warrants a little more attention.

    I think that WordPress would benefit from checking out something as time honored as phpBB's output and template guidelines, for a brief somewhat relevant example for lack of a better one.

    Essentially, the core doesn't manage the content, and I find it a source of frustration that WordPress spits out XHTML compliant soup. Sure, it validates, but it's not properly indented and it doesn't allow me to tell it how far I want it to indent the content it spits out because it thinks it already knows.

    And from what I've seen, the walker function is the worst example of this. Compliant? Yes... Visually readable source? Hardly...

    I want WordPress to indent where it should, as deep as it should...

  16. Steven Vachon
    Posted 7 years ago #

    I too would really like to take advantage of such a feature.


Topic Closed

This topic has been closed to new replies.

About this Topic