Compress page

@param  $page_content
@return string
769778
protected function compressPage($page_content)
    {
        $page_compress_config = Lb::app()->getPageCompressConfig();
        $routeInfo = $this->route_info;
        if (isset($page_compress_config['controllers'][$routeInfo['controller']][$routeInfo['action']]) 
            && $page_compress_config['controllers'][$routeInfo['controller']][$routeInfo['action']]
        ) {
            return HtmlHelper::compress($page_content);
        }
        return $page_content;
    }
1076480
public function setPageContent()
	{
		$content = "---\n";
		$content .= "type: ". $this->properties['type'] . "\n";
		$content .= "layout: " . $this->properties['layout'] . "\n";
		$content .= "title: " . $this->properties['title'] . "\n";
		$content .= "---\n";
		$content .= $this->properties['body'];

		return $content;
	}
772198
public function getPrefix(Page $page)
    {
        $parent = $page->getParent();

        if ($parent === null) {
            return '';
        }

        return ($parent->getChildPageUrlPrefix()) ?: $page->getParent()->url()->getLocation();
    }
946645
public function decompress($content)
    {
        $compressed = snappy_uncompress($content);

        if ($compressed === false) {
            throw new Exception\RuntimeException('Error while decompressing.');
        }

        return $compressed;
    }
477829
function compress($from_path,$to_path){
        $from_path=realpath($from_path);
        $to_path=realpath($to_path);
        if(!is_dir($to_path)){
            mkdir($to_path,0777,true);
        }
        if(is_dir($from_path)&&is_dir($to_path)&&is_writable($to_path)){
            return $this->recursion_compress($from_path,$to_path);
        }else{
            return false;
        }
    }
997382
protected function doCompile($_content)
    {
        /* here is where the compiling takes place. Smarty
          tags in the templates are replaces with PHP code,
          then written to compiled files. */
        // init the lexer/parser to compile the template
        $this->lex = new $this->lexer_class($_content, $this);
        $this->parser = new $this->parser_class($this->lex, $this);
        if ($this->inheritance_child) {
            // start state on child templates
            $this->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
        }
        if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
            $mbEncoding = mb_internal_encoding();
            mb_internal_encoding('ASCII');
        } else {
            $mbEncoding = null;
        }

        if ($this->smarty->_parserdebug) {
            $this->parser->PrintTrace();
            $this->lex->PrintTrace();
        }
        // get tokens from lexer and parse them
        while ($this->lex->yylex() && !$this->abort_and_recompile) {
            if ($this->smarty->_parserdebug) {
                echo "<pre>Line {$this->lex->line} Parsing  {$this->parser->yyTokenName[$this->lex->token]} Token " .
                    htmlentities($this->lex->value) . "</pre>";
            }
            $this->parser->doParse($this->lex->token, $this->lex->value);
        }

        if ($this->abort_and_recompile) {
            // exit here on abort
            return false;
        }
        // finish parsing process
        $this->parser->doParse(0, 0);
        if ($mbEncoding) {
            mb_internal_encoding($mbEncoding);
        }
        // check for unclosed tags
        if (count($this->_tag_stack) > 0) {
            // get stacked info
            list($openTag, $_data) = array_pop($this->_tag_stack);
            $this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag . "{$this->smarty->right_delimiter} tag");
        }
        // return compiled code
        // return str_replace(array("? >\n<?php","? ><?php"), array('',''), $this->parser->retvalue);
        return $this->parser->retvalue;
    }
132681
public function getLastVersion($page_id)
	{
		$qb = $this->createQueryBuilder('p');
		
		$qb->where('p.original=:page_id')
			->orderBy('p.createdAt', 'DESC')
			->setParameter(':page_id', $page_id);
		
		$result = $qb->getQuery()->setMaxResults(1)->getResult();

		if ( is_null($result) ) {
			$qb2 = $this->createQueryBuilder('p');
			$qb2->where('p.id=:page_id')->setParameter(':page_id', $page_id);
			
			$result = $qb->getQuery()->getResult();
		}
		
		return $result[0];
	}
