本文整理匯總了PHP中GFCache::flush方法的典型用法代碼示例。如果您正苦於以下問題:PHP GFCache::flush方法的具體用法?PHP GFCache::flush怎麽用?PHP GFCache::flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GFCache
的用法示例。
在下文中一共展示了GFCache::flush方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
/** Activate the plugin, mock all the things */
public function setUp()
{
parent::setUp();
/* Activate GravityForms */
require_once WP_PLUGIN_DIR . '/gravityforms/gravityforms.php';
require_once WP_PLUGIN_DIR . '/gravityforms/export.php';
/* Something happened in newer versions, and we can't get the lead cache to initialize
properly, we need to do this manually */
global $_gform_lead_meta;
if ($_gform_lead_meta === null) {
$_gform_lead_meta = array();
}
GFForms::setup();
GFCache::flush();
/* Import some ready-made forms */
$this->assertEquals(GFExport::import_file(dirname(__FILE__) . '/forms.xml'), 2);
/* Add a faster turnaround schedule */
add_filter('cron_schedules', function ($s) {
$s['minute'] = array('interval' => 60, 'display' => 'Minutely');
return $s;
});
/* Get an instance of our plugin */
$this->digest = new GFDigestNotifications();
}
示例2: deactivation_hook
public static function deactivation_hook()
{
GFCache::flush(true);
}
示例3: set_current_lead
/**
* Set RGFormsModel::$lead for use in hooks where $lead is not explicitly passed.
*
* @param mixed $lead
*/
public static function set_current_lead($lead)
{
GFCache::flush();
self::$_current_lead = $lead;
}
示例4: maybe_add_review_page
/**
* Get form object and insert review page, if necessary.
*
* @param array $form The current Form object
* @return mixed The form meta array or false
*/
public static function maybe_add_review_page($form)
{
/* Setup default review page parameters. */
$review_page = array('content' => '', 'is_enabled' => false, 'nextButton' => array('type' => 'text', 'text' => __('Review Form', 'gravityforms'), 'imageUrl' => '', 'imageAlt' => ''), 'previousButton' => array('type' => 'text', 'text' => __('Previous', 'gravityforms'), 'imageUrl' => '', 'imageAlt' => ''));
if (has_filter('gform_review_page') || has_filter("gform_review_page_{$form['id']}")) {
// Prepare partial entry for review page.
$partial_entry = GFFormsModel::get_current_lead();
/**
* GFFormsModel::create_lead() caches the field value and conditional logic visibility which can create
* issues when 3rd parties use hooks later in the process to modify the form. Let's flush the cache avoid
* any weirdness.
*/
GFCache::flush();
/**
* A filter for setting up the review page
*
* @param array $review_page The review page parameters
* @param array $form The current form object
* @param array|false $partial_entry The partial entry for the form or false on initial form display.
*/
$review_page = gf_apply_filters(array('gform_review_page', $form['id']), $review_page, $form, $partial_entry);
if (!rgempty('button_text', $review_page)) {
$review_page['nextButton']['text'] = $review_page['button_text'];
}
}
if (rgar($review_page, 'is_enabled')) {
$form = self::insert_review_page($form, $review_page);
}
return $form;
}
示例5: deactivation_hook
/**
* Performs Gravity Forms deactivation tasks.
* @access public
* @static
* @see GFCache
*/
public static function deactivation_hook()
{
GFCache::flush(true);
delete_option('gravityforms_rewrite_rules_flushed');
flush_rewrite_rules();
}
示例6: deactivation_hook
public static function deactivation_hook()
{
/**
* This code was added on Jan. 13, 2016.
*
* @author Wes
*/
add_action('update_option_active_plugins', array('GFForms', 'aria_deactivate_plugins'));
do_action('update_option_active_plugins');
// gravity forms source code..
GFCache::flush(true);
}
示例7: maybe_process_status_update
public function maybe_process_status_update($form, $entry)
{
$feedback = false;
$form_id = $form['id'];
if (isset($_POST['gforms_save_entry']) && check_admin_referer('gforms_save_entry', 'gforms_save_entry')) {
$new_status = rgpost('gravityflow_status');
if (!in_array($new_status, array('in_progress', 'complete'))) {
return false;
}
// Loading files that have been uploaded to temp folder
$files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
if (!is_array($files)) {
$files = array();
}
GFFormsModel::$uploaded_files[$form_id] = $files;
$validation = $this->validate_status_update($new_status, $form);
if (is_wp_error($validation)) {
return $validation;
}
$editable_fields = $this->get_editable_fields();
$previous_assignees = $this->get_assignees();
$this->save_entry($form, $entry, $editable_fields);
remove_action('gform_after_update_entry', array(gravity_flow(), 'filter_after_update_entry'));
do_action('gform_after_update_entry', $form, $entry['id']);
do_action("gform_after_update_entry_{$form['id']}", $form, $entry['id']);
$entry = GFFormsModel::get_lead($entry['id']);
$entry = GFFormsModel::set_entry_meta($entry, $form);
$this->refresh_entry();
GFCache::flush();
$this->maybe_adjust_assignment($previous_assignees);
if ($token = gravity_flow()->decode_access_token()) {
$assignee_key = sanitize_text_field($token['sub']);
} else {
$user = wp_get_current_user();
$assignee_key = 'user_id|' . $user->ID;
}
$assignee = new Gravity_Flow_Assignee($assignee_key, $this);
$feedback = $this->process_assignee_status($assignee, $new_status, $form);
}
return $feedback;
}
示例8: inbox_page
public function inbox_page($args = array())
{
$defaults = array('display_empty_fields' => true, 'check_permissions' => true, 'show_header' => true, 'timeline' => true);
$args = array_merge($defaults, $args);
if (rgget('view') == 'entry') {
$entry_id = absint(rgget('lid'));
$entry = GFAPI::get_entry($entry_id);
if (is_wp_error($entry)) {
esc_html_e('Oops! We could not locate your entry.', 'gravityflow');
return;
}
$form_id = $entry['form_id'];
$form = GFAPI::get_form($form_id);
require_once $this->get_base_path() . '/includes/pages/class-entry-detail.php';
$step = $this->get_current_step($form, $entry);
if ($step) {
$token = $this->decode_access_token();
if (isset($token['scopes']['action'])) {
if ($token['scopes']['action'] === 'cancel_workflow') {
$entry_id = rgars($token, 'scopes/entry_id');
if (empty($entry_id) || $entry_id != $entry['id']) {
esc_html_e('Error: incorrect entry.', 'gravityflow');
return;
}
$api = new Gravity_Flow_API($form_id);
$result = $api->cancel_workflow($entry);
if ($result) {
esc_html_e('Workflow Cancelled', 'gravityflow');
}
return;
}
$feedback = $step->maybe_process_token_action($token['scopes']['action'], $token, $form, $entry);
if (empty($feedback)) {
esc_html_e('Error: This URL is no longer valid.', 'gravityflow');
return;
}
if (is_wp_error($feedback)) {
echo $feedback->get_error_message();
return;
}
$this->process_workflow($form, $entry_id);
echo $feedback;
return;
}
}
$feedback = $this->maybe_process_admin_action($form, $entry);
if (empty($feedback) && $step) {
$feedback = $step->maybe_process_status_update($form, $entry);
if ($feedback && !is_wp_error($feedback)) {
$this->process_workflow($form, $entry_id);
}
}
if (is_wp_error($feedback)) {
$error_data = $feedback->get_error_data();
if (!empty($error_data['form'])) {
$form = $error_data['form'];
}
?>
<div class="notice error is-dismissible gravityflow_validation_error" style="padding:6px;">
<?php
esc_html_e($feedback->get_error_message());
?>
</div>
<?php
} elseif ($feedback) {
GFCache::flush();
$entry = GFAPI::get_entry($entry_id);
// refresh entry
?>
<div class="updated notice notice-success is-dismissible" style="padding:6px;">
<?php
esc_html_e($feedback);
?>
</div>
<?php
$next_step = $this->get_current_step($form, $entry);
$current_user_assignee_key = $this->get_current_user_assignee_key();
if ($next_step && $next_step->is_assignee($current_user_assignee_key) || $args['check_permissions'] == false || $this->current_user_can_any('gravityflow_view_all')) {
$step = $next_step;
} else {
$args['display_instructions'] = false;
}
$args['check_permissions'] = false;
}
Gravity_Flow_Entry_Detail::entry_detail($form, $entry, $step, $args);
return;
} else {
?>
<div class="wrap gf_entry_wrap gravityflow_workflow_wrap gravityflow_workflow_detail">
<?php
if ($args['show_header']) {
?>
<h2 class="gf_admin_page_title">
<img width="45" height="22" src="<?php
echo $this->get_base_url();
?>
/images/gravityflow-icon-blue-grad.svg" style="margin-right:5px;"/>
<span><?php
esc_html_e('Workflow Inbox', 'gravityflow');
?>
//.........這裏部分代碼省略.........