protected function setUp() { $view = new \Aimeos\MW\View\Standard(); $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); $view->addHelper('encoder', $helper); $this->object = new \Aimeos\MW\View\Helper\Content\Standard($view, 'base/url'); }
/** * Creates the view object for the HTML client. * * @param \Aimeos\MW\Config\Iface $config Configuration object * @param array $templatePaths List of base path names with relative template paths as key/value pairs * @param string|null $locale Code of the current language or null for no translation * @return \Aimeos\MW\View\Iface View object */ public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) { $params = $fixed = array(); if ($locale !== null) { $params = Route::current()->parameters() + Input::all(); $fixed = $this->getFixedParams(); $i18n = app('\\Aimeos\\Shop\\Base\\I18n')->get(array($locale)); $translation = $i18n[$locale]; } else { $translation = new \Aimeos\MW\Translation\None('en'); } $view = new \Aimeos\MW\View\Standard($templatePaths); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance()); $view->addHelper('request', $helper); $helper = new \Aimeos\MW\View\Helper\Response\Laravel5($view); $view->addHelper('response', $helper); $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token()); $view->addHelper('csrf', $helper); return $view; }
protected static function createView(\Aimeos\MW\Config\Iface $config) { $tmplpaths = array_merge_recursive(self::getAimeos()->getCustomPaths('client/html'), self::getAimeos()->getCustomPaths('controller/jobs/templates')); $view = new \Aimeos\MW\View\Standard(); $trans = new \Aimeos\MW\Translation\None('de_DE'); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); $view->addHelper('date', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, array()); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\FormParam\Standard($view); $view->addHelper('formparam', $helper); $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); $view->addHelper('encoder', $helper); $helper = new \Aimeos\MW\View\Helper\Partial\Standard($view, $config, $tmplpaths); $view->addHelper('partial', $helper); return $view; }
/** * Creates the view object for the HTML client. * * @param \Aimeos\MW\Config\Iface $config Configuration object * @param array $templatePaths List of base path names with relative template paths as key/value pairs * @param string|null $locale Code of the current language or null for no translation * @return \Aimeos\MW\View\Iface View object */ public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) { $params = $fixed = array(); $request = $this->requestStack->getMasterRequest(); if ($locale !== null) { $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); $fixed = $this->getFixedParams(); $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); $translation = $i18n[$locale]; } else { $translation = new \Aimeos\MW\Translation\None('en'); } $view = new \Aimeos\MW\View\Standard($templatePaths); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); $view->addHelper('number', $helper); if ($request !== null) { $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); $view->addHelper('request', $helper); } $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); $view->addHelper('csrf', $helper); return $view; }
public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null) { if ($config === null) { $config = self::getContext($site)->getConfig(); } $view = new \Aimeos\MW\View\Standard(self::getTemplatePaths()); $trans = new \Aimeos\MW\Translation\None('de_DE'); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); $view->addHelper('date', $helper); $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin', 'client/html', 'controller/jsonadm')); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value'); $view->addHelper('csrf', $helper); $fcn = function () { return array('admin'); }; $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn); $view->addHelper('access', $helper); return $view; }
public function testTransformRelativeUrlFromConfig() { $view = new \Aimeos\MW\View\Standard(); $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); $view->addHelper('encoder', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, \TestHelper::getContext()->getConfig()); $view->addHelper('config', $helper); $this->object = new \Aimeos\MW\View\Helper\Content\Standard($view); $output = $this->object->transform('path/to/resource'); $this->assertEquals('/path/to/resource', $output); }
protected static function createView(\Aimeos\MW\Config\Iface $config) { $view = new \Aimeos\MW\View\Standard(self::getTemplatePaths()); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); $view->addHelper('number', $helper); return $view; }
public static function getView() { $view = new \Aimeos\MW\View\Standard(); $trans = new \Aimeos\MW\Translation\None('en'); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'baseurl'); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); $view->addHelper('date', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, self::getContext()->getConfig()); $view->addHelper('config', $helper); $helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, array()); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\FormParam\Standard($view); $view->addHelper('formparam', $helper); $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); $view->addHelper('encoder', $helper); return $view; }
public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null) { if ($config === null) { $config = self::getContext($site)->getConfig(); } $view = new \Aimeos\MW\View\Standard(self::getTemplatePaths()); $trans = new \Aimeos\MW\Translation\None('de_DE'); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); $view->addHelper('date', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $helper = new \Aimeos\MW\View\Helper\Request\Standard($view, 'body', '127.0.0.1'); $view->addHelper('request', $helper); $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value'); $view->addHelper('csrf', $helper); return $view; }
public static function getView() { $view = new \Aimeos\MW\View\Standard(self::getHtmlTemplatePaths()); $trans = new \Aimeos\MW\Translation\None('en'); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'baseurl'); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); $view->addHelper('date', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, self::getContext()->getConfig()); $view->addHelper('config', $helper); return $view; }
protected static function createView(\Aimeos\MW\Config\Iface $config) { $tmplpaths = self::getAimeos()->getCustomPaths('controller/jsonadm/templates'); $view = new \Aimeos\MW\View\Standard($tmplpaths); $trans = new \Aimeos\MW\Translation\None('de_DE'); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); $view->addHelper('date', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); return $view; }
/** * Creates the view object for the HTML client. * * @param \Aimeos\MW\Config\Iface $config Configuration object * @param \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder URL builder object * @param array $templatePaths List of base path names with relative template paths as key/value pairs * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object * @param string|null $locale Code of the current language or null for no translation * @return MW_View_Interface View object */ public static function getView(\Aimeos\MW\Config\Iface $config, \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder, array $templatePaths, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null, $locale = null) { $params = $fixed = array(); if ($request !== null && $locale !== null) { $params = $request->getArguments(); $fixed = self::getFixedParams($config, $request); $i18n = Base::getI18n(array($locale), $config->get('i18n', array())); $translation = $i18n[$locale]; } else { $translation = new \Aimeos\MW\Translation\None('en'); } $view = new \Aimeos\MW\View\Standard($templatePaths); // workaround for TYPO3 bug (UriBuilder is incomplete in CLI environment) if ($request !== null) { $helper = new \Aimeos\MW\View\Helper\Url\Typo3($view, $uriBuilder, $fixed); } else { $helper = new \Aimeos\MW\View\Helper\Url\None($view); } $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Formparam\Standard($view, array($uriBuilder->getArgumentPrefix())); $view->addHelper('formparam', $helper); $ip = $_SERVER['REMOTE_ADDR']; $target = $GLOBALS["TSFE"]->id; $body = @file_get_contents('php://input'); $files = is_array($_FILES) ? $_FILES : array(); $helper = new \Aimeos\MW\View\Helper\Request\Standard($view, $body, $ip, $target, $files); $view->addHelper('request', $helper); return $view; }
/** * Creates the view object for the HTML client. * * @param \Aimeos\MW\Config\Iface $config Configuration object * @param \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder URL builder object * @param array $templatePaths List of base path names with relative template paths as key/value pairs * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object * @param string|null $locale Code of the current language or null for no translation * @return MW_View_Interface View object */ public static function getView(\Aimeos\MW\Config\Iface $config, \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder, array $templatePaths, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null, $locale = null) { $params = $fixed = array(); if ($request !== null && $locale !== null) { $fixed = self::getFixedParams($config, $request); // required for reloading to the current page $params = $request->getArguments(); $params['target'] = $GLOBALS["TSFE"]->id; $i18n = Base::getI18n(array($locale), $config->get('i18n', array())); $translation = $i18n[$locale]; } else { $translation = new \Aimeos\MW\Translation\None('en'); } $view = new \Aimeos\MW\View\Standard(); // workaround for TYPO3 6.2 bug (UriBuilder is incomplete) if ($request !== null || \TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version() >= '7.0.0') { $helper = new \Aimeos\MW\View\Helper\Url\Typo3($view, $uriBuilder, $fixed); } else { $helper = new \Aimeos\MW\View\Helper\Url\None($view); } $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Partial\Standard($view, $config, $templatePaths); $view->addHelper('partial', $helper); $helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, $params); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\FormParam\Standard($view, array($uriBuilder->getArgumentPrefix())); $view->addHelper('formparam', $helper); $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); $view->addHelper('encoder', $helper); $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view); $view->addHelper('csrf', $helper); $body = @file_get_contents('php://input'); $helper = new \Aimeos\MW\View\Helper\Request\Standard($view, $body, $_SERVER['REMOTE_ADDR']); $view->addHelper('request', $helper); return $view; }
public function testUploadFileExceptionNoUploadFile() { $helper = $this->getMockBuilder('\\Aimeos\\MW\\View\\Helper\\Request\\Standard')->setMethods(array('getUploadedFiles'))->disableOriginalConstructor()->getMock(); $helper->expects($this->once())->method('getUploadedFiles')->will($this->returnValue(array())); $view = new \Aimeos\MW\View\Standard(); $view->addHelper('request', $helper); $this->context->setView($view); $params = new \stdClass(); $params->items = 'file.txt'; $params->site = $this->context->getLocale()->getSite()->getCode(); $this->setExpectedException('\\Aimeos\\Controller\\ExtJS\\Exception'); $this->object->uploadFile($params); }