$value ){ if ( $graphene_defaults[$key] === $value || $value === '' ) { unset( $data[$key] ); } } */ $data = json_encode( $data ); $size = strlen( $data ); header( 'Content-Type: text/plain' ); header( 'Content-Disposition: attachment; filename="'.$name.'"' ); header( "Content-Transfer-Encoding: binary" ); header( 'Accept-Ranges: bytes' ); /* The three lines below basically make the download non-cacheable */ header( "Cache-control: private" ); header( 'Pragma: private' ); header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header( "Content-Length: " . $size); print( $data ); } else { wp_die( __( 'ERROR: You are not authorised to perform that operation', 'graphene' ) ); } die(); } if ( isset( $_POST['graphene_export'] ) ){ add_action( 'init', 'graphene_export_options' ); } /** * This file manages the theme settings uploading and import operations. * Uses WP_Filesystem */ function graphene_import_form(){ $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $size = size_format( $bytes, 2 ); $upload_dir = wp_upload_dir(); if ( ! empty( $upload_dir['error'] ) ) : ?>
' . __( 'Options import completed.', 'graphene' ) . '
'; echo '' . __( '« Return to Graphene Options', 'graphene' ) . '
'; } else { // else: try to read the settings array echo ''.__( 'Sorry, there has been an error.', 'graphene' ).'
';
echo __( 'The uploaded file does not contain valid Graphene options.', 'graphene' ).'
' . __( 'Colour presets import completed.', 'graphene' ) . '
'; echo '' . __( '« Return to Graphene Options', 'graphene' ) . '
'; } else { // else: try to read the settings array echo ''.__( 'Sorry, there has been an error.', 'graphene' ).'
';
echo __( 'The uploaded file does not contain valid Graphene colour presets.', 'graphene' ).'
'.__( 'Sorry, there has been an error.', 'graphene' ).'
';
echo __( 'The uploaded file could not be read.', 'graphene' ).'
'.__( 'Sorry, there has been an error.', 'graphene' ).'
';
echo __( 'The uploaded file is not supported.', 'graphene' ).'
'.__( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.', 'graphene' ).'
'; } echo '