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

PHP language_default函数代码示例

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

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



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

示例1: 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


示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     // Set up an additional language.
     $this->langcodes = array(language_default()->getId(), 'es');
     ConfigurableLanguage::createFromLangcode('es')->save();
     // Create a content type.
     $this->bundle = $this->randomMachineName();
     $this->contentType = $this->drupalCreateContentType(array('type' => $this->bundle));
     // Enable translation for the current entity type and ensure the change is
     // picked up.
     content_translation_set_config('node', $this->bundle, 'enabled', TRUE);
     drupal_static_reset();
     \Drupal::entityManager()->clearCachedBundles();
     \Drupal::service('router.builder')->rebuild();
     // Add a translatable field to the content type.
     entity_create('field_storage_config', array('field_name' => 'field_test_text', 'entity_type' => 'node', 'type' => 'text', 'cardinality' => 1, 'translatable' => TRUE))->save();
     entity_create('field_config', array('entity_type' => 'node', 'field_name' => 'field_test_text', 'bundle' => $this->bundle, 'label' => 'Test text-field'))->save();
     entity_get_form_display('node', $this->bundle, 'default')->setComponent('field_test_text', array('type' => 'text_textfield', 'weight' => 0))->save();
     // Enable content translation.
     $configuration = array('langcode' => language_default()->getId(), 'language_show' => TRUE);
     language_save_default_configuration('node', $this->bundle, $configuration);
     // Create a translator user.
     $permissions = array('access contextual links', 'administer nodes', "edit any {$this->bundle} content", 'translate any entity');
     $this->translator = $this->drupalCreateUser($permissions);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:26,代码来源:ContentTranslationContextualLinksTest.php


示例3: libya_cron_subscription_mail

function libya_cron_subscription_mail($data)
{
    // subscription node
    $mail = $data[0];
    $nids = $data[1];
    // watchdog('actions', 'Cron subscription vars', func_get_args());
    global $siteName, $isMail, $base_url;
    $isMail = TRUE;
    $body = '<h1 style="font-size:1.25em;">Your alert subscription results from ' . $siteName . '</h1>
	<p class="no-margin">The following results match your subscription alert.</p>';
    foreach ($nids as $nid) {
        $N = node_load($nid);
        $content = strip_tags($N->body['und'][0]['value']);
        if (strlen($content) > 200) {
            $content = substr($content, 0, 200);
        }
        $CL = strrpos($content, ' ');
        $content = substr($content, 0, $CL) . '...';
        $body .= '<h2 style="font-size:1.25em;">' . l($N->title, 'node/' . $N->nid, array('attributes' => array('style' => array('text-decoration' => 'none')))) . '</h2><p>' . $content . '</p>
		<p>' . t('read more: ') . l($base_url . '/' . drupal_lookup_path('alias', 'node/' . $N->nid), 'node/' . $N->nid, array('absolute' => TRUE)) . '</p>
		<hr/>';
    }
    $data['message'] = 'Mail sent';
    $to = $mail['mail'];
    $from = variable_get('site_mail', '[email protected]');
    $params = array('body' => $body, 'rand' => $mail['rand'], 'to' => $to);
    $sent = drupal_mail('libya', 'subscription_alert_mail', $to, language_default(), $params, $from, TRUE);
}
开发者ID:vishacc,项目名称:libyanwarthetruth,代码行数:28,代码来源:cron.php


示例4: emailCollaborators

