public function single_row($item, $style = '') { // Set up the hover actions for this user $actions = array(); $view_link = '?page=formidable-entries&frm_action=show&id=' . $item->id; $this->get_actions($actions, $item, $view_link); $action_links = $this->row_actions($actions); // Set up the checkbox ( because the user is editable, otherwise its empty ) $checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />"; $r = "<tr id='item-action-{$item->id}'{$style}>"; list($columns, $hidden, , $primary) = $this->get_column_info(); $action_col = false; foreach ($columns as $column_name => $column_display_name) { $class = $column_name . ' column-' . $column_name; if ($column_name === $primary) { $class .= ' column-primary'; } if (in_array($column_name, $hidden)) { $class .= ' frm_hidden'; } else { if (!$action_col && !in_array($column_name, array('cb', 'id', 'form_id', 'post_id'))) { $action_col = $column_name; } } $attributes = 'class="' . esc_attr($class) . '"'; unset($class); $attributes .= ' data-colname="' . $column_display_name . '"'; $col_name = preg_replace('/^(' . $this->params['form'] . '_)/', '', $column_name); $this->column_name = $col_name; switch ($col_name) { case 'cb': $r .= "<th scope='row' class='check-column'>{$checkbox}</th>"; break; case 'ip': case 'id': case 'item_key': $val = $item->{$col_name}; break; case 'name': case 'description': $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); break; case 'created_at': case 'updated_at': $date = FrmAppHelper::get_formatted_time($item->{$col_name}); $val = '<abbr title="' . esc_attr(FrmAppHelper::get_formatted_time($item->{$col_name}, '', 'g:i:s A')) . '">' . $date . '</abbr>'; break; case 'is_draft': $val = empty($item->is_draft) ? __('No') : __('Yes'); break; case 'form_id': $val = FrmFormsHelper::edit_form_link($item->form_id); break; case 'post_id': $val = FrmAppHelper::post_edit_link($item->post_id); break; case 'user_id': $user = get_userdata($item->user_id); $val = $user->user_login; break; default: $val = apply_filters('frm_entries_' . $col_name . '_column', false, compact('item')); if ($val === false) { $this->get_column_value($item, $val); } break; } if (isset($val)) { $r .= "<td {$attributes}>"; if ($column_name == $action_col) { $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id; $r .= '<a href="' . esc_url(isset($actions['edit']) ? $edit_link : $view_link) . '" class="row-title" >' . $val . '</a> '; $r .= $action_links; } else { $r .= $val; } $r .= '</td>'; } unset($val); } $r .= '</tr>'; return $r; }
public static function replace_content_shortcodes($content, $entry, $shortcodes) { $shortcode_values = array('id' => $entry->id, 'key' => $entry->item_key, 'ip' => $entry->ip); foreach ($shortcodes[0] as $short_key => $tag) { $atts = shortcode_parse_atts($shortcodes[3][$short_key]); if (!empty($shortcodes[3][$short_key])) { $tag = str_replace(array('[', ']'), '', $shortcodes[0][$short_key]); $tags = explode(' ', $tag); if (is_array($tags)) { $tag = $tags[0]; } } else { $tag = $shortcodes[2][$short_key]; } switch ($tag) { case 'id': case 'key': case 'ip': $replace_with = $shortcode_values[$tag]; break; case 'user_agent': case 'user-agent': $entry->description = maybe_unserialize($entry->description); $replace_with = FrmEntryFormat::get_browser($entry->description['browser']); break; case 'created_at': case 'created-at': case 'updated_at': case 'updated-at': if (isset($atts['format'])) { $time_format = ' '; } else { $atts['format'] = get_option('date_format'); $time_format = ''; } $this_tag = str_replace('-', '_', $tag); $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); unset($this_tag); break; case 'created_by': case 'created-by': case 'updated_by': case 'updated-by': $this_tag = str_replace('-', '_', $tag); $replace_with = self::get_display_value($entry->{$this_tag}, (object) array('type' => 'user_id'), $atts); unset($this_tag); break; case 'admin_email': case 'siteurl': case 'frmurl': case 'sitename': case 'get': $replace_with = self::dynamic_default_values($tag, $atts); break; default: $field = FrmField::getOne($tag); if (!$field) { break; } $sep = isset($atts['sep']) ? $atts['sep'] : ', '; $replace_with = FrmEntryMeta::get_meta_value($entry, $field->id); $atts['entry_id'] = $entry->id; $atts['entry_key'] = $entry->item_key; //$replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field); if (is_array($replace_with)) { $replace_with = implode($sep, $replace_with); } if (isset($atts['show']) && $atts['show'] == 'field_label') { $replace_with = $field->name; } else { if (isset($atts['show']) && $atts['show'] == 'description') { $replace_with = $field->description; } else { if (empty($replace_with) && $replace_with != '0') { $replace_with = ''; } else { $replace_with = self::get_display_value($replace_with, $field, $atts); } } } unset($field); break; } if (isset($replace_with)) { $content = str_replace($shortcodes[0][$short_key], $replace_with, $content); } unset($atts, $conditional, $replace_with); } return $content; }
public static function get_formatted_time($date, $date_format = false, $time_format = false) { _deprecated_function(__FUNCTION__, '2.0', 'FrmAppHelper::get_formatted_time'); return FrmAppHelper::get_formatted_time($date, $date_format, $time_format); }
public static function do_shortcode_created_at(&$content, $atts, $shortcodes, $short_key, $args) { if (isset($atts['format'])) { $time_format = ' '; } else { $atts['format'] = get_option('date_format'); $time_format = ''; } if ($args['conditional']) { $atts['short_key'] = $shortcodes[0][$short_key]; self::check_conditional_shortcode($content, $args['entry']->{$args['tag']}, $atts, $args['tag']); } else { if (isset($atts['time_ago'])) { $date = FrmAppHelper::human_time_diff(strtotime($args['entry']->{$args['tag']})); } else { $date = FrmAppHelper::get_formatted_time($args['entry']->{$args['tag']}, $atts['format'], $time_format); } $content = str_replace($shortcodes[0][$short_key], $date, $content); } }
private static function add_entry_data_to_csv(&$row) { $row['created_at'] = FrmAppHelper::get_formatted_time(self::$entry->created_at, self::$wp_date_format, ' '); $row['updated_at'] = FrmAppHelper::get_formatted_time(self::$entry->updated_at, self::$wp_date_format, ' '); $row['user_id'] = self::$entry->user_id; $row['updated_by'] = self::$entry->updated_by; $row['is_draft'] = self::$entry->is_draft ? '1' : '0'; $row['ip'] = self::$entry->ip; $row['id'] = self::$entry->id; $row['item_key'] = self::$entry->item_key; }
$meta = $comment->meta_value; if (!isset($meta['comment'])) { continue; } ?> <tr class="frm_comment_block" id="frmcomment<?php echo esc_attr($comment->id); ?> "> <th scope="row"> <p><strong><?php echo FrmAppHelper::kses(FrmProFieldsHelper::get_display_name($meta['user_id'], 'display_name', array('link' => true))); ?> </strong><br/> <?php echo FrmAppHelper::kses(FrmAppHelper::get_formatted_time($comment->created_at, $date_format, $time_format)); ?> </p> </th> <td><div class="frm_comment"><?php echo wpautop(FrmAppHelper::kses($meta['comment'])); ?> </div></td> </tr> <?php } ?> </table> <a href="#" class="button-secondary alignright frm_show_comment" data-frmtoggle="#frm_comment_form">+ <?php esc_html_e('Add Note/Comment', 'formidable'); ?>