function convertFromLocaleCurrency($toCurrency, $value, $applyRounding = true)
 {
     $locale = eZLocale::instance();
     $fromCurrency = $locale->currencyShortName();
     $retValue = $this->convert($fromCurrency, $toCurrency, $value, $applyRounding);
     return $retValue;
 }
Пример #2
0
 function getMeta($keyword)
 {
     $locale = eZLocale::instance();
     $siteURL = $this->siteIni->variable('SiteSettings', 'SiteURL');
     $metaData = $this->siteIni->variable('SiteSettings', 'MetaDataArray');
     return array('title' => sprintf("%s - %s", $keyword, $this->siteIni->variable('SiteSettings', 'SiteName')), 'description' => sprintf('Items on %s related to %s', $siteURL, $keyword), 'language' => $locale->httpLocaleCode(), 'authorName' => $metaData['author'], 'authorMail' => $this->siteIni->variable('MailSettings', 'AdminEmail'), 'siteURL' => $siteURL);
 }
 function locale()
 {
     if ( $this->Locale !== null )
         return $this->Locale;
     $this->Locale = eZLocale::instance( $this->LanguageCode );
     return $this->Locale;
 }
 function __construct($identifier)
 {
     $locale = eZLocale::instance();
     $format = OCCalendarData::FULLDAY_IDENTIFIER_FORMAT;
     $this->identifier = $identifier;
     $dateTime = DateTime::createFromFormat($format, $identifier, OCCalendarData::timezone());
     if (!$dateTime instanceof DateTime) {
         throw new Exception("{$identifier} in format '{$format}' is not a valid DateTime");
     }
     $dateTime->setTime(0, 0, 0);
     $this->day = $dateTime->format('j');
     $this->shortDayName = $locale->shortDayName($dateTime->format('w'));
     $this->longDayName = $locale->longDayName($dateTime->format('w'));
     $this->month = $dateTime->format('n');
     $this->longMonthName = $locale->longMonthName($this->month);
     $this->shortMonthName = $locale->shortMonthName($this->month);
     $this->year = $dateTime->format('Y');
     $this->urlSuffix = "/(day)/{$this->day}/(month)/{$this->month}/(year)/{$this->year}";
     $this->dayStartDateTime = clone $dateTime;
     $this->dayStartDateTime->setTime(0, 0, 0);
     $this->dayStartTimestamp = $this->dayStartDateTime->format('U');
     $today = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
     $tomorrow = mktime(0, 0, 0, date('n'), date('j') + 1, date('Y'));
     $this->isToday = $this->dayStartTimestamp == $today;
     $this->isTomorrow = $this->dayStartTimestamp == $tomorrow;
     $this->isInWeek = date('W', $this->dayStartTimestamp) == date('W', $today);
     $this->isInMonth = date('n', $this->dayStartTimestamp) == date('n', $today);
     $this->dayEndDateTime = clone $dateTime;
     $this->dayEndDateTime->setTime(23, 59, 59);
     $this->dayEndTimestamp = $this->dayEndDateTime->format('U');
     $this->container = array();
 }
 /**
  * Test for regression #13497:
  * attribute operator throws a PHP fatal error on a node without parent in a displayable language
  *
  * Situation:
  *  - siteaccess with one language (fre-FR) and ShowUntranslatedObjects disabled
  *  - parent content node in another language (eng-GB) with always available disabled
  *  - content node in the siteaccess' language (fre-FR)
  *  - fetch this fre-FR node from anywhere, and call attribute() on it
  *
  * Result:
  *  - Fatal error: Call to a member function attribute() on a non-object in
  *    kernel/classes/ezcontentobjecttreenode.php on line 4225
  *
  * Explanation: the error actually comes from the can_remove_location attribute
  **/
 public function testIssue13497()
 {
     // Create a folder in english only
     $folder = new ezpObject("folder", 2, 14, 1, 'eng-GB');
     $folder->setAlwaysAvailableLanguageID(false);
     $folder->name = "Parent for " . __FUNCTION__;
     $folder->publish();
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // Create an article in french only, as a subitem of the previously created folder
     $article = new ezpObject("article", $folder->attribute('main_node_id'), 14, 1, 'fre-FR');
     $article->title = "Object for " . __FUNCTION__;
     $article->short_description = "Description of test for " . __FUNCTION__;
     $article->publish();
     $articleNodeID = $article->attribute('main_node_id');
     // INi changes: set language to french only, untranslatedobjects disabled
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'fre-FR');
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('fre-FR'));
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ShowUntranslatedObjects', 'disabled');
     eZContentLanguage::expireCache();
     // This should crash
     eZContentObjectTreeNode::fetch($articleNodeID)->attribute('can_remove_location');
     ezpINIHelper::restoreINISettings();
     // re-expire cache for further tests
     eZContentLanguage::expireCache();
 }
 /**
  * Regression test for issue {@see #19174 http://issues.ez.no/19174}
  */
 public function testIssue19174()
 {
     $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
     // add a secondary language
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // create related objects
     $relatedObjectsIds = array($this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation());
     $xmlTextEn = "<embed href=\"ezobject://{$relatedObjectsIds[0]}\" /><link href=\"ezobject://{$relatedObjectsIds[1]}\">link</link>";
     $xmlTextFr = "<embed href=\"ezobject://{$relatedObjectsIds[2]}\" /><link href=\"ezobject://{$relatedObjectsIds[3]}\">link</link>";
     // Create an article in eng-GB, and embed related object one in the intro
     $article = new ezpObject('article', 2, 14, 1, 'eng-GB');
     $article->title = __METHOD__ . ' eng-GB';
     $article->intro = $xmlTextEn;
     $articleId = $article->publish();
     // Workaround as setting folder->name directly doesn't produce the expected result
     $article->addTranslation('fre-FR', array('title' => __METHOD__ . ' fre-FR', 'intro' => $xmlTextFr));
     $relatedObjects = eZContentObject::fetch($articleId)->relatedObjects(false, false, 0, false, array('AllRelations' => eZContentObject::RELATION_LINK | eZContentObject::RELATION_EMBED));
     self::assertEquals(4, count($relatedObjects));
     $expectedRelations = array_flip($relatedObjectsIds);
     foreach ($relatedObjects as $relatedObject) {
         if (isset($expectedRelations[$relatedObject->ID])) {
             unset($expectedRelations[$relatedObject->ID]);
         }
     }
     self::assertEquals(0, count($expectedRelations));
     $article->remove();
     $translation->removeThis();
     eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
 }
 function __construct($value)
 {
     if ($value instanceof eZCurrency) {
         $value = $value->value();
     }
     $this->Value = $value;
     $this->Locale = eZLocale::instance();
 }
