[theme-reviewers] Using file_get_contents() to import theme settings

Syahir Hakim khairulsyahir at gmail.com
Mon May 23 21:42:42 UTC 2011


Hi everyone,

I intend to use file_get_contents() to implement an option in my theme 
where users and/or developers can export and import the theme settings. 
As the number of options available in theme continue to expand, this 
will be a very convenient and useful feature, especially for developers 
who are customising the theme and setting it up locally to quickly 
deploy it on a live server, rather than going through each and every 
settings again. Note though that this only concerns the theme's 
settings, and not WordPress.

Me and the other developer for the theme intend to use 
file_get_contents() to read in the json-encoded exported theme settings 
files when it is uploaded, but as I understand there's a blanket ban on 
the usage of file operations functions. The file will be handled using 
the wp_handle_upload() function, and it doesn't need to be retained 
after the contents are read. And since json_encode() and json_decode() 
functions are only available since PHP 5.2.1, the theme will display a 
message saying that the theme settings import/export feature is not 
available to those users.

Note that this settings is intended to make things easier for the theme 
users and those who are developing a site based on the theme. It will 
not cause any performance issue at all in the front end. Please let me 
know if the use of file_get_contents() can be allowed for this specific 
case, or if not, what are the alternatives that I may consider.

Thanks!

-- 
Regards,
Syahir Hakim

Contact:
http://www.khairul-syahir.com
+6421 0333 649



More information about the theme-reviewers mailing list