function emailCollaborators($new_ids, $node)
{
    $query = db_select('users', 'u')->condition('uid', $new_ids)->fields('u', array('name', 'mail'));
    $result = $query->execute();
    foreach ($result as $row) {
        $options = array('absolute' => TRUE);
        $jobPath = url('node/' . $node->nid, $options);
        $jobTitle = $node->title;
        global $user;
        $inviter = $user->name;
        $module = 'tap_job_invite';
        $key = 'key';
        $email = $row->mail;
        $language = language_default();
        $params = array();
        $from = NULL;
        $send = FALSE;
        $message = drupal_mail($module, $key, $email, $language, $params, $from, $send);
        $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
        $message['subject'] = "Collaborator invitation at Tap";
        $message['body'] = array();
        $message['body'][] = "You have invited as a Collaborator by {$inviter} to the job <a href=\"{$jobPath}\">{$jobTitle}</a>. ";
        $message['body'][] = "Log in to join the workroom.";
        // Retrieve the responsible implementation for this message.
        $system = drupal_mail_system($module, $key);
        // Format the message body.
        $message = $system->format($message);
        // Send e-mail.
        $message['result'] = $system->mail($message);
    }
}
开发者ID:JohnRafols,项目名称:tapWebsite,代码行数:31,代码来源:email_co_workers.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: mailStatusUpdate

 public function mailStatusUpdate($status, $attached)
 {
     $mail = $this->node->field_email[0]['value'];
     $v['subject'] = 'Ваше замечание обработано';
     $v['body'] = "Добрый день!\n\n";
     $v['body'] .= "Вы писали нам про ошибку в вопросе %1\$s. ";
     if ($status == 'resolved') {
         $v['body'] .= "Эта ошибка исправлена. В течение 24 часов изменения будут отображены.\n\n";
     } elseif ($status == 'accepted') {
         $v['body'] .= "Мы признаём эту ошибку. \n\n";
     } elseif ($status == 'rejected') {
         $v['body'] .= "\n\nНам кажется, что этой ошибки в вопросе нет (или ваше сообщение не было сообщением об ошибке).\n\n";
     }
     if ($attached) {
         $v['body'] .= 'Ваше замечание прикреплено к вопросу.' . "\n\n";
     }
     $v['body'] .= "Постоянный адрес вашего сообщения -- %2\$s.";
     if ($this->oldnode->comment_count) {
         $v['body'] .= " По этому адресу вы можете прочитать комментарии";
     }
     $v['body'] .= "\n\nСпасибо!\n\n-- \nРоман Семизаров\n";
     $q = $this->getQuestion();
     $v['body'] = sprintf($v['body'], $q->getAbsoluteQuestionUrl(), url('node/' . $this->node->nid, array('absolute' => TRUE)));
     drupal_mail('chgk_db', 'issue_status_updated', $mail, language_default(), $v);
 }
开发者ID:chgk,项目名称:db.chgk.info,代码行数:25,代码来源:DbIssue.class.php


示例7: getDefaultOperations

 /**
  * {@inheritdoc}
  */
 public function getDefaultOperations(EntityInterface $entity)
 {
     $operations = parent::getDefaultOperations($entity);
     $default = language_default();
     // Deleting the site default language is not allowed.
     if ($entity->id() == $default->id) {
         unset($operations['delete']);
     }
     return $operations;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:13,代码来源:LanguageListBuilder.php


示例8: ListLanguages

 /**
  * verifica se a linguagem esta habilitada, se não retorna padrão (ingles)
  * @param string $lang - Codigo de linguagem
  * @return Ambiguous <multitype: array/object, boolean>
  */
 function ListLanguages($lang)
 {
     $result = $this->SqlSelect("SELECT * From {languages} WHERE language = '{$lang}' AND enabled = '1' ORDER BY weight, name ASC");
     if (mysql_numrows($result) < 1) {
         return language_default();
     }
     $row = NULL;
     while ($row = mysql_fetch_object($result)) {
         $languages = $row;
     }
     return $languages;
 }
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:17,代码来源:lib.Consultas.php


示例9: __construct

 /**
  * Constructor.
  *
  * This is private since we want consumers to instantiate via the factory methods.
  *
  * @param $set_id
  *   A Config Set ID.
  */
 private function __construct($set_id = NULL)
 {
     $this->sid = $set_id;
     $this->set_size = LINGOTEK_CONFIG_SET_SIZE;
     $this->source_data = self::getAllSegments($this->sid);
     $this->source_meta = self::getSetMeta($this->sid);
     $this->language = language_default();
     if (!isset($this->language->lingotek_locale)) {
         // if Drupal variable 'language_default' does not exist
         $this->language->lingotek_locale = Lingotek::convertDrupal2Lingotek($this->language->language);
     }
     $this->language_targets = Lingotek::getLanguagesWithoutSource($this->language->lingotek_locale);
 }
开发者ID:nu113r,项目名称:DrupalSampleApp,代码行数:21,代码来源:LingotekConfigSet.php


示例10: __construct

 /**
  * Constructor.
  *
  * This is private since we want consumers to instantiate via the factory methods.
  *
  * @param $chunk_id
  *   A Config Chunk ID.
  */
 private function __construct($chunk_id = NULL)
 {
     $this->cid = $chunk_id;
     $this->chunk_size = LINGOTEK_CONFIG_CHUNK_SIZE;
     $this->source_data = self::getAllSegments($this->cid);
     $this->source_meta = self::getChunkMeta($this->cid);
     $this->language = language_default();
     if (!isset($this->language->lingotek_locale)) {
         // if Drupal variable 'language_default' does not exist
         $this->language->lingotek_locale = Lingotek::convertDrupal2Lingotek($this->language->language);
     }
     $this->language_targets = Lingotek::getLanguagesWithoutSource($this->language->lingotek_locale);
     $this->min_lid = $this->getMinLid();
     $this->max_lid = $this->getMaxLid();
 }
开发者ID:Nov-Dev-Inf,项目名称:commons,代码行数:23,代码来源:LingotekConfigChunk.php


示例11: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, array &$form_state)
 {
     $langcode = $this->entity->id();
     // Warn and redirect user when attempting to delete the default language.
     if (language_default()->id == $langcode) {
         drupal_set_message($this->t('The default language cannot be deleted.'));
         $url = $this->urlGenerator->generateFromPath('admin/config/regional/language', array('absolute' => TRUE));
         return new RedirectResponse($url);
     }
     // Throw a 404 when attempting to delete a non-existing language.
     $languages = language_list();
     if (!isset($languages[$langcode])) {
         throw new NotFoundHttpException();
     }
     return parent::buildForm($form, $form_state);
 }