Пример #8
0
    /**
     * @param bool $localeString
     * @return string
     */
    public static function countryISO3166Code( $localeString = false )
    {
        if ( $localeString === false )
        {
            $localeString = eZLocale::instance()->localeFullCode();
        }

        $isoCodes = self::isoCodes( $localeString );
        return $isoCodes[1];
    }
Пример #9
0
 /**
  * Creates a new date object with default locale, if $date is not supplied
  * the current date is used.
  *
  * @note this uses the current Timezone
  *
  * @param int $date
  */
 function __construct($date = false)
 {
     $dt = new DateTime();
     if ($date !== false) {
         $dt->setTimestamp($date);
     }
     $dt->setTime(0, 0, 0);
     $this->Date = $dt->getTimestamp();
     $this->Locale = eZLocale::instance();
     $this->IsValid = $date !== null;
 }
 /**
  * i18n
  * Provides all i18n strings for use by TinyMCE and other javascript dialogs.
  * 
  * @static
  * @param array $args
  * @param string $fileExtension
  * @return string returns json string with translation data
  */
 public static function i18n($args, $fileExtension)
 {
     $lang = '-en';
     $locale = eZLocale::instance();
     if ($args && $args[0]) {
         $lang = $args[0];
     }
     $i18nArray = array($lang => array('soextra' => array('font_size' => ezi18n('design/standard/soextra', "Font size"), 'font_class' => ezi18n('design/standard/soextra', "Font style"), 'class' => ezi18n('design/standard/soextra', "Element style"), 'remove_tag' => ezi18n('design/standard/soextra', 'Remove &quot;%tag&quot; tag', null, array('%tag' => '<tag>')), 'remove_tag_keep_contents' => ezi18n('design/standard/soextra', 'Remove &quot;%tag&quot; tag (keep contents)', null, array('%tag' => '<tag>')), 'cursor_before' => ezi18n('design/standard/soextra', 'Place cursor before &quot;%tag&quot;', null, array('%tag' => '<tag>')), 'cursor_after' => ezi18n('design/standard/soextra', 'Place cursor after &quot;%tag&quot;', null, array('%tag' => '<tag>')))));
     $i18nString = json_encode($i18nArray);
     return 'tinyMCE.addI18n( ' . $i18nString . ' );';
 }
Пример #11
0
 /**
  * Executes the operators
  *
  * @param eZTemplate $tpl
  * @param string $operatorName
  * @param array $operatorParameters
  * @param string $rootNamespace
  * @param string $currentNamespace
  * @param mixed $operatorValue
  * @param array $namedParameters
  */
 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'opengraph':
             $operatorValue = $this->generateOpenGraphTags($namedParameters['nodeid']);
             break;
         case 'language_code':
             $operatorValue = eZLocale::instance()->httpLocaleCode();
             break;
     }
 }
