替换里面的块占位符

@param $content
@return mixed
334010
protected function _replace($content)
    {
        $content = trim($content, "\r\n ");
        if (!$this->blocks) {
            return $content;
        }

        return strtr($content, $this->blocks);
    }
1119745
private function getFirstLine($content)
    {
        $lines = preg_split('/\r\n|\n/', $content);

        foreach ($lines as $line) {
            if (trim($line)) {
                return $line;
            }
        }

        return '';
    }
626193
public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt) {
                $content .= $ctt;
            }
            $content = $ctt;
        }
        $_escaped_output = strip_tags((string) $content);
        if ($_escaped_output != (string) $content) {
            if (preg_match('/(.*)<body(.*)</body>/i', (string) $content, $matches)) {
                $_output = $matches[0];
            } else {
                $_output = (string) $content;
            }
            $content = Html2Text::convert($_output);
        }
        return (string) $content;
    }
1316009
public function parse($content)
    {
        $content = $this->normalize($content);

        list($method, $path, $scheme) = $this->getStatus($content);

        // resolve uri path
        if ($this->baseUrl !== null) {
            $path = UriResolver::resolve($this->baseUrl, new Uri($path));
        } else {
            $path = new Uri($path);
        }

        $request = new Request($path, $method);
        $request->setProtocolVersion($scheme);

        list($header, $body) = $this->splitMessage($content);

        $this->headerToArray($request, $header);

        $request->setBody(new StringStream($body));

        return $request;
    }
598406
public function render($content)
    {
        $element = $this->getElement();
        $view    = $element->getView();
        if (null === $view) {
            return $content;
        }

        $tooltip = $element->getAttrib('tooltip');
        $tooltip = trim($tooltip);
        //$element->removeAttrib('tooltip');

        if (empty($tooltip)) {
            return $content;
        }

        $view->headScript()->appendFile(\Zend_Controller_Front::getInstance()->getBaseUrl()  .  '/gems/js/jquery.cluetip.js');
        $view->headLink()->appendStylesheet(\Zend_Controller_Front::getInstance()->getBaseUrl()  . '/gems/js/jquery.cluetip.css');
        $script = "$('" . $this->getTag() . ".tooltip').cluetip({
            activation: 'click',
            sticky: 'true',
            closeText: '[X]',
            closePosition:    'title',
            width: 450,
            titleAttribute: 'tip',
            splitTitle: '|'})
                   $('#tabContainer').bind( 'tabsselect', function(event, ui) {
  $(document).trigger('hideCluetip');
});";

        $view->jQuery()->addOnLoad($script);

        $separator = $this->getSeparator();
        $placement = $this->getPlacement();
        $class     = $this->getClass();
        $tag       = $this->getTag();
        $escape    = $this->getEscape();

        $options   = $this->getOptions();

        if ($escape) {
            $tooltip = $view->escape($tooltip);
        }

        $options['tag'] = $tag;
        $options['tip'] = str_replace('"', '\"', $tooltip);
        $decorator = new \Zend_Form_Decorator_HtmlTag($options);
        $tooltip = $decorator->render($this->getImg()) . $decorator->setOptions(array('class'=>'thetooltip', 'id'=>'tooltip-' . $this->getElement()->getAttrib('id')))->render($tooltip);

        switch ($placement) {
            case self::PREPEND:
                return $tooltip . $separator . $content;
            case self::APPEND:
            default:
                return $content . $separator . $tooltip;
        }

        /* Misschien later toch toevoegen */
        $helper = $this->getHelper();

        return $view->$helper($id, $content, $attribs);
    }
674529
public static function fromString(string $content)
    {
        $arr = \json_decode($content, JSON_PRETTY_PRINT);
        $arr = attrToArray($arr);
        return fromArray($arr);
    }
889847
private function _html($content) {
        // compress?
        if($this->_config['compress']['html'])
            $content = Algorithms::html($content, $this->_config['config']['html']);

        // return content
        return $content;
    }
1227489
public function getResponse($content = '')
    {
        //transform content by content type
        if ($this->isJsonRequest()) {
            if ($content instanceof Response\JsonResponse) {
                $content = json_decode($content->getBody());
            } elseif (!is_array($content)) {
                $content = [$content];
            }
        } else {
            if (is_array($content)) {
                $content = implode('', $content);
            } elseif ($content instanceof ResponseInterface) {
                $content = $content->getBody()->__toString();
            }
        }

        if (!$this->getContainer()->has(ResponseInterface::class)) {
            if ($this->isCli()) {
                $class = Response\TextResponse::class;
            } elseif ($this->isJsonRequest()) {
                $class = Response\JsonResponse::class;
            } else {
                $class = Response\HtmlResponse::class;
            }
            $this->getContainer()->add(ResponseInterface::class, $class);
        }

        /** @var ResponseInterface $response */
        $response = $this->validateContract($this->getContainer()->get(ResponseInterface::class, [$content]),
            ResponseInterface::class);

        //inject request content type
        $request = $this->getRequest();

        $contentTypeKey = 'content-type';
        foreach ($request->getHeader($contentTypeKey) as $contentType) {
            $response = $response->withHeader($contentTypeKey, $contentType);
        }

        return $response;
    }
