summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-02-15 20:37:31 +0100
committerFlorian Pritz <bluewind@xinu.at>2014-02-15 20:37:31 +0100
commitaea9987a38715da82291f87129b1a3047e5c9849 (patch)
tree97ea2f1c162798506c20eabe94800e27bc41a3fb
parent42533f5298c65bb18a93e887df3537bdf4dcd2cb (diff)
Work around PHP 5.3 limitation
$this in anonymous functions is only supported in PHP >= 5.4 Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/file.php8
1 files changed, 5 insertions, 3 deletions
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");