[theme-reviewers] WP_Filesystem for read operation
otto at ottodestruct.com
Tue Sep 27 16:56:21 UTC 2011
The file_get_contents() function is currently restricted by the
theme-check for other reasons.
The file() function, however, is not. It reads text files into arrays
of lines. Probably useful for your purpose.
On Tue, Sep 27, 2011 at 5:44 AM, 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!
> Syahir Hakim
> +6421 0333 649
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
More information about the theme-reviewers