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


PHP get_t函数代码示例

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


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

示例1: webspark_seven_form_required_marker

function webspark_seven_form_required_marker($variables)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array('class' => 'form-required', 'title' => $t('This field is required.'));
    return '<span' . drupal_attributes($attributes) . '> * </span>';
}
开发者ID:sourfacedcyclop,项目名称:webspark-drops-drupal7,代码行数:7,代码来源:template.php

示例2: marco_form_element

/**
 * Return a themed form element.
 * Edited to remove colon.
 *
 * @param element
 *   An associative array containing the properties of the element.
 *   Properties used: title, description, id, required
 * @param $value
 *   The form element's data.
 * @return
 *   A string representing the form element.
 *
 * @ingroup themeable
 */
function marco_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $output = '<div class="form-item"';
    if (!empty($element['#id'])) {
        $output .= ' id="' . $element['#id'] . '-wrapper"';
    }
    $output .= ">\n";
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '"></span>' : '';
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $output .= ' <label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        } else {
            $output .= ' <label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        }
    }
    $output .= " {$value}\n";
    if (!empty($element['#description'])) {
        $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:rocafuerte,项目名称:marco,代码行数:39,代码来源:template.php

示例3: mothership_form_element

/**
 * @file
 * form mothership overwrites
 */
function mothership_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    //add a more specific form-item-$type
    $output = "<div class=\"form-item form-item-" . $element['#type'] . " \" ";
    // TODO cant this be dublicated on a page?
    //and then its not unique
    if (!empty($element['#id'])) {
        $output .= ' id="' . $element['#id'] . '-wrapper"';
    }
    $output .= ">\n";
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        } else {
            $output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        }
    }
    //TODO test to see if this is clean text - then we might need a <span>
    //if we need to catch the content with
    $output .= "{$value}\n";
    if (!empty($element['#description'])) {
        $output .= '<div class="form-description">' . $element['#description'] . "</div>\n";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:victoriachan,项目名称:victoriac-blog,代码行数:34,代码来源:template.form.php

示例4: mothership_form_element

function mothership_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    //$output = '<div>';
    //  removed $output = '<div class="form-item"';
    //so we dont know its a div hmm? form>div ....
    $output = '<div ';
    // removed the ID wrapper?
    if (!empty($element['#id'])) {
        $output .= ' id="' . $element['#id'] . '-wrapper"';
    }
    $output .= ">\n";
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        } else {
            $output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        }
    }
    //TODO test to see if this is clean text - then we might need a <span> etc
    $output .= "{$value}\n";
    if (!empty($element['#description'])) {
        $output .= '<div class="description">' . $element['#description'] . "</div>\n";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:Joanl,项目名称:ding,代码行数:30,代码来源:template.form.php

示例5: tibco_styles_form_element_label

/**
 * Implements theme_form_element_label().
 */
function tibco_styles_form_element_label($variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after') {
        $attributes['class'] = 'option';
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    $help = '';
    if ($element['#type'] == 'checkbox' && $element['#entity_type'] == 'entityform') {
        $help = $element['#checkbox_suffix'];
    }
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . $help . "</label>\n";
}
开发者ID:JaspersoftMarketing,项目名称:design_guide,代码行数:32,代码来源:template.php

示例6: europa_form_required_marker

/**
 * Overrides theme_form_required_marker().
 */
function europa_form_required_marker($variables)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array('class' => 'form-required text-danger glyphicon glyphicon-asterisk', 'title' => $t('This field is required.'));
    return '<span' . drupal_attributes($attributes) . '></span>';
}
开发者ID:janoka,项目名称:platform-dev,代码行数:10,代码来源:template.php

示例7: hook_requirements