1084928
public function getSig($content) {
        if(!$this->privateKey || !$content) {
            return false;
        }
        $privateKey = openssl_pkey_get_private($this->privateKey, '');
        $encryptedData = '';
        // 私钥加密
        openssl_sign($content, $encryptedData, $privateKey, OPENSSL_ALGO_SHA1);
        return base64_encode($encryptedData);
    }
836420
public static function getEmailTemplate($content) 
	{
		$email_template = 'email_template';
		$template_file = YiiBase::getPathOfAlias('webroot').'/'.$email_template.'.php';
		$email_ireplace = str_ireplace('{content}', $content, file_get_contents($template_file));

		return $email_ireplace;
	}
1070833
protected function _getContent($content)
    {
        if(!isset($content))
            return;

        if(is_array($content))
            return array_map(
                function ($value) {
                    return $this->_getContent($value);
                }, $content
            );

        switch(gettype($content)) {
            case 'string': case 'integer': case 'double': case 'float':
                return $content;
            break;
            case 'object':
                if('Closure' == get_class($content)) {
                    ob_start();
                    ob_clean();
                    $returned = $content($this->data);
                    $output = ob_get_clean();
                    if(isset($returned))
                        return $returned;
                    else
                        return $output;
                } elseif(isset($content->content))
                    return $content->content;
            break;
            default:
                throw new \InvalidArgumentException('wrong view content type : '.gettype($content));
        }
    }
4853
public function purify($content)
	{
		if(is_array($content))
			$content=array_map(array($this,'purify'),$content);
		else
			$content=$this->getPurifier()->purify($content);
		return $content;
	}
1262175
public function parse(&$content)
	{
	    $str = $this->getEngineInstance()->parse($content);
	    return $this->getBeginContent() . $str;
	}
1112898
protected function re($content)
    {
        preg_match_all('/more_list">(.*?)<\/ul>/s', $content, $match_ul);
        preg_match_all('/href="(.*?)" .*?">(.*?)</s', $match_ul[1][0], $match_li);
        preg_match_all('/\[(.*?)\]/', $match_ul[1][0], $match_time);

        $list = [];
        foreach ($match_li[0] as $key => $value) {
            $list[$key]['title'] = trim(mb_convert_encoding($match_li[2][$key], 'UTF-8', 'GB2312'));
            $list[$key]['url'] = trim(Config::$config['url_index'] . $match_li[1][$key]);
            $list[$key]['time'] = trim(mb_convert_encoding($match_time[1][$key], 'UTF-8', 'GB2312'));
        }
        return $list;
    }
1052761
protected function _get_permalink( $content ) {
		preg_match( '/<meta +?property=["\']og:url["\'][^\/>]*? content=["\']([^"\']+?)["\'].*?\/?>/si', $content, $reg );
		if ( ! empty( $reg[1] ) ) {
			return $reg[1];
		}

		return $this->url;
	}
1274326
protected function bbCodesHandle($content) {
		return preg_replace_callback('~\[([a-z]+)\](.*?)\[/\1\]~', function($match) use($bbCodes) {
			array_shift($match);
			list($tag, $value) = $match;
			
			if (preg_match('~\[[a-z]+\]~', $value)) {
				$value = $this->bbCodesHandle($value);
			}
			
			if ($tag === 'keyword') {
				return $this->color($value, 'cyan');
			}
			
			if ($tag === 'alert') {
				return $this->color($value, 'red');
			}
			
			if ($tag === 'success') {
				return $this->color($value, 'green');
			}
			
			if ($tag === 'warning') {
				return $this->color($value, 'yellow');
			}
			
			if ($tag === 'info') {
				return $this->color($value, 'blue');
			}
			
			return $value;
		}, $content);
	}
1341343
private function getStart($content)
    {
        $str = '';
        if (preg_match('/function\s*\(.*\)\s*{(.+)/', $content, $r)) {
            $r = preg_replace('/(\/\/|#).*/', '', $r[1]); //去掉可能注释
            $str .= trim($r);
        }
        return $str;
    }