form_id ); return apply_filters( 'jet-form-builder/file-upload/user-dir-name', $user_dir_name ); } /** * Returns upload base directory * * @return [type] [description] */ public static function upload_base() { return apply_filters( 'jet-form-builder/file-upload/dir', 'jet-form-builder' ); } public static function create_index( $path ) { if ( ! is_dir( $path ) ) { return false; } $path = trailingslashit( $path ) . 'index.html'; $index = wp_normalize_path( $path ); if ( file_exists( $index ) ) { return false; } // phpcs:ignore WordPress.WP.AlternativeFunctions return file_put_contents( $index, '' ); } public static function create_htaccess( $path ) { if ( ! is_dir( $path ) ) { return false; } $content = apply_filters( 'jet-form-builder/file-upload/htaccess-content', self::htaccess_content() ); if ( ! $content ) { return false; } $path = trailingslashit( $path ) . '.htaccess'; $index = wp_normalize_path( $path ); if ( file_exists( $index ) ) { return false; } // phpcs:ignore WordPress.WP.AlternativeFunctions return file_put_contents( $index, $content ); } protected static function htaccess_content(): string { return ' # Disable directory browsing Options -Indexes # Hide the contents of directories IndexIgnore * Header set X-Robots-Tag "noindex, nofollow" '; } }