开发者ID:shumer,项目名称:blog,代码行数:19,代码来源:LanguageDeleteForm.php


示例12: 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


示例13: 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


示例14: 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


示例15: execute

 /**
  * {@inheritdoc}
  */
 public function execute($entity = NULL)
 {
     if (empty($this->configuration['node'])) {
         $this->configuration['node'] = $entity;
     }
     $recipient = $this->token->replace($this->configuration['recipient'], $this->configuration);
     // If the recipient is a registered user with a language preference, use
     // the recipient's preferred language. Otherwise, use the system default
     // language.
     $recipient_accounts = $this->storage->loadByProperties(array('mail' => $recipient));
     $recipient_account = reset($recipient_accounts);
     if ($recipient_account) {
         $langcode = $recipient_account->getPreferredLangcode();
     } else {
         $langcode = language_default()->id;
     }
     $params = array('context' => $this->configuration);
     if (drupal_mail('system', 'action_send_email', $recipient, $langcode, $params)) {
         watchdog('action', 'Sent email to %recipient', array('%recipient' => $recipient));
     } else {
         watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $recipient));
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:26,代码来源:EmailAction.php


示例16: setUp

 /**
  * Generates a random database prefix, runs the install scripts on the
  * prefixed database and enable the specified modules. After installation
  * many caches are flushed and the internal browser is setup so that the
  * page requests will run on the new prefix. A temporary files directory
  * is created with the same name as the database prefix.
  *
  * @param ...
  *   List of modules to enable for the duration of the test.
  */
 protected function setUp()
 {
     global $db_prefix, $user, $language;
     // Store necessary current values before switching to prefixed database.
     $this->originalLanguage = $language;
     $this->originalLanguageDefault = variable_get('language_default');
     $this->originalPrefix = $db_prefix;
     $this->originalFileDirectory = file_directory_path();
     $this->originalProfile = drupal_get_profile();
     $clean_url_original = variable_get('clean_url', 0);
     // Generate temporary prefixed database to ensure that tests have a clean starting point.
     $db_prefix_new = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');
     db_update('simpletest_test_id')->fields(array('last_prefix' => $db_prefix_new))->condition('test_id', $this->testId)->execute();
     $db_prefix = $db_prefix_new;
     // Create test directory ahead of installation so fatal errors and debug
     // information can be logged during installation process.
     // Use temporary files directory with the same prefix as the database.
     $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10);
     $private_files_directory = $public_files_directory . '/private';
     $temp_files_directory = $private_files_directory . '/temp';
     // Create the directories
     file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
     file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);
     file_prepare_directory($temp_files_directory, FILE_CREATE_DIRECTORY);
     $this->generatedTestFiles = FALSE;
     // Log fatal errors.
     ini_set('log_errors', 1);
     ini_set('error_log', $public_files_directory . '/error.log');
     // Reset all statics so that test is performed with a clean environment.
     drupal_static_reset();
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
     $this->preloadRegistry();
     // Include the default profile
     variable_set('install_profile', 'standard');
     $profile_details = install_profile_info('standard', 'en');
     // Install the modules specified by the default profile.
     drupal_install_modules($profile_details['dependencies'], TRUE);
     drupal_static_reset('_node_types_build');
     if ($modules = func_get_args()) {
         // Install modules needed for this test.
         drupal_install_modules($modules, TRUE);
     }
     // Because the schema is static cached, we need to flush
     // it between each run. If we don't, then it will contain
     // stale data for the previous run's database prefix and all
     // calls to it will fail.
     drupal_get_schema(NULL, TRUE);
     // Run default profile tasks.
     $install_state = array();
     drupal_install_modules(array('standard'), TRUE);
     // Rebuild caches.
     node_types_rebuild();
     actions_synchronize();
     _drupal_flush_css_js();
     $this->refreshVariables();
     $this->checkPermissions(array(), TRUE);
     // Log in with a clean $user.
     $this->originalUser = $user;
     drupal_save_session(FALSE);
     $user = user_load(1);
     // Restore necessary variables.
     variable_set('install_task', 'done');
     variable_set('clean_url', $clean_url_original);
     variable_set('site_mail', '[email protected]');
     // Set up English language.
     unset($GLOBALS['conf']['language_default']);
     $language = language_default();
     // Set path variables
     variable_set('file_public_path', $public_files_directory);
     variable_set('file_private_path', $private_files_directory);
     variable_set('file_temporary_path', $temp_files_directory);
     // Use the test mail class instead of the default mail handler class.
     variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
     drupal_set_time_limit($this->timeLimit);
 }
