• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP language_list函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: summary

 /**
  * {@inheritdoc}
  */
 public function summary()
 {
     $language_list = language_list(LanguageInterface::STATE_ALL);
     $selected = $this->configuration['langcodes'];
     // Reduce the language list to an array of language names.
     $language_names = array_reduce($language_list, function (&$result, $item) use($selected) {
         // If the current item of the $language_list array is one of the selected
         // languages, add it to the $results array.
         if (!empty($selected[$item->getId()])) {
             $result[$item->getId()] = $item->name;
         }
         return $result;
     }, array());
     // If we have more than one language selected, separate them by commas.
     if (count($this->configuration['langcodes']) > 1) {
         $languages = implode(', ', $language_names);
     } else {
         // If we have just one language just grab the only present value.
         $languages = array_pop($language_names);
     }
     if (!empty($this->configuration['negate'])) {
         return t('The language is not @languages.', array('@languages' => $languages));
     }
     return t('The language is @languages.', array('@languages' => $languages));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:28,代码来源:Language.php


示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form = array();
     // Initialize a language list to the ones available, including English.
     $languages = language_list();
     $existing_languages = array();
     foreach ($languages as $langcode => $language) {
         $existing_languages[$langcode] = $language->name;
     }
     // If we have no languages available, present the list of predefined languages
     // only. If we do have already added languages, set up two option groups with
     // the list of existing and then predefined languages.
     if (empty($existing_languages)) {
         $language_options = $this->languageManager->getStandardLanguageListWithoutConfigured();
     } else {
         $language_options = array($this->t('Existing languages') => $existing_languages, $this->t('Languages not yet added') => $this->languageManager->getStandardLanguageListWithoutConfigured());
     }
     $form['mappings'] = array('#tree' => TRUE, '#theme' => 'language_negotiation_configure_browser_form_table');
     $mappings = $this->language_get_browser_drupal_langcode_mappings();
     foreach ($mappings as $browser_langcode => $drupal_langcode) {
         $form['mappings'][$browser_langcode] = array('browser_langcode' => array('#type' => 'textfield', '#default_value' => $browser_langcode, '#size' => 20, '#required' => TRUE), 'drupal_langcode' => array('#type' => 'select', '#options' => $language_options, '#default_value' => $drupal_langcode, '#required' => TRUE));
     }
     // Add empty row.
     $form['new_mapping'] = array('#type' => 'details', '#title' => $this->t('Add a new mapping'), '#tree' => TRUE);
     $form['new_mapping']['browser_langcode'] = array('#type' => 'textfield', '#title' => $this->t('Browser language code'), '#description' => $this->t('Use language codes as <a href="@w3ctags">defined by the W3C</a> for interoperability. <em>Examples: "en", "en-gb" and "zh-hant".</em>', array('@w3ctags' => 'http://www.w3.org/International/articles/language-tags/')), '#default_value' => '', '#size' => 20);
     $form['new_mapping']['drupal_langcode'] = array('#type' => 'select', '#title' => $this->t('Drupal language'), '#options' => $language_options, '#default_value' => '');
     return parent::buildForm($form, $form_state);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:31,代码来源:NegotiationBrowserForm.php


示例3: getManagedTargets

 public function getManagedTargets($as_detailed_objects = FALSE)
 {
     lingotek_add_missing_locales();
     // fills in any missing lingotek_locale values to the languages table
     $targets_drupal = language_list();
     $default_language = language_default();
     $targets = array();
     foreach ($targets_drupal as $key => $target) {
         $is_source = $default_language->language == $target->language;
         $is_lingotek_managed = $target->lingotek_enabled;
         if ($is_source) {
             continue;
             // skip, since the source language is not a target
         } else {
             if (!$is_lingotek_managed) {
                 continue;
                 // skip, since lingotek is not managing the language
             }
         }
         $target->active = $target->lingotek_enabled;
         $targets[$key] = $target;
     }
     $result = $as_detailed_objects ? $targets : array_map(create_function('$obj', 'return $obj->lingotek_locale;'), $targets);
     return $result;
 }
开发者ID:bunnywong,项目名称:isnatura.com.hk,代码行数:25,代码来源:LingotekAccount.php


示例4: __construct

 function __construct($path)
 {
     parent::__construct($path);
     $this->filename = 'sitemap_images';
     $this->node_image_loader = new NodeImagesLoader();
     $this->available_langs = language_list();
 }
开发者ID:Samuel-Moncarey,项目名称:custom_sitemap,代码行数:7,代码来源:SimplemapImageGenerator.php


示例5: deliver

 /**
  * Override parent deliver() function.
  */
 public function deliver(array $output = array())
 {
     $plugin = $this->plugin;
     $message = $this->message;
     $options = $plugin['options'];
     $account = user_load($message->uid);
     $mail = !empty($options['mail']) ? $options['mail'] : $account->mail;
     $languages = language_list();
     if (!$options['language override']) {
         $lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language] : language_default();
     } else {
         $lang = $languages[$message->language];
     }
     // The subject in an email can't be with HTML, so strip it.
     $output['message_notify_email_subject'] = strip_tags($output['message_notify_email_subject']);
     // Allow for overriding the 'from' of the message.
     $from = isset($options['from']) ? $options['from'] : NULL;
     $from_account = !empty($message->user->uid) ? user_load($message->user->uid) : $account;
     $mimemail_name = variable_get('mimemail_name', t('Atrium'));
     $from = array('name' => oa_core_realname($from_account) . ' (' . $mimemail_name . ')', 'mail' => is_array($from) ? $from['mail'] : $from);
     // Pass the message entity along to hook_drupal_mail().
     $output['message_entity'] = $message;
     if (!empty($message->email_attachments)) {
         $output['attachments'] = isset($output['attachments']) ? $output['attachments'] : array();
         $output['attachments'] = array_merge($message->email_attachments, $output['attachments']);
     }
     return drupal_mail('message_notify', $message->type, $mail, $lang, $output, $from);
 }
