[wp-hackers] Proposal: standardize plugin-data path

Frank Bueltge frank at bueltge.de
Fri Sep 26 13:49:43 GMT 2008


You can use the function:
plugins_url()

example:
for images:
plugins_url('/simple_banner/includes/farbtastic/farbtastic.png')

for JS is this better:
wp_enqueue_script( 'farbtastic',
plugins_url('/simple_banner/includes/farbtastic/farbtastic.js'),
array('jquery'), '1.2' );

for css:
wp_enqueue_style( 'farbtastic',
plugins_url('/simple_banner/includes/farbtastic/farbtastic.css'),
array(), '1.2', 'screen' );

Liebe Grüsse
Frank
______________________________
Mein Buch: WordPress - Weblogs einrichten und administrieren | ISBN
978-3-937514-33-8

bueltge.de
kvfl.com



On Fri, Sep 26, 2008 at 3:35 PM, Otto <otto at ottodestruct.com> wrote:
> Pardon me, using wp_upload_dir() is a bad idea due to the year/month
> thing. Use WP_CONTENT_DIR . '/uploads/your_plugin_name' instead.
>
>
> On Fri, Sep 26, 2008 at 8:34 AM, Otto <otto at ottodestruct.com> wrote:
>> Seems to me that the safest place to do this would be
>> wp_upload_dir().'/your_plugin_name' . The upload directory doesn't
>> have to be limited to uploaded files. The tinyMCE stuff already puts
>> it's cached JS files there too.
>>
>> On Thu, Sep 25, 2008 at 4:58 PM, Stephen Rider
>> <wp-hackers at striderweb.com> wrote:
>>> Hi --
>>>
>>> There are a number of plugins that themselves have user-changeable files.
>>>  I'm not talking about ones where you edit the file to set options, but
>>> things like Spam Karma that have plugins of their own, or my own Pull-Quotes
>>> plugin that allows you to customize the style files, or caching and backup
>>> plugins that create files of their own.
>>>
>>> We also now have an established auto-update system which, upon update, blows
>>> away anything in a plugin's folder, including any files that may have been
>>> added or changed.
>>>
>>> I propose we establish an official location (changeable via CONSTANT of
>>> course) for plugins to put their custom data that should _not_ be so easily
>>> wiped out on update.  The default we set could be as simple as
>>> /wp-content/plugin-data.  Thus myplugin would use
>>> /wp-content/plugin-data/myplugin
>>>
>>> I know plugin authors can just set that directory to anything they like, but
>>> I generally think it's a good idea to standardize such things.  Makes things
>>> a bit easier for plugin authors to establish an alternative location for
>>> things if there's a set standard.
>>>
>>> What say ye all?
>>>
>>> Stephen
>>>
>>> P.S. -- This came up in the course of wanting to allow users of the
>>> aforementioned pull-quotes plugin to set a custom directory for the
>>> pull-quote styles.  It would be great to have something like
>>> WP_PLUGIN_DATA_DIR and WP_PLUGIN_DATA_URL, or even just WP_CONTENT_DIR .
>>> '/plugin-data'
>>>
>>> --
>>> Stephen Rider
>>> <http://striderweb.com/>
>>>
>>>
>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list