PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/mytube.pm/wp-content/plugins/comet-cache/src/includes/traits/Plugin/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/mytube.pm/wp-content/plugins/comet-cache/src/includes/traits/Plugin/UserUtils.php

<?php
namespace WebSharks\CometCache\Traits\Plugin;

use WebSharks\CometCache\Classes;

trait UserUtils
{
    /**
     * Current user can clear the cache?
     *
     * @since 151002 Enhancing user permissions.
     *
     * @return bool Current user can clear the cache?
     */
    public function currentUserCanClearCache()
    {
        if (!is_null($can = &$this->cacheKey('currentUserCanClearCache'))) {
            return $can; // Already cached this.
        }
        $is_multisite = is_multisite();

        if (!$is_multisite && current_user_can($this->cap)) {
            return $can = true; // Plugin admin.
        }
        if ($is_multisite && current_user_can($this->network_cap)) {
            return $can = true; // Plugin admin.
        }
        
        return $can = false;
    }

    /**
     * Alias for currentUserCanClearCache().
     *
     * @since 151002 Enhancing user permissions.
     *
     * @return bool Current user can clear the cache?
     */
    public function currentUserCanWipeCache()
    {
        return call_user_func_array([$this, 'currentUserCanClearCache'], func_get_args());
    }

    /**
     * Current user can clear the opcache?
     *
     * @since 151114 Enhancing user permissions.
     *
     * @return bool Current user can clear the opcache?
     */
    public function currentUserCanClearOpCache()
    {
        if (!is_null($can = &$this->cacheKey('currentUserCanClearOpCache'))) {
            return $can; // Already cached this.
        }
        $is_multisite = is_multisite();

        if (!$is_multisite && current_user_can($this->cap)) {
            return $can = true; // Plugin admin.
        }
        if ($is_multisite && current_user_can($this->network_cap)) {
            return $can = true; // Plugin admin.
        }
        return $can = false;
    }

    /**
     * Alias for currentUserCanClearOpCache().
     *
     * @since 151114 Enhancing user permissions.
     *
     * @return bool Current user can clear the opcache?
     */
    public function currentUserCanWipeOpCache()
    {
        return call_user_func_array([$this, 'currentUserCanClearOpCache'], func_get_args());
    }

    /**
     * Current user can clear the CDN cache?
     *
     * @since 151114 Enhancing user permissions.
     *
     * @return bool Current user can clear the CDN cache?
     */
    public function currentUserCanClearCdnCache()
    {
        if (!is_null($can = &$this->cacheKey('currentUserCanClearCdnCache'))) {
            return $can; // Already cached this.
        }
        $is_multisite = is_multisite();

        if (!$is_multisite && current_user_can($this->cap)) {
            return $can = true; // Plugin admin.
        }
        if ($is_multisite && current_user_can($this->network_cap)) {
            return $can = true; // Plugin admin.
        }
        return $can = false;
    }

    /**
     * Alias for currentUserCanClearCdnCache().
     *
     * @since 151114 Enhancing user permissions.
     *
     * @return bool Current user can clear the CDN cache?
     */
    public function currentUserCanWipeCdnCache()
    {
        return call_user_func_array([$this, 'currentUserCanClearCdnCache'], func_get_args());
    }

    /**
     * Current user can clear expired transients?
     *
     * @since 151220 Enhancing user permissions.
     *
     * @return bool Current user can clear expired transients?
     */
    public function currentUserCanClearExpiredTransients()
    {
        if (!is_null($can = &$this->cacheKey('currentUserCanClearExpiredTransients'))) {
            return $can; // Already cached this.
        }
        $is_multisite = is_multisite();

        if (!$is_multisite && current_user_can($this->cap)) {
            return $can = true; // Plugin admin.
        }
        if ($is_multisite && current_user_can($this->network_cap)) {
            return $can = true; // Plugin admin.
        }
        return $can = false;
    }

    /**
     * Alias for currentUserCanClearExpiredTransients().
     *
     * @since 151220 Enhancing user permissions.
     *
     * @return bool Current user can clear expired transients?
     */
    public function currentUserCanWipeExpiredTransients()
    {
        return call_user_func_array([$this, 'currentUserCanClearExpiredTransients'], func_get_args());
    }

    /**
     * Current user can see stats?
     *
     * @since 151002 Enhancing user permissions.
     *
     * @return bool Current user can see stats?
     */
    public function currentUserCanSeeStats()
    {
        if (!is_null($can = &$this->cacheKey('currentUserCanSeeStats'))) {
            return $can; // Already cached this.
        }
        $is_multisite = is_multisite();

        if (!$is_multisite && current_user_can($this->cap)) {
            return $can = true; // Plugin admin.
        }
        if ($is_multisite && current_user_can($this->network_cap)) {
            return $can = true; // Plugin admin.
        }
        
        return $can = false;
    }
}