Does the check to see if the option is valid. It checks the valid_options
 array (see above), checks if the start of the option name is in the plugin list
 or checks if it's an theme_advanced_container setting
164761
def valid?(option)
      option = option.to_s
      self.class.valid_options.include?(option) ||
        plugins.include?(option.split('_').first) ||
        option =~ /^theme_advanced_container_\w+$/
    end
675311
def valid_web_plugin(self, plugin):
        
        if (issubclass(plugin, WebPlugin)      and
            hasattr(plugin, 'plugin_type')      and plugin.plugin_type == 'web' and
            hasattr(plugin, 'name')             and plugin.name != None):
            return True
        return False
1058333
def valid?
      field_validator = EnumAttributeValidator.new('String', ["DEFAULT", "CREATED_AT"])
      return false unless field_validator.valid?(@field)
      order_validator = EnumAttributeValidator.new('String', ["DESC", "ASC"])
      return false unless order_validator.valid?(@order)
      return true
    end
1239528
public function valid($options = array())
    {
        $options && $this->setOption($options);

        // Initialize the validation result to be true
        $this->result = true;

        $this->beforeValidate && call_user_func($this->beforeValidate, $this, $this->wei);

        foreach ($this->rules as $field => $rules) {
            $data = $this->getFieldData($field);

            /**
             * Process simple rule
             * FROM
             * 'username' => 'required'
             * TO
             * 'username' => array(
             *     'required' => true
             * )
             */
            if (is_string($rules)) {
                $rules = array($rules => true);
            } elseif ($rules instanceof BaseValidator) {
                $rules = array($rules);
            } elseif (!is_array($rules)) {
                throw new \InvalidArgumentException(sprintf(
                    'Expected argument of type array, string or instance of Wei\Validator\BaseValidator, "%s" given',
                    is_object($rules) ? get_class($rules) : gettype($rules)
                ));
            }

            // Make sure the "required" rule at first
            if (!isset($rules['required'])) {
                $isRequired = true;
            } else {
                $isRequired = (bool) $rules['required'];
                unset($rules['required']);
            }
            $rules = array('required' => $isRequired) + $rules;

            // Start validation
            foreach ($rules as $rule => $params) {
                // Prepare property options for validator
                $props = $this->prepareProps($field, $rule);

                // The current rule validation result
                /* @var $validator Validator\BaseValidator */
                $validator = null;
                $result = $this->validateOne($rule, $data, $params, $validator, $props);

                if (is_object($params)) {
                    $rule = get_class($params);
                }

                // Record the rule validators
                $this->ruleValidators[$field][$rule] = $validator;

                // If any rule is invalid, the result would always be false in the whole validation flow
                if (false === $result) {
                    $this->result = false;
                }

                // Record the valid/invalid rule
                $method = $result ? 'addValidRule' : 'addInvalidRule';
                $this->$method($field, $rule);

                // Trigger the ruleValid/ruleInvalid callback
                $callback = $result ? 'ruleValid' : 'ruleInvalid';
                if ($this->$callback && false === call_user_func($this->$callback, $rule, $field, $this, $this->wei)) {
                    return $this->result;
                }

                if ($result) {
                    // The field data is empty and optional, skip the remaining validation rules
                    /** @var $validator Validator\Required */
                    if ('required' === $rule && $validator->isInvalid($data)) {
                        break;
                    }
                } else {
                    // Break the validation flow when any field's rule is invalid
                    if ('required' === $rule || $this->breakRule || $this->skip) {
                        break;
                    }
                }
            }

            // Trigger the fieldValid/fieldInvalid callback
            $callback = $this->isFieldValid($field) ? 'fieldValid' : 'fieldInvalid';
            if ($this->$callback && false === call_user_func($this->$callback, $field, $this, $this->wei)) {
                return $this->result;
            }

            if (!$this->result && $this->skip) {
                continue;
            }

            // Break the validation flow when any field is invalid
            if (!$this->result && ($this->breakRule || $this->breakField)) {
                break;
            }
        }

        // Trigger the success/failure callback
        $callback = $this->result ? 'success' : 'failure';
        $this->$callback && call_user_func($this->$callback, $this, $this->wei);

        return $this->result;
    }
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;
	}
