# css-javascript-toolbox/12/access.points/main.accesspoint.php

CSS &amp; JavaScript Toolbox, version 12. 102 lines.

- Page: https://pluginprobe.com/plugins/css-javascript-toolbox/12/code/access.points/main.accesspoint.php
- Raw: https://pluginprobe.com/plugins/css-javascript-toolbox/12/raw/access.points/main.accesspoint.php
- Modified: 2024-08-07T14:30:52+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/css-javascript-toolbox/12/code/access.points/main.accesspoint.php#L10-L20`.

```php
<?php
/**
*
*/

// Disallow direct access.
defined('ABSPATH') or die("Access denied");

/**
*
*/
class CJTMainAccessPoint extends CJTAccessPoint {

    /**
    * put your comment there...
    *
    * @var mixed
    */
    protected static $instance;

    /**
    * put your comment there...
    *
    */
    public function __construct() {
        // Initialize Access Point base!
        parent::__construct();
        // Set access point name!
        $this->name = 'main';
        // Needed for calling from nuinstall static method!
        self::$instance = $this;
    }

    /**
    * put your comment there...
    *
    */
    protected function doListen()
    {

        // Register uninstall hook!
        if (CJTPlugin::getInstance()->isInstalled())
        {
            // Wordpress need STATIC method!
            register_uninstall_hook(CJTOOLBOX_PLUGIN_FILE, array(__CLASS__, 'uninstall'));
        }

        // If not in uninstall state then plugins_loaded hook
        // used to run the plugin!
        add_action('plugins_loaded', array(&$this, 'main'));
    }

    /**
    * put your comment there...
    *
    */
    public function main()
    {

        // Run the coupling only if installed!
        if (CJTPlugin::getInstance()->isInstalled())
        {
            $this->controllerName = 'blocks-coupling';
            $this->route(false);
        }

        // Run all the aother access points!
        CJTPlugin::getInstance()->listen();
    }

    /**
    * put your comment there...
    *
    */
    public static function uninstall() {
        // For the uninstaller to be run eraseData setting must be enabled.
        cssJSToolbox::import('models:settings:uninstall.php');
		cssJSToolbox::import('models:installer.php');

		delete_option( CJTPlugin::DB_VERSION_OPTION_NAME );
		delete_option( CJTInstallerModel::INSTALLATION_STATE );
		delete_option( 'cjtplusinstaller' );

        $settings = new CJTSettingsUninstallPage();
        if ($settings->eraseData) {
            // Get the only instance we've for the main access point!
            $mainAccessPointObject = self::$instance;
            // Load default controller!
            $mainAccessPointObject->controllerName = 'default';
            $controller = $mainAccessPointObject->route(false)
            // Fire uninstall action!
            ->setAction('uninstall')
			->_doAction();


        }
    }

} // End class.

// Hookable!
CJTMainAccessPoint::define('CJTMainAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
```
