From aea9987a38715da82291f87129b1a3047e5c9849 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 15 Feb 2014 20:37:31 +0100 Subject: Work around PHP 5.3 limitation $this in anonymous functions is only supported in PHP >= 5.4 Signed-off-by: Florian Pritz --- application/controllers/file.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'application/controllers/file.php') diff --git a/application/controllers/file.php b/application/controllers/file.php index 14736431b..cb925f461 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -140,6 +140,7 @@ class File extends MY_Controller { // highlight the file and cache the result $highlit = cache_function($filedata['hash'].'_'.$lexer, 100, function() use ($file, $lexer){ + $CI =& get_instance(); $ret = array(); if ($lexer == "rmd") { ob_start(); @@ -152,11 +153,11 @@ class File extends MY_Controller { $ret["output"] = ob_get_clean(); } else { - $ret = $this->_colorify($file, $lexer); + $ret = $CI->_colorify($file, $lexer); } if ($ret["return_value"] != 0) { - $tmp = $this->_colorify($file, "text"); + $tmp = $CI->_colorify($file, "text"); $ret["output"] = $tmp["output"]; } return $ret; @@ -388,7 +389,8 @@ class File extends MY_Controller { $cache_key = $filedata['hash'].'_thumb_'.$thumb_size; $thumb = cache_function($cache_key, 100, function() use ($id, $thumb_size){ - $thumb = $this->mfile->makeThumb($id, $thumb_size, IMAGETYPE_JPEG); + $CI =& get_instance(); + $thumb = $CI->mfile->makeThumb($id, $thumb_size, IMAGETYPE_JPEG); if ($thumb === false) { show_error("Failed to generate thumbnail"); -- cgit v1.2.3-24-g4f1b