Advanced Order Export For WooCommerce - Version 3.0.2

Version Description

  • 2019-08-20 =
  • Added "Summary by customers" report
  • Format PDF supports UTF8 chars
  • Added filter "Exclude products" to section "Filter by product"
  • New tab "Other items" (in section "Setup fields") allows to export tax/fee/shipping
  • Fixed bug - XLS export stops at wrong dates
  • Fixed bug - button "ESC" doesn't abort export (Safari only)
Download this release

Release Info

Developer algol.plus
Plugin Icon 128x128 Advanced Order Export For WooCommerce
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.2

Files changed (42) hide show
  1. assets/css/export.css +19 -0
  2. assets/js/buttons.js +36 -32
  3. assets/js/export-fields.js +287 -10
  4. assets/js/filters.js +11 -2
  5. assets/js/settings-form.js +3 -1
  6. classes/FPDF/class-woe-fpdf-tt-font-file.php +1458 -0
  7. classes/FPDF/class-woe-fpdf.php +3046 -1807
  8. classes/FPDF/class-woe-pdf-mc-table.php +187 -54
  9. classes/FPDF/exception/class-woe-fpdf-exception.php +53 -0
  10. classes/FPDF/font/OpenSans-Bold.ttf +0 -0
  11. classes/FPDF/font/OpenSans-Regular.ttf +0 -0
  12. classes/FPDF/font/courier.php +0 -10
  13. classes/FPDF/font/courierb.php +0 -10
  14. classes/FPDF/font/courierbi.php +0 -10
  15. classes/FPDF/font/courieri.php +0 -10
  16. classes/FPDF/font/helvetica.php +0 -21
  17. classes/FPDF/font/helveticab.php +0 -21
  18. classes/FPDF/font/helveticabi.php +0 -21
  19. classes/FPDF/font/helveticai.php +0 -21
  20. classes/FPDF/font/symbol.php +0 -20
  21. classes/FPDF/font/times.php +0 -21
  22. classes/FPDF/font/timesb.php +0 -21
  23. classes/FPDF/font/timesbi.php +0 -21
  24. classes/FPDF/font/timesi.php +0 -21
  25. classes/FPDF/font/zapfdingbats.php +0 -20
  26. classes/PHPExcel/Shared/PCLZip/pclzip.lib.php +3 -3
  27. classes/admin/class-wc-order-export-labels.php +1 -2
  28. classes/admin/class-wc-order-export-manage.php +24 -15
  29. classes/admin/class-wc-order-export-settings.php +6 -0
  30. classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-filters.php +27 -0
  31. classes/class-wc-order-export-admin.php +11 -4
  32. classes/core/class-wc-order-export-data-extractor-ui.php +49 -30
  33. classes/core/class-wc-order-export-data-extractor.php +159 -8
  34. classes/core/class-wc-order-export-engine.php +1 -1
  35. classes/formats/abstract-class-woe-formatter-plain-format.php +144 -12
  36. classes/formats/class-woe-formatter-pdf.php +11 -2
  37. classes/formats/class-woe-formatter-xls.php +5 -2
  38. classes/formats/trait-woe-plain-format.php +1 -1
  39. i18n/languages/woo-order-export-lite.pot +969 -906
  40. readme.txt +9 -1
  41. view/settings-form.php +155 -19
  42. woo-order-export-lite.php +3 -3
assets/css/export.css CHANGED
@@ -748,4 +748,23 @@ input.date {
748
 
749
  .default-html-css-label {
750
  display: block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
751
  }
748
 
749
  .default-html-css-label {
750
  display: block;
751
+ }
752
+
753
+ #manage_fields.summary-customers-report .fields-control-block,
754
+ #manage_fields.summary-customers-report #order_fields .mapping_row,
755
+ #manage_fields.summary-customers-report #unselected_fields .subsubsub .block-segment-choice,
756
+ #manage_fields.summary-customers-report #unselected_fields .subsubsub .block-segment-choice[data-segment="shipping"] .divider {
757
+ display: none;
758
+ }
759
+
760
+ #manage_fields.summary-customers-report #order_fields .mapping_row.segment_user,
761
+ #manage_fields.summary-customers-report #order_fields .mapping_row.segment_billing,
762
+ #manage_fields.summary-customers-report #order_fields .mapping_row.segment_shipping {
763
+ display: block;
764
+ }
765
+
766
+ #manage_fields.summary-customers-report #unselected_fields .subsubsub .block-segment-choice[data-segment="user"],
767
+ #manage_fields.summary-customers-report #unselected_fields .subsubsub .block-segment-choice[data-segment="billing"],
768
+ #manage_fields.summary-customers-report #unselected_fields .subsubsub .block-segment-choice[data-segment="shipping"] {
769
+ display: inline;
770
  }
assets/js/buttons.js CHANGED
@@ -102,38 +102,42 @@ function woe_waiting_dialog() {
102
 
103
  jQuery( "#background" ).addClass( "loading" );
104
 
105
- jQuery( '#wpbody-content' ).keydown( function ( event ) {
106
- if ( event.keyCode == 27 ) {
107
- if ( ! window.cancelling ) {
108
- event.preventDefault();
109
- window.cancelling = true;
110
-
111
- jQuery.ajax( {
112
- type: "post",
113
- data: {
114
- action: 'order_exporter',
115
- method: 'cancel_export',
116
- file_id: window.file_id,
117
- },
118
- cache: false,
119
- url: ajaxurl,
120
- dataType: "json",
121
- error: function ( xhr, status, error ) {
122
- alert( xhr.responseText );
123
- woe_export_progress( 100, jQuery( '#progressBar' ) );
124
- },
125
- success: function ( response ) {
126
- woe_export_progress( 100, jQuery( '#progressBar' ) );
127
- }
128
- } );
129
-
130
- window.count = 0;
131
- window.file_id = '';
132
- jQuery( '#wpbody-content' ).off( 'keydown' );
133
- }
134
- return false;
135
- }
136
- } );
 
 
 
 
137
  }
138
 
139
  function woe_export_progress( percent, $element ) {
102
 
103
  jQuery( "#background" ).addClass( "loading" );
104
 
105
+ jQuery( document ).on ('keydown', stop_export );
106
+ }
107
+
108
+ function stop_export(event) {
109
+ if ( event.keyCode == 27 ) {
110
+ if ( ! window.cancelling ) {
111
+ event.preventDefault();
112
+ window.cancelling = true;
113
+
114
+ jQuery.ajax( {
115
+ type: "post",
116
+ data: {
117
+ action: 'order_exporter',
118
+ method: 'cancel_export',
119
+ file_id: window.file_id,
120
+ woe_nonce: settings_form.woe_nonce,
121
+ tab: settings_form.woe_active_tab,
122
+ },
123
+ cache: false,
124
+ url: ajaxurl,
125
+ dataType: "json",
126
+ error: function ( xhr, status, error ) {
127
+ alert( xhr.responseText );
128
+ woe_export_progress( 100, jQuery( '#progressBar' ) );
129
+ },
130
+ success: function ( response ) {
131
+ woe_export_progress( 100, jQuery( '#progressBar' ) );
132
+ }
133
+ } );
134
+
135
+ window.count = 0;
136
+ window.file_id = '';
137
+ jQuery( document ).off( 'keydown', stop_export );
138
+ }
139
+ return false;
140
+ }
141
  }
142
 
143
  function woe_export_progress( percent, $element ) {
assets/js/export-fields.js CHANGED
@@ -506,7 +506,10 @@ function woe_activate_draggable_field( el, segment, format ) {
506
  woe_moving_products_and_coupons_group_blocks_to_first_item( format );
507
 
508
  // change static field key index to prevent fields with identical keys
509
- var tmp_prefix = ['products', 'coupons'].indexOf( segment ) === - 1 ? '' : 'plain_' + segment + '_';
 
 
 
510
  if ( jQuery( ui.helper[0] ).find( 'input[value*="' + tmp_prefix + 'static_field"]' ).length > 0 ) {
511
  var suffix = 0;
512
  jQuery( '#order_fields input[value*="' + tmp_prefix + 'static_field_"]' ).each( function () {
@@ -524,10 +527,13 @@ function woe_activate_draggable_field( el, segment, format ) {
524
  }
525
  } );
526
 
527
- var field_key = tmp_prefix + 'static_field_' + (
528
- suffix + 1
529
- );
530
- jQuery( ui.helper[0] ).find( 'input[name="orders[][key]"]' ).first().val( field_key );
 
 
 
531
  }
532
  // end change static field key
533
 
@@ -935,9 +941,14 @@ function woe_add_custom_meta( to, index_p, format, label, colname, segment, form
935
  }
936
 
937
  function woe_reset_field_contorls() {
938
- jQuery( '.tab-actions-forms' )
939
- .find( 'input,select' )
940
- .val( '' );
 
 
 
 
 
941
  }
942
 
943
  function woe_escape_str( str ) {
@@ -972,6 +983,16 @@ jQuery( document ).ready( function ( $ ) {
972
 
973
  $( '.segment_choice' ).click( function () {
974
 
 
 
 
 
 
 
 
 
 
 
975
  $( '.segment_choice' ).removeClass( 'active' );
976
  $( this ).addClass( 'active' );
977
 
@@ -980,11 +1001,11 @@ jQuery( document ).ready( function ( $ ) {
980
 
981
  window.location.href = $( this ).attr( 'href' );
982
 
983
- jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' ).find( 'input,select' ).val( '' );
984
  } );
985
 
986
  setTimeout( function () {
987
- if ( summary_mode ) {
988
  $( '.segment_choice[href="products"]' ).click()
989
  } else if ( window.location.hash.indexOf( 'segment' ) !== - 1 ) {
990
  $( '.segment_choice[href="' + window.location.hash + '"]' ).click()
@@ -1080,6 +1101,12 @@ jQuery( document ).ready( function ( $ ) {
1080
  .removeClass( 'active' )
1081
  .find( 'input,select' ).val( '' );
1082
 
 
 
 
 
 
 
1083
  return false;
1084
  } );
1085
 
@@ -1172,6 +1199,183 @@ jQuery( document ).ready( function ( $ ) {
1172
  return false;
1173
  });
1174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1175
  ///*CUSTOM FIELDS BINDS
1176
 
1177
  jQuery( 'input[name=custom_meta_order_mode]' ).change( function () {
@@ -1331,6 +1535,8 @@ jQuery( document ).ready( function ( $ ) {
1331
 
1332
  jQuery( '#manage_fields' ).toggleClass( 'summary-products-report', ! ! jQuery( this ).prop( 'checked' ) );
1333
 
 
 
1334
  $( '#unselected_fields .segment_choice' ).removeClass( 'active' );
1335
  $( '#unselected_fields_list .settings-segment' ).removeClass( 'active' );
1336
 
@@ -1400,8 +1606,79 @@ jQuery( document ).ready( function ( $ ) {
1400
 
1401
  } );
1402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1403
  setTimeout( function () {
1404
  jQuery( "#summary_report_by_products_checkbox" ).trigger( 'change', 'onstart' );
1405
  }, 1 )
1406
 
 
 
 
 
1407
  } );
506
  woe_moving_products_and_coupons_group_blocks_to_first_item( format );
507
 
508
  // change static field key index to prevent fields with identical keys
509
+ var tmp_prefix = '';
510
+ if ( woe_is_flat_format( format ) && ['products', 'coupons'].indexOf( segment ) > - 1 ) {
511
+ tmp_prefix = 'plain_' + segment + '_';
512
+ }
513
  if ( jQuery( ui.helper[0] ).find( 'input[value*="' + tmp_prefix + 'static_field"]' ).length > 0 ) {
514
  var suffix = 0;
515
  jQuery( '#order_fields input[value*="' + tmp_prefix + 'static_field_"]' ).each( function () {
527
  }
528
  } );
529
 
530
+ var field_key = tmp_prefix + 'static_field_' + (suffix + 1);
531
+
532
+ if ( ! woe_is_flat_format( format ) && ['products', 'coupons'].indexOf( segment ) > - 1 ) {
533
+ jQuery( ui.helper[0] ).find( 'input[name="' + segment + '[][key]"]' ).first().val( field_key );
534
+ } else {
535
+ jQuery( ui.helper[0] ).find( 'input[name="orders[][key]"]' ).first().val( field_key );
536
+ }
537
  }
538
  // end change static field key
539
 
941
  }
942
 
943
  function woe_reset_field_contorls() {
944
+
945
+ jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' ).find( 'input,select' ).val( '' )
946
+
947
+ jQuery( '.tab-actions-forms .segment-form select' ).each(function () {
948
+ if (jQuery(this).find('option[selected]')) {
949
+ jQuery(this).val(jQuery(this).find('option[selected]').attr('value'));
950
+ }
951
+ });
952
  }
953
 
954
  function woe_escape_str( str ) {
983
 
984
  $( '.segment_choice' ).click( function () {
985
 
986
+ var segment = $( this ).data( 'segment' );
987
+
988
+ $('.tab-actions-buttons').hide();
989
+
990
+ if ($('.tab-actions-buttons.' + segment + '-actions-buttons').length) {
991
+ $('.tab-actions-buttons.' + segment + '-actions-buttons').show();
992
+ } else {
993
+ $('.tab-actions-buttons.default-actions').show();
994
+ }
995
+
996
  $( '.segment_choice' ).removeClass( 'active' );
997
  $( this ).addClass( 'active' );
998
 
1001
 
1002
  window.location.href = $( this ).attr( 'href' );
1003
 
1004
+ woe_reset_field_contorls();
1005
  } );
1006
 
1007
  setTimeout( function () {
1008
+ if ( summary_mode_by_products ) {
1009
  $( '.segment_choice[href="products"]' ).click()
1010
  } else if ( window.location.hash.indexOf( 'segment' ) !== - 1 ) {
1011
  $( '.segment_choice[href="' + window.location.hash + '"]' ).click()
1101
  .removeClass( 'active' )
1102
  .find( 'input,select' ).val( '' );
1103
 
1104
+ jQuery( this ).closest( '.segment-form' ).find( 'select' ).each(function () {
1105
+ if (jQuery(this).find('option[selected]')) {
1106
+ jQuery(this).val(jQuery(this).find('option[selected]').attr('value'));
1107
+ }
1108
+ });
1109
+
1110
  return false;
1111
  } );
1112
 
1199
  return false;
1200
  });
1201
 
1202
+ jQuery( '.tab-controls .other_items-actions-buttons .add-fee' ).on( 'click', function () {
1203
+ jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' );
1204
+ jQuery( '.tab-actions-forms .segment-form.other-items-add-fee-form' ).addClass( 'active' );
1205
+ return false;
1206
+ } );
1207
+
1208
+ jQuery( '.other-items-add-fee-form #button_other_items_add_fee_field' ).on( 'click', function () {
1209
+
1210
+ var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
1211
+
1212
+ var label = jQuery( '#select_fee_items' ).val();
1213
+ var colname = jQuery( '#colname_fee_item_other_items' ).val();
1214
+
1215
+ if ( ! label ) {
1216
+ alert( export_messages.empty_meta_key );
1217
+ jQuery( '#select_fee_items' ).focus();
1218
+ return false
1219
+ }
1220
+
1221
+ if ( ! colname ) {
1222
+ alert( export_messages.empty_column_name );
1223
+ jQuery( '#colname_fee_item_other_items' ).focus();
1224
+ return false
1225
+ }
1226
+
1227
+ var format_field = jQuery( '#format_fee_item_other_items' ).val();
1228
+
1229
+ woe_add_custom_meta(jQuery("#" + segment + '_unselected_segment'), 'orders', output_format, label, colname, segment, format_field);
1230
+
1231
+ jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
1232
+
1233
+ return false;
1234
+ } );
1235
+
1236
+ function load_order_fee_items() {
1237
+
1238
+ jQuery.post(
1239
+ ajaxurl,
1240
+ {
1241
+ action: 'order_exporter',
1242
+ method: 'get_used_order_fee_items',
1243
+ woe_nonce: settings_form.woe_nonce,
1244
+ tab: settings_form.woe_active_tab,
1245
+ },
1246
+ function ( response ) {
1247
+ if ( response ) {
1248
+ var options = '';
1249
+ jQuery.each( response, function ( index, value ) {
1250
+ options += '<option value="' + woe_escape_str( value ) + '">' + value.replace('FEE_', '') + '</option>';
1251
+ } );
1252
+ jQuery( '#select_fee_items' ).html( options );
1253
+ }
1254
+ },
1255
+ 'json'
1256
+ );
1257
+ }
1258
+
1259
+ load_order_fee_items();
1260
+
1261
+ jQuery( '.tab-controls .other_items-actions-buttons .add-shipping' ).on( 'click', function () {
1262
+ jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' );
1263
+ jQuery( '.tab-actions-forms .segment-form.other-items-add-shipping-form' ).addClass( 'active' );
1264
+ return false;
1265
+ } );
1266
+
1267
+ jQuery( '.other-items-add-shipping-form #button_other_items_add_shipping_field' ).on( 'click', function () {
1268
+
1269
+ var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
1270
+
1271
+ var label = jQuery( '#select_shipping_items' ).val();
1272
+ var colname = jQuery( '#colname_shipping_item_other_items' ).val();
1273
+
1274
+ if ( ! label ) {
1275
+ alert( export_messages.empty_meta_key );
1276
+ jQuery( '#select_shipping_items' ).focus();
1277
+ return false
1278
+ }
1279
+
1280
+ if ( ! colname ) {
1281
+ alert( export_messages.empty_column_name );
1282
+ jQuery( '#colname_shipping_item_other_items' ).focus();
1283
+ return false
1284
+ }
1285
+
1286
+ var format_field = jQuery( '#format_shipping_item_other_items' ).val();
1287
+
1288
+ woe_add_custom_meta(jQuery("#" + segment + '_unselected_segment'), 'orders', output_format, label, colname, segment, format_field);
1289
+
1290
+ jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
1291
+
1292
+ return false;
1293
+ } );
1294
+
1295
+ function load_order_shipping_items() {
1296
+
1297
+ jQuery.post(
1298
+ ajaxurl,
1299
+ {
1300
+ action: 'order_exporter',
1301
+ method: 'get_used_order_shipping_items',
1302
+ woe_nonce: settings_form.woe_nonce,
1303
+ tab: settings_form.woe_active_tab,
1304
+ },
1305
+ function ( response ) {
1306
+ if ( response ) {
1307
+ var options = '';
1308
+ jQuery.each( response, function ( index, value ) {
1309
+ options += '<option value="' + woe_escape_str( value ) + '">' + value.replace('SHIPPING_', '') + '</option>';
1310
+ } );
1311
+ jQuery( '#select_shipping_items' ).html( options );
1312
+ }
1313
+ },
1314
+ 'json'
1315
+ );
1316
+ }
1317
+
1318
+ load_order_shipping_items();
1319
+
1320
+ jQuery( '.tab-controls .other_items-actions-buttons .add-tax' ).on( 'click', function () {
1321
+ jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' );
1322
+ jQuery( '.tab-actions-forms .segment-form.other-items-add-tax-form' ).addClass( 'active' );
1323
+ return false;
1324
+ } );
1325
+
1326
+ jQuery( '.other-items-add-tax-form #button_other_items_add_tax_field' ).on( 'click', function () {
1327
+
1328
+ var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
1329
+
1330
+ var label = jQuery( '#select_tax_items' ).val();
1331
+ var colname = jQuery( '#colname_tax_item_other_items' ).val();
1332
+
1333
+ if ( ! label ) {
1334
+ alert( export_messages.empty_meta_key );
1335
+ jQuery( '#select_tax_items' ).focus();
1336
+ return false
1337
+ }
1338
+
1339
+ if ( ! colname ) {
1340
+ alert( export_messages.empty_column_name );
1341
+ jQuery( '#colname_tax_item_other_items' ).focus();
1342
+ return false
1343
+ }
1344
+
1345
+ var format_field = jQuery( '#format_tax_item_other_items' ).val();
1346
+
1347
+ woe_add_custom_meta(jQuery("#" + segment + '_unselected_segment'), 'orders', output_format, label, colname, segment, format_field);
1348
+
1349
+ jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
1350
+
1351
+ return false;
1352
+ } );
1353
+
1354
+ function load_order_tax_items() {
1355
+
1356
+ jQuery.post(
1357
+ ajaxurl,
1358
+ {
1359
+ action: 'order_exporter',
1360
+ method: 'get_used_order_tax_items',
1361
+ woe_nonce: settings_form.woe_nonce,
1362
+ tab: settings_form.woe_active_tab,
1363
+ },
1364
+ function ( response ) {
1365
+ if ( response ) {
1366
+ var options = '';
1367
+ jQuery.each( response, function ( index, value ) {
1368
+ options += '<option value="' + woe_escape_str( value ) + '">' + value.replace('TAX_', '') + '</option>';
1369
+ } );
1370
+ jQuery( '#select_tax_items' ).html( options );
1371
+ }
1372
+ },
1373
+ 'json'
1374
+ );
1375
+ }
1376
+
1377
+ load_order_tax_items();
1378
+
1379
  ///*CUSTOM FIELDS BINDS
1380
 
1381
  jQuery( 'input[name=custom_meta_order_mode]' ).change( function () {
1535
 
1536
  jQuery( '#manage_fields' ).toggleClass( 'summary-products-report', ! ! jQuery( this ).prop( 'checked' ) );
1537
 
1538
+ $('#summary_report_by_customers_checkbox').prop( 'disabled', !!jQuery( this ).prop( 'checked' ) );
1539
+
1540
  $( '#unselected_fields .segment_choice' ).removeClass( 'active' );
1541
  $( '#unselected_fields_list .settings-segment' ).removeClass( 'active' );
1542
 
1606
 
1607
  } );
1608
 
1609
+ //logic for setup link
1610
+ jQuery( "#summary_report_by_customers_checkbox" ).change( function ( e, action ) {
1611
+
1612
+ var summary_report_fields = [];
1613
+
1614
+ summary_report_fields.push( $( '#user_unselected_segment input[value="summary_report_total_count"]' ).parents( 'li' ) );
1615
+ summary_report_fields.push( $( '#user_unselected_segment input[value="summary_report_total_amount"]' ).parents( 'li' ) );
1616
+ summary_report_fields.push( $( '#user_unselected_segment input[value="summary_report_total_amount_paid"]' ).parents( 'li' ) );
1617
+ summary_report_fields.push( $( '#user_unselected_segment input[value="summary_report_total_refund_count"]' ).parents( 'li' ) );
1618
+ summary_report_fields.push( $( '#user_unselected_segment input[value="summary_report_total_refund_amount"]' ).parents( 'li' ) );
1619
+
1620
+ jQuery( '#manage_fields' ).toggleClass( 'summary-customers-report', ! ! jQuery( this ).prop( 'checked' ) );
1621
+
1622
+ $('#summary_report_by_products_checkbox').prop( 'disabled', !!jQuery( this ).prop( 'checked' ) );
1623
+
1624
+ $( '#unselected_fields .segment_choice' ).removeClass( 'active' );
1625
+ $( '#unselected_fields_list .settings-segment' ).removeClass( 'active' );
1626
+
1627
+ if ( jQuery( this ).prop( 'checked' ) ) {
1628
+
1629
+ var segment = 'user';
1630
+
1631
+ if ( 'onstart' !== action ) {
1632
+ // purge summary report fields before insert
1633
+ $( '#order_fields .segment_user input[value="summary_report_total_count"]' ).closest( '.mapping_row' ).remove();
1634
+ $( '#order_fields .segment_user input[value="summary_report_total_amount"]' ).closest( '.mapping_row' ).remove();
1635
+ $( '#order_fields .segment_user input[value="summary_report_total_amount_paid"]' ).closest( '.mapping_row' ).remove();
1636
+ $( '#order_fields .segment_user input[value="summary_report_total_refund_count"]' ).closest( '.mapping_row' ).remove();
1637
+ $( '#order_fields .segment_user input[value="summary_report_total_refund_amount"]' ).closest( '.mapping_row' ).remove();
1638
+
1639
+ // insert summary report fields
1640
+ jQuery.each( summary_report_fields, function ( i, value ) {
1641
+ $( value ).show();
1642
+ var $field_to_copy = $( value ).clone();
1643
+ $field_to_copy
1644
+ .attr( 'style', '' )
1645
+ .addClass( 'ui-draggabled' )
1646
+ .removeClass( 'segment_field' )
1647
+ .find( 'input' ).prop( 'disabled', false );
1648
+
1649
+ jQuery( '#manage_fields #order_fields' ).append( $field_to_copy );
1650
+ } );
1651
+ }
1652
+
1653
+ $( '#unselected_fields .segment_choice[data-segment="' + segment + '"]' ).addClass( 'active' );
1654
+ $( '#unselected_fields_list .settings-segment#' + segment + '_unselected_segment' ).addClass( 'active' );
1655
+
1656
+ } else {
1657
+ var segment = window.location.hash.replace( '#segment=', '' );
1658
+
1659
+ // purge summary report fields
1660
+ $( '#order_fields .segment_user input[value="summary_report_total_count"]' ).closest( '.mapping_row' ).remove();
1661
+ $( '#order_fields .segment_user input[value="summary_report_total_amount"]' ).closest( '.mapping_row' ).remove();
1662
+ $( '#order_fields .segment_user input[value="summary_report_total_amount_paid"]' ).closest( '.mapping_row' ).remove();
1663
+ $( '#order_fields .segment_user input[value="summary_report_total_refund_count"]' ).closest( '.mapping_row' ).remove();
1664
+ $( '#order_fields .segment_user input[value="summary_report_total_refund_amount"]' ).closest( '.mapping_row' ).remove();
1665
+
1666
+ jQuery.each( summary_report_fields, function ( i, value ) {
1667
+ $( value ).hide();
1668
+ } );
1669
+ }
1670
+
1671
+ $( '#unselected_fields .segment_choice[data-segment="' + segment + '"]' ).addClass( 'active' );
1672
+ $( '#unselected_fields_list .settings-segment#' + segment + '_unselected_segment' ).addClass( 'active' );
1673
+
1674
+ } );
1675
+
1676
  setTimeout( function () {
1677
  jQuery( "#summary_report_by_products_checkbox" ).trigger( 'change', 'onstart' );
1678
  }, 1 )
1679
 
1680
+ setTimeout( function () {
1681
+ jQuery( "#summary_report_by_customers_checkbox" ).trigger( 'change', 'onstart' );
1682
+ }, 1 )
1683
+
1684
  } );
assets/js/filters.js CHANGED
@@ -27,6 +27,7 @@ jQuery( document ).ready( function ( $ ) {
27
  action: "order_exporter",
28
  woe_nonce: settings_form.woe_nonce,
29
  tab: settings_form.woe_active_tab,
 
30
  };
31
 
32
  var val_op = jQuery( '#attributes_compare' ).val();
@@ -119,6 +120,7 @@ jQuery( document ).ready( function ( $ ) {
119
  action: "order_exporter",
120
  woe_nonce: settings_form.woe_nonce,
121
  tab: settings_form.woe_active_tab,
 
122
  };
123
 
124
  var val_op = jQuery( '#itemmeta_compare' ).val();
@@ -237,6 +239,7 @@ jQuery( document ).ready( function ( $ ) {
237
  action: "order_exporter",
238
  woe_nonce: settings_form.woe_nonce,
239
  tab: settings_form.woe_active_tab,
 
240
  };
241
 
242
  var val_op = jQuery( '#taxonomies_compare' ).val();
@@ -328,6 +331,7 @@ jQuery( document ).ready( function ( $ ) {
328
  action: "order_exporter",
329
  woe_nonce: settings_form.woe_nonce,
330
  tab: settings_form.woe_active_tab,
 
331
  };
332
 
333
  var val_op = jQuery( '#product_custom_fields_compare' ).val();
@@ -419,6 +423,7 @@ jQuery( document ).ready( function ( $ ) {
419
  action: "order_exporter",
420
  woe_nonce: settings_form.woe_nonce,
421
  tab: settings_form.woe_active_tab,
 
422
  };
423
 
424
  jQuery.post( ajaxurl, data, function ( response ) {
@@ -480,6 +485,7 @@ jQuery( document ).ready( function ( $ ) {
480
  action: "order_exporter",
481
  woe_nonce: settings_form.woe_nonce,
482
  tab: settings_form.woe_active_tab,
 
483
  };
484
 
485
  jQuery.post( ajaxurl, data, function ( response ) {
@@ -542,6 +548,7 @@ jQuery( document ).ready( function ( $ ) {
542
  action: "order_exporter",
543
  woe_nonce: settings_form.woe_nonce,
544
  tab: settings_form.woe_active_tab,
 
545
  };
546
 
547
  jQuery.post( ajaxurl, data, function ( response ) {
@@ -612,6 +619,7 @@ jQuery( document ).ready( function ( $ ) {
612
  action: "order_exporter",
613
  woe_nonce: settings_form.woe_nonce,
614
  tab: settings_form.woe_active_tab,
 
615
  };
616
 
617
  jQuery.post( ajaxurl, data, function ( response ) {
@@ -642,8 +650,7 @@ jQuery( document ).ready( function ( $ ) {
642
  } ).trigger( 'change' );
643
 
644
  jQuery( '#add_item_metadata' ).click( function () {
645
-
646
- var val = jQuery( "#text_item_metadata" ).val();
647
  var val2 = jQuery( '#item_metadata' ).val();
648
  var val_op = jQuery( '#item_metadata_compare' ).val();
649
  if ( val != null && val2 != null && val.length && val2.length ) {
@@ -681,6 +688,7 @@ jQuery( document ).ready( function ( $ ) {
681
  action: "order_exporter",
682
  woe_nonce: settings_form.woe_nonce,
683
  tab: settings_form.woe_active_tab,
 
684
  };
685
  var val_op = jQuery( '#select_user_custom_fields' ).val();
686
  jQuery( '#text_user_custom_fields' ).val( '' );
@@ -778,6 +786,7 @@ jQuery( document ).ready( function ( $ ) {
778
  action: "order_exporter",
779
  woe_nonce: settings_form.woe_nonce,
780
  tab: settings_form.woe_active_tab,
 
781
  };
782
 
783
  var val_op = jQuery( '#custom_fields_compare' ).val();
27
  action: "order_exporter",
28
  woe_nonce: settings_form.woe_nonce,
29
  tab: settings_form.woe_active_tab,
30
+ woe_order_post_type: woe_order_post_type,
31
  };
32
 
33
  var val_op = jQuery( '#attributes_compare' ).val();
120
  action: "order_exporter",
121
  woe_nonce: settings_form.woe_nonce,
122
  tab: settings_form.woe_active_tab,
123
+ woe_order_post_type: woe_order_post_type,
124
  };
125
 
126
  var val_op = jQuery( '#itemmeta_compare' ).val();
239
  action: "order_exporter",
240
  woe_nonce: settings_form.woe_nonce,
241
  tab: settings_form.woe_active_tab,
242
+ woe_order_post_type: woe_order_post_type,
243
  };
244
 
245
  var val_op = jQuery( '#taxonomies_compare' ).val();
331
  action: "order_exporter",
332
  woe_nonce: settings_form.woe_nonce,
333
  tab: settings_form.woe_active_tab,
334
+ woe_order_post_type: woe_order_post_type,
335
  };
336
 
337
  var val_op = jQuery( '#product_custom_fields_compare' ).val();
423
  action: "order_exporter",
424
  woe_nonce: settings_form.woe_nonce,
425
  tab: settings_form.woe_active_tab,
426
+ woe_order_post_type: woe_order_post_type,
427
  };
428
 
429
  jQuery.post( ajaxurl, data, function ( response ) {
485
  action: "order_exporter",
486
  woe_nonce: settings_form.woe_nonce,
487
  tab: settings_form.woe_active_tab,
488
+ woe_order_post_type: woe_order_post_type,
489
  };
490
 
491
  jQuery.post( ajaxurl, data, function ( response ) {
548
  action: "order_exporter",
549
  woe_nonce: settings_form.woe_nonce,
550
  tab: settings_form.woe_active_tab,
551
+ woe_order_post_type: woe_order_post_type,
552
  };
553
 
554
  jQuery.post( ajaxurl, data, function ( response ) {
619
  action: "order_exporter",
620
  woe_nonce: settings_form.woe_nonce,
621
  tab: settings_form.woe_active_tab,
622
+ woe_order_post_type: woe_order_post_type,
623
  };
624
 
625
  jQuery.post( ajaxurl, data, function ( response ) {
650
  } ).trigger( 'change' );
651
 
652
  jQuery( '#add_item_metadata' ).click( function () {
653
+ var val = ! jQuery( "#text_item_metadata" ).is( ':disabled' ) ? jQuery( "#text_item_metadata" ).val() : jQuery( "#text_order_itemmetadata" ).val();
 
654
  var val2 = jQuery( '#item_metadata' ).val();
655
  var val_op = jQuery( '#item_metadata_compare' ).val();
656
  if ( val != null && val2 != null && val.length && val2.length ) {
688
  action: "order_exporter",
689
  woe_nonce: settings_form.woe_nonce,
690
  tab: settings_form.woe_active_tab,
691
+ woe_order_post_type: woe_order_post_type,
692
  };
693
  var val_op = jQuery( '#select_user_custom_fields' ).val();
694
  jQuery( '#text_user_custom_fields' ).val( '' );
786
  action: "order_exporter",
787
  woe_nonce: settings_form.woe_nonce,
788
  tab: settings_form.woe_active_tab,
789
+ woe_order_post_type: woe_order_post_type,
790
  };
791
 
792
  var val_op = jQuery( '#custom_fields_compare' ).val();
assets/js/settings-form.js CHANGED
@@ -45,8 +45,10 @@ function woe_change_filename_ext() {
45
  function woe_show_summary_report( ext ) {
46
  if ( woe_is_flat_format( ext ) ) {
47
  jQuery( '#summary_report_by_products' ).show();
 
48
  } else {
49
  jQuery( '#summary_report_by_products' ).hide();
 
50
  jQuery( '#summary_setup_fields' ).hide();
51
  jQuery( '#summary_report_by_products_checkbox' ).prop( 'checked', false ).trigger( 'change' );
52
  }
@@ -224,7 +226,7 @@ jQuery( document ).ready( function ( $ ) {
224
 
225
  woe_show_summary_report( output_format );
226
 
227
- if ( ! summary_mode ) {
228
  jQuery( '#summary_setup_fields' ).hide();
229
  }
230
 
45
  function woe_show_summary_report( ext ) {
46
  if ( woe_is_flat_format( ext ) ) {
47
  jQuery( '#summary_report_by_products' ).show();
48
+ jQuery( '#summary_report_by_customers' ).show();
49
  } else {
50
  jQuery( '#summary_report_by_products' ).hide();
51
+ jQuery( '#summary_report_by_customers' ).hide();
52
  jQuery( '#summary_setup_fields' ).hide();
53
  jQuery( '#summary_report_by_products_checkbox' ).prop( 'checked', false ).trigger( 'change' );
54
  }
226
 
227
  woe_show_summary_report( output_format );
228
 
229
+ if ( ! summary_mode_by_products ) {
230
  jQuery( '#summary_setup_fields' ).hide();
231
  }
232
 
classes/FPDF/class-woe-fpdf-tt-font-file.php ADDED
@@ -0,0 +1,1458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ mb_internal_encoding('utf-8'); // @important
3
+
4
+
5
+ class WOE_FPDF_TT_Font_File
6
+ {
7
+ private $gfWords = 0b1;
8
+ private $gfScale = 0b1000;
9
+ private $gfMore = 0b100000;
10
+ private $gfXYScale = 0b1000000;
11
+ private $gfTwoByTwo = 0b10000000;
12
+
13
+ // Define the value used in the "head" table of a created TTF file
14
+ // 0x74727565 "true" for Mac
15
+ // 0x00010000 for Windows
16
+ // Either seems to work for a font embedded in a PDF file
17
+ // when read by Adobe Reader on a Windows PC(!)
18
+ private $ttf_mac_header = false;
19
+
20
+ private $maxUni;
21
+ private $_pos;
22
+ private $numTables;
23
+ private $searchRange;
24
+ private $entrySelector;
25
+ private $rangeShift;
26
+ private $tables;
27
+ private $otables;
28
+ private $filename;
29
+ private $fh;
30
+ private $glyphPos;
31
+ private $charToGlyph;
32
+ private $codeToGlyph;
33
+ private $ascent;
34
+ private $descent;
35
+ private $name;
36
+ private $familyName;
37
+ private $styleName;
38
+ private $fullName;
39
+ private $uniqueFontID;
40
+ private $unitsPerEm;
41
+ private $bbox;
42
+ private $capHeight;
43
+ private $stemV;
44
+ private $italicAngle;
45
+ private $flags;
46
+ private $underlinePosition;
47
+ private $underlineThickness;
48
+ private $charWidths;
49
+ private $defaultWidth;
50
+ private $maxStrLenRead;
51
+
52
+ public function __construct()
53
+ {
54
+ $this->maxStrLenRead = 200000; // Maximum size of glyf table to read in as string (otherwise reads each glyph from file)
55
+ }
56
+
57
+ public function getMetrics($file)
58
+ {
59
+ if (!file_exists($file)) {
60
+ throw new \RuntimeException('Can\'t open file ' . $file);
61
+ }
62
+
63
+ $this->filename = $file;
64
+ $this->fh = fopen($file, 'rb');
65
+ $this->_pos = 0;
66
+ $this->charWidths = '';
67
+ $this->glyphPos = array();
68
+ $this->charToGlyph = array();
69
+ $this->tables = array();
70
+ $this->otables = array();
71
+ $this->ascent = 0;
72
+ $this->descent = 0;
73
+ $this->TTCFonts = array();
74
+ $this->version = $version = $this->read_ulong();
75
+
76
+ if ($version === 0x4F54544F) {
77
+ throw new \RuntimeException('Postscript outlines are not supported');
78
+ }
79
+
80
+ if ($version === 0x74746366) {
81
+ throw new \RuntimeException('ERROR - TrueType Fonts Collections not supported');
82
+ }
83
+
84
+ if (!in_array($version, array(0x00010000, 0x74727565))) {
85
+ throw new \RuntimeException("Not a TrueType font: version=" . $version);
86
+ }
87
+
88
+ $this->readTableDirectory();
89
+ $this->extractInfo();
90
+ fclose($this->fh);
91
+ }
92
+
93
+ public function getCharWidths()
94
+ {
95
+ return $this->charWidths;
96
+ }
97
+
98
+ private function readTableDirectory()
99
+ {
100
+ $this->numTables = $this->read_ushort();
101
+ $this->searchRange = $this->read_ushort();
102
+ $this->entrySelector = $this->read_ushort();
103
+ $this->rangeShift = $this->read_ushort();
104
+ $this->tables = array();
105
+ for ($i = 0; $i < $this->numTables; $i++) {
106
+ $record = array();
107
+ $record['tag'] = $this->read_tag();
108
+ $record['checksum'] = array($this->read_ushort(), $this->read_ushort());
109
+ $record['offset'] = $this->read_ulong();
110
+ $record['length'] = $this->read_ulong();
111
+ $this->tables[$record['tag']] = $record;
112
+ }
113
+ }
114
+
115
+
116
+ private function sub32($x, $y)
117
+ {
118
+ $xlo = $x[1];
119
+ $xhi = $x[0];
120
+ $ylo = $y[1];
121
+ $yhi = $y[0];
122
+ if ($ylo > $xlo) {
123
+ $xlo += 1 << 16;
124
+ $yhi += 1;
125
+ }
126
+ $reslo = $xlo - $ylo;
127
+ if ($yhi > $xhi) {
128
+ $xhi += 1 << 16;
129
+ }
130
+ $reshi = $xhi - $yhi;
131
+ $reshi = $reshi & 0xFFFF;
132
+ return array($reshi, $reslo);
133
+ }
134
+
135
+ private function calcChecksum($data)
136
+ {
137
+ if (strlen($data) % 4) {
138
+ $data .= str_repeat("\0", (4 - (strlen($data) % 4)));
139
+ }
140
+ $hi = 0x0000;
141
+ $lo = 0x0000;
142
+ for ($i = 0; $i < strlen($data); $i += 4) {
143
+ $hi += (ord($data[$i]) << 8) + ord($data[$i + 1]);
144
+ $lo += (ord($data[$i + 2]) << 8) + ord($data[$i + 3]);
145
+ $hi += $lo >> 16;
146
+ $lo = $lo & 0xFFFF;
147
+ $hi = $hi & 0xFFFF;
148
+ }
149
+ return array($hi, $lo);
150
+ }
151
+
152
+ private function get_table_pos($tag)
153
+ {
154
+ $offset = $this->tables[$tag]['offset'];
155
+ $length = $this->tables[$tag]['length'];
156
+ return array($offset, $length);
157
+ }
158
+
159
+ private function seek($pos)
160
+ {
161
+ $this->_pos = $pos;
162
+ fseek($this->fh, $this->_pos);
163
+ }
164
+
165
+ private function skip($delta)
166
+ {
167
+ $this->_pos = $this->_pos + $delta;
168
+ fseek($this->fh, $this->_pos);
169
+ }
170
+
171
+ private function seek_table($tag, $offset_in_table = 0)
172
+ {
173
+ $tpos = $this->get_table_pos($tag);
174
+ $this->_pos = $tpos[0] + $offset_in_table;
175
+ fseek($this->fh, $this->_pos);
176
+ return $this->_pos;
177
+ }
178
+
179
+ private function read_tag()
180
+ {
181
+ $this->_pos += 4;
182
+ return fread($this->fh, 4);
183
+ }
184
+
185
+ private function read_short()
186
+ {
187
+ $this->_pos += 2;
188
+ $s = fread($this->fh, 2);
189
+ $a = (ord($s[0]) << 8) + ord($s[1]);
190
+ if ($a & (1 << 15)) {
191
+ $a = ($a - (1 << 16));
192
+ }
193
+ return $a;
194
+ }
195
+
196
+ private function unpack_short($s)
197
+ {
198
+ $a = (ord($s[0]) << 8) + ord($s[1]);
199
+ if ($a & (1 << 15)) {
200
+ $a = ($a - (1 << 16));
201
+ }
202
+ return $a;
203
+ }
204
+
205
+ private function read_ushort()
206
+ {
207
+ $this->_pos += 2;
208
+ $s = fread($this->fh, 2);
209
+ return (ord($s[0]) << 8) + ord($s[1]);
210
+ }
211
+
212
+ private function read_ulong()
213
+ {
214
+ $this->_pos += 4;
215
+ $s = fread($this->fh, 4);
216
+ // if large uInt32 as an integer, PHP converts it to -ve
217
+ return (ord($s[0]) * 16777216) + (ord($s[1]) << 16) + (ord($s[2]) << 8) + ord($s[3]); // 16777216 = 1<<24
218
+ }
219
+
220
+ private function get_ushort($pos)
221
+ {
222
+ fseek($this->fh, $pos);
223
+ $s = fread($this->fh, 2);
224
+ return (ord($s[0]) << 8) + ord($s[1]);
225
+ }
226
+
227
+ private function get_ulong($pos)
228
+ {
229
+ fseek($this->fh, $pos);
230
+ $s = fread($this->fh, 4);
231
+ // iF large uInt32 as an integer, PHP converts it to -ve
232
+ return (ord($s[0]) * 16777216) + (ord($s[1]) << 16) + (ord($s[2]) << 8) + ord($s[3]); // 16777216 = 1<<24
233
+ }
234
+
235
+ private function pack_short($val)
236
+ {
237
+ if ($val < 0) {
238
+ $val = abs($val);
239
+ $val = ~$val;
240
+ $val += 1;
241
+ }
242
+ return pack("n", $val);
243
+ }
244
+
245
+ private function splice($stream, $offset, $value)
246
+ {
247
+ return substr($stream, 0, $offset) . $value . substr($stream, $offset + strlen($value));
248
+ }
249
+
250
+ private function _set_ushort($stream, $offset, $value)
251
+ {
252
+ $up = pack("n", $value);
253
+ return $this->splice($stream, $offset, $up);
254
+ }
255
+
256
+ private function _set_short($stream, $offset, $val)
257
+ {
258
+ if ($val < 0) {
259
+ $val = abs($val);
260
+ $val = ~$val;
261
+ $val += 1;
262
+ }
263
+ $up = pack("n", $val);
264
+ return $this->splice($stream, $offset, $up);
265
+ }
266
+
267
+ private function get_chunk($pos, $length)
268
+ {
269
+ fseek($this->fh, $pos);
270
+ if ($length < 1) {
271
+ return '';
272
+ }
273
+ return (fread($this->fh, $length));
274
+ }
275
+
276
+ private function get_table($tag)
277
+ {
278
+ list($pos, $length) = $this->get_table_pos($tag);
279
+ if ($length == 0) {
280
+ throw new \RuntimeException('Truetype font (' . $this->filename . '): error reading table: ' . $tag);
281
+ }
282
+ fseek($this->fh, $pos);
283
+ return (fread($this->fh, $length));
284
+ }
285
+
286
+ private function add($tag, $data)
287
+ {
288
+ if ($tag == 'head') {
289
+ $data = $this->splice($data, 8, "\0\0\0\0");
290
+ }
291
+ $this->otables[$tag] = $data;
292
+ }
293
+
294
+
295
+
296
+ /////////////////////////////////////////////////////////////////////////////////////////
297
+ /////////////////////////////////////////////////////////////////////////////////////////
298
+
299
+ /////////////////////////////////////////////////////////////////////////////////////////
300
+
301
+ private function extractInfo()
302
+ {
303
+ ///////////////////////////////////
304
+ // name - Naming table
305
+ ///////////////////////////////////
306
+ $this->sFamilyClass = 0;
307
+ $this->sFamilySubClass = 0;
308
+
309
+ $name_offset = $this->seek_table('name');
310
+ $format = $this->read_ushort();
311
+ if ($format != 0)
312
+ throw new \RuntimeException('Unknown name table format ' . $format);
313
+ $numRecords = $this->read_ushort();
314
+ $string_data_offset = $name_offset + $this->read_ushort();
315
+ $names = array(1 => '', 2 => '', 3 => '', 4 => '', 6 => '');
316
+ $K = array_keys($names);
317
+ $nameCount = count($names);
318
+ for ($i = 0; $i < $numRecords; $i++) {
319
+ $platformId = $this->read_ushort();
320
+ $encodingId = $this->read_ushort();
321
+ $languageId = $this->read_ushort();
322
+ $nameId = $this->read_ushort();
323
+ $length = $this->read_ushort();
324
+ $offset = $this->read_ushort();
325
+ if (!in_array($nameId, $K)) continue;
326
+ $N = '';
327
+ if ($platformId == 3 && $encodingId == 1 && $languageId == 0x409) { // Microsoft, Unicode, US English, PS Name
328
+ $opos = $this->_pos;
329
+ $this->seek($string_data_offset + $offset);
330
+ if ($length % 2 != 0)
331
+ throw new \RuntimeException("PostScript name is UTF-16BE string of odd length");
332
+ $length /= 2;
333
+ $N = '';
334
+ while ($length > 0) {
335
+ $char = $this->read_ushort();
336
+ $N .= (chr($char));
337
+ $length -= 1;
338
+ }
339
+ $this->_pos = $opos;
340
+ $this->seek($opos);
341
+ } else if ($platformId == 1 && $encodingId == 0 && $languageId == 0) { // Macintosh, Roman, English, PS Name
342
+ $opos = $this->_pos;
343
+ $N = $this->get_chunk($string_data_offset + $offset, $length);
344
+ $this->_pos = $opos;
345
+ $this->seek($opos);
346
+ }
347
+ if ($N && $names[$nameId] == '') {
348
+ $names[$nameId] = $N;
349
+ $nameCount -= 1;
350
+ if ($nameCount == 0) break;
351
+ }
352
+ }
353
+ if ($names[6])
354
+ $psName = $names[6];
355
+ else if ($names[4])
356
+ $psName = preg_replace('/ /', '-', $names[4]);
357
+ else if ($names[1])
358
+ $psName = preg_replace('/ /', '-', $names[1]);
359
+ else
360
+ $psName = '';
361
+ if (!$psName)
362
+ throw new \RuntimeException("Could not find PostScript font name");
363
+ $this->name = $psName;
364
+ if ($names[1]) {
365
+ $this->familyName = $names[1];
366
+ } else {
367
+ $this->familyName = $psName;
368
+ }
369
+ if ($names[2]) {
370
+ $this->styleName = $names[2];
371
+ } else {
372
+ $this->styleName = 'Regular';
373
+ }
374
+ if ($names[4]) {
375
+ $this->fullName = $names[4];
376
+ } else {
377
+ $this->fullName = $psName;
378
+ }
379
+ if ($names[3]) {
380
+ $this->uniqueFontID = $names[3];
381
+ } else {
382
+ $this->uniqueFontID = $psName;
383
+ }
384
+ if ($names[6]) {
385
+ $this->fullName = $names[6];
386
+ }
387
+
388
+ ///////////////////////////////////
389
+ // head - Font header table
390
+ ///////////////////////////////////
391
+ $this->seek_table("head");
392
+ $this->skip(18);
393
+ $this->unitsPerEm = $unitsPerEm = $this->read_ushort();
394
+ $scale = 1000 / $unitsPerEm;
395
+ $this->skip(16);
396
+ $xMin = $this->read_short();
397
+ $yMin = $this->read_short();
398
+ $xMax = $this->read_short();
399
+ $yMax = $this->read_short();
400
+ $this->bbox = array(($xMin * $scale), ($yMin * $scale), ($xMax * $scale), ($yMax * $scale));
401
+ $this->skip(3 * 2);
402
+ $indexToLocFormat = $this->read_ushort();
403
+ $glyphDataFormat = $this->read_ushort();
404
+ if ($glyphDataFormat != 0)
405
+ throw new \RuntimeException('Unknown glyph data format ' . $glyphDataFormat);
406
+
407
+ ///////////////////////////////////
408
+ // hhea metrics table
409
+ ///////////////////////////////////
410
+ // ttf2t1 seems to use this value rather than the one in OS/2 - so put in for compatibility
411
+ if (isset($this->tables["hhea"])) {
412
+ $this->seek_table("hhea");
413
+ $this->skip(4);
414
+ $hheaAscender = $this->read_short();
415
+ $hheaDescender = $this->read_short();
416
+ $this->ascent = ($hheaAscender * $scale);
417
+ $this->descent = ($hheaDescender * $scale);
418
+ }
419
+
420
+ ///////////////////////////////////
421
+ // OS/2 - OS/2 and Windows metrics table
422
+ ///////////////////////////////////
423
+ if (isset($this->tables["OS/2"])) {
424
+ $this->seek_table("OS/2");
425
+ $version = $this->read_ushort();
426
+ $this->skip(2);
427
+ $usWeightClass = $this->read_ushort();
428
+ $this->skip(2);
429
+ $fsType = $this->read_ushort();
430
+ if ($fsType == 0x0002 || ($fsType & 0x0300) != 0) {
431
+ throw new \RuntimeException('ERROR - Font file ' . $this->filename . ' cannot be embedded due to copyright restrictions.');
432
+ }
433
+ $this->skip(20);
434
+ $sF = $this->read_short();
435
+ $this->sFamilyClass = ($sF >> 8);
436
+ $this->sFamilySubClass = ($sF & 0xFF);
437
+ $this->_pos += 10; //PANOSE = 10 byte length
438
+ $panose = fread($this->fh, 10);
439
+ $this->skip(26);
440
+ $sTypoAscender = $this->read_short();
441
+ $sTypoDescender = $this->read_short();
442
+ if (!$this->ascent) $this->ascent = ($sTypoAscender * $scale);
443
+ if (!$this->descent) $this->descent = ($sTypoDescender * $scale);
444
+ if ($version > 1) {
445
+ $this->skip(16);
446
+ $sCapHeight = $this->read_short();
447
+ $this->capHeight = ($sCapHeight * $scale);
448
+ } else {
449
+ $this->capHeight = $this->ascent;
450
+ }
451
+ } else {
452
+ $usWeightClass = 500;
453
+ if (!$this->ascent) $this->ascent = ($yMax * $scale);
454
+ if (!$this->descent) $this->descent = ($yMin * $scale);
455
+ $this->capHeight = $this->ascent;
456
+ }
457
+ $this->stemV = 50 + (int) pow($usWeightClass / 65.0, 2);
458
+
459
+ ///////////////////////////////////
460
+ // post - PostScript table
461
+ ///////////////////////////////////
462
+ $this->seek_table('post');
463
+ $this->skip(4);
464
+ $this->italicAngle = $this->read_short() + $this->read_ushort() / 65536.0;
465
+ $this->underlinePosition = $this->read_short() * $scale;
466
+ $this->underlineThickness = $this->read_short() * $scale;
467
+ $isFixedPitch = $this->read_ulong();
468
+
469
+ $this->flags = 4;
470
+
471
+ if ($this->italicAngle != 0)
472
+ $this->flags = $this->flags | 64;
473
+ if ($usWeightClass >= 600)
474
+ $this->flags = $this->flags | 262144;
475
+ if ($isFixedPitch)
476
+ $this->flags = $this->flags | 1;
477
+
478
+ ///////////////////////////////////
479
+ // hhea - Horizontal header table
480
+ ///////////////////////////////////
481
+ $this->seek_table("hhea");
482
+ $this->skip(32);
483
+ $metricDataFormat = $this->read_ushort();
484
+ if ($metricDataFormat != 0)
485
+ throw new \RuntimeException('Unknown horizontal metric data format ' . $metricDataFormat);
486
+ $numberOfHMetrics = $this->read_ushort();
487
+ if ($numberOfHMetrics == 0)
488
+ throw new \RuntimeException('Number of horizontal metrics is 0');
489
+
490
+ ///////////////////////////////////
491
+ // maxp - Maximum profile table
492
+ ///////////////////////////////////
493
+ $this->seek_table("maxp");
494
+ $this->skip(4);
495
+ $numGlyphs = $this->read_ushort();
496
+
497
+
498
+ ///////////////////////////////////
499
+ // cmap - Character to glyph index mapping table
500
+ ///////////////////////////////////
501
+ $cmap_offset = $this->seek_table("cmap");
502
+ $this->skip(2);
503
+ $cmapTableCount = $this->read_ushort();
504
+ $unicode_cmap_offset = 0;
505
+ for ($i = 0; $i < $cmapTableCount; $i++) {
506
+ $platformID = $this->read_ushort();
507
+ $encodingID = $this->read_ushort();
508
+ $offset = $this->read_ulong();
509
+ $save_pos = $this->_pos;
510
+ if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
511
+ $format = $this->get_ushort($cmap_offset + $offset);
512
+ if ($format == 4) {
513
+ if (!$unicode_cmap_offset) $unicode_cmap_offset = $cmap_offset + $offset;
514
+ break;
515
+ }
516
+ }
517
+ $this->seek($save_pos);
518
+ }
519
+ if (!$unicode_cmap_offset)
520
+ throw new \RuntimeException('Font (' . $this->filename . ') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
521
+
522
+
523
+ $glyphToChar = array();
524
+ $charToGlyph = array();
525
+ $this->getCMAP4($unicode_cmap_offset, $glyphToChar, $charToGlyph);
526
+
527
+ ///////////////////////////////////
528
+ // hmtx - Horizontal metrics table
529
+ ///////////////////////////////////
530
+ $this->getHMTX($numberOfHMetrics, $numGlyphs, $glyphToChar, $scale);
531
+
532
+ }
533
+
534
+
535
+ /////////////////////////////////////////////////////////////////////////////////////////
536
+ /////////////////////////////////////////////////////////////////////////////////////////
537
+
538
+
539
+ public function makeSubset($file, &$subset)
540
+ {
541
+ if (!file_exists($file)) {
542
+ throw new \RuntimeException('Can\'t open file to create subset');
543
+ }
544
+
545
+ $this->filename = $file;
546
+ $this->fh = fopen($file, 'rb');
547
+ $this->_pos = 0;
548
+ $this->charWidths = '';
549
+ $this->glyphPos = array();
550
+ $this->charToGlyph = array();
551
+ $this->tables = array();
552
+ $this->otables = array();
553
+ $this->ascent = 0;
554
+ $this->descent = 0;
555
+ $this->skip(4);
556
+ $this->maxUni = 0;
557
+ $this->readTableDirectory();
558
+
559
+
560
+ ///////////////////////////////////
561
+ // head - Font header table
562
+ ///////////////////////////////////
563
+ $this->seek_table("head");
564
+ $this->skip(50);
565
+ $indexToLocFormat = $this->read_ushort();
566
+ $glyphDataFormat = $this->read_ushort();
567
+
568
+ ///////////////////////////////////
569
+ // hhea - Horizontal header table
570
+ ///////////////////////////////////
571
+ $this->seek_table("hhea");
572
+ $this->skip(32);
573
+ $metricDataFormat = $this->read_ushort();
574
+ $orignHmetrics = $numberOfHMetrics = $this->read_ushort();
575
+
576
+ ///////////////////////////////////
577
+ // maxp - Maximum profile table
578
+ ///////////////////////////////////
579
+ $this->seek_table("maxp");
580
+ $this->skip(4);
581
+ $numGlyphs = $this->read_ushort();
582
+
583
+
584
+ ///////////////////////////////////
585
+ // cmap - Character to glyph index mapping table
586
+ ///////////////////////////////////
587
+ $cmap_offset = $this->seek_table("cmap");
588
+ $this->skip(2);
589
+ $cmapTableCount = $this->read_ushort();
590
+ $unicode_cmap_offset = 0;
591
+ for ($i = 0; $i < $cmapTableCount; $i++) {
592
+ $platformID = $this->read_ushort();
593
+ $encodingID = $this->read_ushort();
594
+ $offset = $this->read_ulong();
595
+ $save_pos = $this->_pos;
596
+ if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
597
+ $format = $this->get_ushort($cmap_offset + $offset);
598
+ if ($format == 4) {
599
+ $unicode_cmap_offset = $cmap_offset + $offset;
600
+ break;
601
+ }
602
+ }
603
+ $this->seek($save_pos);
604
+ }
605
+
606
+ if (!$unicode_cmap_offset)
607
+ throw new \RuntimeException('Font (' . $this->filename . ') does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)');
608
+
609
+
610
+ $glyphToChar = array();
611
+ $charToGlyph = array();
612
+ $this->getCMAP4($unicode_cmap_offset, $glyphToChar, $charToGlyph);
613
+
614
+ $this->charToGlyph = $charToGlyph;
615
+
616
+ ///////////////////////////////////
617
+ // hmtx - Horizontal metrics table
618
+ ///////////////////////////////////
619
+ $scale = 1; // not used
620
+ $this->getHMTX($numberOfHMetrics, $numGlyphs, $glyphToChar, $scale);
621
+
622
+ ///////////////////////////////////
623
+ // loca - Index to location
624
+ ///////////////////////////////////
625
+ $this->getLOCA($indexToLocFormat, $numGlyphs);
626
+
627
+ $subsetglyphs = array(0 => 0);
628
+ $subsetCharToGlyph = array();
629
+ foreach ($subset AS $code) {
630
+ if (isset($this->charToGlyph[$code])) {
631
+ $subsetglyphs[$this->charToGlyph[$code]] = $code; // Old Glyph ID => Unicode
632
+ $subsetCharToGlyph[$code] = $this->charToGlyph[$code]; // Unicode to old GlyphID
633
+
634
+ }
635
+ $this->maxUni = max($this->maxUni, $code);
636
+ }
637
+
638
+ list($start, $dummy) = $this->get_table_pos('glyf');
639
+
640
+ $glyphSet = array();
641
+ ksort($subsetglyphs);
642
+ $n = 0;
643
+ $fsLastCharIndex = 0; // maximum Unicode index (character code) in this font, according to the cmap subtable for platform ID 3 and platform- specific encoding ID 0 or 1.
644
+ foreach ($subsetglyphs AS $originalGlyphIdx => $uni) {
645
+ $fsLastCharIndex = max($fsLastCharIndex, $uni);
646
+ $glyphSet[$originalGlyphIdx] = $n; // old glyphID to new glyphID
647
+ $n++;
648
+ }
649
+
650
+ ksort($subsetCharToGlyph);
651
+ foreach ($subsetCharToGlyph AS $uni => $originalGlyphIdx) {
652
+ $codeToGlyph[$uni] = $glyphSet[$originalGlyphIdx];
653
+ }
654
+ $this->codeToGlyph = $codeToGlyph;
655
+
656
+ ksort($subsetglyphs);
657
+ foreach ($subsetglyphs AS $originalGlyphIdx => $uni) {
658
+ $this->getGlyphs($originalGlyphIdx, $start, $glyphSet, $subsetglyphs);
659
+ }
660
+
661
+ $numGlyphs = $numberOfHMetrics = count($subsetglyphs);
662
+
663
+ //tables copied from the original
664
+ $tags = array('name');
665
+ foreach ($tags AS $tag) {
666
+ $this->add($tag, $this->get_table($tag));
667
+ }
668
+ $tags = array('cvt ', 'fpgm', 'prep', 'gasp');
669
+ foreach ($tags AS $tag) {
670
+ if (isset($this->tables[$tag])) {
671
+ $this->add($tag, $this->get_table($tag));
672
+ }
673
+ }
674
+
675
+ // post - PostScript
676
+ $opost = $this->get_table('post');
677
+ $post = "\x00\x03\x00\x00" . substr($opost, 4, 12) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
678
+ $this->add('post', $post);
679
+
680
+ // Sort CID2GID map into segments of contiguous codes
681
+ ksort($codeToGlyph);
682
+ unset($codeToGlyph[0]);
683
+ //unset($codeToGlyph[65535]);
684
+ $rangeid = 0;
685
+ $range = array();
686
+ $prevcid = -2;
687
+ $prevglidx = -1;
688
+ // for each character
689
+ foreach ($codeToGlyph as $cid => $glidx) {
690
+ if ($cid == ($prevcid + 1) && $glidx == ($prevglidx + 1)) {
691
+ $range[$rangeid][] = $glidx;
692
+ } else {
693
+ // new range
694
+ $rangeid = $cid;
695
+ $range[$rangeid] = array();
696
+ $range[$rangeid][] = $glidx;
697
+ }
698
+ $prevcid = $cid;
699
+ $prevglidx = $glidx;
700
+ }
701
+
702
+ // cmap - Character to glyph mapping - Format 4 (MS / )
703
+ $segCount = count($range) + 1; // + 1 Last segment has missing character 0xFFFF
704
+ $searchRange = 1;
705
+ $entrySelector = 0;
706
+ while ($searchRange * 2 <= $segCount) {
707
+ $searchRange = $searchRange * 2;
708
+ $entrySelector = $entrySelector + 1;
709
+ }
710
+ $searchRange = $searchRange * 2;
711
+ $rangeShift = $segCount * 2 - $searchRange;
712
+ $length = 16 + (8 * $segCount) + ($numGlyphs + 1);
713
+ $cmap = array(0, 1, // Index : version, number of encoding subtables
714
+ 3, 1, // Encoding Subtable : platform (MS=3), encoding (Unicode)
715
+ 0, 12, // Encoding Subtable : offset (hi,lo)
716
+ 4, $length, 0, // Format 4 Mapping subtable: format, length, language
717
+ $segCount * 2,
718
+ $searchRange,
719
+ $entrySelector,
720
+ $rangeShift);
721
+
722
+ // endCode(s)
723
+ foreach ($range AS $start => $subrange) {
724
+ $endCode = $start + (count($subrange) - 1);
725
+ $cmap[] = $endCode; // endCode(s)
726
+ }
727
+ $cmap[] = 0xFFFF; // endCode of last Segment
728
+ $cmap[] = 0; // reservedPad
729
+
730
+ // startCode(s)
731
+ foreach ($range AS $start => $subrange) {
732
+ $cmap[] = $start; // startCode(s)
733
+ }
734
+ $cmap[] = 0xFFFF; // startCode of last Segment
735
+ // idDelta(s)
736
+ foreach ($range AS $start => $subrange) {
737
+ $idDelta = -($start - $subrange[0]);
738
+ $n += count($subrange);
739
+ $cmap[] = $idDelta; // idDelta(s)
740
+ }
741
+ $cmap[] = 1; // idDelta of last Segment
742
+ // idRangeOffset(s)
743
+ foreach ($range AS $subrange) {
744
+ $cmap[] = 0; // idRangeOffset[segCount] Offset in bytes to glyph indexArray, or 0
745
+
746
+ }
747
+ $cmap[] = 0; // idRangeOffset of last Segment
748
+ foreach ($range AS $subrange) {
749
+ foreach ($subrange AS $glidx) {
750
+ $cmap[] = $glidx;
751
+ }
752
+ }
753
+ $cmap[] = 0; // Mapping for last character
754
+ $cmapstr = '';
755
+ foreach ($cmap AS $cm) {
756
+ $cmapstr .= pack("n", $cm);
757
+ }
758
+ $this->add('cmap', $cmapstr);
759
+
760
+
761
+ // glyf - Glyph data
762
+ list($glyfOffset, $glyfLength) = $this->get_table_pos('glyf');
763
+ if ($glyfLength < $this->maxStrLenRead) {
764
+ $glyphData = $this->get_table('glyf');
765
+ }
766
+
767
+ $offsets = array();
768
+ $glyf = '';
769
+ $pos = 0;
770
+
771
+ $hmtxstr = '';
772
+ $xMinT = 0;
773
+ $yMinT = 0;
774
+ $xMaxT = 0;
775
+ $yMaxT = 0;
776
+ $advanceWidthMax = 0;
777
+ $minLeftSideBearing = 0;
778
+ $minRightSideBearing = 0;
779
+ $xMaxExtent = 0;
780
+ $maxPoints = 0; // points in non-compound glyph
781
+ $maxContours = 0; // contours in non-compound glyph
782
+ $maxComponentPoints = 0; // points in compound glyph
783
+ $maxComponentContours = 0; // contours in compound glyph
784
+ $maxComponentElements = 0; // number of glyphs referenced at top level
785
+ $maxComponentDepth = 0; // levels of recursion, set to 0 if font has only simple glyphs
786
+ $this->glyphdata = array();
787
+
788
+ foreach ($subsetglyphs AS $originalGlyphIdx => $uni) {
789
+ // hmtx - Horizontal Metrics
790
+ $hm = $this->getHMetric($orignHmetrics, $originalGlyphIdx);
791
+ $hmtxstr .= $hm;
792
+
793
+ $offsets[] = $pos;
794
+ $glyphPos = $this->glyphPos[$originalGlyphIdx];
795
+ $glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
796
+ if ($glyfLength < $this->maxStrLenRead) {
797
+ $data = substr($glyphData, $glyphPos, $glyphLen);
798
+ } else {
799
+ if ($glyphLen > 0) $data = $this->get_chunk($glyfOffset + $glyphPos, $glyphLen);
800
+ else $data = '';
801
+ }
802
+
803
+ if ($glyphLen > 0) {
804
+ $up = unpack("n", substr($data, 0, 2));
805
+ }
806
+
807
+ if ($glyphLen > 2 && ($up[1] & (1 << 15))) { // If number of contours <= -1 i.e. composiste glyph
808
+ $pos_in_glyph = 10;
809
+ $flags = $this->gfMore;
810
+ $nComponentElements = 0;
811
+ while ($flags & $this->gfMore) {
812
+ $nComponentElements += 1; // number of glyphs referenced at top level
813
+ $up = unpack("n", substr($data, $pos_in_glyph, 2));
814
+ $flags = $up[1];
815
+ $up = unpack("n", substr($data, $pos_in_glyph + 2, 2));
816
+ $glyphIdx = $up[1];
817
+ $this->glyphdata[$originalGlyphIdx]['compGlyphs'][] = $glyphIdx;
818
+ $data = $this->_set_ushort($data, $pos_in_glyph + 2, $glyphSet[$glyphIdx]);
819
+ $pos_in_glyph += 4;
820
+ if ($flags & $this->gfWords) {
821
+ $pos_in_glyph += 4;
822
+ } else {
823
+ $pos_in_glyph += 2;
824
+ }
825
+ if ($flags & $this->gfScale) {
826
+ $pos_in_glyph += 2;
827
+ } else if ($flags & $this->gfXYScale) {
828
+ $pos_in_glyph += 4;
829
+ } else if ($flags & $this->gfTwoByTwo) {
830
+ $pos_in_glyph += 8;
831
+ }
832
+ }
833
+ $maxComponentElements = max($maxComponentElements, $nComponentElements);
834
+ }
835
+
836
+ $glyf .= $data;
837
+ $pos += $glyphLen;
838
+ if ($pos % 4 != 0) {
839
+ $padding = 4 - ($pos % 4);
840
+ $glyf .= str_repeat("\0", $padding);
841
+ $pos += $padding;
842
+ }
843
+ }
844
+
845
+ $offsets[] = $pos;
846
+ $this->add('glyf', $glyf);
847
+
848
+ // hmtx - Horizontal Metrics
849
+ $this->add('hmtx', $hmtxstr);
850
+
851
+ // loca - Index to location
852
+ $locastr = '';
853
+ if ((($pos + 1) >> 1) > 0xFFFF) {
854
+ $indexToLocFormat = 1; // long format
855
+ foreach ($offsets AS $offset) {
856
+ $locastr .= pack("N", $offset);
857
+ }
858
+ } else {
859
+ $indexToLocFormat = 0; // short format
860
+ foreach ($offsets AS $offset) {
861
+ $locastr .= pack("n", ($offset / 2));
862
+ }
863
+ }
864
+ $this->add('loca', $locastr);
865
+
866
+ // head - Font header
867
+ $head = $this->get_table('head');
868
+ $head = $this->_set_ushort($head, 50, $indexToLocFormat);
869
+ $this->add('head', $head);
870
+
871
+
872
+ // hhea - Horizontal Header
873
+ $hhea = $this->get_table('hhea');
874
+ $hhea = $this->_set_ushort($hhea, 34, $numberOfHMetrics);
875
+ $this->add('hhea', $hhea);
876
+
877
+ // maxp - Maximum Profile
878
+ $maxp = $this->get_table('maxp');
879
+ $maxp = $this->_set_ushort($maxp, 4, $numGlyphs);
880
+ $this->add('maxp', $maxp);
881
+
882
+
883
+ // OS/2 - OS/2
884
+ $os2 = $this->get_table('OS/2');
885
+ $this->add('OS/2', $os2);
886
+
887
+ fclose($this->fh);
888
+
889
+ // Put the TTF file together
890
+ $stm = '';
891
+ $this->endTTFile($stm);
892
+ return $stm;
893
+ }
894
+
895
+ //////////////////////////////////////////////////////////////////////////////////
896
+ // Recursively get composite glyph data
897
+ private function getGlyphData($originalGlyphIdx, &$maxdepth, &$depth, &$points, &$contours)
898
+ {
899
+ $depth++;
900
+ $maxdepth = max($maxdepth, $depth);
901
+ if (count($this->glyphdata[$originalGlyphIdx]['compGlyphs'])) {
902
+ foreach ($this->glyphdata[$originalGlyphIdx]['compGlyphs'] AS $glyphIdx) {
903
+ $this->getGlyphData($glyphIdx, $maxdepth, $depth, $points, $contours);
904
+ }
905
+ } else if (($this->glyphdata[$originalGlyphIdx]['nContours'] > 0) && $depth > 0) { // simple
906
+ $contours += $this->glyphdata[$originalGlyphIdx]['nContours'];
907
+ $points += $this->glyphdata[$originalGlyphIdx]['nPoints'];
908
+ }
909
+ $depth--;
910
+ }
911
+
912
+
913
+ //////////////////////////////////////////////////////////////////////////////////
914
+ // Recursively get composite glyphs
915
+ private function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs)
916
+ {
917
+ $glyphPos = $this->glyphPos[$originalGlyphIdx];
918
+ $glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
919
+ if (!$glyphLen) {
920
+ return;
921
+ }
922
+ $this->seek($start + $glyphPos);
923
+ $numberOfContours = $this->read_short();
924
+ if ($numberOfContours < 0) {
925
+ $this->skip(8);
926
+ $flags = $this->gfMore;
927
+ while ($flags & $this->gfMore) {
928
+ $flags = $this->read_ushort();
929
+ $glyphIdx = $this->read_ushort();
930
+ if (!isset($glyphSet[$glyphIdx])) {
931
+ $glyphSet[$glyphIdx] = count($subsetglyphs); // old glyphID to new glyphID
932
+ $subsetglyphs[$glyphIdx] = true;
933
+ }
934
+ $savepos = ftell($this->fh);
935
+ $this->getGlyphs($glyphIdx, $start, $glyphSet, $subsetglyphs);
936
+ $this->seek($savepos);
937
+ if ($flags & $this->gfWords)
938
+ $this->skip(4);
939
+ else
940
+ $this->skip(2);
941
+ if ($flags & $this->gfScale)
942
+ $this->skip(2);
943
+ else if ($flags & $this->gfXYScale)
944
+ $this->skip(4);
945
+ else if ($flags & $this->gfTwoByTwo)
946
+ $this->skip(8);
947
+ }
948
+ }
949
+ }
950
+
951
+
952
+ //////////////////////////////////////////////////////////////////////////////////
953
+
954
+ private function getHMTX($numberOfHMetrics, $numGlyphs, &$glyphToChar, $scale)
955
+ {
956
+ $start = $this->seek_table("hmtx");
957
+ $aw = 0;
958
+ $this->charWidths = str_pad('', 256 * 256 * 2, "\x00");
959
+ $nCharWidths = 0;
960
+ if (($numberOfHMetrics * 4) < $this->maxStrLenRead) {
961
+ $data = $this->get_chunk($start, ($numberOfHMetrics * 4));
962
+ $arr = unpack("n*", $data);
963
+ } else {
964
+ $this->seek($start);
965
+ }
966
+ for ($glyph = 0; $glyph < $numberOfHMetrics; $glyph++) {
967
+
968
+ if (($numberOfHMetrics * 4) < $this->maxStrLenRead) {
969
+ $aw = $arr[($glyph * 2) + 1];
970
+ } else {
971
+ $aw = $this->read_ushort();
972
+ $lsb = $this->read_ushort();
973
+ }
974
+ if (isset($glyphToChar[$glyph]) || $glyph == 0) {
975
+
976
+ if ($aw >= (1 << 15)) {
977
+ $aw = 0;
978
+ } // 1.03 Some (arabic) fonts have -ve values for width
979
+ // although should be unsigned value - comes out as e.g. 65108 (intended -50)
980
+ if ($glyph == 0) {
981
+ $this->defaultWidth = $scale * $aw;
982
+ continue;
983
+ }
984
+ foreach ($glyphToChar[$glyph] AS $char) {
985
+ if ($char != 0 && $char != 65535) {
986
+ $w = intval(round($scale * $aw));
987
+ if ($w == 0) {
988
+ $w = 65535;
989
+ }
990
+ if ($char < 196608) {
991
+ $this->charWidths[$char * 2] = chr($w >> 8);
992
+ $this->charWidths[$char * 2 + 1] = chr($w & 0xFF);
993
+ $nCharWidths++;
994
+ }
995
+ }
996
+ }
997
+ }
998
+ }
999
+ $data = $this->get_chunk(($start + $numberOfHMetrics * 4), ($numGlyphs * 2));
1000
+ $arr = unpack("n*", $data);
1001
+ $diff = $numGlyphs - $numberOfHMetrics;
1002
+ for ($pos = 0; $pos < $diff; $pos++) {
1003
+ $glyph = $pos + $numberOfHMetrics;
1004
+ if (isset($glyphToChar[$glyph])) {
1005
+ foreach ($glyphToChar[$glyph] AS $char) {
1006
+ if ($char != 0 && $char != 65535) {
1007
+ $w = intval(round($scale * $aw));
1008
+ if ($w == 0) {
1009
+ $w = 65535;
1010
+ }
1011
+ if ($char < 196608) {
1012
+ $this->charWidths[$char * 2] = chr($w >> 8);
1013
+ $this->charWidths[$char * 2 + 1] = chr($w & 0xFF);
1014
+ $nCharWidths++;
1015
+ }
1016
+ }
1017
+ }
1018
+ }
1019
+ }
1020
+ // NB 65535 is a set width of 0
1021
+ // First bytes define number of chars in font
1022
+ $this->charWidths[0] = chr($nCharWidths >> 8);
1023
+ $this->charWidths[1] = chr($nCharWidths & 0xFF);
1024
+ }
1025
+
1026
+ /**
1027
+ * @return int
1028
+ */
1029
+ public function getGfWords()
1030
+ {
1031
+ return $this->gfWords;
1032
+ }
1033
+
1034
+ /**
1035
+ * @return int
1036
+ */
1037
+ public function getGfScale()
1038
+ {
1039
+ return $this->gfScale;
1040
+ }
1041
+
1042
+ /**
1043
+ * @return int
1044
+ */
1045
+ public function getGfMore()
1046
+ {
1047
+ return $this->gfMore;
1048
+ }
1049
+
1050
+ /**
1051
+ * @return int
1052
+ */
1053
+ public function getGfXYScale()
1054
+ {
1055
+ return $this->gfXYScale;
1056
+ }
1057
+
1058
+ /**
1059
+ * @return int
1060
+ */
1061
+ public function getGfTwoByTwo()
1062
+ {
1063
+ return $this->gfTwoByTwo;
1064
+ }
1065
+
1066
+ /**
1067
+ * @return boolean
1068
+ */
1069
+ public function isTtfMacHeader()
1070
+ {
1071
+ return $this->ttf_mac_header;
1072
+ }
1073
+
1074
+ /**
1075
+ * @return mixed
1076
+ */
1077
+ public function getMaxUni()
1078
+ {
1079
+ return $this->maxUni;
1080
+ }
1081
+
1082
+ /**
1083
+ * @return mixed
1084
+ */
1085
+ public function getPos()
1086
+ {
1087
+ return $this->_pos;
1088
+ }
1089
+
1090
+ /**
1091
+ * @return mixed
1092
+ */
1093
+ public function getNumTables()
1094
+ {
1095
+ return $this->numTables;
1096
+ }
1097
+
1098
+ /**
1099
+ * @return mixed
1100
+ */
1101
+ public function getSearchRange()
1102
+ {
1103
+ return $this->searchRange;
1104
+ }
1105
+
1106
+ /**
1107
+ * @return mixed
1108
+ */
1109
+ public function getEntrySelector()
1110
+ {
1111
+ return $this->entrySelector;
1112
+ }
1113
+
1114
+ /**
1115
+ * @return mixed
1116
+ */
1117
+ public function getRangeShift()
1118
+ {
1119
+ return $this->rangeShift;
1120
+ }
1121
+
1122
+ /**
1123
+ * @return mixed
1124
+ */
1125
+ public function getTables()
1126
+ {
1127
+ return $this->tables;
1128
+ }
1129
+
1130
+ /**
1131
+ * @return mixed
1132
+ */
1133
+ public function getOtables()
1134
+ {
1135
+ return $this->otables;
1136
+ }
1137
+
1138
+ /**
1139
+ * @return mixed
1140
+ */
1141
+ public function getFilename()
1142
+ {
1143
+ return $this->filename;
1144
+ }
1145
+
1146
+ /**
1147
+ * @return mixed
1148
+ */
1149
+ public function getFh()
1150
+ {
1151
+ return $this->fh;
1152
+ }
1153
+
1154
+ /**
1155
+ * @return mixed
1156
+ */
1157
+ public function getGlyphPos()
1158
+ {
1159
+ return $this->glyphPos;
1160
+ }
1161
+
1162
+ /**
1163
+ * @return mixed
1164
+ */
1165
+ public function getCharToGlyph()
1166
+ {
1167
+ return $this->charToGlyph;
1168
+ }
1169
+
1170
+ /**
1171
+ * @return mixed
1172
+ */
1173
+ public function getAscent()
1174
+ {
1175
+ return $this->ascent;
1176
+ }
1177
+
1178
+ /**
1179
+ * @return mixed
1180
+ */
1181
+ public function getDescent()
1182
+ {
1183
+ return $this->descent;
1184
+ }
1185
+
1186
+ /**
1187
+ * @return mixed
1188
+ */
1189
+ public function getName()
1190
+ {
1191
+ return $this->name;
1192
+ }
1193
+
1194
+ /**
1195
+ * @return mixed
1196
+ */
1197
+ public function getFamilyName()
1198
+ {
1199
+ return $this->familyName;
1200
+ }
1201
+
1202
+ /**
1203
+ * @return mixed
1204
+ */
1205
+ public function getStyleName()
1206
+ {
1207
+ return $this->styleName;
1208
+ }
1209
+
1210
+ /**
1211
+ * @return mixed
1212
+ */
1213
+ public function getFullName()
1214
+ {
1215
+ return $this->fullName;
1216
+ }
1217
+
1218
+ /**
1219
+ * @return mixed
1220
+ */
1221
+ public function getUniqueFontID()
1222
+ {
1223
+ return $this->uniqueFontID;
1224
+ }
1225
+
1226
+ /**
1227
+ * @return mixed
1228
+ */
1229
+ public function getUnitsPerEm()
1230
+ {
1231
+ return $this->unitsPerEm;
1232
+ }
1233
+
1234
+ /**
1235
+ * @return mixed
1236
+ */
1237
+ public function getBbox()
1238
+ {
1239
+ return $this->bbox;
1240
+ }
1241
+
1242
+ /**
1243
+ * @return mixed
1244
+ */
1245
+ public function getCapHeight()
1246
+ {
1247
+ return $this->capHeight;
1248
+ }
1249
+
1250
+ /**
1251
+ * @return mixed
1252
+ */
1253
+ public function getStemV()
1254
+ {
1255
+ return $this->stemV;
1256
+ }
1257
+
1258
+ /**
1259
+ * @return mixed
1260
+ */
1261
+ public function getItalicAngle()
1262
+ {
1263
+ return $this->italicAngle;
1264
+ }
1265
+
1266
+ /**
1267
+ * @return mixed
1268
+ */
1269
+ public function getFlags()
1270
+ {
1271
+ return $this->flags;
1272
+ }
1273
+
1274
+ /**
1275
+ * @return mixed
1276
+ */
1277
+ public function getUnderlinePosition()
1278
+ {
1279
+ return $this->underlinePosition;
1280
+ }
1281
+
1282
+ /**
1283
+ * @return mixed
1284
+ */
1285
+ public function getUnderlineThickness()
1286
+ {
1287
+ return $this->underlineThickness;
1288
+ }
1289
+
1290
+ /**
1291
+ * @return mixed
1292
+ */
1293
+ public function getDefaultWidth()
1294
+ {
1295
+ return $this->defaultWidth;
1296
+ }
1297
+
1298
+ /**
1299
+ * @return int
1300
+ */
1301
+ public function getMaxStrLenRead()
1302
+ {
1303
+ return $this->maxStrLenRead;
1304
+ }
1305
+
1306
+ /**
1307
+ * @return mixed
1308
+ */
1309
+ public function getCodeToGlyph()
1310
+ {
1311
+ return $this->codeToGlyph;
1312
+ }
1313
+
1314
+ private function getHMetric($numberOfHMetrics, $gid)
1315
+ {
1316
+ $start = $this->seek_table("hmtx");
1317
+ if ($gid < $numberOfHMetrics) {
1318
+ $this->seek($start + ($gid * 4));
1319
+ $hm = fread($this->fh, 4);
1320
+ } else {
1321
+ $this->seek($start + (($numberOfHMetrics - 1) * 4));
1322
+ $hm = fread($this->fh, 2);
1323
+ $this->seek($start + ($numberOfHMetrics * 2) + ($gid * 2));
1324
+ $hm .= fread($this->fh, 2);
1325
+ }
1326
+ return $hm;
1327
+ }
1328
+
1329
+ private function getLOCA($indexToLocFormat, $numGlyphs)
1330
+ {
1331
+ $start = $this->seek_table('loca');
1332
+ $this->glyphPos = array();
1333
+ if ($indexToLocFormat == 0) {
1334
+ $data = $this->get_chunk($start, ($numGlyphs * 2) + 2);
1335
+ $arr = unpack("n*", $data);
1336
+ for ($n = 0; $n <= $numGlyphs; $n++) {
1337
+ $this->glyphPos[] = ($arr[$n + 1] * 2);
1338
+ }
1339
+ } else if ($indexToLocFormat == 1) {
1340
+ $data = $this->get_chunk($start, ($numGlyphs * 4) + 4);
1341
+ $arr = unpack("N*", $data);
1342
+ for ($n = 0; $n <= $numGlyphs; $n++) {
1343
+ $this->glyphPos[] = ($arr[$n + 1]);
1344
+ }
1345
+ } else
1346
+ throw new \RuntimeException('Unknown location table format ' . $indexToLocFormat);
1347
+ }
1348
+
1349
+
1350
+ // CMAP Format 4
1351
+ private function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph)
1352
+ {
1353
+ $this->maxUniChar = 0;
1354
+ $this->seek($unicode_cmap_offset + 2);
1355
+ $length = $this->read_ushort();
1356
+ $limit = $unicode_cmap_offset + $length;
1357
+ $this->skip(2);
1358
+
1359
+ $segCount = $this->read_ushort() / 2;
1360
+ $this->skip(6);
1361
+ $endCount = array();
1362
+ for ($i = 0; $i < $segCount; $i++) {
1363
+ $endCount[] = $this->read_ushort();
1364
+ }
1365
+ $this->skip(2);
1366
+ $startCount = array();
1367
+ for ($i = 0; $i < $segCount; $i++) {
1368
+ $startCount[] = $this->read_ushort();
1369
+ }
1370
+ $idDelta = array();
1371
+ for ($i = 0; $i < $segCount; $i++) {
1372
+ $idDelta[] = $this->read_short();
1373
+ } // ???? was unsigned short
1374
+ $idRangeOffset_start = $this->_pos;
1375
+ $idRangeOffset = array();
1376
+ for ($i = 0; $i < $segCount; $i++) {
1377
+ $idRangeOffset[] = $this->read_ushort();
1378
+ }
1379
+
1380
+ for ($n = 0; $n < $segCount; $n++) {
1381
+ $endpoint = ($endCount[$n] + 1);
1382
+ for ($unichar = $startCount[$n]; $unichar < $endpoint; $unichar++) {
1383
+ if ($idRangeOffset[$n] == 0)
1384
+ $glyph = ($unichar + $idDelta[$n]) & 0xFFFF;
1385
+ else {
1386
+ $offset = ($unichar - $startCount[$n]) * 2 + $idRangeOffset[$n];
1387
+ $offset = $idRangeOffset_start + 2 * $n + $offset;
1388
+ if ($offset >= $limit)
1389
+ $glyph = 0;
1390
+ else {
1391
+ $glyph = $this->get_ushort($offset);
1392
+ if ($glyph != 0)
1393
+ $glyph = ($glyph + $idDelta[$n]) & 0xFFFF;
1394
+ }
1395
+ }
1396
+ $charToGlyph[$unichar] = $glyph;
1397
+ if ($unichar < 196608) {
1398
+ $this->maxUniChar = max($unichar, $this->maxUniChar);
1399
+ }
1400
+ $glyphToChar[$glyph][] = $unichar;
1401
+ }
1402
+ }
1403
+ }
1404
+
1405
+
1406
+ // Put the TTF file together
1407
+ private function endTTFile(&$stm)
1408
+ {
1409
+ $stm = '';
1410
+ $numTables = count($this->otables);
1411
+ $searchRange = 1;
1412
+ $entrySelector = 0;
1413
+ while ($searchRange * 2 <= $numTables) {
1414
+ $searchRange = $searchRange * 2;
1415
+ $entrySelector = $entrySelector + 1;
1416
+ }
1417
+ $searchRange = $searchRange * 16;
1418
+ $rangeShift = $numTables * 16 - $searchRange;
1419
+
1420
+ // Header
1421
+ if ($this->ttf_mac_header) {
1422
+ $stm .= (pack("Nnnnn", 0x74727565, $numTables, $searchRange, $entrySelector, $rangeShift)); // Mac
1423
+ } else {
1424
+ $stm .= (pack("Nnnnn", 0x00010000, $numTables, $searchRange, $entrySelector, $rangeShift)); // Windows
1425
+ }
1426
+
1427
+ // Table directory
1428
+ $tables = $this->otables;
1429
+
1430
+ ksort($tables);
1431
+ $offset = 12 + $numTables * 16;
1432
+ foreach ($tables AS $tag => $data) {
1433
+ if ($tag == 'head') {
1434
+ $head_start = $offset;
1435
+ }
1436
+ $stm .= $tag;
1437
+ $checksum = $this->calcChecksum($data);
1438
+ $stm .= pack("nn", $checksum[0], $checksum[1]);
1439
+ $stm .= pack("NN", $offset, strlen($data));
1440
+ $paddedLength = (strlen($data) + 3) & ~3;
1441
+ $offset = $offset + $paddedLength;
1442
+ }
1443
+
1444
+ // Table data
1445
+ foreach ($tables AS $tag => $data) {
1446
+ $data .= "\0\0\0";
1447
+ $stm .= substr($data, 0, (strlen($data) & ~3));
1448
+ }
1449
+
1450
+ $checksum = $this->calcChecksum($stm);
1451
+ $checksum = $this->sub32(array(0xB1B0, 0xAFBA), $checksum);
1452
+ $chk = pack("nn", $checksum[0], $checksum[1]);
1453
+ $stm = $this->splice($stm, ($head_start + 8), $chk);
1454
+ return $stm;
1455
+ }
1456
+
1457
+
1458
+ }
classes/FPDF/class-woe-fpdf.php CHANGED
@@ -1,1903 +1,3142 @@
1
  <?php
2
- /*******************************************************************************
3
- * WOE_FPDF *
4
- * Renamed to avoid accidental replacement *
5
- *
6
- * Version: 1.81 *
7
- * Date: 2015-12-20 *
8
- * Author: Olivier PLATHEY *
9
- *******************************************************************************/
10
-
11
- define('FPDF_VERSION','1.81');
12
-
13
- class WOE_FPDF
14
- {
15
- protected $page; // current page number
16
- protected $n; // current object number
17
- protected $offsets; // array of object offsets
18
- protected $buffer; // buffer holding in-memory PDF
19
- protected $pages; // array containing pages
20
- protected $state; // current document state
21
- protected $compress; // compression flag
22
- protected $k; // scale factor (number of points in user unit)
23
- protected $DefOrientation; // default orientation
24
- protected $CurOrientation; // current orientation
25
- protected $StdPageSizes; // standard page sizes
26
- protected $DefPageSize; // default page size
27
- protected $CurPageSize; // current page size
28
- protected $CurRotation; // current page rotation
29
- protected $PageInfo; // page-related data
30
- protected $wPt, $hPt; // dimensions of current page in points
31
- protected $w, $h; // dimensions of current page in user unit
32
- protected $lMargin; // left margin
33
- protected $tMargin; // top margin
34
- protected $rMargin; // right margin
35
- protected $bMargin; // page break margin
36
- protected $cMargin; // cell margin
37
- protected $x, $y; // current position in user unit
38
- protected $lasth; // height of last printed cell
39
- protected $LineWidth; // line width in user unit
40
- protected $fontpath; // path containing fonts
41
- protected $CoreFonts; // array of core font names
42
- protected $fonts; // array of used fonts
43
- protected $FontFiles; // array of font files
44
- protected $encodings; // array of encodings
45
- protected $cmaps; // array of ToUnicode CMaps
46
- protected $FontFamily; // current font family
47
- protected $FontStyle; // current font style
48
- protected $underline; // underlining flag
49
- protected $CurrentFont; // current font info
50
- protected $FontSizePt; // current font size in points
51
- protected $FontSize; // current font size in user unit
52
- protected $DrawColor; // commands for drawing color
53
- protected $FillColor; // commands for filling color
54
- protected $TextColor; // commands for text color
55
- protected $ColorFlag; // indicates whether fill and text colors are different
56
- protected $WithAlpha; // indicates whether alpha channel is used
57
- protected $ws; // word spacing
58
- protected $images; // array of used images
59
- protected $PageLinks; // array of links in pages
60
- protected $links; // array of internal links
61
- protected $AutoPageBreak; // automatic page breaking
62
- protected $PageBreakTrigger; // threshold used to trigger page breaks
63
- protected $InHeader; // flag set when processing header
64
- protected $InFooter; // flag set when processing footer
65
- protected $AliasNbPages; // alias for total number of pages
66
- protected $ZoomMode; // zoom display mode
67
- protected $LayoutMode; // layout display mode
68
- protected $metadata; // document properties
69
- protected $PDFVersion; // PDF version number
70
-
71
- /*******************************************************************************
72
- * Public methods *
73
- *******************************************************************************/
74
-
75
- function __construct($orientation='P', $unit='mm', $size='A4')
76
- {
77
- // Some checks
78
- $this->_dochecks();
79
- // Initialization of properties
80
- $this->state = 0;
81
- $this->page = 0;
82
- $this->n = 2;
83
- $this->buffer = '';
84
- $this->pages = array();
85
- $this->PageInfo = array();
86
- $this->fonts = array();
87
- $this->FontFiles = array();
88
- $this->encodings = array();
89
- $this->cmaps = array();
90
- $this->images = array();
91
- $this->links = array();
92
- $this->InHeader = false;
93
- $this->InFooter = false;
94
- $this->lasth = 0;
95
- $this->FontFamily = '';
96
- $this->FontStyle = '';
97
- $this->FontSizePt = 12;
98
- $this->underline = false;
99
- $this->DrawColor = '0 G';
100
- $this->FillColor = '0 g';
101
- $this->TextColor = '0 g';
102
- $this->ColorFlag = false;
103
- $this->WithAlpha = false;
104
- $this->ws = 0;
105
- // Font path
106
- if(defined('FPDF_FONTPATH'))
107
- {
108
- $this->fontpath = FPDF_FONTPATH;
109
- if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\')
110
- $this->fontpath .= '/';
111
- }
112
- elseif(is_dir(dirname(__FILE__).'/font'))
113
- $this->fontpath = dirname(__FILE__).'/font/';
114
- else
115
- $this->fontpath = '';
116
- // Core fonts
117
- $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
118
- // Scale factor
119
- if($unit=='pt')
120
- $this->k = 1;
121
- elseif($unit=='mm')
122
- $this->k = 72/25.4;
123
- elseif($unit=='cm')
124
- $this->k = 72/2.54;
125
- elseif($unit=='in')
126
- $this->k = 72;
127
- else
128
- $this->Error('Incorrect unit: '.$unit);
129
- // Page sizes
130
- $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
131
- 'letter'=>array(612,792), 'legal'=>array(612,1008));
132
- $size = $this->_getpagesize($size);
133
- $this->DefPageSize = $size;
134
- $this->CurPageSize = $size;
135
- // Page orientation
136
- $orientation = strtolower($orientation);
137
- if($orientation=='p' || $orientation=='portrait')
138
- {
139
- $this->DefOrientation = 'P';
140
- $this->w = $size[0];
141
- $this->h = $size[1];
142
- }
143
- elseif($orientation=='l' || $orientation=='landscape')
144
- {
145
- $this->DefOrientation = 'L';
146
- $this->w = $size[1];
147
- $this->h = $size[0];
148
- }
149
- else
150
- $this->Error('Incorrect orientation: '.$orientation);
151
- $this->CurOrientation = $this->DefOrientation;
152
- $this->wPt = $this->w*$this->k;
153
- $this->hPt = $this->h*$this->k;
154
- // Page rotation
155
- $this->CurRotation = 0;
156
- // Page margins (1 cm)
157
- $margin = 28.35/$this->k;
158
- $this->SetMargins($margin,$margin);
159
- // Interior cell margin (1 mm)
160
- $this->cMargin = $margin/10;
161
- // Line width (0.2 mm)
162
- $this->LineWidth = .567/$this->k;
163
- // Automatic page break
164
- $this->SetAutoPageBreak(true,2*$margin);
165
- // Default display mode
166
- $this->SetDisplayMode('default');
167
- // Enable compression
168
- $this->SetCompression(true);
169
- // Set default PDF version number
170
- $this->PDFVersion = '1.3';
171
- }
172
 
173
- function SetMargins($left, $top, $right=null)
174
- {
175
- // Set left, top and right margins
176
- $this->lMargin = $left;
177
- $this->tMargin = $top;
178
- if($right===null)
179
- $right = $left;
180
- $this->rMargin = $right;
181
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
- function SetLeftMargin($margin)
184
- {
185
- // Set left margin
186
- $this->lMargin = $margin;
187
- if($this->page>0 && $this->x<$margin)
188
- $this->x = $margin;
189
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
- function SetTopMargin($margin)
192
- {
193
- // Set top margin
194
- $this->tMargin = $margin;
195
- }
196
 
197
- function SetRightMargin($margin)
198
- {
199
- // Set right margin
200
- $this->rMargin = $margin;
201
- }
202
 
203
- function SetAutoPageBreak($auto, $margin=0)
204
- {
205
- // Set auto page break mode and triggering margin
206
- $this->AutoPageBreak = $auto;
207
- $this->bMargin = $margin;
208
- $this->PageBreakTrigger = $this->h-$margin;
209
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
- function SetDisplayMode($zoom, $layout='default')
212
- {
213
- // Set display mode in viewer
214
- if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
215
- $this->ZoomMode = $zoom;
216
- else
217
- $this->Error('Incorrect zoom display mode: '.$zoom);
218
- if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
219
- $this->LayoutMode = $layout;
220
- else
221
- $this->Error('Incorrect layout display mode: '.$layout);
222
- }
223
 
224
- function SetCompression($compress)
225
- {
226
- // Set page compression
227
- if(function_exists('gzcompress'))
228
- $this->compress = $compress;
229
- else
230
- $this->compress = false;
231
- }
 
 
 
232
 
233
- function SetTitle($title, $isUTF8=false)
234
- {
235
- // Title of document
236
- $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title);
237
- }
 
 
238
 
239
- function SetAuthor($author, $isUTF8=false)
240
- {
241
- // Author of document
242
- $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author);
243
- }
 
 
 
 
 
 
 
244
 
245
- function SetSubject($subject, $isUTF8=false)
246
- {
247
- // Subject of document
248
- $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject);
249
- }
 
 
 
 
250
 
251
- function SetKeywords($keywords, $isUTF8=false)
252
- {
253
- // Keywords of document
254
- $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords);
255
- }
 
 
 
256
 
257
- function SetCreator($creator, $isUTF8=false)
258
- {
259
- // Creator of document
260
- $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator);
261
- }
262
 
263
- function AliasNbPages($alias='{nb}')
264
- {
265
- // Define an alias for total number of pages
266
- $this->AliasNbPages = $alias;
267
- }
 
 
 
 
 
 
268
 
269
- function Error($msg)
270
- {
271
- // Fatal error
272
- throw new Exception('FPDF error: '.$msg);
273
- }
274
 
275
- function Close()
276
- {
277
- // Terminate document
278
- if($this->state==3)
279
- return;
280
- if($this->page==0)
281
- $this->AddPage();
282
- // Page footer
283
- $this->InFooter = true;
284
- $this->Footer();
285
- $this->InFooter = false;
286
- // Close page
287
- $this->_endpage();
288
- // Close document
289
- $this->_enddoc();
290
- }
291
 
292
- function AddPage($orientation='', $size='', $rotation=0)
293
- {
294
- // Start a new page
295
- if($this->state==3)
296
- $this->Error('The document is closed');
297
- $family = $this->FontFamily;
298
- $style = $this->FontStyle.($this->underline ? 'U' : '');
299
- $fontsize = $this->FontSizePt;
300
- $lw = $this->LineWidth;
301
- $dc = $this->DrawColor;
302
- $fc = $this->FillColor;
303
- $tc = $this->TextColor;
304
- $cf = $this->ColorFlag;
305
- if($this->page>0)
306
- {
307
- // Page footer
308
- $this->InFooter = true;
309
- $this->Footer();
310
- $this->InFooter = false;
311
- // Close page
312
- $this->_endpage();
313
- }
314
- // Start new page
315
- $this->_beginpage($orientation,$size,$rotation);
316
- // Set line cap style to square
317
- $this->_out('2 J');
318
- // Set line width
319
- $this->LineWidth = $lw;
320
- $this->_out(sprintf('%.2F w',$lw*$this->k));
321
- // Set font
322
- if($family)
323
- $this->SetFont($family,$style,$fontsize);
324
- // Set colors
325
- $this->DrawColor = $dc;
326
- if($dc!='0 G')
327
- $this->_out($dc);
328
- $this->FillColor = $fc;
329
- if($fc!='0 g')
330
- $this->_out($fc);
331
- $this->TextColor = $tc;
332
- $this->ColorFlag = $cf;
333
- // Page header
334
- $this->InHeader = true;
335
- $this->Header();
336
- $this->InHeader = false;
337
- // Restore line width
338
- if($this->LineWidth!=$lw)
339
- {
340
- $this->LineWidth = $lw;
341
- $this->_out(sprintf('%.2F w',$lw*$this->k));
342
- }
343
- // Restore font
344
- if($family)
345
- $this->SetFont($family,$style,$fontsize);
346
- // Restore colors
347
- if($this->DrawColor!=$dc)
348
- {
349
- $this->DrawColor = $dc;
350
- $this->_out($dc);
351
- }
352
- if($this->FillColor!=$fc)
353
- {
354
- $this->FillColor = $fc;
355
- $this->_out($fc);
356
- }
357
- $this->TextColor = $tc;
358
- $this->ColorFlag = $cf;
359
- }
360
 
361
- function Header()
362
- {
363
- // To be implemented in your own inherited class
364
- }
 
 
 
 
 
365
 
366
- function Footer()
367
- {
368
- // To be implemented in your own inherited class
369
- }
370
 
371
- function PageNo()
372
- {
373
- // Get current page number
374
- return $this->page;
375
- }
376
 
377
- function SetDrawColor($r, $g=null, $b=null)
378
- {
379
- // Set color for all stroking operations
380
- if(($r==0 && $g==0 && $b==0) || $g===null)
381
- $this->DrawColor = sprintf('%.3F G',$r/255);
382
- else
383
- $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
384
- if($this->page>0)
385
- $this->_out($this->DrawColor);
386
- }
387
 
388
- function SetFillColor($r, $g=null, $b=null)
389
- {
390
- // Set color for all filling operations
391
- if(($r==0 && $g==0 && $b==0) || $g===null)
392
- $this->FillColor = sprintf('%.3F g',$r/255);
393
- else
394
- $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
395
- $this->ColorFlag = ($this->FillColor!=$this->TextColor);
396
- if($this->page>0)
397
- $this->_out($this->FillColor);
398
- }
 
 
 
 
 
 
 
 
 
 
 
399
 
400
- function SetTextColor($r, $g=null, $b=null)
401
- {
402
- // Set color for text
403
- if(($r==0 && $g==0 && $b==0) || $g===null)
404
- $this->TextColor = sprintf('%.3F g',$r/255);
405
- else
406
- $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
407
- $this->ColorFlag = ($this->FillColor!=$this->TextColor);
408
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
- function GetStringWidth($s)
411
- {
412
- // Get width of a string in the current font
413
- $s = (string)$s;
414
- $cw = &$this->CurrentFont['cw'];
415
- $w = 0;
416
- $l = strlen($s);
417
- for($i=0;$i<$l;$i++)
418
- $w += $cw[$s[$i]];
419
- return $w*$this->FontSize/1000;
420
- }
421
 
422
- function SetLineWidth($width)
423
- {
424
- // Set line width
425
- $this->LineWidth = $width;
426
- if($this->page>0)
427
- $this->_out(sprintf('%.2F w',$width*$this->k));
428
- }
 
 
 
 
 
429
 
430
- function Line($x1, $y1, $x2, $y2)
431
- {
432
- // Draw a line
433
- $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
434
- }
435
 
436
- function Rect($x, $y, $w, $h, $style='')
437
- {
438
- // Draw a rectangle
439
- if($style=='F')
440
- $op = 'f';
441
- elseif($style=='FD' || $style=='DF')
442
- $op = 'B';
443
- else
444
- $op = 'S';
445
- $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
446
- }
 
 
 
447
 
448
- function AddFont($family, $style='', $file='')
449
- {
450
- // Add a TrueType, OpenType or Type1 font
451
- $family = strtolower($family);
452
- if($file=='')
453
- $file = str_replace(' ','',$family).strtolower($style).'.php';
454
- $style = strtoupper($style);
455
- if($style=='IB')
456
- $style = 'BI';
457
- $fontkey = $family.$style;
458
- if(isset($this->fonts[$fontkey]))
459
- return;
460
- $info = $this->_loadfont($file);
461
- $info['i'] = count($this->fonts)+1;
462
- if(!empty($info['file']))
463
- {
464
- // Embedded font
465
- if($info['type']=='TrueType')
466
- $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
467
- else
468
- $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
469
- }
470
- $this->fonts[$fontkey] = $info;
471
- }
472
 
473
- function SetFont($family, $style='', $size=0)
474
- {
475
- // Select a font; size given in points
476
- if($family=='')
477
- $family = $this->FontFamily;
478
- else
479
- $family = strtolower($family);
480
- $style = strtoupper($style);
481
- if(strpos($style,'U')!==false)
482
- {
483
- $this->underline = true;
484
- $style = str_replace('U','',$style);
485
- }
486
- else
487
- $this->underline = false;
488
- if($style=='IB')
489
- $style = 'BI';
490
- if($size==0)
491
- $size = $this->FontSizePt;
492
- // Test if font is already selected
493
- if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
494
- return;
495
- // Test if font is already loaded
496
- $fontkey = $family.$style;
497
- if(!isset($this->fonts[$fontkey]))
498
- {
499
- // Test if one of the core fonts
500
- if($family=='arial')
501
- $family = 'helvetica';
502
- if(in_array($family,$this->CoreFonts))
503
- {
504
- if($family=='symbol' || $family=='zapfdingbats')
505
- $style = '';
506
- $fontkey = $family.$style;
507
- if(!isset($this->fonts[$fontkey]))
508
- $this->AddFont($family,$style);
509
- }
510
- else
511
- $this->Error('Undefined font: '.$family.' '.$style);
512
- }
513
- // Select it
514
- $this->FontFamily = $family;
515
- $this->FontStyle = $style;
516
- $this->FontSizePt = $size;
517
- $this->FontSize = $size/$this->k;
518
- $this->CurrentFont = &$this->fonts[$fontkey];
519
- if($this->page>0)
520
- $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
521
- }
522
 
523
- function SetFontSize($size)
524
- {
525
- // Set font size in points
526
- if($this->FontSizePt==$size)
527
- return;
528
- $this->FontSizePt = $size;
529
- $this->FontSize = $size/$this->k;
530
- if($this->page>0)
531
- $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
532
- }
533
 
534
- function AddLink()
535
- {
536
- // Create a new internal link
537
- $n = count($this->links)+1;
538
- $this->links[$n] = array(0, 0);
539
- return $n;
540
- }
541
 
542
- function SetLink($link, $y=0, $page=-1)
543
- {
544
- // Set destination of internal link
545
- if($y==-1)
546
- $y = $this->y;
547
- if($page==-1)
548
- $page = $this->page;
549
- $this->links[$link] = array($page, $y);
550
- }
551
 
552
- function Link($x, $y, $w, $h, $link)
553
- {
554
- // Put a link on the page
555
- $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
556
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
 
558
- function Text($x, $y, $txt)
559
- {
560
- // Output a string
561
- if(!isset($this->CurrentFont))
562
- $this->Error('No font has been set');
563
- $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
564
- if($this->underline && $txt!='')
565
- $s .= ' '.$this->_dounderline($x,$y,$txt);
566
- if($this->ColorFlag)
567
- $s = 'q '.$this->TextColor.' '.$s.' Q';
568
- $this->_out($s);
569
- }
 
570
 
571
- function AcceptPageBreak()
572
- {
573
- // Accept automatic page break or not
574
- return $this->AutoPageBreak;
575
- }
576
 
577
- function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
578
- {
579
- // Output a cell
580
- $k = $this->k;
581
- if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
582
- {
583
- // Automatic page break
584
- $x = $this->x;
585
- $ws = $this->ws;
586
- if($ws>0)
587
- {
588
- $this->ws = 0;
589
- $this->_out('0 Tw');
590
- }
591
- $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation);
592
- $this->x = $x;
593
- if($ws>0)
594
- {
595
- $this->ws = $ws;
596
- $this->_out(sprintf('%.3F Tw',$ws*$k));
597
- }
598
- }
599
- if($w==0)
600
- $w = $this->w-$this->rMargin-$this->x;
601
- $s = '';
602
- if($fill || $border==1)
603
- {
604
- if($fill)
605
- $op = ($border==1) ? 'B' : 'f';
606
- else
607
- $op = 'S';
608
- $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
609
- }
610
- if(is_string($border))
611
- {
612
- $x = $this->x;
613
- $y = $this->y;
614
- if(strpos($border,'L')!==false)
615
- $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
616
- if(strpos($border,'T')!==false)
617
- $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
618
- if(strpos($border,'R')!==false)
619
- $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
620
- if(strpos($border,'B')!==false)
621
- $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
622
- }
623
- if($txt!=='')
624
- {
625
- if ( function_exists('iconv') ) {
626
- $txt = iconv('UTF-8', 'windows-1252', $txt);
627
- }
628
-
629
- if(!isset($this->CurrentFont))
630
- $this->Error('No font has been set');
631
- if($align=='R')
632
- $dx = $w-$this->cMargin-$this->GetStringWidth($txt);
633
- elseif($align=='C')
634
- $dx = ($w-$this->GetStringWidth($txt))/2;
635
- else
636
- $dx = $this->cMargin;
637
- if($this->ColorFlag)
638
- $s .= 'q '.$this->TextColor.' ';
639
- $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
640
- if($this->underline)
641
- $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
642
- if($this->ColorFlag)
643
- $s .= ' Q';
644
- if($link)
645
- $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
646
- }
647
- if($s)
648
- $this->_out($s);
649
- $this->lasth = $h;
650
- if($ln>0)
651
- {
652
- // Go to next line
653
- $this->y += $h;
654
- if($ln==1)
655
- $this->x = $this->lMargin;
656
- }
657
- else
658
- $this->x += $w;
659
- }
660
 
661
- function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false)
662
- {
663
- // Output text with automatic or explicit line breaks
664
- if(!isset($this->CurrentFont))
665
- $this->Error('No font has been set');
666
- $cw = &$this->CurrentFont['cw'];
667
- if($w==0)
668
- $w = $this->w-$this->rMargin-$this->x;
669
- $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
670
- $s = str_replace("\r",'',$txt);
671
- $nb = strlen($s);
672
- if($nb>0 && $s[$nb-1]=="\n")
673
- $nb--;
674
- $b = 0;
675
- if($border)
676
- {
677
- if($border==1)
678
- {
679
- $border = 'LTRB';
680
- $b = 'LRT';
681
- $b2 = 'LR';
682
- }
683
- else
684
- {
685
- $b2 = '';
686
- if(strpos($border,'L')!==false)
687
- $b2 .= 'L';
688
- if(strpos($border,'R')!==false)
689
- $b2 .= 'R';
690
- $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
691
- }
692
- }
693
- $sep = -1;
694
- $i = 0;
695
- $j = 0;
696
- $l = 0;
697
- $ns = 0;
698
- $nl = 1;
699
- while($i<$nb)
700
- {
701
- // Get next character
702
- $c = $s[$i];
703
- if($c=="\n")
704
- {
705
- // Explicit line break
706
- if($this->ws>0)
707
- {
708
- $this->ws = 0;
709
- $this->_out('0 Tw');
710
- }
711
- $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
712
- $i++;
713
- $sep = -1;
714
- $j = $i;
715
- $l = 0;
716
- $ns = 0;
717
- $nl++;
718
- if($border && $nl==2)
719
- $b = $b2;
720
- continue;
721
- }
722
- if($c==' ')
723
- {
724
- $sep = $i;
725
- $ls = $l;
726
- $ns++;
727
- }
728
- $l += $cw[$c];
729
- if($l>$wmax)
730
- {
731
- // Automatic line break
732
- if($sep==-1)
733
- {
734
- if($i==$j)
735
- $i++;
736
- if($this->ws>0)
737
- {
738
- $this->ws = 0;
739
- $this->_out('0 Tw');
740
- }
741
- $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
742
- }
743
- else
744
- {
745
- if($align=='J')
746
- {
747
- $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
748
- $this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
749
  }
750
- $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
751
- $i = $sep+1;
752
- }
753
- $sep = -1;
754
- $j = $i;
755
- $l = 0;
756
- $ns = 0;
757
- $nl++;
758
- if($border && $nl==2)
759
- $b = $b2;
760
- }
761
- else
762
- $i++;
763
- }
764
- // Last chunk
765
- if($this->ws>0)
766
- {
767
- $this->ws = 0;
768
- $this->_out('0 Tw');
769
- }
770
- if($border && strpos($border,'B')!==false)
771
- $b .= 'B';
772
- $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
773
- $this->x = $this->lMargin;
774
- }
775
 
776
- function Write($h, $txt, $link='')
777
- {
778
- // Output text in flowing mode
779
- if(!isset($this->CurrentFont))
780
- $this->Error('No font has been set');
781
- $cw = &$this->CurrentFont['cw'];
782
- $w = $this->w-$this->rMargin-$this->x;
783
- $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
784
- $s = str_replace("\r",'',$txt);
785
- $nb = strlen($s);
786
- $sep = -1;
787
- $i = 0;
788
- $j = 0;
789
- $l = 0;
790
- $nl = 1;
791
- while($i<$nb)
792
- {
793
- // Get next character
794
- $c = $s[$i];
795
- if($c=="\n")
796
- {
797
- // Explicit line break
798
- $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
799
- $i++;
800
- $sep = -1;
801
- $j = $i;
802
- $l = 0;
803
- if($nl==1)
804
- {
805
- $this->x = $this->lMargin;
806
- $w = $this->w-$this->rMargin-$this->x;
807
- $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
808
- }
809
- $nl++;
810
- continue;
811
- }
812
- if($c==' ')
813
- $sep = $i;
814
- $l += $cw[$c];
815
- if($l>$wmax)
816
- {
817
- // Automatic line break
818
- if($sep==-1)
819
- {
820
- if($this->x>$this->lMargin)
821
- {
822
- // Move to next line
823
- $this->x = $this->lMargin;
824
- $this->y += $h;
825
- $w = $this->w-$this->rMargin-$this->x;
826
- $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
827
- $i++;
828
- $nl++;
829
- continue;
830
  }
831
- if($i==$j)
832
- $i++;
833
- $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
834
- }
835
- else
836
- {
837
- $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link);
838
- $i = $sep+1;
839
- }
840
- $sep = -1;
841
- $j = $i;
842
- $l = 0;
843
- if($nl==1)
844
- {
845
- $this->x = $this->lMargin;
846
- $w = $this->w-$this->rMargin-$this->x;
847
- $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
848
- }
849
- $nl++;
850
- }
851
- else
852
- $i++;
853
- }
854
- // Last chunk
855
- if($i!=$j)
856
- $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
857
- }
858
 
859
- function Ln($h=null)
860
- {
861
- // Line feed; default value is the last cell height
862
- $this->x = $this->lMargin;
863
- if($h===null)
864
- $this->y += $this->lasth;
865
- else
866
- $this->y += $h;
867
- }
868
 
869
- function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
870
- {
871
- // Put an image on the page
872
- if($file=='')
873
- $this->Error('Image file name is empty');
874
- if(!isset($this->images[$file]))
875
- {
876
- // First use of this image, get info
877
- if($type=='')
878
- {
879
- $pos = strrpos($file,'.');
880
- if(!$pos)
881
- $this->Error('Image file has no extension and no type was specified: '.$file);
882
- $type = substr($file,$pos+1);
883
- }
884
- $type = strtolower($type);
885
- if($type=='jpeg')
886
- $type = 'jpg';
887
- $mtd = '_parse'.$type;
888
- if(!method_exists($this,$mtd))
889
- $this->Error('Unsupported image type: '.$type);
890
- $info = $this->$mtd($file);
891
- $info['i'] = count($this->images)+1;
892
- $this->images[$file] = $info;
893
- }
894
- else
895
- $info = $this->images[$file];
896
-
897
- // Automatic width and height calculation if needed
898
- if($w==0 && $h==0)
899
- {
900
- // Put image at 96 dpi
901
- $w = -96;
902
- $h = -96;
903
- }
904
- if($w<0)
905
- $w = -$info['w']*72/$w/$this->k;
906
- if($h<0)
907
- $h = -$info['h']*72/$h/$this->k;
908
- if($w==0)
909
- $w = $h*$info['w']/$info['h'];
910
- if($h==0)
911
- $h = $w*$info['h']/$info['w'];
912
-
913
- // Flowing mode
914
- if($y===null)
915
- {
916
- if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
917
- {
918
- // Automatic page break
919
- $x2 = $this->x;
920
- $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation);
921
- $this->x = $x2;
922
  }
923
- $y = $this->y;
924
- $this->y += $h;
925
- }
926
 
927
- if($x===null)
928
- $x = $this->x;
929
- $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
930
- if($link)
931
- $this->Link($x,$y,$w,$h,$link);
932
- }
933
 
934
- function GetPageWidth()
935
- {
936
- // Get current page width
937
- return $this->w;
938
- }
 
 
 
939
 
940
- function GetPageHeight()
941
- {
942
- // Get current page height
943
- return $this->h;
944
- }
945
 
946
- function GetX()
947
- {
948
- // Get x position
949
- return $this->x;
950
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
951
 
952
- function SetX($x)
953
- {
954
- // Set x position
955
- if($x>=0)
956
- $this->x = $x;
957
- else
958
- $this->x = $this->w+$x;
959
- }
960
 
961
- function GetY()
962
- {
963
- // Get y position
964
- return $this->y;
965
- }
 
 
 
966
 
967
- function SetY($y, $resetX=true)
968
- {
969
- // Set y position and optionally reset x
970
- if($y>=0)
971
- $this->y = $y;
972
- else
973
- $this->y = $this->h+$y;
974
- if($resetX)
975
- $this->x = $this->lMargin;
976
- }
977
 
978
- function SetXY($x, $y)
979
- {
980
- // Set x and y positions
981
- $this->SetX($x);
982
- $this->SetY($y,false);
983
- }
 
 
 
 
 
984
 
985
- function Output($dest='', $name='', $isUTF8=false)
986
- {
987
- // Output PDF to some destination
988
- $this->Close();
989
- if(strlen($name)==1 && strlen($dest)!=1)
990
- {
991
- // Fix parameter order
992
- $tmp = $dest;
993
- $dest = $name;
994
- $name = $tmp;
995
- }
996
- if($dest=='')
997
- $dest = 'I';
998
- if($name=='')
999
- $name = 'doc.pdf';
1000
- switch(strtoupper($dest))
1001
- {
1002
- case 'I':
1003
- // Send to standard output
1004
- $this->_checkoutput();
1005
- if(PHP_SAPI!='cli')
1006
- {
1007
- // We send to a browser
1008
- header('Content-Type: application/pdf');
1009
- header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8));
1010
- header('Cache-Control: private, max-age=0, must-revalidate');
1011
- header('Pragma: public');
1012
- }
1013
- echo $this->buffer;
1014
- break;
1015
- case 'D':
1016
- // Download file
1017
- $this->_checkoutput();
1018
- header('Content-Type: application/x-download');
1019
- header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8));
1020
- header('Cache-Control: private, max-age=0, must-revalidate');
1021
- header('Pragma: public');
1022
- echo $this->buffer;
1023
- break;
1024
- case 'F':
1025
- // Save to local file
1026
- if(!file_put_contents($name,$this->buffer))
1027
- $this->Error('Unable to create output file: '.$name);
1028
- break;
1029
- case 'S':
1030
- // Return as a string
1031
- return $this->buffer;
1032
- default:
1033
- $this->Error('Incorrect output destination: '.$dest);
1034
- }
1035
- return '';
1036
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1037
 
1038
- /*******************************************************************************
1039
- * Protected methods *
1040
- *******************************************************************************/
1041
-
1042
- protected function _dochecks()
1043
- {
1044
- // Check mbstring overloading
1045
- if(ini_get('mbstring.func_overload') & 2)
1046
- $this->Error('mbstring overloading must be disabled');
1047
- // Ensure runtime magic quotes are disabled
1048
- if(get_magic_quotes_runtime())
1049
- @set_magic_quotes_runtime(0);
1050
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1051
 
1052
- protected function _checkoutput()
1053
- {
1054
- if(PHP_SAPI!='cli')
1055
- {
1056
- if(headers_sent($file,$line))
1057
- $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
1058
- }
1059
- if(ob_get_length())
1060
- {
1061
- // The output buffer is not empty
1062
- if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
1063
- {
1064
- // It contains only a UTF-8 BOM and/or whitespace, let's clean it
1065
- ob_clean();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1066
  }
1067
- else
1068
- $this->Error("Some data has already been output, can't send PDF file");
1069
  }
1070
- }
1071
 
1072
- protected function _getpagesize($size)
1073
- {
1074
- if(is_string($size))
1075
- {
1076
- $size = strtolower($size);
1077
- if(!isset($this->StdPageSizes[$size]))
1078
- $this->Error('Unknown page size: '.$size);
1079
- $a = $this->StdPageSizes[$size];
1080
- return array($a[0]/$this->k, $a[1]/$this->k);
1081
- }
1082
- else
1083
- {
1084
- if($size[0]>$size[1])
1085
- return array($size[1], $size[0]);
1086
- else
1087
- return $size;
1088
- }
1089
- }
1090
 
1091
- protected function _beginpage($orientation, $size, $rotation)
1092
- {
1093
- $this->page++;
1094
- $this->pages[$this->page] = '';
1095
- $this->state = 2;
1096
- $this->x = $this->lMargin;
1097
- $this->y = $this->tMargin;
1098
- $this->FontFamily = '';
1099
- // Check page size and orientation
1100
- if($orientation=='')
1101
- $orientation = $this->DefOrientation;
1102
- else
1103
- $orientation = strtoupper($orientation[0]);
1104
- if($size=='')
1105
- $size = $this->DefPageSize;
1106
- else
1107
- $size = $this->_getpagesize($size);
1108
- if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1])
1109
- {
1110
- // New size or orientation
1111
- if($orientation=='P')
1112
- {
1113
- $this->w = $size[0];
1114
- $this->h = $size[1];
1115
- }
1116
- else
1117
- {
1118
- $this->w = $size[1];
1119
- $this->h = $size[0];
1120
- }
1121
- $this->wPt = $this->w*$this->k;
1122
- $this->hPt = $this->h*$this->k;
1123
- $this->PageBreakTrigger = $this->h-$this->bMargin;
1124
- $this->CurOrientation = $orientation;
1125
- $this->CurPageSize = $size;
1126
- }
1127
- if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1])
1128
- $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt);
1129
- if($rotation!=0)
1130
- {
1131
- if($rotation%90!=0)
1132
- $this->Error('Incorrect rotation value: '.$rotation);
1133
- $this->CurRotation = $rotation;
1134
- $this->PageInfo[$this->page]['rotation'] = $rotation;
1135
- }
1136
- }
1137
 
1138
- protected function _endpage()
1139
- {
1140
- $this->state = 1;
1141
- }
1142
 
1143
- protected function _loadfont($font)
1144
- {
1145
- // Load a font definition file from the font directory
1146
- if(strpos($font,'/')!==false || strpos($font,"\\")!==false)
1147
- $this->Error('Incorrect font definition file name: '.$font);
1148
- include($this->fontpath.$font);
1149
- if(!isset($name))
1150
- $this->Error('Could not include font definition file');
1151
- if(isset($enc))
1152
- $enc = strtolower($enc);
1153
- if(!isset($subsetted))
1154
- $subsetted = false;
1155
- return get_defined_vars();
1156
- }
1157
 
1158
- protected function _isascii($s)
1159
- {
1160
- // Test if string is ASCII
1161
- $nb = strlen($s);
1162
- for($i=0;$i<$nb;$i++)
1163
- {
1164
- if(ord($s[$i])>127)
1165
- return false;
1166
- }
1167
- return true;
1168
- }
1169
 
1170
- protected function _httpencode($param, $value, $isUTF8)
1171
- {
1172
- // Encode HTTP header field parameter
1173
- if($this->_isascii($value))
1174
- return $param.'="'.$value.'"';
1175
- if(!$isUTF8)
1176
- $value = utf8_encode($value);
1177
- if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false)
1178
- return $param.'="'.rawurlencode($value).'"';
1179
- else
1180
- return $param."*=UTF-8''".rawurlencode($value);
1181
- }
1182
 
1183
- protected function _UTF8toUTF16($s)
1184
- {
1185
- // Convert UTF-8 to UTF-16BE with BOM
1186
- $res = "\xFE\xFF";
1187
- $nb = strlen($s);
1188
- $i = 0;
1189
- while($i<$nb)
1190
- {
1191
- $c1 = ord($s[$i++]);
1192
- if($c1>=224)
1193
- {
1194
- // 3-byte character
1195
- $c2 = ord($s[$i++]);
1196
- $c3 = ord($s[$i++]);
1197
- $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
1198
- $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
1199
- }
1200
- elseif($c1>=192)
1201
- {
1202
- // 2-byte character
1203
- $c2 = ord($s[$i++]);
1204
- $res .= chr(($c1 & 0x1C)>>2);
1205
- $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
1206
- }
1207
- else
1208
- {
1209
- // Single-byte character
1210
- $res .= "\0".chr($c1);
1211
- }
1212
- }
1213
- return $res;
1214
- }
1215
 
1216
- protected function _escape($s)
1217
- {
1218
- // Escape special characters
1219
- if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
1220
- return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
1221
- else
1222
- return $s;
1223
- }
1224
 
1225
- protected function _textstring($s)
1226
- {
1227
- // Format a text string
1228
- if(!$this->_isascii($s))
1229
- $s = $this->_UTF8toUTF16($s);
1230
- return '('.$this->_escape($s).')';
1231
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1232
 
1233
- protected function _dounderline($x, $y, $txt)
1234
- {
1235
- // Underline text
1236
- $up = $this->CurrentFont['up'];
1237
- $ut = $this->CurrentFont['ut'];
1238
- $w = $this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
1239
- return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
1240
- }
1241
 
1242
- protected function _parsejpg($file)
1243
- {
1244
- // Extract info from a JPEG file
1245
- $a = getimagesize($file);
1246
- if(!$a)
1247
- $this->Error('Missing or incorrect image file: '.$file);
1248
- if($a[2]!=2)
1249
- $this->Error('Not a JPEG file: '.$file);
1250
- if(!isset($a['channels']) || $a['channels']==3)
1251
- $colspace = 'DeviceRGB';
1252
- elseif($a['channels']==4)
1253
- $colspace = 'DeviceCMYK';
1254
- else
1255
- $colspace = 'DeviceGray';
1256
- $bpc = isset($a['bits']) ? $a['bits'] : 8;
1257
- $data = file_get_contents($file);
1258
- return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
1259
- }
1260
 
1261
- protected function _parsepng($file)
1262
- {
1263
- // Extract info from a PNG file
1264
- $f = fopen($file,'rb');
1265
- if(!$f)
1266
- $this->Error('Can\'t open image file: '.$file);
1267
- $info = $this->_parsepngstream($f,$file);
1268
- fclose($f);
1269
- return $info;
1270
- }
1271
 
1272
- protected function _parsepngstream($f, $file)
1273
- {
1274
- // Check signature
1275
- if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
1276
- $this->Error('Not a PNG file: '.$file);
1277
-
1278
- // Read header chunk
1279
- $this->_readstream($f,4);
1280
- if($this->_readstream($f,4)!='IHDR')
1281
- $this->Error('Incorrect PNG file: '.$file);
1282
- $w = $this->_readint($f);
1283
- $h = $this->_readint($f);
1284
- $bpc = ord($this->_readstream($f,1));
1285
- if($bpc>8)
1286
- $this->Error('16-bit depth not supported: '.$file);
1287
- $ct = ord($this->_readstream($f,1));
1288
- if($ct==0 || $ct==4)
1289
- $colspace = 'DeviceGray';
1290
- elseif($ct==2 || $ct==6)
1291
- $colspace = 'DeviceRGB';
1292
- elseif($ct==3)
1293
- $colspace = 'Indexed';
1294
- else
1295
- $this->Error('Unknown color type: '.$file);
1296
- if(ord($this->_readstream($f,1))!=0)
1297
- $this->Error('Unknown compression method: '.$file);
1298
- if(ord($this->_readstream($f,1))!=0)
1299
- $this->Error('Unknown filter method: '.$file);
1300
- if(ord($this->_readstream($f,1))!=0)
1301
- $this->Error('Interlacing not supported: '.$file);
1302
- $this->_readstream($f,4);
1303
- $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w;
1304
-
1305
- // Scan chunks looking for palette, transparency and image data
1306
- $pal = '';
1307
- $trns = '';
1308
- $data = '';
1309
- do
1310
- {
1311
- $n = $this->_readint($f);
1312
- $type = $this->_readstream($f,4);
1313
- if($type=='PLTE')
1314
- {
1315
- // Read palette
1316
- $pal = $this->_readstream($f,$n);
1317
- $this->_readstream($f,4);
1318
- }
1319
- elseif($type=='tRNS')
1320
- {
1321
- // Read transparency info
1322
- $t = $this->_readstream($f,$n);
1323
- if($ct==0)
1324
- $trns = array(ord(substr($t,1,1)));
1325
- elseif($ct==2)
1326
- $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1)));
1327
- else
1328
- {
1329
- $pos = strpos($t,chr(0));
1330
- if($pos!==false)
1331
- $trns = array($pos);
1332
- }
1333
- $this->_readstream($f,4);
1334
- }
1335
- elseif($type=='IDAT')
1336
- {
1337
- // Read image data block
1338
- $data .= $this->_readstream($f,$n);
1339
- $this->_readstream($f,4);
1340
- }
1341
- elseif($type=='IEND')
1342
- break;
1343
- else
1344
- $this->_readstream($f,$n+4);
1345
- }
1346
- while($n);
1347
-
1348
- if($colspace=='Indexed' && empty($pal))
1349
- $this->Error('Missing palette in '.$file);
1350
- $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
1351
- if($ct>=4)
1352
- {
1353
- // Extract alpha channel
1354
- if(!function_exists('gzuncompress'))
1355
- $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
1356
- $data = gzuncompress($data);
1357
- $color = '';
1358
- $alpha = '';
1359
- if($ct==4)
1360
- {
1361
- // Gray image
1362
- $len = 2*$w;
1363
- for($i=0;$i<$h;$i++)
1364
- {
1365
- $pos = (1+$len)*$i;
1366
- $color .= $data[$pos];
1367
- $alpha .= $data[$pos];
1368
- $line = substr($data,$pos+1,$len);
1369
- $color .= preg_replace('/(.)./s','$1',$line);
1370
- $alpha .= preg_replace('/.(.)/s','$1',$line);
1371
- }
1372
- }
1373
- else
1374
- {
1375
- // RGB image
1376
- $len = 4*$w;
1377
- for($i=0;$i<$h;$i++)
1378
- {
1379
- $pos = (1+$len)*$i;
1380
- $color .= $data[$pos];
1381
- $alpha .= $data[$pos];
1382
- $line = substr($data,$pos+1,$len);
1383
- $color .= preg_replace('/(.{3})./s','$1',$line);
1384
- $alpha .= preg_replace('/.{3}(.)/s','$1',$line);
1385
- }
1386
- }
1387
- unset($data);
1388
- $data = gzcompress($color);
1389
- $info['smask'] = gzcompress($alpha);
1390
- $this->WithAlpha = true;
1391
- if($this->PDFVersion<'1.4')
1392
- $this->PDFVersion = '1.4';
1393
- }
1394
- $info['data'] = $data;
1395
- return $info;
1396
- }
1397
 
1398
- protected function _readstream($f, $n)
1399
- {
1400
- // Read n bytes from stream
1401
- $res = '';
1402
- while($n>0 && !feof($f))
1403
- {
1404
- $s = fread($f,$n);
1405
- if($s===false)
1406
- $this->Error('Error while reading stream');
1407
- $n -= strlen($s);
1408
- $res .= $s;
1409
- }
1410
- if($n>0)
1411
- $this->Error('Unexpected end of stream');
1412
- return $res;
1413
- }
1414
 
1415
- protected function _readint($f)
1416
- {
1417
- // Read a 4-byte integer from stream
1418
- $a = unpack('Ni',$this->_readstream($f,4));
1419
- return $a['i'];
1420
- }
 
 
 
 
1421
 
1422
- protected function _parsegif($file)
1423
- {
1424
- // Extract info from a GIF file (via PNG conversion)
1425
- if(!function_exists('imagepng'))
1426
- $this->Error('GD extension is required for GIF support');
1427
- if(!function_exists('imagecreatefromgif'))
1428
- $this->Error('GD has no GIF read support');
1429
- $im = imagecreatefromgif($file);
1430
- if(!$im)
1431
- $this->Error('Missing or incorrect image file: '.$file);
1432
- imageinterlace($im,0);
1433
- ob_start();
1434
- imagepng($im);
1435
- $data = ob_get_clean();
1436
- imagedestroy($im);
1437
- $f = fopen('php://temp','rb+');
1438
- if(!$f)
1439
- $this->Error('Unable to create memory stream');
1440
- fwrite($f,$data);
1441
- rewind($f);
1442
- $info = $this->_parsepngstream($f,$file);
1443
- fclose($f);
1444
- return $info;
1445
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1446
 
1447
- protected function _out($s)
1448
- {
1449
- // Add a line to the document
1450
- if($this->state==2)
1451
- $this->pages[$this->page] .= $s."\n";
1452
- elseif($this->state==1)
1453
- $this->_put($s);
1454
- elseif($this->state==0)
1455
- $this->Error('No page has been added yet');
1456
- elseif($this->state==3)
1457
- $this->Error('The document is closed');
1458
- }
1459
 
1460
- protected function _put($s)
1461
- {
1462
- $this->buffer .= $s."\n";
1463
- }
 
 
 
 
 
 
 
 
 
 
1464
 
1465
- protected function _getoffset()
1466
- {
1467
- return strlen($this->buffer);
1468
- }
 
 
 
 
 
 
 
 
 
 
1469
 
1470
- protected function _newobj($n=null)
1471
- {
1472
- // Begin a new object
1473
- if($n===null)
1474
- $n = ++$this->n;
1475
- $this->offsets[$n] = $this->_getoffset();
1476
- $this->_put($n.' 0 obj');
1477
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1478
 
1479
- protected function _putstream($data)
1480
- {
1481
- $this->_put('stream');
1482
- $this->_put($data);
1483
- $this->_put('endstream');
1484
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1485
 
1486
- protected function _putstreamobject($data)
1487
- {
1488
- if($this->compress)
1489
- {
1490
- $entries = '/Filter /FlateDecode ';
1491
- $data = gzcompress($data);
1492
- }
1493
- else
1494
- $entries = '';
1495
- $entries .= '/Length '.strlen($data);
1496
- $this->_newobj();
1497
- $this->_put('<<'.$entries.'>>');
1498
- $this->_putstream($data);
1499
- $this->_put('endobj');
1500
- }
1501
 
1502
- protected function _putpage($n)
1503
- {
1504
- $this->_newobj();
1505
- $this->_put('<</Type /Page');
1506
- $this->_put('/Parent 1 0 R');
1507
- if(isset($this->PageInfo[$n]['size']))
1508
- $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
1509
- if(isset($this->PageInfo[$n]['rotation']))
1510
- $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
1511
- $this->_put('/Resources 2 0 R');
1512
- if(isset($this->PageLinks[$n]))
1513
- {
1514
- // Links
1515
- $annots = '/Annots [';
1516
- foreach($this->PageLinks[$n] as $pl)
1517
- {
1518
- $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
1519
- $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1520
- if(is_string($pl[4]))
1521
- $annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
1522
- else
1523
- {
1524
- $l = $this->links[$pl[4]];
1525
- if(isset($this->PageInfo[$l[0]]['size']))
1526
- $h = $this->PageInfo[$l[0]]['size'][1];
1527
- else
1528
- $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k;
1529
- $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
1530
- }
1531
- }
1532
- $this->_put($annots.']');
1533
- }
1534
- if($this->WithAlpha)
1535
- $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
1536
- $this->_put('/Contents '.($this->n+1).' 0 R>>');
1537
- $this->_put('endobj');
1538
- // Page content
1539
- if(!empty($this->AliasNbPages))
1540
- $this->pages[$n] = str_replace($this->AliasNbPages,$this->page,$this->pages[$n]);
1541
- $this->_putstreamobject($this->pages[$n]);
1542
- }
1543
 
1544
- protected function _putpages()
1545
- {
1546
- $nb = $this->page;
1547
- for($n=1;$n<=$nb;$n++)
1548
- $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1);
1549
- for($n=1;$n<=$nb;$n++)
1550
- $this->_putpage($n);
1551
- // Pages root
1552
- $this->_newobj(1);
1553
- $this->_put('<</Type /Pages');
1554
- $kids = '/Kids [';
1555
- for($n=1;$n<=$nb;$n++)
1556
- $kids .= $this->PageInfo[$n]['n'].' 0 R ';
1557
- $this->_put($kids.']');
1558
- $this->_put('/Count '.$nb);
1559
- if($this->DefOrientation=='P')
1560
- {
1561
- $w = $this->DefPageSize[0];
1562
- $h = $this->DefPageSize[1];
1563
- }
1564
- else
1565
- {
1566
- $w = $this->DefPageSize[1];
1567
- $h = $this->DefPageSize[0];
1568
- }
1569
- $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$w*$this->k,$h*$this->k));
1570
- $this->_put('>>');
1571
- $this->_put('endobj');
1572
- }
 
 
 
 
 
 
 
 
1573
 
1574
- protected function _putfonts()
1575
- {
1576
- foreach($this->FontFiles as $file=>$info)
1577
- {
1578
- // Font file embedding
1579
- $this->_newobj();
1580
- $this->FontFiles[$file]['n'] = $this->n;
1581
- $font = file_get_contents($this->fontpath.$file,true);
1582
- if(!$font)
1583
- $this->Error('Font file not found: '.$file);
1584
- $compressed = (substr($file,-2)=='.z');
1585
- if(!$compressed && isset($info['length2']))
1586
- $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']);
1587
- $this->_put('<</Length '.strlen($font));
1588
- if($compressed)
1589
- $this->_put('/Filter /FlateDecode');
1590
- $this->_put('/Length1 '.$info['length1']);
1591
- if(isset($info['length2']))
1592
- $this->_put('/Length2 '.$info['length2'].' /Length3 0');
1593
- $this->_put('>>');
1594
- $this->_putstream($font);
1595
- $this->_put('endobj');
1596
- }
1597
- foreach($this->fonts as $k=>$font)
1598
- {
1599
- // Encoding
1600
- if(isset($font['diff']))
1601
- {
1602
- if(!isset($this->encodings[$font['enc']]))
1603
- {
1604
- $this->_newobj();
1605
- $this->_put('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$font['diff'].']>>');
1606
- $this->_put('endobj');
1607
- $this->encodings[$font['enc']] = $this->n;
1608
- }
1609
- }
1610
- // ToUnicode CMap
1611
- if(isset($font['uv']))
1612
- {
1613
- if(isset($font['enc']))
1614
- $cmapkey = $font['enc'];
1615
- else
1616
- $cmapkey = $font['name'];
1617
- if(!isset($this->cmaps[$cmapkey]))
1618
- {
1619
- $cmap = $this->_tounicodecmap($font['uv']);
1620
- $this->_putstreamobject($cmap);
1621
- $this->cmaps[$cmapkey] = $this->n;
1622
- }
1623
- }
1624
- // Font object
1625
- $this->fonts[$k]['n'] = $this->n+1;
1626
- $type = $font['type'];
1627
- $name = $font['name'];
1628
- if($font['subsetted'])
1629
- $name = 'AAAAAA+'.$name;
1630
- if($type=='Core')
1631
- {
1632
- // Core font
1633
- $this->_newobj();
1634
- $this->_put('<</Type /Font');
1635
- $this->_put('/BaseFont /'.$name);
1636
- $this->_put('/Subtype /Type1');
1637
- if($name!='Symbol' && $name!='ZapfDingbats')
1638
- $this->_put('/Encoding /WinAnsiEncoding');
1639
- if(isset($font['uv']))
1640
- $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
1641
- $this->_put('>>');
1642
- $this->_put('endobj');
1643
- }
1644
- elseif($type=='Type1' || $type=='TrueType')
1645
- {
1646
- // Additional Type1 or TrueType/OpenType font
1647
- $this->_newobj();
1648
- $this->_put('<</Type /Font');
1649
- $this->_put('/BaseFont /'.$name);
1650
- $this->_put('/Subtype /'.$type);
1651
- $this->_put('/FirstChar 32 /LastChar 255');
1652
- $this->_put('/Widths '.($this->n+1).' 0 R');
1653
- $this->_put('/FontDescriptor '.($this->n+2).' 0 R');
1654
- if(isset($font['diff']))
1655
- $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
1656
- else
1657
- $this->_put('/Encoding /WinAnsiEncoding');
1658
- if(isset($font['uv']))
1659
- $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
1660
- $this->_put('>>');
1661
- $this->_put('endobj');
1662
- // Widths
1663
- $this->_newobj();
1664
- $cw = &$font['cw'];
1665
- $s = '[';
1666
- for($i=32;$i<=255;$i++)
1667
- $s .= $cw[chr($i)].' ';
1668
- $this->_put($s.']');
1669
- $this->_put('endobj');
1670
- // Descriptor
1671
- $this->_newobj();
1672
- $s = '<</Type /FontDescriptor /FontName /'.$name;
1673
- foreach($font['desc'] as $k=>$v)
1674
- $s .= ' /'.$k.' '.$v;
1675
- if(!empty($font['file']))
1676
- $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
1677
- $this->_put($s.'>>');
1678
- $this->_put('endobj');
1679
- }
1680
- else
1681
- {
1682
- // Allow for additional types
1683
- $mtd = '_put'.strtolower($type);
1684
- if(!method_exists($this,$mtd))
1685
- $this->Error('Unsupported font type: '.$type);
1686
- $this->$mtd($font);
1687
  }
 
 
 
1688
  }
1689
- }
1690
 
1691
- protected function _tounicodecmap($uv)
1692
- {
1693
- $ranges = '';
1694
- $nbr = 0;
1695
- $chars = '';
1696
- $nbc = 0;
1697
- foreach($uv as $c=>$v)
1698
- {
1699
- if(is_array($v))
1700
- {
1701
- $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]);
1702
- $nbr++;
1703
- }
1704
- else
1705
- {
1706
- $chars .= sprintf("<%02X> <%04X>\n",$c,$v);
1707
- $nbc++;
1708
- }
1709
- }
1710
- $s = "/CIDInit /ProcSet findresource begin\n";
1711
- $s .= "12 dict begin\n";
1712
- $s .= "begincmap\n";
1713
- $s .= "/CIDSystemInfo\n";
1714
- $s .= "<</Registry (Adobe)\n";
1715
- $s .= "/Ordering (UCS)\n";
1716
- $s .= "/Supplement 0\n";
1717
- $s .= ">> def\n";
1718
- $s .= "/CMapName /Adobe-Identity-UCS def\n";
1719
- $s .= "/CMapType 2 def\n";
1720
- $s .= "1 begincodespacerange\n";
1721
- $s .= "<00> <FF>\n";
1722
- $s .= "endcodespacerange\n";
1723
- if($nbr>0)
1724
- {
1725
- $s .= "$nbr beginbfrange\n";
1726
- $s .= $ranges;
1727
- $s .= "endbfrange\n";
1728
- }
1729
- if($nbc>0)
1730
- {
1731
- $s .= "$nbc beginbfchar\n";
1732
- $s .= $chars;
1733
- $s .= "endbfchar\n";
1734
- }
1735
- $s .= "endcmap\n";
1736
- $s .= "CMapName currentdict /CMap defineresource pop\n";
1737
- $s .= "end\n";
1738
- $s .= "end";
1739
- return $s;
1740
- }
1741
 
1742
- protected function _putimages()
1743
- {
1744
- foreach(array_keys($this->images) as $file)
1745
- {
1746
- $this->_putimage($this->images[$file]);
1747
- unset($this->images[$file]['data']);
1748
- unset($this->images[$file]['smask']);
1749
  }
1750
- }
1751
 
1752
- protected function _putimage(&$info)
1753
- {
1754
- $this->_newobj();
1755
- $info['n'] = $this->n;
1756
- $this->_put('<</Type /XObject');
1757
- $this->_put('/Subtype /Image');
1758
- $this->_put('/Width '.$info['w']);
1759
- $this->_put('/Height '.$info['h']);
1760
- if($info['cs']=='Indexed')
1761
- $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
1762
- else
1763
- {
1764
- $this->_put('/ColorSpace /'.$info['cs']);
1765
- if($info['cs']=='DeviceCMYK')
1766
- $this->_put('/Decode [1 0 1 0 1 0 1 0]');
1767
- }
1768
- $this->_put('/BitsPerComponent '.$info['bpc']);
1769
- if(isset($info['f']))
1770
- $this->_put('/Filter /'.$info['f']);
1771
- if(isset($info['dp']))
1772
- $this->_put('/DecodeParms <<'.$info['dp'].'>>');
1773
- if(isset($info['trns']) && is_array($info['trns']))
1774
- {
1775
- $trns = '';
1776
- for($i=0;$i<count($info['trns']);$i++)
1777
- $trns .= $info['trns'][$i].' '.$info['trns'][$i].' ';
1778
- $this->_put('/Mask ['.$trns.']');
1779
- }
1780
- if(isset($info['smask']))
1781
- $this->_put('/SMask '.($this->n+1).' 0 R');
1782
- $this->_put('/Length '.strlen($info['data']).'>>');
1783
- $this->_putstream($info['data']);
1784
- $this->_put('endobj');
1785
- // Soft mask
1786
- if(isset($info['smask']))
1787
- {
1788
- $dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$info['w'];
1789
- $smask = array('w'=>$info['w'], 'h'=>$info['h'], 'cs'=>'DeviceGray', 'bpc'=>8, 'f'=>$info['f'], 'dp'=>$dp, 'data'=>$info['smask']);
1790
- $this->_putimage($smask);
1791
- }
1792
- // Palette
1793
- if($info['cs']=='Indexed')
1794
- $this->_putstreamobject($info['pal']);
1795
- }
1796
 
1797
- protected function _putxobjectdict()
1798
- {
1799
- foreach($this->images as $image)
1800
- $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
1801
- }
1802
 
1803
- protected function _putresourcedict()
1804
- {
1805
- $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
1806
- $this->_put('/Font <<');
1807
- foreach($this->fonts as $font)
1808
- $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
1809
- $this->_put('>>');
1810
- $this->_put('/XObject <<');
1811
- $this->_putxobjectdict();
1812
- $this->_put('>>');
1813
- }
1814
 
1815
- protected function _putresources()
1816
- {
1817
- $this->_putfonts();
1818
- $this->_putimages();
1819
- // Resource dictionary
1820
- $this->_newobj(2);
1821
- $this->_put('<<');
1822
- $this->_putresourcedict();
1823
- $this->_put('>>');
1824
- $this->_put('endobj');
1825
- }
1826
 
1827
- protected function _putinfo()
1828
- {
1829
- $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION;
1830
- $this->metadata['CreationDate'] = 'D:'.@date('YmdHis');
1831
- foreach($this->metadata as $key=>$value)
1832
- $this->_put('/'.$key.' '.$this->_textstring($value));
1833
- }
 
1834
 
1835
- protected function _putcatalog()
1836
- {
1837
- $n = $this->PageInfo[1]['n'];
1838
- $this->_put('/Type /Catalog');
1839
- $this->_put('/Pages 1 0 R');
1840
- if($this->ZoomMode=='fullpage')
1841
- $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
1842
- elseif($this->ZoomMode=='fullwidth')
1843
- $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
1844
- elseif($this->ZoomMode=='real')
1845
- $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
1846
- elseif(!is_string($this->ZoomMode))
1847
- $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
1848
- if($this->LayoutMode=='single')
1849
- $this->_put('/PageLayout /SinglePage');
1850
- elseif($this->LayoutMode=='continuous')
1851
- $this->_put('/PageLayout /OneColumn');
1852
- elseif($this->LayoutMode=='two')
1853
- $this->_put('/PageLayout /TwoColumnLeft');
1854
- }
1855
 
1856
- protected function _putheader()
1857
- {
1858
- $this->_put('%PDF-'.$this->PDFVersion);
1859
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1860
 
1861
- protected function _puttrailer()
1862
- {
1863
- $this->_put('/Size '.($this->n+1));
1864
- $this->_put('/Root '.$this->n.' 0 R');
1865
- $this->_put('/Info '.($this->n-1).' 0 R');
1866
- }
1867
 
1868
- protected function _enddoc()
1869
- {
1870
- $this->_putheader();
1871
- $this->_putpages();
1872
- $this->_putresources();
1873
- // Info
1874
- $this->_newobj();
1875
- $this->_put('<<');
1876
- $this->_putinfo();
1877
- $this->_put('>>');
1878
- $this->_put('endobj');
1879
- // Catalog
1880
- $this->_newobj();
1881
- $this->_put('<<');
1882
- $this->_putcatalog();
1883
- $this->_put('>>');
1884
- $this->_put('endobj');
1885
- // Cross-ref
1886
- $offset = $this->_getoffset();
1887
- $this->_put('xref');
1888
- $this->_put('0 '.($this->n+1));
1889
- $this->_put('0000000000 65535 f ');
1890
- for($i=1;$i<=$this->n;$i++)
1891
- $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
1892
- // Trailer
1893
- $this->_put('trailer');
1894
- $this->_put('<<');
1895
- $this->_puttrailer();
1896
- $this->_put('>>');
1897
- $this->_put('startxref');
1898
- $this->_put($offset);
1899
- $this->_put('%%EOF');
1900
- $this->state = 3;
1901
- }
1902
  }
1903
- ?>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ if ( ! class_exists( 'WOE_FPDF_TT_Font_File' ) ) {
4
+ require( 'class-woe-fpdf-tt-font-file.php' );
5
+ }
6
+
7
+ if ( ! class_exists( 'WOE_FPDF_Exception' ) ) {
8
+ require( 'exception/class-woe-fpdf-exception.php' );
9
+ }
10
+
11
+ class WOE_FPDF {
12
+
13
+ const ORIENTATION_PORTRAIT = 'P';
14
+ const ORIENTATION_LANDSCAPE = 'L';
15
+
16
+ const DOCUMENT_STATE_NOT_INITIALIZED = 0;
17
+ const DOCUMENT_STATE_INITIALIZED = 1;
18
+ const DOCUMENT_STATE_CREATING = 2;
19
+ const DOCUMENT_STATE_TERMINATED = 3;
20
+
21
+ const FONT_TRUETYPE = 'TTF';
22
+
23
+ const FILE_FONT_METRICS = 'fm-';
24
+ const FILE_CHARACTER_WIDTH = 'cw-';
25
+
26
+ /**
27
+ * @var bool
28
+ */
29
+ protected $bol_uniform_subset = false;
30
+
31
+ /**
32
+ * Current page number
33
+ *
34
+ * @var int
35
+ */
36
+ protected $int_page = 0;
37
+
38
+ /**
39
+ * Current object number
40
+ *
41
+ * @var int
42
+ */
43
+ protected $int_current_object = 2;
44
+
45
+ /**
46
+ * Array of object offsets
47
+ *
48
+ * @var array
49
+ */
50
+ protected $arr_offsets = [];
51
+
52
+ /**
53
+ * Buffer holding in-memory PDF
54
+ *
55
+ * @var string
56
+ */
57
+ protected $str_buffer = '';
58
+
59
+ /**
60
+ * Array containing pages
61
+ *
62
+ * @var array
63
+ */
64
+ protected $arr_pages = [];
65
+
66
+ /**
67
+ * Current document state
68
+ *
69
+ * @var int
70
+ */
71
+ protected $int_state = self::DOCUMENT_STATE_NOT_INITIALIZED;
72
+
73
+ /**
74
+ * Compression flag
75
+ *
76
+ * @var bool
77
+ */
78
+ protected $bol_compress = false;
79
+
80
+ /**
81
+ * Scale factor (number of points in user unit)
82
+ *
83
+ * @var int
84
+ */
85
+ protected $flt_scale_factor = 1;
86
+
87
+ /**
88
+ * Default orientation
89
+ *
90
+ * @var string
91
+ */
92
+ protected $str_default_orientation = '';
93
+
94
+ /**
95
+ * Current orientation
96
+ *
97
+ * @var string
98
+ */
99
+ protected $str_current_orientation = '';
100
+
101
+ /**
102
+ * Standard page sizes
103
+ *
104
+ * @var array
105
+ */
106
+ protected $arr_standard_page_sizes = [
107
+ 'a3' => array( 841.89, 1190.55 ),
108
+ 'a4' => array( 595.28, 841.89 ),
109
+ 'a5' => array( 420.94, 595.28 ),
110
+ 'letter' => array( 612, 792 ),
111
+ 'legal' => array( 612, 1008 )
112
+ ];
113
+
114
+ /**
115
+ * Default page size
116
+ *
117
+ * @var array|string
118
+ */
119
+ protected $arr_default_page_sizes = [];
120
+
121
+ /**
122
+ * Current page size
123
+ *
124
+ * @var array|string
125
+ */
126
+ protected $arr_current_page_sizes = [];
127
+
128
+ /**
129
+ * Used for pages with non default sizes or orientations
130
+ *
131
+ * @var array
132
+ */
133
+ protected $arr_page_sizes = [];
134
+
135
+ /**
136
+ * Dimensions of current page in points
137
+ *
138
+ * @var mixed
139
+ */
140
+ protected $flt_width_points, $flt_height_points = 0.00;
141
+
142
+ /**
143
+ * Dimensions of current page in user units
144
+ *
145
+ * @var mixed
146
+ */
147
+ protected $flt_current_width, $flt_current_height = 0.00;
148
+
149
+ /**
150
+ * Left Margin
151
+ *
152
+ * @var int
153
+ */
154
+ protected $int_left_margin = 0;
155
+
156
+ /**
157
+ * Top Margin
158
+ *
159
+ * @var int
160
+ */
161
+ protected $int_top_margin = 0;
162
+
163
+ /**
164
+ * Right Margin
165
+ *
166
+ * @var int
167
+ */
168
+ protected $int_right_margin = 0;
169
+
170
+ /**
171
+ * Page break margin
172
+ *
173
+ * @var int
174
+ */
175
+ protected $int_break_margin = 0;
176
+
177
+ /**
178
+ * Cell Margin
179
+ *
180
+ * @var float|int
181
+ */
182
+ protected $int_cell_margin = 0;
183
+
184
+ /**
185
+ * Current position in user unit
186
+ *
187
+ * @var
188
+ */
189
+ protected $flt_position_x, $flt_position_y = 0.00;
190
+
191
+ /**
192
+ * Height of last printed cell
193
+ *
194
+ * @var float
195
+ */
196
+ protected $flt_last_cell_height = 0.00;
197
+
198
+ /**
199
+ * Line width in user units
200
+ *
201
+ * @var float
202
+ */
203
+ protected $flt_line_width = 0.00;
204
+
205
+ /**
206
+ * The path containing fonts
207
+ *
208
+ * @var string
209
+ */
210
+ protected $str_font_path = '';
211
+
212
+ /**
213
+ * Array of core font names
214
+ *
215
+ * @var array
216
+ */
217
+ protected $arr_core_fonts = [
218
+ 'courier',
219
+ 'helvetica',
220
+ 'times',
221
+ 'symbol',
222
+ 'zapfdingbats'
223
+ ];
224
+
225
+ /**
226
+ * Array of used fonts
227
+ *
228
+ * @var array
229
+ */
230
+ protected $arr_fonts = [];
231
+
232
+ /**
233
+ * Array of font files
234
+ *
235
+ * @var array
236
+ */
237
+ protected $arr_font_files = [];
238
+
239
+ /**
240
+ * Array of encoding differences
241
+ *
242
+ * @var array
243
+ */
244
+ protected $arr_encoding_diffs = [];
245
+
246
+ /**
247
+ * Current font family
248
+ *
249
+ * @var string
250
+ */
251
+ protected $str_current_font_family = '';
252
+
253
+ /**
254
+ * Current font style
255
+ *
256
+ * @var string
257
+ */
258
+ protected $str_current_font_style = '';
259
+
260
+ /**
261
+ * Underline flag
262
+ *
263
+ * @var bool
264
+ */
265
+ protected $bol_underline = false;
266
+
267
+ /**
268
+ * Array of current font info
269
+ *
270
+ * @var array
271
+ */
272
+ protected $arr_current_font_info = [];
273
+
274
+ /**
275
+ * Current font size in points
276
+ *
277
+ * @var int
278
+ */
279
+ protected $int_current_font_size = 12;
280
+
281
+ /**
282
+ * Current font size in user units
283
+ *
284
+ * @var int
285
+ */
286
+ protected $int_font_size_user = 0;
287
+
288
+ /**
289
+ * The draw color
290
+ *
291
+ * @var string
292
+ */
293
+ protected $str_draw_color = '0 G';
294
+
295
+ /**
296
+ * The fill color
297
+ *
298
+ * @var string
299
+ */
300
+ protected $str_fill_color = '0 g';
301
+
302
+ /**
303
+ * The text color
304
+ *
305
+ * @var string
306
+ */
307
+ protected $str_text_color = '0 g';
308
+
309
+ /**
310
+ * Indicates whether fill and text colors are different
311
+ *
312
+ * @var bool
313
+ */
314
+ protected $bol_fill_text_differ = false;
315
+
316
+ /**
317
+ * The word spacing
318
+ *
319
+ * @var int
320
+ */
321
+ protected $int_word_spacing = 0;
322
+
323
+ /**
324
+ * Array of used images
325
+ *
326
+ * @var array
327
+ */
328
+ protected $arr_images = [];
329
+
330
+ /**
331
+ * Array of links in pages
332
+ *
333
+ * @var array
334
+ */
335
+ protected $arr_page_links = [];
336
+
337
+ /**
338
+ * Array of internal links
339
+ *
340
+ * @var array
341
+ */
342
+ protected $arr_internal_links = [];
343
+
344
+ /**
345
+ * Automatic page breaking
346
+ *
347
+ * @var bool
348
+ */
349
+ protected $bol_auto_page_break = false;
350
+
351
+ /**
352
+ * Threshold used to trigger page breaks
353
+ *
354
+ * @var float
355
+ */
356
+ protected $flt_page_break_trigger = 0.00;
357
+
358
+ /**
359
+ * Flag set when processing header
360
+ *
361
+ * @var bool
362
+ */
363
+ protected $bol_in_header = false;
364
+
365
+ /**
366
+ * Flag set when processing footer
367
+ *
368
+ * @var bool
369
+ */
370
+ protected $bol_in_footer = false;
371
+
372
+ /**
373
+ * Zoom display mode
374
+ *
375
+ * @var mixed
376
+ */
377
+ protected $mix_zoom_mode;
378
+
379
+ /**
380
+ * Layout display mode
381
+ *
382
+ * @var string
383
+ */
384
+ protected $str_layout_mode = '';
385
+
386
+ /**
387
+ * The title
388
+ *
389
+ * @var string
390
+ */
391
+ protected $str_title = '';
392
+
393
+ /**
394
+ * The subject
395
+ *
396
+ * @var string
397
+ */
398
+ protected $str_subject = '';
399
+
400
+ /**
401
+ * The author
402
+ *
403
+ * @var string
404
+ */
405
+ protected $str_author = '';
406
+
407
+ /**
408
+ * The keywords
409
+ *
410
+ * @var string
411
+ */
412
+ protected $str_keywords = '';
413
+
414
+ /**
415
+ * The creator
416
+ *
417
+ * @var string
418
+ */
419
+ protected $str_creator = '';
420
+
421
+ /**
422
+ * The alias for total number of pages
423
+ *
424
+ * @var string
425
+ */
426
+ protected $str_alias_number_pages = '';
427
+
428
+ /**
429
+ * The PDF version number
430
+ *
431
+ * @var string
432
+ */
433
+ protected $str_pdf_version = '1.3';
434
+
435
+ /**
436
+ * The font metric cache directory, if null no cache will be used
437
+ *
438
+ * @var string
439
+ */
440
+ protected $cachePath = null;
441
+
442
+
443
+ /**
444
+ * PDF constructor.
445
+ *
446
+ * @param string $str_orientation
447
+ * @param string $str_units
448
+ * @param string $str_size
449
+ */
450
+ public function __construct( $str_orientation = 'P', $str_units = 'mm', $str_size = 'A4' ) {
451
+
452
+ $this->setFontPath( __DIR__ . '/font' );
453
+
454
+ // Scale factor
455
+ switch ( $str_units ) {
456
+ case 'pt':
457
+ $this->flt_scale_factor = 1;
458
+ break;
459
+ case 'mm':
460
+ case 'cm':
461
+ $this->flt_scale_factor = 72 / 25.4;
462
+ break;
463
+ case 'in':
464
+ $this->flt_scale_factor = 72;
465
+ break;
466
+ default:
467
+ throw new WOE_FPDF_Exception( 'Invalid unit specified: ' . $str_units, WOE_FPDF_Exception::INVALID_UNIT );
468
+ }
469
 
470
+ $str_size = $this->getPageSize( $str_size );
471
+ $this->arr_default_page_sizes = $str_size;
472
+ $this->arr_current_page_sizes = $str_size;
473
+ // Page orientation
474
+
475
+ switch ( $str_orientation ) {
476
+
477
+ case 'portrait':
478
+ case self::ORIENTATION_PORTRAIT:
479
+ $this->str_default_orientation = 'P';
480
+ $this->flt_current_width = $str_size[0];
481
+ $this->flt_current_height = $str_size[1];
482
+ break;
483
+
484
+ case 'landscape':
485
+ case self::ORIENTATION_LANDSCAPE:
486
+ $this->str_default_orientation = 'L';
487
+ $this->flt_current_width = $str_size[1];
488
+ $this->flt_current_height = $str_size[0];
489
+ break;
490
+
491
+ default:
492
+ throw new WOE_FPDF_Exception( 'Invalid orientation: ' . $str_orientation, WOE_FPDF_Exception::INVALID_ORIENTATION );
493
+ break;
494
+ }
495
 
496
+ $this->str_current_orientation = $this->str_default_orientation;
497
+ $this->flt_width_points = $this->flt_current_width * $this->flt_scale_factor;
498
+ $this->flt_height_points = $this->flt_current_height * $this->flt_scale_factor;
 
 
499
 
500
+ // Page margins (1 cm)
501
+ $flt_margin = 28.35 / $this->flt_scale_factor;
502
+ $this->setMargins( $flt_margin, $flt_margin );
 
 
503
 
504
+ // Interior cell margin (1 mm)
505
+ $this->int_cell_margin = $flt_margin / 10;
506
+
507
+ // Line width (0.2 mm)
508
+ $this->flt_line_width = .567 / $this->flt_scale_factor;
509
+
510
+ // Automatic page break
511
+ $this->SetAutoPageBreak( true, 2 * $flt_margin );
512
+
513
+ // Default display mode
514
+ $this->SetDisplayMode( 'default' );
515
+
516
+ // Enable compression
517
+ $this->SetCompression( true );
518
+
519
+ }
520
+
521
+ /**
522
+ * @param $int_left
523
+ * @param $int_top
524
+ * @param null $int_right
525
+ */
526
+ public function setMargins( $int_left, $int_top, $int_right = null ) {
527
+ // Set left, top and right margins
528
+ $this->int_left_margin = $int_left;
529
+ $this->int_top_margin = $int_top;
530
+ if ( null === $int_right ) {
531
+ $int_right = $int_left;
532
+ }
533
+ $this->int_right_margin = $int_right;
534
+ }
535
+
536
+ /**
537
+ * @param $int_margin
538
+ */
539
+ public function SetLeftMargin( $int_margin ) {
540
+ // Set left margin
541
+ $this->int_left_margin = $int_margin;
542
+ if ( $this->int_page > 0 && $this->flt_position_x < $int_margin ) {
543
+ $this->flt_position_x = $int_margin;
544
+ }
545
+ }
546
+
547
+ /**
548
+ * @param $int_margin
549
+ */
550
+ public function SetTopMargin( $int_margin ) {
551
+ // Set top margin
552
+ $this->int_top_margin = $int_margin;
553
+ }
554
+
555
+ /**
556
+ * @param $int_margin
557
+ */
558
+ public function SetRightMargin( $int_margin ) {
559
+ // Set right margin
560
+ $this->int_right_margin = $int_margin;
561
+ }
562
+
563
+ /**
564
+ * @param $bol_auto
565
+ * @param int $int_margin
566
+ */
567
+ public function SetAutoPageBreak( $bol_auto, $int_margin = 0 ) {
568
+ // Set auto page break mode and triggering margin
569
+ $this->bol_auto_page_break = $bol_auto;
570
+ $this->int_break_margin = $int_margin;
571
+ $this->flt_page_break_trigger = $this->flt_current_height - $int_margin;
572
+ }
573
+
574
+ /**
575
+ * Set display mode and zoom view
576
+ *
577
+ * @param string $zoomMode Set zoom mode: default, fullpage, fullwidth or real
578
+ * @param string $layoutMode Set layout mode: default, single, continuous or two
579
+ */
580
+ public function SetDisplayMode( $zoomMode = null, $layoutMode = null ) {
581
+
582
+ // Validate zoom mode
583
+ $zoomModes = [ 'default', 'fullpage', 'fullwidth', 'real' ];
584
+ if ( $zoomMode === null ) {
585
+ $zoomMode = $zoomModes[0];
586
+ }
587
+
588
+ if ( ! in_array( $zoomMode, $zoomModes ) ) {
589
+ throw new WOE_FPDF_Exception( 'Invalid zoom mode specified: `' . $zoomMode . '`', WOE_FPDF_Exception::INVALID_ZOOM_MODE );
590
+ }
591
+
592
+ // Valid layout mode
593
+ $layoutModes = [ 'default', 'single', 'continuous', 'two' ];
594
+ if ( $layoutMode === null ) {
595
+ $layoutMode = $layoutModes[0];
596
+ }
597
+
598
+ if ( ! in_array( $layoutMode, $layoutModes ) ) {
599
+ throw new WOE_FPDF_Exception( 'Invalid layout mode specified: `' . $layoutMode . '`', WOE_FPDF_Exception::INVALID_LAYOUT_MODE );
600
+ }
601
+
602
+ // Set zoom and layout modes
603
+ $this->mix_zoom_mode = $zoomMode;
604
+ $this->str_layout_mode = $layoutMode;
605
+ }
606
+
607
+ /**
608
+ * @param $bol_compression
609
+ */
610
+ public function SetCompression( $bol_compression ) {
611
+ // Set page compression
612
+ if ( function_exists( 'gzcompress' ) ) {
613
+ $this->bol_compress = $bol_compression;
614
+ } else {
615
+ $this->bol_compress = false;
616
+ }
617
+ }
618
+
619
+ /**
620
+ * @param $str_title
621
+ * @param bool $bol_utf8
622
+ */
623
+ public function SetTitle( $str_title, $bol_utf8 = false ) {
624
+ // Title of document
625
+ if ( $bol_utf8 ) {
626
+ $str_title = $this->UTF8toUTF16( $str_title );
627
+ }
628
+ $this->str_title = $str_title;
629
+ }
630
+
631
+ /**
632
+ * @param $str_subject
633
+ * @param bool $bol_utf8
634
+ */
635
+ public function SetSubject( $str_subject, $bol_utf8 = false ) {
636
+ // Subject of document
637
+ if ( $bol_utf8 ) {
638
+ $str_subject = $this->UTF8toUTF16( $str_subject );
639
+ }
640
+ $this->str_subject = $str_subject;
641
+ }
642
+
643
+ /**
644
+ * @param $str_author
645
+ * @param bool $bol_utf8
646
+ */
647
+ public function SetAuthor( $str_author, $bol_utf8 = false ) {
648
+ // Author of document
649
+ if ( $bol_utf8 ) {
650
+ $str_author = $this->UTF8toUTF16( $str_author );
651
+ }
652
+ $this->str_author = $str_author;
653
+ }
654
+
655
+ /**
656
+ * @param $str_keywords
657
+ * @param bool $bol_utf8
658
+ */
659
+ public function SetKeywords( $str_keywords, $bol_utf8 = false ) {
660
+ // Keywords of document
661
+ if ( $bol_utf8 ) {
662
+ $str_keywords = $this->UTF8toUTF16( $str_keywords );
663
+ }
664
+ $this->str_keywords = $str_keywords;
665
+ }
666
+
667
+ /**
668
+ * @param $str_creator
669
+ * @param bool $bol_utf8
670
+ */
671
+ public function SetCreator( $str_creator, $bol_utf8 = false ) {
672
+ // Creator of document
673
+ if ( $bol_utf8 ) {
674
+ $str_creator = $this->UTF8toUTF16( $str_creator );
675
+ }
676
+ $this->str_creator = $str_creator;
677
+ }
678
+
679
+ /**
680
+ * @param string $str_alias
681
+ */
682
+ public function AliasNbPages( $str_alias = '{nb}' ) {
683
+ // Define an alias for total number of pages
684
+ $this->str_alias_number_pages = $str_alias;
685
+ }
686
+
687
+ /**
688
+ * Inits the document
689
+ */
690
+ public function Open() {
691
+ // Begin document
692
+ $this->int_state = self::DOCUMENT_STATE_INITIALIZED;
693
+ }
694
+
695
+ /**
696
+ * Closes the document
697
+ */
698
+ public function Close() {
699
+ // Terminate document
700
+ if ( $this->int_state == self::DOCUMENT_STATE_TERMINATED ) {
701
+ return;
702
+ }
703
+ if ( $this->int_page == 0 ) {
704
+ $this->AddPage();
705
+ }
706
+ // Page footer
707
+ $this->bol_in_footer = true;
708
+ $this->Footer();
709
+ $this->bol_in_footer = false;
710
+ // Close page
711
+ $this->EndPage();
712
+ // Close document
713
+ $this->EndDoc();
714
+ }
715
+
716
+ /**
717
+ * @param string $str_orientation
718
+ * @param string $str_size
719
+ */
720
+ public function AddPage( $str_orientation = '', $str_size = '' ) {
721
+ // Start a new page
722
+ if ( $this->int_state == self::DOCUMENT_STATE_NOT_INITIALIZED ) {
723
+ $this->Open();
724
+ }
725
+ $str_font_family = $this->str_current_font_family;
726
+ $str_style = $this->str_current_font_style . ( $this->bol_underline ? 'U' : '' );
727
+ $int_font_size = $this->int_current_font_size;
728
+ $flt_line_width = $this->flt_line_width;
729
+ $str_draw_color = $this->str_draw_color;
730
+ $str_fill_color = $this->str_fill_color;
731
+ $str_text_color = $this->str_text_color;
732
+ $bol_fill_text_differ = $this->bol_fill_text_differ;
733
+ if ( $this->int_page > 0 ) {
734
+ // Page footer
735
+ $this->bol_in_footer = true;
736
+ $this->Footer();
737
+ $this->bol_in_footer = false;
738
+ // Close page
739
+ $this->EndPage();
740
+ }
741
+ // Start new page
742
+ $this->BeginPage( $str_orientation, $str_size );
743
+ // Set line cap style to square
744
+ $this->Out( '2 J' );
745
+ // Set line width
746
+ $this->flt_line_width = $flt_line_width;
747
+ $this->Out( sprintf( '%.2F w', $flt_line_width * $this->flt_scale_factor ) );
748
+ // Set font
749
+ if ( $str_font_family ) {
750
+ $this->SetFont( $str_font_family, $str_style, $int_font_size );
751
+ }
752
+ // Set colors
753
+ $this->str_draw_color = $str_draw_color;
754
+ if ( $str_draw_color != '0 G' ) {
755
+ $this->Out( $str_draw_color );
756
+ }
757
+ $this->str_fill_color = $str_fill_color;
758
+ if ( $str_fill_color != '0 g' ) {
759
+ $this->Out( $str_fill_color );
760
+ }
761
+ $this->str_text_color = $str_text_color;
762
+ $this->bol_fill_text_differ = $bol_fill_text_differ;
763
+ // Page header
764
+ $this->bol_in_header = true;
765
+ $this->Header();
766
+ $this->bol_in_header = false;
767
+ // Restore line width
768
+ if ( $this->flt_line_width != $flt_line_width ) {
769
+ $this->flt_line_width = $flt_line_width;
770
+ $this->Out( sprintf( '%.2F w', $flt_line_width * $this->flt_scale_factor ) );
771
+ }
772
+ // Restore font
773
+ if ( $str_font_family ) {
774
+ $this->SetFont( $str_font_family, $str_style, $int_font_size );
775
+ }
776
+ // Restore colors
777
+ if ( $this->str_draw_color != $str_draw_color ) {
778
+ $this->str_draw_color = $str_draw_color;
779
+ $this->Out( $str_draw_color );
780
+ }
781
+ if ( $this->str_fill_color != $str_fill_color ) {
782
+ $this->str_fill_color = $str_fill_color;
783
+ $this->Out( $str_fill_color );
784
+ }
785
+ $this->str_text_color = $str_text_color;
786
+ $this->bol_fill_text_differ = $bol_fill_text_differ;
787
+ }
788
+
789
+ /**
790
+ *
791
+ */
792
+ public function Header() {
793
+ // To be implemented in your own inherited class
794
+ }
795
+
796
+ /**
797
+ *
798
+ */
799
+ public function Footer() {
800
+ // To be implemented in your own inherited class
801
+ }
802
+
803
+ /**
804
+ * @return int
805
+ */
806
+ public function PageNo() {
807
+ // Get current page number
808
+ return $this->int_page;
809
+ }
810
+
811
+ /**
812
+ * @param $int_red
813
+ * @param null $int_green
814
+ * @param null $int_blue
815
+ */
816
+ public function SetDrawColor( $int_red, $int_green = null, $int_blue = null ) {
817
+ // Set color for all stroking operations
818
+ if ( ( $int_red == 0 && $int_green == 0 && $int_blue == 0 ) || $int_green === null ) {
819
+ $this->str_draw_color = sprintf( '%.3F G', $int_red / 255 );
820
+ } else {
821
+ $this->str_draw_color = sprintf( '%.3F %.3F %.3F RG', $int_red / 255, $int_green / 255, $int_blue / 255 );
822
+ }
823
+ if ( $this->int_page > 0 ) {
824
+ $this->Out( $this->str_draw_color );
825
+ }
826
+ }
827
+
828
+ /**
829
+ * @param $int_red
830
+ * @param null $int_green
831
+ * @param null $int_blue
832
+ */
833
+ public function SetFillColor( $int_red, $int_green = null, $int_blue = null ) {
834
+ // Set color for all filling operations
835
+ if ( ( $int_red == 0 && $int_green == 0 && $int_blue == 0 ) || $int_green === null ) {
836
+ $this->str_fill_color = sprintf( '%.3F g', $int_red / 255 );
837
+ } else {
838
+ $this->str_fill_color = sprintf( '%.3F %.3F %.3F rg', $int_red / 255, $int_green / 255, $int_blue / 255 );
839
+ }
840
+ $this->bol_fill_text_differ = ( $this->str_fill_color != $this->str_text_color );
841
+ if ( $this->int_page > 0 ) {
842
+ $this->Out( $this->str_fill_color );
843
+ }
844
+ }
845
+
846
+ /**
847
+ * @param $int_red
848
+ * @param null $int_green
849
+ * @param null $int_blue
850
+ */
851
+ public function SetTextColor( $int_red, $int_green = null, $int_blue = null ) {
852
+ // Set color for text
853
+ if ( ( $int_red == 0 && $int_green == 0 && $int_blue == 0 ) || $int_green === null ) {
854
+ $this->str_text_color = sprintf( '%.3F g', $int_red / 255 );
855
+ } else {
856
+ $this->str_text_color = sprintf( '%.3F %.3F %.3F rg', $int_red / 255, $int_green / 255, $int_blue / 255 );
857
+ }
858
+ $this->bol_fill_text_differ = ( $this->str_fill_color != $this->str_text_color );
859
+ }
860
+
861
+ /**
862
+ * @param $str_text
863
+ *
864
+ * @return float|int
865
+ */
866
+ public function GetStringWidth( $str_text ) {
867
+ // Get width of a string in the current font
868
+ $str_text = (string) $str_text;
869
+ $arr_character_width = &$this->arr_current_font_info['cw'];
870
+ $flt_width = 0;
871
+ if ( $this->bol_uniform_subset ) {
872
+ $str_unicode = $this->UTF8StringToArray( $str_text );
873
+ foreach ( $str_unicode as $str_char ) {
874
+ if ( isset( $arr_character_width[ $str_char ] ) ) {
875
+ $flt_width += ( ord( $arr_character_width[ 2 * $str_char ] ) << 8 ) + ord( $arr_character_width[ 2 * $str_char + 1 ] );
876
+ } else {
877
+ if ( $str_char > 0 && $str_char < 128 && isset( $arr_character_width[ chr( $str_char ) ] ) ) {
878
+ $flt_width += $arr_character_width[ chr( $str_char ) ];
879
+ } else {
880
+ if ( isset( $this->arr_current_font_info['desc']['MissingWidth'] ) ) {
881
+ $flt_width += $this->arr_current_font_info['desc']['MissingWidth'];
882
+ } else {
883
+ if ( isset( $this->arr_current_font_info['MissingWidth'] ) ) {
884
+ $flt_width += $this->arr_current_font_info['MissingWidth'];
885
+ } else {
886
+ $flt_width += 500;
887
+ }
888
+ }
889
+ }
890
+ }
891
+ }
892
+ } else {
893
+ $int_length = strlen( $str_text );
894
+ for ( $i = 0; $i < $int_length; $i ++ ) {
895
+ $flt_width += $arr_character_width[ $str_text[ $i ] ];
896
+ }
897
+ }
898
+
899
+ return $flt_width * $this->int_font_size_user / 1000;
900
+ }
901
+
902
+ /**
903
+ * @param $flt_width
904
+ */
905
+ public function SetLineWidth( $flt_width ) {
906
+ // Set line width
907
+ $this->flt_line_width = $flt_width;
908
+ if ( $this->int_page > 0 ) {
909
+ $this->Out( sprintf( '%.2F w', $flt_width * $this->flt_scale_factor ) );
910
+ }
911
+ }
912
+
913
+ /**
914
+ * @param $flt_x_1
915
+ * @param $flt_y_1
916
+ * @param $flt_x_2
917
+ * @param $flt_y_2
918
+ */
919
+ public function Line( $flt_x_1, $flt_y_1, $flt_x_2, $flt_y_2 ) {
920
+ // Draw a line
921
+ $this->Out( sprintf( '%.2F %.2F m %.2F %.2F l S', $flt_x_1 * $this->flt_scale_factor, ( $this->flt_current_height - $flt_y_1 ) * $this->flt_scale_factor, $flt_x_2 * $this->flt_scale_factor, ( $this->flt_current_height - $flt_y_2 ) * $this->flt_scale_factor ) );
922
+ }
923
+
924
+ /**
925
+ * @param $flt_x
926
+ * @param $flt_y
927
+ * @param $flt_width
928
+ * @param $flt_height
929
+ * @param string $str_style
930
+ */
931
+ public function Rect( $flt_x, $flt_y, $flt_width, $flt_height, $str_style = '' ) {
932
+ // Draw a rectangle
933
+ if ( $str_style == 'F' ) {
934
+ $op = 'f';
935
+ } elseif ( $str_style == 'FD' || $str_style == 'DF' ) {
936
+ $op = 'B';
937
+ } else {
938
+ $op = 'S';
939
+ }
940
+ $this->Out( sprintf( '%.2F %.2F %.2F %.2F re %s', $flt_x * $this->flt_scale_factor, ( $this->flt_current_height - $flt_y ) * $this->flt_scale_factor, $flt_width * $this->flt_scale_factor, - $flt_height * $this->flt_scale_factor, $op ) );
941
+ }
942
+
943
+ /**
944
+ * Add a unicode font to the document
945
+ *
946
+ * @param string $fontFamily The Font-Family name to be used in setFont method
947
+ * @param string $fontStyle Font-Style of the font to be used in setFont method (B, I, U)
948
+ * @param string $fontFile The relative font filename used with the set font path
949
+ */
950
+ public function AddFont( $fontFamily, $fontStyle = '', $fontFile = '' ) {
951
+
952
+ // Add a TrueType, OpenType or Type1 font
953
+ $fontFamily = strtolower( $fontFamily );
954
+ $fontStyle = strtoupper( $fontStyle );
955
+
956
+ if ( $fontStyle == 'IB' ) {
957
+ $fontStyle = 'BI';
958
+ }
959
+ if ( $fontFile == '' ) {
960
+ $fontFile = str_replace( ' ', '', $fontFamily ) . strtolower( $fontStyle );
961
+
962
+ if ( file_exists( $fontFile . '.ttf' ) ) {
963
+ $fontFile .= '.ttf';
964
+ } else {
965
+ $fontFile .= '.php';
966
+ }
967
+ }
968
+
969
+ $fontExtension = pathinfo( $fontFile, PATHINFO_EXTENSION );
970
+ $isUnicode = ( strtolower( $fontExtension ) != 'php' );
971
+
972
+ $fontKey = $fontFamily . $fontStyle;
973
+ if ( isset( $this->arr_fonts[ $fontKey ] ) ) {
974
+ return;
975
+ }
976
+
977
+ if ( $isUnicode ) {
978
+ $fontFile = $this->getFontPath() . $fontFile;
979
+
980
+ $fontMetrics = $this->getFontMetricFiles( $fontFile, $fontKey );
981
+
982
+ $int_font_count = count( $this->arr_fonts ) + 1;
983
+ $arr_numbers = range( 0, ( ! empty( $this->str_alias_number_pages ) ) ? 57 : 32 );
984
+
985
+ $this->arr_fonts[ $fontKey ] = array_merge( $fontMetrics, [
986
+ 'i' => $int_font_count,
987
+ 'ttffile' => $fontFile,
988
+ 'subset' => $arr_numbers,
989
+ 'filename' => pathinfo( $fontFile, PATHINFO_FILENAME ),
990
+ ] );
991
+
992
+ $this->arr_font_files[ $fontKey ] = [
993
+ 'length1' => $fontMetrics['originalsize'],
994
+ 'type' => self::FONT_TRUETYPE,
995
+ 'ttffile' => $fontFile,
996
+ ];
997
+ $this->arr_font_files[ $fontFile ] = [
998
+ 'type' => self::FONT_TRUETYPE
999
+ ];
1000
+
1001
+ unset( $fontMetrics );
1002
+ } else {
1003
+ $arr_info = $this->LoadFont( $fontFile );
1004
+ $arr_info['i'] = count( $this->arr_fonts ) + 1;
1005
+ if ( ! empty( $arr_info['diff'] ) ) {
1006
+ // Search existing encodings
1007
+ $int_key = array_search( $arr_info['diff'], $this->arr_encoding_diffs );
1008
+ if ( ! $int_key ) {
1009
+ $int_key = count( $this->arr_encoding_diffs ) + 1;
1010
+ $this->arr_encoding_diffs[ $int_key ] = $arr_info['diff'];
1011
+ }
1012
+ $arr_info['diffn'] = $int_key;
1013
+ }
1014
+ if ( ! empty( $arr_info['file'] ) ) {
1015
+ // Embedded font
1016
+ if ( $arr_info['type'] == 'TrueType' ) {
1017
+ $this->arr_font_files[ $arr_info['file'] ] = array( 'length1' => $arr_info['originalsize'] );
1018
+ } else {
1019
+ $this->arr_font_files[ $arr_info['file'] ] = array(
1020
+ 'length1' => $arr_info['size1'],
1021
+ 'length2' => $arr_info['size2']
1022
+ );
1023
+ }
1024
+ }
1025
+ $this->arr_fonts[ $fontKey ] = $arr_info;
1026
+ }
1027
+ }
1028
+
1029
+ /**
1030
+ * @param $fontFile
1031
+ * @param $fontKey
1032
+ *
1033
+ * @return array
1034
+ */
1035
+ public function getFontMetricFiles( $fontFile, $fontKey ) {
1036
+
1037
+ $ext = strrchr( $fontFile, '.' );
1038
+ $baseName = basename( $fontFile, $ext );
1039
+
1040
+ $cachePath = $this->getCachePath();
1041
+
1042
+ $metricFile = $cachePath . self::FILE_FONT_METRICS . $baseName . '.json';
1043
+ $charWidthFile = $cachePath . self::FILE_CHARACTER_WIDTH . $baseName . '.dat';
1044
+
1045
+ $oFileSize = filesize( $fontFile );
1046
+
1047
+ if ( $cachePath !== null && file_exists( $metricFile ) && file_exists( $charWidthFile ) ) {
1048
+ $fopen = fopen( $metricFile, 'r' );
1049
+ $fread = fread( $fopen, filesize( $metricFile ) + 1 );
1050
+ fclose( $fopen );
1051
+
1052
+ $json = json_decode( $fread, true );
1053
+
1054
+ if ( json_last_error() === JSON_ERROR_NONE ) {
1055
+ $fopen = fopen( $charWidthFile, 'r' );
1056
+ $fread = fread( $fopen, filesize( $charWidthFile ) + 1 );
1057
+ fclose( $fopen );
1058
+
1059
+ $json['cw'] = $fread;
1060
+
1061
+ if ( $oFileSize == $json['originalsize'] ) {
1062
+ return $json;
1063
+ }
1064
+ }
1065
+ }
1066
+
1067
+ $ttf = new WOE_FPDF_TT_Font_File();
1068
+ $ttf->getMetrics( $fontFile );
1069
+
1070
+ $name = preg_replace( '/[ ()]/', '', $ttf->getFullName() );
1071
+
1072
+ $flt_underline_pos = round( $ttf->getUnderlinePosition() );
1073
+ $flt_underline_thickness = round( $ttf->getUnderlineThickness() );
1074
+
1075
+ $characterWidths = $ttf->getCharWidths();
1076
+
1077
+ // Generate metrics array
1078
+ $strMetricsData = [
1079
+ 'name' => $name,
1080
+ 'type' => self::FONT_TRUETYPE,
1081
+ 'desc' => [
1082
+ 'Ascent' => round( $ttf->getAscent() ),
1083
+ 'Descent' => round( $ttf->getDescent() ),
1084
+ 'CapHeight' => round( $ttf->getCapHeight() ),
1085
+ 'Flags' => $ttf->getFlags(),
1086
+ 'FontBBox' => '[' . round( $ttf->getBbox()[0] ) . ' ' . round( $ttf->getBbox()[1] ) . ' ' . round( $ttf->getBbox()[2] ) . ' ' . round( $ttf->getBbox()[3] ) . ']',
1087
+ 'ItalicAngle' => $ttf->getItalicAngle(),
1088
+ 'StemV' => round( $ttf->getStemV() ),
1089
+ 'MissingWidth' => round( $ttf->getDefaultWidth() ),
1090
+ ],
1091
+ 'flt_underline_pos' => $flt_underline_pos,
1092
+ 'flt_underline_thickness' => $flt_underline_thickness,
1093
+ 'ttffile' => str_replace( __DIR__ . "/", "", $metricFile ),
1094
+ 'originalsize' => $oFileSize,
1095
+ 'fontkey' => $fontKey,
1096
+ 'cw' => null,
1097
+ ];
1098
+
1099
+ $cachePath = $this->getCachePath();
1100
+ if ( $cachePath !== null ) {
1101
+
1102
+ // write metrics file
1103
+ $json = json_encode( $strMetricsData );
1104
+
1105
+ $fopen = fopen( $metricFile, 'w' );
1106
+ fwrite( $fopen, $json );
1107
+ fclose( $fopen );
1108
+
1109
+ // write char width file
1110
+ $fopen = fopen( $charWidthFile, 'w' );
1111
+ fwrite( $fopen, $characterWidths );
1112
+ fclose( $fopen );
1113
+
1114
+ // unlink char width 127 file
1115
+ $charWidth127file = $cachePath . self::FILE_CHARACTER_WIDTH . $baseName . '.json';
1116
+ if ( file_exists( $charWidth127file ) ) {
1117
+ @unlink( $charWidth127file );
1118
+ }
1119
+ }
1120
+
1121
+ $strMetricsData['cw'] = $characterWidths;
1122
+
1123
+ unset( $ttf );
1124
+
1125
+ return $strMetricsData;
1126
+ }
1127
+
1128
+ /**
1129
+ * @param $str_family
1130
+ * @param string $str_style
1131
+ * @param int $int_size
1132
+ */
1133
+ public function SetFont( $str_family, $str_style = '', $int_size = 0 ) {
1134
+ // Select a font; size given in points
1135
+ if ( $str_family == '' ) {
1136
+ $str_family = $this->str_current_font_family;
1137
+ } else {
1138
+ $str_family = strtolower( $str_family );
1139
+ }
1140
+ $str_style = strtoupper( $str_style );
1141
+ if ( strpos( $str_style, 'U' ) !== false ) {
1142
+ $this->bol_underline = true;
1143
+ $str_style = str_replace( 'U', '', $str_style );
1144
+ } else {
1145
+ $this->bol_underline = false;
1146
+ }
1147
+ if ( $str_style == 'IB' ) {
1148
+ $str_style = 'BI';
1149
+ }
1150
+ if ( $int_size == 0 ) {
1151
+ $int_size = $this->int_current_font_size;
1152
+ }
1153
+ // Test if font is already selected
1154
+ if ( $this->str_current_font_family == $str_family && $this->str_current_font_style == $str_style && $this->int_current_font_size == $int_size ) {
1155
+ return;
1156
+ }
1157
+ // Test if font is already loaded
1158
+ $str_font_key = $str_family . $str_style;
1159
+ if ( ! isset( $this->arr_fonts[ $str_font_key ] ) ) {
1160
+ // Test if one of the core fonts
1161
+ if ( $str_family == 'arial' ) {
1162
+ $str_family = 'helvetica';
1163
+ }
1164
+ if ( ! in_array( $str_family, $this->arr_core_fonts ) ) {
1165
+ throw new WOE_FPDF_Exception( 'Undefined font: ' . $str_family . ' ' . $str_style, WOE_FPDF_Exception::UNDEFINED_FONT );
1166
+ }
1167
+
1168
+ if ( $str_family == 'symbol' || $str_family == 'zapfdingbats' ) {
1169
+ $str_style = '';
1170
+ }
1171
+ $str_font_key = $str_family . $str_style;
1172
+ if ( ! isset( $this->arr_fonts[ $str_font_key ] ) ) {
1173
+ $this->AddFont( $str_family, $str_style );
1174
+ }
1175
+ }
1176
+ // Select it
1177
+ $this->str_current_font_family = $str_family;
1178
+ $this->str_current_font_style = $str_style;
1179
+ $this->int_current_font_size = $int_size;
1180
+ $this->int_font_size_user = $int_size / $this->flt_scale_factor;
1181
+ $this->arr_current_font_info = &$this->arr_fonts[ $str_font_key ];
1182
+ if ( $this->arr_fonts[ $str_font_key ]['type'] == self::FONT_TRUETYPE ) {
1183
+ $this->bol_uniform_subset = true;
1184
+ } else {
1185
+ $this->bol_uniform_subset = false;
1186
+ }
1187
+ if ( $this->int_page > 0 ) {
1188
+ $this->Out( sprintf( 'BT /F%d %.2F Tf ET', $this->arr_current_font_info['i'], $this->int_current_font_size ) );
1189
+ }
1190
+ }
1191
+
1192
+ /**
1193
+ * @param $int_size
1194
+ */
1195
+ public function SetFontSize( $int_size ) {
1196
+ // Set font size in points
1197
+ if ( $this->int_current_font_size == $int_size ) {
1198
+ return;
1199
+ }
1200
+ $this->int_current_font_size = $int_size;
1201
+ $this->int_font_size_user = $int_size / $this->flt_scale_factor;
1202
+ if ( $this->int_page > 0 ) {
1203
+ $this->Out( sprintf( 'BT /F%d %.2F Tf ET', $this->arr_current_font_info['i'], $this->int_current_font_size ) );
1204
+ }
1205
+ }
1206
+
1207
+ /**
1208
+ * @return int
1209
+ */
1210
+ public function AddLink() {
1211
+ // Create a new internal link
1212
+ $int_count = count( $this->arr_internal_links ) + 1;
1213
+ $this->arr_internal_links[ $int_count ] = array( 0, 0 );
1214
+
1215
+ return $int_count;
1216
+ }
1217
+
1218
+ /**
1219
+ * @param $mix_link_key
1220
+ * @param int $int_y
1221
+ * @param int $int_page
1222
+ */
1223
+ public function SetLink( $mix_link_key, $int_y = 0, $int_page = - 1 ) {
1224
+ // Set destination of internal link
1225
+ if ( $int_y == - 1 ) {
1226
+ $int_y = $this->flt_position_y;
1227
+ }
1228
+ if ( $int_page == - 1 ) {
1229
+ $int_page = $this->int_page;
1230
+ }
1231
+ $this->arr_internal_links[ $mix_link_key ] = array( $int_page, $int_y );
1232
+ }
1233
+
1234
+ /**
1235
+ * @param $flt_x
1236
+ * @param $flt_y
1237
+ * @param $flt_width
1238
+ * @param $flt_height
1239
+ * @param $mix_link_key
1240
+ */
1241
+ public function Link( $flt_x, $flt_y, $flt_width, $flt_height, $mix_link_key ) {
1242
+ // Put a link on the page
1243
+ $this->arr_page_links[ $this->int_page ][] = array(
1244
+ $flt_x * $this->flt_scale_factor,
1245
+ $this->flt_height_points - $flt_y * $this->flt_scale_factor,
1246
+ $flt_width * $this->flt_scale_factor,
1247
+ $flt_height * $this->flt_scale_factor,
1248
+ $mix_link_key
1249
+ );
1250
+ }
1251
+
1252
+ /**
1253
+ * @param $flt_x
1254
+ * @param $flt_y
1255
+ * @param $str_text
1256
+ */
1257
+ public function Text( $flt_x, $flt_y, $str_text ) {
1258
+ // Output a string
1259
+ if ( $this->bol_uniform_subset ) {
1260
+ $str_text_2 = '(' . $this->EscapeString( $this->UTF8ToUTF16BE( $str_text, false ) ) . ')';
1261
+ foreach ( $this->UTF8StringToArray( $str_text ) as $uni ) {
1262
+ $this->arr_current_font_info['subset'][ $uni ] = $uni;
1263
+ }
1264
+ } else {
1265
+ $str_text_2 = '(' . $this->EscapeString( $str_text ) . ')';
1266
+ }
1267
+ $str_output = sprintf( 'BT %.2F %.2F Td %s Tj ET', $flt_x * $this->flt_scale_factor, ( $this->flt_current_height - $flt_y ) * $this->flt_scale_factor, $str_text_2 );
1268
+ if ( $this->bol_underline && $str_text != '' ) {
1269
+ $str_output .= ' ' . $this->DoUnderline( $flt_x, $flt_y, $str_text );
1270
+ }
1271
+ if ( $this->bol_fill_text_differ ) {
1272
+ $str_output = 'q ' . $this->str_text_color . ' ' . $str_output . ' Q';
1273
+ }
1274
+ $this->Out( $str_output );
1275
+ }
1276
+
1277
+ /**
1278
+ * @return bool
1279
+ */
1280
+ public function AcceptPageBreak() {
1281
+ // Accept automatic page break or not
1282
+ return $this->bol_auto_page_break;
1283
+ }
1284
+
1285
+ /**
1286
+ * @param float $flt_width
1287
+ * @param float $flt_height
1288
+ * @param string $str_text
1289
+ * @param int $int_border
1290
+ * @param int $int_line_number
1291
+ * @param string $str_alignment
1292
+ * @param bool $bol_fill
1293
+ * @param string $str_link
1294
+ */
1295
+ public function Cell( $flt_width, $flt_height = 0, $str_text = '', $int_border = 0, $int_line_number = 0, $str_alignment = '', $bol_fill = false, $str_link = '' ) {
1296
+ // Output a cell
1297
+ $flt_scale = $this->flt_scale_factor;
1298
+ if ( $this->flt_position_y + $flt_height > $this->flt_page_break_trigger && ! $this->bol_in_header && ! $this->bol_in_footer && $this->AcceptPageBreak() ) {
1299
+ // Automatic page break
1300
+ $flt_position_x = $this->flt_position_x;
1301
+ $int_word_spacing = $this->int_word_spacing;
1302
+ if ( $int_word_spacing > 0 ) {
1303
+ $this->int_word_spacing = 0;
1304
+ $this->Out( '0 Tw' );
1305
+ }
1306
+ $this->AddPage( $this->str_current_orientation, $this->arr_current_page_sizes );
1307
+ $this->flt_position_x = $flt_position_x;
1308
+ if ( $int_word_spacing > 0 ) {
1309
+ $this->int_word_spacing = $int_word_spacing;
1310
+ $this->Out( sprintf( '%.3F Tw', $int_word_spacing * $flt_scale ) );
1311
+ }
1312
+ }
1313
+ if ( $flt_width == 0 ) {
1314
+ $flt_width = $this->flt_current_width - $this->int_right_margin - $this->flt_position_x;
1315
+ }
1316
+ $str_output = '';
1317
+ if ( $bol_fill || $int_border == 1 ) {
1318
+ if ( $bol_fill ) {
1319
+ $str_operation = ( $int_border == 1 ) ? 'B' : 'f';
1320
+ } else {
1321
+ $str_operation = 'S';
1322
+ }
1323
+ $str_output = sprintf( '%.2F %.2F %.2F %.2F re %s ', $this->flt_position_x * $flt_scale, ( $this->flt_current_height - $this->flt_position_y ) * $flt_scale, $flt_width * $flt_scale, - $flt_height * $flt_scale, $str_operation );
1324
+ }
1325
+ if ( is_string( $int_border ) ) {
1326
+ $flt_position_x = $this->flt_position_x;
1327
+ $flt_position_y = $this->flt_position_y;
1328
+ if ( strpos( $int_border, 'L' ) !== false ) {
1329
+ $str_output .= sprintf( '%.2F %.2F m %.2F %.2F l S ', $flt_position_x * $flt_scale, ( $this->flt_current_height - $flt_position_y ) * $flt_scale, $flt_position_x * $flt_scale, ( $this->flt_current_height - ( $flt_position_y + $flt_height ) ) * $flt_scale );
1330
+ }
1331
+ if ( strpos( $int_border, 'T' ) !== false ) {
1332
+ $str_output .= sprintf( '%.2F %.2F m %.2F %.2F l S ', $flt_position_x * $flt_scale, ( $this->flt_current_height - $flt_position_y ) * $flt_scale, ( $flt_position_x + $flt_width ) * $flt_scale, ( $this->flt_current_height - $flt_position_y ) * $flt_scale );
1333
+ }
1334
+ if ( strpos( $int_border, 'R' ) !== false ) {
1335
+ $str_output .= sprintf( '%.2F %.2F m %.2F %.2F l S ', ( $flt_position_x + $flt_width ) * $flt_scale, ( $this->flt_current_height - $flt_position_y ) * $flt_scale, ( $flt_position_x + $flt_width ) * $flt_scale, ( $this->flt_current_height - ( $flt_position_y + $flt_height ) ) * $flt_scale );
1336
+ }
1337
+ if ( strpos( $int_border, 'B' ) !== false ) {
1338
+ $str_output .= sprintf( '%.2F %.2F m %.2F %.2F l S ', $flt_position_x * $flt_scale, ( $this->flt_current_height - ( $flt_position_y + $flt_height ) ) * $flt_scale, ( $flt_position_x + $flt_width ) * $flt_scale, ( $this->flt_current_height - ( $flt_position_y + $flt_height ) ) * $flt_scale );
1339
+ }
1340
+ }
1341
+ if ( $str_text !== '' ) {
1342
+ if ( $str_alignment == 'R' ) {
1343
+ $flt_dimensions = $flt_width - $this->int_cell_margin - $this->GetStringWidth( $str_text );
1344
+ } elseif ( $str_alignment == 'C' ) {
1345
+ $flt_dimensions = ( $flt_width - $this->GetStringWidth( $str_text ) ) / 2;
1346
+ } else {
1347
+ $flt_dimensions = $this->int_cell_margin;
1348
+ }
1349
+ if ( $this->bol_fill_text_differ ) {
1350
+ $str_output .= 'q ' . $this->str_text_color . ' ';
1351
+ }
1352
+
1353
+ // If multibyte, Tw has no effect - do word spacing using an adjustment before each space
1354
+ if ( $this->int_word_spacing && $this->bol_uniform_subset ) {
1355
+ foreach ( $this->UTF8StringToArray( $str_text ) as $mix_unicode ) {
1356
+ $this->arr_current_font_info['subset'][ $mix_unicode ] = $mix_unicode;
1357
+ }
1358
+ $str_space = $this->EscapeString( $this->UTF8ToUTF16BE( ' ', false ) );
1359
+ $str_output .= sprintf( 'BT 0 Tw %.2F %.2F Td [', ( $this->flt_position_x + $flt_dimensions ) * $flt_scale, ( $this->flt_current_height - ( $this->flt_position_y + .5 * $flt_height + .3 * $this->int_font_size_user ) ) * $flt_scale );
1360
+ $arr_bits = explode( ' ', $str_text );
1361
+ $int_bit_count = count( $arr_bits );
1362
+ for ( $i = 0; $i < $int_bit_count; $i ++ ) {
1363
+ $str_converted_text = $arr_bits[ $i ];
1364
+ $str_converted_text = '(' . $this->EscapeString( $this->UTF8ToUTF16BE( $str_converted_text, false ) ) . ')';
1365
+ $str_output .= sprintf( '%s ', $str_converted_text );
1366
+ if ( ( $i + 1 ) < $int_bit_count ) {
1367
+ $flt_adjustment = - ( $this->int_word_spacing * $this->flt_scale_factor ) * 1000 / $this->int_current_font_size;
1368
+ $str_output .= sprintf( '%d(%s) ', $flt_adjustment, $str_space );
1369
+ }
1370
+ }
1371
+ $str_output .= '] TJ';
1372
+ $str_output .= ' ET';
1373
+ } else {
1374
+ if ( $this->bol_uniform_subset ) {
1375
+ $str_text_2 = '(' . $this->EscapeString( $this->UTF8ToUTF16BE( $str_text, false ) ) . ')';
1376
+ foreach ( $this->UTF8StringToArray( $str_text ) as $mix_unicode ) {
1377
+ $this->arr_current_font_info['subset'][ $mix_unicode ] = $mix_unicode;
1378
+ }
1379
+ } else {
1380
+ $str_text_2 = '(' . str_replace( ')', '\\)', str_replace( '(', '\\(', str_replace( '\\', '\\\\', $str_text ) ) ) . ')';
1381
+ }
1382
+ $str_output .= sprintf( 'BT %.2F %.2F Td %s Tj ET', ( $this->flt_position_x + $flt_dimensions ) * $flt_scale, ( $this->flt_current_height - ( $this->flt_position_y + .5 * $flt_height + .3 * $this->int_font_size_user ) ) * $flt_scale, $str_text_2 );
1383
+ }
1384
+ if ( $this->bol_underline ) {
1385
+ $str_output .= ' ' . $this->DoUnderline( $this->flt_position_x + $flt_dimensions, $this->flt_position_y + .5 * $flt_height + .3 * $this->int_font_size_user, $str_text );
1386
+ }
1387
+ if ( $this->bol_fill_text_differ ) {
1388
+ $str_output .= ' Q';
1389
+ }
1390
+ if ( $str_link ) {
1391
+ $this->Link( $this->flt_position_x + $flt_dimensions, $this->flt_position_y + .5 * $flt_height - .5 * $this->int_font_size_user, $this->GetStringWidth( $str_text ), $this->int_font_size_user, $str_link );
1392
+ }
1393
+ }
1394
+ if ( $str_output ) {
1395
+ $this->Out( $str_output );
1396
+ }
1397
+ $this->flt_last_cell_height = $flt_height;
1398
+ if ( $int_line_number > 0 ) {
1399
+ // Go to next line
1400
+ $this->flt_position_y += $flt_height;
1401
+ if ( $int_line_number == 1 ) {
1402
+ $this->flt_position_x = $this->int_left_margin;
1403
+ }
1404
+ } else {
1405
+ $this->flt_position_x += $flt_width;
1406
+ }
1407
+ }
1408
+
1409
+ /**
1410
+ * @param $flt_width
1411
+ * @param $flt_height
1412
+ * @param $str_text
1413
+ * @param int $int_border
1414
+ * @param string $str_alignment
1415
+ * @param bool $bol_fill
1416
+ * @param int int_maxline
1417
+ *
1418
+ * @return string
1419
+ */
1420
+ public function MultiCell( $flt_width, $flt_height, $str_text, $int_border = 0, $str_alignment = 'J', $bol_fill = false, $int_maxline = 0 ) {
1421
+ // Output text with automatic or explicit line breaks
1422
+ $arr_character_width = &$this->arr_current_font_info['cw'];
1423
+ if ( $flt_width == 0 ) {
1424
+ $flt_width = $this->flt_current_width - $this->int_right_margin - $this->flt_position_x;
1425
+ }
1426
+ $flt_max_width = ( $flt_width - 2 * $this->int_cell_margin );
1427
+ $str_text = str_replace( "\r", '', $str_text );
1428
+ if ( $this->bol_uniform_subset ) {
1429
+ $int_length = mb_strlen( $str_text, 'utf-8' );
1430
+ while ( $int_length > 0 && mb_substr( $str_text, $int_length - 1, 1, 'utf-8' ) == "\n" ) {
1431
+ $int_length --;
1432
+ }
1433
+ } else {
1434
+ $int_length = strlen( $str_text );
1435
+ if ( $int_length > 0 && $str_text[ $int_length - 1 ] == "\n" ) {
1436
+ $int_length --;
1437
+ }
1438
+ }
1439
+ $mix_adjusted_border = 0;
1440
+ $mix_adjusted_border_2 = 0;
1441
+ if ( $int_border ) {
1442
+ if ( $int_border == 1 ) {
1443
+ $int_border = 'LTRB';
1444
+ $mix_adjusted_border = 'LRT';
1445
+ $mix_adjusted_border_2 = 'LR';
1446
+ } else {
1447
+ $mix_adjusted_border_2 = '';
1448
+ if ( strpos( $int_border, 'L' ) !== false ) {
1449
+ $mix_adjusted_border_2 .= 'L';
1450
+ }
1451
+ if ( strpos( $int_border, 'R' ) !== false ) {
1452
+ $mix_adjusted_border_2 .= 'R';
1453
+ }
1454
+ $mix_adjusted_border = ( strpos( $int_border, 'T' ) !== false ) ? $mix_adjusted_border_2 . 'T' : $mix_adjusted_border_2;
1455
+ }
1456
+ }
1457
+ $int_sep = - 1;
1458
+ $int_i = 0;
1459
+ $int_j = 0;
1460
+ $int_l = 0;
1461
+ $int_space_count = 0;
1462
+ $int_line_count = 1;
1463
+ $int_ls = 0;
1464
+ while ( $int_i < $int_length ) {
1465
+ // Get next character
1466
+ if ( $this->bol_uniform_subset ) {
1467
+ $str_character = mb_substr( $str_text, $int_i, 1, 'UTF-8' );
1468
+ } else {
1469
+ $str_character = $str_text[ $int_i ];
1470
+ }
1471
+ if ( $str_character == "\n" ) {
1472
+ // Explicit line break
1473
+ if ( $this->int_word_spacing > 0 ) {
1474
+ $this->int_word_spacing = 0;
1475
+ $this->Out( '0 Tw' );
1476
+ }
1477
+ if ( $this->bol_uniform_subset ) {
1478
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_i - $int_j, 'UTF-8' ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1479
+ } else {
1480
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_i - $int_j ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1481
+ }
1482
+ $int_i ++;
1483
+ $int_sep = - 1;
1484
+ $int_j = $int_i;
1485
+ $int_l = 0;
1486
+ $int_space_count = 0;
1487
+ $int_line_count ++;
1488
+ if ( $int_border && $int_line_count == 2 ) {
1489
+ $mix_adjusted_border = $mix_adjusted_border_2;
1490
+ }
1491
+ if ( $int_maxline && $int_line_count > $int_maxline ) {
1492
+ return substr( $str_text, $int_i );
1493
+ }
1494
+ continue;
1495
+ }
1496
+ if ( $str_character == ' ' ) {
1497
+ $int_sep = $int_i;
1498
+ $int_ls = $int_l;
1499
+ $int_space_count ++;
1500
+ }
1501
+
1502
+ if ( $this->bol_uniform_subset ) {
1503
+ $int_l += $this->GetStringWidth( $str_character );
1504
+ } else {
1505
+ $int_l += $arr_character_width[ $str_character ] * $this->int_font_size_user / 1000;
1506
+ }
1507
+
1508
+ if ( $int_l > $flt_max_width ) {
1509
+ // Automatic line break
1510
+ if ( $int_sep == - 1 ) {
1511
+ if ( $int_i == $int_j ) {
1512
+ $int_i ++;
1513
+ }
1514
+ if ( $this->int_word_spacing > 0 ) {
1515
+ $this->int_word_spacing = 0;
1516
+ $this->Out( '0 Tw' );
1517
+ }
1518
+ if ( $this->bol_uniform_subset ) {
1519
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_i - $int_j, 'UTF-8' ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1520
+ } else {
1521
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_i - $int_j ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1522
+ }
1523
+ } else {
1524
+ if ( $str_alignment == 'J' ) {
1525
+ $this->int_word_spacing = ( $int_space_count > 1 ) ? ( $flt_max_width - $int_ls ) / ( $int_space_count - 1 ) : 0;
1526
+ $this->Out( sprintf( '%.3F Tw', $this->int_word_spacing * $this->flt_scale_factor ) );
1527
+ }
1528
+ if ( $this->bol_uniform_subset ) {
1529
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_sep - $int_j, 'UTF-8' ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1530
+ } else {
1531
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_sep - $int_j ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1532
+ }
1533
+ $int_i = $int_sep + 1;
1534
+ }
1535
+ $int_sep = - 1;
1536
+ $int_j = $int_i;
1537
+ $int_l = 0;
1538
+ $int_space_count = 0;
1539
+ $int_line_count ++;
1540
+ if ( $int_border && $int_line_count == 2 ) {
1541
+ $mix_adjusted_border = $mix_adjusted_border_2;
1542
+ }
1543
+
1544
+ if ( $int_maxline && $int_line_count > $int_maxline ) {
1545
+ if ( $this->int_word_spacing > 0 ) {
1546
+ $this->int_word_spacing = 0;
1547
+ $this->Out( '0 Tw' );
1548
+ }
1549
+
1550
+ return substr( $str_text, $int_i );
1551
+ }
1552
+
1553
+ } else {
1554
+ $int_i ++;
1555
+ }
1556
+ }
1557
+ // Last chunk
1558
+ if ( $this->int_word_spacing > 0 ) {
1559
+ $this->int_word_spacing = 0;
1560
+ $this->Out( '0 Tw' );
1561
+ }
1562
+ if ( $int_border && strpos( $int_border, 'B' ) !== false ) {
1563
+ $mix_adjusted_border .= 'B';
1564
+ }
1565
+ if ( $this->bol_uniform_subset ) {
1566
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_i - $int_j, 'UTF-8' ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1567
+ } else {
1568
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_i - $int_j ), $mix_adjusted_border, 2, $str_alignment, $bol_fill );
1569
+ }
1570
+ $this->flt_position_x = $this->int_left_margin;
1571
+
1572
+ return '';
1573
+ }
1574
+
1575
+ /**
1576
+ * @param float $flt_height
1577
+ * @param string $str_text
1578
+ * @param string $str_link
1579
+ */
1580
+ public function Write( $flt_height, $str_text, $str_link = '' ) {
1581
+ // Output text in flowing mode
1582
+ $arr_character_widths = &$this->arr_current_font_info['cw'];
1583
+ $flt_width = $this->flt_current_width - $this->int_right_margin - $this->flt_position_x;
1584
+
1585
+ $flt_max_width = ( $flt_width - 2 * $this->int_cell_margin );
1586
+ $str_text = str_replace( "\r", '', $str_text );
1587
+ if ( $this->bol_uniform_subset ) {
1588
+ $int_length = mb_strlen( $str_text, 'UTF-8' );
1589
+ if ( $int_length == 1 && $str_text == " " ) {
1590
+ $this->flt_position_x += $this->GetStringWidth( $str_text );
1591
+
1592
+ return;
1593
+ }
1594
+ } else {
1595
+ $int_length = strlen( $str_text );
1596
+ }
1597
+ $int_sep = - 1;
1598
+ $int_i = 0;
1599
+ $int_j = 0;
1600
+ $flt_string_width = 0;
1601
+ $int_line_count = 1;
1602
+ while ( $int_i < $int_length ) {
1603
+ // Get next character
1604
+ if ( $this->bol_uniform_subset ) {
1605
+ $str_character = mb_substr( $str_text, $int_i, 1, 'UTF-8' );
1606
+ } else {
1607
+ $str_character = $str_text[ $int_i ];
1608
+ }
1609
+ if ( $str_character == "\n" ) {
1610
+ // Explicit line break
1611
+ if ( $this->bol_uniform_subset ) {
1612
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_i - $int_j, 'UTF-8' ), 0, 2, '', 0, $str_link );
1613
+ } else {
1614
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_i - $int_j ), 0, 2, '', 0, $str_link );
1615
+ }
1616
+ $int_i ++;
1617
+ $int_sep = - 1;
1618
+ $int_j = $int_i;
1619
+ $flt_string_width = 0;
1620
+ if ( $int_line_count == 1 ) {
1621
+ $this->flt_position_x = $this->int_left_margin;
1622
+ $flt_width = $this->flt_current_width - $this->int_right_margin - $this->flt_position_x;
1623
+ $flt_max_width = ( $flt_width - 2 * $this->int_cell_margin );
1624
+ }
1625
+ $int_line_count ++;
1626
+ continue;
1627
+ }
1628
+ if ( $str_character == ' ' ) {
1629
+ $int_sep = $int_i;
1630
+ }
1631
+
1632
+ if ( $this->bol_uniform_subset ) {
1633
+ $flt_string_width += $this->GetStringWidth( $str_character );
1634
+ } else {
1635
+ $flt_string_width += $arr_character_widths[ $str_character ] * $this->int_font_size_user / 1000;
1636
+ }
1637
+
1638
+ if ( $flt_string_width > $flt_max_width ) {
1639
+ // Automatic line break
1640
+ if ( $int_sep == - 1 ) {
1641
+ if ( $this->flt_position_x > $this->int_left_margin ) {
1642
+ // Move to next line
1643
+ $this->flt_position_x = $this->int_left_margin;
1644
+ $this->flt_position_y += $flt_height;
1645
+ $flt_width = $this->flt_current_width - $this->int_right_margin - $this->flt_position_x;
1646
+ $flt_max_width = ( $flt_width - 2 * $this->int_cell_margin );
1647
+ $int_i ++;
1648
+ $int_line_count ++;
1649
+ continue;
1650
+ }
1651
+ if ( $int_i == $int_j ) {
1652
+ $int_i ++;
1653
+ }
1654
+ if ( $this->bol_uniform_subset ) {
1655
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_i - $int_j, 'UTF-8' ), 0, 2, '', 0, $str_link );
1656
+ } else {
1657
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_i - $int_j ), 0, 2, '', 0, $str_link );
1658
+ }
1659
+ } else {
1660
+ if ( $this->bol_uniform_subset ) {
1661
+ $this->Cell( $flt_width, $flt_height, mb_substr( $str_text, $int_j, $int_sep - $int_j, 'UTF-8' ), 0, 2, '', 0, $str_link );
1662
+ } else {
1663
+ $this->Cell( $flt_width, $flt_height, substr( $str_text, $int_j, $int_sep - $int_j ), 0, 2, '', 0, $str_link );
1664
+ }
1665
+ $int_i = $int_sep + 1;
1666
+ }
1667
+ $int_sep = - 1;
1668
+ $int_j = $int_i;
1669
+ $flt_string_width = 0;
1670
+ if ( $int_line_count == 1 ) {
1671
+ $this->flt_position_x = $this->int_left_margin;
1672
+ $flt_width = $this->flt_current_width - $this->int_right_margin - $this->flt_position_x;
1673
+ $flt_max_width = ( $flt_width - 2 * $this->int_cell_margin );
1674
+ }
1675
+ $int_line_count ++;
1676
+ } else {
1677
+ $int_i ++;
1678
+ }
1679
+ }
1680
+ // Last chunk
1681
+ if ( $int_i != $int_j ) {
1682
+ if ( $this->bol_uniform_subset ) {
1683
+ $this->Cell( $flt_string_width, $flt_height, mb_substr( $str_text, $int_j, $int_i - $int_j, 'UTF-8' ), 0, 0, '', 0, $str_link );
1684
+ } else {
1685
+ $this->Cell( $flt_string_width, $flt_height, substr( $str_text, $int_j ), 0, 0, '', 0, $str_link );
1686
+ }
1687
+ }
1688
+ }
1689
+
1690
+ /**
1691
+ * @param float|null $flt_height
1692
+ */
1693
+ public function Ln( $flt_height = null ) {
1694
+ // Line feed; default value is last cell height
1695
+ $this->flt_position_x = $this->int_left_margin;
1696
+ if ( $flt_height === null ) {
1697
+ $this->flt_position_y += $this->flt_last_cell_height;
1698
+ } else {
1699
+ $this->flt_position_y += $flt_height;
1700
+ }
1701
+ }
1702
+
1703
+ /**
1704
+ * @param $str_file
1705
+ * @param float|null $flt_x
1706
+ * @param float|null $flt_y
1707
+ * @param int $int_width
1708
+ * @param int $int_height
1709
+ * @param string $str_type
1710
+ * @param string $str_link
1711
+ */
1712
+ public function Image( $str_file, $flt_x = null, $flt_y = null, $int_width = 0, $int_height = 0, $str_type = '', $str_link = '' ) {
1713
+ // Put an image on the page
1714
+ if ( ! isset( $this->arr_images[ $str_file ] ) ) {
1715
+ // First use of this image, get info
1716
+ if ( $str_type == '' ) {
1717
+ $int_position = strrpos( $str_file, '.' );
1718
+ if ( ! $int_position ) {
1719
+ throw new WOE_FPDF_Exception( 'Image file has no extension and no type was specified: ' . $str_file, WOE_FPDF_Exception::INVALID_IMAGE );
1720
+ }
1721
+ $str_type = substr( $str_file, $int_position + 1 );
1722
+ }
1723
+ $str_type = strtolower( $str_type );
1724
+ if ( $str_type == 'jpeg' ) {
1725
+ $str_type = 'jpg';
1726
+ }
1727
+ $str_method = '_parse' . $str_type;
1728
+ if ( ! method_exists( $this, $str_method ) ) {
1729
+ throw new WOE_FPDF_Exception( 'Unsupported image type: `' . $str_type . '`', WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
1730
+ }
1731
+ $arr_image_info = $this->$str_method( $str_file );
1732
+ $arr_image_info['i'] = count( $this->arr_images ) + 1;
1733
+ $this->arr_images[ $str_file ] = $arr_image_info;
1734
+ } else {
1735
+ $arr_image_info = $this->arr_images[ $str_file ];
1736
+ }
1737
+
1738
+ // Automatic width and height calculation if needed
1739
+ if ( $int_width == 0 && $int_height == 0 ) {
1740
+ // Put image at 96 dpi
1741
+ $int_width = - 96;
1742
+ $int_height = - 96;
1743
+ }
1744
+ if ( $int_width < 0 ) {
1745
+ $int_width = - $arr_image_info['w'] * 72 / $int_width / $this->flt_scale_factor;
1746
+ }
1747
+ if ( $int_height < 0 ) {
1748
+ $int_height = - $arr_image_info['h'] * 72 / $int_height / $this->flt_scale_factor;
1749
+ }
1750
+ if ( $int_width == 0 ) {
1751
+ $int_width = $int_height * $arr_image_info['w'] / $arr_image_info['h'];
1752
+ }
1753
+ if ( $int_height == 0 ) {
1754
+ $int_height = $int_width * $arr_image_info['h'] / $arr_image_info['w'];
1755
+ }
1756
+
1757
+ // Flowing mode
1758
+ if ( $flt_y === null ) {
1759
+ if ( $this->flt_position_y + $int_height > $this->flt_page_break_trigger && ! $this->bol_in_header && ! $this->bol_in_footer && $this->AcceptPageBreak() ) {
1760
+ // Automatic page break
1761
+ $flt_new_x_pos = $this->flt_position_x;
1762
+ $this->AddPage( $this->str_current_orientation, $this->arr_current_page_sizes );
1763
+ $this->flt_position_x = $flt_new_x_pos;
1764
+ }
1765
+ $flt_y = $this->flt_position_y;
1766
+ $this->flt_position_y += $int_height;
1767
+ }
1768
+
1769
+ if ( $flt_x === null ) {
1770
+ $flt_x = $this->flt_position_x;
1771
+ }
1772
+ $this->Out( sprintf( 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $int_width * $this->flt_scale_factor, $int_height * $this->flt_scale_factor, $flt_x * $this->flt_scale_factor, ( $this->flt_current_height - ( $flt_y + $int_height ) ) * $this->flt_scale_factor, $arr_image_info['i'] ) );
1773
+ if ( $str_link ) {
1774
+ $this->Link( $flt_x, $flt_y, $int_width, $int_height, $str_link );
1775
+ }
1776
+ }
1777
 
1778
+ /**
1779
+ * @return mixed
1780
+ */
1781
+ public function GetX() {
1782
+ // Get x position
1783
+ return $this->flt_position_x;
1784
+ }
 
 
 
 
 
1785
 
1786
+ /**
1787
+ * @param $flt_position_x
1788
+ */
1789
+ public function SetX( $flt_position_x ) {
1790
+ // Set x position
1791
+ if ( $flt_position_x >= 0 ) {
1792
+ $this->flt_position_x = $flt_position_x;
1793
+ } else {
1794
+ $this->flt_position_x = $this->flt_current_width + $flt_position_x;
1795
+ }
1796
+ }
1797
 
1798
+ /**
1799
+ * @return float
1800
+ */
1801
+ public function GetY() {
1802
+ // Get y position
1803
+ return $this->flt_position_y;
1804
+ }
1805
 
1806
+ /**
1807
+ * @param $flt_position_y
1808
+ */
1809
+ public function SetY( $flt_position_y ) {
1810
+ // Set y position and reset x
1811
+ $this->flt_position_x = $this->int_left_margin;
1812
+ if ( $flt_position_y >= 0 ) {
1813
+ $this->flt_position_y = $flt_position_y;
1814
+ } else {
1815
+ $this->flt_position_y = $this->flt_current_height + $flt_position_y;
1816
+ }
1817
+ }
1818
 
1819
+ /**
1820
+ * @param $x
1821
+ * @param $y
1822
+ */
1823
+ public function SetXY( $x, $y ) {
1824
+ // Set x and y positions
1825
+ $this->SetY( $y );
1826
+ $this->SetX( $x );
1827
+ }
1828
 
1829
+ /**
1830
+ * @return string
1831
+ */
1832
+ public function output() {
1833
+ // Output PDF to some destination
1834
+ if ( $this->int_state < self::DOCUMENT_STATE_TERMINATED ) {
1835
+ $this->Close();
1836
+ }
1837
 
1838
+ return $this->str_buffer;
1839
+ }
 
 
 
1840
 
1841
+ /**
1842
+ * Set the font directory where font should be loaded front
1843
+ *
1844
+ * @param $fontPath string The font directory
1845
+ *
1846
+ * @return string
1847
+ */
1848
+ public function setFontPath( $fontPath ) {
1849
+ if ( ! file_exists( $fontPath ) || ! is_dir( $fontPath ) ) {
1850
+ throw new WOE_FPDF_Exception( 'Font path does not exist `' . $fontPath . '`', WOE_FPDF_Exception::INVALID_FONT_PATH );
1851
+ }
1852
 
1853
+ $this->str_font_path = realpath( $fontPath ) . '/';
 
 
 
 
1854
 
1855
+ return $this->str_font_path;
1856
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1857
 
1858
+ /**
1859
+ * @return string
1860
+ */
1861
+ protected function getFontPath() {
1862
+ return realpath( $this->str_font_path ) . '/';
1863
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1864
 
1865
+ /**
1866
+ *
1867
+ */
1868
+ protected function checkOutput() {
1869
+ if ( PHP_SAPI !== 'cli' ) {
1870
+ if ( headers_sent( $str_file, $int_line ) ) {
1871
+ throw new WOE_FPDF_Exception( "Some data has already been output, can't send PDF file, output started at " . $str_file . ":" . $int_line, WOE_FPDF_Exception::HEADER_ALREADY_SENT );
1872
+ }
1873
+ }
1874
 
1875
+ if ( ob_get_length() ) {
 
 
 
1876
 
1877
+ // The output buffer is not empty
1878
+ if ( ! preg_match( '/^(\xEF\xBB\xBF)?\s*$/', ob_get_contents() ) ) {
1879
+ throw new WOE_FPDF_Exception( 'Some data has already been output, can\'t send PDF file', WOE_FPDF_Exception::HEADER_ALREADY_SENT );
1880
+ }
 
1881
 
1882
+ // It contains only a UTF-8 BOM and/or whitespace, let's clean it
1883
+ ob_clean();
1884
+ }
1885
+ }
 
 
 
 
 
 
1886
 
1887
+ /**
1888
+ * @param $mix_size
1889
+ *
1890
+ * @return array|string
1891
+ */
1892
+ private function getPageSize( $mix_size ) {
1893
+ if ( is_string( $mix_size ) ) {
1894
+ $mix_size = strtolower( $mix_size );
1895
+ if ( ! isset( $this->arr_standard_page_sizes[ $mix_size ] ) ) {
1896
+ throw new WOE_FPDF_Exception( 'Invalid page size: ' . $mix_size, WOE_FPDF_Exception::INVALID_PAGE_SIZE );
1897
+ }
1898
+ $a = $this->arr_standard_page_sizes[ $mix_size ];
1899
+
1900
+ return array( $a[0] / $this->flt_scale_factor, $a[1] / $this->flt_scale_factor );
1901
+ } else {
1902
+ if ( $mix_size[0] > $mix_size[1] ) {
1903
+ return array( $mix_size[1], $mix_size[0] );
1904
+ } else {
1905
+ return $mix_size;
1906
+ }
1907
+ }
1908
+ }
1909
 
1910
+ /**
1911
+ * @param $str_orientation
1912
+ * @param $mix_size
1913
+ */
1914
+ private function BeginPage( $str_orientation, $mix_size ) {
1915
+ $this->int_page ++;
1916
+ $this->arr_pages[ $this->int_page ] = '';
1917
+ $this->int_state = self::DOCUMENT_STATE_CREATING;
1918
+ $this->flt_position_x = $this->int_left_margin;
1919
+ $this->flt_position_y = $this->int_top_margin;
1920
+ $this->str_current_font_family = '';
1921
+ // Check page size and orientation
1922
+ if ( $str_orientation == '' ) {
1923
+ $str_orientation = $this->str_default_orientation;
1924
+ } else {
1925
+ $str_orientation = strtoupper( $str_orientation[0] );
1926
+ }
1927
+ if ( $mix_size == '' ) {
1928
+ $mix_size = $this->arr_default_page_sizes;
1929
+ } else {
1930
+ $mix_size = $this->getPageSize( $mix_size );
1931
+ }
1932
+ if ( $str_orientation != $this->str_current_orientation || $mix_size[0] != $this->arr_current_page_sizes[0] || $mix_size[1] != $this->arr_current_page_sizes[1] ) {
1933
+ // New size or orientation
1934
+ if ( $str_orientation == self::ORIENTATION_PORTRAIT ) {
1935
+ $this->flt_current_width = $mix_size[0];
1936
+ $this->flt_current_height = $mix_size[1];
1937
+ } else { // landscape
1938
+ $this->flt_current_width = $mix_size[1];
1939
+ $this->flt_current_height = $mix_size[0];
1940
+ }
1941
+ $this->flt_width_points = $this->flt_current_width * $this->flt_scale_factor;
1942
+ $this->flt_height_points = $this->flt_current_height * $this->flt_scale_factor;
1943
+ $this->flt_page_break_trigger = $this->flt_current_height - $this->int_break_margin;
1944
+ $this->str_current_orientation = $str_orientation;
1945
+ $this->arr_current_page_sizes = $mix_size;
1946
+ }
1947
+ if ( $str_orientation != $this->str_default_orientation || $mix_size[0] != $this->arr_default_page_sizes[0] || $mix_size[1] != $this->arr_default_page_sizes[1] ) {
1948
+ $this->arr_page_sizes[ $this->int_page ] = array( $this->flt_width_points, $this->flt_height_points );
1949
+ }
1950
+ }
1951
 
1952
+ /**
1953
+ *
1954
+ */
1955
+ private function EndPage() {
1956
+ $this->int_state = self::DOCUMENT_STATE_INITIALIZED;
1957
+ }
 
 
 
 
 
1958
 
1959
+ /**
1960
+ * @param $str_font
1961
+ *
1962
+ * @return array
1963
+ */
1964
+ private function LoadFont( $str_font ) {
1965
+ // Load a font definition file from the font directory
1966
+ include( $this->str_font_path . $str_font );
1967
+ $arr_defined_vars = get_defined_vars();
1968
+ if ( ! isset( $arr_defined_vars['name'] ) ) {
1969
+ throw new WOE_FPDF_Exception( 'Could not include font definition file', WOE_FPDF_Exception::INVALID_FONT_FILE );
1970
+ }
1971
 
1972
+ return $arr_defined_vars;
1973
+ }
 
 
 
1974
 
1975
+ /**
1976
+ * @param $str_text
1977
+ *
1978
+ * @return mixed
1979
+ */
1980
+ protected function EscapeString( $str_text ) {
1981
+ // Escape special characters in strings
1982
+ $str_text = str_replace( '\\', '\\\\', $str_text );
1983
+ $str_text = str_replace( '(', '\\(', $str_text );
1984
+ $str_text = str_replace( ')', '\\)', $str_text );
1985
+ $str_text = str_replace( "\r", '\\r', $str_text );
1986
+
1987
+ return $str_text;
1988
+ }
1989
 
1990
+ /**
1991
+ * @param $s
1992
+ *
1993
+ * @return string
1994
+ */
1995
+ protected function TextString( $s ) {
1996
+ // Format a text string
1997
+ return '(' . $this->EscapeString( $s ) . ')';
1998
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1999
 
2000
+ /**
2001
+ * @param $str_text
2002
+ *
2003
+ * @return string
2004
+ */
2005
+ private function UTF8toUTF16( $str_text ) {
2006
+ // Convert UTF-8 to UTF-16BE with BOM
2007
+ $str_res = "\xFE\xFF";
2008
+ $int_length = strlen( $str_text );
2009
+ $i = 0;
2010
+ while ( $i < $int_length ) {
2011
+ $int_character_1 = ord( $str_text[ $i ++ ] );
2012
+ if ( $int_character_1 >= 224 ) {
2013
+ // 3-byte character
2014
+ $int_character_2 = ord( $str_text[ $i ++ ] );
2015
+ $int_character_3 = ord( $str_text[ $i ++ ] );
2016
+ $str_res .= chr( ( ( $int_character_1 & 0x0F ) << 4 ) + ( ( $int_character_2 & 0x3C ) >> 2 ) );
2017
+ $str_res .= chr( ( ( $int_character_2 & 0x03 ) << 6 ) + ( $int_character_3 & 0x3F ) );
2018
+ } elseif ( $int_character_1 >= 192 ) {
2019
+ // 2-byte character
2020
+ $int_character_2 = ord( $str_text[ $i ++ ] );
2021
+ $str_res .= chr( ( $int_character_1 & 0x1C ) >> 2 );
2022
+ $str_res .= chr( ( ( $int_character_1 & 0x03 ) << 6 ) + ( $int_character_2 & 0x3F ) );
2023
+ } else {
2024
+ // Single-byte character
2025
+ $str_res .= "\0" . chr( $int_character_1 );
2026
+ }
2027
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2028
 
2029
+ return $str_res;
2030
+ }
 
 
 
 
 
 
 
 
2031
 
2032
+ private function DoUnderline( $flt_x, $flt_y, $str_text ) {
2033
+ // Underline text
2034
+ $flt_underline_position = $this->arr_current_font_info['up'];
2035
+ $flt_underline_thickness = $this->arr_current_font_info['ut'];
2036
+ $flt_width = $this->GetStringWidth( $str_text ) + $this->int_word_spacing * substr_count( $str_text, ' ' );
 
 
2037
 
2038
+ return sprintf( '%.2F %.2F %.2F %.2F re f', $flt_x * $this->flt_scale_factor, ( $this->flt_current_height - ( $flt_y - $flt_underline_position / 1000 * $this->int_font_size_user ) ) * $this->flt_scale_factor, $flt_width * $this->flt_scale_factor, - $flt_underline_thickness / 1000 * $this->int_current_font_size );
2039
+ }
 
 
 
 
 
 
 
2040
 
2041
+ /**
2042
+ * @param $str_file
2043
+ *
2044
+ * @return array
2045
+ */
2046
+ private function _parsejpg( $str_file ) {
2047
+ // Extract info from a JPEG file
2048
+ $arr_size_data = getimagesize( $str_file );
2049
+ if ( ! $arr_size_data ) {
2050
+ throw new WOE_FPDF_Exception( 'Missing or incorrect image file: ' . $str_file, WOE_FPDF_Exception::INVALID_IMAGE );
2051
+ }
2052
+ if ( $arr_size_data[2] != 2 ) {
2053
+ throw new WOE_FPDF_Exception( 'Not a JPEG file: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2054
+ }
2055
+ if ( ! isset( $arr_size_data['channels'] ) || $arr_size_data['channels'] == 3 ) {
2056
+ $str_color_space = 'DeviceRGB';
2057
+ } elseif ( $arr_size_data['channels'] == 4 ) {
2058
+ $str_color_space = 'DeviceCMYK';
2059
+ } else {
2060
+ $str_color_space = 'DeviceGray';
2061
+ }
2062
+ $int_bits_per_component = isset( $arr_size_data['bits'] ) ? $arr_size_data['bits'] : 8;
2063
+ $str_data = file_get_contents( $str_file );
2064
+
2065
+ return array(
2066
+ 'w' => $arr_size_data[0],
2067
+ 'h' => $arr_size_data[1],
2068
+ 'cs' => $str_color_space,
2069
+ 'bpc' => $int_bits_per_component,
2070
+ 'f' => 'DCTDecode',
2071
+ 'data' => $str_data
2072
+ );
2073
+ }
2074
 
2075
+ /**
2076
+ * @param $str_file
2077
+ *
2078
+ * @return array
2079
+ */
2080
+ private function _parsepng( $str_file ) {
2081
+ // Extract info from a PNG file
2082
+ $ptr_file = fopen( $str_file, 'rb' );
2083
+ if ( ! $ptr_file ) {
2084
+ throw new WOE_FPDF_Exception( 'Can\'t open image file: ' . $str_file, WOE_FPDF_Exception::INVALID_IMAGE );
2085
+ }
2086
+ $arr_info = $this->_parsepngstream( $ptr_file, $str_file );
2087
+ fclose( $ptr_file );
2088
 
2089
+ return $arr_info;
2090
+ }
 
 
 
2091
 
2092
+ /**
2093
+ * @param $ptr_file
2094
+ * @param $str_file
2095
+ *
2096
+ * @return array
2097
+ */
2098
+ private function _parsepngstream( $ptr_file, $str_file ) {
2099
+ // Check signature
2100
+ if ( $this->_readstream( $ptr_file, 8 ) != chr( 137 ) . 'PNG' . chr( 13 ) . chr( 10 ) . chr( 26 ) . chr( 10 ) ) {
2101
+ throw new WOE_FPDF_Exception( 'Not a PNG file: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2102
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2103
 
2104
+ // Read header chunk
2105
+ $this->_readstream( $ptr_file, 4 );
2106
+ if ( $this->_readstream( $ptr_file, 4 ) != 'IHDR' ) {
2107
+ throw new WOE_FPDF_Exception( 'Incorrect PNG file: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2108
+ }
2109
+ $int_width = $this->_readint( $ptr_file );
2110
+ $int_height = $this->_readint( $ptr_file );
2111
+ $int_bits_per_component = ord( $this->_readstream( $ptr_file, 1 ) );
2112
+ if ( $int_bits_per_component > 8 ) {
2113
+ throw new WOE_FPDF_Exception( '16-bit depth not supported: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2114
+ }
2115
+ $int_color_channels = ord( $this->_readstream( $ptr_file, 1 ) );
2116
+ if ( $int_color_channels == 0 || $int_color_channels == 4 ) {
2117
+ $str_color_space = 'DeviceGray';
2118
+ } elseif ( $int_color_channels == 2 || $int_color_channels == 6 ) {
2119
+ $str_color_space = 'DeviceRGB';
2120
+ } elseif ( $int_color_channels == 3 ) {
2121
+ $str_color_space = 'Indexed';
2122
+ } else {
2123
+ throw new WOE_FPDF_Exception( 'Unknown color type: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2124
+ }
2125
+ if ( ord( $this->_readstream( $ptr_file, 1 ) ) != 0 ) {
2126
+ throw new WOE_FPDF_Exception( 'Unknown compression method: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2127
+ }
2128
+ if ( ord( $this->_readstream( $ptr_file, 1 ) ) != 0 ) {
2129
+ throw new WOE_FPDF_Exception( 'Unknown filter method: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2130
+ }
2131
+ if ( ord( $this->_readstream( $ptr_file, 1 ) ) != 0 ) {
2132
+ throw new WOE_FPDF_Exception( 'Interlacing not supported: ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2133
+ }
2134
+ $this->_readstream( $ptr_file, 4 );
2135
+ $str_predictor = '/Predictor 15 /Colors ' . ( $str_color_space == 'DeviceRGB' ? 3 : 1 ) . ' /BitsPerComponent ' . $int_bits_per_component . ' /Columns ' . $int_width;
2136
+
2137
+ // Scan chunks looking for palette, transparency and image data
2138
+ $str_palette = '';
2139
+ $arr_transparency_data = '';
2140
+ $str_data = '';
2141
+ do {
2142
+ $int_line = $this->_readint( $ptr_file );
2143
+ $str_type = $this->_readstream( $ptr_file, 4 );
2144
+ if ( $str_type == 'PLTE' ) {
2145
+ // Read palette
2146
+ $str_palette = $this->_readstream( $ptr_file, $int_line );
2147
+ $this->_readstream( $ptr_file, 4 );
2148
+ } elseif ( $str_type == 'tRNS' ) {
2149
+ // Read transparency info
2150
+ $str_transparency = $this->_readstream( $ptr_file, $int_line );
2151
+ if ( $int_color_channels == 0 ) {
2152
+ $arr_transparency_data = array( ord( substr( $str_transparency, 1, 1 ) ) );
2153
+ } elseif ( $int_color_channels == 2 ) {
2154
+ $arr_transparency_data = array(
2155
+ ord( substr( $str_transparency, 1, 1 ) ),
2156
+ ord( substr( $str_transparency, 3, 1 ) ),
2157
+ ord( substr( $str_transparency, 5, 1 ) )
2158
+ );
2159
+ } else {
2160
+ $int_pos = strpos( $str_transparency, chr( 0 ) );
2161
+ if ( $int_pos !== false ) {
2162
+ $arr_transparency_data = array( $int_pos );
2163
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2164
  }
2165
+ $this->_readstream( $ptr_file, 4 );
2166
+ } elseif ( $str_type == 'IDAT' ) {
2167
+ // Read image data block
2168
+ $str_data .= $this->_readstream( $ptr_file, $int_line );
2169
+ $this->_readstream( $ptr_file, 4 );
2170
+ } elseif ( $str_type == 'IEND' ) {
2171
+ break;
2172
+ } else {
2173
+ $this->_readstream( $ptr_file, $int_line + 4 );
2174
+ }
2175
+ } while ( $int_line );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2176
 
2177
+ if ( $str_color_space == 'Indexed' && empty( $str_palette ) ) {
2178
+ throw new WOE_FPDF_Exception( 'Missing palette in ' . $str_file, WOE_FPDF_Exception::UNSUPPORTED_IMAGE );
2179
+ }
2180
+ $arr_info = array(
2181
+ 'w' => $int_width,
2182
+ 'h' => $int_height,
2183
+ 'cs' => $str_color_space,
2184
+ 'bpc' => $int_bits_per_component,
2185
+ 'f' => 'FlateDecode',
2186
+ 'dp' => $str_predictor,
2187
+ 'pal' => $str_palette,
2188
+ 'trns' => $arr_transparency_data
2189
+ );
2190
+ if ( $int_color_channels >= 4 ) {
2191
+ // Extract alpha channel
2192
+ if ( ! function_exists( 'gzuncompress' ) ) {
2193
+ throw new WOE_FPDF_Exception( 'Zlib not available, can\'t handle alpha channel: ' . $str_file, WOE_FPDF_Exception::EXTENSION_NOT_AVAILABLE );
2194
+ }
2195
+ $str_data = gzuncompress( $str_data );
2196
+ $str_color = '';
2197
+ $str_alpha = '';
2198
+ if ( $int_color_channels == 4 ) {
2199
+ // Gray image
2200
+ $int_length = 2 * $int_width;
2201
+ for ( $i = 0; $i < $int_height; $i ++ ) {
2202
+ $int_pos = ( 1 + $int_length ) * $i;
2203
+ $str_color .= $str_data[ $int_pos ];
2204
+ $str_alpha .= $str_data[ $int_pos ];
2205
+ $str_line = substr( $str_data, $int_pos + 1, $int_length );
2206
+ $str_color .= preg_replace( '/(.)./s', '$1', $str_line );
2207
+ $str_alpha .= preg_replace( '/.(.)/s', '$1', $str_line );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2208
  }
2209
+ } else {
2210
+ // RGB image
2211
+ $int_length = 4 * $int_width;
2212
+ for ( $i = 0; $i < $int_height; $i ++ ) {
2213
+ $int_pos = ( 1 + $int_length ) * $i;
2214
+ $str_color .= $str_data[ $int_pos ];
2215
+ $str_alpha .= $str_data[ $int_pos ];
2216
+ $str_line = substr( $str_data, $int_pos + 1, $int_length );
2217
+ $str_color .= preg_replace( '/(.{3})./s', '$1', $str_line );
2218
+ $str_alpha .= preg_replace( '/.{3}(.)/s', '$1', $str_line );
2219
+ }
2220
+ }
2221
+ unset( $str_data );
2222
+ $str_data = gzcompress( $str_color );
2223
+ $arr_info['smask'] = gzcompress( $str_alpha );
2224
+ if ( $this->str_pdf_version < '1.4' ) {
2225
+ $this->str_pdf_version = '1.4';
2226
+ }
2227
+ }
2228
+ $arr_info['data'] = $str_data;
 
 
 
 
 
 
 
2229
 
2230
+ return $arr_info;
2231
+ }
 
 
 
 
 
 
 
2232
 
2233
+ /**
2234
+ * @param $ptr_file
2235
+ * @param $int_bytes
2236
+ *
2237
+ * @return string
2238
+ */
2239
+ private function _readstream( $ptr_file, $int_bytes ) {
2240
+ // Read n bytes from stream
2241
+ $str_result = '';
2242
+ while ( $int_bytes > 0 && ! feof( $ptr_file ) ) {
2243
+ $str_data = fread( $ptr_file, $int_bytes );
2244
+ if ( $str_data === false ) {
2245
+ throw new WOE_FPDF_Exception( 'Error while reading stream', WOE_FPDF_Exception::INVALID_STREAM );
2246
+ }
2247
+ $int_bytes -= strlen( $str_data );
2248
+ $str_result .= $str_data;
2249
+ }
2250
+ if ( $int_bytes > 0 ) {
2251
+ throw new WOE_FPDF_Exception( 'Unexpected end of stream', WOE_FPDF_Exception::INVALID_STREAM );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2252
  }
 
 
 
2253
 
2254
+ return $str_result;
2255
+ }
 
 
 
 
2256
 
2257
+ /**
2258
+ * @param $ptr_file
2259
+ *
2260
+ * @return mixed
2261
+ */
2262
+ private function _readint( $ptr_file ) {
2263
+ // Read a 4-byte integer from stream
2264
+ $arr_data = unpack( 'Ni', $this->_readstream( $ptr_file, 4 ) );
2265
 
2266
+ return $arr_data['i'];
2267
+ }
 
 
 
2268
 
2269
+ /**
2270
+ * @param $str_file
2271
+ *
2272
+ * @return array
2273
+ */
2274
+ private function _parsegif( $str_file ) {
2275
+ // Extract info from a GIF file (via PNG conversion)
2276
+ if ( ! function_exists( 'imagepng' ) ) {
2277
+ throw new WOE_FPDF_Exception( 'GD extension is required for GIF support', WOE_FPDF_Exception::EXTENSION_NOT_AVAILABLE );
2278
+ }
2279
+ if ( ! function_exists( 'imagecreatefromgif' ) ) {
2280
+ throw new WOE_FPDF_Exception( 'GD has no GIF read support', WOE_FPDF_Exception::EXTENSION_NOT_AVAILABLE );
2281
+ }
2282
+ $obj_image = imagecreatefromgif( $str_file );
2283
+ if ( ! $obj_image ) {
2284
+ throw new WOE_FPDF_Exception( 'Missing or incorrect image file: ' . $str_file, WOE_FPDF_Exception::INVALID_IMAGE );
2285
+ }
2286
+ imageinterlace( $obj_image, 0 );
2287
+ $ptr_file = @fopen( 'php://temp', 'rb+' );
2288
+ if ( $ptr_file ) {
2289
+ // Perform conversion in memory
2290
+ ob_start();
2291
+ imagepng( $obj_image );
2292
+ $str_data = ob_get_clean();
2293
+ imagedestroy( $obj_image );
2294
+ fwrite( $ptr_file, $str_data );
2295
+ rewind( $ptr_file );
2296
+ $arr_info = $this->_parsepngstream( $ptr_file, $str_file );
2297
+ fclose( $ptr_file );
2298
+ } else {
2299
+ // Use temporary file
2300
+ $str_tmp = tempnam( '.', 'gif' );
2301
+ if ( ! $str_tmp ) {
2302
+ throw new WOE_FPDF_Exception( 'Unable to create a temporary file', WOE_FPDF_Exception::IMAGE_NOT_WRITABLE );
2303
+ }
2304
+ if ( ! imagepng( $obj_image, $str_tmp ) ) {
2305
+ throw new WOE_FPDF_Exception( 'Error while saving to temporary file', WOE_FPDF_Exception::IMAGE_NOT_WRITABLE );
2306
+ }
2307
+ imagedestroy( $obj_image );
2308
+ $arr_info = $this->_parsepng( $str_tmp );
2309
+ unlink( $str_tmp );
2310
+ }
2311
 
2312
+ return $arr_info;
2313
+ }
 
 
 
 
 
 
2314
 
2315
+ /**
2316
+ * Creates a new object
2317
+ */
2318
+ protected function NewObject() {
2319
+ $this->int_current_object ++;
2320
+ $this->arr_offsets[ $this->int_current_object ] = strlen( $this->str_buffer );
2321
+ $this->Out( $this->int_current_object . ' 0 obj' );
2322
+ }
2323
 
2324
+ /**
2325
+ * @param $str_data
2326
+ */
2327
+ protected function PutStream( $str_data ) {
2328
+ $this->Out( 'stream' );
2329
+ $this->Out( $str_data );
2330
+ $this->Out( 'endstream' );
2331
+ }
 
 
2332
 
2333
+ /**
2334
+ * @param $str_data
2335
+ */
2336
+ protected function Out( $str_data ) {
2337
+ // Add a line to the document
2338
+ if ( $this->int_state == self::DOCUMENT_STATE_CREATING ) {
2339
+ $this->arr_pages[ $this->int_page ] .= $str_data . "\n";
2340
+ } else {
2341
+ $this->str_buffer .= $str_data . "\n";
2342
+ }
2343
+ }
2344
 
2345
+ /**
2346
+ * Puts the pages into the document
2347
+ */
2348
+ private function PutPages() {
2349
+ $int_page = $this->int_page;
2350
+ if ( ! empty( $this->str_alias_number_pages ) ) {
2351
+ // Replace number of pages in fonts using subsets
2352
+ $str_alias = $this->UTF8ToUTF16BE( $this->str_alias_number_pages, false );
2353
+ $str_replace = $this->UTF8ToUTF16BE( "$int_page", false );
2354
+ for ( $n = 1; $n <= $int_page; $n ++ ) {
2355
+ $this->arr_pages[ $n ] = str_replace( $str_alias, $str_replace, $this->arr_pages[ $n ] );
2356
+ }
2357
+ // Now repeat for no pages in non-subset fonts
2358
+ for ( $n = 1; $n <= $int_page; $n ++ ) {
2359
+ $this->arr_pages[ $n ] = str_replace( $this->str_alias_number_pages, $int_page, $this->arr_pages[ $n ] );
2360
+ }
2361
+ }
2362
+ if ( $this->str_default_orientation == self::ORIENTATION_PORTRAIT ) {
2363
+ $flt_page_width = $this->arr_default_page_sizes[0] * $this->flt_scale_factor;
2364
+ $flt_page_height = $this->arr_default_page_sizes[1] * $this->flt_scale_factor;
2365
+ } else {
2366
+ $flt_page_width = $this->arr_default_page_sizes[1] * $this->flt_scale_factor;
2367
+ $flt_page_height = $this->arr_default_page_sizes[0] * $this->flt_scale_factor;
2368
+ }
2369
+ $str_filter = ( $this->bol_compress ) ? '/Filter /FlateDecode ' : '';
2370
+ for ( $n = 1; $n <= $int_page; $n ++ ) {
2371
+ // Page
2372
+ $this->NewObject();
2373
+ $this->Out( '<</Type /Page' );
2374
+ $this->Out( '/Parent 1 0 R' );
2375
+ if ( isset( $this->arr_page_sizes[ $n ] ) ) {
2376
+ $this->Out( sprintf( '/MediaBox [0 0 %.2F %.2F]', $this->arr_page_sizes[ $n ][0], $this->arr_page_sizes[ $n ][1] ) );
2377
+ }
2378
+ $this->Out( '/Resources 2 0 R' );
2379
+ if ( isset( $this->arr_page_links[ $n ] ) ) {
2380
+ // Links
2381
+ $str_annotations = '/Annots [';
2382
+ foreach ( $this->arr_page_links[ $n ] as $arr_page_link ) {
2383
+ $str_rectangle = sprintf( '%.2F %.2F %.2F %.2F', $arr_page_link[0], $arr_page_link[1], $arr_page_link[0] + $arr_page_link[2], $arr_page_link[1] - $arr_page_link[3] );
2384
+ $str_annotations .= '<</Type /Annot /Subtype /Link /Rect [' . $str_rectangle . '] /Border [0 0 0] ';
2385
+ if ( is_string( $arr_page_link[4] ) ) {
2386
+ $str_annotations .= '/A <</S /URI /URI ' . $this->TextString( $arr_page_link[4] ) . '>>>>';
2387
+ } else {
2388
+ $arr_link = $this->arr_internal_links[ $arr_page_link[4] ];
2389
+ $flt_height = isset( $this->arr_page_sizes[ $arr_link[0] ] ) ? $this->arr_page_sizes[ $arr_link[0] ][1] : $flt_page_height;
2390
+ $str_annotations .= sprintf( '/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $arr_link[0], $flt_height - $arr_link[1] * $this->flt_scale_factor );
2391
+ }
2392
+ }
2393
+ $this->Out( $str_annotations . ']' );
2394
+ }
2395
+ if ( $this->str_pdf_version > '1.3' ) {
2396
+ $this->Out( '/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>' );
2397
+ }
2398
+ $this->Out( '/Contents ' . ( $this->int_current_object + 1 ) . ' 0 R>>' );
2399
+ $this->Out( 'endobj' );
2400
+ // Page content
2401
+ $str_page_content = ( $this->bol_compress ) ? gzcompress( $this->arr_pages[ $n ] ) : $this->arr_pages[ $n ];
2402
+ $this->NewObject();
2403
+ $this->Out( '<<' . $str_filter . '/Length ' . strlen( $str_page_content ) . '>>' );
2404
+ $this->PutStream( $str_page_content );
2405
+ $this->Out( 'endobj' );
2406
+ }
2407
+ // Pages root
2408
+ $this->arr_offsets[1] = strlen( $this->str_buffer );
2409
+ $this->Out( '1 0 obj' );
2410
+ $this->Out( '<</Type /Pages' );
2411
+ $str_kids = '/Kids [';
2412
+ for ( $i = 0; $i < $int_page; $i ++ ) {
2413
+ $str_kids .= ( 3 + 2 * $i ) . ' 0 R ';
2414
+ }
2415
+ $this->Out( $str_kids . ']' );
2416
+ $this->Out( '/Count ' . $int_page );
2417
+ $this->Out( sprintf( '/MediaBox [0 0 %.2F %.2F]', $flt_page_width, $flt_page_height ) );
2418
+ $this->Out( '>>' );
2419
+ $this->Out( 'endobj' );
2420
+ }
2421
 
2422
+ /**
2423
+ *
2424
+ */
2425
+ public function PutFonts() {
2426
+ $int_current_object = $this->int_current_object;
2427
+ foreach ( $this->arr_encoding_diffs as $str_diff ) {
2428
+ // Encodings
2429
+ $this->NewObject();
2430
+ $this->Out( '<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $str_diff . ']>>' );
2431
+ $this->Out( 'endobj' );
2432
+ }
2433
+ foreach ( $this->arr_font_files as $str_file => $arr_info ) {
2434
+ if ( ! isset( $arr_info['type'] ) || $arr_info['type'] != self::FONT_TRUETYPE ) {
2435
+ // Font file embedding
2436
+ $this->NewObject();
2437
+ $this->arr_font_files[ $str_file ]['n'] = $this->int_current_object;
2438
+ $str_font = $this->readFontFile( $this->getFontPath() . $str_file );
2439
+
2440
+ $bol_compressed_file = ( substr( $str_file, - 2 ) == '.z' );
2441
+ if ( ! $bol_compressed_file && isset( $arr_info['length2'] ) ) {
2442
+ $bol_header = ( ord( $str_font[0] ) == 128 );
2443
+ if ( $bol_header ) {
2444
+ // Strip first binary header
2445
+ $str_font = substr( $str_font, 6 );
2446
+ }
2447
+ if ( $bol_header && ord( $str_font[ $arr_info['length1'] ] ) == 128 ) {
2448
+ // Strip second binary header
2449
+ $str_font = substr( $str_font, 0, $arr_info['length1'] ) . substr( $str_font, $arr_info['length1'] + 6 );
2450
+ }
2451
+ }
2452
+ $this->Out( '<</Length ' . strlen( $str_font ) );
2453
+ if ( $bol_compressed_file ) {
2454
+ $this->Out( '/Filter /FlateDecode' );
2455
+ }
2456
+ $this->Out( '/Length1 ' . $arr_info['length1'] );
2457
+ if ( isset( $arr_info['length2'] ) ) {
2458
+ $this->Out( '/Length2 ' . $arr_info['length2'] . ' /Length3 0' );
2459
+ }
2460
+ $this->Out( '>>' );
2461
+ $this->PutStream( $str_font );
2462
+ $this->Out( 'endobj' );
2463
+ }
2464
+ }
2465
 
2466
+ foreach ( $this->arr_fonts as $str_key => $arr_font_data ) {
2467
+
2468
+ // Font objects
2469
+ //$this->fonts[$k]['n']=$this->n+1;
2470
+ $str_type = $arr_font_data['type'];
2471
+ $str_name = $arr_font_data['name'];
2472
+ if ( $str_type == 'Core' ) {
2473
+ // Standard font
2474
+ $this->arr_fonts[ $str_key ]['n'] = $this->int_current_object + 1;
2475
+ $this->NewObject();
2476
+ $this->Out( '<</Type /Font' );
2477
+ $this->Out( '/BaseFont /' . $str_name );
2478
+ $this->Out( '/Subtype /Type1' );
2479
+ if ( $str_name != 'Symbol' && $str_name != 'ZapfDingbats' ) {
2480
+ $this->Out( '/Encoding /WinAnsiEncoding' );
2481
+ }
2482
+ $this->Out( '>>' );
2483
+ $this->Out( 'endobj' );
2484
+ } elseif ( $str_type == 'Type1' || $str_type == 'TrueType' ) {
2485
+ // Additional Type1 or TrueType font
2486
+ $this->arr_fonts[ $str_key ]['n'] = $this->int_current_object + 1;
2487
+ $this->NewObject();
2488
+ $this->Out( '<</Type /Font' );
2489
+ $this->Out( '/BaseFont /' . $str_name );
2490
+ $this->Out( '/Subtype /' . $str_type );
2491
+ $this->Out( '/FirstChar 32 /LastChar 255' );
2492
+ $this->Out( '/Widths ' . ( $this->int_current_object + 1 ) . ' 0 R' );
2493
+ $this->Out( '/FontDescriptor ' . ( $this->int_current_object + 2 ) . ' 0 R' );
2494
+ if ( $arr_font_data['enc'] ) {
2495
+ if ( isset( $arr_font_data['diff'] ) ) {
2496
+ $this->Out( '/Encoding ' . ( $int_current_object + $arr_font_data['diff'] ) . ' 0 R' );
2497
+ } else {
2498
+ $this->Out( '/Encoding /WinAnsiEncoding' );
2499
+ }
2500
+ }
2501
+ $this->Out( '>>' );
2502
+ $this->Out( 'endobj' );
2503
+ // Widths
2504
+ $this->NewObject();
2505
+ $int_character_width =& $arr_font_data['cw'];
2506
+ $str_data = '[';
2507
+ for ( $i = 32; $i <= 255; $i ++ ) {
2508
+ $str_data .= $int_character_width[ chr( $i ) ] . ' ';
2509
+ }
2510
+ $this->Out( $str_data . ']' );
2511
+ $this->Out( 'endobj' );
2512
+ // Descriptor
2513
+ $this->NewObject();
2514
+ $str_data = '<</Type /FontDescriptor /FontName /' . $str_name;
2515
+ foreach ( $arr_font_data['desc'] as $str_inner_key => $str_value ) {
2516
+ $str_data .= ' /' . $str_inner_key . ' ' . $str_value;
2517
+ }
2518
+ $str_file = $arr_font_data['file'];
2519
+ if ( $str_file ) {
2520
+ $str_data .= ' /FontFile' . ( $str_type == 'Type1' ? '' : '2' ) . ' ' . $this->arr_font_files[ $str_file ]['n'] . ' 0 R';
2521
+ }
2522
+ $this->Out( $str_data . '>>' );
2523
+ $this->Out( 'endobj' );
2524
+ } // TrueType embedded SUBSETS or FULL
2525
+ else {
2526
+ if ( $str_type === self::FONT_TRUETYPE ) {
2527
+ $this->arr_fonts[ $str_key ]['n'] = $this->int_current_object + 1;
2528
+
2529
+ $obj_ttf = new WOE_FPDF_TT_Font_File();
2530
+ $str_font_name = 'MPDFAA' . '+' . $arr_font_data['name'];
2531
+ $str_subset = $arr_font_data['subset'];
2532
+ unset( $str_subset[0] );
2533
+ $str_ttf_font_stream = $obj_ttf->makeSubset( $arr_font_data['ttffile'], $str_subset );
2534
+ $int_ttf_font_size = strlen( $str_ttf_font_stream );
2535
+ $str_font_stream_compressed = gzcompress( $str_ttf_font_stream );
2536
+ $str_code_to_glyph = $obj_ttf->getCodeToGlyph();
2537
+ unset( $str_code_to_glyph[0] );
2538
+
2539
+ // Type0 Font
2540
+ // A composite font - a font composed of other fonts, organized hierarchically
2541
+ $this->NewObject();
2542
+ $this->Out( '<</Type /Font' );
2543
+ $this->Out( '/Subtype /Type0' );
2544
+ $this->Out( '/BaseFont /' . $str_font_name . '' );
2545
+ $this->Out( '/Encoding /Identity-H' );
2546
+ $this->Out( '/DescendantFonts [' . ( $this->int_current_object + 1 ) . ' 0 R]' );
2547
+ $this->Out( '/ToUnicode ' . ( $this->int_current_object + 2 ) . ' 0 R' );
2548
+ $this->Out( '>>' );
2549
+ $this->Out( 'endobj' );
2550
+
2551
+ // CIDFontType2
2552
+ // A CIDFont whose glyph descriptions are based on TrueType font technology
2553
+ $this->NewObject();
2554
+ $this->Out( '<</Type /Font' );
2555
+ $this->Out( '/Subtype /CIDFontType2' );
2556
+ $this->Out( '/BaseFont /' . $str_font_name . '' );
2557
+ $this->Out( '/CIDSystemInfo ' . ( $this->int_current_object + 2 ) . ' 0 R' );
2558
+ $this->Out( '/FontDescriptor ' . ( $this->int_current_object + 3 ) . ' 0 R' );
2559
+ if ( isset( $arr_font_data['desc']['MissingWidth'] ) ) {
2560
+ $this->Out( '/DW ' . $arr_font_data['desc']['MissingWidth'] . '' );
2561
+ }
2562
+
2563
+ $this->PutTTFontWidths( $arr_font_data, $obj_ttf->getMaxUni() );
2564
+
2565
+ $this->Out( '/CIDToGIDMap ' . ( $this->int_current_object + 4 ) . ' 0 R' );
2566
+ $this->Out( '>>' );
2567
+ $this->Out( 'endobj' );
2568
+
2569
+ // ToUnicode
2570
+ $this->NewObject();
2571
+ $str_to_unicode = "/CIDInit /ProcSet findresource begin\n";
2572
+ $str_to_unicode .= "12 dict begin\n";
2573
+ $str_to_unicode .= "begincmap\n";
2574
+ $str_to_unicode .= "/CIDSystemInfo\n";
2575
+ $str_to_unicode .= "<</Registry (Adobe)\n";
2576
+ $str_to_unicode .= "/Ordering (UCS)\n";
2577
+ $str_to_unicode .= "/Supplement 0\n";
2578
+ $str_to_unicode .= ">> def\n";
2579
+ $str_to_unicode .= "/CMapName /Adobe-Identity-UCS def\n";
2580
+ $str_to_unicode .= "/CMapType 2 def\n";
2581
+ $str_to_unicode .= "1 begincodespacerange\n";
2582
+ $str_to_unicode .= "<0000> <FFFF>\n";
2583
+ $str_to_unicode .= "endcodespacerange\n";
2584
+ $str_to_unicode .= "1 beginbfrange\n";
2585
+ $str_to_unicode .= "<0000> <FFFF> <0000>\n";
2586
+ $str_to_unicode .= "endbfrange\n";
2587
+ $str_to_unicode .= "endcmap\n";
2588
+ $str_to_unicode .= "CMapName currentdict /CMap defineresource pop\n";
2589
+ $str_to_unicode .= "end\n";
2590
+ $str_to_unicode .= "end";
2591
+ $this->Out( '<</Length ' . ( strlen( $str_to_unicode ) ) . '>>' );
2592
+ $this->PutStream( $str_to_unicode );
2593
+ $this->Out( 'endobj' );
2594
+
2595
+ // CIDSystemInfo dictionary
2596
+ $this->NewObject();
2597
+ $this->Out( '<</Registry (Adobe)' );
2598
+ $this->Out( '/Ordering (UCS)' );
2599
+ $this->Out( '/Supplement 0' );
2600
+ $this->Out( '>>' );
2601
+ $this->Out( 'endobj' );
2602
+
2603
+ // Font descriptor
2604
+ $this->NewObject();
2605
+ $this->Out( '<</Type /FontDescriptor' );
2606
+ $this->Out( '/FontName /' . $str_font_name );
2607
+ foreach ( $arr_font_data['desc'] as $str_inner_inner_key => $str_value ) {
2608
+ if ( $str_inner_inner_key == 'Flags' ) {
2609
+ $str_value = $str_value | 4;
2610
+ $str_value = $str_value & ~32;
2611
+ } // SYMBOLIC font flag
2612
+ $this->Out( ' /' . $str_inner_inner_key . ' ' . $str_value );
2613
+ }
2614
+ $this->Out( '/FontFile2 ' . ( $this->int_current_object + 2 ) . ' 0 R' );
2615
+ $this->Out( '>>' );
2616
+ $this->Out( 'endobj' );
2617
+
2618
+ // Embed CIDToGIDMap
2619
+ // A specification of the mapping from CIDs to glyph indices
2620
+ $str_cid_to_gid_map = str_pad( '', 256 * 256 * 2, "\x00" );
2621
+ foreach ( $str_code_to_glyph as $cc => $str_clyph ) {
2622
+ $str_cid_to_gid_map[ $cc * 2 ] = chr( $str_clyph >> 8 );
2623
+ $str_cid_to_gid_map[ $cc * 2 + 1 ] = chr( $str_clyph & 0xFF );
2624
+ }
2625
+ $str_cid_to_gid_map = gzcompress( $str_cid_to_gid_map );
2626
+ $this->NewObject();
2627
+ $this->Out( '<</Length ' . strlen( $str_cid_to_gid_map ) . '' );
2628
+ $this->Out( '/Filter /FlateDecode' );
2629
+ $this->Out( '>>' );
2630
+ $this->PutStream( $str_cid_to_gid_map );
2631
+ $this->Out( 'endobj' );
2632
+
2633
+ //Font file
2634
+ $this->NewObject();
2635
+ $this->Out( '<</Length ' . strlen( $str_font_stream_compressed ) );
2636
+ $this->Out( '/Filter /FlateDecode' );
2637
+ $this->Out( '/Length1 ' . $int_ttf_font_size );
2638
+ $this->Out( '>>' );
2639
+ $this->PutStream( $str_font_stream_compressed );
2640
+ $this->Out( 'endobj' );
2641
+ unset( $obj_ttf );
2642
+ } else {
2643
+ // Allow for additional types
2644
+ $this->arr_fonts[ $str_key ]['n'] = $this->int_current_object + 1;
2645
+ $str_method = '_put' . strtolower( $str_type );
2646
+ if ( ! method_exists( $this, $str_method ) ) {
2647
+ throw new WOE_FPDF_Exception( 'Unsupported font type: ' . $str_type, WOE_FPDF_Exception::UNSUPPORTED_FONT );
2648
+ }
2649
+ $this->$str_method( $arr_font_data );
2650
+ }
2651
+ }
2652
  }
 
 
2653
  }
 
2654
 
2655
+ protected function PutTTFontWidths( $font, $maxUni ) {
2656
+ $cachePath = $this->getCachePath();
2657
+ $cacheFile = $cachePath . self::FILE_CHARACTER_WIDTH . $font['filename'] . '.json';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2658
 
2659
+ $rangeid = 0;
2660
+ $range = array();
2661
+ $prevcid = - 2;
2662
+ $prevwidth = - 1;
2663
+ $interval = false;
2664
+ $startcid = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2665
 
2666
+ if ( $cachePath !== null && file_exists( $cacheFile ) ) {
2667
+ $fopen = fopen( $cacheFile, 'r' );
2668
+ $fread = fread( $fopen, filesize( $cacheFile ) );
2669
+ fclose( $fopen );
2670
 
2671
+ $json = json_decode( $fread, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
2672
 
2673
+ if ( json_last_error() !== JSON_ERROR_NONE ) {
2674
+ extract( $json );
2675
+ $startcid = 128;
2676
+ }
2677
+ }
 
 
 
 
 
 
2678
 
2679
+ $cwlen = $maxUni + 1;
2680
+ // for each character
2681
+ for ( $cid = $startcid; $cid < $cwlen; $cid ++ ) {
2682
+ if ( $font['cw'][ $cid * 2 ] == "\00" && $font['cw'][ $cid * 2 + 1 ] == "\00" ) {
2683
+ continue;
2684
+ }
 
 
 
 
 
 
2685
 
2686
+ $width = ( ord( $font['cw'][ $cid * 2 ] ) << 8 ) + ord( $font['cw'][ $cid * 2 + 1 ] );
2687
+ if ( $width == 65535 ) {
2688
+ $width = 0;
2689
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2690
 
2691
+ if ( $cid > 255 && ( ! isset( $font['subset'][ $cid ] ) || ! $font['subset'][ $cid ] ) ) {
2692
+ continue;
2693
+ }
 
 
 
 
 
2694
 
2695
+ if ( ! isset( $font['dw'] ) || ( isset( $font['dw'] ) && $width != $font['dw'] ) ) {
2696
+ if ( $cid == ( $prevcid + 1 ) ) {
2697
+ if ( $width == $prevwidth ) {
2698
+ if ( $width == $range[ $rangeid ][0] ) {
2699
+ $range[ $rangeid ][] = $width;
2700
+ } else {
2701
+ array_pop( $range[ $rangeid ] );
2702
+ // new range
2703
+ $rangeid = $prevcid;
2704
+ $range[ $rangeid ] = array();
2705
+ $range[ $rangeid ][] = $prevwidth;
2706
+ $range[ $rangeid ][] = $width;
2707
+ }
2708
+ $interval = true;
2709
+ $range[ $rangeid ]['interval'] = true;
2710
+ } else {
2711
+ if ( $interval ) {
2712
+ // new range
2713
+ $rangeid = $cid;
2714
+ $range[ $rangeid ] = array();
2715
+ $range[ $rangeid ][] = $width;
2716
+ } else {
2717
+ $range[ $rangeid ][] = $width;
2718
+ }
2719
+ $interval = false;
2720
+ }
2721
+ } else {
2722
+ $rangeid = $cid;
2723
+ $range[ $rangeid ] = array();
2724
+ $range[ $rangeid ][] = $width;
2725
+ $interval = false;
2726
+ }
2727
+ $prevcid = $cid;
2728
+ $prevwidth = $width;
2729
+ }
2730
+ }
2731
 
2732
+ // write file
2733
+ if ( $cachePath !== null && ! file_exists( $cacheFile ) ) {
2734
+ $fh = fopen( $cacheFile, 'wb' );
 
 
 
 
 
2735
 
2736
+ $cw127 = [
2737
+ 'rangeid' => $rangeid,
2738
+ 'prevcid' => $prevcid,
2739
+ 'prevwidth' => $prevwidth,
2740
+ 'interval' => (bool) $interval,
2741
+ 'range' => $range,
2742
+ ];
 
 
 
 
 
 
 
 
 
 
 
2743
 
2744
+ fwrite( $fh, json_encode( $cw127 ) );
2745
+ fclose( $fh );
2746
+ }
 
 
 
 
 
 
 
2747
 
2748
+ $prevk = - 1;
2749
+ $nextk = - 1;
2750
+ $prevint = false;
2751
+ foreach ( $range as $k => $ws ) {
2752
+ $cws = count( $ws );
2753
+ if ( ( $k == $nextk ) AND ( ! $prevint ) AND ( ( ! isset( $ws['interval'] ) ) OR ( $cws < 4 ) ) ) {
2754
+ if ( isset( $range[ $k ]['interval'] ) ) {
2755
+ unset( $range[ $k ]['interval'] );
2756
+ }
2757
+ $range[ $prevk ] = array_merge( $range[ $prevk ], $range[ $k ] );
2758
+ unset( $range[ $k ] );
2759
+ } else {
2760
+ $prevk = $k;
2761
+ }
2762
+ $nextk = $k + $cws;
2763
+ if ( isset( $ws['interval'] ) ) {
2764
+ if ( $cws > 3 ) {
2765
+ $prevint = true;
2766
+ } else {
2767
+ $prevint = false;
2768
+ }
2769
+ unset( $range[ $k ]['interval'] );
2770
+ -- $nextk;
2771
+ } else {
2772
+ $prevint = false;
2773
+ }
2774
+ }
2775
+ $w = '';
2776
+ foreach ( $range as $k => $ws ) {
2777
+ if ( count( array_count_values( $ws ) ) == 1 ) {
2778
+ $w .= ' ' . $k . ' ' . ( $k + count( $ws ) - 1 ) . ' ' . $ws[0];
2779
+ } else {
2780
+ $w .= ' ' . $k . ' [ ' . implode( ' ', $ws ) . ' ]' . "\n";
2781
+ }
2782
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2783
 
2784
+ $this->Out( '/W [' . $w . ' ]' );
2785
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2786
 
2787
+ /**
2788
+ *
2789
+ */
2790
+ private function PutImages() {
2791
+ foreach ( array_keys( $this->arr_images ) as $str_file ) {
2792
+ $this->PutImage( $this->arr_images[ $str_file ] );
2793
+ unset( $this->arr_images[ $str_file ]['data'] );
2794
+ unset( $this->arr_images[ $str_file ]['smask'] );
2795
+ }
2796
+ }
2797
 
2798
+ /**
2799
+ * @param $arr_info
2800
+ */
2801
+ public function PutImage( &$arr_info ) {
2802
+ $this->NewObject();
2803
+ $arr_info['n'] = $this->int_current_object;
2804
+ $this->Out( '<</Type /XObject' );
2805
+ $this->Out( '/Subtype /Image' );
2806
+ $this->Out( '/Width ' . $arr_info['w'] );
2807
+ $this->Out( '/Height ' . $arr_info['h'] );
2808
+ if ( $arr_info['cs'] == 'Indexed' ) {
2809
+ $this->Out( '/ColorSpace [/Indexed /DeviceRGB ' . ( strlen( $arr_info['pal'] ) / 3 - 1 ) . ' ' . ( $this->int_current_object + 1 ) . ' 0 R]' );
2810
+ } else {
2811
+ $this->Out( '/ColorSpace /' . $arr_info['cs'] );
2812
+ if ( $arr_info['cs'] == 'DeviceCMYK' ) {
2813
+ $this->Out( '/Decode [1 0 1 0 1 0 1 0]' );
2814
+ }
2815
+ }
2816
+ $this->Out( '/BitsPerComponent ' . $arr_info['bpc'] );
2817
+ if ( isset( $arr_info['f'] ) ) {
2818
+ $this->Out( '/Filter /' . $arr_info['f'] );
2819
+ }
2820
+ if ( isset( $arr_info['dp'] ) ) {
2821
+ $this->Out( '/DecodeParms <<' . $arr_info['dp'] . '>>' );
2822
+ }
2823
+ if ( isset( $arr_info['trns'] ) && is_array( $arr_info['trns'] ) ) {
2824
+ $trns = '';
2825
+ for ( $i = 0; $i < count( $arr_info['trns'] ); $i ++ ) {
2826
+ $trns .= $arr_info['trns'][ $i ] . ' ' . $arr_info['trns'][ $i ] . ' ';
2827
+ }
2828
+ $this->Out( '/Mask [' . $trns . ']' );
2829
+ }
2830
+ if ( isset( $arr_info['smask'] ) ) {
2831
+ $this->Out( '/SMask ' . ( $this->int_current_object + 1 ) . ' 0 R' );
2832
+ }
2833
+ $this->Out( '/Length ' . strlen( $arr_info['data'] ) . '>>' );
2834
+ $this->PutStream( $arr_info['data'] );
2835
+ $this->Out( 'endobj' );
2836
+ // Soft mask
2837
+ if ( isset( $arr_info['smask'] ) ) {
2838
+ $str_dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns ' . $arr_info['w'];
2839
+ $arr_smask = array(
2840
+ 'w' => $arr_info['w'],
2841
+ 'h' => $arr_info['h'],
2842
+ 'cs' => 'DeviceGray',
2843
+ 'bpc' => 8,
2844
+ 'f' => $arr_info['f'],
2845
+ 'dp' => $str_dp,
2846
+ 'data' => $arr_info['smask']
2847
+ );
2848
+ $this->PutImage( $arr_smask );
2849
+ }
2850
+ // Palette
2851
+ if ( $arr_info['cs'] == 'Indexed' ) {
2852
+ $str_filter = ( $this->bol_compress ) ? '/Filter /FlateDecode ' : '';
2853
+ $str_pal = ( $this->bol_compress ) ? gzcompress( $arr_info['pal'] ) : $arr_info['pal'];
2854
+ $this->NewObject();
2855
+ $this->Out( '<<' . $str_filter . '/Length ' . strlen( $str_pal ) . '>>' );
2856
+ $this->PutStream( $str_pal );
2857
+ $this->Out( 'endobj' );
2858
+ }
2859
+ }
2860
 
2861
+ /**
2862
+ *
2863
+ */
2864
+ public function PutXObjectDict() {
2865
+ foreach ( $this->arr_images as $arr_image ) {
2866
+ $this->Out( '/I' . $arr_image['i'] . ' ' . $arr_image['n'] . ' 0 R' );
2867
+ }
2868
+ }
 
 
 
 
2869
 
2870
+ /**
2871
+ *
2872
+ */
2873
+ public function PutResourceDict() {
2874
+ $this->Out( '/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]' );
2875
+ $this->Out( '/Font <<' );
2876
+ foreach ( $this->arr_fonts as $arr_font ) {
2877
+ $this->Out( '/F' . $arr_font['i'] . ' ' . $arr_font['n'] . ' 0 R' );
2878
+ }
2879
+ $this->Out( '>>' );
2880
+ $this->Out( '/XObject <<' );
2881
+ $this->PutXObjectDict();
2882
+ $this->Out( '>>' );
2883
+ }
2884
 
2885
+ /**
2886
+ *
2887
+ */
2888
+ public function PutResources() {
2889
+ $this->PutFonts();
2890
+ $this->PutImages();
2891
+ // Resource dictionary
2892
+ $this->arr_offsets[2] = strlen( $this->str_buffer );
2893
+ $this->Out( '2 0 obj' );
2894
+ $this->Out( '<<' );
2895
+ $this->PutResourceDict();
2896
+ $this->Out( '>>' );
2897
+ $this->Out( 'endobj' );
2898
+ }
2899
 
2900
+ /**
2901
+ *
2902
+ */
2903
+ public function PutInfo() {
2904
+ $this->Out( '/Producer ' . $this->TextString( 'tFPDF ' . $this->str_pdf_version ) );
2905
+ if ( ! empty( $this->str_title ) ) {
2906
+ $this->Out( '/Title ' . $this->TextString( $this->str_title ) );
2907
+ }
2908
+ if ( ! empty( $this->str_subject ) ) {
2909
+ $this->Out( '/Subject ' . $this->TextString( $this->str_subject ) );
2910
+ }
2911
+ if ( ! empty( $this->str_author ) ) {
2912
+ $this->Out( '/Author ' . $this->TextString( $this->str_author ) );
2913
+ }
2914
+ if ( ! empty( $this->str_keywords ) ) {
2915
+ $this->Out( '/Keywords ' . $this->TextString( $this->str_keywords ) );
2916
+ }
2917
+ if ( ! empty( $this->str_creator ) ) {
2918
+ $this->Out( '/Creator ' . $this->TextString( $this->str_creator ) );
2919
+ }
2920
+ $this->Out( '/CreationDate ' . $this->TextString( 'D:' . @date( 'YmdHis' ) ) );
2921
+ }
2922
 
2923
+ /**
2924
+ *
2925
+ */
2926
+ public function PutCatalog() {
2927
+ $this->Out( '/Type /Catalog' );
2928
+ $this->Out( '/Pages 1 0 R' );
2929
+ if ( $this->mix_zoom_mode == 'fullpage' ) {
2930
+ $this->Out( '/OpenAction [3 0 R /Fit]' );
2931
+ } elseif ( $this->mix_zoom_mode == 'fullwidth' ) {
2932
+ $this->Out( '/OpenAction [3 0 R /FitH null]' );
2933
+ } elseif ( $this->mix_zoom_mode == 'real' ) {
2934
+ $this->Out( '/OpenAction [3 0 R /XYZ null null 1]' );
2935
+ } elseif ( ! is_string( $this->mix_zoom_mode ) ) {
2936
+ $this->Out( '/OpenAction [3 0 R /XYZ null null ' . sprintf( '%.2F', $this->mix_zoom_mode / 100 ) . ']' );
2937
+ }
2938
+ if ( $this->str_layout_mode == 'single' ) {
2939
+ $this->Out( '/PageLayout /SinglePage' );
2940
+ } elseif ( $this->str_layout_mode == 'continuous' ) {
2941
+ $this->Out( '/PageLayout /OneColumn' );
2942
+ } elseif ( $this->str_layout_mode == 'two' ) {
2943
+ $this->Out( '/PageLayout /TwoColumnLeft' );
2944
+ }
2945
+ }
2946
 
2947
+ /**
2948
+ *
2949
+ */
2950
+ public function PutHeader() {
2951
+ $this->Out( '%PDF-' . $this->str_pdf_version );
2952
+ }
 
 
 
 
 
 
 
 
 
2953
 
2954
+ /**
2955
+ *
2956
+ */
2957
+ public function PutTrailer() {
2958
+ $this->Out( '/Size ' . ( $this->int_current_object + 1 ) );
2959
+ $this->Out( '/Root ' . $this->int_current_object . ' 0 R' );
2960
+ $this->Out( '/Info ' . ( $this->int_current_object - 1 ) . ' 0 R' );
2961
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2962
 
2963
+ /**
2964
+ *
2965
+ */
2966
+ public function EndDoc() {
2967
+ $this->PutHeader();
2968
+ $this->PutPages();
2969
+ $this->PutResources();
2970
+ // Info
2971
+ $this->NewObject();
2972
+ $this->Out( '<<' );
2973
+ $this->PutInfo();
2974
+ $this->Out( '>>' );
2975
+ $this->Out( 'endobj' );
2976
+ // Catalog
2977
+ $this->NewObject();
2978
+ $this->Out( '<<' );
2979
+ $this->PutCatalog();
2980
+ $this->Out( '>>' );
2981
+ $this->Out( 'endobj' );
2982
+ // Cross-ref
2983
+ $int_buffer_size = strlen( $this->str_buffer );
2984
+ $this->Out( 'xref' );
2985
+ $this->Out( '0 ' . ( $this->int_current_object + 1 ) );
2986
+ $this->Out( '0000000000 65535 f ' );
2987
+ for ( $i = 1; $i <= $this->int_current_object; $i ++ ) {
2988
+ $this->Out( sprintf( '%010d 00000 n ', $this->arr_offsets[ $i ] ) );
2989
+ }
2990
+ // Trailer
2991
+ $this->Out( 'trailer' );
2992
+ $this->Out( '<<' );
2993
+ $this->PutTrailer();
2994
+ $this->Out( '>>' );
2995
+ $this->Out( 'startxref' );
2996
+ $this->Out( $int_buffer_size );
2997
+ $this->Out( '%%EOF' );
2998
+ $this->int_state = self::DOCUMENT_STATE_TERMINATED;
2999
+ }
3000
 
3001
+ /**
3002
+ * Converts UTF-8 strings to UTF16-BE
3003
+ *
3004
+ * @param $str_input
3005
+ * @param bool $bol_set_byte_order_mark
3006
+ *
3007
+ * @return string
3008
+ */
3009
+ public function UTF8ToUTF16BE( $str_input, $bol_set_byte_order_mark = true ) {
3010
+ $str_output = "";
3011
+ if ( $bol_set_byte_order_mark ) {
3012
+ $str_output .= "\xFE\xFF";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3013
  }
3014
+ $str_output .= mb_convert_encoding( $str_input, 'UTF-16BE', 'UTF-8' );
3015
+
3016
+ return $str_output;
3017
  }
 
3018
 
3019
+ /**
3020
+ * Converts UTF-8 strings to codepoints array
3021
+ *
3022
+ * @param $str_input
3023
+ *
3024
+ * @return array
3025
+ */
3026
+ public function UTF8StringToArray( $str_input ) {
3027
+ $arr_output = array();
3028
+ $int_string_length = strlen( $str_input );
3029
+ for ( $i = 0; $i < $int_string_length; $i ++ ) {
3030
+ $uni = - 1;
3031
+ $int_char = ord( $str_input[ $i ] );
3032
+ if ( $int_char <= 0x7F ) {
3033
+ $uni = $int_char;
3034
+ } elseif ( $int_char >= 0xC2 ) {
3035
+ if ( ( $int_char <= 0xDF ) && ( $i < $int_string_length - 1 ) ) {
3036
+ $uni = ( $int_char & 0x1F ) << 6 | ( ord( $str_input[ ++ $i ] ) & 0x3F );
3037
+ } elseif ( ( $int_char <= 0xEF ) && ( $i < $int_string_length - 2 ) ) {
3038
+ $uni = ( $int_char & 0x0F ) << 12 | ( ord( $str_input[ ++ $i ] ) & 0x3F ) << 6 | ( ord( $str_input[ ++ $i ] ) & 0x3F );
3039
+ } elseif ( ( $int_char <= 0xF4 ) && ( $i < $int_string_length - 3 ) ) {
3040
+ $uni = ( $int_char & 0x0F ) << 18 | ( ord( $str_input[ ++ $i ] ) & 0x3F ) << 12 | ( ord( $str_input[ ++ $i ] ) & 0x3F ) << 6 | ( ord( $str_input[ ++ $i ] ) & 0x3F );
3041
+ }
3042
+ }
3043
+ if ( $uni >= 0 ) {
3044
+ $arr_output[] = $uni;
3045
+ }
3046
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3047
 
3048
+ return $arr_output;
 
 
 
 
 
 
3049
  }
 
3050
 
3051
+ /**
3052
+ * With this method you can set the cache path
3053
+ *
3054
+ * @param string $cachePath The cache folder
3055
+ *
3056
+ * @return string The newly set cache folder
3057
+ */
3058
+ public function setCachePath( $cachePath = null ) {
3059
+ if ( ! file_exists( $cachePath ) ) {
3060
+ @mkdir( $cachePath, 0775, true );
3061
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3062
 
3063
+ if ( ! file_exists( $cachePath ) || ! is_dir( $cachePath ) || ! is_writable( $cachePath ) ) {
3064
+ throw new WOE_FPDF_Exception( 'Could not write to cache folder: ' . $cachePath, WOE_FPDF_Exception::INVALID_CACHE_FOLDER );
3065
+ }
 
 
3066
 
3067
+ $this->cachePath = realpath( $cachePath ) . '/';
 
 
 
 
 
 
 
 
 
 
3068
 
3069
+ return $cachePath;
3070
+ }
 
 
 
 
 
 
 
 
 
3071
 
3072
+ /**
3073
+ * Get the currently set cache folder
3074
+ *
3075
+ * @return string The cache folder, may be null
3076
+ */
3077
+ public function getCachePath() {
3078
+ return $this->cachePath;
3079
+ }
3080
 
3081
+ /**
3082
+ * Clear all cached files in the cache folder
3083
+ *
3084
+ */
3085
+ public function clearCache() {
3086
+ $cachePath = $this->getCachePath();
3087
+ if ( $cachePath !== null ) {
3088
+ $cacheFiles = glob( $cachePath . '*.*' );
3089
+ foreach ( $cacheFiles as $cacheFile ) {
3090
+ @unlink( $cacheFile );
3091
+ }
3092
+ }
3093
+ }
 
 
 
 
 
 
 
3094
 
3095
+ /**
3096
+ * Calculates the expected line height for a multi cell,
3097
+ * useful if you want to know how much space a cell is going to use
3098
+ *
3099
+ * @param string $text The text to calculate the line height from
3100
+ * @param int $cellWidth The width of the multicell
3101
+ * @param int $lineHeight The line height of the multicell
3102
+ *
3103
+ * @return int The calculated line height
3104
+ */
3105
+ public function calculateHeight( $text, $cellWidth = 80, $lineHeight = 3 ) {
3106
+ $explode = explode( "\r", $text );
3107
+
3108
+ array_walk( $explode, 'trim' );
3109
+
3110
+ $lines = [];
3111
+ foreach ( $explode as $split ) {
3112
+ $sub = $split;
3113
+ $char = 1;
3114
+
3115
+ while ( $char <= strlen( $sub ) ) {
3116
+ $substr = substr( $sub, 0, $char );
3117
+
3118
+ if ( $this->getStringWidth( $substr ) >= $cellWidth - 1 ) {
3119
+ $pos = strrpos( $substr, " " );
3120
+
3121
+ $lines[] = substr( $sub, 0, ( $pos !== false ? $pos : $char ) ) . ( $pos === false ? '-' : '' );
3122
+
3123
+ if ( $pos !== false ) { //if $pos returns FALSE, substr has no whitespace, so split word on current position
3124
+ $char = $pos + 1;
3125
+ $len = $char;
3126
+ }
3127
+
3128
+ $sub = ltrim( substr( $sub, $char ) );
3129
+ $char = 0;
3130
+ }
3131
 
3132
+ $char ++;
3133
+ }
 
 
 
 
3134
 
3135
+ if ( ! empty( $sub ) ) {
3136
+ $lines[] = $sub;
3137
+ }
3138
+ }
3139
+
3140
+ return (int) count( $lines ) * $lineHeight;
3141
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3142
  }
 
classes/FPDF/class-woe-pdf-mc-table.php CHANGED
@@ -24,17 +24,17 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
24
  'style' => 'B',
25
  'size' => 5,
26
  'text_color' => array( 0, 0, 0 ),
27
- 'logo' => array(
28
- 'source' => '',
29
- 'width' => 0,
30
- 'height' => 0,
31
- 'align' => 'R',
32
  ),
33
  ),
34
  'table' => array(
35
  'stretch' => false,
36
  'column_width' => array(),
37
- 'solid_width' => array(),
38
  ),
39
  'table_header' => array(
40
  'style' => '',
@@ -124,11 +124,11 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
124
  $width = $this->validateWidth( $width );
125
 
126
  if ( $align == 'R' ) {
127
- $x = $this->GetPageWidth() - $this->rMargin - $width;
128
  } elseif ( $align == 'C' ) {
129
  $x = ( $this->GetPageWidth() - $width ) / 2;
130
  } else {
131
- $x = $this->lMargin;
132
  }
133
 
134
  $type = strtoupper( pathinfo( $source, PATHINFO_EXTENSION ) );
@@ -156,7 +156,11 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
156
 
157
  if ( ! empty( $this->footer_props['pagination'] ) ) {
158
  // Page number
159
- $align = in_array( $this->footer_props['pagination'], array( 'L', 'C', 'R', ) ) ? $this->footer_props['pagination'] : false;
 
 
 
 
160
  if ( $align ) {
161
  $this->Cell( 0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, $align );
162
  }
@@ -220,7 +224,7 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
220
  $count = count( $widths );
221
  if ( $this->table_props['stretch'] ) {
222
  $sum_width = 0;
223
- $page_width = $this->GetPageWidth() - $this->lMargin - $this->rMargin;
224
  $count = 0;
225
  foreach ( $widths as $width ) {
226
  if ( $sum_width + $width > $page_width ) {
@@ -245,14 +249,13 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
245
  if ( $this->table_props['stretch'] ) {
246
  $widths = array();
247
  for ( $i = 0; $i < count( $row ); $i ++ ) {
248
- $width = isset( $this->table_props['column_width'][ $i ] ) ? $this->table_props['column_width'][ $i ] :
249
- $this->table_props['column_width'][ $i % count( $this->table_props['column_width'] ) ];
250
 
251
  $widths[ $i ] = $this->validateWidth( $width );
252
  }
253
 
254
  } else {
255
- $widths = array_fill( 0, count( $row ), ( $this->GetPageWidth() - $this->lMargin - $this->rMargin ) / count( $row ) );
256
  }
257
 
258
  if ( $this->table_props['solid_width'] ) {
@@ -264,8 +267,24 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
264
  return $widths;
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  protected function validateWidth( $width, $min_width = 5 ) {
268
- $max_width = $this->GetPageWidth() - $this->lMargin - $this->rMargin - 50;
269
  if ( $width < $min_width ) {
270
  $width = $min_width;
271
  } elseif ( $width > $max_width ) {
@@ -276,7 +295,7 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
276
  }
277
 
278
  protected function validateHeight( $height, $min_height = 5 ) {
279
- $max_height = $this->GetPageHeight() - $this->tMargin - $this->bMargin - 50;
280
  if ( $height < $min_height ) {
281
  $height = $min_height;
282
  } elseif ( $height > $max_height ) {
@@ -299,7 +318,7 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
299
  for ( $i = 0; $i < count( $row ); $i ++ ) {
300
  // do not calculate height for non string values
301
  $value = is_string( $row[ $i ] ) ? $row[ $i ] : 0;
302
- $nb = max( $nb, $this->NbLines( $widths[ $i ], $value ) );
303
  }
304
 
305
  return 5 * $nb;
@@ -307,10 +326,10 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
307
 
308
  public function CheckPageBreak( $h ) {
309
  //If the height h would cause an overflow, add a new page immediately
310
- if ( $this->GetY() + $h > $this->PageBreakTrigger ) {
311
  $this->flush_buffer();
312
 
313
- $this->AddPage( $this->CurOrientation );
314
  if ( $this->table_header_props['repeat'] && $this->table_header ) {
315
  $this->changeBrushToDraw( 'table_header' );
316
  $this->Row( $this->table_header );
@@ -319,14 +338,89 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
319
  }
320
  }
321
 
322
- public function Output( $dest = '', $name = '', $isUTF8 = false ) {
323
  $this->flush_buffer();
324
- parent::Output( $dest, $name, $isUTF8 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  }
326
 
327
  protected function flush_buffer() {
328
  while ( $this->stretch_buffer ) {
329
- $this->AddPage( $this->CurOrientation );
330
 
331
  $buffer = $this->stretch_buffer;
332
  $stretch_buffer_params = $this->stretch_buffer_params;
@@ -349,53 +443,54 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
349
 
350
  public function NbLines( $w, $txt ) {
351
  //Computes the number of lines a MultiCell of width w will take
352
- $cw =& $this->CurrentFont['cw'];
353
  if ( $w == 0 ) {
354
- $w = $this->w - $this->rMargin - $this->x;
355
- }
356
- $wmax = ( $w - 2 * $this->cMargin ) * 1000 / $this->FontSize;
357
- $s = str_replace( "\r", '', $txt );
358
- $nb = strlen( $s );
359
- if ( $nb > 0 and $s[ $nb - 1 ] == "\n" ) {
360
- $nb --;
361
- }
362
- $sep = - 1;
363
- $i = 0;
364
- $j = 0;
365
- $l = 0;
366
- $nl = 1;
367
- while ( $i < $nb ) {
368
- $c = $s[ $i ];
369
- if ( $c == "\n" ) {
370
- $i ++;
371
  $sep = - 1;
372
- $j = $i;
373
  $l = 0;
374
- $nl ++;
375
  continue;
376
  }
377
- if ( $c == ' ' ) {
378
- $sep = $i;
379
  }
380
- $l += $cw[ $c ];
 
 
381
  if ( $l > $wmax ) {
382
  if ( $sep == - 1 ) {
383
- if ( $i == $j ) {
384
- $i ++;
385
  }
386
  } else {
387
- $i = $sep + 1;
388
  }
389
  $sep = - 1;
390
- $j = $i;
391
  $l = 0;
392
- $nl ++;
393
  } else {
394
- $i ++;
395
  }
396
  }
397
 
398
- return $nl;
399
  }
400
 
401
  public function SetAligns( $a ) {
@@ -414,13 +509,51 @@ class WOE_PDF_MC_Table extends WOE_FPDF {
414
  }
415
  $props = $this->$name;
416
 
417
- $this->SetFont( $this->FontFamily, $props['style'], $props['size'] );
418
- $this->loadTextColor( $props );
419
- $this->loadFillColor( $props );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
 
421
  return true;
422
  }
423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  private function loadTextColor( $props ) {
425
  $color = ! empty( $props['text_color'] ) ? $props['text_color'] : array();
426
 
24
  'style' => 'B',
25
  'size' => 5,
26
  'text_color' => array( 0, 0, 0 ),
27
+ 'logo' => array(
28
+ 'source' => '',
29
+ 'width' => 0,
30
+ 'height' => 0,
31
+ 'align' => 'R',
32
  ),
33
  ),
34
  'table' => array(
35
  'stretch' => false,
36
  'column_width' => array(),
37
+ 'solid_width' => array(),
38
  ),
39
  'table_header' => array(
40
  'style' => '',
124
  $width = $this->validateWidth( $width );
125
 
126
  if ( $align == 'R' ) {
127
+ $x = $this->GetPageWidth() - $this->getRightMargin() - $width;
128
  } elseif ( $align == 'C' ) {
129
  $x = ( $this->GetPageWidth() - $width ) / 2;
130
  } else {
131
+ $x = $this->getLeftMargin();
132
  }
133
 
134
  $type = strtoupper( pathinfo( $source, PATHINFO_EXTENSION ) );
156
 
157
  if ( ! empty( $this->footer_props['pagination'] ) ) {
158
  // Page number
159
+ $align = in_array( $this->footer_props['pagination'], array(
160
+ 'L',
161
+ 'C',
162
+ 'R',
163
+ ) ) ? $this->footer_props['pagination'] : false;
164
  if ( $align ) {
165
  $this->Cell( 0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, $align );
166
  }
224
  $count = count( $widths );
225
  if ( $this->table_props['stretch'] ) {
226
  $sum_width = 0;
227
+ $page_width = $this->GetPageWidth() - $this->getLeftMargin() - $this->getRightMargin();
228
  $count = 0;
229
  foreach ( $widths as $width ) {
230
  if ( $sum_width + $width > $page_width ) {
249
  if ( $this->table_props['stretch'] ) {
250
  $widths = array();
251
  for ( $i = 0; $i < count( $row ); $i ++ ) {
252
+ $width = isset( $this->table_props['column_width'][ $i ] ) ? $this->table_props['column_width'][ $i ] : $this->table_props['column_width'][ $i % count( $this->table_props['column_width'] ) ];
 
253
 
254
  $widths[ $i ] = $this->validateWidth( $width );
255
  }
256
 
257
  } else {
258
+ $widths = array_fill( 0, count( $row ), ( $this->GetPageWidth() - $this->getLeftMargin() - $this->getRightMargin() ) / count( $row ) );
259
  }
260
 
261
  if ( $this->table_props['solid_width'] ) {
267
  return $widths;
268
  }
269
 
270
+ public function GetPageWidth() {
271
+ return $this->flt_current_width;
272
+ }
273
+
274
+ public function GetPageHeight() {
275
+ return $this->flt_current_height;
276
+ }
277
+
278
+ public function getLeftMargin() {
279
+ return $this->int_left_margin;
280
+ }
281
+
282
+ public function getRightMargin() {
283
+ return $this->int_right_margin;
284
+ }
285
+
286
  protected function validateWidth( $width, $min_width = 5 ) {
287
+ $max_width = $this->GetPageWidth() - $this->getLeftMargin() - $this->getRightMargin() - 50;
288
  if ( $width < $min_width ) {
289
  $width = $min_width;
290
  } elseif ( $width > $max_width ) {
295
  }
296
 
297
  protected function validateHeight( $height, $min_height = 5 ) {
298
+ $max_height = $this->GetPageHeight() - $this->int_top_margin - $this->int_break_margin - 50;
299
  if ( $height < $min_height ) {
300
  $height = $min_height;
301
  } elseif ( $height > $max_height ) {
318
  for ( $i = 0; $i < count( $row ); $i ++ ) {
319
  // do not calculate height for non string values
320
  $value = is_string( $row[ $i ] ) ? $row[ $i ] : 0;
321
+ $nb = max( $nb, $this->NbLines( $widths[ $i ], $value ) );
322
  }
323
 
324
  return 5 * $nb;
326
 
327
  public function CheckPageBreak( $h ) {
328
  //If the height h would cause an overflow, add a new page immediately
329
+ if ( $this->GetY() + $h > $this->flt_page_break_trigger ) {
330
  $this->flush_buffer();
331
 
332
+ $this->AddPage( $this->str_current_orientation );
333
  if ( $this->table_header_props['repeat'] && $this->table_header ) {
334
  $this->changeBrushToDraw( 'table_header' );
335
  $this->Row( $this->table_header );
338
  }
339
  }
340
 
341
+ public function output_to_destination( $dest = '', $name = '', $isUTF8 = false ) {
342
  $this->flush_buffer();
343
+ // Output PDF to some destination
344
+ $this->Close();
345
+ $output = parent::output();
346
+ if ( strlen( $name ) == 1 && strlen( $dest ) != 1 ) {
347
+ // Fix parameter order
348
+ $tmp = $dest;
349
+ $dest = $name;
350
+ $name = $tmp;
351
+ }
352
+ if ( $dest == '' ) {
353
+ $dest = 'I';
354
+ }
355
+ if ( $name == '' ) {
356
+ $name = 'doc.pdf';
357
+ }
358
+ switch ( strtoupper( $dest ) ) {
359
+ case 'I':
360
+ // Send to standard output
361
+ if ( PHP_SAPI != 'cli' ) {
362
+ // We send to a browser
363
+ header( 'Content-Type: application/pdf' );
364
+ header( 'Content-Disposition: inline; ' . $this->_httpencode( 'filename', $name, $isUTF8 ) );
365
+ header( 'Cache-Control: private, max-age=0, must-revalidate' );
366
+ header( 'Pragma: public' );
367
+ }
368
+ echo $output;
369
+ break;
370
+ case 'D':
371
+ // Download file
372
+ header( 'Content-Type: application/x-download' );
373
+ header( 'Content-Disposition: attachment; ' . $this->_httpencode( 'filename', $name, $isUTF8 ) );
374
+ header( 'Cache-Control: private, max-age=0, must-revalidate' );
375
+ header( 'Pragma: public' );
376
+ echo $output;
377
+ break;
378
+ case 'F':
379
+ // Save to local file
380
+ if ( ! file_put_contents( $name, $output ) ) {
381
+ throw new WOE_FPDF_Exception( 'Unable to create output file: ' . $name );
382
+ }
383
+ break;
384
+ case 'S':
385
+ // Return as a string
386
+ return $output;
387
+ default:
388
+ throw new WOE_FPDF_Exception( 'Incorrect output destination: ' . $dest );
389
+ }
390
+
391
+ return '';
392
+ }
393
+
394
+ protected function _httpencode( $param, $value, $isUTF8 ) {
395
+ // Encode HTTP header field parameter
396
+ if ( $this->_isascii( $value ) ) {
397
+ return $param . '="' . $value . '"';
398
+ }
399
+ if ( ! $isUTF8 ) {
400
+ $value = utf8_encode( $value );
401
+ }
402
+ if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) {
403
+ return $param . '="' . rawurlencode( $value ) . '"';
404
+ } else {
405
+ return $param . "*=UTF-8''" . rawurlencode( $value );
406
+ }
407
+ }
408
+
409
+ protected function _isascii( $s ) {
410
+ // Test if string is ASCII
411
+ $nb = strlen( $s );
412
+ for ( $i = 0; $i < $nb; $i ++ ) {
413
+ if ( ord( $s[ $i ] ) > 127 ) {
414
+ return false;
415
+ }
416
+ }
417
+
418
+ return true;
419
  }
420
 
421
  protected function flush_buffer() {
422
  while ( $this->stretch_buffer ) {
423
+ $this->AddPage( $this->str_current_orientation );
424
 
425
  $buffer = $this->stretch_buffer;
426
  $stretch_buffer_params = $this->stretch_buffer_params;
443
 
444
  public function NbLines( $w, $txt ) {
445
  //Computes the number of lines a MultiCell of width w will take
 
446
  if ( $w == 0 ) {
447
+ $w = $this->GetPageWidth() - $this->getRightMargin() - $this->flt_position_x;
448
+ }
449
+ $wmax = ( $w - 2 * $this->int_cell_margin ) * 1000 / $this->int_font_size_user;
450
+ $s = str_replace( "\r", '', $txt );
451
+ $text_len = strlen( $s );
452
+ if ( $text_len > 0 and $s[ $text_len - 1 ] == "\n" ) {
453
+ $text_len --;
454
+ }
455
+ $sep = - 1;
456
+ $ch_index = 0;
457
+ $j = 0;
458
+ $l = 0;
459
+ $line_counter = 1;
460
+ while ( $ch_index < $text_len ) {
461
+ $char = $s[ $ch_index ];
462
+ if ( $char == "\n" ) {
463
+ $ch_index ++;
464
  $sep = - 1;
465
+ $j = $ch_index;
466
  $l = 0;
467
+ $line_counter ++;
468
  continue;
469
  }
470
+ if ( $char == ' ' ) {
471
+ $sep = $ch_index;
472
  }
473
+ // $l += $arr_character_width[ $char ];
474
+ $l += $this->GetStringWidth( $char ) * 1000;
475
+
476
  if ( $l > $wmax ) {
477
  if ( $sep == - 1 ) {
478
+ if ( $ch_index == $j ) {
479
+ $ch_index ++;
480
  }
481
  } else {
482
+ $ch_index = $sep + 1;
483
  }
484
  $sep = - 1;
485
+ $j = $ch_index;
486
  $l = 0;
487
+ $line_counter ++;
488
  } else {
489
+ $ch_index ++;
490
  }
491
  }
492
 
493
+ return $line_counter;
494
  }
495
 
496
  public function SetAligns( $a ) {
509
  }
510
  $props = $this->$name;
511
 
512
+ $defaults = array(
513
+ 'font_family' => $this->str_current_font_family,
514
+ 'font_style' => $props['style'],
515
+ 'font_size' => $props['size'],
516
+ 'font_color' => $this->getTextColor( $props ),
517
+ 'background_color' => $this->getFillColor( $props ),
518
+ );
519
+ $args = apply_filters( 'woe_formatter_pdf_change_brush_to_draw_arguments', $defaults, $what );
520
+ $args = array_merge($defaults, $args);
521
+
522
+
523
+
524
+ $this->SetFont( $args['font_family'], $args['font_style'], $args['font_size'] );
525
+ if ( ! empty( $args['font_color'] ) ) {
526
+ $color = $args['font_color'];
527
+ $this->SetTextColor( $color[0], $color[1], $color[2] );
528
+ }
529
+ if ( ! empty( $args['background_color'] ) ) {
530
+ $color = $args['background_color'];
531
+ $this->SetFillColor( $color[0], $color[1], $color[2] );
532
+ }
533
 
534
  return true;
535
  }
536
 
537
+ private function getTextColor($props) {
538
+ $color = ! empty( $props['text_color'] ) ? $props['text_color'] : null;
539
+
540
+ if ( $color ) {
541
+ $color = $this->convert_color( $color );
542
+ }
543
+
544
+ return $color;
545
+ }
546
+
547
+ private function getFillColor($props) {
548
+ $color = ! empty( $props['background_color'] ) ? $props['background_color'] : null;
549
+
550
+ if ( $color ) {
551
+ $color = $this->convert_color( $color );
552
+ }
553
+
554
+ return $color;
555
+ }
556
+
557
  private function loadTextColor( $props ) {
558
  $color = ! empty( $props['text_color'] ) ? $props['text_color'] : array();
559
 
classes/FPDF/exception/class-woe-fpdf-exception.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WOE_FPDF_Exception extends Exception {
4
+
5
+ // Invalid unit specified
6
+ const INVALID_UNIT = -1;
7
+
8
+ // Invalid orientiation specified (must be portrait or landscape)
9
+ const INVALID_ORIENTATION = -2;
10
+
11
+ // Invalid zoom mode specified
12
+ const INVALID_ZOOM_MODE = -3;
13
+
14
+ // Invalid layout mode specified
15
+ const INVALID_LAYOUT_MODE = -4;
16
+
17
+ // Invalid page size is specified
18
+ const INVALID_PAGE_SIZE = -5;
19
+
20
+ // Invalid font specified
21
+ const UNDEFINED_FONT = -6;
22
+
23
+ // Unsupported font specified, the font you are trying to use is not loaded
24
+ const UNSUPPORTED_FONT = -7;
25
+
26
+ // Invalid font file
27
+ const INVALID_FONT_FILE = -8;
28
+
29
+ // Invalid font specified
30
+ const INVALID_FONT_PATH = -9;
31
+
32
+ // Invalid image was specified, not existing or not readable
33
+ const INVALID_IMAGE = -10;
34
+
35
+ // Unsupported image was specified
36
+ const UNSUPPORTED_IMAGE = -11;
37
+
38
+ // Image not writable, probally temp directory not writable
39
+ const IMAGE_NOT_WRITABLE = -12;
40
+
41
+ // Headers have already been send
42
+ const HEADER_ALREADY_SENT = -13;
43
+
44
+ // Cache folder is invalid or not writable
45
+ const INVALID_CACHE_FOLDER = -14;
46
+
47
+ // A required PHP extension is not available
48
+ const EXTENSION_NOT_AVAILABLE = -15;
49
+
50
+ // Stream could not be readed (completely)
51
+ const INVALID_STREAM = -16;
52
+
53
+ }
classes/FPDF/font/OpenSans-Bold.ttf ADDED
Binary file
classes/FPDF/font/OpenSans-Regular.ttf ADDED
Binary file
classes/FPDF/font/courier.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Courier';
4
- $up = -100;
5
- $ut = 50;
6
- for($i=0;$i<=255;$i++)
7
- $cw[chr($i)] = 600;
8
- $enc = 'cp1252';
9
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10
- ?>
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/courierb.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Courier-Bold';
4
- $up = -100;
5
- $ut = 50;
6
- for($i=0;$i<=255;$i++)
7
- $cw[chr($i)] = 600;
8
- $enc = 'cp1252';
9
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10
- ?>
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/courierbi.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Courier-BoldOblique';
4
- $up = -100;
5
- $ut = 50;
6
- for($i=0;$i<=255;$i++)
7
- $cw[chr($i)] = 600;
8
- $enc = 'cp1252';
9
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10
- ?>
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/courieri.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Courier-Oblique';
4
- $up = -100;
5
- $ut = 50;
6
- for($i=0;$i<=255;$i++)
7
- $cw[chr($i)] = 600;
8
- $enc = 'cp1252';
9
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10
- ?>
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/helvetica.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Helvetica';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
8
- chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
9
- ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
10
- 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
11
- 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
12
- 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
13
- chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
14
- chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
16
- chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
18
- chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/helveticab.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Helvetica-Bold';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
8
- chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
9
- ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
10
- 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
11
- 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
12
- 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
13
- chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
14
- chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
16
- chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
18
- chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/helveticabi.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Helvetica-BoldOblique';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
8
- chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
9
- ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
10
- 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
11
- 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
12
- 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
13
- chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
14
- chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
16
- chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
18
- chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/helveticai.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Helvetica-Oblique';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
8
- chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
9
- ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
10
- 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
11
- 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
12
- 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
13
- chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
14
- chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
16
- chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
18
- chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/symbol.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Symbol';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
8
- chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549,
9
- ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722,
10
- 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768,
11
- 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576,
12
- 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,
13
- chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
14
- chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603,
15
- chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768,
16
- chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
17
- chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
18
- chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
19
- $uv = array(32=>160,33=>33,34=>8704,35=>35,36=>8707,37=>array(37,2),39=>8715,40=>array(40,2),42=>8727,43=>array(43,2),45=>8722,46=>array(46,18),64=>8773,65=>array(913,2),67=>935,68=>array(916,2),70=>934,71=>915,72=>919,73=>921,74=>977,75=>array(922,4),79=>array(927,2),81=>920,82=>929,83=>array(931,3),86=>962,87=>937,88=>926,89=>936,90=>918,91=>91,92=>8756,93=>93,94=>8869,95=>95,96=>63717,97=>array(945,2),99=>967,100=>array(948,2),102=>966,103=>947,104=>951,105=>953,106=>981,107=>array(954,4),111=>array(959,2),113=>952,114=>961,115=>array(963,3),118=>982,119=>969,120=>958,121=>968,122=>950,123=>array(123,3),126=>8764,160=>8364,161=>978,162=>8242,163=>8804,164=>8725,165=>8734,166=>402,167=>9827,168=>9830,169=>9829,170=>9824,171=>8596,172=>array(8592,4),176=>array(176,2),178=>8243,179=>8805,180=>215,181=>8733,182=>8706,183=>8226,184=>247,185=>array(8800,2),187=>8776,188=>8230,189=>array(63718,2),191=>8629,192=>8501,193=>8465,194=>8476,195=>8472,196=>8855,197=>8853,198=>8709,199=>array(8745,2),201=>8835,202=>8839,203=>8836,204=>8834,205=>8838,206=>array(8712,2),208=>8736,209=>8711,210=>63194,211=>63193,212=>63195,213=>8719,214=>8730,215=>8901,216=>172,217=>array(8743,2),219=>8660,220=>array(8656,4),224=>9674,225=>9001,226=>array(63720,3),229=>8721,230=>array(63723,10),241=>9002,242=>8747,243=>8992,244=>63733,245=>8993,246=>array(63734,9));
20
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/times.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Times-Roman';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
8
- chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
9
- ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722,
10
- 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944,
11
- 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
12
- 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
13
- chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980,
14
- chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
16
- chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
18
- chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/timesb.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Times-Bold';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
8
- chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
9
- ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722,
10
- 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000,
11
- 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833,
12
- 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
13
- chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
14
- chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
16
- chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
18
- chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/timesbi.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Times-BoldItalic';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
8
- chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
9
- ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667,
10
- 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889,
11
- 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
12
- 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
13
- chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
14
- chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
16
- chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
18
- chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/timesi.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'Times-Italic';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
8
- chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
9
- ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611,
10
- 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833,
11
- 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722,
12
- 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
13
- chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980,
14
- chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333,
15
- chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611,
16
- chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
17
- chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
18
- chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
19
- $enc = 'cp1252';
20
- $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/FPDF/font/zapfdingbats.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- $type = 'Core';
3
- $name = 'ZapfDingbats';
4
- $up = -100;
5
- $ut = 50;
6
- $cw = array(
7
- chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
8
- chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
9
- ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,
10
- 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,
11
- 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,
12
- 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
13
- chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
14
- chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,
15
- chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,
16
- chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
17
- chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
18
- chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
19
- $uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14));
20
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/PHPExcel/Shared/PCLZip/pclzip.lib.php CHANGED
@@ -1729,14 +1729,14 @@ class PclZip
1729
 
1730
  if ($last == 'g') {
1731
  //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1732
- $v_memory_limit = $v_memory_limit*1073741824;
1733
  }
1734
  if ($last == 'm') {
1735
  //$v_memory_limit = $v_memory_limit*1024*1024;
1736
- $v_memory_limit = $v_memory_limit*1048576;
1737
  }
1738
  if ($last == 'k') {
1739
- $v_memory_limit = $v_memory_limit*1024;
1740
  }
1741
 
1742
  $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
1729
 
1730
  if ($last == 'g') {
1731
  //$v_memory_limit = $v_memory_limit*1024*1024*1024;
1732
+ $v_memory_limit = (int)$v_memory_limit*1073741824;
1733
  }
1734
  if ($last == 'm') {
1735
  //$v_memory_limit = $v_memory_limit*1024*1024;
1736
+ $v_memory_limit = (int)$v_memory_limit*1048576;
1737
  }
1738
  if ($last == 'k') {
1739
+ $v_memory_limit = (int)$v_memory_limit*1024;
1740
  }
1741
 
1742
  $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
classes/admin/class-wc-order-export-labels.php CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
6
 
7
  class WC_Order_Export_Labels {
8
 
9
- private $labels;
10
 
11
  public function __get( $key ) {
12
  if ( ! $key || empty( $this->labels ) ) {
@@ -159,7 +159,6 @@ class WC_Order_Export_Labels {
159
  $unique_keys[ $label_data["key"] ] = $label_data["label"];
160
  }
161
  }
162
-
163
  return $unique_keys;
164
  }
165
  }
6
 
7
  class WC_Order_Export_Labels {
8
 
9
+ private $labels = array();
10
 
11
  public function __get( $key ) {
12
  if ( ! $key || empty( $this->labels ) ) {
159
  $unique_keys[ $label_data["key"] ] = $label_data["label"];
160
  }
161
  }
 
162
  return $unique_keys;
163
  }
164
  }
classes/admin/class-wc-order-export-manage.php CHANGED
@@ -80,6 +80,7 @@ class WC_Order_Export_Manage {
80
  'product_categories',
81
  'product_vendors',
82
  'products',
 
83
  'shipping_locations',
84
  'shipping_methods',
85
  'user_roles',
@@ -190,6 +191,7 @@ class WC_Order_Export_Manage {
190
  'product_categories' => array(),
191
  'product_vendors' => array(),
192
  'products' => array(),
 
193
  'product_taxonomies' => array(),
194
  'product_custom_fields' => array(),
195
  'product_attributes' => array(),
@@ -226,6 +228,7 @@ class WC_Order_Export_Manage {
226
  'product_categories' => array(),
227
  'product_vendors' => array(),
228
  'products' => array(),
 
229
  'product_taxonomies' => array(),
230
  'product_custom_fields' => array(),
231
  'product_attributes' => array(),
@@ -337,6 +340,7 @@ class WC_Order_Export_Manage {
337
  'group_by' => 'product',
338
  ),
339
  ),
 
340
  );
341
  }
342
 
@@ -461,24 +465,29 @@ class WC_Order_Export_Manage {
461
  $filter = "woe_get_order_fields_" . $segment;
462
  }
463
 
 
 
 
 
464
  if ( method_exists( 'WC_Order_Export_Data_Extractor_UI', $method ) ) {
465
- // woe_get_order_fields_common filter
466
- $segment_fields = array();
467
- $default_segment_fields = array_merge(
468
- WC_Order_Export_Data_Extractor_UI::$method( $format ),
469
- apply_filters( $filter, array(), $format )
470
- );
471
- foreach ( $default_segment_fields as $key => $value ) {
472
- $order_field = $value;
473
- $order_field['colname'] = $value['label'];
474
- $order_field['key'] = $key;
475
- $order_field['default'] = 1;
476
- unset( $order_field['checked'] );
477
- $segment_fields[] = $order_field;
478
- }
479
 
480
- $order_fields[ $segment ] = $segment_fields;
 
 
 
 
 
 
 
 
 
 
 
481
  }
 
 
482
  }
483
 
484
  return $order_fields;
80
  'product_categories',
81
  'product_vendors',
82
  'products',
83
+ 'exclude_products',
84
  'shipping_locations',
85
  'shipping_methods',
86
  'user_roles',
191
  'product_categories' => array(),
192
  'product_vendors' => array(),
193
  'products' => array(),
194
+ 'exclude_products' => array(),
195
  'product_taxonomies' => array(),
196
  'product_custom_fields' => array(),
197
  'product_attributes' => array(),
228
  'product_categories' => array(),
229
  'product_vendors' => array(),
230
  'products' => array(),
231
+ 'exclude_products' => array(),
232
  'product_taxonomies' => array(),
233
  'product_custom_fields' => array(),
234
  'product_attributes' => array(),
340
  'group_by' => 'product',
341
  ),
342
  ),
343
+ 'summary_report_by_customers' => 0,
344
  );
345
  }
346
 
465
  $filter = "woe_get_order_fields_" . $segment;
466
  }
467
 
468
+ // woe_get_order_fields_common filter
469
+ $segment_fields = array();
470
+ $default_segment_fields = array();
471
+
472
  if ( method_exists( 'WC_Order_Export_Data_Extractor_UI', $method ) ) {
473
+ $default_segment_fields = WC_Order_Export_Data_Extractor_UI::$method( $format );
474
+ }
 
 
 
 
 
 
 
 
 
 
 
 
475
 
476
+ $default_segment_fields = array_merge(
477
+ $default_segment_fields,
478
+ apply_filters( $filter, array(), $format )
479
+ );
480
+
481
+ foreach ( $default_segment_fields as $key => $value ) {
482
+ $order_field = $value;
483
+ $order_field['colname'] = $value['label'];
484
+ $order_field['key'] = $key;
485
+ $order_field['default'] = 1;
486
+ unset( $order_field['checked'] );
487
+ $segment_fields[] = $order_field;
488
  }
489
+
490
+ $order_fields[ $segment ] = $segment_fields;
491
  }
492
 
493
  return $order_fields;
classes/admin/class-wc-order-export-settings.php CHANGED
@@ -18,10 +18,16 @@ class WC_Order_Export_Main_Settings {
18
  'limit_button_test' => '1',
19
  'cron_key' => null,
20
  'ipn_url' => '',
 
 
 
 
 
21
  'zapier_api_key' => '12345678',
22
  'zapier_file_timeout' => 60,
23
  'show_date_time_picker_for_date_range' => false,
24
  'display_html_report_in_browser' => false,
 
25
  'default_html_css' => '',
26
  );
27
 
18
  'limit_button_test' => '1',
19
  'cron_key' => null,
20
  'ipn_url' => '',
21
+
22
+ 'notify_failed_jobs' => 0,
23
+ 'notify_failed_jobs_email_subject' => '',
24
+ 'notify_failed_jobs_email_recipients' => '',
25
+
26
  'zapier_api_key' => '12345678',
27
  'zapier_file_timeout' => 60,
28
  'show_date_time_picker_for_date_range' => false,
29
  'display_html_report_in_browser' => false,
30
+ 'default_date_range_for_export_now' => '',
31
  'default_html_css' => '',
32
  );
33
 
classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-filters.php CHANGED
@@ -113,4 +113,31 @@ trait WC_Order_Export_Admin_Tab_Abstract_Ajax_Filters {
113
  echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_item_meta_key_values( $_POST['meta_key'] ) );
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
113
  echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_item_meta_key_values( $_POST['meta_key'] ) );
114
  }
115
 
116
+ public function ajax_get_used_order_fee_items() {
117
+
118
+ $ret = WC_Order_Export_Data_Extractor::get_order_fee_items();
119
+
120
+ $ret = array_map(function ($v) { return 'FEE_' . $v; }, $ret);
121
+
122
+ echo json_encode( $ret );
123
+ }
124
+
125
+ public function ajax_get_used_order_shipping_items() {
126
+
127
+ $ret = WC_Order_Export_Data_Extractor::get_order_shipping_items();
128
+
129
+ $ret = array_map(function ($v) { return 'SHIPPING_' . $v; }, $ret);
130
+
131
+ echo json_encode( $ret );
132
+ }
133
+
134
+ public function ajax_get_used_order_tax_items() {
135
+
136
+ $ret = WC_Order_Export_Data_Extractor::get_order_tax_items();
137
+
138
+ $ret = array_map(function ($v) { return 'TAX_' . $v; }, $ret);
139
+
140
+ echo json_encode( $ret );
141
+ }
142
+
143
  }
classes/class-wc-order-export-admin.php CHANGED
@@ -62,9 +62,10 @@ class WC_Order_Export_Admin {
62
  }
63
  }
64
 
 
 
65
  $this->settings = WC_Order_Export_Main_Settings::get_settings();
66
 
67
- do_action( 'woe_order_export_admin_init', $this );
68
  }
69
 
70
  public function get_tabs() {
@@ -82,7 +83,6 @@ class WC_Order_Export_Admin {
82
  }
83
 
84
  public function add_order_status_column_header( $columns ) {
85
-
86
  if ( ! $this->settings['show_export_status_column'] ) {
87
  return $columns;
88
  }
@@ -195,8 +195,13 @@ class WC_Order_Export_Admin {
195
 
196
  $this->enqueue_select2_scripts( $active_tab );
197
 
198
- wp_enqueue_script( 'serializejson', $this->url_plugin . 'assets/js/jquery.serializejson.js', array( 'jquery' ),
199
- WOE_VERSION );
 
 
 
 
 
200
 
201
  wp_enqueue_style( 'export', $this->url_plugin . 'assets/css/export.css', array(), WOE_VERSION );
202
 
@@ -397,6 +402,8 @@ class WC_Order_Export_Admin {
397
  $method = 'ajax_' . $_REQUEST['method'];
398
  $tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : false;
399
 
 
 
400
  if ( ! isset( $this->tabs[ $tab ] ) ) {
401
  $ajax_handler = apply_filters( 'woe_global_ajax_handler', new WC_Order_Export_Ajax() );
402
  if ( ! method_exists( $ajax_handler, $method ) ) {
62
  }
63
  }
64
 
65
+ do_action( 'woe_order_export_admin_init', $this );
66
+
67
  $this->settings = WC_Order_Export_Main_Settings::get_settings();
68
 
 
69
  }
70
 
71
  public function get_tabs() {
83
  }
84
 
85
  public function add_order_status_column_header( $columns ) {
 
86
  if ( ! $this->settings['show_export_status_column'] ) {
87
  return $columns;
88
  }
195
 
196
  $this->enqueue_select2_scripts( $active_tab );
197
 
198
+ wp_enqueue_script( 'serializejson', $this->url_plugin . 'assets/js/jquery.serializejson.js', array( 'jquery' ), WOE_VERSION );
199
+
200
+ // kill learn-press
201
+ // prevent to rewrite $.fn.serializeJSON
202
+ add_action( 'learn-press/admin/after-enqueue-scripts', function () {
203
+ wp_scripts()->dequeue( array('learn-press-utils', 'lp-admin-learnpress', 'lp-admin') );
204
+ },PHP_INT_MAX );
205
 
206
  wp_enqueue_style( 'export', $this->url_plugin . 'assets/css/export.css', array(), WOE_VERSION );
207
 
402
  $method = 'ajax_' . $_REQUEST['method'];
403
  $tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : false;
404
 
405
+ do_action( 'woe_order_export_admin_ajax_gate_before');
406
+
407
  if ( ! isset( $this->tabs[ $tab ] ) ) {
408
  $ajax_handler = apply_filters( 'woe_global_ajax_handler', new WC_Order_Export_Ajax() );
409
  if ( ! method_exists( $ajax_handler, $method ) ) {
classes/core/class-wc-order-export-data-extractor-ui.php CHANGED
@@ -82,12 +82,12 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
82
  (SELECT DISTINCT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'line_item' AND order_id IN ($sql_order_ids))";
83
 
84
  $product_ids = $wpdb->get_col( "SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_type IN ('product','product_variation') AND ID IN ($sql_products) ORDER BY ID DESC LIMIT 1000" );
85
-
86
  $wp_fields = array();
87
  if($product_ids ) {
88
  $product_ids = join(",", $product_ids);
89
  $wp_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE post_id IN ($product_ids) ORDER BY meta_key" );
90
- }
91
 
92
  return apply_filters( 'get_product_custom_meta_fields_for_orders', $wp_fields );
93
  }
@@ -296,7 +296,7 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
296
  global $wpdb;
297
 
298
  $names = $wpdb->get_results( "SELECT distinct order_item_type,meta_key FROM {$wpdb->prefix}woocommerce_order_items AS items
299
- INNER JOIN (SELECT ID AS order_id FROM {$wpdb->prefix}posts WHERE post_type='shop_order' ORDER BY ID DESC LIMIT 1000) AS orders ON orders.order_id = items.order_id
300
  JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta ON meta.order_item_id = items.order_item_id
301
  ORDER BY order_item_type,meta_key" );
302
 
@@ -316,7 +316,7 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
316
  //we skip serialized and long values!
317
  $values = $wpdb->get_col( $wpdb->prepare( "SELECT distinct meta_value FROM {$wpdb->prefix}woocommerce_order_items AS items
318
  JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta ON meta.order_item_id = items.order_item_id
319
- WHERE items.order_item_type = %s AND meta.meta_key=%s
320
  AND meta_value NOT LIKE 'a:%' AND LENGTH(meta_value)<20
321
  ORDER BY meta_value", $type, $key ) );
322
 
@@ -552,7 +552,7 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
552
  'format' => 'money',
553
  ),
554
  'summary_report_total_refund_count' => array(
555
- 'label' => __( 'Summary Report Total Refund Count', 'woo-order-export-lite' ),
556
  'checked' => 0,
557
  'format' => 'number',
558
  ),
@@ -620,23 +620,12 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
620
 
621
  public static function get_order_fields( $format, $segments = array() ) {
622
  if ( ! $segments ) {
623
- $segments = array(
624
- 'common',
625
- 'user',
626
- 'billing',
627
- 'shipping',
628
- 'products',
629
- 'coupons',
630
- 'cart',
631
- 'ship_calc',
632
- 'totals',
633
- 'misc',
634
- );
635
  }
636
  $map = array();
637
  foreach ( $segments as $segment ) {
638
  $method = "get_order_fields_" . $segment;
639
- $map_segment = self::$method();
640
 
641
  foreach ( $map_segment as $key => $value ) {
642
  $map_segment[ $key ]['segment'] = $segment;
@@ -773,6 +762,31 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
773
  'checked' => 0,
774
  'format' => 'date',
775
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
776
  );
777
  }
778
 
@@ -1125,6 +1139,10 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
1125
  );
1126
  }
1127
 
 
 
 
 
1128
  public static function get_order_fields_misc() {
1129
  return array(
1130
  'total_weight_items' => array(
@@ -1163,18 +1181,19 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
1163
  }
1164
 
1165
  public static function get_order_segments() {
1166
- return array(
1167
- 'common' => __( 'Common', 'woo-order-export-lite' ),
1168
- 'user' => __( 'User', 'woo-order-export-lite' ),
1169
- 'billing' => __( 'Billing Address', 'woo-order-export-lite' ),
1170
- 'shipping' => __( 'Shipping Address', 'woo-order-export-lite' ),
1171
- 'products' => __( 'Products', 'woo-order-export-lite' ),
1172
- 'coupons' => __( 'Coupons', 'woo-order-export-lite' ),
1173
- 'cart' => __( 'Cart', 'woo-order-export-lite' ),
1174
- 'ship_calc' => __( 'Shipping', 'woo-order-export-lite' ),
1175
- 'totals' => __( 'Totals', 'woo-order-export-lite' ),
1176
- 'misc' => __( 'Others', 'woo-order-export-lite' ),
1177
- );
 
1178
  }
1179
 
1180
  public static function get_format_fields() {
82
  (SELECT DISTINCT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'line_item' AND order_id IN ($sql_order_ids))";
83
 
84
  $product_ids = $wpdb->get_col( "SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_type IN ('product','product_variation') AND ID IN ($sql_products) ORDER BY ID DESC LIMIT 1000" );
85
+
86
  $wp_fields = array();
87
  if($product_ids ) {
88
  $product_ids = join(",", $product_ids);
89
  $wp_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE post_id IN ($product_ids) ORDER BY meta_key" );
90
+ }
91
 
92
  return apply_filters( 'get_product_custom_meta_fields_for_orders', $wp_fields );
93
  }
296
  global $wpdb;
297
 
298
  $names = $wpdb->get_results( "SELECT distinct order_item_type,meta_key FROM {$wpdb->prefix}woocommerce_order_items AS items
299
+ INNER JOIN (SELECT ID AS order_id FROM {$wpdb->prefix}posts WHERE post_type='shop_order' ORDER BY ID DESC LIMIT 1000) AS orders ON orders.order_id = items.order_id
300
  JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta ON meta.order_item_id = items.order_item_id
301
  ORDER BY order_item_type,meta_key" );
302
 
316
  //we skip serialized and long values!
317
  $values = $wpdb->get_col( $wpdb->prepare( "SELECT distinct meta_value FROM {$wpdb->prefix}woocommerce_order_items AS items
318
  JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta ON meta.order_item_id = items.order_item_id
319
+ WHERE items.order_item_type = %s AND meta.meta_key=%s
320
  AND meta_value NOT LIKE 'a:%' AND LENGTH(meta_value)<20
321
  ORDER BY meta_value", $type, $key ) );
322
 
552
  'format' => 'money',
553
  ),
554
  'summary_report_total_refund_count' => array(
555
+ 'label' => __( 'Summary Report Total Refunds', 'woo-order-export-lite' ),
556
  'checked' => 0,
557
  'format' => 'number',
558
  ),
620
 
621
  public static function get_order_fields( $format, $segments = array() ) {
622
  if ( ! $segments ) {
623
+ $segments = array_keys(self::get_order_segments());
 
 
 
 
 
 
 
 
 
 
 
624
  }
625
  $map = array();
626
  foreach ( $segments as $segment ) {
627
  $method = "get_order_fields_" . $segment;
628
+ $map_segment = method_exists('WC_Order_Export_Data_Extractor_UI', $method) ? self::$method() : array();
629
 
630
  foreach ( $map_segment as $key => $value ) {
631
  $map_segment[ $key ]['segment'] = $segment;
762
  'checked' => 0,
763
  'format' => 'date',
764
  ),
765
+ 'summary_report_total_count' => array(
766
+ 'label' => __( 'Summary Report Total Orders', 'woo-order-export-lite' ),
767
+ 'checked' => 0,
768
+ 'format' => 'number',
769
+ ),
770
+ 'summary_report_total_amount' => array(
771
+ 'label' => __( 'Summary Report Total Amount', 'woo-order-export-lite' ),
772
+ 'checked' => 0,
773
+ 'format' => 'money',
774
+ ),
775
+ 'summary_report_total_amount_paid' => array(
776
+ 'label' => __( 'Summary Report Total Amount Paid', 'woo-order-export-lite' ),
777
+ 'checked' => 0,
778
+ 'format' => 'money',
779
+ ),
780
+ 'summary_report_total_refund_count' => array(
781
+ 'label' => __( 'Summary Report Total Refunds', 'woo-order-export-lite' ),
782
+ 'checked' => 0,
783
+ 'format' => 'number',
784
+ ),
785
+ 'summary_report_total_refund_amount' => array(
786
+ 'label' => __( 'Summary Report Total Refund Amount', 'woo-order-export-lite' ),
787
+ 'checked' => 0,
788
+ 'format' => 'money',
789
+ ),
790
  );
791
  }
792
 
1139
  );
1140
  }
1141
 
1142
+ public static function get_order_fields_other_items() {
1143
+ return array();
1144
+ }
1145
+
1146
  public static function get_order_fields_misc() {
1147
  return array(
1148
  'total_weight_items' => array(
1181
  }
1182
 
1183
  public static function get_order_segments() {
1184
+ return apply_filters('woe_get_order_segments', array(
1185
+ 'common' => __('Common', 'woo-order-export-lite'),
1186
+ 'user' => __('User', 'woo-order-export-lite'),
1187
+ 'billing' => __('Billing Address', 'woo-order-export-lite'),
1188
+ 'shipping' => __('Shipping Address', 'woo-order-export-lite'),
1189
+ 'products' => __('Products', 'woo-order-export-lite'),
1190
+ 'coupons' => __('Coupons', 'woo-order-export-lite'),
1191
+ 'other_items' => __('Other items', 'woo-order-export-lite'),
1192
+ 'cart' => __('Cart', 'woo-order-export-lite'),
1193
+ 'ship_calc' => __('Shipping', 'woo-order-export-lite'),
1194
+ 'totals' => __('Totals', 'woo-order-export-lite'),
1195
+ 'misc' => __('Others', 'woo-order-export-lite'),
1196
+ ));
1197
  }
1198
 
1199
  public static function get_format_fields() {
classes/core/class-wc-order-export-data-extractor.php CHANGED
@@ -129,6 +129,82 @@ class WC_Order_Export_Data_Extractor {
129
  return apply_filters( 'woe_get_product_itemmeta', $metas );
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  public static function get_product_taxonomies() {
133
  global $wpdb;
134
 
@@ -534,8 +610,17 @@ class WC_Order_Export_Data_Extractor {
534
  $exact_product_where = "AND orderitemmeta_product.meta_value IN ($values)";
535
  }
536
  }
 
 
 
 
 
 
 
 
 
537
  $product_where = join( " ",
538
- array_filter( array( $taxonomy_where, $product_category_where, $exact_product_where ) ) );
539
 
540
  //skip empty values
541
  if ( $product_where ) {
@@ -787,6 +872,8 @@ class WC_Order_Export_Data_Extractor {
787
  }
788
 
789
 
 
 
790
  // pre top
791
  $left_join_order_meta = $order_meta_where = $user_meta_where = $inner_join_user_meta = array();
792
  //add filter by custom fields in order
@@ -797,14 +884,14 @@ class WC_Order_Export_Data_Extractor {
797
  if ( ! in_array( $settings['sort'], WC_Order_Export_Engine::get_wp_posts_fields() ) ) {
798
  $pos = "sort";
799
  $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} " .
800
- "ON ordermeta_cf_{$pos}.post_id = orders.ID AND ordermeta_cf_{$pos}.meta_key='{$sort_field}'";
801
  }
802
  }
803
 
804
  if ( $settings['export_unmarked_orders'] ) {
805
  $pos = "export_unmarked_orders";
806
  $field = "woe_order_exported";
807
- $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} ON ordermeta_cf_{$pos}.post_id = orders.ID AND ordermeta_cf_{$pos}.meta_key='$field'";
808
  $order_meta_where [] = " ( ordermeta_cf_{$pos}.meta_value IS NULL ) ";
809
  }
810
 
@@ -814,7 +901,7 @@ class WC_Order_Export_Data_Extractor {
814
  foreach ( $filters as $operator => $fields ) {
815
  foreach ( $fields as $field => $values ) {
816
  if ( $values ) {
817
- $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} ON ordermeta_cf_{$pos}.post_id = orders.ID AND ordermeta_cf_{$pos}.meta_key='$field'";
818
  if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
819
  $values = self::sql_subset( $values );
820
  $order_meta_where [] = " ( ordermeta_cf_{$pos}.meta_value $operator ($values) ) ";
@@ -871,7 +958,7 @@ class WC_Order_Export_Data_Extractor {
871
  foreach ( $fields as $field => $values ) {
872
  $values = self::sql_subset( $values );
873
  if ( $values ) {
874
- $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.ID";
875
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_shipping_$field' AND ordermeta_{$field}.meta_value $operator ($values)) ";
876
  }
877
  }
@@ -884,7 +971,7 @@ class WC_Order_Export_Data_Extractor {
884
  foreach ( $fields as $field => $values ) {
885
  $values = self::sql_subset( $values );
886
  if ( $values ) {
887
- $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.ID";
888
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_billing_$field' AND ordermeta_{$field}.meta_value $operator ($values)) ";
889
  }
890
  }
@@ -930,7 +1017,7 @@ class WC_Order_Export_Data_Extractor {
930
  $field = 'customer_user';
931
  $values = self::sql_subset( $user_ids );
932
  if ( $values ) {
933
- $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.ID";
934
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_customer_user' AND ordermeta_{$field}.meta_value in ($values)) ";
935
  }
936
  }
@@ -940,7 +1027,7 @@ class WC_Order_Export_Data_Extractor {
940
  $field = 'payment_method';
941
  $values = self::sql_subset( $settings['payment_methods'] );
942
 
943
- $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.ID";
944
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_{$field}' AND ordermeta_{$field}.meta_value in ($values)) ";
945
  }
946
  $order_meta_where = join( " AND ",
@@ -1686,6 +1773,7 @@ class WC_Order_Export_Data_Extractor {
1686
  $options
1687
  ) {
1688
  global $wp_roles;
 
1689
 
1690
  // $extra_rows = array();
1691
  $row = array();
@@ -1805,6 +1893,69 @@ class WC_Order_Export_Data_Extractor {
1805
  if ( substr( $field, 0, 5 ) == "USER_" ) { //user field
1806
  $key = substr( $field, 5 );
1807
  $row[ $field ] = $user ? $user->get( $key ) : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1808
  } elseif ( $field == 'order_id' ) {
1809
  $row[ $field ] = $order_id;
1810
  } elseif ( $field == 'order_date' ) {
129
  return apply_filters( 'woe_get_product_itemmeta', $metas );
130
  }
131
 
132
+ public static function get_order_shipping_items() {
133
+ global $wpdb;
134
+ $transient_key = 'woe_get_order_shipping_items_result';
135
+
136
+ $metas = false; //get_transient( $transient_key );
137
+ if ( $metas === false ) {
138
+ $total_orders = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "'" );
139
+ if ( $total_orders < self::HUGE_SHOP_ORDERS ) {
140
+ // WP internal table, take all metas
141
+ $metas = $wpdb->get_col( "SELECT DISTINCT order_item_name FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'shipping' AND order_item_name <> '' " );
142
+ sort( $metas );
143
+ set_transient( $transient_key, $metas, 60 ); //valid for a minute
144
+
145
+ } else {
146
+ $limit = self::HUGE_SHOP_ORDERS;
147
+ $order_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "' AND post_status IN('wc-on-hold','wc-processing','wc-completed') ORDER BY post_date DESC LIMIT {$limit}" );
148
+ $order_ids = join( ",", $order_ids );
149
+ $metas = $wpdb->get_col( "SELECT DISTINCT order_item_name FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'shipping' AND order_id IN ($order_ids) AND order_item_name <> '' " );
150
+ sort( $metas );
151
+ set_transient( $transient_key, $metas, 60 ); //valid for a minute
152
+ }
153
+ }
154
+
155
+ return apply_filters( 'woe_get_order_shipping_items', $metas );
156
+ }
157
+
158
+ public static function get_order_fee_items() {
159
+ global $wpdb;
160
+ $transient_key = 'woe_get_order_fee_items_result';
161
+
162
+ $metas = get_transient( $transient_key );
163
+ if ( $metas === false ) {
164
+ $total_orders = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "'" );
165
+ if ( $total_orders < self::HUGE_SHOP_ORDERS ) {
166
+ // WP internal table, take all metas
167
+ $metas = $wpdb->get_col( "SELECT DISTINCT order_item_name FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'fee' AND order_item_name <> '' " );
168
+ sort( $metas );
169
+ set_transient( $transient_key, $metas, 60 ); //valid for a minute
170
+ } else {
171
+ $limit = self::HUGE_SHOP_ORDERS;
172
+ $order_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "' AND post_status IN('wc-on-hold','wc-processing','wc-completed') ORDER BY post_date DESC LIMIT {$limit}" );
173
+ $order_ids = join( ",", $order_ids );
174
+ $metas = $wpdb->get_col( "SELECT DISTINCT order_item_name FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'fee' AND order_id IN ($order_ids) AND order_item_name <> '' " );
175
+ sort( $metas );
176
+ set_transient( $transient_key, $metas, 60 ); //valid for a minute
177
+ }
178
+ }
179
+
180
+ return apply_filters( 'woe_get_order_fee_items', $metas );
181
+ }
182
+
183
+ public static function get_order_tax_items() {
184
+ global $wpdb;
185
+ $transient_key = 'woe_get_order_tax_items_result';
186
+
187
+ $metas = get_transient( $transient_key );
188
+ if ( $metas === false ) {
189
+ $total_orders = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "'" );
190
+ if ( $total_orders < self::HUGE_SHOP_ORDERS ) {
191
+ // WP internal table, take all metas
192
+ $metas = $wpdb->get_col( "SELECT DISTINCT order_item_name FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'tax' AND order_item_name <> '' " );
193
+ sort( $metas );
194
+ set_transient( $transient_key, $metas, 60 ); //valid for a minute
195
+ } else {
196
+ $limit = self::HUGE_SHOP_ORDERS;
197
+ $order_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "' AND post_status IN('wc-on-hold','wc-processing','wc-completed') ORDER BY post_date DESC LIMIT {$limit}" );
198
+ $order_ids = join( ",", $order_ids );
199
+ $metas = $wpdb->get_col( "SELECT DISTINCT order_item_name FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'tax' AND order_id IN ($order_ids) AND order_item_name <> '' " );
200
+ sort( $metas );
201
+ set_transient( $transient_key, $metas, 60 ); //valid for a minute
202
+ }
203
+ }
204
+
205
+ return apply_filters( 'woe_get_order_tax_items', $metas );
206
+ }
207
+
208
  public static function get_product_taxonomies() {
209
  global $wpdb;
210
 
610
  $exact_product_where = "AND orderitemmeta_product.meta_value IN ($values)";
611
  }
612
  }
613
+
614
+ $exclude_product_where = '';
615
+ if ( $settings['exclude_products'] ) {
616
+ $values = self::sql_subset( $settings['exclude_products'] );
617
+ if ( $values ) {
618
+ $exclude_product_where = "AND (orderitemmeta_product.meta_key = '_product_id' AND orderitemmeta_product.meta_value NOT IN ($values))";
619
+ }
620
+ }
621
+
622
  $product_where = join( " ",
623
+ array_filter( array( $taxonomy_where, $product_category_where, $exact_product_where, $exclude_product_where ) ) );
624
 
625
  //skip empty values
626
  if ( $product_where ) {
872
  }
873
 
874
 
875
+ $left_join_order_meta_order_id = self::$object_type === 'shop_order' ? 'ID' : 'post_parent';
876
+
877
  // pre top
878
  $left_join_order_meta = $order_meta_where = $user_meta_where = $inner_join_user_meta = array();
879
  //add filter by custom fields in order
884
  if ( ! in_array( $settings['sort'], WC_Order_Export_Engine::get_wp_posts_fields() ) ) {
885
  $pos = "sort";
886
  $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} " .
887
+ "ON ordermeta_cf_{$pos}.post_id = orders.{$left_join_order_meta_order_id} AND ordermeta_cf_{$pos}.meta_key='{$sort_field}'";
888
  }
889
  }
890
 
891
  if ( $settings['export_unmarked_orders'] ) {
892
  $pos = "export_unmarked_orders";
893
  $field = "woe_order_exported";
894
+ $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} ON ordermeta_cf_{$pos}.post_id = orders.{$left_join_order_meta_order_id} AND ordermeta_cf_{$pos}.meta_key='$field'";
895
  $order_meta_where [] = " ( ordermeta_cf_{$pos}.meta_value IS NULL ) ";
896
  }
897
 
901
  foreach ( $filters as $operator => $fields ) {
902
  foreach ( $fields as $field => $values ) {
903
  if ( $values ) {
904
+ $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} ON ordermeta_cf_{$pos}.post_id = orders.{$left_join_order_meta_order_id} AND ordermeta_cf_{$pos}.meta_key='$field'";
905
  if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
906
  $values = self::sql_subset( $values );
907
  $order_meta_where [] = " ( ordermeta_cf_{$pos}.meta_value $operator ($values) ) ";
958
  foreach ( $fields as $field => $values ) {
959
  $values = self::sql_subset( $values );
960
  if ( $values ) {
961
+ $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.{$left_join_order_meta_order_id}";
962
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_shipping_$field' AND ordermeta_{$field}.meta_value $operator ($values)) ";
963
  }
964
  }
971
  foreach ( $fields as $field => $values ) {
972
  $values = self::sql_subset( $values );
973
  if ( $values ) {
974
+ $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.{$left_join_order_meta_order_id}";
975
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_billing_$field' AND ordermeta_{$field}.meta_value $operator ($values)) ";
976
  }
977
  }
1017
  $field = 'customer_user';
1018
  $values = self::sql_subset( $user_ids );
1019
  if ( $values ) {
1020
+ $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.{$left_join_order_meta_order_id}";
1021
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_customer_user' AND ordermeta_{$field}.meta_value in ($values)) ";
1022
  }
1023
  }
1027
  $field = 'payment_method';
1028
  $values = self::sql_subset( $settings['payment_methods'] );
1029
 
1030
+ $left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_{$field} ON ordermeta_{$field}.post_id = orders.{$left_join_order_meta_order_id}";
1031
  $order_meta_where [] = " (ordermeta_{$field}.meta_key='_{$field}' AND ordermeta_{$field}.meta_value in ($values)) ";
1032
  }
1033
  $order_meta_where = join( " AND ",
1773
  $options
1774
  ) {
1775
  global $wp_roles;
1776
+ global $wpdb;
1777
 
1778
  // $extra_rows = array();
1779
  $row = array();
1893
  if ( substr( $field, 0, 5 ) == "USER_" ) { //user field
1894
  $key = substr( $field, 5 );
1895
  $row[ $field ] = $user ? $user->get( $key ) : '';
1896
+ } elseif ( substr( $field, 0, 4 ) == "FEE_" ) {
1897
+
1898
+ $key = substr( $field, 4 );
1899
+
1900
+ $value = $wpdb->get_col( $wpdb->prepare(
1901
+ "SELECT
1902
+ itemmeta.meta_value
1903
+ FROM
1904
+ {$wpdb->prefix}woocommerce_order_items items
1905
+ INNER JOIN
1906
+ {$wpdb->prefix}woocommerce_order_itemmeta itemmeta
1907
+ ON
1908
+ items.order_item_id = itemmeta.order_item_id AND itemmeta.meta_key = '_fee_amount'
1909
+ WHERE
1910
+ items.order_id = %s AND items.order_item_type = 'fee' AND items.order_item_name = %s",
1911
+ $order_id,
1912
+ $key
1913
+ ) );
1914
+
1915
+ $row[ $field ] = isset($value[0]) ? $value[0] : '';
1916
+
1917
+ } elseif ( substr( $field, 0, 9 ) == "SHIPPING_" ) {
1918
+
1919
+ $key = substr( $field, 9 );
1920
+
1921
+ $value = $wpdb->get_col( $wpdb->prepare(
1922
+ "SELECT
1923
+ itemmeta.meta_value
1924
+ FROM
1925
+ {$wpdb->prefix}woocommerce_order_items items
1926
+ INNER JOIN
1927
+ {$wpdb->prefix}woocommerce_order_itemmeta itemmeta
1928
+ ON
1929
+ items.order_item_id = itemmeta.order_item_id AND itemmeta.meta_key = 'cost'
1930
+ WHERE
1931
+ items.order_id = %s AND items.order_item_type = 'shipping' AND items.order_item_name = %s",
1932
+ $order_id,
1933
+ $key
1934
+ ) );
1935
+
1936
+ $row[ $field ] = isset($value[0]) ? $value[0] : '';
1937
+
1938
+ } elseif ( substr( $field, 0, 4 ) == "TAX_" ) {
1939
+
1940
+ $key = substr( $field, 4 );
1941
+
1942
+ $value = $wpdb->get_col( $wpdb->prepare(
1943
+ "SELECT
1944
+ itemmeta.meta_value
1945
+ FROM
1946
+ {$wpdb->prefix}woocommerce_order_items items
1947
+ INNER JOIN
1948
+ {$wpdb->prefix}woocommerce_order_itemmeta itemmeta
1949
+ ON
1950
+ items.order_item_id = itemmeta.order_item_id AND itemmeta.meta_key = 'tax_amount'
1951
+ WHERE
1952
+ items.order_id = %s AND items.order_item_type = 'tax' AND items.order_item_name = %s",
1953
+ $order_id,
1954
+ $key
1955
+ ) );
1956
+
1957
+ $row[ $field ] = isset($value[0]) ? $value[0] : '';
1958
+
1959
  } elseif ( $field == 'order_id' ) {
1960
  $row[ $field ] = $order_id;
1961
  } elseif ( $field == 'order_date' ) {
classes/core/class-wc-order-export-engine.php CHANGED
@@ -147,7 +147,7 @@ class WC_Order_Export_Engine {
147
  }
148
 
149
  return array(
150
- 'labels' => $labels->is_not_empty() ? $labels : false,
151
  'static_fields' => $static_fields,
152
  'field_formats' => $field_formats,
153
  );
147
  }
148
 
149
  return array(
150
+ 'labels' => $labels,
151
  'static_fields' => $static_fields,
152
  'field_formats' => $field_formats,
153
  );
classes/formats/abstract-class-woe-formatter-plain-format.php CHANGED
@@ -8,7 +8,8 @@ require_once 'trait-woe-plain-format.php';
8
  abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
9
  use WOE_Order_Export_Plain_Format;
10
  private $duplicate_settings = array();
11
- private $summary_report;
 
12
  protected $rows;
13
  var $encoding;
14
 
@@ -26,11 +27,17 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
26
  ) {
27
  parent::__construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset );
28
  $this->duplicate_settings = $this->settings['global_job_settings']['duplicated_fields_settings'];
29
- $this->summary_report = $this->settings['global_job_settings']['summary_report_by_products'];
30
- if ( $this->summary_report ) {
 
31
  self::check_create_session();
32
  $this->field_formats["order"] = isset($this->field_formats["products"]) ? $this->field_formats["products"] : array() ;// Products at top level!
33
  }
 
 
 
 
 
34
  $this->summary_processing = false; //true only when we finish order scan
35
 
36
  $this->encoding = isset( $this->settings['encoding'] ) ? $this->settings['encoding'] : '';
@@ -38,8 +45,14 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
38
 
39
  public function output( $rec ) {
40
  //don't output orders in summary mode!
41
- if ( $this->summary_report AND ! $this->summary_processing ) {
42
- $this->try_fill_summary_report_fields( $rec );
 
 
 
 
 
 
43
 
44
  return array();
45
  }
@@ -131,8 +144,12 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
131
 
132
  $item_rows_start_from_new_line = ( $this->format == 'csv' && $this->settings['global_job_settings']['format_csv_item_rows_start_from_new_line'] );
133
 
134
- if ( $this->summary_report ) {
135
- return $this->make_summary_header( $data );
 
 
 
 
136
  }
137
 
138
  $group_fields = array(
@@ -213,7 +230,7 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
213
  }
214
  }
215
 
216
- protected function make_summary_header( $data = '' ) {
217
  $header = array();
218
  self::check_create_session();
219
  $_SESSION['woe_summary_products'] = array();
@@ -233,10 +250,10 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
233
  }
234
  }
235
 
236
- return apply_filters( 'woe_summary_headers', $header );
237
  }
238
 
239
- private function try_fill_summary_report_fields( $row ) {
240
  $order = false;
241
 
242
  foreach ( self::get_array_from_array( $row, 'products' ) as $item_id => $item ) {
@@ -309,7 +326,7 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
309
  }
310
 
311
  protected function try_apply_summary_report_fields() {
312
- if ( $this->summary_report ) {
313
  $this->summary_processing = true;
314
 
315
  //sort by name
@@ -333,10 +350,125 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
333
  }
334
  }
335
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
 
338
  protected function field_format_is( $field, $format_fields ) {
339
- if ( in_array( $field, $format_fields ) ) {
340
  return true;
341
  }
342
  if ( preg_match( '#^(.+?)_\d+$#', $field, $duplicated_field ) ) {
8
  abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
9
  use WOE_Order_Export_Plain_Format;
10
  private $duplicate_settings = array();
11
+ private $summary_report_products;
12
+ private $summary_report_customers;
13
  protected $rows;
14
  var $encoding;
15
 
27
  ) {
28
  parent::__construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset );
29
  $this->duplicate_settings = $this->settings['global_job_settings']['duplicated_fields_settings'];
30
+ $this->summary_report_products = $this->settings['global_job_settings']['summary_report_by_products'];
31
+ $this->summary_report_customers = $this->settings['global_job_settings']['summary_report_by_customers'];
32
+ if ( $this->summary_report_products ) {
33
  self::check_create_session();
34
  $this->field_formats["order"] = isset($this->field_formats["products"]) ? $this->field_formats["products"] : array() ;// Products at top level!
35
  }
36
+
37
+ if ( $this->summary_report_customers ) {
38
+ self::check_create_session();
39
+ }
40
+
41
  $this->summary_processing = false; //true only when we finish order scan
42
 
43
  $this->encoding = isset( $this->settings['encoding'] ) ? $this->settings['encoding'] : '';
45
 
46
  public function output( $rec ) {
47
  //don't output orders in summary mode!
48
+ if ( $this->summary_report_products AND ! $this->summary_processing ) {
49
+ $this->try_fill_summary_report_products_fields( $rec );
50
+
51
+ return array();
52
+ }
53
+
54
+ if ( $this->summary_report_customers AND ! $this->summary_processing ) {
55
+ $this->try_fill_summary_report_customers_fields( $rec, WC_Order_Export_Engine::$order_id );
56
 
57
  return array();
58
  }
144
 
145
  $item_rows_start_from_new_line = ( $this->format == 'csv' && $this->settings['global_job_settings']['format_csv_item_rows_start_from_new_line'] );
146
 
147
+ if ( $this->summary_report_products ) {
148
+ return $this->make_summary_products_header( $data );
149
+ }
150
+
151
+ if ( $this->summary_report_customers ) {
152
+ return $this->make_summary_customers_header( $data );
153
  }
154
 
155
  $group_fields = array(
230
  }
231
  }
232
 
233
+ protected function make_summary_products_header( $data = '' ) {
234
  $header = array();
235
  self::check_create_session();
236
  $_SESSION['woe_summary_products'] = array();
250
  }
251
  }
252
 
253
+ return apply_filters( 'woe_summary_products_headers', $header );
254
  }
255
 
256
+ private function try_fill_summary_report_products_fields( $row ) {
257
  $order = false;
258
 
259
  foreach ( self::get_array_from_array( $row, 'products' ) as $item_id => $item ) {
326
  }
327
 
328
  protected function try_apply_summary_report_fields() {
329
+ if ( $this->summary_report_products ) {
330
  $this->summary_processing = true;
331
 
332
  //sort by name
350
  }
351
  }
352
  }
353
+
354
+ if ( $this->summary_report_customers ) {
355
+ $this->summary_processing = true;
356
+
357
+ //sort by name
358
+ $first_row = reset( $_SESSION['woe_summary_customers'] );
359
+ if ( isset( $first_row['name'] ) ) {
360
+ uasort( $_SESSION['woe_summary_customers'], function ( $a, $b ) {
361
+ return strcmp( $a['name'], $b['name'] );
362
+ } );
363
+ }
364
+
365
+ do_action( 'woe_summary_before_output' );
366
+ if ( $this->mode == 'preview' ) {
367
+ if ( empty( $this->rows ) ) // no headers!
368
+ {
369
+ $this->rows = array();
370
+ }
371
+ $this->rows += $_SESSION['woe_summary_customers'];
372
+ } else {
373
+ foreach ( $_SESSION['woe_summary_customers'] as $item ) {
374
+ $this->output( $item );
375
+ }
376
+ }
377
+ }
378
+ }
379
+
380
+ protected function make_summary_customers_header( $data = '' ) {
381
+ $header = array();
382
+ self::check_create_session();
383
+ $_SESSION['woe_summary_customers'] = array();
384
+
385
+ if( empty($this->labels['order']) ) // error , no product fields?!
386
+ return array();
387
+
388
+ $allowed_fields = WC_Order_Export_Data_Extractor_UI::get_order_fields(
389
+ $this->settings['global_job_settings']['format'],
390
+ array('user', 'billing', 'shipping')
391
+ );
392
+
393
+ foreach ( $this->labels['order']->get_labels() as $label_data ) {
394
+ $field_header = $label_data['label'];
395
+ $key = $label_data['key'];
396
+
397
+ $field_header = apply_filters( 'woe_add_csv_headers', $field_header, $key );
398
+ if ( isset($allowed_fields[$key]) ) {
399
+ $header[] = $field_header;
400
+ } else {
401
+ unset( $this->labels['order']->$key );
402
+ }
403
+ }
404
+
405
+ return apply_filters( 'woe_summary_customers_headers', $header );
406
+ }
407
+
408
+ private function try_fill_summary_report_customers_fields( $row, $order_id ) {
409
+
410
+ $order = new WC_Order( $order_id );
411
+
412
+ $key = $order->get_billing_email();
413
+ $key = apply_filters( "woe_summary_customers_adjust_key", $key, $order );
414
+
415
+ $allowed_fields = WC_Order_Export_Data_Extractor_UI::get_order_fields(
416
+ $this->settings['global_job_settings']['format'],
417
+ array('user', 'billing', 'shipping')
418
+ );
419
+
420
+ //add new product
421
+ if ( ! isset( $_SESSION['woe_summary_customers'][ $key ] ) ) {
422
+ $new_row = array();
423
+ foreach ( $this->labels['order']->get_labels() as $label_data ) {
424
+ $original_key = $label_data['key'];
425
+ if ( ! isset( $allowed_fields[$original_key] ) ) {
426
+ continue;
427
+ }
428
+ $field_key = $label_data['parent_key'] ? $label_data['parent_key'] : $original_key;
429
+ if ( preg_match( '#^summary_report_total_#', $field_key ) ) {
430
+ $new_row[ $original_key ] = 0;
431
+ }//total fields
432
+ else {
433
+ $new_row[ $original_key ] = $row[ $field_key ];
434
+ } // already calculated
435
+ }
436
+ $new_row = apply_filters( 'woe_summary_column_keys',
437
+ $new_row );// legacy hook
438
+ $new_row = apply_filters( "woe_summary_customers_prepare_row",
439
+ $new_row, $key, $order );
440
+ $_SESSION['woe_summary_customers'][ $key ] = $new_row;
441
+ }
442
+
443
+ //increase totals
444
+ if ( isset( $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_count'] ) ) {
445
+ $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_count']++;
446
+ }
447
+
448
+ if ( isset( $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_amount'] ) ) {
449
+ $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_amount'] += wc_round_tax_total( $order->get_total() );
450
+ }
451
+
452
+ if ( isset( $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_amount_paid'] ) ) {
453
+ $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_amount_paid'] += $order->is_paid() ? wc_round_tax_total( $order->get_total() ) : 0;
454
+ }
455
+
456
+ if ( isset( $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_refund_count'] ) ) {
457
+ $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_refund_count'] += $order->get_status() == 'wc-refunded' ? 1 : 0;
458
+ }
459
+
460
+ if ( isset( $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_refund_amount'] ) ) {
461
+ $_SESSION['woe_summary_customers'][ $key ]['summary_report_total_refund_amount'] += wc_round_tax_total( $order->get_total_refunded() );
462
+ }
463
+
464
+ do_action( "woe_summary_customers_add_item", $key, $order, $row );
465
+
466
+ //no lines for order!
467
+ return array();
468
  }
469
 
470
  protected function field_format_is( $field, $format_fields ) {
471
+ if ( in_array( $field, $format_fields, true ) ) {
472
  return true;
473
  }
474
  if ( preg_match( '#^(.+?)_\d+$#', $field, $duplicated_field ) ) {
classes/formats/class-woe-formatter-pdf.php CHANGED
@@ -124,8 +124,17 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
124
  }
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
127
 
128
- $this->pdf->SetFont( 'Arial', '', $this->font_size );
129
  $this->pdf->SetFillColor( null );
130
  $this->pdf->setProperties( array(
131
  'header' => array(
@@ -199,7 +208,7 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
199
  }
200
 
201
  do_action("woe_pdf_finished", $this->pdf, $this);
202
- $this->pdf->Output( 'f', str_replace( '.csv', '.pdf', $this->filename ) );
203
 
204
  delete_transient( $this->get_tmp_data_transient_name() );
205
  }
124
  }
125
  }
126
 
127
+ if ( apply_filters('woe_formatter_pdf_use_external_font', false) ) {
128
+ $this->pdf = apply_filters('woe_formatter_pdf_apply_external_font', $this->pdf);
129
+ } else {
130
+ $this->pdf->setFontPath( dirname( __FILE__ ) . '/../FPDF/font/');
131
+
132
+ $this->pdf->AddFont( 'OpenSans', "", "OpenSans-Regular.ttf" );
133
+ $this->pdf->AddFont( 'OpenSans', "B", "OpenSans-Bold.ttf" );
134
+
135
+ $this->pdf->SetFont( 'OpenSans', '', $this->font_size );
136
+ }
137
 
 
138
  $this->pdf->SetFillColor( null );
139
  $this->pdf->setProperties( array(
140
  'header' => array(
208
  }
209
 
210
  do_action("woe_pdf_finished", $this->pdf, $this);
211
+ $this->pdf->output_to_destination( 'f', str_replace( '.csv', '.pdf', $this->filename ) );
212
 
213
  delete_transient( $this->get_tmp_data_transient_name() );
214
  }
classes/formats/class-woe-formatter-xls.php CHANGED
@@ -208,7 +208,10 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
208
  if ( empty( $this->settings['global_job_settings']['time_format'] ) ) { // must remove time!
209
  $text = date( "Y-m-d", strtotime( $text ) );
210
  }
211
- $text = PHPExcel_Shared_Date::PHPToExcel( new DateTime( $text ) );
 
 
 
212
  $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow( $pos, $this->last_row, $text );
213
  }
214
  } else {
@@ -247,7 +250,7 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
247
  }
248
  $rec = array_reverse( $rec );
249
  }
250
- if ( $num == 0 AND $this->settings['display_column_names'] ) {
251
  fwrite( $this->handle,
252
  '<tr style="font-weight:bold"><td>' . join( '</td><td>', $rec ) . "</td><tr>\n" );
253
  } else {
208
  if ( empty( $this->settings['global_job_settings']['time_format'] ) ) { // must remove time!
209
  $text = date( "Y-m-d", strtotime( $text ) );
210
  }
211
+ try {
212
+ $text = PHPExcel_Shared_Date::PHPToExcel( new DateTime( $text ) );
213
+ } catch (Exception $e) {}
214
+
215
  $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow( $pos, $this->last_row, $text );
216
  }
217
  } else {
250
  }
251
  $rec = array_reverse( $rec );
252
  }
253
+ if ( $num === 0 AND $this->settings['display_column_names'] ) {
254
  fwrite( $this->handle,
255
  '<tr style="font-weight:bold"><td>' . join( '</td><td>', $rec ) . "</td><tr>\n" );
256
  } else {
classes/formats/trait-woe-plain-format.php CHANGED
@@ -215,7 +215,7 @@ trait WOE_Order_Export_Plain_Format {
215
  unset( $row[ $key ] );
216
  }
217
  }
218
-
219
  foreach ( $this->labels['coupons']->to_Array() as $key => $label ) {
220
  $key = 'plain_coupons_' . $key;
221
  if ( isset( $row[ $key ] ) ) {
215
  unset( $row[ $key ] );
216
  }
217
  }
218
+
219
  foreach ( $this->labels['coupons']->to_Array() as $key => $label ) {
220
  $key = 'plain_coupons_' . $key;
221
  if ( isset( $row[ $key ] ) ) {
i18n/languages/woo-order-export-lite.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Advanced Order Export For WooCommerce\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2019-07-18 12:31+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9
  "Language-Team: \n"
@@ -15,1727 +15,1790 @@ msgstr ""
15
  "X-Generator: Loco https://localise.biz/\n"
16
  "X-Loco-Version: 2.3.0; wp-5.2.2"
17
 
18
- #: woo-order-export-lite.php:34
19
- msgid ""
20
- "Please, <a href=\"plugins.php\">deactivate</a> Free version of Advanced "
21
- "Order Export For WooCommerce!"
22
- msgstr ""
 
23
 
24
- #: view/settings-form.php:43
25
- msgid "Field format"
26
- msgstr ""
 
 
 
27
 
28
- #: view/settings-form.php:46 view/settings-form.php:616
29
- #: view/settings-form.php:642
30
  msgid "-"
31
  msgstr ""
32
 
33
- #: view/settings-form.php:110
34
- msgid "Filter orders by"
35
  msgstr ""
36
 
37
- #: view/settings-form.php:116 view/settings-form.php:660
38
- #: classes/core/class-wc-order-export-data-extractor-ui.php:677
39
- msgid "Order Date"
40
  msgstr ""
41
 
42
- #: view/settings-form.php:123 view/settings-form.php:661
43
- #: classes/core/class-wc-order-export-data-extractor-ui.php:682
44
- msgid "Modification Date"
45
  msgstr ""
46
 
47
- #: view/settings-form.php:130
48
- #: classes/core/class-wc-order-export-data-extractor-ui.php:702
49
- msgid "Paid Date"
50
  msgstr ""
51
 
52
- #: view/settings-form.php:137
53
- #: classes/core/class-wc-order-export-data-extractor-ui.php:697
54
- msgid "Completed Date"
55
  msgstr ""
56
 
57
- #: view/settings-form.php:142
58
- msgid "This date range should not be saved in the scheduled task"
59
  msgstr ""
60
 
61
- #: view/settings-form.php:145
62
- msgid "Date range"
 
63
  msgstr ""
64
 
65
- #: view/settings-form.php:148
66
- msgid "to"
67
  msgstr ""
68
 
69
- #: view/settings-form.php:153
70
- msgid "Express export"
71
  msgstr ""
72
 
73
- #: view/settings-form.php:161
74
- msgid "Summary Report By Products"
75
  msgstr ""
76
 
77
- #: view/settings-form.php:170
78
- msgid "Export filename"
79
  msgstr ""
80
 
81
- #: view/settings-form.php:181
82
- msgid "Format"
83
  msgstr ""
84
 
85
- #: view/settings-form.php:194
86
- msgid "XLS options"
87
  msgstr ""
88
 
89
- #: view/settings-form.php:204
90
- msgid "Export as .xls (Binary File Format)"
91
  msgstr ""
92
 
93
- #: view/settings-form.php:206
94
- msgid "Use sheet name"
95
  msgstr ""
96
 
97
- #: view/settings-form.php:212 view/settings-form.php:253
98
- #: view/settings-form.php:331 view/settings-form.php:350
99
- #: view/settings-form.php:524
100
- msgid "Output column titles as first line"
101
  msgstr ""
102
 
103
- #: view/settings-form.php:216
104
- msgid "Auto column width"
105
  msgstr ""
106
 
107
- #: view/settings-form.php:220
108
- msgid "Right-to-Left direction"
109
  msgstr ""
110
 
111
- #: view/settings-form.php:224
112
- msgid "Force general format for all cells"
113
  msgstr ""
114
 
115
- #: view/settings-form.php:227 view/settings-form.php:503
116
- msgid "Images width"
 
 
117
  msgstr ""
118
 
119
- #: view/settings-form.php:234 view/settings-form.php:510
120
- msgid "Images height"
121
  msgstr ""
122
 
123
- #: view/settings-form.php:240
124
- msgid "CSV options"
125
  msgstr ""
126
 
127
- #: view/settings-form.php:249 view/settings-form.php:327
128
- msgid "Output UTF-8 BOM"
129
  msgstr ""
130
 
131
- #: view/settings-form.php:257
132
- msgid "Convert line breaks to literals"
133
  msgstr ""
134
 
135
- #: view/settings-form.php:261
136
- msgid "Product rows start with a new line"
137
  msgstr ""
138
 
139
- #: view/settings-form.php:262
140
- msgid "Enclosure"
141
  msgstr ""
142
 
143
- #: view/settings-form.php:266
144
- msgid "Field Delimiter"
145
  msgstr ""
146
 
147
- #: view/settings-form.php:270 view/settings-form.php:332
148
- msgid "Line Break"
149
  msgstr ""
150
 
151
- #: view/settings-form.php:275 view/settings-form.php:337
152
- msgid "Character encoding"
153
  msgstr ""
154
 
155
- #: view/settings-form.php:281
156
- msgid "XML options"
157
  msgstr ""
158
 
159
- #: view/settings-form.php:284
160
- msgid "Please, install/enable PHP XML Extension!"
161
  msgstr ""
162
 
163
- #: view/settings-form.php:287
164
- msgid "Prepend XML"
 
165
  msgstr ""
166
 
167
- #: view/settings-form.php:290
168
- msgid "Root tag"
 
169
  msgstr ""
170
 
171
- #: view/settings-form.php:293
172
- msgid "Order tag"
 
173
  msgstr ""
174
 
175
- #: view/settings-form.php:296
176
- msgid "Product tag"
177
  msgstr ""
178
 
179
- #: view/settings-form.php:299
180
- msgid "Coupon tag"
181
  msgstr ""
182
 
183
- #: view/settings-form.php:302
184
- msgid "Append XML"
185
  msgstr ""
186
 
187
- #: view/settings-form.php:305
188
- msgid "Self closing tags"
 
 
 
 
189
  msgstr ""
190
 
191
- #: view/settings-form.php:311
192
- msgid "JSON options"
193
  msgstr ""
194
 
195
- #: view/settings-form.php:313
196
- msgid "Start tag"
197
  msgstr ""
198
 
199
- #: view/settings-form.php:316
200
- msgid "End tag"
201
  msgstr ""
202
 
203
- #: view/settings-form.php:320
204
- msgid "TSV options"
205
  msgstr ""
206
 
207
- #: view/settings-form.php:344
208
- msgid "PDF options"
209
  msgstr ""
210
 
211
- #: view/settings-form.php:357
212
- msgid "repeat at each page"
213
  msgstr ""
214
 
215
- #: view/settings-form.php:361
216
- msgid "Orientation"
217
  msgstr ""
218
 
219
- #: view/settings-form.php:370
220
- msgid "Page size"
221
  msgstr ""
222
 
223
- #: view/settings-form.php:379 view/settings-form.php:534
224
- msgid "Font size"
225
  msgstr ""
226
 
227
- #: view/settings-form.php:385
228
- msgid "Page numbers"
229
  msgstr ""
230
 
231
- #: view/settings-form.php:388
232
- msgid "Left align"
233
  msgstr ""
234
 
235
- #: view/settings-form.php:389
236
- msgid "Center align"
237
  msgstr ""
238
 
239
- #: view/settings-form.php:390
240
- msgid "Right align"
241
  msgstr ""
242
 
243
- #: view/settings-form.php:395
244
- msgid "No page numbers"
245
  msgstr ""
246
 
247
- #: view/settings-form.php:403
248
- msgid "Page header text"
249
  msgstr ""
250
 
251
- #: view/settings-form.php:408
252
- msgid "Columns width"
253
  msgstr ""
254
 
255
- #: view/settings-form.php:409 view/settings-form.php:419
256
- #: view/settings-form.php:541
257
- msgid "comma separated list"
 
 
 
258
  msgstr ""
259
 
260
- #: view/settings-form.php:413
261
- msgid "Page footer text"
262
  msgstr ""
263
 
264
- #: view/settings-form.php:418 view/settings-form.php:540
265
  msgid "Columns align"
266
  msgstr ""
267
 
268
- #: view/settings-form.php:424
269
- msgid "Fit table to page width"
270
- msgstr ""
271
-
272
- #: view/settings-form.php:425
273
- msgid "Yes"
274
  msgstr ""
275
 
276
- #: view/settings-form.php:426
277
- msgid "No"
 
278
  msgstr ""
279
 
280
- #: view/settings-form.php:430 view/settings-form.php:555
281
- msgid "Table header text color"
282
  msgstr ""
283
 
284
- #: view/settings-form.php:435 view/settings-form.php:560
285
- msgid "Table header background color"
286
  msgstr ""
287
 
288
- #: view/settings-form.php:441 view/settings-form.php:566
289
- msgid "Table row text color"
290
  msgstr ""
291
 
292
- #: view/settings-form.php:446 view/settings-form.php:571
293
- msgid "Table row background color"
 
294
  msgstr ""
295
 
296
- #: view/settings-form.php:452
297
- msgid "Page header text color"
 
 
 
 
298
  msgstr ""
299
 
300
- #: view/settings-form.php:457
301
- msgid "Page footer text color"
302
  msgstr ""
303
 
304
- #: view/settings-form.php:466
305
- msgid "Select logo"
 
 
306
  msgstr ""
307
 
308
- #: view/settings-form.php:478
309
- msgid "Remove logo"
310
  msgstr ""
311
 
312
- #: view/settings-form.php:481
313
- msgid "Logo align"
314
  msgstr ""
315
 
316
- #: view/settings-form.php:489
317
- msgid "Logo height"
318
  msgstr ""
319
 
320
- #: view/settings-form.php:495
321
- msgid "Logo width"
322
  msgstr ""
323
 
324
- #: view/settings-form.php:496
325
- msgid "0 - auto scale"
326
  msgstr ""
327
 
328
- #: view/settings-form.php:518
329
- msgid "Html options"
330
  msgstr ""
331
 
332
- #: view/settings-form.php:530
333
- msgid "repeat header as last line"
334
  msgstr ""
335
 
336
- #: view/settings-form.php:545
337
- msgid "Header text"
338
  msgstr ""
339
 
340
- #: view/settings-form.php:550
341
- msgid "Footer text"
342
  msgstr ""
343
 
344
- #: view/settings-form.php:577
345
- msgid "Header text color"
 
 
 
346
  msgstr ""
347
 
348
- #: view/settings-form.php:582
349
- msgid "Footer text color"
350
  msgstr ""
351
 
352
- #: view/settings-form.php:591
353
- msgid "Custom css"
354
  msgstr ""
355
 
356
- #: view/settings-form.php:593
357
- msgid "This option cancels UI settings(above) and don't applied to Preview"
358
  msgstr ""
359
 
360
- #: view/settings-form.php:602
361
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1185
362
- msgid "Date"
363
  msgstr ""
364
 
365
- #: view/settings-form.php:620 view/settings-form.php:646
366
  msgid "custom"
367
  msgstr ""
368
 
369
- #: view/settings-form.php:629
370
- msgid "Time"
371
  msgstr ""
372
 
373
- #: view/settings-form.php:659
374
- #: classes/core/class-wc-order-export-data-extractor-ui.php:662
375
- msgid "Order ID"
376
  msgstr ""
377
 
378
- #: view/settings-form.php:662
379
- msgid "Order status"
380
  msgstr ""
381
 
382
- #: view/settings-form.php:683
383
- msgid "Descending"
384
  msgstr ""
385
 
386
- #: view/settings-form.php:685
387
- msgid "Ascending"
388
  msgstr ""
389
 
390
- #: view/settings-form.php:690
391
- #, php-format
392
- msgid "Sort orders by %s in %s order"
393
  msgstr ""
394
 
395
- #: view/settings-form.php:696
396
- msgid "Change order status to"
397
  msgstr ""
398
 
399
- #: view/settings-form.php:701
400
- msgid "- don't modify -"
401
  msgstr ""
402
 
403
- #: view/settings-form.php:713
404
- msgid "Misc settings"
405
  msgstr ""
406
 
407
- #: view/settings-form.php:719
408
- msgid "Format numbers (use WC decimal separator)"
409
  msgstr ""
410
 
411
- #: view/settings-form.php:725
412
- msgid "Export all order notes"
413
  msgstr ""
414
 
415
- #: view/settings-form.php:731
416
- msgid "Export refund notes as Customer Note"
417
  msgstr ""
418
 
419
- #: view/settings-form.php:737
420
- msgid "Strip tags from Product Description/Variation"
 
421
  msgstr ""
422
 
423
- #: view/settings-form.php:743
424
- msgid "Cleanup phone (export only digits)"
425
  msgstr ""
426
 
427
- #: view/settings-form.php:749
428
- msgid "Enable debug output"
429
  msgstr ""
430
 
431
- #: view/settings-form.php:755
432
- msgid "Custom PHP code to modify output"
433
  msgstr ""
434
 
435
- #: view/settings-form.php:760
436
- msgid ""
437
- "Please check permissions for your role. You must have capability "
438
- "“edit_themes” to use this box."
439
  msgstr ""
440
 
441
- #: view/settings-form.php:765
442
- msgid "Read how to fix it"
443
  msgstr ""
444
 
445
- #: view/settings-form.php:769
446
- msgid "Use only unnamed functions!"
447
  msgstr ""
448
 
449
- #: view/settings-form.php:781
450
- msgid "Filter by order"
451
  msgstr ""
452
 
453
- #: view/settings-form.php:786
454
- msgid "Don't export child orders"
455
  msgstr ""
456
 
457
- #: view/settings-form.php:790
458
- msgid "Export refunds"
459
  msgstr ""
460
 
461
- #: view/settings-form.php:794
462
- msgid "Mark exported orders"
463
  msgstr ""
464
 
465
- #: view/settings-form.php:798
466
- msgid "Export unmarked orders only"
 
 
 
467
  msgstr ""
468
 
469
- #: view/settings-form.php:800
470
- msgid "Order statuses"
471
  msgstr ""
472
 
473
- #: view/settings-form.php:812 view/settings-form.php:1089
474
- msgid "Custom fields"
475
  msgstr ""
476
 
477
- #: view/settings-form.php:855
478
- msgid ""
479
- "The filters won't work correctly.<br>Another plugin(or theme) has loaded "
480
- "outdated Select2.js"
481
  msgstr ""
482
 
483
- #: view/settings-form.php:857
484
- msgid "Filter by product"
485
  msgstr ""
486
 
487
- #: view/settings-form.php:862
488
- msgid "Export all products from the order"
489
  msgstr ""
490
 
491
- #: view/settings-form.php:866
492
- msgid "Skip fully refunded items"
493
  msgstr ""
494
 
495
- #: view/settings-form.php:868
496
- msgid "Product categories"
 
497
  msgstr ""
498
 
499
- #: view/settings-form.php:886
500
- msgid "Vendor/creator"
501
  msgstr ""
502
 
503
- #: view/settings-form.php:902
504
- msgid "Product"
505
  msgstr ""
506
 
507
- #: view/settings-form.php:917
508
- msgid "Product taxonomies"
509
  msgstr ""
510
 
511
- #: view/settings-form.php:949
512
- msgid "Product custom fields"
513
  msgstr ""
514
 
515
- #: view/settings-form.php:987
516
- msgid "Variable product attributes"
517
  msgstr ""
518
 
519
- #: view/settings-form.php:1019
520
- msgid "Item meta data"
521
  msgstr ""
522
 
523
- #: view/settings-form.php:1060
524
- msgid "Filter by customers"
525
  msgstr ""
526
 
527
- #: view/settings-form.php:1064
528
- msgid "Usernames"
529
  msgstr ""
530
 
531
- #: view/settings-form.php:1078
532
- msgid "User roles"
533
  msgstr ""
534
 
535
- #: view/settings-form.php:1130
536
- msgid "Filter by coupons"
537
  msgstr ""
538
 
539
- #: view/settings-form.php:1136
540
- msgid "Any coupon used"
541
  msgstr ""
542
 
543
- #: view/settings-form.php:1139
544
- #: classes/admin/class-wc-order-export-manage.php:684
545
- #: classes/core/class-wc-order-export-data-extractor-ui.php:965
546
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1172
547
- msgid "Coupons"
548
  msgstr ""
549
 
550
- #: view/settings-form.php:1157
551
- msgid "Filter by billing"
 
552
  msgstr ""
553
 
554
- #: view/settings-form.php:1160
555
- msgid "Billing locations"
556
  msgstr ""
557
 
558
- #: view/settings-form.php:1188
559
- msgid "Payment methods"
560
  msgstr ""
561
 
562
- #: view/settings-form.php:1204
563
- msgid "Filter by shipping"
 
564
  msgstr ""
565
 
566
- #: view/settings-form.php:1207
567
- msgid "Shipping locations"
 
 
 
568
  msgstr ""
569
 
570
- #: view/settings-form.php:1235
571
- msgid "Shipping methods"
572
  msgstr ""
573
 
574
- #: view/settings-form.php:1251
575
- msgid "Filter by item and metadata"
576
  msgstr ""
577
 
578
- #: view/settings-form.php:1254
579
- msgid "Item names"
580
  msgstr ""
581
 
582
- #: view/settings-form.php:1284
583
- msgid "Item metadata"
584
  msgstr ""
585
 
586
- #: view/settings-form.php:1324
587
- msgid "Set up fields to export"
588
  msgstr ""
589
 
590
- #: view/settings-form.php:1337
591
- msgid "Turn off mode Summary report to export order fields"
 
592
  msgstr ""
593
 
594
- #: view/settings-form.php:1344
595
- msgid "Drag rows to reorder exported fields"
596
  msgstr ""
597
 
598
- #: view/settings-form.php:1350
599
- msgid "Remove all fields"
600
  msgstr ""
601
 
602
- #: view/settings-form.php:1377
603
- msgid "Actions"
604
  msgstr ""
605
 
606
- #: view/settings-form.php:1380
607
- msgid "Add field"
608
  msgstr ""
609
 
610
- #: view/settings-form.php:1383
611
- msgid "Add static field"
612
  msgstr ""
613
 
614
- #: view/settings-form.php:1388 view/settings-form.php:1482
615
- msgid ""
616
- "The plugin fetches meta keys from the existing orders. So you should create "
617
- "fake order if you've added new field just now."
618
  msgstr ""
619
 
620
- #: view/settings-form.php:1390 view/settings-form.php:1447
621
- #: view/settings-form.php:1548
622
- msgid "Meta key"
623
  msgstr ""
624
 
625
- #: view/settings-form.php:1401 view/settings-form.php:1458
626
- #: view/settings-form.php:1492 view/settings-form.php:1557
627
- msgid "or type meta key here"
628
  msgstr ""
629
 
630
- #: view/settings-form.php:1406 view/settings-form.php:1463
631
- #: view/settings-form.php:1497 view/settings-form.php:1551
632
- msgid "Hide unused fields"
633
  msgstr ""
634
 
635
- #: view/settings-form.php:1410 view/settings-form.php:1426
636
- #: view/settings-form.php:1467 view/settings-form.php:1513
637
- #: view/settings-form.php:1527 view/settings-form.php:1560
638
- #: view/settings-form.php:1575
639
- msgid "Column name"
640
  msgstr ""
641
 
642
- #: view/settings-form.php:1418 view/settings-form.php:1439
643
- #: view/settings-form.php:1475 view/settings-form.php:1519
644
- #: view/settings-form.php:1541 view/settings-form.php:1567
645
- #: view/settings-form.php:1589
646
- msgid "Confirm"
647
  msgstr ""
648
 
649
- #: view/settings-form.php:1420 view/settings-form.php:1441
650
- #: view/settings-form.php:1477 view/settings-form.php:1521
651
- #: view/settings-form.php:1543 view/settings-form.php:1569
652
- #: view/settings-form.php:1592
653
- msgid "Cancel"
654
  msgstr ""
655
 
656
- #: view/settings-form.php:1431 view/settings-form.php:1532
657
- #: view/settings-form.php:1580
658
- msgid "Value"
659
  msgstr ""
660
 
661
- #: view/settings-form.php:1483
662
- msgid "Product fields"
663
  msgstr ""
664
 
665
- #: view/settings-form.php:1487
666
- msgid "Order item fields"
667
  msgstr ""
668
 
669
- #: view/settings-form.php:1500
670
- msgid "OR"
671
  msgstr ""
672
 
673
- #: view/settings-form.php:1502
674
- msgid "Taxonomy"
675
  msgstr ""
676
 
677
- #: view/settings-form.php:1620
678
- #, php-format
679
- msgid ""
680
- "If you see this message after page load, user interface won't work correctly!"
681
- "<br>There is a JS error (<a target=blank href='%s'>read here</a> how to view "
682
- "it). Probably, it's a conflict with another plugin or active theme."
683
  msgstr ""
684
 
685
- #: view/settings-form.php:1626
686
- msgid "Preview"
687
  msgstr ""
688
 
689
- #: view/settings-form.php:1627
690
- msgid "Might be different from actual export!"
691
  msgstr ""
692
 
693
- #: view/settings-form.php:1630 view/settings-form.php:1635
694
- msgid "Save settings"
695
  msgstr ""
696
 
697
- #: view/settings-form.php:1633
698
- msgid "Save & Exit"
699
  msgstr ""
700
 
701
- #: view/settings-form.php:1640
702
- msgid "Export"
703
  msgstr ""
704
 
705
- #: view/settings-form.php:1644
706
- msgid "Export [w/o progressbar]"
707
  msgstr ""
708
 
709
- #: view/settings-form.php:1645
710
- msgid "It might not work for huge datasets!"
711
  msgstr ""
712
 
713
- #: view/settings-form.php:1652
714
- msgid "Reset settings"
715
  msgstr ""
716
 
717
- #: view/settings-form.php:1656
718
- #, php-format
719
- msgid "Export total: %s orders"
720
  msgstr ""
721
 
722
- #: view/settings-form.php:1658
723
- msgid "Preview size"
724
  msgstr ""
725
 
726
- #: view/settings-form.php:1665 view/tab/tools.php:86
727
- msgid "Settings were successfully updated!"
728
  msgstr ""
729
 
730
- #: view/settings-form.php:1670
731
- msgid "Press 'Esc' to cancel the export"
732
  msgstr ""
733
 
734
- #: view/settings-form.php:1671
735
- msgid "Click here to download"
736
  msgstr ""
737
 
738
- #: view/main.php:8
739
- msgid "Settings saved"
740
  msgstr ""
741
 
742
- #: classes/class-wc-order-export-admin.php:93
743
- msgid "Export Status"
744
  msgstr ""
745
 
746
- #: classes/class-wc-order-export-admin.php:128
747
- msgid ""
748
- "Advanced Order Export For WooCommerce is available <a href=\"admin.php?"
749
- "page=wc-order-export\">on this page</a>."
750
  msgstr ""
751
 
752
- #: classes/class-wc-order-export-admin.php:137
753
- msgid "Settings"
754
  msgstr ""
755
 
756
- #: classes/class-wc-order-export-admin.php:138
757
- msgid "Docs"
 
758
  msgstr ""
759
 
760
- #: classes/class-wc-order-export-admin.php:140
761
- msgid "Support"
762
  msgstr ""
763
 
764
- #: classes/class-wc-order-export-admin.php:155
765
- #: classes/class-wc-order-export-admin.php:156
766
- #: classes/class-wc-order-export-admin.php:160
767
- #: classes/class-wc-order-export-admin.php:161
768
- msgid "Export Orders"
769
  msgstr ""
770
 
771
- #: classes/class-wc-order-export-admin.php:211
772
  #, php-format
773
- msgid "Add %s fields"
 
 
 
774
  msgstr ""
775
 
776
- #: classes/class-wc-order-export-admin.php:213
777
- msgid "rows"
778
  msgstr ""
779
 
780
- #: classes/class-wc-order-export-admin.php:214
781
- msgid "columns"
782
  msgstr ""
783
 
784
- #: classes/class-wc-order-export-admin.php:215
785
- msgid "one row"
786
  msgstr ""
787
 
788
- #: classes/class-wc-order-export-admin.php:218
789
- msgid "Add"
790
  msgstr ""
791
 
792
- #: classes/class-wc-order-export-admin.php:219
793
- msgid "as"
794
  msgstr ""
795
 
796
- #: classes/class-wc-order-export-admin.php:220
797
- msgid "Split values by"
798
  msgstr ""
799
 
800
- #: classes/class-wc-order-export-admin.php:221
801
- msgid "Fill order columns for"
802
  msgstr ""
803
 
804
- #: classes/class-wc-order-export-admin.php:222
805
- msgid "all rows"
806
  msgstr ""
807
 
808
- #: classes/class-wc-order-export-admin.php:223
809
- msgid "1st row only"
810
  msgstr ""
811
 
812
- #: classes/class-wc-order-export-admin.php:225
813
- msgid "Grouping by product"
814
  msgstr ""
815
 
816
- #: classes/class-wc-order-export-admin.php:226
817
- msgid "Grouping by coupon"
818
  msgstr ""
819
 
820
- #: classes/class-wc-order-export-admin.php:230
821
- msgid "Set up product fields"
822
- msgstr ""
823
-
824
- #: classes/class-wc-order-export-admin.php:231
825
- msgid "Set up coupon fields"
826
  msgstr ""
827
 
828
- #: classes/class-wc-order-export-admin.php:232
829
- msgid "products"
830
  msgstr ""
831
 
832
- #: classes/class-wc-order-export-admin.php:233
833
- msgid "coupons"
834
  msgstr ""
835
 
836
- #: classes/class-wc-order-export-admin.php:235
837
- msgid "Remove all fields?"
838
  msgstr ""
839
 
840
- #: classes/class-wc-order-export-admin.php:236
841
- msgid ""
842
- "This action will reset filters, settings and fields to default state. Are "
843
- "you sure?"
844
  msgstr ""
845
 
846
- #: classes/class-wc-order-export-admin.php:284
847
- msgid "empty column name"
848
  msgstr ""
849
 
850
- #: classes/class-wc-order-export-admin.php:285
851
- msgid "empty meta key"
852
  msgstr ""
853
 
854
- #: classes/class-wc-order-export-admin.php:286
855
- msgid "select product field or item field or taxonomy"
856
  msgstr ""
857
 
858
- #: classes/class-wc-order-export-admin.php:288
859
- msgid "empty value"
860
  msgstr ""
861
 
862
- #: classes/class-wc-order-export-admin.php:289
863
- msgid "title is empty"
864
  msgstr ""
865
 
866
- #: classes/class-wc-order-export-admin.php:290
867
- msgid "Date From is greater than Date To"
868
  msgstr ""
869
 
870
- #: classes/class-wc-order-export-admin.php:291
871
- msgid "Please, set up fields to export"
872
  msgstr ""
873
 
874
- #: classes/class-wc-order-export-admin.php:292
875
- #: classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php:98
876
- msgid "Nothing to export. Please, adjust your filters"
877
  msgstr ""
878
 
879
- #: classes/class-wc-order-export-admin.php:294
880
- #: classes/core/class-wc-order-export-data-extractor.php:235
881
- msgid "empty"
882
  msgstr ""
883
 
884
- #: classes/class-wc-order-export-admin.php:390
885
- msgid "You can not do it"
886
  msgstr ""
887
 
888
- #: classes/class-wc-order-export-admin.php:394
889
- msgid "Empty method"
890
  msgstr ""
891
 
892
- #: classes/class-wc-order-export-admin.php:403
893
- #, php-format
894
- msgid "Unknown AJAX method %s"
895
  msgstr ""
896
 
897
- #: classes/class-wc-order-export-admin.php:411
898
- #, php-format
899
- msgid "Unknown tab method %s"
900
  msgstr ""
901
 
902
- #: classes/class-wc-order-export-admin.php:415
903
- msgid "Wrong nonce"
904
  msgstr ""
905
 
906
- #: classes/class-wc-order-export-admin.php:442
907
  #, php-format
908
- msgid "Export as %s"
 
909
  msgstr ""
910
 
911
- #: classes/class-wc-order-export-admin.php:448
 
 
 
 
912
  msgid "Mark exported"
913
  msgstr ""
914
 
915
- #: classes/class-wc-order-export-admin.php:449
916
- msgid "Unmark exported"
917
  msgstr ""
918
 
919
- #: classes/class-wc-order-export-admin.php:497
920
- #, php-format
921
- msgid "%s order marked."
922
- msgid_plural "%s orders marked."
923
- msgstr[0] ""
924
- msgstr[1] ""
925
 
926
- #: classes/class-wc-order-export-admin.php:506
927
- #, php-format
928
- msgid "%s order unmarked."
929
- msgid_plural "%s orders unmarked."
930
- msgstr[0] ""
931
- msgstr[1] ""
932
 
933
- #: view/tab/tools.php:29
934
- msgid "Export settings"
935
  msgstr ""
936
 
937
- #: view/tab/tools.php:32
938
- msgid ""
939
- "Copy these settings and use it to migrate plugin to another WordPress "
940
- "install."
941
  msgstr ""
942
 
943
- #: view/tab/tools.php:38
944
- msgid "All"
945
  msgstr ""
946
 
947
- #: view/tab/tools.php:42
948
- #: classes/admin/tabs/class-wc-order-export-admin-tab-export-now.php:10
949
- msgid "Export now"
950
  msgstr ""
951
 
952
- #: view/tab/tools.php:54
953
- msgid "Just click inside the textarea and copy (Ctrl+C)"
954
  msgstr ""
955
 
956
- #: view/tab/tools.php:63
957
- msgid "Import settings"
958
  msgstr ""
959
 
960
- #: view/tab/tools.php:66
961
- msgid ""
962
- "Paste text into this field to import settings into the current WordPress "
963
- "install."
964
  msgstr ""
965
 
966
- #: view/tab/tools.php:72
967
- msgid ""
968
- "This process will overwrite your settings for \"Advanced Order Export For "
969
- "WooCommerce\" !"
970
  msgstr ""
971
 
972
- #: view/tab/tools.php:82
973
- msgid "Import"
 
974
  msgstr ""
975
 
976
- #: view/tab/tools.php:132
977
- msgid "Are you sure to continue?"
978
  msgstr ""
979
 
980
- #: view/tab/order-actions.php:5 view/tab/profiles.php:5
981
- #: view/tab/schedules.php:5
982
- msgid "Pro version"
983
  msgstr ""
984
 
985
- #: view/tab/order-actions.php:7
986
- #, php-format
987
- msgid "Buy %s to get access to Status change jobs"
988
  msgstr ""
989
 
990
- #: view/tab/help.php:6
991
- msgid "settings"
 
992
  msgstr ""
993
 
994
- #: view/tab/help.php:8
995
- msgid "code snippets"
 
996
  msgstr ""
997
 
998
- #: view/tab/help.php:10
999
- msgid "this page"
 
1000
  msgstr ""
1001
 
1002
- #: view/tab/help.php:16
1003
- msgid "Need help? Create ticket in"
1004
  msgstr ""
1005
 
1006
- #: view/tab/help.php:17
1007
- msgid "helpdesk system"
1008
  msgstr ""
1009
 
1010
- #: view/tab/help.php:21
1011
- #, php-format
1012
- msgid ""
1013
- "Don't forget to attach your %s or some screenshots. It will significantly "
1014
- "reduce reply time :)"
1015
  msgstr ""
1016
 
1017
- #: view/tab/help.php:24
1018
- #, php-format
1019
- msgid ""
1020
- "Look at %s for popular plugins or check %s to study how to extend the plugin."
1021
  msgstr ""
1022
 
1023
- #: view/tab/profiles.php:7
1024
- #, php-format
1025
- msgid "Buy %s to get access to profiles"
1026
  msgstr ""
1027
 
1028
- #: view/tab/schedules.php:7
1029
- #, php-format
1030
- msgid "Buy %s to get access to Scheduled jobs"
1031
  msgstr ""
1032
 
1033
- #: classes/formats/abstract-class-woe-formatter-sv.php:102
1034
- #: classes/formats/class-woe-formatter-html.php:120
1035
- #: classes/formats/class-woe-formatter-xls.php:238
1036
- msgid "No results"
1037
  msgstr ""
1038
 
1039
- #: classes/formats/abstract-class-woe-formatter.php:49
1040
- msgid "can not open for output"
1041
  msgstr ""
1042
 
1043
- #: classes/formats/class-woe-formatter-xls.php:132
1044
- #: classes/admin/class-wc-order-export-manage.php:235
1045
- msgid "Orders"
1046
  msgstr ""
1047
 
1048
- #: classes/admin/class-wc-order-export-manage.php:21
1049
- msgid "Sun"
1050
  msgstr ""
1051
 
1052
- #: classes/admin/class-wc-order-export-manage.php:22
1053
- msgid "Mon"
1054
  msgstr ""
1055
 
1056
- #: classes/admin/class-wc-order-export-manage.php:23
1057
- msgid "Tue"
1058
  msgstr ""
1059
 
1060
- #: classes/admin/class-wc-order-export-manage.php:24
1061
- msgid "Wed"
1062
  msgstr ""
1063
 
1064
- #: classes/admin/class-wc-order-export-manage.php:25
1065
- msgid "Thu"
1066
  msgstr ""
1067
 
1068
- #: classes/admin/class-wc-order-export-manage.php:26
1069
- msgid "Fri"
1070
  msgstr ""
1071
 
1072
- #: classes/admin/class-wc-order-export-manage.php:27
1073
- msgid "Sat"
1074
  msgstr ""
1075
 
1076
- #: classes/admin/class-wc-order-export-manage.php:641
1077
- #: classes/core/class-wc-order-export-data-extractor-ui.php:953
1078
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1171
1079
- msgid "Products"
1080
  msgstr ""
1081
 
1082
- #: classes/core/class-wc-order-export-data-extractor-ui.php:330
1083
- msgid "Item ID"
1084
  msgstr ""
1085
 
1086
- #: classes/core/class-wc-order-export-data-extractor-ui.php:335
1087
- msgid "Item #"
1088
  msgstr ""
1089
 
1090
- #: classes/core/class-wc-order-export-data-extractor-ui.php:340
1091
- msgid "SKU"
1092
  msgstr ""
1093
 
1094
- #: classes/core/class-wc-order-export-data-extractor-ui.php:345
1095
- msgid "Item Name"
1096
  msgstr ""
1097
 
1098
- #: classes/core/class-wc-order-export-data-extractor-ui.php:350
1099
- msgid "Product Id"
1100
  msgstr ""
1101
 
1102
- #: classes/core/class-wc-order-export-data-extractor-ui.php:355
1103
- msgid "Product Name"
1104
  msgstr ""
1105
 
1106
- #: classes/core/class-wc-order-export-data-extractor-ui.php:360
1107
- msgid "Product Name (main)"
1108
  msgstr ""
1109
 
1110
- #: classes/core/class-wc-order-export-data-extractor-ui.php:365
1111
- msgid "Variation Id"
1112
  msgstr ""
1113
 
1114
- #: classes/core/class-wc-order-export-data-extractor-ui.php:370
1115
- msgid "Product Variation"
1116
  msgstr ""
1117
 
1118
- #: classes/core/class-wc-order-export-data-extractor-ui.php:375
1119
- msgid "Item Seller"
1120
  msgstr ""
1121
 
1122
- #: classes/core/class-wc-order-export-data-extractor-ui.php:380
1123
- msgid "Quantity"
1124
  msgstr ""
1125
 
1126
- #: classes/core/class-wc-order-export-data-extractor-ui.php:385
1127
- msgid "Quantity (- Refund)"
1128
  msgstr ""
1129
 
1130
- #: classes/core/class-wc-order-export-data-extractor-ui.php:390
1131
- msgid "Item Cost"
1132
  msgstr ""
1133
 
1134
- #: classes/core/class-wc-order-export-data-extractor-ui.php:395
1135
- msgid "Product Current Price"
1136
  msgstr ""
1137
 
1138
- #: classes/core/class-wc-order-export-data-extractor-ui.php:400
1139
- msgid "Order Line (w/o tax)"
1140
  msgstr ""
1141
 
1142
- #: classes/core/class-wc-order-export-data-extractor-ui.php:405
1143
- msgid "Order Line Tax"
1144
  msgstr ""
1145
 
1146
- #: classes/core/class-wc-order-export-data-extractor-ui.php:410
1147
- msgid "Order Line Tax Refunded"
1148
  msgstr ""
1149
 
1150
- #: classes/core/class-wc-order-export-data-extractor-ui.php:415
1151
- msgid "Order Line Tax (- Refund)"
1152
  msgstr ""
1153
 
1154
- #: classes/core/class-wc-order-export-data-extractor-ui.php:420
1155
- msgid "Order Line Subtotal"
1156
  msgstr ""
1157
 
1158
- #: classes/core/class-wc-order-export-data-extractor-ui.php:425
1159
- msgid "Order Line Subtotal Tax"
1160
  msgstr ""
1161
 
1162
- #: classes/core/class-wc-order-export-data-extractor-ui.php:430
1163
- msgid "Order Line Total"
1164
  msgstr ""
1165
 
1166
- #: classes/core/class-wc-order-export-data-extractor-ui.php:435
1167
- msgid "Order Line Total (include tax)"
1168
  msgstr ""
1169
 
1170
- #: classes/core/class-wc-order-export-data-extractor-ui.php:440
1171
- msgid "Order Line Total Refunded"
1172
  msgstr ""
1173
 
1174
- #: classes/core/class-wc-order-export-data-extractor-ui.php:445
1175
- msgid "Order Line Total (- Refund)"
 
1176
  msgstr ""
1177
 
1178
- #: classes/core/class-wc-order-export-data-extractor-ui.php:450
1179
- msgid "Item Discount Amount"
1180
  msgstr ""
1181
 
1182
- #: classes/core/class-wc-order-export-data-extractor-ui.php:455
1183
- msgid "Item Tax Rate"
1184
  msgstr ""
1185
 
1186
- #: classes/core/class-wc-order-export-data-extractor-ui.php:460
1187
- msgid "Type"
1188
  msgstr ""
1189
 
1190
- #: classes/core/class-wc-order-export-data-extractor-ui.php:465
1191
- msgid "Category"
 
 
1192
  msgstr ""
1193
 
1194
- #: classes/core/class-wc-order-export-data-extractor-ui.php:470
1195
- msgid "Tags"
1196
  msgstr ""
1197
 
1198
- #: classes/core/class-wc-order-export-data-extractor-ui.php:475
1199
- msgid "Width"
1200
  msgstr ""
1201
 
1202
- #: classes/core/class-wc-order-export-data-extractor-ui.php:480
1203
- msgid "Length"
1204
  msgstr ""
1205
 
1206
- #: classes/core/class-wc-order-export-data-extractor-ui.php:485
1207
- msgid "Height"
1208
  msgstr ""
1209
 
1210
- #: classes/core/class-wc-order-export-data-extractor-ui.php:490
1211
- msgid "Weight"
1212
  msgstr ""
1213
 
1214
- #: classes/core/class-wc-order-export-data-extractor-ui.php:495
1215
- msgid "Product URL"
1216
  msgstr ""
1217
 
1218
- #: classes/core/class-wc-order-export-data-extractor-ui.php:500
1219
- msgid "Download URL"
1220
  msgstr ""
1221
 
1222
- #: classes/core/class-wc-order-export-data-extractor-ui.php:505
1223
- msgid "Item download URL"
 
1224
  msgstr ""
1225
 
1226
- #: classes/core/class-wc-order-export-data-extractor-ui.php:510
1227
- msgid "Image URL"
 
 
1228
  msgstr ""
1229
 
1230
- #: classes/core/class-wc-order-export-data-extractor-ui.php:515
1231
- msgid "Product Shipping Class"
1232
  msgstr ""
1233
 
1234
- #: classes/core/class-wc-order-export-data-extractor-ui.php:520
1235
- msgid "Description"
1236
  msgstr ""
1237
 
1238
- #: classes/core/class-wc-order-export-data-extractor-ui.php:525
1239
- msgid "Short Description"
1240
  msgstr ""
1241
 
1242
- #: classes/core/class-wc-order-export-data-extractor-ui.php:530
1243
- msgid "Full names for categories"
1244
  msgstr ""
1245
 
1246
- #: classes/core/class-wc-order-export-data-extractor-ui.php:535
1247
- msgid "Summary Report Total Quantity"
1248
  msgstr ""
1249
 
1250
- #: classes/core/class-wc-order-export-data-extractor-ui.php:540
1251
- msgid "Summary Report Total Amount"
 
 
1252
  msgstr ""
1253
 
1254
- #: classes/core/class-wc-order-export-data-extractor-ui.php:545
1255
- msgid "Embedded Product Image"
 
 
1256
  msgstr ""
1257
 
1258
- #: classes/core/class-wc-order-export-data-extractor-ui.php:550
1259
- msgid "Summary Report Total Discount"
1260
  msgstr ""
1261
 
1262
- #: classes/core/class-wc-order-export-data-extractor-ui.php:555
1263
- msgid "Summary Report Total Refund Count"
1264
  msgstr ""
1265
 
1266
- #: classes/core/class-wc-order-export-data-extractor-ui.php:560
1267
- msgid "Summary Report Total Refund Amount"
1268
  msgstr ""
1269
 
1270
- #: classes/core/class-wc-order-export-data-extractor-ui.php:577
1271
- msgid "Coupon Code"
1272
  msgstr ""
1273
 
1274
- #: classes/core/class-wc-order-export-data-extractor-ui.php:582
1275
- msgid "Discount Amount"
1276
  msgstr ""
1277
 
1278
- #: classes/core/class-wc-order-export-data-extractor-ui.php:587
1279
- msgid "Discount Amount Tax"
1280
  msgstr ""
1281
 
1282
- #: classes/core/class-wc-order-export-data-extractor-ui.php:592
1283
- msgid "Discount Amount + Tax"
1284
  msgstr ""
1285
 
1286
- #: classes/core/class-wc-order-export-data-extractor-ui.php:597
1287
- msgid "Coupon Description"
1288
  msgstr ""
1289
 
1290
- #: classes/core/class-wc-order-export-data-extractor-ui.php:601
1291
- msgid "Coupon Type"
1292
  msgstr ""
1293
 
1294
- #: classes/core/class-wc-order-export-data-extractor-ui.php:606
1295
- msgid "Coupon Amount"
 
1296
  msgstr ""
1297
 
1298
- #: classes/core/class-wc-order-export-data-extractor-ui.php:657
1299
- msgid "Line number"
1300
  msgstr ""
1301
 
1302
- #: classes/core/class-wc-order-export-data-extractor-ui.php:667
1303
- msgid "Order Number"
1304
  msgstr ""
1305
 
1306
- #: classes/core/class-wc-order-export-data-extractor-ui.php:672
1307
- msgid "Order Status"
1308
  msgstr ""
1309
 
1310
- #: classes/core/class-wc-order-export-data-extractor-ui.php:687
1311
- msgid "Transaction ID"
1312
  msgstr ""
1313
 
1314
- #: classes/core/class-wc-order-export-data-extractor-ui.php:692
1315
- msgid "Currency"
1316
  msgstr ""
1317
 
1318
- #: classes/core/class-wc-order-export-data-extractor-ui.php:707
1319
- msgid "Date of first refund"
1320
  msgstr ""
1321
 
1322
- #: classes/core/class-wc-order-export-data-extractor-ui.php:712
1323
- msgid "Customer Note"
1324
  msgstr ""
1325
 
1326
- #: classes/core/class-wc-order-export-data-extractor-ui.php:717
1327
- msgid "Order Notes"
1328
  msgstr ""
1329
 
1330
- #: classes/core/class-wc-order-export-data-extractor-ui.php:722
1331
- msgid "Link to edit order"
1332
  msgstr ""
1333
 
1334
- #: classes/core/class-wc-order-export-data-extractor-ui.php:732
1335
- msgid "Customer IP address"
1336
  msgstr ""
1337
 
1338
- #: classes/core/class-wc-order-export-data-extractor-ui.php:737
1339
- msgid "Customer User ID"
1340
  msgstr ""
1341
 
1342
- #: classes/core/class-wc-order-export-data-extractor-ui.php:742
1343
- msgid "Customer Username"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1344
  msgstr ""
1345
 
1346
- #: classes/core/class-wc-order-export-data-extractor-ui.php:747
1347
- msgid "User Website"
1348
  msgstr ""
1349
 
1350
- #: classes/core/class-wc-order-export-data-extractor-ui.php:752
1351
- msgid "Customer User Email"
1352
  msgstr ""
1353
 
1354
- #: classes/core/class-wc-order-export-data-extractor-ui.php:757
1355
- msgid "Customer Role"
1356
  msgstr ""
1357
 
1358
- #: classes/core/class-wc-order-export-data-extractor-ui.php:762
1359
- msgid "Customer Total Orders"
1360
  msgstr ""
1361
 
1362
- #: classes/core/class-wc-order-export-data-extractor-ui.php:767
1363
- msgid "Customer first order date"
1364
  msgstr ""
1365
 
1366
- #: classes/core/class-wc-order-export-data-extractor-ui.php:772
1367
- msgid "Customer last order date"
1368
  msgstr ""
1369
 
1370
- #: classes/core/class-wc-order-export-data-extractor-ui.php:782
1371
- msgid "First Name (Billing)"
1372
  msgstr ""
1373
 
1374
- #: classes/core/class-wc-order-export-data-extractor-ui.php:787
1375
- msgid "Last Name (Billing)"
1376
  msgstr ""
1377
 
1378
- #: classes/core/class-wc-order-export-data-extractor-ui.php:792
1379
- msgid "Full Name (Billing)"
1380
  msgstr ""
1381
 
1382
- #: classes/core/class-wc-order-export-data-extractor-ui.php:797
1383
- msgid "Company (Billing)"
1384
  msgstr ""
1385
 
1386
- #: classes/core/class-wc-order-export-data-extractor-ui.php:802
1387
- msgid "Address 1&2 (Billing)"
1388
  msgstr ""
1389
 
1390
- #: classes/core/class-wc-order-export-data-extractor-ui.php:807
1391
- msgid "Address 1 (Billing)"
1392
  msgstr ""
1393
 
1394
- #: classes/core/class-wc-order-export-data-extractor-ui.php:812
1395
- msgid "Address 2 (Billing)"
1396
  msgstr ""
1397
 
1398
- #: classes/core/class-wc-order-export-data-extractor-ui.php:817
1399
- msgid "City (Billing)"
1400
  msgstr ""
1401
 
1402
- #: classes/core/class-wc-order-export-data-extractor-ui.php:822
1403
- msgid "State Code (Billing)"
1404
  msgstr ""
1405
 
1406
- #: classes/core/class-wc-order-export-data-extractor-ui.php:827
1407
- msgid "City, State, Zip (Billing)"
1408
  msgstr ""
1409
 
1410
- #: classes/core/class-wc-order-export-data-extractor-ui.php:832
1411
- msgid "City, State Zip (Billing)"
1412
  msgstr ""
1413
 
1414
- #: classes/core/class-wc-order-export-data-extractor-ui.php:837
1415
- msgid "State Name (Billing)"
1416
  msgstr ""
1417
 
1418
- #: classes/core/class-wc-order-export-data-extractor-ui.php:842
1419
- msgid "Postcode (Billing)"
1420
  msgstr ""
1421
 
1422
- #: classes/core/class-wc-order-export-data-extractor-ui.php:847
1423
- msgid "Country Code (Billing)"
1424
  msgstr ""
1425
 
1426
- #: classes/core/class-wc-order-export-data-extractor-ui.php:852
1427
- msgid "Country Name (Billing)"
1428
  msgstr ""
1429
 
1430
- #: classes/core/class-wc-order-export-data-extractor-ui.php:857
1431
- msgid "Email (Billing)"
1432
  msgstr ""
1433
 
1434
- #: classes/core/class-wc-order-export-data-extractor-ui.php:862
1435
- msgid "Phone (Billing)"
1436
  msgstr ""
1437
 
1438
- #: classes/core/class-wc-order-export-data-extractor-ui.php:872
1439
- msgid "First Name (Shipping)"
1440
  msgstr ""
1441
 
1442
- #: classes/core/class-wc-order-export-data-extractor-ui.php:877
1443
- msgid "Last Name (Shipping)"
1444
  msgstr ""
1445
 
1446
- #: classes/core/class-wc-order-export-data-extractor-ui.php:882
1447
- msgid "Full Name (Shipping)"
1448
  msgstr ""
1449
 
1450
- #: classes/core/class-wc-order-export-data-extractor-ui.php:887
1451
- msgid "Company (Shipping)"
1452
  msgstr ""
1453
 
1454
- #: classes/core/class-wc-order-export-data-extractor-ui.php:892
1455
- msgid "Address 1&2 (Shipping)"
 
1456
  msgstr ""
1457
 
1458
- #: classes/core/class-wc-order-export-data-extractor-ui.php:897
1459
- msgid "Address 1 (Shipping)"
1460
  msgstr ""
1461
 
1462
- #: classes/core/class-wc-order-export-data-extractor-ui.php:902
1463
- msgid "Address 2 (Shipping)"
1464
  msgstr ""
1465
 
1466
- #: classes/core/class-wc-order-export-data-extractor-ui.php:907
1467
- msgid "City (Shipping)"
1468
  msgstr ""
1469
 
1470
- #: classes/core/class-wc-order-export-data-extractor-ui.php:912
1471
  msgid "State Code (Shipping)"
1472
  msgstr ""
1473
 
1474
- #: classes/core/class-wc-order-export-data-extractor-ui.php:917
1475
- msgid "City, State, Zip (Shipping)"
1476
- msgstr ""
1477
-
1478
- #: classes/core/class-wc-order-export-data-extractor-ui.php:922
1479
- msgid "City, State Zip (Shipping)"
1480
  msgstr ""
1481
 
1482
- #: classes/core/class-wc-order-export-data-extractor-ui.php:927
1483
  msgid "State Name (Shipping)"
1484
  msgstr ""
1485
 
1486
- #: classes/core/class-wc-order-export-data-extractor-ui.php:932
1487
- msgid "Postcode (Shipping)"
1488
  msgstr ""
1489
 
1490
- #: classes/core/class-wc-order-export-data-extractor-ui.php:937
1491
- msgid "Country Code (Shipping)"
1492
  msgstr ""
1493
 
1494
- #: classes/core/class-wc-order-export-data-extractor-ui.php:942
1495
- msgid "Country Name (Shipping)"
1496
  msgstr ""
1497
 
1498
- #: classes/core/class-wc-order-export-data-extractor-ui.php:976
1499
- msgid "Shipping Method Title"
1500
  msgstr ""
1501
 
1502
- #: classes/core/class-wc-order-export-data-extractor-ui.php:981
1503
- msgid "Shipping Method"
1504
  msgstr ""
1505
 
1506
- #: classes/core/class-wc-order-export-data-extractor-ui.php:986
1507
- msgid "Shipping Method (no id)"
 
1508
  msgstr ""
1509
 
1510
- #: classes/core/class-wc-order-export-data-extractor-ui.php:991
1511
- msgid "Payment Method Title"
1512
  msgstr ""
1513
 
1514
- #: classes/core/class-wc-order-export-data-extractor-ui.php:996
1515
- msgid "Payment Method"
1516
  msgstr ""
1517
 
1518
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1001
1519
- msgid "Coupons Used"
1520
  msgstr ""
1521
 
1522
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1006
1523
- msgid "Cart Discount Amount"
1524
  msgstr ""
1525
 
1526
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1011
1527
- msgid "Cart Discount Amount Tax"
 
1528
  msgstr ""
1529
 
1530
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1016
1531
- msgid "Order Subtotal Amount"
 
1532
  msgstr ""
1533
 
1534
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1021
1535
- msgid "Order Subtotal - Cart Discount"
1536
  msgstr ""
1537
 
1538
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1026
1539
- msgid "Order Subtotal Amount Refunded"
1540
  msgstr ""
1541
 
1542
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1031
1543
- msgid "Order Subtotal Amount (- Refund)"
1544
  msgstr ""
1545
 
1546
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1036
1547
- msgid "Order Tax Amount"
1548
  msgstr ""
1549
 
1550
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1046
1551
- msgid "Order Shipping Amount"
1552
  msgstr ""
1553
 
1554
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1051
1555
- msgid "Order Shipping + Tax Amount"
1556
  msgstr ""
1557
 
1558
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1056
1559
- msgid "Order Shipping Amount Refunded"
1560
  msgstr ""
1561
 
1562
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1061
1563
- msgid "Order Shipping Amount (- Refund)"
1564
  msgstr ""
1565
 
1566
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1066
1567
- msgid "Order Shipping Tax Amount"
1568
  msgstr ""
1569
 
1570
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1071
1571
- msgid "Order Shipping Tax Refunded"
 
1572
  msgstr ""
1573
 
1574
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1076
1575
- msgid "Order Shipping Tax Amount (- Refund)"
 
 
1576
  msgstr ""
1577
 
1578
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1086
1579
- msgid "Order Total Fee"
 
 
1580
  msgstr ""
1581
 
1582
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1091
1583
- msgid "Order Refund Amount"
 
 
1584
  msgstr ""
1585
 
1586
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1096
1587
- msgid "Order Total Amount (- Refund)"
1588
  msgstr ""
1589
 
1590
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1101
1591
- msgid "Order Total Amount"
1592
  msgstr ""
1593
 
1594
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1106
1595
- msgid "Order Total Amount without Tax"
1596
  msgstr ""
1597
 
1598
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1111
1599
- msgid "Order Total Tax Amount"
 
 
1600
  msgstr ""
1601
 
1602
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1116
1603
- msgid "Order Total Tax Amount Refunded"
1604
  msgstr ""
1605
 
1606
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1121
1607
- msgid "Order Total Tax Amount (- Refund)"
1608
  msgstr ""
1609
 
1610
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1131
1611
- msgid "Total weight"
1612
  msgstr ""
1613
 
1614
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1136
1615
- msgid "Total items"
1616
  msgstr ""
1617
 
1618
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1141
1619
- msgid "Exported items"
1620
  msgstr ""
1621
 
1622
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1146
1623
- msgid "Total products"
1624
  msgstr ""
1625
 
1626
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1167
1627
- msgid "Common"
1628
  msgstr ""
1629
 
1630
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1168
1631
- msgid "User"
1632
  msgstr ""
1633
 
1634
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1169
1635
- msgid "Billing Address"
1636
  msgstr ""
1637
 
1638
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1170
1639
- msgid "Shipping Address"
1640
  msgstr ""
1641
 
1642
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1173
1643
- msgid "Cart"
1644
  msgstr ""
1645
 
1646
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1174
1647
- msgid "Shipping"
1648
  msgstr ""
1649
 
1650
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1175
1651
- msgid "Totals"
1652
  msgstr ""
1653
 
1654
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1176
1655
- msgid "Others"
1656
  msgstr ""
1657
 
1658
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1182
1659
- msgid "String"
 
1660
  msgstr ""
1661
 
1662
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1183
1663
- msgid "Money"
 
1664
  msgstr ""
1665
 
1666
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1184
1667
- msgid "Number"
1668
  msgstr ""
1669
 
1670
- #: classes/core/class-wc-order-export-data-extractor-ui.php:1186
1671
- msgid "Image"
1672
  msgstr ""
1673
 
1674
- #: classes/core/class-wc-order-export-data-extractor.php:1995
1675
- msgid "Edit order"
1676
  msgstr ""
1677
 
1678
- #: classes/core/class-wc-order-export-data-extractor.php:2177
1679
- msgid "[Rest of the World]"
1680
  msgstr ""
1681
 
1682
- #: classes/core/class-wc-order-export-engine.php:340
1683
- msgid "Don't Panic"
1684
  msgstr ""
1685
 
1686
- #: classes/core/class-wc-order-export-engine.php:341
1687
- #, php-format
1688
- msgid "The code you are trying to save produced a fatal error on line %d:"
1689
  msgstr ""
1690
 
1691
- #: classes/core/class-wc-order-export-engine.php:469
1692
- msgid "Main SQL queries are listed below"
1693
  msgstr ""
1694
 
1695
- #: classes/admin/tabs/class-wc-order-export-admin-tab-help.php:10
1696
- msgid "Help"
 
1697
  msgstr ""
1698
 
1699
- #: classes/admin/tabs/class-wc-order-export-admin-tab-status-change-jobs.php:10
1700
- msgid "Status change jobs"
1701
  msgstr ""
1702
 
1703
- #: classes/admin/tabs/class-wc-order-export-admin-tab-schedule-jobs.php:10
1704
- msgid "Scheduled jobs"
1705
  msgstr ""
1706
 
1707
- #: classes/admin/tabs/class-wc-order-export-admin-tab-profiles.php:10
1708
- msgid "Profiles"
1709
  msgstr ""
1710
 
1711
- #: classes/admin/tabs/class-wc-order-export-admin-tab-tools.php:10
1712
- msgid "Tools"
1713
  msgstr ""
1714
 
1715
- #: classes/admin/tabs/ajax/trait-wc-order-export-ajax-helpers.php:118
1716
- msgid "Can't find exported file"
1717
  msgstr ""
1718
 
1719
- #: classes/admin/tabs/ajax/class-wc-order-export-ajax.php:20
1720
- msgid "Profile required!"
1721
  msgstr ""
1722
 
1723
- #: classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php:36
1724
- msgid "Can't create temporary file"
1725
  msgstr ""
1726
 
1727
- #. Name of the plugin
1728
- msgid "Advanced Order Export For WooCommerce"
1729
  msgstr ""
1730
 
1731
- #. Description of the plugin
1732
- msgid "Export orders from WooCommerce with ease (Excel/CSV/XML/JSON supported)"
1733
  msgstr ""
1734
 
1735
- #. Author of the plugin
1736
- msgid "AlgolPlus"
1737
  msgstr ""
1738
 
1739
- #. Author URI of the plugin
1740
- msgid "https://algolplus.com/"
1741
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Advanced Order Export For WooCommerce\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2019-08-19 13:22+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9
  "Language-Team: \n"
15
  "X-Generator: Loco https://localise.biz/\n"
16
  "X-Loco-Version: 2.3.0; wp-5.2.2"
17
 
18
+ #: classes/class-wc-order-export-admin.php:504
19
+ #, php-format
20
+ msgid "%s order marked."
21
+ msgid_plural "%s orders marked."
22
+ msgstr[0] ""
23
+ msgstr[1] ""
24
 
25
+ #: classes/class-wc-order-export-admin.php:513
26
+ #, php-format
27
+ msgid "%s order unmarked."
28
+ msgid_plural "%s orders unmarked."
29
+ msgstr[0] ""
30
+ msgstr[1] ""
31
 
32
+ #: view/settings-form.php:46 view/settings-form.php:657
33
+ #: view/settings-form.php:683
34
  msgid "-"
35
  msgstr ""
36
 
37
+ #: view/settings-form.php:742
38
+ msgid "- don't modify -"
39
  msgstr ""
40
 
41
+ #: view/settings-form.php:537
42
+ msgid "0 - auto scale"
 
43
  msgstr ""
44
 
45
+ #: classes/class-wc-order-export-admin.php:228
46
+ msgid "1st row only"
 
47
  msgstr ""
48
 
49
+ #: classes/core/class-wc-order-export-data-extractor.php:2328
50
+ msgid "[Rest of the World]"
 
51
  msgstr ""
52
 
53
+ #: view/settings-form.php:1432 view/settings-form.php:1443
54
+ msgid "Actions"
 
55
  msgstr ""
56
 
57
+ #: classes/class-wc-order-export-admin.php:223
58
+ msgid "Add"
59
  msgstr ""
60
 
61
+ #: classes/class-wc-order-export-admin.php:216
62
+ #, php-format
63
+ msgid "Add %s fields"
64
  msgstr ""
65
 
66
+ #: view/settings-form.php:1446
67
+ msgid "Add fee"
68
  msgstr ""
69
 
70
+ #: view/settings-form.php:1435
71
+ msgid "Add field"
72
  msgstr ""
73
 
74
+ #: view/settings-form.php:1449
75
+ msgid "Add shipping"
76
  msgstr ""
77
 
78
+ #: view/settings-form.php:1438
79
+ msgid "Add static field"
80
  msgstr ""
81
 
82
+ #: view/settings-form.php:1452
83
+ msgid "Add tax"
84
  msgstr ""
85
 
86
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:821
87
+ msgid "Address 1 (Billing)"
88
  msgstr ""
89
 
90
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:911
91
+ msgid "Address 1 (Shipping)"
92
  msgstr ""
93
 
94
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:816
95
+ msgid "Address 1&2 (Billing)"
96
  msgstr ""
97
 
98
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:906
99
+ msgid "Address 1&2 (Shipping)"
 
 
100
  msgstr ""
101
 
102
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:826
103
+ msgid "Address 2 (Billing)"
104
  msgstr ""
105
 
106
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:916
107
+ msgid "Address 2 (Shipping)"
108
  msgstr ""
109
 
110
+ #. Name of the plugin
111
+ msgid "Advanced Order Export For WooCommerce"
112
  msgstr ""
113
 
114
+ #: classes/class-wc-order-export-admin.php:128
115
+ msgid ""
116
+ "Advanced Order Export For WooCommerce is available <a href=\"admin.php?"
117
+ "page=wc-order-export\">on this page</a>."
118
  msgstr ""
119
 
120
+ #. Author of the plugin
121
+ msgid "AlgolPlus"
122
  msgstr ""
123
 
124
+ #: view/tab/tools.php:38
125
+ msgid "All"
126
  msgstr ""
127
 
128
+ #: classes/class-wc-order-export-admin.php:227
129
+ msgid "all rows"
130
  msgstr ""
131
 
132
+ #: view/settings-form.php:1192
133
+ msgid "Any coupon used"
134
  msgstr ""
135
 
136
+ #: view/settings-form.php:343
137
+ msgid "Append XML"
138
  msgstr ""
139
 
140
+ #: view/tab/tools.php:132
141
+ msgid "Are you sure to continue?"
142
  msgstr ""
143
 
144
+ #: classes/class-wc-order-export-admin.php:224
145
+ msgid "as"
146
  msgstr ""
147
 
148
+ #: view/settings-form.php:726
149
+ msgid "Ascending"
150
  msgstr ""
151
 
152
+ #: view/settings-form.php:257
153
+ msgid "Auto column width"
154
  msgstr ""
155
 
156
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1187
157
+ msgid "Billing Address"
158
  msgstr ""
159
 
160
+ #: view/settings-form.php:1216
161
+ msgid "Billing locations"
162
  msgstr ""
163
 
164
+ #: view/tab/profiles.php:7
165
+ #, php-format
166
+ msgid "Buy %s to get access to profiles"
167
  msgstr ""
168
 
169
+ #: view/tab/schedules.php:7
170
+ #, php-format
171
+ msgid "Buy %s to get access to Scheduled jobs"
172
  msgstr ""
173
 
174
+ #: view/tab/order-actions.php:7
175
+ #, php-format
176
+ msgid "Buy %s to get access to Status change jobs"
177
  msgstr ""
178
 
179
+ #: classes/formats/abstract-class-woe-formatter.php:49
180
+ msgid "can not open for output"
181
  msgstr ""
182
 
183
+ #: classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php:36
184
+ msgid "Can't create temporary file"
185
  msgstr ""
186
 
187
+ #: classes/admin/tabs/ajax/trait-wc-order-export-ajax-helpers.php:118
188
+ msgid "Can't find exported file"
189
  msgstr ""
190
 
191
+ #: view/settings-form.php:1489 view/settings-form.php:1510
192
+ #: view/settings-form.php:1546 view/settings-form.php:1590
193
+ #: view/settings-form.php:1612 view/settings-form.php:1638
194
+ #: view/settings-form.php:1661 view/settings-form.php:1683
195
+ #: view/settings-form.php:1705 view/settings-form.php:1727
196
+ msgid "Cancel"
197
  msgstr ""
198
 
199
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1192
200
+ msgid "Cart"
201
  msgstr ""
202
 
203
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1020
204
+ msgid "Cart Discount Amount"
205
  msgstr ""
206
 
207
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1025
208
+ msgid "Cart Discount Amount Tax"
209
  msgstr ""
210
 
211
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:465
212
+ msgid "Category"
213
  msgstr ""
214
 
215
+ #: view/settings-form.php:430
216
+ msgid "Center align"
217
  msgstr ""
218
 
219
+ #: view/settings-form.php:737
220
+ msgid "Change order status to"
221
  msgstr ""
222
 
223
+ #: view/settings-form.php:316 view/settings-form.php:378
224
+ msgid "Character encoding"
225
  msgstr ""
226
 
227
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:831
228
+ msgid "City (Billing)"
229
  msgstr ""
230
 
231
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:921
232
+ msgid "City (Shipping)"
233
  msgstr ""
234
 
235
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:846
236
+ msgid "City, State Zip (Billing)"
237
  msgstr ""
238
 
239
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:936
240
+ msgid "City, State Zip (Shipping)"
241
  msgstr ""
242
 
243
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:841
244
+ msgid "City, State, Zip (Billing)"
245
  msgstr ""
246
 
247
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:931
248
+ msgid "City, State, Zip (Shipping)"
249
  msgstr ""
250
 
251
+ #: view/settings-form.php:784
252
+ msgid "Cleanup phone (export only digits)"
253
  msgstr ""
254
 
255
+ #: view/settings-form.php:1806
256
+ msgid "Click here to download"
257
  msgstr ""
258
 
259
+ #: view/tab/help.php:8
260
+ msgid "code snippets"
261
  msgstr ""
262
 
263
+ #: view/settings-form.php:1479 view/settings-form.php:1495
264
+ #: view/settings-form.php:1536 view/settings-form.php:1582
265
+ #: view/settings-form.php:1596 view/settings-form.php:1629
266
+ #: view/settings-form.php:1644 view/settings-form.php:1673
267
+ #: view/settings-form.php:1695 view/settings-form.php:1717
268
+ msgid "Column name"
269
  msgstr ""
270
 
271
+ #: classes/class-wc-order-export-admin.php:219
272
+ msgid "columns"
273
  msgstr ""
274
 
275
+ #: view/settings-form.php:459 view/settings-form.php:581
276
  msgid "Columns align"
277
  msgstr ""
278
 
279
+ #: view/settings-form.php:449
280
+ msgid "Columns width"
 
 
 
 
281
  msgstr ""
282
 
283
+ #: view/settings-form.php:450 view/settings-form.php:460
284
+ #: view/settings-form.php:582
285
+ msgid "comma separated list"
286
  msgstr ""
287
 
288
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1185
289
+ msgid "Common"
290
  msgstr ""
291
 
292
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:811
293
+ msgid "Company (Billing)"
294
  msgstr ""
295
 
296
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:901
297
+ msgid "Company (Shipping)"
298
  msgstr ""
299
 
300
+ #: view/settings-form.php:167
301
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:686
302
+ msgid "Completed Date"
303
  msgstr ""
304
 
305
+ #: view/settings-form.php:1487 view/settings-form.php:1508
306
+ #: view/settings-form.php:1544 view/settings-form.php:1588
307
+ #: view/settings-form.php:1610 view/settings-form.php:1636
308
+ #: view/settings-form.php:1658 view/settings-form.php:1680
309
+ #: view/settings-form.php:1702 view/settings-form.php:1724
310
+ msgid "Confirm"
311
  msgstr ""
312
 
313
+ #: view/settings-form.php:298
314
+ msgid "Convert line breaks to literals"
315
  msgstr ""
316
 
317
+ #: view/tab/tools.php:32
318
+ msgid ""
319
+ "Copy these settings and use it to migrate plugin to another WordPress "
320
+ "install."
321
  msgstr ""
322
 
323
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:861
324
+ msgid "Country Code (Billing)"
325
  msgstr ""
326
 
327
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:951
328
+ msgid "Country Code (Shipping)"
329
  msgstr ""
330
 
331
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:866
332
+ msgid "Country Name (Billing)"
333
  msgstr ""
334
 
335
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:956
336
+ msgid "Country Name (Shipping)"
337
  msgstr ""
338
 
339
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:606
340
+ msgid "Coupon Amount"
341
  msgstr ""
342
 
343
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:577
344
+ msgid "Coupon Code"
345
  msgstr ""
346
 
347
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:597
348
+ msgid "Coupon Description"
349
  msgstr ""
350
 
351
+ #: view/settings-form.php:340
352
+ msgid "Coupon tag"
353
  msgstr ""
354
 
355
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:601
356
+ msgid "Coupon Type"
357
  msgstr ""
358
 
359
+ #: view/settings-form.php:1195
360
+ #: classes/admin/class-wc-order-export-manage.php:693
361
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:979
362
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1190
363
+ msgid "Coupons"
364
  msgstr ""
365
 
366
+ #: classes/class-wc-order-export-admin.php:238
367
+ msgid "coupons"
368
  msgstr ""
369
 
370
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1015
371
+ msgid "Coupons Used"
372
  msgstr ""
373
 
374
+ #: view/settings-form.php:281
375
+ msgid "CSV options"
376
  msgstr ""
377
 
378
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:681
379
+ msgid "Currency"
 
380
  msgstr ""
381
 
382
+ #: view/settings-form.php:661 view/settings-form.php:687
383
  msgid "custom"
384
  msgstr ""
385
 
386
+ #: view/settings-form.php:632
387
+ msgid "Custom css"
388
  msgstr ""
389
 
390
+ #: view/settings-form.php:853 view/settings-form.php:1145
391
+ msgid "Custom fields"
 
392
  msgstr ""
393
 
394
+ #: view/settings-form.php:796
395
+ msgid "Custom PHP code to modify output"
396
  msgstr ""
397
 
398
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:756
399
+ msgid "Customer first order date"
400
  msgstr ""
401
 
402
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:721
403
+ msgid "Customer IP address"
404
  msgstr ""
405
 
406
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:761
407
+ msgid "Customer last order date"
 
408
  msgstr ""
409
 
410
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:701
411
+ msgid "Customer Note"
412
  msgstr ""
413
 
414
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:746
415
+ msgid "Customer Role"
416
  msgstr ""
417
 
418
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:751
419
+ msgid "Customer Total Orders"
420
  msgstr ""
421
 
422
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:741
423
+ msgid "Customer User Email"
424
  msgstr ""
425
 
426
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:726
427
+ msgid "Customer User ID"
428
  msgstr ""
429
 
430
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:731
431
+ msgid "Customer Username"
432
  msgstr ""
433
 
434
+ #: view/settings-form.php:643
435
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1204
436
+ msgid "Date"
437
  msgstr ""
438
 
439
+ #: classes/class-wc-order-export-admin.php:295
440
+ msgid "Date From is greater than Date To"
441
  msgstr ""
442
 
443
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:696
444
+ msgid "Date of first refund"
445
  msgstr ""
446
 
447
+ #: view/settings-form.php:175
448
+ msgid "Date range"
449
  msgstr ""
450
 
451
+ #: view/settings-form.php:724
452
+ msgid "Descending"
 
 
453
  msgstr ""
454
 
455
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:520
456
+ msgid "Description"
457
  msgstr ""
458
 
459
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:582
460
+ msgid "Discount Amount"
461
  msgstr ""
462
 
463
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:592
464
+ msgid "Discount Amount + Tax"
465
  msgstr ""
466
 
467
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:587
468
+ msgid "Discount Amount Tax"
469
  msgstr ""
470
 
471
+ #: classes/class-wc-order-export-admin.php:138
472
+ msgid "Docs"
473
  msgstr ""
474
 
475
+ #: view/settings-form.php:827
476
+ msgid "Don't export child orders"
477
  msgstr ""
478
 
479
+ #: view/tab/help.php:21
480
+ #, php-format
481
+ msgid ""
482
+ "Don't forget to attach your %s or some screenshots. It will significantly "
483
+ "reduce reply time :)"
484
  msgstr ""
485
 
486
+ #: classes/core/class-wc-order-export-engine.php:340
487
+ msgid "Don't Panic"
488
  msgstr ""
489
 
490
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:500
491
+ msgid "Download URL"
492
  msgstr ""
493
 
494
+ #: view/settings-form.php:1400
495
+ msgid "Drag rows to reorder exported fields"
 
 
496
  msgstr ""
497
 
498
+ #: classes/core/class-wc-order-export-data-extractor.php:2146
499
+ msgid "Edit order"
500
  msgstr ""
501
 
502
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:871
503
+ msgid "Email (Billing)"
504
  msgstr ""
505
 
506
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:545
507
+ msgid "Embedded Product Image"
508
  msgstr ""
509
 
510
+ #: classes/class-wc-order-export-admin.php:299
511
+ #: classes/core/class-wc-order-export-data-extractor.php:311
512
+ msgid "empty"
513
  msgstr ""
514
 
515
+ #: classes/class-wc-order-export-admin.php:289
516
+ msgid "empty column name"
517
  msgstr ""
518
 
519
+ #: classes/class-wc-order-export-admin.php:290
520
+ msgid "empty meta key"
521
  msgstr ""
522
 
523
+ #: classes/class-wc-order-export-admin.php:399
524
+ msgid "Empty method"
525
  msgstr ""
526
 
527
+ #: classes/class-wc-order-export-admin.php:293
528
+ msgid "empty value"
529
  msgstr ""
530
 
531
+ #: view/settings-form.php:790
532
+ msgid "Enable debug output"
533
  msgstr ""
534
 
535
+ #: view/settings-form.php:303
536
+ msgid "Enclosure"
537
  msgstr ""
538
 
539
+ #: view/settings-form.php:357
540
+ msgid "End tag"
541
  msgstr ""
542
 
543
+ #: view/settings-form.php:1095
544
+ msgid "Exclude products"
545
  msgstr ""
546
 
547
+ #: view/settings-form.php:1775
548
+ msgid "Export"
549
  msgstr ""
550
 
551
+ #: view/settings-form.php:1779
552
+ msgid "Export [w/o progressbar]"
553
  msgstr ""
554
 
555
+ #: view/settings-form.php:766
556
+ msgid "Export all order notes"
557
  msgstr ""
558
 
559
+ #: view/settings-form.php:903
560
+ msgid "Export all products from the order"
 
 
 
561
  msgstr ""
562
 
563
+ #: classes/class-wc-order-export-admin.php:449
564
+ #, php-format
565
+ msgid "Export as %s"
566
  msgstr ""
567
 
568
+ #: view/settings-form.php:245
569
+ msgid "Export as .xls (Binary File Format)"
570
  msgstr ""
571
 
572
+ #: view/settings-form.php:208
573
+ msgid "Export filename"
574
  msgstr ""
575
 
576
+ #: view/tab/tools.php:42
577
+ #: classes/admin/tabs/class-wc-order-export-admin-tab-export-now.php:10
578
+ msgid "Export now"
579
  msgstr ""
580
 
581
+ #: classes/class-wc-order-export-admin.php:155
582
+ #: classes/class-wc-order-export-admin.php:156
583
+ #: classes/class-wc-order-export-admin.php:160
584
+ #: classes/class-wc-order-export-admin.php:161
585
+ msgid "Export Orders"
586
  msgstr ""
587
 
588
+ #. Description of the plugin
589
+ msgid "Export orders from WooCommerce with ease (Excel/CSV/XML/JSON supported)"
590
  msgstr ""
591
 
592
+ #: view/settings-form.php:772
593
+ msgid "Export refund notes as Customer Note"
594
  msgstr ""
595
 
596
+ #: view/settings-form.php:831
597
+ msgid "Export refunds"
598
  msgstr ""
599
 
600
+ #: view/tab/tools.php:29
601
+ msgid "Export settings"
602
  msgstr ""
603
 
604
+ #: classes/class-wc-order-export-admin.php:93
605
+ msgid "Export Status"
606
  msgstr ""
607
 
608
+ #: view/settings-form.php:1791
609
+ #, php-format
610
+ msgid "Export total: %s orders"
611
  msgstr ""
612
 
613
+ #: view/settings-form.php:839
614
+ msgid "Export unmarked orders only"
615
  msgstr ""
616
 
617
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1159
618
+ msgid "Exported items"
619
  msgstr ""
620
 
621
+ #: view/settings-form.php:183
622
+ msgid "Express export"
623
  msgstr ""
624
 
625
+ #: view/settings-form.php:1667
626
+ msgid "Fee name"
627
  msgstr ""
628
 
629
+ #: view/settings-form.php:307
630
+ msgid "Field Delimiter"
631
  msgstr ""
632
 
633
+ #: view/settings-form.php:43
634
+ msgid "Field format"
 
 
635
  msgstr ""
636
 
637
+ #: classes/class-wc-order-export-admin.php:226
638
+ msgid "Fill order columns for"
 
639
  msgstr ""
640
 
641
+ #: view/settings-form.php:1213
642
+ msgid "Filter by billing"
 
643
  msgstr ""
644
 
645
+ #: view/settings-form.php:1186
646
+ msgid "Filter by coupon"
 
647
  msgstr ""
648
 
649
+ #: view/settings-form.php:1116
650
+ msgid "Filter by customer"
 
 
 
651
  msgstr ""
652
 
653
+ #: view/settings-form.php:1307
654
+ msgid "Filter by item and metadata"
 
 
 
655
  msgstr ""
656
 
657
+ #: view/settings-form.php:822
658
+ msgid "Filter by order"
 
 
 
659
  msgstr ""
660
 
661
+ #: view/settings-form.php:898
662
+ msgid "Filter by product"
 
663
  msgstr ""
664
 
665
+ #: view/settings-form.php:1260
666
+ msgid "Filter by shipping"
667
  msgstr ""
668
 
669
+ #: view/settings-form.php:140
670
+ msgid "Filter orders by"
671
  msgstr ""
672
 
673
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:796
674
+ msgid "First Name (Billing)"
675
  msgstr ""
676
 
677
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:886
678
+ msgid "First Name (Shipping)"
679
  msgstr ""
680
 
681
+ #: view/settings-form.php:465
682
+ msgid "Fit table to page width"
 
 
 
 
683
  msgstr ""
684
 
685
+ #: view/settings-form.php:420 view/settings-form.php:575
686
+ msgid "Font size"
687
  msgstr ""
688
 
689
+ #: view/settings-form.php:591
690
+ msgid "Footer text"
691
  msgstr ""
692
 
693
+ #: view/settings-form.php:623
694
+ msgid "Footer text color"
695
  msgstr ""
696
 
697
+ #: view/settings-form.php:265
698
+ msgid "Force general format for all cells"
699
  msgstr ""
700
 
701
+ #: view/settings-form.php:219
702
+ msgid "Format"
703
  msgstr ""
704
 
705
+ #: view/settings-form.php:760
706
+ msgid "Format numbers (use WC decimal separator)"
707
  msgstr ""
708
 
709
+ #: classes/admin/class-wc-order-export-manage.php:26
710
+ msgid "Fri"
711
  msgstr ""
712
 
713
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:806
714
+ msgid "Full Name (Billing)"
715
  msgstr ""
716
 
717
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:896
718
+ msgid "Full Name (Shipping)"
 
719
  msgstr ""
720
 
721
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:530
722
+ msgid "Full names for categories"
723
  msgstr ""
724
 
725
+ #: classes/class-wc-order-export-admin.php:231
726
+ msgid "Grouping by coupon"
727
  msgstr ""
728
 
729
+ #: classes/class-wc-order-export-admin.php:230
730
+ msgid "Grouping by product"
731
  msgstr ""
732
 
733
+ #: view/settings-form.php:586
734
+ msgid "Header text"
735
  msgstr ""
736
 
737
+ #: view/settings-form.php:618
738
+ msgid "Header text color"
739
  msgstr ""
740
 
741
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:485
742
+ msgid "Height"
743
  msgstr ""
744
 
745
+ #: classes/admin/tabs/class-wc-order-export-admin-tab-help.php:10
746
+ msgid "Help"
 
 
747
  msgstr ""
748
 
749
+ #: view/tab/help.php:17
750
+ msgid "helpdesk system"
751
  msgstr ""
752
 
753
+ #: view/settings-form.php:1475 view/settings-form.php:1532
754
+ #: view/settings-form.php:1566 view/settings-form.php:1620
755
+ msgid "Hide unused fields"
756
  msgstr ""
757
 
758
+ #: view/settings-form.php:559
759
+ msgid "Html options"
760
  msgstr ""
761
 
762
+ #. Author URI of the plugin
763
+ msgid "https://algolplus.com/"
 
 
 
764
  msgstr ""
765
 
766
+ #: view/settings-form.php:1755
767
  #, php-format
768
+ msgid ""
769
+ "If you see this message after page load, user interface won't work correctly!"
770
+ "<br>There is a JS error (<a target=blank href='%s'>read here</a> how to view "
771
+ "it). Probably, it's a conflict with another plugin or active theme."
772
  msgstr ""
773
 
774
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1205
775
+ msgid "Image"
776
  msgstr ""
777
 
778
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:510
779
+ msgid "Image URL"
780
  msgstr ""
781
 
782
+ #: view/settings-form.php:275 view/settings-form.php:551
783
+ msgid "Images height"
784
  msgstr ""
785
 
786
+ #: view/settings-form.php:268 view/settings-form.php:544
787
+ msgid "Images width"
788
  msgstr ""
789
 
790
+ #: view/tab/tools.php:82
791
+ msgid "Import"
792
  msgstr ""
793
 
794
+ #: view/tab/tools.php:63
795
+ msgid "Import settings"
796
  msgstr ""
797
 
798
+ #: view/settings-form.php:1780
799
+ msgid "It might not work for huge datasets!"
800
  msgstr ""
801
 
802
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:335
803
+ msgid "Item #"
804
  msgstr ""
805
 
806
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:390
807
+ msgid "Item Cost"
808
  msgstr ""
809
 
810
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:450
811
+ msgid "Item Discount Amount"
812
  msgstr ""
813
 
814
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:505
815
+ msgid "Item download URL"
816
  msgstr ""
817
 
818
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:330
819
+ msgid "Item ID"
 
 
 
 
820
  msgstr ""
821
 
822
+ #: view/settings-form.php:1060
823
+ msgid "Item meta data"
824
  msgstr ""
825
 
826
+ #: view/settings-form.php:1340
827
+ msgid "Item metadata"
828
  msgstr ""
829
 
830
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:345
831
+ msgid "Item Name"
832
  msgstr ""
833
 
834
+ #: view/settings-form.php:1310
835
+ msgid "Item names"
 
 
836
  msgstr ""
837
 
838
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:375
839
+ msgid "Item Seller"
840
  msgstr ""
841
 
842
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:455
843
+ msgid "Item Tax Rate"
844
  msgstr ""
845
 
846
+ #: view/settings-form.php:352
847
+ msgid "JSON options"
848
  msgstr ""
849
 
850
+ #: view/tab/tools.php:54
851
+ msgid "Just click inside the textarea and copy (Ctrl+C)"
852
  msgstr ""
853
 
854
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:801
855
+ msgid "Last Name (Billing)"
856
  msgstr ""
857
 
858
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:891
859
+ msgid "Last Name (Shipping)"
860
  msgstr ""
861
 
862
+ #: view/settings-form.php:429
863
+ msgid "Left align"
864
  msgstr ""
865
 
866
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:480
867
+ msgid "Length"
 
868
  msgstr ""
869
 
870
+ #: view/settings-form.php:311 view/settings-form.php:373
871
+ msgid "Line Break"
 
872
  msgstr ""
873
 
874
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:646
875
+ msgid "Line number"
876
  msgstr ""
877
 
878
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:711
879
+ msgid "Link to edit order"
880
  msgstr ""
881
 
882
+ #: view/settings-form.php:522
883
+ msgid "Logo align"
 
884
  msgstr ""
885
 
886
+ #: view/settings-form.php:530
887
+ msgid "Logo height"
 
888
  msgstr ""
889
 
890
+ #: view/settings-form.php:536
891
+ msgid "Logo width"
892
  msgstr ""
893
 
894
+ #: view/tab/help.php:24
895
  #, php-format
896
+ msgid ""
897
+ "Look at %s for popular plugins or check %s to study how to extend the plugin."
898
  msgstr ""
899
 
900
+ #: classes/core/class-wc-order-export-engine.php:469
901
+ msgid "Main SQL queries are listed below"
902
+ msgstr ""
903
+
904
+ #: classes/class-wc-order-export-admin.php:455
905
  msgid "Mark exported"
906
  msgstr ""
907
 
908
+ #: view/settings-form.php:835
909
+ msgid "Mark exported orders"
910
  msgstr ""
911
 
912
+ #: view/settings-form.php:1459 view/settings-form.php:1516
913
+ #: view/settings-form.php:1617
914
+ msgid "Meta key"
915
+ msgstr ""
 
 
916
 
917
+ #: view/settings-form.php:1762
918
+ msgid "Might be different from actual export!"
919
+ msgstr ""
 
 
 
920
 
921
+ #: view/settings-form.php:754
922
+ msgid "Misc settings"
923
  msgstr ""
924
 
925
+ #: view/settings-form.php:153 view/settings-form.php:702
926
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:671
927
+ msgid "Modification Date"
 
928
  msgstr ""
929
 
930
+ #: classes/admin/class-wc-order-export-manage.php:22
931
+ msgid "Mon"
932
  msgstr ""
933
 
934
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1202
935
+ msgid "Money"
 
936
  msgstr ""
937
 
938
+ #: view/tab/help.php:16
939
+ msgid "Need help? Create ticket in"
940
  msgstr ""
941
 
942
+ #: view/settings-form.php:467
943
+ msgid "No"
944
  msgstr ""
945
 
946
+ #: view/settings-form.php:436
947
+ msgid "No page numbers"
 
 
948
  msgstr ""
949
 
950
+ #: classes/formats/abstract-class-woe-formatter-sv.php:102
951
+ #: classes/formats/class-woe-formatter-html.php:120
952
+ #: classes/formats/class-woe-formatter-xls.php:241
953
+ msgid "No results"
954
  msgstr ""
955
 
956
+ #: classes/class-wc-order-export-admin.php:297
957
+ #: classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php:98
958
+ msgid "Nothing to export. Please, adjust your filters"
959
  msgstr ""
960
 
961
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1203
962
+ msgid "Number"
963
  msgstr ""
964
 
965
+ #: classes/class-wc-order-export-admin.php:220
966
+ msgid "one row"
 
967
  msgstr ""
968
 
969
+ #: view/settings-form.php:1569
970
+ msgid "OR"
 
971
  msgstr ""
972
 
973
+ #: view/settings-form.php:1470 view/settings-form.php:1527
974
+ #: view/settings-form.php:1561 view/settings-form.php:1626
975
+ msgid "or type meta key here"
976
  msgstr ""
977
 
978
+ #: view/settings-form.php:146 view/settings-form.php:701
979
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:666
980
+ msgid "Order Date"
981
  msgstr ""
982
 
983
+ #: view/settings-form.php:700
984
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:651
985
+ msgid "Order ID"
986
  msgstr ""
987
 
988
+ #: view/settings-form.php:1556
989
+ msgid "Order item fields"
990
  msgstr ""
991
 
992
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:400
993
+ msgid "Order Line (w/o tax)"
994
  msgstr ""
995
 
996
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:420
997
+ msgid "Order Line Subtotal"
 
 
 
998
  msgstr ""
999
 
1000
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:425
1001
+ msgid "Order Line Subtotal Tax"
 
 
1002
  msgstr ""
1003
 
1004
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:405
1005
+ msgid "Order Line Tax"
 
1006
  msgstr ""
1007
 
1008
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:415
1009
+ msgid "Order Line Tax (- Refund)"
 
1010
  msgstr ""
1011
 
1012
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:410
1013
+ msgid "Order Line Tax Refunded"
 
 
1014
  msgstr ""
1015
 
1016
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:430
1017
+ msgid "Order Line Total"
1018
  msgstr ""
1019
 
1020
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:445
1021
+ msgid "Order Line Total (- Refund)"
 
1022
  msgstr ""
1023
 
1024
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:435
1025
+ msgid "Order Line Total (include tax)"
1026
  msgstr ""
1027
 
1028
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:440
1029
+ msgid "Order Line Total Refunded"
1030
  msgstr ""
1031
 
1032
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:706
1033
+ msgid "Order Notes"
1034
  msgstr ""
1035
 
1036
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:656
1037
+ msgid "Order Number"
1038
  msgstr ""
1039
 
1040
+ #: view/settings-form.php:122
1041
+ msgid "Order Refund"
1042
  msgstr ""
1043
 
1044
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1105
1045
+ msgid "Order Refund Amount"
1046
  msgstr ""
1047
 
1048
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1065
1049
+ msgid "Order Shipping + Tax Amount"
1050
  msgstr ""
1051
 
1052
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1060
1053
+ msgid "Order Shipping Amount"
 
 
1054
  msgstr ""
1055
 
1056
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1075
1057
+ msgid "Order Shipping Amount (- Refund)"
1058
  msgstr ""
1059
 
1060
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1070
1061
+ msgid "Order Shipping Amount Refunded"
1062
  msgstr ""
1063
 
1064
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1080
1065
+ msgid "Order Shipping Tax Amount"
1066
  msgstr ""
1067
 
1068
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1090
1069
+ msgid "Order Shipping Tax Amount (- Refund)"
1070
  msgstr ""
1071
 
1072
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1085
1073
+ msgid "Order Shipping Tax Refunded"
1074
  msgstr ""
1075
 
1076
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:661
1077
+ msgid "Order Status"
1078
  msgstr ""
1079
 
1080
+ #: view/settings-form.php:703
1081
+ msgid "Order status"
1082
  msgstr ""
1083
 
1084
+ #: view/settings-form.php:841
1085
+ msgid "Order statuses"
1086
  msgstr ""
1087
 
1088
+ #: view/settings-form.php:118
1089
+ msgid "Order Subscription"
1090
  msgstr ""
1091
 
1092
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1035
1093
+ msgid "Order Subtotal - Cart Discount"
1094
  msgstr ""
1095
 
1096
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1030
1097
+ msgid "Order Subtotal Amount"
1098
  msgstr ""
1099
 
1100
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1045
1101
+ msgid "Order Subtotal Amount (- Refund)"
1102
  msgstr ""
1103
 
1104
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1040
1105
+ msgid "Order Subtotal Amount Refunded"
1106
  msgstr ""
1107
 
1108
+ #: view/settings-form.php:334
1109
+ msgid "Order tag"
1110
  msgstr ""
1111
 
1112
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1050
1113
+ msgid "Order Tax Amount"
1114
  msgstr ""
1115
 
1116
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1115
1117
+ msgid "Order Total Amount"
1118
  msgstr ""
1119
 
1120
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1110
1121
+ msgid "Order Total Amount (- Refund)"
1122
  msgstr ""
1123
 
1124
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1120
1125
+ msgid "Order Total Amount without Tax"
1126
  msgstr ""
1127
 
1128
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1100
1129
+ msgid "Order Total Fee"
1130
  msgstr ""
1131
 
1132
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1125
1133
+ msgid "Order Total Tax Amount"
1134
  msgstr ""
1135
 
1136
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1135
1137
+ msgid "Order Total Tax Amount (- Refund)"
1138
  msgstr ""
1139
 
1140
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1130
1141
+ msgid "Order Total Tax Amount Refunded"
1142
  msgstr ""
1143
 
1144
+ #: view/settings-form.php:112
1145
+ msgid "Order Type"
1146
  msgstr ""
1147
 
1148
+ #: classes/formats/class-woe-formatter-xls.php:132
1149
+ #: classes/admin/class-wc-order-export-manage.php:238
1150
+ msgid "Orders"
1151
  msgstr ""
1152
 
1153
+ #: view/settings-form.php:402
1154
+ msgid "Orientation"
1155
  msgstr ""
1156
 
1157
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1191
1158
+ msgid "Other items"
1159
  msgstr ""
1160
 
1161
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1195
1162
+ msgid "Others"
1163
  msgstr ""
1164
 
1165
+ #: view/settings-form.php:253 view/settings-form.php:294
1166
+ #: view/settings-form.php:372 view/settings-form.php:391
1167
+ #: view/settings-form.php:565
1168
+ msgid "Output column titles as first line"
1169
  msgstr ""
1170
 
1171
+ #: view/settings-form.php:290 view/settings-form.php:368
1172
+ msgid "Output UTF-8 BOM"
1173
  msgstr ""
1174
 
1175
+ #: view/settings-form.php:454
1176
+ msgid "Page footer text"
1177
  msgstr ""
1178
 
1179
+ #: view/settings-form.php:498
1180
+ msgid "Page footer text color"
1181
  msgstr ""
1182
 
1183
+ #: view/settings-form.php:444
1184
+ msgid "Page header text"
1185
  msgstr ""
1186
 
1187
+ #: view/settings-form.php:493
1188
+ msgid "Page header text color"
1189
  msgstr ""
1190
 
1191
+ #: view/settings-form.php:426
1192
+ msgid "Page numbers"
1193
  msgstr ""
1194
 
1195
+ #: view/settings-form.php:411
1196
+ msgid "Page size"
1197
  msgstr ""
1198
 
1199
+ #: view/settings-form.php:160
1200
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:691
1201
+ msgid "Paid Date"
1202
  msgstr ""
1203
 
1204
+ #: view/tab/tools.php:66
1205
+ msgid ""
1206
+ "Paste text into this field to import settings into the current WordPress "
1207
+ "install."
1208
  msgstr ""
1209
 
1210
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1010
1211
+ msgid "Payment Method"
1212
  msgstr ""
1213
 
1214
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1005
1215
+ msgid "Payment Method Title"
1216
  msgstr ""
1217
 
1218
+ #: view/settings-form.php:1244
1219
+ msgid "Payment methods"
1220
  msgstr ""
1221
 
1222
+ #: view/settings-form.php:385
1223
+ msgid "PDF options"
1224
  msgstr ""
1225
 
1226
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:876
1227
+ msgid "Phone (Billing)"
1228
  msgstr ""
1229
 
1230
+ #: view/settings-form.php:801
1231
+ msgid ""
1232
+ "Please check permissions for your role. You must have capability "
1233
+ "“edit_themes” to use this box."
1234
  msgstr ""
1235
 
1236
+ #: woo-order-export-lite.php:34
1237
+ msgid ""
1238
+ "Please, <a href=\"plugins.php\">deactivate</a> Free version of Advanced "
1239
+ "Order Export For WooCommerce!"
1240
  msgstr ""
1241
 
1242
+ #: view/settings-form.php:235
1243
+ msgid "Please, install/enable PHP mbstring extension!"
1244
  msgstr ""
1245
 
1246
+ #: view/settings-form.php:325
1247
+ msgid "Please, install/enable PHP XML extension!"
1248
  msgstr ""
1249
 
1250
+ #: classes/class-wc-order-export-admin.php:296
1251
+ msgid "Please, set up fields to export"
1252
  msgstr ""
1253
 
1254
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:856
1255
+ msgid "Postcode (Billing)"
1256
  msgstr ""
1257
 
1258
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:946
1259
+ msgid "Postcode (Shipping)"
1260
  msgstr ""
1261
 
1262
+ #: view/settings-form.php:328
1263
+ msgid "Prepend XML"
1264
  msgstr ""
1265
 
1266
+ #: view/settings-form.php:1805
1267
+ msgid "Press 'Esc' to cancel the export"
1268
  msgstr ""
1269
 
1270
+ #: view/settings-form.php:1761
1271
+ msgid "Preview"
1272
  msgstr ""
1273
 
1274
+ #: view/settings-form.php:1793
1275
+ msgid "Preview size"
1276
  msgstr ""
1277
 
1278
+ #: view/tab/order-actions.php:5 view/tab/profiles.php:5
1279
+ #: view/tab/schedules.php:5
1280
+ msgid "Pro version"
1281
  msgstr ""
1282
 
1283
+ #: view/settings-form.php:909
1284
+ msgid "Product categories"
1285
  msgstr ""
1286
 
1287
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:395
1288
+ msgid "Product Current Price"
1289
  msgstr ""
1290
 
1291
+ #: view/settings-form.php:990
1292
+ msgid "Product custom fields"
1293
  msgstr ""
1294
 
1295
+ #: view/settings-form.php:1552
1296
+ msgid "Product fields"
1297
  msgstr ""
1298
 
1299
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:350
1300
+ msgid "Product Id"
1301
  msgstr ""
1302
 
1303
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:355
1304
+ msgid "Product Name"
1305
  msgstr ""
1306
 
1307
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:360
1308
+ msgid "Product Name (main)"
1309
  msgstr ""
1310
 
1311
+ #: view/settings-form.php:302
1312
+ msgid "Product rows start with a new line"
1313
  msgstr ""
1314
 
1315
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:515
1316
+ msgid "Product Shipping Class"
1317
  msgstr ""
1318
 
1319
+ #: view/settings-form.php:337
1320
+ msgid "Product tag"
1321
  msgstr ""
1322
 
1323
+ #: view/settings-form.php:958
1324
+ msgid "Product taxonomies"
1325
  msgstr ""
1326
 
1327
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:495
1328
+ msgid "Product URL"
1329
+ msgstr ""
1330
+
1331
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:370
1332
+ msgid "Product Variation"
1333
+ msgstr ""
1334
+
1335
+ #: view/settings-form.php:943
1336
+ #: classes/admin/class-wc-order-export-manage.php:650
1337
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:967
1338
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1189
1339
+ msgid "Products"
1340
+ msgstr ""
1341
+
1342
+ #: classes/class-wc-order-export-admin.php:237
1343
+ msgid "products"
1344
+ msgstr ""
1345
+
1346
+ #: classes/admin/tabs/ajax/class-wc-order-export-ajax.php:20
1347
+ msgid "Profile required!"
1348
+ msgstr ""
1349
+
1350
+ #: classes/admin/tabs/class-wc-order-export-admin-tab-profiles.php:10
1351
+ msgid "Profiles"
1352
+ msgstr ""
1353
+
1354
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:380
1355
+ msgid "Quantity"
1356
+ msgstr ""
1357
+
1358
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:385
1359
+ msgid "Quantity (- Refund)"
1360
+ msgstr ""
1361
+
1362
+ #: view/settings-form.php:806
1363
+ msgid "Read how to fix it"
1364
+ msgstr ""
1365
+
1366
+ #: view/settings-form.php:1406
1367
+ msgid "Remove all fields"
1368
+ msgstr ""
1369
+
1370
+ #: classes/class-wc-order-export-admin.php:240
1371
+ msgid "Remove all fields?"
1372
+ msgstr ""
1373
+
1374
+ #: view/settings-form.php:519
1375
+ msgid "Remove logo"
1376
+ msgstr ""
1377
+
1378
+ #: view/settings-form.php:398
1379
+ msgid "repeat at each page"
1380
+ msgstr ""
1381
+
1382
+ #: view/settings-form.php:571
1383
+ msgid "repeat header as last line"
1384
+ msgstr ""
1385
+
1386
+ #: view/settings-form.php:1787
1387
+ msgid "Reset settings"
1388
+ msgstr ""
1389
+
1390
+ #: view/settings-form.php:431
1391
+ msgid "Right align"
1392
+ msgstr ""
1393
+
1394
+ #: view/settings-form.php:261
1395
+ msgid "Right-to-Left direction"
1396
  msgstr ""
1397
 
1398
+ #: view/settings-form.php:331
1399
+ msgid "Root tag"
1400
  msgstr ""
1401
 
1402
+ #: classes/class-wc-order-export-admin.php:218
1403
+ msgid "rows"
1404
  msgstr ""
1405
 
1406
+ #: classes/admin/class-wc-order-export-manage.php:27
1407
+ msgid "Sat"
1408
  msgstr ""
1409
 
1410
+ #: view/settings-form.php:1768
1411
+ msgid "Save & Exit"
1412
  msgstr ""
1413
 
1414
+ #: view/settings-form.php:1765 view/settings-form.php:1770
1415
+ msgid "Save settings"
1416
  msgstr ""
1417
 
1418
+ #: classes/admin/tabs/class-wc-order-export-admin-tab-schedule-jobs.php:10
1419
+ msgid "Scheduled jobs"
1420
  msgstr ""
1421
 
1422
+ #: view/settings-form.php:507
1423
+ msgid "Select logo"
1424
  msgstr ""
1425
 
1426
+ #: classes/class-wc-order-export-admin.php:291
1427
+ msgid "select product field or item field or taxonomy"
1428
  msgstr ""
1429
 
1430
+ #: view/settings-form.php:346
1431
+ msgid "Self closing tags"
1432
  msgstr ""
1433
 
1434
+ #: classes/class-wc-order-export-admin.php:236
1435
+ msgid "Set up coupon fields"
1436
  msgstr ""
1437
 
1438
+ #: view/settings-form.php:1380
1439
+ msgid "Set up fields to export"
1440
  msgstr ""
1441
 
1442
+ #: classes/class-wc-order-export-admin.php:235
1443
+ msgid "Set up product fields"
1444
  msgstr ""
1445
 
1446
+ #: classes/class-wc-order-export-admin.php:137
1447
+ msgid "Settings"
1448
  msgstr ""
1449
 
1450
+ #: view/tab/help.php:6
1451
+ msgid "settings"
1452
  msgstr ""
1453
 
1454
+ #: view/main.php:8
1455
+ msgid "Settings saved"
1456
  msgstr ""
1457
 
1458
+ #: view/settings-form.php:1800 view/tab/tools.php:86
1459
+ msgid "Settings were successfully updated!"
1460
  msgstr ""
1461
 
1462
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1193
1463
+ msgid "Shipping"
1464
  msgstr ""
1465
 
1466
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1188
1467
+ msgid "Shipping Address"
1468
  msgstr ""
1469
 
1470
+ #: view/settings-form.php:1263
1471
+ msgid "Shipping locations"
1472
  msgstr ""
1473
 
1474
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:995
1475
+ msgid "Shipping Method"
1476
  msgstr ""
1477
 
1478
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1000
1479
+ msgid "Shipping Method (no id)"
1480
  msgstr ""
1481
 
1482
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:990
1483
+ msgid "Shipping Method Title"
1484
  msgstr ""
1485
 
1486
+ #: view/settings-form.php:1291
1487
+ msgid "Shipping methods"
1488
  msgstr ""
1489
 
1490
+ #: view/settings-form.php:1689
1491
+ msgid "Shipping name"
1492
  msgstr ""
1493
 
1494
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:525
1495
+ msgid "Short Description"
1496
  msgstr ""
1497
 
1498
+ #: view/settings-form.php:907
1499
+ msgid "Skip fully refunded items"
1500
  msgstr ""
1501
 
1502
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:340
1503
+ msgid "SKU"
1504
  msgstr ""
1505
 
1506
+ #: view/settings-form.php:731
1507
+ #, php-format
1508
+ msgid "Sort orders by %s in %s order"
1509
  msgstr ""
1510
 
1511
+ #: classes/class-wc-order-export-admin.php:225
1512
+ msgid "Split values by"
1513
  msgstr ""
1514
 
1515
+ #: view/settings-form.php:354
1516
+ msgid "Start tag"
1517
  msgstr ""
1518
 
1519
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:836
1520
+ msgid "State Code (Billing)"
1521
  msgstr ""
1522
 
1523
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:926
1524
  msgid "State Code (Shipping)"
1525
  msgstr ""
1526
 
1527
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:851
1528
+ msgid "State Name (Billing)"
 
 
 
 
1529
  msgstr ""
1530
 
1531
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:941
1532
  msgid "State Name (Shipping)"
1533
  msgstr ""
1534
 
1535
+ #: classes/admin/tabs/class-wc-order-export-admin-tab-status-change-jobs.php:10
1536
+ msgid "Status change jobs"
1537
  msgstr ""
1538
 
1539
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1201
1540
+ msgid "String"
1541
  msgstr ""
1542
 
1543
+ #: view/settings-form.php:778
1544
+ msgid "Strip tags from Product Description/Variation"
1545
  msgstr ""
1546
 
1547
+ #: view/settings-form.php:199
1548
+ msgid "Summary Report By Customers"
1549
  msgstr ""
1550
 
1551
+ #: view/settings-form.php:191
1552
+ msgid "Summary Report By Products"
1553
  msgstr ""
1554
 
1555
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:540
1556
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:771
1557
+ msgid "Summary Report Total Amount"
1558
  msgstr ""
1559
 
1560
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:776
1561
+ msgid "Summary Report Total Amount Paid"
1562
  msgstr ""
1563
 
1564
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:550
1565
+ msgid "Summary Report Total Discount"
1566
  msgstr ""
1567
 
1568
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:766
1569
+ msgid "Summary Report Total Orders"
1570
  msgstr ""
1571
 
1572
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:535
1573
+ msgid "Summary Report Total Quantity"
1574
  msgstr ""
1575
 
1576
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:560
1577
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:786
1578
+ msgid "Summary Report Total Refund Amount"
1579
  msgstr ""
1580
 
1581
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:555
1582
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:781
1583
+ msgid "Summary Report Total Refunds"
1584
  msgstr ""
1585
 
1586
+ #: classes/admin/class-wc-order-export-manage.php:21
1587
+ msgid "Sun"
1588
  msgstr ""
1589
 
1590
+ #: classes/class-wc-order-export-admin.php:140
1591
+ msgid "Support"
1592
  msgstr ""
1593
 
1594
+ #: view/settings-form.php:476 view/settings-form.php:601
1595
+ msgid "Table header background color"
1596
  msgstr ""
1597
 
1598
+ #: view/settings-form.php:471 view/settings-form.php:596
1599
+ msgid "Table header text color"
1600
  msgstr ""
1601
 
1602
+ #: view/settings-form.php:487 view/settings-form.php:612
1603
+ msgid "Table row background color"
1604
  msgstr ""
1605
 
1606
+ #: view/settings-form.php:482 view/settings-form.php:607
1607
+ msgid "Table row text color"
1608
  msgstr ""
1609
 
1610
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:470
1611
+ msgid "Tags"
1612
  msgstr ""
1613
 
1614
+ #: view/settings-form.php:1711
1615
+ msgid "Tax name"
1616
  msgstr ""
1617
 
1618
+ #: view/settings-form.php:1571
1619
+ msgid "Taxonomy"
1620
  msgstr ""
1621
 
1622
+ #: classes/core/class-wc-order-export-engine.php:341
1623
+ #, php-format
1624
+ msgid "The code you are trying to save produced a fatal error on line %d:"
1625
  msgstr ""
1626
 
1627
+ #: view/settings-form.php:896
1628
+ msgid ""
1629
+ "The filters won't work correctly.<br>Another plugin(or theme) has loaded "
1630
+ "outdated Select2.js"
1631
  msgstr ""
1632
 
1633
+ #: view/settings-form.php:1457 view/settings-form.php:1551
1634
+ msgid ""
1635
+ "The plugin fetches meta keys from the existing orders. So you should create "
1636
+ "fake order if you've added new field just now."
1637
  msgstr ""
1638
 
1639
+ #: classes/class-wc-order-export-admin.php:241
1640
+ msgid ""
1641
+ "This action will reset filters, settings and fields to default state. Are "
1642
+ "you sure?"
1643
  msgstr ""
1644
 
1645
+ #: view/settings-form.php:172
1646
+ msgid "This date range should not be saved in the scheduled task"
1647
  msgstr ""
1648
 
1649
+ #: view/settings-form.php:634
1650
+ msgid "This option cancels UI settings(above) and don't applied to Preview"
1651
  msgstr ""
1652
 
1653
+ #: view/tab/help.php:10
1654
+ msgid "this page"
1655
  msgstr ""
1656
 
1657
+ #: view/tab/tools.php:72
1658
+ msgid ""
1659
+ "This process will overwrite your settings for \"Advanced Order Export For "
1660
+ "WooCommerce\" !"
1661
  msgstr ""
1662
 
1663
+ #: classes/admin/class-wc-order-export-manage.php:25
1664
+ msgid "Thu"
1665
  msgstr ""
1666
 
1667
+ #: view/settings-form.php:670
1668
+ msgid "Time"
1669
  msgstr ""
1670
 
1671
+ #: classes/class-wc-order-export-admin.php:294
1672
+ msgid "title is empty"
1673
  msgstr ""
1674
 
1675
+ #: view/settings-form.php:178
1676
+ msgid "to"
1677
  msgstr ""
1678
 
1679
+ #: classes/admin/tabs/class-wc-order-export-admin-tab-tools.php:10
1680
+ msgid "Tools"
1681
  msgstr ""
1682
 
1683
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1154
1684
+ msgid "Total items"
1685
  msgstr ""
1686
 
1687
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1164
1688
+ msgid "Total products"
1689
  msgstr ""
1690
 
1691
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1149
1692
+ msgid "Total weight"
1693
  msgstr ""
1694
 
1695
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1194
1696
+ msgid "Totals"
1697
  msgstr ""
1698
 
1699
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:676
1700
+ msgid "Transaction ID"
1701
  msgstr ""
1702
 
1703
+ #: view/settings-form.php:361
1704
+ msgid "TSV options"
1705
  msgstr ""
1706
 
1707
+ #: classes/admin/class-wc-order-export-manage.php:23
1708
+ msgid "Tue"
1709
  msgstr ""
1710
 
1711
+ #: view/settings-form.php:1393
1712
+ msgid "Turn off mode Summary report to export order fields"
1713
  msgstr ""
1714
 
1715
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:460
1716
+ msgid "Type"
1717
  msgstr ""
1718
 
1719
+ #: classes/class-wc-order-export-admin.php:410
1720
+ #, php-format
1721
+ msgid "Unknown AJAX method %s"
1722
  msgstr ""
1723
 
1724
+ #: classes/class-wc-order-export-admin.php:418
1725
+ #, php-format
1726
+ msgid "Unknown tab method %s"
1727
  msgstr ""
1728
 
1729
+ #: classes/class-wc-order-export-admin.php:456
1730
+ msgid "Unmark exported"
1731
  msgstr ""
1732
 
1733
+ #: view/settings-form.php:810
1734
+ msgid "Use only unnamed functions!"
1735
  msgstr ""
1736
 
1737
+ #: view/settings-form.php:247
1738
+ msgid "Use sheet name"
1739
  msgstr ""
1740
 
1741
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:1186
1742
+ msgid "User"
1743
  msgstr ""
1744
 
1745
+ #: view/settings-form.php:1134
1746
+ msgid "User roles"
1747
  msgstr ""
1748
 
1749
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:736
1750
+ msgid "User Website"
 
1751
  msgstr ""
1752
 
1753
+ #: view/settings-form.php:1120
1754
+ msgid "Usernames"
1755
  msgstr ""
1756
 
1757
+ #: view/settings-form.php:1500 view/settings-form.php:1601
1758
+ #: view/settings-form.php:1649
1759
+ msgid "Value"
1760
  msgstr ""
1761
 
1762
+ #: view/settings-form.php:1028
1763
+ msgid "Variable product attributes"
1764
  msgstr ""
1765
 
1766
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:365
1767
+ msgid "Variation Id"
1768
  msgstr ""
1769
 
1770
+ #: view/settings-form.php:927
1771
+ msgid "Vendors/creators"
1772
  msgstr ""
1773
 
1774
+ #: classes/admin/class-wc-order-export-manage.php:24
1775
+ msgid "Wed"
1776
  msgstr ""
1777
 
1778
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:490
1779
+ msgid "Weight"
1780
  msgstr ""
1781
 
1782
+ #: classes/core/class-wc-order-export-data-extractor-ui.php:475
1783
+ msgid "Width"
1784
  msgstr ""
1785
 
1786
+ #: classes/class-wc-order-export-admin.php:422
1787
+ msgid "Wrong nonce"
1788
  msgstr ""
1789
 
1790
+ #: view/settings-form.php:232
1791
+ msgid "XLS options"
1792
  msgstr ""
1793
 
1794
+ #: view/settings-form.php:322
1795
+ msgid "XML options"
1796
  msgstr ""
1797
 
1798
+ #: view/settings-form.php:466
1799
+ msgid "Yes"
1800
  msgstr ""
1801
 
1802
+ #: classes/class-wc-order-export-admin.php:395
1803
+ msgid "You can not do it"
1804
  msgstr ""
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce,export,order,xls,csv,xml,woo export lite,export orders,orders
5
  Requires PHP: 5.4.0
6
  Requires at least: 4.7
7
  Tested up to: 5.2
8
- Stable tag: 3.0.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -109,6 +109,14 @@ Yes, you can email a request to aprokaev@gmail.com. We intensively develop this
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
112
  = 3.0.1 - 2019-07-22 =
113
  * Added product field "Product Name (main)" to export name of variable product (not name of variation!)
114
  * Added summary product fields to export discounts and refunds
5
  Requires PHP: 5.4.0
6
  Requires at least: 4.7
7
  Tested up to: 5.2
8
+ Stable tag: 3.0.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
109
 
110
  == Changelog ==
111
 
112
+ = 3.0.2 - 2019-08-20 =
113
+ * Added "Summary by customers" report
114
+ * Format PDF supports UTF8 chars
115
+ * Added filter "Exclude products" to section "Filter by product"
116
+ * New tab "Other items" (in section "Setup fields") allows to export tax/fee/shipping
117
+ * Fixed bug - XLS export stops at wrong dates
118
+ * Fixed bug - button "ESC" doesn't abort export (Safari only)
119
+
120
  = 3.0.1 - 2019-07-22 =
121
  * Added product field "Product Name (main)" to export name of variable product (not name of variation!)
122
  * Added summary product fields to export discounts and refunds
view/settings-form.php CHANGED
@@ -30,23 +30,23 @@ $pdf_format_available_options = array(
30
  ),
31
  );
32
 
33
- function print_formats_field( $type, $segment = "" ) {
34
  if ( ! $type && $type !== 'meta' && $type !== 'field' ) {
35
  return '';
36
  }
37
  $margin_left = 'meta' == $type ? '1px' : '4px';
38
  // colname_custom_field
39
- $id = $segment ? 'format_custom_' . $type . '_' . $segment : 'format_custom_' . $type;
40
 
41
  $formats_fields_html =
42
  '<label for="' . $id . '">' .
43
  __( 'Field format', 'woo-order-export-lite' ) . ':' .
44
  '</label>' .
45
- '<select type="text" id="' . $id . '" style="max-width: 215px; margin-left: ' . $margin_left . '">' .
46
  '<option value="" >' . __( '-', 'woo-order-export-lite' ) . '</option>';
47
 
48
  foreach ( WC_Order_Export_Data_Extractor_UI::get_format_fields() as $format_id => $format_label ) {
49
- $formats_fields_html .= "<option value='$format_id' >$format_label</option>";
50
  };
51
  $formats_fields_html .= '</select>';
52
 
@@ -71,7 +71,10 @@ function remove_time_from_date( $datetime ) {
71
 
72
  ?>
73
 
 
 
74
  <script>
 
75
  var mode = '<?php echo $mode ?>';
76
  var job_id = '<?php echo esc_js( $id ) ?>';
77
  var output_format = '<?php echo $settings['format'] ?>';
@@ -86,7 +89,8 @@ function remove_time_from_date( $datetime ) {
86
  var order_coupons_custom_meta_fields = <?php echo json_encode( WC_Order_Export_Data_Extractor_UI::get_all_coupon_custom_meta_fields() ) ?>;
87
  var order_segments = <?php echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_segments() ) ?>;
88
  var field_formats = <?php echo json_encode( WC_Order_Export_Data_Extractor_UI::get_format_fields() ) ?>;
89
- var summary_mode = <?php echo $settings['summary_report_by_products'] ?>;
 
90
 
91
  jQuery( document ).ready( function ( $ ) {
92
  $( 'input.color_pick' ).wpColorPicker();
@@ -99,11 +103,37 @@ function remove_time_from_date( $datetime ) {
99
  <div style="width: 100%;">&nbsp;</div>
100
  <?php endif; ?>
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  <div id="my-left" style="float: left; width: 49%; max-width: 500px;">
103
  <?php do_action( 'woe_settings_form_view_top', $settings ); ?>
104
  <input type="hidden" name="settings[version]"
105
  value="<?php echo isset( $settings['version'] ) ? $settings['version'] : '2.0' ?>">
106
 
 
107
  <?php if ( $show['date_filter'] ) : ?>
108
  <div id="my-export-date-field" class="my-block">
109
  <div class="wc-oe-header">
@@ -153,7 +183,7 @@ function remove_time_from_date( $datetime ) {
153
  <button id="my-quick-export-btn" class="button-primary"><?php _e( 'Express export',
154
  'woo-order-export-lite' ) ?></button>
155
  <br>
156
- <div id="summary_report_by_products" style="display:inline-block"><input type="hidden"
157
  name="settings[summary_report_by_products]"
158
  value="0"/><label><input
159
  type="checkbox" id=summary_report_by_products_checkbox
@@ -161,6 +191,14 @@ function remove_time_from_date( $datetime ) {
161
  value="1" <?php checked( $settings['summary_report_by_products'] ) ?> /> <?php _e( "Summary Report By Products",
162
  'woo-order-export-lite' ) ?></label>
163
  </div>
 
 
 
 
 
 
 
 
164
  </div>
165
  <br>
166
  <?php endif; ?>
@@ -193,6 +231,9 @@ function remove_time_from_date( $datetime ) {
193
 
194
  <div id='XLS_options' style='display:none'><strong><?php _e( 'XLS options',
195
  'woo-order-export-lite' ) ?></strong><br>
 
 
 
196
  <input type=hidden name="settings[format_xls_use_xls_format]" value=0>
197
  <input type=hidden name="settings[format_xls_display_column_names]" value=0>
198
  <input type=hidden name="settings[format_xls_auto_width]" value=0>
@@ -281,7 +322,7 @@ function remove_time_from_date( $datetime ) {
281
  <div id='XML_options' style='display:none'><strong><?php _e( 'XML options',
282
  'woo-order-export-lite' ) ?></strong><br>
283
  <?php if ( ! class_exists( "XMLWriter" ) ): ?>
284
- <div style="color:red"><?php _e( 'Please, install/enable PHP XML Extension!', 'woo-order-export-lite' ) ?></div>
285
  <?php endif ?>
286
  <input type=hidden name="settings[format_xml_self_closing_tags]" value=0>
287
  <span class="xml-title"><?php _e( 'Prepend XML', 'woo-order-export-lite' ) ?></span><input type=text
@@ -760,11 +801,11 @@ function remove_time_from_date( $datetime ) {
760
  <?php _e( 'Please check permissions for your role. You must have capability “edit_themes” to use this box.',
761
  'woo-order-export-lite' ); ?>
762
  </strong>
763
- <?php echo sprintf( '<a href="%s" target=_blank>%s</a>',
764
  "https://algolplus.freshdesk.com/support/solutions/articles/25000018208-grey-textarea-for-custom-code-in-section-misc-settings-",
765
- __( 'Read how to fix it','woo-order-export-lite' )
766
  ); ?>
767
-
768
  <?php endif; ?>
769
  <textarea placeholder="<?php _e( 'Use only unnamed functions!', 'woo-order-export-lite' ) ?>"
770
  name="settings[custom_php_code]" <?php echo $readonly_php ?> class="width-100"
@@ -883,7 +924,7 @@ function remove_time_from_date( $datetime ) {
883
  <?php }
884
  } ?>
885
  </select>
886
- <span class="wc-oe-header"><?php _e( 'Vendor/creator', 'woo-order-export-lite' ) ?></span>
887
  <select id="product_vendors" class="select2-i18n" data-select2-i18n-ajax-method="get_vendors"
888
  name="settings[product_vendors][]" multiple="multiple"
889
  style="width: 100%; max-width: 25%;">
@@ -899,7 +940,7 @@ function remove_time_from_date( $datetime ) {
899
 
900
  <?php do_action( "woe_settings_filter_by_product_after_vendors", $settings ); ?>
901
 
902
- <span class="wc-oe-header"><?php _e( 'Product', 'woo-order-export-lite' ) ?></span>
903
 
904
  <select id="products" class="select2-i18n" data-select2-i18n-ajax-method="get_products"
905
  name="settings[products][]" multiple="multiple"
@@ -1051,13 +1092,28 @@ function remove_time_from_date( $datetime ) {
1051
  } ?>
1052
  </select>
1053
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1054
  </div>
1055
  </div>
1056
 
1057
  <br>
1058
 
1059
  <div class="my-block">
1060
- <span class="my-hide-next "><?php _e( 'Filter by customers', 'woo-order-export-lite' ) ?>
1061
  <span class="ui-icon ui-icon-triangle-1-s my-icon-triangle"></span></span>
1062
  <div id="my-users" hidden="hidden">
1063
 
@@ -1127,7 +1183,7 @@ function remove_time_from_date( $datetime ) {
1127
  <br>
1128
 
1129
  <div class="my-block">
1130
- <span class="my-hide-next "><?php _e( 'Filter by coupons', 'woo-order-export-lite' ) ?>
1131
  <span class="ui-icon ui-icon-triangle-1-s my-icon-triangle"></span></span>
1132
  <div id="my-coupons" hidden="hidden">
1133
  <div>
@@ -1358,21 +1414,20 @@ function remove_time_from_date( $datetime ) {
1358
  </div>
1359
  <div></div>
1360
  <div id='unselected_fields'>
1361
- <ul class="subsubsub">
1362
  <?php $segments = WC_Order_Export_Data_Extractor_UI::get_order_segments(); ?>
1363
  <?php foreach ( $segments as $id => $segment_title ): ?>
1364
- <li>
1365
  <a class="segment_choice"
1366
  data-segment="<?php echo $id; ?>" href="#segment=<?php echo $id; ?>">
1367
  <?php echo $segment_title; ?>
1368
  </a>
1369
- <?php echo( end( $segments ) == $segment_title ? '' : ' | ' ); ?>
1370
  </li>
1371
  <?php endforeach; ?>
1372
  </ul>
1373
- <br class="clear">
1374
  <div class="tab-controls">
1375
- <div class="tab-actions-buttons">
1376
  <span class="tab-actions-buttons__title">
1377
  <strong><?php _e( 'Actions', 'woo-order-export-lite' ) ?>:</strong>
1378
  </span>
@@ -1383,6 +1438,20 @@ function remove_time_from_date( $datetime ) {
1383
  <?php _e( 'Add static field', 'woo-order-export-lite' ) ?>
1384
  </button>
1385
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1386
  <div class="tab-actions-forms">
1387
  <div class='div_meta segment-form all-segments'>
1388
  <div class='add_form_tip'><?php _e( "The plugin fetches meta keys from the existing orders. So you should create fake order if you've added new field just now.", 'woo-order-export-lite' )?></div>
@@ -1593,6 +1662,72 @@ function remove_time_from_date( $datetime ) {
1593
  </button>
1594
  </div>
1595
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1596
  </div>
1597
  </div>
1598
 
@@ -1691,4 +1826,5 @@ function remove_time_from_date( $datetime ) {
1691
  <input name="mode" type="hidden" value="<?php echo $mode ?>">
1692
  <input name="id" type="hidden" value="<?php echo $id ?>">
1693
  <input name="json" type="hidden">
 
1694
  </form>
30
  ),
31
  );
32
 
33
+ function print_formats_field( $type, $segment = "", $selected = "", $custom_key = "" ) {
34
  if ( ! $type && $type !== 'meta' && $type !== 'field' ) {
35
  return '';
36
  }
37
  $margin_left = 'meta' == $type ? '1px' : '4px';
38
  // colname_custom_field
39
+ $id = $custom_key ? $custom_key : ($segment ? 'format_custom_' . $type . '_' . $segment : 'format_custom_' . $type);
40
 
41
  $formats_fields_html =
42
  '<label for="' . $id . '">' .
43
  __( 'Field format', 'woo-order-export-lite' ) . ':' .
44
  '</label>' .
45
+ '<select id="' . $id . '" style="max-width: 215px; margin-left: ' . $margin_left . '">' .
46
  '<option value="" >' . __( '-', 'woo-order-export-lite' ) . '</option>';
47
 
48
  foreach ( WC_Order_Export_Data_Extractor_UI::get_format_fields() as $format_id => $format_label ) {
49
+ $formats_fields_html .= "<option value='$format_id' ".($selected === $format_id ? 'selected="selected"' : '').">$format_label</option>";
50
  };
51
  $formats_fields_html .= '</select>';
52
 
71
 
72
  ?>
73
 
74
+ <?php $woe_order_post_type = isset($settings['post_type']) ? $settings['post_type'] : (isset($_GET['woe_post_type']) ? $_GET['woe_post_type'] : 'shop_order'); ?>
75
+
76
  <script>
77
+ var woe_order_post_type = '<?php echo $woe_order_post_type ?>';
78
  var mode = '<?php echo $mode ?>';
79
  var job_id = '<?php echo esc_js( $id ) ?>';
80
  var output_format = '<?php echo $settings['format'] ?>';
89
  var order_coupons_custom_meta_fields = <?php echo json_encode( WC_Order_Export_Data_Extractor_UI::get_all_coupon_custom_meta_fields() ) ?>;
90
  var order_segments = <?php echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_segments() ) ?>;
91
  var field_formats = <?php echo json_encode( WC_Order_Export_Data_Extractor_UI::get_format_fields() ) ?>;
92
+ var summary_mode_by_products = <?php echo $settings['summary_report_by_products'] ?>;
93
+ var summary_mode_by_customers = <?php echo $settings['summary_report_by_customers'] ?>;
94
 
95
  jQuery( document ).ready( function ( $ ) {
96
  $( 'input.color_pick' ).wpColorPicker();
103
  <div style="width: 100%;">&nbsp;</div>
104
  <?php endif; ?>
105
 
106
+ <input type="hidden" name="settings[post_type]"
107
+ value="<?php echo $woe_order_post_type ?>">
108
+
109
+ <?php if ($woe_order_post_type && $woe_order_post_type !== 'shop_order'): ?>
110
+ <div id="my-export-post-type" class="my-block" style="width: 100%; max-width: 993px;">
111
+ <div class="wc-oe-header" style="display: inline-block">
112
+ <?php _e( 'Order Type', 'woo-order-export-lite' ) ?>:
113
+ </div>
114
+ <div style="display: inline-block">
115
+ <?php
116
+ switch($woe_order_post_type) {
117
+ case 'shop_subscription':
118
+ _e( 'Order Subscription', 'woo-order-export-lite' );
119
+ break;
120
+
121
+ case 'shop_order_refund':
122
+ _e( 'Order Refund', 'woo-order-export-lite' );
123
+ break;
124
+ }
125
+ ?>
126
+ </div>
127
+ </div>
128
+ <br>
129
+ <?php endif; ?>
130
+
131
  <div id="my-left" style="float: left; width: 49%; max-width: 500px;">
132
  <?php do_action( 'woe_settings_form_view_top', $settings ); ?>
133
  <input type="hidden" name="settings[version]"
134
  value="<?php echo isset( $settings['version'] ) ? $settings['version'] : '2.0' ?>">
135
 
136
+
137
  <?php if ( $show['date_filter'] ) : ?>
138
  <div id="my-export-date-field" class="my-block">
139
  <div class="wc-oe-header">
183
  <button id="my-quick-export-btn" class="button-primary"><?php _e( 'Express export',
184
  'woo-order-export-lite' ) ?></button>
185
  <br>
186
+ <div id="summary_report_by_products" style="display:block"><input type="hidden"
187
  name="settings[summary_report_by_products]"
188
  value="0"/><label><input
189
  type="checkbox" id=summary_report_by_products_checkbox
191
  value="1" <?php checked( $settings['summary_report_by_products'] ) ?> /> <?php _e( "Summary Report By Products",
192
  'woo-order-export-lite' ) ?></label>
193
  </div>
194
+ <div id="summary_report_by_customers" style="display:block"><input type="hidden"
195
+ name="settings[summary_report_by_customers]"
196
+ value="0"/><label><input
197
+ type="checkbox" id=summary_report_by_customers_checkbox
198
+ name="settings[summary_report_by_customers]"
199
+ value="1" <?php checked( $settings['summary_report_by_customers'] ) ?> /> <?php _e( "Summary Report By Customers",
200
+ 'woo-order-export-lite' ) ?></label>
201
+ </div>
202
  </div>
203
  <br>
204
  <?php endif; ?>
231
 
232
  <div id='XLS_options' style='display:none'><strong><?php _e( 'XLS options',
233
  'woo-order-export-lite' ) ?></strong><br>
234
+ <?php if ( ! function_exists( "mb_strtolower" ) ): ?>
235
+ <div style="color:red"><?php _e( 'Please, install/enable PHP mbstring extension!', 'woo-order-export-lite' ) ?></div>
236
+ <?php endif ?>
237
  <input type=hidden name="settings[format_xls_use_xls_format]" value=0>
238
  <input type=hidden name="settings[format_xls_display_column_names]" value=0>
239
  <input type=hidden name="settings[format_xls_auto_width]" value=0>
322
  <div id='XML_options' style='display:none'><strong><?php _e( 'XML options',
323
  'woo-order-export-lite' ) ?></strong><br>
324
  <?php if ( ! class_exists( "XMLWriter" ) ): ?>
325
+ <div style="color:red"><?php _e( 'Please, install/enable PHP XML extension!', 'woo-order-export-lite' ) ?></div>
326
  <?php endif ?>
327
  <input type=hidden name="settings[format_xml_self_closing_tags]" value=0>
328
  <span class="xml-title"><?php _e( 'Prepend XML', 'woo-order-export-lite' ) ?></span><input type=text
801
  <?php _e( 'Please check permissions for your role. You must have capability “edit_themes” to use this box.',
802
  'woo-order-export-lite' ); ?>
803
  </strong>
804
+ <?php echo sprintf( '<a href="%s" target=_blank>%s</a>',
805
  "https://algolplus.freshdesk.com/support/solutions/articles/25000018208-grey-textarea-for-custom-code-in-section-misc-settings-",
806
+ __( 'Read how to fix it','woo-order-export-lite' )
807
  ); ?>
808
+
809
  <?php endif; ?>
810
  <textarea placeholder="<?php _e( 'Use only unnamed functions!', 'woo-order-export-lite' ) ?>"
811
  name="settings[custom_php_code]" <?php echo $readonly_php ?> class="width-100"
924
  <?php }
925
  } ?>
926
  </select>
927
+ <span class="wc-oe-header"><?php _e( 'Vendors/creators', 'woo-order-export-lite' ) ?></span>
928
  <select id="product_vendors" class="select2-i18n" data-select2-i18n-ajax-method="get_vendors"
929
  name="settings[product_vendors][]" multiple="multiple"
930
  style="width: 100%; max-width: 25%;">
940
 
941
  <?php do_action( "woe_settings_filter_by_product_after_vendors", $settings ); ?>
942
 
943
+ <span class="wc-oe-header"><?php _e( 'Products', 'woo-order-export-lite' ) ?></span>
944
 
945
  <select id="products" class="select2-i18n" data-select2-i18n-ajax-method="get_products"
946
  name="settings[products][]" multiple="multiple"
1092
  } ?>
1093
  </select>
1094
 
1095
+ <span class="wc-oe-header"><?php _e( 'Exclude products', 'woo-order-export-lite' ) ?></span>
1096
+
1097
+ <select id="exclude_products" class="select2-i18n" data-select2-i18n-ajax-method="get_products"
1098
+ name="settings[exclude_products][]" multiple="multiple"
1099
+ style="width: 100%; max-width: 25%;">
1100
+ <?php
1101
+ if ( $settings['exclude_products'] ) {
1102
+ foreach ( $settings['exclude_products'] as $prod ) {
1103
+ $p = get_the_title( $prod );
1104
+ ?>
1105
+ <option selected value="<?php echo $prod ?>"> <?php echo $p; ?></option>
1106
+ <?php }
1107
+ } ?>
1108
+ </select>
1109
+
1110
  </div>
1111
  </div>
1112
 
1113
  <br>
1114
 
1115
  <div class="my-block">
1116
+ <span class="my-hide-next "><?php _e( 'Filter by customer', 'woo-order-export-lite' ) ?>
1117
  <span class="ui-icon ui-icon-triangle-1-s my-icon-triangle"></span></span>
1118
  <div id="my-users" hidden="hidden">
1119
 
1183
  <br>
1184
 
1185
  <div class="my-block">
1186
+ <span class="my-hide-next "><?php _e( 'Filter by coupon', 'woo-order-export-lite' ) ?>
1187
  <span class="ui-icon ui-icon-triangle-1-s my-icon-triangle"></span></span>
1188
  <div id="my-coupons" hidden="hidden">
1189
  <div>
1414
  </div>
1415
  <div></div>
1416
  <div id='unselected_fields'>
1417
+ <ul class="subsubsub" style="float: none">
1418
  <?php $segments = WC_Order_Export_Data_Extractor_UI::get_order_segments(); ?>
1419
  <?php foreach ( $segments as $id => $segment_title ): ?>
1420
+ <li class="block-segment-choice" data-segment="<?php echo $id; ?>">
1421
  <a class="segment_choice"
1422
  data-segment="<?php echo $id; ?>" href="#segment=<?php echo $id; ?>">
1423
  <?php echo $segment_title; ?>
1424
  </a>
1425
+ <span class="divider"><?php echo( end( $segments ) == $segment_title ? '' : ' | ' ); ?></span>
1426
  </li>
1427
  <?php endforeach; ?>
1428
  </ul>
 
1429
  <div class="tab-controls">
1430
+ <div class="tab-actions-buttons default-actions">
1431
  <span class="tab-actions-buttons__title">
1432
  <strong><?php _e( 'Actions', 'woo-order-export-lite' ) ?>:</strong>
1433
  </span>
1438
  <?php _e( 'Add static field', 'woo-order-export-lite' ) ?>
1439
  </button>
1440
  </div>
1441
+ <div class="tab-actions-buttons other_items-actions-buttons">
1442
+ <span class="tab-actions-buttons__title">
1443
+ <strong><?php _e( 'Actions', 'woo-order-export-lite' ) ?>:</strong>
1444
+ </span>
1445
+ <button class='button-secondary add-fee'>
1446
+ <?php _e( 'Add fee', 'woo-order-export-lite' ) ?>
1447
+ </button>
1448
+ <button class='button-secondary add-shipping'>
1449
+ <?php _e( 'Add shipping', 'woo-order-export-lite' ) ?>
1450
+ </button>
1451
+ <button class='button-secondary add-tax'>
1452
+ <?php _e( 'Add tax', 'woo-order-export-lite' ) ?>
1453
+ </button>
1454
+ </div>
1455
  <div class="tab-actions-forms">
1456
  <div class='div_meta segment-form all-segments'>
1457
  <div class='add_form_tip'><?php _e( "The plugin fetches meta keys from the existing orders. So you should create fake order if you've added new field just now.", 'woo-order-export-lite' )?></div>
1662
  </button>
1663
  </div>
1664
  </div>
1665
+ <div class='div_custom other-items-segment segment-form other-items-add-fee-form'>
1666
+ <label>
1667
+ <?php _e( 'Fee name', 'woo-order-export-lite' ) ?>:
1668
+ </label>
1669
+ <br/>
1670
+ <select id='select_fee_items'></select>
1671
+ <br/>
1672
+ <br/>
1673
+ <label><?php _e( 'Column name', 'woo-order-export-lite' ) ?>:</label>
1674
+ <input type='text' id='colname_fee_item_other_items'/>
1675
+ <div style="margin-top: 20px;">
1676
+ <?php echo print_formats_field( 'field', 'other_items', 'money', 'format_fee_item_other_items'); ?>
1677
+ </div>
1678
+ <div style="text-align: right;">
1679
+ <button id='button_other_items_add_fee_field' class='button-secondary'>
1680
+ <?php _e( 'Confirm', 'woo-order-export-lite' ) ?>
1681
+ </button>
1682
+ <button class='button-secondary button-cancel'>
1683
+ <?php _e( 'Cancel', 'woo-order-export-lite' ) ?>
1684
+ </button>
1685
+ </div>
1686
+ </div>
1687
+ <div class='div_custom other-items-segment segment-form other-items-add-shipping-form'>
1688
+ <label>
1689
+ <?php _e( 'Shipping name', 'woo-order-export-lite' ) ?>:
1690
+ </label>
1691
+ <br/>
1692
+ <select id='select_shipping_items'></select>
1693
+ <br/>
1694
+ <br/>
1695
+ <label><?php _e( 'Column name', 'woo-order-export-lite' ) ?>:</label>
1696
+ <input type='text' id='colname_shipping_item_other_items'/>
1697
+ <div style="margin-top: 20px;">
1698
+ <?php echo print_formats_field( 'field', 'other_items', 'money', 'format_shipping_item_other_items'); ?>
1699
+ </div>
1700
+ <div style="text-align: right;">
1701
+ <button id='button_other_items_add_shipping_field' class='button-secondary'>
1702
+ <?php _e( 'Confirm', 'woo-order-export-lite' ) ?>
1703
+ </button>
1704
+ <button class='button-secondary button-cancel'>
1705
+ <?php _e( 'Cancel', 'woo-order-export-lite' ) ?>
1706
+ </button>
1707
+ </div>
1708
+ </div>
1709
+ <div class='div_custom other-items-segment segment-form other-items-add-tax-form'>
1710
+ <label>
1711
+ <?php _e( 'Tax name', 'woo-order-export-lite' ) ?>:
1712
+ </label>
1713
+ <br/>
1714
+ <select id='select_tax_items'></select>
1715
+ <br/>
1716
+ <br/>
1717
+ <label><?php _e( 'Column name', 'woo-order-export-lite' ) ?>:</label>
1718
+ <input type='text' id='colname_tax_item_other_items'/>
1719
+ <div style="margin-top: 20px;">
1720
+ <?php echo print_formats_field( 'field', 'other_items', 'money', 'format_tax_item_other_items'); ?>
1721
+ </div>
1722
+ <div style="text-align: right;">
1723
+ <button id='button_other_items_add_tax_field' class='button-secondary'>
1724
+ <?php _e( 'Confirm', 'woo-order-export-lite' ) ?>
1725
+ </button>
1726
+ <button class='button-secondary button-cancel'>
1727
+ <?php _e( 'Cancel', 'woo-order-export-lite' ) ?>
1728
+ </button>
1729
+ </div>
1730
+ </div>
1731
  </div>
1732
  </div>
1733
 
1826
  <input name="mode" type="hidden" value="<?php echo $mode ?>">
1827
  <input name="id" type="hidden" value="<?php echo $id ?>">
1828
  <input name="json" type="hidden">
1829
+ <input name="woe_order_post_type" type="hidden" value="<?php echo $woe_order_post_type ?>">
1830
  </form>
woo-order-export-lite.php CHANGED
@@ -5,11 +5,11 @@
5
  * Description: Export orders from WooCommerce with ease (Excel/CSV/XML/JSON supported)
6
  * Author: AlgolPlus
7
  * Author URI: https://algolplus.com/
8
- * Version: 3.0.1
9
  * Text Domain: woo-order-export-lite
10
  * Domain Path: /i18n/languages/
11
  * WC requires at least: 2.6.0
12
- * WC tested up to: 3.6
13
  *
14
  * Copyright: (c) 2015 AlgolPlus LLC. (algol.plus@gmail.com)
15
  *
@@ -39,7 +39,7 @@ if ( class_exists( 'WC_Order_Export_Admin' ) ) {
39
  return;
40
  }
41
 
42
- define( 'WOE_VERSION', '3.0.1' );
43
  define( 'WOE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
44
  define( 'WOE_PLUGIN_BASEPATH', dirname( __FILE__ ) );
45
 
5
  * Description: Export orders from WooCommerce with ease (Excel/CSV/XML/JSON supported)
6
  * Author: AlgolPlus
7
  * Author URI: https://algolplus.com/
8
+ * Version: 3.0.2
9
  * Text Domain: woo-order-export-lite
10
  * Domain Path: /i18n/languages/
11
  * WC requires at least: 2.6.0
12
+ * WC tested up to: 3.7
13
  *
14
  * Copyright: (c) 2015 AlgolPlus LLC. (algol.plus@gmail.com)
15
  *
39
  return;
40
  }
41
 
42
+ define( 'WOE_VERSION', '3.0.2' );
43
  define( 'WOE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
44
  define( 'WOE_PLUGIN_BASEPATH', dirname( __FILE__ ) );
45