[wp-trac] Re: [WordPress Trac] #3047: get_plugininfo()

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 21 21:21:12 GMT 2006


#3047: get_plugininfo()
------------------------------------------+---------------------------------
 Reporter:  forceagainstsomething         |        Owner:  westi   
     Type:  enhancement                   |       Status:  assigned
 Priority:  normal                        |    Milestone:          
Component:  Administration                |      Version:  2.1     
 Severity:  normal                        |   Resolution:          
 Keywords:  bg|has-patch bg|dev-feedback  |  
------------------------------------------+---------------------------------
Comment (by forceagainstsomething):

 "It is not the include file being in the same directory but the plugin
 itself."

 Well you've got me there.  Didn't think of that.

 "My implementation is not pointless"

 I say pointless, because at some point it's not even convenient to use
 anymore.  And convenience is at the heart of this function.  Having to
 call the function from the base plugin script, along with passing FILE to
 the function, degrades the elegance of the function.

 "get_bloginfo can be so effortless because it works for the whole blog it
 does not need a point of reference - anything that provides the info for a
 plugin needs a point of reference."

 Right, but the goal should be making get_plugininfo() as effetless as
 get_bloginfo().  Doesn't mean it's going to happen, but that should at
 least be the goal.

 "Personally, I think that a plugin author should know the name of the file
 they're working with. get_plugininfo('whatevvv',
 'myplugindir/mymainpluginfile.php'); is not hard to type."

 Not true.  I don't hardcode my plugin path, I know others don't either.
 Most of my plugins start like this:

 define('PLUG_BASE',             dirname(plugin_basename(__FILE__)));

 define('PLUG_PATH',             ABSPATH . 'wp-content/plugins/' .
 PLUG_BASE);

 define('PLUG_URL',              get_bloginfo('wpurl') . '/wp-
 content/plugins/' . PLUG_BASE);

 This way the user can rename my plugin's directory, and it still works.
 If I was to use the method you described, I would still have to define the
 PLUG_BASE to use whenever I call the get_plugininfo() function.  The point
 of the function is so I don't have to define any more variables.  Also I
 try my damnest not to use global variables or constants inside of classes,
 so that means I would have to redefine the PLUG_BASE inside every class.

 "I see no point in a crappy implementation to work around lazy plugin
 developers."

 You call it lazy, I call it convenient.  Like I've said already, you can
 find out the blog's URL without using get_bloginfo().  So does that make
 me lazy for using get_bloginfo()?  No.  It's just convenient.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3047>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list