GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Protected Member Functions
GravityView_Edit_Entry_Locking Class Reference

If this file is called directly, abort. More...

Public Member Functions

 ajax_lock_request ()
 
 ajax_reject_lock_request ()
 
 check_lock ( $entry_id)
 Is this entry locked to some other user? More...
 
 delete_lock_meta ( $entry_id)
 Release the lock for an entry. More...
 
 get_lock_meta ( $entry_id)
 The lock for an entry. More...
 
 get_lock_ui ( $user_id)
 Returns a string with the Lock UI HTML markup. More...
 
 get_string ( $string)
 Get a localized string. More...
 
 get_strings ()
 Localized string for the UI. More...
 
 load ()
 Load extension entry point. More...
 
 maybe_enqueue_scripts ()
 Checks whether to enqueue scripts based on: More...
 
 maybe_lock_object ( $entry_id)
 Lock the entry... More...
 
 set_lock ( $entry_id)
 Lock the entry to the current user. More...
 
 update_lock_meta ( $entry_id, $user_id)
 Set the lock for an entry. More...
 

Protected Member Functions

 delete_lock_request_meta ( $object_id)
 
 enqueue_scripts ( $entry)
 Enqueue the required scripts and styles from Gravity Forms. More...
 
 request_lock ( $object_id)
 
 update_lock_request_meta ( $object_id, $lock_request_value)
 

Detailed Description

If this file is called directly, abort.

An entry locking class that syncs with GFEntryLocking.

Since
2.5.2

Definition at line 13 of file class-edit-entry-locking.php.

Member Function Documentation

◆ ajax_lock_request()

ajax_lock_request ( )

Definition at line 37 of file class-edit-entry-locking.php.

References request_lock().

◆ ajax_reject_lock_request()

ajax_reject_lock_request ( )

Definition at line 45 of file class-edit-entry-locking.php.

References delete_lock_request_meta().

◆ check_lock()

check_lock (   $entry_id)

Is this entry locked to some other user?

Parameters
int$entry_idThe entry ID.
Returns
boolean Yes or no.

Definition at line 348 of file class-edit-entry-locking.php.

References get_lock_meta().

Referenced by enqueue_scripts(), maybe_lock_object(), and request_lock().

◆ delete_lock_meta()

delete_lock_meta (   $entry_id)

Release the lock for an entry.

Parameters
int$entry_idThe entry ID.
Returns
void

Definition at line 392 of file class-edit-entry-locking.php.

Referenced by maybe_lock_object().

◆ delete_lock_request_meta()

delete_lock_request_meta (   $object_id)
protected

Definition at line 53 of file class-edit-entry-locking.php.

Referenced by ajax_reject_lock_request().

◆ enqueue_scripts()

enqueue_scripts (   $entry)
protected

Enqueue the required scripts and styles from Gravity Forms.

Called via load() and wp_enqueue_scripts

Since
2.5.2
Parameters
array$entryGravity Forms entry array
Returns
void

Definition at line 164 of file class-edit-entry-locking.php.

References $entry, $strings, check_lock(), get_lock_ui(), and get_strings().

Referenced by maybe_enqueue_scripts().

◆ get_lock_meta()

get_lock_meta (   $entry_id)

The lock for an entry.

Leverages Gravity Forms' persistent caching mechanisms.

Parameters
int$entry_idThe entry ID.
Returns
int|null The User ID or null.

Definition at line 369 of file class-edit-entry-locking.php.

Referenced by check_lock().

◆ get_lock_ui()

get_lock_ui (   $user_id)

Returns a string with the Lock UI HTML markup.

Called script enqueuing, added to JavaScript gforms_locking global variable.

Since
2.5.2
See also
GravityView_Edit_Entry_Locking::check_lock
Parameters
int$user_idThe User ID that has the current lock. Will be empty if entry is not locked or is locked to the current user.
Returns
string The Lock UI dialog box, etc.

Definition at line 210 of file class-edit-entry-locking.php.

References $user, get_string(), and GVCommon\has_cap().

Referenced by enqueue_scripts().

◆ get_string()

get_string (   $string)

Get a localized string.

Parameters
string$stringThe string to get.
Returns
string A localized string. See self::get_strings()

Definition at line 303 of file class-edit-entry-locking.php.

References get_strings().

Referenced by get_lock_ui().

◆ get_strings()

get_strings ( )

Localized string for the UI.

Uses gravityforms textdomain unchanged.

Since
2.5.2
Returns
array An array of translations.

Definition at line 275 of file class-edit-entry-locking.php.

Referenced by enqueue_scripts(), and get_string().

◆ load()

load ( )

Load extension entry point.

DO NOT RENAME this method. Required by the class-edit-entry.php component loader.

See also
GravityView_Edit_Entry::load_components()
Since
2.5.2
Returns
void

Definition at line 25 of file class-edit-entry-locking.php.

◆ maybe_enqueue_scripts()

maybe_enqueue_scripts ( )

Checks whether to enqueue scripts based on:

  • Is it Edit Entry?
  • Is the entry connected to a View that has edit_locking enabled?
  • Is the entry connected to a form connected to a currently-loaded View?

Definition at line 107 of file class-edit-entry-locking.php.

References $entry, $post, enqueue_scripts(), View_Collection\from_post(), and gravityview().

◆ maybe_lock_object()

maybe_lock_object (   $entry_id)

Lock the entry...

maybe.

Has 3 modes of locking:

  • acquire (get), which reloads the page after locking the entry
  • release, which reloads the page after unlocking the entry
  • default action to lock on load if not locked
Parameters
int$entry_idThe entry ID.
Returns
void

Definition at line 320 of file class-edit-entry-locking.php.

References check_lock(), delete_lock_meta(), and set_lock().

◆ request_lock()

request_lock (   $object_id)
protected

◆ set_lock()

set_lock (   $entry_id)

Lock the entry to the current user.

Since
2.5.2
Parameters
int$entry_idThe entry ID.
Returns
int|false Locked or not.

Definition at line 405 of file class-edit-entry-locking.php.

References $entry, GravityView_Edit_Entry\check_user_cap_edit_entry(), and update_lock_meta().

Referenced by maybe_lock_object(), and request_lock().

◆ update_lock_meta()

update_lock_meta (   $entry_id,
  $user_id 
)

Set the lock for an entry.

Parameters
int$entry_idThe entry ID.
int$user_idThe user ID to lock the entry to.
Returns
void

Definition at line 381 of file class-edit-entry-locking.php.

Referenced by set_lock().

◆ update_lock_request_meta()

update_lock_request_meta (   $object_id,
  $lock_request_value 
)
protected

Definition at line 89 of file class-edit-entry-locking.php.

Referenced by request_lock().


The documentation for this class was generated from the following file: