本文整理汇总了PHP中Prado::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::getVersion方法的具体用法?PHP Prado::getVersion怎么用?PHP Prado::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::getVersion方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Dispatch the command line actions.
* @param array command line arguments
*/
public function run($args)
{
echo "Command line tools for Prado " . Prado::getVersion() . ".\n";
if (count($args) > 1) {
array_shift($args);
}
$valid = false;
foreach ($this->_actions as $class => $action) {
if ($action->isValidAction($args)) {
$valid |= $action->performAction($args);
break;
} else {
$valid = false;
}
}
if (!$valid) {
$this->printHelp();
}
}
示例2: resolvePaths
protected function resolvePaths($basePath)
{
if (empty($basePath) || ($basePath = realpath($basePath)) === false) {
throw new TConfigurationException('application_basepath_invalid', $basePath);
}
if (is_dir($basePath) && is_file($basePath . DIRECTORY_SEPARATOR . $this->getConfigurationFileName())) {
$configFile = $basePath . DIRECTORY_SEPARATOR . $this->getConfigurationFileName();
} else {
if (is_file($basePath)) {
$configFile = $basePath;
$basePath = dirname($configFile);
} else {
$configFile = null;
}
}
$runtimePath = $basePath . DIRECTORY_SEPARATOR . self::RUNTIME_PATH;
if (is_writable($runtimePath)) {
if ($configFile !== null) {
$runtimePath .= DIRECTORY_SEPARATOR . basename($configFile) . '-' . Prado::getVersion();
if (!is_dir($runtimePath)) {
if (@mkdir($runtimePath) === false) {
throw new TConfigurationException('application_runtimepath_failed', $runtimePath);
}
@chmod($runtimePath, PRADO_CHMOD);
}
$this->setConfigurationFile($configFile);
}
$this->setBasePath($basePath);
$this->setRuntimePath($runtimePath);
} else {
throw new TConfigurationException('application_runtimepath_invalid', $runtimePath);
}
}
示例3: hash
/**
* Generate a CRC32 hash for the directory path. Collisions are higher
* than MD5 but generates a much smaller hash string.
* @param string string to be hashed.
* @return string hashed string.
*/
protected function hash($dir)
{
return sprintf('%x', crc32($dir . Prado::getVersion()));
}
示例4: displayException
/**
* Displays exception information.
* Exceptions are displayed with rich context information, including
* the call stack and the context source code.
* This method is only invoked when application is in <b>Debug</b> mode.
* @param Exception exception instance
*/
protected function displayException($exception)
{
if (php_sapi_name() === 'cli') {
echo $exception->getMessage() . "\n";
echo $exception->getTraceAsString();
return;
}
if ($exception instanceof TTemplateException) {
$fileName = $exception->getTemplateFile();
$lines = empty($fileName) ? explode("\n", $exception->getTemplateSource()) : @file($fileName);
$source = $this->getSourceCode($lines, $exception->getLineNumber());
if ($fileName === '') {
$fileName = '---embedded template---';
}
$errorLine = $exception->getLineNumber();
} else {
if (($trace = $this->getExactTrace($exception)) !== null) {
$fileName = $trace['file'];
$errorLine = $trace['line'];
} else {
$fileName = $exception->getFile();
$errorLine = $exception->getLine();
}
$source = $this->getSourceCode(@file($fileName), $errorLine);
}
if ($this->getApplication()->getMode() === TApplicationMode::Debug) {
$version = $_SERVER['SERVER_SOFTWARE'] . ' <a href="http://www.pradosoft.com/">PRADO</a>/' . Prado::getVersion();
} else {
$version = '';
}
$tokens = array('%%ErrorType%%' => get_class($exception), '%%ErrorMessage%%' => $this->addLink(htmlspecialchars($exception->getMessage())), '%%SourceFile%%' => htmlspecialchars($fileName) . ' (' . $errorLine . ')', '%%SourceCode%%' => $source, '%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()), '%%Version%%' => $version, '%%Time%%' => @strftime('%Y-%m-%d %H:%M', time()));
$content = $this->getExceptionTemplate($exception);
echo strtr($content, $tokens);
}
示例5: printGreeting
public static function printGreeting()
{
echo "Command line tools for Prado " . Prado::getVersion() . ".\n";
}
示例6: getExceptionStackTrace
/**
* @param Exception exception details.
* @return array exception stack trace details.
*/
private function getExceptionStackTrace($exception)
{
$data['code'] = $exception->getCode() > 0 ? $exception->getCode() : 500;
$data['file'] = $exception->getFile();
$data['line'] = $exception->getLine();
$data['trace'] = $exception->getTrace();
if ($exception instanceof TPhpErrorException) {
// if PHP exception, we want to show the 2nd stack level context
// because the 1st stack level is of little use (it's in error handler)
if (isset($trace[0]) && isset($trace[0]['file']) && isset($trace[0]['line'])) {
$data['file'] = $trace[0]['file'];
$data['line'] = $trace[0]['line'];
}
}
$data['type'] = get_class($exception);
$data['message'] = $exception->getMessage();
$data['version'] = $_SERVER['SERVER_SOFTWARE'] . ' ' . Prado::getVersion();
$data['time'] = @strftime('%Y-%m-%d %H:%M', time());
return $data;
}
示例7: saveAsDWExtension
public function saveAsDWExtension($basePath)
{
$tagPath = $basePath . '/Configuration/TagLibraries/PRADO';
// prepare the directory to save tag lib
@mkdir($basePath . '/Configuration');
@mkdir($basePath . '/Configuration/TagLibraries');
@mkdir($basePath . '/Configuration/TagLibraries/PRADO');
$docMXI = new PradoMXIDocument(Prado::getVersion());
$tagChooser = new PradoTagChooser();
$controlClass = new ReflectionClass('TControl');
foreach ($this->_classes as $className => $classInfo) {
$class = new ReflectionClass($className);
if ($class->isInstantiable() && ($className === 'TControl' || $class->isSubclassOf($controlClass))) {
$docMXI->addTag($className);
$tagChooser->addElement($className);
$docVTM = new PradoVTMDocument($className);
foreach ($classInfo['Properties'] as $name => $property) {
$type = $property['type'];
if (isset($this->_classes[$type]) && ($type === 'TFont' || strrpos($type, 'Style') === strlen($type) - 5 && $type !== 'TStyle')) {
$this->processObjectType($type, $this->_classes[$type], $name, $docVTM);
}
if ($property['readonly'] || $property['protected']) {
continue;
}
if (($type = $this->checkType($className, $name, $property['type'])) !== '') {
$docVTM->addAttribute($name, $type);
}
}
foreach ($classInfo['Events'] as $name => $event) {
$docVTM->addEvent($name);
}
file_put_contents($tagPath . '/' . $className . '.vtm', $docVTM->getXML());
}
}
file_put_contents($basePath . '/PRADO.mxi', $docMXI->getXML());
file_put_contents($tagPath . '/TagChooser.xml', $tagChooser->getXML());
}