put_contents( FIVENAMES_LLMTXT_FILE, $content, FS_CHMOD_FILE ); } } // Fallback: directe schrijfactie. // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents $result = file_put_contents( FIVENAMES_LLMTXT_FILE, $content ); return $result !== false; } /** * Bestaat het bestand? */ public function exists() { return file_exists( FIVENAMES_LLMTXT_FILE ); } /** * Bestandsgrootte in bytes (0 als niet bestaat). */ public function get_size() { if ( ! $this->exists() ) { return 0; } return filesize( FIVENAMES_LLMTXT_FILE ); } /** * Tijdstip van laatste wijziging (Unix timestamp, null als niet bestaat). */ public function get_modified_time() { if ( ! $this->exists() ) { return null; } return filemtime( FIVENAMES_LLMTXT_FILE ); } /** * Kan de plugin naar het bestand (of de root-map) schrijven? */ public function is_writable() { $path = $this->exists() ? FIVENAMES_LLMTXT_FILE : ABSPATH; if ( function_exists( 'WP_Filesystem' ) ) { global $wp_filesystem; if ( empty( $wp_filesystem ) ) { WP_Filesystem(); } if ( $wp_filesystem ) { return $wp_filesystem->is_writable( $path ); } } // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_is_writable return is_writable( $path ); } }