Instance all plugins
Genera una variable global para cada clase o plugin
cargado accesibe como global
ejs.:
global $BCA_P2Projects;
$BCA_P2Projects->widget();
@return void
321270
public function boot() {

		do_action('app_before_boot_complete');

        $cmb2InitPath = $this->getBasePath().'vendor/webdevstudios/cmb2/init.php';
        $cmb2InitPathOpc = $this->getBasePath().'vendor/webdevstudios/CMB2/init.php';

        if (file_exists($cmb2InitPath)) {
            require $cmb2InitPath;
        } elseif ( $cmb2InitPathOpc ) {
          require_once $cmb2InitPathOpc;
        }

        $plugins_files = scandir($this->get_dir_plugins());
        do_action('app_before_boot_plugins');
		foreach ($plugins_files as $file) {
			if ($file != '.' && $file != '..' && $file != '.gitkeep') {
				$class_name = explode('.', $file)[0];
				if ($class_name != 'Plugin') {
					$class = '\\App\\Plugins\\' . $class_name;
                    $pluginDoAction = strtolower(str_replace('\\','_', $class));
                    do_action('before'.$pluginDoAction); //before_app_plugins_dummies
					    $PluginInstance = new $class();
					    $PluginInstance->setClass($class);
					    $ClassRef = &$PluginInstance;
					    $this->create_global_plugin($ClassRef);
                    do_action('after'.$pluginDoAction); //after_app_plugins_dummies

				}

			}
		}
        do_action('app_after_boot_plugins');
		$this->appBootComplete();
	}
1219991
def GLOBAL(self, node):
        """"""
        if isinstance(self.scope, FunctionScope):
            self.scope.globals.update(node.names)
272340
def globals(self):
        """"""
        defglobal = lib.EnvGetNextDefglobal(self._env, ffi.NULL)

        while defglobal != ffi.NULL:
            yield Global(self._env, defglobal)

            defglobal = lib.EnvGetNextDefglobal(self._env, defglobal)
860324
public static function setupGlobalVariables(): void
	{
		$_SERVER = array_intersect_key($_SERVER, array_flip([
			'PHP_SELF',
			'SCRIPT_NAME',
			'SERVER_ADDR',
			'SERVER_SOFTWARE',
			'HTTP_HOST',
			'DOCUMENT_ROOT',
			'OS',
			'argc',
			'argv',
		]));
		$_SERVER['REQUEST_TIME'] = 1234567890;
		$_ENV = $_GET = $_POST = [];
	}
1291324
function(){
			var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
				opts = this.options,
				actualOpts = plugin.options,
				availOptList = opts.optionList,
				$opts = $(this.options.optionTarget).empty(),
				$ul = $("<ul>").appendTo($opts),
				$li = null;
			$.each(availOptList, function(i, o){
				if( typeof o.value === "boolean"){
					$li = $("<li>").append(
						$("<input>", {
							id: o.name,
							name: o.name,
							type: "checkbox",
							checked: !!actualOpts[o.name]  //o.value
						})
					).append(
						$("<label>", {"for": o.name, text: " " + o.hint})
					);
				}else if( typeof o.value === "number" || typeof o.value === "string"){
					$li = $("<li>").append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<input>", {
								id: o.name,
								name: o.name,
								type: "text",
								value: actualOpts[o.name] //o.value
							})
						);
				}else if( $.isArray(o.value) ){
					$li = $("<li>")
						.append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<select>", {
								id: o.name,
								name: o.name,
								size: 1
							})
						);
					var $sel = $li.find("select");
					$.each(o.value, function(){
						$sel.append($("<option>", {
							value: this.value,
							text: this.name,
							selected: (actualOpts[o.name] == this.value)  //this.selected
						}));
					});
				}
				$ul.append($li);
			});
		}