Пример #12
0
 /**
  * i18n
  * Provides all i18n strings for use by TinyMCE and other javascript dialogs.
  *
  * @param array $args
  * @param string $fileExtension
  * @return string returns json string with translation data
  */
 public static function i18n($args, $fileExtension)
 {
     $lang = '-en';
     $locale = eZLocale::instance();
     if ($args && $args[0]) {
         $lang = $args[0];
     }
     $i18nArray = array($lang => array('common' => array('edit_confirm' => ezpI18n::tr('design/standard/ezoe', "Do you want to use the WYSIWYG mode for this textarea?"), 'apply' => ezpI18n::tr('design/standard/ezoe', "Apply"), 'insert' => ezpI18n::tr('design/standard/ezoe', "Insert"), 'update' => ezpI18n::tr('design/standard/ezoe', "Update"), 'cancel' => ezpI18n::tr('design/standard/ezoe', "Cancel"), 'close' => ezpI18n::tr('design/standard/ezoe', "Close"), 'browse' => ezpI18n::tr('design/standard/ezoe', "Browse"), 'class_name' => ezpI18n::tr('design/standard/ezoe', "Class"), 'not_set' => ezpI18n::tr('design/standard/ezoe', "-- Not set --"), 'clipboard_msg' => ezpI18n::tr('design/standard/ezoe', "Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?"), 'clipboard_no_support' => ezpI18n::tr('design/standard/ezoe', "Currently not supported by your browser, use keyboard shortcuts instead."), 'popup_blocked' => ezpI18n::tr('design/standard/ezoe', "Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool."), 'invalid_data' => ezpI18n::tr('design/standard/ezoe', "Error: Invalid values entered, these are marked in red."), 'more_colors' => ezpI18n::tr('design/standard/ezoe', "More colors")), 'validator_dlg' => array('required' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; is required and must have a value', null, array('%label' => '<label>')), 'number' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be a valid number', null, array('%label' => '<label>')), 'int' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be a valid integer number', null, array('%label' => '<label>')), 'url' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be a valid absolute url address', null, array('%label' => '<label>')), 'email' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be a valid email address', null, array('%label' => '<label>')), 'size' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be a valid css size/unit value', null, array('%label' => '<label>')), 'html_id' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be a valid html element id', null, array('%label' => '<label>')), 'min' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be higher then %min', null, array('%label' => '<label>', '%min' => '<min>')), 'max' => ezpI18n::tr('design/standard/ezoe/validator', '&quot;%label&quot; must be lower then %max', null, array('%label' => '<label>', '%max' => '<max>'))), 'contextmenu' => array('align' => ezpI18n::tr('design/standard/ezoe', "Alignment"), 'left' => ezpI18n::tr('design/standard/ezoe', "Left"), 'center' => ezpI18n::tr('design/standard/ezoe', "Center"), 'right' => ezpI18n::tr('design/standard/ezoe', "Right"), 'full' => ezpI18n::tr('design/standard/ezoe', "Full")), 'insertdatetime' => array('date_fmt' => ezpI18n::tr('design/standard/ezoe', "%Y-%m-%d"), 'time_fmt' => ezpI18n::tr('design/standard/ezoe', "%H:%M:%S"), 'insertdate_desc' => ezpI18n::tr('design/standard/ezoe', "Insert date"), 'inserttime_desc' => ezpI18n::tr('design/standard/ezoe', "Insert time"), 'months_long' => implode(',', $locale->LongMonthNames), 'months_short' => implode(',', $locale->ShortMonthNames), 'day_long' => implode(',', $locale->LongDayNames) . ',' . $locale->longDayName(0), 'day_short' => implode(',', $locale->ShortDayNames) . ',' . $locale->shortDayName(0)), 'print' => array('print_desc' => ezpI18n::tr('design/standard/ezoe', "Print")), 'preview' => array('preview_desc' => ezpI18n::tr('design/standard/ezoe', "Preview")), 'directionality' => array('ltr_desc' => ezpI18n::tr('design/standard/ezoe', "Direction left to right"), 'rtl_desc' => ezpI18n::tr('design/standard/ezoe', "Direction right to left")), 'save' => array('save_desc' => ezpI18n::tr('design/standard/ezoe', "Save"), 'cancel_desc' => ezpI18n::tr('design/standard/ezoe', "Cancel all changes")), 'nonbreaking' => array('nonbreaking_desc' => ezpI18n::tr('design/standard/ezoe', "Insert non-breaking space character")), 'iespell' => array('iespell_desc' => ezpI18n::tr('design/standard/ezoe', "Run spell checking"), 'download' => ezpI18n::tr('design/standard/ezoe', "ieSpell not detected. Do you want to install it now?")), 'advhr' => array('advhr_desc' => ezpI18n::tr('design/standard/ezoe', "Horizontale rule")), 'emotions' => array('emotions_desc' => ezpI18n::tr('design/standard/ezoe', "Emotions")), 'emotions_dlg' => array('title' => ezpI18n::tr('design/standard/ezoe', "Insert emotion"), 'desc' => ezpI18n::tr('design/standard/ezoe', "Emotions"), 'cool' => ezpI18n::tr('design/standard/ezoe', "Cool"), 'cry' => ezpI18n::tr('design/standard/ezoe', "Cry"), 'embarassed' => ezpI18n::tr('design/standard/ezoe', "Embarassed"), 'foot_in_mouth' => ezpI18n::tr('design/standard/ezoe', "Foot in mouth"), 'frown' => ezpI18n::tr('design/standard/ezoe', "Frown"), 'innocent' => ezpI18n::tr('design/standard/ezoe', "Innocent"), 'kiss' => ezpI18n::tr('design/standard/ezoe', "Kiss"), 'laughing' => ezpI18n::tr('design/standard/ezoe', "Laughing"), 'money_mouth' => ezpI18n::tr('design/standard/ezoe', "Money mouth"), 'sealed' => ezpI18n::tr('design/standard/ezoe', "Sealed"), 'smile' => ezpI18n::tr('design/standard/ezoe', "Smile"), 'surprised' => ezpI18n::tr('design/standard/ezoe', "Surprised"), 'tongue_out' => ezpI18n::tr('design/standard/ezoe', "Tongue out"), 'undecided' => ezpI18n::tr('design/standard/ezoe', "Undecided"), 'wink' => ezpI18n::tr('design/standard/ezoe', "Wink"), 'usage' => ezpI18n::tr('design/standard/ezoe', "Use left and right arrows to navigate."), 'yell' => ezpI18n::tr('design/standard/ezoe', "Yell")), 'searchreplace' => array('search_desc' => ezpI18n::tr('design/standard/ezoe', "Find"), 'replace_desc' => ezpI18n::tr('design/standard/ezoe', "Find/Replace")), 'paste' => array('paste_text_desc' => ezpI18n::tr('design/standard/ezoe', "Paste as Plain Text"), 'paste_word_desc' => ezpI18n::tr('design/standard/ezoe', "Paste from Word"), 'selectall_desc' => ezpI18n::tr('design/standard/ezoe', "Select All"), 'plaintext_mode_sticky' => ezpI18n::tr('design/standard/ezoe', "Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode."), 'plaintext_mode' => ezpI18n::tr('design/standard/ezoe', "Paste is now in plain text mode. Click again to toggle back to regular paste mode.")), 'paste_dlg' => array('text_title' => ezpI18n::tr('design/standard/ezoe', "Use CTRL+V on your keyboard to paste the text into the window."), 'text_linebreaks' => ezpI18n::tr('design/standard/ezoe', "Keep linebreaks"), 'word_title' => ezpI18n::tr('design/standard/ezoe', "Use CTRL+V on your keyboard to paste the text into the window.")), 'table' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Inserts a new table"), 'row_before_desc' => ezpI18n::tr('design/standard/ezoe', "Insert row before"), 'row_after_desc' => ezpI18n::tr('design/standard/ezoe', "Insert row after"), 'delete_row_desc' => ezpI18n::tr('design/standard/ezoe', "Delete row"), 'col_before_desc' => ezpI18n::tr('design/standard/ezoe', "Insert column before"), 'col_after_desc' => ezpI18n::tr('design/standard/ezoe', "Insert column after"), 'delete_col_desc' => ezpI18n::tr('design/standard/ezoe', "Remove column"), 'split_cells_desc' => ezpI18n::tr('design/standard/ezoe', "Split merged table cells"), 'merge_cells_desc' => ezpI18n::tr('design/standard/ezoe', "Merge table cells"), 'row_desc' => ezpI18n::tr('design/standard/ezoe', "Table row properties"), 'cell_desc' => ezpI18n::tr('design/standard/ezoe', "Table cell properties"), 'props_desc' => ezpI18n::tr('design/standard/ezoe', "Table properties"), 'paste_row_before_desc' => ezpI18n::tr('design/standard/ezoe', "Paste table row before"), 'paste_row_after_desc' => ezpI18n::tr('design/standard/ezoe', "Paste table row after"), 'cut_row_desc' => ezpI18n::tr('design/standard/ezoe', "Cut table row"), 'copy_row_desc' => ezpI18n::tr('design/standard/ezoe', "Copy table row"), 'del' => ezpI18n::tr('design/standard/ezoe', "Delete table"), 'row' => ezpI18n::tr('design/standard/ezoe', "Row"), 'col' => ezpI18n::tr('design/standard/ezoe', "Column"), 'rows' => ezpI18n::tr('design/standard/ezoe', "Rows"), 'cols' => ezpI18n::tr('design/standard/ezoe', "Columns"), 'cell' => ezpI18n::tr('design/standard/ezoe', "Cell")), 'autosave' => array('unload_msg' => ezpI18n::tr('design/standard/ezoe', "The changes you made will be lost if you navigate away from this page.")), 'fullscreen' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Toggle fullscreen mode")), 'media' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Insert / edit embedded media"), 'edit' => ezpI18n::tr('design/standard/ezoe', "Edit embedded media")), 'fullpage' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Document properties")), 'template' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Insert predefined template content")), 'visualchars' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Visual control characters on/off.")), 'spellchecker' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Toggle spellchecker"), 'menu' => ezpI18n::tr('design/standard/ezoe', "Spellchecker settings"), 'ignore_word' => ezpI18n::tr('design/standard/ezoe', "Ignore word"), 'ignore_words' => ezpI18n::tr('design/standard/ezoe', "Ignore all"), 'langs' => ezpI18n::tr('design/standard/ezoe', "Languages"), 'wait' => ezpI18n::tr('design/standard/ezoe', "Please wait..."), 'sug' => ezpI18n::tr('design/standard/ezoe', "Suggestions"), 'no_sug' => ezpI18n::tr('design/standard/ezoe', "No suggestions"), 'no_mpell' => ezpI18n::tr('design/standard/ezoe', "No misspellings found.")), 'pagebreak' => array('desc' => ezpI18n::tr('design/standard/ezoe', "Insert page break.")), 'advanced' => array('style_select' => ezpI18n::tr('design/standard/ezoe', "Styles"), 'block' => ezpI18n::tr('design/standard/ezoe', "Format"), 'paragraph' => ezpI18n::tr('design/standard/ezoe', "Paragraph"), 'div' => ezpI18n::tr('design/standard/ezoe', "Div"), 'pre' => ezpI18n::tr('design/standard/ezoe', "Literal"), 'h1' => ezpI18n::tr('design/standard/ezoe', "Heading 1"), 'h2' => ezpI18n::tr('design/standard/ezoe', "Heading 2"), 'h3' => ezpI18n::tr('design/standard/ezoe', "Heading 3"), 'h4' => ezpI18n::tr('design/standard/ezoe', "Heading 4"), 'h5' => ezpI18n::tr('design/standard/ezoe', "Heading 5"), 'h6' => ezpI18n::tr('design/standard/ezoe', "Heading 6"), 'code' => ezpI18n::tr('design/standard/ezoe', "Code"), 'samp' => ezpI18n::tr('design/standard/ezoe', "Code sample"), 'dt' => ezpI18n::tr('design/standard/ezoe', "Definition term"), 'dd' => ezpI18n::tr('design/standard/ezoe', "Definition description"), 'bold_desc' => ezpI18n::tr('design/standard/ezoe', "Bold (Ctrl+B)"), 'italic_desc' => ezpI18n::tr('design/standard/ezoe', "Italic (Ctrl+I)"), 'underline_desc' => ezpI18n::tr('design/standard/ezoe', "Underline (Ctrl+U)"), 'striketrough_desc' => ezpI18n::tr('design/standard/ezoe', "Strikethrough"), 'justifyleft_desc' => ezpI18n::tr('design/standard/ezoe', "Align left"), 'justifycenter_desc' => ezpI18n::tr('design/standard/ezoe', "Align center"), 'justifyright_desc' => ezpI18n::tr('design/standard/ezoe', "Align right"), 'justifyfull_desc' => ezpI18n::tr('design/standard/ezoe', "Align full"), 'bullist_desc' => ezpI18n::tr('design/standard/ezoe', "Unordered list"), 'numlist_desc' => ezpI18n::tr('design/standard/ezoe', "Ordered list"), 'outdent_desc' => ezpI18n::tr('design/standard/ezoe', "Outdent"), 'indent_desc' => ezpI18n::tr('design/standard/ezoe', "Indent"), 'undo_desc' => ezpI18n::tr('design/standard/ezoe', "Undo (Ctrl+Z)"), 'redo_desc' => ezpI18n::tr('design/standard/ezoe', "Redo (Ctrl+Y)"), 'link_desc' => ezpI18n::tr('design/standard/ezoe', "Insert/edit link"), 'unlink_desc' => ezpI18n::tr('design/standard/ezoe', "Unlink"), 'image_desc' => ezpI18n::tr('design/standard/ezoe', "Insert/edit image"), 'object_desc' => ezpI18n::tr('design/standard/ezoe', "Insert/edit object"), 'file_desc' => ezpI18n::tr('design/standard/ezoe', "Insert/edit file"), 'custom_desc' => ezpI18n::tr('design/standard/ezoe', "Insert custom tag"), 'literal_desc' => ezpI18n::tr('design/standard/ezoe', "Insert literal text"), 'pagebreak_desc' => ezpI18n::tr('design/standard/ezoe', "Insert pagebreak"), 'disable_desc' => ezpI18n::tr('design/standard/content/datatype', "Disable editor"), 'store_desc' => ezpI18n::tr('design/standard/content/edit', "Store draft"), 'publish_desc' => ezpI18n::tr('design/standard/content/edit', "Send for publishing"), 'discard_desc' => ezpI18n::tr('design/standard/content/edit', "Discard"), 'cleanup_desc' => ezpI18n::tr('design/standard/ezoe', "Cleanup messy code"), 'code_desc' => ezpI18n::tr('design/standard/ezoe', "Edit HTML Source"), 'sub_desc' => ezpI18n::tr('design/standard/ezoe', "Subscript"), 'sup_desc' => ezpI18n::tr('design/standard/ezoe', "Superscript"), 'hr_desc' => ezpI18n::tr('design/standard/ezoe', "Insert horizontal ruler"), 'removeformat_desc' => ezpI18n::tr('design/standard/ezoe', "Remove formatting"), 'custom1_desc' => ezpI18n::tr('design/standard/ezoe', "Your custom description here"), 'charmap_desc' => ezpI18n::tr('design/standard/ezoe', "Insert special character"), 'visualaid_desc' => ezpI18n::tr('design/standard/ezoe', "Toggle guidelines/invisible elements"), 'anchor_desc' => ezpI18n::tr('design/standard/ezoe', "Insert/edit anchor"), 'cut_desc' => ezpI18n::tr('design/standard/ezoe', "Cut"), 'copy_desc' => ezpI18n::tr('design/standard/ezoe', "Copy"), 'paste_desc' => ezpI18n::tr('design/standard/ezoe', "Paste"), 'image_props_desc' => ezpI18n::tr('design/standard/ezoe', "Image properties"), 'newdocument_desc' => ezpI18n::tr('design/standard/ezoe', "New document"), 'help_desc' => ezpI18n::tr('design/standard/ezoe', "Help"), 'clipboard_msg' => ezpI18n::tr('design/standard/ezoe', "Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?"), 'path' => ezpI18n::tr('design/standard/ezoe', "Path"), 'newdocument' => ezpI18n::tr('design/standard/ezoe', "Are you sure you want clear all contents?"), 'toolbar_focus' => ezpI18n::tr('design/standard/ezoe', "Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X"), 'next' => ezpI18n::tr('design/standard/ezoe', "Next"), 'previous' => ezpI18n::tr('design/standard/ezoe', "Previous"), 'select' => ezpI18n::tr('design/standard/ezoe', "Select"), 'type' => ezpI18n::tr('design/standard/ezoe', "Type")), 'advanced_dlg' => array('about_general' => ezpI18n::tr('design/standard/ezoe', "About"), 'about_help' => ezpI18n::tr('design/standard/ezoe', "Help"), 'about_license' => ezpI18n::tr('design/standard/ezoe', "License"), 'about_plugins' => ezpI18n::tr('design/standard/ezoe', "Plugins"), 'about_plugin' => ezpI18n::tr('design/standard/ezoe', "Plugin"), 'about_author' => ezpI18n::tr('design/standard/ezoe', "Author"), 'about_version' => ezpI18n::tr('design/standard/ezoe', "Version"), 'about_loaded' => ezpI18n::tr('design/standard/ezoe', "Loaded plugins"), 'code_title' => ezpI18n::tr('design/standard/ezoe', "HTML Source Editor"), 'code_wordwrap' => ezpI18n::tr('design/standard/ezoe', "Word wrap"), 'colorpicker_title' => ezpI18n::tr('design/standard/ezoe', "Select a color"), 'colorpicker_picker_tab' => ezpI18n::tr('design/standard/ezoe', "Picker"), 'colorpicker_picker_title' => ezpI18n::tr('design/standard/ezoe', "Color picker"), 'colorpicker_palette_tab' => ezpI18n::tr('design/standard/ezoe', "Palette"), 'colorpicker_palette_title' => ezpI18n::tr('design/standard/ezoe', "Palette colors"), 'colorpicker_named_tab' => ezpI18n::tr('design/standard/ezoe', "Named"), 'colorpicker_named_title' => ezpI18n::tr('design/standard/ezoe', "Named colors"), 'colorpicker_color' => ezpI18n::tr('design/standard/ezoe', "Color"), 'colorpicker_name' => ezpI18n::tr('design/standard/ezoe', "Name"), 'charmap_usage' => ezpI18n::tr('design/standard/ezoe', "Use left and right arrows to navigate."), 'charmap_title' => ezpI18n::tr('design/standard/ezoe', "Select special character")), 'ez' => array('root_node_name' => ezpI18n::tr('kernel/content', 'Top Level Nodes'), 'empty_search_result' => ezpI18n::tr('design/standard/content/search', 'No results were found when searching for &quot;%1&quot;', null, array('%1' => '<search_string>')), 'empty_bookmarks_result' => ezpI18n::tr('design/standard/content/view', 'You have no bookmarks')), 'searchreplace_dlg' => array('searchnext_desc' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Find again"), 'notfound' => ezpI18n::tr('design/standard/ezoe/searchreplace', "The search has been completed. The search string could not be found."), 'search_title' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Find"), 'replace_title' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Find/Replace"), 'allreplaced' => ezpI18n::tr('design/standard/ezoe/searchreplace', "All occurrences of the search string were replaced."), 'findwhat' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Find what"), 'replacewith' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Replace with"), 'direction' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Direction"), 'up' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Up"), 'down' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Down"), 'mcase' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Match case"), 'findnext' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Find next"), 'replace' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Replace"), 'replaceall' => ezpI18n::tr('design/standard/ezoe/searchreplace', "Replace all"))));
     $i18nString = json_encode($i18nArray);
     return 'tinyMCE.addI18n( ' . $i18nString . ' );';
 }
