Products Downloadable Main Media Download.

@param string $token

@return \Illuminate\Http\JsonResponse
329201
public function downloadDemoToken($token)
    {
        $downloadableUrl = $this->downRepository->findByToken($token);
        $path = storage_path(
            'app/public' . DIRECTORY_SEPARATOR . $downloadableUrl->demo_path
        );

        return response()->download($path);
    }
1339712
public function withToken(Token $token)
    {
        $this->grant = 'provided_token';
        $this->token = new AccessToken([
            'access_token' => $token->jwt(),
            'expires' => $token->expires()->timestamp,
        ]);

        return $this;
    }
879171
function acknowledgeTransaction($token) {

        $acknowledgeTransaction = new acknowledgeTransaction();
        $acknowledgeTransaction->tokenInput = $token;
        $acknowledgeTransactionResponse = $this->_acknowledgeTransaction($acknowledgeTransaction);

        $xmlResponse = $this->soapClient->__getLastResponse();
        $soapValidation = new SoapValidation($xmlResponse, $this->config->getWebpayCert());
        $validationResult = $soapValidation->getValidationResult();
        return $validationResult === TRUE;
    }
1217110
public function getContentUntil(AbstractToken $token)
    {
        if ($this === $token) {
            return '';
        }

        $content = $this->getContent();
        $next = $this->nextToken;

        while ($next && $next !== $token) {
            $content .= $next->getContent();
            $next = $next->nextToken;
        }

        if (null === $next) {
            throw new \RuntimeException(sprintf('Could not find token "%s".', $token));
        }

        return $content;
    }
749309
public function getFromToken($token)
    {
        $rest = $this->callService('GET', self::API_SHARE_LINK . $token);

        return $rest->getModel(models\FileSystem\ShareLink::class);
    }
562005
public function generateFromToken($token)
    {
        if (!$token instanceof HTMLPurifier_Token) {
            trigger_error('Cannot generate HTML from non-HTMLPurifier_Token object', E_USER_WARNING);
            return '';

        } elseif ($token instanceof HTMLPurifier_Token_Start) {
            $attr = $this->generateAttributes($token->attr, $token->name);
            if ($this->_flashCompat) {
                if ($token->name == "object") {
                    $flash = new stdclass();
                    $flash->attr = $token->attr;
                    $flash->param = array();
                    $this->_flashStack[] = $flash;
                }
            }
            return '<' . $token->name . ($attr ? ' ' : '') . $attr . '>';

        } elseif ($token instanceof HTMLPurifier_Token_End) {
            $_extra = '';
            if ($this->_flashCompat) {
                if ($token->name == "object" && !empty($this->_flashStack)) {
                    // doesn't do anything for now
                }
            }
            return $_extra . '</' . $token->name . '>';

        } elseif ($token instanceof HTMLPurifier_Token_Empty) {
            if ($this->_flashCompat && $token->name == "param" && !empty($this->_flashStack)) {
                $this->_flashStack[count($this->_flashStack)-1]->param[$token->attr['name']] = $token->attr['value'];
            }
            $attr = $this->generateAttributes($token->attr, $token->name);
             return '<' . $token->name . ($attr ? ' ' : '') . $attr .
                ( $this->_xhtml ? ' /': '' ) // <br /> v. <br>
                . '>';

        } elseif ($token instanceof HTMLPurifier_Token_Text) {
            return $this->escape($token->data, ENT_NOQUOTES);

        } elseif ($token instanceof HTMLPurifier_Token_Comment) {
            return '<!--' . $token->data . '-->';
        } else {
            return '';

        }
    }
778609
private function getLinksField($token)
    {
        $uri = $this->service->getInvoicePdfUri($token);
        $text = ucfirst($this->t('invoice'));
        $title = sprintf($this->t('open_as_pdf'), $text);
        /** @noinspection HtmlUnknownTarget */
        $invoiceLink = sprintf('<a class="%4$s" href="%1$s" title="%3$s">%2$s</a>', $uri, $text, $title, 'pdf');

        $uri = $this->service->getPackingSlipUri($token);
        $text = ucfirst($this->t('packing_slip'));
        $title = sprintf($this->t('open_as_pdf'), $text);
        /** @noinspection HtmlUnknownTarget */
        $packingSlipLink = sprintf('<a class="%4$s" href="%1$s" title="%3$s">%2$s</a>', $uri, $text, $title, 'pdf');

        $fields = array(
            'links' => array(
                'type' => 'markup',
                'label' => $this->t('documents'),
                'value' => "$invoiceLink $packingSlipLink",
            ),
        );
        return $fields;
    }
