本文整理汇总了PHP中osc_current_user_locale函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_current_user_locale函数的具体用法?PHP osc_current_user_locale怎么用?PHP osc_current_user_locale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_current_user_locale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extendDataSingle
public function extendDataSingle($item)
{
$prefLocale = osc_current_user_locale();
$descriptions = $this->conn->osc_dbFetchResults('SELECT * FROM %st_item_description WHERE fk_i_item_id = %d', DB_TABLE_PREFIX, $item['pk_i_id']);
$item['locale'] = array();
foreach ($descriptions as $desc) {
if ($desc['s_title'] != "" || $desc['s_description'] != "") {
$item['locale'][$desc['fk_c_locale_code']] = $desc;
}
}
$is_itemLanguageAvailable = !empty($item['locale'][$prefLocale]['s_title']) && !empty($item['locale'][$prefLocale]['s_description']);
if (isset($item['locale'][$prefLocale]) && $is_itemLanguageAvailable) {
$item['s_title'] = $item['locale'][$prefLocale]['s_title'];
$item['s_description'] = $item['locale'][$prefLocale]['s_description'];
} else {
$mCategories = new Category();
$aCategory = $mCategories->findByPrimaryKey($item['fk_i_category_id']);
$title = sprintf(__('%s in'), $aCategory['s_name']);
if (isset($item['s_city'])) {
$title .= ' ' . $item['s_city'];
} else {
if (isset($item['s_region'])) {
$title .= ' ' . $item['s_region'];
} else {
if (isset($item['s_country'])) {
$title .= ' ' . $item['s_country'];
}
}
}
$item['s_title'] = $title;
$item['s_description'] = __('There\'s no description available in your language');
unset($data);
}
return $item;
}
示例2: processData
private function processData($pages)
{
if (!empty($pages)) {
$prefLocale = osc_current_user_locale();
foreach ($pages as $aRow) {
$row = array();
$content = array();
if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
$content = $aRow['locale'][$prefLocale];
} else {
$content = current($aRow['locale']);
}
// -- options --
$options = array();
View::newInstance()->_exportVariableToView('page', $aRow);
$options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&action=edit&id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
if (!$aRow['b_indelible']) {
$options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&action=delete&id=' . $aRow['pk_i_id'] . '&' . osc_csrf_token_url() . '">' . __('Delete') . '</a>';
}
$auxOptions = '<ul>' . PHP_EOL;
foreach ($options as $actual) {
$auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
}
$actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
$row['bulkactions'] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
$row['internal_name'] = $aRow['s_internal_name'] . $actions;
$row['title'] = $content['s_title'];
$row['order'] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" /> <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
$row = osc_apply_filter('pages_processing_row', $row, $aRow);
$this->addRow($row);
$this->rawRows[] = $aRow;
}
}
}
示例3: new_pm_email
/**
* Send email to user when they get a new PM
*
* @param integer $item
* @param integer $offer_value
*
* @dynamic tags
*
* '{RECIP_NAME}', '{SENDER_NAME}', '{WEB_URL}', '{WEB_TITLE}', '{PM_URL}', '{PM_SUBJECT}', '{PM_MESSAGE}'
*/
function new_pm_email($pm_info)
{
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_PM_alert');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
if ($pm_info['sender_id'] == 0) {
$sender_name = pmAdmin();
} else {
$pm_senderData = User::newInstance()->findByPrimaryKey($pm_info['sender_id']);
$sender_name = $pm_senderData['s_name'];
}
if ($pm_info['recip_id'] == 0) {
$pm_url = osc_admin_base_url(true) . '?page=plugins&action=renderplugin&file=osclass_pm/admin-send.php?userId=' . $pm_info['sender_id'] . '&mType=adminQuote&messId=' . $pm_info['pm_id'];
$pm_name = pmAdmin();
$pm_recipData['s_email'] = osc_contact_email();
} else {
$pm_url = osc_base_url(true) . '?page=custom&file=osclass_pm/user-send.php?userId=' . $pm_info['sender_id'] . '&mType=quote&messId=' . $pm_info['pm_id'];
$pm_recipData = User::newInstance()->findByPrimaryKey($pm_info['recip_id']);
$pm_name = $pm_recipData['s_name'];
}
$pm_url = '<a href="' . $pm_url . '" >' . $pm_url . '</a>';
$words = array();
$words[] = array('{RECIP_NAME}', '{SENDER_NAME}', '{WEB_URL}', '{WEB_TITLE}', '{PM_URL}', '{PM_SUBJECT}', '{PM_MESSAGE}', '[quote]', '[/quote]', '[quoteAuthor]', '[/quoteAuthor]');
$words[] = array($pm_name, $sender_name, osc_base_url(), osc_page_title(), $pm_url, $pm_info['pm_subject'], nl2br($pm_info['pm_message']), '<div class="messQuote">', '</div>', '<div class="quoteAuthor">', '</div>');
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $pm_recipData['s_email'], 'to_name' => $pm_name, 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
示例4: __construct
public function __construct($l = "")
{
if ($l == "") {
$l = osc_current_user_locale();
}
$this->language = $l;
parent::__construct();
}
示例5: listAll
public function listAll($language = "")
{
if ($language == '') {
$language = osc_current_user_locale();
} else {
$language = "en_US";
}
return $this->conn->osc_dbFetchResults('SELECT * FROM (SELECT *, FIELD(fk_c_locale_code, \'en_US\', \'' . osc_current_user_locale() . '\', \'' . $language . '\') as sorter FROM %s WHERE s_name != \'\' ORDER BY sorter DESC) dummytable GROUP BY pk_c_code ORDER BY s_name ASC', $this->getTableName());
}
示例6: __construct
public function __construct($l = "")
{
if ($l == "") {
$l = osc_current_user_locale();
}
$this->language = $l;
$this->tree = null;
$this->relation = null;
$this->categories = null;
parent::__construct();
$this->empty_tree = true;
$this->toTree();
}
示例7: __construct
/**
* Set data related to t_category table
*/
function __construct($l = '')
{
parent::__construct();
$this->setTableName('t_category');
$this->setPrimaryKey('pk_i_id');
$array_fields = array('pk_i_id', 'fk_i_parent_id', 'i_expiration_days', 'i_position', 'b_enabled', 's_icon', 'b_price_enabled');
$this->setFields($array_fields);
if ($l == '') {
$l = osc_current_user_locale();
}
$this->_language = $l;
$this->_tree = null;
$this->_relation = null;
$this->_categories = null;
$this->_emptyTree = true;
$this->toTree();
}
示例8: listAllAdmin
public function listAllAdmin($language = "")
{
if ($language == '') {
$language = osc_current_user_locale();
} else {
$language = 'en_US';
}
$countries_temp = $this->conn->osc_dbFetchResults('SELECT * FROM (SELECT *, FIELD(fk_c_locale_code, \'en_US\', \'' . osc_current_user_locale() . '\', \'' . $language . '\') as sorter FROM %s WHERE s_name != \'\' ORDER BY sorter DESC) dummytable GROUP BY pk_c_code ORDER BY s_name ASC', $this->getTableName());
$countries = array();
foreach ($countries_temp as $country) {
$locales = $this->conn->osc_dbFetchResults("SELECT * FROM %s WHERE pk_c_code = '%s'", $this->getTableName(), $country['pk_c_code']);
foreach ($locales as $locale) {
$country['locales'][$locale['fk_c_locale_code']] = $locale['s_name'];
}
$countries[] = $country;
}
return $countries;
}
示例9: __construct
function __construct($install = false)
{
if (!$install) {
// get user/admin locale
if (OC_ADMIN) {
$locale = osc_current_admin_locale();
} else {
$locale = osc_current_user_locale();
}
// load core
$core_file = osc_translations_path() . $locale . '/core.mo';
$this->_load($core_file, 'core');
// load messages
$messages_file = osc_themes_path() . osc_theme() . '/languages/' . $locale . '/messages.mo';
if (!file_exists($messages_file)) {
$messages_file = osc_translations_path() . $locale . '/messages.mo';
}
$this->_load($messages_file, 'messages');
// load theme
$domain = osc_theme();
$theme_file = osc_themes_path() . $domain . '/languages/' . $locale . '/theme.mo';
if (!file_exists($theme_file)) {
if (!file_exists(osc_themes_path() . $domain)) {
$domain = 'modern';
}
$theme_file = osc_translations_path() . $locale . '/theme.mo';
}
$this->_load($theme_file, $domain);
// load plugins
$aPlugins = Plugins::listInstalled();
foreach ($aPlugins as $plugin) {
$domain = preg_replace('|/.*|', '', $plugin);
$plugin_file = osc_plugins_path() . $domain . '/languages/' . $locale . '/messages.mo';
if (file_exists($plugin_file)) {
$this->_load($plugin_file, $domain);
}
}
} else {
$core_file = osc_translations_path() . osc_current_admin_locale() . '/core.mo';
$this->_load($core_file, 'core');
}
}
示例10: toArrayFormat
private function toArrayFormat()
{
$this->result['iTotalRecords'] = $this->total;
$this->result['iTotalDisplayRecords'] = $this->total_filtered;
$this->result['iDisplayLength'] = $this->_get['iDisplayLength'];
$this->result['aaData'] = array();
if (count($this->pages) == 0) {
return;
}
$prefLocale = osc_current_user_locale();
$count = 0;
foreach ($this->pages as $aRow) {
$row = array();
$content = array();
if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
$content = $aRow['locale'][$prefLocale];
} else {
$content = current($aRow['locale']);
}
// -- options --
$options = array();
View::newInstance()->_exportVariableToView('page', $aRow);
$options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
$options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&action=edit&id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
if (!$aRow['b_indelible']) {
$options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&action=delete&id=' . $aRow['pk_i_id'] . '">' . __('Delete') . '</a>';
}
$auxOptions = '<ul>' . PHP_EOL;
foreach ($options as $actual) {
$auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
}
$actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
$row[] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
$row[] = $aRow['s_internal_name'] . $actions;
$row[] = $content['s_title'];
$row[] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" /> <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
$this->result['aaData'][] = $row;
}
}
示例11: email_link_problem
function email_link_problem($url_from, $url_to, $contact)
{
$page = new Page();
$page = $page->findByInternalName('seo_link_problem');
if (empty($page)) {
exit;
}
$locale = osc_current_user_locale();
$content = array();
if (isset($page['locale'][$locale]['s_title'])) {
$content = $page['locale'][$locale];
} else {
$content = current($page['locale']);
}
$words = array();
$words[] = array('{LINK_FROM}', '{LINK_TO}');
$words[] = array($url_from, $url_to);
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$email_build = array('subject' => $title, 'to' => $contact, 'to_name' => 'Partner', 'body' => $body, 'alt_body' => $body);
osc_sendMail($email_build);
}
示例12: language_selector
public static function language_selector($value = NULL)
{
$name = 'new_item[gn_lang]';
self::setInputValueFor('gn_lang', $value);
$locales = osc_all_enabled_locales_for_admin();
if ($value == NULL) {
$value = osc_current_user_locale();
}
if (count($locales) > 1) {
echo '<select name="' . $name . '" id="news_lang_selector">';
foreach ($locales as $locale) {
$selected = '';
if ($value == $locale['pk_c_code']) {
$selected = 'selected="selected"';
}
echo '<option value="' . $locale['pk_c_code'] . '" ' . $selected . '>' . $locale['s_short_name'] . '</option>';
}
echo '</select>';
} else {
echo $locales[0]['s_short_name'];
parent::generic_input_hidden('locale', $locales[0]['pk_c_code']);
}
}
示例13: _e
</label>
<div class="controls">
<?php
UserForm::website_text(osc_user());
?>
</div>
</div>
<div class="form-group">
<label class="control-label" for="s_info">
<?php
_e('Description', OSCLASSWIZARDS_THEME_FOLDER);
?>
</label>
<div class="controls">
<?php
UserForm::info_textarea('s_info', osc_current_user_locale(), @$osc_user['locale'][osc_current_user_locale()]['s_info']);
?>
</div>
</div>
<?php
osc_run_hook('user_profile_form', osc_user());
?>
<div class="form-group">
<div class="controls">
<button type="submit" class="btn btn-success">
<?php
_e("Update", OSCLASSWIZARDS_THEME_FOLDER);
?>
</button>
</div>
</div>
示例14: __construct
/**
*
*/
function __construct($expired = false)
{
parent::__construct();
$this->setTableName('t_item');
$this->setFields(array('pk_i_id'));
$this->withPattern = false;
$this->withLocations = false;
$this->withCategoryId = false;
$this->withUserId = false;
$this->withPicture = false;
$this->withNoUserEmail = false;
$this->price_min = null;
$this->price_max = null;
$this->user_ids = null;
$this->itemId = null;
$this->city_areas = array();
$this->cities = array();
$this->regions = array();
$this->countries = array();
$this->categories = array();
$this->conditions = array();
$this->tables = array();
$this->tables_join = array();
$this->search_fields = array();
$this->itemConditions = array();
$this->groupBy = '';
$this->having = '';
$this->order();
$this->limit();
$this->results_per_page = 10;
if (!$expired) {
// t_item
$this->addItemConditions(sprintf("%st_item.b_enabled = 1 ", DB_TABLE_PREFIX));
$this->addItemConditions(sprintf("%st_item.b_active = 1 ", DB_TABLE_PREFIX));
$this->addItemConditions(sprintf("%st_item.b_spam = 0", DB_TABLE_PREFIX));
$this->addItemConditions(sprintf("(%st_item.b_premium = 1 || %st_item.dt_expiration >= '%s')", DB_TABLE_PREFIX, DB_TABLE_PREFIX, date('Y-m-d H:i:s')));
}
$this->total_results = null;
$this->total_results_table = null;
// get all item_location data
if (OC_ADMIN) {
$this->addField(sprintf('%st_item_location.*', DB_TABLE_PREFIX));
$this->locale_code = osc_current_admin_locale();
} else {
$this->locale_code = osc_current_user_locale();
}
}
示例15: echo_users_best_rated
/**
* Return layout optimized for sidebar at main web page, with the best user voted with a limit
*
* @param int $num number of users
*/
function echo_users_best_rated($num = 5)
{
if (osc_get_preference('user_voting', 'voting') == 1) {
$filter = array('order' => 'desc', 'num_items' => $num);
$results = get_user_votes($filter);
if (count($results) > 0) {
$locale = osc_current_user_locale();
require 'set_results_user.php';
}
}
}