本文整理汇总了PHP中gpc_string_to_bool函数的典型用法代码示例。如果您正苦于以下问题:PHP gpc_string_to_bool函数的具体用法?PHP gpc_string_to_bool怎么用?PHP gpc_string_to_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gpc_string_to_bool函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_filter_do_filter_by_date
/**
* Print filter by date fields
* @param boolean $p_hide_checkbox Hide data filter checkbox.
* @return void
*/
function print_filter_do_filter_by_date($p_hide_checkbox = false)
{
global $g_filter;
?>
<table cellspacing="0" cellpadding="0">
<?php
$t_menu_disabled = '';
if (!$p_hide_checkbox) {
?>
<tr>
<td colspan="2">
<label>
<input type="checkbox" id="use_date_filters" name="<?php
echo FILTER_PROPERTY_FILTER_BY_DATE;
?>
"<?php
check_checked(gpc_string_to_bool($g_filter[FILTER_PROPERTY_FILTER_BY_DATE]), true);
?>
/>
<?php
echo lang_get('use_date_filters');
?>
</label>
</td>
</tr>
<?php
if ('on' !== $g_filter[FILTER_PROPERTY_FILTER_BY_DATE]) {
$t_menu_disabled = ' disabled="disabled" ';
}
}
?>
<!-- Start date -->
<tr>
<td>
<?php
echo lang_get('start_date_label');
?>
</td>
<td class="nowrap">
<?php
$t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
foreach ($t_chars as $t_char) {
if (strcasecmp($t_char, 'M') == 0) {
echo '<select name="', FILTER_PROPERTY_START_MONTH, '"', $t_menu_disabled, '>';
print_month_option_list($g_filter[FILTER_PROPERTY_START_MONTH]);
print "</select>\n";
}
if (strcasecmp($t_char, 'D') == 0) {
echo '<select name="', FILTER_PROPERTY_START_DAY, '"', $t_menu_disabled, '>';
print_day_option_list($g_filter[FILTER_PROPERTY_START_DAY]);
print "</select>\n";
}
if (strcasecmp($t_char, 'Y') == 0) {
echo '<select name="', FILTER_PROPERTY_START_YEAR, '"', $t_menu_disabled, '>';
print_year_option_list($g_filter[FILTER_PROPERTY_START_YEAR]);
print "</select>\n";
}
}
?>
</td>
</tr>
<!-- End date -->
<tr>
<td>
<?php
echo lang_get('end_date_label');
?>
</td>
<td>
<?php
$t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
foreach ($t_chars as $t_char) {
if (strcasecmp($t_char, 'M') == 0) {
echo '<select name="', FILTER_PROPERTY_END_MONTH, '"', $t_menu_disabled, '>';
print_month_option_list($g_filter[FILTER_PROPERTY_END_MONTH]);
print "</select>\n";
}
if (strcasecmp($t_char, 'D') == 0) {
echo '<select name="', FILTER_PROPERTY_END_DAY, '"', $t_menu_disabled, '>';
print_day_option_list($g_filter[FILTER_PROPERTY_END_DAY]);
print "</select>\n";
}
if (strcasecmp($t_char, 'Y') == 0) {
echo '<select name="', FILTER_PROPERTY_END_YEAR, '"', $t_menu_disabled, '>';
print_year_option_list($g_filter[FILTER_PROPERTY_END_YEAR]);
print "</select>\n";
}
}
?>
</td>
</tr>
</table>
<?php
}
示例2: gpc_get_bool_array
function gpc_get_bool_array($p_var_name, $p_default = null)
{
# Don't pass along a default unless one was given to us
# otherwise we prevent an error being triggered
$args = func_get_args();
$t_result = call_user_func_array('gpc_get', $args);
# If we the result isn't the default we were given or an array, error
if (!(1 < func_num_args() && $t_result === $p_default || is_array($t_result))) {
error_parameters($p_var_name);
trigger_error(ERROR_GPC_ARRAY_EXPECTED, ERROR);
}
for ($i = 0; $i < sizeof($t_result); $i++) {
$t_result[$i] = gpc_string_to_bool($t_result[$i]);
}
return $t_result;
}
示例3: gpc_get_bool
function gpc_get_bool($p_var_name, $p_default = false)
{
$t_result = gpc_get($p_var_name, $p_default);
if ($t_result === $p_default) {
return $p_default;
} else {
if (is_array($t_result)) {
error_parameters($p_var_name);
trigger_error(ERROR_GPC_ARRAY_UNEXPECTED, ERROR);
}
return gpc_string_to_bool($t_result);
}
}
示例4: history_localize_item
/**
* Localizes one raw history item specified by set the next parameters: $p_field_name, $p_type, $p_old_value, $p_new_value
* Returns array with two elements indexed as 'note' and 'change'
* @param string $p_field_name The field name of the field being localized.
* @param integer $p_type The type of the history entry.
* @param string $p_old_value The old value of the field.
* @param string $p_new_value The new value of the field.
* @param boolean $p_linkify Whether to return a string containing hyperlinks.
* @return array
*/
function history_localize_item($p_field_name, $p_type, $p_old_value, $p_new_value, $p_linkify = true)
{
$t_note = '';
$t_change = '';
$t_field_localized = $p_field_name;
$t_raw = true;
if (PLUGIN_HISTORY == $p_type) {
$t_note = lang_get_defaulted('plugin_' . $p_field_name, $p_field_name);
$t_change = isset($p_new_value) ? $p_old_value . ' => ' . $p_new_value : $p_old_value;
return array('note' => $t_note, 'change' => $t_change, 'raw' => true);
}
switch ($p_field_name) {
case 'category':
$t_field_localized = lang_get('category');
break;
case 'status':
$p_old_value = get_enum_element('status', $p_old_value);
$p_new_value = get_enum_element('status', $p_new_value);
$t_field_localized = lang_get('status');
break;
case 'severity':
$p_old_value = get_enum_element('severity', $p_old_value);
$p_new_value = get_enum_element('severity', $p_new_value);
$t_field_localized = lang_get('severity');
break;
case 'reproducibility':
$p_old_value = get_enum_element('reproducibility', $p_old_value);
$p_new_value = get_enum_element('reproducibility', $p_new_value);
$t_field_localized = lang_get('reproducibility');
break;
case 'resolution':
$p_old_value = get_enum_element('resolution', $p_old_value);
$p_new_value = get_enum_element('resolution', $p_new_value);
$t_field_localized = lang_get('resolution');
break;
case 'priority':
$p_old_value = get_enum_element('priority', $p_old_value);
$p_new_value = get_enum_element('priority', $p_new_value);
$t_field_localized = lang_get('priority');
break;
case 'eta':
$p_old_value = get_enum_element('eta', $p_old_value);
$p_new_value = get_enum_element('eta', $p_new_value);
$t_field_localized = lang_get('eta');
break;
case 'view_state':
$p_old_value = get_enum_element('view_state', $p_old_value);
$p_new_value = get_enum_element('view_state', $p_new_value);
$t_field_localized = lang_get('view_status');
break;
case 'projection':
$p_old_value = get_enum_element('projection', $p_old_value);
$p_new_value = get_enum_element('projection', $p_new_value);
$t_field_localized = lang_get('projection');
break;
case 'sticky':
$p_old_value = gpc_string_to_bool($p_old_value) ? lang_get('yes') : lang_get('no');
$p_new_value = gpc_string_to_bool($p_new_value) ? lang_get('yes') : lang_get('no');
$t_field_localized = lang_get('sticky_issue');
break;
case 'project_id':
if (project_exists($p_old_value)) {
$p_old_value = project_get_field($p_old_value, 'name');
} else {
$p_old_value = '@' . $p_old_value . '@';
}
# Note that the new value maybe an intermediately project and not the
# current one.
if (project_exists($p_new_value)) {
$p_new_value = project_get_field($p_new_value, 'name');
} else {
$p_new_value = '@' . $p_new_value . '@';
}
$t_field_localized = lang_get('email_project');
break;
case 'handler_id':
$t_field_localized = lang_get('assigned_to');
case 'reporter_id':
if ('reporter_id' == $p_field_name) {
$t_field_localized = lang_get('reporter');
}
if (0 == $p_old_value) {
$p_old_value = '';
} else {
$p_old_value = user_get_name($p_old_value);
}
if (0 == $p_new_value) {
$p_new_value = '';
} else {
$p_new_value = user_get_name($p_new_value);
//.........这里部分代码省略.........
示例5: gpc_get_bool_array
function gpc_get_bool_array($p_var_name, $p_default = null)
{
# Don't pass along a default unless one was given to us
# otherwise we prevent an error being triggered
if (func_num_args() > 1) {
$t_result = gpc_get($p_var_name, $p_default);
} else {
$t_result = gpc_get($p_var_name);
}
if (!is_array($t_result)) {
#trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR);
echo "Unexpected array '{$p_var_name}'.";
}
for ($i = 0; $i < sizeof($t_result); $i++) {
$t_result[$i] = gpc_string_to_bool($t_result[$i]);
}
return $t_result;
}
示例6: print_filter_sticky_issues
/**
* print sticky issues field
*/
function print_filter_sticky_issues()
{
global $t_filter;
?>
<!-- Show or hide sticky bugs -->
<input type="checkbox" name="<?php
echo FILTER_PROPERTY_STICKY;
?>
"<?php
check_checked(gpc_string_to_bool($t_filter[FILTER_PROPERTY_STICKY]), true);
?>
/>
<?php
}
示例7: print_filter_sticky_issues
function print_filter_sticky_issues()
{
global $t_filter;
?>
<!-- Show or hide sticky bugs -->
<input type="checkbox" name="sticky_issues" <?php
check_checked(gpc_string_to_bool($t_filter['sticky_issues']), 'on');
?>
/>
<?php
}
示例8: history_localize_item
function history_localize_item($p_field_name, $p_type, $p_old_value, $p_new_value)
{
$t_note = '';
$t_change = '';
$t_field_localized = $p_field_name;
switch ($p_field_name) {
case 'category':
$t_field_localized = lang_get('category');
break;
case 'status':
$p_old_value = get_enum_element('status', $p_old_value);
$p_new_value = get_enum_element('status', $p_new_value);
$t_field_localized = lang_get('status');
break;
case 'severity':
$p_old_value = get_enum_element('severity', $p_old_value);
$p_new_value = get_enum_element('severity', $p_new_value);
$t_field_localized = lang_get('severity');
break;
case 'reproducibility':
$p_old_value = get_enum_element('reproducibility', $p_old_value);
$p_new_value = get_enum_element('reproducibility', $p_new_value);
$t_field_localized = lang_get('reproducibility');
break;
case 'resolution':
$p_old_value = get_enum_element('resolution', $p_old_value);
$p_new_value = get_enum_element('resolution', $p_new_value);
$t_field_localized = lang_get('resolution');
break;
case 'priority':
$p_old_value = get_enum_element('priority', $p_old_value);
$p_new_value = get_enum_element('priority', $p_new_value);
$t_field_localized = lang_get('priority');
break;
case 'eta':
$p_old_value = get_enum_element('eta', $p_old_value);
$p_new_value = get_enum_element('eta', $p_new_value);
$t_field_localized = lang_get('eta');
break;
case 'view_state':
$p_old_value = get_enum_element('view_state', $p_old_value);
$p_new_value = get_enum_element('view_state', $p_new_value);
$t_field_localized = lang_get('view_status');
break;
case 'projection':
$p_old_value = get_enum_element('projection', $p_old_value);
$p_new_value = get_enum_element('projection', $p_new_value);
$t_field_localized = lang_get('projection');
break;
case 'sticky':
$p_old_value = gpc_string_to_bool($p_old_value) ? lang_get('yes') : lang_get('no');
$p_new_value = gpc_string_to_bool($p_new_value) ? lang_get('yes') : lang_get('no');
$t_field_localized = lang_get('sticky_issue');
break;
case 'project_id':
if (project_exists($p_old_value)) {
$p_old_value = project_get_field($p_old_value, 'name');
} else {
$p_old_value = '@' . $p_old_value . '@';
}
# Note that the new value maybe an intermediately project and not the
# current one.
if (project_exists($p_new_value)) {
$p_new_value = project_get_field($p_new_value, 'name');
} else {
$p_new_value = '@' . $p_new_value . '@';
}
$t_field_localized = lang_get('email_project');
break;
case 'handler_id':
$t_field_localized = lang_get('assigned_to');
case 'reporter_id':
if ('reporter_id' == $p_field_name) {
$t_field_localized = lang_get('reporter');
}
if (0 == $p_old_value) {
$p_old_value = '';
} else {
$p_old_value = user_get_name($p_old_value);
}
if (0 == $p_new_value) {
$p_new_value = '';
} else {
$p_new_value = user_get_name($p_new_value);
}
break;
case 'fixed_in_version':
$t_field_localized = lang_get('fixed_in_version');
break;
case 'date_submitted':
$t_field_localized = lang_get('date_submitted');
break;
case 'last_updated':
$t_field_localized = lang_get('last_update');
break;
case 'summary':
$t_field_localized = lang_get('summary');
break;
case 'duplicate_id':
$t_field_localized = lang_get('duplicate_id');
//.........这里部分代码省略.........
示例9: gpc_get_bool_array
/**
* Retrieve a boolean array GPC variable. Uses gpc_get().
* If you pass in *no* default, an error will be triggered if the variable does not exist.
* @param string $p_var_name Variable name to retrieve.
* @param array $p_default Default value of the boolean array if not set.
* @return array
*/
function gpc_get_bool_array($p_var_name, array $p_default = null)
{
# Don't pass along a default unless one was given to us
# otherwise we prevent an error being triggered
$t_args = func_get_args();
$t_result = call_user_func_array('gpc_get', $t_args);
# If the result isn't the default we were given or an array, error
if (!(1 < func_num_args() && $t_result === $p_default || is_array($t_result))) {
error_parameters($p_var_name);
trigger_error(ERROR_GPC_ARRAY_EXPECTED, ERROR);
}
if (is_array($t_result)) {
foreach ($t_result as $t_key => $t_value) {
$t_result[$t_key] = gpc_string_to_bool($t_value);
}
}
return $t_result;
}