public function testDomain() { $this->assertEquals('Typ', _dgettext('phpmyadmin', 'Type')); $this->assertEquals('%d sekundy', _dngettext('phpmyadmin', '%d second', '%d seconds', 2)); $this->assertEquals('%d seconds', _dnpgettext('phpmyadmin', 'context', '%d second', '%d seconds', 2)); $this->assertEquals('Tabulka', _dpgettext('phpmyadmin', 'Display format', 'Table')); }
/** * Generates a html select with all countries * * @access public * @param string * @param string * @param string * @param mixed * @return string */ function countries_menu($default = 'DZ', $class = '', $name = 'countries', $attributes = '') { $CI =& get_instance(); $default or $default = 'DZ'; $menu = '<select name="' . $name . '"'; if ($class !== '') { $menu .= ' class="' . $class . '"'; } $menu .= _stringify_attributes($attributes) . ">\n"; //foreach (timezones() as $key => $val) foreach (countries() as $key => $val) { $selected = $default === $key ? ' selected="selected"' : ''; $menu .= '<option value="' . $key . '"' . $selected . '>' . _dgettext("system", $val['name']) . "</option>\n"; } return $menu . '</select>'; }
/** * Retrieves list of available migration scripts * * @return array list of migration file paths sorted by version */ public function find_migrations() { $migrations = array(); // Load all *_*.php files in the migrations path foreach (glob($this->_migration_path . '*_*.php') as $file) { $name = basename($file, '.php'); // Filter out non-migration files if (preg_match($this->_migration_regex, $name)) { $number = $this->_get_migration_number($name); // There cannot be duplicate migration numbers if (isset($migrations[$number])) { $this->_error_string = sprintf(_dgettext("system", "There are multiple migrations with the same version number: %s."), $number); show_error($this->_error_string); } $migrations[$number] = $file; } } ksort($migrations); return $migrations; }
function dgettext($domain, $msgid) { return _dgettext($domain, $msgid); }
/** * Timezone Menu * * Generates a drop-down menu of timezones. * * @param string timezone * @param string classname * @param string menu name * @param mixed attributes * @return string */ function timezone_menu($default = 'UTC', $class = '', $name = 'timezones', $attributes = '') { $CI =& get_instance(); include_once BASEPATH . 'vendor/timezones.php'; $default = $default === 'GMT' ? 'UTC' : $default; $menu = '<select name="' . $name . '"'; if ($class !== '') { $menu .= ' class="' . $class . '"'; } $menu .= _stringify_attributes($attributes) . ">\n"; //foreach (timezones() as $key => $val) foreach ($timezones as $key => $val) { $selected = $default === $key ? ' selected="selected"' : ''; $menu .= '<option value="' . $key . '"' . $selected . '>' . _dgettext("system", $val) . "</option>\n"; } return $menu . '</select>'; }
/** * Fetch the encryption key * * Returns it as MD5 in order to have an exact-length 128 bit key. * Mcrypt is sensitive to keys that are not the correct length * * @param string * @return string */ public function get_key($key = '') { if ($key === '') { if ($this->encryption_key !== '') { return $this->encryption_key; } $key = config_item('encryption_key'); if (!strlen($key)) { show_error(_dgettext("system", "In order to use the encryption class requires that you set an encryption key in your config file.")); } } return md5($key); }
/** * Alias for gettext. * * @param string $msgid The message. * @param string $domain Gettext domain. * * @return string * @throws Exception If $domain is an array. */ function __($msgid, $domain = null) { return isset($domain) ? _dgettext($domain, $msgid) : _gettext($msgid); }
/** * Get image properties * * A helper function that gets info about the file * * @param string * @param bool * @return mixed */ public function get_image_properties($path = '', $return = FALSE) { // For now we require GD but we should // find a way to determine this using IM or NetPBM if ($path === '') { $path = $this->full_src_path; } if (!file_exists($path)) { $this->set_error(_dgettext("system", "The path to the image is not correct.")); return FALSE; } $vals = getimagesize($path); $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); $mime = isset($types[$vals[2]]) ? 'image/' . $types[$vals[2]] : 'image/jpg'; if ($return === TRUE) { return array('width' => $vals[0], 'height' => $vals[1], 'image_type' => $vals[2], 'size_str' => $vals[3], 'mime_type' => $mime); } $this->orig_width = $vals[0]; $this->orig_height = $vals[1]; $this->image_type = $vals[2]; $this->size_str = $vals[3]; $this->mime_type = $mime; return TRUE; }
?> </a>.</p> </div> <div class="box-footer text-right"> <span class="float-left"> <a href="http://bit.ly/CI3GitHub" class="btn btn-small btn-github" target="_blank"><i class="fa fa-github-square"></i> Github</a> <a href="<?php echo site_url('welcome/twig'); ?> " class="btn btn-small btn-red">Twig</a> </span> <?php echo __("Page rendered in"); ?> <strong>{elapsed_time}</strong> <?php echo _dgettext("system", "Seconds"); ?> . <?php echo ENVIRONMENT === 'development' ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : ''; ?> </div> </div> </div> </div> </div> <?php if (config('site.use_cdn') === true) { ?> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript" src="http://static.ianhub.com/dinakit/js/dinakit.js"></script>
/** * Set file permissions * * @param string $path File path * @param int $perm Permissions * @return bool */ public function chmod($path, $perm) { if (!$this->_is_conn()) { return FALSE; } if (@ftp_chmod($this->conn_id, $perm, $path) === FALSE) { if ($this->debug === TRUE) { $this->_error(_dgettext("system", "Unable to set file permissions. Please check your path.")); } return FALSE; } return TRUE; }
function _d($domain, $msgid) { T_bindtextdomain($domain, APPPATH . 'language'); return _dgettext($domain, $msgid); }
/** * Alias for gettext. * * @param string $msgid The message. * @param string $domain Gettext domain. * * @throws Exception If $domain is an array. */ function __($msgid, $domain = null) { if (is_array($domain)) { throw new Exception(__('$domain cannot be an array.')); } return isset($domain) ? _dgettext($domain, $msgid) : _gettext($msgid); }
$result = _("Send"); } $delta["_"] = array((microtime(true) - $start) / $times, $result); $start = microtime(true); for ($i = 0; $i < $times; $i++) { $result = __("Send"); } $delta["__"] = array((microtime(true) - $start) / $times, $result); $start = microtime(true); for ($i = 0; $i < $times; $i++) { $result = dgettext("FeedSub", "Feeds"); } $delta["dgettext"] = array((microtime(true) - $start) / $times, $result); $start = microtime(true); for ($i = 0; $i < $times; $i++) { $result = _dgettext("FeedSub", "Feeds"); } $delta["_dgettext"] = array((microtime(true) - $start) / $times, $result); $start = microtime(true); for ($i = 0; $i < $times; $i++) { // TRANS: String in the gettext speed test script. Unimportant. $result = _m("Feeds"); } $delta["_m"] = array((microtime(true) - $start) / $times, $result); $start = microtime(true); for ($i = 0; $i < $times; $i++) { $result = fake("Feeds"); } $delta["fake"] = array((microtime(true) - $start) / $times, $result); foreach ($delta as $func => $bits) { list($time, $result) = $bits;
/** * Send SMTP data * * @param string $data * @return bool */ protected function _send_data($data) { $data .= $this->newline; for ($written = $timestamp = 0, $length = strlen($data); $written < $length; $written += $result) { if (($result = fwrite($this->_smtp_connect, substr($data, $written))) === FALSE) { break; } elseif ($result === 0) { if ($timestamp === 0) { $timestamp = time(); } elseif ($timestamp < time() - $this->smtp_timeout) { $result = FALSE; break; } usleep(250000); continue; } else { $timestamp = 0; } } if ($result === FALSE) { $this->_set_error_message(_dgettext("system", "Unable to send data: %s"), $data); return FALSE; } return TRUE; }
/** * Constructor * * @param array $params Initialization parameters * @return void */ public function __construct($params = array()) { $this->CI =& get_instance(); foreach (array('first_link', 'next_link', 'prev_link', 'last_link') as $key) { switch ($key) { case 'first_link': $this->{$key} = _dgettext("system", "‹ First"); break; case 'next_link': $this->{$key} = _dgettext("system", ">"); break; case 'prev_link': $this->{$key} = _dgettext("system", "<"); break; case 'last_link': $this->{$key} = _dgettext("system", "Last ›"); break; } } $this->initialize($params); log_message('info', 'Pagination Class Initialized'); }
/** * Class constructor * * @param array $params Configuration parameters * @return void */ public function __construct(array $params = array()) { $this->_drivers = array('mcrypt' => defined('MCRYPT_DEV_URANDOM'), 'openssl' => is_php('5.3.3') && extension_loaded('openssl')); if (!$this->_drivers['mcrypt'] && !$this->_drivers['openssl']) { show_error(_dgettext("system", "Encryption: Unable to find an available encryption driver.")); } isset(self::$func_override) or self::$func_override = extension_loaded('mbstring') && ini_get('mbstring.func_override'); $this->initialize($params); if (!isset($this->_key) && self::strlen($key = config_item('encryption_key')) > 0) { $this->_key = $key; } log_message('info', 'Encryption Class Initialized'); }