PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.2
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / modules / actions-v2 / insert-term / properties / base-term-action.php
base-term-action.php
66 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace JFB_Modules\Actions_V2\Insert_Term\Properties;
4
5 use Jet_Form_Builder\Actions\Methods\Base_Modifier_Action;
6
7 // If this file is called directly, abort.
8 if ( ! defined( 'WPINC' ) ) {
9 die;
10 }
11
12 abstract class Base_Term_Action extends Base_Modifier_Action {
13
14 protected $inserted_id = 0;
15
16 /**
17 * Inserted ID getter.
18 *
19 * @return integer
20 */
21 public function get_inserted_id(): int {
22 return $this->inserted_id;
23 }
24
25 public function do_after() {
26 if ( ! $this->inserted_id ) {
27 return;
28 }
29
30 /**
31 * Perform any actions after term inserted/updated
32 */
33 do_action(
34 'jet-form-builder/action/after-term-' . $this->get_id(),
35 jet_fb_action_handler()->get_current_action(),
36 jet_fb_action_handler(),
37 $this
38 );
39 }
40
41 public function pre_check(): bool {
42 return apply_filters(
43 'jet-form-builder/action/insert-term/pre-check',
44 true,
45 $this->modifier->source_arr,
46 jet_fb_action_handler()->get_current_action()
47 );
48 }
49
50 public function get_inserted(): int {
51 return $this->inserted_id;
52 }
53
54 public function user_can_manage_taxonomy_terms( $taxonomy ) {
55 $taxonomy_object = get_taxonomy( $taxonomy );
56
57 if ( ! $taxonomy_object ) {
58 return false;
59 }
60
61 $capability = $taxonomy_object->cap->edit_terms;
62
63 return current_user_can( $capability );
64 }
65 }
66