当前位置: 首页>>代码示例>>PHP>>正文


PHP LocalizationUtility::translate方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP LocalizationUtility::translate方法的具体用法?PHP LocalizationUtility::translate怎么用?PHP LocalizationUtility::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Extbase\Utility\LocalizationUtility的用法示例。


在下文中一共展示了LocalizationUtility::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderStorageMenu

    /**
     * @return string
     */
    protected function renderStorageMenu()
    {
        $currentStorage = $this->getMediaModule()->getCurrentStorage();
        /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
        $options = '';
        foreach ($this->getMediaModule()->getAllowedStorages() as $storage) {
            $selected = '';
            if ($currentStorage->getUid() == $storage->getUid()) {
                $selected = 'selected';
            }
            $options .= sprintf('<option value="%s" %s>%s %s</option>', $storage->getUid(), $selected, $storage->getName(), $storage->isOnline() ? '' : '(' . LocalizationUtility::translate('offline', 'media') . ')');
        }
        $parameters = GeneralUtility::_GET();
        $inputs = '';
        foreach ($parameters as $parameter => $value) {
            list($parameter, $value) = $this->computeParameterAndValue($parameter, $value);
            if ($parameter !== $this->moduleLoader->getParameterPrefix() . '[storage]') {
                $inputs .= sprintf('<input type="hidden" name="%s" value="%s" />', $parameter, $value);
            }
        }
        $template = '<form action="mod.php" id="form-menu-storage" method="get">
						%s
						<select name="%s[storage]" class="btn btn-min" id="menu-storage" onchange="$(\'#form-menu-storage\').submit()">%s</select>
					</form>';
        return sprintf($template, $inputs, $this->moduleLoader->getParameterPrefix(), $options);
    }
开发者ID:visol,项目名称:media,代码行数:29,代码来源:StorageMenu.php

示例2: isValid

 /**
  * Checks if the given value is a valid recaptcha.
  *
  * @param mixed $value The value that should be validated
  * @throws InvalidVariableException
  */
 public function isValid($value)
 {
     $response = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('g-recaptcha-response');
     if ($response !== null) {
         // Only check if a response is set
         $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
         $fullTs = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         $reCaptchaSettings = $fullTs['plugin.']['tx_sfeventmgt.']['settings.']['reCaptcha.'];
         if (isset($reCaptchaSettings) && is_array($reCaptchaSettings) && isset($reCaptchaSettings['secretKey']) && $reCaptchaSettings['secretKey']) {
             $ch = curl_init();
             $fields = ['secret' => $reCaptchaSettings['secretKey'], 'response' => $response];
             // url-ify the data for the POST
             $fieldsString = '';
             foreach ($fields as $key => $value) {
                 $fieldsString .= $key . '=' . $value . '&';
             }
             rtrim($fieldsString, '&');
             // set the url, number of POST vars, POST data
             curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
             curl_setopt($ch, CURLOPT_POST, count($fields));
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
             // execute post
             $resultCH = json_decode(curl_exec($ch));
             if (!(bool) $resultCH->success) {
                 $this->addError(LocalizationUtility::translate('validation.possible_robot', 'sf_event_mgt'), 1231423345);
             }
         } else {
             throw new InvalidVariableException(LocalizationUtility::translate('error.no_secretKey', 'sf_event_mgt'), 1358349150);
         }
     }
 }
开发者ID:derhansen,项目名称:sf_event_mgt,代码行数:38,代码来源:RecaptchaValidator.php

