• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP string_shorten函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中string_shorten函数的典型用法代码示例。如果您正苦于以下问题:PHP string_shorten函数的具体用法?PHP string_shorten怎么用?PHP string_shorten使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了string_shorten函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: print_build_option_list

function print_build_option_list($p_build = '')
{
    $t_bug_table = db_get_table('bug');
    $t_overall_build_arr = array();
    $t_project_id = helper_get_current_project();
    $t_project_where = helper_project_specific_where($t_project_id);
    # Get the "found in" build list
    $query = "SELECT DISTINCT build\n\t\t\t\tFROM {$t_bug_table}\n\t\t\t\tWHERE {$t_project_where}\n\t\t\t\tORDER BY build DESC";
    $result = db_query_bound($query);
    $option_count = db_num_rows($result);
    for ($i = 0; $i < $option_count; $i++) {
        $row = db_fetch_array($result);
        $t_overall_build_arr[] = $row['build'];
    }
    $t_max_length = config_get('max_dropdown_length');
    foreach ($t_overall_build_arr as $t_build_unescaped) {
        $t_build = string_attribute($t_build_unescaped);
        echo "<option value=\"{$t_build}\"";
        check_selected($p_build, $t_build_unescaped);
        echo ">" . string_shorten($t_build, $t_max_length) . "</option>";
    }
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:22,代码来源:print_api.php


示例2: print_filter_custom_field

/**
 * print custom fields
 * @param integer $p_field_id Custom field identifier.
 * @return void
 */
function print_filter_custom_field($p_field_id)
{
    global $g_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $g_select_modifier;
    $j = array_search($p_field_id, $t_accessible_custom_fields_ids);
    if ($j === null || $j === false) {
        ?>
			<span style="color:red;font-weight:bold;">
				unknown custom filter (custom <?php 
        echo $p_field_id;
        ?>
)
			</span>
		<?php 
    } else {
        if (isset($t_accessible_custom_fields_names[$j])) {
            if ($t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE) {
                print_filter_custom_field_date($j, $p_field_id);
            } else {
                if ($t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA) {
                    echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
                } else {
                    echo '<select' . $g_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
                    echo '<option value="' . META_FILTER_ANY . '"';
                    check_selected($g_filter['custom_fields'][$p_field_id], (string) META_FILTER_ANY);
                    echo '>[' . lang_get('any') . ']</option>';
                    # don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
                    if (!in_array($t_accessible_custom_fields_types[$j], array(CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST))) {
                        echo '<option value="' . META_FILTER_NONE . '"';
                        check_selected($g_filter['custom_fields'][$p_field_id], (string) META_FILTER_NONE);
                        echo '>[' . lang_get('none') . ']</option>';
                    }
                    if (is_array($t_accessible_custom_fields_values[$j])) {
                        $t_max_length = config_get('max_dropdown_length');
                        foreach ($t_accessible_custom_fields_values[$j] as $t_item) {
                            if (strtolower($t_item) !== META_FILTER_ANY && strtolower($t_item) !== META_FILTER_NONE) {
                                echo '<option value="' . string_attribute($t_item) . '"';
                                if (isset($g_filter['custom_fields'][$p_field_id])) {
                                    check_selected($g_filter['custom_fields'][$p_field_id], $t_item);
                                }
                                echo '>' . string_attribute(string_shorten($t_item, $t_max_length)) . '</option>' . "\n";
                            }
                        }
                    }
                    echo '</select>';
                }
            }
        }
    }
}
开发者ID:vipjaven,项目名称:mantisbt,代码行数:54,代码来源:filter_api.php


示例3: print_filter_custom_field

function print_filter_custom_field($p_field_id)
{
    global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier;
    $j = array_search($p_field_id, $t_accessible_custom_fields_ids);
    if ($j === null || $j === false) {
        # Note: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE.
        ?>
			<span style="color:red;weight:bold;">
				unknown custom filter (custom <?php 
        $p_field_id;
        ?>
)
			</span>
			<?php 
    } elseif (isset($t_accessible_custom_fields_names[$j])) {
        if ($t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE) {
            print_filter_custom_field_date($j, $p_field_id);
        } else {
            echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
            echo '<option value="' . META_FILTER_ANY . '" ';
            check_selected($t_filter['custom_fields'][$p_field_id], META_FILTER_ANY);
            echo '>[' . lang_get('any') . ']</option>';
            # don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
            if (!in_array($t_accessible_custom_fields_types[$j], array(CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST))) {
                echo '<option value="' . META_FILTER_NONE . '" ';
                check_selected($t_filter['custom_fields'][$p_field_id], META_FILTER_NONE);
                echo '>[' . lang_get('none') . ']</option>';
            }
            foreach ($t_accessible_custom_fields_values[$j] as $t_item) {
                if (strtolower($t_item) !== META_FILTER_ANY && strtolower($t_item) !== META_FILTER_NONE) {
                    echo '<option value="' . string_html_entities($t_item) . '" ';
                    if (isset($t_filter['custom_fields'][$p_field_id])) {
                        check_selected($t_filter['custom_fields'][$p_field_id], $t_item);
                    }
                    echo '>' . string_shorten($t_item) . '</option>' . "\n";
                }
            }
            echo '</select>';
        }
    }
}
开发者ID:amjadtbssm,项目名称:website,代码行数:41,代码来源:filter_api.php


示例4: print_build_option_list

/**
 * print build option list
 * @param string $p_build The current build value.
 * @return void
 */
function print_build_option_list($p_build = '')
{
    $t_overall_build_arr = array();
    $t_project_id = helper_get_current_project();
    $t_project_where = helper_project_specific_where($t_project_id);
    # Get the "found in" build list
    $t_query = 'SELECT DISTINCT build
				FROM {bug}
				WHERE ' . $t_project_where . '
				ORDER BY build DESC';
    $t_result = db_query($t_query);
    while ($t_row = db_fetch_array($t_result)) {
        $t_overall_build_arr[] = $t_row['build'];
    }
    $t_max_length = config_get('max_dropdown_length');
    foreach ($t_overall_build_arr as $t_build_unescaped) {
        $t_build = string_attribute($t_build_unescaped);
        echo '<option value="' . $t_build . '"';
        check_selected($p_build, $t_build_unescaped);
        echo '>' . string_shorten($t_build, $t_max_length) . '</option>';
    }
}
开发者ID:gtn,项目名称:mantisbt,代码行数:27,代码来源:print_api.php


示例5: print_build_option_list

function print_build_option_list($p_build = '')
{
    $t_bug_table = config_get('mantis_bug_table');
    $t_overall_build_arr = array();
    $t_project_id = helper_get_current_project();
    $t_project_where = helper_project_specific_where($t_project_id);
    # Get the "found in" build list
    $query = "SELECT DISTINCT build\r\n\t\t\t\tFROM {$t_bug_table}\r\n\t\t\t\tWHERE {$t_project_where}\r\n\t\t\t\tORDER BY build DESC";
    $result = db_query($query);
    $option_count = db_num_rows($result);
    for ($i = 0; $i < $option_count; $i++) {
        $row = db_fetch_array($result);
        $t_overall_build_arr[] = $row['build'];
    }
    foreach ($t_overall_build_arr as $t_build) {
        print "<option value=\"{$t_build}\"";
        check_selected($p_build, $t_build);
        print ">" . string_shorten($t_build) . "</option>";
    }
}
开发者ID:amjadtbssm,项目名称:website,代码行数:20,代码来源:print_api.php



注:本文中的string_shorten函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP string_textarea函数代码示例发布时间:2022-05-23
下一篇:
PHP string_sanitize_url函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap