Get current css output.

@param array $options
@param string $url
@return string
485148
protected function _getCssOutput(array $options, $url)
    {
        if ($options['rel'] === 'import') {
            return $this->formatTemplate('style', [
                'attrs'   => $this->templater()->formatAttributes($options, ['rel', 'block', 'weight', 'alias']),
                'content' => '@import url(' . $url . ');',
            ]);
        }

        return $this->formatTemplate('css', [
            'rel'   => $options['rel'],
            'url'   => $url,
            'attrs' => $this->templater()->formatAttributes($options, ['rel', 'block', 'weight', 'alias']),
        ]);
    }
876219
public function get($url, $options = [], $body = null, $raw = true)
    {
        return $this->httpRequest('GET', $this->createUrl($url, $options), $body, $raw);
    }
1276091
protected static function createViaStreamWrapper($url, array $options = [])
    {
        $clientOptions = isset($options['client']) ? (array)$options['client'] : [];
        $opts = array_merge_recursive([
            'http' => [
                'method' => 'GET',
                'protocol_version' => 1.1,
                'user_agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.466.4 Safari/534.3',
                'max_redirects' => 10,
                'timeout' => 10.0,
                'header' => "Accept-language: en\r\n",
            ]
        ], $clientOptions);
        $context = stream_context_create($opts);
        $requestOptions = isset($options['request']) ? (array)$options['request'] : [];
        stream_context_set_params($context, $requestOptions);
        $response = @file_get_contents($url, false, $context);
        return self::createFromString($response);
    }
846513
protected function getUrl(array $options): string
    {
        $urlOptions = [];
        $this->setOriginAndDestinationOption($urlOptions, $options);
        $this->setViaOption($urlOptions, $options);
        $this->setDateOption($urlOptions, $options);

        $urlOptions = array_merge($urlOptions, $options);

        return sprintf('trip?%s&format=json', http_build_query($urlOptions));
    }
33040
public function getShareLink($url, array $options = array())
    {
        $options['url'] = $url;

        return sprintf(self::SHARE_URL, http_build_query($options));
    }
196347
public function loadOptions($options)
    {
        if (isset($options['css-files']) && count($options['css-files']) > 0) {
            $this->css = '';
            foreach ($options['css-files'] as $file) {
                $this->css .= file_get_contents($file);
            }
        }
    }
852508
private function _output($options = array())
    {
        if (!isset($options["type"])) $options["type"] = "png";
        if (!isset($options["page"])) $options["page"] = 1;
        $type = strtolower($options["type"]);

        if (isset($this->_imgs[$options["page"] - 1])) {
            $img = $this->_imgs[$options["page"] - 1];
        } else {
            $img = $this->_imgs[0];
        }

        // Perform any antialiasing
        if ($this->_aa_factor != 1) {
            $dst_w = $this->_actual_width / $this->_aa_factor;
            $dst_h = $this->_actual_height / $this->_aa_factor;
            $dst = imagecreatetruecolor($dst_w, $dst_h);
            imagecopyresampled($dst, $img, 0, 0, 0, 0,
                $dst_w, $dst_h,
                $this->_actual_width, $this->_actual_height);
        } else {
            $dst = $img;
        }

        switch ($type) {
            case "jpg":
            case "jpeg":
                if (!isset($options["quality"])) {
                    $options["quality"] = 75;
                }

                imagejpeg($dst, null, $options["quality"]);
                break;
            case "png":
            default:
                imagepng($dst);
                break;
        }

        if ($this->_aa_factor != 1) {
            imagedestroy($dst);
        }
    }
1066567
public function fetch($url, $options = array())
    {
        $this->debug->groupCollapsed(__METHOD__);
        $optionsDefault = $this->getOptionsDefault();
        $options = $this->getOptions($optionsDefault, $options);
        $urlParts = Html::parseUrl($url);
        $useCurl = $urlParts['scheme'] == 'https' || \array_diff_key($options, $optionsDefault);
        $return = $useCurl
            ? $this->fetchCurl($url, $options)
            : $this->fetchFsock($url, $options);
        #$this->debug->log('return',$return);
        $this->debug->groupEnd();
        return $return;
    }
1161756
protected function _stream($url,$options) {
		$eol="\r\n";
		if (isset($options['proxy'])) {
			$options['proxy']=preg_replace('/https?/i','tcp',$options['proxy']);
			$options['request_fulluri']=true;
			if (preg_match('/socks4?/i',$options['proxy']))
				return $this->_socket($url,$options);
		}
		$options['header']=implode($eol,$options['header']);
		$body=@file_get_contents($url,FALSE,
			stream_context_create(['http'=>$options]));
		$headers=isset($http_response_header)?
			$http_response_header:[];
		$err='';
		if (is_string($body)) {
			$match=NULL;
			foreach ($headers as $header)
				if (preg_match('/Content-Encoding: (.+)/i',$header,$match))
					break;
			if ($match)
				switch ($match[1]) {
					case 'gzip':
						$body=gzdecode($body);
						break;
					case 'deflate':
						$body=gzuncompress($body);
						break;
				}
		}
		else {
			$tmp=error_get_last();
			$err=$tmp['message'];
		}
		return [
			'body'=>$body,
			'headers'=>$headers,
			'engine'=>'stream',
			'cached'=>FALSE,
			'error'=>$err
		];
	}
