summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/I18N/TI18NControl.php2
-rw-r--r--framework/I18N/TNumberFormat.php2
-rw-r--r--framework/I18N/TTranslate.php2
-rw-r--r--framework/PradoBase.php4
-rw-r--r--framework/TApplication.php5
-rw-r--r--framework/Util/TPropelLogRoute.php98
-rw-r--r--framework/Web/THttpResponse.php10
-rw-r--r--framework/Web/UI/TTemplateManager.php2
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php2
9 files changed, 16 insertions, 111 deletions
diff --git a/framework/I18N/TI18NControl.php b/framework/I18N/TI18NControl.php
index e6aed0fa..efe3ac84 100644
--- a/framework/I18N/TI18NControl.php
+++ b/framework/I18N/TI18NControl.php
@@ -42,7 +42,7 @@ class TI18NControl extends TControl
*/
public function getCharset()
{
- $app = $this->getApplication()->getGlobalization();
+ $app = $this->getApplication()->getGlobalization(false);
//instance charset
$charset = $this->getViewState('Charset','');
diff --git a/framework/I18N/TNumberFormat.php b/framework/I18N/TNumberFormat.php
index 4dc1e3ee..76373a8e 100644
--- a/framework/I18N/TNumberFormat.php
+++ b/framework/I18N/TNumberFormat.php
@@ -166,7 +166,7 @@ class TNumberFormat extends TI18NControl
*/
protected function getFormattedValue()
{
- $app = $this->Application->getGlobalization();
+ $app = $this->getApplication()->getGlobalization();
//initialized the default class wide formatter
if(is_null(self::$formatter))
self::$formatter = new NumberFormat($app->getCulture());
diff --git a/framework/I18N/TTranslate.php b/framework/I18N/TTranslate.php
index 0a03b506..6a30f3a6 100644
--- a/framework/I18N/TTranslate.php
+++ b/framework/I18N/TTranslate.php
@@ -168,7 +168,7 @@ class TTranslate extends TI18NControl
*/
protected function translateText($text, $subs)
{
- $app = $this->Application->getGlobalization();
+ $app = $this->getApplication()->getGlobalization();
//no translation handler provided
if(is_null($config = $app->getTranslationConfiguration()))
diff --git a/framework/PradoBase.php b/framework/PradoBase.php
index 08e503b1..7e631cb8 100644
--- a/framework/PradoBase.php
+++ b/framework/PradoBase.php
@@ -533,14 +533,14 @@ class PradoBase
public static function localize($text, $parameters=array(), $catalogue=null, $charset=null)
{
Prado::using('System.I18N.Translation');
- $app = Prado::getApplication()->getGlobalization();
+ $app = Prado::getApplication()->getGlobalization(false);
$params = array();
foreach($parameters as $key => $value)
$params['{'.$key.'}'] = $value;
//no translation handler provided
- if(($config = $app->getTranslationConfiguration())===null)
+ if($app===null || ($config = $app->getTranslationConfiguration())===null)
return strtr($text, $params);
Translation::init();
diff --git a/framework/TApplication.php b/framework/TApplication.php
index 893856de..ef2fd1a1 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -755,10 +755,13 @@ class TApplication extends TComponent
}
/**
+ * @param boolean whether to create globalization if it does not exist
* @return TGlobalization globalization module
*/
- public function getGlobalization()
+ public function getGlobalization($createIfNotExists=true)
{
+ if($this->_globalization===null && $createIfNotExists)
+ $this->_globalization=new TGlobalization;
return $this->_globalization;
}
diff --git a/framework/Util/TPropelLogRoute.php b/framework/Util/TPropelLogRoute.php
deleted file mode 100644
index eb87ca19..00000000
--- a/framework/Util/TPropelLogRoute.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/**
- * TLogger class file
- *
- * @author Jason Ragsdale <jrags@jasrags.net>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Revision: $ $Date: $
- * @package System.Util
- */
-
-/**
- * TPropelLogRoute class.
- *
- * TPropelLogRoute saves selected log messages into a Propel database.
- * The name of the Propel database object used to represent each message
- * is specified by {@link setPropelObjectName PropelObjectName}, which defaults
- * to 'PradoLog'.
- *
- * The schema of the Propel object must be as follows (the table name can be
- * changed to the value of {@link getPropelObjectName PropelObjectName}.
- * <code>
- * <table name="Pradolog">
- * <column
- * name="ID"
- * required="true"
- * primaryKey="true"
- * autoIncrement="true"
- * type="INTEGER" />
- * <column
- * name="Category"
- * required="true"
- * type="VARCHAR"
- * size="255" />
- * <column
- * name="Level"
- * required="true"
- * type="VARCHAR"
- * size="255" />
- * <column
- * name="Message"
- * required="true"
- * type="LONGVARCHAR"
- * size="2048" />
- * <column
- * name="Time"
- * required="true"
- * type="DOUBLE"
- * size="14"
- * scale="4" />
- * </table>
- * </code>
- *
- * @author Jason Ragsdale <jrags@jasrags.net>
- * @version $Revision: $ $Date: $
- * @package System.Util
- * @since 3.0
- */
-class TPropelLogRoute extends TLogRoute
-{
- private $_className='Pradolog';
-
- /**
- * @return string the name of the Prople object used to save each log message. Defaults to 'PradoLog'.
- */
- public function getPropelObjectName()
- {
- return $this->_className;
- }
-
- /**
- * @param string the name of the Prople object used to save each log message. The name can be in namespace format.
- */
- public function setPropelObjectName($value)
- {
- $this->_className=$value;
- }
-
- /**
- * Saves log messages to the Propel database object.
- *
- * @param array $logs
- */
- protected function processLogs($logs)
- {
- foreach($logs as $log)
- {
- $pradoLog=Prado::createComponent($this->_className);
- $pradoLog->setMessage($log[0]);
- $pradoLog->setLevel($this->getLevelName($log[1]));
- $pradoLog->setCategory($log[2]);
- $pradoLog->setTime($log[3]);
- $pradoLog->save();
- }
- }
-}
-?> \ No newline at end of file
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index d4a62cc6..f76218ca 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -69,7 +69,7 @@ class THttpResponse extends TModule implements ITextWriter
/**
* @var string character set, e.g. UTF-8
*/
- private $_charset;
+ private $_charset='';
/**
* Destructor.
@@ -285,10 +285,10 @@ class THttpResponse extends TModule implements ITextWriter
*/
protected function sendContentTypeHeader()
{
- $charset = $this->getCharset();
- if(empty($charset) && ($globalization=$this->getApplication()->getGlobalization())!==null)
- $charset = $globalization->getCharset();
- if(!empty($charset))
+ $charset=$this->getCharset();
+ if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
+ $charset=$globalization->getCharset();
+ if($charset==='')
{
$header='Content-Type: '.$this->getContentType().';charset='.$charset;
$this->appendHeader($header);
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 488a3a3b..6b7202f7 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -105,7 +105,7 @@ class TTemplateManager extends TModule
*/
protected function getLocalizedTemplate($filename)
{
- if(($app=$this->getApplication()->getGlobalization())===null)
+ if(($app=$this->getApplication()->getGlobalization(false))===null)
return $filename;
foreach($app->getLocalizedResource($filename) as $file)
{
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 9bb352d6..c6a2345b 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -406,7 +406,7 @@ class TDatePicker extends TTextBox
*/
protected function getCurrentCulture()
{
- $app = $this->getApplication()->getGlobalization();
+ $app = $this->getApplication()->getGlobalization(false);
return $this->getCulture() == '' ?
($app ? $app->getCulture() : 'en') : $this->getCulture();
}