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


PHP _t函数代码示例

本文整理汇总了PHP中_t函数的典型用法代码示例。如果您正苦于以下问题:PHP _t函数的具体用法?PHP _t怎么用?PHP _t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $badge = new UploadField('Badge', _t('ScoutGroup.BADGE', 'Badge'));
     $badge->setFolderName('group/badge');
     $badge->setRightTitle(_t('ScoutGroup.BADGE_HELP', 'The badge/logo/emblem of the Group'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Info', $badge);
     $necker = new UploadField('Necker', _t('ScoutGroup.NECKER', 'Necker'));
     $necker->setFolderName('group/necker');
     $necker->setRightTitle(_t('ScoutGroup.NECKER_HELP', 'The neckerchief the Group'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Info', $necker);
     $fields->addFieldToTab('Root.Info', new TextField('NeckerDescription', _t('ScoutGroup.NECKERDESCRIPTION', 'Neckerchief Description')));
     $fields->addFieldToTab('Root.Social', new TextField('TwitterUser', _t('ScoutGroup.TWITTERUSER', 'Twitter User')));
     $fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('ScoutGroup.FACEBOOKPAGE', 'Facebook Page')));
     $fields->addFieldToTab('Root.Social', new TextField('GooglePage', _t('ScoutGroup.GOOGLEPAGE', 'Google Page')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address1', _t('ScoutGroup.ADDRESS1', 'Address 1')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address2', _t('ScoutGroup.ADDRESS2', 'Address 2')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address3', _t('ScoutGroup.ADDRESS3', 'Address 3')));
     $fields->addFieldToTab('Root.Contact', new TextField('Town', _t('ScoutGroup.TOWN', 'Town')));
     $fields->addFieldToTab('Root.Contact', new TextField('Postcode', _t('ScoutGroup.POSTCODE', 'Post Code')));
     $fields->addFieldToTab('Root.Contact', new TextField('Phone', _t('ScoutGroup.PHONE', 'Phone #')));
     $fields->addFieldToTab('Root.Contact', new TextField('Email', _t('ScoutGroup.EMAIL', 'Email Address')));
     $fields->addFieldToTab('Root.Contact', new TextField('CharityNumber', _t('ScoutGroup.CHARITYNUMBER', 'CharityNumber')));
     $sectionGridConfig = new GridFieldConfig_RecordEditor();
     $sectionGridConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $sectionGrid = new GridField('Sections', 'Sections', $this->Sections(), $sectionGridConfig);
     $fields->addFieldToTab('Root.Sections', $sectionGrid);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:phpboyscout-silverstripe-scouts,代码行数:30,代码来源:ScoutGroup.php

示例2: validate

 public function validate($validator)
 {
     // If the field is empty then don't return an invalidation message
     if (!trim(implode("", $this->value))) {
         return true;
     }
     $i = 0;
     if ($this->value) {
         foreach ($this->value as $part) {
             if (!$part || !(strlen($part) == 4) || !preg_match("/([0-9]{4})/", $part)) {
                 switch ($i) {
                     case 0:
                         $number = _t('CreditCardField.FIRST', 'first');
                         break;
                     case 1:
                         $number = _t('CreditCardField.SECOND', 'second');
                         break;
                     case 2:
                         $number = _t('CreditCardField.THIRD', 'third');
                         break;
                     case 3:
                         $number = _t('CreditCardField.FOURTH', 'fourth');
                         break;
                 }
                 $validator->validationError($this->name, _t('Form.VALIDATIONCREDITNUMBER', "Please ensure you have entered the {number} credit card number correctly", array('number' => $number)), "validation", false);
                 return false;
             }
             $i++;
         }
     }
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:31,代码来源:CreditCardField.php

示例3: refine

 /**
  *
  */
 public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null)
 {
     $o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null;
     // Set place hierarchy
     if ($vs_hierarchy = $pa_item['settings']['placeSplitter_placeHierarchy']) {
         $vn_hierarchy_id = caGetListItemID('place_hierarchies', $vs_hierarchy);
     } else {
         // Default to first place hierarchy
         $t_list = new ca_lists();
         $va_hierarchy_ids = $t_list->getItemsForList('place_hierarchies', array('idsOnly' => true));
         $vn_hierarchy_id = array_shift($va_hierarchy_ids);
     }
     if (!$vn_hierarchy_id) {
         if ($o_log) {
             $o_log->logError(_t('[placeSplitterRefinery] No place hierarchies are defined'));
         }
         return array();
     }
     $pa_options['hierarchyID'] = $vn_hierarchy_id;
     $t_place = new ca_places();
     if ($t_place->load(array('parent_id' => null, 'hierarchy_id' => $vn_hierarchy_id))) {
         $pa_options['defaultParentID'] = $t_place->getPrimaryKey();
     }
     return caGenericImportSplitter('placeSplitter', 'place', 'ca_places', $this, $pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:28,代码来源:placeSplitterRefinery.php

示例4: __construct

 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->opo_browse = new OccurrenceBrowse($this->opo_result_context->getSearchExpression(), 'providence');
     $this->opa_views = array('list' => _t('list'), 'editable' => _t('editable'));
     $this->opa_sorts = array_merge(array('ca_occurrence_labels.name' => _t('name'), 'ca_occurrences.idno_sort' => _t('idno')), $this->opa_sorts);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:7,代码来源:BrowseOccurrencesController.php

示例5: Field

 /**
  * Returns a readonly span containing the correct value.
  *
  * @param array $properties
  *
  * @return string
  */
 public function Field($properties = array())
 {
     $source = ArrayLib::flatten($this->getSource());
     $values = $this->getValueArray();
     // Get selected values
     $mapped = array();
     foreach ($values as $value) {
         if (isset($source[$value])) {
             $mapped[] = $source[$value];
         }
     }
     // Don't check if string arguments are matching against the source,
     // as they might be generated HTML diff views instead of the actual values
     if ($this->value && is_string($this->value) && empty($mapped)) {
         $mapped = array(trim($this->value));
         $values = array();
     }
     if ($mapped) {
         $attrValue = implode(', ', array_values($mapped));
         $attrValue = Convert::raw2xml($attrValue);
         $inputValue = implode(', ', array_values($values));
     } else {
         $attrValue = '<i>(' . _t('FormField.NONE', 'none') . ')</i>';
         $inputValue = '';
     }
     $properties = array_merge($properties, array('AttrValue' => DBField::create_field('HTMLFragment', $attrValue), 'InputValue' => $inputValue));
     return parent::Field($properties);
 }
开发者ID:SpiritLevel,项目名称:silverstripe-framework,代码行数:35,代码来源:LookupField.php

示例6: __construct

 /**
  * @param string $sortField - Field to sort the blocks on. If this is set, it will also make the
  * 	blocks sortable in the CMS (requires SortableGridField module!)
  * @param array $allowedBlocks - a set of allowed class names, optionally mapped to titles
  * @param int $itemsPerPage - How many items per page should show up
  */
 public function __construct($sortField = null, $allowedBlocks = null, $itemsPerPage = null)
 {
     parent::__construct($itemsPerPage);
     // setup a bulk manager for block management
     $bulkManager = new GridFieldBulkManager();
     // remove the default actions
     $toRemove = array('bulkedit', 'bulkEdit', 'delete', 'unlink', 'unLink');
     $validActions = array_keys($bulkManager->getConfig('actions'));
     foreach ($toRemove as $key) {
         if (in_array($key, $validActions)) {
             $bulkManager->removeBulkAction($key);
         }
     }
     // add the actions in desired order
     $bulkManager->addBulkAction('publish', _t('PageBlock.PUBLISH', 'Publish'))->addBulkAction('unpublish', _t('PageBlock.UNPUBLISH', 'Unpublish'))->addBulkAction('bulkedit', _t('PageBlock.EDIT', 'Edit'), 'GridFieldBulkActionEditHandler', array('icon' => 'pencil'))->addBulkAction('versionedunlink', _t('PageBlock.UNLINK', 'Unlink'), 'GridFieldBulkActionVersionedUnlinkHandler', array('icon' => 'chain--minus'))->addBulkAction('versioneddelete', _t('PageBlock.DELETE', 'Delete'), 'GridFieldBulkActionVersionedDeleteHandler', array('isDestructive' => true, 'icon' => 'decline'));
     if ($sortField && class_exists('GridFieldOrderableRows')) {
         $this->addComponent(new GridFieldOrderableRows($sortField));
     }
     // remove the delete action, since unlinking is not required
     $this->removeComponent($this->getComponentByType('GridFieldDeleteAction'));
     // remove the search field since it doesn't make sense (cannot add existing, unless "stealing" from another page)
     $this->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $this->addComponent(new GridFieldAddExistingSearchButton('buttons-before-right'));
     $this->addComponent(new GridFieldAddNewMultiClass(), 'GridFieldToolbarHeader');
     $this->addComponent($bulkManager);
     $this->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => _t('Block.TITLE', 'Title'), 'i18n_singular_name' => _t('Block.TYPE', 'Type'), 'PublishedStatus' => _t('Block.STATUS', 'Status')));
     $this->setAllowedBlocks($allowedBlocks);
 }
开发者ID:VisionaerAG,项目名称:page-blocks,代码行数:34,代码来源:PageBlocks.php

示例7: FieldHolder

 public function FieldHolder()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('eventmanagement/javascript/EventInvitationField.js');
     $link = $this->createTag('a', array('id' => 'event-do-invite', 'href' => $this->Link('invite')), _t('EventManagement.INVITEPEOPLETOEVENT', 'Invite People To Event'));
     return $this->createTag('div', array('id' => $this->id(), 'href' => $this->Link('FieldHolder')), "<p>{$link}</p>" . $this->table->FieldHolder());
 }
开发者ID:nyeholt,项目名称:silverstripe-eventmanagement,代码行数:7,代码来源:EventInvitationField.php

示例8: onBeforeWrite

 public function onBeforeWrite()
 {
     if ($this->owner->BaseClass == "Discussion" && $this->owner->ID == 0) {
         $discussion = Discussion::get()->byID($this->owner->ParentID);
         $discussion_author = $discussion->Author();
         $holder = $discussion->Parent();
         $author = Member::get()->byID($this->owner->AuthorID);
         // Get our default email from address
         if (DiscussionHolder::config()->send_emails_from) {
             $from = DiscussionHolder::config()->send_email_from;
         } else {
             $from = Email::config()->admin_email;
         }
         // Vars for the emails
         $vars = array("Title" => $discussion->Title, "Author" => $author, "Comment" => $this->owner->Comment, 'Link' => Controller::join_links($holder->Link("view"), $discussion->ID, "#comments-holder"));
         // Send email to discussion owner
         if ($discussion_author && $discussion_author->Email && $discussion_author->RecieveCommentEmails && $discussion_author->ID != $this->owner->AuthorID) {
             $subject = _t("Discussions.NewCreatedReplySubject", "{Nickname} replied to your discussion", null, array("Nickname" => $author->Nickname));
             $email = new Email($from, $discussion_author->Email, $subject);
             $email->setTemplate('NewCreatedReplyEmail');
             $email->populateTemplate($vars);
             $email->send();
         }
         // Send to anyone who liked this, if they want notifications
         foreach ($discussion->LikedBy() as $liked) {
             if ($liked->RecieveLikedReplyEmails && $liked->Email && $liked->ID != $author->ID) {
                 $subject = _t("Discussions.NewLikedReplySubject", "{Nickname} replied to your liked discussion", null, array("Nickname" => $author->Nickname));
                 $email = new Email($from, $liked->Email, $subject);
                 $email->setTemplate('NewLikedReplyEmail');
                 $email->populateTemplate($vars);
                 $email->send();
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-discussions,代码行数:35,代码来源:DiscussionsComment.php

示例9: doChangePassword

 /**
  * @param array $data
  * @return SS_HTTPResponse|void
  */
 function doChangePassword(array $data)
 {
     try {
         $token = Session::get('AutoLoginHash');
         $member = $this->password_manager->changePassword($token, @$data['NewPassword1'], @$data['NewPassword2']);
         Session::clear('AutoLoginHash');
         $back_url = isset($_REQUEST['BackURL']) ? $_REQUEST['BackURL'] : '/';
         return OpenStackIdCommon::loginMember($member, $back_url);
     } catch (InvalidResetPasswordTokenException $ex1) {
         Session::clear('AutoLoginHash');
         Controller::curr()->redirect('login');
     } catch (EmptyPasswordException $ex2) {
         $this->clearMessage();
         $this->sessionMessage(_t('Member.EMPTYNEWPASSWORD', "The new password can't be empty, please try again"), "bad");
         Controller::curr()->redirectBack();
     } catch (PasswordMismatchException $ex3) {
         $this->clearMessage();
         $this->sessionMessage(_t('Member.ERRORNEWPASSWORD', "You have entered your new password differently, try again"), "bad");
         Controller::curr()->redirectBack();
     } catch (InvalidPasswordException $ex4) {
         $this->clearMessage();
         $this->sessionMessage(sprintf(_t('Member.INVALIDNEWPASSWORD', "We couldn't accept that password: %s"), nl2br("\n" . $ex4->getMessage())), "bad");
         Controller::curr()->redirectBack();
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:29,代码来源:CustomChangePasswordForm.php

示例10: __construct

 /**
  *
  * Constructor for HiEngine
  *
  * Sets up the stream protocol handler
  */
 public function __construct()
 {
     $streams = stream_get_wrappers();
     if (!in_array('hi', $streams)) {
         stream_wrapper_register("hi", "HiEngineParser") or die(_t("Failed to register HiEngine stream protocol"));
     }
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:13,代码来源:hiengine.php

示例11: updateSettingsFields

    public function updateSettingsFields(FieldList $fields)
    {
        //removing view settings
        $fields->removeByName("CanViewType");
        $fields->removeByName("ViewerGroups");
        //adding view settings displaying the custom hard coded view settings
        $groups = $this->owner->DictatedViewerGroups();
        $groupsStr = '';
        if ($groups) {
            foreach ($groups as $g) {
                $groupsStr .= "{$g->Title}, ";
            }
            $groupsStr = rtrim($groupsStr, ', ');
        } else {
            $groupsStr = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
        }
        $fields->addFieldToTab('Root', LiteralField::create('CanViewTypeExpl', '
<div class="field fieldgroup fieldgroup">
	<label class="left">' . _t('SiteTree.ACCESSHEADER', "Who can view this page?") . '</label>
	<div class="middleColumn fieldgroup ">
		<p>
			<em>' . $groupsStr . '</em>
		</p>

	</div>
</div>
			'), 'CanEditType');
    }
开发者ID:helpfulrobot,项目名称:titledk-silverstripe-memberpages,代码行数:28,代码来源:MembersOnlyPageExtension.php

示例12: processPayment

 /**
  * Process the Cheque payment method
  */
 public function processPayment($data, $form)
 {
     $this->Status = 'Pending';
     $this->Message = '<p class="warningMessage">' . _t('ChequePayment.MESSAGE', 'Payment accepted via Cheque. Please note : products will not be shipped until payment has been received.') . '</p>';
     $this->write();
     return new Payment_Success();
 }
开发者ID:sheadawson,项目名称:silverstripe-payment,代码行数:10,代码来源:ChequePayment.php

示例13: updateCMSFields

 /**
  * Adds PublishDate to CMS Form.
  * @param $fields
  */
 function updateCMSFields(FieldList $fields)
 {
     $datefield = DatetimeField::create('PublishDate', _t('CMSPublishableDataExtension.PUBLISH_DATE', 'Publish date'));
     $datefield->getDateField()->setConfig('showcalendar', 1);
     // $datefield->setConfig('setLocale', en_US);
     $fields->addFieldToTab("Root.Main", $datefield, 'Content');
 }
开发者ID:helpfulrobot,项目名称:arillo-silverstripe-cleanutilities,代码行数:11,代码来源:PublishDateDataExtension.php

示例14: genCustomInputSubmitText

 protected function genCustomInputSubmitText($aInput)
 {
     return '<div class="bx-form-right-line-aligned">
                 <a href="' . BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password') . '">' . _t("_sys_txt_forgot_pasword") . '</a>
             </div>
             <div class="clear_both"></div>';
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:7,代码来源:BxBaseFormLogin.php

示例15: getHTMLFragments

 /**
  * Place the print button in a <p> tag below the field
  *
  * @param GridField
  *
  * @return array
  */
 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'print', _t('TableListField.Print', 'Print'), 'print', null);
     $button->setAttribute('data-icon', 'grid_print');
     $button->addExtraClass('gridfield-button-print');
     return array($this->targetFragment => '<p class="grid-print-button">' . $button->Field() . '</p>');
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:14,代码来源:GridFieldPrintButton.php


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