summaryrefslogtreecommitdiff
path: root/classes/diskcache.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-15 16:11:30 +0300
committerAndrew Dolgov <[email protected]>2021-02-15 16:11:30 +0300
commit166f2d46666bb872a1f30a5ab23b113f2f481640 (patch)
treeaba3be014a77a930e067864ce36b72e962100e3a /classes/diskcache.php
parent8e79f1717d5270558ffd30c20cc75840b0ecc955 (diff)
diskcache: unify naming
Diffstat (limited to 'classes/diskcache.php')
-rw-r--r--classes/diskcache.php44
1 files changed, 22 insertions, 22 deletions
diff --git a/classes/diskcache.php b/classes/diskcache.php
index 3fd099d3c..bad2ee0da 100644
--- a/classes/diskcache.php
+++ b/classes/diskcache.php
@@ -194,20 +194,20 @@ class DiskCache {
$this->dir = CACHE_DIR . "/" . basename(clean($dir));
}
- public function getDir() {
+ public function get_dir() {
return $this->dir;
}
- public function makeDir() {
+ public function make_dir() {
if (!is_dir($this->dir)) {
return mkdir($this->dir);
}
}
- public function isWritable($filename = "") {
+ public function is_writable($filename = "") {
if ($filename) {
- if (file_exists($this->getFullPath($filename)))
- return is_writable($this->getFullPath($filename));
+ if (file_exists($this->get_full_path($filename)))
+ return is_writable($this->get_full_path($filename));
else
return is_writable($this->dir);
} else {
@@ -216,44 +216,44 @@ class DiskCache {
}
public function exists($filename) {
- return file_exists($this->getFullPath($filename));
+ return file_exists($this->get_full_path($filename));
}
- public function getSize($filename) {
+ public function get_size($filename) {
if ($this->exists($filename))
- return filesize($this->getFullPath($filename));
+ return filesize($this->get_full_path($filename));
else
return -1;
}
- public function getFullPath($filename) {
+ public function get_full_path($filename) {
return $this->dir . "/" . basename(clean($filename));
}
public function put($filename, $data) {
- return file_put_contents($this->getFullPath($filename), $data);
+ return file_put_contents($this->get_full_path($filename), $data);
}
public function touch($filename) {
- return touch($this->getFullPath($filename));
+ return touch($this->get_full_path($filename));
}
public function get($filename) {
if ($this->exists($filename))
- return file_get_contents($this->getFullPath($filename));
+ return file_get_contents($this->get_full_path($filename));
else
return null;
}
- public function getMimeType($filename) {
+ public function get_mime_type($filename) {
if ($this->exists($filename))
- return mime_content_type($this->getFullPath($filename));
+ return mime_content_type($this->get_full_path($filename));
else
return null;
}
- public function getFakeExtension($filename) {
- $mimetype = $this->getMimeType($filename);
+ public function get_fake_extension($filename) {
+ $mimetype = $this->get_mime_type($filename);
if ($mimetype)
return isset($this->mimeMap[$mimetype]) ? $this->mimeMap[$mimetype] : "";
@@ -262,17 +262,17 @@ class DiskCache {
}
public function send($filename) {
- $fake_extension = $this->getFakeExtension($filename);
+ $fake_extension = $this->get_fake_extension($filename);
if ($fake_extension)
$fake_extension = ".$fake_extension";
header("Content-Disposition: inline; filename=\"${filename}${fake_extension}\"");
- return $this->send_local_file($this->getFullPath($filename));
+ return $this->send_local_file($this->get_full_path($filename));
}
- public function getUrl($filename) {
+ public function get_url($filename) {
return get_self_url_prefix() . "/public.php?op=cached_url&file=" . basename($this->dir) . "/" . basename($filename);
}
@@ -280,7 +280,7 @@ class DiskCache {
// this is called separately after sanitize() and plugin render article hooks to allow
// plugins work on original source URLs used before caching
// NOTE: URLs should be already absolutized because this is called after sanitize()
- static public function rewriteUrls($str)
+ static public function rewrite_urls($str)
{
$res = trim($str);
if (!$res) return '';
@@ -301,7 +301,7 @@ class DiskCache {
$cached_filename = sha1($url);
if ($cache->exists($cached_filename)) {
- $url = $cache->getUrl($cached_filename);
+ $url = $cache->get_url($cached_filename);
$entry->setAttribute($attr, $url);
$entry->removeAttribute("srcset");
@@ -318,7 +318,7 @@ class DiskCache {
$cached_filename = sha1($matches[$i]["url"]);
if ($cache->exists($cached_filename)) {
- $matches[$i]["url"] = $cache->getUrl($cached_filename);
+ $matches[$i]["url"] = $cache->get_url($cached_filename);
$need_saving = true;
}