示例3: render

 /**
  * @return array
  */
 public function render()
 {
     $result = [];
     // Start the select with a blank element?
     if ($this->arguments['leadingBlank']) {
         $result[''] = '';
     }
     $extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
     if (!empty($this->arguments['values'])) {
         foreach ($this->arguments['values'] as $item => $count) {
             // Localise item name.
             $localisationKey = $this->arguments['localisationPrefix'] . $item;
             $localisedItem = LocalizationUtility::translate($localisationKey, $extensionName);
             if (!$localisedItem) {
                 $localisedItem = $item;
             }
             // Append count to item name?
             $result[$item] = $localisedItem . ($this->arguments['showCount'] ? ' (' . $count . ')' : '');
         }
     }
     // Sort the array?
     if ($this->arguments['sortByName']) {
         ksort($result);
     }
     // Strip sort prefixes.
     if ($this->arguments['sortPrefixSeparator']) {
         $strippedResult = [];
         foreach ($result as $key => $value) {
             $valueParts = explode($this->arguments['sortPrefixSeparator'], $value, 2);
             $strippedResult[$key] = $valueParts[count($valueParts) - 1];
         }
         $result = $strippedResult;
     }
     return $result;
 }
开发者ID:cushingw,项目名称:typo3-find,代码行数:38,代码来源:SelectOptionsForFacetViewHelper.php

示例4: render

 public function render()
 {
     $key = $this->arguments['key'];
     $id = $this->arguments['id'];
     $default = $arguments['default'];
     $htmlEscape = $arguments['htmlEscape'];
     $extensionName = $this->arguments['extensionName'];
     $arguments = $arguments['arguments'];
     // Wrapper including a compatibility layer for TYPO3 Flow Translation
     if ($id === null) {
         $id = $key;
     }
     if ((string) $id === '') {
         \AuM\Blypo\Service\ExceptionService::throwException('An argument "key" or "id" has to be provided');
     }
     $request = static::$renderingContext->getControllerContext()->getRequest();
     $extensionName = $extensionName === null ? $request->getControllerExtensionName() : $extensionName;
     $value = LocalizationUtility::translate($id, $extensionName, $arguments);
     if ($value === null) {
         $value = $default !== null ? $default : '';
         if (!empty($arguments)) {
             $value = vsprintf($value, $arguments);
         }
     } elseif ($htmlEscape) {
         $value = htmlspecialchars($value);
     }
     return $value;
 }
开发者ID:blypo,项目名称:blypo,代码行数:28,代码来源:Translate.php

示例5: getAdditionalFields

 /**
  * This method is used to define new fields for adding or editing a task
  * In this case, it adds an pid field
  *
  * @param array $taskInfo Reference to the array containing the info used in the add/edit form
  * @param object $task When editing, reference to the current task object. Null when adding.
  * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject Reference to the calling object (Scheduler's BE module)
  * @return array	Array containing all the information pertaining to the additional fields
  */
 public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
 {
     // Initialize extra field value
     if (empty($taskInfo['newsPids'])) {
         if ($parentObject->CMD == 'edit') {
             // In case of edit, set to internal value if no data was submitted already
             $taskInfo['newsPids'] = $task->newsPids;
         } else {
             // Otherwise set an empty value, as it will not be used anyway
             $taskInfo['newsPids'] = '';
         }
     }
     if (empty($taskInfo['ignore'])) {
         if ($parentObject->CMD == 'edit') {
             // In case of edit, set to internal value if no data was submitted already
             $taskInfo['ignore'] = $task->ignore;
         } else {
             // Otherwise set an empty value, as it will not be used anyway
             $taskInfo['ignore'] = 0;
         }
     }
     $additionalFields = array();
     // Write the code for the field
     $fieldID = 'task_newsPids';
     $fieldCode = $this->getMooxNewsFoldersSelector('tx_scheduler[newsPids]', $taskInfo['newsPids']);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:moox_news/Resources/Private/Language/locallang_scheduler.xlf:tx_mooxnews_tasks_setnewsaccesstask.news_pids_label', 'moox_news'), 'cshKey' => '_MOD_tools_txschedulerM1', 'cshLabel' => $fieldID);
     // Write the code for the field
     $fieldID = 'task_ignore';
     $fieldCode = '<input type="checkbox" name="tx_scheduler[ignore]" id="' . $fieldID . '" value="1" ' . ($taskInfo['ignore'] ? 'checked="checked" ' : '') . '/>';
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:moox_news/Resources/Private/Language/locallang_scheduler.xlf:tx_mooxnews_tasks_setnewsaccesstask.ignore_label', 'moox_news'), 'cshKey' => '_MOD_tools_txschedulerM1', 'cshLabel' => $fieldID);
     return $additionalFields;
 }
