本文整理汇总了PHP中FrmForm::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmForm::getName方法的具体用法?PHP FrmForm::getName怎么用?PHP FrmForm::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmForm
的用法示例。
在下文中一共展示了FrmForm::getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_edit_vars
public static function setup_edit_vars($record, $doing_ajax = false)
{
$values = array('id' => $record->id, 'form_id' => $record->form_id);
$defaults = array('name' => $record->name, 'description' => $record->description, 'field_key' => $record->field_key, 'type' => $record->type, 'default_value' => $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required);
if ($doing_ajax) {
$values = $values + $defaults;
$values['form_name'] = '';
} else {
foreach ($defaults as $var => $default) {
$values[$var] = FrmAppHelper::get_param($var, $default, 'get', 'htmlspecialchars');
unset($var, $default);
}
$values['form_name'] = $record->form_id ? FrmForm::getName($record->form_id) : '';
}
unset($defaults);
$values['options'] = $record->options;
$values['field_options'] = $record->field_options;
$defaults = self::get_default_field_opts($values['type'], $record, true);
if ($values['type'] == 'captcha') {
$frm_settings = FrmAppHelper::get_settings();
$defaults['invalid'] = $frm_settings->re_msg;
}
foreach ($defaults as $opt => $default) {
$values[$opt] = isset($record->field_options[$opt]) ? $record->field_options[$opt] : $default;
unset($opt, $default);
}
$values['custom_html'] = isset($record->field_options['custom_html']) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
return apply_filters('frm_setup_edit_field_vars', $values, array('doing_ajax' => $doing_ajax));
}
示例2: widget
public function widget($args, $instance)
{
if (empty($instance['title'])) {
$title = FrmForm::getName($instance['form']);
} else {
$title = $instance['title'];
}
$title = apply_filters('widget_title', $title);
$instance['description'] = isset($instance['description']) ? $instance['description'] : false;
echo $args['before_widget'];
echo '<div class="frm_form_widget">';
if ($title) {
echo $args['before_title'] . stripslashes($title) . $args['after_title'];
}
echo FrmFormsController::show_form($instance['form'], '', false, $instance['description']);
echo '</div>';
echo $args['after_widget'];
}
示例3: widget
function widget($args, $instance)
{
extract($args);
$frm_form = new FrmForm();
$form_name = $frm_form->getName($instance['form']);
$title = apply_filters('widget_title', empty($instance['title']) ? $form_name : $instance['title']);
$instance['description'] = isset($instance['description']) ? $instance['description'] : false;
echo $before_widget;
$select_class = (isset($instance['select_width']) and $instance['select_width']) ? ' frm_set_select' : '';
echo '<div class="frm_form_widget' . $select_class . '">';
if ($title) {
echo $before_title . stripslashes($title) . $after_title;
}
if (isset($instance['size']) and is_numeric($instance['size'])) {
global $frm_vars;
$frm_vars['sidebar_width'] = $instance['size'];
}
echo FrmFormsController::show_form($instance['form'], '', false, $instance['description']);
$frm_vars['sidebar_width'] = '';
echo '</div>';
echo $after_widget;
}
示例4: edit_form_link
public static function edit_form_link($form_id)
{
if (is_object($form_id)) {
$form = $form_id;
$name = $form->name;
$form_id = $form->id;
} else {
$name = FrmForm::getName($form_id);
}
if ($form_id) {
$val = '<a href="' . esc_url(admin_url('admin.php') . '?page=formidable&frm_action=edit&id=' . $form_id) . '">' . ('' == $name ? __('(no title)') : FrmAppHelper::truncate($name, 40)) . '</a>';
} else {
$val = '';
}
return $val;
}
示例5: array
function single_row($item, $style = '')
{
global $frmpro_settings;
$checkbox = '';
// Set up the hover actions for this user
$actions = array();
$edit_link = "?page=formidable-{$this->page_name}&frm_action=edit&id={$item->id}";
$actions['edit'] = "<a href='" . wp_nonce_url($edit_link) . "'>" . __('Edit') . "</a>";
$duplicate_link = "?page=formidable-{$this->page_name}&frm_action=duplicate&id={$item->id}";
$delete_link = "?page=formidable-{$this->page_name}&frm_action=destroy&id={$item->id}";
if ($this->plural == 'entries') {
$duplicate_link .= "&form=" . $this->params['form'];
$delete_link .= "&form=" . $this->params['form'];
$view_link = "?page=formidable-{$this->page_name}&frm_action=show&id={$item->id}";
$actions['view'] = "<a href='" . wp_nonce_url($view_link) . "'>" . __('View', 'formidable') . "</a>";
}
$actions['duplicate'] = "<a href='" . wp_nonce_url($duplicate_link) . "'>" . __('Duplicate', 'formidable') . "</a>";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url($delete_link) . "' onclick='return confirm(\"" . __('Are you sure you want to delete that?', 'formidable') . "\")'>" . __('Delete') . "</a>";
if ($this->plural == 'entries') {
if (!current_user_can('frm_edit_entries')) {
unset($actions['edit']);
}
if (!current_user_can('frm_create_entries')) {
unset($actions['duplicate']);
}
if (!current_user_can('frm_delete_entries')) {
unset($actions['delete']);
}
}
$actions = apply_filters('frm_row_actions', $actions, $item);
$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) = $this->get_column_info();
$action_col = false;
foreach ($columns as $column_name => $column_display_name) {
$class = "class=\"{$column_name} column-{$column_name}\"";
$style = '';
if (in_array($column_name, $hidden)) {
$style = ' style="display:none;"';
} else {
if (!$action_col and !in_array($column_name, array('cb', 'id', 'form_id', 'post_id'))) {
$action_col = $column_name;
}
}
$attributes = "{$class}{$style}";
$col_name = preg_replace('/^(' . $this->params['form'] . '_)/', '', $column_name);
switch ($col_name) {
case 'cb':
$r .= "<th scope='row' class='check-column'>{$checkbox}</th>";
break;
case 'ip':
case 'id':
case 'item_key':
case 'display_key':
case 'show_count':
$val = $item->{$col_name};
break;
case 'name':
case 'description':
case 'content':
case 'dyncontent':
$val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
break;
case 'created_at':
case 'updated_at':
$date = FrmProAppHelper::get_formatted_time($item->{$col_name}, $frmpro_settings->date_format);
$val = "<abbr title='" . FrmProAppHelper::get_formatted_time($item->{$col_name}, $frmpro_settings->date_format, 'g:i:s A') . "'>" . $date . "</abbr>";
break;
case 'is_draft':
$val = empty($item->is_draft) ? __('No') : __('Yes');
break;
case 'form_id':
$frm_form = new FrmForm();
$form = $frm_form->getName($item->form_id);
if ($form) {
$val = '<a href="' . admin_url('admin.php') . '?page=formidable&frm_action=edit&id=' . $item->form_id . '">' . FrmAppHelper::truncate($form, 40) . '</a>';
} else {
$val = '';
}
break;
case 'post_id':
$post = get_post($item->{$col_name});
if ($post) {
$val = '<a href="' . admin_url('post.php') . '?post=' . $item->{$col_name} . '&action=edit">' . FrmAppHelper::truncate($post->post_title, 50) . '</a>';
} else {
$val = '';
}
break;
case 'user_id':
$user = get_userdata($item->user_id);
$val = $user->user_login;
break;
case 'shortcode':
$code = '';
$val = '<input type="text" readonly="true" class="frm_select_box" value="' . esc_attr($code) . '" />';
break;
default:
if ($this->plural == 'entries') {
//.........这里部分代码省略.........
示例6: manage_custom_columns
public static function manage_custom_columns($column_name, $id)
{
$val = '';
switch ($column_name) {
case 'id':
$val = $id;
break;
case 'old_id':
$old_id = get_post_meta($id, 'frm_old_id', true);
$val = $old_id ? $old_id : __('N/A', 'formidable');
break;
case 'name':
case 'content':
$post = get_post($id);
$val = FrmAppHelper::truncate(strip_tags($post->{"post_{$column_name}"}), 100);
break;
case 'description':
$post = get_post($id);
$val = FrmAppHelper::truncate(strip_tags($post->post_excerpt), 100);
break;
case 'show_count':
$val = ucwords(get_post_meta($id, 'frm_' . $column_name, true));
break;
case 'dyncontent':
$val = FrmAppHelper::truncate(strip_tags(get_post_meta($id, 'frm_' . $column_name, true)), 100);
break;
case 'form_id':
$frm_form = new FrmForm();
$form_id = get_post_meta($id, 'frm_' . $column_name, true);
$form = $frm_form->getName($form_id);
unset($frm_form);
if ($form) {
$val = '<a href="' . admin_url('admin.php') . '?page=formidable&frm_action=edit&id=' . $form_id . '">' . FrmAppHelper::truncate($form, 40) . '</a>';
} else {
$val = '';
}
break;
case 'post_id':
$insert_loc = get_post_meta($id, 'frm_insert_loc', true);
if (!$insert_loc or $insert_loc == 'none') {
$val = '';
break;
}
$post_id = get_post_meta($id, 'frm_' . $column_name, true);
$auto_post = get_post($post_id);
if ($auto_post) {
$val = '<a href="' . admin_url('post.php') . '?post=' . $post_id . '&action=edit">' . FrmAppHelper::truncate($auto_post->post_title, 50) . '</a>';
} else {
$val = '';
}
break;
case 'shortcode':
$code = "[display-frm-data id={$id} filter=1]";
$val = '<input type="text" readonly="true" class="frm_select_box" value="' . esc_attr($code) . '" />';
break;
default:
$val = $column_name;
break;
}
echo $val;
}