getoptions

Parses command line options.

Description

(array) getoptions(); 

Returns (array)

The command line options


Usage

  1. if ( !function_exists( 'getoptions' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-pdf-invoices-packing-slips/lib/dompdf/dompdf.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = getoptions(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/lib/dompdf/dompdf.php  
  1. function getoptions() { 
  2.  
  3. $opts = array(); 
  4.  
  5. if ( $_SERVER["argc"] == 1 ) 
  6. return $opts; 
  7.  
  8. $i = 1; 
  9. while ($i < $_SERVER["argc"]) { 
  10.  
  11. switch ($_SERVER["argv"][$i]) { 
  12.  
  13. case "--help": 
  14. case "-h": 
  15. $opts["h"] = true; 
  16. $i++; 
  17. break; 
  18.  
  19. case "-l": 
  20. $opts["l"] = true; 
  21. $i++; 
  22. break; 
  23.  
  24. case "-p": 
  25. if ( !isset($_SERVER["argv"][$i+1]) ) 
  26. die("-p switch requires a size parameter\n"); 
  27. $opts["p"] = $_SERVER["argv"][$i+1]; 
  28. $i += 2; 
  29. break; 
  30.  
  31. case "-o": 
  32. if ( !isset($_SERVER["argv"][$i+1]) ) 
  33. die("-o switch requires an orientation parameter\n"); 
  34. $opts["o"] = $_SERVER["argv"][$i+1]; 
  35. $i += 2; 
  36. break; 
  37.  
  38. case "-b": 
  39. if ( !isset($_SERVER["argv"][$i+1]) ) 
  40. die("-b switch requires a path parameter\n"); 
  41. $opts["b"] = $_SERVER["argv"][$i+1]; 
  42. $i += 2; 
  43. break; 
  44.  
  45. case "-f": 
  46. if ( !isset($_SERVER["argv"][$i+1]) ) 
  47. die("-f switch requires a filename parameter\n"); 
  48. $opts["f"] = $_SERVER["argv"][$i+1]; 
  49. $i += 2; 
  50. break; 
  51.  
  52. case "-v": 
  53. $opts["v"] = true; 
  54. $i++; 
  55. break; 
  56.  
  57. case "-d": 
  58. $opts["d"] = true; 
  59. $i++; 
  60. break; 
  61.  
  62. case "-t": 
  63. if ( !isset($_SERVER['argv'][$i + 1]) ) 
  64. die("-t switch requires a comma separated list of types\n"); 
  65. $opts["t"] = $_SERVER['argv'][$i+1]; 
  66. $i += 2; 
  67. break; 
  68.  
  69. default: 
  70. $opts["filename"] = $_SERVER["argv"][$i]; 
  71. $i++; 
  72. break; 
  73.  
  74. return $opts;