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


PHP FrmAppHelper::check_cache方法代码示例

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


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

示例1: 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

示例2: get_field

 public static function get_field($field = 'is_draft', $id)
 {
     $entry = FrmAppHelper::check_cache($id, 'frm_entry');
     if ($entry && isset($entry->{$field})) {
         return $entry->{$field};
     }
     $var = FrmDb::get_var('frm_items', array('id' => $id), $field);
     return $var;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:9,代码来源:FrmProEntriesHelper.php

示例3: get_var

 public static function get_var($table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var')
 {
     $group = '';
     self::get_group_and_table_name($table, $group);
     self::convert_options_to_array($args, '', $limit);
     $query = 'SELECT ' . $field . ' FROM ' . $table;
     if (is_array($where) || empty($where)) {
         // only separate into array values and query string if is array
         self::get_where_clause_and_values($where);
         global $wpdb;
         $query = $wpdb->prepare($query . $where['where'] . ' ' . implode(' ', $args), $where['values']);
     } else {
         /**
          * Allow the $where to be prepared before we recieve it here.
          * This is a fallback for reverse compatability, but is not recommended
          */
         _deprecated_argument('where', '2.0', __('Use the query in an array format so it can be properly prepared.', 'formidable'));
         $query .= $where . ' ' . implode(' ', $args);
     }
     $cache_key = str_replace(array(' ', ','), '_', trim(implode('_', FrmAppHelper::array_flatten($where)) . implode('_', $args) . $field . '_' . $type, ' WHERE'));
     $results = FrmAppHelper::check_cache($cache_key, $group, $query, 'get_' . $type);
     return $results;
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:23,代码来源:FrmDb.php

示例4: get_all

 public function get_all($form_id = false, $limit = 99)
 {
     if ($form_id) {
         $this->form_id = $form_id;
     }
     $type = $this->id_base;
     global $frm_vars;
     $frm_vars['action_type'] = $type;
     add_filter('posts_where', 'FrmFormActionsController::limit_by_type');
     $query = self::action_args($form_id, $limit);
     $query['post_status'] = 'any';
     $query['suppress_filters'] = false;
     $actions = FrmAppHelper::check_cache(serialize($query) . '_type_' . $type, 'frm_actions', $query, 'get_posts');
     unset($query);
     remove_filter('posts_where', 'FrmFormActionsController::limit_by_type');
     if (empty($actions)) {
         return array();
     }
     $settings = array();
     foreach ($actions as $action) {
         if (count($settings) >= $limit) {
             continue;
         }
         $action = $this->prepare_action($action);
         $settings[$action->ID] = $action;
     }
     if (1 === $limit) {
         $settings = reset($settings);
     }
     return $settings;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:31,代码来源:FrmFormAction.php

示例5: 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

示例6: get_all

 public function get_all($orderby = 'title', $order = 'ASC', $limit = 99)
 {
     $post_atts = array('post_type' => FrmStylesController::$post_type, 'post_status' => 'publish', 'numberposts' => $limit, 'orderby' => $orderby, 'order' => $order);
     $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
     if (empty($temp_styles)) {
         global $wpdb;
         // make sure there wasn't a conflict with the query
         $query = $wpdb->prepare('SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish');
         $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
         if (empty($temp_styles)) {
             // create a new style if there are none
             $new = $this->get_new();
             $new->post_title = $new->post_name = __('Formidable Style', 'formidable');
             $new->menu_order = 1;
             $new = $this->save((array) $new);
             $this->update('default');
             $post_atts['include'] = $new;
             $temp_styles = get_posts($post_atts);
         }
     }
     $default_values = $this->get_defaults();
     $default_style = false;
     $styles = array();
     foreach ($temp_styles as $style) {
         $this->id = $style->ID;
         if ($style->menu_order) {
             if ($default_style) {
                 // only return one default
                 $style->menu_order = 0;
             } else {
                 // check for a default style
                 $default_style = $style->ID;
             }
         }
         $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
         // fill default values
         $style->post_content = $this->override_defaults($style->post_content);
         $style->post_content = wp_parse_args($style->post_content, $default_values);
         $styles[$style->ID] = $style;
     }
     if (!$default_style) {
         $default_style = reset($styles);
         $styles[$default_style->ID]->menu_order = 1;
     }
     return $styles;
 }
开发者ID:tshdvs,项目名称:GooseMobile,代码行数:46,代码来源:FrmStyle.php

示例7: array

 /**
  * @param int $id
  * @return string form key
  */
 public static function &getKeyById($id)
 {
     $id = (int) $id;
     $cache = FrmAppHelper::check_cache($id, 'frm_form');
     if ($cache) {
         return $cache->form_key;
     }
     $key = FrmDb::get_var('frm_forms', array('id' => $id), 'form_key');
     return $key;
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:14,代码来源:FrmForm.php

示例8: getEntryIds

 public static function getEntryIds($where = array(), $order_by = '', $limit = '', $unique = true, $args = array())
 {
     $defaults = array('is_draft' => false, 'user_id' => '', 'group_by' => '');
     $args = wp_parse_args($args, $defaults);
     $query = array();
     self::get_ids_query($where, $order_by, $limit, $unique, $args, $query);
     $query = implode(' ', $query);
     $cache_key = 'ids_' . maybe_serialize($where) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize($args);
     $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, $limit == ' LIMIT 1' ? 'get_var' : 'get_col');
     return $results;
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:11,代码来源:FrmEntryMeta.php

示例9: copy_forms

 /**
  * Copy forms that are set to copy from one site to another
  */
 private static function copy_forms($force)
 {
     if (!$force) {
         //don't check on every page load
         $last_checked = get_option('frmpro_copies_checked');
         if (!$last_checked || time() - $last_checked >= 60 * 60) {
             //check every hour
             $force = true;
         }
     }
     if (!$force) {
         return;
     }
     global $wpdb, $blog_id;
     //get all forms to be copied from global table
     $query = $wpdb->prepare('SELECT c.*, p.post_name FROM ' . self::table_name() . ' c LEFT JOIN ' . $wpdb->prefix . 'frm_forms f ON (c.copy_key = f.form_key) LEFT JOIN ' . $wpdb->posts . ' p ON (c.copy_key = p.post_name) WHERE blog_id != %d AND ((type = %s AND f.form_key is NULL) OR (type = %s AND p.post_name is NULL)) ORDER BY type DESC', $blog_id, 'form', 'display');
     $templates = FrmAppHelper::check_cache('all_templates_' . $blog_id, 'frm_copy', $query, 'get_results');
     foreach ($templates as $temp) {
         if ($temp->type == 'form') {
             FrmForm::duplicate($temp->form_id, false, true, $temp->blog_id);
             continue;
         }
         $values = FrmProDisplay::getOne($temp->form_id, $temp->blog_id, true);
         if (!$values || 'trash' == $values->post_status) {
             continue;
         }
         // check if post with slug already exists
         $post_name = wp_unique_post_slug($values->post_name, 0, 'publish', 'frm_display', 0);
         if ($post_name != $values->post_name) {
             continue;
         }
         if ($values->post_name != $temp->copy_key) {
             $wpdb->update(self::table_name(), array('copy_key' => $values->post_name), array('id' => $temp->id));
         }
         FrmProDisplay::duplicate($temp->form_id, true, $temp->blog_id);
         //TODO: replace any ids with field keys in the display before duplicated
         unset($temp);
     }
     update_option('frmpro_copies_checked', time());
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:43,代码来源:FrmProCopy.php

示例10: get_associative_array_results

 /**
  * Get the associative array results for the given columns, table, and where query
  *
  * @since 2.02.05
  * @param string $columns
  * @param string $table
  * @param array $where
  * @return mixed
  */
 public static function get_associative_array_results($columns, $table, $where)
 {
     $group = '';
     self::get_group_and_table_name($table, $group);
     $query = self::generate_query_string_from_pieces($columns, $table, $where);
     $cache_key = str_replace(array(' ', ','), '_', trim(implode('_', FrmAppHelper::array_flatten($where)) . $columns . '_results_ARRAY_A', ' WHERE'));
     $results = FrmAppHelper::check_cache($cache_key, $group, $query, 'get_associative_results');
     return $results;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:18,代码来源:FrmDb.php


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