/**
 * Check installation requirements and do status reporting.
 *
 * This hook has two closely related uses, determined by the $phase argument:
 * checking installation requirements ($phase == 'install')
 * and status reporting ($phase == 'runtime').
 *
 * Note that this hook, like all others dealing with installation and updates,
 * must reside in a module_name.install file, or it will not properly abort
 * the installation of the module if a critical requirement is missing.
 *
 * During the 'install' phase, modules can for example assert that
 * library or server versions are available or sufficient.
 * Note that the installation of a module can happen during installation of
 * Drupal itself (by install.php) with an installation profile or later by hand.
 * As a consequence, install-time requirements must be checked without access
 * to the full Drupal API, because it is not available during install.php.
 * For localisation you should for example use $t = get_t() to
 * retrieve the appropriate localisation function name (t() or st()).
 * If a requirement has a severity of REQUIREMENT_ERROR, install.php will abort
 * or at least the module will not install.
 * Other severity levels have no effect on the installation.
 * Module dependencies do not belong to these installation requirements,
 * but should be defined in the module's .info file.
 *
 * The 'runtime' phase is not limited to pure installation requirements
 * but can also be used for more general status information like maintenance
 * tasks and security issues.
 * The returned 'requirements' will be listed on the status report in the
 * administration section, with indication of the severity level.
 * Moreover, any requirement with a severity of REQUIREMENT_ERROR severity will
 * result in a notice on the the administration overview page.
 *
 * @param $phase
 *   The phase in which hook_requirements is run:
 *   - 'install': the module is being installed.
 *   - 'runtime': the runtime requirements are being checked and shown on the
 *              status report page.
 *
 * @return
 *   A keyed array of requirements. Each requirement is itself an array with
 *   the following items:
 *     - 'title': the name of the requirement.
 *     - 'value': the current value (e.g. version, time, level, ...). During
 *       install phase, this should only be used for version numbers, do not set
 *       it if not applicable.
 *     - 'description': description of the requirement/status.
 *     - 'severity': the requirement's result/severity level, one of:
 *         - REQUIREMENT_INFO:    For info only.
 *         - REQUIREMENT_OK:      The requirement is satisfied.
 *         - REQUIREMENT_WARNING: The requirement failed with a warning.
 *         - REQUIREMENT_ERROR:   The requirement failed with an error.
 */
function hook_requirements($phase)
{
    $requirements = array();
    // Ensure translations don't break at install time
    $t = get_t();
    // Report Drupal version
    if ($phase == 'runtime') {
        $requirements['drupal'] = array('title' => $t('Drupal'), 'value' => VERSION, 'severity' => REQUIREMENT_INFO);
    }
    // Test PHP version
    $requirements['php'] = array('title' => $t('PHP'), 'value' => $phase == 'runtime' ? l(phpversion(), 'admin/logs/status/php') : phpversion());
    if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) < 0) {
        $requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
        $requirements['php']['severity'] = REQUIREMENT_ERROR;
    }
    // Report cron status
    if ($phase == 'runtime') {
        $cron_last = variable_get('cron_last', NULL);
        if (is_numeric($cron_last)) {
            $requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
        } else {
            $requirements['cron'] = array('description' => $t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron')), 'severity' => REQUIREMENT_ERROR, 'value' => $t('Never run'));
        }
        $requirements['cron']['description'] .= ' ' . t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/logs/status/run-cron')));
        $requirements['cron']['title'] = $t('Cron maintenance tasks');
    }
    return $requirements;
}
开发者ID:t-web,项目名称:drupal-doxygen-base,代码行数:81,代码来源:install.php

示例8: bootstrap_psdpt_form_element_label

/**
 * Overrides theme_form_element_label().
 */
function bootstrap_psdpt_form_element_label(&$variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // Determine if certain things should skip for checkbox or radio elements.
    $skip = isset($element['#type']) && ('checkbox' === $element['#type'] || 'radio' === $element['#type']);
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '' && !$skip) && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after' && !$skip) {
        $attributes['class'][] = $element['#type'];
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'][] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    // Insert radio and checkboxes inside label elements.
    $output = '';
    if (isset($variables['#children'])) {
        $output .= $variables['#children'];
    }
    // Append label.
    $output .= $t('!title !required', array('!title' => $title, '!required' => $required));
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $output . "</label>\n";
}
开发者ID:atssc-scdata,项目名称:bootstrap_psdpt,代码行数:37,代码来源:form-element-label.func.php

