ensureBoolean() публичный статический Метод

Note, string 'true' (case-insensitive) will be converted to true, string 'false' (case-insensitive) will be converted to false. If a string represents a non-zero number, it will be treated as true.
public static ensureBoolean ( $value ) : boolean
Результат boolean
Пример #1
0
 /**
  * Initialize the TTranslate translation components
  */
 public static function init($catalogue = 'messages')
 {
     static $saveEventHandlerAttached = false;
     //initialized the default class wide formatter
     if (!isset(self::$formatters[$catalogue])) {
         $app = Prado::getApplication()->getGlobalization();
         $config = $app->getTranslationConfiguration();
         $source = MessageSource::factory($config['type'], $config['source'], $config['filename']);
         $source->setCulture($app->getCulture());
         if (isset($config['cache'])) {
             $source->setCache(new MessageCache($config['cache']));
         }
         self::$formatters[$catalogue] = new MessageFormat($source, $app->getCharset());
         //mark untranslated text
         if ($ps = $config['marker']) {
             self::$formatters[$catalogue]->setUntranslatedPS(array($ps, $ps));
         }
         //save the message on end request
         // Do it only once !
         if (!$saveEventHandlerAttached && TPropertyValue::ensureBoolean($config['autosave'])) {
             Prado::getApplication()->attachEventHandler('OnEndRequest', array('Translation', 'saveMessages'));
             $saveEventHandlerAttached = true;
         }
     }
 }
Пример #2
0
 protected function createBooleanControl($container, $column, $record)
 {
     $value = $this->getRecordPropertyValue($column, $record);
     $control = new TCheckBox();
     $control->setChecked(TPropertyValue::ensureBoolean($value));
     $control->setCssClass('boolean-checkbox');
     $this->setDefaultProperty($container, $control, $column, $record);
     return $control;
 }
 public function __construct($dropParams)
 {
     $this->_dragElementId = $dropParams->DragElementID;
     $this->_screenX = $dropParams->ScreenX;
     $this->_screenY = $dropParams->ScreenY;
     $this->_offsetX = isset($dropParams->OffsetX) ? $dropParams->OffsetX : false;
     $this->_offsetY = isset($dropParams->OffsetY) ? $dropParams->OffsetY : false;
     $this->_clientX = $dropParams->ClientX;
     $this->_clientY = $dropParams->ClientY;
     $this->_shiftKey = TPropertyValue::ensureBoolean($dropParams->ShiftKey);
     $this->_ctrlKey = TPropertyValue::ensureBoolean($dropParams->CtrlKey);
     $this->_altKey = TPropertyValue::ensureBoolean($dropParams->AltKey);
 }
Пример #4
0
 /**
  * @param boolean sets whether buffering of output can continue after this point
  */
 public function setContinueBuffering($value)
 {
     $this->_continueBuffering = TPropertyValue::ensureBoolean($value);
 }
 /**
  * @param boolean whether navigation to the next step should be canceled.
  */
 public function setCancelNavigation($value)
 {
     $this->_cancel = TPropertyValue::ensureBoolean($value);
 }
Пример #6
0
 /**
  * @param boolean whether the connection is persistent or not
  * Some DBMS (such as sqlite) may not support this feature.
  */
 public function setPersistent($value)
 {
     return $this->setAttribute(PDO::ATTR_PERSISTENT, TPropertyValue::ensureBoolean($value));
 }
Пример #7
0
 /**
  * Sets the value indicating whether the text content wraps within a multiline text box.
  * @param boolean whether the text content wraps within a multiline text box.
  */
 public function setWrap($value)
 {
     $this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true);
 }
Пример #8
0
 /**
  * @param boolean whether the subdirectories of the directory will also be checked.
  */
 public function setRecursiveCheck($value)
 {
     $this->_recursiveCheck = TPropertyValue::ensureBoolean($value);
 }
Пример #9
0
 /**
  * @param boolean whether the item is selected
  */
 public function setSelected($value)
 {
     $this->_selected = TPropertyValue::ensureBoolean($value);
 }
Пример #10
0
 /**
  * @param bool wether this control is valid.
  */
 public function setIsValid($value)
 {
     $this->_isValid = TPropertyValue::ensureBoolean($value);
 }
Пример #11
0
 /**
  * Sets a value indicating whether cached output will be used on postback requests.
  * By default, this is disabled. Be very cautious when enabling it.
  * If the cached content including interactive user controls such as
  * TTextBox, TDropDownList, your page may fail to render on postbacks.
  * @param boolean whether cached output will be used on postback requests.
  */
 public function setCachingPostBack($value)
 {
     $this->_cachePostBack = TPropertyValue::ensureBoolean($value);
 }
