This was moved to private because users should just use sanitize for any content
502082
def replace(word)
      case @replacement
      when :vowels then word.gsub(/[aeiou]/i, '*')
      when :stars  then '*' * word.size
      when :nonconsonants then word.gsub(/[^bcdfghjklmnpqrstvwxyz]/i, '*')
      when :default, :garbled then '$@!#%'
      else raise LanguageFilter::UnknownReplacement.new("#{@replacement} is not a known replacement type.")
      end
    end
1197028
def _sanitize(recipe):
        """"""
        recipe = recipe.copy()
        for k in list(recipe):
            if k not in ("start", "error") and int(k) and k != int(k):
                recipe[int(k)] = recipe[k]
                del recipe[k]
        for k in list(recipe):
            if "output" in recipe[k] and not isinstance(
                recipe[k]["output"], (list, dict)
            ):
                recipe[k]["output"] = [recipe[k]["output"]]
            # dicts should be normalized, too
        if "start" in recipe:
            recipe["start"] = [tuple(x) for x in recipe["start"]]
        return recipe
150431
def clean(self):
        
        super().clean()

        # At least a poster (user) or a session key must be associated with
        # the post.
        if self.poster is None and self.anonymous_key is None:
            raise ValidationError(
                _('A user id or an anonymous key must be associated with a post.'),
            )
        if self.poster and self.anonymous_key:
            raise ValidationError(
                _('A user id or an anonymous key must be associated with a post, but not both.'),
            )

        if self.anonymous_key and not self.username:
            raise ValidationError(_('A username must be specified if the poster is anonymous'))
107143
public function sanitize()
    {
        $this->addCustomFilters();
        $this->sanitizer = app('sanitizer')->make($this->input(), $this->filters());
        $this->replace($this->sanitizer->sanitize());
    }
90588
static PyExpr wrapAsSanitizedContent(SanitizedContentKind contentKind, PyExpr pyExpr) {
    String sanitizer = NodeContentKinds.toPySanitizedContentOrdainer(contentKind);
    String approval =
        "sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval("
            + "'Internally created Sanitization.')";
    return new PyExpr(
        sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE);
  }
1076294
function sanitize (msg) {
  if (typeof msg !== 'object') return null
  if (typeof msg.value !== 'object') return null
  if (typeof msg.value.content !== 'object') return null
  if (typeof msg.value.timestamp !== 'number') return null
  if (typeof msg.value.type !== 'string') return null
  return msg
}
1085744
function () {

                this.$raiseEvent("beforeRemoveContent");
                // so that the children section can see that it is useless to remove themselves from
                // their parent:
                this._removingContent = true;
                var content = this._content;
                var contentLength = content.length;
                for (var i = 0; i < contentLength; i++) {
                    var elt = content[i];
                    if (elt._type == TYPE_BEHAVIOR) {
                        var bhv = elt.behavior;
                        if (elt.id && this.idMap) {
                            this.idMap[elt.id] = null;
                            delete this.idMap[elt.id];
                        }
                        bhv.$dispose();
                    } else {
                        elt.$dispose();
                    }
                }
                this._content = [];
                this._initWidgetsDone = false;
                this._removingContent = false;
                this.$raiseEvent("afterRemoveContent");
            }
219714
def remove_perm(perm, user_or_group, forum=None):
    
    user, group = get_identity(user_or_group)
    perm = ForumPermission.objects.get(codename=perm)
    if user:
        UserForumPermission.objects.filter(
            forum=forum,
            permission=perm,
            user=user if not user.is_anonymous else None,
            anonymous_user=user.is_anonymous,
        ).delete()
    if group:
        GroupForumPermission.objects.filter(forum=forum, permission=perm, group=group).delete()
211997
function _sanitize (chunk) {

  if (chunk && typeof chunk === 'object' && chunk.toString) {
    chunk = chunk.toString();
  }
  if (typeof chunk === 'string') {
    chunk = chunk.replace(/^[\s\n]*/, '');
    chunk = chunk.replace(/[\s\n]*$/, '');
  }
  return chunk;
}
54411
protected function sanitize()
    {
        $sanitized = sanitizer()->make(
            $this->all(),
            $this->sanitizerRules()
        );

        $this->replace($sanitized);
    }