开发者ID:redponey,项目名称:openatrium-7.x-2.51,代码行数:31,代码来源:OaEmail.class.php


示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $filter_values = $this->translateFilterValues();
     $langcode = $filter_values['langcode'];
     $this->languageManager->reset();
     $languages = language_list();
     $langname = isset($langcode) ? $languages[$langcode]->name : "- None -";
     $form['#attached']['library'][] = 'locale/drupal.locale.admin';
     $form['langcode'] = array('#type' => 'value', '#value' => $filter_values['langcode']);
     $form['strings'] = array('#type' => 'item', '#tree' => TRUE, '#language' => $langname, '#theme' => 'locale_translate_edit_form_strings');
     if (isset($langcode)) {
         $strings = $this->translateFilterLoadStrings();
         $plural_formulas = $this->state->get('locale.translation.plurals') ?: array();
         foreach ($strings as $string) {
             // Cast into source string, will do for our purposes.
             $source = new SourceString($string);
             // Split source to work with plural values.
             $source_array = $source->getPlurals();
             $translation_array = $string->getPlurals();
             if (count($source_array) == 1) {
                 // Add original string value and mark as non-plural.
                 $form['strings'][$string->lid]['plural'] = array('#type' => 'value', '#value' => 0);
                 $form['strings'][$string->lid]['original'] = array('#type' => 'item', '#title' => $this->t('Source string (@language)', array('@language' => $this->t('Built-in English'))), '#title_display' => 'invisible', '#markup' => '<span lang="en">' . String::checkPlain($source_array[0]) . '</span>');
             } else {
                 // Add original string value and mark as plural.
                 $form['strings'][$string->lid]['plural'] = array('#type' => 'value', '#value' => 1);
                 $form['strings'][$string->lid]['original_singular'] = array('#type' => 'item', '#title' => $this->t('Singular form'), '#markup' => '<span lang="en">' . String::checkPlain($source_array[0]) . '</span>', '#prefix' => '<span class="visually-hidden">' . $this->t('Source string (@language)', array('@language' => $this->t('Built-in English'))) . '</span>');
                 $form['strings'][$string->lid]['original_plural'] = array('#type' => 'item', '#title' => $this->t('Plural form'), '#markup' => '<span lang="en">' . String::checkPlain($source_array[1]) . '</span>');
             }
             if (!empty($string->context)) {
                 $form['strings'][$string->lid]['context'] = array('#type' => 'value', '#value' => '<span lang="en">' . String::checkPlain($string->context) . '</span>');
             }
             // Approximate the number of rows to use in the default textarea.
             $rows = min(ceil(str_word_count($source_array[0]) / 12), 10);
             if (empty($form['strings'][$string->lid]['plural']['#value'])) {
                 $form['strings'][$string->lid]['translations'][0] = array('#type' => 'textarea', '#title' => $this->t('Translated string (@language)', array('@language' => $langname)), '#title_display' => 'invisible', '#rows' => $rows, '#default_value' => $translation_array[0], '#attributes' => array('lang' => $langcode));
             } else {
                 // Dealing with plural strings.
                 if (isset($plural_formulas[$langcode]['plurals']) && $plural_formulas[$langcode]['plurals'] > 2) {
                     // Add a textarea for each plural variant.
                     for ($i = 0; $i < $plural_formulas[$langcode]['plurals']; $i++) {
                         $form['strings'][$string->lid]['translations'][$i] = array('#type' => 'textarea', '#title' => $i == 0 ? $this->t('Singular form') : format_plural($i, 'First plural form', '@count. plural form'), '#rows' => $rows, '#default_value' => isset($translation_array[$i]) ? $translation_array[$i] : '', '#attributes' => array('lang' => $langcode), '#prefix' => $i == 0 ? '<span class="visually-hidden">' . $this->t('Translated string (@language)', array('@language' => $langname)) . '</span>' : '');
                     }
                 } else {
                     // Fallback for unknown number of plurals.
                     $form['strings'][$string->lid]['translations'][0] = array('#type' => 'textarea', '#title' => $this->t('Singular form'), '#rows' => $rows, '#default_value' => $translation_array[0], '#attributes' => array('lang' => $langcode), '#prefix' => '<span class="visually-hidden">' . $this->t('Translated string (@language)', array('@language' => $langname)) . '</span>');
                     $form['strings'][$string->lid]['translations'][1] = array('#type' => 'textarea', '#title' => $this->t('Plural form'), '#rows' => $rows, '#default_value' => isset($translation_array[1]) ? $translation_array[1] : '', '#attributes' => array('lang' => $langcode));
                 }
             }
         }
         if (count(Element::children($form['strings']))) {
             $form['actions'] = array('#type' => 'actions');
             $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save translations'));
         }
     }
     return $form;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:60,代码来源:TranslateEditForm.php