Пример #13
0
 function eZDate($date = false)
 {
     if ($date === false) {
         $date = mktime(0, 0, 0);
     } else {
         $arr = getdate($date);
         $date = mktime(0, 0, 0, $arr['mon'], $arr['mday'], $arr['year']);
     }
     $this->Date = $date;
     $this->Locale = eZLocale::instance();
     $this->IsValid = true;
 }
Пример #14
0
 static function fetchTranslatedNames( &$countries )
 {
     $locale = eZLocale::instance();
     $translatedCountryNames = $locale->translatedCountryNames();
     foreach ( array_keys( $countries ) as $countryKey )
     {
         $translatedName = isset( $translatedCountryNames[$countryKey] ) ? $translatedCountryNames[$countryKey] : false;
         if ( $translatedName )
             $countries[$countryKey]['Name'] = $translatedName;
     }
     usort( $countries, array( 'eZCountryType', 'compareCountryNames' ) );
 }
Пример #15
0
 function createRedirectionUrl($process)
 {
     //__DEBUG__
     $this->logger->writeTimedString("createRedirectionUrl");
     //___end____
     $paypalINI = eZINI::instance('paypal.ini');
     $paypalServer = $paypalINI->variable('ServerSettings', 'ServerName');
     $requestURI = $paypalINI->variable('ServerSettings', 'RequestURI');
     $business = urlencode($paypalINI->variable('PaypalSettings', 'Business'));
     $processParams = $process->attribute('parameter_list');
     $orderID = $processParams['order_id'];
     $indexDir = eZSys::indexDir();
     $localHost = eZSys::serverURL();
     $localURI = eZSys::serverVariable('REQUEST_URI');
     $order = eZOrder::fetch($orderID);
     $amount = urlencode($order->attribute('total_inc_vat'));
     $currency = urlencode($order->currencyCode());
     //        include_once( 'lib/ezlocale/classes/ezlocale.php' );
     $locale = eZLocale::instance();
     $countryCode = urlencode($locale->countryCode());
     $maxDescLen = $paypalINI->variable('PaypalSettings', 'MaxDescriptionLength');
     $itemName = urlencode($this->createShortDescription($order, $maxDescLen));
     $accountInfo = $order->attribute('account_information');
     $first_name = urlencode($accountInfo['first_name']);
     $last_name = urlencode($accountInfo['last_name']);
     $street = urlencode($accountInfo['street2']);
     $zip = urlencode($accountInfo['zip']);
     $state = urlencode($accountInfo['state']);
     $place = urlencode($accountInfo['place']);
     $image_url = "{$localHost}" . urlencode($paypalINI->variable('PaypalSettings', 'LogoURI'));
     $background = urlencode($paypalINI->variable('PaypalSettings', 'BackgroundColor'));
     $pageStyle = urlencode($paypalINI->variable('PaypalSettings', 'PageStyle'));
     $noNote = urlencode($paypalINI->variable('PaypalSettings', 'NoNote'));
     $noteLabel = $noNote == 1 ? '' : urlencode($paypalINI->variable('PaypalSettings', 'NoteLabel'));
     $noShipping = 1;
     $url = $paypalServer . $requestURI . "?cmd=_ext-enter" . "&redirect_cmd=_xclick" . "&business={$business}" . "&item_name={$itemName}" . "&custom={$orderID}" . "&amount={$amount}" . "&currency_code={$currency}" . "&first_name={$first_name}" . "&last_name={$last_name}" . "&address1={$street}" . "&zip={$zip}" . "&state={$state}" . "&city={$place}" . "&image_url={$image_url}" . "&cs={$background}" . "&page_style={$pageStyle}" . "&no_shipping={$noShipping}" . "&cn={$noteLabel}" . "&no_note={$noNote}" . "&lc={$countryCode}" . "&notify_url={$localHost}" . $indexDir . "/paypal/notify_url/" . "&return={$localHost}" . $indexDir . "/shop/checkout/" . "&cancel_return={$localHost}" . $indexDir . "/shop/basket/";
     //__DEBUG__
     $this->logger->writeTimedString("business       = {$business}");
     $this->logger->writeTimedString("item_name      = {$itemName}");
     $this->logger->writeTimedString("custom         = {$orderID}");
     $this->logger->writeTimedString("no_shipping    = {$noShipping}");
     $this->logger->writeTimedString("localHost      = {$localHost}");
     $this->logger->writeTimedString("amount         = {$amount}");
     $this->logger->writeTimedString("currency_code  = {$currency}");
     $this->logger->writeTimedString("notify_url     = {$localHost}" . $indexDir . "/paypal/notify_url/");
     $this->logger->writeTimedString("return         = {$localHost}" . $indexDir . "/shop/checkout/");
     $this->logger->writeTimedString("cancel_return  = {$localHost}" . $indexDir . "/shop/basket/");
     //___end____
     return $url;
 }
