HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: /var/www/indoadvisory/wp/wp-content/plugins/gpltimes-/inc/Plugupdate/Plugpackage.php
<?php

/**
 * @package Gpltimes
 */

namespace Inc\Plugupdate;

class Plugpackage
{
    private $type; // 'plugin' or 'theme'

    public function __construct($value)
    {
        $this->type = $this->determineItemType($value);

        $option_name = $this->type === 'theme' ? 'gpltheme_slugdetails' : 'gplslugdetails';
        $all_package = get_option($option_name, []);

        if (!in_array($value, $all_package)) {
            $all_package[] = $value;
            update_option($option_name, $all_package);
        }
    }

    private function determineItemType($slug)
    {
        // Use slug format to determine the item type
        if (strpos($slug, '/') !== false && substr($slug, -4) === '.php') {
            return 'plugin';
        } else {
            return 'theme';
        }
    }
}