842370
public function layout_Content()
    {
        $page = str_replace('/', '_', $this->page);

        if (method_exists($this, $pagefunc = 'page_'.$page)) {
            $p = $this->add('Page', $this->page, 'Content');
            $this->$pagefunc($p);
        } else {
            $this->app->locate('page', str_replace('_', '/', $this->page).'.php');
            $this->add('page_'.$page, $page, 'Content');
            //throw new BaseException("No such page: ".$this->page);
        }
    }
609817
function (pageConfig, contentId) {
            var outputContent = [];
            var content = pageConfig.contents.placeholderContents
                    ? pageConfig.contents.placeholderContents[contentId]
                    : null;
            if (!content) {
                return outputContent;
            }
            if (!ariaUtilsType.isArray(content)) {
                content = [content];
            }
            for (var i = 0, length = content.length; i < length; i++) {
                outputContent = outputContent.concat(this.processContent(content[i]));
            }
            return outputContent;
        }
313002
function encodePage(output, page) {
    var book = output.getBook();
    var summary = book.getSummary();
    var fs = book.getContentFS();
    var file = page.getFile();

    // JS Page is based on the JSON output
    var result = JSONUtils.encodePage(page, summary);

    result.type = file.getType();
    result.path = file.getPath();
    result.rawPath = fs.resolve(result.path);

    deprecate.field(output, 'page.progress', result, 'progress', function() {
        return encodeProgress(output, page);
    }, '"page.progress" property is deprecated');

    deprecate.field(output, 'page.sections', result, 'sections', [
        {
            content: result.content,
            type: 'normal'
        }
    ], '"sections" property is deprecated, use page.content instead');

    return result;
}
692401
public function compress($content)
    {
        // Increment recursion level only before doing a compression
        ini_set('pcre.recursion_limit', '16777');

        $content = $this->removeSpaces($content);
        $content = $this->removeComments($content);

        return $content;
    }
384667
public String getPageContent()
    {
        if(pageConent != null){return pageConent;}
        pageConent = gpUtil.getPageContent(page);
        return pageConent;
    }
1015940
private function preparePayload($payload, CompressionInterface $compression_method = null)
    {
        $prepared = is_string($payload) ? $payload : json_encode($payload);

        Assertion::notNull($prepared, 'The payload is empty or cannot encoded into JSON.');

        if (null === $compression_method) {
            return $prepared;
        }
        $compressed_payload = $compression_method->compress($prepared);
        Assertion::string($compressed_payload, 'Compression failed.');

        return $compressed_payload;
    }
651932
public function compress($content)
    {
        $compressed = snappy_compress($content);

        if ($compressed === false) {
            throw new Exception\RuntimeException('Error while compressing.');
        }

        return $compressed;
    }
194521
public function write($file_name, $content = '')
    {
        if (!is_file($file_name)) {
            return false;
        }

        return file_put_contents($file_name, $content, LOCK_EX);
    }
1316503
public function blocksAction($page_id)
    {
        $em = $this->getDoctrine()->getManager();
        $availableLangs = $this->container->getParameter('flowcode_page.available_languages');
        $entities = array();
        $types = array("type_html", "type_text");
        foreach ($availableLangs as $key => $value) {
            $entities[] = array(
                'lang' => $key,
                'blocks' => $em->getRepository('AmulenPageBundle:Block')->findBlockByPageAndLangAndInType($page_id, $value, $types)
            );
        }
        $page = $em->getRepository('AmulenPageBundle:Page')->find($page_id);

        return array(
            'page' => $page,
            'entities' => $entities,
        );
    }
1348846
public function update(Page $page, PageContent $content)
    {
        if (is_null(request()->file('media'))) {
            $attributes = request()->validate(array_except(PageContent::$rules, 'media'),
                PageContent::$messages);
        }
        else {
            $attributes = request()->validate(PageContent::$rules, PageContent::$messages);

            $media = $this->moveAndCreatePhoto($attributes['media']);
            if ($media) {
                $attributes['media'] = $media;
            }
        }

        unset($attributes['page_id']);
        $item = $this->updateEntry($content, $attributes);

        return redirect_to_resource();
    }