1 | <?php |
||
13 | class GravityView_Edit_Entry_Locking { |
||
14 | /** |
||
15 | * Load extension entry point. |
||
16 | * |
||
17 | * DO NOT RENAME this method. Required by the class-edit-entry.php component loader. |
||
18 | * @see GravityView_Edit_Entry::load_components() |
||
19 | * |
||
20 | * @since 2.5.2 |
||
21 | * |
||
22 | * @return void |
||
23 | */ |
||
24 | public function load() { |
||
29 | |||
30 | /** |
||
31 | * Enqueue the required scripts and styles from Gravity Forms. |
||
32 | * |
||
33 | * Called via load() and `wp_enqueue_scripts` |
||
34 | * |
||
35 | * @since 2.5.2 |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | public function enqueue_scripts() { |
||
74 | |||
75 | /** |
||
76 | * Returns a string with the Lock UI HTML markup. |
||
77 | * |
||
78 | * Called script enqueuing, added to JavaScript gforms_locking global variable. |
||
79 | * |
||
80 | * @since 2.5.2 |
||
81 | * |
||
82 | * @see GravityView_Edit_Entry_Locking::check_lock |
||
83 | * |
||
84 | * @param int $user_id The User ID that has the current lock. Will be empty if entry is not locked |
||
85 | * or is locked to the current user. |
||
86 | * |
||
87 | * @return string The Lock UI dialog box, etc. |
||
88 | */ |
||
89 | public function get_lock_ui( $user_id ) { |
||
135 | |||
136 | /** |
||
137 | * Localized string for the UI. |
||
138 | * |
||
139 | * Uses gravityforms textdomain unchanged. |
||
140 | * |
||
141 | * @since 2.5.2 |
||
142 | * |
||
143 | * @return array An array of translations. |
||
144 | */ |
||
145 | public function get_strings() { |
||
165 | |||
166 | /** |
||
167 | * Get a localized string. |
||
168 | * |
||
169 | * @param string $string The string to get. |
||
170 | * |
||
171 | * @return string A localized string. See self::get_strings() |
||
172 | */ |
||
173 | public function get_string( $string ) { |
||
176 | |||
177 | /** |
||
178 | * Lock the entry... maybe. |
||
179 | * |
||
180 | * Has 3 modes of locking: |
||
181 | * |
||
182 | * - acquire (get), which reloads the page after locking the entry |
||
183 | * - release, which reloads the page after unlocking the entry |
||
184 | * - default action to lock on load if not locked |
||
185 | * |
||
186 | * @param int $entry_id The entry ID. |
||
187 | * |
||
188 | * @return void |
||
189 | */ |
||
190 | public function maybe_lock_object( $entry_id ) { |
||
210 | |||
211 | /** |
||
212 | * Is this entry locked to some other user? |
||
213 | * |
||
214 | * @param int $entry_id The entry ID. |
||
215 | * |
||
216 | * @return boolean Yes or no. |
||
217 | */ |
||
218 | public function check_lock( $entry_id ) { |
||
229 | |||
230 | /** |
||
231 | * The lock for an entry. |
||
232 | * |
||
233 | * Leverages Gravity Forms' persistent caching mechanisms. |
||
234 | * |
||
235 | * @param int $entry_id The entry ID. |
||
236 | * |
||
237 | * @return int|null The User ID or null. |
||
238 | */ |
||
239 | public function get_lock_meta( $entry_id ) { |
||
242 | |||
243 | /** |
||
244 | * Set the lock for an entry. |
||
245 | * |
||
246 | * @param int $entry_id The entry ID. |
||
247 | * @param int $user_id The user ID to lock the entry to. |
||
248 | * |
||
249 | * @return void |
||
250 | */ |
||
251 | public function update_lock_meta( $entry_id, $user_id ) { |
||
254 | |||
255 | /** |
||
256 | * Release the lock for an entry. |
||
257 | * |
||
258 | * @param int $entry_id The entry ID. |
||
259 | * |
||
260 | * @return void |
||
261 | */ |
||
262 | public function delete_lock_meta( $entry_id ) { |
||
265 | |||
266 | /** |
||
267 | * Lock the entry to the current user. |
||
268 | * |
||
269 | * @since 2.5.2 |
||
270 | * |
||
271 | * @param int $entry_id The entry ID. |
||
272 | * |
||
273 | * @return int|false Locked or not. |
||
274 | */ |
||
275 | public function set_lock( $entry_id ) { |
||
287 | } |
||
288 |