コード例 #1
0
ファイル: TestHelper.php プロジェクト: arcavias/arcavias-core
 public static function getView($site = 'unittest', MW_Config_Interface $config = null)
 {
     if ($config === null) {
         $config = self::getContext($site)->getConfig();
     }
     $view = new MW_View_Default();
     $trans = new MW_Translation_None('de_DE');
     $helper = new MW_View_Helper_Translate_Default($view, $trans);
     $view->addHelper('translate', $helper);
     $helper = new MW_View_Helper_Url_Default($view, 'http://baseurl');
     $view->addHelper('url', $helper);
     $helper = new MW_View_Helper_Number_Default($view, '.', '');
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Date_Default($view, 'Y-m-d');
     $view->addHelper('date', $helper);
     $helper = new MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $helper = new MW_View_Helper_Parameter_Default($view, array());
     $view->addHelper('param', $helper);
     $helper = new MW_View_Helper_FormParam_Default($view);
     $view->addHelper('formparam', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     return $view;
 }
コード例 #2
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $view = new MW_View_Default();
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $this->_object = new MW_View_Helper_Media_Default($view);
 }
コード例 #3
0
ファイル: TestHelper.php プロジェクト: Bananamoon/aimeos-core
 protected static function _createView(MW_Config_Interface $config)
 {
     $tmplpaths = self::getArcavias()->getCustomPaths('client/html');
     $tmplpaths[dirname(__DIR__)] = array('layouts');
     $view = new MW_View_Default();
     $trans = new MW_Translation_None('de_DE');
     $helper = new MW_View_Helper_Translate_Default($view, $trans);
     $view->addHelper('translate', $helper);
     $helper = new MW_View_Helper_Url_Default($view, 'http://baseurl');
     $view->addHelper('url', $helper);
     $helper = new MW_View_Helper_Number_Default($view, '.', '');
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Date_Default($view, 'Y-m-d');
     $view->addHelper('date', $helper);
     $helper = new MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $helper = new MW_View_Helper_Parameter_Default($view, array());
     $view->addHelper('param', $helper);
     $helper = new MW_View_Helper_FormParam_Default($view);
     $view->addHelper('formparam', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new MW_View_Helper_Partial_Default($view, $config, $tmplpaths);
     $view->addHelper('partial', $helper);
     return $view;
 }
コード例 #4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $view = new MW_View_Default();
     $helper = new MW_View_Helper_Url_Default($view, '');
     $view->addHelper('url', $helper);
     $helper = new MW_View_Helper_Config_Default($view, TestHelper::getContext()->getConfig());
     $view->addHelper('config', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $this->_object = new MW_View_Helper_NavTree_Default($view);
 }
コード例 #5
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $view = new MW_View_Default();
     $helper = new MW_View_Helper_Translate_Default($view, new MW_Translation_None('en'));
     $view->addHelper('translate', $helper);
     $helper = new MW_View_Helper_Number_Default($view, ',', ' ');
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $this->_object = new MW_View_Helper_Price_Default($view);
 }
コード例 #6
0
 public function testTransformRelativeUrlFromConfig()
 {
     $view = new MW_View_Default();
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new MW_View_Helper_Config_Default($view, TestHelper::getContext()->getConfig());
     $view->addHelper('config', $helper);
     $this->_object = new MW_View_Helper_Content_Default($view);
     $output = $this->_object->transform('path/to/resource');
     $this->assertEquals('/path/to/resource', $output);
 }
コード例 #7
0
ファイル: TestHelper.php プロジェクト: swpierce/ext-download
 protected static function _createView(MW_Config_Interface $config)
 {
     $view = new MW_View_Default();
     $helper = new MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     return $view;
 }
