PluginProbe
Happyforms – Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms / trunk
Happyforms – Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms vtrunk
1.26.15 trunk 1.0 1.10.0 1.11.0 1.11.1 1.12.0 1.12.1 1.12.10 1.12.11 1.12.12 1.12.2 1.12.3 1.12.4 1.12.5 1.12.6 1.12.7 1.12.8 1.12.9 1.13.0 1.13.1 1.13.10 1.13.11 1.13.12 1.13.2 All 194 releases
happyforms / core / classes / class-cache.php

class-cache.php in Happyforms – Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms trunk, at core/classes/class-cache.php

59 lines 922 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class HappyForms_Cache {
4
5 private static $instance;
6
7 private $cache = array();
8
9 public static function instance() {
10 if ( is_null( self::$instance ) ) {
11 self::$instance = new self();
12 }
13
14 return self::$instance;
15 }
16
17 public function exists( $key ) {
18 $exists = isset( $this->cache[$key] );
19
20 return $exists;
21 }
22
23 public function get( $key, &$found = null ) {
24 $found = false;
25
26 if ( $this->exists( $key ) ) {
27 $found = true;
28
29 if ( is_object( $this->cache[$key] ) ) {
30 return clone( $this->cache[$key] );
31 } else {
32 return $this->cache[$key];
33 }
34 }
35
36 return false;
37 }
38
39 public function set( $key, $value ) {
40 if ( is_object( $value ) ) {
41 $value = clone( $value );
42 }
43
44 $this->cache[$key] = $value;
45
46 return true;
47 }
48
49 }
50
51 if ( ! function_exists( 'happyforms_get_cache' ) ):
52
53 function happyforms_get_cache() {
54 return HappyForms_Cache::instance();
55 }
56
57 endif;
58
59 happyforms_get_cache();