Example #1
0
        if (empty(Inji::$storage['IdnaConvert'])) {
            Inji::$storage['IdnaConvert'] = new \idna_convert(array('idn_version' => 2008));
        }
        return Inji::$storage['IdnaConvert']->decode($domain);
    }
}
if (file_exists('vendor/autoload.php')) {
    include_once 'vendor/autoload.php';
}
if (file_exists(App::$primary->path . '/vendor/autoload.php')) {
    include_once App::$primary->path . '/vendor/autoload.php';
}
Module::$cur = Module::resolveModule(App::$cur);
if (Module::$cur === null) {
    INJI_SYSTEM_ERROR('Module not found', true);
}
Controller::$cur = Module::$cur->findController();
if (Controller::$cur === null) {
    INJI_SYSTEM_ERROR('Controller not found', true);
}
if (!empty(App::$primary->config['autoloadModules'])) {
    foreach (App::$primary->config['autoloadModules'] as $module) {
        App::$cur->{$module};
    }
}
if (App::$primary !== App::$cur) {
    foreach (App::$cur->config['autoloadModules'] as $module) {
        App::$cur->{$module};
    }
}
Controller::$cur->run();
 /**
  * This method is used to return data after an ajax call was made.
  * When a asynchronious request is made to the shopping cart (ajax),
  * then you will first action the request and then use this function
  * to return some values.
  *
  * It can also be used without ajax, in wich case it will redirects back
  * to the last page.
  *
  * Note that you can set the ajax response class in the configuration file.
  *
  *
  * @param String $message
  * @param String $status
  * @param Form $form
  * @returns String (JSON)
  */
 public function setMessageAndReturn($message = "", $status = "", Form $form = null)
 {
     if ($message && $status) {
         $this->addMessage($message, $status);
     }
     //TODO: handle passing back multiple messages
     if (Director::is_ajax()) {
         $responseClass = EcommerceConfig::get("ShoppingCart", "response_class");
         $obj = new $responseClass();
         return $obj->ReturnCartData($this->getMessages());
     } else {
         //TODO: handle passing a message back to a form->sessionMessage
         $this->StoreMessagesInSession();
         if ($form) {
             //lets make sure that there is an order
             $this->currentOrder();
             //nowe we can (re)calculate the order
             $this->order->calculateOrderAttributes($force = false);
             $form->sessionMessage($message, $status);
             //let the form controller do the redirectback or whatever else is needed.
         } else {
             if (empty($_REQUEST["BackURL"])) {
                 Controller::curr()->redirectBack();
             } else {
                 Controller::cur()->redirect(urldecode($_REQUEST["BackURL"]));
             }
         }
         return;
     }
 }