Changeset 7207
- Timestamp:
- 05/14/2018 08:34:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/utilities/class-export-csv.php
r6596 r7207 293 293 die(); 294 294 } 295 296 /** 297 * Save the CSV file to a local directory. 298 * 299 * @param string $location The path of the directory to save the file in. 300 * 301 * @return bool|string 302 */ 303 public function save_file( $location ) { 304 if ( ! $this->filename ) { 305 $this->error->add( 306 'csv_error', 307 'Could not generate a CSV file without a file name.' 308 ); 309 } 310 311 if ( ! wp_is_writable( $location ) ) { 312 $this->error->add( 313 'filesystem_error', 314 'The specified location is not writable.' 315 ); 316 317 return false; 318 } 319 320 $full_path = trailingslashit( $location ) . $this->filename; 321 $content = $this->generate_file_content(); 322 323 $file = fopen( $full_path, 'w' ); 324 fwrite( $file, $content ); 325 fclose( $file ); 326 327 return $full_path; 328 } 295 329 }
Note: See TracChangeset
for help on using the changeset viewer.