Main plugin execution
436821
public void execute()
    {
        for ( Resource resource : resources )
        {
            // Check for relative paths in the resource configuration.
            // http://maven.apache.org/plugin-developers/common-bugs.html#Resolving_Relative_Paths
            File resourceDir = new File( resource.getDirectory() );
            if ( !resourceDir.isAbsolute() )
            {
                resourceDir = new File( project.getBasedir(), resource.getDirectory() );
                resource.setDirectory( resourceDir.getAbsolutePath() );
            }

            addResource( resource );
        }
    }
661196
function main() {
    console.log("Will create symlink from " + languageDir + " to " + baseDir);
    let relativeLanguageDir = path.relative(currentDir, languageDir);
    let relativeBaseDir = path.relative(currentDir, baseDir);
    console.log("Using relative paths " + relativeLanguageDir + " to " + relativeBaseDir);
    symlinkOrCopySync(relativeLanguageDir, relativeBaseDir);

    // clean out elm-stuff cache
    glob(path.join(currentDir, "/elm-stuff/**/user/project/*/"+argv.rootModule+"*"), function(er, files) {
        files.forEach(function(file) {
            console.log("clearing out cache at", file);
            fs.removeSync(file);
        });
        if (argv.output) {
            build(argv.output);
        }
    });
}
1202728
public function main()
	{
		$ds = DIRECTORY_SEPARATOR;

		$this->_msg( 'Generating JSB2 packages' );

		$abslen = strlen( $this->_projectPath );

		foreach( $this->_arcavias->getCustomPaths( 'client/extjs' ) as $base => $paths )
		{
			foreach( $paths as $path )
			{
				$jsbPath = $base . $ds . $path;

				$message = sprintf( 'Package: %1$s ', $jsbPath );
				$this->_msg( sprintf( 'Package: %1$s ', $jsbPath ) );

				if( !is_file( $jsbPath ) || !is_readable( $jsbPath ) )
				{
					$this->_msg( $message, 'failed' );
					$this->_msg( sprintf( 'No manifest file found in %1$s', $jsbPath ) );
					continue;
				}

				try
				{
					$jsbParser = new MW_Jsb2_Default( $jsbPath );
					$jsbParser->deploy( 'js' );
					$this->_msg( $message, 'done' );
				}
				catch ( Exception $e )
				{
					$this->_msg( $message, 'failed' );
					$this->_msg( sprintf( 'Error: %1$s', $e->getMessage() ) );
				}
			}
		}
	}
198846
public function main()
    {
        $this->setup('propget');

        $this->log("Get value from file '" . $this->getWorkingCopy() . "'");

        $output = $this->run([$this->getSvnPropertyName(), $this->getFromDir()]);

        $this->project->setProperty($this->getPropertyName(), $output);
    }
742442
public function run()
    {
        $this->registerClientScript();

        $this->options['data-plugin-name'] = $this->_pluginName;
        $this->options['data-plugin-options'] = $this->_hashOptions;

        Html::addCssClass($this->options, 'fullcalendar');

        echo '<div id="container_' . $this->options['id'] . '">';
        echo '<div class="fc-loading" style="display: none;">' . $this->loading . '</div>';
        echo Html::tag('div', '', $this->options);
        echo '</div>';
    }
579254
public function main()
    {
        $this->loadModel('System.Plugins');

        try {
            $plugin = plugin($this->params['plugin']);
            $existsInDb = (bool)$this->Plugins
                ->find()
                ->where(['name' => $this->params['plugin']])
                ->count();
        } catch (\Exception $e) {
            $plugin = $existsInDb = false;
        }

        if (!$plugin || !$existsInDb) {
            $this->err(__d('installer', 'Plugin "{0}" was not found.', $this->params['plugin']));

            return false;
        }

        if ($this->params['status'] === 'enable') {
            return $this->_enable($plugin);
        }

        return $this->_disable($plugin);
    }
