本文整理匯總了PHP中FrmFormsHelper::get_direct_link方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrmFormsHelper::get_direct_link方法的具體用法?PHP FrmFormsHelper::get_direct_link怎麽用?PHP FrmFormsHelper::get_direct_link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FrmFormsHelper
的用法示例。
在下文中一共展示了FrmFormsHelper::get_direct_link方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sprintf
?>
</td>
<td><?php
echo $form->form_key;
?>
</td>
<td><?php
$text = $frm_entry->getRecordCount($form->id);
$text = sprintf(_n('%1$s Entry', '%1$s Entries', $text, 'formidable'), $text);
echo current_user_can('frm_view_entries') ? '<a href="' . esc_url(admin_url('admin.php') . '?page=formidable-entries&form=' . $form->id) . '">' . $text . '</a>' : $text;
unset($text);
?>
</td>
<td>
<input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="<?php
echo $target_url = FrmFormsHelper::get_direct_link($form->form_key, $form->prli_link_id);
?>
" /><br/><a href="<?php
echo $target_url;
?>
" target="blank"><?php
_e('View Form', 'formidable');
?>
</a>
</td>
<td><input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable id=<?php
echo $form->id;
?>
]" /><br/>
<input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable key=<?php
echo $form->form_key;
示例2: _e
_e('No Templates Found', 'formidable');
?>
</td></tr>
<?php
} else {
$alternate = false;
foreach ($default_templates as $form) {
$alternate = !$alternate ? 'alternate' : false;
?>
<tr class="<?php
echo $alternate;
?>
">
<td class="post-title">
<a class="row-title" href="<?php
echo $url = FrmFormsHelper::get_direct_link($form->form_key, $form);
?>
" title="<?php
_e('View', 'formidable');
?>
<?php
echo esc_attr($form->name);
?>
" target="blank"><?php
echo $form->name;
?>
</a><br/>
<div class="row-actions">
<?php
if (current_user_can('frm_edit_forms')) {
?>
示例3: single_row
function single_row($item, $style = '')
{
global $frmpro_is_installed, $frm_entry;
$checkbox = '';
// Set up the hover actions for this user
$actions = array();
$title = esc_attr(strip_tags(stripslashes($item->name)));
$edit_link = "?page=formidable&frm_action=edit&id={$item->id}";
$actions['edit'] = "<a href='" . wp_nonce_url($edit_link) . "'>" . __('Edit', 'formidable') . "</a>";
$duplicate_link = "?page=formidable&frm_action=duplicate&id={$item->id}";
$view_link = "?page=formidable-{$this->page_name}&frm_action=show&id={$item->id}";
if ($this->params['template']) {
$actions['duplicate'] = "<a href='" . wp_nonce_url($duplicate_link) . "'>" . __('Create Form from Template', 'formidable') . "</a>";
} else {
$actions['settings'] = "<a href='" . wp_nonce_url("?page=formidable&frm_action=settings&id={$item->id}") . "'>" . __('Settings', 'formidable') . "</a>";
$actions['entries'] = "<a href='" . wp_nonce_url("?page=formidable-entries&form={$item->id}") . "' title='{$title} " . __('Entries', 'formidable') . "'>" . __('Entries', 'formidable') . "</a>";
$actions['reports'] = "<a href='" . wp_nonce_url("?page=formidable-reports&form={$item->id}") . "' title='{$title} " . __('Reports', 'formidable') . "'>" . __('Reports', 'formidable') . "</a>";
if ($frmpro_is_installed and current_user_can('frm_create_entries')) {
$actions['entry'] = "<a href='" . wp_nonce_url("?page=formidable-entries&frm_action=new&form={$item->id}") . "' title='" . __('New', 'formidable') . " {$title} " . __('Entry', 'formidable') . "'>" . __('New Entry', 'formidable') . "</a>";
}
$actions['duplicate'] = "<a href='" . wp_nonce_url($duplicate_link) . "' title='" . __('Copy', 'formidable') . " {$title}'>" . __('Duplicate', 'formidable') . "</a>";
if ($frmpro_is_installed) {
$actions['template'] = "<a href='" . wp_nonce_url("?page=formidable&frm_action=duplicate&id={$item->id}&template=1") . "' title='" . __('Create Template', 'formidable') . "'>" . __('Create Template', 'formidable') . "</a>";
}
}
if ($frmpro_is_installed) {
$actions['export_template'] = "<a href='" . wp_nonce_url(FRM_SCRIPT_URL . "&controller=forms&frm_action=export&id={$item->id}") . "' title='{$title} " . __('Export Template', 'formidable') . "'>" . __('Export Template', 'formidable') . "</a>";
}
$delete_link = "?page=formidable&frm_action=destroy&id={$item->id}";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url($delete_link) . "' onclick='return confirm(\"" . __('Are you sure you want to delete that?', 'formidable') . "\")'>" . __('Delete', 'formidable') . "</a>";
if (!current_user_can('frm_view_entries')) {
if (isset($actions['entries'])) {
unset($actions['entries']);
}
if (isset($actions['reports'])) {
unset($actions['reports']);
}
}
if (!current_user_can('frm_edit_forms')) {
unset($actions['edit']);
unset($actions['duplicate']);
if (isset($actions['settings'])) {
unset($actions['settings']);
}
if (!$frmpro_is_installed) {
unset($actions['duplicate']);
}
}
if (!current_user_can('frm_delete_forms')) {
unset($actions['delete']);
}
$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'))) {
$action_col = $column_name;
}
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'cb':
$r .= "<th scope='row' class='check-column'>{$checkbox}</th>";
break;
case 'id':
case 'form_key':
$val = stripslashes($item->{$column_name});
break;
case 'name':
case 'description':
$val = FrmAppHelper::truncate(strip_tags(stripslashes($item->{$column_name})), 100);
break;
case 'created_at':
$format = 'Y/m/d';
//get_option('date_format');
$date = date($format, strtotime($item->{$column_name}));
$val = "<abbr title='" . date($format . ' g:i:s A', strtotime($item->{$column_name})) . "'>" . $date . "</abbr>";
break;
case 'shortcode':
$val = "<input type='text' style='font-size:10px;width:100%;' readonly='true' onclick='this.select();' onfocus='this.select();' value='[formidable id={$item->id}]' /><br/>";
$val .= "<input type='text' style='font-size:10px;width:100%;' readonly='true' onclick='this.select();' onfocus='this.select();' value='[formidable key={$item->form_key}]' />";
break;
case 'entries':
$text = $frm_entry->getRecordCount($item->id);
$text = sprintf(_n('%1$s Entry', '%1$s Entries', $text, 'formidable'), $text);
$val = current_user_can('frm_view_entries') ? '<a href="' . esc_url(admin_url('admin.php') . '?page=formidable-entries&form=' . $item->id) . '">' . $text . '</a>' : $text;
unset($text);
break;
case 'link':
$target_url = FrmFormsHelper::get_direct_link($item->form_key, $item->prli_link_id);
$val = '<input type="text" style="font-size:10px;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="' . esc_html($target_url) . '" /><br/><a href="' . esc_html($target_url) . '" target="blank">' . __('View Form', 'formidable') . '</a>';
unset($target_url);
//.........這裏部分代碼省略.........
示例4: single_row
function single_row($item, $style = '')
{
global $frm_vars, $frm_entry;
$checkbox = '';
// Set up the hover actions for this user
$actions = array();
$title = esc_attr(strip_tags($item->name));
if (current_user_can('frm_edit_forms')) {
$edit_link = "?page=formidable&frm_action=edit&id={$item->id}";
$duplicate_link = "?page=formidable&frm_action=duplicate&id={$item->id}";
$actions['frm_edit'] = "<a href='" . esc_url($edit_link) . "'>" . __('Edit') . "</a>";
if ($this->params['template']) {
$actions['frm_duplicate'] = "<a href='" . wp_nonce_url($duplicate_link) . "'>" . __('Create Form from Template', 'formidable') . "</a>";
} else {
$actions['frm_settings'] = "<a href='" . wp_nonce_url("?page=formidable&frm_action=settings&id={$item->id}") . "'>" . __('Settings', 'formidable') . "</a>";
if ($frm_vars['pro_is_installed']) {
$actions['duplicate'] = '<a href="' . wp_nonce_url($duplicate_link) . '">' . __('Duplicate', 'formidable') . '</a>';
}
}
}
$delete_link = "?page=formidable&frm_action=destroy&id={$item->id}";
if (current_user_can('frm_delete_forms')) {
$actions['trash'] = '<a class="submitdelete" href="' . wp_nonce_url($delete_link) . '" onclick="return confirm(\'' . __('Are you sure you want to delete that?', 'formidable') . '\')">' . __('Delete') . '</a>';
}
$actions['view'] = '<a href="' . FrmFormsHelper::get_direct_link($item->form_key, $item) . '" target="_blank">' . __('Preview') . '</a>';
$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'))) {
$action_col = $column_name;
}
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'cb':
$r .= '<th scope="row" class="check-column">' . $checkbox . '</th>';
break;
case 'id':
case 'form_key':
$val = $item->{$column_name};
break;
case 'name':
if (trim($item->{$column_name}) == '') {
$val = __('(no title)');
} else {
$val = FrmAppHelper::truncate(strip_tags($item->{$column_name}), 50);
}
break;
case 'description':
$val = FrmAppHelper::truncate(strip_tags($item->{$column_name}), 50);
break;
case 'created_at':
$format = 'Y/m/d';
//get_option('date_format');
$date = date($format, strtotime($item->{$column_name}));
$val = "<abbr title='" . date($format . ' g:i:s A', strtotime($item->{$column_name})) . "'>" . $date . "</abbr>";
break;
case 'shortcode':
$val = '<input type="text" readonly="true" class="frm_select_box" value="' . esc_attr("[formidable id={$item->id}]") . '" /><br/>';
$val .= '<input type="text" readonly="true" class="frm_select_box" value="' . esc_attr("[formidable key={$item->form_key}]") . '" />';
break;
case 'entries':
$text = $frm_entry->getRecordCount($item->id);
//$text = sprintf(_n( '%1$s Entry', '%1$s Entries', $text, 'formidable' ), $text);
$val = current_user_can('frm_view_entries') ? '<a href="' . esc_url(admin_url('admin.php') . '?page=formidable-entries&form=' . $item->id) . '">' . $text . '</a>' : $text;
unset($text);
break;
case 'link':
$links = array();
if ($frm_vars['pro_is_installed'] and current_user_can('frm_create_entries')) {
$links[] = '<a href="' . wp_nonce_url("?page=formidable-entries&frm_action=new&form={$item->id}") . '" class="frm_add_entry_icon frm_icon_font frm_bstooltip" title="' . __('Add Entry', 'formidable') . '" data-toggle="tooltip"> </a>';
}
if (current_user_can('frm_edit_forms')) {
$links[] = '<a href="' . wp_nonce_url("?page=formidable&frm_action=duplicate&id={$item->id}&template=1") . '" class="frm_icon_font frm_new_template_icon frm_bstooltip" title="' . __('Create template from form', 'formidable') . '" data-toggle="tooltip"> </a>';
}
$val = implode(' ', $links);
break;
default:
$val = $column_name;
break;
}
if (isset($val)) {
$r .= "<td {$attributes}>";
if ($column_name == $action_col) {
$r .= '<a class="row-title" href="' . (isset($actions['frm_edit']) ? $edit_link : FrmFormsHelper::get_direct_link($item->form_key, $item)) . '">' . $val . '</a> ';
$r .= $action_links;
} else {
$r .= $val;
}
$r .= '</td>';
}
//.........這裏部分代碼省略.........
示例5: _e
"><?php
_e('Preview', 'formidable');
?>
</a>
<?php
} else {
?>
<div class="preview dropdown">
<a href="#" id="frm-previewDrop" class="frm-dropdown-toggle button" data-toggle="dropdown"><?php
_e('Preview', 'formidable');
?>
<b class="caret"></b></a>
<ul class="frm-dropdown-menu pull-right" role="menu" aria-labelledby="frm-previewDrop">
<li><a href="<?php
echo esc_url(FrmFormsHelper::get_direct_link($values['form_key']));
?>
" target="_blank"><?php
_e('On Blank Page', 'formidable');
?>
</a></li>
<li><a href="<?php
echo esc_url(add_query_arg('form', $values['form_key'], get_permalink($frm_settings->preview_page_id)));
?>
" target="_blank"><?php
_e('In Theme', 'formidable');
?>
</a></li>
</ul>
</div>
<?php
示例6: _e
if (!isset($hide_preview) or !$hide_preview) {
if (!$values['is_template']) {
?>
<p class="howto" style="margin-top:0;"><?php
_e('Insert into a post, page or text widget', 'formidable');
?>
<input type="text" style="text-align:center;font-weight:bold;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable id=<?php
echo $id;
?>
]" /></p>
<?php
}
?>
<p class="frm_orange"><a href="<?php
echo FrmFormsHelper::get_direct_link($values['form_key']);
?>
" target="_blank"><?php
_e('Preview', 'formidable');
?>
</a>
<?php
global $frm_settings;
if ($frm_settings->preview_page_id > 0) {
?>
<?php
_e('or', 'formidable');
?>
<a href="<?php
echo add_query_arg('form', $values['form_key'], get_permalink($frm_settings->preview_page_id));
示例7: get_form_name
/**
* @param string $edit_link
*/
private function get_form_name($item, $actions, $edit_link, $mode = 'list')
{
$form_name = $item->name;
if (trim($form_name) == '') {
$form_name = __('(no title)');
}
$form_name = FrmAppHelper::kses($form_name);
if ('excerpt' != $mode) {
$form_name = FrmAppHelper::truncate($form_name, 50);
}
$val = '<strong>';
if ('trash' == $this->status) {
$val .= $form_name;
} else {
$val .= '<a href="' . esc_url(isset($actions['frm_edit']) ? $edit_link : FrmFormsHelper::get_direct_link($item->form_key, $item)) . '" class="row-title">' . FrmAppHelper::kses($form_name) . '</a> ';
}
$this->add_draft_label($item, $val);
$val .= '</strong>';
$this->add_form_description($item, $val);
return $val;
}
示例8: update
function update($id, $values, $create_link = false)
{
global $wpdb, $frmdb, $frm_field, $frm_settings;
if ($create_link or isset($values['options']) or isset($values['item_meta']) or isset($values['field_options'])) {
$values['status'] = 'published';
}
if (isset($values['form_key'])) {
$values['form_key'] = FrmAppHelper::get_unique_key($values['form_key'], $frmdb->forms, 'form_key', $id);
}
$form_fields = array('form_key', 'name', 'description', 'status', 'prli_link_id');
$new_values = array();
if (isset($values['options'])) {
$options = array();
$defaults = FrmFormsHelper::get_default_opts();
foreach ($defaults as $var => $default) {
$options[$var] = isset($values['options'][$var]) ? $values['options'][$var] : $default;
}
$options['custom_style'] = isset($values['options']['custom_style']) ? $values['options']['custom_style'] : 0;
$options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
$options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
$options = apply_filters('frm_form_options_before_update', $options, $values);
$new_values['options'] = serialize($options);
}
foreach ($values as $value_key => $value) {
if (in_array($value_key, $form_fields)) {
$new_values[$value_key] = $value;
}
}
if (!empty($new_values)) {
$query_results = $wpdb->update($frmdb->forms, $new_values, array('id' => $id));
if ($query_results) {
wp_cache_delete($id, 'frm_form');
}
} else {
$query_results = true;
}
$all_fields = $frm_field->getAll(array('fi.form_id' => $id));
if ($all_fields and (isset($values['options']) or isset($values['item_meta']) or isset($values['field_options']))) {
if (!isset($values['item_meta'])) {
$values['item_meta'] = array();
}
$existing_keys = array_keys($values['item_meta']);
foreach ($all_fields as $fid) {
if (!in_array($fid->id, $existing_keys)) {
$values['item_meta'][$fid->id] = '';
}
}
foreach ($values['item_meta'] as $field_id => $default_value) {
$field = $frm_field->getOne($field_id);
if (!$field) {
continue;
}
$field_options = maybe_unserialize($field->field_options);
if (isset($values['options']) or isset($values['field_options']['custom_html_' . $field_id])) {
//updating the settings page
if (isset($values['field_options']['custom_html_' . $field_id])) {
$field_options['custom_html'] = isset($values['field_options']['custom_html_' . $field_id]) ? $values['field_options']['custom_html_' . $field_id] : (isset($field_options['custom_html']) ? $field_options['custom_html'] : FrmFieldsHelper::get_default_html($field->type));
$field_options = apply_filters('frm_update_form_field_options', $field_options, $field, $values);
$frm_field->update($field_id, array('field_options' => $field_options));
} else {
if ($field->type == 'hidden') {
$prev_opts = $field_options;
$field_options = apply_filters('frm_update_form_field_options', $field_options, $field, $values);
if ($prev_opts != $field_options) {
$frm_field->update($field_id, array('field_options' => $field_options));
}
unset($prev_opts);
}
}
} else {
//updating the form
foreach (array('size', 'max', 'label', 'invalid', 'required_indicator', 'blank', 'classes') as $opt) {
$field_options[$opt] = isset($values['field_options'][$opt . '_' . $field_id]) ? trim($values['field_options'][$opt . '_' . $field_id]) : '';
}
$field_options['separate_value'] = isset($values['field_options']['separate_value_' . $field_id]) ? trim($values['field_options']['separate_value_' . $field_id]) : 0;
$field_options = apply_filters('frm_update_field_options', $field_options, $field, $values);
$default_value = maybe_serialize($values['item_meta'][$field_id]);
$field_key = isset($values['field_options']['field_key_' . $field_id]) ? $values['field_options']['field_key_' . $field_id] : $field->field_key;
$field_type = isset($values['field_options']['type_' . $field_id]) ? $values['field_options']['type_' . $field_id] : $field->type;
$field_description = isset($values['field_options']['description_' . $field_id]) ? $values['field_options']['description_' . $field_id] : $field->description;
$frm_field->update($field_id, array('field_key' => $field_key, 'type' => $field_type, 'default_value' => $default_value, 'field_options' => $field_options, 'description' => $field_description));
}
}
}
if (isset($values['form_key']) && class_exists('PrliLink')) {
$form = $this->getOne($id);
global $prli_link;
$prlink = $prli_link->getOne($form->prli_link_id);
if ($prlink) {
$prli = array();
$prli['url'] = FrmFormsHelper::get_direct_link($values['form_key']);
$prli['slug'] = $prlink->slug;
$prli['name'] = $prlink->name;
$prli['param_forwarding'] = $prlink->param_forwarding;
$prli['param_struct'] = $prlink->param_struct;
$prli['redirect_type'] = $prlink->redirect_type;
$prli['description'] = $prlink->description;
$prli['track_me'] = $prlink->track_me;
$prli['nofollow'] = $prlink->nofollow;
$prli['group_id'] = $prlink->group_id;
//.........這裏部分代碼省略.........
示例9: _e
if (!isset($hide_preview) || !$hide_preview) {
if (!$form->is_template) {
?>
<p class="howto" style="margin-top:0;"><?php
_e('Insert into a post, page or text widget', 'formidable');
?>
<input type="text" readonly="true" class="frm_select_box" value="[formidable id=<?php
echo $id;
?>
]" /></p>
<?php
}
?>
<p class="frm_orange"><a href="<?php
echo FrmFormsHelper::get_direct_link($form->form_key);
?>
" target="_blank"><?php
_e('Preview', 'formidable');
?>
</a>
<?php
global $frm_settings;
if ($frm_settings->preview_page_id > 0) {
?>
<?php
_e('or', 'formidable');
?>
<a href="<?php
echo add_query_arg('form', $form->form_key, get_permalink($frm_settings->preview_page_id));