summaryrefslogtreecommitdiffstats
path: root/application/models/mfile.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-22 15:42:07 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-22 22:36:55 +0200
commitde02b8cb514a95c100d0ec11ab469acfc687ca00 (patch)
tree9c09a70f4ac2b582ae80dd6e065f700ef460ed11 /application/models/mfile.php
parent36f0185d8c950933099268c69081cabc084545c9 (diff)
switch design to bootstrap; minor fixes along the way
Initial-work-by: Oliver Mader <b52@reaktor42.de> Additional-work-by: Markus Cisler <mrkscslr@gmail.com> Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models/mfile.php')
-rw-r--r--application/models/mfile.php21
1 files changed, 21 insertions, 0 deletions
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;