PluginProbe
Media Cloud Sync / 1.1.1
Media Cloud Sync v1.1.1
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 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 All 34 releases
media-cloud-sync / includes / base / counter.php

counter.php in Media Cloud Sync 1.1.1, at includes/base/counter.php

73 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Dudlewebs\WPMCS;
3
4 defined('ABSPATH') || exit;
5
6 class Counter {
7 private static $instance = null;
8 private $assets_url;
9 private $version;
10 private $token;
11
12 /**
13 * Admin constructor.
14 * @since 1.0.0
15 */
16 public function __construct() {
17 $this->assets_url = WPMCS_ASSETS_URL;
18 $this->version = WPMCS_VERSION;
19 $this->token = WPMCS_TOKEN;
20
21 // Initialize setup
22 // $this->init();
23 }
24 /**
25 *
26 * Add Count
27 * @since 1.0.0
28 *
29 */
30 public static function add( $property = 'uploaded' ){
31 $settings_key = Schema::getConstant('COUNTER_KEY');
32 $current = Utils::get_option( $property, 0, Schema::getConstant('COUNTER_KEY') );
33 $current++;
34 return Utils::update_option( $property, $current, Schema::getConstant('COUNTER_KEY') );
35 }
36
37 /**
38 *
39 * Add Count
40 * @since 1.0.0
41 *
42 */
43 public static function remove( $property = 'uploaded' ){
44 $settings_key = Schema::getConstant('COUNTER_KEY');
45 $current = Utils::get_option( $property, 0, Schema::getConstant('COUNTER_KEY') );
46 $current--;
47 return Utils::update_option( $property, $current, Schema::getConstant('COUNTER_KEY') );
48 }
49
50 /**
51 * Get Count
52 * @since 1.0.0
53 */
54 public static function get( $property = 'uploaded' ) {
55 return Utils::get_option( $property, 0, Schema::getConstant('COUNTER_KEY') );
56 }
57
58 /**
59 * Update Count
60 * @since 1.0.0
61 */
62 public static function update( $property, $value ) {
63 return Utils::update_option( $property, $value, Schema::getConstant('COUNTER_KEY') );
64 }
65
66
67 public static function instance(){
68 if (is_null(self::$instance)) {
69 self::$instance = new self();
70 }
71 return self::$instance;
72 }
73 }