495039
protected function fetchFsock($url, $options = array())
    {
        $this->debug->groupCollapsed(__METHOD__);
        $return = false;
        $urlParts = Html::parseUrl($url);
        // $this->debug->log('urlParts', $urlParts);
        // $this->debug->log('options', $options);
        if (!empty($options['proxy']) && !\in_array($urlParts['host'], array('127.0.0.1','localhost'))) {
            $this->debug->log('proxy', $options['proxy']);
            $request = 'GET '.$url.' HTTP/1.0'."\r\n";
            $proxyParts = \parse_url($options['proxy']);
            $pointer = \fsockopen($proxyParts['host'], $proxyParts['port'], $errno, $errstr, $options['timeout']);
        } else {
            $uri = $urlParts['path'].( !empty($urlParts['query']) ? '?'.$urlParts['query'] : '' );
            $request = 'GET '.$uri.' HTTP/1.0'."\r\n";
            $pointer = \fsockopen($urlParts['host'], $urlParts['port'], $errno, $errstr, $options['timeout']);
        }
        if ($pointer) {
            $host = $urlParts['host'].( $urlParts['port'] != '80' ? ':'.$urlParts['port'] : '' );
            $return = '';
            $request .= ''
                .'Host: '.$host."\r\n"
                .'Referer: '.Html::getSelfUrl(array(), array('fullUrl'=>true,'chars'=>false))."\r\n"
                .( !empty($urlParts['user'])
                    ? 'Authorization: Basic '.\base64_encode($urlParts['user'].':'.$urlParts['pass'])."\r\n"
                    : ''
                )
                ."\r\n";
            $this->debug->log('request', $request);
            \fputs($pointer, $request);
            while (!\feof($pointer)) {
                $return .= \fread($pointer, 4096);
            }
            \fclose($pointer);
            $this->debug->log('return', $return);
            $header_start = 0;
            while (true) {
                $header_end     = \strpos($return, "\r\n\r\n", $header_start);
                $header_length  = $header_end-$header_start;
                $headers        = \substr($return, $header_start, $header_length);
                $header_start   = $header_end+4;
                if (!\preg_match('/^HTTP.+Continue/i', $headers)) {
                    break;
                }
            }
            $this->debug->log('headers', $headers);
            $parsedHeaders = Net::parseHeaders($headers);
            $return = array(
                'headers'   => $parsedHeaders,
                'body'      => \substr($return, $header_end+4),
                'cookies'   => $this->getCookies($parsedHeaders),
            );
            $this->fetchResponse = $return;
            if (isset($return['headers']['Location'])) {
                $this->debug->log('headers', $return['headers']);
                $location = Html::getAbsUrl($urlParts, $return['headers']['Location']);
                $return = $this->fetch($location, $options);
            } elseif ($return['headers']['Return-Code'] != '200') {
                $this->debug->log('return[headers]', $return['headers']);
                if (isset($return['headers']['Proxy-Authenticate'])
                    && ( $return['headers']['Proxy-Authenticate'] == 'NTLM' || \in_array('NTLM', $return['headers']['Proxy-Authenticate']))
                ) {
                    $return = $this->fetchCurl($url, $options);
                    $return['headers']['Current-Location'] = $url;
                } else {
                    $this->debug->log('return was', $return);
                    $return = false;
                }
            }
        } else {
            $this->debug->warn('Error ('.$errno.') : ', $errstr);
        }
        $this->debug->groupEnd();
        return $return;
    }
1339382
public function request($url, array $options = array()) {
    // Initialize a curl
    $curl = curl_init($url);
    // If there's options
    if ($options) {
      // Set options
      curl_setopt_array($curl, $options);
    }
    // Execute
    $response = curl_exec($curl);
    // Get header size
    $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
    // Get body
    $body = substr($response, $headerSize);
    // Get status
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    // Parse header
    $headers = $this->parseHeaders(substr($response, 0, $headerSize));
    // Close curl
    curl_close($curl);
    // Return response
    return new Response($body, $status, $headers);
  }
1022389
public function getThumbImage($alias, $options=[])
    {
        $url = $this->getThumbUrl($alias);

        if (empty($url)) {
            return '';
        }

        if (empty($options['alt'])) {
            $options['alt'] = $this->alt;
        }

        return Html::img($url, $options);
    }
261506
public function generateUrl($url, $token, $options, $availableOptions)
    {

        // Append client id
        $url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?').'client_id='.$this->getClientId();

        // Append token if provided
        if ($token) {
            $url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?').'oauth_token='.$this->getToken($token);
        }

        // Add options to the URL
        foreach ($options as $key => $value) {
            $url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?').$key.'='.$value;
        }

        return $url;
    }
299230
public static function image($url, $name = null, $options = [])
    {
        $options['src'] = $url;

        self::exclure($options);

        return self::input('image', $name, null, $options);
    }
177178
public static function post(string $url, array $options = []) : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => null
		];
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query2($options['params']));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$result['data'] = curl_exec($ch);
		if (!empty($options['json'])) {
			$result['data'] = json_decode($result['data'], true);
		}
		curl_close($ch);
		$result['success'] = true;
		return $result;
	}
446928
public function link($title, array $url, array $options = []) {
		if (!$this->hasAccess($url)) {
			return $this->_default($title, $options);
		}
		unset($options['default']);

		return $this->Html->link($title, $url, $options);
	}
384239
function output($options = null) {
		//Helpers::dompdf_debug("trace", "($options[compress])");

		// Add page text
		$this->_add_page_text();
		$this->_add_internal_links();

		$this->_place_objects();

		if ( isset($options["compress"]) && $options["compress"] == 0 ) {
			$compress = false;
		}
		else {
			$compress = true;
		}

		$this->_pdf->SetCompression($compress);

		return $this->_pdf->Output('', 'S');
	}