本文整理汇总了PHP中FrmDb::get_count方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmDb::get_count方法的具体用法?PHP FrmDb::get_count怎么用?PHP FrmDb::get_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmDb
的用法示例。
在下文中一共展示了FrmDb::get_count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_items
public function prepare_items()
{
global $wpdb, $per_page, $mode;
$mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
$default_orderby = 'name';
$default_order = 'ASC';
$orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : $default_orderby;
$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $default_order;
$page = $this->get_pagenum();
$per_page = $this->get_items_per_page('formidable_page_formidable_per_page');
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : ($page - 1) * $per_page;
$s_query = array();
$s_query[] = array('or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1);
switch ($this->status) {
case 'template':
$s_query['is_template'] = 1;
$s_query['status !'] = 'trash';
break;
case 'draft':
$s_query['is_template'] = 0;
$s_query['status'] = 'draft';
break;
case 'trash':
$s_query['status'] = 'trash';
break;
default:
$s_query['is_template'] = 0;
$s_query['status !'] = 'trash';
break;
}
$s = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
if ($s != '') {
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
$search_terms = array_map('trim', $matches[0]);
foreach ((array) $search_terms as $term) {
$s_query[] = array('or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term);
unset($term);
}
}
$this->items = FrmForm::getAll($s_query, $orderby . ' ' . $order, $start . ',' . $per_page);
$total_items = FrmDb::get_count('frm_forms', $s_query);
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
}
示例2: generate_csv
public static function generate_csv($atts)
{
global $frm_vars;
$frm_vars['prevent_caching'] = true;
self::$fields = $atts['form_cols'];
self::$form_id = $atts['form']->id;
self::set_class_paramters();
$filename = apply_filters('frm_csv_filename', date('ymdHis', time()) . '_' . sanitize_title_with_dashes($atts['form']->name) . '_formidable_entries.csv', $atts['form']);
unset($atts['form'], $atts['form_cols']);
self::print_file_headers($filename);
unset($filename);
$comment_count = FrmDb::get_count('frm_item_metas', array('item_id' => $atts['entry_ids'], 'field_id' => 0, 'meta_value like' => '{'), array('group_by' => 'item_id', 'order_by' => 'count(*) DESC', 'limit' => 1));
self::$comment_count = $comment_count;
self::prepare_csv_headings();
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_set = array_splice($atts['entry_ids'], 0, 20)) {
self::prepare_next_csv_rows($next_set);
}
}
示例3: _deprecated_function
/**
* @param string $table_name
*/
public static function &getRecordCount($where = '', $table_name)
{
_deprecated_function(__FUNCTION__, '2.0', 'FrmDb::get_count');
$count = FrmDb::get_count($table_name, $where);
return $count;
}
示例4: duplicate
public static function duplicate()
{
check_ajax_referer('frm_ajax', 'nonce');
global $wpdb;
$field_id = FrmAppHelper::get_post_param('field_id', 0, 'absint');
$form_id = FrmAppHelper::get_post_param('form_id', 0, 'absint');
$copy_field = FrmField::getOne($field_id);
if (!$copy_field) {
wp_die();
}
do_action('frm_duplicate_field', $copy_field, $form_id);
do_action('frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id);
$values = array('id' => $form_id);
FrmFieldsHelper::fill_field($values, $copy_field, $form_id);
$field_count = FrmDb::get_count($wpdb->prefix . 'frm_fields fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id)', array('or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id));
$values['field_order'] = $field_count + 1;
if (!($field_id = FrmField::create($values))) {
wp_die();
}
self::include_single_field($field_id, $values);
wp_die();
}
示例5: getRecordCount
public static function getRecordCount($where = '')
{
global $wpdb;
$table_join = $wpdb->prefix . 'frm_items it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
if (is_numeric($where)) {
$table_join = 'frm_items';
$where = array('form_id' => $where);
}
if (is_array($where)) {
$count = FrmDb::get_count($table_join, $where);
} else {
global $wpdb;
$cache_key = 'count_' . maybe_serialize($where);
$query = 'SELECT COUNT(*) FROM ' . $table_join . FrmAppHelper::prepend_and_or_where(' WHERE ', $where);
$count = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_var');
}
return $count;
}
示例6: duplicate_section
public static function duplicate_section($section_field, $form_id)
{
check_ajax_referer('frm_ajax', 'nonce');
global $wpdb;
if (isset($_POST['children'])) {
$children = array_filter((array) $_POST['children'], 'is_numeric');
$fields = FrmField::getAll(array('fi.id' => $children), 'field_order');
} else {
$fields = array();
}
array_unshift($fields, $section_field);
$field_count = FrmDb::get_count($wpdb->prefix . 'frm_fields fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id)', array('or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id));
$ended = false;
if (isset($section_field->field_options['repeat']) && $section_field->field_options['repeat']) {
// create the repeatable form
$new_form_id = FrmProField::create_repeat_form(0, array('parent_form_id' => $form_id, 'field_name' => $section_field->name));
} else {
$new_form_id = $form_id;
}
foreach ($fields as $field) {
// keep the current form id or give it the id of the newly created form
$this_form_id = $field->form_id == $form_id ? $form_id : $new_form_id;
$values = array();
FrmFieldsHelper::fill_field($values, $field, $this_form_id);
if (FrmField::is_repeating_field($field)) {
$values['field_options']['form_select'] = $new_form_id;
}
$field_count++;
$values['field_order'] = $field_count;
$field_id = FrmField::create($values);
if (!$field_id) {
continue;
}
if ('end_divider' == $field->type) {
$ended = true;
}
$values['id'] = $this_form_id;
FrmFieldsController::include_single_field($field_id, $values);
}
if (!$ended) {
//make sure the section is ended
self::create_multiple_fields((array) $section_field, $form_id);
}
// Prevent the function in the free version from completing
wp_die();
}