开发者ID:preinboth,项目名称:moox_news,代码行数:41,代码来源:SetNewsAccessTaskAdditionalFieldProvider.php

示例6: manipulateCacheActions

 /**
  * Add an entry to the CacheMenuItems array
  *
  * @param array $cacheActions Array of CacheMenuItems
  * @param array $optionValues Array of AccessConfigurations-identifiers (typically  used by userTS with options.clearCache.identifier)
  */
 public function manipulateCacheActions(&$cacheActions, &$optionValues)
 {
     $title = LocalizationUtility::translate('cache_action.title', 'cs_clear_images');
     $icon = '<img ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ExtensionManagementUtility::extRelPath('cs_clear_images') . 'Resources/Public/Images/clear_cache_icon.png', 'width="16" height="16"') . ' alt="" title="' . $title . '"/>';
     // Clearing of processed images
     $cacheActions[] = array('id' => 'tx_csclearimages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=tx_csclearimages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => $icon);
 }
开发者ID:clickstorm,项目名称:cs_clear_images,代码行数:13,代码来源:ClearImages.php

示例7: render

    /**
     * Renders a download link
     *
     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
     * @return string the rendered a tag
     */
    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
    {
        $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
        if (empty($installPaths)) {
            return '';
        }
        $pathSelector = '<ul class="is-hidden">';
        foreach ($installPaths as $installPathType => $installPath) {
            $pathSelector .= '<li>
				<input type="radio" id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '" name="' . htmlspecialchars($this->getFieldNamePrefix('downloadPath')) . '[downloadPath]" class="downloadPath" value="' . htmlspecialchars($installPathType) . '"' . ($installPathType == 'Local' ? ' checked="checked"' : '') . '/>
				<label for="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '">' . htmlspecialchars($installPathType) . '</label>
			</li>';
        }
        $pathSelector .= '</ul>';
        $uriBuilder = $this->controllerContext->getUriBuilder();
        $action = 'checkDependencies';
        $uriBuilder->reset();
        $uriBuilder->setFormat('json');
        $uri = $uriBuilder->uriFor($action, array('extension' => (int) $extension->getUid()), 'Download');
        $this->tag->addAttribute('data-href', $uri);
        $label = '
			<div class="btn-group">
				<button
					title="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '"
					type="submit"
					class="btn btn-default"
					value="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '"
				>
					<span class="t3-icon fa fa-cloud-download"></span>
				</button>
			</div>';
        $this->tag->setContent($label . $pathSelector);
        $this->tag->addAttribute('class', 'download');
        return '<div id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
    }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:41,代码来源:DownloadExtensionViewHelper.php

示例8: initializeAction

 /**
  *
  */
 protected function initializeAction()
 {
     if (!$this->backendUserHasUserGroup($this->getRequiredUserGroup())) {
         $this->addFlashMessage(LocalizationUtility::translate('controller.be.protected_controller.no_permission', 'election'), LocalizationUtility::translate('controller.be.protected_controller.error', 'election'), AbstractMessage::ERROR);
         $this->redirect(BeDashboardController::ACTION_INDEX, BeDashboardController::CONTROLLER_NAME);
     }
 }
开发者ID:vertexvaar,项目名称:election,代码行数:10,代码来源:AbstractProtectedBeController.php

示例9: run

 /**
  * @param \S3b0\ProjectRegistration\Scheduler\InfoMail\Task $task
  *
  * @return bool
  */
 public function run(\S3b0\ProjectRegistration\Scheduler\InfoMail\Task $task)
 {
     $settings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extensionName]);
     $upperLimit = new \DateTime();
     $lowerLimit = new \DateTime();
     $daysLeft = $settings['warnXDaysBeforeExpireDate'];
     $sender = [$task->getSenderAddress()];
     $receiver = [$task->getReceiverAddress()];
     $subject = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('infomail.subject', $this->extensionName);
     $this->databaseConnection = $GLOBALS['TYPO3_DB'];
     // Upper limit (expiry) = Current date + Days left
     $upperLimit->setTimestamp($upperLimit->getTimestamp() + $daysLeft * 86400);
     // Lower limit (expiry) = Current date + Days left - Scheduler frequency
     $lowerLimit->setTimestamp($lowerLimit->getTimestamp() + $daysLeft * 86400 - $task->getExecution()->getInterval());
     $where = "date_of_expiry > '{$lowerLimit->format('Y-m-d h:i:s')}' AND date_of_expiry < '{$upperLimit->format('Y-m-d h:i:s')}'";
     if ($this->databaseConnection->exec_SELECTcountRows('*', 'tx_projectregistration_domain_model_project', $where)) {
         $expiredProjects = $this->databaseConnection->exec_SELECTgetRows('project.*, registrant.name as registrant_name, registrant.company as registrant_company', 'tx_projectregistration_domain_model_project as project join tx_projectregistration_domain_model_person as registrant on project.registrant=registrant.uid', $where);
         $list = [];
         /** @var array $expiredProject */
         foreach ($expiredProjects as $expiredProject) {
             $list[] = "#{$expiredProject['uid']} - '{$expiredProject['title']}' by {$expiredProject['registrant_name']} ({$expiredProject['registrant_company']})";
         }
         $mailContent = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('infomail.message', $this->extensionName, [$daysLeft, '<li>' . implode('</li><li>', $list) . '</li>']);
         /** @var \TYPO3\CMS\Core\Mail\MailMessage $mail */
         $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
         $mail->setContentType('text/html');
         /**
          * Email to sender
          */
         $mail->setFrom($sender)->setTo($receiver)->setPriority(1)->setSubject($subject)->setBody($mailContent)->send();
     }
     return true;
 }