504895
public function execute() {
        global $CFG;

        require_once($CFG->dirroot . '/course/lib.php');

        // Specific list of plugins that need to be refreshed. If not set, then all mod plugins will be refreshed.
        $pluginstorefresh = null;
        if (isset($this->get_custom_data()->plugins)) {
            $pluginstorefresh = $this->get_custom_data()->plugins;
        }

        // Is course id set?
        if (isset($this->get_custom_data()->courseid)) {
            $courseid = $this->get_custom_data()->courseid;
        } else {
            $courseid = 0;
        }

        $pluginmanager = core_plugin_manager::instance();
        $modplugins = $pluginmanager->get_plugins_of_type('mod');
        foreach ($modplugins as $plugin) {
            // Check if a specific list of plugins is defined and check if it contains the plugin that is currently being evaluated.
            if (!empty($pluginstorefresh) && !in_array($plugin->name, $pluginstorefresh)) {
                // This plugin is not in the list, move on to the next one.
                continue;
            }
            // Refresh events.
            mtrace('Refreshing events for ' . $plugin->name);
            course_module_bulk_update_calendar_events($plugin->name, $courseid);
        }
    }
789637
function main() {
  var wtfOptions = self.options.wtfOptions || {};

  setupCommunications();

  injectScriptFile(
      'wtf_trace_web_js_compiled.js', self.options.wtfScriptContents);
  injectScriptFunction(function(options) {
    wtf.trace.prepare(options);
  }, [
    wtfOptions
  ]);
  injectScriptFunction(startTracing, []);
}
668717
def run_plugins(self):
        
        for obj in self.loader.objects:
            # Reserve a slot in the output_dict in order to ensure that the
            # items are in the correct order.
            self.output_dict[obj.output_options['name']] = None
            self.thread_manager.add_thread(obj.main, obj.options['interval'])
588296
public function main()
    {
        if (!$this->_init()) {
            $this->_reset();

            return false;
        }

        if (!$this->params['no-callbacks']) {
            // "before" events occurs even before plugins is moved to its destination
            $this->_attachListeners($this->_plugin['name'], "{$this->_workingDir}/");
            try {
                $event = $this->trigger("Plugin.{$this->_plugin['name']}.beforeUpdate");
                if ($event->isStopped() || $event->result === false) {
                    $this->err(__d('installer', 'Task was explicitly rejected by the plugin.'));
                    $this->_reset();

                    return false;
                }
            } catch (\Exception $ex) {
                $this->err(__d('installer', 'Internal error, plugin did not respond to "beforeUpdate" callback correctly.'));
                $this->_reset();

                return false;
            }
        }

        if (!$this->_movePackage(true)) {
            $this->_reset();

            return false;
        }

        if (!$this->params['no-callbacks']) {
            try {
                $event = $this->trigger("Plugin.{$this->_plugin['name']}.afterUpdate");
            } catch (\Exception $e) {
                $this->err(__d('installer', 'Plugin was installed but some errors occur.'));
            }
        }

        $this->_finish();

        return true;
    }
28495
public static void main(final String[] args) {
		// init of the connection to the plugin
		int viewPort = 0;
		final List<String> classList = new ArrayList<String>();
		for (int i = 0; i < args.length; i++) {
			if (args[i].equals("-Port")) {
				if (args[i + 1] != null) {
					viewPort = Integer.parseInt(args[i + 1]);
				}
				break;
			} else {
				classList.add(args[i]);
			}
		}
		try {

			final IUpdater updater = new SocketViewProgressUpdater(null,
					viewPort);

			final SocketAdapter adapter = new SocketAdapter(updater,
					classList.toArray(new String[classList.size()]));

			adapter.registerClasses(classList.toArray(new String[classList
					.size()]));
			adapter.runBenchmark();
		} catch (final SocketViewException | ClassNotFoundException
				| InstantiationException | IllegalAccessException e) {
			throw new IllegalStateException(e);
		}
	}
