Generates PDF file from provided file (html, zip, tar.gz...)

@param array $params Parameters for pdf generating (parameter 'file' must be set)
@return response
@throws \Exception
433362
public function generateFromFile($params)
    {
        if(empty($params['file']))
            throw new \Exception('Parameter \'file\' must be set' );

        $params['file'] = '@'.$params['file'];
        $params = $this->validator->validate($params);
        $this->validator->validateHtmlFile($params['file']);

        try {
            return $this->client->sendRequest('pdf', $params, 'POST');
        } catch (\Exception $ex) {
            throw $ex;
        }
    }
1139984
public function render($template=null, array $params=[]) {
		if($template === null)
			$template = $this->template;
		$params = array_merge($this->params, $params);

		return static::renderFile($template, $params);
	}
999987
public static function create($params = null, $options = null)
    {
        $opts = \Stripe\Util\RequestOptions::parse($options);
        if (is_null($opts->apiBase)) {
            $opts->apiBase = Stripe::$apiUploadBase;
        }
        // Manually flatten params, otherwise curl's multipart encoder will
        // choke on nested arrays.
        // TODO: use array_column() once we drop support for PHP 5.4
        $flatParams = [];
        foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
            $flatParams[$pair[0]] = $pair[1];
        }
        return static::_create($flatParams, $opts);
    }
193062
private function thumbnail(array $params)
    {
        $mode = isset($params['mode']) ? $params['mode'] : self::THUMBNAIL_OUTBOUND;

        $width = (isset($params['width']) && is_numeric($params['width'])) ? $params['width'] : null;
        $height = (isset($params['height']) && is_numeric($params['height'])) ? $params['height'] : null;

        if (is_null($width) || is_null($height)) {
            throw new Exception('Wrong thumbnail width or height');
        }

        $this->image = $this->image->thumbnail(new Box($width, $height), $mode);
    }
153557
public function create($params, $optParams = [])
    {
        if (!$params instanceof SuperBackup) {
            throw new InvalidParamException(SuperBackup::class.' is required!');
        }
        if(!isset($optParams['cloud'])){
            $optParams['cloud'] = [];
        }
        $optParams['cloud']['id'] = $params->cloud->id;

        return $this->sendRequest([], [
            'restAction' => 'create',
            'uri' => '/c/<cloud.id>',
            'postParams' => $params->toArray(),
            'getParams' => $optParams,
        ], function ($response) {
            return isset($response->data) ? new SuperBackup($response->data) : $response;
        });
    }
61007
protected function generateUrlArray(array $params)
    {
        $urlRequest = $this->getUrl() . '?' . http_build_query($params, null, '&');
        $urlArray = parse_url($urlRequest);

        return $urlArray;
    }
1267312
public function form_file($params) {
        if (!isset($params['field'])) {
            throw new \UnexpectedValueException("The field parameter is required.");
        }
        $attributes = isset($params['attrs']) ? $params['attrs'] : array();
        return Form::file($params['field'], $attributes);
    }
443746
private function processRequest($params = null)
    {
        // Ensure this api is currently enabled/supported
        $this->assertEnabled();

        // Instantiate requester
        $requestor = new Requestor($this->config);

        switch ($this->config['dataFormat']) {
            case 'xml':
                // Do nothing special for XML
                break;
            case 'json':
                // Validate and sanitize parameters (json decode/encode)
                if ($this->config['paramValidationEnabled']) {
                    $params_decoded = json_decode($params, TRUE);
                    $params_decoded = $this->validateApiParameters($this->keys, $params_decoded);
                    // Add URI method and version to payload
                    $params_decoded['_method'] = $this->id;
                    $params_decoded['_version'] = $requestor->version;
                    $params = json_encode($params_decoded);
                }
                break;
            case 'array':
                // Validate and sanitize parameters
                if ($this->config['paramValidationEnabled']) {
                    $params = $this->validateApiParameters($this->keys, $params);
                } else {
                    $params = $this->setAuthenticationParametersNoValidation($params);
                }
                // Add URI method and version to payload
                $params['_method'] = $this->id;
                $params['_version'] = $requestor->version;
                break;
            default:
                throw new ApiException(
                    'Invalid dataFormat: '.$this->config['dataFormat']
                );
        }

        // Send request
        $response = $requestor->request('post', $this->id, $params);

        // Return result
        $this->lastApiResponse = $response;
        return $response;
    }
952215
public function action_create( $params )
	{
		$name = array_shift( $params );
		
		$file = \DB\Migrator::path( $name );
		
		\CCFile::write( $file, "# ---> up\n\n\n\n# ---> down\n\n" );
	}
468205
public function execute(&$params, &$pagerenderer)
    {
        if (!is_array($params['cssFiles'])) {
            return;
        }
        $cssFilesArray = [];
        foreach ($params['cssFiles'] as $cssFile => $cssFileSettings) {
            $compiledFile = \KayStrobach\Dyncss\Service\DyncssService::getCompiledFile($cssFile);
            if ($compiledFile !== $cssFile) {
                $cssFileSettings['file'] = $compiledFile; //needed for TYPO3 4.6+ ;)
                $cssFileSettings['compress'] = 0;
                $cssFilesArray[$compiledFile] = $cssFileSettings;
            } else {
                $cssFilesArray[$cssFile] = $cssFileSettings;
            }
        }
        $params['cssFiles'] = $cssFilesArray;
    }