示例9: __construct

 public function __construct()
 {
     // Beeptify values
     $this->id = 'beeptify';
     $this->method_title = 'Beeptify';
     $this->icon = WP_PLUGIN_URL . "/" . plugin_basename(dirname(__FILE__)) . '/images/logo.png';
     $this->has_fields = false;
     $this->liveurl = 'https://my.beeptify.com/payment?registered=False';
     // Load the form fields
     $this->init_form_fields();
     // Load the settings.
     $this->init_settings();
     // Define user set variables
     $this->title = $this->settings['title'];
     $this->description = $this->settings['description'];
     $this->merchant_id = $this->settings['merchant_id'];
     $this->pay_language = $this->settings['pay_language'];
     $this->mode = $this->settings['mode'];
     $this->frame = $this->settings['frame'];
     $this->secret = $this->settings['secret'];
     $this->testmode = $this->settings['testmode'];
     if (empty($this->pay_language)) {
         $this->pay_language = 'en-GB.php';
     }
     // Translations
     require_once 'lang/' . $this->pay_language . '.php';
     $this->_t = get_t();
     // Order btn text
     $this->order_button_text = $this->_t['pay_beeptify'];
     // Test mode values
     if ($this->yesnotoint($this->testmode)) {
         $this->liveurl = 'https://stage.beeptify.com/payment';
     }
     // Logs
     $this->log = new WC_Logger();
     // Actions
     // Add check for callback
     add_action('init', array(&$this, 'check_callback'));
     // Check for successful callback
     add_action('valid_beeptify_callback', array(&$this, 'successful_request'));
     add_action('woocommerce_api_wc_payment_gateway_beeptify', array($this, 'check_callback'));
     // Add our admin options
     add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
     add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     // Hook in to reciept
     add_action('woocommerce_receipt_beeptify', array($this, 'receipt'));
     // Hook in to thank you
     add_action('woocommerce_thankyou_beeptify', array($this, 'thankyou'));
     // Test if costumer can use plugin, eg lang
     if (!$this->is_valid_for_use()) {
         $this->enabled = false;
     }
 }
开发者ID:Ivan0905,项目名称:beeptify-payment-module-woocommerce,代码行数:53,代码来源:gateway.beeptify.php

示例10: ding_wayf_dk_login_requirements

/**
 * Implements hook_requirements().
 */
function ding_wayf_dk_login_requirements($phase)
{
    $requirements = array();
    // Ensure translations don't break at install time.
    $t = get_t();
    if ($phase == 'runtime') {
        if (!variable_get('wayf_hash', FALSE)) {
            $requirements['wayf_hash'] = array('value' => $t('WAYF not configured correctly'), 'description' => $t('WAYF is not properly configured, you need to set $conf[\'wayf_hash\'] in setttings.php.'), 'severity' => REQUIREMENT_ERROR);
        }
    }
    return $requirements;
}
开发者ID:vejlebib,项目名称:ding_wayf_dk,代码行数:15,代码来源:ding_wayf_dk_login.install.php

示例11: form_fun_form_element

/**
 * Overriding theme_form_element().
 */
function form_fun_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array();
    // Add drupal defaults
    if (!empty($element['#id'])) {
        $attributes['id'] = $element['#id'] . '-wrapper';
    }
    $attributes['class'][] = 'form-item';
    // Add a class indicating if a label isn't inside this element.
    // (Not sure if I'm keeping this or not)
    if (empty($element['#title'])) {
        $attributes['class'][] = 'form-item-no-label';
    }
    // Add a clearfix classes on most elements, might add some more here.
    $inline = array('radio', 'checkbox');
    if (!in_array($element['#type'], $inline)) {
        $attributes['class'][] = 'clearfix';
    }
    // Flatten the attributes for output.
    $attributes = theme('render_attributes', $attributes);
    // Form required marker
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
    // Label
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $label = '<label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . '</label>' . "\n";
        } else {
            $label = '<label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . '</label>' . "\n";
        }
    }
    // Description
    if (!empty($element['#description'])) {
        $description = '<div class="description">' . $element['#description'] . '</div>' . "\n";
    }
    // Prepare the output
    $output = "\n" . '<div' . $attributes . '>' . "\n";
    // If there is no label, we can have less markup.  Wrapper level class can handle positioning.
    if (!$label) {
        $output .= '<div class="inner">' . "\n" . $value . "\n" . $description . '</div>';
    } else {
        $output .= $label . '<div class="right">' . "\n" . '<div class="inner">' . "\n" . $value . "\n" . $description . '</div>' . "\n" . '</div>' . "\n";
    }
    $output .= '</div>' . "\n";
    return $output;
}
开发者ID:jacine,项目名称:form-fun,代码行数:51,代码来源:template.php

示例12: tao_form_element

/**
 * Override of theme_form_element().
 * Take a more sensitive/delineative approach toward theming form elements.
 */