1177760
private function SaveGloablVariablesToPHP()
    {
        $output_file = fopen(
            $this->definitions_path . "variables.php", 
            "w"
        );
        
        fwrite($output_file, "<?php\n\n");
        
        fwrite($output_file, "use Peg\Lib\Definitions\Element\GlobalVariable;\n");
        
        foreach($this->symbols->headers as $header)
        {
            if(!$header->HasGlobalVariables())
                continue;
            
            foreach($header->namespaces as $namespace)
            {
                if(!$namespace->HasGlobalVariables())
                    continue;
                
                foreach($namespace->global_variables as $variable)
                {
                    $type = addslashes($variable->original_type);
                    $description = addslashes($variable->description);
                    $namespace_name = addslashes($namespace->name);
                    
                    $output = "\n";
                    $output .= '$symbols->AddGlobalVar(' . "\n";
                    $output .= '    new GlobalVariable(' . "\n";
                    $output .= '        "'.$variable->name.'",' . "\n";
                    $output .= '        "'.$type.'",' . "\n";
                    $output .= '        "'.$description.'"' . "\n";
                    $output .= '    ),' . "\n";
                    $output .= '    "'.$header->name.'",' . "\n";
                    $output .= '    "'.$namespace_name.'"' . "\n";
                    $output .= ');' . "\n";
                    
                    fwrite($output_file, $output);
                }
            }
        }
        
        fclose($output_file);
    }
145360
private function globalVar() {
    if ($this->currentType === T_VARIABLE) {
      return $this->mustMatchToken(T_VARIABLE);
    }
    elseif ($this->currentType === '$') {
      if ($this->isLookAhead('{')) {
        return $this->_compoundVariable();
      }
      else {
        $node = new VariableVariableNode();
        $this->mustMatch('$', $node);
        $node->addChild($this->variable());
        return $node;
      }
    }
    throw new ParserException(
      $this->filename,
      $this->iterator->getLineNumber(),
      $this->iterator->getColumnNumber(),
      'expected a global variable (eg. T_VARIABLE)');
  }
841813
protected function defineGlobals()
    {
        $wpRootFolder = $this->getWpRootFolder();

        // load an extra config file if any
        $this->loadConfigFile();

        $constants = [
            // by default install WordPress in an isolated process
            'WPCEPT_ISOLATED_INSTALL' => $this->requiresIsolatedInstallation(),
            'ABSPATH'                 => $wpRootFolder,
            'DB_NAME'                 => $this->config['dbName'],
            'DB_USER'                 => $this->config['dbUser'],
            'DB_PASSWORD'             => $this->config['dbPassword'],
            'DB_HOST'                 => $this->config['dbHost'],
            'DB_CHARSET'              => $this->config['dbCharset'],
            'DB_COLLATE'              => $this->config['dbCollate'],
            'WP_TESTS_TABLE_PREFIX'   => $this->config['tablePrefix'],
            'WP_TESTS_DOMAIN'         => $this->config['domain'],
            'WP_TESTS_EMAIL'          => $this->config['adminEmail'],
            'WP_TESTS_TITLE'          => $this->config['title'],
            'WP_PHP_BINARY'           => $this->config['phpBinary'],
            'WPLANG'                  => $this->config['language'],
            'WP_DEBUG'                => $this->config['wpDebug'],
            'WP_TESTS_MULTISITE'      => $this->config['multisite'],
        ];

        foreach ($constants as $key => $value) {
            if (!defined($key)) {
                define($key, $value);
            }
        }

        if (!defined('WP_PLUGIN_DIR') && !empty($this->config['pluginsFolder'])) {
            define('WP_PLUGIN_DIR', $this->getPluginsFolder());
        }
    }
82779
public static function Initialize()
    {
        // Initialize the plugin loader and try to load any plugins.
        self::$plugin_loader = new Plugins\Loader();

        if(self::ValidExtension())
        {
            self::$plugin_loader->Start(self::GetCwd() . "/plugins");
            
            if(file_exists(self::GetCwd() . "/peg.conf"))
            {
                Settings::SetBackEnd(new Config\INI);
                Settings::Load(self::GetCwd(), "peg.conf");
            }
            else
            {
                Settings::SetBackEnd(new Config\JSON);
                Settings::Load(self::GetCwd(), "peg.json");
            }
        }
    }
