[theme-reviewers] WP_Filesystem for read operation

Syahir Hakim khairulsyahir at gmail.com
Tue Sep 27 10:44:27 UTC 2011


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



More information about the theme-reviewers mailing list