1108294
function isValidOptions(options) {
  if(!options) {
    return false;
  }

  if(options.hasOwnProperty('ids') && Array.isArray(options.ids)) {
    for(var cId = 0; cId < options.ids.length; cId++) {
      if(!reelib.identifier.isValid(options.ids[cId])) {
        return false;
      }
    }
    return true;
  }

  else {
    return false;
  }
}
134238
public static function is_plugin() {
		$is_plugin = false;
		if ( ! function_exists( 'get_plugins' ) ) {
			require_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
		}

		// Get all plugins.
		$plugins = get_plugins();
		$_plugin = '';
		foreach ( $plugins as $plugin => $args ) {
			if ( ! $is_plugin && isset( $args['Name'] ) && ( 'Kirki' === $args['Name'] || 'Kirki Toolkit' === $args['Name'] ) ) {
				$is_plugin = true;
				$_plugin   = $plugin;
			}
		}

		// No need to proceed any further if Kirki wasn't found in the list of plugins.
		if ( ! $is_plugin ) {
			return false;
		}

		// Make sure the is_plugins_loaded function is loaded.
		include_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude

		// Extra logic in case the plugin is installed but not activated.
		if ( $_plugin && is_plugin_inactive( $_plugin ) ) {
			return false;
		}
		return $is_plugin;
	}
387364
private static function is_valid() {
	if (self::is_active() == false) {
		$exception = bootstrap::get_library('exception');
		throw new $exception('inactive session');
	}
	
	if (self::validate() == false) {
		return false;
	}
	if (self::challenge() == false) {
		return false;
	}
	
	if (is_callable(self::$validation_callback)) {
		if (call_user_func(self::$validation_callback) == false) {
			return false;
		}
	}
	
	return true;
}
855536
def valid_options(kwargs, allowed_options):
    

    diff = set(kwargs) - set(allowed_options)
    if diff:
        print("Invalid option(s): ", ', '.join(diff))
        return False
    return True
146608
protected function maybeCheck()
    {
        if ($this->checked) {
            return; // Done.
        }
        $this->checked = true; // Checking now.

        if (!$this->App->Config->§dependencies['§plugins']
            && !$this->App->Config->§dependencies['§themes']
            && !$this->App->Config->§dependencies['§others']) {
            return; // Nothing to do; we can stop here.
        } elseif (($is_front_or_ajax = !$this->Wp->is_admin || $this->c::isAjax())
                && $this->lastOkTime() > $this->outdated_check_time) {
            return; // Had a successfull check recently.
        }
        $all_active_plugin_slugs = $this->s::allActivePlugins();
        $all_active_theme_slugs  = array_unique([$this->Wp->template, $this->Wp->stylesheet]);

        $plugin_dependencies = $this->App->Config->§dependencies['§plugins'];
        $theme_dependencies  = $this->App->Config->§dependencies['§themes'];
        $other_dependencies  = $this->App->Config->§dependencies['§others'];

        foreach (['plugin' => 'Plugin', 'theme' => 'Theme'] as $_type => $_ucf_type) {
            foreach (${$_type.'_dependencies'} as $_dependency_slug => $_dependency_args) {
                if ($_dependency_slug === $this->App->base_dir_basename && $this->App->Config->§specs['§type'] === $_type) {
                    continue; // Sanity check. Cannot depend on self of the same type.
                }
                if (!in_array($_dependency_slug, ${'all_active_'.$_type.'_slugs'}, true)) {
                    $this->{$_type.'s'}['inactive'][$_dependency_slug] = ['args' => $_dependency_args];

                    // Else we can run a more in-depth test if the app provides a callback.
                } elseif (!empty($_dependency_args['test']) && is_callable($_dependency_args['test'])) {
                    if (is_array($_test_result = $_dependency_args['test']($_dependency_slug)) && !empty($_test_result['reason'])) {
                        $this->{$_type.'s'}[$_test_result['reason']][$_dependency_slug] = ['args' => $_dependency_args, 'test_result' => $_test_result];
                    }
                }
            } // unset($_dependency_slug, $_dependency_args, $_test_result); // Housekeeping.
        } // unset($_type, $_ucf_type); // Housekeeping.

        foreach ($other_dependencies as $_dependency_key => $_dependency_args) {
            if (!empty($_dependency_args['test']) && is_callable($_dependency_args['test'])) {
                if (is_array($_test_result = $_dependency_args['test']($_dependency_key))) {
                    $this->others[$_dependency_key] = ['args' => $_dependency_args, 'test_result' => $_test_result];
                }
            }
        } // unset($_dependency_key, $_dependency_args, $_test_result); // Housekeeping.

        $unsatisfied_dependencies = $this->unsatisfied(); // Any unsatisfied?

        if ($is_front_or_ajax && !$unsatisfied_dependencies) {
            $this->lastOkTime(time());
        } elseif ($unsatisfied_dependencies) {
            $this->lastOkTime(0);
            $this->maybeNotify();
        }
    }
662313
def _string_check(self, value, allow_list=False):
        '''
        
        '''
        if self._optcre is self.OPTCRE or value:
            is_list = isinstance(value, list)
            if is_list and not allow_list:
                raise TypeError('option value cannot be a list unless allow_list is True')
            elif not is_list:
                value = [value]
            if not all(isinstance(x, six.string_types) for x in value):
                raise TypeError('option values must be strings')
46868
public function valid()
    {

        if ($this->container['name'] === null) {
            return false;
        }
        if (strlen($this->container['name']) > 40) {
            return false;
        }
        if (strlen($this->container['name']) < 1) {
            return false;
        }
        $allowedValues = $this->getColorAllowableValues();
        if (!in_array($this->container['color'], $allowedValues)) {
            return false;
        }
        return true;
    }
461197
function validateOption (options, name, values) {
  if (options[name] !== undefined && !contains(values, options[name])) {
    const index = findIndex(values, options[name])
    if (index !== -1) {
      // right value, wrong casing
      // TODO: lower case values are deprecated since v3, remove this warning some day.
      console.warn('Warning: Wrong casing for configuration option "' + name + '", should be "' + values[index] + '" instead of "' + options[name] + '".')

      options[name] = values[index] // change the option to the right casing
    } else {
      // unknown value
      console.warn('Warning: Unknown value "' + options[name] + '" for configuration option "' + name + '". Available options: ' + values.map(JSON.stringify).join(', ') + '.')
    }
  }
}
975803
public function containsOption($optionValue, $options)
    {
        if ($this->validationDisabled) {
            return true;
        }

        foreach ($options as $option) {
            if ($option['value'] == $optionValue) {
                return true;
            }
        }

        return false;
    }
707352
def _modeIsValid(self, mode):
        
        try:
            # Suport for version 2 of wrappers
            return mode in self.modes.keys()
        except AttributeError as e:
            # Legacy for mantaining old wrappers
            if mode in self.isValidMode.keys():
                if mode in self.isValidMode.keys():
                    return True
        return False
552679
def validate_options(valid_option_keys, options)
      options.keys.each do |key|
        unless valid_option_keys.include? key.to_sym
          raise ArgumentError, "Invalid option `#{key}`"
        end
      end
    end
266583
function isValid(options, key) {
    var value = _.isFunction(options) ? options(key) : options[key];

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

    if (value === null) {
        return false;
    }

    if (value === '') {
        return false;
    }

    if (_.isNaN(value)) {
        return false;
    }

    return true;
}