/*
match_field_groups_ajax

@description:
@since: 3.5.7
@created: 3/01/13
489080
function match_field_groups_ajax()
	{
		
		// vars
		$options = array(
			'nonce' => '',
			'ajax' => true
		);
		
		
		// load post options
		$options = array_merge($options, $_POST);
		
		
		// verify nonce
		if( ! wp_verify_nonce($options['nonce'], 'acf_nonce') )
		{
			die(0);
		}
		
		
		// return array
		$return = apply_filters( 'acf/location/match_field_groups', array(), $options );
		
		
		// echo json
		echo json_encode( $return );
		
		
		die();	
	}
196276
def match_fields(fields, searches,
                 ignore_case=False, wholename=False, complement=False):
    
    if ignore_case:
        fields = [f.lower() for f in fields]
        searches = [s.lower() for s in searches]
    if wholename:
        match_found = _complete_match
    else:
        match_found = _partial_match

    fields = [(i, field) for i, field in enumerate(fields)]
    matched = []
    for search, (idx, field) in itertools.product(searches, fields):
        if not search:  ## don't return all fields for ''
            continue
        if match_found(search, field) and idx not in matched:
            matched.append(idx)

    if complement:
        matched = [idx for idx in list(zip(*fields))[0] if idx not in matched]

    return matched
622904
function createTemplateMatcher (fields) {
  var length = fields.length
  var pattern = fields.reduce(function (pattern, field, i) {
    if (i === 0) {
      pattern = '^'
    }
    if (field.prefix) {
      pattern += '(' + escapeRegExp(field.prefix) + ')'
    }
    if (field.placeholder) {
      switch (field.placeholder) {
        case 'hash':
        case 'chunkhash':
          pattern += '[0-9a-fA-F]'
          pattern += field.width ? '{1,' + field.width + '}' : '+'
          break
        case 'id':
        case 'name':
        case 'file':
        case 'filebase':
          pattern += '.+?'
          break
        case 'query':
          pattern += '(?:\\?.+?)?'
          break
      }
    }
    if (i === length - 1) {
      pattern += '$'
    }

    return pattern
  }, '')

  return new RegExp(pattern)
}
768614
function fieldsToMongo(fields) {
    if (!fields) return null
    var hash = {}
    fields.split(',').forEach(function(field) {
        hash[field.trim()] = 1
    })
    return hash
}
249917
@SuppressWarnings("rawtypes")
    private boolean hasGroups(final Annotation anno, final Class<?>... groups) {
        
        final Optional<Class[]> targetGroups = Utils.getAnnotationAttribute(anno, "groups", Class[].class);
        
        if(!targetGroups.isPresent()) {
            // groups属性を持たない場合
            return false;
            
        }
        
        if(groups.length == 0) {
            if(targetGroups.get().length == 0) {
                // グループの指定がない場合は、デフォルトグループとして処理。
                return true;
                
            } else {
                for(Class<?> targetGroup : targetGroups.get()) {
                    if(targetGroup.equals(DefaultGroup.class)) {
                        // デフォルトを直接指定している場合に、グループと一致。
                        return true;
                    }
                }
            }
            
        } else {
            // グループの指定がある場合
            for(Class<?> group : groups) {
                
                if(group.equals(DefaultGroup.class) && targetGroups.get().length == 0) {
                    // フィールド側にグループの指定がない場合は、デフォルトグループとして処理する。
                    return true;
                }
                
                for(Class<?> targetGroup : targetGroups.get()) {
                    // 一致するグループを持つか判定する。
                    if(targetGroup.equals(group)) {
                        return true;
                    }
                }
                
            }
            
        }
        
        return false;
        
    }
971207
@Override
    protected boolean isMatching(final Field field) {

        if (!super.isMatching(field)) {
            return false;
        }

        final Resource resourceAnnotation = field.getAnnotation(Resource.class);
        if (resourceAnnotation == null) {
            return false;
        }

        return matchesResourceAnnotation(resourceAnnotation);
    }
1250596
function parseMatchplan(team, callback) {
	/** @type {String[]} */
	var matchPlanArr = [],
	/** @type {Matchplan} */
			matchPlan,
    /** @type {String[]} */
            matchDetails = [],
    /** @type {Encounter[]} */
            encounters = [];


	jsdom.env({
	  url: team,
	  scripts: ["http://code.jquery.com/jquery.js"],
	  done: function (err, window) {
	    var $ = window.$;

	    $("tr.row-headline").each(function() {
	        matchPlanArr.push(parseMatchTime($(this).text()));
	    });

	    $(".club-name").each(function(index) {
            if ((index + 1) % 2 === 0) {
                encounters[encounters.length - 1].setVisitingTeam($(this).text());
            } else {
                encounters.push(new Encounter($(this).text()));
            }
	    });

        $("td.column-detail a").each(function(index, element) {
            matchDetails.push(new URL(element.href));
        });

	    matchPlan = createMatchplan(matchPlanArr, encounters, matchDetails);
		matchPlan.output();
		callback(matchPlan);
	  }
	});
}
108674
func (elem GroupKindElement) GroupMatch(groups ...string) bool {
	for _, g := range groups {
		if elem.Group == g {
			return true
		}
	}
	return false
}
771615
function get_field_groups( $array )
	{
		// cache
		$found = false;
		$cache = wp_cache_get( 'field_groups', 'acf', false, $found );
		
		if( $found )
		{
			return $cache;
		}
		
		
		// get acf's
		$posts = get_posts(array(
			'numberposts' 	=> -1,
			'post_type' 	=> 'acf',
			'orderby' 		=> 'menu_order title',
			'order' 		=> 'asc',
			'suppress_filters' => false,
		));

		
		// populate acfs
		if( $posts ){ foreach( $posts as $post ){
			
			 $array[] = array(
				'id' => $post->ID,
				'title' => $post->post_title,
				'menu_order' => $post->menu_order,
			);
			
		}}

		
		// set cache
		wp_cache_set( 'field_groups', $array, 'acf' );
				
				
		return $array;
	}
