/** * Ověří mimetype předaného souboru. * @param \Nette\Http\FileUpload $file Nahraný soubor k ověření. * @return bool Má soubor správný mimetype? */ public function checkType(\Nette\Http\FileUpload $file) { if (\Nette\Utils\Arrays::searchKey($this->getMimeTypes(), $file->getContentType()) !== FALSE) { return TRUE; } else { // Pokud se nepodaří ověřit mimetype, ověříme alespoň koncovku. if (array_search($this->getExtension($file->getName()), array_unique($this->getMimeTypes())) !== FALSE) { return TRUE; } else { return FALSE; } } }
function __set($name, $val) { if (Nette\Utils\Arrays::searchKey($this->og, $name) !== FALSE) { $this->og[$name] = Nette\Utils\Strings::normalize($val); } else { if (Nette\Utils\Arrays::searchKey($this->fb, $name) !== FALSE) { $this->fb[$name] = Nette\Utils\Strings::normalize($val); } else { list($ar, $section, $name) = Nette\Utils\Strings::match($name, '/([a-zA-Z]+)[_]([a-zA-Z]*)/'); if (Nette\Utils\Arrays::searchKey($this->{$section}, $name) !== FALSE) { $this->{$section} = array_replace($this->{$section}, array($name => $val)); } } } }
public function getVisibility($vars) { if (!is_array($vars) || !Arrays::searchKey($vars, 'visibility')) { return "public "; } else { return Arrays::get($vars, 'visibility') . " "; } }
/** * Get data from ID * @param int $id * @return \IQRF\Cloud\Response\DataAPI * @throws \OutOfRangeException Non exist ID */ public function getID($id) { foreach ($this->data as $key => $value) { if ($value[0] == (string) $id) { $this->id = Arrays::searchKey($this->data, $key); return $this; } } if (empty($this->id)) { throw new \OutOfRangeException('Non exist ID'); } }