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


PHP gettext函数代码示例

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


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

示例1: GetXMLTreeProfile

function GetXMLTreeProfile($xmlloc)
{
    if (file_exists($xmlloc)) {
        $data = implode('', file($xmlloc));
    } else {
        $fp = fopen($xmlloc, 'r');
        $data = fread($fp, 100000000);
        fclose($fp);
    }
    $data = preg_replace("/<knows>.*<\\/knows>/is", "", $data);
    $parser = xml_parser_create('UTF-8');
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
    xml_parse_into_struct($parser, $data, $vals, $index);
    xml_parser_free($parser);
    $code = xml_get_error_code($parser);
    if ($code != XML_ERROR_NONE) {
        global $messages;
        $messages[] = gettext("XML error: ") . xml_error_string($code);
    }
    $tree = array();
    $i = 0;
    if (isset($vals[$i]['attributes'])) {
        $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];
        $index = count($tree[$vals[$i]['tag']]) - 1;
        $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));
    } else {
        $tree[$vals[$i]['tag']][] = GetChildren($vals, $i);
    }
    return $tree;
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:30,代码来源:main.php

示例2: data

 public function data($message = '')
 {
     if (!is_string($message)) {
         return Error::set(lang('Error', 'stringParameter', '1.(message)'));
     }
     return gettext($message);
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:7,代码来源:GT.php

示例3: __construct

 public function __construct($name, $title, $link = null, $icon = null)
 {
     // If we have a link; we're actually an <a class='btn'>
     if (isset($link)) {
         $this->_attributes['href'] = $link;
         $this->_tagName = 'a';
         $this->addClass('btn-default');
         unset($this->_attributes['type']);
         if (isset($icon)) {
             $this->_attributes['icon'] = $icon;
         }
     } else {
         if (isset($icon)) {
             $this->_tagSelfClosing = false;
             $this->_tagName = 'button';
             $this->_attributes['value'] = gettext($title);
             $this->_attributes['icon'] = $icon;
         } else {
             $this->_tagSelfClosing = true;
             $this->_attributes['value'] = gettext($title);
             $this->addClass('btn-primary');
         }
     }
     parent::__construct($name, $title, null);
     if (isset($link)) {
         unset($this->_attributes['name']);
     }
 }
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:28,代码来源:Button.class.php

示例4: getOptionsSupported

 function getOptionsSupported()
 {
     $MapTypes = array();
     // order matters here because the first allowed map is selected if the 'gmap_starting_map' is not allowed
     if (getOption('gmap_map_hybrid')) {
         $MapTypes[gettext('Hybrid')] = 'HYBRID';
     }
     if (getOption('gmap_map_roadmap')) {
         $MapTypes[gettext('Map')] = 'ROADMAP';
     }
     if (getOption('gmap_map_satellite')) {
         $MapTypes[gettext('Satellite')] = 'SATELLITE';
     }
     if (getOption('gmap_map_terrain')) {
         $MapTypes[gettext('Terrain')] = 'TERRAIN';
     }
     $defaultMap = getOption('gmap_starting_map');
     if (array_search($defaultMap, $MapTypes) === false) {
         // the starting map is not allowed, pick a new one
         $temp = $MapTypes;
         $defaultMap = array_shift($temp);
         setOption('gmap_starting_map', $defaultMap);
     }
     return array(gettext('Allowed maps') => array('key' => 'gmap_allowed_maps', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'order' => 1, 'checkboxes' => array(gettext('Hybrid') => 'gmap_map_hybrid', gettext('Map') => 'gmap_map_roadmap', gettext('Satellite') => 'gmap_map_satellite', gettext('Terrain') => 'gmap_map_terrain'), 'desc' => gettext('Select the map types that are allowed.')), gettext('Initial map display selection') => array('key' => 'gmap_starting_map', 'type' => OPTION_TYPE_SELECTOR, 'order' => 2, 'selections' => $MapTypes, 'desc' => gettext('Select the initial type of map to display.')), gettext('Map display') => array('key' => 'gmap_display', 'type' => OPTION_TYPE_SELECTOR, 'order' => 3, 'selections' => array(gettext('show') => 'show', gettext('hide') => 'hide', gettext('colorbox') => 'colorbox'), 'desc' => gettext('Select <em>hide</em> to initially hide the map. Select <em>colorbox</em> for the map to display in a colorbox. Select <em>show</em> and the map will display when the page loads.')), gettext('Map controls') => array('key' => 'gmap_control_type', 'type' => OPTION_TYPE_RADIO, 'order' => 4, 'buttons' => array(gettext('None') => 'none', gettext('Default') => 'DEFAULT', gettext('Dropdown') => 'DROPDOWN_MENU', gettext('Horizontal') => 'HORIZONTAL_BAR'), 'desc' => gettext('Display options for the Map type control.')), gettext('Zoom controls') => array('key' => 'gmap_zoom_size', 'type' => OPTION_TYPE_RADIO, 'order' => 5, 'buttons' => array(gettext('Small') => 'SMALL', gettext('Default') => 'DEFAULT', gettext('Large') => 'LARGE'), 'desc' => gettext('Display options for the Zoom control.')), gettext('Max zoom level') => array('key' => 'gmap_cluster_max_zoom', 'type' => OPTION_TYPE_NUMBER, 'order' => 6, 'desc' => gettext('The max zoom level for clustering pictures on map.')), gettext('Map dimensions—width') => array('key' => 'gmap_width', 'type' => OPTION_TYPE_NUMBER, 'order' => 7, 'desc' => gettext('The default width of the map.')), gettext('Map dimensions—height') => array('key' => 'gmap_height', 'type' => OPTION_TYPE_NUMBER, 'order' => 8, 'desc' => gettext('The default height of the map.')), gettext('Map sessions') => array('key' => 'gmap_sessions', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 9, 'desc' => gettext('If checked GoogleMaps will use sessions to pass map data for the <em>colorbox</em> display option. We recommend this option be selected. It protects against reference forgery security attacks and mitigates problems with data exceeding the allowed by some browsers.')));
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:25,代码来源:googleMap.php

示例5: zenphoto_sendmail

function zenphoto_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo, $html = false)
{
    $headers = sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n";
    if (count($cc_addresses) > 0) {
        $cclist = '';
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $cclist .= ',' . $cc_mail;
        }
        $headers .= 'Cc: ' . substr($cclist, 1) . "\n";
    }
    if ($replyTo) {
        $headers .= 'Reply-To: ' . array_shift($replyTo) . "\n";
    }
    $result = true;
    foreach ($email_list as $to_mail) {
        $result = $result && utf8::send_mail($to_mail, $subject, $message, $headers, '', $html);
    }
    if (!$result) {
        if (!empty($msg)) {
            $msg .= '<br />';
        }
        $msg .= sprintf(gettext('<code>zenphoto_sendmail</code> failed to send <em>%s</em> to one or more recipients.'), $subject);
    }
    return $msg;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:25,代码来源:zenphoto_sendmail.php

示例6: __construct

 function __construct($steam_object = FALSE)
 {
     self::$PATH = PATH_EXTENSIONS . "units_extern/";
     self::$DISPLAY_NAME = gettext("External Resource");
     self::$DISPLAY_DESCRIPTION = gettext("You can use this unit type for providing external web resources in an course. In the preferences of this unit you can specify an external web link that will thereafter be accessable as unit content.");
     parent::__construct(PATH_EXTENSIONS . "units_extern.xml", $steam_object);
 }
开发者ID:rolwi,项目名称:koala,代码行数:7,代码来源:units_extern.extension.class.php

示例7: sitemap_printAvailableSitemaps

function sitemap_printAvailableSitemaps()
{
    $cachefolder = SERVERPATH . '/' . STATIC_CACHE_FOLDER . '/sitemap/';
    $dirs = array_diff(scandir($cachefolder), array('.', '..', '.DS_Store', 'Thumbs.db', '.htaccess', '.svn'));
    echo '<h2>' . gettext('Available sitemap files:') . '</h2>';
    if (!$dirs) {
        echo '<p>' . gettext('No sitemap files available.') . '</p>';
    } else {
        echo '<ol>';
        foreach ($dirs as $dir) {
            $filemtime = filemtime($cachefolder . $dir);
            $lastchange = date('Y-m-d H:m:s', $filemtime);
            ?>
			<li><a target="_blank" href="<?php 
            echo FULLWEBPATH . '/' . STATIC_CACHE_FOLDER;
            ?>
/sitemap/<?php 
            echo $dir;
            ?>
"><?php 
            echo $dir;
            ?>
</a> (<small><?php 
            echo $lastchange;
            ?>
)</small>
			</li>
			<?php 
        }
        echo '</ol>';
    }
}
开发者ID:rb26,项目名称:zenphoto,代码行数:32,代码来源:sitemap-extended-admin.php

示例8: printNews

function printNews($side)
{
    $pos = zp_filter_slot('admin_overview', 'comment_form_print10Most') !== false;
    if ($pos && $side == 'left' || !$pos && $side == 'right') {
        if ($connected = is_connected()) {
            require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
        }
        ?>
		<div class="box" id="overview-news">
		<h2 class="h2_bordered"><?php 
        echo gettext("News from Zenphoto.org");
        ?>
</h2>
		<?php 
        if ($connected) {
            echo RSS_Display("http://www.zenphoto.org/index.php?rss-news&withimages", 5);
        } else {
            ?>
			<ul>
				<li><?php 
            echo gettext('A connection to <em>Zenphoto.org</em> could not be established.');
            ?>
				</li>
			</ul>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
    return $side;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:32,代码来源:zenphoto_news.php

示例9: newsclient_pagesetup

function newsclient_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (isloggedin() && $CFG->your_resources_enabled) {
        if (defined("context") && context == "resources" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'resources', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/feeds/\" class=\"selected\" >" . gettext("Your Resources") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'resources', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/feeds/\" >" . gettext("Your Resources") . '</a></li>');
        }
        $rss_username = run("users:id_to_name", $page_owner);
    }
    if (defined("context") && context == "resources" && $CFG->your_resources_enabled) {
        if ($page_owner != -1) {
            if (run("permissions:check", "rss") && logged_on && $page_owner == $_SESSION['userid']) {
                $PAGE->menu_sub[] = array('name' => 'newsfeed:subscription', 'html' => a_hrefg($CFG->wwwroot . $_SESSION['username'] . "/feeds/", gettext("Feeds")));
                $PAGE->menu_sub[] = array('name' => 'newsfeed:subscription:publish:blog', 'html' => a_hrefg($CFG->wwwroot . "_rss/blog.php?page_owner=" . $_SESSION['userid'], gettext("Publish to blog")));
            }
            $PAGE->menu_sub[] = array('name' => 'newsclient', 'html' => a_hrefg($CFG->wwwroot . $rss_username . "/feeds/all/", gettext("View aggregator")));
        }
        $PAGE->menu_sub[] = array('name' => 'feed', 'html' => a_hrefg($CFG->wwwroot . "_rss/popular.php", gettext("Popular Feeds")));
        /*
        $PAGE->menu_sub[] = array( 'name' => 'feed',
                                   'html' => a_hrefg( $CFG->wwwroot."help/feeds_help.php", 
                                                      "Page help"));
        */
    }
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:31,代码来源:lib.php

示例10: _getInput

    protected function _getInput()
    {
        $element = parent::_getInput();
        $options = '';
        foreach ($this->_values as $value => $name) {
            // Things can get weird if we have mixed types
            $sval = $this->_value;
            if (gettype($value) == "integer" && gettype($sval) == "string") {
                $value = strval($value);
            }
            if (isset($this->_attributes['multiple'])) {
                $selected = in_array($value, (array) $sval);
            } else {
                $selected = $sval == $value;
            }
            if (!empty(trim($name)) || is_numeric($name)) {
                $name_str = htmlspecialchars(gettext($name));
            } else {
                // Fixes HTML5 validation: Element option without attribute label must not be empty
                $name_str = "&nbsp;";
            }
            $options .= '<option value="' . htmlspecialchars($value) . '"' . ($selected ? ' selected' : '') . '>' . $name_str . '</option>';
        }
        return <<<EOT
\t{$element}
\t\t{$options}
\t</select>
EOT;
    }
开发者ID:NewEraCracker,项目名称:pfsense,代码行数:29,代码来源:Select.class.php

示例11: pseudo_sendmail

function pseudo_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses)
{
    global $_zp_UTF8;
    $filename = str_replace(array('<', '>', ':', '"' . '/' . '\\', '|', '?', '*'), '_', $subject);
    $path = dirname(dirname(__FILE__)) . '/' . DATA_FOLDER . '/' . $filename . '.txt';
    $f = fopen($path, 'w');
    fwrite($f, str_pad('*', 49, '-') . "\n");
    $tolist = '';
    foreach ($email_list as $to) {
        $tolist .= ',' . $to;
    }
    fwrite($f, sprintf(gettext('To: %s'), substr($tolist, 1)) . "\n");
    fwrite($f, sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n");
    if (count($cc_addresses) > 0) {
        $cclist = '';
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $cclist .= ',' . $cc_mail;
        }
        fwrite($f, sprintf(gettext('Cc: %s'), substr($cclist, 1)) . "\n");
    }
    fwrite($f, sprintf(gettext('Subject: %s'), $subject) . "\n");
    fwrite($f, str_pad('*', 49, '-') . "\n");
    fwrite($f, $message . "\n");
    fclose($f);
    clearstatcache();
    return $msg;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:27,代码来源:pseudomail.php

示例12: __toString

    public function __toString()
    {
        $element = parent::__toString();
        $title = htmlspecialchars(gettext($this->_title));
        $body = implode('', $this->_groups);
        $hdricon = "";
        $bodyclass = '<div class="panel-body">';
        if ($this->_collapsible & COLLAPSIBLE) {
            $hdricon = '<span class="widget-heading-icon">' . '<a data-toggle="collapse" href="#' . $this->_attributes['id'] . '_panel-body">' . '<i class="fa fa-plus-circle"></i>' . '</a>' . '</span>';
            $bodyclass = '<div id="' . $this->_attributes['id'] . '_panel-body" class="panel-body collapse ';
            if ($this->_collapsible & SEC_CLOSED) {
                $bodyclass .= 'out">';
            } else {
                $bodyclass .= 'in">';
            }
        }
        return <<<EOT
\t{$element}
\t\t<div class="panel-heading">
\t\t\t<h2 class="panel-title">{$title}{$hdricon}</h2>
\t\t</div>
\t\t{$bodyclass}
\t\t\t{$body}
\t\t</div>
\t</div>
EOT;
    }
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:27,代码来源:Section.class.php

示例13: printLoginZone

/**
 * Prints out the links for login/out, register formular if asked
 */
function printLoginZone()
{
    if (!zp_loggedin() && (function_exists('printUserLogin_out') || function_exists('printUserLogin_out') || function_exists('printRegistrationForm'))) {
        $multi = 0;
        echo '<div id="loginout" class=" push_5 grid_10">';
        if (zp_loggedin() && function_exists('printUserLogin_out')) {
            printUserLogin_out('', '', false);
            $multi++;
        }
        if (!zp_loggedin() && function_exists('printUserLogin_out')) {
            if ($multi) {
                echo ' - ';
            }
            printCustomPageURL(gettext('Login'), 'login', '', '');
            $multi++;
        }
        if (!zp_loggedin() && function_exists('printRegistrationForm')) {
            if ($multi) {
                echo ' - ';
            }
            printCustomPageURL(gettext('Register for this site'), 'register', '', '');
        }
        echo '</div>';
    }
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:28,代码来源:functions.php

示例14: print_states

function print_states($tracker)
{
    global $rulescnt;
    $rulesid = "";
    $bytes = 0;
    $states = 0;
    $packets = 0;
    $evaluations = 0;
    $stcreations = 0;
    $rules = get_pf_rules($rulescnt, $tracker);
    if (is_array($rules)) {
        foreach ($rules as $rule) {
            $bytes += $rule['bytes'];
            $states += $rule['states'];
            $packets += $rule['packets'];
            $evaluations += $rule['evaluations'];
            $stcreations += $rule['state creations'];
            if (strlen($rulesid) > 0) {
                $rulesid .= ",";
            }
            $rulesid .= "{$rule['id']}";
        }
    }
    printf("<a href=\"diag_dump_states.php?ruleid=%s\" data-toggle=\"popover\" data-trigger=\"hover focus\" title=\"%s\" ", $rulesid, gettext("States details"));
    printf("data-content=\"evaluations: %s<br>packets: %s<br>bytes: %s<br>states: %s<br>state creations: %s\" data-html=\"true\">", format_number($evaluations), format_number($packets), format_bytes($bytes), format_number($states), format_number($stcreations));
    printf("%d/%s</a><br>", format_number($states), format_bytes($bytes));
}
开发者ID:NewEraCracker,项目名称:pfsense,代码行数:27,代码来源:firewall_rules.php

示例15: RunFreeQuery

function RunFreeQuery()
{
    global $cnInfoCentral;
    global $aRowClass;
    global $rsQueryResults;
    global $sSQL;
    global $iQueryID;
    //Run the SQL
    $rsQueryResults = RunQuery($sSQL);
    if (mysql_error() != "") {
        echo gettext("An error occured: ") . mysql_errno() . "--" . mysql_error();
    } else {
        $sRowClass = "RowColorA";
        echo "<table align=\"center\" cellpadding=\"5\" cellspacing=\"0\">";
        echo "<tr class=\"" . $sRowClass . "\">";
        //Loop through the fields and write the header row
        for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
            echo "<td align=\"center\"><b>" . mysql_field_name($rsQueryResults, $iCount) . "</b></td>";
        }
        echo "</tr>";
        //Loop through the recordsert
        while ($aRow = mysql_fetch_array($rsQueryResults)) {
            $sRowClass = AlternateRowStyle($sRowClass);
            echo "<tr class=\"" . $sRowClass . "\">";
            //Loop through the fields and write each one
            for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
                echo "<td align=\"center\">" . $aRow[$iCount] . "</td>";
            }
            echo "</tr>";
        }
        echo "</table>";
        echo "<br><p class=\"ShadedBox\" style=\"border-style: solid; margin-left: 50px; margin-right: 50 px; border-width: 1px;\"><span class=\"SmallText\">" . str_replace(Chr(13), "<br>", htmlspecialchars($sSQL)) . "</span></p>";
    }
}
开发者ID:vikingkarwur,项目名称:smjgpib,代码行数:34,代码来源:QuerySQL.php


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