Sets initial form data
762817
protected function setFormDataBeforeCheckout()
    {
        $this->data_form = array();

        $default_order = $this->getDefaultOrder();
        $order = gplcart_array_merge($default_order, $this->data_order);

        $payment_methods = $this->getPaymentMethodsCheckout();
        $shipping_methods = $this->getShippingMethodsCheckout();

        if (count($payment_methods) == 1) {
            reset($payment_methods);
            $order['payment'] = key($payment_methods);
        }

        if (count($shipping_methods)) {
            reset($shipping_methods);
            $order['shipping'] = key($shipping_methods);
        }

        $this->data_form['order'] = $order;
        $this->data_form['messages'] = array();
        $this->data_form['admin'] = $this->admin;
        $this->data_form['user'] = $this->data_user;

        $this->data_form['statuses'] = $this->order->getStatuses();
        $this->data_form['payment_methods'] = $payment_methods;
        $this->data_form['shipping_methods'] = $shipping_methods;

        $this->data_form['has_dynamic_payment_methods'] = $this->hasDynamicMethods($payment_methods);
        $this->data_form['has_dynamic_shipping_methods'] = $this->hasDynamicMethods($shipping_methods);

        // Price rule calculator requires this data
        $this->data_form['store_id'] = $this->order_store_id;
        $this->data_form['currency'] = $this->data_cart['currency'];

        $this->setFormDataDimensionsCheckout();
    }
129932
final function onFormInitialized() {
		parent::onFormInitialized();
		$this->addClass('df-number');
		df_fe_init($this, __CLASS__);
		$this->setAfterElementHtml($this[self::LABEL_RIGHT]);
	}
927623
function formData(form) {
    var length = form.length;
    var data = {};
    var value;
    var el;
    var type;
    var name;

    var append = function (data, name, value) {
      if (data[name] === undefined) {
        data[name] = value;
      } else {
        if (typeof data[name] === 'string') {
          data[name] = [data[name]];
        }
        data[name].push(value);
      }
    };

    for (var i = 0; i < length; i++) {
      el = form[i];
      value = el.value;
      type = el.type;
      name = el.name;

      if (type === 'radio') {
        if (el.checked) {
          append(data, name, value);
        }
      } else if (type === 'checkbox') {
        if (data[name] === undefined) {
          data[name] = [];
        }
        if (el.checked) {
          append(data, name, value);
        }
      } else {
        append(data, name, value);
      }
    }

    return data;
  }
655618
def _init_data(self, data, obj, files):
        
        data = self.prepare(data)

        # Initialize sub-forms
        for name, subform in self._forms.items():
            obj_value = get_obj_value(obj, name)
            if inspect.isclass(subform):
                fclass = subform
            else:
                fclass = subform.__class__
            subform_prefix = '{prefix}{name}.'.format(
                prefix=self._prefix,
                name=name.lower()
            )
            subform = fclass(
                data,
                obj_value,
                files=files,
                locale=self._locale,
                tz=self._tz,
                prefix=subform_prefix,
                backref=getattr(subform, '_backref', None)
            )

            self._forms[name] = subform
            setattr(self, name, subform)
            self._input_data = self._input_data or subform._input_data

        # Initialize form-sets
        for name, formset in self._sets.items():
            sclass = formset.__class__
            objs = formset._objs or get_obj_value(obj, name)
            formset_name = '{prefix}{name}'.format(
                prefix=self._prefix,
                name=name.lower()
            )
            formset = sclass(
                form_class=formset._form_class,
                name=formset_name,
                data=data,
                objs=objs,
                files=files,
                locale=self._locale,
                tz=self._tz,
                create_new=formset._create_new,
                backref=formset._backref
            )
            self._sets[name] = formset
            setattr(self, name, formset)
            for _form in formset._forms:
                self._input_data = self._input_data or _form._input_data

        # Initialize fields
        for name, field in self._fields.items():
            subdata = data.getlist(self._prefix + name)
            subfiles = files.getlist(self._prefix + name)
            self._input_data = self._input_data or subdata or subfiles
            obj_value = get_obj_value(obj, name)
            was_deleted = self._prefix + name + '__deleted' in data
            if was_deleted:
                subdata = obj_value = subfiles = None
            field.load_data(subdata, obj_value, file_data=subfiles,
                            locale=self._locale, tz=self._tz)
            # delete field data
            if was_deleted:
                field._deleted = True
603920
protected function initData()
    {
        if ($this->data !== null) {
            return;
        }

        if ($this->value !== null) {
            $this->data = $this->value;
            return;
        }

        if ($this->model instanceof Model) {
            $data = ($this->model->hasProperty($this->attribute) || isset($this->model->{$this->attribute}))
                ? ArrayHelper::getValue($this->model, $this->attribute, [])
                : [];

            if (!is_array($data) && empty($data)) {
                return;
            }

            if (!($data instanceof \Traversable)) {
                $data = (array) $data;
            }

            foreach ($data as $index => $value) {
                $this->data[$index] = $value;
            }
        }
    }