示例7: addFilterWidget

 public function addFilterWidget(&$form, &$form_state, $form_id)
 {
     if ($this->active) {
         $options = array('' => t('-- Current (@lang) --', array('@lang' => t($GLOBALS['language']->name))), 'all' => t('-- All --'));
         foreach (language_list() as $key => $lang) {
             $options[$key] = t($lang->name);
         }
         $form['langselect'] = array('#type' => 'select', '#title' => t('Filter menu by language'), '#options' => $options, '#default_value' => $this->language, '#ajax' => array('callback' => '_content_menu_filter_elements_by_language'));
         $form['#content_menu_filter_widget'][] = 'langselect';
     }
 }
开发者ID:CuBoulder,项目名称:cu-express-drops-7,代码行数:11,代码来源:content_menu_language_filter.php


示例8: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Prepare a language object for saving.
     $languages = language_list();
     $langcode = $form_state['values']['langcode'];
     $language = $languages[$langcode];
     $language->name = $form_state['values']['name'];
     $language->direction = $form_state['values']['direction'];
     language_save($language);
     $form_state->setRedirect('language.admin_overview');
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:14,代码来源:LanguageEditForm.php


示例9: pdt_cookie_consent_form

/**
 * Formulaire de config multilingue, drupal 7
 * @return mixed
 */
