Save files.

@param array $ids
762578
public function saveFiles($ids)
    {
        // Work on $_FILES
        $files = $_FILES;

        if (empty($files) || empty($ids)) {
            return;
        }

        // Get required files
        require_once ABSPATH.'wp-admin'.S.'includes'.S.'image.php';
        require_once ABSPATH.'wp-admin'.S.'includes'.S.'file.php';
        require_once ABSPATH.'wp-admin'.S.'includes'.S.'media.php';

        // Iterate
        foreach ($files as $k => $v) {
            // Don't do nothing if no file is defined
            if (empty($v['tmp_name']) || !in_array($k, $ids)) {
                continue;
            }

            // Do the magic
            $file = wp_handle_upload($v, ['test_form' => false]);

            // Register settings
            Option::set($k, $file['url']);
        }
    }
271722
public function removeEntities(array $ids)
    {

        foreach ($this->getRepository()->getEntitiesById($ids) as $entity) {
            $this->entityManager->remove($entity);
        }

        $this->entityManager->flush();
        return true;
    }
548686
public function upload($id, array $files)
    {
        foreach ($this->uploaders as $uploader) {
            if (!$uploader->upload($id, $files)) {
                return false;
            }
        }

        return true;
    }
1186390
public function save(array $options = null)
    {
        try {
            parent::save($options);
        }
        catch (Exception $ex) {
            $this->throwHalcyonSaveException($ex);
        }
    }
858935
public function save($params = array()) {
        $competencies = $params['competency_competencies'];
        unset($params['competency_competencies']);
        if (is_string($competencies)) {
            $competencies = explode(',', $competencies);
        }
        foreach ($competencies as $competencyid) {
            $params["competency_{$competencyid}"] = $competencyid;
        }
        parent::save($params);
    }
1294370
public function save(array $params)
    {
        foreach ($params as $method => $param) {
            if (is_array($param) && isset($param[0])) {
                call_user_func_array([$this, $method], $param);
            } else {
                $this->{$method}($param);
            }
        }
    }
472204
protected function prepareFiles(array $ids, array $libraries)
    {
        $prepared = array();

        foreach ($ids as $id) {
            if (!empty($libraries[$id]['files'])) {
                $prepared = array_merge($prepared, $libraries[$id]['files']);
            }
        }

        return $prepared;
    }
514469
public function ids($ids)
    {
        $ids = is_array($ids) ? $ids : [$ids];

        $query = new IdsQuery($ids);

        $this->append($query);

        return $this;
    }
580456
public function filter($ids = array())
    {
        $data = $this->get();
        $data = array_intersect($data, $ids);

        $this->meta          = array();
        $this->meta['count'] = count($data);
        $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
    }
790836
public function upload($id, array $files)
    {
        foreach ($files as $file) {
            if ($file instanceof FileEntity) {
                foreach ($this->dimensions as $index => $dimension) {

                    $width = (int) $dimension[0];
                    $height = (int) $dimension[1];

                    $destination = $this->makeDestination($id, $width, $height);

                    // Ensure that destination actually exists
                    if (!is_dir($destination)) {
                        mkdir($destination, 0777, true);
                    }

                    $to = sprintf('%s/%s', $destination, $file->getUniqueName());

                    $imageProcessor = new ImageProcessor($file->getTmpName());
                    $imageProcessor->thumb($width, $height);

                    // This might fail sometimes
                    $imageProcessor->save($to, $this->quality);
                }
            }
        }

        return true;
    }
704166
function save($id, $data)
    {
        $data['_id'] = $id;
        $data['__meta']['sid'] = $this->sid;
        $this->collection->insertOne($data);
    }
1128085
public function saveAll(array $entities): void
    {
        if ([] === $entities) {
            return;
        }
        foreach ($entities as $entity) {
            if (false === $entity instanceof EntityInterface) {
                throw new \InvalidArgumentException(
                    'Found invalid $entity was not an EntityInterface, was ' . \get_class($entity)
                );
            }
            $this->entityManager->persist($entity);
        }
        $this->entityManager->flush();
    }
516624
protected function _clearCache( array $ids )
	{
		$domain = str_replace( '_', '/', strtolower( $this->_name ) );
		$tags = array( $domain );

		foreach( $ids as $id ) {
			$tags[] = $domain . '-' . $id;
		}

		$this->_context->getCache()->deleteByTags( $tags );
	}
1295210
public function setFiles(array $files)
    {
        $this->files = array();
        foreach ($files as $key => $file) {
            if (!is_array($file)) {
                $file = array('content' => $file);
            }

            $file = array_merge(array(
                'content' => null,
                'mtime' => null,
            ), $file);

            $this->setFile($key, $file['content'], $file['mtime']);
        }
    }
1364170
public function costsDelete(array $ids)
    {
        if (!count($ids)) {
            throw new \InvalidArgumentException(
                'Parameter `ids` must contains a data'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            '/costs/delete',
            "POST",
            ['ids' => json_encode($ids)]
        );
    }
190581
public function removePermission($ids)
    {
        $ids = is_array($ids) ? $ids : func_get_args();

        $this->permissions()->detach($ids);
    }
1056416
public function deactivateUsers(array $ids): void
	{
		if ($this->isAjax()) {
			$users = $this->orm->users->findById($ids);
			foreach ($users as $user) {
				$user->active = false;
				$this->orm->users->persist($user);
			}
			$this->orm->flush();
			$this['userList']->reload();
		} else {
			$this->terminate();
		}
	}