1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00
limesurvey_ynh/sources/application/helpers/globals.php

37 lines
1.2 KiB
PHP
Raw Normal View History

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This file contains global helper function used in LS.
* This file MUST NOT depend on any other files, except those available in Yii
* by default.
*
*/
/**
* Helper function to replace calls to Yii::app() and enable correct code completion.
* @return LSYii_Application
*/
function App()
{
return Yii::app();
}
/**
* If debug = 2 in application/config.php this will produce output in the console / firebug
* similar to var_dump. It will also include the filename and line that called this method.
*
* @param mixed $variable The variable to be dumped
* @param int $depth Maximum depth to go into the variable, default is 10
*/
function traceVar($variable, $depth = 10) {
$msg = CVarDumper::dumpAsString($variable, $depth, false);
$fullTrace = debug_backtrace();
$trace=array_shift($fullTrace);
if(isset($trace['file'],$trace['line']) && strpos($trace['file'],YII_PATH)!==0)
{
$msg = $trace['file'].' ('.$trace['line']."):\n" . $msg;
}
Yii::trace($msg, 'vardump');
}
?>