From de02b8cb514a95c100d0ec11ab469acfc687ca00 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 22 Oct 2012 15:42:07 +0200 Subject: switch design to bootstrap; minor fixes along the way Initial-work-by: Oliver Mader Additional-work-by: Markus Cisler Signed-off-by: Florian Pritz --- application/models/mfile.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'application/models/mfile.php') diff --git a/application/models/mfile.php b/application/models/mfile.php index e298850a5..10daba3af 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -199,6 +199,27 @@ class Mfile extends CI_Model { return true; } + public function get_lexers() { + $this->load->library("MemcacheLibrary"); + if (! $lexers = $this->memcachelibrary->get('lexers')) { + $lexers = array(); + $last_desc = ""; + exec("python ".escapeshellarg(FCPATH."scripts/get_lexer_list.py"), $output); + + foreach ($output as $line) { + list($name, $desc) = explode("|", $line); + if ($desc == $last_desc) { + continue; + } + $last_desc = $desc; + $lexers[$name] = $desc; + } + $this->memcachelibrary->set('lexers', $lexers, 1800); + } + + return $lexers; + } + function should_highlight($type) { if ($this->mime2lexer($type)) return true; -- cgit v1.2.3-24-g4f1b