[buddypress-trac] [BuddyPress] #4470: BuddyPress Singleton

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Aug 28 01:40:09 UTC 2012


#4470: BuddyPress Singleton
------------------------------+------------------------------
 Reporter:  johnjamesjacoby   |       Owner:  johnjamesjacoby
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  1.7
Component:  Core              |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+------------------------------

Comment (by johnjamesjacoby):

 Replying to [comment:3 foxly]:
 > Seriously??
 Yes.

 > If my team wants to "tamper" with Buddypress, we can, and if necessary
 we will, hook into the WP plugin load process, read your class files in
 with fread(), modify them with preg_replace() and then load them back into
 memory with eval().
 >
 > By making it difficult to inspect and modify BP's core variables, the
 only thing you're doing is wasting *everyone's* time (it makes it VERY
 hard to do unit testing) and annoying other plugin developers.
 >
 > Yes, make it a singleton, but do NOT start setting methods and variables
 to private ...Buddypress is nowhere near mature enough for that

 This patch changes none of the things you're upset about. There are are
 magic getters and setters in place that nullify your argument here.

 Try:

 {{{
 function wow_init() {
         global $bp;

         $bp->version = 'wow';

         // uncomment to
         //$bp = buddypress();
         //$bp->version = 'wow';
 }
 add_action( 'bp_init', 'wow_init' );

 function wow_wp() {

         echo buddypress()->version;

         global $bp;
         echo $bp->version;

         die;
 }
 add_action( 'wp', 'wow_wp' );
 }}}

 You're still able to "tamper" with whatever you'd like, the same as you
 always have. Nothing is more difficult, no ones time is wasted, no one is
 annoyed, no methods or variables are incorrectly private, existing
 visibility is maintained, and the $bp global is untouched.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4470#comment:4>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list