| 1 |
<?php |
| 2 |
isset( $GLOBALS['_kint_settings'] ) or $GLOBALS['_kint_settings'] = array(); |
| 3 |
$_kintSettings = &$GLOBALS['_kint_settings']; |
| 4 |
|
| 5 |
|
| 6 |
/** @var bool if set to false, kint will become silent, same as Kint::enabled(false) or Kint::$enabled = false */ |
| 7 |
$_kintSettings['enabled'] = true; |
| 8 |
|
| 9 |
|
| 10 |
/** |
| 11 |
* @var bool whether to display where kint was called from |
| 12 |
*/ |
| 13 |
$_kintSettings['displayCalledFrom'] = true; |
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* @var string format of the link to the source file in trace entries. Use %f for file path, %l for line number. |
| 18 |
* Defaults to xdebug.file_link_format if not set. |
| 19 |
* |
| 20 |
* [!] EXAMPLE (works with for phpStorm and RemoteCall Plugin): |
| 21 |
* |
| 22 |
* $_kintSettings['fileLinkFormat'] = 'http://localhost:8091/?message=%f:%l'; |
| 23 |
* |
| 24 |
*/ |
| 25 |
$_kintSettings['fileLinkFormat'] = ini_get( 'xdebug.file_link_format' ); |
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* @var array base directories of your application that will be displayed instead of the full path. Keys are paths, |
| 30 |
* values are replacement strings |
| 31 |
* |
| 32 |
* Defaults to array( $_SERVER['DOCUMENT_ROOT'] => '<ROOT>' ) |
| 33 |
* |
| 34 |
* [!] EXAMPLE (for Kohana framework): |
| 35 |
* |
| 36 |
* $_kintSettings['appRootDirs'] = array( |
| 37 |
* APPPATH => 'APPPATH', // make sure the constants are already defined at the time of including this config file |
| 38 |
* SYSPATH => 'SYSPATH', |
| 39 |
* MODPATH => 'MODPATH', |
| 40 |
* DOCROOT => 'DOCROOT', |
| 41 |
* ); |
| 42 |
* |
| 43 |
* [!] EXAMPLE #2 (for a semi-universal approach) |
| 44 |
* |
| 45 |
* $_kintSettings['appRootDirs'] = array( |
| 46 |
* realpath( __DIR__ . '/../../..' ) => 'ROOT', // go up as many levels as needed in the realpath() param |
| 47 |
* ); |
| 48 |
* |
| 49 |
* $_kintSettings['fileLinkFormat'] = 'http://localhost:8091/?message=%f:%l'; |
| 50 |
* |
| 51 |
*/ |
| 52 |
$_kintSettings['appRootDirs'] = array( |
| 53 |
$_SERVER['DOCUMENT_ROOT'] => '<ROOT>' |
| 54 |
); |
| 55 |
|
| 56 |
|
| 57 |
/** |
| 58 |
* @var callable|null |
| 59 |
* |
| 60 |
* @param array $step each step of the backtrace is passed to this callback to clean it up or skip it entirely |
| 61 |
* |
| 62 |
* @return array|null you can return null if you want to bypass outputting this step |
| 63 |
* |
| 64 |
* [!] EXAMPLE: |
| 65 |
* |
| 66 |
* $_kintSettings['traceCleanupCallback'] = function( $traceStep ) { |
| 67 |
* if ( isset( $traceStep['class'] ) && strtolower( $traceStep['class'] ) === 'errorHandler' ) { |
| 68 |
* return null; |
| 69 |
* } |
| 70 |
* |
| 71 |
* if ( isset( $traceStep['function'] ) && strtolower( $traceStep['function'] ) === '__tostring' ) { |
| 72 |
* $traceStep['function'] = "[object converted to string]"; |
| 73 |
* } |
| 74 |
* |
| 75 |
* return $traceStep; |
| 76 |
* }; |
| 77 |
*/ |
| 78 |
$_kintSettings['traceCleanupCallback'] = null; |
| 79 |
|
| 80 |
|
| 81 |
/** @var int max length of string before it is truncated and displayed separately in full. Zero or false to disable */ |
| 82 |
$_kintSettings['maxStrLength'] = 60; |
| 83 |
|
| 84 |
/** @var array possible alternative char encodings in order of probability, eg. array('windows-1251') */ |
| 85 |
$_kintSettings['charEncodings'] = array(); |
| 86 |
|
| 87 |
|
| 88 |
/** @var int max array/object levels to go deep, if zero no limits are applied */ |
| 89 |
$_kintSettings['maxLevels'] = 5; |
| 90 |
|
| 91 |
|
| 92 |
/** @var bool whether dumped indexed arrays that are in ideal sequence are displayed */ |
| 93 |
$_kintSettings['hideSequentialKeys'] = true; |
| 94 |
|
| 95 |
|
| 96 |
/** @var string name of theme for rich view */ |
| 97 |
$_kintSettings['theme'] = 'original'; |
| 98 |
|
| 99 |
|
| 100 |
/** |
| 101 |
* @var callback filters array/object keys before outputting; return false if you do not wish to see it in the output |
| 102 |
* |
| 103 |
* @param string $key the key being output |
| 104 |
* @param mixed $val the contents of the dumped element in case you need it |
| 105 |
* |
| 106 |
* @return bool return false to skip displaying |
| 107 |
* |
| 108 |
* [!] EXAMPLE: |
| 109 |
* |
| 110 |
* $_kintSettings['keyFilterCallback'] = function( $key, $val ) { |
| 111 |
* if ( preg_match( '#_mt$#', $key ) ) { |
| 112 |
* return false; |
| 113 |
* } |
| 114 |
* |
| 115 |
* if ( $val === '--testing--' ) { |
| 116 |
* return false; |
| 117 |
* } |
| 118 |
* |
| 119 |
* // no need to return true to continue output |
| 120 |
* }; |
| 121 |
* |
| 122 |
*/ |
| 123 |
$_kintSettings['keyFilterCallback'] = null; |
| 124 |
|
| 125 |
|
| 126 |
/** @var bool only set to true if you want to develop kint and know what you're doing */ |
| 127 |
$_kintSettings['devel'] = false; |
| 128 |
|
| 129 |
|
| 130 |
unset( $_kintSettings ); |