本文整理汇总了PHP中_V函数的典型用法代码示例。如果您正苦于以下问题:PHP _V函数的具体用法?PHP _V怎么用?PHP _V使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_V函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: t
private static function t($str)
{
if (function_exists('_V')) {
return _V($str);
}
return $str;
}
示例2: format_values
protected function format_values($tab, $record_id)
{
$rb_obj = new RBO_RecordsetAccessor($tab);
$record = $rb_obj->get_record($record_id);
if (!$record) {
return array();
}
$access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
if (!$access) {
return array();
}
// use RB object instance for better display callback compatibility
// some of them uses Utils_RecordBrowser::$rb_obj instance
$rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
$rb->construct($tab);
$rb->init($tab);
$fields = Utils_RecordBrowserCommon::init($tab);
$printable_data = array();
foreach ($fields as $f) {
if ($access[$f['id']]) {
$printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
}
}
// fill rows - it's easier here than in template
if ($this->fill_empty_rows()) {
while (count($printable_data) % $this->cols() != 0) {
$printable_data[] = array('label' => '', 'value' => '');
}
}
return $printable_data;
}
示例3: applet
public function applet($conf, &$opts)
{
$recordset = "quick_search";
$theme = $this->init_module('Base/Theme');
$form = $this->init_module('Libs/QuickForm');
$txtQuery = 'query_text';
$txtLabel = 'query_label';
$btnQuery = 'query_button';
$id = $conf['criteria'];
$searchPrompt = Applets_QuickSearchCommon::getSearchPromptById($id);
$conf['a_title'] = $conf['a_title'] == "Quick Search" ? Applets_QuickSearchCommon::getPresetNameById($id) : $conf['a_title'];
$placeholder = $searchPrompt == "" ? "" : $searchPrompt;
$opts['title'] = $conf['a_title'];
$opts['go'] = false;
load_css('modules/Applets/QuickSearch/theme/quick_form.css');
load_js('modules/Applets/QuickSearch/js/quicksearch.js');
//$js ='setDelayOnSearch()';
//eval_js($js);
$txt = $form->addElement('text', $txtQuery, __('Search'));
$txt->setAttribute('id', $txtQuery . "_" . $id);
$txt->setAttribute('class', 'QuickSearch_text');
$txt->setAttribute('onkeypress', 'setDelayOnSearch(\'' . $id . '\')');
$txt->setAttribute('placeholder', _V($placeholder));
$theme->assign($txtLabel, __('Search'));
$theme->assign($txtQuery, $txt->toHtml());
$theme->assign('search_id', $conf['criteria']);
$theme->display('quick_form');
return true;
}
示例4: retrieve_help_from_file
public static function retrieve_help_from_file($module)
{
$file = 'modules/' . str_replace('_', '/', $module) . '/help/tutorials.hlp';
if (file_exists($file)) {
$f = fopen($file, 'r');
}
$ret = array();
$i = 0;
while (!feof($f)) {
$line = '';
while (!feof($f) && substr($line, -1, 1) != ']') {
$line .= ($line ? '##' : '') . fgets($f);
$line = trim($line);
}
$line = trim($line, '[]');
if (!$line) {
continue;
}
$line = explode(':', $line);
$func = array_shift($line);
$arg = implode(':', $line);
switch ($func) {
case 'LABEL':
$i++;
$ret[$i] = array('label' => _V($arg), 'keywords' => '', 'context' => false, 'steps' => '');
break;
case 'STEPS':
$arg = explode('##', $arg);
foreach ($arg as $k => $v) {
if (!$v) {
unset($arg[$k]);
continue;
}
$tmp = explode('//', $v);
if (isset($tmp[1])) {
$arg[$k] = $tmp[0] . '//' . _V(trim($tmp[1]));
}
}
$arg = implode('##', $arg);
$ret[$i]['steps'] = $arg;
break;
case 'KEYWORDS':
$ret[$i]['keywords'] = _V($arg);
break;
case 'CONTEXT':
$ret[$i]['context'] = strtolower($arg) == 'true' ? true : false;
break;
default:
}
}
return $ret;
}
示例5: check_for_links
private static function check_for_links($prefix, $array, $mod, $prefixt = '')
{
$result = array();
foreach ($array as $k => $v) {
if (substr($k, 0, 2) == '__') {
continue;
}
$c_pre = $prefixt . _V($k);
// ****** Menu options label
if (is_array($v) && array_key_exists('__submenu__', $v)) {
$result = array_merge($result, self::check_for_links($prefix . $k . ': ', $v, $mod, $c_pre . ': '));
} elseif (is_array($v)) {
$result[] = array('name' => md5($prefix . $k), 'link' => $v, 'label' => $c_pre, 'module' => $mod);
}
}
return $result;
}
示例6: admin
public function admin()
{
if ($this->is_back()) {
$this->parent->reset();
return;
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$form = $this->init_module('Libs/QuickForm');
foreach (Base_PrintCommon::get_registered_printers_translated() as $class_name => $printer_name) {
$printer = Base_PrintCommon::printer_instance($class_name);
$form->addElement('header', $printer_name, $printer_name);
foreach ($printer->default_templates() as $tpl_name => $tpl) {
$field_id = "{$class_name}::{$tpl_name}";
$field_id = preg_replace('/[^A-Za-z0-9_:]/', '_', $field_id);
$form->addElement('checkbox', $field_id, _V($tpl_name));
$state = !Base_PrintCommon::is_template_disabled($class_name, $tpl_name);
$form->setDefaults(array($field_id => $state));
}
}
if ($form->validate()) {
$values = $form->exportValues();
foreach (Base_PrintCommon::get_registered_printers_translated() as $class_name => $printer_name) {
$printer = Base_PrintCommon::printer_instance($class_name);
foreach ($printer->default_templates() as $tpl_name => $tpl) {
$field_id = "{$class_name}::{$tpl_name}";
$field_id = preg_replace('/[^A-Za-z0-9_:]/', '_', $field_id);
$active = isset($values[$field_id]) ? $values[$field_id] : false;
Base_PrintCommon::set_template_disabled($class_name, $tpl_name, $active);
}
}
$this->parent->reset();
} else {
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
$this->display_module($form);
}
}
示例7: user_settings
public static function user_settings()
{
if (!Base_EpesiStoreCommon::admin_access()) {
return array();
}
set_time_limit(0);
// get default data from user contact
$my_contact = ModuleManager::is_installed('CRM_Contacts') > -1 ? CRM_ContactsCommon::get_my_record() : array();
// key = field name from contact => value = field name in settings
$keys = self::get_payment_data_keys();
$values = array();
// do user setting entries from data
foreach ($keys as $k => $v) {
$x = array('name' => $v, 'label' => _V(ucwords(str_replace('_', ' ', $v))), 'type' => 'text', 'default' => isset($my_contact[$k]) ? $my_contact[$k] : '');
if ($k == 'country') {
$x['type'] = 'select';
$x['values'] = Utils_CommonDataCommon::get_translated_array('Countries');
}
$values[] = $x;
}
return array(__('EPESI Store') => array_merge(array(array('name' => 'payments_header', 'label' => '', 'type' => 'header', 'default' => __('Payment credentials'))), $values));
}
示例8: array
$tab_info = Utils_RecordBrowserCommon::init($tab);
$records = Utils_RecordBrowserCommon::get_records($tab, $crits, array(), $order, array(), $admin);
header('Content-Type: text/csv');
//header('Content-Length: '.strlen($buffer));
header('Content-disposition: attachement; filename="' . $tab . '_export_' . date('Y_m_d__H_i_s') . '.csv"');
if (headers_sent()) {
die('Some data has already been output to browser, can\'t send the file');
}
$cols = array(__('Record ID'), __('Created on'), __('Created by'), __('Edited on'), __('Edited by'));
foreach ($tab_info as $v) {
if (!$v['export']) {
continue;
}
$cols[] = _V($v['name']);
if ($v['style'] == 'currency') {
$cols[] = _V($v['name']) . ' - ' . __('Currency');
}
}
$f = fopen('php://output', 'w');
fwrite($f, "");
fputcsv($f, $cols);
$currency_codes = DB::GetAssoc('SELECT symbol, code FROM utils_currency');
function rb_csv_export_format_currency_value($v, $symbol)
{
static $currency_decimal_signs = null;
static $currency_thou_signs;
if ($currency_decimal_signs === null) {
$currency_decimal_signs = DB::GetAssoc('SELECT symbol, decimal_sign FROM utils_currency');
$currency_thou_signs = DB::GetAssoc('SELECT symbol, thousand_sign FROM utils_currency');
}
$v = str_replace($currency_thou_signs[$symbol], '', $v);
示例9: set_selected_template
/**
* Set template in printer according to requested tpl,
* first default if no one. Also set filename in document
* @throws ErrorException
*/
protected function set_selected_template()
{
$printer = $this->get_printer();
$tpl = $this->get_tpl();
$templates = $printer->default_templates();
if (!$tpl) {
$tpl = key($templates);
$this->set_tpl($tpl);
}
if (!isset($templates[$tpl])) {
throw new ErrorException('Wrong template');
}
$template = $templates[$tpl];
if ($template) {
$printer->set_template($template);
}
$printer->get_document()->set_filename(_V($tpl));
}
示例10: edit_home_page
public function edit_home_page($id = null)
{
if ($this->is_back()) {
return false;
}
$counts = 5;
$all_clearances = array('' => '---') + array_flip(Base_AclCommon::get_clearance(true));
$home_pages = array('' => '---');
$current_clearance = 0;
$form = $this->init_module('Libs_QuickForm');
$theme = $this->init_module('Base_Theme');
$theme->assign('labels', array('and' => '<span class="joint">' . __('and') . '</span>', 'or' => '<span class="joint">' . __('or') . '</span>', 'caption' => $id ? __('Edit Home Page') : __('Add Home Page'), 'clearance' => __('Clearance requried'), 'fields' => __('Fields allowed'), 'crits' => __('Criteria required'), 'add_clearance' => __('Add clearance'), 'add_or' => __('Add criteria (or)'), 'add_and' => __('Add criteria (and)')));
$tmp = Base_HomePageCommon::get_home_pages();
$home_pages = array();
foreach ($tmp as $k => $v) {
$home_pages[$k] = _V($k);
}
// ****** - translating home_page options
$form->addElement('select', 'home_page', __('Target Home Page'), array('' => '---') + $home_pages);
if ($id) {
$page = DB::GetOne('SELECT home_page FROM base_home_page WHERE id=%d', array($id));
$form->setDefaults(array('home_page' => $page));
}
$form->addRule('home_page', __('Field required'), 'required');
for ($i = 0; $i < $counts; $i++) {
$form->addElement('select', 'clearance_' . $i, __('Clearance'), $all_clearances);
}
$i = 0;
$clearances = DB::GetAssoc('SELECT id, clearance FROM base_home_page_clearance WHERE home_page_id=%d', array($id));
foreach ($clearances as $v) {
$form->setDefaults(array('clearance_' . $i => $v));
$i++;
}
$current_clearance = max($i - 1, 0);
if ($form->validate()) {
DB::StartTrans();
$vals = $form->exportValues();
$clearances = array();
for ($i = 0; $i < $counts; $i++) {
if ($vals['clearance_' . $i]) {
$clearances[] = $vals['clearance_' . $i];
}
}
if ($id !== null) {
DB::Execute('DELETE FROM base_home_page_clearance WHERE home_page_id=%d', array($id));
DB::Execute('UPDATE base_home_page SET home_page=%s WHERE id=%d', array($vals['home_page'], $id));
} else {
$prio = DB::GetOne('SELECT MAX(priority) FROM base_home_page') + 1;
DB::Execute('INSERT INTO base_home_page (home_page,priority) VALUES (%s, %d)', array($vals['home_page'], $prio));
$id = DB::Insert_ID('base_home_page', 'id');
}
foreach ($clearances as $c) {
DB::Execute('INSERT INTO base_home_page_clearance (home_page_id, clearance) VALUES (%d, %s)', array($id, $c));
}
DB::CompleteTrans();
return false;
}
$form->add_error_closing_buttons();
$form->assign_theme('form', $theme);
$theme->assign('counts', $counts);
$theme->display('edit_home_pages');
load_js('modules/Base/HomePage/edit_home_pages.js');
eval_js('base_home_page__init_clearance(' . $current_clearance . ', ' . $counts . ')');
eval_js('base_home_page__initialized = true;');
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ActionBarCommon::add('delete', __('Cancel'), $this->create_back_href());
return true;
}
示例11: translate_array
public static function translate_array(&$arr)
{
foreach ($arr as $k => &$v) {
if (is_array($v)) {
$v =& $v['value'];
}
$v = _V($v);
// ****** CommonData value translation
}
return $arr;
}
示例12: isset
$order_num = isset($_GET['order']) && isset($_GET['order_dir']) ? $_GET['order'] : -1;
$order = false;
//cols
$cols = Utils_RecordBrowserCommon::init($table);
$cols_out = array();
foreach ($cols as $k => $col) {
if (!$col['visible'] && (!isset($info[$col['id']]) || !$info[$col['id']])) {
continue;
}
if (isset($info[$col['id']]) && !$info[$col['id']]) {
continue;
}
if (count($cols_out) == $order_num) {
$order = $col['id'];
}
$col['name'] = _V($col['name']);
if ($type != 'recent') {
$cols_out[] = array('name' => $col['name'], 'order' => $col['id'], 'record' => $col, 'key' => $k);
} else {
$cols_out[] = array('name' => $col['name'], 'record' => $col, 'key' => $k);
}
}
//views
/*if($ret['recent'] && $type!='recent') print('<a '.(IPHONE?'class="button red" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'recent','rb_offset'=>0))).'">'.__('Recent').'</a>'.(IPHONE?'':'<br>'));
if($ret['favorites'] && $type!='favorites') print('<a '.(IPHONE?'class="button green" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'favorites','rb_offset'=>0))).'">'.__('Favorites').'</a>'.(IPHONE?'':'<br>'));
if(($ret['recent'] || $ret['favorites']) && $type!='all') print('<a '.(IPHONE?'class="button white" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'all','rb_offset'=>0))).'">'.__('All').'</a>'.(IPHONE?'':'<br>'));*/
print '<form method="GET" action="mobile.php?' . http_build_query($_GET) . '">';
if (!IPHONE) {
print '<table width="100%"><tr><td>';
}
if (Utils_RecordBrowserCommon::get_access($table, 'add')) {
示例13: add_store_products
public function add_store_products(&$sorted, &$filters)
{
$registered = Base_EssClientCommon::has_license_key();
$filters_attrs = '';
if (!$registered) {
if (TRIAL_MODE) {
$msg = __('EPESI Store is not accessible during the trial.');
$filters_attrs = 'href="javascript:void(0);" onclick="alert(\'' . $msg . '\');"';
} else {
$msg = __('To access EPESI Store it is necessary that you register your EPESI installation. Would you like to do this now?');
$filters_attrs = $this->create_confirm_callback_href($msg, array($this, 'jump_to_epesi_registration'));
}
}
$filters[__('Updates')] = array('arg' => 'updates', 'attrs' => $filters_attrs);
$filters[__('My Purchases')] = array('arg' => 'purchases', 'attrs' => $filters_attrs);
$filters[__('Store')] = array('arg' => 'store', 'attrs' => $filters_attrs);
if (!$registered) {
return;
}
$store = Base_EpesiStoreCommon::get_modules_all_available();
print Base_EssClientCommon::client_messages_frame();
if (!$store) {
return;
}
foreach ($store as $s) {
$name = htmlspecialchars_decode($s['name']);
// Module name is translated on the server
$label = $s['action'];
$downloaded = $label != Base_EpesiStoreCommon::ACTION_BUY && $label != Base_EpesiStoreCommon::ACTION_DOWNLOAD;
if (!isset($s['total_price'])) {
$s['total_price'] = $s['price'];
}
if ($label == Base_EpesiStoreCommon::ACTION_BUY && $s['total_price'] === 0) {
$s['total_price'] = __('Free');
$label = 'obtain license';
}
$b_label = _V(ucfirst($label));
// ****** EpesiStoreCommon - translations added in comments
$button = array('label' => $b_label, 'style' => 'install', 'href' => Base_EpesiStoreCommon::action_href($s, $s['action'], array('Base_Setup', 'response_callback')));
if (isset($sorted[$name]) && $downloaded) {
$sorted[$name]['filter'][] = 'purchases';
if ($label == Base_EpesiStoreCommon::ACTION_UPDATE) {
$sorted[$name]['buttons'][] = $button;
$sorted[$name]['filter'][] = 'updates';
$sorted[$name]['style'] = 'problem';
}
if ($label == Base_EpesiStoreCommon::ACTION_RESTORE) {
$button['style'] = 'problem';
$sorted[$name]['buttons'][] = $button;
$sorted[$name]['style'] = 'disabled';
$sorted[$name]['status'] = __('Files modified');
}
$sorted[$name]['url'] = $s['description_url'];
$sorted[$name]['icon'] = $s['icon_url'];
continue;
}
$sorted[$name] = array();
$sorted[$name]['core'] = 0;
$sorted[$name]['url'] = $s['description_url'];
$sorted[$name]['icon'] = $s['icon_url'];
$sorted[$name]['name'] = $name;
// ****** FIXME - modules names from the store
$sorted[$name]['modules'] = array();
$sorted[$name]['options'] = array();
if (isset($s['paid']) && $s['paid']) {
$status = __('Purchased');
$style = 'problem';
switch ($label) {
case Base_EpesiStoreCommon::ACTION_RESTORE:
$status = __('Files modified');
$button['style'] = 'uninstall';
$style = 'disabled';
break;
case Base_EpesiStoreCommon::ACTION_INSTALL:
$status = __('Ready to use');
$style = 'disabled';
break;
case Base_EpesiStoreCommon::ACTION_UPDATE:
$status = __('To update');
break;
}
$sorted[$name]['status'] = $status;
$sorted[$name]['style'] = $style;
$sorted[$name]['filter'] = array('purchases');
} else {
$sorted[$name]['status'] = __('Price: %s', array($s['total_price']));
$sorted[$name]['style'] = 'store';
$sorted[$name]['filter'] = array('store');
$sorted[$name]['buttons_tooltip'] = $this->included_modules_text($s);
}
if ($label != Base_EpesiStoreCommon::ACTION_INSTALL) {
$sorted[$name]['buttons'] = array($button);
}
$sorted[$name]['version'] = $s['version'];
if ($label == Base_EpesiStoreCommon::ACTION_UPDATE) {
$sorted[$name]['filter'][] = 'updates';
}
$sorted[$name]['installed'] = null;
$sorted[$name]['instalable'] = 0;
$sorted[$name]['uninstalable'] = 0;
//.........这里部分代码省略.........
示例14: QFfield_recordset
public static function QFfield_recordset(&$form, $field, $label, $mode, $default)
{
if ($mode == 'add' || $mode == 'edit') {
$rss = DB::GetCol('SELECT f_recordset FROM task_related_data_1 WHERE active=1');
// remove currently selected value
$key = array_search($default, $rss);
if ($key !== false) {
unset($rss[$key]);
}
$tabs = DB::GetAssoc('SELECT tab, caption FROM recordbrowser_table_properties WHERE tab not in (\'' . implode('\',\'', $rss) . '\') AND tab not like "%_related"');
foreach ($tabs as $k => $v) {
$tabs[$k] = _V($v) . " ({$k})";
}
$form->addElement('select', $field, $label, $tabs, array('id' => $field));
$form->addRule($field, 'Field required', 'required');
if ($mode == 'edit') {
$form->setDefaults(array($field => $default));
}
} else {
$form->addElement('static', $field, $label);
$form->setDefaults(array($field => $default));
}
}
示例15: edit_rule
public function edit_rule($r_id, $p_id = null)
{
if ($this->is_back()) {
return false;
}
$counts = 5;
$all_clearances = array('' => '---') + array_flip(Base_AclCommon::get_clearance(true));
$translated_permission_names = array();
foreach (DB::GetAssoc('SELECT id, name FROM base_acl_permission ORDER BY name ASC') as $k => $v) {
$translated_permission_names[$k] = _V($v);
}
$perms = array('' => '---') + $translated_permission_names;
$current_clearance = 0;
$form = $this->init_module('Libs_QuickForm');
$theme = $this->init_module('Base_Theme');
$theme->assign('labels', array('and' => '<span class="joint">' . __('and') . '</span>', 'or' => '<span class="joint">' . __('or') . '</span>', 'caption' => $r_id ? __('Edit permission rule') : __('Add permission rule'), 'clearance' => __('Clearance requried'), 'fields' => __('Fields allowed'), 'crits' => __('Criteria required'), 'add_clearance' => __('Add clearance'), 'add_or' => __('Add criteria (or)'), 'add_and' => __('Add criteria (and)')));
$form->addElement('select', 'permission', __('Permission'), $perms);
if ($p_id) {
$form->setDefaults(array('permission' => $p_id));
$form->freeze('permission');
} else {
$form->addRule('permission', __('Field required'), 'required');
}
for ($i = 0; $i < $counts; $i++) {
$form->addElement('select', 'clearance_' . $i, __('Clearance'), $all_clearances);
}
$i = 0;
$clearances = DB::GetAssoc('SELECT id, clearance FROM base_acl_rules_clearance WHERE rule_id=%d', array($r_id));
foreach ($clearances as $v) {
$form->setDefaults(array('clearance_' . $i => $v));
$i++;
}
$current_clearance = max($i - 1, 0);
if ($form->validate()) {
$vals = $form->exportValues();
$clearances = array();
for ($i = 0; $i < $counts; $i++) {
if ($vals['clearance_' . $i]) {
$clearances[] = $vals['clearance_' . $i];
}
}
if ($r_id !== null) {
DB::Execute('DELETE FROM base_acl_rules_clearance WHERE rule_id=%d', array($r_id));
} else {
if (!$p_id) {
$p_id = $vals['permission'];
}
DB::Execute('INSERT INTO base_acl_rules (permission_id) VALUES (%d)', array($p_id));
$r_id = DB::Insert_ID('base_acl_rules', 'id');
}
foreach ($clearances as $c) {
DB::Execute('INSERT INTO base_acl_rules_clearance (rule_id, clearance) VALUES (%d, %s)', array($r_id, $c));
}
return false;
}
$form->add_error_closing_buttons();
$form->assign_theme('form', $theme);
$theme->assign('counts', $counts);
$theme->display('edit_permissions');
load_js('modules/Base/Acl/edit_permissions.js');
eval_js('base_acl__init_clearance(' . $current_clearance . ', ' . $counts . ')');
eval_js('base_acl__initialized = true;');
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ActionBarCommon::add('delete', __('Cancel'), $this->create_back_href());
return true;
}