Пример #16
0
 function number($number, $is_integer)
 {
     $locale = eZLocale::instance();
     if ($is_integer && is_numeric($number) && (int) $number == $number) {
         $neg = $number < 0;
         $num = $neg ? -$number : $number;
         $text = number_format($num, 0, '', $locale->thousandsSeparator());
         $text = ($neg ? $locale->negativeSymbol() : $locale->positiveSymbol()) . $text;
         return $text;
     } else {
         if (is_numeric($number)) {
             return $locale->formatNumber($number);
         } else {
             return $number;
         }
     }
 }
Пример #17
0
 function setAttribute($attr, $val)
 {
     switch ($attr) {
         case 'discount_percent':
             $locale = eZLocale::instance();
             $val = $locale->internalNumber($val);
             if ($val < 0.0) {
                 $val = 0.0;
             }
             if ($val > 100.0) {
                 $val = 100.0;
             }
             eZPersistentObject::setAttribute($attr, $val);
             break;
         default:
             eZPersistentObject::setAttribute($attr, $val);
             break;
     }
 }
Пример #18
0
 function attribute($attr)
 {
     if ($attr == 'settings') {
         return $this->settings(eZUser::currentUser());
     } else {
         if ($attr == 'all_week_days') {
             return eZLocale::instance()->attribute('weekday_name_list');
         } else {
             if ($attr == 'all_month_days') {
                 return range(1, 31);
             } else {
                 if ($attr == 'available_hours') {
                     return array('0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00');
                 }
             }
         }
     }
     return eZNotificationEventHandler::attribute($attr);
 }