29671
public function main()
    {
        # The theme is activated.
        # Location: Resources/Themes/Default/
        Theme::active('Default');
        
        # The current settings are being configured.
        Masterpage::headPage('Sections/head')
                  ->bodyPage('Sections/body')
                  ->browserIcon(FILES_DIR . 'favicon.ico')
                  ->backgroundImage(FILES_DIR . 'background.jpg');
    }
5515
public function main()
    {
        LibraryLoader::includeAll();

        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->doc->backPath = $GLOBALS['BACK_PATH'];

        if ($GLOBALS['BE_USER']->user['admin']) {
            $this->doc->bodyTagAdditions = 'id="doc3"';

            $this->addAdditionalHeaderData();

            $this->cleanOutputBuffers();
            $this->outputService->output(
                $this->doc->startPage($this->translate('title')) .
                $this->doc->header(\PHPUnit_Runner_Version::getVersionString())
            );

            $this->renderRunTests();

            $this->outputService->output(
                $this->doc->section(
                    $this->translate('shortcuts.title'),
                    '<p>' . $this->translate('shortcuts.text') . '</p>
                    <p>' . $this->translate('shortcuts.browser_dependency') . '</p>
                    <ul>
                    <li>' . $this->translate('shortcuts.browser_safari_ie') . '</li>
                    <li>' . $this->translate('shortcuts.browser_firefox') . '</li>
                    </ul>'
                )
            );
        } else {
            $this->outputService->output(
                $this->doc->startPage($this->translate('title')) .
                $this->doc->header($this->translate('title')) .
                $this->translate('admin_rights_needed')
            );
        }

        $this->outputService->output($this->doc->endPage());
    }
3034
public function main()
    {
        if (empty($this->params['theme'])) {
            $this->err(__d('installer', 'You must provide a theme.'));

            return false;
        }

        if (!Plugin::exists($this->params['theme'])) {
            $this->err(__d('installer', 'Theme "{0}" was not found.', $this->params['theme']));

            return false;
        }

        $plugin = plugin($this->params['theme']);
        if (!$plugin->isTheme) {
            $this->err(__d('installer', '"{0}" is not a theme.', $plugin->humanName));

            return false;
        }

        if (in_array($this->params['theme'], [option('front_theme'), option('back_theme')])) {
            $this->err(__d('installer', 'Theme "{0}" is already active.', $plugin->humanName));

            return false;
        }

        // MENTAL NOTE: As theme is "inactive" its listeners are not attached to the
        // system, so we need to manually attach them in order to trigger callbacks.
        if (!$this->params['no-callbacks']) {
            $this->_attachListeners($plugin->name, "{$plugin->path}/");

            try {
                $event = $this->trigger("Plugin.{$plugin->name}.beforeActivate");
                if ($event->isStopped() || $event->result === false) {
                    $this->err(__d('installer', 'Task was explicitly rejected by the theme.'));
                    $this->_detachListeners();

                    return false;
                }
            } catch (\Exception $ex) {
                $this->err(__d('installer', 'Internal error, theme did not respond to "beforeActivate" callback properly.'));
                $this->_detachListeners();

                return false;
            }
        }

        if (isset($plugin->composer['extra']['admin']) && $plugin->composer['extra']['admin']) {
            $prefix = 'back_';
            $previousTheme = option('back_theme');
        } else {
            $prefix = 'front_';
            $previousTheme = option('front_theme');
        }

        $this->loadModel('System.Options');
        $this->loadModel('System.Plugins');

        if ($this->Plugins->updateAll(['status' => 0], ['name' => $previousTheme]) &&
            $this->Plugins->updateAll(['status' => 1], ['name' => $this->params['theme']])
        ) {
            if ($this->Options->update("{$prefix}theme", $this->params['theme'])) {
                $this->_copyBlockPositions($this->params['theme'], $previousTheme);
            } else {
                $this->err(__d('installer', 'Internal error, the option "{0}" could not be persisted on database.', "{$prefix}theme"));
                $this->_detachListeners();

                return false;
            }
        } else {
            $this->err(__d('installer', 'Internal error, unable to turnoff current theme ({0}) and active new one ({1}).', $previousTheme, $this->params['theme']));

            return false;
        }

        if (!$this->params['no-callbacks']) {
            try {
                $this->trigger("Plugin.{$plugin->name}.afterActivate");
            } catch (\Exception $e) {
                $this->err(__d('installer', 'Theme did not respond to "afterActivate" callback.'));
            }
        }

        return true;
    }
