- $entries = array_filter($this->entries, create_function('$e', 'return !empty($e->translations);'));
+ $res = $this->export_to_file_handle( $fh );
+ fclose($fh);
+ return $res;
+ }
+
+ function export() {
+ $tmp_fh = fopen("php://temp", 'r+');
+ if ( !$tmp_fh ) return false;
+ $this->export_to_file_handle( $tmp_fh );
+ rewind( $tmp_fh );
+ return stream_get_contents( $tmp_fh );
+ }
+
+ function is_entry_good_for_export( $entry ) {
+ if ( empty( $entry->translations ) ) {
+ return false;
+ }
+
+ if ( !array_filter( $entry->translations ) ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ function export_to_file_handle($fh) {
+ $entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) );