983530
protected function view_plugin_page() {
        global $USER;

        $o = '';

        $pluginsubtype = required_param('pluginsubtype', PARAM_ALPHA);
        $plugintype = required_param('plugin', PARAM_PLUGIN);
        $pluginaction = required_param('pluginaction', PARAM_ALPHA);

        $plugin = $this->get_plugin_by_type($pluginsubtype, $plugintype);
        if (!$plugin) {
            print_error('invalidformdata', '');
            return;
        }

        $o .= $plugin->view_page($pluginaction);

        return $o;
    }
951070
protected function initConfig()
    {
        if (defined('CONFIG_FILE') && file_exists(CONFIG_FILE)) {
            $this->config = include_once CONFIG_FILE;
        }

        // Inject Config Container
        $config_container = ConfigContainer::component();
        foreach ($this->config as $config_name => $config_content) {
            $config_container->set($config_name, $config_content);
            yield;
        }
        $this->config = [];
        Lb::app()->containers['config'] = $config_container;
    }
285897
private function LoadGlobalVariablesFromJson()
    {
        $variables_def = Json::Decode(file_get_contents(
            $this->definitions_path . "variables.json")
        );

        foreach($variables_def as $header => $namespaces)
        {
            $this->symbols->AddHeader($header);
            
            foreach($namespaces as $namespace => $variables)
            {
                foreach($variables as $variable_name => $variable_data)
                {
                    if(!isset($variable_data["description"]))
                        $variable_data["description"] = "";
                    
                    $variable = new Element\GlobalVariable(
                        $variable_name,
                        $variable_data["type"],
                        $variable_data["description"]
                    );

                    $this->symbols->headers[$header]->AddGlobalVariable(
                        $variable,
                        $namespace
                    );
                }
            }
        }

        unset($variables_def);
    }
416716
public function initializeDca(): void
    {
        /** @var Input $input */
        $input = $this->framework->getAdapter(Input::class);

        if ($input->get('act') !== 'edit') {
            return;
        }

        $model = $this->repository->findByPk(Input::get('id'));
        if (!$model || $model->type !== 'bs_grid_gallery') {
            return;
        }

        $GLOBALS['TL_CSS'][] = 'bundles/contaobootstrapgrid/css/backend.css';

        $GLOBALS['TL_DCA']['tl_content']['fields']['galleryTpl']['options_callback'] = [
            'contao_bootstrap.grid.listeners.dca.content',
            'getGalleryTemplates',
        ];
    }
1341721
public function init()
    {
        parent::init();

        self::$plugin = $this;

        $this->_setPluginComponents();
        $this->_setLogging();
        $this->_registerCpRoutes();
        $this->_registerVariables();
        $this->_registerFieldTypes();
        $this->_registerElementTypes();
        $this->_registerIntegrations();
        $this->_registerProjectConfigEventListeners();
    }
1154467
public function addJsVariables()
    {
        global $current_screen;
        global $post;
        global $archive;

        $id = isset($post->ID) ? $post->ID : "'" . $archive . "'";

        if (substr($current_screen->post_type, 0, 4) == 'mod-' && ($current_screen->action == 'add' || $current_screen->action == '')) {
            echo "
                <script>
                    var modularity_post_id = ". $id . ";
                    var modularity_post_action = '" . $current_screen->action . "';
                </script>
            ";
        }
    }
540125
def on_add(self, widget, data=None):
        
        gv_name = "new_global_%s" % self.global_variable_counter
        self.global_variable_counter += 1
        try:
            self.model.global_variable_manager.set_variable(gv_name, None)
        except (RuntimeError, AttributeError, TypeError) as e:
            logger.warning("Addition of new global variable '{0}' failed: {1}".format(gv_name, e))
        self.select_entry(gv_name)
        return True
1267917
def add_global_variable(*pVariable)
      pVariable.flatten.each do |element|
        next unless element.is_a?(Languages::VariableGlobalData)
        @global_variables.push(element)
      end
    end