开发者ID:S3b0,项目名称:project_registration,代码行数:38,代码来源:BusinessLogic.php

示例10: render

 public function render()
 {
     $class = 'control-group';
     if ($this->arguments['llLabel']) {
         $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($this->arguments['llLabel'], 'typo3_forum');
     } else {
         $label = $this->arguments['label'];
     }
     if ($this->arguments['error']) {
         $results = $this->controllerContext->getRequest()->getOriginalRequestMappingResults()->getSubResults();
         $propertyPath = explode('.', $this->arguments['error']);
         foreach ($propertyPath as $currentPropertyName) {
             $errors = $this->getErrorsForProperty($currentPropertyName, $results);
         }
         if (count($errors) > 0) {
             $class .= ' error';
             $errorContent = '';
             foreach ($errors as $error) {
                 $errorText = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($this->arguments['errorLLPrefix'] . '_' . $error->getCode(), 'typo3_forum');
                 if (!$errorText) {
                     $errorText = 'TRANSLATE: ' . $this->arguments['errorLLPrefix'] . '_' . $error->getCode();
                 }
                 $errorContent .= '<p class="help-block">' . $errorText . '</p>';
             }
         }
     } else {
         $errorText = '';
     }
     $label = '<label>' . $label . '</label>';
     $content = '<div>' . $this->renderChildren() . $errorContent . '</div>';
     $this->tag->addAttribute('class', $class);
     $this->tag->setContent($label . $content);
     return $this->tag->render();
 }
开发者ID:steffmeister,项目名称:typo3-forum,代码行数:34,代码来源:RowViewHelper.php

