本文整理汇总了PHP中GFCommon::get_remote_message方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::get_remote_message方法的具体用法?PHP GFCommon::get_remote_message怎么用?PHP GFCommon::get_remote_message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFCommon
的用法示例。
在下文中一共展示了GFCommon::get_remote_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leads_page
public static function leads_page($form_id)
{
global $wpdb;
//quit if version of wp is not supported
if (!GFCommon::ensure_wp_version()) {
return;
}
$form_id = absint($form_id);
echo GFCommon::get_remote_message();
$action = RGForms::post('action');
$filter = rgget('filter');
$search = stripslashes(rgget('s'));
$page_index = empty($_GET['paged']) ? 0 : intval($_GET['paged']) - 1;
$star = $filter == 'star' ? 1 : null;
$read = $filter == 'unread' ? 0 : null;
$status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
$form = RGFormsModel::get_form_meta($form_id);
$search_criteria['status'] = $status;
if ($star) {
$search_criteria['field_filters'][] = array('key' => 'is_starred', 'value' => (bool) $star);
}
if (!is_null($read)) {
$search_criteria['field_filters'][] = array('key' => 'is_read', 'value' => (bool) $read);
}
$search_field_id = rgget('field_id');
$search_operator = rgget('operator');
if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
$key = $search_field_id;
$val = stripslashes(rgget('s'));
$strpos_row_key = strpos($search_field_id, '|');
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode('|', $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ':' . $val;
}
if ('entry_id' == $key) {
$key = 'id';
}
$filter_operator = empty($search_operator) ? 'is' : $search_operator;
$field = GFFormsModel::get_field($form, $key);
if ($field) {
$input_type = GFFormsModel::get_input_type($field);
if ($field->type == 'product' && in_array($input_type, array('radio', 'select'))) {
$filter_operator = 'contains';
}
}
$search_criteria['field_filters'][] = array('key' => $key, 'operator' => $filter_operator, 'value' => $val);
}
$update_message = '';
switch ($action) {
case 'delete':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$lead_id = $_POST['action_argument'];
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_lead($lead_id);
$update_message = esc_html__('Entry deleted.', 'gravityforms');
} else {
$update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'bulk':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$bulk_action = !empty($_POST['bulk_action']) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
$select_all = rgpost('all_entries');
$leads = empty($select_all) ? $_POST['lead'] : GFFormsModel::search_lead_ids($form_id, $search_criteria);
$entry_count = count($leads) > 1 ? sprintf(esc_html__('%d entries', 'gravityforms'), count($leads)) : esc_html__('1 entry', 'gravityforms');
switch ($bulk_action) {
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_leads($leads);
$update_message = sprintf(esc_html__('%s deleted.', 'gravityforms'), $entry_count);
} else {
$update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'trash':
RGFormsModel::update_leads_property($leads, 'status', 'trash');
$update_message = sprintf(esc_html__('%s moved to Trash.', 'gravityforms'), $entry_count);
break;
case 'restore':
RGFormsModel::update_leads_property($leads, 'status', 'active');
$update_message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count);
break;
case 'unspam':
RGFormsModel::update_leads_property($leads, 'status', 'active');
$update_message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count);
break;
case 'spam':
RGFormsModel::update_leads_property($leads, 'status', 'spam');
$update_message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count);
break;
case 'mark_read':
RGFormsModel::update_leads_property($leads, 'is_read', 1);
$update_message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count);
break;
case 'mark_unread':
RGFormsModel::update_leads_property($leads, 'is_read', 0);
$update_message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count);
break;
//.........这里部分代码省略.........
示例2: export_page
public static function export_page()
{
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$view = rgget('view') ? rgget('view') : 'export_entry';
switch ($view) {
case 'export_entry':
self::export_lead_page();
break;
case 'import_form':
self::import_form_page();
break;
case 'export_form':
self::export_form_page();
break;
default:
/**
* Fires when export pages are gathered
*
* Used to add additional export settings pages
*
* @param string $view Set when defining the action string. Creates the name for the new page
*/
do_action("gform_export_page_{$view}");
break;
}
}
示例3: settings_page
public static function settings_page()
{
$addon_name = RGForms::get("addon");
$icon_path = empty($addon_name) ? "" : self::$addon_pages[$addon_name]["icon"];
$page_title = empty($addon_name) ? __("Gravity Forms Settings", "gravityforms") : $addon_name . " " . __("Settings", "gravityforms");
$icon_path = empty($icon_path) ? GFCommon::get_base_url() . "/images/gravity-settings-icon-32.png" : $icon_path;
echo GFCommon::get_remote_message();
?>
<link rel="stylesheet" href="<?php
echo GFCommon::get_base_url();
?>
/css/admin.css" />
<div class="wrap">
<img alt="<?php
$page_title;
?>
" src="<?php
echo $icon_path;
?>
" style="float:left; margin:15px 7px 0 0;"/>
<h2><?php
echo $page_title;
?>
</h2>
<?php
if (!empty(self::$addon_pages)) {
?>
<ul class="subsubsub">
<li><a href="?page=gf_settings">Gravity Forms</a> |</li>
<?php
$count = sizeof(self::$addon_pages);
for ($i = 0; $i < $count; $i++) {
$addon_keys = array_keys(self::$addon_pages);
$addon = $addon_keys[$i];
?>
<li><a href="?page=gf_settings&addon=<?php
echo urlencode($addon);
?>
"><?php
echo esc_html($addon);
?>
</a> <?php
echo $i < $count - 1 ? "|" : "";
?>
</li>
<?php
}
?>
</ul>
<br style="clear:both;"/>
<?php
}
if (empty($addon_name)) {
self::gravityforms_settings_page();
} else {
do_action("gform_settings_" . str_replace(" ", "_", $addon_name));
}
}
示例4: export_page
public static function export_page()
{
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$view = RGForms::get("view");
switch ($view) {
case "import_form":
self::import_form_page();
break;
case "export_form":
self::export_form_page();
break;
default:
self::export_lead_page();
break;
}
}
示例5: form_list_page
public static function form_list_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post("action");
$bulk_action = RGForms::post("bulk_action");
$bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
if ($action == "trash") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
} else {
if ($action == "restore") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
} else {
if ($action == "delete") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
} else {
if ($action == "duplicate") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
}
}
}
}
if ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any("gravityforms_delete_entries")) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete entries.", "gravityforms");
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (isset($message)) {
$message = sprintf($message, $form_count);
}
}
$sort_column = empty($_GET["sort"]) ? "title" : $_GET["sort"];
$sort_direction = empty($_GET["dir"]) ? "ASC" : $_GET["dir"];
$active = RGForms::get("active") == "" ? null : RGForms::get("active");
$trash = RGForms::get("trash") == "" ? false : RGForms::get("trash");
$trash = esc_attr($trash);
//.........这里部分代码省略.........
示例6: leads_page
public static function leads_page($form_id)
{
global $wpdb;
//quit if version of wp is not supported
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post("action");
$filter = rgget("filter");
$search = rgget("s");
$page_index = empty($_GET["paged"]) ? 0 : intval($_GET["paged"]) - 1;
$star = $filter == "star" ? 1 : null;
// is_numeric(RGForms::get("star")) ? intval(RGForms::get("star")) : null;
$read = $filter == "unread" ? 0 : null;
//is_numeric(RGForms::get("read")) ? intval(RGForms::get("read")) : null;
$status = in_array($filter, array("trash", "spam")) ? $filter : "active";
$update_message = "";
switch ($action) {
case "delete":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$lead_id = $_POST["action_argument"];
RGFormsModel::delete_lead($lead_id);
$update_message = __("Entry deleted.", "gravityforms");
break;
case "bulk":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$bulk_action = !empty($_POST["bulk_action"]) ? $_POST["bulk_action"] : $_POST["bulk_action2"];
$select_all = rgpost("all_entries");
$leads = empty($select_all) ? $_POST["lead"] : GFFormsModel::get_lead_ids($form_id, $search, $star, $read, null, null, $status);
$entry_count = count($leads) > 1 ? sprintf(__("%d entries", "gravityforms"), count($leads)) : __("1 entry", "gravityforms");
switch ($bulk_action) {
case "delete":
RGFormsModel::delete_leads($leads);
$update_message = sprintf(__("%s deleted.", "gravityforms"), $entry_count);
break;
case "trash":
RGFormsModel::update_leads_property($leads, "status", "trash");
$update_message = sprintf(__("%s moved to Trash.", "gravityforms"), $entry_count);
break;
case "restore":
RGFormsModel::update_leads_property($leads, "status", "active");
$update_message = sprintf(__("%s restored from the Trash.", "gravityforms"), $entry_count);
break;
case "unspam":
RGFormsModel::update_leads_property($leads, "status", "active");
$update_message = sprintf(__("%s restored from the spam.", "gravityforms"), $entry_count);
break;
case "spam":
RGFormsModel::update_leads_property($leads, "status", "spam");
$update_message = sprintf(__("%s marked as spam.", "gravityforms"), $entry_count);
break;
case "mark_read":
RGFormsModel::update_leads_property($leads, "is_read", 1);
$update_message = sprintf(__("%s marked as read.", "gravityforms"), $entry_count);
break;
case "mark_unread":
RGFormsModel::update_leads_property($leads, "is_read", 0);
$update_message = sprintf(__("%s marked as unread.", "gravityforms"), $entry_count);
break;
case "add_star":
RGFormsModel::update_leads_property($leads, "is_starred", 1);
$update_message = sprintf(__("%s starred.", "gravityforms"), $entry_count);
break;
case "remove_star":
RGFormsModel::update_leads_property($leads, "is_starred", 0);
$update_message = sprintf(__("%s unstarred.", "gravityforms"), $entry_count);
break;
}
break;
case "change_columns":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$columns = GFCommon::json_decode(stripslashes($_POST["grid_columns"]), true);
RGFormsModel::update_grid_column_meta($form_id, $columns);
break;
}
if (rgpost("button_delete_permanently")) {
RGFormsModel::delete_leads_by_form($form_id, $filter);
}
$sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
$sort_direction = empty($_GET["dir"]) ? "DESC" : $_GET["dir"];
$form = RGFormsModel::get_form_meta($form_id);
$sort_field_meta = RGFormsModel::get_field($form, $sort_field);
$is_numeric = $sort_field_meta["type"] == "number";
$page_size = apply_filters("gform_entry_page_size", apply_filters("gform_entry_page_size_{$form_id}", 20, $form_id), $form_id);
$first_item_index = $page_index * $page_size;
$leads = RGFormsModel::get_leads($form_id, $sort_field, $sort_direction, $search, $first_item_index, $page_size, $star, $read, $is_numeric, null, null, $status);
$lead_count = RGFormsModel::get_lead_count($form_id, $search, $star, $read, null, null, $status);
$summary = RGFormsModel::get_form_counts($form_id);
$active_lead_count = $summary["total"];
$unread_count = $summary["unread"];
$starred_count = $summary["starred"];
$spam_count = $summary["spam"];
$trash_count = $summary["trash"];
$columns = RGFormsModel::get_grid_columns($form_id, true);
$search_qs = empty($search) ? "" : "&s=" . urlencode($search);
$sort_qs = empty($sort_field) ? "" : "&sort={$sort_field}";
$dir_qs = empty($sort_field) ? "" : "&dir={$sort_direction}";
$star_qs = $star !== null ? "&star={$star}" : "";
$read_qs = $read !== null ? "&read={$read}" : "";
//.........这里部分代码省略.........
示例7: addons_page
public static function addons_page()
{
wp_print_scripts("thickbox");
wp_print_styles(array("thickbox"));
$plugins = get_plugins();
$installed_plugins = array();
foreach ($plugins as $key => $plugin) {
$is_active = is_plugin_active($key);
$installed_plugin = array("plugin" => $key, "name" => $plugin["Name"], "is_active" => $is_active);
$installed_plugin["activation_url"] = $is_active ? "" : wp_nonce_url("plugins.php?action=activate&plugin={$key}", "activate-plugin_{$key}");
$installed_plugin["deactivation_url"] = !$is_active ? "" : wp_nonce_url("plugins.php?action=deactivate&plugin={$key}", "deactivate-plugin_{$key}");
$installed_plugins[] = $installed_plugin;
}
$nonces = self::get_addon_nonces();
$body = array("plugins" => urlencode(serialize($installed_plugins)), "nonces" => urlencode(serialize($nonces)), "key" => GFCommon::get_key());
$options = array('body' => $body, 'headers' => array('Referer' => get_bloginfo("url")));
$request_url = GRAVITY_MANAGER_URL . "/api.php?op=plugin_browser&{$_SERVER["QUERY_STRING"]}";
$raw_response = wp_remote_post($request_url, $options);
if (is_wp_error($raw_response) || $raw_response['response']['code'] != 200) {
echo "<div class='error' style='margin-top:50px; padding:20px;'>" . __("Add-On brower is currently unavailable. Please try again later.", "gravityforms") . "</div>";
} else {
echo GFCommon::get_remote_message();
echo $raw_response["body"];
}
}
示例8: form_list_page
public static function form_list_page()
{
global $wpdb;
// todo: hook up bulk action confirmation js
// todo: apply button filter
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
wp_print_styles(array('thickbox'));
add_action('admin_print_footer_scripts', array(__CLASS__, 'output_form_list_script_block'), 20);
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min';
?>
<script type="text/javascript">
// checked by the ToggleActive method to prevent errors when form status icon is clicked before page has fully loaded
var gfPageLoaded = false;
</script>
<style type="text/css">
body div#TB_window[style] {
width: 405px !important;
height: 340px !important;
margin-left: -202px !important;
}
body #TB_ajaxContent {
height: 290px !important;
overflow: hidden;
}
.gf_new_form_modal_container {
padding: 30px;
}
.gf_new_form_modal_container .setting-row {
margin: 0 0 10px;
}
.gf_new_form_modal_container .setting-row label {
line-height: 24px;
}
.gf_new_form_modal_container .setting-row input,
.gf_new_form_modal_container .setting-row textarea {
display: block;
width: 100%;
}
.gf_new_form_modal_container .setting-row textarea {
height: 110px;
}
.gf_new_form_modal_container .submit-row {
margin-top: 18px;
}
.gf_new_form_modal_container #gf_new_form_error_message {
margin: 0 0 18px 5px !important;
color: #BC0B0B;
}
.gf_new_form_modal_container img.gfspinner {
position: relative;
top: 5px;
left: 5px;
}
.gf_not_ready { opacity: 0.25; }
</style>
<?php
if (GFCommon::current_user_can_any('gravityforms_create_form')) {
?>
<div id="gf_new_form_modal" style="display:none;">
<div class="gf_new_form_modal_container">
<div class="setting-row">
<label for="new_form_title"><?php
esc_html_e('Form Title', 'gravityforms');
?>
<span class="gfield_required">*</span></label><br />
<input type="text" class="regular-text" value="" id="new_form_title" tabindex="9000">
</div>
<div class="setting-row">
<label for="new_form_description"><?php
esc_html_e('Form Description', 'gravityforms');
?>
</label><br />
<textarea class="regular-text" id="new_form_description" tabindex="9001"></textarea>
</div>
<div class="submit-row">
<?php
/**
* Allows for modification of the "New Form" button HTML
*
//.........这里部分代码省略.........
示例9: help_page
public static function help_page()
{
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min';
?>
<link rel="stylesheet" href="<?php
echo GFCommon::get_base_url();
?>
/css/admin<?php
echo $min;
?>
.css" />
<div class="wrap <?php
echo GFCommon::get_browser_class();
?>
">
<h2><?php
esc_html_e('Gravity Forms Help', 'gravityforms');
?>
</h2>
<div style="margin-top:10px;">
<div
class="gf_admin_notice"><?php
printf(esc_html__('%sIMPORTANT NOTICE:%s We do not provide support via telephone or e-mail. Please %sopen a support ticket%s.', 'gravityforms'), '<strong>', '</strong>', '<a href="https://www.gravityhelp.com/support/" target="_blank">', '</a>');
?>
</div>
<div class="gf_help_content"><p><?php
printf(esc_html__("Please review the plugin documentation and %sfrequently asked questions (FAQ)%s first. If you still can't find the answer %sopen a support ticket%s and we will be happy to answer your questions and assist you with any problems. %sPlease note:%s If you have not %spurchased a license%s from us, you will not have access to these help resources.", 'gravityforms'), '<a href="https://www.gravityhelp.com/frequently-asked-questions/">', '</a>', '<a href="https://www.gravityhelp.com/support/" target="_blank">', '</a>', '<strong>', '</strong>', '<a href="http://www.gravityforms.com/purchase-gravity-forms/">', '</a>');
?>
</p></div>
<div class="hr-divider"></div>
<h3><?php
esc_html_e('User Documentation', 'gravityforms');
?>
</h3>
<div class="gforms_helpbox" style="margin:15px 0;">
<ul class="resource_list">
<li>
<i class="fa fa-book"></i> <a href="https://www.gravityhelp.com/documentation/article/creating-a-form/">
<?php
esc_html_e('Creating a Form', 'gravityforms');
?>
</a>
</li>
<li>
<i class="fa fa-book"></i> <a target="_blank" href="https://www.gravityhelp.com/documentation/article/embedding-a-form/">
<?php
esc_html_e('Embedding a Form', 'gravityforms');
?>
</a>
</li>
<li>
<i class="fa fa-book"></i> <a target="_blank" href="https://www.gravityhelp.com/documentation/article/reviewing-form-submissions/">
<?php
esc_html_e('Reviewing Form Submissions', 'gravityforms');
?>
</a>
</li>
<li>
<i class="fa fa-book"></i> <a target="_blank" href="https://www.gravityhelp.com/documentation/article/configuring-confirmations-in-gravity-forms/">
<?php
esc_html_e('Configuring Confirmations', 'gravityforms');
?>
</a>
</li>
<li>
<i class="fa fa-book"></i> <a target="_blank" href="https://www.gravityhelp.com/documentation/article/configuring-notifications-in-gravity-forms/">
<?php
esc_html_e('Configuring Notifications', 'gravityforms');
?>
</a>
</li>
</ul>
</div>
<div class="hr-divider"></div>
<h3><?php
esc_html_e('Developer Documentation', 'gravityforms');
?>
</h3>
<div class="gforms_helpbox" style="margin:15px 0;">
<ul class="resource_list">
<li>
<i class="fa fa-book"></i> <a href="https://www.gravityhelp.com/documentation/article/getting-started-with-the-gravity-forms-api-gfapi/">
<?php
esc_html_e('Getting Started with the Gravity Forms API', 'gravityforms');
?>
//.........这里部分代码省略.........
示例10: forms_page
//.........这里部分代码省略.........
exprPatt = /^[0-9 -/*\(\)]+$/i,
expr = formula.replace(/(\r\n|\n|\r)/gm, ''),
match;
while (match = patt.exec(expr)) {
expr = expr.replace(match[0], 1);
}
if (exprPatt.test(expr)) {
try {
var r = eval(expr);
return !isNaN(parseFloat(r)) && isFinite(r);
} catch (e) {
return false;
}
} else {
return false;
}
}
</script>
<?php
$form = !rgempty('meta', $update_result) ? rgar($update_result, 'meta') : GFFormsModel::get_form_meta($form_id);
if (!isset($form['fields']) || !is_array($form['fields'])) {
$form['fields'] = array();
}
$form = apply_filters('gform_admin_pre_render_' . $form_id, apply_filters('gform_admin_pre_render', $form));
if (isset($form['id'])) {
echo "<script type=\"text/javascript\">var form = " . json_encode($form) . ';</script>';
} else {
echo "<script type=\"text/javascript\">var form = new Form();</script>";
}
?>
<?php
echo GFCommon::get_remote_message();
?>
<div class="wrap gforms_edit_form <?php
echo GFCommon::get_browser_class();
?>
">
<?php
if (empty($form_id)) {
?>
<h2 class="gf_admin_page_title"><?php
_e('New Form', 'gravityforms');
?>
</h2>
<?php
} else {
?>
<h2 class="gf_admin_page_title">
<span><?php
_e('Form Editor', 'gravityforms');
?>
</span><span class="gf_admin_page_subtitle"><span class="gf_admin_page_formid">ID: <?php
echo absint($form['id']);
?>
</span><span class="gf_admin_page_formname"><?php
_e('Form Name', 'gravityforms');
?>
: <?php
echo esc_html($form['title']);
?>
</span></span>
</h2>
<?php
}
示例11: lead_detail_page
public static function lead_detail_page()
{
global $current_user;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$form = RGFormsModel::get_form_meta(absint($_GET['id']));
$form_id = absint($form['id']);
$form = apply_filters('gform_admin_pre_render_' . $form_id, apply_filters('gform_admin_pre_render', $form));
$lead_id = absint(rgget('lid'));
$filter = rgget('filter');
$status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
$position = rgget('pos') ? rgget('pos') : 0;
$sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
$sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
$sort_field_meta = RGFormsModel::get_field($form, $sort_field);
$is_numeric = $sort_field_meta['type'] == 'number';
$star = $filter == 'star' ? 1 : null;
$read = $filter == 'unread' ? 0 : null;
$search_criteria['status'] = $status;
if ($star) {
$search_criteria['field_filters'][] = array('key' => 'is_starred', 'value' => (bool) $star);
}
if (!is_null($read)) {
$search_criteria['field_filters'][] = array('key' => 'is_read', 'value' => (bool) $read);
}
$search_field_id = rgget('field_id');
if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
$key = $search_field_id;
$val = rgget('s');
$strpos_row_key = strpos($search_field_id, '|');
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode('|', $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ':' . $val;
}
$search_criteria['field_filters'][] = array('key' => $key, 'operator' => rgempty('operator', $_GET) ? 'is' : rgget('operator'), 'value' => $val);
$type = rgget('type');
if (empty($type)) {
if (rgget('field_id') == '0') {
$search_criteria['type'] = 'global';
}
}
}
$paging = array('offset' => $position, 'page_size' => 1);
if (!empty($sort_field)) {
$sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
} else {
$sorting = array();
}
$total_count = 0;
$leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
$prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
$next_pos = !rgblank($position) && $position < $total_count - 1 ? $position + 1 : false;
// unread filter requires special handling for pagination since entries are filter out of the query as they are read
if ($filter == 'unread') {
$next_pos = $position;
if ($next_pos + 1 == $total_count) {
$next_pos = false;
}
}
if (!$lead_id) {
$lead = !empty($leads) ? $leads[0] : false;
} else {
$lead = GFAPI::get_entry($lead_id);
}
if (!$lead) {
esc_html_e("Oops! We couldn't find your entry. Please try again", 'gravityforms');
return;
}
RGFormsModel::update_lead_property($lead['id'], 'is_read', 1);
switch (RGForms::post('action')) {
case 'update':
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
//Loading files that have been uploaded to temp folder
$files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
if (!is_array($files)) {
$files = array();
}
GFFormsModel::$uploaded_files[$form_id] = $files;
GFFormsModel::save_lead($form, $lead);
do_action('gform_after_update_entry', $form, $lead['id']);
do_action("gform_after_update_entry_{$form['id']}", $form, $lead['id']);
$lead = RGFormsModel::get_lead($lead['id']);
$lead = GFFormsModel::set_entry_meta($lead, $form);
break;
case 'add_note':
check_admin_referer('gforms_update_note', 'gforms_update_note');
$user_data = get_userdata($current_user->ID);
RGFormsModel::add_note($lead['id'], $current_user->ID, $user_data->display_name, stripslashes($_POST['new_note']));
//emailing notes if configured
if (rgpost('gentry_email_notes_to')) {
GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Preparing to email entry notes.');
$email_to = $_POST['gentry_email_notes_to'];
$email_from = $current_user->user_email;
$email_subject = stripslashes($_POST['gentry_email_subject']);
$body = stripslashes($_POST['new_note']);
$headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
//.........这里部分代码省略.........
示例12: update_page
public static function update_page()
{
if (!GFCommon::current_user_can_any("gravityforms_view_updates")) {
wp_die(__("You don't have permissions to view this page", "gravityforms"));
}
if (!GFCommon::ensure_wp_version()) {
return;
}
GFCommon::cache_remote_message();
echo GFCommon::get_remote_message();
?>
<link rel="stylesheet" href="<?php
echo GFCommon::get_base_url() . "/css/admin.css";
?>
" />
<div class="wrap">
<div class="icon32" id="gravity-update-icon"><br></div>
<h2><?php
echo _e("Gravity Forms Updates", "gravityforms");
?>
</h2>
<?php
$version_info = GFCommon::get_version_info(false);
if (version_compare(GFCommon::$version, $version_info["version"], '<')) {
$plugin_file = "gravityforms/gravityforms.php";
$upgrade_url = wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . urlencode($plugin_file), 'upgrade-plugin_' . $plugin_file);
$message = __("There is a new version of Gravity Forms available.", "gravityforms");
if ($version_info["is_valid_key"]) {
?>
<div class="gf_update_outdated alert_yellow">
<?php
echo $message . " " . sprintf(__("<p>You can update to the latest version automatically or download the update and install it manually. %sUpdate Automatically%s %sDownload Update%s", "gravityforms"), "</p><a class='button-primary' href='{$upgrade_url}'>", "</a>", " <a class='button' href='{$version_info["url"]}'>", "</a>");
?>
</div>
<?php
} else {
?>
<div class="gf_update_expired alert_red">
<?php
echo $message . " " . __('<a href="admin.php?page=gf_settings">Register</a> your copy of Gravity Forms to receive access to automatic updates and support. Need a license key? <a href="http://www.gravityforms.com">Purchase one now</a>.', 'gravityforms');
?>
</div>
<?php
}
echo "<br/><br/>";
$changelog = RGForms::get_changelog();
echo $changelog;
} else {
?>
<div class="gf_update_current alert_green">
<?php
_e("Your version of Gravity Forms is up to date.", "gravityforms");
?>
</div>
<?php
}
?>
<div id='gform_upgrade_license' style="display:none;"></div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery.post(ajaxurl,{
action:"gf_upgrade_license",
gf_upgrade_license: "<?php
echo wp_create_nonce("gf_upgrade_license");
?>
",
cookie: encodeURIComponent(document.cookie)},
function(data){
if(data.trim().length > 0)
jQuery("#gform_upgrade_license").replaceWith(data);
}
);
});
</script>
</div>
<?php
}
示例13: help_page
public static function help_page()
{
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
?>
<link rel="stylesheet" href="<?php
echo GFCommon::get_base_url();
?>
/css/admin.css"/>
<div class="wrap <?php
echo GFCommon::get_browser_class();
?>
">
<h2><?php
_e("Gravity Forms Help", "gravityforms");
?>
</h2>
<div style="margin-top:10px;">
<div
class="gforms_help_alert alert_yellow"><?php
_e("<strong>IMPORTANT NOTICE:</strong> We do not provide support via e-mail. Please <a href='http://www.gravityhelp.com/support/' target='_blank'>open a support ticket</a>.", "gravityforms");
?>
</div>
<div><?php
_e("Please review the plugin documentation and <a href='http://www.gravityhelp.com/frequently-asked-questions/'>frequently asked questions (FAQ)</a> first. If you still can't find the answer <a href='http://www.gravityhelp.com/support/' target='_blank'>open a support ticket</a> and we will be happy to answer your questions and assist you with any problems. <strong>Please note:</strong> If you have not <a href='http://www.gravityforms.com/purchase-gravity-forms/'>purchased a license</a> from us, you won't have access to these help resources.", "gravityforms");
?>
</div>
<div class="hr-divider"></div>
<h3><?php
_e("Gravity Forms Documentation", "gravityforms");
?>
</h3>
<ul style="margin-top:15px;">
<li>
<div class="gforms_helpbox">
<form name="jump">
<select name="menu">
<!-- begin documentation listing -->
<option
selected><?php
_e("Documentation (please select a topic)", "gravityforms");
?>
</option>
<option
value="http://gravityhelp.com/documentation/page/Getting_Started"><?php
_e("Getting Started", "gravityforms");
?>
</option>
<option
value="http://gravityhelp.com/documentation/page/Using_Gravity_Forms"><?php
_e("Using Gravity Forms", "gravityforms");
?>
</option>
<option
value="http://gravityhelp.com/documentation/page/Design_and_Layout"><?php
_e("Design and Layout", "gravityforms");
?>
</option>
<option
value="http://gravityhelp.com/documentation/page/Developer_Docs"><?php
_e("Developer Docs", "gravityforms");
?>
</option>
<option
value="http://gravityhelp.com/documentation/page/Add-ons"><?php
_e("Add-Ons", "gravityforms");
?>
</option>
<option
value="http://gravityhelp.com/documentation/page/How_To"><?php
_e("How To", "gravityforms");
?>
</option>
<!-- end documentation listing -->
</select>
<input type="button" class="button"
onClick="window.open(document.jump.menu.options[document.jump.menu.selectedIndex].value);"
value="<?php
_e("GO", "gravityforms");
?>
">
</form>
</div>
</li>
</ul>
<div class="hr-divider"></div>
<h3><?php
_e("Gravity Forms FAQ", "gravityforms");
//.........这里部分代码省略.........
示例14: leads_page
public static function leads_page($form_id)
{
global $wpdb;
//quit if version of wp is not supported
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post("action");
switch ($action) {
case "delete":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$lead_id = $_POST["action_argument"];
RGFormsModel::delete_lead($lead_id);
break;
case "bulk":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$bulk_action = !empty($_POST["bulk_action"]) ? $_POST["bulk_action"] : $_POST["bulk_action2"];
$leads = $_POST["lead"];
switch ($bulk_action) {
case "delete":
RGFormsModel::delete_leads($leads);
break;
case "mark_read":
RGFormsModel::update_leads_property($leads, "is_read", 1);
break;
case "mark_unread":
RGFormsModel::update_leads_property($leads, "is_read", 0);
break;
case "add_star":
RGFormsModel::update_leads_property($leads, "is_starred", 1);
break;
case "remove_star":
RGFormsModel::update_leads_property($leads, "is_starred", 0);
break;
}
break;
case "change_columns":
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$columns = GFCommon::json_decode(stripslashes($_POST["grid_columns"]), true);
RGFormsModel::update_grid_column_meta($form_id, $columns);
break;
}
$sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
$sort_direction = empty($_GET["dir"]) ? "DESC" : $_GET["dir"];
$search = RGForms::get("s");
$page_index = empty($_GET["paged"]) ? 0 : intval($_GET["paged"]) - 1;
$star = is_numeric(RGForms::get("star")) ? intval(RGForms::get("star")) : null;
$read = is_numeric(RGForms::get("read")) ? intval(RGForms::get("read")) : null;
$page_size = 20;
$first_item_index = $page_index * $page_size;
$form = RGFormsModel::get_form_meta($form_id);
$sort_field_meta = RGFormsModel::get_field($form, $sort_field);
$is_numeric = $sort_field_meta["type"] == "number";
$leads = RGFormsModel::get_leads($form_id, $sort_field, $sort_direction, $search, $first_item_index, $page_size, $star, $read, $is_numeric);
$lead_count = RGFormsModel::get_lead_count($form_id, $search, $star, $read);
$summary = RGFormsModel::get_form_counts($form_id);
$total_lead_count = $summary["total"];
$unread_count = $summary["unread"];
$starred_count = $summary["starred"];
$columns = RGFormsModel::get_grid_columns($form_id, true);
$search_qs = empty($search) ? "" : "&s=" . urlencode($search);
$sort_qs = empty($sort_field) ? "" : "&sort={$sort_field}";
$dir_qs = empty($sort_field) ? "" : "&dir={$sort_direction}";
$star_qs = $star !== null ? "&star={$star}" : "";
$read_qs = $read !== null ? "&read={$read}" : "";
$page_links = paginate_links(array('base' => admin_url("admin.php") . "?page=gf_entries&view=entries&id={$form_id}&%_%" . $search_qs . $sort_qs . $dir_qs . $star_qs . $read_qs, 'format' => 'paged=%#%', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($lead_count / $page_size), 'current' => $page_index + 1, 'show_all' => false));
wp_print_scripts(array("thickbox"));
wp_print_styles(array("thickbox"));
?>
<script src="<?php
echo GFCommon::get_base_url();
?>
/js/jquery.json-1.3.js?ver=<?php
echo GFCommon::$version;
?>
"></script>
<script>
function ChangeColumns(columns){
jQuery("#action").val("change_columns");
jQuery("#grid_columns").val(jQuery.toJSON(columns));
tb_remove();
jQuery("#lead_form")[0].submit();
}
function Search(sort_field_id, sort_direction, form_id, search, star, read){
var search_qs = search == "" ? "" : "&s=" + search;
var star_qs = star == "" ? "" : "&star=" + star;
var read_qs = read == "" ? "" : "&read=" + read;
var location = "?page=gf_entries&view=entries&id=" + form_id + "&sort=" + sort_field_id + "&dir=" + sort_direction + search_qs + star_qs + read_qs;
document.location = location;
}
function ToggleStar(img, lead_id){
var is_starred = img.src.indexOf("star1.png") >=0
if(is_starred)
img.src = img.src.replace("star1.png", "star0.png");
//.........这里部分代码省略.........
示例15: lead_detail_page
public static function lead_detail_page()
{
global $wpdb;
global $current_user;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$form = RGFormsModel::get_form_meta($_GET["id"]);
$form_id = $form["id"];
$form = apply_filters("gform_admin_pre_render_" . $form["id"], apply_filters("gform_admin_pre_render", $form));
$lead_id = rgget('lid');
$filter = rgget("filter");
$status = in_array($filter, array("trash", "spam")) ? $filter : "active";
$position = rgget('pos') ? rgget('pos') : 0;
$sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
$sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
$sort_field_meta = RGFormsModel::get_field($form, $sort_field);
$is_numeric = $sort_field_meta["type"] == "number";
$star = $filter == "star" ? 1 : null;
$read = $filter == "unread" ? 0 : null;
$search_criteria["status"] = $status;
if ($star) {
$search_criteria["field_filters"][] = array("key" => "is_starred", "value" => (bool) $star);
}
if (!is_null($read)) {
$search_criteria["field_filters"][] = array("key" => "is_read", "value" => (bool) $read);
}
$search_field_id = rgget("field_id");
if (isset($_GET["field_id"]) && $_GET["field_id"] !== '') {
$key = $search_field_id;
$val = rgget("s");
$strpos_row_key = strpos($search_field_id, "|");
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode("|", $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ":" . $val;
}
$type = rgget("type");
if (empty($type)) {
$type = rgget("field_id") == "0" ? "global" : "field";
}
$search_criteria["field_filters"][] = array("key" => $key, "type" => $type, "operator" => rgempty("operator", $_GET) ? "is" : rgget("operator"), "value" => $val);
}
$paging = array('offset' => $position, 'page_size' => 1);
if (!empty($sort_field)) {
$sorting = array('key' => $_GET["sort"], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
} else {
$sorting = array();
}
$total_count = 0;
$leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
$prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
$next_pos = !rgblank($position) && $position < $total_count - 1 ? $position + 1 : false;
// unread filter requires special handling for pagination since entries are filter out of the query as they are read
if ($filter == 'unread') {
$next_pos = $position;
if ($next_pos + 1 == $total_count) {
$next_pos = false;
}
}
if (!$lead_id) {
$lead = !empty($leads) ? $leads[0] : false;
} else {
$lead = GFAPI::get_entry($lead_id);
}
if (!$lead) {
_e("Oops! We couldn't find your entry. Please try again", "gravityforms");
return;
}
RGFormsModel::update_lead_property($lead["id"], "is_read", 1);
switch (RGForms::post("action")) {
case "update":
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
//Loading files that have been uploaded to temp folder
$files = GFCommon::json_decode(stripslashes(RGForms::post("gform_uploaded_files")));
if (!is_array($files)) {
$files = array();
}
GFFormsModel::$uploaded_files[$form_id] = $files;
GFFormsModel::save_lead($form, $lead);
do_action("gform_after_update_entry", $form, $lead["id"]);
do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]);
$lead = RGFormsModel::get_lead($lead["id"]);
$lead = GFFormsModel::set_entry_meta($lead, $form);
break;
case "add_note":
check_admin_referer('gforms_update_note', 'gforms_update_note');
$user_data = get_userdata($current_user->ID);
RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"]));
//emailing notes if configured
if (rgpost("gentry_email_notes_to")) {
$email_to = $_POST["gentry_email_notes_to"];
$email_from = $current_user->user_email;
$email_subject = stripslashes($_POST["gentry_email_subject"]);
$headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
$result = wp_mail($email_to, $email_subject, stripslashes($_POST["new_note"]), $headers);
}
break;
//.........这里部分代码省略.........