本文整理匯總了PHP中FrmField::use_cache方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrmField::use_cache方法的具體用法?PHP FrmField::use_cache怎麽用?PHP FrmField::use_cache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FrmField
的用法示例。
在下文中一共展示了FrmField::use_cache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_all_for_form
public static function get_all_for_form($form_id, $limit = '', $inc_sub = 'exclude')
{
if (!(int) $form_id) {
return array();
}
$results = self::get_fields_from_transients($form_id, $inc_sub);
if (!empty($results)) {
if (empty($limit)) {
return $results;
}
$fields = array();
$count = 0;
foreach ($results as $result) {
$fields[$result->id] = $result;
if (!empty($limit) && $count >= $limit) {
break;
}
}
return $fields;
}
self::$use_cache = false;
// get the fields, but make sure to not get the subfields if set to exclude
$results = self::getAll(array('fi.form_id' => absint($form_id)), 'field_order', $limit);
self::$use_cache = true;
self::include_sub_fields($results, $inc_sub, 'all');
if (empty($limit)) {
self::set_field_transient($results, $form_id, $inc_sub);
}
return $results;
}
示例2: get_all_for_form
public static function get_all_for_form($form_id, $limit = '', $inc_embed = 'exclude', $inc_repeat = 'include')
{
if (!(int) $form_id) {
return array();
}
$results = self::get_fields_from_transients($form_id, array('inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat));
if (!empty($results)) {
if (empty($limit)) {
return $results;
}
$fields = array();
$count = 0;
foreach ($results as $result) {
$fields[$result->id] = $result;
if (!empty($limit) && $count >= $limit) {
break;
}
}
return $fields;
}
self::$use_cache = false;
$where = array('fi.form_id' => absint($form_id));
self::maybe_include_repeating_fields($inc_repeat, $where);
$results = self::getAll($where, 'field_order', $limit);
self::$use_cache = true;
self::include_sub_fields($results, $inc_embed, 'all');
if (empty($limit)) {
self::set_field_transient($results, $form_id, 0, array('inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat));
}
return $results;
}