771845
private function sanitizeGlobals() {
		// It would be "wrong" to unset any of these GLOBALS.
		$protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', 'GLOBALS', 'system_folder', 'application_folder', 'BM', 'EXT', 'CFG', 'URI', 'RTR', 'OUT', 'IN');
		
		// Unset globals for securiy.
		// This is effectively the same as register_globals = off
		foreach (array($_GET, $_POST, $_COOKIE) as $global) {
			if (!is_array($global)) {
				if (!in_array($global, $protected)) {
					global $$global;
					$$global = NULL;
				}
			} else {
				foreach ($global as $key => $val) {
					if (!in_array($key, $protected)) {
						global $$key;
						$$key = NULL;
					}
				}
			}
		}
		
		// Is $_GET data allowed? If not we'll set the $_GET to an empty array
		if (is_array($_GET) and count($_GET) > 0) {
			foreach ($_GET as $key => $val) {
				$_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
			}
		}
		
		// Clean $_POST Data
		if (is_array($_POST) and count($_POST) > 0) {
			foreach ($_POST as $key => $val) {
				$_POST[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
			}
		}
		
		// Clean $_COOKIE Data
		if (is_array($_COOKIE) and count($_COOKIE) > 0) {
			// Also get rid of specially treated cookies that might be set by a
			// server
			// or silly application, that are of no use to a CI application
			// anyway
			// but that when present will trip our 'Disallowed Key Characters'
			// alarm
			// http://www.ietf.org/rfc/rfc2109.txt
			// note that the key names below are single quoted strings, and are
			// not PHP variables
			unset($_COOKIE['$Version']);
			unset($_COOKIE['$Path']);
			unset($_COOKIE['$Domain']);
			
			foreach ($_COOKIE as $key => $val) {
				$_COOKIE[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
			}
		}
		
		// Sanitize PHP_SELF
		$_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
		
		// CSRF Protection check
		if ($this->_enable_csrf == TRUE) {
			Security::csrf_verify();
		}
		
	}
272180
def remove_private_obfuscation(self):
    
    classname = self.__class__.__name__
    attrlist = [attr for attr in dir(self) if attr.startswith('_' + classname + '__')]
    for attr in attrlist:
        method = getattr(self, attr)
        truename = attr.replace('_' + classname + '__', '__')
        setattr(self, truename, method)
459845
def sanitize!
      self.class.sanitizable_attributes.each do |attr_name|
        cleaned_text = process_text_via_sanitization_method(self.send(attr_name), attr_name)
        self.send((attr_name.to_s + '='), cleaned_text)
      end
    end
1103752
function htmlSanitizer(html, needHtmlText) {
  const $html = $('<div />');

  html = html.replace(/<!--[\s\S]*?-->/g, '');

  $html.append(html);

  removeUnnecessaryTags($html);
  leaveOnlyWhitelistAttribute($html);

  return finalizeHtml($html, needHtmlText);
}
72922
private function _sanitize_class() {
		if ( isset( $this->attr['class'] ) && is_string( $this->attr['class'] ) ) {
			$this->attr['class'] = explode( ' ', $this->attr['class'] );
		}
		if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
			$this->attr['class'] = array();
		}
	}
389020
public static SanitizedContent fromSafeStyle(SafeStyle style) {
    return SanitizedContent.create(style.getSafeStyleString(), ContentKind.CSS);
  }
878651
function sanitizeStyle(value) {
    value = String(value).trim(); // Make sure it's actually a string.
    if (!value)
        return '';
    // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
    // reasoning behind this.
    var /** @type {?} */ urlMatch = value.match(URL_RE);
    if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
        value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
        return value; // Safe style values.
    }
    if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* isDevMode */])()) {
        getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
    }
    return 'unsafe';
}