!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/gateway.picotech.app/public_html/vendor/nwidart/laravel-modules/src/   drwxr-xr-x
Free 28.53 GB of 117.98 GB (24.18%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Module.php (8.8 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Nwidart\Modules;

use 
Illuminate\Cache\CacheManager;
use 
Illuminate\Container\Container;
use 
Illuminate\Filesystem\Filesystem;
use 
Illuminate\Support\Arr;
use 
Illuminate\Support\Str;
use 
Illuminate\Support\Traits\Macroable;
use 
Illuminate\Translation\Translator;
use 
Nwidart\Modules\Contracts\ActivatorInterface;

abstract class 
Module
{
    use 
Macroable;

    
/**
     * The laravel|lumen application instance.
     *
     * @var \Illuminate\Contracts\Foundation\Application|\Laravel\Lumen\Application
     */
    
protected $app;

    
/**
     * The module name.
     *
     * @var
     */
    
protected $name;

    
/**
     * The module path.
     *
     * @var string
     */
    
protected $path;

    
/**
     * @var array of cached Json objects, keyed by filename
     */
    
protected $moduleJson = [];
    
/**
     * @var CacheManager
     */
    
private $cache;
    
/**
     * @var Filesystem
     */
    
private $files;
    
/**
     * @var Translator
     */
    
private $translator;
    
/**
     * @var ActivatorInterface
     */
    
private $activator;

    
/**
     * The constructor.
     * @param Container $app
     * @param $name
     * @param $path
     */
    
public function __construct(Container $appstring $name$path)
    {
        
$this->name $name;
        
$this->path $path;
        
$this->cache $app['cache'];
        
$this->files $app['files'];
        
$this->translator $app['translator'];
        
$this->activator $app[ActivatorInterface::class];
        
$this->app $app;
    }

    
/**
     * Get name.
     *
     * @return string
     */
    
public function getName(): string
    
{
        return 
$this->name;
    }

    
/**
     * Get name in lower case.
     *
     * @return string
     */
    
public function getLowerName(): string
    
{
        return 
strtolower($this->name);
    }

    
/**
     * Get name in studly case.
     *
     * @return string
     */
    
public function getStudlyName(): string
    
{
        return 
Str::studly($this->name);
    }

    
/**
     * Get name in snake case.
     *
     * @return string
     */
    
public function getSnakeName(): string
    
{
        return 
Str::snake($this->name);
    }

    
/**
     * Get description.
     *
     * @return string
     */
    
public function getDescription(): string
    
{
        return 
$this->get('description');
    }

    
/**
     * Get alias.
     *
     * @return string
     */
    
public function getAlias(): string
    
{
        return 
$this->get('alias');
    }

    
/**
     * Get priority.
     *
     * @return string
     */
    
public function getPriority(): string
    
{
        return 
$this->get('priority');
    }

    
/**
     * Get module requirements.
     *
     * @return array
     */
    
public function getRequires(): array
    {
        return 
$this->get('requires');
    }

    
/**
     * Get path.
     *
     * @return string
     */
    
public function getPath(): string
    
{
        return 
$this->path;
    }

    
/**
     * Set path.
     *
     * @param string $path
     *
     * @return $this
     */
    
public function setPath($path): Module
    
{
        
$this->path $path;

        return 
$this;
    }

    
/**
     * Bootstrap the application events.
     */
    
public function boot(): void
    
{
        if (
config('modules.register.translations'true) === true) {
            
$this->registerTranslation();
        }

        if (
$this->isLoadFilesOnBoot()) {
            
$this->registerFiles();
        }

        
$this->fireEvent('boot');
    }

    
/**
     * Register module's translation.
     *
     * @return void
     */
    
protected function registerTranslation(): void
    
{
        
$lowerName $this->getLowerName();

        
$langPath $this->getPath() . '/Resources/lang';

        if (
is_dir($langPath)) {
            
$this->loadTranslationsFrom($langPath$lowerName);
        }
    }

    
/**
     * Get json contents from the cache, setting as needed.
     *
     * @param string $file
     *
     * @return Json
     */
    
public function json($file null) : Json
    
{
        if (
$file === null) {
            
$file 'module.json';
        }

        return 
Arr::get($this->moduleJson$file, function () use ($file) {
            return 
$this->moduleJson[$file] = new Json($this->getPath() . '/' $file$this->files);
        });
    }

    
/**
     * Get a specific data from json file by given the key.
     *
     * @param string $key
     * @param null $default
     *
     * @return mixed
     */
    
public function get(string $key$default null)
    {
        return 
$this->json()->get($key$default);
    }

    
/**
     * Get a specific data from composer.json file by given the key.
     *
     * @param $key
     * @param null $default
     *
     * @return mixed
     */
    
public function getComposerAttr($key$default null)
    {
        return 
$this->json('composer.json')->get($key$default);
    }

    
/**
     * Register the module.
     */
    
public function register(): void
    
{
        
$this->registerAliases();

        
$this->registerProviders();

        if (
$this->isLoadFilesOnBoot() === false) {
            
$this->registerFiles();
        }

        
$this->fireEvent('register');
    }

    
/**
     * Register the module event.
     *
     * @param string $event
     */
    
protected function fireEvent($event): void
    
{
        
$this->app['events']->dispatch(sprintf('modules.%s.' $event$this->getLowerName()), [$this]);
    }
    
/**
     * Register the aliases from this module.
     */
    
abstract public function registerAliases(): void;

    
/**
     * Register the service providers from this module.
     */
    
abstract public function registerProviders(): void;

    
/**
     * Get the path to the cached *_module.php file.
     *
     * @return string
     */
    
abstract public function getCachedServicesPath(): string;

    
/**
     * Register the files from this module.
     */
    
protected function registerFiles(): void
    
{
        foreach (
$this->get('files', []) as $file) {
            include 
$this->path '/' $file;
        }
    }

    
/**
     * Handle call __toString.
     *
     * @return string
     */
    
public function __toString()
    {
        return 
$this->getStudlyName();
    }

    
/**
     * Determine whether the given status same with the current module status.
     *
     * @param bool $status
     *
     * @return bool
     */
    
public function isStatus(bool $status) : bool
    
{
        return 
$this->activator->hasStatus($this$status);
    }

    
/**
     * Determine whether the current module activated.
     *
     * @return bool
     */
    
public function isEnabled() : bool
    
{
        return 
$this->activator->hasStatus($thistrue);
    }

    
/**
     *  Determine whether the current module not disabled.
     *
     * @return bool
     */
    
public function isDisabled() : bool
    
{
        return !
$this->isEnabled();
    }

    
/**
     * Set active state for current module.
     *
     * @param bool $active
     *
     * @return void
     */
    
public function setActive(bool $active): void
    
{
        
$this->activator->setActive($this$active);
    }

    
/**
     * Disable the current module.
     */
    
public function disable(): void
    
{
        
$this->fireEvent('disabling');

        
$this->activator->disable($this);
        
$this->flushCache();

        
$this->fireEvent('disabled');
    }

    
/**
     * Enable the current module.
     */
    
public function enable(): void
    
{
        
$this->fireEvent('enabling');

        
$this->activator->enable($this);
        
$this->flushCache();

        
$this->fireEvent('enabled');
    }

    
/**
     * Delete the current module.
     *
     * @return bool
     */
    
public function delete(): bool
    
{
        
$this->activator->delete($this);

        return 
$this->json()->getFilesystem()->deleteDirectory($this->getPath());
    }

    
/**
     * Get extra path.
     *
     * @param string $path
     *
     * @return string
     */
    
public function getExtraPath(string $path) : string
    
{
        return 
$this->getPath() . '/' $path;
    }

    
/**
     * Check if can load files of module on boot method.
     *
     * @return bool
     */
    
protected function isLoadFilesOnBoot(): bool
    
{
        return 
config('modules.register.files''register') === 'boot' &&
            
// force register method if option == boot && app is AsgardCms
            
!class_exists('\Modules\Core\Foundation\AsgardCms');
    }

    private function 
flushCache(): void
    
{
        if (
config('modules.cache.enabled')) {
            
$this->cache->store()->flush();
        }
    }

    
/**
     * Register a translation file namespace.
     *
     * @param  string  $path
     * @param  string  $namespace
     * @return void
     */
    
private function loadTranslationsFrom(string $pathstring $namespace): void
    
{
        
$this->translator->addNamespace($namespace$path);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0042 ]--