remove disallowed content elements from wizard items

@param array $allowed
@param array $disallowed
@param array $wizardItems
554543
public function removeDisallowedWizardItems(array $allowed, array $disallowed, array &$wizardItems)
    {
        foreach ($wizardItems as $key => $wizardItem) {
            if (!$wizardItems[$key]['header']) {
                if (
                    (
                        !empty($allowed['CType']) &&
                        !isset($allowed['CType'][$wizardItems[$key]['tt_content_defValues']['CType']]) &&
                        !isset($allowed['CType']['*'])
                    ) ||
                    (
                        !empty($disallowed) && (
                            isset($disallowed['CType'][$wizardItems[$key]['tt_content_defValues']['CType']]) ||
                            isset($disallowed['CType']['*'])
                        )
                    ) ||
                    (
                        isset($wizardItems[$key]['tt_content_defValues']['list_type']) &&
                        !empty($allowed['list_type']) &&
                        !isset($allowed['list_type'][$wizardItems[$key]['tt_content_defValues']['list_type']]) &&
                        !isset($allowed['list_type']['*'])
                    ) ||
                    (
                        isset($wizardItems[$key]['tt_content_defValues']['list_type']) &&
                        !empty($disallowed) && (
                            isset($disallowed['list_type'][$wizardItems[$key]['tt_content_defValues']['list_type']]) ||
                            isset($disallowed['list_type']['*'])
                        )
                    )
                ) {
                    unset($wizardItems[$key]);
                }
            }
        }
    }
546207
def remove_prohibited_element(tag_name, document_element):
    
    elements = document_element.getElementsByTagName(tag_name)
    for element in elements:
        p = element.parentNode
        p.removeChild(element)
31588
public function onAllowedThemeList(AllowListEvent $event)
    {
        if ($group = $this->findMostRelevantGroup()) {
            if ($themes = $group->getAttribute('allowed_themes')) {
                $event->removeNotIn($themes);
            }
        }
    }
134786
public function removeAllowedExtension($extension)
    {
        $key = array_search($extension, $this->allowedExtensions);
        if ($key !== false) {
            unset($this->allowedExtensions[$key]);
            return true;
        }

        return false;
    }
163682
function applyFilter(data, restrictedFields, allowedFields) {
    var filterFunc;

    // if string, something like a sort where each word should be a value
    var isString = _.isString(data);
    if (isString) { data = data.split(' '); }

    if (restrictedFields) {
        filterFunc = _.isArray(data) ? removeItemsFromList : removeFieldsFromObj;
        data = filterFunc(data, restrictedFields);
    }
    else if (allowedFields) {
        filterFunc = _.isArray(data) ? getItemsFromList : getFieldsFromObj;
        data = filterFunc(data, allowedFields);
    }

    return isString ? data[0] : data;
}
781627
public function allowMethods(array $excepted)
    {
        if (count($excepted) == 0) {
            throw new AccessControlException(
                'Parameter is empty.',
                E_USER_ERROR
            );
        }

        return $this->push('Access-Control-Allow-Methods', implode(', ', $excepted));
    }
1126243
public function methodNotAllowed(string $requestMethod, array $allowedMethods): Error
    {
        $this->status->methodNotAllowed($allowedMethods);
        return Error::methodNotAllowed($requestMethod, $allowedMethods);
    }
496418
public function RemoveRestrictedItems()
    {
        // since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them
        $aValidIds = array();
        $this->GoToStart();
        while ($oItem = &$this->Next()) {
            if ($oItem->IsPublic()) {
                $aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id);
            }
        }

        $query = 'SELECT `shop_shipping_type`.*
                  FROM `shop_shipping_type`
                 WHERE ';
        if (count($aValidIds) > 0) {
            $query .= " `shop_shipping_type`.`id` IN ('".implode("','", $aValidIds)."') ";
        } else {
            $query .= ' 1 = 0 ';
        }
        $query .= ' ORDER BY `shop_shipping_type`.`position`';
        $this->Load($query);
    }
1122567
public function toArray(array $allowed = null)
	{
		if ( ! $this->_toArray() || $this->isModified())
		{
			$response = $this->client->send((new Request($this->uri->withPath($this->uri->getPath().'trash/resources')
			                                                       ->withQuery(http_build_query(array_merge($this->getParameters($this->parametersAllowed), [
					'path' => $this->getPath()
				]), null, '&')), 'GET')));

			if ($response->getStatusCode() == 200)
			{
				$response = json_decode($response->getBody(), true);

				if ( ! empty($response))
				{
					$this->isModified = false;

					if (isset($response['_embedded']))
					{
						$response = array_merge($response, $response['_embedded']);
					}

					unset($response['_links'], $response['_embedded']);

					if (isset($response['items']))
					{
						$response['items'] = new Container\Collection(array_map(function($item) {
							return new self($item, $this->client, $this->uri);
						}, $response['items']));
					}
					
					$this->setContents($response);
				}
			}
		}

		return $this->_toArray($allowed);
	}
632563
function permittedAttributes() {
        let filteredKeys = ghostBookshelf.Model.prototype.permittedAttributes.apply(this, arguments);

        this.relationships.forEach((key) => {
            filteredKeys.push(key);
        });

        return filteredKeys;
    }
1360292
protected function filterDetectedRules(array $rules, AppliesToResource $resource)
    {

        if (!$this->typeProvider) {
            return $rules;
        }

        $filteredRules = [];

        foreach ($rules as $key=>$rule) {

            if (!$type = $this->xType($key)) {
                continue;
            }

            if ($this->shouldRemoveRules($key, $type)) {
                continue;
            }

            if ($type->readonly) {
                $filteredRules[$key] = 'forbidden';
                continue;
            }

            $filteredRules[$key] = $rule;
        }

        return $filteredRules;
    }
