WordPress.org

Ready to get started?Download WordPress

Forums

RFC: A professional WordPress API (5 posts)

  1. jnt72
    Member
    Posted 7 years ago #

    I really had to lough when I read about 'coding guidelines' on these pages! Have the makers of WordPress ever seen a real API? ALL constants, variables and methods of the system should have a unique prefix (such as 'wp_' for example) in order to have separated namespaces. (They did it with the db table names, so why this mess in PHP?)

    Otherwise it's quite likely to happen that someone overwrites an internal WordPress variables/methods when developing more complex themes. Other solution would be to encapsulate the whole WordPress-thingy in a class (yes, a bit like $wpdb) and ONE single, global instance provides all methods/data. Would be a much cleaner interface imho.

    If 'code is poetry' it should be self-explanatory and there shouldn't be a need for so many (confusing) docs which are aiming at varying audiences (devs? designers? just bloggers in general?).

  2. Root
    Member
    Posted 7 years ago #

    Have you tried Habari? :)

  3. lxg
    Member
    Posted 7 years ago #

    jnt72: This is nonsense.

    The DB tables are prefixed because this allows having tables for more than one application in one database. It is merely a bonus for people who have limited hosting ressources.

    The PHP functions/variables/etc. don't have to be prefixed, as those descriptors don't collide with other applications. And it's up to the theme/plugin authors to prefix their descriptors, as they write code based on the core system.

    Other solution would be to encapsulate the whole WordPress-thingy in a class (yes, a bit like $wpdb) and ONE single, global instance provides all methods/data. Would be a much cleaner interface imho.

    Go home, kid.

  4. Comments, suggestions and discussion about WP's core code would be better directed at the wp-hackers mailing list:

    http://lists.automattic.com/mailman/listinfo/wp-hackers

  5. lxg
    Member
    Posted 7 years ago #

    LesBessant: I agree, but I just couldn't leave that first post uncommented.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags