/*
Rejects a meta field if it contains embedded poll code.
this forces people to use the fields and short code [[poll]]
423997
public function rejectInlinePoll(Errors &$errors, Meta &$meta)
    {
        if (stristr((string)$meta->getValue(), '://cdn.polls') !== false || stristr((string)$meta->getValue(), '://polls') !== false || stristr((string)$meta->getValue(), 'wb-polls/') !== false) {
            $errors->reject('You cannot embed Polls inline, use the provided fields and input [[poll]] into the contents instead.');
        }
    }
167923
def validate_field_matches_type(field, value, field_type, select_items=None, _min=None, _max=None):
    """"""
    if (field_type == defs.TEXT_TYPE and not isinstance(value, six.string_types)) or \
       (field_type == defs.STRING_TYPE and not isinstance(value, six.string_types)) or \
       (field_type == defs.BOOLEAN_TYPE and not isinstance(value, bool)) or \
       (field_type == defs.INTEGER_TYPE and not isinstance(value, int)):
        raise exceptions.ConfigFieldTypeMismatch(field, value, field_type)

    if field_type == defs.INTEGER_TYPE:
        if _min and value < _min:
            raise exceptions.ConfigFieldTypeMismatch(field, value, "must be higher than {}".format(_min))
        if _max and value > _max:
            raise exceptions.ConfigFieldTypeMismatch(field, value, "must be lower than {}".format(_max))

    if field_type == defs.SELECT_TYPE:
        from honeycomb.utils.plugin_utils import get_select_items
        items = get_select_items(select_items)
        if value not in items:
            raise exceptions.ConfigFieldTypeMismatch(field, value, "one of: {}".format(", ".join(items)))
359677
function mf_metabox_content( $post, $metabox ) {
    global $mf_domain, $mf_post_values;

    //Getting the custom fields for this metabox
    $custom_fields = $this->get_custom_fields_by_group($metabox['args']['group_info']['id']);
    $group_id = $metabox['args']['group_info']['id'];
    //default markup
    ?>
    <div class="mf-group-wrapper group-<?php print $group_id;?>" id="mf_group-<?php print $group_id; ?>" >
      <!-- grupos se puede repetir -->
      <?php
        $extraclass = "";
        if( $metabox['args']['group_info']['duplicated'] ) {
          $extraclass = "mf_duplicate_group";
          $repeated_groups = $this->mf_get_duplicated_groups( $post->ID, $group_id );
        } else {
          $repeated_groups = 1;
        }

        for( $group_index = 1; $group_index <= $repeated_groups; $group_index++ ){
          $only = ($repeated_groups == 1)? TRUE : FALSE;
          $this->mf_draw_group($metabox,$extraclass,$group_index,$custom_fields,$mf_post_values,$only);
        }
        printf('<input value="%d" id="mf_group_counter_%d" style="display:none" >',$repeated_groups,$group_id);
      ?>
      <!-- fin del grupo -->
    </div>
  <?php
  }
931614
function validateUpdates (updates, meta) {
  var language = meta.language
  var i, j, update

  if (!updates || !updates.length)
    throw new BadRequestError(
      message('UpdateRecordsInvalid', language))

  for (i = 0, j = updates.length; i < j; i++) {
    update = updates[i]
    if (!update[primaryKey])
      throw new BadRequestError(
        message('UpdateRecordMissingID', language))
  }
}
1360372
public final void mJAVASCRIPT() throws RecognitionException {
		try {
			int _type = JAVASCRIPT;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// druidG.g:647:2: ( ( 'JAVASCRIPT:' | 'javascript:' ) )
			// druidG.g:647:5: ( 'JAVASCRIPT:' | 'javascript:' )
			{
			// druidG.g:647:5: ( 'JAVASCRIPT:' | 'javascript:' )
			int alt33=2;
			int LA33_0 = input.LA(1);
			if ( (LA33_0=='J') ) {
				alt33=1;
			}
			else if ( (LA33_0=='j') ) {
				alt33=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 33, 0, input);
				throw nvae;
			}

			switch (alt33) {
				case 1 :
					// druidG.g:647:6: 'JAVASCRIPT:'
					{
					match("JAVASCRIPT:"); 

					}
					break;
				case 2 :
					// druidG.g:647:21: 'javascript:'
					{
					match("javascript:"); 

					}
					break;

			}

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
1135443
def ignore_code(self, code):
        
        if len(code) < 4 and any(s.startswith(code)
                                 for s in self.options.select):
            return False
        return (code.startswith(self.options.ignore) and
                not code.startswith(self.options.select))
850663
@Override
  protected boolean reject(LogItem log) {
    if (blacklistTags != null) {
      for (String disabledTag : blacklistTags) {
        if (log.tag.equals(disabledTag)) {
          return true;
        }
      }
    }
    return false;
  }
478083
def filter_excluded_fields(fields, Meta, exclude_dump_only):
    
    exclude = list(getattr(Meta, "exclude", []))
    if exclude_dump_only:
        exclude.extend(getattr(Meta, "dump_only", []))

    filtered_fields = OrderedDict(
        (key, value) for key, value in fields.items() if key not in exclude
    )

    return filtered_fields
1244823
function ignoredMetas(cfgs, metas){
	cfgs = cfgs || {};
	Object.keys(metas).forEach(function(name){
		var cfg = metas[name];
		if(cfg && cfg.bundle === false) {
			cfgs[name] = cfg;
		}
	});
	return { meta: cfgs };
}
1007923
@Override
  protected boolean reject(LogItem log) {
    if (whitelistTags != null) {
      for (String enabledTag : whitelistTags) {
        if (log.tag.equals(enabledTag)) {
          return false;
        }
      }
    }
    return true;
  }
1259889
void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) {
        for (RejectAttributeChecker checker : checks) {
            rejectedAttributes.checkAttribute(checker, name, attributeValue);
        }
    }
1349637
def _validate_disallowed(self, disallowed, field, value):
        
        if disallowed:
            msg = 'disallowed user provided config option'
            self._error(field, msg)
260550
function validateAndMaskMode(value, def, callback) {
  if(typeof def === 'function') {
    callback = def;
    def = undefined;
  }

  if (isUint32(value)) {
    return value & FULL_READ_WRITE_EXEC_PERMISSIONS;
  }

  if (typeof value === 'number') {
    if (!Number.isInteger(value)) {
      callback(new Errors.EINVAL('mode not a valid an integer value', value));
      return false;
    } else {
      // 2 ** 32 === 4294967296
      callback(new Errors.EINVAL('mode not a valid an integer value', value));
      return false;
    }
  }

  if (typeof value === 'string') {
    if (!octalReg.test(value)) {
      callback(new Errors.EINVAL('mode not a valid octal string', value));
      return false;
    }
    var parsed = parseInt(value, 8);
    return parsed & FULL_READ_WRITE_EXEC_PERMISSIONS;
  }

  // TODO(BridgeAR): Only return `def` in case `value === null`
  if (def !== undefined) {
    return def;
  }

  callback(new Errors.EINVAL('mode not valid', value));
  return false;
}
281701
function validateField (fields, key) {
  var value = fields[key] = castShorthand(fields[key])

  if (typeof value !== 'object')
    throw new TypeError('The definition of "' + key + '" must be an object.')

  if (key === primaryKey)
    throw new Error('Can not define primary key "' + primaryKey + '".')

  if (key in plainObject)
    throw new Error('Can not define field name "' + key +
      '" which is in Object.prototype.')

  if (!value[typeKey] && !value[linkKey])
    throw new Error('The definition of "' + key + '" must contain either ' +
      'the "' + typeKey + '" or "' + linkKey + '" property.')

  if (value[typeKey] && value[linkKey])
    throw new Error('Can not define both "' + typeKey + '" and "' + linkKey +
      '" on "' + key + '".')

  if (value[typeKey]) {
    if (typeof value[typeKey] === 'string')
      value[typeKey] = nativeTypes[
        stringifiedTypes.indexOf(value[typeKey].toLowerCase())]

    if (typeof value[typeKey] !== 'function')
      throw new Error('The "' + typeKey + '" on "' + key +
        '" must be a function.')

    if (!find(nativeTypes, function (type) {
      var hasMatch = type === value[typeKey] ||
        type.name === value[typeKey].name

      // In case this errors due to security sandboxing, just skip this check.
      if (!hasMatch)
        try {
          hasMatch = Object.create(value[typeKey]) instanceof type
        }
        catch (e) {
          hasMatch = true
        }

      return hasMatch
    }))
      throw new Error('The "' + typeKey + '" on "' + key + '" must be or ' +
        'inherit from a valid native type.')

    if (value[inverseKey])
      throw new Error('The field "' + inverseKey + '" may not be defined ' +
        'on "' + key + '".')
  }

  if (value[linkKey]) {
    if (typeof value[linkKey] !== 'string')
      throw new TypeError('The "' + linkKey + '" on "' + key +
        '" must be a string.')

    if (value[inverseKey] && typeof value[inverseKey] !== 'string')
      throw new TypeError('The "' + inverseKey + '" on "' + key + '" ' +
        'must be a string.')
  }

  if (value[isArrayKey] && typeof value[isArrayKey] !== 'boolean')
    throw new TypeError('The key "' + isArrayKey + '" on "' + key + '" ' +
        'must be a boolean.')
}
588781
StringBuilder assembleConfig(boolean meta) {
    StringBuilder builder = new StringBuilder();

    if (meta) {
      builder.append(PREFIX_META);
    }

    if (isTrim) {
      builder.append(PART_TRIM);
      if (trimPixelColor != null) {
        builder.append(":").append(trimPixelColor.value);
        if (trimColorTolerance > 0) {
          builder.append(":").append(trimColorTolerance);
        }
      }
      builder.append("/");
    }

    if (hasCrop) {
      builder.append(cropLeft).append("x").append(cropTop) //
          .append(":").append(cropRight).append("x").append(cropBottom);

      builder.append("/");
    }

    if (hasResize) {
      if (fitInStyle != null) {
        builder.append(fitInStyle.value).append("/");
      }
      if (flipHorizontally) {
        builder.append("-");
      }
      if (resizeWidth == ORIGINAL_SIZE) {
        builder.append("orig");
      } else {
        builder.append(resizeWidth);
      }
      builder.append("x");
      if (flipVertically) {
        builder.append("-");
      }
      if (resizeHeight == ORIGINAL_SIZE) {
        builder.append("orig");
      } else {
        builder.append(resizeHeight);
      }
      if (isSmart) {
        builder.append("/").append(PART_SMART);
      } else {
        if (cropHorizontalAlign != null) {
          builder.append("/").append(cropHorizontalAlign.value);
        }
        if (cropVerticalAlign != null) {
          builder.append("/").append(cropVerticalAlign.value);
        }
      }
      builder.append("/");
    }

    if (filters != null) {
      builder.append(PART_FILTERS);
      for (String filter : filters) {
        builder.append(":").append(filter);
      }
      builder.append("/");
    }

    builder.append(isLegacy ? md5(image) : image);

    return builder;
  }
1010993
def reject!(connected_at, code, reason)
      self.update_node!(connected_at,
        connected: false,
        updated: false,
        websocket_connection: {
          opened: false,
          close_code: code,
          close_reason: reason,
        },
      )
      info "Rejected connection for node #{@node.to_path} at #{connected_at} with code #{code}: #{reason}"
    rescue => exc
      error exc
    end
1180077
public void validateMetadata(IfdTags metadata) {
    int prevTagId = 0;
    try {
      TiffTags.getTiffTags();
    } catch (ReadTagsIOException e) {
    }
    for (TagValue ie : metadata.getTags()) {
      if (!TiffTags.tagMap.containsKey(ie.getId())) {
        validation.addWarning("Ignoring undefined tag id " + ie.getId(), "", "Metadata");
      } else if (!TiffTags.tagTypes.containsKey(ie.getType())) {
        validation.addWarning("Ignoring unknown tag type " + ie.getType(), "", "Metadata");
      }
      else {
        Tag t = TiffTags.getTag(ie.getId());
        String stype = TiffTags.tagTypes.get(ie.getType());
        if (ie.getId() == 320) {
          // Colormap length check
          long bps = 0;
          if (metadata.containsTagId(258))
            bps = metadata.get(258).getFirstNumericValue();
          long calc = 3 * (long) Math.pow(2, bps);
          if (calc != ie.getCardinality()) {
            validation.addError("Invalid cardinality for tag "
                + TiffTags.getTag(ie.getId()).getName() + "[" + ie.getCardinality() + "]",
                "Metadata", stype);
          }
        }
        try {
          // Cardinality check
          int card = Integer.parseInt(t.getCardinality());
          if (card != ie.getCardinality())
            validation.addError("Cardinality for tag " + TiffTags.getTag(ie.getId()).getName()
                + " must be " + card, "Metadata",
                ie.getCardinality());
        } catch (Exception e) {
          // TODO: Deal with formulas?
        }
      }

      if (ie.getId() < prevTagId) {
        if (tagOrderTolerance > 0)
          validation.addWarning("Tags are not in ascending order", "", "Metadata");
        else
          validation.addErrorLoc("Tags are not in ascending order", "Metadata");
      }
      prevTagId = ie.getId();
    }
  }