本文整理汇总了PHP中rgempty函数的典型用法代码示例。如果您正苦于以下问题:PHP rgempty函数的具体用法?PHP rgempty怎么用?PHP rgempty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rgempty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($slug, $config)
{
$this->_slug = $slug;
$this->_title = rgar($config, "title");
$this->_search_title = rgempty("search_title", $config) ? __("Results Filters", "gravityforms") : rgar($config, "search_title");
$this->_callbacks = isset($config["callbacks"]) ? $config["callbacks"] : array();
$this->_capabilities = isset($config["capabilities"]) ? $config["capabilities"] : array();
}
示例2: __construct
public function __construct($slug, $config)
{
$this->_slug = $slug;
$this->_title = rgar($config, 'title');
$this->_icon = rgar($config, 'icon');
$this->_search_title = rgempty('search_title', $config) ? esc_html__('Results Filters', 'gravityforms') : rgar($config, 'search_title');
$this->_callbacks = isset($config['callbacks']) ? $config['callbacks'] : array();
$this->_capabilities = isset($config['capabilities']) ? $config['capabilities'] : array();
}
示例3: process_exterior_pages
public static function process_exterior_pages()
{
if (rgempty("gf_page", $_GET)) {
return;
}
//ensure users are logged in
if (!is_user_logged_in()) {
auth_redirect();
}
switch (rgget("gf_page")) {
case "directory_columns":
require_once "select_directory_columns.php";
break;
}
exit;
}
示例4: validate
public function validate($value, $form)
{
$email = is_array($value) ? rgar($value, 0) : $value;
// Form objects created in 1.8 will supply a string as the value.
$is_blank = rgblank($value) || is_array($value) && rgempty(array_filter($value));
if (!$is_blank && !GFCommon::is_valid_email($email)) {
$this->failed_validation = true;
$this->validation_message = empty($this->errorMessage) ? esc_html__('Please enter a valid email address.', 'gravityforms') : $this->errorMessage;
} elseif ($this->emailConfirmEnabled && !empty($email)) {
$confirm = is_array($value) ? rgar($value, 1) : rgpost('input_' . $this->id . '_2');
if ($confirm != $email) {
$this->failed_validation = true;
$this->validation_message = esc_html__('Your emails do not match.', 'gravityforms');
}
}
}
示例5: process_exterior_pages
function process_exterior_pages()
{
if (rgempty("gf_pdf", $_GET)) {
return;
}
//ensure users are logged in
if (!is_user_logged_in()) {
auth_redirect();
}
switch (rgget("gf_pdf")) {
case "print-entry":
require_once "render_to_pdf.php";
break;
}
exit;
}
示例6: validate
public function validate($value, $form)
{
if (is_array($value) && rgempty(0, $value) && rgempty(1, $value) && rgempty(2, $value)) {
$value = null;
}
if (!empty($value)) {
$format = empty($this->dateFormat) ? 'mdy' : $this->dateFormat;
$date = GFCommon::parse_date($value, $format);
if (empty($date) || !$this->checkdate($date['month'], $date['day'], $date['year'])) {
$this->failed_validation = true;
$format_name = '';
switch ($format) {
case 'mdy':
$format_name = 'mm/dd/yyyy';
break;
case 'dmy':
$format_name = 'dd/mm/yyyy';
break;
case 'dmy_dash':
$format_name = 'dd-mm-yyyy';
break;
case 'dmy_dot':
$format_name = 'dd.mm.yyyy';
break;
case 'ymd_slash':
$format_name = 'yyyy/mm/dd';
break;
case 'ymd_dash':
$format_name = 'yyyy-mm-dd';
break;
case 'ymd_dot':
$format_name = 'yyyy.mm.dd';
break;
}
$message = $this->dateType == 'datepicker' ? sprintf(esc_html__('Please enter a valid date in the format (%s).', 'gravityforms'), $format_name) : esc_html__('Please enter a valid date.', 'gravityforms');
$this->validation_message = empty($this->errorMessage) ? $message : $this->errorMessage;
}
}
}
示例7: page_header
public static function page_header($title = '')
{
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min';
// register admin styles
wp_register_style('gform_admin', GFCommon::get_base_url() . "/css/admin{$min}.css");
wp_print_styles(array('jquery-ui-styles', 'gform_admin'));
$current_tab = rgempty('view', $_GET) ? 'export_entry' : rgget('view');
$setting_tabs = self::get_tabs();
// kind of boring having to pass the title, optionally get it from the settings tab
if (!$title) {
foreach ($setting_tabs as $tab) {
if ($tab['name'] == $current_tab) {
$title = $tab['name'];
}
}
}
?>
<div class="wrap <?php
echo sanitize_html_class($current_tab);
?>
">
<h2><?php
echo esc_html($title);
?>
</h2>
<?php
GFCommon::display_admin_message();
?>
<div id="gform_tab_group" class="gform_tab_group vertical_tabs">
<ul id="gform_tabs" class="gform_tabs">
<?php
foreach ($setting_tabs as $tab) {
$query = array('view' => $tab['name']);
if (isset($tab['query'])) {
$query = array_merge($query, $tab['query']);
}
$url = add_query_arg($query);
?>
<li <?php
echo $current_tab == $tab['name'] ? "class='active'" : '';
?>
>
<a href="<?php
echo esc_url($url);
?>
"><?php
echo esc_html($tab['label']);
?>
</a>
</li>
<?php
}
?>
</ul>
<div id="gform_tab_container" class="gform_tab_container">
<div class="gform_tab_content" id="tab_<?php
echo esc_attr($current_tab);
?>
">
<?php
}
示例8: is_entry_list
protected function is_entry_list()
{
if (rgget("page") == "gf_entries" && rgempty("view", $_GET)) {
return true;
}
return false;
}
示例9: get_field_label
/**
* Retrieve the field label.
*
* @param bool $force_frontend_label Should the frontend label be displayed in the admin even if an admin label is configured.
* @param string $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
*
* @return string
*/
public function get_field_label($force_frontend_label, $value)
{
$field_label = $force_frontend_label ? $this->label : GFCommon::get_label($this);
if (($this->inputType == 'singleproduct' || $this->inputType == 'calculation') && !rgempty($this->id . '.1', $value)) {
$field_label = rgar($value, $this->id . '.1');
}
return $field_label;
}
示例10: toolbar_class
private static function toolbar_class($item)
{
switch ($item) {
case 'editor':
if (in_array(rgget('page'), array('gf_edit_forms', 'gf_new_form')) && rgempty('view', $_GET)) {
return 'gf_toolbar_active';
}
break;
case 'settings':
if (rgget('view') == 'settings') {
return 'gf_toolbar_active';
}
break;
case 'notifications':
if (rgget('page') == 'gf_new_form') {
return 'gf_toolbar_disabled';
} else {
if (rgget('page') == 'gf_edit_forms' && rgget('view') == 'notification') {
return 'gf_toolbar_active';
}
}
break;
case 'entries':
if (rgget('page') == 'gf_new_form') {
return 'gf_toolbar_disabled';
} else {
if (rgget('page') == 'gf_entries' && rgempty('view', $_GET)) {
return 'gf_toolbar_active';
}
}
break;
case 'preview':
if (rgget('page') == 'gf_new_form') {
return 'gf_toolbar_disabled';
}
break;
}
return '';
}
示例11: get_sales_data
protected function get_sales_data($form_id, $search, $state)
{
global $wpdb;
$data = array('chart' => array('hAxis' => array(), 'vAxis' => array('column' => 'revenue', 'label' => esc_html__('Revenue', 'gravityforms'))), 'table' => array('header' => array('orders' => esc_html__('Orders', 'gravityforms'), 'subscriptions' => esc_html__('Subscriptions', 'gravityforms'), 'recurring_payments' => esc_html__('Recurring Payments', 'gravityforms'), 'refunds' => esc_html__('Refunds', 'gravityforms'), 'revenue' => esc_html__('Revenue', 'gravityforms'))), 'rows' => array());
$tz_offset = $this->get_mysql_tz_offset();
$page_size = 10;
$group = strtolower(rgpost('group'));
switch ($group) {
case 'weekly':
$select = "concat(left(lead.week,4), ' - ', right(lead.week,2)) as week";
$select_inner1 = "yearweek(CONVERT_TZ(date_created, '+00:00', '" . $tz_offset . "')) week";
$select_inner2 = "yearweek(CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "')) week";
$group_by = 'week';
$order_by = 'week desc';
$join = 'lead.week = transaction.week';
$data['chart']['hAxis']['column'] = 'week';
$data['chart']['hAxis']['label'] = esc_html__('Week', 'gravityforms');
$data['table']['header'] = array_merge(array('week' => esc_html__('Week', 'gravityforms')), $data['table']['header']);
break;
case 'monthly':
$select = "date_format(lead.month, '%%Y') as year, date_format(lead.month, '%%c') as month, '' as month_abbrev, '' as month_year";
$select_inner1 = "date_format(CONVERT_TZ(date_created, '+00:00', '" . $tz_offset . "'), '%%Y-%%m-01') month";
$select_inner2 = "date_format(CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "'), '%%Y-%%m-01') month";
$group_by = 'month';
$order_by = 'year desc, month desc';
$join = 'lead.month = transaction.month';
$data['chart']['hAxis']['column'] = 'month_abbrev';
$data['chart']['hAxis']['label'] = esc_html__('Month', 'gravityforms');
$data['table']['header'] = array_merge(array('month_year' => esc_html__('Month', 'gravityforms')), $data['table']['header']);
break;
default:
//daily
$select = "lead.date, date_format(lead.date, '%%c') as month, day(lead.date) as day, dayname(lead.date) as day_of_week, '' as month_day";
$select_inner1 = "date(CONVERT_TZ(date_created, '+00:00', '" . $tz_offset . "')) as date";
$select_inner2 = "date(CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "')) as date";
$group_by = 'date';
$order_by = 'date desc';
$join = 'lead.date = transaction.date';
$data['chart']['hAxis']['column'] = 'month_day';
$data['chart']['hAxis']['label'] = esc_html__('Day', 'gravityforms');
$data['table']['header'] = array_merge(array('date' => esc_html__('Date', 'gravityforms'), 'day_of_week' => esc_html__('Day', 'gravityforms')), $data['table']['header']);
break;
}
$lead_date_filter = '';
$transaction_date_filter = '';
if (isset($search['start_date'])) {
$lead_date_filter = $wpdb->prepare(" AND timestampdiff(SECOND, %s, CONVERT_TZ(l.date_created, '+00:00', '" . $tz_offset . "')) >= 0", $search['start_date']);
$transaction_date_filter = $wpdb->prepare(" AND timestampdiff(SECOND, %s, CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "')) >= 0", $search['start_date']);
}
if (isset($search['end_date'])) {
$lead_date_filter .= $wpdb->prepare(" AND timestampdiff(SECOND, %s, CONVERT_TZ(l.date_created, '+00:00', '" . $tz_offset . "')) <= 0", $search['end_date']);
$transaction_date_filter .= $wpdb->prepare(" AND timestampdiff(SECOND, %s, CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "')) <= 0", $search['end_date']);
}
$payment_method = rgpost('payment_method');
$payment_method_filter = '';
if (!empty($payment_method)) {
$payment_method_filter = $wpdb->prepare(' AND l.payment_method=%s', $payment_method);
}
$current_page = rgempty('paged') ? 1 : absint(rgpost('paged'));
$offset = $page_size * ($current_page - 1);
$sql = $wpdb->prepare(" SELECT SQL_CALC_FOUND_ROWS {$select}, lead.orders, lead.subscriptions, transaction.refunds, transaction.recurring_payments, transaction.revenue\n FROM (\n SELECT {$select_inner1},\n sum( if(transaction_type = 1,1,0) ) as orders,\n sum( if(transaction_type = 2,1,0) ) as subscriptions\n FROM {$wpdb->prefix}rg_lead l\n WHERE l.status='active' AND form_id=%d {$lead_date_filter} {$payment_method_filter}\n GROUP BY {$group_by}\n ) AS lead\n\n LEFT OUTER JOIN(\n SELECT {$select_inner2},\n sum( if(t.transaction_type = 'refund', abs(t.amount) * -1, t.amount) ) as revenue,\n sum( if(t.transaction_type = 'refund', 1, 0) ) as refunds,\n sum( if(t.transaction_type = 'payment' AND t.is_recurring = 1, 1, 0) ) as recurring_payments\n FROM {$wpdb->prefix}gf_addon_payment_transaction t\n INNER JOIN {$wpdb->prefix}rg_lead l ON l.id = t.lead_id\n WHERE l.status='active' AND l.form_id=%d {$lead_date_filter} {$transaction_date_filter} {$payment_method_filter}\n GROUP BY {$group_by}\n\n ) AS transaction on {$join}\n ORDER BY {$order_by}\n LIMIT {$page_size} OFFSET {$offset}\n ", $form_id, $form_id);
$results = $wpdb->get_results($sql, ARRAY_A);
foreach ($results as &$result) {
$result['orders'] = intval($result['orders']);
$result['subscriptions'] = intval($result['subscriptions']);
$result['refunds'] = intval($result['refunds']);
$result['recurring_payments'] = intval($result['recurring_payments']);
$result['revenue'] = floatval($result['revenue']);
$result = $this->format_chart_h_axis($result);
}
$data['row_count'] = $wpdb->get_var('SELECT FOUND_ROWS()');
$data['page_size'] = $page_size;
$data['rows'] = $results;
return $data;
}
示例12: get_post_category_values
public static function get_post_category_values()
{
$has_input_name = strtolower(rgpost('inputName')) != 'false';
$id = !$has_input_name ? rgpost('objectType') . '_rule_value_' . rgpost('ruleIndex') : rgpost('inputName');
$selected = rgempty('selectedValue') ? 0 : rgpost('selectedValue');
$dropdown = wp_dropdown_categories(array('class' => 'gfield_rule_select gfield_rule_value_dropdown gfield_category_dropdown', 'orderby' => 'name', 'id' => $id, 'name' => $id, 'selected' => $selected, 'hierarchical' => true, 'hide_empty' => 0, 'echo' => false));
die($dropdown);
}
示例13: update_lead
public static function update_lead($lead)
{
_deprecated_function('GFFormsModel::update_lead()', '1.8.8', 'GFAPI::update_entry()');
global $wpdb;
$lead_table = self::get_lead_table_name();
$payment_date = strtotime(rgar($lead, 'payment_date')) ? "'" . gmdate('Y-m-d H:i:s', strtotime("{$lead['payment_date']}")) . "'" : 'NULL';
$payment_amount = !rgblank(rgar($lead, 'payment_amount')) ? (double) rgar($lead, 'payment_amount') : 'NULL';
$transaction_type = !rgempty('transaction_type', $lead) ? intval($lead['transaction_type']) : 'NULL';
$status = !rgempty('status', $lead) ? $lead['status'] : 'active';
$source_url = self::truncate(rgar($lead, 'source_url'), 200);
$user_agent = self::truncate(rgar($lead, 'user_agent'), 250);
$sql = $wpdb->prepare("UPDATE {$lead_table} SET\n\t\t\t\tform_id=%d,\n\t\t\t\tpost_id=%d,\n\t\t\t\tis_starred=%d,\n\t\t\t\tis_read=%d,\n\t\t\t\tip=%s,\n\t\t\t\tsource_url=%s,\n\t\t\t\tuser_agent=%s,\n\t\t\t\tcurrency=%s,\n\t\t\t\tpayment_status=%s,\n\t\t\t\tpayment_date={$payment_date},\n\t\t\t\tpayment_amount={$payment_amount},\n\t\t\t\ttransaction_id=%s,\n\t\t\t\tis_fulfilled=%d,\n\t\t\t\ttransaction_type={$transaction_type},\n\t\t\t\tpayment_method=%s,\n\t\t\t\tstatus='{$status}'\n\t\t WHERE id=%d", rgar($lead, 'form_id'), rgar($lead, 'post_id'), rgar($lead, 'is_starred'), rgar($lead, 'is_read'), rgar($lead, 'ip'), $source_url, $user_agent, rgar($lead, 'currency'), rgar($lead, 'payment_status'), rgar($lead, 'transaction_id'), rgar($lead, 'is_fulfilled'), rgar($lead, 'payment_method'), rgar($lead, 'id'));
$wpdb->query($sql);
self::set_current_lead($lead);
}
示例14: get_current_feed_id
public function get_current_feed_id()
{
if ($this->_current_feed_id) {
return $this->_current_feed_id;
} else {
if (!rgempty('gf_feed_id')) {
return rgpost('gf_feed_id');
} else {
return rgget('fid');
}
}
}
示例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;
//.........这里部分代码省略.........