当前位置: 首页>>代码示例>>PHP>>正文


PHP FrmAppHelper::prepend_and_or_where方法代码示例

本文整理汇总了PHP中FrmAppHelper::prepend_and_or_where方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::prepend_and_or_where方法的具体用法?PHP FrmAppHelper::prepend_and_or_where怎么用?PHP FrmAppHelper::prepend_and_or_where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrmAppHelper的用法示例。


在下文中一共展示了FrmAppHelper::prepend_and_or_where方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAll

 function getAll($where = '', $order_by = '', $limit = '')
 {
     global $wpdb;
     $query = "SELECT * FROM {$this->table_name} " . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
     if ($limit == ' LIMIT 1') {
         $results = $wpdb->get_row($query);
     } else {
         $results = $wpdb->get_results($query);
     }
     return $results;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:11,代码来源:FrmProCopy.php

示例2: 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;
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:18,代码来源:FrmEntry.php

示例3: getRecordCount

 function getRecordCount($where = '')
 {
     global $wpdb;
     if (is_numeric($where)) {
         $query = "SELECT COUNT(*) FROM {$wpdb->prefix}frm_items WHERE form_id=" . $where;
     } else {
         $query = "SELECT COUNT(*) FROM {$wpdb->prefix}frm_items it LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id" . FrmAppHelper::prepend_and_or_where(' WHERE ', $where);
     }
     return $wpdb->get_var($query);
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:10,代码来源:FrmEntry.php

示例4: getIds

 public static function getIds($where = '', $order_by = '', $limit = '')
 {
     _deprecated_function(__FUNCTION__, '2.0');
     global $wpdb;
     if (!empty($order_by) && !strpos($order_by, 'ORDER BY') !== false) {
         $order_by = ' ORDER BY ' . $order_by;
     }
     $query = 'SELECT fi.id  FROM ' . $wpdb->prefix . 'frm_fields fi ' . 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON fi.form_id=fr.id' . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
     $method = $limit == ' LIMIT 1' || $limit == 1 ? 'get_var' : 'get_col';
     $cache_key = 'getIds_' . maybe_serialize($where) . $order_by . $limit;
     $results = FrmAppHelper::check_cache($cache_key, 'frm_field', $query, $method);
     return $results;
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:13,代码来源:FrmField.php

示例5: getIds

 function getIds($where = '', $order_by = '', $limit = '')
 {
     global $wpdb;
     if (!empty($order_by) && !preg_match("/ORDER BY/", $order_by)) {
         $order_by = ' ORDER BY ' . $order_by;
     }
     $query = "SELECT fi.id  FROM {$wpdb->prefix}frm_fields fi " . "LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON fi.form_id=fr.id" . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
     if ($limit == ' LIMIT 1' or $limit == 1) {
         $results = $wpdb->get_var($query);
     } else {
         $results = $wpdb->get_col($query);
     }
     return $results;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:14,代码来源:FrmField.php

示例6: filter_entry_ids

 private static function filter_entry_ids($args, $where_field, $entry_ids, &$new_ids)
 {
     $where_statement = array('fi.id' => (int) $args['where_opt']);
     $field_key = 'meta_value ' . (in_array($where_field->type, array('number', 'scale')) ? ' +0 ' : '') . FrmDb::append_where_is($args['temp_where_is']);
     $nested_where = array($field_key => $args['where_val']);
     if (isset($args['where_val_esc']) && $args['where_val_esc'] != $args['where_val']) {
         $nested_where['or'] = 1;
         $nested_where[' ' . $field_key] = $args['where_val_esc'];
     }
     $where_statement[] = $nested_where;
     $args['entry_ids'] = $entry_ids;
     $where_statement = apply_filters('frm_where_filter', $where_statement, $args);
     $filter_args = array('is_draft' => $args['drafts']);
     self::add_group_by($filter_args, $args);
     // If the field is from a repeating section (or embedded form?) get the parent ID
     $filter_args['return_parent_id'] = $where_field->form_id != $args['form_id'];
     // Add entry IDs to $where_statement. Meant for use when showing one entry.
     if ($args['use_ids']) {
         if (is_array($where_statement)) {
             if ($filter_args['return_parent_id']) {
                 $where_statement['parent_item_id'] = $entry_ids;
             } else {
                 $where_statement['item_id'] = $entry_ids;
             }
         } else {
             // if the filter changed the query to a string, allow it
             $where_statement .= FrmAppHelper::prepend_and_or_where(' AND ', array('item_id' => $entry_ids));
         }
     }
     $new_ids = FrmEntryMeta::getEntryIds($where_statement, '', '', true, $filter_args);
     if ($args['where_is'] != $args['temp_where_is']) {
         $new_ids = array_diff((array) $entry_ids, $new_ids);
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:34,代码来源:FrmProAppHelper.php

示例7: getAll

 /**
  * @return object|array of objects
  */
 public static function getAll($where = array(), $order_by = '', $limit = '')
 {
     if (is_array($where) && !empty($where)) {
         $results = FrmDb::get_results('frm_forms', $where, '*', array('order_by' => $order_by, 'limit' => $limit));
     } else {
         global $wpdb;
         // the query has already been prepared if this is not an array
         $query = 'SELECT * FROM ' . $wpdb->prefix . 'frm_forms' . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . FrmAppHelper::esc_order($order_by) . FrmAppHelper::esc_limit($limit);
         $results = $wpdb->get_results($query);
     }
     if ($results) {
         foreach ($results as $result) {
             wp_cache_set($result->id, $result, 'frm_form');
             $result->options = maybe_unserialize($result->options);
         }
     }
     if ($limit == ' LIMIT 1' || $limit == 1) {
         // return the first form object if we are only getting one form
         $results = reset($results);
     }
     return stripslashes_deep($results);
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:25,代码来源:FrmForm.php

示例8: search_entry_metas

 public static function search_entry_metas($search, $field_id = '', $operator)
 {
     $cache_key = 'search_' . maybe_serialize($search) . $field_id . $operator;
     $results = wp_cache_get($cache_key, 'frm_entry');
     if (false !== $results) {
         return $results;
     }
     global $wpdb;
     if (is_array($search)) {
         $where = '';
         foreach ($search as $field => $value) {
             if ($value <= 0 || !in_array($field, array('year', 'month', 'day'))) {
                 continue;
             }
             switch ($field) {
                 case 'year':
                     $value = '%' . $value;
                     break;
                 case 'month':
                     $value .= '%';
                     break;
                 case 'day':
                     $value = '%' . $value . '%';
             }
             $where .= $wpdb->prepare(' meta_value ' . $operator . ' %s and', $value);
         }
         $where .= $wpdb->prepare(' field_id=%d', $field_id);
         $query = "SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas" . FrmAppHelper::prepend_and_or_where(' WHERE ', $where);
     } else {
         if ($operator == 'LIKE') {
             $search = '%' . $search . '%';
         }
         $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id);
     }
     $results = $wpdb->get_col($query, 0);
     wp_cache_set($cache_key, $results, 'frm_entry', 300);
     return $results;
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:38,代码来源:FrmEntryMeta.php

示例9: search_entry_metas

 function search_entry_metas($search, $field_id = '', $operator)
 {
     global $wpdb;
     if (is_array($search)) {
         $where = '';
         foreach ($search as $field => $value) {
             if ($field == 'year' and $value > 0) {
                 $where .= " meta_value {$operator} '%{$value}' and";
             }
             if ($field == 'month' and $value > 0) {
                 $where .= " meta_value {$operator} '{$value}%' and";
             }
             if ($field == 'day' and $value > 0) {
                 $where .= " meta_value {$operator} '%/{$value}/%' and";
             }
         }
         $where .= " field_id='{$field_id}'";
         $query = "SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas" . FrmAppHelper::prepend_and_or_where(' WHERE ', $where);
     } else {
         if ($operator == 'LIKE') {
             $search = "%{$search}%";
         }
         $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id);
     }
     return $wpdb->get_col($query, 0);
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:26,代码来源:FrmEntryMeta.php

示例10: getRecordCount

 public static function getRecordCount($where = "", $table_name)
 {
     global $wpdb;
     $query = 'SELECT COUNT(*) FROM ' . $table_name . FrmAppHelper::prepend_and_or_where(' WHERE ', $where);
     return $wpdb->get_var($query);
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:6,代码来源:FrmAppHelper.php

示例11: get_view_results

 public static function get_view_results($where, $args)
 {
     global $wpdb;
     $defaults = array('order_by_array' => array(), 'order_array' => array(), 'limit' => '', 'posts' => array(), 'display' => false);
     $args = wp_parse_args($args, $defaults);
     $args['time_field'] = false;
     $query = array('select' => 'SELECT it.id FROM ' . $wpdb->prefix . 'frm_items it', 'where' => $where, 'order' => 'ORDER BY it.created_at ASC');
     //If order is set
     if (!empty($args['order_by_array'])) {
         self::prepare_entries_query($query, $args);
     }
     $query = apply_filters('frm_view_order', $query, $args);
     if (!empty($query['where'])) {
         $query['where'] = FrmAppHelper::prepend_and_or_where('WHERE ', $query['where']);
     }
     $query['order'] = rtrim($query['order'], ', ');
     $query = implode($query, ' ') . $args['limit'];
     $entry_ids = $wpdb->get_col($query);
     self::reorder_time_entries($entry_ids, $args['time_field']);
     return $entry_ids;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:21,代码来源:FrmProEntry.php

示例12: getAll

 function getAll($where = array(), $order_by = '', $limit = '')
 {
     global $wpdb, $frmdb;
     if (is_numeric($limit)) {
         $limit = " LIMIT {$limit}";
     }
     $query = 'SELECT * FROM ' . $wpdb->prefix . 'frm_forms' . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
     if ($limit == ' LIMIT 1' || $limit == 1) {
         if (is_array($where)) {
             $results = $frmdb->get_one_record($wpdb->prefix . 'frm_forms', $where, '*', $order_by);
         } else {
             $results = $wpdb->get_row($query);
         }
         if ($results) {
             wp_cache_set($results->id, $results, 'frm_form');
             $results->options = maybe_unserialize($results->options);
         }
     } else {
         if (is_array($where) && !empty($where)) {
             $results = $frmdb->get_records($wpdb->prefix . 'frm_forms', $where, $order_by, $limit);
         } else {
             $results = $wpdb->get_results($query);
         }
         if ($results) {
             foreach ($results as $result) {
                 wp_cache_set($result->id, $result, 'frm_form');
                 $result->options = maybe_unserialize($result->options);
             }
         }
     }
     return stripslashes_deep($results);
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:32,代码来源:FrmForm.php


注:本文中的FrmAppHelper::prepend_and_or_where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。