本文整理汇总了PHP中t函数的典型用法代码示例。如果您正苦于以下问题:PHP t函数的具体用法?PHP t怎么用?PHP t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了t函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* Authenticates the password.
* This is the 'authenticate' validator as declared in rules().
*/
public function authenticate($attribute, $params)
{
if (!$this->hasErrors()) {
$identity = new UserIdentity($this->username, $this->password);
$identity->authenticate();
switch ($identity->errorCode) {
case UserIdentity::ERROR_NONE:
$duration = $this->rememberMe ? Yii::app()->controller->module->rememberMeTime : 0;
Yii::app()->user->login($identity, $duration);
break;
case UserIdentity::ERROR_EMAIL_INVALID:
$this->addError("username", t("Email is incorrect."));
break;
case UserIdentity::ERROR_USERNAME_INVALID:
$this->addError("username", t("Username is incorrect."));
break;
case UserIdentity::ERROR_STATUS_NOTACTIV:
$this->addError("status", t("You account is not activated."));
break;
case UserIdentity::ERROR_STATUS_BAN:
$this->addError("status", t("You account is blocked."));
break;
case UserIdentity::ERROR_PASSWORD_INVALID:
$this->addError("password", t("Password is incorrect."));
break;
}
}
}
开发者ID:kosenka,项目名称:yboard,代码行数:32,代码来源:UserLogin.php
示例2: __construct
public function __construct()
{
parent::__construct();
$oCommentModel = new CommentModel();
$sComment = $this->httpRequest->post('comment');
$sCurrentTime = $this->dateTime->get()->dateTime('Y-m-d H:i:s');
$iTimeDelay = (int) DbConfig::getSetting('timeDelaySendComment');
$sTable = $this->httpRequest->get('table');
$iRecipientId = $this->httpRequest->get('recipient', 'int');
$iSenderId = (int) $this->session->get('member_id');
if (!$oCommentModel->idExists($iRecipientId, $sTable)) {
\PFBC\Form::setError('form_comment', t('The comment recipient does not exists.'));
} elseif (!$oCommentModel->checkWaitSend($iSenderId, $iTimeDelay, $sCurrentTime, $sTable)) {
\PFBC\Form::setError('form_comment', Form::waitWriteMsg($iTimeDelay));
} elseif ($oCommentModel->isDuplicateContent($iSenderId, $sComment, $sTable)) {
\PFBC\Form::setError('form_comment', Form::duplicateContentMsg());
} else {
if (!$oCommentModel->add($sComment, $iRecipientId, $iSenderId, 1, $sCurrentTime, $sTable)) {
\PFBC\Form::setError('form_comment', t('Oops! Error when adding comment.'));
} else {
/* Clean All Data of CommentModel Cache */
(new Framework\Cache\Cache())->start(CommentCoreModel::CACHE_GROUP, null, null)->clear();
HeaderUrl::redirect(Uri::get('comment', 'comment', 'read', $sTable . ',' . $iRecipientId), t('The comment has been sent successfully!'));
}
}
unset($oCommentModel);
}
开发者ID:joswilson,项目名称:NotJustOK,代码行数:27,代码来源:CommentFormProcess.php
示例3: prepare_remote_upgrade
public function prepare_remote_upgrade($remoteMPID = 0)
{
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
$mri = MarketplaceRemoteItem::getByID($remoteMPID);
if (!is_object($mri)) {
$this->set('error', array(t('Invalid marketplace item ID.')));
return;
}
$local = Package::getbyHandle($mri->getHandle());
if (!is_object($local) || $local->isPackageInstalled() == false) {
$this->set('error', array(Package::E_PACKAGE_NOT_FOUND));
return;
}
$r = $mri->downloadUpdate();
if ($r != false) {
if (!is_array($r)) {
$this->set('error', array($r));
} else {
$errors = Package::mapError($r);
$this->set('error', $errors);
}
} else {
$this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle());
}
}
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:27,代码来源:update.php
示例4: cmstheme_breadcrumb
/**
* Implemensts hook_breadcrumb().
*
* [email protected] check if there is a better way to do this...
*/
function cmstheme_breadcrumb($variables)
{
$breadcrumb = $variables['breadcrumb'];
$nid = arg(1);
if (is_numeric($nid)) {
$node = node_load($nid);
}
if (!empty($breadcrumb)) {
$output = '<div class="breadcrumb you-are-here">' . t('Du er her: ') . '</div>';
$title = drupal_get_title();
$breadcrumb[0] = l(t('Forside'), '<front>', array('attributes' => array('title' => 'Forside')));
$breadcrumb[] = '<a href="#" title="' . $title . '">' . $title . '</a>';
if ($title == 'Søg') {
unset($breadcrumb);
$breadcrumb[0] = l(t('Forside'), '<front>', array('attributes' => array('title' => 'Forside')));
$breadcrumb[] = '<a href="#" title="Søgning">Søgning</a>';
}
if (isset($node) && is_object($node) && $node->type == 'meeting') {
unset($breadcrumb);
$breadcrumb[0] = l(t('Forside'), '<front>', array('attributes' => array('title' => 'Forside')));
$breadcrumb[] = l(t('Politik & planer'), 'politik-og-planer', array('attributes' => array('title' => 'Politik og planer')));
$breadcrumb[] = l(t('Søg i dagsordener og referater'), 'dagsorden-og-referat', array('attributes' => array('title' => 'Søg i dagsordner og referater')));
$breadcrumb[] = l(t($title), '#');
}
$output .= '<div class="breadcrumb">' . implode('<div class="bread-crumb"> > </div> ', $breadcrumb) . '</div>';
return $output;
}
}
开发者ID:odsherred,项目名称:odsherred.dk,代码行数:33,代码来源:template.php
示例5: testUriFunctions
/**
* Test the getViaUri() and getViaScheme() methods and target functions.
*/
function testUriFunctions()
{
$config = $this->config('system.file');
$instance = \Drupal::service('stream_wrapper_manager')->getViaUri($this->scheme . '://foo');
$this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.');
$instance = \Drupal::service('stream_wrapper_manager')->getViaUri('public://foo');
$this->assertEqual('Drupal\\Core\\StreamWrapper\\PublicStream', get_class($instance), 'Got correct class type for public URI.');
// Test file_uri_target().
$this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.');
$this->assertEqual(file_uri_target('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Got a valid stream target from a data URI.'));
$this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
$this->assertFalse(file_uri_target('public://'), 'public:// has no target.');
$this->assertFalse(file_uri_target('data:'), 'data: has no target.');
// Test file_build_uri() and
// Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath().
$this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
$this->assertEqual(\Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.');
$this->assertEqual(\Drupal::service('stream_wrapper_manager')->getViaScheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.');
$config->set('default_scheme', 'private')->save();
$this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
// Test file_create_url()
// TemporaryStream::getExternalUrl() uses Url::fromRoute(), which needs
// route information to work.
$this->container->get('router.builder')->rebuild();
$this->assertTrue(strpos(file_create_url('temporary://test.txt'), 'system/temporary?file=test.txt'), 'Temporary external URL correctly built.');
$this->assertTrue(strpos(file_create_url('public://test.txt'), Settings::get('file_public_path') . '/test.txt'), 'Public external URL correctly built.');
$this->assertTrue(strpos(file_create_url('private://test.txt'), 'system/files/test.txt'), 'Private external URL correctly built.');
}
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:31,代码来源:StreamWrapperTest.php
示例6: testInputDemoForm
/**
* Test example forms provided by fapi_example.
*/
public function testInputDemoForm()
{
// Test for a link to the form_example in the Tools menu.
$this->drupalGet('');
$this->assertResponse(200, 'The Home page is available.');
$this->assertLinkByHref('examples/fapi_example');
// Test for a link to the simple_form example on the form_example page.
$this->drupalGet('examples/fapi_example');
$this->assertLinkByHref('examples/fapi_example/input_demo');
// Verify that anonymous can access the simpletest_examples page.
$this->drupalGet('examples/fapi_example/input_demo');
$this->assertResponse(200, 'The Demo of Common Input Elements page is available.');
// Post the form.
$edit = ['tests_taken[SAT]' => TRUE, 'color' => '#ff6bf1', 'expiration' => '2015-10-21', 'email' => '[email protected]', 'quantity' => '4', 'password' => 'letmein', 'password_confirm[pass1]' => 'letmein', 'password_confirm[pass2]' => 'letmein', 'size' => '76', 'active' => '1', 'search' => 'my search string', 'favorite' => 'blue', 'phone' => '555-555-5555', 'table[1]' => TRUE, 'table[3]' => TRUE, 'text' => 'This is a test of my form.', 'subject' => 'Form test', 'weight' => '3'];
$this->drupalPostForm('/examples/fapi_example/input_demo', $edit, t('Submit'));
$this->assertText('Value for What standardized tests did you take?: Array ( [SAT] => SAT )');
$this->assertText('Value for Color: #ff6bf1');
$this->assertText('Value for Content expiration: 2015-10-21');
$this->assertText('Value for Email: [email protected]');
$this->assertText('Value for Quantity: 4');
$this->assertText('Value for Password: letmein');
$this->assertText('Value for New Password: letmein');
$this->assertText('Value for Size: 76');
$this->assertText('Value for active: 1');
$this->assertText('Value for Search: my search string');
$this->assertText('Value for Favorite color: blue');
$this->assertText('Value for Phone: 555-555-5555');
$this->assertText('Value for Users: Array ( [1] => 1 [3] => 3 )');
$this->assertText('Value for Text: This is a test of my form.');
$this->assertText('Value for Subject: Form test');
$this->assertText('Value for Weight: 3');
}
开发者ID:alexburrows,项目名称:cream-2.x,代码行数:35,代码来源:InputDemoTest.php
示例7: testReEnabledField
/**
* Test the behavior of a field module after being disabled and re-enabled.
*/
function testReEnabledField()
{
// Add a telephone field to the article content type.
$field_storage = entity_create('field_storage_config', array('name' => 'field_telephone', 'entity_type' => 'node', 'type' => 'telephone'));
$field_storage->save();
entity_create('field_instance_config', array('field_storage' => $field_storage, 'bundle' => 'article', 'label' => 'Telephone Number'))->save();
entity_get_form_display('node', 'article', 'default')->setComponent('field_telephone', array('type' => 'telephone_default', 'settings' => array('placeholder' => '123-456-7890')))->save();
entity_get_display('node', 'article', 'default')->setComponent('field_telephone', array('type' => 'telephone_link', 'weight' => 1))->save();
// Display the article node form and verify the telephone widget is present.
$this->drupalGet('node/add/article');
$this->assertFieldByName("field_telephone[0][value]", '', 'Widget found.');
// Submit an article node with a telephone field so data exist for the
// field.
$edit = array('title[0][value]' => $this->randomName(), 'field_telephone[0][value]' => "123456789");
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertRaw('<a href="tel:123456789">');
// Test that the module can't be uninstalled from the UI while there is data
// for it's fields.
$admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules'));
$this->drupalLogin($admin_user);
$this->drupalGet('admin/modules');
$this->assertText('Fields type(s) in use');
$field_storage->delete();
$this->drupalGet('admin/modules');
$this->assertText('Fields pending deletion');
$this->cronRun();
$this->assertNoText('Fields type(s) in use');
$this->assertNoText('Fields pending deletion');
}
开发者ID:alnutile,项目名称:drunatra,代码行数:32,代码来源:reEnableModuleFieldTest.php
示例8: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array();
$filters = array("t" => 14);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array(), array('t'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 13
echo "<a href=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["url"]) ? $context["url"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "addClass", array(0 => "feed-icon"), "method"), "html", null, true));
echo ">\n ";
// line 14
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->renderVar(t("Subscribe to @title", array("@title" => isset($context["title"]) ? $context["title"] : null))));
echo "\n</a>\n";
}
开发者ID:OCIODOE,项目名称:drupal8,代码行数:28,代码来源:4e8adf0e8cae99397b0688f558f6863de5fc0fd1bb8d110086e07e0cd06416d9.php
示例9: shareaholic_form_node_form_alter
/**
* Implements hook_form_node_form_alter().
*
* When the node form is presented, add additional options
* for Shareaholic Apps
*
* @param Array $form - Nested array of form elements
* @param Array $form_state - keyed array containing form state
* @param $form_id - String representing the name of the form itself
*/
function shareaholic_form_node_form_alter(&$form, &$form_state, $form_id)
{
$node = $form['#node'];
$form['shareaholic_options'] = array('#type' => 'fieldset', '#access' => TRUE, '#title' => 'Shareaholic Options', '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', '#weight' => 100);
// I have to namespace it this way because Drupal can't add
// the shareholic_options name to it
// when you process the form on submit!!!
$form['shareaholic_options']['shareaholic_hide_share_buttons'] = array('#type' => 'checkbox', '#title' => 'Hide Share Buttons');
$form['shareaholic_options']['shareaholic_hide_recommendations'] = array('#type' => 'checkbox', '#title' => 'Hide Related Content');
$form['shareaholic_options']['shareaholic_exclude_from_recommendations'] = array('#type' => 'checkbox', '#title' => 'Exclude from Related Content');
$form['shareaholic_options']['shareaholic_exclude_og_tags'] = array('#type' => 'checkbox', '#title' => 'Do not include Open Graph tags');
if (!db_table_exists('shareaholic_content_settings')) {
$form['shareaholic_options']['shareaholic_message'] = array('#type' => 'markup', '#markup' => '<p style="color:#FF0000;">' . t('Action required: you have some pending updates required by Shareaholic. Please go to update.php for more information.') . '</p>');
}
if ($node->shareaholic_options['shareaholic_exclude_from_recommendations']) {
$form['shareaholic_options']['shareaholic_exclude_from_recommendations']['#attributes'] = array('checked' => 'checked');
}
if ($node->shareaholic_options['shareaholic_hide_recommendations']) {
$form['shareaholic_options']['shareaholic_hide_recommendations']['#attributes'] = array('checked' => 'checked');
}
if ($node->shareaholic_options['shareaholic_hide_share_buttons']) {
$form['shareaholic_options']['shareaholic_hide_share_buttons']['#attributes'] = array('checked' => 'checked');
}
if ($node->shareaholic_options['shareaholic_exclude_og_tags']) {
$form['shareaholic_options']['shareaholic_exclude_og_tags']['#attributes'] = array('checked' => 'checked');
}
}
开发者ID:reasonat,项目名称:women,代码行数:37,代码来源:node.php
示例10: propertyDefinitions
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition)
{
$properties['value'] = DataDefinition::create('string')->setLabel(t('Text'))->setRequired(TRUE);
$properties['format'] = DataDefinition::create('filter_format')->setLabel(t('Text format'));
$properties['processed'] = DataDefinition::create('string')->setLabel(t('Processed text'))->setDescription(t('The text with the text format applied.'))->setComputed(TRUE)->setClass('\\Drupal\\text\\TextProcessed')->setSetting('text source', 'value');
return $properties;
}
开发者ID:nstielau,项目名称:drops-8,代码行数:10,代码来源:TextItemBase.php
示例11: testFormsWithOverrides
/**
* Tests that overrides do not affect forms or listing screens.
*/
public function testFormsWithOverrides()
{
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$original_label = 'Default';
$overridden_label = 'Overridden label';
$edited_label = 'Edited label';
$config_test_storage = $this->container->get('entity.manager')->getStorage('config_test');
// Set up an override.
$settings['config']['config_test.dynamic.dotted.default']['label'] = (object) array('value' => $overridden_label, 'required' => TRUE);
$this->writeSettings($settings);
// Test that the overridden label is loaded with the entity.
$this->assertEqual($config_test_storage->load('dotted.default')->label(), $overridden_label);
// Test that the original label on the listing page is intact.
$this->drupalGet('admin/structure/config_test');
$this->assertText($original_label);
$this->assertNoText($overridden_label);
// Test that the original label on the editing page is intact.
$this->drupalGet('admin/structure/config_test/manage/dotted.default');
$elements = $this->xpath('//input[@name="label"]');
$this->assertIdentical((string) $elements[0]['value'], $original_label);
$this->assertNoText($overridden_label);
// Change to a new label and test that the listing now has the edited label.
$edit = array('label' => $edited_label);
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalGet('admin/structure/config_test');
$this->assertNoText($overridden_label);
$this->assertText($edited_label);
// Test that the editing page now has the edited label.
$this->drupalGet('admin/structure/config_test/manage/dotted.default');
$elements = $this->xpath('//input[@name="label"]');
$this->assertIdentical((string) $elements[0]['value'], $edited_label);
// Test that the overridden label is still loaded with the entity.
$this->assertEqual($config_test_storage->load('dotted.default')->label(), $overridden_label);
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:37,代码来源:ConfigEntityFormOverrideTest.php
示例12: get
function get()
{
require_once 'include/acl_selectors.php';
if (!local_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
if (\App::$argc != 2) {
return;
}
$contact_id = intval(\App::$argv[1]);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval(local_channel()));
if (!count($r)) {
notice(t('Contact not found.') . EOL);
return;
}
$contact = $r[0];
$o = '<h3>' . t('Suggest Friends') . '</h3>';
$o .= '<div id="fsuggest-desc" >' . sprintf(t('Suggest a friend for %s'), $contact['name']) . '</div>';
$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
// FIXME contact_selector deprecated, removed
// $o .= contact_selector('suggest','suggest-select', false,
// array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));
$o .= '<div id="fsuggest-submit-wrapper"><input id="fsuggest-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div>';
$o .= '</form>';
return $o;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:27,代码来源:Fsuggest.php
示例13: __construct
public function __construct()
{
parent::__construct();
$oUser = new UserCore();
$oUserModel = new UserCoreModel();
$oExistsModel = new ExistsCoreModel();
$oValidate = new Validate();
$aUserData = json_decode($this->file->getFile('http://api.randomuser.me/?results=' . $this->httpRequest->post('num')), true);
foreach ($aUserData['results'] as $aUser) {
$aUser = $aUser['user'];
$sEmail = trim($aUser['email']);
$sUsername = trim($aUser['username']);
if ($oValidate->email($sEmail) && !$oExistsModel->email($sEmail) && $oValidate->username($sUsername)) {
$aData['username'] = $sUsername;
$aData['email'] = $sEmail;
$aData['first_name'] = $aUser['name']['first'];
$aData['last_name'] = $aUser['name']['last'];
$aData['password'] = $aUser['password'];
$aData['sex'] = $aUser['gender'];
$aData['match_sex'] = array($oUser->getMatchSex($aData['sex']));
$aData['country'] = 'US';
$aData['city'] = $aUser['location']['city'];
$aData['state'] = $aUser['location']['state'];
$aData['zip_code'] = $aUser['location']['zip'];
$aData['birth_date'] = $this->dateTime->get($aUser['dob'])->date('Y-m-d');
$aData['avatar'] = $aUser['picture']['large'];
$aData['ip'] = Ip::get();
$aData['profile_id'] = $oUserModel->add(escape($aData, true));
$this->_addAvatar($aData, $oUser);
}
}
unset($oUser, $oUserModel, $oExistsModel, $oValidate, $aUser, $aData, $aUserData);
\PFBC\Form::setSuccess('form_add_fake_profiles', t('Users has been successfully added.'));
}
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:34,代码来源:AddFakeProfilesFormProcess.php
示例14: check_index
/**
* @return string An error message suitable for inclusion in the task log
*/
static function check_index()
{
list($remaining) = search::stats();
if ($remaining) {
site_status::warning(t('Your search index needs to be updated. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), "search_index_out_of_date");
}
}
开发者ID:viosca,项目名称:gallery3,代码行数:10,代码来源:search.php
示例15: testRequiredAttributes
/**
* Test that required alt/title fields gets validated right.
*/
function testRequiredAttributes()
{
$field_name = strtolower($this->randomMachineName());
$field_settings = array('alt_field' => 1, 'alt_field_required' => 1, 'title_field' => 1, 'title_field_required' => 1, 'required' => 1);
$instance = $this->createImageField($field_name, 'article', array(), $field_settings);
$images = $this->drupalGetTestFiles('image');
// Let's just use the first image.
$image = $images[0];
$this->uploadNodeImage($image, $field_name, 'article');
// Look for form-required for the alt text.
$elements = $this->xpath('//label[@for="edit-' . $field_name . '-0-alt" and @class="js-form-required form-required"]/following-sibling::input[@id="edit-' . $field_name . '-0-alt"]');
$this->assertTrue(isset($elements[0]), 'Required marker is shown for the required alt text.');
$elements = $this->xpath('//label[@for="edit-' . $field_name . '-0-title" and @class="js-form-required form-required"]/following-sibling::input[@id="edit-' . $field_name . '-0-title"]');
$this->assertTrue(isset($elements[0]), 'Required marker is shown for the required title text.');
$this->assertText(t('Alternative text field is required.'));
$this->assertText(t('Title field is required.'));
$instance->setSetting('alt_field_required', 0);
$instance->setSetting('title_field_required', 0);
$instance->save();
$edit = array('title[0][value]' => $this->randomMachineName());
$this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
$this->assertNoText(t('Alternative text field is required.'));
$this->assertNoText(t('Title field is required.'));
$instance->setSetting('required', 0);
$instance->setSetting('alt_field_required', 1);
$instance->setSetting('title_field_required', 1);
$instance->save();
$edit = array('title[0][value]' => $this->randomMachineName());
$this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
$this->assertNoText(t('Alternative text field is required.'));
$this->assertNoText(t('Title field is required.'));
}
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:35,代码来源:ImageFieldValidateTest.php
示例16: getSummary
public function getSummary()
{
$pageTitle = '<h2>' . mt('monitoring', 'Monitoring Backend', 'setup.page.title') . '</h2>';
$backendDescription = '<p>' . sprintf(mt('monitoring', 'Icinga Web 2 will retrieve information from your monitoring environment' . ' using a backend called "%s" and the specified resource below:'), $this->data['backendConfig']['name']) . '</p>';
if ($this->data['resourceConfig']['type'] === 'db') {
$resourceTitle = '<h3>' . mt('monitoring', 'Database Resource') . '</h3>';
$resourceHtml = '' . '<table>' . '<tbody>' . '<tr>' . '<td><strong>' . t('Resource Name') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['name'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Database Type') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['db'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Host') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['host'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Port') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['port'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Database Name') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['dbname'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Username') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['username'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Password') . '</strong></td>' . '<td>' . str_repeat('*', strlen($this->data['resourceConfig']['password'])) . '</td>' . '</tr>';
if (isset($this->data['resourceConfig']['ssl_key']) && $this->data['resourceConfig']['ssl_key']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('SSL Key') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_key'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_cert']) && $this->data['resourceConfig']['ssl_cert']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('SSL Cert') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_cert'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_ca']) && $this->data['resourceConfig']['ssl_ca']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('CA') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_ca'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_capath']) && $this->data['resourceConfig']['ssl_capath']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('CA Path') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_capath'] . '</td>' . '</tr>';
}
if (isset($this->data['resourceConfig']['ssl_cipher']) && $this->data['resourceConfig']['ssl_cipher']) {
$resourceHtml .= '' . '<tr>' . '<td><strong>' . t('Cipher') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['ssl_cipher'] . '</td>' . '</tr>';
}
$resourceHtml .= '' . '</tbody>' . '</table>';
} else {
// $this->data['resourceConfig']['type'] === 'livestatus'
$resourceTitle = '<h3>' . mt('monitoring', 'Livestatus Resource') . '</h3>';
$resourceHtml = '' . '<table>' . '<tbody>' . '<tr>' . '<td><strong>' . t('Resource Name') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['name'] . '</td>' . '</tr>' . '<tr>' . '<td><strong>' . t('Socket') . '</strong></td>' . '<td>' . $this->data['resourceConfig']['socket'] . '</td>' . '</tr>' . '</tbody>' . '</table>';
}
return $pageTitle . '<div class="topic">' . $backendDescription . $resourceTitle . $resourceHtml . '</div>';
}
开发者ID:0svald,项目名称:icingaweb2,代码行数:30,代码来源:BackendStep.php
示例17: city_magazine_comment_post_forbidden
/**
* Theme a "you can't post comments" notice.
*
* @param $node
* The comment node.
* @ingroup themeable
*/
function city_magazine_comment_post_forbidden($node)
{
global $user;
static $authenticated_post_comments;
if (!$user->uid) {
if (!isset($authenticated_post_comments)) {
// We only output any link if we are certain, that users get permission
// to post comments by logging in. We also locally cache this information.
$authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval'));
}
if ($authenticated_post_comments) {
// We cannot use drupal_get_destination() because these links
// sometimes appear on /node and taxonomy listing pages.
if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$destination = 'destination=' . rawurlencode("comment/reply/{$node->nid}#comment-form");
} else {
$destination = 'destination=' . rawurlencode("node/{$node->nid}#comment-form");
}
if (variable_get('user_register', 1)) {
// Users can register themselves.
// original
//return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">or</span> <a href="@register"><span>register</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
// no register
return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination))));
} else {
// Only admins can add new users, no public registration.
return t('<a href="@login"><span>Login</span></a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
}
}
}
}
开发者ID:knieper,项目名称:crltmich,代码行数:38,代码来源:template.php
示例18: hook_fivestar_target_info
/**
* Implementation of hook_fivestar_target_info().
*
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structures for the $field.
*
* @return array
* An array of key => value pairs. Each key must be unique the identifier for this
* target selection. The Value is an array of key => value pairs for a title and a
* callback function. The title value is used for displaying in the #options array
* of the target selection option. The callback function is used when trying to decided
* which target the current vote should be cast against.
*
* @see fivestar_get_targets()
* @see fivestar_fivestar_target_info()
*/
function hook_fivestar_target_info($field, $instance)
{
$entity_type = $instance['entity_type'];
$bundle = $instance['bundle'];
$options = array('example_node_author' => array('title' => t('Node Author'), 'callback' => '_example_target_node_author'));
return $options;
}
开发者ID:ssj1053,项目名称:cvillecouncilus,代码行数:25,代码来源:fivestar.api.php
示例19: _get_admin_form
private function _get_admin_form()
{
$form = new Forge("admin/hide/save", "", "post", array("id" => "g-hide-admin-form"));
$form->dropdown("access_permissions")->label(t("Who can see hidden items?"))->options(hide::get_groups_as_dropdown_options())->selected(module::get_var("hide", "access_permissions"));
$form->submit("save")->value(t("Save"));
return $form;
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:admin_hide.php
示例20: addLanguage
/**
* Adds a language.
*
* @param string $langcode
* The language code of the language to add.
*/
protected function addLanguage($langcode)
{
$edit = array('predefined_langcode' => $langcode);
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
$this->container->get('language_manager')->reset();
$this->assertTrue(\Drupal::languageManager()->getLanguage($langcode), SafeMarkup::format('Language %langcode added.', array('%langcode' => $langcode)));
}
开发者ID:isramv,项目名称:camp-gdl,代码行数:13,代码来源:LocaleUpdateBase.php
注:本文中的t函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论