# media-cloud-sync/1.2.2/includes/base/counter.php

Media Cloud Sync, version 1.2.2. 73 lines.

- Page: https://pluginprobe.com/plugins/media-cloud-sync/1.2.2/code/includes/base/counter.php
- Raw: https://pluginprobe.com/plugins/media-cloud-sync/1.2.2/raw/includes/base/counter.php
- Modified: 2024-10-27T10:40:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/media-cloud-sync/1.2.2/code/includes/base/counter.php#L10-L20`.

```php
<?php
namespace Dudlewebs\WPMCS;

defined('ABSPATH') || exit;

class Counter {
    private static $instance = null;
    private $assets_url;
    private $version;
    private $token;

    /**
     * Admin constructor.
     * @since 1.0.0
     */
    public function __construct() {
        $this->assets_url   = WPMCS_ASSETS_URL;
        $this->version      = WPMCS_VERSION;
        $this->token        = WPMCS_TOKEN;

        // Initialize setup
        // $this->init();
    }
    /**
     * 
     * Add Count
     * @since 1.0.0
     *
     */
    public static function add(  $property = 'uploaded' ){
        $settings_key = Schema::getConstant('COUNTER_KEY');
        $current      = Utils::get_option( $property, 0, Schema::getConstant('COUNTER_KEY') );
        $current++;
        return Utils::update_option( $property, $current, Schema::getConstant('COUNTER_KEY') );
    }

    /**
     * 
     * Add Count
     * @since 1.0.0
     *
     */
    public static function remove(  $property = 'uploaded' ){
        $settings_key = Schema::getConstant('COUNTER_KEY');
        $current      = Utils::get_option( $property, 0, Schema::getConstant('COUNTER_KEY') );
        $current--;
        return Utils::update_option( $property, $current, Schema::getConstant('COUNTER_KEY') );
    }

    /**
     * Get Count
     * @since 1.0.0
     */
    public static function get( $property = 'uploaded' ) {
        return Utils::get_option( $property, 0, Schema::getConstant('COUNTER_KEY') );
    }

    /**
     * Update Count
     * @since 1.0.0
     */
    public static function update( $property, $value ) {
        return Utils::update_option( $property, $value, Schema::getConstant('COUNTER_KEY') );
    }

    
    public static function instance(){
        if (is_null(self::$instance)) {
            self::$instance = new self();
        }
        return self::$instance;
    }
}
```
