Clean Contact Form plugin functionalities.

@param array $settings
171219
public function pluginContactForm($settings)
    {
        if (empty($settings)) {
            return;
        }

        $available = [
            'enqueue_styles',
        ];

        // Special case
        if (is_bool($settings) && $settings) {
            $settings = $available;
        }

        foreach ($settings as $key) {
            $key = strtolower($key);

            if (!in_array($key, $available)) {
                continue;
            }

            if ('enqueue_styles' === $key && !OL_ZEUS_ISADMIN) {
                add_action('wp_enqueue_scripts', function () {
                    wp_localize_script('contact-form-7', 'wpcf7', [
                        'apiSettings' => [
                            'root'      => esc_url_raw(rest_url('contact-form-7/v1')),
                            'namespace' => 'contact-form-7/v1',
                        ],
                        'jqueryUi'    => 1,
                    ]);
                }, 10);
                continue;
            }
        }
    }
852385
public function injectSettings(array $settings)
    {
        $this->settings = $settings;
        if (isset($this->settings['debugMode'])) {
            $this->setDebugMode($this->settings['debugMode'] === true);
        }
        if (isset($this->settings['enableContentCache'])) {
            $this->setEnableContentCache($this->settings['enableContentCache'] === true);
        }
    }
1220236
private function checkSetting($setting)
    {
        if (array_key_exists($setting, $this->getDefaults())) {
            if (! $this->getSetting($setting)) {
                $this->addSetting($setting);
            }
            
            return true;
        }
    }
130589
public function setLinkDefaults(array $Settings = [])
    {
        if (isset($Settings["R"])) {
            $this->Default["LinkR"] = $Settings["R"];
        }
        if (isset($Settings["G"])) {
            $this->Default["LinkG"] = $Settings["G"];
        }
        if (isset($Settings["B"])) {
            $this->Default["LinkB"] = $Settings["B"];
        }
        if (isset($Settings["Alpha"])) {
            $this->Default["LinkAlpha"] = $Settings["Alpha"];
        }
    }
347993
protected function removeDots(array $settings): array
    {
        $conf = [];
        foreach ($settings as $key => $value) {
            $conf[$this->removeDotAtTheEnd($key)] = \is_array($value) ? $this->removeDots($value) : $value;
        }
        return $conf;
    }
1309967
protected function addModelSettings(array &$settings)
    {
        $empty = [];
        if (!$this->_fieldDefinition['gtf_required'] || $this->_fieldDefinition['gtf_field_default'] === null) {
            $empty = $this->util->getTranslated()->getEmptyDropdownArray();
        }

        $multi = explode(parent::FIELD_SEP, $this->_fieldDefinition['gtf_field_values']);

        $settings['elementClass'] = 'Select';
        $settings['multiOptions'] = $empty + array_combine($multi, $multi);
    }
535147
public function setAttachmentOptions(array $settings)
    {
        $this->attachmentOptions = array_merge(
            $this->defaultAttachmentOptions(),
            $this->parseAttachmentOptions($settings)
        );

        return $this;
    }
233296
protected function addModelSettings(array &$settings)
    {
        $settings['elementClass']  = 'Date';
        $settings['dateFormat']    = $this->getDateFormat();
        $settings['storageFormat'] = $this->getStorageFormat();
        $settings['type']          = $this->type;
    }
528322
public function formatStackOperationOptions(array $settings)
    {
        $data = [];

        foreach ($settings as $name => $value) {
            $data[] = $name.':'.$value;
        }

        return implode(' | ', $data);
    }
941158
protected function parseCompatibleSettings(array $settings)
    {
        $settings = collect($settings)->collapse()->all();

        foreach ($settings as $setting) {
            if ($setting instanceof CanHandlePageSettings) {
                $setting->settingGet();
            }
        }
    }
