Sets up the add addons box.
348874
function setupAddBox() {
  var addBox = document.querySelector('.addRow input');
  addBox.oninput = function() {
    if (addBox.value == '') {
      clearError();
      return;
    }
    fetchAddonManifest(addBox.value);
  };
  function fetchAddonManifest(url) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.onerror = function() {
      setError();
    };
    xhr.onload = function() {
      var contentType = xhr.getResponseHeader('content-type') || '';
      if (xhr.status != 200 ||
          contentType.indexOf('/json') == -1) {
        setError();
        return;
      }

      var manifest;
      try {
        manifest = JSON.parse(xhr.responseText);
      } catch (e) {
      }
      if (!manifest) {
        setError();
        return;
      }

      clearError();
      addAddon(url, manifest);
    };
    try {
      xhr.send(null);
    } catch (e) {
      setError();
    }
  };
  function setError() {
    addBox.classList.add('kTextFieldError');
  };
  function clearError() {
    addBox.classList.remove('kTextFieldError');
  };

  function addAddon(url, manifest) {
    _gaq.push(['_trackEvent', 'popup', 'addon_added']);

    addBox.value = '';
    port.postMessage({
      command: 'add_addon',
      url: url,
      manifest: manifest
    });
    port.postMessage({
      command: 'toggle_addon',
      enabled: true,
      url: url
    });
  };
}
22641
protected function _setup()
    {
        foreach ($this->_properties as $property) {
            $element = $this->_createElement($property);
            if ($element) {
                $this->addElement($element['name'], $element);
            }
        }
        $this->add(
            new Submit(
                ['value' => 'Save']
            )
        );
    }
