PluginProbe ʕ •ᴥ•ʔ
AI Copilot – Content Generator / 1.2.0
AI Copilot – Content Generator v1.2.0
1.5.4 1.4.21 1.4.18 1.4.19 1.4.20 trunk 1.0.4 1.1.0 1.2.0 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.17 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.9
ai-copilot-content-generator / classes / cache.php
ai-copilot-content-generator / classes Last commit date
tables 1 year ago assets.php 1 year ago baseObject.php 1 year ago cache.php 1 year ago controller.php 1 year ago date.php 1 year ago db.php 1 year ago dispatcher.php 1 year ago errors.php 1 year ago field.php 1 year ago fieldAdapter.php 1 year ago frame.php 1 year ago helper.php 1 year ago html.php 1 year ago installer.php 1 year ago installerDbUpdater.php 1 year ago modInstaller.php 1 year ago model.php 1 year ago module.php 1 year ago req.php 1 year ago response.php 1 year ago table.php 1 year ago uri.php 1 year ago user.php 1 year ago utils.php 1 year ago validator.php 1 year ago view.php 1 year ago
cache.php
57 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 class WaicCache {
6 private $directories = array();
7
8 public function init() {
9 $this->initFilesystem();
10 }
11 public static function getInstance() {
12 static $instance;
13 if (!$instance) {
14 $instance = new WaicCache();
15 }
16 return $instance;
17 }
18 public static function _() {
19 return self::getInstance();
20 }
21 public function getDirectory( $key ) {
22 return isset($this->directories[$key]) ? $this->directories[$key] : false;
23 }
24 protected function initFilesystem() {
25 $directories = array();
26
27 foreach ($directories as $key => $dir) {
28 $fullPath = $this->makeDirectory($dir);
29 if (false !== $fullPath) {
30 $this->directories[$key] = $fullPath;
31 }
32 }
33 }
34 protected function makeDirectory( $directory ) {
35 $uploads = wp_upload_dir();
36
37 $basedir = $uploads['basedir'];
38 $dir = $basedir . $directory;
39 if (!is_dir($dir)) {
40 if (false === @mkdir($dir, 0775, true)) {
41 return false;
42 }
43 } else {
44 if (!is_writable($dir)) {
45 return false;
46 }
47 }
48 return $dir;
49 }
50 public function cleanCache( $dir, $file ) {
51 $cachePath = $this->getDirectory($dir) . WAIC_DS . $file;
52 if (file_exists($cachePath)) {
53 unlink($cachePath);
54 }
55 }
56 }
57