本文整理汇总了PHP中FrmAppHelper::getRecordCount方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::getRecordCount方法的具体用法?PHP FrmAppHelper::getRecordCount怎么用?PHP FrmAppHelper::getRecordCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::getRecordCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_items
function prepare_items()
{
global $wpdb, $per_page, $frm_settings;
$paged = $this->get_pagenum();
$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();
$default_count = empty($this->page_name) ? 20 : 10;
$per_page = $this->get_items_per_page('formidable_page_formidable' . str_replace('-', '_', $this->page_name) . '_per_page', $default_count);
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : ($page - 1) * $per_page;
$s = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
$fid = isset($_REQUEST['fid']) ? $_REQUEST['fid'] : '';
if ($s != '') {
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
$search_terms = array_map('trim', $matches[0]);
}
$s_query = " (status is NULL OR status = '' OR status = 'published') AND default_template=0 AND is_template = " . (int) $this->params['template'];
if ($s != '') {
foreach ((array) $search_terms as $term) {
if (!empty($s_query)) {
$s_query .= " AND";
}
$term = FrmAppHelper::esc_like($term);
$s_query .= $wpdb->prepare(" (name like %s OR description like %s OR created_at like %s)", '%' . $term . '%', '%' . $term . '%', '%' . $term . '%');
unset($term);
}
}
$frm_form = new FrmForm();
$this->items = $frm_form->getAll($s_query, " ORDER BY {$orderby} {$order}", " LIMIT {$start}, {$per_page}", true, false);
$total_items = FrmAppHelper::getRecordCount($s_query, $this->table_name);
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
}
示例2: get_default_field_opts
public static function get_default_field_opts($type, $field, $limit = false)
{
$field_options = array('size' => '', 'max' => '', 'label' => '', 'blank' => '', 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', 'custom_html' => '');
if ($limit) {
return $field_options;
}
global $wpdb, $frm_settings;
$form_id = is_numeric($field) ? $field : $field->form_id;
$key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_fields', 'field_key') : $field->field_key;
$field_count = FrmAppHelper::getRecordCount(array('form_id' => $form_id), $wpdb->prefix . 'frm_fields');
return array('name' => __('Untitled', 'formidable'), 'description' => '', 'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '', 'field_order' => $field_count + 1, 'required' => false, 'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg, 'invalid' => __('This field is invalid', 'formidable'), 'form_id' => $form_id, 'field_options' => $field_options);
}
示例3: duplicate
public static function duplicate()
{
global $wpdb;
$frm_field = new FrmField();
$copy_field = $frm_field->getOne($_POST['field_id']);
if (!$copy_field) {
return;
}
$values = array();
$values['field_key'] = FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_fields', 'field_key');
$values['options'] = maybe_serialize($copy_field->options);
$values['default_value'] = maybe_serialize($copy_field->default_value);
$values['form_id'] = $copy_field->form_id;
foreach (array('name', 'description', 'type', 'field_options', 'required') as $col) {
$values[$col] = $copy_field->{$col};
}
$field_count = FrmAppHelper::getRecordCount(array('form_id' => $copy_field->form_id), $wpdb->prefix . 'frm_fields');
$values['field_order'] = $field_count + 1;
$field_id = $frm_field->create($values);
if ($field_id) {
$field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
$field_name = "item_meta[{$field_id}]";
$id = $field['form_id'];
if ($field['type'] == 'html') {
$field['stop_filter'] = true;
}
require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php';
}
die;
}