コード例 #8
0
ファイル: TestHelper.php プロジェクト: arcavias/arcavias-core
 protected static function _createView(MW_Config_Interface $config)
 {
     $view = new MW_View_Default();
     $trans = new MW_Translation_None('de_DE');
     $helper = new MW_View_Helper_Translate_Default($view, $trans);
     $view->addHelper('translate', $helper);
     $helper = new MW_View_Helper_Url_Default($view, 'http://baseurl');
     $view->addHelper('url', $helper);
     $helper = new MW_View_Helper_Number_Default($view, '.', '');
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Date_Default($view, 'Y-m-d');
     $view->addHelper('date', $helper);
     $helper = new MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $helper = new MW_View_Helper_Parameter_Default($view, array());
     $view->addHelper('param', $helper);
     $helper = new MW_View_Helper_FormParam_Default($view);
     $view->addHelper('formparam', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     return $view;
 }
コード例 #9
0
ファイル: TestHelper.php プロジェクト: Bananamoon/aimeos-core
 public static function getView()
 {
     $view = new MW_View_Default();
     $trans = new MW_Translation_None('en');
     $helper = new MW_View_Helper_Translate_Default($view, $trans);
     $view->addHelper('translate', $helper);
     $helper = new MW_View_Helper_Url_Default($view, 'baseurl');
     $view->addHelper('url', $helper);
     $helper = new MW_View_Helper_Number_Default($view, '.', '');
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Date_Default($view, 'Y-m-d');
     $view->addHelper('date', $helper);
     $helper = new MW_View_Helper_Config_Default($view, self::getContext()->getConfig());
     $view->addHelper('config', $helper);
     $helper = new MW_View_Helper_Parameter_Default($view, array());
     $view->addHelper('param', $helper);
     $helper = new MW_View_Helper_FormParam_Default($view);
     $view->addHelper('formparam', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     return $view;
 }
コード例 #10
0
ファイル: Base.php プロジェクト: nos3/aimeos-typo3
 /**
  * Creates the view object for the HTML client.
  *
  * @param \MW_Config_Interface $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(\MW_Config_Interface $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 \MW_Translation_None('en');
     }
     $view = new \MW_View_Default();
     // workaround for TYPO3 6.2 bug (UriBuilder is incomplete)
     if ($request !== null || \TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version() >= '7.0.0') {
         $helper = new \MW_View_Helper_Url_Typo3($view, $uriBuilder, $fixed);
     } else {
         $helper = new \MW_View_Helper_Url_None($view);
     }
     $view->addHelper('url', $helper);
     $helper = new \MW_View_Helper_Translate_Default($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \MW_View_Helper_Partial_Default($view, $config, $templatePaths);
     $view->addHelper('partial', $helper);
     $helper = new \MW_View_Helper_Parameter_Default($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \MW_View_Helper_FormParam_Default($view, array($uriBuilder->getArgumentPrefix()));
     $view->addHelper('formparam', $helper);
     $helper = new \MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new \MW_View_Helper_Csrf_Default($view);
     $view->addHelper('csrf', $helper);
     $body = @file_get_contents('php://input');
     $helper = new \MW_View_Helper_Request_Default($view, $body, $_SERVER['REMOTE_ADDR']);
     $view->addHelper('request', $helper);
     return $view;
 }
コード例 #11
0
ファイル: View.php プロジェクト: nos3/aimeos-flow
 /**
  * Creates the view object for the HTML client.
  *
  * @param \MShop_Context_Item_Interface $context Context object
  * @param \TYPO3\Flow\Mvc\Routing\UriBuilder $uriBuilder URL builder object
  * @param array $templatePaths List of base path names with relative template paths as key/value pairs
  * @param \TYPO3\Flow\Mvc\RequestInterface|null $request Request object
  * @param string|null $langid Language ID
  * @return \MW_View_Interface View object
  */
 public function create(\MW_Config_Interface $config, \TYPO3\Flow\Mvc\Routing\UriBuilder $uriBuilder, array $templatePaths, \TYPO3\Flow\Mvc\RequestInterface $request = null, $langid = null)
 {
     $params = $fixed = array();
     if ($request !== null && $langid !== null) {
         $params = $request->getArguments();
         $fixed = $this->getFixedParams($request);
         // required for reloading to the current page
         // $params['target'] = $request->getArgument( '_route' );
         $i18n = $this->i18n->get(array($langid));
         $translation = $i18n[$langid];
     } else {
         $translation = new \MW_Translation_None('en');
     }
     $view = new \MW_View_Default();
     $helper = new \MW_View_Helper_Translate_Default($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \MW_View_Helper_Url_Flow($view, $uriBuilder, $fixed);
     $view->addHelper('url', $helper);
     $helper = new \MW_View_Helper_Partial_Default($view, $config, $templatePaths);
     $view->addHelper('partial', $helper);
     $helper = new \MW_View_Helper_Parameter_Default($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \MW_View_Helper_FormParam_Default($view, array());
     $view->addHelper('formparam', $helper);
     $helper = new \MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     if ($request !== null) {
         $helper = new \MW_View_Helper_Request_Flow($view, $request->getHttpRequest());
         $view->addHelper('request', $helper);
     }
     return $view;
 }
コード例 #12
0
ファイル: TestHelper.php プロジェクト: Bananamoon/aimeos-core
 public static function getView($site = 'unittest', MW_Config_Interface $config = null)
 {
     if ($config === null) {
         $config = self::getContext($site)->getConfig();
     }
     $view = new MW_View_Default();
     $trans = new MW_Translation_None('de_DE');
     $helper = new MW_View_Helper_Translate_Default($view, $trans);
     $view->addHelper('translate', $helper);
     $helper = new MW_View_Helper_Url_Default($view, 'http://baseurl');
     $view->addHelper('url', $helper);
     $helper = new MW_View_Helper_Number_Default($view, '.', '');
     $view->addHelper('number', $helper);
     $helper = new MW_View_Helper_Date_Default($view, 'Y-m-d');
     $view->addHelper('date', $helper);
     $helper = new MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $helper = new MW_View_Helper_Parameter_Default($view, array());
     $view->addHelper('param', $helper);
     $helper = new MW_View_Helper_FormParam_Default($view);
     $view->addHelper('formparam', $helper);
     $helper = new MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new MW_View_Helper_Partial_Default($view, $config, array(dirname(__DIR__) => array('layouts')));
     $view->addHelper('partial', $helper);
     $helper = new MW_View_Helper_Request_Default($view, 'body', '127.0.0.1');
     $view->addHelper('request', $helper);
     $helper = new MW_View_Helper_Csrf_Default($view, '_csrf_token', '_csrf_value');
     $view->addHelper('csrf', $helper);
     return $view;
 }
コード例 #13
0
ファイル: View.php プロジェクト: nos3/aimeos-symfony2
 /**
  * Creates the view object for the HTML client.
  *
  * @param \MW_Config_Interface $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 \MW_View_Interface View object
  */
 public function create(\MW_Config_Interface $config, array $templatePaths, $locale = null)
 {
     $params = $fixed = array();
     $request = $this->requestStack->getMasterRequest();
     if ($locale !== null) {
         $fixed = $this->getFixedParams();
         $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params');
         // required for reloading to the current page
         $params['target'] = $request->get('_route');
         $i18n = $this->container->get('aimeos_i18n')->get(array($locale));
         $translation = $i18n[$locale];
     } else {
         $translation = new \MW_Translation_None('en');
     }
     $view = new \MW_View_Default();
     $helper = new \MW_View_Helper_Translate_Default($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \MW_View_Helper_Url_Symfony2($view, $this->container->get('router'), $fixed);
     $view->addHelper('url', $helper);
     $helper = new \MW_View_Helper_Partial_Default($view, $config, $templatePaths);
     $view->addHelper('partial', $helper);
     $helper = new \MW_View_Helper_Parameter_Default($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \MW_View_Helper_FormParam_Default($view, array());
     $view->addHelper('formparam', $helper);
     $helper = new \MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     if ($request !== null) {
         $helper = new \MW_View_Helper_Request_Symfony2($view, $request);
         $view->addHelper('request', $helper);
     }
     $token = $this->container->get('security.csrf.token_manager')->getToken('_token');
     $helper = new \MW_View_Helper_Csrf_Default($view, '_token', $token->getValue());
     $view->addHelper('csrf', $helper);
     return $view;
 }
コード例 #14
0
ファイル: View.php プロジェクト: roginthomas/aimeos-laravel
 /**
  * Creates the view object for the HTML client.
  *
  * @param \MW_Config_Interface $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 \MW_View_Interface View object
  */
 public function create(\MW_Config_Interface $config, array $templatePaths, $locale = null)
 {
     $params = $fixed = array();
     if ($locale !== null) {
         $params = \Route::current()->parameters() + \Input::all();
         $params['target'] = \Route::currentRouteName();
         $fixed = $this->getFixedParams();
         $i18n = app('\\Aimeos\\Shop\\Base\\I18n')->get(array($locale));
         $translation = $i18n[$locale];
     } else {
         $translation = new \MW_Translation_None('en');
     }
     $view = new \MW_View_Default();
     $helper = new \MW_View_Helper_Translate_Default($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \MW_View_Helper_Url_Laravel5($view, app('url'), $fixed);
     $view->addHelper('url', $helper);
     $helper = new \MW_View_Helper_Partial_Default($view, $config, $templatePaths);
     $view->addHelper('partial', $helper);
     $helper = new \MW_View_Helper_Parameter_Default($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \MW_View_Helper_FormParam_Default($view, array());
     $view->addHelper('formparam', $helper);
     $helper = new \MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new \MW_View_Helper_Csrf_Default($view, '_token', csrf_token());
     $view->addHelper('csrf', $helper);
     return $view;
 }