示例11: errorAction

 /**
  */
 protected function errorAction()
 {
     $results = new \stdClass();
     $results->hasErrors = false;
     $errorResults = $this->arguments->getValidationResults();
     $results->errors = new \stdClass();
     $results->errors->byProperty = array();
     foreach ($errorResults->getFlattenedErrors() as $property => $error) {
         $errorDetails = $errorResults->forProperty($property)->getErrors();
         foreach ($errorDetails as $error) {
             $results->hasErrors = true;
             $errorObj = new \stdClass();
             $errorObj->code = $error->getCode();
             $errorObj->property = $property;
             $key = 'form-frontendUserController-' . $errorObj->property . '-' . $errorObj->code;
             $translatedMessage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, 'cicregister');
             if ($translatedMessage) {
                 $errorObj->message = $translatedMessage;
             } else {
                 $errorObj->message = $error->getMessage();
             }
             $results->errors->byProperty[str_replace('.', '-', $property)][] = $errorObj;
         }
     }
     $this->view->assign('results', json_encode($results));
 }
开发者ID:busynoggin,项目名称:cicregister,代码行数:28,代码来源:FrontendUserJSONController.php

示例12: isValid

 /**
  * Check the word that was entered against the hashed value
  * Returns TRUE, if the given property ($word) matches the session captcha value.
  *
  * @param string $word: the word that was entered and should be validated
  * @return boolean TRUE, if the word entered matches the hash value, FALSE if an error occured
  */
 public function isValid($word)
 {
     $isValid = FALSE;
     // Overwrite $word if options contains a value
     if ($this->options['word']) {
         $word = $this->options['word'];
     }
     // Get session data
     /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     /** @var \SJBR\SrFreecap\Domain\Repository\WordRepository $wordRepository */
     $wordRepository = $objectManager->get('SJBR\\SrFreecap\\Domain\\Repository\\WordRepository');
     $wordObject = $wordRepository->getWord();
     $wordHash = $wordObject->getWordHash();
     // Check the word hash against the stored hash value
     if (!empty($wordHash) && !empty($word)) {
         if ($wordObject->getHashFunction() == 'md5') {
             // All freeCap words are lowercase.
             // font #4 looks uppercase, but trust me, it's not...
             if (md5(strtolower(utf8_decode($word))) == $wordHash) {
                 // Reset freeCap session vars
                 // Cannot stress enough how important it is to do this
                 // Defeats re-use of known image with spoofed session id
                 $wordRepository->cleanUpWord();
                 $isValid = TRUE;
             }
         }
     }
     if (!$isValid) {
         $this->addError(LocalizationUtility::translate('tx_pwcomments.validation_error.captcha', 'PwComments'), 9221561048.0);
     }
     return $isValid;
 }
开发者ID:jonathanheilmann,项目名称:ext-jh_pwcomments_captcha,代码行数:40,代码来源:SrFreecapValidator.php