Пример #12
0
 /**
  * Sets the value indicating whether the content wraps within the table item.
  * @param boolean whether the content wraps within the panel.
  */
 public function setWrap($value)
 {
     $this->_wrap = TPropertyValue::ensureBoolean($value);
 }
Пример #13
0
 /**
  * Set true to cache sqlmap instances.
  * @param boolean true to cache sqlmap instance.
  */
 public function setEnableCache($value)
 {
     $this->_enableCache = TPropertyValue::ensureBoolean($value);
 }
Пример #14
0
 /**
  * @param boolean whether postback event trigger by this button will cause input validation
  */
 public function setCausesValidation($value)
 {
     $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true);
 }
Пример #15
0
 /**
  * @param boolean whether the keys are case-sensitive.
  */
 public function setCaseSensitive($value)
 {
     $this->_caseSensitive = TPropertyValue::ensureBoolean($value);
 }
Пример #16
0
 /**
  * @param boolean whether the pager is visible.
  */
 public function setVisible($value)
 {
     $this->_visible = TPropertyValue::ensureBoolean($value);
 }
Пример #17
0
 /**
  * Sets a value indicating whether a databind call is required by the data bound control.
  * If true and the control has been prerendered while it uses the data source
  * specified by {@link setDataSourceID}, a databind call will be called by this method.
  * @param boolean whether a databind call is required.
  */
 protected function setRequiresDataBinding($value)
 {
     $value = TPropertyValue::ensureBoolean($value);
     if ($value && $this->_prerendered) {
         $this->_requiresDataBinding = true;
         $this->ensureDataBound();
     } else {
         $this->_requiresDataBinding = $value;
     }
 }
Пример #18
0
 /**
  * @param boolean whether there should be a visual separator between the frames.
  */
 public function setShowBorder($value)
 {
     $this->setViewState('ShowBorder', TPropertyValue::ensureBoolean($value), true);
 }
Пример #19
0
 /**
  * Wrapper for {@link setReadOnly ReadOnly} property.
  * @param boolean whether the rating list can be edited
  */
 public function setEnabled($value)
 {
     $this->setReadOnly(!TPropertyValue::ensureBoolean($value));
 }
Пример #20
0
 /**
  * @param boolean whether this tab view is active.
  */
 public function setActive($value)
 {
     $this->_active = TPropertyValue::ensureBoolean($value);
 }
Пример #21
0
 /**
  * @param boolean whether page state should be compressed.
  * @since 3.1.6
  */
 public function setEnableStateCompression($value)
 {
     $this->_enableStateCompression = TPropertyValue::ensureBoolean($value);
 }
Пример #22
0
 /**
  * @param boolean true to allow fine grain callback updates.
  */
 public function setEnableUpdate($value)
 {
     $this->setOption('EnableUpdate', TPropertyValue::ensureBoolean($value), true);
 }
Пример #23
0
 /**
  * @param bool whether to flush script files using TClientScriptManager::flushScriptFiles() before rendering the script block
  */
 public function setFlushScriptFiles($value)
 {
     $this->setViewState('FlushScriptFiles', TPropertyValue::ensureBoolean($value));
 }
Пример #24
0
 /**
  * Set the option to trim the contents.
  * @param boolean trim or not.
  */
 public function setTrim($value)
 {
     $this->setViewState('Trim', TPropertyValue::ensureBoolean($value), true);
 }
Пример #25
0
 /**
  * @param boolean whether this list is read-only or not
  */
 protected function setReadOnly($value)
 {
     $this->_r = TPropertyValue::ensureBoolean($value);
 }
Пример #26
0
 /**
  * @param boolean whether the items in the column can be edited
  */
 public function setReadOnly($value)
 {
     $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false);
 }
Пример #27
0
 /**
  * @param boolean whether to render javascript.
  */
 public function setEnableClientScript($value)
 {
     $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true);
 }
Пример #28
0
 /**
  * @param boolean true to start the timer when page loads.
  */
 public function setStartTimerOnLoad($value)
 {
     $this->setViewState('StartTimerOnLoad', TPropertyValue::ensureBoolean($value), false);
 }
Пример #29
0
 /**
  * @param boolean  whether the rendered text should be HTML-encoded.
  */
 public function setEncode($value)
 {
     $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false);
 }
Пример #30
0
 /**
  * @param boolean whether this step can be re-visited.
  */
 public function setAllowReturn($value)
 {
     $this->setViewState('AllowReturn', TPropertyValue::ensureBoolean($value), true);
 }