开发者ID:jacobSingh,项目名称:drupal,代码行数:86,代码来源:drupal_web_test_case.php


示例17: setUp


//.........这里部分代码省略.........
  * being executed.
  *
  * @param ...
  *   List of modules to enable for the duration of the test. This can be
  *   either a single array or a variable number of string arguments.
  *
  * @see BackdropWebTestCase::prepareDatabasePrefix()
  * @see BackdropWebTestCase::changeDatabasePrefix()
  * @see BackdropWebTestCase::prepareEnvironment()
  */
 protected function setUp()
 {
     global $user, $language, $conf;
     // Create the database prefix for this test.
     $this->prepareDatabasePrefix();
     // Prepare the environment for running tests.
     $this->prepareEnvironment();
     if (!$this->setupEnvironment) {
         return FALSE;
     }
     // Reset all statics and variables to perform tests in a clean environment.
     $conf = array();
     backdrop_static_reset();
     // Change the database prefix.
     // All static variables need to be reset before the database prefix is
     // changed, since BackdropCacheArray implementations attempt to
     // write back to persistent caches when they are destructed.
     $this->changeDatabasePrefix();
     if (!$this->setupDatabasePrefix) {
         return FALSE;
     }
     // Preset the 'install_profile' system variable, so the first call into
     // system_rebuild_module_data() (in backdrop_install_system()) will register
     // the test's profile as a module. Without this, the installation profile of
     // the parent site (executing the test) is registered, and the test
     // profile's hook_install() and other hook implementations are never invoked.
     config_install_default_config('system');
     config_set('system.core', 'install_profile', $this->profile);
     // Perform the actual Backdrop installation.
     include_once BACKDROP_ROOT . '/core/includes/install.inc';
     backdrop_install_system();
     // Set path variables.
     $core_config = config('system.core');
     $core_config->set('file_default_scheme', 'public');
     $core_config->set('file_public_path', $this->public_files_directory);
     $core_config->set('file_private_path', $this->private_files_directory);
     $core_config->set('file_temporary_path', $this->temp_files_directory);
     $core_config->save();
     // Set 'parent_profile' of simpletest to add the parent profile's
     // search path to the child site's search paths.
     // @see backdrop_system_listing()
     // @todo This may need to be primed like 'install_profile' above.
     config_set('simpletest.settings', 'parent_profile', $this->originalProfile);
     // Ensure schema versions are recalculated.
     backdrop_static_reset('backdrop_get_schema_versions');
     // Include the testing profile.
     config_set('system.core', 'install_profile', $this->profile);
     $profile_details = install_profile_info($this->profile, 'en');
     // Install the modules specified by the testing profile.
     module_enable($profile_details['dependencies'], FALSE);
     // Install modules needed for this test. This could have been passed in as
     // either a single array argument or a variable number of string arguments.
     // @todo Remove this compatibility layer and only accept a single array.
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     if ($modules) {
         $success = module_enable($modules, TRUE);
         $this->assertTrue($success, t('Enabled modules: %modules', array('%modules' => implode(', ', $modules))));
     }
     // Run the profile tasks.
     $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(':name' => $this->profile))->fetchField();
     if ($install_profile_module_exists) {
         module_enable(array($this->profile), FALSE);
     }
     // Reset/rebuild all data structures after enabling the modules.
     $this->resetAll();
     // Run cron once in that environment, as install.php does at the end of
     // the installation process.
     backdrop_cron_run();
     // Ensure that the session is not written to the new environment and replace
     // the global $user session with uid 1 from the new test site.
     backdrop_save_session(FALSE);
     // Login as uid 1.
     $user = user_load(1);
     // Restore necessary variables.
     state_set('install_task', 'done');
     config_set('system.core', 'clean_url', $this->originalCleanUrl);
     config_set('system.core', 'site_mail', '[email protected]');
     config_set('system.date', 'date_default_timezone', date_default_timezone_get());
     backdrop_static_reset('url');
     // Set up English language.
     unset($conf['language_default']);
     $language = language_default();
     // Use the test mail class instead of the default mail handler class.
     config_set('system.mail', 'default-system', 'TestingMailSystem');
     backdrop_set_time_limit($this->timeLimit);
     $this->setup = TRUE;
 }
