[theme-reviewers] WP_Filesystem for read operation

Dion Hulse (dd32) wordpress at dd32.id.au
Tue Sep 27 11:50:54 UTC 2011


You shouldn't need to use WP_Filesystem for read-only operations, it's an
API designed for write access.
I'll leave it up to every one else for what you should be using, as I'm not
aware of the "best practice" for themes. (I would add however, how ever you
do it, cache it (transient?), don't scan on every admin options page load..)

On 27 September 2011 20:44, Syahir Hakim <khairulsyahir at gmail.com> wrote:

> Greetings, theme devs!
>
> I have a question regarding the restriction of file operations in themes. I
> am well aware that we shouldn't use PHP's built in file operation functions
> directly in the theme due to security concerns, but what if we just need to
> read in a content of a file to scan it with a regex? I'm basically using a
> function to scan the template files in my theme for all added action hooks,
> so that I can list them in the options page programmatically rather than
> manually typing out the list. Is there a way to use the filesystem API
> without requesting credentials? I'm asking this because there'll be no
> writing operation at all, just reading, and typically template files have no
> permission restriction on read operation on the server. Also, asking the
> user to enter FTP credentials every time they access the options page is
> very inconvenient, bordering annoying, in fact.
>
> Thanks for any input!
>
> --
> Regards,
> Syahir Hakim
>
> Contact:
> http://www.khairul-syahir.com
> +6421 0333 649
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110927/35407729/attachment.htm>


More information about the theme-reviewers mailing list