function pdt_cookie_consent_form()
{
    $form = array();
    $languages = language_list();
    foreach ($languages as $language) {
        $lang = $language->language;
        $form[$lang] = array('#type' => "fieldset", '#title' => "Configuration pour le language " . $lang);
        $form[$lang]["pdt_cookie_consent_message_{$lang}"] = array('#title' => 'Message', '#type' => 'textfield', '#description' => '', '#default_value' => variable_get("pdt_cookie_consent_message_{$lang}", ""));
    }
    return system_settings_form($form);
}
开发者ID:nyl-auster,项目名称:snippets,代码行数:15,代码来源:drupal-7--config-form-multilingue.php


示例10: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     // Prepare a language object for saving.
     $languages = language_list();
     $langcode = $form_state['values']['langcode'];
     $language = $languages[$langcode];
     $language->name = $form_state['values']['name'];
     $language->direction = $form_state['values']['direction'];
     language_save($language);
     $form_state['redirect_route']['route_name'] = 'language.admin_overview';
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:14,代码来源:LanguageEditForm.php


示例11: validateForm

 /**
  * Implements \Drupal\Core\Form\FormInterface::validateForm().
  */
 public function validateForm(array &$form, FormStateInterface $form_state)
 {
     $languages = language_list();
     // Count repeated values for uniqueness check.
     $count = array_count_values($form_state->getValue('prefix'));
     foreach ($languages as $langcode => $language) {
         $value = $form_state->getValue(array('prefix', $langcode));
         if ($value === '') {
             if (!$language->isDefault() && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_PATH_PREFIX) {
                 // Throw a form error if the prefix is blank for a non-default language,
                 // although it is required for selected negotiation type.
                 $form_state->setErrorByName("prefix][{$langcode}", $this->t('The prefix may only be left blank for the default language.'));
             }
         } elseif (strpos($value, '/') !== FALSE) {
             // Throw a form error if the string contains a slash,
             // which would not work.
             $form_state->setErrorByName("prefix][{$langcode}", $this->t('The prefix may not contain a slash.'));
         } elseif (isset($count[$value]) && $count[$value] > 1) {
             // Throw a form error if there are two languages with the same
             // domain/prefix.
             $form_state->setErrorByName("prefix][{$langcode}", $this->t('The prefix for %language, %value, is not unique.', array('%language' => $language->name, '%value' => $value)));
         }
     }
     // Count repeated values for uniqueness check.
     $count = array_count_values($form_state->getValue('domain'));
     foreach ($languages as $langcode => $language) {
         $value = $form_state->getValue(array('domain', $langcode));
         if ($value === '') {
             if ($form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_DOMAIN) {
                 // Throw a form error if the domain is blank for a non-default language,
                 // although it is required for selected negotiation type.
                 $form_state->setErrorByName("domain][{$langcode}", $this->t('The domain may not be left blank for %language.', array('%language' => $language->name)));
             }
         } elseif (isset($count[$value]) && $count[$value] > 1) {
             // Throw a form error if there are two languages with the same
             // domain/domain.
             $form_state->setErrorByName("domain][{$langcode}", $this->t('The domain for %language, %value, is not unique.', array('%language' => $language->name, '%value' => $value)));
         }
     }
     // Domain names should not contain protocol and/or ports.
     foreach ($languages as $langcode => $name) {
         $value = $form_state->getValue(array('domain', $langcode));
         if (!empty($value)) {
             // Ensure we have exactly one protocol when checking the hostname.
             $host = 'http://' . str_replace(array('http://', 'https://'), '', $value);
             if (parse_url($host, PHP_URL_HOST) != $value) {
                 $form_state->setErrorByName("domain][{$langcode}", $this->t('The domain for %language may only contain the domain name, not a protocol and/or port.', array('%language' => $name)));
             }
         }
     }
     parent::validateForm($form, $form_state);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:55,代码来源:NegotiationUrlForm.php


示例12: simplemap_exclusions_form

function simplemap_exclusions_form()
{
    $create_rows = function () {
        $loader = new ExcludedNodesLoader();
        $excluded = $loader->loadExcludedNodes();
        $available_langs = language_list();
        return array_map(function ($node) use($available_langs) {
            // The link must be created in the original node language, not in the
            // current user language.
            $node_link = l($node->title, "node/{$node->nid}", ['language' => $available_langs[$node->language]]);
            $delete_link = l(t('Delete from Exclusion'), "admin/settings/simplemap/exclusions/{$node->nid}/delete");
            return [$node->nid, $node_link, $delete_link];
        }, $excluded);
    };
    return ['new_exclusion' => ['#type' => 'fieldset', '#title' => t('Add a new node to the exclusion list'), 'nid' => ['#type' => 'textfield', '#title' => t('NID'), '#required' => true], 'submit' => ['#type' => 'submit', '#value' => t('Add to the Exclusion List')]], 'existing_exclusions' => ['#type' => 'fieldset', '#title' => t('Nodes Excluded from Sitemaps'), 'list' => ['#theme' => 'table', '#header' => [t('NID'), t('Title'), ''], '#rows' => $create_rows()]]];
}
开发者ID:Samuel-Moncarey,项目名称:custom_sitemap,代码行数:16,代码来源:exclusions_form.php


示例13: renderLink

 /**
  * {@inheritdoc}
  */
 protected function renderLink($data, ResultRow $values)
 {
     if (!empty($this->options['link_to_user'])) {
         $uid = $this->getValue($values, 'uid');
         if ($this->view->getUser()->hasPermission('access user profiles') && $uid) {
             $this->options['alter']['make_link'] = TRUE;
             $this->options['alter']['path'] = 'user/' . $uid;
         }
     }
     if (empty($data)) {
         $lang = language_default();
     } else {
         $lang = language_list();
         $lang = $lang[$data];
     }
     return $this->sanitizeValue($lang->getName());
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:20,代码来源:Language.php


示例14: alterItems

 public function alterItems(array &$items)
 {
     // Prevent session information from being saved while indexing.
     drupal_save_session(FALSE);
     // Force the current user to anonymous to prevent access bypass in search
     // indexes.
     $original_user = $GLOBALS['user'];
     $GLOBALS['user'] = drupal_anonymous_user();
     $entity_type = $this->index->getEntityType();
     $entity_handler = panelizer_entity_plugin_get_handler($entity_type);
     foreach ($items as &$item) {
         $entity_id = entity_id($entity_type, $item);
         $item->search_api_panelizer_content = NULL;
         $item->search_api_panelizer_title = NULL;
         // If Search API specifies a language to view the item in, force the
         // global language_content to be Search API item language. Fieldable
         // panel panes will render in the correct language.
         if (isset($item->search_api_language)) {
             global $language_content;
             $original_language_content = $language_content;
             $languages = language_list();
             if (isset($languages[$item->search_api_language])) {
                 $language_content = $languages[$item->search_api_language];
             } else {
                 $language_content = language_default();
             }
         }
         try {
             if ($render_info = $entity_handler->render_entity($item, 'page_manager')) {
                 $item->search_api_panelizer_content = $render_info['content'];
                 $item->search_api_panelizer_title = !empty($render_info['title']) ? $render_info['title'] : NULL;
             }
         } catch (Exception $e) {
             watchdog_exception('panelizer', $e, 'Error indexing Panelizer content for %entity_type with ID %entity_id', array('%entity_type' => $entity_type, '%entity_id' => $entity_id));
         }
         // Restore the language_content global if it was overridden.
         if (isset($original_language_content)) {
             $language_content = $original_language_content;
         }
     }
     // Restore the user.
     $GLOBALS['user'] = $original_user;
     drupal_save_session(TRUE);
 }
开发者ID:GitError404,项目名称:favrskov.dk,代码行数:44,代码来源:PanelizerSearchApiAlterCallback.class.php


示例15: deliver

 public function deliver(array $output = array())
 {
     $plugin = $this->plugin;
     $message = $this->message;
     $options = $plugin['options'];
     $account = user_load($message->uid);
     $mail = $options['mail'] ? $options['mail'] : $account->mail;
     $languages = language_list();
     if (!$options['language override']) {
         $lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language] : language_default();
     } else {
         $lang = $languages[$message->language];
     }
     // The subject in an email can't be with HTML, so strip it.
     $output['message_notify_email_subject'] = strip_tags($output['message_notify_email_subject']);
     // Pass the message entity along to hook_drupal_mail().
     $output['message_entity'] = $message;
     return drupal_mail('message_notify', $message->type, $mail, $lang, $output);
 }
开发者ID:rexxllabore,项目名称:acme,代码行数:19,代码来源:MessageNotifierEmail.class.php


示例16: renderLink

 /**
  * Prepares link to the node.
  *
  * @param string $data
  *   The XSS safe string for the link text.
  * @param \Drupal\views\ResultRow $values
  *   The values retrieved from a single row of a view's query result.
  *
  * @return string
  *   Returns a string for the link text.
  */
 protected function renderLink($data, ResultRow $values)
 {
     if (!empty($this->options['link_to_node']) && !empty($this->additional_fields['nid'])) {
         if ($data !== NULL && $data !== '') {
             $this->options['alter']['make_link'] = TRUE;
             $this->options['alter']['path'] = "node/" . $this->getValue($values, 'nid');
             if (isset($this->aliases['langcode'])) {
                 $languages = language_list();
                 $langcode = $this->getValue($values, 'langcode');
                 if (isset($languages[$langcode])) {
                     $this->options['alter']['language'] = $languages[$langcode];
                 } else {
                     unset($this->options['alter']['language']);
                 }
             }
         } else {
             $this->options['alter']['make_link'] = FALSE;
         }
     }
     return $data;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:32,代码来源:Node.php


示例17: languageLinks

 /**
  * Give paths to all (or a subset) of the available translations
  */
 public function languageLinks($languages = NULL, $path = NULL)
 {
     if (!$languages) {
         $languages = \language_list();
     }
     if (!$path) {
         $path = \current_path();
     }
     $currentLanguage = $this->currentLanguage();
     $links = array();
     $switchLinks = $this->switchLinks($path);
     foreach ($languages as $code => $language) {
         if ($code == $currentLanguage) {
             continue;
         }
         if (isset($switchLinks[$code]) && isset($switchLinks[$code]['href']) && $this->checkAccess($switchLinks[$code]['href'], $code)) {
             $links[$code] = $switchLinks[$code];
         }
     }
     return $links;
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:24,代码来源:LanguageApi.php


示例18: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $config = $this->config('image_captcha.settings');
     // Add CSS and JS for theming and added usability on admin form.
     $form['#attached']['library'][] = 'captcha_image/base';
     // First some error checking.
     $setup_status = _image_captcha_check_setup(FALSE);
     if ($setup_status & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
         drupal_set_message(t('The Image CAPTCHA module can not generate images because your PHP setup does not support it (no <a href="!gdlib" target="_blank">GD library</a> with JPEG support).', ['!gdlib' => 'http://php.net/manual/en/book.image.php']), 'error');
         // It is no use to continue building the rest of the settings form.
         return $form;
     }
     $form['image_captcha_example'] = ['#type' => 'details', '#title' => t('Example'), '#description' => t('Presolved image CAPTCHA example, generated with the current settings.')];
     $form['image_captcha_example']['image'] = ['#type' => 'captcha', '#captcha_type' => 'image_captcha/Image', '#captcha_admin_mode' => TRUE];
     // General code settings.
     $form['image_captcha_code_settings'] = ['#type' => 'details', '#title' => t('Code settings')];
     $form['image_captcha_code_settings']['image_captcha_image_allowed_chars'] = ['#type' => 'textfield', '#title' => t('Characters to use in the code'), '#default_value' => $config->get('image_captcha_image_allowed_chars')];
     $form['image_captcha_code_settings']['image_captcha_code_length'] = ['#type' => 'select', '#title' => t('Code length'), '#options' => [2 => 2, 3, 4, 5, 6, 7, 8, 9, 10], '#default_value' => $config->get('image_captcha_code_length'), '#description' => t('The code length influences the size of the image. Note that larger values make the image generation more CPU intensive.')];
     // RTL support option (only show this option when there are RTL languages).
     $languages = language_list('direction');
     if (isset($languages[Language::DIRECTION_RTL])) {
         $form['image_captcha_code_settings']['image_captcha_rtl_support'] = ['#title' => t('RTL support'), '#type' => 'checkbox', '#default_value' => $config->get('image_captcha_rtl_support'), '#description' => t('Enable this option to render the code from right to left for right to left languages.')];
     }
     // Font related stuff.
     $form['image_captcha_font_settings'] = $this->settingsDotSection();
     // Color and file format settings.
     $form['image_captcha_color_settings'] = ['#type' => 'details', '#title' => t('Color and image settings'), '#description' => t('Configuration of the background, text colors and file format of the image CAPTCHA.')];
     $form['image_captcha_color_settings']['image_captcha_background_color'] = ['#type' => 'textfield', '#title' => t('Background color'), '#description' => t('Enter the hexadecimal code for the background color (e.g. #FFF or #FFCE90). When using the PNG file format with transparent background, it is recommended to set this close to the underlying background color.'), '#default_value' => $config->get('image_captcha_background_color'), '#maxlength' => 7, '#size' => 8];
     $form['image_captcha_color_settings']['image_captcha_foreground_color'] = ['#type' => 'textfield', '#title' => t('Text color'), '#description' => t('Enter the hexadecimal code for the text color (e.g. #000 or #004283).'), '#default_value' => $config->get('image_captcha_foreground_color'), '#maxlength' => 7, '#size' => 8];
     $form['image_captcha_color_settings']['image_captcha_foreground_color_randomness'] = ['#type' => 'select', '#title' => t('Additional variation of text color'), '#options' => [0 => t('No variation'), 50 => t('Little variation'), 100 => t('Medium variation'), 150 => t('High variation'), 200 => t('Very high variation')], '#default_value' => $config->get('image_captcha_foreground_color_randomness'), '#description' => t('The different characters will have randomized colors in the specified range around the text color.')];
     $form['image_captcha_color_settings']['image_captcha_file_format'] = ['#type' => 'select', '#title' => t('File format'), '#description' => t('Select the file format for the image. JPEG usually results in smaller files, PNG allows tranparency.'), '#default_value' => $config->get('image_captcha_file_format'), '#options' => [IMAGE_CAPTCHA_FILE_FORMAT_JPG => t('JPEG'), IMAGE_CAPTCHA_FILE_FORMAT_PNG => t('PNG'), IMAGE_CAPTCHA_FILE_FORMAT_TRANSPARENT_PNG => t('PNG with transparent background')]];
     // Distortion and noise settings.
     $form['image_captcha_distortion_and_noise'] = ['#type' => 'details', '#title' => t('Distortion and noise'), '#description' => t('With these settings you can control the degree of obfuscation by distortion and added noise. Do not exaggerate the obfuscation and assure that the code in the image is reasonably readable. For example, do not combine high levels of distortion and noise.')];
     $form['image_captcha_distortion_and_noise']['image_captcha_distortion_amplitude'] = ['#type' => 'select', '#title' => t('Distortion level'), '#options' => [0 => t('@level - no distortion', ['@level' => '0']), 1 => t('@level - low', ['@level' => '1']), 2 => '2', 3 => '3', 4 => '4', 5 => t('@level - medium', ['@level' => '5']), 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => t('@level - high', ['@level' => '10'])], '#default_value' => $config->get('image_captcha_distortion_amplitude'), '#description' => t('Set the degree of wave distortion in the image.')];
     $form['image_captcha_distortion_and_noise']['image_captcha_bilinear_interpolation'] = ['#type' => 'checkbox', '#title' => t('Smooth distortion'), '#default_value' => $config->get('image_captcha_bilinear_interpolation'), '#description' => t('This option enables bilinear interpolation of the distortion which makes the image look smoother, but it is more CPU intensive.')];
     $form['image_captcha_distortion_and_noise']['image_captcha_dot_noise'] = ['#type' => 'checkbox', '#title' => t('Add salt and pepper noise'), '#default_value' => $config->get('image_captcha_dot_noise'), '#description' => t('This option adds randomly colored point noise.')];
     $form['image_captcha_distortion_and_noise']['image_captcha_line_noise'] = ['#type' => 'checkbox', '#title' => t('Add line noise'), '#default_value' => $config->get('image_captcha_line_noise', 0), '#description' => t('This option enables lines randomly drawn on top of the text code.')];
     $form['image_captcha_distortion_and_noise']['image_captcha_noise_level'] = ['#type' => 'select', '#title' => t('Noise level'), '#options' => [1 => '1 - ' . t('low'), 2 => '2', 3 => '3 - ' . t('medium'), 4 => '4', 5 => '5 - ' . t('high'), 7 => '7', 10 => '10 - ' . t('severe')], '#default_value' => (int) $config->get('image_captcha_noise_level')];
     return parent::buildForm($form, $form_state);
 }
开发者ID:Wylbur,项目名称:gj,代码行数:43,代码来源:ImageCaptchaSettingsForm.php


示例19: access

 /**
  * Checks translation access for the entity and operation on the given route.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to check against.
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request object.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  * @param string $source
  *   (optional) For a create operation, the language code of the source.
  * @param string $target
  *   (optional) For a create operation, the language code of the translation.
  * @param string $language
  *   (optional) For an update or delete operation, the language code of the
  *   translation being updated or deleted.
  *
  * @return string
  *   A \Drupal\Core\Access\AccessInterface constant value.
  */
 public function access(Route $route, Request $request, AccountInterface $account, $source = NULL, $target = NULL, $language = NULL)
 {
     $entity_type = $request->attributes->get('_entity_type_id');
     /** @var $entity \Drupal\Core\Entity\EntityInterface */
     if ($entity = $request->attributes->get($entity_type)) {
         $operation = $route->getRequirement('_access_content_translation_manage');
         $controller = content_translation_controller($entity_type, $account);
         // Load translation.
         $translations = $entity->getTranslationLanguages();
         $languages = language_list();
         switch ($operation) {
             case 'create':
                 $source = language_load($source) ?: $entity->language();
                 $target = language_load($target) ?: \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
                 return $source->id != $target->id && isset($languages[$source->id]) && isset($languages[$target->id]) && !isset($translations[$target->id]) && $controller->getTranslationAccess($entity, $operation) ? static::ALLOW : static::DENY;
             case 'update':
             case 'delete':
                 $language = language_load($language) ?: \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
                 return isset($languages[$language->id]) && $language->id != $entity->getUntranslated()->language()->id && isset($translations[$language->id]) && $controller->getTranslationAccess($entity, $operation) ? static::ALLOW : static::DENY;
         }
     }
     return static::DENY;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:43,代码来源:ContentTranslationManageAccessCheck.php


示例20: style_list

window.location='index.php?page=usercp&uid=<?php 
echo $CURUSER["uid"];
?>
&do=pm&action=list'
// -->
}
</script>
<?php 
if (isset($CURUSER) && $CURUSER && $CURUSER["uid"] > 1) {
    print "<form name=\"jump1\" action=\"index.php\" method=\"post\">\n";
    ?>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<?php 
    $style = style_list();
    $langue = language_list();
    $block[0]["id"] = "yes";
    $block[0]["block"] = "side blocks";
    $block[1]["id"] = "nol";
    $block[1]["block"] = "no left";
    $block[2]["id"] = "nor";
    $block[2]["block"] = "no right";
    $block[3]["id"] = "no";
    $block[3]["block"] = "no blocks";
    // group image
    $rsr = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT picture FROM {$TABLE_PREFIX}users_level WHERE id_level=" . $CURUSER['id']);
    $rosr = mysqli_fetch_array($rsr);
    if ($rosr["picture"] == '') {
        $xx = '';
    } else {
        $xx = '<img src="images/ul/' . $rosr["picture"] . '">';
                      

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP language_load函数代码示例发布时间:2022-05-15
下一篇:
PHP language_get_default_configuration函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap