Retrieve list of registered post types.

@param array $filter
@param array $fields

@return array    list of struct

@link http://codex.wordpress.org/XML-RPC_WordPress_API/Posts#wp.getPostTypes
975504
function getPostTypes(array $filter = array(), array $fields = array())
    {
        $params = array(1, $this->username, $this->password, $filter, $fields);

        return $this->sendRequest('wp.getPostTypes', $params);
    }
412717
public static function getItems($filter = []): array
    {
        $res = [];

        /* @var $class LightModel */
        $className = get_called_class();
        $class = new $className;

        $sql = 'SELECT * FROM ' . $class->getTableName() . ' WHERE 1=1';
        $params = self::handleFilter($sql, $filter, $class);

        $query = DB::getConnection()->prepare($sql);
        $query->execute($params);

        foreach ($query->fetchAll(PDO::FETCH_CLASS, $className) as $item)
        {
            $res[] = self::typeCastModel($item);
        }

        return $res;
    }
259872
private static function getFieldTypeArray($fields)
    {
        if (count($fields) === 0) {
            return;
        }

        $types = array();

        foreach ($fields as &$field) {
            $types[] = $field->type;
        }

        return $types;
    }
177351
public function getMethods($filter = \ReflectionProperty::IS_PUBLIC)
    {
        $methods = array();
        $reflectionMethods = $this->reflectionEntity->getMethods($filter);
        foreach ($reflectionMethods as $method) {
            $methods[] = new Method($method->name, $method->isStatic());
        }

        return $methods;
    }
1184785
public function getListRecipients($filters)
    {
        $response = $this->client->get(Resources::$Listrecipient, ['filters' => $filters]);
        if (!$response->success()) {
            $this->throwError("MailjetService:getListRecipients() failed", $response);
        }
        return $response;
    }
1184262
public static function filterFieldList($fieldsList, $filters = array())
    {
        $result = array();

        foreach ($fieldsList as $field) {
            if (in_array($field->id, $filters, true)) {
                $result[] = $field;
            }
        }

        return $result;
    }
1200460
public function getMethods($filter = -1)
    {
        $return = parent::getMethods($filter);
        foreach ($return as $key => $val) {
            $return[$key] = new ReflectionMethod($this->getName(), $val->getName());
        }

        return $return;
    }
737165
protected function getPredicatesFromFilterCondition($filter)
    {
        $predicates = [];
        $regex = "/(^|\b)(\w+\:\w+)\.(l|u)(\b|$)/";
        foreach($filter as $key=>$condition)
        {
            if(is_string($key))
            {
                $numMatches = preg_match_all($regex, $key, $matches);
                for($i = 0; $i < $numMatches; $i++)
                {
                    if(isset($matches[2][$i]))
                    {
                        $predicates[] = $matches[2][$i];
                    }
                }
            }
            if(is_string($condition))
            {
                $numMatches = preg_match_all($regex, $condition, $matches);
                for($i = 0; $i < $numMatches; $i++)
                {
                    if(isset($matches[2][$i]))
                    {
                        $predicates[] = $matches[2][$i];
                    }
                }
            }
            elseif(is_array($condition))
            {
                array_merge($predicates, $this->getPredicatesFromFilterCondition($condition));
            }
        }
        return $predicates;
    }
1295665
private function listResources($filters = array(), $listType = null)
    {
        $uri = '/resources';
        $query = array();
        if ($listType) {
            $query[] = $listType;
        }
        foreach ($filters as $name => $value) {
            $query[] = "{$name}={$value}";
        }

        if (sizeof($query)) {
            $uri .= '?' . implode('&', $query);
        }
        $body = $this->sendRequest($uri);
        $node = $this->parseXml((string)$body);
        return $this->parseResourcesXmlToResources($node);
    }
372435
public function fieldTypesToFilter($arrFields) {
		foreach ($arrFields as $key => &$properties) {
			if (isset($properties['filter']) ||
				!isset($properties['type']) ||
				!isset($this->typesToFilter[$properties['type']]) )
				continue;

			$properties = $properties + $this->typesToFilter[$properties['type']];
		}

		return $arrFields;
	}
148160
public function registerFilter($extension, $filter)
    {
        if (is_array($extension)) {
            foreach ($extension as $_extension) {
                $this->registerFilter($_extension, $filter);
            }
            return;
        }

        $extension = strtolower($extension);

        if (!isset($this->filters[$extension])) {
            $this->filters[$extension] = [];
        }

        if ($filter !== null) {
            $this->filters[$extension][] = $filter;
        }

        return $this;
    }
