芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/itrema/wp-content/plugins/wp-table-reloaded/classes/export.class.php
export_formats = array( 'csv' => __( 'CSV - Character-Separated Values', WP_TABLE_RELOADED_TEXTDOMAIN ), 'html' => __( 'HTML - Hypertext Markup Language', WP_TABLE_RELOADED_TEXTDOMAIN ), 'xml' => __( 'XML - eXtended Markup Language', WP_TABLE_RELOADED_TEXTDOMAIN ) ); $this->delimiters = array( ';' => __( '; (semicolon)', WP_TABLE_RELOADED_TEXTDOMAIN ), ',' => __( ', (comma)', WP_TABLE_RELOADED_TEXTDOMAIN ), ':' => __( ': (colon)', WP_TABLE_RELOADED_TEXTDOMAIN ), '.' => __( '. (dot)', WP_TABLE_RELOADED_TEXTDOMAIN ), '|' => __( '| (pipe)', WP_TABLE_RELOADED_TEXTDOMAIN ) ); } // ################################################################################################################### function export_table() { $output = ''; $data = $this->table_to_export['data']; $data = stripslashes_deep( $data ); $rows = count( $data ); $cols = (0 < $rows) ? count( $data[0] ) : 0; switch( $this->export_format ) { case 'csv': if ( 0 < $rows && 0 < $cols) { $parseCSV = $this->create_class_instance( 'parseCSV', 'parsecsv.class.php' ); $parseCSV->output_filename = null; // no download initiated by parseCSV class // might need to do something about encoding here as well $output = $parseCSV->output( null, $data, array(), $this->delimiter ); } break; case 'xml': if ( 0 < $rows && 0 < $cols) { $output .= "\n"; $output .= "
\n"; foreach ( $data as $row_idx => $row ) { $output .= "\t
\n"; $row = array_map( array( &$this, 'xml_wrap_and_escape' ), $row ); $output .= implode( '', $row ); $output .= "\t
\n"; } $output .= '
'; } break; case 'html': if ( 0 < $rows && 0 < $cols) { $output .= "
\n"; foreach ( $data as $row_idx => $row ) { $output .= "\t
\n"; $row = array_map( array( &$this, 'html_wrap_and_escape' ), $row ); $output .= implode( '', $row ); $output .= "\t
\n"; } $output .= '
'; } break; default: } $this->exported_table = $output; } // ################################################################################################################### function xml_wrap_and_escape( $string ) { if ( $string != htmlspecialchars( $string ) ) $string = ""; return "\t\t
" . $string . "\n"; } // ################################################################################################################### function html_wrap_and_escape( $string ) { return "\t\t
" . $string . "
\n"; } // ################################################################################################################### function create_class_instance( $class, $file, $folder = 'classes' ) { if ( !class_exists( $class ) ) include_once ( WP_TABLE_RELOADED_ABSPATH . $folder . '/' . $file ); return new $class; } } // class WP_Table_Reloaded_Export ?>