本文整理汇总了PHP中Language类的典型用法代码示例。如果您正苦于以下问题:PHP Language类的具体用法?PHP Language怎么用?PHP Language使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Language类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: formImportFullText
public function formImportFullText()
{
$language = new Language();
$this->data->languages = $language->listAll()->asQuery()->chunkResult('idLanguage', 'language');
$this->data->action = '@fnbr20/utils/import/importFullText';
$this->render();
}
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:7,代码来源:ImportController.php
示例2: availableLangs
/**
* Get available languages list
*
* @return mixed
*/
function availableLangs()
{
$objLang = new Language();
//$conditions = $this->Access->isAdmin() ? array() : array('visible' => 1);
$conditions = array();
return $objLang->find('list', array('conditions' => $conditions));
}
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:12,代码来源:LanguageHelper.php
示例3: edit
function edit($id = false)
{
if (!$id) {
redirect($this->linker->a_recipe_show_link());
}
/* Loading libraries */
$this->load->library('form_validation');
# Js function from main.js which loads by default
array_push($this->data['js_functions'], array('name' => 'recipes_edit_init', 'data' => FALSE));
array_push($this->data['js_functions'], array('name' => 'language_text_init', 'data' => FALSE));
/* Get data for select boxes */
$recipe = new Recipe();
$meras = new Mera();
$languages = new Language();
$recipe->get_full_info($id);
$languages->get_iterated();
$meras->get_full_info();
#soedinit' sushestvuushie shagi po language
if ($this->form_validation->run('recipe_edit')) {
$this->_save($recipe);
} else {
/* Error on validation */
$this->data['form_error'] = validation_errors();
}
#
$this->data['dm_recipe'] = $recipe;
$this->data['dm_languages'] = $languages;
$this->data['dm_meras'] = $meras;
$this->template->load('/admin/templates/main_template', '/admin/recipes/edit', $this->data);
}
开发者ID:usaphp,项目名称:listafe,代码行数:30,代码来源:recipes.php
示例4: getLangByDB
/**
* get the Language config information
*
* @param object &$DBconn
* @param int $lang_id
* @return array $arr_data
*
*/
function getLangByDB(&$DBconn, $lang_id)
{
$language = new Language(&$DBconn);
$language->id = $lang_id;
$arr_data = $language->selectLanguage();
return $arr_data;
}
开发者ID:BackupTheBerlios,项目名称:openology-svn,代码行数:15,代码来源:SystemConfig.php
示例5: index
public function index()
{
$code = '';
$this->load->model('localisation/language');
$languages = $this->model_localisation_language->getLanguages();
if (isset($this->request->cookie['language'])) {
$code = $this->request->cookie['language'];
}
// Language Detection
if (!empty($this->request->server['HTTP_ACCEPT_LANGUAGE']) && !array_key_exists($code, $languages)) {
$browser_languages = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
foreach ($browser_languages as $browser_language) {
if (array_key_exists(strtolower($browser_language), $languages)) {
$code = strtolower($browser_language);
break;
}
}
}
if (!array_key_exists($code, $languages)) {
$code = $this->config->get('config_language');
}
if (!isset($this->request->cookie['language']) || $this->request->cookie['language'] != $code) {
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
// Overwrite the default language object
$language = new Language($code);
$language->load($code);
$this->registry->set('language', $language);
// Set the config language_id
$this->config->set('config_language_id', $languages[$code]['language_id']);
}
开发者ID:oleg1618,项目名称:ishop,代码行数:31,代码来源:language.php
示例6: save_postdata
function save_postdata($post_id)
{
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if (!wp_verify_nonce($_POST['aceelpress_noncename'], plugin_basename(__FILE__))) {
return;
}
// Check permissions
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return;
}
} else {
if (!current_user_can('edit_post', $post_id)) {
return;
}
}
// OK, we're authenticated: we need to find and save the data
$l = new Language();
if (!($languageIDs = $_POST[$l->getFormName()])) {
return;
}
foreach ($languageIDs as $lid => $val) {
add_post_meta($post_id, 'accelpress_language_' . $lid, $val, true) or update_post_meta($post_id, 'accelpress_language_' . $lid, $val);
}
}
开发者ID:netacceleration,项目名称:accelpress,代码行数:31,代码来源:Language.php
示例7: sendmessage
function sendmessage($touser, $title, $message, $from = '0')
{
global $hp_url, $admin_email, $admin_name, $hp_title;
$_language_tmp = new Language();
$systemmail = false;
if (!$from) {
$systemmail = true;
$from = '1';
}
if (!$systemmail) {
safe_query("INSERT INTO " . PREFIX . "messenger (userID, date, fromuser, touser, title, message, viewed) values('{$from}', '" . time() . "', '{$from}', '{$touser}', '{$title}', '" . $message . "', '0')");
safe_query("UPDATE " . PREFIX . "user SET pmsent=pmsent+1 WHERE userID='{$from}'");
}
if (!isignored($touser, $from) or $systemmail) {
if ($touser != $from || $systemmail) {
safe_query("INSERT INTO " . PREFIX . "messenger (userID, date, fromuser, touser, title, message, viewed) VALUES ('{$touser}', '" . time() . "', '{$from}', '{$touser}', '{$title}', '" . $message . "', '0')");
}
safe_query("UPDATE " . PREFIX . "user SET pmgot=pmgot+1 WHERE userID='{$touser}'");
if (wantmail($touser) and isonline($touser) == "offline") {
$ds = mysql_fetch_array(safe_query("SELECT email, language FROM " . PREFIX . "user WHERE userID='{$touser}'"));
$_language_tmp->set_language($ds['language']);
$_language_tmp->read_module('messenger');
$mail_body = str_replace("%nickname%", getnickname($touser), $_language_tmp->module['mail_body']);
$mail_body = str_replace("%hp_url%", $hp_url, $mail_body);
mail($ds['email'], $hp_title . ': ' . $_language_tmp->module['mail_subject'], $mail_body, "Content-Type: text/html; charset=utf-8\nFrom: " . $admin_email . "\n");
}
}
}
开发者ID:Blaz3r,项目名称:webSPELL,代码行数:28,代码来源:messenger.php
示例8: fetchJobSpecInfo
function fetchJobSpecInfo($value)
{
$lan = new Language();
require $lan->getLangPath("full.php");
$jobTitle = new JobTitle();
$status = $jobTitle->getJobStatusFromTitle($value);
$stat[] = array(0 => '', 1 => '0', 2 => "-- {$lang_hremp_selempstat} --");
for ($i = 0; $i < count($status); $i++) {
$stat[] = $status[$i];
}
$status = $stat;
$view_controller = new ViewController();
$response = new xajaxResponse();
$xajaxFiller = new xajaxElementFiller();
$objResponse = $xajaxFiller->cmbFillerById($response, $status, 1, 'frmEmp.empstatpp', 'cmbType');
$jobSpec = $view_controller->getJobSpecForJob($value);
if (empty($jobSpec)) {
$jobSpecName = '';
$jobSpecDuties = '';
} else {
$jobSpecName = CommonFunctions::escapeHtml($jobSpec->getName());
$jobSpecDuties = nl2br(CommonFunctions::escapeHtml($jobSpec->getDuties()));
}
$response->addAssign('jobSpecName', 'innerHTML', $jobSpecName);
$response->addAssign('jobSpecDuties', 'innerHTML', $jobSpecDuties);
$response->addAssign('status', 'innerHTML', '');
$response->addScript('reselectEmpStatus();');
return $response->getXML();
}
开发者ID:googlecode-mirror,项目名称:pucit-orangehrm,代码行数:29,代码来源:hrEmpMain.php
示例9: clearCache
/**
* Calls the delete_files function, then displays a message.
*
* @param string $folder - path to the cache folder
* @param string $msg - show "cleared" message or not
* @return bool $success
*/
public function clearCache($h, $folder, $msg = true)
{
// clear language from memory (lang_cache only)
if ($folder == 'lang_cache') {
$h->lang = array();
}
// go delete the files
$success = $this->deleteFiles(CACHE . $folder);
// lang_cache only:
if ($folder == 'lang_cache') {
$langObj = new Language();
$h->lang = $langObj->includeLanguagePack($h->lang, 'main');
$h->lang = $langObj->includeLanguagePack($h->lang, 'admin');
}
// no need to show a message, return now
if (!$msg) {
return $success;
}
// prepare messages
if ($success) {
$h->messages[$h->lang('admin_maintenance_clear_cache_success')] = 'alert-success';
} else {
$h->messages[$h->lang('admin_maintenance_clear_cache_failure')] = 'alert-danger';
}
// return boolean result
return $success;
}
开发者ID:hotarucms,项目名称:hotarucms,代码行数:34,代码来源:Maintenance.php
示例10: run_update
function run_update($command, $args)
{
CLI::logging("Updating...\n");
$language = new Language();
$language->updateLanguagePlugin($command[0], $command[1]);
CLI::logging("Update successful\n");
}
开发者ID:emildev35,项目名称:processmaker,代码行数:7,代码来源:cliPlugins.php
示例11: editOrder
public function editOrder($order_id, $data)
{
$this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int) $data['order_status_id'] . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'");
$this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int) $order_id . "', order_status_id = '" . (int) $data['order_status_id'] . "', notify = '" . (isset($data['notify']) ? (int) $data['notify'] : 0) . "', comment = '" . $this->db->escape(strip_tags($data['comment'])) . "', date_added = NOW()");
if (isset($data['notify'])) {
$query = $this->db->query("SELECT *, os.name AS status, l.code AS language FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id AND os.language_id = o.language_id) LEFT JOIN " . DB_PREFIX . "language l ON (o.language_id = l.language_id) WHERE o.order_id = '" . (int) $order_id . "'");
if ($query->num_rows) {
$language = new Language($query->row['language']);
$language->load('customer/order');
$subject = sprintf($language->get('mail_subject'), html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8'), $order_id);
$message = $language->get('mail_order') . ' ' . $order_id . "\n";
$message .= $language->get('mail_date_added') . ' ' . date($language->get('date_format_short'), strtotime($query->row['date_added'])) . "\n\n";
$message .= $language->get('mail_order_status') . "\n\n";
$message .= $query->row['status'] . "\n\n";
$message .= $language->get('mail_invoice') . "\n";
$message .= html_entity_decode(HTTP_CATALOG . 'index.php?route=account/invoice&order_id=' . $order_id, ENT_QUOTES, 'UTF-8') . "\n\n";
if (isset($data['comment'])) {
$message .= $language->get('mail_comment') . "\n\n";
$message .= strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "\n\n";
}
$message .= $language->get('mail_footer');
$mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password'), ENT_QUOTES, 'UTF-8'), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
$mail->setTo($query->row['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject($subject);
$mail->setText($message);
$mail->send();
}
}
}
开发者ID:RepublicMaster,项目名称:opencart,代码行数:31,代码来源:order.php
示例12: get_short_info
function get_short_info($id = false, $current_language = 'English')
{
#
$language = new Language();
is_numeric($current_language) ? $language->get_by_id($current_language) : $language->get_by_name($current_language);
#svazivaet nutrition s vibranim language
if ($id) {
$this->get_by_id($id);
$this->language->include_join_fields()->get_iterated();
} else {
$full_list = new Nutrition();
$full_list->select('id, tagname')->where('Group_List', 3)->get_iterated();
#создает объектную модель данных для одбращения к данным через свойства объекта
$this->select('id, tagname, value, units')->where('group_list', 3)->get();
foreach ($this as $nutrition) {
$this->data->{strtolower($nutrition->tagname)} = array('id' => $nutrition->id, 'value' => $nutrition->value, 'units' => $nutrition->units);
}
#добавляет нулевые значения к отсутствующим данным
foreach ($full_list as $elem) {
if (!isset($this->data->{strtolower($elem->tagname)})) {
$this->data->{strtolower($elem->tagname)} = array('id' => $elem->id, 'value' => '~', 'units' => '');
}
}
$this->id = null;
}
}
开发者ID:usaphp,项目名称:listafe,代码行数:26,代码来源:nutrition.php
示例13: translate
public static function translate(Language $language, $html, $debug = false)
{
$errors = [];
// @param $html : html document
foreach (self::$loadedSources as $sourcename) {
// load translations from file
$temp = $language->getTranslations($sourcename);
$translations = [];
if (isset($temp['translations'])) {
$translations = $temp['translations'];
}
// apply given values
foreach ($translations as $key => $value) {
try {
if (empty($value)) {
#throw new Exception('Missing translation for '.$key);
if ($debug) {
$value = '(' . $key . ')';
} else {
$value = '';
}
}
$html = str_replace($key, trim($value), $html);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
}
}
return array('content' => $html, 'errors' => $errors);
}
开发者ID:metterrothan,项目名称:cv-reboot-tpl-sys,代码行数:30,代码来源:Controller.class.php
示例14: postLanguage
public function postLanguage()
{
$language = new Language();
$language->name = Input::get('name');
$language->save();
return Response::json($language);
}
开发者ID:saifurrahman,项目名称:dev,代码行数:7,代码来源:LanguageController.php
示例15: GetURI
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
{
$translator = \Zend_Registry::get('container')->getService('translator');
$languageObj = new Language($p_languageId);
if (!$languageObj->exists()) {
return new PEAR_Error($translator->trans('Language does not exist.'));
}
$uri = '/' . $languageObj->getCode() . '/';
if (!is_null($p_issueNo) && is_null($p_articleNo)) {
$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
if (!$issueObj->exists()) {
return new PEAR_Error($translator->trans('Issue does not exist.'));
}
$uri .= $issueObj->getUrlName() . '/';
}
if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
if (!$sectionObj->exists()) {
return new PEAR_Error($translator->trans('Section does not exist.'));
}
$uri .= $sectionObj->getUrlName() . '/';
}
if (!is_null($p_articleNo)) {
$articleObj = new Article($p_languageId, $p_articleNo);
if (!$articleObj->exists()) {
return new PEAR_Error($translator->trans('Article does not exist.'));
}
$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
$uri .= $issueObj->getUrlName() . '/';
$uri .= $sectionObj->getUrlName() . '/';
$uri .= $articleObj->getUrlName() . '/';
}
return $uri;
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:35,代码来源:ShortURL.php
示例16: edit
function edit($id = false)
{
$this->load->library('form_validation');
# var $data['js_functions'] init from Admin_Controller
# Js function from main.js which loads by default
array_push($this->data['js_functions'], array('name' => 'nutritions_edit_init', 'data' => FALSE));
$languages = new Language();
$nutrition = new Nutrition();
$nutrition_categories = new Nutrition_category();
$languages->get_iterated();
$nutrition->get_full_info($id);
$nutrition_categories->get_full_info();
//if form validates
if ($this->form_validation->run('nutrition')) {
$nutrition_category = new Nutrition_category();
$nutrition_category->get_by_id($this->input->post('nutritions_categories_id'));
$nutrition->nutrition_category_id = $nutrition_category->id;
if ($this->save_object_name($nutrition)) {
$this->data['form_success'] = 'Вещество добавлено';
} else {
$this->data['form_error'] = $nutrition->error->string;
}
} else {
#$this->data['form_error'] = validation_errors();
}
$this->data['dm_languages'] = $languages;
$this->data['dm_nutrition'] = $nutrition;
$this->data['current_language'] = 1;
#Russian
$this->data['nutrition_categories'] = $nutrition_categories;
$this->template->load('/admin/templates/main_template', '/admin/nutritions/edit', $this->data);
}
开发者ID:usaphp,项目名称:listafe,代码行数:32,代码来源:nutritions.php
示例17: testSanitizeFilename
/**
* @param $inputFileName
* @param $expectedOutput
* @param $description
* @dataProvider testSanitizeFilenameDataProvider
*/
public function testSanitizeFilename($inputFileName, $contentLanguageCode, $expectedOutput, $description)
{
$language = new \Language();
$language->setCode($contentLanguageCode);
$actualOutput = $this->imageFilenameSanitizer->sanitizeImageFileName($inputFileName, $language);
$this->assertEquals($expectedOutput, $actualOutput, $description);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:ImageFilenameSanitizerTest.php
示例18: GetURI
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
{
$languageObj = new Language($p_languageId);
if (!$languageObj->exists()) {
return new PEAR_Error(getGS('Language does not exist.'));
}
$uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
if (!is_null($p_issueNo) && is_null($p_articleNo)) {
$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
if (!$issueObj->exists()) {
return new PEAR_Error(getGS('Issue does not exist.'));
}
$uri .= $issueObj->getUrlName() . '/';
}
if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
if (!$sectionObj->exists()) {
return new PEAR_Error(getGS('Section does not exist.'));
}
$uri .= $sectionObj->getUrlName() . '/';
}
if (!is_null($p_articleNo)) {
$articleObj = new Article($p_languageId, $p_articleNo);
if (!$articleObj->exists()) {
return new PEAR_Error(getGS('Article does not exist.'));
}
$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
$uri .= $issueObj->getUrlName() . '/';
$uri .= $sectionObj->getUrlName() . '/';
$uri .= $articleObj->getUrlName() . '/';
}
return $uri;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:34,代码来源:ShortURL.php
示例19: index
public function index()
{
if (!isset($this->session->data['language'])) {
$languages = glob(DIR_LANGUAGE . '*', GLOB_ONLYDIR);
foreach ($languages as $language) {
$languages[] = basename($language);
}
if (isset($this->request->server['HTTP_ACCEPT_LANGUAGE'])) {
$browser_languages = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
foreach ($browser_languages as $browser_language) {
if (in_array($browser_language, $languages)) {
$this->session->data['language'] = $browser_language;
break;
}
}
}
}
if (!isset($this->session->data['language']) || !is_dir(DIR_LANGUAGE . str_replace('../', '/', $this->session->data['language']))) {
$this->session->data['language'] = $this->config->get('language.default');
}
// Language
$language = new Language($this->session->data['language']);
$language->load($this->session->data['language']);
$this->registry->set('language', $language);
}
开发者ID:dyp8848,项目名称:opencart,代码行数:25,代码来源:language.php
示例20: getUndefinedLanguages
public function getUndefinedLanguages($entry)
{
$criteria = $this->getCriteria()->select("idLanguage");
$criteria->where("entry = '{$entry}'");
$language = new Language();
$languages = $language->getCriteria()->select("idLanguage, language")->where('idLanguage', 'not in', $criteria)->asQuery()->chunkResult('idLanguage', 'language');
return $languages;
}
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:8,代码来源:EntryRepository.php
注:本文中的Language类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论