Вставляет  JavaScript  в  конец   выходного  потока
@param string  Код  скрипта
@param  boolean Если  true  - вставка  после  загрузки  документа в  браузер
496840
public function addJavaScript($js, $docready = false)
    {

        if ($docready === true) {
            $this->JSrenderDocReady .= ( $js . "\n");
        } else {
            $this->JSrender .= ( $js . "\n");
        }
    }
223107
function isBoolean(value) {

    if (typeof(value) == "undefined") {
        return false;
    }

    if (typeof value === 'boolean') {
        return true;
    };

    var b = value.toString().trim().toLowerCase();

    return b === 'true' || b === 'false';
}
722527
public function render($echo = false)
    {
        $name = $this->field->getName();
        $display = $this->field->getDisplayName();
        $value = $this->getValue();
        $readOnly = $this->getReadOnlyString();
        $required = $this->getRequiredString();
        $crud = $this->field->getCRUD();
        $key = self::$apiKey;
        $longitudeFieldName = $this->longitudeField->getName();

        $html  = <<< HTML
        <div class="form-group">
            <label for="field-$name">$display</label>
            <input id="field-$name" class="form-control"  type="hidden" name="$name" value="$value" $readOnly $required />
            <div id="map-$name" style="width:100%; height:500px"></div>
        </div>
HTML;

        $crud->addScript(<<< HTML
        

<script src="https://maps.googleapis.com/maps/api/js?key=$key"></script>
        
<script>
    $(document).ready(function () {
        var latitude =  $("#field-$name").val();
        var longitude = $("#field-$longitudeFieldName").val();
        var zoom = 14;
        var LatLng = new google.maps.LatLng(latitude, longitude);

        var mapOptions = {
              zoom: zoom,
              center: LatLng,
              panControl: false,
              zoomControl: false,
              scaleControl: true,
              mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        var map = new google.maps.Map(document.getElementById("map-$name"), mapOptions);

        var marker = new google.maps.Marker({
            position: LatLng,
            map: map,
            title: 'Drag Me!',
            draggable: true
        });
        
        google.maps.event.addListener(map, 'click', function(event) {
           marker.setPosition(event.latLng);
           $("#field-$name").val(latLng.lat());
           $("#field-$longitudeFieldName").val(latLng.lng());
        });

        google.maps.event.addListener(marker, 'dragend', function(marker) {
            var latLng = marker.latLng;
            $("#field-$name").val(latLng.lat());
            $("#field-$longitudeFieldName").val(latLng.lng());
        });
    });
</script>
HTML
        );

        if ($echo)
            echo $html;

        return $html;
    }
649707
public function setChannelSyncing($boolean)
    {
        if ($boolean) {
            $this->_channelsyncing = true;
            $this->log(SMARTIRC_DEBUG_CHANNELSYNCING,
                'DEBUG_CHANNELSYNCING: Channel syncing enabled',
                __FILE__, __LINE__
            );
        } else {
            $this->_channelsyncing = false;
            $this->log(SMARTIRC_DEBUG_CHANNELSYNCING,
                'DEBUG_CHANNELSYNCING: Channel syncing disabled',
                __FILE__, __LINE__
            );
        }
        return $this->_channelsyncing;
    }
20902
public function render($echo = false)
    {
        $name = $this->field->getName();
        $display = $this->field->getDisplayName();
        $defaultValue = $this->field->getDefaultValue();
        $bean = $this->field->getBean();
        $value = $this->getValue();
        $readOnly = $this->getReadOnlyString();
        $required = $this->getRequiredString();
        $crud = $this->field->getCRUD();

        $uploadURL = \LouisLam\Util::url("louislam-crud/upload");

        $html  = <<< HTML
        <label for="field-$name">$display </label>
        <textarea id="field-$name" class="editor" name="$name" $readOnly $required style="width:100%">$value</textarea>
HTML;

        $fullFeatures = ($this->fullFeatures) ? "true" : "false";

        $crud->addScript(<<< HTML

        <script>
        $(document).ready(function () {
                var element = $( 'textarea.editor[name=$name]' );
                var fullFeatures = $fullFeatures;

              var ckConfig = {
                    height: 600,
                    width: "100%",
                    extraPlugins: 'uploadimage',
                    imageUploadUrl: '$uploadURL/json',
                    filebrowserImageUploadUrl: '$uploadURL/js',
                    allowedContent: true
                };

                if (fullFeatures) {
                        ckConfig.plugins = "dialogui,dialog,a11yhelp,about,basicstyles,bidi,blockquote,clipboard," +
"button,panelbutton,panel,floatpanel,colorbutton,colordialog,menu," +
"contextmenu,dialogadvtab,div,elementspath,enterkey,entities,popup," +
"filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo," +
"font,format,forms,horizontalrule,htmlwriter,iframe,image,indent," +
"indentblock,indentlist,justify,link,list,liststyle,magicline," +
"maximize,newpage,pagebreak,pastefromword,pastetext,preview,print," +
"removeformat,resize,save,menubutton,scayt,selectall,showblocks," +
"showborders,smiley,sourcearea,specialchar,stylescombo,tab,table," +
"tabletools,templates,toolbar,undo,wsc,wysiwygarea";
                        ckConfig.toolbar = 'Full';

                        ckConfig.toolbar_Full = [
                            { name: 'document', items : [ 'Source','-', 'NewPage','DocProps','Preview','Print','-','Templates' ] },
                            { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
                            { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
                            { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
                            'HiddenField' ] },
                            '/',
                            { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
                            { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv',
                            '-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
                            { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
                            { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
                            '/',
                            { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
                            { name: 'colors', items : [ 'TextColor','BGColor' ] },
                            { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
                    ];
                }

            element.ckeditor(ckConfig);

            element.ckeditor().resize("100%");
        });

        </script>
HTML
);

        if ($echo)
            echo $html;

        return $html;
    }
93259
public static function boolean($input, $field_name = 'boolean')
    {
        //Define trivial model
        $model = [
            $field_name => ['type' => Validate::TYPE_BOOLEAN, Validate::REQUIRED]
        ];

        $parameters = [$field_name => $input];
        Validate::model($parameters, $model);

        return $parameters[$field_name];
    }
1109685
public function when($value, $true_call, $false_call = null)
    {
        if ($value) {
            $true_call($this, $value);
        } elseif ($false_call) {
            $false_call($this, $value);
        }

        return $this;
    }
1327979
def boolean(value):
    
    if isinstance(value, bool):
        return value

    if value == "":
        return False

    return strtobool(value)
599151
static function bool($value, &$error, $args)
    {
        if ($value===true || $value===false){
            return $value;
        }
        if (is_string($value)){
            return !in_array(mb_strtolower($value), ['false', '', '0']);
        }
        if (is_scalar($value)){
            return (bool)$value;
        }
        $error = new Error('Должно быть логическим (true/false, 1/0)', 'bool');
        return (bool)$value;
    }
264585
public static function setIsDebug(bool $bool): void
    {
        if (self::isCliApp()) {
            self::$IS_DEBUG = $bool;
        } else {
            MSession::set(MCoreApplication::DEBUG, $bool);
        }
    }
741632
function(kb) {
			if (!kb) { return false; }
			if (this.keyCode !== kb.keyCode) { return false; }
			if (this.mod1 !== kb.mod1) { return false; }
			if (this.mod2 !== kb.mod2) { return false; }
			if (this.mod3 !== kb.mod3) { return false; }
			if (this.mod4 !== kb.mod4) { return false; }
			if (this.type !== kb.type) { return false; }
			return true;
		}
377016
protected function setOption(int $option, bool $bool) : void
    {
        if ($bool) {
            $this->options |= $option;
        } else {
            $this->options &= ~ $option;
        }
    }
651379
public function setXML($value = FALSE)
    {
        if (!$value) {
            $this->isXML = FALSE;
        } else {
            $this->isXML = TRUE;
        }
    }
624339
public static function booleanSwitch(string $name = '', array $values = [], bool $active = false,
                                         array $attributes = []): string
    {
        $defaultAttributes = ['method-get' => false];
        $userAttributes = \array_merge($defaultAttributes, $attributes);
        $isEnabled = !\array_key_exists('disabled', $userAttributes);
        $attributes = [];
        $attributes['type'] = 'hidden';
        $attributes['name'] = $userAttributes['method-get'] === false ? \sprintf('MFVARS[%s]', $name) : $name;
        $attributes['value'] = $active === true ? 1 : 0;
        $attributes['id'] = isset($userAttributes['id']) ? $userAttributes['id'] : $name;
        $userAttributes = static::clearAttributes($userAttributes, ['method-get', 'id', 'disabled']);

        $switch = [];
        $switch[] = Tags::div(Tags::i(), ['class' => 'switch cf']);
        $switch[] = Tags::label($values[0], ['class' => 'label-0']);
        $switch[] = Tags::label($values[1], ['class' => 'label-1']);
        $switch[] = Tags::input(\array_merge($attributes, $userAttributes));

        $class = ['form-switch', 'cf'];
        if ($active === true) {
            $class[] = 'active';
        }
        if (!$isEnabled) {
            $class[] = 'disabled';
        }
        return Tags::div($switch, ['class' => \implode(' ', $class)]);
    }
941923
function boolOrFn(val, args) {
    if (typeof val == TYPE_FUNCTION) {
        return val.apply(args ? args[0] || undefined : undefined, args);
    }
    return val;
}
1131625
public static function bool($string): bool
    {
        $yesList = [
            'affirmative',
            'all right',
            'aye',
            'indubitably',
            'most assuredly',
            'ok',
            'of course',
            'oui',
            'okay',
            'sure thing',
            'y',
            'yes',
            'yea',
            'yep',
            'sure',
            'yeah',
            'true',
            't',
            'on',
            '1',
            'vrai',
            'да',
            'д',
            '+',
            '++',
            '+++',
            '++++',
            '+++++',
            '*',
        ];

        $noList = [
            'no*',
            'no way',
            'nope',
            'nah',
            'na',
            'never',
            'absolutely not',
            'by no means',
            'negative',
            'never ever',
            'false',
            'f',
            'off',
            '0',
            'non',
            'faux',
            'нет',
            'н',
            'немає',
            '-',
        ];

        $string = Str::low($string);

        if (Arr::in($string, $yesList) || self::float($string) !== 0.0) {
            return true;
        }

        if (Arr::in($string, $noList)) {
            return false;
        }

        return filter_var($string, FILTER_VALIDATE_BOOLEAN);
    }
651404
public void setBoolean(@NotNull final String key, boolean value) {
        setString(key, Boolean.toString(value));
    }