658933
private function getAllowedConverter($extension = null)
    {
        $allowedConverter = [
            ''     => ['pdf'],
            'pptx' => ['pdf'],
            'ppt'  => ['pdf'],
            'pdf'  => ['pdf'],
            'docx' => ['pdf', 'odt', 'html'],
            'doc'  => ['pdf', 'odt', 'html'],
            'wps'  => ['pdf', 'odt', 'html'],
            'dotx' => ['pdf', 'odt', 'html'],
            'docm' => ['pdf', 'odt', 'html'],
            'dotm' => ['pdf', 'odt', 'html'],
            'dot'  => ['pdf', 'odt', 'html'],
            'odt'  => ['pdf', 'html'],
            'xlsx' => ['pdf'],
            'xls'  => ['pdf'],
            'png'  => ['pdf'],
            'jpg'  => ['pdf'],
            'jpeg' => ['pdf'],
            'jfif' => ['pdf'],
            'PPTX' => ['pdf'],
            'PPT'  => ['pdf'],
            'PDF'  => ['pdf'],
            'DOCX' => ['pdf', 'odt', 'html'],
            'DOC'  => ['pdf', 'odt', 'html'],
            'WPS'  => ['pdf', 'odt', 'html'],
            'DOTX' => ['pdf', 'odt', 'html'],
            'DOCM' => ['pdf', 'odt', 'html'],
            'DOTM' => ['pdf', 'odt', 'html'],
            'DOT'  => ['pdf', 'odt', 'html'],
            'ODT'  => ['pdf', 'html'],
            'XLSX' => ['pdf'],
            'XLS'  => ['pdf'],
            'PNG'  => ['pdf'],
            'JPG'  => ['pdf'],
            'JPEG' => ['pdf'],
            'JFIF' => ['pdf'],
            'Pptx' => ['pdf'],
            'Ppt'  => ['pdf'],
            'Pdf'  => ['pdf'],
            'Docx' => ['pdf', 'odt', 'html'],
            'Doc'  => ['pdf', 'odt', 'html'],
            'Wps'  => ['pdf', 'odt', 'html'],
            'Dotx' => ['pdf', 'odt', 'html'],
            'Docm' => ['pdf', 'odt', 'html'],
            'Dotm' => ['pdf', 'odt', 'html'],
            'Dot'  => ['pdf', 'odt', 'html'],
            'Ddt'  => ['pdf', 'html'],
            'Xlsx' => ['pdf'],
            'Xls'  => ['pdf'],
            'Png'  => ['pdf'],
            'Jpg'  => ['pdf'],
            'Jpeg' => ['pdf'],
            'Jfif' => ['pdf'],
            'rtf'  => ['docx', 'txt']
        ];

        if ($extension !== null) {
            if (isset($allowedConverter[$extension])) {
                return $allowedConverter[$extension];
            }

            return [];
        }

        return $allowedConverter;
    }
1102640
protected function _removeFromDisabledModulesArray($aDeletedExtIds)
    {
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aDisabledExtensionIds = $this->getDisabledModules();
        $aDisabledExtensionIds = array_diff($aDisabledExtensionIds, $aDeletedExtIds);
        $oConfig->saveShopConfVar('arr', 'aDisabledModules', $aDisabledExtensionIds);
    }
93752
def disable_restricted(self, ):
        
        todisable = [(self.reftrack.duplicate, self.duplicate_tb),
                     (self.reftrack.delete, self.delete_tb),
                     (self.reftrack.reference, self.reference_tb),
                     (self.reftrack.replace, self.replace_tb),]
        for action, btn in todisable:
            res = self.reftrack.is_restricted(action)
            btn.setDisabled(res)
107205
public function filter($level, $allowed)
    {
        if (empty($allowed)) {
            return true;
        }

        if (is_array($allowed)) {
            $merges = array_values(array_uintersect($this->levels, $allowed, "strcasecmp"));
            if (in_array(strtolower($level), $merges)) {
                return true;
            }
        }

        return false;
    }
965286
public function withAllowedMethods(array $allowedMethods): self
    {
        foreach ($allowedMethods as $key => $method) {
            if (!\is_string($method)) {
                throw new \Error(
                    \sprintf(
                        "Invalid type at key %s of allowed methods array: %s",
                        $key,
                        \is_object($method) ? \get_class($method) : \gettype($method)
                    )
                );
            }

            if ($method === "") {
                throw new \Error(
                    "Invalid empty HTTP method at key {$key} of allowed methods array"
                );
            }
        }

        $allowedMethods = \array_unique($allowedMethods);

        if (!\in_array("GET", $allowedMethods, true)) {
            throw new \Error(
                "Servers must support GET as an allowed HTTP method"
            );
        }

        if (!\in_array("HEAD", $allowedMethods, true)) {
            throw new \Error(
                "Servers must support HEAD as an allowed HTTP method"
            );
        }

        $new = clone $this;
        $new->allowedMethods = $allowedMethods;

        return $new;
    }
566364
function exclude(array $exclusionFields = [], $exclusionBehave = self::EXCLUDE_DISALLOW)
    {
        $exclude = [];
        foreach ($this->value as $field => $term)
        {
            if (!empty($exclusionFields))
            {
                $flag = in_array($field, $exclusionFields);

                ($exclusionBehave != self::EXCLUDE_ALLOW) ?: $flag = !$flag;

                if ($flag)
                    // The Field not considered as Expression Term
                    continue;
            }

            $exclude[$field] = $term;

        }// end foreach


        return new StdArray($exclude);
    }