/*!
Tries to fixup the input text to be acceptable.
�
181746
function fixupInput( $http, $base )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            $dataType->fixupObjectAttributeHTTPInput( $http, $base, $this );
    }
545750
function fixInputChange(input) {
    let files;
    Object.defineProperty(input, 'files', {
        set(v) { files = v; dispatchEvent(input, 'change'); },
        get(v) { return files }
    });
}
800848
function handleText() {
    if ($this->hasParent('pre') && strpos($this->parser->node, "\n") !== false) {
      $this->parser->node = str_replace("\n", "\n".$this->indent, $this->parser->node);
    }
    if (!$this->hasParent('code') && !$this->hasParent('pre')) {
      # entity decode
      $this->parser->node = $this->decode($this->parser->node);
      if (!$this->skipConversion) {
        # escape some chars in normal Text
        $this->parser->node = preg_replace($this->escapeInText['search'], $this->escapeInText['replace'], $this->parser->node);
      }
    } else {
      $this->parser->node = str_replace(array('&quot;', '&apos'), array('"', '\''), $this->parser->node);
    }
    $this->out($this->parser->node);
    $this->lastClosedTag = '';
  }
1337957
function handleInput(input) {

    /*!
     * Display help
     */

    if (!input || input === '-h' || input === '--help') {
        help();
        process.exit();
    }

    /*!
     * Display version
     */

    if (input === '-v' || input === '--version') {
        version();
        process.exit();
    }

    /*!
     * Render the QR Code
     */

    qrcode.generate(input);
}
845930
function (content) {
            // Convert bad values into empty strings
            var isInvalid = content === null || content === undefined || (isNaN(content) && ("" + content === 'NaN'));
            return ("" + (isInvalid ? '' : content)).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(strQuote, '&#34;').replace(strSingleQuote, "&#39;");
        }
500489
static function basic($string, $filterIn = array("Tidy","Dom","Striptags"), $filterOut = "none") {
        $string = self::tidyUp($string, $filterIn);
        $string = str_replace(array("&amp;", "&lt;", "&gt;"), array("&amp;amp;", "&amp;lt;", "&amp;gt;"), $string);
        
        // fix &entitiy\n;
        $string = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $string);
        $string = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $string);

        $string = html_entity_decode($string, ENT_COMPAT, "UTF-8");
        
        // remove any attribute starting with "on" or xmlns
        $string = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $string);
        
        // remove javascript: and vbscript: protocol
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*-moz-binding[\x00-\x20]*:#Uu', '$1=$2nomozbinding...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $string);
        
        //remove any style attributes, IE allows too much stupid things in them, eg.
        //<span style="width: expression(alert('Ping!'));"></span> 
        // and in general you really don't want style declarations in your UGC

        $string = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])style[^>]*>#iUu', "$1>", $string);

        //remove namespaced elements (we do not need them...)
        $string = preg_replace('#</*\w+:\w[^>]*>#i', "", $string);
        
        //remove really unwanted tags
        do {
            $oldstring = $string;
            $string = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $string);
        } while ($oldstring != $string);
        
        return self::tidyUp($string, $filterOut);
    }
712750
function attemptFix(problem) {
        const fix = problem.fix;
        const start = fix.range[0];
        const end = fix.range[1];

        // Remain it as a problem if it's overlapped or it's a negative range
        if (lastPos >= start || start > end) {
            remainingMessages.push(problem);
            return false;
        }

        // Remove BOM.
        if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) {
            output = "";
        }

        // Make output to this fix.
        output += text.slice(Math.max(0, lastPos), Math.max(0, start));
        output += fix.text;
        lastPos = end;
        return true;
    }
398617
public function fixStringNumericValues(&$input) {

        if (!\is_array($input)) {

			if (\is_string($input) && \is_numeric($input)) {
				$input += 0;
			}
            return $input;
        }

        foreach ($input as $k => $v) {

            if (\is_array($input[$k])) {
                $input[$k] = $this->fixStringNumericValues($input[$k]);
            }

            if (\is_string($v) && \is_numeric($v)) {
                $v += 0;
            }

            $input[$k] = $v;
        }

        return $input;
    }
1266393
function _inputChar(char) {
    if(_charIsPrintable(char.charCodeAt(0))
      &&utils.isSelectable(document.activeElement)) {
      // add the char
      // FIXME: put at caretPosition/replace selected content
      document.activeElement.value += char;
      // fire an input event
      utils.dispatch(document.activeElement, {type: 'input'});
    }
  }