1030422
def set_form_data(params, sep = '&')
      self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
      self.content_type = 'application/x-www-form-urlencoded'
    end
74233
protected function initForm()
    {
        $name = isset($this->options['name']) ? $this->options['name'] : '';
        if(empty($name)){
            $name = 'form_'.(count(self::$forms)+1);
        }
        unset($this->options['name']);

        $this->form = tao_helpers_form_FormFactory::getForm($name, $this->options);

        //add translate action in toolbar
        $actions = tao_helpers_form_FormFactory::getCommonActions();

        //add a hidden form element that states that it is an Instance Form.
        $instanceElt = tao_helpers_form_FormFactory::getElement('tao.forms.instance', 'Hidden');
        $instanceElt->setValue('1');
        $this->form->addElement($instanceElt, true);

        //add a token to protect against xsrf
        $tokenElt = tao_helpers_form_FormFactory::getElement('token', 'Token');
        $tokenElt->addValidator(new XsrfTokenValidator());
        $this->form->addElement($tokenElt, true);

        $this->form->setActions($actions, 'top');
        $this->form->setActions($actions, 'bottom');
    }
1265637
function init(form_id) {
        var form = document.forms[form_id];
        if (form === undefined) {
            throw new Error('Form with ID ' + form_id + ' not found in DOM!');
        }
        if (this._collection[form_id] !== undefined) {
            throw new Error('Form with ID ' + form_id + ' already initiated!');
        }
        this._collection[form_id] = new BunnyFormData(form);
        this._attachChangeAndDefaultFileEvent(form_id);
        this._attachRadioListChangeEvent(form_id);
        this._attachDOMChangeEvent(form_id);
    }
345587
private function _initialize()
    {
        if ($this->getInitialized()) {
            return;
        }

        $params = $this->getParameters();
        if ($params !== null) {
            foreach ($params as $param) {
                if ('in' == $param->getName()) {
                    $this->setInputEncoding($param->getValue());
                } else {
                    if ('out' == $param->getName()) {
                        $this->setOutputEncoding($param->getValue());
                    }
                }
            }
        }

        $this->setInitialized(true);
    }
1273731
private function setupInitialData()
	{
		// Get Params File
		$param = Configuration::getParam();

		// Application Title
		Yii::$app->config->set(Enum::APP_NAME, 'Starter Kit');
		// Application Default Backend Theme
		Yii::$app->config->set(Enum::APP_BACKEND_THEME, 'yeti');
		// Application Default Frontend Theme
		Yii::$app->config->set(Enum::APP_FRONTEND_THEME, 'readable');

		// Caching
		Yii::$app->config->set(Enum::CACHE_CLASS, DbCache::className());

		// Admin
		Yii::$app->config->set(Enum::ADMIN_INSTALL_ID, md5(uniqid('', TRUE)));

		// Basic
		Yii::$app->config->set(Enum::APP_TOUR, TRUE);

		// Yii2-User
		Yii::$app->config->set(Enum::USER_REGISTRATION, 1);
		Yii::$app->config->set(Enum::USER_PASSWORD_RESET_TOKEN_EXPIRE, 86400);
		Yii::$app->config->set(Enum::USER_FORGOT_PASSWORD, 1);
		Yii::$app->config->set(Enum::REMEMBER_ME_DURATION, 3600);
		Yii::$app->config->set(Enum::USER_LOGIN_TYPE, 2);

		// Mailer
		Yii::$app->config->set(Enum::MAILER_USE_TRANSPORT, $param['installer']['mail']['useTransport']);
		Yii::$app->config->set(Enum::MAILER_HOST, $param['installer']['mail']['transport']['host']);
		Yii::$app->config->set(Enum::MAILER_USERNAME, $param['installer']['mail']['transport']['username']);
		Yii::$app->config->set(Enum::MAILER_PASSWORD, $param['installer']['mail']['transport']['password']);
		Yii::$app->config->set(Enum::MAILER_PORT, $param['installer']['mail']['transport']['port']);
		Yii::$app->config->set(Enum::MAILER_ENCRYPTION, $param['installer']['mail']['transport']['encryption']);

		// Authentication Clients
		Yii::$app->config->set(Enum::GOOGLE_AUTH, NULL);
		Yii::$app->config->set(Enum::GOOGLE_CLIENT_ID, NULL);
		Yii::$app->config->set(Enum::GOOGLE_CLIENT_SECRET, NULL);

		Yii::$app->config->set(Enum::FACEBOOK_AUTH, NULL);
		Yii::$app->config->set(Enum::FACEBOOK_CLIENT_ID, NULL);
		Yii::$app->config->set(Enum::FACEBOOK_CLIENT_SECRET, NULL);

		Yii::$app->config->set(Enum::LINKED_IN_AUTH, NULL);
		Yii::$app->config->set(Enum::LINKED_IN_CLIENT_ID, NULL);
		Yii::$app->config->set(Enum::LINKED_IN_CLIENT_SECRET, NULL);

		Yii::$app->config->set(Enum::GITHUB_AUTH, NULL);
		Yii::$app->config->set(Enum::GITHUB_CLIENT_ID, NULL);
		Yii::$app->config->set(Enum::GITHUB_CLIENT_SECRET, NULL);

		Yii::$app->config->set(Enum::LIVE_AUTH, NULL);
		Yii::$app->config->set(Enum::LIVE_CLIENT_ID, NULL);
		Yii::$app->config->set(Enum::LIVE_CLIENT_SECRET, NULL);

		Yii::$app->config->set(Enum::TWITTER_AUTH, NULL);
		Yii::$app->config->set(Enum::TWITTER_CONSUMER_KEY, NULL);
		Yii::$app->config->set(Enum::TWITTER_CONSUMER_SECRET, NULL);
	}