Пример #19
0
 function eZDateTime($datetime = false)
 {
     if ($datetime instanceof eZDate) {
         $arr = getdate($datetime->timeStamp());
         $arr2 = getdate($this->DateTime);
         $datetime = mktime($arr2['hours'], $arr2['minutes'], $arr2['seconds'], $arr['mon'], $arr['mday'], $arr['year']);
     } else {
         if ($datetime instanceof eZTime) {
             $arr2 = getdate($datetime->timeStamp());
             $arr = getdate($this->DateTime);
             $datetime = mktime($arr2['hours'], $arr2['minutes'], $arr2['seconds'], $arr['mon'], $arr['mday'], $arr['year']);
         } else {
             if ($datetime === false) {
                 $datetime = time();
             }
         }
     }
     $this->DateTime = intval($datetime);
     $this->Locale = eZLocale::instance();
     $this->IsValid = true;
 }
Пример #20
0
 function i18nTrans($operatorName, &$node, $tpl, &$resourceData, $element, $lastElement, $elementList, $elementTree, &$parameters)
 {
     // i18n( $input, $context, $comment, $arguments )
     // Check if if the three first parameters are constants, if not we cannot compile it
     foreach (array_slice($parameters, 0, 3) as $parameter) {
         if ($parameter !== null && !eZTemplateNodeTool::isConstantElement($parameter)) {
             return false;
         }
     }
     $value = eZTemplateNodeTool::elementConstantValue($parameters[0]);
     $numParameters = count($parameters);
     $context = $numParameters > 1 ? eZTemplateNodeTool::elementConstantValue($parameters[1]) : null;
     $comment = $numParameters > 2 ? eZTemplateNodeTool::elementConstantValue($parameters[2]) : null;
     if ($numParameters < 4) {
         return array(eZTemplateNodeTool::createStringElement(ezpI18n::tr($context, $value, $comment, null)));
     }
     $values = array();
     $ini = eZINI::instance();
     if ($ini->variable('RegionalSettings', 'TextTranslation') != 'disabled') {
         $language = eZLocale::instance()->localeFullCode();
         if ($language != "eng-GB") {
             $file = 'translation.ts';
             $ini = eZINI::instance();
             $useCache = $ini->variable('RegionalSettings', 'TranslationCache') != 'disabled';
             eZTSTranslator::initialize($context, $language, $file, $useCache);
             $man = eZTranslatorManager::instance();
             $newValue = $man->translate($context, $value, $comment);
             if ($newValue) {
                 $value = $newValue;
             }
         }
     }
     $values[] = array(eZTemplateNodeTool::createStringElement($value));
     $values[] = $parameters[3];
     $code = '%tmp1% = array();' . "\n" . 'foreach ( %2% as %tmp2% => %tmp3% )' . "\n" . '{' . "\n" . '  if ( is_int( %tmp2% ) )' . "\n" . '    %tmp1%[\'%\' . ( (%tmp2%%9) + 1 )] = %tmp3%;' . "\n" . '  else' . "\n" . '    %tmp1%[%tmp2%] = %tmp3%;' . "\n" . '}' . "\n" . '%output% = strtr( %1%, %tmp1% );' . "\n";
     return array(eZTemplateNodeTool::createCodePieceElement($code, $values, false, 3));
 }
