On Thu, Dec 2, 2010 at 4:02 AM, Sayontan Sinha <span dir="ltr"><<a href="mailto:sayontan@gmail.com">sayontan@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex" class="gmail_quote">There's no good reason to use fopen in a theme. Any reason you can<br>
think of has better ways of doing it.<br></blockquote><br></div>I am curious as to what qualifies as a better way of doing things. E.g. I have code where depending on selections certain stylesheets are grouped together, then either they are compressed and/or minified. This requires a call to fopen to spit out all the contents of a local file into a buffer, then operate on that buffer. I cannot think of a way other than the one implemented for this purpose. Functions like include or get_template_part will fail to do what is intended because the contents of the files need to be altered on the fly. And if you are loading a collection of CSS files through PHP using the "link" tag, the PHP goes out of WP's context, so native WP functions will not be available in that PHP, unless you use wp-load.php, which is absolutely not recommended (I did read your post on wp-load, BTW).</blockquote>
<div><br></div><div>That's for a plugin to do, not a theme.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I also checked WP's native loader files - they incidentally use file_get_contents(), which is another function apparently blacklisted as "fishy code" by the theme upload checker.<br>
</blockquote><div><br></div><div>Yes. It has the potential to be fishy. There's no reason for a theme to use it. If they need to do an external request, they should use the HTTP API. If they need to do an internal request, well, they shouldn't be doing any internal requests.</div>
<div><br></div><div>Nacin</div></div>