Example #1
0
 public function addMergeTranslation(array $files, $locale = null, array $options = array())
 {
     foreach ($files as $file) {
         $translate = new Sitengine_Translate(Sitengine_Translate::AN_XLIFF, $file, $locale, $options);
         $this->_merge($translate->getAdapter());
     }
 }
Example #2
0
 public function checkUserModifyData(Sitengine_Status $status, Sitengine_Controller_Request_Http $request, Sitengine_Translate $translate)
 {
     require_once 'Sitengine/Validator.php';
     $name = 'name';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsNameRequired');
         $status->addHint($name, $message);
     } else {
         if (!Sitengine_Validator::emailAddress($val)) {
             $message = $translate->translate('hintsNameValidEmailRequired');
             $status->addHint($name, $message);
         }
     }
     $name = 'nickname';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsNicknameRequired');
         $status->addHint($name, $message);
     }
     $name = 'firstname';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsFirstnameRequired');
         $status->addHint($name, $message);
     }
     $name = 'lastname';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsLastnameRequired');
         $status->addHint($name, $message);
     }
     $name = 'password';
     $val = $request->getPost($name);
     if ($val != $request->getPost('passwordConfirm')) {
         $message = $translate->translate('hintsPasswordsDontMatch');
         $status->addHint($name, $message);
     }
     if ($val != '') {
         require_once 'Zend/Validate/StringLength.php';
         $validator = new Zend_Validate_StringLength($this->getPermiso()->getMinimalPasswordLength());
         $validator->setMessage($translate->translate('hintsPasswordTooShort'), Zend_Validate_StringLength::TOO_SHORT);
         if (!$validator->isValid($val)) {
             $messages = $validator->getMessages();
             $status->addHint($name, $messages);
         }
     }
     $name = 'country';
     if (Sitengine_Validator::nada($request->getPost($name), 'noneSelected')) {
         $message = $translate->translate('hintsCountryRequired');
         $status->addHint($name, $message);
     }
     $name = 'timezone';
     if (Sitengine_Validator::nada($request->getPost($name), 'noneSelected')) {
         $message = $translate->translate('hintsTimezoneRequired');
         #$status->addHint($name, $message);
     }
     $fileId = 'avatarOriginal';
     require_once 'Sitengine/Upload.php';
     $upload = new Sitengine_Upload($fileId);
     if ($upload->isFile()) {
         $messages = array();
         if (!preg_match('/(gif|jpg|jpeg)/i', $upload->getMime())) {
             $messages[] = $translate->translate('hintsAvatarOriginalFiletype');
         }
         if ($upload->getSize() > 1024 * 1024) {
             $messages[] = $translate->translate('hintsAvatarOriginalFilesize');
         }
         if (sizeof($messages)) {
             $status->addHint($fileId, $messages);
         }
     }
     return !$status->hasHints();
 }
Example #3
0
 protected function _getTranslateInstance()
 {
     require_once 'Sitengine/Translate.php';
     $translate = new Sitengine_Translate(Sitengine_Translate::AN_XML, $this->getEnv()->getIncludesDir() . '/Sitengine/Env/_Dictionary/global.xml', Sitengine_Env::LANGUAGE_EN);
     $en = array($this->getEnv()->getIncludesDir() . '/Sitengine/Env/_Dictionary/en.xml', $this->getEnv()->getIncludesDir() . '/Sitengine/Newsletter/Frontend/Subscriptions/_Dictionary/en.xml');
     $translate->addMergeTranslation($en, Sitengine_Env::LANGUAGE_EN);
     return $translate;
 }
Example #4
0
 protected function _getTranslateInstance()
 {
     require_once 'Sitengine/Translate.php';
     $translate = new Sitengine_Translate(Sitengine_Translate::AN_XML, $this->getEnv()->getIncludesDir() . '/Sitengine/Env/_Dictionary/global.xml', Sitengine_Env::LANGUAGE_EN);
     $en = array($this->getEnv()->getIncludesDir() . '/Sitengine/Env/_Dictionary/en.xml', $this->getEnv()->getIncludesDir() . '/Sitengine/Proto/Backend/Goodies/Shouldies/_Dictionary/en.xml', $this->getEnv()->getIncludesDir() . '/Sitengine/Proto/Backend/_Dictionary/en.xml');
     $translate->addMergeTranslation($en, Sitengine_Env::LANGUAGE_EN);
     return $translate;
 }
Example #5
0
 protected function _getTranslateInstance()
 {
     require_once 'Sitengine/Translate.php';
     $translate = new Sitengine_Translate(Sitengine_Translate::AN_XML, $this->getEnv()->getIncludesDir() . '/Sitengine/Env/_Dictionary/global.xml', Sitengine_Env::LANGUAGE_EN);
     $en = array($this->getEnv()->getIncludesDir() . '/Sitengine/Permiso/Login/_Dictionary/en.xml');
     $de = array($this->getEnv()->getIncludesDir() . '/Sitengine/Env/_Dictionary/global.xml', $this->getEnv()->getIncludesDir() . '/Sitengine/Permiso/Login/_Dictionary/de.xml');
     $translate->addMergeTranslation($en, Sitengine_Env::LANGUAGE_EN);
     $translate->addMergeTranslation($de, Sitengine_Env::LANGUAGE_DE);
     return $translate;
 }
Example #6
0
 public function getGlobalNavSection(Sitengine_Translate $translate, array $queries, $current, $selectorPrefix = '')
 {
     $selected = '';
     $items = array();
     $location = 'backendHome';
     $items[$queries[$location]] = '> ' . $translate->translate('labels' . ucfirst($location));
     $items['separator10'] = '----------------';
     $location = 'protoBackendGoodies';
     $items[$queries[$location]] = '> ' . $translate->translate('labels' . ucfirst($location));
     $selected = $current == 'protoBackendGoodies' ? $queries[$location] : $selected;
     $n = 'globalNav';
     require_once 'Sitengine/Form/Element.php';
     $e = new Sitengine_Form_Element('', $selected);
     $e->setScript('onchange="if(!this.options[this.selectedIndex].value.match(/^separator/)) { window.location=this.options[this.selectedIndex].value; }"');
     $e->setClass($selectorPrefix . 'Select');
     $e->setId($selectorPrefix . $n);
     return array('ITEMS' => $items, 'menu' => $e->getSelect($items));
 }
Example #7
0
 public static function removeCache()
 {
     self::$_cache = null;
 }