Пример #21
0
 function fixupClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     $minValueName = $base . self::MIN_VARIABLE . $classAttribute->attribute("id");
     $maxValueName = $base . self::MAX_VARIABLE . $classAttribute->attribute("id");
     if ($http->hasPostVariable($minValueName) and $http->hasPostVariable($maxValueName)) {
         $locale = eZLocale::instance();
         $minValueValue = $http->postVariable($minValueName);
         $minValueValue = str_replace(" ", "", $minValueValue);
         $minValueValue = $locale->internalNumber($minValueValue);
         $maxValueValue = $http->postVariable($maxValueName);
         $maxValueValue = str_replace(" ", "", $maxValueValue);
         $maxValueValue = $locale->internalNumber($maxValueValue);
         if ($minValueValue > $maxValueValue) {
             $this->FloatValidator->setRange($minValueValue, false);
             $maxValueValue = $this->FloatValidator->fixup($maxValueValue);
             $http->setPostVariable($maxValueName, $maxValueValue);
         }
     }
 }
Пример #22
0
 static function compilationFilename($key, $resourceData)
 {
     $internalCharset = eZTextCodec::internalCharset();
     $templateFilepath = $resourceData['template-filename'];
     $extraName = '';
     if (preg_match("#^.+/(.*)\\.tpl\$#", $templateFilepath, $matches)) {
         $extraName = $matches[1] . '-';
     } else {
         if (preg_match("#^(.*)\\.tpl\$#", $templateFilepath, $matches)) {
             $extraName = $matches[1] . '-';
         }
     }
     $accessText = false;
     if (isset($GLOBALS['eZCurrentAccess']['name'])) {
         $accessText = '-' . $GLOBALS['eZCurrentAccess']['name'];
     }
     $locale = eZLocale::instance();
     $language = $locale->localeFullCode();
     $http = eZHTTPTool::instance();
     $useFullUrlText = $http->UseFullUrl ? 'full' : 'relative';
     $pageLayoutVariable = "";
     if (isset($GLOBALS['eZCustomPageLayout'])) {
         $pageLayoutVariable = $GLOBALS['eZCustomPageLayout'];
     }
     $ini = eZINI::instance();
     $shareTemplates = $ini->hasVariable('TemplateSettings', 'ShareCompiledTemplates') ? $ini->variable('TemplateSettings', 'ShareCompiledTemplates') == 'enabled' : false;
     if ($shareTemplates) {
         $cacheFileKey = $key . '-' . $language;
     } else {
         $cacheFileKey = $key . '-' . $internalCharset . '-' . $language . '-' . $useFullUrlText . $accessText . "-" . $pageLayoutVariable . '-' . eZSys::indexFile();
     }
     $cacheFileName = $extraName . md5($cacheFileKey) . '.php';
     return $cacheFileName;
 }
Пример #23
0
    {
        $selectedVersion = $http->postVariable( 'SelectedVersion' );
        // Kept for backwards compatibility, EditLanguage may also be set in URL
        if ( $http->hasPostVariable( 'ContentObjectLanguageCode' ) )
        {
            $EditLanguage = $http->postVariable( 'ContentObjectLanguageCode' );
        }

        return $Module->redirectToView( "edit", array( $ObjectID, $selectedVersion, $EditLanguage ) );
    }
}

//Check if there is corresponding locale for the supplied language code.
if ( $EditLanguage != null )
{
   $localeObject = eZLocale::instance( $EditLanguage );
       if ( !$localeObject || !$localeObject->isValid() )
       {
           eZDebug::writeError( "No such locale $EditLanguage!", 'Can not find language.' );
           return $Module->handleError( eZError::KERNEL_LANGUAGE_NOT_FOUND, 'kernel',
                     array( 'AccessList' => $obj->accessList( 'edit' ) ) );
       }
}

