Closed welovewebdesign closed 11 years ago
It is for preventing direct access to the files. The web server should prevent direct access to the theme files (.htaccess), but this is an additionnal mesure.
// The PHP file called by the server
// (with WordPress, everything is managed by the index.php file)
echo $_SERVER['SCRIPT_FILENAME'];
// The current file
echo __FILE__;
// If both names are the same, it means the current file has been directly called.
Example: http://www.lesintegristes.net/wp-content/themes/lesintegristes/sidebar.php http://www.presse-citron.net/wordpress_prod/wp-content/themes/steaw-citron/sidebar.php
I'd never seen this line of code in a WordPress theme before. Is it a specific lesintegristes-theme's requirement?