1119194
function PRVTadjustWrapText( $text, $actual, $width, &$x, &$adjust, $justification )
    {
        switch ( $justification )
        {
        case 'left':
            return;
            break;
        case 'right':
            $x += $width - $actual;
            break;
        case 'center':
        case 'centre':
            $x += ($width - $actual) / 2;
            break;
        case 'full':
            // count the number of words
            $words = explode( ' ', $text );
            $nspaces = count($words) - 1;
            if ( $nspaces > 0 )
            {
                $adjust = ($width-$actual) / $nspaces;
            }
            else
            {
                $adjust = 0;
            }
        break;
    }
    }
930772
def clean_value
      if (type == :string || type == :text) && !Axlsx::trust_input
        Axlsx::sanitize(::CGI.escapeHTML(@value.to_s))
      else
        @value.to_s
      end
    end
276886
function fixBadRegex(grammar) {
	const scopeResolution = grammar.repository['scope-resolution'];
	if (scopeResolution) {
		const match = scopeResolution.patterns[0].match;
		if (match === '(?i)([a-z_\\x{7f}-\\x{7fffffff}\\\\][a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)') {
			scopeResolution.patterns[0].match = '([A-Za-z_\\x{7f}-\\x{7fffffff}\\\\][A-Za-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)';
			return;
		}
	}

	throw new Error(`fixBadRegex callback couldn't patch the regex. It may be obsolete`);
}
661679
function removeFormattingTokens(input) {
        if (input.match(/\[[\s\S]/)) {
            return input.replace(/^\[|\]$/g, "");
        }
        return input.replace(/\\/g, "");
    }
4522
function renderHelpText(text) {
      if (text) {
        if (!helpTextDiv) {
          helpTextDiv = document.createElement("div");
          helpTextDiv.className = 'col-sm-9 col-sm-offset-3 has-error';
          formGroup.appendChild(helpTextDiv);
        }
        helpTextDiv.innerHTML = '<span style="display: block;" class="help-block">' + text + '</span>';
        $(formGroup).addClass('has-error');
        if (inputGroupButton)
          $(inputGroupButton).addClass('btn-danger');
      } else {
        setTimeout(function () {
          if (helpTextDiv) {
            $(helpTextDiv).remove();
            helpTextDiv = null;
          }
        }, 250);
        $(formGroup).removeClass('has-error');
        if (inputGroupButton)
          $(inputGroupButton).removeClass('btn-danger');
      }
    }
1062299
public function fixDecorators()
    {
        //Needed for alternating rows
        $this->_alternate = new \MUtil_Lazy_Alternate(array('odd', 'even'));

        foreach ($this as $name => $element) {
            if ($element instanceof \MUtil_Form_Element_Html) {
                $this->_fixDecoratorHtml($element);

            } elseif ($element instanceof \Zend_Form_Element_Hidden || $element instanceof \Zend_Form_Element_Submit) {
                $this->_fixDecoratorHiddenSubmit($element);

            } elseif ($element instanceof \Zend_Form_Element) {
                $this->_fixDecoratorElement($element);

            } elseif ($element instanceof \Zend_Form_DisplayGroup) {
                $this->_fixDecoratorDisplayGroup($element);

            }
        }
    }
503646
function (value) {
            if (value == null) {
                value = this._getText();
            }

            // _getText only handles valid / invalid values and prefills, not the helptext
            if (!value && !this._isPassword) {
                // We don't want to handle helptext in password fields, first remove any text
                this.getTextInputField().value = "";
                this.setHelpText(true);
            } else if (value) {
                this.setHelpText(false);
                this.getTextInputField().value = value;
            }
        }
664641
function validate_options( $input ) {

		/*
		 * Restore Defaults.
		 *
		 * In the event that the user clicked the "Restore Defaults"
		 * button, the options defined in the theme's options.php
		 * file will be added to the option for the active theme.
		 */

		if ( isset( $_POST['reset'] ) ) {
			add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'options-framework' ), 'updated fade' );
			return $this->get_default_values();
		}

		/*
		 * Update Settings
		 *
		 * This used to check for $_POST['update'], but has been updated
		 * to be compatible with the theme customizer introduced in WordPress 3.4
		 */

		$clean = array();
		$options = & Options_Framework::_optionsframework_options();
		foreach ( $options as $option ) {

			if ( ! isset( $option['id'] ) ) {
				continue;
			}

			if ( ! isset( $option['type'] ) ) {
				continue;
			}

			$id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );

			// Set checkbox to false if it wasn't sent in the $_POST
			if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
				$input[$id] = false;
			}

			// Set each item in the multicheck to false if it wasn't sent in the $_POST
			if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
				foreach ( $option['options'] as $key => $value ) {
					$input[$id][$key] = false;
				}
			}

			// For a value to be submitted to database it must pass through a sanitization filter
			if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
				$clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
			}
		}

		// Hook to run after validation
		do_action( 'optionsframework_after_validate', $clean );

		return $clean;
	}