本文整理匯總了PHP中GFCommon::format_date方法的典型用法代碼示例。如果您正苦於以下問題:PHP GFCommon::format_date方法的具體用法?PHP GFCommon::format_date怎麽用?PHP GFCommon::format_date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GFCommon
的用法示例。
在下文中一共展示了GFCommon::format_date方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: leads_page
//.........這裏部分代碼省略.........
" src="<?php
echo GFCommon::get_base_url();
?>
/images/star<?php
echo intval($lead['is_starred']);
?>
.png" onclick="ToggleStar(this, '<?php
echo esc_js($lead['id']);
?>
','<?php
echo esc_js($filter);
?>
');" />
</td>
<?php
}
$is_first_column = true;
$nowrap_class = 'entry_nowrap';
foreach ($field_ids as $field_id) {
$field = RGFormsModel::get_field($form, $field_id);
$value = rgar($lead, $field_id);
if (!empty($field) && $field->type == 'post_category') {
$value = GFCommon::prepare_post_category_value($value, $field, 'entry_list');
}
//filtering lead value
$value = apply_filters('gform_get_field_value', $value, $lead, $field);
$input_type = !empty($columns[$field_id]['inputType']) ? $columns[$field_id]['inputType'] : $columns[$field_id]['type'];
switch ($input_type) {
case 'source_url':
$value = "<a href='" . esc_attr($lead['source_url']) . "' target='_blank' alt='" . esc_attr($lead['source_url']) . "' title='" . esc_attr($lead['source_url']) . "'>.../" . esc_attr(GFCommon::truncate_url($lead['source_url'])) . '</a>';
break;
case 'date_created':
case 'payment_date':
$value = GFCommon::format_date($value, false);
break;
case 'payment_amount':
$value = GFCommon::to_money($value, $lead['currency']);
break;
case 'created_by':
if (!empty($value)) {
$userdata = get_userdata($value);
if (!empty($userdata)) {
$value = $userdata->user_login;
}
}
break;
default:
if ($field !== null) {
$value = $field->get_value_entry_list($value, $lead, $field_id, $columns, $form);
} else {
$value = esc_html($value);
}
}
$value = apply_filters('gform_entries_field_value', $value, $form_id, $field_id, $lead);
/* ^ maybe move to function */
$query_string = "gf_entries&view=entry&id={$form_id}&lid={$lead['id']}{$search_qs}{$sort_qs}{$dir_qs}{$filter_qs}&paged=" . ($page_index + 1);
if ($is_first_column) {
?>
<td class="column-title">
<a href="admin.php?page=gf_entries&view=entry&id=<?php
echo absint($form_id);
?>
&lid=<?php
echo esc_attr($lead['id'] . $search_qs . $sort_qs . $dir_qs . $filter_qs);
?>
&paged=<?php
示例2: meta_box_entry_info
public static function meta_box_entry_info($args, $metabox)
{
$form = $args['form'];
$entry = $args['entry'];
$mode = $args['mode'];
?>
<div id="submitcomment" class="submitbox">
<div id="minor-publishing" style="padding:10px;">
<?php
esc_html_e('Entry Id', 'gravityforms');
?>
: <?php
echo absint($entry['id']);
?>
<br /><br />
<?php
esc_html_e('Submitted on', 'gravityforms');
?>
: <?php
echo esc_html(GFCommon::format_date($entry['date_created'], false, 'Y/m/d'));
?>
<br /><br />
<?php
esc_html_e('User IP', 'gravityforms');
?>
: <?php
echo esc_html($entry['ip']);
?>
<br /><br />
<?php
if (!empty($entry['created_by']) && ($usermeta = get_userdata($entry['created_by']))) {
?>
<?php
esc_html_e('User', 'gravityforms');
?>
:
<a href="user-edit.php?user_id=<?php
echo absint($entry['created_by']);
?>
" alt="<?php
esc_attr_e('View user profile', 'gravityforms');
?>
" title="<?php
esc_attr_e('View user profile', 'gravityforms');
?>
"><?php
echo esc_html($usermeta->user_login);
?>
</a>
<br /><br />
<?php
}
?>
<?php
esc_html_e('Embed Url', 'gravityforms');
?>
:
<a href="<?php
echo esc_url($entry['source_url']);
?>
" target="_blank" alt="<?php
echo esc_attr($entry['source_url']);
?>
" title="<?php
echo esc_attr($entry['source_url']);
?>
">.../<?php
echo esc_html(GFCommon::truncate_url($entry['source_url']));
?>
</a>
<br /><br />
<?php
if (!empty($entry['post_id'])) {
$post = get_post($entry['post_id']);
?>
<?php
esc_html_e('Edit Post', 'gravityforms');
?>
:
<a href="post.php?action=edit&post=<?php
echo absint($post->ID);
?>
" alt="<?php
esc_attr_e('Click to edit post', 'gravityforms');
?>
" title="<?php
esc_attr_e('Click to edit post', 'gravityforms');
?>
"><?php
echo esc_html($post->post_title);
?>
</a>
<br /><br />
<?php
}
/**
* Adds additional information to the entry details
*
* @param int $form['id'] The form ID
//.........這裏部分代碼省略.........
示例3: format_date
/**
* Allow formatting date and time based on GravityView standards
*
* @since 1.16
*
* @see GVCommon_Test::test_format_date for examples
*
* @param string $date_string The date as stored by Gravity Forms (`Y-m-d h:i:s` GMT)
* @param string|array $args Array or string of settings for output parsed by `wp_parse_args()`; Can use `raw=1` or `array('raw' => true)` \n
* - `raw` Un-formatted date string in original `Y-m-d h:i:s` format
* - `timestamp` Integer timestamp returned by GFCommon::get_local_timestamp()
* - `diff` "%s ago" format, unless other `format` is defined
* - `human` Set $is_human parameter to true for `GFCommon::format_date()`. Shows `diff` within 24 hours or date after. Format based on blog setting, unless `format` is defined.
* - `time` Include time in the `GFCommon::format_date()` output
* - `format` Define your own date format, or `diff` format
*
* @return int|null|string Formatted date based on the original date
*/
public static function format_date($date_string = '', $args = array())
{
$default_atts = array('raw' => false, 'timestamp' => false, 'diff' => false, 'human' => false, 'format' => '', 'time' => false);
$atts = wp_parse_args($args, $default_atts);
/**
* Gravity Forms code to adjust date to locally-configured Time Zone
* @see GFCommon::format_date() for original code
*/
$date_gmt_time = mysql2date('G', $date_string);
$date_local_timestamp = GFCommon::get_local_timestamp($date_gmt_time);
$format = rgar($atts, 'format');
$is_human = !empty($atts['human']);
$is_diff = !empty($atts['diff']);
$is_raw = !empty($atts['raw']);
$is_timestamp = !empty($atts['timestamp']);
$include_time = !empty($atts['time']);
// If we're using time diff, we want to have a different default format
if (empty($format)) {
/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
$format = $is_diff ? esc_html__('%s ago', 'gravityview') : get_option('date_format');
}
// If raw was specified, don't modify the stored value
if ($is_raw) {
$formatted_date = $date_string;
} elseif ($is_timestamp) {
$formatted_date = $date_local_timestamp;
} elseif ($is_diff) {
$formatted_date = sprintf($format, human_time_diff($date_gmt_time));
} else {
$formatted_date = GFCommon::format_date($date_string, $is_human, $format, $include_time);
}
unset($format, $is_diff, $is_human, $is_timestamp, $is_raw, $date_gmt_time, $date_local_timestamp, $default_atts);
return $formatted_date;
}
示例4: payment_details_box
public static function payment_details_box($lead, $form)
{
?>
<!-- PAYMENT BOX -->
<div id="submitdiv" class="stuffbox">
<h3 class="hndle" style="cursor:default;">
<span><?php
echo $lead['transaction_type'] == 2 ? esc_html__('Subscription Details', 'gravityforms') : esc_html__('Payment Details', 'gravityforms');
?>
</span>
</h3>
<div class="inside">
<div id="submitcomment" class="submitbox">
<div id="minor-publishing" style="padding:10px;">
<?php
$payment_status = apply_filters('gform_payment_status', $lead['payment_status'], $form, $lead);
if (!empty($payment_status)) {
?>
<div id="gf_payment_status" class="gf_payment_detail">
<?php
esc_html_e('Status', 'gravityforms');
?>
:
<span id="gform_payment_status"><?php
echo $payment_status;
// May contain HTML
?>
</span>
</div>
<?php
$payment_date = apply_filters('gform_payment_date', GFCommon::format_date($lead['payment_date'], false, 'Y/m/d', $lead['transaction_type'] != 2), $form, $lead);
if (!empty($payment_date)) {
?>
<div id="gf_payment_date" class="gf_payment_detail">
<?php
echo $lead['transaction_type'] == 2 ? esc_html__('Start Date', 'gravityforms') : esc_html__('Date', 'gravityforms');
?>
:
<span id='gform_payment_date'><?php
echo $payment_date;
// May contain HTML
?>
</span>
</div>
<?php
}
$transaction_id = apply_filters('gform_payment_transaction_id', $lead['transaction_id'], $form, $lead);
if (!empty($transaction_id)) {
?>
<div id="gf_payment_transaction_id" class="gf_payment_detail">
<?php
echo $lead['transaction_type'] == 2 ? esc_html__('Subscription Id', 'gravityforms') : esc_html__('Transaction Id', 'gravityforms');
?>
:
<span id='gform_payment_transaction_id'><?php
echo $transaction_id;
// May contain HTML
?>
</span>
</div>
<?php
}
$payment_amount = apply_filters('gform_payment_amount', GFCommon::to_money($lead['payment_amount'], $lead['currency']), $form, $lead);
if (!rgblank($payment_amount)) {
?>
<div id="gf_payment_amount" class="gf_payment_detail">
<?php
echo $lead['transaction_type'] == 2 ? esc_html__('Recurring Amount', 'gravityforms') : esc_html__('Amount', 'gravityforms');
?>
:
<span id='gform_payment_amount'><?php
echo $payment_amount;
// May contain HTML
?>
</span>
</div>
<?php
}
}
do_action('gform_payment_details', $form['id'], $lead);
?>
</div>
</div>
</div>
</div>
<?php
}
示例5: monthly_chart_info
private static function monthly_chart_info($config)
{
global $wpdb;
$tz_offset = self::get_mysql_tz_offset();
$results = $wpdb->get_results("SELECT date_format(CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "'), '%Y-%m-02') date, sum(t.amount) as amount_sold, sum(is_renewal) as renewals, sum(is_renewal=0) as new_sales\r\n FROM {$wpdb->prefix}rg_lead l\r\n INNER JOIN {$wpdb->prefix}rg_paypal_transaction t ON l.id = t.entry_id\r\n WHERE form_id={$config["form_id"]} AND t.transaction_type='payment'\r\n group by date\r\n order by date desc\r\n LIMIT 30");
$sales_month = 0;
$revenue_month = 0;
$tooltips = "";
if (!empty($results)) {
$data = "[";
foreach ($results as $result) {
$timestamp = self::get_graph_timestamp($result->date);
if (self::matches_current_date("Y-m", $timestamp)) {
$sales_month += $result->new_sales;
$revenue_month += $result->amount_sold;
}
$data .= "[{$timestamp},{$result->amount_sold}],";
if ($config["meta"]["type"] == "subscription") {
$sales_line = " <div class='paypal_tooltip_subscription'><span class='paypal_tooltip_heading'>" . __("New Subscriptions", "gravityformspaypal") . ": </span><span class='paypal_tooltip_value'>" . $result->new_sales . "</span></div><div class='paypal_tooltip_subscription'><span class='paypal_tooltip_heading'>" . __("Renewals", "gravityformspaypal") . ": </span><span class='paypal_tooltip_value'>" . $result->renewals . "</span></div>";
} else {
$sales_line = "<div class='paypal_tooltip_sales'><span class='paypal_tooltip_heading'>" . __("Orders", "gravityformspaypal") . ": </span><span class='paypal_tooltip_value'>" . $result->new_sales . "</span></div>";
}
$tooltips .= "\"<div class='paypal_tooltip_date'>" . GFCommon::format_date($result->date, false, "F, Y", false) . "</div>{$sales_line}<div class='paypal_tooltip_revenue'><span class='paypal_tooltip_heading'>" . __("Revenue", "gravityformspaypal") . ": </span><span class='paypal_tooltip_value'>" . GFCommon::to_money($result->amount_sold) . "</span></div>\",";
}
$data = substr($data, 0, strlen($data) - 1);
$tooltips = substr($tooltips, 0, strlen($tooltips) - 1);
$data .= "]";
$series = "[{data:" . $data . "}]";
$month_names = self::get_chart_month_names();
$options = "\r\n {\r\n xaxis: {mode: 'time', monthnames: {$month_names}, timeformat: '%b %y', minTickSize: [1, 'month']},\r\n yaxis: {tickFormatter: convertToMoney},\r\n bars: {show:true, align:'center', barWidth: (24 * 60 * 60 * 30 * 1000) - 130000000},\r\n colors: ['#a3bcd3', '#14568a'],\r\n grid: {hoverable: true, clickable: true, tickColor: '#F1F1F1', backgroundColor:'#FFF', borderWidth: 1, borderColor: '#CCC'}\r\n }";
}
switch ($config["meta"]["type"]) {
case "product":
$sales_label = __("Orders this Month", "gravityformspaypal");
break;
case "donation":
$sales_label = __("Donations this Month", "gravityformspaypal");
break;
case "subscription":
$sales_label = __("Subscriptions this Month", "gravityformspaypal");
break;
}
$revenue_month = GFCommon::to_money($revenue_month);
return array("series" => $series, "options" => $options, "tooltips" => "[{$tooltips}]", "revenue_label" => __("Revenue this Month", "gravityformspaypal"), "revenue" => $revenue_month, "sales_label" => $sales_label, "sales" => $sales_month);
}
示例6: payment_details_box
/**
* @param $lead
* @param $form
* @return mixed
*/
public static function payment_details_box($lead, $form)
{
?>
<!-- PAYMENT BOX -->
<div id="submitdiv" class="stuffbox">
<h3>
<span
class="hndle"><?php
echo $lead["transaction_type"] == 2 ? __("Subscription Details", "gravityforms") : __("Payment Details", "gravityforms");
?>
</span>
</h3>
<div class="inside">
<div id="submitcomment" class="submitbox">
<div id="minor-publishing" style="padding:10px;">
<br/>
<?php
if (!empty($lead["payment_status"])) {
echo __("Status", "gravityforms");
?>
: <span
id="gform_payment_status"><?php
echo apply_filters("gform_payment_status", $lead["payment_status"], $form, $lead);
?>
</span>
<br/><br/>
<?php
if (!empty($lead["payment_date"])) {
echo $lead["transaction_type"] == 2 ? __("Start Date", "gravityforms") : __("Date", "gravityforms");
?>
: <?php
echo GFCommon::format_date($lead["payment_date"], false, "Y/m/d", $lead["transaction_type"] != 2);
?>
<br/><br/>
<?php
}
if (!empty($lead["transaction_id"])) {
echo $lead["transaction_type"] == 2 ? __("Subscription Id", "gravityforms") : __("Transaction Id", "gravityforms");
?>
: <?php
echo $lead["transaction_id"];
?>
<br/><br/>
<?php
}
if (!rgblank($lead["payment_amount"])) {
echo $lead["transaction_type"] == 2 ? __("Recurring Amount", "gravityforms") : __("Amount", "gravityforms");
?>
: <?php
echo GFCommon::to_money($lead["payment_amount"], $lead["currency"]);
?>
<br/><br/>
<?php
}
}
do_action("gform_payment_details", $form["id"], $lead);
?>
</div>
</div>
</div>
</div>
<?php
}
示例7: leads_page
//.........這裏部分代碼省略.........
}
}
}
}
}
break;
case "post_image":
list($url, $title, $caption, $description) = rgexplode("|:|", $value, 4);
if (!empty($url)) {
//displaying thumbnail (if file is an image) or an icon based on the extension
$thumb = self::get_icon_url($url);
$value = "<a href='" . esc_attr($url) . "' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
}
break;
case "fileupload":
$file_path = $value;
if (!empty($file_path)) {
//displaying thumbnail (if file is an image) or an icon based on the extension
$thumb = self::get_icon_url($file_path);
$file_path = esc_attr($file_path);
$value = "<a href='{$file_path}' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
}
break;
case "source_url":
$value = "<a href='" . esc_attr($lead["source_url"]) . "' target='_blank' alt='" . esc_attr($lead["source_url"]) . "' title='" . esc_attr($lead["source_url"]) . "'>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>";
break;
case "textarea":
case "post_content":
case "post_excerpt":
$value = esc_html($value);
break;
case "date_created":
case "payment_date":
$value = GFCommon::format_date($value, false);
break;
case "date":
$field = RGFormsModel::get_field($form, $field_id);
$value = GFCommon::date_display($value, rgar($field, "dateFormat"));
break;
case "radio":
case "select":
$field = RGFormsModel::get_field($form, $field_id);
$value = GFCommon::selection_display($value, $field, $lead["currency"]);
break;
case "number":
$field = RGFormsModel::get_field($form, $field_id);
$value = GFCommon::format_number($value, rgar($field, "numberFormat"));
break;
case "total":
case "payment_amount":
$value = GFCommon::to_money($value, $lead["currency"]);
break;
case "created_by":
if (!empty($value)) {
$userdata = get_userdata($value);
$value = $userdata->user_login;
}
break;
case "multiselect":
// add space after comma-delimited values
$value = implode(', ', explode(',', $value));
break;
default:
$value = esc_html($value);
}
$value = apply_filters("gform_entries_field_value", $value, $form_id, $field_id, $lead);
示例8: notes_sidebar_grid
function notes_sidebar_grid($notes, $is_editable, $emails = null, $subject = '')
{
?>
<table class="widefat fixed entry-detail-notes">
<tbody id="the-comment-list" class="list:comment">
<?php
$count = 0;
$notes_count = sizeof($notes);
foreach ($notes as $note) {
$count++;
$is_last = $count >= $notes_count ? true : false;
?>
<tr valign="top">
<?php
if ($is_editable && GFCommon::current_user_can_any('gravityforms_edit_entry_notes')) {
?>
<th class="check-column" scope="row" style="padding:9px 3px 0 0">
<input type="checkbox" value="<?php
echo $note->id;
?>
" name="note[]" />
</th>
<?php
}
?>
<td class="entry-detail-note<?php
echo $is_last ? ' lastrow' : '';
?>
">
<?php
$class = $note->note_type ? " gforms_note_{$note->note_type}" : '';
?>
<div style="margin-top: 4px;">
<div class="note-avatar">
<?php
echo apply_filters('gform_notes_avatar', get_avatar($note->user_id, 48), $note);
?>
</div>
<h6 class="note-author">
<?php
echo esc_html($note->user_name);
?>
</h6>
<p class="note-email">
<a href="mailto:<?php
echo esc_attr($note->user_email);
?>
"><?php
echo esc_html($note->user_email);
?>
</a><br />
<?php
_e('added on', 'gravityforms');
?>
<?php
echo esc_html(GFCommon::format_date($note->date_created, false));
?>
</p>
</div>
<div class="detail-note-content<?php
echo $class;
?>
">
<?php
echo html_entity_decode($note->value);
?>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
if (sizeof($notes) > 0 && $is_editable && GFCommon::current_user_can_any('gravityforms_edit_entry_notes')) {
?>
<input type="submit" name="delete_note_sidebar" value="Delete Selected Note(s)" class="button" style="width:100%;padding-bottom:2px;" onclick="jQuery('#action').val('delete_note_sidebar');">
<?php
}
}
示例9: contacts_tab
public function contacts_tab($contact_id)
{
if (false === empty($contact_id)) {
$search_criteria['status'] = 'active';
$search_criteria['field_filters'][] = array('type' => 'meta', 'key' => 'gcontacts_contact_id', 'value' => $contact_id);
$search_criteria['field_filters'][] = array('type' => 'meta', 'key' => 'gquiz_score', 'operator' => '>=', 'value' => 0, 'is_numeric' => true);
$form_id = 0;
//all forms
$entries = GFAPI::get_entries($form_id, $search_criteria);
if (empty($entries)) {
_e('This contact has not submitted any quiz entries yet.', 'gravityformsquiz');
} else {
?>
<h3><span><?php
_e('Quiz Entries', 'gravityformsquiz');
?>
</span></h3>
<div>
<table id="gcontacts-entry-list" class="widefat">
<tr class="gcontacts-entries-header">
<td>
<?php
_e('Entry Id', 'gravityformsquiz');
?>
</td>
<td>
<?php
_e('Date', 'gravityformsquiz');
?>
</td>
<td>
<?php
_e('Form', 'gravityformsquiz');
?>
</td>
<td>
<?php
_e('Score', 'gravityformsquiz');
?>
</td>
<td>
<?php
_e('Pass/Fail', 'gravityformsquiz');
?>
</td>
<td>
<?php
_e('Grade', 'gravityformsquiz');
?>
</td>
</tr>
<?php
foreach ($entries as $entry) {
$form_id = $entry['form_id'];
$form = GFFormsModel::get_form_meta($form_id);
$form_title = rgar($form, 'title');
$entry_id = $entry['id'];
$entry_date = GFCommon::format_date(rgar($entry, 'date_created'), false);
$entry_url = admin_url("admin.php?page=gf_entries&view=entry&id={$form_id}&lid={$entry_id}");
$passfail = '';
$grading = $this->get_form_setting($form, 'grading');
if ('passfail' == $grading) {
$is_pass = rgar($entry, 'gquiz_is_pass') ? true : false;
$passfail = $is_pass ? __('Pass', 'gravityformsquiz') : __('Fail', 'gravityformsquiz');
$color = $is_pass ? 'green' : 'red';
$passfail = sprintf('<span style="color:%s">%s</span>', $color, $passfail);
}
$grade = '';
if ('letter' == $grading) {
$grade = rgar($entry, 'gquiz_grade');
}
?>
<tr>
<td>
<a href="<?php
echo $entry_url;
?>
"><?php
echo $entry_id;
?>
</a>
</td>
<td>
<?php
echo $entry_date;
?>
</td>
<td>
<?php
echo $form_title;
?>
</td>
<td>
<?php
echo rgar($entry, 'gquiz_score');
?>
</td>
<td>
<?php
echo $passfail;
//.........這裏部分代碼省略.........
示例10: make_directory
//.........這裏部分代碼省略.........
}
$value = "<a href='{$url}'{$target}{$lightboxclass}>{$img['code']}</a>";
}
break;
case "source_url":
if (in_array('urls', $lightboxsettings) || !empty($lightboxsettings['urls'])) {
$lightboxclass .= ' rel="directory_all directory_urls"';
}
if ($linkwebsite) {
$value = "<a href='" . esc_attr($lead["source_url"]) . "'{$target}{$lightboxclass} title='" . esc_attr($lead["source_url"]) . "'{$nofollow}>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>";
} else {
$value = esc_attr(GFCommon::truncate_url($lead["source_url"]));
}
break;
case "textarea":
case "post_content":
case "post_excerpt":
if ($fulltext) {
$long_text = $value = "";
if (isset($lead[$field_id]) && strlen($lead[$field_id]) >= GFORMS_MAX_FIELD_LENGTH) {
$long_text = get_gf_field_value_long($lead["id"], $field_id);
}
if (isset($lead[$field_id])) {
$value = !empty($long_text) ? $long_text : $lead[$field_id];
}
if ($wpautop) {
$value = wpautop($value);
}
} else {
$value = esc_html($value);
}
break;
case "date_created":
$value = GFCommon::format_date($value, false, $datecreatedformat);
break;
case "date":
$field = RGFormsModel::get_field($form, $field_id);
if ($dateformat) {
$value = GFCommon::date_display($value, $dateformat);
} else {
$value = GFCommon::date_display($value, $field["dateFormat"]);
}
break;
case "id":
$linkClass = '';
break;
case "list":
$field = RGFormsModel::get_field($form, $field_id);
$value = GFCommon::get_lead_field_display($field, $value);
break;
default:
$input_type = 'text';
if (is_email($value) && $linkemail) {
$value = "<a href='mailto:{$value}'{$nofollow}>{$value}</a>";
} elseif (preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $value) && $linkwebsite) {
$href = $value;
if (!empty($lightboxsettings['images'])) {
if (in_array('urls', $lightboxsettings) || !empty($lightboxsettings['urls'])) {
$lightboxclass .= ' rel="directory_all directory_urls"';
}
$linkClass = $lightboxclass;
} else {
$linkClass = isset($linkClass) ? $linkClass : '';
}
if ($truncatelink) {
$value = apply_filters('kws_gf_directory_anchor_text', $value);
示例11: display
//.........這裏部分代碼省略.........
?>
<td data-label="<?php
esc_html_e('Submitter', 'gravityflow');
?>
" <?php
echo $submitter_style;
?>
>
<?php
printf($link, $url_entry, $name);
?>
</td>
<td data-label="<?php
esc_html_e('Step', 'gravityflow');
?>
" <?php
echo $step_style;
?>
>
<?php
if (isset($entry['workflow_step'])) {
$step = gravity_flow()->get_step($entry['workflow_step']);
if ($step) {
printf($link, $url_entry, $step->get_name());
}
}
?>
</td>
<td data-label="<?php
esc_html_e('Submitted', 'gravityflow');
?>
">
<?php
printf($link, $url_entry, GFCommon::format_date($entry['date_created']));
?>
</td>
<?php
if ($args['form_id'] && is_array($args['field_ids'])) {
if (isset($form['fields']) && is_array($form['fields'])) {
$field_ids = array_keys($columns);
foreach ($args['field_ids'] as $field_id) {
/* @var GF_Field $field */
if (!in_array($field_id, $field_ids)) {
continue;
}
$field_id = trim($field_id);
$field_info = $columns[$field_id];
$value = rgar($entry, $field_id);
$field = GFFormsModel::get_field($form, $field_id);
?>
<td data-label="<?php
echo esc_attr($field_info['label']);
?>
">
<?php
printf($link, $url_entry, $field->get_value_entry_list($value, $entry, $field_id, $columns, $form));
?>
</td>
<?php
}
}
}
if ($args['last_updated']) {
?>
<td data-label="<?php
示例12: esc_url
if (apply_filters('kws_gf_directory_post_title_link', false, $form, $lead) && !empty($lead['post_id'])) {
$value = '<a href="' . esc_url(get_permalink($lead['post_id'])) . '" title="' . esc_attr($value) . '" ' . $nofollow . $target . '>' . esc_html($value) . '</a>';
} else {
$value = esc_html($value);
}
break;
case "textarea":
case "post_content":
case "post_excerpt":
$value = wpautop($value);
break;
case "post_category":
$value = GFCommon::prepare_post_category_value($lead[$field_id], $field);
break;
case "date_created":
$value = GFCommon::format_date($lead['date_created'], true, apply_filters('kws_gf_date_format', ''));
break;
case "date":
if ($dateformat) {
$value = GFCommon::date_display($value, $dateformat);
} else {
$value = GFCommon::date_display($value, $field["dateFormat"]);
}
break;
case "id":
$linkClass = '';
break;
case "list":
$value = GFCommon::get_lead_field_display($field, $value);
break;
default:
示例13: replace_variables
/**
* Target for the gform_pre_replace_merge_tags filter. Replaces the workflow_timeline and created_by merge tags.
*
*
* @param string $text
* @param array $form
* @param array $entry
* @param bool $url_encode
* @param bool $esc_html
* @param bool $nl2br
* @param string $format
*
* @return string
*/
function replace_variables($text, $form, $entry, $url_encode, $esc_html, $nl2br, $format)
{
preg_match_all('/{workflow_timeline(:(.*?))?}/', $text, $timeline_matches, PREG_SET_ORDER);
if (is_array($timeline_matches) && isset($timeline_matches[0])) {
$full_tag = $timeline_matches[0][0];
require_once gravity_flow()->get_base_path() . '/includes/pages/class-entry-detail.php';
$notes = Gravity_Flow_Entry_Detail::get_timeline_notes($entry);
$html = '';
foreach ($notes as $note) {
$html .= '<br />';
$html .= GFCommon::format_date($note->date_created, false, 'd M Y g:i a', false);
$html .= ': ';
if (empty($note->user_id)) {
if ($note->user_name !== 'gravityflow') {
$step = Gravity_Flow_Steps::get($note->user_name);
if ($step) {
$html .= $step->get_label();
}
} else {
$html .= esc_html(gravity_flow()->translate_navigation_label('Workflow'));
}
} else {
$html .= esc_html($note->user_name);
}
$html .= '<br />';
$html .= nl2br(esc_html($note->value));
$html .= '<br />';
}
$text = str_replace($full_tag, $html, $text);
}
preg_match_all('/{created_by(:(.*?))?}/', $text, $created_by_matches, PREG_SET_ORDER);
if (is_array($created_by_matches)) {
if (!empty($entry['created_by'])) {
$entry_creator = new WP_User($entry['created_by']);
foreach ($created_by_matches as $created_by_match) {
if (!isset($created_by_match[2])) {
continue;
}
$full_tag = $created_by_match[0];
$property = $created_by_match[2];
if ($property == 'roles') {
$value = implode(', ', $entry_creator->roles);
} else {
$value = $entry_creator->get($property);
}
$value = esc_html($value);
$text = str_replace($full_tag, $value, $text);
}
}
}
return $text;
}
示例14: contacts_tab
public function contacts_tab($contact_id)
{
if (false === empty($contact_id)) {
$search_criteria["status"] = "active";
$search_criteria["field_filters"][] = array("type" => "meta", "key" => "gcontacts_contact_id", "value" => $contact_id);
$form_ids = array();
$forms = GFFormsModel::get_forms(true);
foreach ($forms as $form) {
$form_meta = GFFormsModel::get_form_meta($form->id);
$poll_fields = GFCommon::get_fields_by_type($form_meta, array('poll'));
if (!empty($poll_fields)) {
$form_ids[] = $form->id;
}
}
if (empty($form_ids)) {
return;
}
$entries = GFAPI::get_entries($form_ids, $search_criteria);
if (empty($entries)) {
_e("This contact has not submitted any poll entries yet.", "gravityformspolls");
} else {
?>
<h3><span><?php
_e("Poll Entries", "gravityformspolls");
?>
</span></h3>
<div>
<table id="gcontacts-entry-list" class="widefat">
<tr class="gcontacts-entries-header">
<td>
<?php
_e("Entry Id", "gravityformspolls");
?>
</td>
<td>
<?php
_e("Date", "gravityformspolls");
?>
</td>
<td>
<?php
_e("Form", "gravityformspolls");
?>
</td>
</tr>
<?php
foreach ($entries as $entry) {
$form_id = $entry["form_id"];
$form = GFFormsModel::get_form_meta($form_id);
$form_title = rgar($form, "title");
$entry_id = $entry["id"];
$entry_date = GFCommon::format_date(rgar($entry, "date_created"), false);
$entry_url = admin_url("admin.php?page=gf_entries&view=entry&id={$form_id}&lid={$entry_id}");
?>
<tr>
<td>
<a href="<?php
echo $entry_url;
?>
"><?php
echo $entry_id;
?>
</a>
</td>
<td>
<?php
echo $entry_date;
?>
</td>
<td>
<?php
echo $form_title;
?>
</td>
</tr>
<?php
}
?>
</table>
</div>
<?php
}
}
}
示例15: column_default
/**
* Displays the entry value.
*
* @param object $entry
* @param string $field_id
*/
function column_default($entry, $column_id)
{
$field_id = (string) str_replace('field_id-', '', $column_id);
$form = $this->get_form();
$form_id = $this->get_form_id();
$field = GFFormsModel::get_field($form, $field_id);
$columns = GFFormsModel::get_grid_columns($form_id, true);
$value = rgar($entry, $field_id);
if (!empty($field) && $field->type == 'post_category') {
$value = GFCommon::prepare_post_category_value($value, $field, 'entry_list');
}
// Filtering lead value
$value = apply_filters('gform_get_field_value', $value, $entry, $field);
switch ($field_id) {
case 'source_url':
$value = "<a href='" . esc_attr($entry['source_url']) . "' target='_blank' alt='" . esc_attr($entry['source_url']) . "' title='" . esc_attr($entry['source_url']) . "'>.../" . esc_attr(GFCommon::truncate_url($entry['source_url'])) . '</a>';
break;
case 'date_created':
case 'payment_date':
$value = GFCommon::format_date($value, false);
break;
case 'payment_amount':
$value = GFCommon::to_money($value, $entry['currency']);
break;
case 'created_by':
if (!empty($value)) {
$userdata = get_userdata($value);
if (!empty($userdata)) {
$value = $userdata->user_login;
}
}
break;
default:
if ($field !== null) {
$value = $field->get_value_entry_list($value, $entry, $field_id, $columns, $form);
} else {
$value = esc_html($value);
}
}
$value = apply_filters('gform_entries_field_value', $value, $form_id, $field_id, $entry);
$primary = $this->get_primary_column_name();
if ($column_id == $primary) {
$edit_url = $this->get_detail_url($entry);
$value = '<a title="' . esc_attr__('View this entry', 'gravityforms') . '" href="' . $edit_url . '">' . $value . '</a>';
}
echo $value;
}