示例13: renderStatic

 /**
  * Implementing CompilableInterface suppresses object instantiation of this view helper
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return string
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     // The two main icon classes are static during one call. They trigger relatively expensive
     // calculation with a signal and object creation and thus make sense to have them cached.
     if (!static::$grantedCssClasses) {
         static::$grantedCssClasses = IconUtility::getSpriteIconClasses('status-status-permission-granted');
     }
     if (!static::$deniedCssClasses) {
         static::$deniedCssClasses = IconUtility::getSpriteIconClasses('status-status-permission-denied');
     }
     $masks = array(1, 16, 2, 4, 8);
     if (empty(static::$permissionLabels)) {
         foreach ($masks as $mask) {
             static::$permissionLabels[$mask] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:' . $mask, 'be_user');
         }
     }
     $icon = '';
     foreach ($masks as $mask) {
         if ($arguments['permission'] & $mask) {
             $icon .= '<span' . ' title="' . static::$permissionLabels[$mask] . '"' . ' class="' . static::$grantedCssClasses . ' change-permission text-success"' . ' data-page="' . $arguments['pageId'] . '"' . ' data-permissions="' . $arguments['permission'] . '"' . ' data-mode="delete"' . ' data-who="' . $arguments['scope'] . '"' . ' data-bits="' . $mask . '"' . ' style="cursor:pointer"' . '></span>';
         } else {
             $icon .= '<span' . ' title="' . static::$permissionLabels[$mask] . '"' . ' class="' . static::$deniedCssClasses . ' change-permission text-danger"' . ' data-page="' . $arguments['pageId'] . '"' . ' data-permissions="' . $arguments['permission'] . '"' . ' data-mode="add"' . ' data-who="' . $arguments['scope'] . '"' . ' data-bits="' . $mask . '"' . ' style="cursor:pointer"' . '></span>';
         }
     }
     return '<span id="' . $arguments['pageId'] . '_' . $arguments['scope'] . '">' . $icon . '</span>';
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:35,代码来源:PermissionsViewHelper.php

示例14: render

 public function render()
 {
     $decimals = isset($this->arguments['decimals']) ? $this->arguments['decimals'] : 2;
     $decSep = isset($this->arguments['decSep']) ? $this->arguments['decSep'] : false;
     $thouSep = isset($this->arguments['thouSep']) ? $this->arguments['thouSep'] : false;
     $value = $this->arguments['value'];
     if ($value === null) {
         //TODO #exception
     }
     if (empty(self::$units)) {
         self::$units = GeneralUtility::trimExplode(',', LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid'));
     }
     if (!is_integer($value) && !is_float($value)) {
         if (is_numeric($value)) {
             $value = (double) $value;
         } else {
             $value = 0;
         }
     }
     $bytes = max($value, 0);
     $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
     $pow = min($pow, count(self::$units) - 1);
     $bytes /= pow(2, 10 * $pow);
     echo sprintf('%s %s', number_format(round($bytes, 4 * $this->arguments['decimals']), $this->arguments['decimals'], $this->arguments['decimalSeparator'], $this->arguments['thousandsSeparator']), self::$units[$pow]);
 }
开发者ID:blypo,项目名称:blypo,代码行数:25,代码来源:Bytes.php

示例15: isValid

 /**
  * Initial function to validate
  *
  * @param Comment $comment Comment model to validate
  * @return bool
  */
 public function isValid($comment)
 {
     $this->settings = $this->getExtensionSettings();
     $errorNumber = NULL;
     $errorArguments = NULL;
     if (!$this->anyPropertyIsSet($comment)) {
         $errorNumber = 1299628038;
     } elseif (!$this->mailIsValid($comment)) {
         $errorNumber = 1299628371;
     } elseif (!$this->messageIsSet($comment)) {
         $errorNumber = 1299628099;
         $errorArguments = array($this->settings['secondsBetweenTwoComments']);
     } elseif ($this->settings['useBadWordsList'] && !$this->checkTextForBadWords($comment->getMessage())) {
         $errorNumber = 1315608355;
     } elseif ($this->settings['useBadWordsListOnUsername'] && !$this->checkTextForBadWords($comment->getAuthorName())) {
         $errorNumber = 1406644911;
     } elseif ($this->settings['useBadWordsListOnMailAddress'] && !$this->checkTextForBadWords($comment->getAuthorMail())) {
         $errorNumber = 1406644912;
     } elseif (!$this->lastCommentRespectsTimer($comment)) {
         $errorNumber = 1300280476;
         $errorArguments = array($this->settings['secondsBetweenTwoComments']);
     }
     if ($errorNumber !== NULL) {
         $errorMessage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_pwcomments.validation_error.' . $errorNumber, 'PwComments', $errorArguments);
         $this->addError($errorMessage, $errorNumber);
     }
     return $errorNumber === NULL;
 }
开发者ID:mmunz,项目名称:pw_comments,代码行数:34,代码来源:CommentValidator.php


注:本文中的TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。