Checks if uploaded image is located in theme.

@param string $path image path.
@return bool     If the image is located in the theme directory it returns true.
If not or $path doesn't exits it returns false.
505879
protected static function is_in_theme_dir( $path ) {
		$root = realpath(get_stylesheet_directory());

		if ( false === $root ) {
			return false;
		}

		if ( 0 === strpos($path, (string) $root) ) {
			return true;
		} else {
			return false;
		}
	}
951188
public function fileExists($path) {

        $ch = curl_init($this->hostUrl . "/" . $this->siteFolder . $path);

        curl_setopt($ch, CURLOPT_NOBODY, true);

        $result = curl_exec($ch);
        $ret = false;

        if($result !== false) {
        $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        if($status == 200) {
            $ret = true;
        }
        }

        curl_close($ch);

        return $ret;
    }
1017277
protected static function isValidPath($path)
    {
        if (strpos($path, '?') !== false) {
            return false;
        }
        if (strpos($path, '*') !== false) {
            return false;
        }
        if (strpos($path, ':') !== false) {
            return false;
        }
        if (strpos($path, '|') !== false) {
            return false;
        }
        if (strpos($path, '\\') !== false) {
            return false;
        }
        if (strpos($path, '<') !== false) {
            return false;
        }
        if (strpos($path, '>') !== false) {
            return false;
        }
        if (strpos($path, '"') !== false) {
            return false;
        }

        return true;
    }
319279
protected function isDirectory($path)
    {
        $location = $this->applyPathPrefix($path);

        if (empty($location)) {
            return true;
        }

        try {
            $file = $this->share->stat($location);
        } catch (NotFoundException $e) {
            return false;
        }

        return $file->isDirectory();
    }
564458
public function has(string $path): bool
    {
        $keys = $this->explode($path);
        $array = $this->items;
        foreach ($keys as $key) {
            if (!array_key_exists($key, $array)) {
                return false;
            }
            $array = $array[$key];
        }
        return true;
    }
1050780
protected function verifyPath($path){
		if (file_exists($path)) return true;
			
		if (mkdir($path, 0777, true)) return true;
				
		return false;
	}
1020383
public function isPathCovered($path)
    {
        foreach ($this->patterns as $pattern) {
            if (1 === preg_match('{'.$pattern.'}', $path)) {
                return true;
            }
        }
        return false;
    }
480849
public function is_image($path){
        if( !file_exists($path) || !($info = getimagesize($path)) ){
            return false;
        }
        return (bool) preg_match("/^image\/(jpeg|png|gif)$/", $info['mime']);
    }
48429
public function imageExists($path) {
        $this->validateLocalFile($path);
        $checksum = md5_file($path);
        $query = new ImagesQuery();
        $query->originalChecksums(array($checksum))
              ->limit(1);

        $response = $this->getImages($query);

        return (boolean) $response['search']['hits'];
    }
538576
public function has($path)
    {
        $location = $this->applyPathPrefix($path);
        return $this->ossClient->doesObjectExist($this->bucket, $location);
    }
108116
public function isValidSolrPath($path)
    {
        $path = trim($path);

        if ((!empty($path)) && (preg_match('/^[^*?"<>|:#]*$/', $path))) {
            return true;
        }

        return false;
    }
1275619
private function createPathIfNeeded(string $path) : bool
    {
        if (! is_dir($path)) {
            if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) {
                return false;
            }
        }

        return true;
    }
793260
public function isValidPath($path)
    {
        $isValidPath = false;

        $pathValue = $this->getValueByPath($path);
        if (!is_null($pathValue)) {
            $isValidPath = true;
        }

        return $isValidPath;
    }
369184
protected function checkPath($path)
    {
        foreach ($this->chroots as $chroot) {
            if (StringHelper::contains($path, $chroot)) {
                return true;
            }
        }
        return false;
    }
317728
private function checkPath($path)
    {
        return file_exists($path) && is_readable($path) && ($resources = scandir($path)) && (count($resources) > 2);
    }
1085012
protected function isConfig($path)
    {
        if ($this->config()->isConfigFile($path)) {
            $this->config()->invalidateConfig();

            $this->loader->loadEverything();

            return true;
        }

        return false;
    }
1240093
public static function mkdir($path): bool
    {
        if (is_dir($path)) {
            return true;
        }

        if (dirname($path) && !is_dir(dirname($path))) {
            self::mkdir(dirname($path));
        }

        try {
            mkdir($path);

            return true;
        } catch (Throwable $ex) {
            return false;
        }
    }