// Action for edit_draft.tpl page,
// This will create a new draft of the object which the user can edit.
if ( $http->hasPostVariable( 'NewDraftButton' ) )
{
    // Check permission for object in specified language
    if ( !$obj->canEdit( false, false, false, $EditLanguage ) )
    {
Пример #24
0
 function currency()
 {
     $locale = eZLocale::instance();
     $currencyCode = $locale->currencyShortName();
     return $currencyCode;
 }
Пример #25
0
 static function localeList($asObject = false, $withVariations = true)
 {
     $locales =& $GLOBALS['eZLocaleLocaleStringList'];
     if (!is_array($locales)) {
         $localeRegexp = eZLocale::localeRegexp($withVariations, false);
         $locales = array();
         $dir = opendir('share/locale');
         while (($file = readdir($dir)) !== false) {
             if (preg_match("/^({$localeRegexp})\\.ini\$/", $file, $regs)) {
                 $locales[] = $regs[1];
             }
         }
         closedir($dir);
         $locales = array_unique($locales);
         sort($locales);
         if ($asObject) {
             $localeObjects = array();
             foreach ($locales as $locale) {
                 $localeInstance = eZLocale::instance($locale);
                 if ($localeInstance) {
                     $localeObjects[] = $localeInstance;
                 }
             }
             $locales = $localeObjects;
         }
     }
     return $locales;
 }
 public static function fetchLocale($localeCode)
 {
     // Fetch locale list
     $localeList = eZLocale::localeList(false, true);
     $localeObj = eZLocale::instance($localeCode);
     // Check if $localeName exists
     if ($localeObj === null or is_object($localeObj) and !in_array($localeObj->localeFullCode(), $localeList)) {
         $result = array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
     } else {
         $result = array('result' => $localeObj);
     }
     return $result;
 }
    /**
     * Regression test for issue {@see #17632 http://issues.ez.no/17632}
     *
     * In a multi language environment, a node fetched with a language other than the prioritized one(s) will return the
     * URL alias in the prioritized language
     */
    public function testIssue17632()
    {
        $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();

        $strNameEngGB = __FUNCTION__ . " eng-GB";
        $strNameFreFR = __FUNCTION__ . " fre-FR";

        // add a secondary language
        $locale = eZLocale::instance( 'fre-FR' );
        $translation = eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );

        // set the prioritize language list to contain english
        // ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'SiteLanguageList', array( 'fre-FR' ) );
        eZContentLanguage::setPrioritizedLanguages( array( 'fre-FR' ) );

        // Create an object with data in fre-FR and eng-GB
        $folder = new ezpObject( 'folder', 2, 14, 1, 'eng-GB' );
        $folder->publish();

        // Workaround as setting folder->name directly doesn't produce the expected result
        $folder->addTranslation( 'eng-GB', array( 'name' => $strNameEngGB ) );
        $folder->addTranslation( 'fre-FR', array( 'name' => $strNameFreFR ) );

        $nodeId = $folder->main_node_id;

        // fetch the node with no default parameters. Should return the french URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId );
        self::assertEquals( 'testIssue17632-fre-FR' , $node->attribute( 'url_alias' ) );

        // fetch the node in english. Should return the english URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId, 'eng-GB' );
        self::assertEquals( 'testIssue17632-eng-GB' , $node->attribute( 'url_alias' ) );

        ezpINIHelper::restoreINISettings();
        eZContentLanguage::setPrioritizedLanguages( $bkpLanguages );
    }
 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
 {
     $unit = $namedParameters["unit"];
     $prefix = $namedParameters["prefix"];
     $locale = eZLocale::instance();
     $decimalCount = $locale->decimalCount();
     $decimalSymbol = $locale->decimalSymbol();
     $decimalThousandsSeparator = $locale->thousandsSeparator();
     if ($namedParameters['decimal_count'] !== false) {
         $decimalCount = $namedParameters['decimal_count'];
     } elseif ($prefix == 'none') {
         $decimalCount = 0;
     }
     if (strlen($namedParameters['decimal_symbol']) > 0) {
         $decimalSymbol = $namedParameters['decimal_symbol'];
     }
     if (strlen($namedParameters['thousands_separator']) > 0) {
         $decimalThousandsSeparator = $namedParameters['thousands_separator'];
     }
     $ini = eZINI::instance();
     if ($prefix == "auto") {
         $prefixes = $ini->variableArray("UnitSettings", "BinaryUnits");
         if (in_array($unit, $prefixes)) {
             $prefix = "binary";
         } else {
             $prefix = "decimal";
         }
     }
     $unit_ini = eZINI::instance("units.ini");
     $use_si = $ini->variable("UnitSettings", "UseSIUnits") == "true";
     $fake = $use_si ? "" : "Fake";
     if ($unit_ini->hasVariable("Base", $unit)) {
         $base = $unit_ini->variable("Base", $unit);
     } else {
         $tpl->warning("eZTemplateUnitOperator", "No such unit '{$unit}'", $placement);
         return;
     }
     $prefix_var = "";
     if ($prefix == "decimal") {
         if ($operatorValue >= 0 and $operatorValue < 10) {
             $prefix_var = '';
         } else {
             $prefix_group = $unit_ini->group("DecimalPrefixes");
             $prefixes = array();
             foreach ($prefix_group as $prefix_item) {
                 $prefixes[] = explode(";", $prefix_item);
             }
             usort($prefixes, "eZTemplateUnitCompareFactor");
             $prefix_var = "";
             $divider = false;
             foreach ($prefixes as $prefix) {
                 $val = pow(10, (int) $prefix[0]);
                 if ($val <= $operatorValue) {
                     $prefix_var = $prefix[1];
                     $operatorValue = number_format($operatorValue / $val, $decimalCount, $decimalSymbol, $decimalThousandsSeparator);
                     break;
                 }
             }
         }
     } else {
         if ($prefix == "binary") {
             if ($operatorValue >= 0 and $operatorValue < 10) {
                 $prefix_var = '';
             } else {
                 $prefix_group = $unit_ini->group($fake . "BinaryPrefixes");
                 $prefixes = array();
                 foreach ($prefix_group as $prefix_item) {
                     $prefixes[] = explode(";", $prefix_item);
                 }
                 usort($prefixes, "eZTemplateUnitCompareFactor");
                 $prefix_var = "";
                 foreach ($prefixes as $prefix) {
                     $val = pow(2, (int) $prefix[0]);
                     if ($val <= $operatorValue) {
                         $prefix_var = $prefix[1];
                         $operatorValue = number_format($operatorValue / $val, $decimalCount, $decimalSymbol, $decimalThousandsSeparator);
                         break;
                     }
                 }
             }
         } else {
             if ($unit_ini->hasVariable("BinaryPrefixes", $prefix)) {
                 $prefix_base = 2;
                 $prefix_var = $unit_ini->variableArray("BinaryPrefixes", $prefix);
             } else {
                 if ($unit_ini->hasVariable("DecimalPrefixes", $prefix)) {
                     $prefix_base = 10;
                     $prefix_var = $unit_ini->variableArray("DecimalPrefixes", $prefix);
                 } else {
                     if ($prefix == "none") {
                         $prefix_var = "";
                         $operatorValue = number_format($operatorValue, $decimalCount, $decimalSymbol, $decimalThousandsSeparator);
                     } else {
                         $tpl->warning($operatorName, "Prefix \"{$prefix}\" for unit \"{$unit}\" not found", $placement);
                     }
                 }
             }
             if (is_array($prefix_var)) {
                 $val = pow($prefix_base, (int) $prefix_var[0]);
                 $operatorValue = number_format($operatorValue / $val, $decimalCount, $decimalSymbol, $decimalThousandsSeparator);
                 $prefix_var = $prefix_var[1];
             }
         }
     }
     $operatorValue = "{$operatorValue} {$prefix_var}" . $base;
 }
 unset($var1);
 if (!isset($var)) {
     $var = NULL;
 }
 while (is_object($var) and method_exists($var, 'templateValue')) {
     $var = $var->templateValue();
 }
 $text .= $var;
 unset($var);
 $text .= '
 </td>
 <td>
     ';
 unset($var);
 // l10nTransformation begin
 $locale = eZLocale::instance();
 // l10nTransformation: static
 unset($var1);
 unset($var1);
 $var1 = (array_key_exists($rootNamespace, $vars) and array_key_exists('latest_node', $vars[$rootNamespace])) ? $vars[$rootNamespace]['latest_node'] : null;
 $var2 = compiledFetchAttribute($var1, 'object');
 unset($var1);
 $var1 = $var2;
 $var2 = compiledFetchAttribute($var1, 'modified');
 unset($var1);
 $var1 = $var2;
 if (!isset($var1)) {
     $var1 = NULL;
 }
 while (is_object($var1) and method_exists($var1, 'templateValue')) {
     $var1 = $var1->templateValue();
Пример #30
0
 function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
 {
     $data = $http->postVariable($base . "_data_price_" . $contentObjectAttribute->attribute("id"));
     $vatType = $http->postVariable($base . '_ezprice_vat_id_' . $contentObjectAttribute->attribute('id'));
     $vatExInc = $http->postVariable($base . '_ezprice_inc_ex_vat_' . $contentObjectAttribute->attribute('id'));
     $locale = eZLocale::instance();
     $data = $locale->internalCurrency($data);
     $data_text = $vatType . ',' . $vatExInc;
     $contentObjectAttribute->setAttribute("data_float", $data);
     $contentObjectAttribute->setAttribute('data_text', $data_text);
     return true;
 }