285513
protected function getGroups()
	{
		$groups = array();
		$label = 0;

		$select = new HtmlSelect;

		// Try to inject the text object into the field
		try
		{
			$select->setText($this->getText());
		}
		catch (\RuntimeException $exception)
		{
			// A Text object was not set, ignore the error and try to continue processing
		}

		/** @var \SimpleXMLElement $element */
		foreach ($this->element->children() as $element)
		{
			switch ($element->getName())
			{
				// The element is an <option />
				case 'option':
					// Initialize the group if necessary.
					if (!isset($groups[$label]))
					{
						$groups[$label] = array();
					}

					// Create a new option object based on the <option /> element.
					$tmp = $select->option(
						($element['value']) ? (string) $element['value'] : trim((string) $element),
						$this->getText()->alt(trim((string) $element), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
						((string) $element['disabled'] == 'true')
					);

					// Set some option attributes.
					$tmp->class = (string) $element['class'];

					// Set some JavaScript option attributes.
					$tmp->onclick = (string) $element['onclick'];

					// Add the option.
					$groups[$label][] = $tmp;
					break;

				// The element is a <group />
				case 'group':
					// Get the group label.
					if ($groupLabel = (string) $element['label'])
					{
						$label = $this->translateLabel ? $this->getText()->translate($groupLabel) : $groupLabel;
					}

					// Initialize the group if necessary.
					if (!isset($groups[$label]))
					{
						$groups[$label] = array();
					}

					// Iterate through the children and build an array of options.
					/** @var \SimpleXMLElement $option */
					foreach ($element->children() as $option)
					{
						// Only add <option /> elements.
						if ($option->getName() != 'option')
						{
							continue;
						}

						// Create a new option object based on the <option /> element.
						$tmp = $select->option(
							($option['value']) ? (string) $option['value'] : $this->getText()->translate(trim((string) $option)),
							$this->getText()->translate(trim((string) $option)), 'value', 'text', ((string) $option['disabled'] == 'true')
						);

						// Set some option attributes.
						$tmp->class = (string) $option['class'];

						// Set some JavaScript option attributes.
						$tmp->onclick = (string) $option['onclick'];

						// Add the option.
						$groups[$label][] = $tmp;
					}

					if ($groupLabel)
					{
						$label = count($groups);
					}
					break;

				// Unknown element type.
				default:
					throw new \UnexpectedValueException(
						sprintf('Unsupported element %1$s in %2$s', $element->getName(), __CLASS__),
						500
					);
			}
		}

		reset($groups);

		return $groups;
	}
347450
private boolean matchesField(Format.Field attribute) {
        if (this.attribute != null) {
            return this.attribute.equals(attribute);
        }
        return false;
    }
314397
protected function getGroups()
	{
		$groups = array();

		$select = new HtmlSelect;

		// Try to inject the text object into the field
		try
		{
			$select->setText($this->getText());
		}
		catch (\RuntimeException $exception)
		{
			// A Text object was not set, ignore the error and try to continue processing
		}

		// Get the list of time zones from the server.
		$zones = \DateTimeZone::listIdentifiers();

		// Build the group lists.
		foreach ($zones as $zone)
		{
			// Time zones not in a group we will ignore.
			if (strpos($zone, '/') === false)
			{
				continue;
			}

			// Get the group/locale from the timezone.
			list ($group, $locale) = explode('/', $zone, 2);

			// Only use known groups.
			if (in_array($group, self::$zones))
			{
				// Initialize the group if necessary.
				if (!isset($groups[$group]))
				{
					$groups[$group] = array();
				}

				// Only add options where a locale exists.
				if (!empty($locale))
				{
					$groups[$group][$zone] = $select->option($zone, str_replace('_', ' ', $locale), 'value', 'text', false);
				}
			}
		}

		// Sort the group lists.
		ksort($groups);

		foreach ($groups as &$location)
		{
			sort($location);
		}

		// Merge any additional groups in the XML definition.
		$groups = array_merge(parent::getGroups(), $groups);

		return $groups;
	}
36525
def server_group_field_data(request):
    
    server_groups = server_group_list(request)
    if server_groups:
        server_groups_list = [(sg.id, sg.name) for sg in server_groups]
        server_groups_list.sort(key=lambda obj: obj[1])
        return [("", _("Select Server Group")), ] + server_groups_list

    return [("", _("No server groups available")), ]
305373
public function addField($field, $fieldset = null, $group = null)
    {
        $field = FieldHelper::create($field);

        $fieldset = $fieldset ?: $this->wrap['fieldset'];
        $group = $group ?: $this->wrap['group'];

        if ($fieldset) {
            $field->setFieldset($fieldset);
        }

        if ($group) {
            $field->setGroup($group);
        }

        $group = $field->getGroup();
        $fieldset = $field->getFieldset();

        if ($group && !in_array($group, $this->groups)) {
            $this->groups[] = $group;
        }

        if ($fieldset && !in_array($fieldset, $this->fieldsets)) {
            $this->fieldsets[] = $fieldset;
        }

        $field->setControl($this->control)
            ->setForm($this);

        $this->fields[$field->getName(true)] = $field;

        return $field;
    }
736548
public function GroupBy($Fields = NULL) {
      if(is_null($Fields)) {
         // Group by every item in the select that isn't a function.
         foreach($this->_Selects as $Alias => $Select) {
            if(ArrayValue('Function', $Select) == '') {
               $this->_GroupBys[] = $Select['Field'];
            }
         }
         return $this;
      }
      
      if (is_string($Fields))
         $Fields = explode(',', $Fields);

      foreach ($Fields as $Field) {
         $Field = trim($Field);

         if ($Field != '')
            $this->_GroupBys[] = $this->EscapeIdentifier($Field);
      }
      return $this;
   }
1083168
public boolean remove(String field) {
		try {
			if (isCluster(groupName)) {
				return getBinaryJedisClusterCommands(groupName).hdel(keyBytes, SafeEncoder.encode(field)).equals(RESP_OK);
			} else {
				return getBinaryJedisCommands(groupName).hdel(keyBytes, SafeEncoder.encode(field)).equals(RESP_OK);
			}
		} finally {
			getJedisProvider(groupName).release();
		}
	}
49559
function findGroup(catalogGroup, keywordsGroups, record) {
  for (var i = 0; i < keywordsGroups.length; i++) {
    var kg = keywordsGroups[i];
    var fields = record[kg.field];
    var matched = false;
    if (defined(fields)) {
      if (fields instanceof String || typeof fields === "string") {
        fields = [fields];
      }
      for (var j = 0; j < fields.length; j++) {
        var field = fields[j];
        if (matchValue(kg.value, field, kg.regex)) {
          matched = true;
          break;
        }
      }
    }
    if (matched) {
      var newGroup = addGroupIfNotAlreadyPresent(
        kg.group ? kg.group : kg.value,
        catalogGroup
      );
      if (kg.children && defined(newGroup)) {
        // recurse to see if it fits into any of the children
        catalogGroup = findGroup(newGroup, kg.children, record);
        if (!defined(catalogGroup)) {
          //console.log("No match in children for record "+record.title+"::"+record.subject+"::"+record.title+", will assign to "+newGroup.name);
          catalogGroup = newGroup;
        }
      } else if (defined(newGroup)) {
        catalogGroup = newGroup;
      }
      return catalogGroup;
    }
  }
}