alanpich / tveasyupload

A simple file-upload TV input filter for MODx Revolution 2.2+
4 stars 15 forks source link

Pass parameters to @SNIPPET options #17

Open alanpich opened 10 years ago

goldsky commented 10 years ago

    /**
     * Prepare the save path using the TV's defined pathing string
     * @param string $pathStr path
     * @return string path
     */
    private function preparePath($pathStr) {

        // If the pathStr starts '@SNIPPET ' then run the snippet to get path
        if (strpos($pathStr, '@SNIPPET ') !== false) {
            $snippet = str_replace('@SNIPPET ', '', $pathStr);
            return $this->modx->runSnippet($snippet, $this->getProperties());
        };

        // Parse path string and return it
        $path = $this->parsePlaceholders($pathStr);
        return $path;
    }