function tao_form_element($element, $value)
{
    $output = '';
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // Add a wrapper id
    $attr = array('class' => '');
    $attr['id'] = !empty($element['#id']) ? "{$element['#id']}-wrapper" : NULL;
    // Type logic
    $label_attr = array();
    $label_attr['for'] = !empty($element['#id']) ? $element['#id'] : '';
    if (!empty($element['#type']) && in_array($element['#type'], array('checkbox', 'radio'))) {
        $label_type = 'label';
        $attr['class'] .= ' form-item form-option';
    } else {
        $label_type = 'label';
        $attr['class'] .= ' form-item';
    }
    // Generate required markup
    $required_title = $t('This field is required.');
    $required = !empty($element['#required']) ? "<span class='form-required' title='{$required_title}'>*</span>" : '';
    // Generate label markup
    if (!empty($element['#title'])) {
        $title = $t('!title: !required', array('!title' => filter_xss_admin($element['#title']), '!required' => $required));
        $label_attr = drupal_attributes($label_attr);
        $output .= "<{$label_type} {$label_attr}>{$title}</{$label_type}>";
        $attr['class'] .= ' form-item-labeled';
    }
    // Add child values
    $output .= "{$value}";
    // Description markup
    $output .= !empty($element['#description']) ? "<div class='description'>{$element['#description']}</div>" : '';
    // Render the whole thing
    $attr = drupal_attributes($attr);
    $output = "<div {$attr}>{$output}</div>";
    return $output;
}
开发者ID:rmontero,项目名称:dla_ecommerce_site,代码行数:41,代码来源:template.php

示例13: townsquare_bootstrap_form_element

function townsquare_bootstrap_form_element($variables)
{
    $element =& $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // This function is invoked as theme wrapper, but the rendered form element
    // may not necessarily have been processed by form_builder().
    $element += array('#title_display' => 'before');
    // Add element #id for #type 'item'.
    if (isset($element['#markup']) && !empty($element['#id'])) {
        $attributes['id'] = $element['#id'];
    }
    // Add element's #type and #name as class to aid with JS/CSS selectors.
    $attributes['class'] = array('form-item');
    if (!empty($element['#type'])) {
        $attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
    }
    if (!empty($element['#name'])) {
        $attributes['class'][] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
    }
    // Add a class for disabled elements to facilitate cross-browser styling.
    if (!empty($element['#attributes']['disabled'])) {
        $attributes['class'][] = 'form-disabled';
    }
    $attributes['class'][] = 'control-group';
    $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
    // If #title is not set, we don't display any label or required marker.
    if (!isset($element['#title'])) {
        $element['#title_display'] = 'none';
    }
    $prefix = '<div class="controls">';
    $prefix .= isset($element['#field_prefix']) ? '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ' : '';
    $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>' : '';
    $suffix .= '</div>';
    switch ($element['#title_display']) {
        case 'before':
        case 'invisible':
            $output .= ' ' . theme('form_element_label', $variables);
            $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
            break;
        case 'after':
            $output .= ' ' . $prefix . $element['#children'] . $suffix;
            $output .= ' ' . theme('form_element_label', $variables) . "\n";
            break;
        case 'none':
        case 'attribute':
            // Output no label and no required marker, only the children.
            $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
            break;
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:nningego,项目名称:townsquare,代码行数:53,代码来源:template.php

示例14: teamwork_15_subtheme_form_element_label

/**
 * Overrides theme_form_element_label().
 */
function teamwork_15_subtheme_form_element_label(&$variables)
{
    $element = $variables['element'];
    $title = filter_xss_admin($element['#title']);
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    //   // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array();
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    $output = '';
    if (isset($variables['#children'])) {
        if ($element['#type'] === "radio") {
            $output .= $variables['#children'];
        }
        if ($element['#type'] === "checkbox") {
            $output .= $variables['#children'];
        }
    }
    return ' <label' . backdrop_attributes($attributes) . '></label><div>' . $t('!title', array('!title' => $title)) . "</div> \n";
}
开发者ID:backdrop-contrib,项目名称:teamwork_15,代码行数:26,代码来源:template.php

示例15: mothership_checkbox

function mothership_checkbox($variables)
{
    $element = $variables['element'];
    $t = get_t();
    $element['#attributes']['type'] = 'checkbox';
    element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));
    // Unchecked checkbox has #value of integer 0.
    if (!empty($element['#checked'])) {
        $element['#attributes']['checked'] = 'checked';
    }
    if (!theme_get_setting('mothership_classes_form_input')) {
        _form_set_class($element, array('form-checkbox'));
    }
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:kieranbutler,项目名称:ikieran,代码行数:15,代码来源:form.php


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