1179648
protected function createStream(array $params)
    {
        $http_response_header = null;
        $url = $this->url;
        $context = $this->context;
        $fp = $this->createResource(function () use ($context, $url, &$http_response_header) {
            return fopen((string) $url, 'r', false, $context);
        });

        // Determine the class to instantiate
        $className = isset($params['stream_class']) ? $params['stream_class'] : __NAMESPACE__ . '\\Stream';

        /** @var $stream StreamInterface */
        $stream = new $className($fp);

        // Track the response headers of the request
        if (isset($http_response_header)) {
            $this->lastResponseHeaders = $http_response_header;
            $this->processResponseHeaders($stream);
        }

        return $stream;
    }
35449
public function generate($name, $params = []) {
		$url = '';
		$path = $this->generatePath($name, $params);

		if ($path) {
			if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
				&& $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'
			) {
				$scheme = 'https';
			} else {
				$scheme = 'http';
			}
			$url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $path;
		}

		return $url;
	}
34699
public function exportFile( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );
		$context = $this->getContext();

		$items = (array) $params->items;
		$lang = ( property_exists( $params, 'lang' ) ) ? (array) $params->lang : [];

		$config = $context->getConfig();

		/** controller/extjs/product/export/text/standard/downloaddir
		 * Directory where the exported files can be found through the web
		 *
		 * The exported files are stored in this directory.
		 *
		 * The download directory must be relative to the document root of your
		 * virtual host. If the document root is
		 *
		 *  /var/www/test/htdocs
		 *
		 * and the exported files will be in
		 *
		 *  /var/www/test/htdocs/files/exports
		 *
		 * then the configuration for the download directory must be
		 *
		 *  files/exports
		 *
		 * Avoid leading and trailing slashes for the export directory string!
		 *
		 * @param string Relative path in the URL
		 * @since 2014.03
		 * @category Developer
		 */
		$downloaddir = $config->get( 'controller/extjs/product/export/text/standard/downloaddir', 'uploads' );

		$foldername = 'product-text-export_' . date( 'Y-m-d_H:i:s' ) . '_' . md5( time() . getmypid() );
		$tmppath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $foldername;

		$filename = $this->exportData( $items, $lang, $tmppath );
		$downloadFile = $downloaddir . '/' . basename( $filename );

		$fs = $context->getFilesystemManager()->get( 'fs-admin' );
		$fs->writef( basename( $filename ), $filename );

		return array(
			'file' => '<a href="' . $downloadFile . '">Download</a>',
		);
	}
652610
public function download(string $filename, array $params = [])
    {
        $path = $this->buildAttachmentsPath($filename);

        return $this->pureGet($path, $params, ['Accept' => '*/*'])->getBody();
    }
937092
public function post($params = array(), $options = array())
	{
		// If its an array (instead of a query string) then format it correctly
		if (is_array($params))
		{
            if($this->format == "json"){
                $params = json_encode($params);
            }else{
                if(!empty($_FILES)){
                    foreach($_FILES as $fileField => $fileVal){
                        $params[$fileField] = curl_file_create($fileVal['tmp_name'], $fileVal['type'], $fileVal['name']);
                    }
                }else{
					$params = http_build_query($params, NULL, '&');
				}
            }
		}

		// Add in the specific options provided
		$this->options($options);

		$this->http_method('post');

		$this->option(CURLOPT_POST, TRUE);
		$this->option(CURLOPT_POSTFIELDS, $params);
	}
967614
public function convert(string $outputFile, string $format, array $params = array()): ExportResult
    {
        try {
            $this->getVerb()->setOutputFile($outputFile)
                ->setFormat($format)
                ->setParameters($params);

            $result = self::getCommand()->execute($this->getVerb());
            if (!$result->isSuccess()) {
                if ($result->hasException()) {
                    throw $result->getException();
                }
                throw new \RuntimeException('Unknown error: ', $result->getExitCode());
            }
            return $result;
        } catch (\Exception $e) {
            throw new ConverterException('Conversion failed', ErrorCodes::EXECUTION_FAILURE, $e);
        }
    }
1047185
private function _exec($params) {
        $params['key'] = $this->_config['api_key'];
        $params = json_encode($params);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mandrill-PHP/1.0.52');
        curl_setopt($ch, CURLOPT_POST, true);
        if (!ini_get('safe_mode') && !ini_get('open_basedir')){
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        }
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($ch, CURLOPT_TIMEOUT, 600);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send.json');
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
        curl_setopt($ch, CURLOPT_VERBOSE, false);

        $response_body = curl_exec($ch);

        if(curl_error($ch)) {
            throw new Exception("API call to messages/send failed: " . curl_error($ch));
        }
        $result = json_decode($response_body, true);
        if($result === null) throw new Exception('We were unable to decode the JSON response from the Mandrill API: ' . $response_body);

        return $result;
    }