本文整理汇总了PHP中GFCommon::truncate_middle方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::truncate_middle方法的具体用法?PHP GFCommon::truncate_middle怎么用?PHP GFCommon::truncate_middle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFCommon
的用法示例。
在下文中一共展示了GFCommon::truncate_middle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_mapped_field_list
private static function get_mapped_field_list($variable_name, $selected_field, $fields)
{
$field_name = "paypal_customer_field_" . $variable_name;
$str = "<select name='{$field_name}' id='{$field_name}'><option value=''></option>";
foreach ($fields as $field) {
$field_id = $field[0];
$field_label = esc_html(GFCommon::truncate_middle($field[1], 40));
$selected = $field_id == $selected_field ? "selected='selected'" : "";
$str .= "<option value='" . $field_id . "' " . $selected . ">" . $field_label . "</option>";
}
$str .= "</select>";
return $str;
}
示例2: get_mapped_field_list
public static function get_mapped_field_list($variable_name, $selected_field, $fields)
{
$field_name = "campaignmonitor_map_field_" . $variable_name;
$str = "<select name='{$field_name}' id='{$field_name}'><option value=''>" . __("", "gravityformscampaignmonitor") . "</option>";
foreach ($fields as $field) {
$field_id = $field[0];
$field_label = esc_html(GFCommon::truncate_middle($field[1], 40));
$selected = $field_id == $selected_field ? "selected='selected'" : "";
$str .= "<option value='" . $field_id . "' " . $selected . ">" . $field_label . "</option>";
}
$str .= "</select>";
return $str;
}
示例3: get_field_drop_down_items
private static function get_field_drop_down_items($fields, $selected_field, $empty_option = true)
{
$str = '';
if ($empty_option == true) {
$str = '<option value=""></option>';
}
if (is_array($fields)) {
foreach ($fields as $field) {
$field_id = $field[0];
$field_label = $field[1];
$selected = $field_id == $selected_field ? "selected='selected'" : "";
$str .= "<option value='" . $field_id . "' " . $selected . ">" . GFCommon::truncate_middle($field_label, 25) . "</option>";
}
}
return $str;
}
示例4: insert_field_variable
public static function insert_field_variable($field, $max_label_size = 40)
{
if (is_array($field["inputs"])) {
foreach ($field["inputs"] as $input) {
?>
<option value='<?php
echo "{" . esc_html(GFCommon::get_label($field, $input["id"])) . ":" . $input["id"] . "}";
?>
'><?php
echo esc_html(GFCommon::truncate_middle(GFCommon::get_label($field, $input["id"]), $max_label_size));
?>
</option>
<?php
}
} else {
?>
<option value='<?php
echo "{" . esc_html(GFCommon::get_label($field)) . ":" . $field["id"] . "}";
?>
'><?php
echo esc_html(GFCommon::truncate_middle(GFCommon::get_label($field), $max_label_size));
?>
</option>
<?php
}
}
示例5: get_field_values
private static function get_field_values($form, $field_id, $selected_value, $max_field_length = 16)
{
if (empty($field_id)) {
$field_id = self::get_first_routing_field($form);
}
if (empty($field_id)) {
return "";
}
$field = RGFormsModel::get_field($form, $field_id);
$is_any_selected = false;
foreach ($field["choices"] as $choice) {
$is_selected = $choice["value"] == $selected_value;
$selected = $is_selected ? "selected='selected'" : "";
if ($is_selected) {
$is_any_selected = true;
}
$str .= "<option value='" . esc_attr($choice["value"]) . "' " . $selected . ">" . GFCommon::truncate_middle($choice["text"], $max_field_length) . "</option>";
}
//adding current selected field value to the list
if (!$is_any_selected && !empty($selected_value)) {
$str .= "<option value='" . esc_attr($selected_value) . "' selected='selected'>" . GFCommon::truncate_middle($selected_value, $max_field_length) . "</option>";
}
return $str;
}
示例6: insert_field_variable
public static function insert_field_variable($field, $max_label_size = 40, $args = "")
{
$tag_args = RGFormsModel::get_input_type($field) == "list" ? ":{$args}" : "";
//args currently only supported by list field
if (is_array($field["inputs"])) {
if (RGFormsModel::get_input_type($field) == "checkbox") {
?>
<option value='<?php
echo "{" . esc_html(GFCommon::get_label($field, $field["id"])) . ":" . $field["id"] . "{$tag_args}}";
?>
'><?php
echo esc_html(GFCommon::truncate_middle(GFCommon::get_label($field, $field["id"]), $max_label_size));
?>
</option>
<?php
}
foreach ($field["inputs"] as $input) {
?>
<option value='<?php
echo "{" . esc_html(GFCommon::get_label($field, $input["id"])) . ":" . $input["id"] . "{$tag_args}}";
?>
'><?php
echo esc_html(GFCommon::truncate_middle(GFCommon::get_label($field, $input["id"]), $max_label_size));
?>
</option>
<?php
}
} else {
?>
<option value='<?php
echo "{" . esc_html(GFCommon::get_label($field)) . ":" . $field["id"] . "{$tag_args}}";
?>
'><?php
echo esc_html(GFCommon::truncate_middle(GFCommon::get_label($field), $max_label_size));
?>
</option>
<?php
}
}
示例7: setting_get_mapped_field_list
private static function setting_get_mapped_field_list($selected_field, $fields, $selectname_arr, $c)
{
$str = "<select name='name_form_field[]' id='name_form_field_{$c}' data-c='{$c}' required><option value=''>Select Form Field</option>";
foreach ($fields as $field) {
$field_id = $field[0];
$field_label = esc_html(GFCommon::truncate_middle($field[1], 50));
$selected = $field_id == $selected_field ? "selected='selected'" : "";
$str .= "<option value='" . $field_id . "' " . $selected . ">" . $field_label . "</option>";
}
$str .= "</select>";
$str1 = "<select name='email_form_field[]' id='email_form_field_{$c}' data-c='{$c}' required><option value=''>Select Form Field</option>";
foreach ($fields as $field) {
$field_id = $field[0];
$field_label = esc_html(GFCommon::truncate_middle($field[1], 50));
$selected = $field_id == $selected_field ? "selected='selected'" : "";
$str1 .= "<option value='" . $field_id . "' " . $selected . ">" . $field_label . "</option>";
}
$str1 .= "</select>";
$select_array['name'] = $str;
$select_array['email'] = $str1;
return json_encode($select_array);
}
示例8: get_field_variable
public static function get_field_variable($field, $max_label_size = 40)
{
$str = "";
if (is_array($field["inputs"])) {
foreach ($field["inputs"] as $input) {
$str .= "<option value='{" . esc_attr(GFCommon::get_label($field, $input["id"])) . ":" . $input["id"] . "}'>" . esc_html(GFCommon::truncate_middle(GFCommon::get_label($field, $input["id"]), $max_label_size)) . "</option>";
}
} else {
$str .= "<option value='{" . esc_html(GFCommon::get_label($field)) . ":" . $field["id"] . "}'>" . esc_html(GFCommon::truncate_middle(GFCommon::get_label($field), $max_label_size)) . "</option>";
}
return $str;
}