663239
public function downloadAction()
	{
		$response = Shop::get( 'account/download' )->getView()->response();
		return Response::make( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() );
	}
287817
public function downloadAttachment($url)
	{
		$result = $this->client->sendRequest(
			self::REQUEST_GET,
			$url,
			array(),
			null,
			$this->authentication,
			true,
			false
		);

		return $result;
	}
1123514
protected function getUserByToken($token) {
		$response = $this->getHttpClient()->request('GET', 'https://openapi.naver.com/v1/nid/getUserProfile.xml', [
			'headers' => [
				'Authorization' => 'Bearer ' . $token,
		    ],
		]);
		
		$xml = $response->getBody()->getContents();
		
		return $this->parseXML($xml)['response'];
		
	}
1025810
public function downloadAction(string $path): Response
    {
        if (!$meta = $this->filesystem->getMetadata($path)) {
            throw new NotFoundHttpException('Media not found: ' . $path);
        }

        $content = $this->filesystem->read($path);

        $response = new Response($content);
        $response->headers->set('Content-Type', $meta['mimetype']);
        $response->headers->set('Content-Length', $meta['size']);
        $response->headers->set('Content-Transfer-Encoding', 'binary');

        $name = explode('/', $path);

        $disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $name[count($name) - 1]);
        $response->headers->set('Content-Disposition', $disposition);

        return $response;
    }
1148201
protected function parseToken($token)
    {
        list($id, $content) = $token;
        if ($id == T_INLINE_HTML) {
            $content = $this->renderShortcodes($content);
        }

        return $content;
    }
662482
protected function requireToken($token)
    {
        if ($token) {
            return $this->setToken($token);
        } elseif ($this->token) {
            return $this;
        } else {
            throw new JWTException('A token is required', 400);
        }
    }
422091
public function getFileInfo($token)
    {
        $record = ORM::for_table('files_downloads')
            ->select_many('path', 'name', 'token')
            ->where_equal('token', $token)
            ->find_one();
        if (is_object($record)) {
            if ($record->token === $token) {
                return Response::data([
                    'path' => $record->path,
                    'name' => $record->name,
                ]);
            } else {
                return Response::error400('Неверный токен');
            }
        } else {
            return Response::error404('Токен не найден');
        }
    }
1182144
public function getTransactionResult($token = null)
    {
        if (!$token) {
            $token = $_POST['token_ws'];
        }

        return $this->service->getTransactionResult($token)->return;
    }
215703
static public function load($token = null)
    {
        // if single token is set, we keep it
        if (is_null($token) && static::hasSingleToken()) {
            $token = static::getSingleToken();
        }

        // if no session are set, we set a new one only is class has a singleToken
        if (!Session::has($token)){
            if (static::hasSingleToken()) {
                Session::push($token, json_encode(['constructor' => static::class]));
            } else {
                throw new \InvalidArgumentException('Token "' . $token . '" is not valid');
            }
        }

        // load configuration
        $config = Session::get($token);
        $config = json_decode($config[0], true);
        $constructor = $config['constructor'];

        // construct Table polliwog
        if (preg_match('#(?<class>.+)::(?<method>.+)#', $constructor, $match)) {

            $method = $match['method'];
            // extract parameters
            $params = [];
            if (preg_match('#(?<method>[^:]+):(?<params>.+)#', $method, $params)) {
                $method = $params['method'];
                $params = explode(',', $params['params']);
            }

            $table =  call_user_func_array([$match['class'], $method], $params);
        } else {
            $instance = new \ReflectionClass($config->constructor);
            $table = $instance->newInstance();
        }

        // validate that instance is viable
        if (!($table instanceof static)) {
            throw new \Exception('Loaded instance is not viable');
        }

        return $table;
    }
289147
public function getTransactionResult($token)
    {
        $transactionResult = new TransactionResult();
        $transactionResult->tokenInput = $token;

        return $this->callSoapMethod('getTransactionResult', $transactionResult);
    }