166046
private void firePluginStarted(final Plugin plugin) {
        PluginEvent e = null;
        synchronized (listenerList) {
            for (Iterator iter = listenerList.iterator(); iter.hasNext();) {
                PluginListener l = (PluginListener) iter.next();
                if (e == null) {
                    e = new PluginEvent(plugin);
                }
                l.pluginStarted(e);
            }
        }
    }
947911
public function run()
    {        
        $masonry = ob_get_clean();
        echo Html::beginTag('div', $this->options); //opens the container
            echo $masonry;
        echo Html::endTag('div'); //closes the container, opened on init
        $this->registerPlugin();
    }
515144
public function main()
    {
        $this->validateAttributes();

        if ($this->file !== null) {
            if ($this->file->exists()) {
                if ($this->destFile === null) {
                    $this->destFile = new PhingFile($this->destDir, (string) $this->file->getName());
                }
                if ($this->overwrite === true || ($this->file->lastModified() > $this->destFile->lastModified())) {
                    $this->fileCopyMap[$this->file->getAbsolutePath()] = $this->destFile->getAbsolutePath();
                } else {
                    $this->log($this->file->getName() . " omitted, " . $this->destFile->getName() . " is up to date");
                }
            } else {
                // terminate build
                $this->logError("Could not find file " . $this->file->__toString() . " to copy.");
            }
        }

        $project = $this->getProject();

        // process filelists
        foreach ($this->filelists as $fl) {
            $fromDir = $fl->getDir($project);
            $srcFiles = $fl->getFiles($project);
            $srcDirs = [$fl->getDir($project)];

            if (!$this->flatten && $this->mapperElement === null) {
                $this->completeDirMap[$fromDir->getAbsolutePath()] = $this->destDir->getAbsolutePath();
            }

            $this->_scan($fromDir, $this->destDir, $srcFiles, $srcDirs);
        }

        foreach ($this->dirsets as $dirset) {
            try {
                $ds = $dirset->getDirectoryScanner($project);
                $fromDir = $dirset->getDir($project);
                $srcDirs = $ds->getIncludedDirectories();

                $srcFiles = [];
                foreach ($srcDirs as $srcDir) {
                    $srcFiles[] = $srcDir;
                }

                if (!$this->flatten && $this->mapperElement === null && $ds->isEverythingIncluded()
                ) {
                    $this->completeDirMap[$fromDir->getAbsolutePath()] = $this->destDir->getAbsolutePath();
                }

                $this->_scan($fromDir, $this->destDir, $srcFiles, $srcDirs);
            } catch (BuildException $e) {
                if ($this->haltonerror === true) {
                    throw $e;
                }

                $this->logError($e->getMessage());
            }
        }

        // process filesets
        foreach ($this->filesets as $fs) {
            try {
                $ds = $fs->getDirectoryScanner($project);
                $fromDir = $fs->getDir($project);
                $srcFiles = $ds->getIncludedFiles();
                $srcDirs = $ds->getIncludedDirectories();

                if (!$this->flatten && $this->mapperElement === null
                    && $ds->isEverythingIncluded()
                ) {
                    $this->completeDirMap[$fromDir->getAbsolutePath()] = $this->destDir->getAbsolutePath();
                }

                $this->_scan($fromDir, $this->destDir, $srcFiles, $srcDirs);
            } catch (BuildException $e) {
                if ($this->haltonerror == true) {
                    throw $e;
                }

                $this->logError($e->getMessage());
            }
        }

        // go and copy the stuff
        $this->doWork();

        if ($this->destFile !== null) {
            $this->destDir = null;
        }
    }