' . esc_html( $message ) . '
';
}
}
/* File uploading functions */
function wpcf7_init_uploads() {
$dir = wpcf7_upload_tmp_dir();
wp_mkdir_p( trailingslashit( $dir ) );
@chmod( $dir, 0733 );
$htaccess_file = trailingslashit( $dir ) . '.htaccess';
if ( file_exists( $htaccess_file ) )
return;
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
fwrite( $handle, "Deny from all\n" );
fclose( $handle );
}
}
function wpcf7_upload_tmp_dir() {
if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) )
return WPCF7_UPLOADS_TMP_DIR;
else
return wpcf7_upload_dir( 'dir' ) . '/wpcf7_uploads';
}
function wpcf7_cleanup_upload_files() {
$dir = trailingslashit( wpcf7_upload_tmp_dir() );
if ( ! is_dir( $dir ) )
return false;
if ( ! is_readable( $dir ) )
return false;
if ( ! is_writable( $dir ) )
return false;
if ( $handle = @opendir( $dir ) ) {
while ( false !== ( $file = readdir( $handle ) ) ) {
if ( $file == "." || $file == ".." || $file == ".htaccess" )
continue;
$stat = stat( $dir . $file );
if ( $stat['mtime'] + 60 < time() ) // 60 secs
@unlink( $dir . $file );
}
closedir( $handle );
}
}
if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
wpcf7_cleanup_upload_files();
?>