798676
public static function setup(): void
    {
        $aComponents          = Components::available();
        self::$aContainers    = [];
        self::$aLoadedHelpers = [];
        $aDiscoveredServices  = [
            'nails/common' => self::findServicesForComponent('nails/common'),
        ];

        foreach ($aComponents as $oComponent) {
            $aDiscoveredServices[$oComponent->slug] = self::findServicesForComponent($oComponent->slug);
        }

        $aDiscoveredServices['app'] = self::findServicesForApp();
        $aDiscoveredServices        = array_filter($aDiscoveredServices);

        foreach ($aDiscoveredServices as $sComponentName => $aComponentServices) {

            //  Properties
            if (!empty($aComponentServices['properties'])) {
                if (empty(self::$aContainers[$sComponentName]['properties'])) {
                    self::$aContainers[$sComponentName]['properties'] = new Container();
                }
                foreach ($aComponentServices['properties'] as $sKey => $mValue) {
                    self::$aContainers[$sComponentName]['properties'][$sKey] = $mValue;
                }
            }

            // --------------------------------------------------------------------------

            /**
             * SERVICES
             * All services are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['services'])) {
                if (empty(self::$aContainers[$sComponentName]['services'])) {
                    self::$aContainers[$sComponentName]['services'] = new Container();
                }
                foreach ($aComponentServices['services'] as $sKey => $cCallable) {
                    self::$aContainers[$sComponentName]['services'][$sKey] = function () use ($sKey, $cCallable) {
                        return $cCallable;
                    };;
                }
            }

            // --------------------------------------------------------------------------

            /**
             * MODELS
             * All models are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['models'])) {
                if (empty(self::$aContainers[$sComponentName]['models'])) {
                    self::$aContainers[$sComponentName]['models'] = new Container();
                }
                foreach ($aComponentServices['models'] as $sKey => $cCallable) {
                    self::$aContainers[$sComponentName]['models'][$sKey] = function () use ($cCallable) {
                        return $cCallable;
                    };
                }
            }

            // --------------------------------------------------------------------------

            /**
             * FACTORIES
             * All factories are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['factories'])) {
                if (empty(self::$aContainers[$sComponentName]['factories'])) {
                    self::$aContainers[$sComponentName]['factories'] = new Container();
                }
                foreach ($aComponentServices['factories'] as $sKey => $cCallable) {

                    $cWrapper = function () use ($cCallable) {
                        return $cCallable;
                    };

                    self::$aContainers[$sComponentName]['factories'][$sKey] = self::$aContainers[$sComponentName]['factories']
                        ->factory($cWrapper);
                }
            }

            // --------------------------------------------------------------------------

            /**
             * FACTORIES
             * All factories are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['resources'])) {
                if (empty(self::$aContainers[$sComponentName]['resources'])) {
                    self::$aContainers[$sComponentName]['resources'] = new Container();
                }
                foreach ($aComponentServices['resources'] as $sKey => $cCallable) {

                    $cWrapper = function () use ($cCallable) {
                        return $cCallable;
                    };

                    self::$aContainers[$sComponentName]['resources'][$sKey] = self::$aContainers[$sComponentName]['resources']
                        ->factory($cWrapper);
                }
            }
        }
    }
41322
public function add()
	{
		// Get the alias we're setting
		$name = $this->arguments->getOpt(3);
		$path = $this->arguments->getOpt(4);

		// Delete the primary args so they aren't added as top level config values
		$this->arguments->deleteOpt(3);
		$this->arguments->deleteOpt(4);

		// Set the new aliases argument
		$this->arguments->setOpt('aliases', array($name => $path));

		// Redirect back to the basic configuration set method
		App::get('client')->call('configuration', 'set', $this->arguments, $this->output);
	}
983802
def create_add_on(self, add_on):
        """"""
        url = urljoin(self._url, '/add_ons')
        return add_on.post(url)
781490
def setup(self, name_filters=['*.py', '*.pyw'], show_all=False,
              single_click_to_open=False):
        """"""
        self.setup_view()

        self.set_name_filters(name_filters)
        self.show_all = show_all
        self.single_click_to_open = single_click_to_open
        
        # Setup context menu
        self.menu = QMenu(self)
        self.common_actions = self.setup_common_actions()
440415
function buildAddonTable(addons, enabledAddons) {
  var tbody = document.querySelector('.addonPicker tbody');

  // Remove all old content.
  while (tbody.firstChild) {
    tbody.firstChild.remove();
  }

  // Add empty row.
  if (!addons.length) {
    var tr = document.createElement('tr');
    tr.className = 'emptyRow';
    var td = document.createElement('td');
    td.innerText = 'No addons added.';
    tr.appendChild(td);
    tbody.appendChild(tr);
  }

  // Build the table.
  for (var n = 0; n < addons.length; n++) {
    var extension = addons[n];
    addExtensionRow(extension);
  }
  function addExtensionRow(extension) {
    var isEnabled = enabledAddons.indexOf(extension.url) >= 0;;

    var td = document.createElement('td');
    var input = document.createElement('input');
    input.type = 'checkbox';
    input.checked = isEnabled;
    td.appendChild(input);
    var span = document.createElement('span');
    span.innerText = extension.manifest.name;
    span.title = extension.url;
    td.appendChild(span);

    var remove = document.createElement('td');
    remove.className = 'remove';
    var removeImg = document.createElement('img');
    removeImg.title = 'Remove extension';
    remove.appendChild(removeImg);

    var tr = document.createElement('tr');
    tr.appendChild(td);
    tr.appendChild(remove);

    tbody.appendChild(tr);

    function changed() {
      _gaq.push(['_trackEvent', 'popup', 'addon_toggled']);

      port.postMessage({
        command: 'toggle_extension',
        enabled: input.checked,
        url: extension.url
      });
    };
    input.onchange = function() {
      changed();
    };
    span.onclick = function() {
      input.checked = !input.checked;
      changed();
    };

    remove.onclick = function() {
      _gaq.push(['_trackEvent', 'popup', 'addon_removed']);

      if (isEnabled) {
        port.postMessage({
          command: 'toggle_addon',
          enabled: false,
          url: extension.url
        });
      }
      port.postMessage({
        command: 'remove_addon',
        url: extension.url
      });
    };
  };
}
950657
def setup_ui(self, ):
        
        w = QtGui.QWidget(self)
        w.setLayout(self.central_vbox)
        self.setCentralWidget(w)
        releasetypes = [djadapter.RELEASETYPES["work"]]
        self.browser = FileBrowser(self.filetype, releasetypes, None, self)
        self.central_vbox.insertWidget(0, self.browser)

        self.comment_pte = self.create_comment_edit()
        self.central_vbox.addWidget(self.comment_pte)
        self.option_gb.setVisible(False)

        self.setup_icons()
294365
function _addons_page_load() {
            $this->_logger->entrance();

            fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );

            wp_enqueue_script( 'plugin-install' );
            add_thickbox();

            function fs_addons_body_class( $classes ) {
                $classes .= ' plugins-php';

                return $classes;
            }

            add_filter( 'admin_body_class', 'fs_addons_body_class' );

            if ( ! $this->is_registered() && $this->is_org_repo_compliant() ) {
                $this->_admin_notices->add(
                    sprintf( $this->get_text_inline( 'Just letting you know that the add-ons information of %s is being pulled from an external server.', 'addons-info-external-message' ), '<b>' . $this->get_plugin_name() . '</b>' ),
                    $this->get_text_x_inline( 'Heads up', 'advance notice of something that will need attention.', 'heads-up' ),
                    'update-nag'
                );
            }
        }
1146388
def add(self, defn):
        """"""
        self[defn.name]            = defn
        self.opcodes[defn._opcode] = defn
1019950
def setup(self):
    
    return self._load_plugins(
      self._working_set,
      self._bootstrap_options.pythonpath,
      self._bootstrap_options.plugins,
      self._bootstrap_options.backend_packages
    )
299354
def registerAddonModule(cls, module):
        
        prop = '_{0}__addon_modules'.format(cls.__name__)
        mods = getattr(cls, prop, set())
        mods.add(module)
        setattr(cls, prop, mods)
1371237
public function install()
    {
        // 1. Set options
        $this->setOptions($this->config->options());

        // 2. Activate plugins
        $this->activatePlugins($this->config->plugins());

        // 3. Maybe set the theme (and settings)
        if ($theme = $this->config->theme()) {
            $this->setTheme($theme->name, $theme->mods, $theme->options, $theme->menus, $theme->sidebars);
        }

        // 4. Maybe set the permalink structure
        global $wp_rewrite;
        if ($wp_rewrite && $permalinks = $this->config->permalinks()) {
            $this->setPermalinkStructure($wp_rewrite, $permalinks);
        }

        // 5. Maybe set the timezone
        if ($timezone = $this->config->timezone()) {
            $this->setTimezone($timezone);
        }
    }
1325479
protected function wizardAddPage()
    {
        // Required
        $this->validatePrompt('title', $this->text('Title'), 'page');
        $this->validatePrompt('description', $this->text('Description'), 'page');
        $this->validatePrompt('store_id', $this->text('Store ID'), 'page');

        // Optional
        $this->validatePrompt('user_id', $this->text('User ID'), 'page', 0);
        $this->validatePrompt('meta_title', $this->text('Meta title'), 'page', '');
        $this->validatePrompt('meta_description', $this->text('Meta description'), 'page', '');
        $this->validatePrompt('category_id', $this->text('Category ID'), 'page', 0);
        $this->validatePrompt('blog_post', $this->text('Blog post'), 'page', 0);
        $this->validatePrompt('status', $this->text('Status'), 'page', 0);

        $this->validateComponent('page');
        $this->addPage();
    }
952603
private function setUpBoxes()
    {
        $parameters = $this->context->getParameters();
        $boxes = $parameters['boxes'];

        $finalBoxes = array();
        if (is_array($boxes)) {
            foreach ($boxes as $key => $box) {
                $finalBoxes[$key] = null;
            }
        }

        $assocBoxes = $this->em->getRepository('WebCMS\Entity\Box')->findBy(array(
            'pageTo' => $this->actualPage
        ));

        foreach ($assocBoxes as $box) {
            $presenter = 'FrontendModule\\'.$box->getModuleName().'Module\\'.$box->getPresenter().'Presenter';
            $object = new $presenter();

            if (method_exists($object, $box->getFunction())) {
                $function = $box->getFunction();
                $pageFrom = $box->getPageFrom();
                if ($pageFrom) {
                    $finalBoxes[$box->getBox()] = call_user_func(array($object, $function), $this, $pageFrom);
                }
            }
        }

        $this->template->boxes = $finalBoxes;
    }
1117163
def add(self, addon, dev=False, interactive=True):
        """"""
        dependencies = self.get_dependency_manager(dev=dev)
        other_dependencies = self.get_dependency_manager(dev=not dev)
        existing = dependencies.get(addon)
        self.stdout.write(style.format_command('Adding', addon))
        dependencies.add(addon)
        try:
            # try running the build
            self.build()
            self.refresh()

            # remove version of this in other requirements file
            other_dependencies.remove(addon, warn=False)

            # run new addon constructor
            constructor_name = '%s.init' % Dependency(addon).module_name
            constructor = self.blueprints.get(constructor_name)

            if constructor:
                context = constructor.load_context().main(
                    [], standalone_mode=False
                )
                self.generate(constructor, context, interactive=interactive)
        except Exception as e:
            # restore original settings
            self.stdout.write(style.red(str(e)))
            self.stdout.write(
                style.yellow('Could not find %s' % addon)
            )
            dependencies.remove(addon)
            if existing:
                dependencies.add(existing)
            return
1339788
private function _store_addons( $plugin_addons, $store = true ) {
            $this->_logger->entrance();

            $addons                       = self::get_all_addons();
            $addons[ $this->_plugin->id ] = $plugin_addons;
            self::$_accounts->set_option( 'addons', $addons, $store );
        }