1221174
function () {
            this.$Element.initWidget.call(this);
            this.setOptions();

            var newIndex = this.getSelectedIndexFromBindings();
            if (newIndex != null) {
                this._domElt.selectedIndex = newIndex;
            }
            this.initDisabledWidgetAttribute();

            this.__updateDataModel();
        }
158975
function() {
        var form = this.element.find('form:first');

        if (!form) {
            return;
        }

        this.fireEvent('submit', [form]);

        var options = {
            url: form.attr('action'),
            type: (form.attr('method') || 'post').toUpperCase()
        };

        if (window.FormData) {
            options.processData = false;
            options.contentType = false;
            options.data = new FormData(form[0]);
        } else {
            options.data = form.serialize();
        }

        this.requestData(options);
    }
863658
protected function initForm()
	{


		(isset($this->options['name'])) ? $name = $this->options['name'] : $name = '';
		if(empty($name)){
			$name = 'form_'.(count(self::$forms)+1);
		}
		unset($this->options['name']);

		$this->index = array_key_exists( 'index', $this->options ) ? $this->options['index'] : 1;

		$this->form = tao_helpers_form_FormFactory::getForm($name, $this->options);


	}
181812
def set_initial_state(self, kwargs):
        """"""

        self.main_window = kwargs.pop("main_window")

        try:
            statustext = kwargs.pop("statustext")

        except KeyError:
            statustext = ""

        try:
            self.total_lines = kwargs.pop("total_lines")
            self.statustext = statustext + \
                _("{nele} of {totalele} elements processed.")

        except KeyError:
            self.total_lines = None
            self.statustext = statustext + _("{nele} elements processed.")

        try:
            self.freq = kwargs.pop("freq")

        except KeyError:
            self.freq = 1000

        # The aborted attribute makes next() to raise StopIteration
        self.aborted = False

        # Line counter
        self.line = 0

        # Bindings
        self.main_window.Bind(wx.EVT_KEY_DOWN, self.on_key)
424353
public static function initialize()
    {
        switch($_SERVER['REQUEST_METHOD']) {
            case "POST":
                self::$_method = self::POST;
                break;
            case "GET":
                self::$_method = self::GET;
                break;
            case "PUT":
                self::$_method = self::PUT;
                break;
            case "DELETE":
                self::$_method = self::DELETE;
                break;
            default:
                self::$_method = self::HEAD;
        }
        self::$_data = array();
        self::_parseData($_GET);
        self::_parseData($_POST);
        
        if(
            isset($_SERVER['HTTPS']) &&
            $_SERVER['HTTPS'] !== null &&
            $_SERVER['HTTPS'] !== "off"
        ) {
            self::$_https = true;
        } else {
            self::$_https = false;
        }
        
        self::$_domain = (string) $_SERVER['HTTP_HOST'];
        self::$_file = (string) $_SERVER['SCRIPT_FILENAME'];
        if(isset($_SERVER['PATH_INFO'])) {
            self::$_pathInfo = (string) $_SERVER['PATH_INFO'];
        } else {
            self::$_pathInfo = "";
        }
    }
1047472
def initialize(self, data):
        
        for item in data:
            if hasattr(self, item):
                setattr(self, item, data[item])
546480
def get_initial(self, form, name):
        

        if hasattr(form, 'initial'):
            return form.initial.get(name, None)
        return None