开发者ID:thejimbirch,项目名称:backdropcms.org,代码行数:101,代码来源:backdrop_web_test_case.php


示例18: subscribeSendMail

function subscribeSendMail($data)
{
    $to = $data['mail'];
    $from = variable_get('site_mail', '[email protected]');
    $params = array('rand' => $data['rand']);
    $sent = drupal_mail('libya', 'subscription_mail', $to, language_default(), $params, $from, TRUE);
}
开发者ID:vishacc,项目名称:libyanwarthetruth,代码行数:7,代码来源:forms.php


示例19: bbcom_theme_premium_body

function bbcom_theme_premium_body($node)
{
    // Hack to allow 'content' to still work with the reader when it's being hidden via 'premium_content'
    if ($node->type == 'content' && module_exists('lingwo_korpus')) {
        $node_language = $node->language ? $node->language : language_default();
        $teaser = lingwo_korpus_filter_text($node->teaser, $node_language, $node->nid . ':teaser');
    } else {
        $teaser = check_markup($node->teaser, $node->format, FALSE);
    }
    /**
     * Copied from uc_premium_access!
     */
    $html = $teaser;
    $html .= '<div class="premium-message">';
    // TODO: this should probably be optional!
    $html .= '<div class="premium-message-text">';
    $html .= check_markup(t($node->premium_level['denied_message']), $node->premium_level['denied_message_format'], FALSE);
    $html .= '</div>';
    if (module_exists('uc_premium_access')) {
        $products = uc_premium_access_products($node);
        if (!empty($products)) {
            $html .= theme('uc_premium_access_product_list', $products, $node);
        }
    }
    $html .= '</div>';
    return $html;
}
开发者ID:rollinsb1010,项目名称:bbcom,代码行数:27,代码来源:template.php


示例20: language_default

<?php

/**
 * @file
 * Overriding the default simple view template to display the list of rows as an interactive Map
 *
 * @ingroup views_templates
 */
$results = $view->result;
// https://www.drupal.org/node/277675
global $language;
// current selected language
$current_language = $language->language;
$default_language = language_default()->language;
$url_language_prefix = $current_language != $default_language ? "/{$current_language}" : "";
$all_countries = countries_get_countries('all', array('enabled' => COUNTRIES_ENABLED));
// list of European Union member states along with their data
$eu_countries = array();
$eu_countries_with_data_count = 0;
// $key is the country iso2 code
foreach ($all_countries as $key => $country) {
    $identifier = $key;
    // county is in Europe
    if ($country->continent == 'EU') {
        // country is member state of the European Union
        if (count($country->field_eu_country_code)) {
            $i18n_country_name = countries_t($country, "name", $current_language);
            // http://publications.europa.eu/code/en/en-370100.htm
            // EU country code is different from iso2 code in case of Greece (EL instead of GR) and United Kingdom (UK instead of GB)
            $identifier = $country->field_eu_country_code[LANGUAGE_NONE][0]['value'];
            // a sanitized version of the country name is used in the country profile url
开发者ID:EIGE,项目名称:www_staging,代码行数:31,代码来源:views-view-unformatted--administrative-data-sources-map.tpl.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP language_get_default_configuration函数代码示例发布时间:2022-05-15
下一篇:
PHP language_attributes函数代码示例发布时间: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