本文整理汇总了PHP中FrmDb::get_row方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmDb::get_row方法的具体用法?PHP FrmDb::get_row怎么用?PHP FrmDb::get_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmDb
的用法示例。
在下文中一共展示了FrmDb::get_row方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOne
/**
* @return object form
*/
public static function getOne($id, $blog_id = false)
{
global $wpdb;
if ($blog_id && is_multisite()) {
global $wpmuBaseTablePrefix;
$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix . $blog_id . '_' : $wpdb->get_blog_prefix($blog_id);
$table_name = $prefix . 'frm_forms';
} else {
$table_name = $wpdb->prefix . 'frm_forms';
$cache = wp_cache_get($id, 'frm_form');
if ($cache) {
if (isset($cache->options)) {
$cache->options = maybe_unserialize($cache->options);
}
return stripslashes_deep($cache);
}
}
if (is_numeric($id)) {
$where = array('id' => $id);
} else {
$where = array('form_key' => $id);
}
$results = FrmDb::get_row($table_name, $where);
if (isset($results->options)) {
wp_cache_set($results->id, $results, 'frm_form');
$results->options = maybe_unserialize($results->options);
}
return stripslashes_deep($results);
}
示例2: ajax_destroy
public static function ajax_destroy($form_id = false, $ajax = true, $echo = true)
{
global $wpdb, $frm_vars;
$entry_key = FrmAppHelper::get_param('entry', '', 'get', 'sanitize_title');
if (!$form_id) {
$form_id = FrmAppHelper::get_param('form_id', '', 'get', 'absint');
}
if (!$entry_key) {
return;
}
if (isset($frm_vars['deleted_entries']) && is_array($frm_vars['deleted_entries']) && in_array($entry_key, $frm_vars['deleted_entries'])) {
return;
}
if (is_numeric($entry_key)) {
$where = array('id' => $entry_key);
} else {
$where = array('item_key' => $entry_key);
}
$entry = FrmDb::get_row($wpdb->prefix . 'frm_items', $where, 'id, form_id, is_draft, user_id');
unset($where);
if (!$entry || $form_id && $entry->form_id != (int) $form_id) {
return;
}
$message = self::maybe_delete_entry($entry);
if ($message && !is_numeric($message)) {
if ($echo) {
echo '<div class="frm_message">' . $message . '</div>';
}
return;
}
if (!isset($frm_vars['deleted_entries']) || empty($frm_vars['deleted_entries'])) {
$frm_vars['deleted_entries'] = array();
}
$frm_vars['deleted_entries'][] = $entry->id;
if ($ajax && $echo) {
echo $message = 'success';
} else {
if (!$ajax) {
$message = apply_filters('frm_delete_message', __('Your entry was successfully deleted', 'formidable'), $entry);
if ($echo) {
echo '<div class="frm_message">' . $message . '</div>';
}
} else {
$message = '';
}
}
return $message;
}
示例3: get_form_custom_display
public static function get_form_custom_display($form_id)
{
global $wpdb;
$display_ids = self::get_display_ids_by_form($form_id);
if (!$display_ids) {
return false;
}
$display = FrmDb::get_row($wpdb->posts . ' p LEFT JOIN ' . $wpdb->postmeta . ' pm ON (p.ID = pm.post_ID)', array('pm.meta_key' => 'frm_show_count', 'post_type' => 'frm_display', 'p.ID' => $display_ids, 'pm.meta_value' => array('dynamic', 'calendar', 'one'), 'p.post_status' => 'publish'), 'p.*', array('order_by' => 'p.ID ASC'));
return $display;
}
示例4: get_user_id_values
/**
* Get values for user ID graph
*
* @since 2.0
*
* @param array $values
* @param array $labels
* @param array $tooltips
* @param boolean $pie - boolean for pie graph
* @param array $temp_values - temporary values
* @param object $field
*/
public static function get_user_id_values(&$values, &$labels, &$tooltips, &$pie, $temp_values, $field)
{
global $wpdb;
// Get form options
$form = FrmDb::get_row($wpdb->prefix . 'frm_forms', array('id' => $field->form_id));
$form_options = maybe_unserialize($form->options);
// Remove deleted users from values and show display name instead of user ID number
foreach ($temp_values as $user_id => $count) {
$user_info = get_userdata($user_id);
if (!$user_info) {
unset($temp_values[$user_id]);
continue;
}
$labels[] = $user_info ? $user_info->display_name : __('Deleted User', 'formidable');
$values[] = $count;
}
// If only one response per user, do a pie chart of users who have submitted the form
if (isset($form_options['single_entry']) && $form_options['single_entry'] && isset($form_options['single_entry_type']) && $form_options['single_entry_type'] == 'user') {
// Get number of users on site
$total_users = count(get_users());
// Get number of users that have completed entries
$id_count = count($values);
// Get the difference
$not_completed = (int) $total_users - (int) $id_count;
$labels = array(__('Completed', 'formidable'), __('Not Completed', 'formidable'));
$temp_values = array($id_count, $not_completed);
$pie = true;
} else {
if (count($labels) < 10) {
$pie = true;
}
}
$values = $temp_values;
}
示例5: _get_expected_entry_result
function _get_expected_entry_result($test, $entry_id)
{
if ($test > 0 && $test < 5) {
$e_result = FrmDb::get_row('frm_items', array('id' => $entry_id), 'post_id, id', array('order_by' => 'created_at DESC'));
} else {
if ($test >= 5) {
$e_result = false;
}
}
return $e_result;
}
示例6: get_content
public static function get_content($content)
{
global $post;
if (!$post) {
return $content;
}
$entry_id = false;
$filter = apply_filters('frm_filter_auto_content', true);
if ($post->post_type == self::$post_type && in_the_loop()) {
global $frm_displayed;
if (!$frm_displayed) {
$frm_displayed = array();
}
if (in_array($post->ID, $frm_displayed)) {
return $content;
}
$frm_displayed[] = $post->ID;
return self::get_display_data($post, $content, false, compact('filter'));
}
if (is_singular() && post_password_required()) {
return $content;
}
$display_id = get_post_meta($post->ID, 'frm_display_id', true);
if (!$display_id || !is_single() && !is_page()) {
return $content;
}
$display = FrmProDisplay::getOne($display_id);
if (!$display) {
return $content;
}
global $frm_displayed, $frm_display_position;
if ($post->post_type != self::$post_type) {
$display = FrmProDisplaysHelper::setup_edit_vars($display, false);
}
if (!isset($display->frm_insert_pos)) {
$display->frm_insert_pos = 1;
}
if (!$frm_displayed) {
$frm_displayed = array();
}
if (!$frm_display_position) {
$frm_display_position = array();
}
if (!isset($frm_display_position[$display->ID])) {
$frm_display_position[$display->ID] = 0;
}
$frm_display_position[$display->ID]++;
//make sure this isn't loaded multiple times but still works with themes and plugins that call the_content multiple times
if (!in_the_loop() || in_array($display->ID, (array) $frm_displayed) || $frm_display_position[$display->ID] < (int) $display->frm_insert_pos) {
return $content;
}
global $wpdb;
//get the entry linked to this post
if ((is_single() || is_page()) && $post->post_type != self::$post_type && ($display->frm_insert_loc == 'none' || $display->frm_insert_loc != 'none' && $display->frm_post_id != $post->ID)) {
$entry = FrmDb::get_row('frm_items', array('post_id' => $post->ID), 'id, item_key');
if (!$entry) {
return $content;
}
$entry_id = $entry->id;
if (in_array($display->frm_show_count, array('dynamic', 'calendar')) && $display->frm_type == 'display_key') {
$entry_id = $entry->item_key;
}
}
$frm_displayed[] = $display->ID;
$content = self::get_display_data($display, $content, $entry_id, array('filter' => $filter, 'auto_id' => $entry_id));
return $content;
}