|
|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
|
|
|
-// For date()
|
|
|
+use Cake\Core\Configure;
|
|
|
+
|
|
|
define('FORMAT_DB_DATETIME', 'Y-m-d H:i:s');
|
|
|
define('FORMAT_DB_DATE', 'Y-m-d');
|
|
|
define('FORMAT_DB_TIME', 'H:i:s');
|
|
|
@@ -58,6 +59,57 @@ if (!defined('WINDOWS')) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+if (!function_exists('dd')) {
|
|
|
+ function dd($data, $showHtml = null)
|
|
|
+ {
|
|
|
+ if (Configure::read('debug')) {
|
|
|
+ debug($data, $showHtml, false);
|
|
|
+ $backtrace = debug_backtrace(false, 1);
|
|
|
+ pr('dd-location: ' . $backtrace[0]['file'] . ':' . $backtrace[0]['line']);
|
|
|
+ die();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+if (!function_exists('prd')) {
|
|
|
+ function prd($data)
|
|
|
+ {
|
|
|
+ if (Configure::read('debug')) {
|
|
|
+ pr($data);
|
|
|
+ $backtrace = debug_backtrace(false, 1);
|
|
|
+ pr('prd-location: ' . $backtrace[0]['file'] . ':' . $backtrace[0]['line']);
|
|
|
+ die();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+if (!function_exists('vd')) {
|
|
|
+ function vd($var)
|
|
|
+ {
|
|
|
+ if (Configure::read('debug')) {
|
|
|
+ echo '<pre>';
|
|
|
+ var_dump($var);
|
|
|
+ echo '</pre>';
|
|
|
+ $backtrace = debug_backtrace(false, 1);
|
|
|
+ pr('vd-location: ' . $backtrace[0]['file'] . ':' . $backtrace[0]['line']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+if (!function_exists('vdd')) {
|
|
|
+ function vdd($var)
|
|
|
+ {
|
|
|
+ if (Configure::read('debug')) {
|
|
|
+ echo '<pre>';
|
|
|
+ var_dump($var);
|
|
|
+ echo '</pre>';
|
|
|
+ $backtrace = debug_backtrace(false, 1);
|
|
|
+ pr('vdd-location: ' . $backtrace[0]['file'] . ':' . $backtrace[0]['line']);
|
|
|
+ die();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Convenience function to check on "empty()"
|
|
|
*
|
|
|
@@ -72,7 +124,7 @@ function isEmpty($var = null) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Return of what type the specific value is
|
|
|
+ * Returns of what type the specific value is
|
|
|
*
|
|
|
* //TODO: use Debugger::exportVar() instead?
|
|
|
*
|
|
|
@@ -154,6 +206,8 @@ function entDec($text, $quoteStyle = ENT_QUOTES) {
|
|
|
/**
|
|
|
* Focus is on the filename (without path)
|
|
|
*
|
|
|
+ * @deprecated Use native method instead
|
|
|
+ *
|
|
|
* @param string $filename to check on
|
|
|
* @param string|null $type (extension/ext, filename/file, basename/base, dirname/dir)
|
|
|
* @return mixed
|
|
|
@@ -185,6 +239,8 @@ function extractFileInfo($filename, $type = null) {
|
|
|
* Improves it by not returning non-file-name characters from url files if specified.
|
|
|
* So "filename.ext?foo=bar#hash" would simply be "filename.ext" then.
|
|
|
*
|
|
|
+ * @deprecated Use native method instead
|
|
|
+ *
|
|
|
* @param string $filename to check on
|
|
|
* @param string|null $type (extension/ext, filename/file, basename/base, dirname/dir)
|
|
|
* @param bool $fromUrl
|