997525
private function applyFilters(array $settings): void
    {
        $data = $this->getSource();
        $data = array_filter(
            $data,
            function ($row) use ($settings) {
                foreach ($settings as $column => $filters) {
                    foreach ($filters as $filter => $value) {
                        // switch statement for filter
                        switch ($filter) {
                            case Grid\Grid::FILTER_EQ:
                                if ($row[$column] != $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_NE:
                                if ($row[$column] == $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_GT:
                                if ($row[$column] <= $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_GE:
                                if ($row[$column] < $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LT:
                                if ($row[$column] >= $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LE:
                                if ($row[$column] > $value) {
                                    return false;
                                }
                                break;
                            case Grid\Grid::FILTER_LIKE:
                                if (!preg_match('/' . $value . '/', $row[$column])) {
                                    return false;
                                }
                                break;
                        }
                    }
                }
                return true;
            }
        );
        $this->setSource($data);
    }
1342648
protected function upgradeSettings($settings)
    {
        /*
         * Handle component usage
         */
        $componentProperties = post('component_properties');
        $componentNames = post('component_names');
        $componentAliases = post('component_aliases');

        if ($componentProperties !== null) {
            if ($componentNames === null || $componentAliases === null) {
                throw new ApplicationException(trans('cms::lang.component.invalid_request'));
            }

            $count = count($componentProperties);
            if (count($componentNames) != $count || count($componentAliases) != $count) {
                throw new ApplicationException(trans('cms::lang.component.invalid_request'));
            }

            for ($index = 0; $index < $count; $index++) {
                $componentName = $componentNames[$index];
                $componentAlias = $componentAliases[$index];

                $section = $componentName;
                if ($componentAlias != $componentName) {
                    $section .= ' '.$componentAlias;
                }

                $properties = json_decode($componentProperties[$index], true);
                unset($properties['oc.alias'], $properties['inspectorProperty'], $properties['inspectorClassName']);
                $settings[$section] = $properties;
            }
        }

        /*
         * Handle view bag
         */
        $viewBag = post('viewBag');
        if ($viewBag !== null) {
            $settings['viewBag'] = $viewBag;
        }

        /**
         * @event cms.template.processSettingsBeforeSave
         * Fires before a CMS template (page|partial|layout|content|asset) is saved and provides an opportunity to interact with the settings data. `$dataHolder` = {settings: array()}
         *
         * Example usage:
         *
         *     Event::listen('cms.template.processSettingsBeforeSave', function ((\Cms\Controllers\Index) $controller, (object) $dataHolder) {
         *         // Make some modifications to the $dataHolder object
         *     });
         *
         * Or
         *
         *     $CmsIndexController->bindEvent('template.processSettingsBeforeSave', function ((object) $dataHolder) {
         *         // Make some modifications to the $dataHolder object
         *     });
         *
         */
        $dataHolder = (object) ['settings' => $settings];
        $this->fireSystemEvent('cms.template.processSettingsBeforeSave', [$dataHolder]);

        return $dataHolder->settings;
    }
773309
public function settings(array $settings = null)
    {
        if ($settings !== null) {
            $this->settings = $settings;
        }

        return $this->settings;
    }
1014943
public function _beforeSuite($settings = []) {
    if ($this->config['check_logs'] && \Drupal::moduleHandler()->moduleExists('dblog')) {
      // Clear log entries from the database log.
      \Drupal::database()->truncate('watchdog')->execute();
    }
  }
611345
public function setData(array $settings) : void
    {
        foreach ($settings as $key => $value) {
            $this->data[strtolower($key)] = $value;
        }
    }
1139110
public function addSettings(array $settings)
    {
        foreach ($settings as $key => $value) {
            $this->addSetting($key, $value);
        }
    }
844846
public function resetFields(array $fields) {
		$defaults = $this->defaults();
		foreach ($fields as $field) {
			unset($this->fieldsCache[$field]);
			unset($this->saveCsd[$field]);
			if (isset($defaults[$field]))
				$this->set($field,$defaults[$field]);
			else {
				$this->set($field,NULL);
			}
		}
	}