954947
public function get_filter_values($filter) {
        if ($allvalues = (array) $this->get_config('filtervalues')) {
            if (isset($allvalues[$filter])) {
                return $allvalues[$filter];
            }
        }

        return [];
    }
495551
public static function convertFilter($filter)
    {
        if (!$filter) {
            return array();
        }
        if (is_array($filter)) {
            return $filter;
        }

        $filter_array = array();
        $rules        = explode('|', $filter);
        foreach ($rules as $rule) {
            list($name, $arg) = self::get_name_and_arg($rule);
            $filter_array[$name] = $arg;
        }

        return $filter_array;
    }
864182
public function populatePostTypeSelect($field)
    {
        $choices = array_map('trim', get_post_types());

        $choices = array_diff($choices, array('revision','acf-field-group','acf-field','nav_menu_item'));

        if (is_array($choices)) {
            foreach ($choices as $choice) {
                $field['choices'][ $choice ] = $choice;
            }
        }

        return $field;
    }
952642
private static function fixFilterFieldPath(?Filter $filter): ? Filter
    {
        if (is_null($filter)) {
            return $filter;
        }

        $filterAsArray = $filter->toArray();
        $filterAsArray['field'] = Item::getPathByField($filterAsArray['field']);

        return Filter::createFromArray($filterAsArray);
    }
685397
protected function _post($field = '', $default = false, $filter = false)
    {
        if (isset($_POST['fruit'][$field]))
        {
            if (get_magic_quotes_gpc())
            {
                if (is_array($_POST['fruit'][$field]))
                {
                    array_walk_recursive($_POST['fruit'][$field], array($this, 'stripslashes_callback'));
                }
                else
                {
                    $_POST['fruit'][$field] == stripslashes($_POST['fruit'][$field]);
                }
            }
            if (Fruit_config::$auto_xss_filtering)
            {
                $xss = $this->load_core_class('xss');
            }
            else
            {
                $xss = false;
            }
            if (($field == 'postdata' or $field == 'unique') && $_POST['fruit'][$field])
            {
                $data_keys = array_keys($_POST['fruit'][$field]);
                foreach ($data_keys as $k => $key)
                {
                    $data_keys[$k] = $xss ? $xss->xss_clean($this->fieldname_decode($key)) : $this->fieldname_decode($key);
                    if ($xss)
                    {
                        $_POST['fruit'][$field][$key] = $xss->xss_clean($_POST['fruit'][$field][$key]);
                    }
                }
                return array_combine($data_keys, $_POST['fruit'][$field]);
            }
            elseif ($filter)
            {
                switch ($filter)
                {
                    case 'key':
                        return str_replace('`', '', $xss ? $xss->xss_clean($_POST['fruit'][$field]) : $_POST['fruit'][$field]);
                        break;
                    case 'int':
                        return (int)$_POST['fruit'][$field];
                        break;
                    case 'trim':
                        return trim($xss ? $xss->xss_clean($_POST['fruit'][$field]) : $_POST['fruit'][$field]);
                        break;
                    case 'base64':
                        return $xss ? $xss->xss_clean($this->fieldname_decode($_POST['fruit'][$field])) : $this->fieldname_decode($_POST['fruit'][$field]);
                        break;
                    default:
                        return $xss ? $xss->xss_clean($_POST['fruit'][$field]) : $_POST['fruit'][$field];
                        break;
                }
            }
            else
            {
                return $xss ? $xss->xss_clean($_POST['fruit'][$field]) : $_POST['fruit'][$field];
            }
        }
        else
            return $default;
    }
1063411
public function listTemplates($filter = null)
    {
        $files = [];

        $name = $filter ? Glob::toRegex($filter, false, false) : '/^[a-zA-Z0-9]\V+\.twig$/';

        /** @var Finder|FileInterface[] $finder */
        $finder = $this->templatesDir->find()
            ->files()
            ->notName('/^_/')
            ->exclude(['node_modules', 'bower_components', '.sass-cache'])
            ->depth('<4')
            ->path($name)
            ->sortByName()
        ;

        foreach ($finder as $file) {
            $name = Str::replaceFirst($file->getFullPath(), $this->templatesDir->getFullPath(), '');
            $files[$name] = $name;
        }

        // Check: Have we defined names for any of the matched templates?
        foreach ((array) $this->themeTemplateSelect as $templateFile) {
            if (!empty($templateFile['name']) && !empty($templateFile['filename']) && in_array($templateFile['filename'], $files)) {
                $files[$templateFile['filename']] = $templateFile['name'];
            }
        }

        return $files;
    }