@@ -6,28 +6,28 @@ |
||
6 | 6 | */ |
7 | 7 | class GravityView_Field_Transaction_ID extends GravityView_Field |
8 | 8 | { |
9 | - public $name = 'transaction_id'; |
|
9 | + public $name = 'transaction_id'; |
|
10 | 10 | |
11 | - public $is_searchable = true; |
|
11 | + public $is_searchable = true; |
|
12 | 12 | |
13 | - public $is_numeric = true; |
|
13 | + public $is_numeric = true; |
|
14 | 14 | |
15 | - public $search_operators = ['is', 'isnot', 'starts_with', 'ends_with']; |
|
15 | + public $search_operators = ['is', 'isnot', 'starts_with', 'ends_with']; |
|
16 | 16 | |
17 | - public $group = 'pricing'; |
|
17 | + public $group = 'pricing'; |
|
18 | 18 | |
19 | - public $_custom_merge_tag = 'transaction_id'; |
|
19 | + public $_custom_merge_tag = 'transaction_id'; |
|
20 | 20 | |
21 | - public $icon = 'dashicons-cart'; |
|
21 | + public $icon = 'dashicons-cart'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * GravityView_Field_Payment_Amount constructor. |
|
25 | - */ |
|
26 | - public function __construct() |
|
27 | - { |
|
28 | - $this->label = esc_html__('Transaction ID', 'gravityview'); |
|
29 | - parent::__construct(); |
|
30 | - } |
|
23 | + /** |
|
24 | + * GravityView_Field_Payment_Amount constructor. |
|
25 | + */ |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + $this->label = esc_html__('Transaction ID', 'gravityview'); |
|
29 | + parent::__construct(); |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | new GravityView_Field_Transaction_ID(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public $is_numeric = true; |
14 | 14 | |
15 | - public $search_operators = ['is', 'isnot', 'starts_with', 'ends_with']; |
|
15 | + public $search_operators = [ 'is', 'isnot', 'starts_with', 'ends_with' ]; |
|
16 | 16 | |
17 | 17 | public $group = 'pricing'; |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct() |
27 | 27 | { |
28 | - $this->label = esc_html__('Transaction ID', 'gravityview'); |
|
28 | + $this->label = esc_html__( 'Transaction ID', 'gravityview' ); |
|
29 | 29 | parent::__construct(); |
30 | 30 | } |
31 | 31 | } |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @since 1.16 |
6 | 6 | */ |
7 | -class GravityView_Field_Transaction_ID extends GravityView_Field |
|
8 | -{ |
|
7 | +class GravityView_Field_Transaction_ID extends GravityView_Field { |
|
9 | 8 | public $name = 'transaction_id'; |
10 | 9 | |
11 | 10 | public $is_searchable = true; |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | /** |
24 | 23 | * GravityView_Field_Payment_Amount constructor. |
25 | 24 | */ |
26 | - public function __construct() |
|
27 | - { |
|
25 | + public function __construct() { |
|
28 | 26 | $this->label = esc_html__('Transaction ID', 'gravityview'); |
29 | 27 | parent::__construct(); |
30 | 28 | } |
@@ -6,29 +6,29 @@ |
||
6 | 6 | */ |
7 | 7 | class GravityView_Field_Payment_Method extends GravityView_Field |
8 | 8 | { |
9 | - public $name = 'payment_method'; |
|
9 | + public $name = 'payment_method'; |
|
10 | 10 | |
11 | - public $is_searchable = true; |
|
11 | + public $is_searchable = true; |
|
12 | 12 | |
13 | - public $is_numeric = false; |
|
13 | + public $is_numeric = false; |
|
14 | 14 | |
15 | - public $search_operators = ['is', 'isnot', 'contains']; |
|
15 | + public $search_operators = ['is', 'isnot', 'contains']; |
|
16 | 16 | |
17 | - public $group = 'pricing'; |
|
17 | + public $group = 'pricing'; |
|
18 | 18 | |
19 | - public $_custom_merge_tag = 'payment_method'; |
|
19 | + public $_custom_merge_tag = 'payment_method'; |
|
20 | 20 | |
21 | - public $icon = 'dashicons-cart'; |
|
21 | + public $icon = 'dashicons-cart'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * GravityView_Field_Date_Created constructor. |
|
25 | - */ |
|
26 | - public function __construct() |
|
27 | - { |
|
28 | - $this->label = esc_html__('Payment Method', 'gravityview'); |
|
29 | - $this->description = esc_html__('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview'); |
|
30 | - parent::__construct(); |
|
31 | - } |
|
23 | + /** |
|
24 | + * GravityView_Field_Date_Created constructor. |
|
25 | + */ |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + $this->label = esc_html__('Payment Method', 'gravityview'); |
|
29 | + $this->description = esc_html__('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview'); |
|
30 | + parent::__construct(); |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | new GravityView_Field_Payment_Method(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public $is_numeric = false; |
14 | 14 | |
15 | - public $search_operators = ['is', 'isnot', 'contains']; |
|
15 | + public $search_operators = [ 'is', 'isnot', 'contains' ]; |
|
16 | 16 | |
17 | 17 | public $group = 'pricing'; |
18 | 18 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct() |
27 | 27 | { |
28 | - $this->label = esc_html__('Payment Method', 'gravityview'); |
|
29 | - $this->description = esc_html__('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview'); |
|
28 | + $this->label = esc_html__( 'Payment Method', 'gravityview' ); |
|
29 | + $this->description = esc_html__( 'The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview' ); |
|
30 | 30 | parent::__construct(); |
31 | 31 | } |
32 | 32 | } |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @since 1.16 |
6 | 6 | */ |
7 | -class GravityView_Field_Payment_Method extends GravityView_Field |
|
8 | -{ |
|
7 | +class GravityView_Field_Payment_Method extends GravityView_Field { |
|
9 | 8 | public $name = 'payment_method'; |
10 | 9 | |
11 | 10 | public $is_searchable = true; |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | /** |
24 | 23 | * GravityView_Field_Date_Created constructor. |
25 | 24 | */ |
26 | - public function __construct() |
|
27 | - { |
|
25 | + public function __construct() { |
|
28 | 26 | $this->label = esc_html__('Payment Method', 'gravityview'); |
29 | 27 | $this->description = esc_html__('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview'); |
30 | 28 | parent::__construct(); |
@@ -4,112 +4,112 @@ discard block |
||
4 | 4 | */ |
5 | 5 | class GravityView_Field_Is_Starred extends GravityView_Field |
6 | 6 | { |
7 | - public $name = 'is_starred'; |
|
8 | - |
|
9 | - public $is_searchable = true; |
|
10 | - |
|
11 | - public $search_operators = ['is', 'isnot']; |
|
12 | - |
|
13 | - public $group = 'meta'; |
|
14 | - |
|
15 | - public $contexts = ['single', 'multiple', 'export']; |
|
16 | - |
|
17 | - public $icon = 'dashicons-star-filled'; |
|
18 | - |
|
19 | - private static $has_star_field = false; |
|
20 | - |
|
21 | - /** |
|
22 | - * GravityView_Field_Is_Starred constructor. |
|
23 | - */ |
|
24 | - public function __construct() |
|
25 | - { |
|
26 | - $this->label = esc_html__('Entry Star', 'gravityview'); |
|
27 | - $this->default_search_label = __('Is Starred', 'gravityview'); |
|
28 | - $this->description = esc_html__('Display the entry\'s "star" status.', 'gravityview'); |
|
29 | - |
|
30 | - $this->add_hooks(); |
|
31 | - |
|
32 | - parent::__construct(); |
|
33 | - } |
|
34 | - |
|
35 | - private function add_hooks() |
|
36 | - { |
|
37 | - /** @see \GV\Field::get_value_filters */ |
|
38 | - add_filter("gravityview/field/{$this->name}/output", [$this, 'get_content'], 4, 2); |
|
39 | - add_action('gravityview/template/after', [$this, 'print_script'], 10, 1); |
|
40 | - add_filter('gravityview_entry_default_fields', [$this, 'add_default_field'], 10, 3); |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Add this field to the default fields in the GV field picker. |
|
45 | - * |
|
46 | - * @param array $entry_default_fields Array of fields shown by default |
|
47 | - * @param string|array $form form_ID or form object |
|
48 | - * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
49 | - * |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - public function add_default_field($entry_default_fields = [], $form = [], $zone = '') |
|
53 | - { |
|
54 | - if ('edit' !== $zone) { |
|
55 | - $entry_default_fields[$this->name] = [ |
|
56 | - 'label' => $this->label, |
|
57 | - 'desc' => $this->description, |
|
58 | - 'type' => $this->name, |
|
59 | - ]; |
|
60 | - } |
|
61 | - |
|
62 | - return $entry_default_fields; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * Show the star image. |
|
67 | - * |
|
68 | - * @since 2.0 |
|
69 | - * |
|
70 | - * @param string $output HTML value output |
|
71 | - * @param \GV\Field_Template $template The field template being rendered |
|
72 | - * |
|
73 | - * @return string Image of the star |
|
74 | - */ |
|
75 | - public function get_content($output, $template) |
|
76 | - { |
|
77 | - $entry = $template->entry; |
|
78 | - |
|
79 | - $star_url = GFCommon::get_base_url().'/images/star'.intval($entry['is_starred']).'.png'; |
|
80 | - |
|
81 | - $entry_id = ''; |
|
82 | - |
|
83 | - if (GravityView_Roles_Capabilities::has_cap('gravityview_edit_entries')) { |
|
84 | - $entry_id = "data-entry-id='{$entry->ID}'"; |
|
85 | - } |
|
86 | - |
|
87 | - // if( $show_as_star ) |
|
88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'.intval($entry['is_starred']).'" src="'.esc_attr($star_url).'" />'; |
|
89 | - |
|
90 | - self::$has_star_field = true; |
|
91 | - |
|
92 | - return $output; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Add JS to the bottom of the View if there is a star field and user has `gravityview_edit_entries` cap. |
|
97 | - * |
|
98 | - * @param \GV\Template_Context $context The template context |
|
99 | - * |
|
100 | - * @since 2.0 |
|
101 | - * |
|
102 | - * @return void |
|
103 | - */ |
|
104 | - public function print_script($context) |
|
105 | - { |
|
106 | - if (!self::$has_star_field) { |
|
107 | - return; |
|
108 | - } |
|
109 | - |
|
110 | - if (!GravityView_Roles_Capabilities::has_cap('gravityview_edit_entries')) { |
|
111 | - return; |
|
112 | - } ?> |
|
7 | + public $name = 'is_starred'; |
|
8 | + |
|
9 | + public $is_searchable = true; |
|
10 | + |
|
11 | + public $search_operators = ['is', 'isnot']; |
|
12 | + |
|
13 | + public $group = 'meta'; |
|
14 | + |
|
15 | + public $contexts = ['single', 'multiple', 'export']; |
|
16 | + |
|
17 | + public $icon = 'dashicons-star-filled'; |
|
18 | + |
|
19 | + private static $has_star_field = false; |
|
20 | + |
|
21 | + /** |
|
22 | + * GravityView_Field_Is_Starred constructor. |
|
23 | + */ |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + $this->label = esc_html__('Entry Star', 'gravityview'); |
|
27 | + $this->default_search_label = __('Is Starred', 'gravityview'); |
|
28 | + $this->description = esc_html__('Display the entry\'s "star" status.', 'gravityview'); |
|
29 | + |
|
30 | + $this->add_hooks(); |
|
31 | + |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | + |
|
35 | + private function add_hooks() |
|
36 | + { |
|
37 | + /** @see \GV\Field::get_value_filters */ |
|
38 | + add_filter("gravityview/field/{$this->name}/output", [$this, 'get_content'], 4, 2); |
|
39 | + add_action('gravityview/template/after', [$this, 'print_script'], 10, 1); |
|
40 | + add_filter('gravityview_entry_default_fields', [$this, 'add_default_field'], 10, 3); |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Add this field to the default fields in the GV field picker. |
|
45 | + * |
|
46 | + * @param array $entry_default_fields Array of fields shown by default |
|
47 | + * @param string|array $form form_ID or form object |
|
48 | + * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
49 | + * |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + public function add_default_field($entry_default_fields = [], $form = [], $zone = '') |
|
53 | + { |
|
54 | + if ('edit' !== $zone) { |
|
55 | + $entry_default_fields[$this->name] = [ |
|
56 | + 'label' => $this->label, |
|
57 | + 'desc' => $this->description, |
|
58 | + 'type' => $this->name, |
|
59 | + ]; |
|
60 | + } |
|
61 | + |
|
62 | + return $entry_default_fields; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * Show the star image. |
|
67 | + * |
|
68 | + * @since 2.0 |
|
69 | + * |
|
70 | + * @param string $output HTML value output |
|
71 | + * @param \GV\Field_Template $template The field template being rendered |
|
72 | + * |
|
73 | + * @return string Image of the star |
|
74 | + */ |
|
75 | + public function get_content($output, $template) |
|
76 | + { |
|
77 | + $entry = $template->entry; |
|
78 | + |
|
79 | + $star_url = GFCommon::get_base_url().'/images/star'.intval($entry['is_starred']).'.png'; |
|
80 | + |
|
81 | + $entry_id = ''; |
|
82 | + |
|
83 | + if (GravityView_Roles_Capabilities::has_cap('gravityview_edit_entries')) { |
|
84 | + $entry_id = "data-entry-id='{$entry->ID}'"; |
|
85 | + } |
|
86 | + |
|
87 | + // if( $show_as_star ) |
|
88 | + $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'.intval($entry['is_starred']).'" src="'.esc_attr($star_url).'" />'; |
|
89 | + |
|
90 | + self::$has_star_field = true; |
|
91 | + |
|
92 | + return $output; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Add JS to the bottom of the View if there is a star field and user has `gravityview_edit_entries` cap. |
|
97 | + * |
|
98 | + * @param \GV\Template_Context $context The template context |
|
99 | + * |
|
100 | + * @since 2.0 |
|
101 | + * |
|
102 | + * @return void |
|
103 | + */ |
|
104 | + public function print_script($context) |
|
105 | + { |
|
106 | + if (!self::$has_star_field) { |
|
107 | + return; |
|
108 | + } |
|
109 | + |
|
110 | + if (!GravityView_Roles_Capabilities::has_cap('gravityview_edit_entries')) { |
|
111 | + return; |
|
112 | + } ?> |
|
113 | 113 | <style> |
114 | 114 | .gv-star-image[data-entry-id] { |
115 | 115 | cursor: pointer; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | }); |
148 | 148 | </script> |
149 | 149 | <?php |
150 | - } |
|
150 | + } |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | new GravityView_Field_Is_Starred(); |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | public $is_searchable = true; |
10 | 10 | |
11 | - public $search_operators = ['is', 'isnot']; |
|
11 | + public $search_operators = [ 'is', 'isnot' ]; |
|
12 | 12 | |
13 | 13 | public $group = 'meta'; |
14 | 14 | |
15 | - public $contexts = ['single', 'multiple', 'export']; |
|
15 | + public $contexts = [ 'single', 'multiple', 'export' ]; |
|
16 | 16 | |
17 | 17 | public $icon = 'dashicons-star-filled'; |
18 | 18 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() |
25 | 25 | { |
26 | - $this->label = esc_html__('Entry Star', 'gravityview'); |
|
27 | - $this->default_search_label = __('Is Starred', 'gravityview'); |
|
28 | - $this->description = esc_html__('Display the entry\'s "star" status.', 'gravityview'); |
|
26 | + $this->label = esc_html__( 'Entry Star', 'gravityview' ); |
|
27 | + $this->default_search_label = __( 'Is Starred', 'gravityview' ); |
|
28 | + $this->description = esc_html__( 'Display the entry\'s "star" status.', 'gravityview' ); |
|
29 | 29 | |
30 | 30 | $this->add_hooks(); |
31 | 31 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | private function add_hooks() |
36 | 36 | { |
37 | 37 | /** @see \GV\Field::get_value_filters */ |
38 | - add_filter("gravityview/field/{$this->name}/output", [$this, 'get_content'], 4, 2); |
|
39 | - add_action('gravityview/template/after', [$this, 'print_script'], 10, 1); |
|
40 | - add_filter('gravityview_entry_default_fields', [$this, 'add_default_field'], 10, 3); |
|
38 | + add_filter( "gravityview/field/{$this->name}/output", [ $this, 'get_content' ], 4, 2 ); |
|
39 | + add_action( 'gravityview/template/after', [ $this, 'print_script' ], 10, 1 ); |
|
40 | + add_filter( 'gravityview_entry_default_fields', [ $this, 'add_default_field' ], 10, 3 ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - public function add_default_field($entry_default_fields = [], $form = [], $zone = '') |
|
52 | + public function add_default_field( $entry_default_fields = [ ], $form = [ ], $zone = '' ) |
|
53 | 53 | { |
54 | - if ('edit' !== $zone) { |
|
55 | - $entry_default_fields[$this->name] = [ |
|
54 | + if ( 'edit' !== $zone ) { |
|
55 | + $entry_default_fields[ $this->name ] = [ |
|
56 | 56 | 'label' => $this->label, |
57 | 57 | 'desc' => $this->description, |
58 | 58 | 'type' => $this->name, |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string Image of the star |
74 | 74 | */ |
75 | - public function get_content($output, $template) |
|
75 | + public function get_content( $output, $template ) |
|
76 | 76 | { |
77 | 77 | $entry = $template->entry; |
78 | 78 | |
79 | - $star_url = GFCommon::get_base_url().'/images/star'.intval($entry['is_starred']).'.png'; |
|
79 | + $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png'; |
|
80 | 80 | |
81 | 81 | $entry_id = ''; |
82 | 82 | |
83 | - if (GravityView_Roles_Capabilities::has_cap('gravityview_edit_entries')) { |
|
83 | + if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_edit_entries' ) ) { |
|
84 | 84 | $entry_id = "data-entry-id='{$entry->ID}'"; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // if( $show_as_star ) |
88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'.intval($entry['is_starred']).'" src="'.esc_attr($star_url).'" />'; |
|
88 | + $output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />'; |
|
89 | 89 | |
90 | 90 | self::$has_star_field = true; |
91 | 91 | |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return void |
103 | 103 | */ |
104 | - public function print_script($context) |
|
104 | + public function print_script( $context ) |
|
105 | 105 | { |
106 | - if (!self::$has_star_field) { |
|
106 | + if ( ! self::$has_star_field ) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | - if (!GravityView_Roles_Capabilities::has_cap('gravityview_edit_entries')) { |
|
110 | + if ( ! GravityView_Roles_Capabilities::has_cap( 'gravityview_edit_entries' ) ) { |
|
111 | 111 | return; |
112 | 112 | } ?> |
113 | 113 | <style> |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | $.ajax({ |
128 | 128 | type: "POST", |
129 | - url: "<?php echo esc_js(admin_url('admin-ajax.php')); ?>", |
|
129 | + url: "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>", |
|
130 | 130 | data: { |
131 | 131 | action: 'rg_update_lead_property', |
132 | - rg_update_lead_property: '<?php echo wp_create_nonce('rg_update_lead_property') ?>', |
|
132 | + rg_update_lead_property: '<?php echo wp_create_nonce( 'rg_update_lead_property' ) ?>', |
|
133 | 133 | lead_id: entry_id, |
134 | 134 | name: 'is_starred', |
135 | 135 | value: update |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | .data( 'is_starred', update ); |
142 | 142 | }) |
143 | 143 | .fail(function() { |
144 | - alert(<?php echo json_encode(__('There was an error updating the entry.', 'gravityview')); ?>); |
|
144 | + alert(<?php echo json_encode( __( 'There was an error updating the entry.', 'gravityview' ) ); ?>); |
|
145 | 145 | }); |
146 | 146 | }); |
147 | 147 | }); |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * @file class-gravityview-field-is-starred.php |
4 | 4 | */ |
5 | -class GravityView_Field_Is_Starred extends GravityView_Field |
|
6 | -{ |
|
5 | +class GravityView_Field_Is_Starred extends GravityView_Field { |
|
7 | 6 | public $name = 'is_starred'; |
8 | 7 | |
9 | 8 | public $is_searchable = true; |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | /** |
22 | 21 | * GravityView_Field_Is_Starred constructor. |
23 | 22 | */ |
24 | - public function __construct() |
|
25 | - { |
|
23 | + public function __construct() { |
|
26 | 24 | $this->label = esc_html__('Entry Star', 'gravityview'); |
27 | 25 | $this->default_search_label = __('Is Starred', 'gravityview'); |
28 | 26 | $this->description = esc_html__('Display the entry\'s "star" status.', 'gravityview'); |
@@ -32,8 +30,7 @@ discard block |
||
32 | 30 | parent::__construct(); |
33 | 31 | } |
34 | 32 | |
35 | - private function add_hooks() |
|
36 | - { |
|
33 | + private function add_hooks() { |
|
37 | 34 | /** @see \GV\Field::get_value_filters */ |
38 | 35 | add_filter("gravityview/field/{$this->name}/output", [$this, 'get_content'], 4, 2); |
39 | 36 | add_action('gravityview/template/after', [$this, 'print_script'], 10, 1); |
@@ -49,8 +46,7 @@ discard block |
||
49 | 46 | * |
50 | 47 | * @return array |
51 | 48 | */ |
52 | - public function add_default_field($entry_default_fields = [], $form = [], $zone = '') |
|
53 | - { |
|
49 | + public function add_default_field($entry_default_fields = [], $form = [], $zone = '') { |
|
54 | 50 | if ('edit' !== $zone) { |
55 | 51 | $entry_default_fields[$this->name] = [ |
56 | 52 | 'label' => $this->label, |
@@ -72,8 +68,7 @@ discard block |
||
72 | 68 | * |
73 | 69 | * @return string Image of the star |
74 | 70 | */ |
75 | - public function get_content($output, $template) |
|
76 | - { |
|
71 | + public function get_content($output, $template) { |
|
77 | 72 | $entry = $template->entry; |
78 | 73 | |
79 | 74 | $star_url = GFCommon::get_base_url().'/images/star'.intval($entry['is_starred']).'.png'; |
@@ -101,8 +96,7 @@ discard block |
||
101 | 96 | * |
102 | 97 | * @return void |
103 | 98 | */ |
104 | - public function print_script($context) |
|
105 | - { |
|
99 | + public function print_script($context) { |
|
106 | 100 | if (!self::$has_star_field) { |
107 | 101 | return; |
108 | 102 | } |
@@ -4,125 +4,125 @@ |
||
4 | 4 | */ |
5 | 5 | class GravityView_Field_Password extends GravityView_Field |
6 | 6 | { |
7 | - public $name = 'password'; |
|
8 | - |
|
9 | - public $is_searchable = false; |
|
10 | - |
|
11 | - /** @see GF_Field_Password */ |
|
12 | - public $_gf_field_class_name = 'GF_Field_Password'; |
|
13 | - |
|
14 | - public $group = 'advanced'; |
|
15 | - |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - $this->label = esc_html__('Password', 'gravityview'); |
|
19 | - |
|
20 | - $this->add_hooks(); |
|
21 | - |
|
22 | - parent::__construct(); |
|
23 | - |
|
24 | - add_filter('gravityview/field/password/value', [$this, 'get_value'], 10, 6); |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Filter the value of the field, future. |
|
29 | - * |
|
30 | - * @since 2.0 |
|
31 | - * |
|
32 | - * @param mixed $value The value of the field. |
|
33 | - * @param \GV\Field $field The field as seen by future. |
|
34 | - * @param \GV\View $view The view requested in. |
|
35 | - * @param \GV\Source $source The data source (form). |
|
36 | - * @param \GV\Entry $entry The entry. |
|
37 | - * @param \GV\Request $request The request context. |
|
38 | - * |
|
39 | - * @return mixed $value The filtered value. |
|
40 | - */ |
|
41 | - public function get_value($value, $field, $view, $source, $entry, $request) |
|
42 | - { |
|
43 | - /** Passwords should never be exposed. */ |
|
44 | - return ''; |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Add filters to modify the front-end label and the Add Field label. |
|
49 | - * |
|
50 | - * @since 1.17 |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function add_hooks() |
|
55 | - { |
|
56 | - add_filter('gravityview/common/get_form_fields', [$this, 'add_form_fields'], 10, 3); |
|
57 | - |
|
58 | - add_filter('gravityview/template/field_label', [$this, 'field_label'], 10, 4); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Use the GV Admin Field label for the Password field instead of the per-input setting. |
|
63 | - * |
|
64 | - * @since 1.17 |
|
65 | - * |
|
66 | - * @param string $label Field label HTML |
|
67 | - * @param array $field GravityView field array |
|
68 | - * @param array $form Gravity Forms form array |
|
69 | - * @param array $entry Gravity Forms entry array |
|
70 | - * |
|
71 | - * @return string If a custom field label isn't set, return the field label for the password field |
|
72 | - */ |
|
73 | - public function field_label($label = '', $field = [], $form = [], $entry = []) |
|
74 | - { |
|
75 | - |
|
76 | - // If using a custom label, no need to fetch the parent label |
|
77 | - if (!is_numeric($field['id']) || !empty($field['custom_label'])) { |
|
78 | - return $label; |
|
79 | - } |
|
80 | - |
|
81 | - $field_object = GFFormsModel::get_field($form, $field['id']); |
|
82 | - |
|
83 | - if ($field_object && 'password' === $field_object->type) { |
|
84 | - $label = $field['label']; |
|
85 | - } |
|
86 | - |
|
87 | - return $label; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * If a form has list fields, add the columns to the field picker. |
|
92 | - * |
|
93 | - * @since 1.17 |
|
94 | - * |
|
95 | - * @param array $fields Associative array of fields, with keys as field type |
|
96 | - * @param array $form GF Form array |
|
97 | - * @param bool $include_parent_field Whether to include the parent field when getting a field with inputs |
|
98 | - * |
|
99 | - * @return array $fields with list field columns added, if exist. Unmodified if form has no list fields. |
|
100 | - */ |
|
101 | - public function add_form_fields($fields = [], $form = [], $include_parent_field = true) |
|
102 | - { |
|
103 | - foreach ($fields as $key => $field) { |
|
104 | - if ('password' === $field['type']) { |
|
105 | - |
|
106 | - // The Enter Password input |
|
107 | - if (floor($key) === floatval($key)) { |
|
108 | - if (!empty($field['parent'])) { |
|
109 | - $field['label'] = $field['parent']->label; |
|
110 | - $field['adminOnly'] = $field['parent']->adminOnly; |
|
111 | - $field['adminLabel'] = $field['parent']->adminLabel; |
|
112 | - // Don't show as a child input |
|
113 | - unset($field['parent']); |
|
114 | - } |
|
115 | - |
|
116 | - $fields[$key] = $field; |
|
117 | - } else { |
|
118 | - // The Confirm Password input |
|
119 | - unset($fields[$key]); |
|
120 | - } |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - return $fields; |
|
125 | - } |
|
7 | + public $name = 'password'; |
|
8 | + |
|
9 | + public $is_searchable = false; |
|
10 | + |
|
11 | + /** @see GF_Field_Password */ |
|
12 | + public $_gf_field_class_name = 'GF_Field_Password'; |
|
13 | + |
|
14 | + public $group = 'advanced'; |
|
15 | + |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + $this->label = esc_html__('Password', 'gravityview'); |
|
19 | + |
|
20 | + $this->add_hooks(); |
|
21 | + |
|
22 | + parent::__construct(); |
|
23 | + |
|
24 | + add_filter('gravityview/field/password/value', [$this, 'get_value'], 10, 6); |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Filter the value of the field, future. |
|
29 | + * |
|
30 | + * @since 2.0 |
|
31 | + * |
|
32 | + * @param mixed $value The value of the field. |
|
33 | + * @param \GV\Field $field The field as seen by future. |
|
34 | + * @param \GV\View $view The view requested in. |
|
35 | + * @param \GV\Source $source The data source (form). |
|
36 | + * @param \GV\Entry $entry The entry. |
|
37 | + * @param \GV\Request $request The request context. |
|
38 | + * |
|
39 | + * @return mixed $value The filtered value. |
|
40 | + */ |
|
41 | + public function get_value($value, $field, $view, $source, $entry, $request) |
|
42 | + { |
|
43 | + /** Passwords should never be exposed. */ |
|
44 | + return ''; |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Add filters to modify the front-end label and the Add Field label. |
|
49 | + * |
|
50 | + * @since 1.17 |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function add_hooks() |
|
55 | + { |
|
56 | + add_filter('gravityview/common/get_form_fields', [$this, 'add_form_fields'], 10, 3); |
|
57 | + |
|
58 | + add_filter('gravityview/template/field_label', [$this, 'field_label'], 10, 4); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Use the GV Admin Field label for the Password field instead of the per-input setting. |
|
63 | + * |
|
64 | + * @since 1.17 |
|
65 | + * |
|
66 | + * @param string $label Field label HTML |
|
67 | + * @param array $field GravityView field array |
|
68 | + * @param array $form Gravity Forms form array |
|
69 | + * @param array $entry Gravity Forms entry array |
|
70 | + * |
|
71 | + * @return string If a custom field label isn't set, return the field label for the password field |
|
72 | + */ |
|
73 | + public function field_label($label = '', $field = [], $form = [], $entry = []) |
|
74 | + { |
|
75 | + |
|
76 | + // If using a custom label, no need to fetch the parent label |
|
77 | + if (!is_numeric($field['id']) || !empty($field['custom_label'])) { |
|
78 | + return $label; |
|
79 | + } |
|
80 | + |
|
81 | + $field_object = GFFormsModel::get_field($form, $field['id']); |
|
82 | + |
|
83 | + if ($field_object && 'password' === $field_object->type) { |
|
84 | + $label = $field['label']; |
|
85 | + } |
|
86 | + |
|
87 | + return $label; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * If a form has list fields, add the columns to the field picker. |
|
92 | + * |
|
93 | + * @since 1.17 |
|
94 | + * |
|
95 | + * @param array $fields Associative array of fields, with keys as field type |
|
96 | + * @param array $form GF Form array |
|
97 | + * @param bool $include_parent_field Whether to include the parent field when getting a field with inputs |
|
98 | + * |
|
99 | + * @return array $fields with list field columns added, if exist. Unmodified if form has no list fields. |
|
100 | + */ |
|
101 | + public function add_form_fields($fields = [], $form = [], $include_parent_field = true) |
|
102 | + { |
|
103 | + foreach ($fields as $key => $field) { |
|
104 | + if ('password' === $field['type']) { |
|
105 | + |
|
106 | + // The Enter Password input |
|
107 | + if (floor($key) === floatval($key)) { |
|
108 | + if (!empty($field['parent'])) { |
|
109 | + $field['label'] = $field['parent']->label; |
|
110 | + $field['adminOnly'] = $field['parent']->adminOnly; |
|
111 | + $field['adminLabel'] = $field['parent']->adminLabel; |
|
112 | + // Don't show as a child input |
|
113 | + unset($field['parent']); |
|
114 | + } |
|
115 | + |
|
116 | + $fields[$key] = $field; |
|
117 | + } else { |
|
118 | + // The Confirm Password input |
|
119 | + unset($fields[$key]); |
|
120 | + } |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + return $fields; |
|
125 | + } |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | new GravityView_Field_Password(); |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | |
16 | 16 | public function __construct() |
17 | 17 | { |
18 | - $this->label = esc_html__('Password', 'gravityview'); |
|
18 | + $this->label = esc_html__( 'Password', 'gravityview' ); |
|
19 | 19 | |
20 | 20 | $this->add_hooks(); |
21 | 21 | |
22 | 22 | parent::__construct(); |
23 | 23 | |
24 | - add_filter('gravityview/field/password/value', [$this, 'get_value'], 10, 6); |
|
24 | + add_filter( 'gravityview/field/password/value', [ $this, 'get_value' ], 10, 6 ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return mixed $value The filtered value. |
40 | 40 | */ |
41 | - public function get_value($value, $field, $view, $source, $entry, $request) |
|
41 | + public function get_value( $value, $field, $view, $source, $entry, $request ) |
|
42 | 42 | { |
43 | 43 | /** Passwords should never be exposed. */ |
44 | 44 | return ''; |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function add_hooks() |
55 | 55 | { |
56 | - add_filter('gravityview/common/get_form_fields', [$this, 'add_form_fields'], 10, 3); |
|
56 | + add_filter( 'gravityview/common/get_form_fields', [ $this, 'add_form_fields' ], 10, 3 ); |
|
57 | 57 | |
58 | - add_filter('gravityview/template/field_label', [$this, 'field_label'], 10, 4); |
|
58 | + add_filter( 'gravityview/template/field_label', [ $this, 'field_label' ], 10, 4 ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return string If a custom field label isn't set, return the field label for the password field |
72 | 72 | */ |
73 | - public function field_label($label = '', $field = [], $form = [], $entry = []) |
|
73 | + public function field_label( $label = '', $field = [ ], $form = [ ], $entry = [ ] ) |
|
74 | 74 | { |
75 | 75 | |
76 | 76 | // If using a custom label, no need to fetch the parent label |
77 | - if (!is_numeric($field['id']) || !empty($field['custom_label'])) { |
|
77 | + if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) { |
|
78 | 78 | return $label; |
79 | 79 | } |
80 | 80 | |
81 | - $field_object = GFFormsModel::get_field($form, $field['id']); |
|
81 | + $field_object = GFFormsModel::get_field( $form, $field[ 'id' ] ); |
|
82 | 82 | |
83 | - if ($field_object && 'password' === $field_object->type) { |
|
84 | - $label = $field['label']; |
|
83 | + if ( $field_object && 'password' === $field_object->type ) { |
|
84 | + $label = $field[ 'label' ]; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return $label; |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return array $fields with list field columns added, if exist. Unmodified if form has no list fields. |
100 | 100 | */ |
101 | - public function add_form_fields($fields = [], $form = [], $include_parent_field = true) |
|
101 | + public function add_form_fields( $fields = [ ], $form = [ ], $include_parent_field = true ) |
|
102 | 102 | { |
103 | - foreach ($fields as $key => $field) { |
|
104 | - if ('password' === $field['type']) { |
|
103 | + foreach ( $fields as $key => $field ) { |
|
104 | + if ( 'password' === $field[ 'type' ] ) { |
|
105 | 105 | |
106 | 106 | // The Enter Password input |
107 | - if (floor($key) === floatval($key)) { |
|
108 | - if (!empty($field['parent'])) { |
|
109 | - $field['label'] = $field['parent']->label; |
|
110 | - $field['adminOnly'] = $field['parent']->adminOnly; |
|
111 | - $field['adminLabel'] = $field['parent']->adminLabel; |
|
107 | + if ( floor( $key ) === floatval( $key ) ) { |
|
108 | + if ( ! empty( $field[ 'parent' ] ) ) { |
|
109 | + $field[ 'label' ] = $field[ 'parent' ]->label; |
|
110 | + $field[ 'adminOnly' ] = $field[ 'parent' ]->adminOnly; |
|
111 | + $field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel; |
|
112 | 112 | // Don't show as a child input |
113 | - unset($field['parent']); |
|
113 | + unset( $field[ 'parent' ] ); |
|
114 | 114 | } |
115 | 115 | |
116 | - $fields[$key] = $field; |
|
116 | + $fields[ $key ] = $field; |
|
117 | 117 | } else { |
118 | 118 | // The Confirm Password input |
119 | - unset($fields[$key]); |
|
119 | + unset( $fields[ $key ] ); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * @file class-gravityview-field-password.php |
4 | 4 | */ |
5 | -class GravityView_Field_Password extends GravityView_Field |
|
6 | -{ |
|
5 | +class GravityView_Field_Password extends GravityView_Field { |
|
7 | 6 | public $name = 'password'; |
8 | 7 | |
9 | 8 | public $is_searchable = false; |
@@ -13,8 +12,7 @@ discard block |
||
13 | 12 | |
14 | 13 | public $group = 'advanced'; |
15 | 14 | |
16 | - public function __construct() |
|
17 | - { |
|
15 | + public function __construct() { |
|
18 | 16 | $this->label = esc_html__('Password', 'gravityview'); |
19 | 17 | |
20 | 18 | $this->add_hooks(); |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return mixed $value The filtered value. |
40 | 38 | */ |
41 | - public function get_value($value, $field, $view, $source, $entry, $request) |
|
42 | - { |
|
39 | + public function get_value($value, $field, $view, $source, $entry, $request) { |
|
43 | 40 | /** Passwords should never be exposed. */ |
44 | 41 | return ''; |
45 | 42 | } |
@@ -51,8 +48,7 @@ discard block |
||
51 | 48 | * |
52 | 49 | * @return void |
53 | 50 | */ |
54 | - public function add_hooks() |
|
55 | - { |
|
51 | + public function add_hooks() { |
|
56 | 52 | add_filter('gravityview/common/get_form_fields', [$this, 'add_form_fields'], 10, 3); |
57 | 53 | |
58 | 54 | add_filter('gravityview/template/field_label', [$this, 'field_label'], 10, 4); |
@@ -70,8 +66,7 @@ discard block |
||
70 | 66 | * |
71 | 67 | * @return string If a custom field label isn't set, return the field label for the password field |
72 | 68 | */ |
73 | - public function field_label($label = '', $field = [], $form = [], $entry = []) |
|
74 | - { |
|
69 | + public function field_label($label = '', $field = [], $form = [], $entry = []) { |
|
75 | 70 | |
76 | 71 | // If using a custom label, no need to fetch the parent label |
77 | 72 | if (!is_numeric($field['id']) || !empty($field['custom_label'])) { |
@@ -98,8 +93,7 @@ discard block |
||
98 | 93 | * |
99 | 94 | * @return array $fields with list field columns added, if exist. Unmodified if form has no list fields. |
100 | 95 | */ |
101 | - public function add_form_fields($fields = [], $form = [], $include_parent_field = true) |
|
102 | - { |
|
96 | + public function add_form_fields($fields = [], $form = [], $include_parent_field = true) { |
|
103 | 97 | foreach ($fields as $key => $field) { |
104 | 98 | if ('password' === $field['type']) { |
105 | 99 |
@@ -4,66 +4,66 @@ |
||
4 | 4 | */ |
5 | 5 | class GravityView_Field_Post_Custom_Field extends GravityView_Field |
6 | 6 | { |
7 | - public $name = 'post_custom_field'; |
|
7 | + public $name = 'post_custom_field'; |
|
8 | 8 | |
9 | - public $is_searchable = true; |
|
9 | + public $is_searchable = true; |
|
10 | 10 | |
11 | - /** |
|
12 | - * @var array Custom fields are text, but can be any format (including JSON) |
|
13 | - */ |
|
14 | - public $search_operators = ['contains', 'is', 'isnot']; |
|
11 | + /** |
|
12 | + * @var array Custom fields are text, but can be any format (including JSON) |
|
13 | + */ |
|
14 | + public $search_operators = ['contains', 'is', 'isnot']; |
|
15 | 15 | |
16 | - /** |
|
17 | - * @see GF_Field_Post_Custom_Field |
|
18 | - */ |
|
19 | - public $_gf_field_class_name = 'GF_Field_Post_Custom_Field'; |
|
16 | + /** |
|
17 | + * @see GF_Field_Post_Custom_Field |
|
18 | + */ |
|
19 | + public $_gf_field_class_name = 'GF_Field_Post_Custom_Field'; |
|
20 | 20 | |
21 | - public $group = 'post'; |
|
21 | + public $group = 'post'; |
|
22 | 22 | |
23 | - public $icon = 'dashicons-admin-generic'; |
|
23 | + public $icon = 'dashicons-admin-generic'; |
|
24 | 24 | |
25 | - public function __construct() |
|
26 | - { |
|
27 | - $this->label = esc_html__('Post Custom Field', 'gravityview'); |
|
28 | - parent::__construct(); |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + $this->label = esc_html__('Post Custom Field', 'gravityview'); |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | - $this->add_hooks(); |
|
31 | - } |
|
30 | + $this->add_hooks(); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Add hooks for the field. |
|
35 | - * |
|
36 | - * @since 1.17 |
|
37 | - * |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - private function add_hooks() |
|
41 | - { |
|
42 | - add_filter('gravityview/edit_entry/field_value_post_custom_field', [$this, 'edit_entry_field_value'], 10, 2); |
|
43 | - } |
|
33 | + /** |
|
34 | + * Add hooks for the field. |
|
35 | + * |
|
36 | + * @since 1.17 |
|
37 | + * |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + private function add_hooks() |
|
41 | + { |
|
42 | + add_filter('gravityview/edit_entry/field_value_post_custom_field', [$this, 'edit_entry_field_value'], 10, 2); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Fix "List" Field Type pre-population of content in Edit Entry mode. |
|
47 | - * |
|
48 | - * @since 1.17 |
|
49 | - * |
|
50 | - * @param mixed $field_value field value used to populate the input |
|
51 | - * @param GF_Field $field Gravity Forms field object |
|
52 | - * |
|
53 | - * @return mixed If a List input for Custom Field, returns JSON-decoded value. Otherwise, original value. |
|
54 | - */ |
|
55 | - public function edit_entry_field_value($field_value, $field) |
|
56 | - { |
|
57 | - if ('list' === $field->inputType) { |
|
58 | - $field_value = is_string($field_value) ? json_decode($field_value, true) : $field_value; |
|
45 | + /** |
|
46 | + * Fix "List" Field Type pre-population of content in Edit Entry mode. |
|
47 | + * |
|
48 | + * @since 1.17 |
|
49 | + * |
|
50 | + * @param mixed $field_value field value used to populate the input |
|
51 | + * @param GF_Field $field Gravity Forms field object |
|
52 | + * |
|
53 | + * @return mixed If a List input for Custom Field, returns JSON-decoded value. Otherwise, original value. |
|
54 | + */ |
|
55 | + public function edit_entry_field_value($field_value, $field) |
|
56 | + { |
|
57 | + if ('list' === $field->inputType) { |
|
58 | + $field_value = is_string($field_value) ? json_decode($field_value, true) : $field_value; |
|
59 | 59 | |
60 | - if (!is_array($field_value)) { |
|
61 | - gravityview()->log->error('"List" Custom Field value not an array or string.', ['data' => compact('field_value', 'field')]); |
|
62 | - } |
|
63 | - } |
|
60 | + if (!is_array($field_value)) { |
|
61 | + gravityview()->log->error('"List" Custom Field value not an array or string.', ['data' => compact('field_value', 'field')]); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - return $field_value; |
|
66 | - } |
|
65 | + return $field_value; |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | new GravityView_Field_Post_Custom_Field(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @var array Custom fields are text, but can be any format (including JSON) |
13 | 13 | */ |
14 | - public $search_operators = ['contains', 'is', 'isnot']; |
|
14 | + public $search_operators = [ 'contains', 'is', 'isnot' ]; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @see GF_Field_Post_Custom_Field |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public function __construct() |
26 | 26 | { |
27 | - $this->label = esc_html__('Post Custom Field', 'gravityview'); |
|
27 | + $this->label = esc_html__( 'Post Custom Field', 'gravityview' ); |
|
28 | 28 | parent::__construct(); |
29 | 29 | |
30 | 30 | $this->add_hooks(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | private function add_hooks() |
41 | 41 | { |
42 | - add_filter('gravityview/edit_entry/field_value_post_custom_field', [$this, 'edit_entry_field_value'], 10, 2); |
|
42 | + add_filter( 'gravityview/edit_entry/field_value_post_custom_field', [ $this, 'edit_entry_field_value' ], 10, 2 ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return mixed If a List input for Custom Field, returns JSON-decoded value. Otherwise, original value. |
54 | 54 | */ |
55 | - public function edit_entry_field_value($field_value, $field) |
|
55 | + public function edit_entry_field_value( $field_value, $field ) |
|
56 | 56 | { |
57 | - if ('list' === $field->inputType) { |
|
58 | - $field_value = is_string($field_value) ? json_decode($field_value, true) : $field_value; |
|
57 | + if ( 'list' === $field->inputType ) { |
|
58 | + $field_value = is_string( $field_value ) ? json_decode( $field_value, true ) : $field_value; |
|
59 | 59 | |
60 | - if (!is_array($field_value)) { |
|
61 | - gravityview()->log->error('"List" Custom Field value not an array or string.', ['data' => compact('field_value', 'field')]); |
|
60 | + if ( ! is_array( $field_value ) ) { |
|
61 | + gravityview()->log->error( '"List" Custom Field value not an array or string.', [ 'data' => compact( 'field_value', 'field' ) ] ); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * @file class-gravityview-field-post-custom-field.php |
4 | 4 | */ |
5 | -class GravityView_Field_Post_Custom_Field extends GravityView_Field |
|
6 | -{ |
|
5 | +class GravityView_Field_Post_Custom_Field extends GravityView_Field { |
|
7 | 6 | public $name = 'post_custom_field'; |
8 | 7 | |
9 | 8 | public $is_searchable = true; |
@@ -22,8 +21,7 @@ discard block |
||
22 | 21 | |
23 | 22 | public $icon = 'dashicons-admin-generic'; |
24 | 23 | |
25 | - public function __construct() |
|
26 | - { |
|
24 | + public function __construct() { |
|
27 | 25 | $this->label = esc_html__('Post Custom Field', 'gravityview'); |
28 | 26 | parent::__construct(); |
29 | 27 | |
@@ -37,8 +35,7 @@ discard block |
||
37 | 35 | * |
38 | 36 | * @return void |
39 | 37 | */ |
40 | - private function add_hooks() |
|
41 | - { |
|
38 | + private function add_hooks() { |
|
42 | 39 | add_filter('gravityview/edit_entry/field_value_post_custom_field', [$this, 'edit_entry_field_value'], 10, 2); |
43 | 40 | } |
44 | 41 | |
@@ -52,8 +49,7 @@ discard block |
||
52 | 49 | * |
53 | 50 | * @return mixed If a List input for Custom Field, returns JSON-decoded value. Otherwise, original value. |
54 | 51 | */ |
55 | - public function edit_entry_field_value($field_value, $field) |
|
56 | - { |
|
52 | + public function edit_entry_field_value($field_value, $field) { |
|
57 | 53 | if ('list' === $field->inputType) { |
58 | 54 | $field_value = is_string($field_value) ? json_decode($field_value, true) : $field_value; |
59 | 55 |
@@ -4,24 +4,24 @@ |
||
4 | 4 | */ |
5 | 5 | class GravityView_Field_Name extends GravityView_Field |
6 | 6 | { |
7 | - public $name = 'name'; |
|
7 | + public $name = 'name'; |
|
8 | 8 | |
9 | - /** @see GF_Field_Name */ |
|
10 | - public $_gf_field_class_name = 'GF_Field_Name'; |
|
9 | + /** @see GF_Field_Name */ |
|
10 | + public $_gf_field_class_name = 'GF_Field_Name'; |
|
11 | 11 | |
12 | - public $group = 'advanced'; |
|
12 | + public $group = 'advanced'; |
|
13 | 13 | |
14 | - public $search_operators = ['is', 'isnot', 'contains']; |
|
14 | + public $search_operators = ['is', 'isnot', 'contains']; |
|
15 | 15 | |
16 | - public $is_searchable = true; |
|
16 | + public $is_searchable = true; |
|
17 | 17 | |
18 | - public $icon = 'dashicons-admin-users'; |
|
18 | + public $icon = 'dashicons-admin-users'; |
|
19 | 19 | |
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->label = esc_html__('Name', 'gravityview'); |
|
23 | - parent::__construct(); |
|
24 | - } |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->label = esc_html__('Name', 'gravityview'); |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | new GravityView_Field_Name(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | public $group = 'advanced'; |
13 | 13 | |
14 | - public $search_operators = ['is', 'isnot', 'contains']; |
|
14 | + public $search_operators = [ 'is', 'isnot', 'contains' ]; |
|
15 | 15 | |
16 | 16 | public $is_searchable = true; |
17 | 17 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct() |
21 | 21 | { |
22 | - $this->label = esc_html__('Name', 'gravityview'); |
|
22 | + $this->label = esc_html__( 'Name', 'gravityview' ); |
|
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | } |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * @file class-gravityview-field-name.php |
4 | 4 | */ |
5 | -class GravityView_Field_Name extends GravityView_Field |
|
6 | -{ |
|
5 | +class GravityView_Field_Name extends GravityView_Field { |
|
7 | 6 | public $name = 'name'; |
8 | 7 | |
9 | 8 | /** @see GF_Field_Name */ |
@@ -17,8 +16,7 @@ discard block |
||
17 | 16 | |
18 | 17 | public $icon = 'dashicons-admin-users'; |
19 | 18 | |
20 | - public function __construct() |
|
21 | - { |
|
19 | + public function __construct() { |
|
22 | 20 | $this->label = esc_html__('Name', 'gravityview'); |
23 | 21 | parent::__construct(); |
24 | 22 | } |
@@ -4,86 +4,86 @@ |
||
4 | 4 | */ |
5 | 5 | class GravityView_Field_Post_Content extends GravityView_Field |
6 | 6 | { |
7 | - public $name = 'post_content'; |
|
8 | - |
|
9 | - public $is_searchable = true; |
|
10 | - |
|
11 | - public $search_operators = ['is', 'isnot', 'contains', 'starts_with', 'ends_with']; |
|
12 | - |
|
13 | - public $_gf_field_class_name = 'GF_Field_Post_Content'; |
|
14 | - |
|
15 | - public $group = 'post'; |
|
16 | - |
|
17 | - public $icon = 'dashicons-editor-alignleft'; |
|
18 | - |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - $this->label = esc_html__('Post Content', 'gravityview'); |
|
22 | - parent::__construct(); |
|
23 | - } |
|
24 | - |
|
25 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
26 | - { |
|
27 | - unset($field_options['show_as_link']); |
|
28 | - |
|
29 | - if ('edit' === $context) { |
|
30 | - return $field_options; |
|
31 | - } |
|
32 | - |
|
33 | - $this->add_field_support('dynamic_data', $field_options); |
|
34 | - |
|
35 | - return $field_options; |
|
36 | - } |
|
37 | - |
|
38 | - /** |
|
39 | - * Returns the field inner markup. |
|
40 | - * |
|
41 | - * @param array $form The Form Object currently being processed. |
|
42 | - * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
|
43 | - * @param null|array $entry Null or the Entry Object currently being edited. |
|
44 | - * |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - public function get_field_input($form, $value = '', $entry = null, GF_Field_Post_Content $field) |
|
48 | - { |
|
49 | - $id = (int) $field->id; |
|
50 | - $input_name = "input_{$id}"; |
|
51 | - $class = esc_attr($field->size); |
|
52 | - $tabindex = $field->get_tabindex(); |
|
53 | - |
|
54 | - $editor_settings = [ |
|
55 | - 'editor_class' => "textarea {$class}", |
|
56 | - 'textarea_name' => $input_name, |
|
57 | - 'textarea_rows' => 15, |
|
58 | - 'tabindex' => $tabindex, |
|
59 | - 'media_buttons' => false, |
|
60 | - 'quicktags' => false, |
|
61 | - 'logic_event' => $field->get_conditional_logic_event('keyup'), |
|
62 | - 'placeholder' => $field->get_field_placeholder_attribute(), |
|
63 | - ]; |
|
64 | - |
|
65 | - /** |
|
66 | - * @filter `gravityview/edit_entry/post_content/wp_editor_settings` Modify the settings passed to the Post Content wp_editor() |
|
67 | - * |
|
68 | - * @see wp_editor() For the options available |
|
69 | - * @since 1.7 |
|
70 | - * |
|
71 | - * @param array $editor_settings Array of settings to be passed to wp_editor(). Note: there are also two additional values in the array: `logic_event` and `placehodler`, added to the textarea HTML by GravityView. |
|
72 | - */ |
|
73 | - $editor_settings = apply_filters('gravityview/edit_entry/post_content/wp_editor_settings', $editor_settings); |
|
74 | - |
|
75 | - ob_start(); |
|
76 | - wp_editor($value, $input_name, $editor_settings); |
|
77 | - $editor = ob_get_clean(); |
|
78 | - |
|
79 | - $logic_event = \GV\Utils::get($editor_settings, 'logic_event'); |
|
80 | - $placeholder = \GV\Utils::get($editor_settings, 'placeholder'); |
|
81 | - |
|
82 | - /** @internal Instead of using `add_filter('the_editor')` and doing the same thing, it's cleaner here. */ |
|
83 | - $editor = str_replace('<textarea ', "<textarea {$logic_event} {$placeholder}", $editor); |
|
84 | - |
|
85 | - return sprintf("<div class='ginput_container ginput_container_post_content'>%s</div>", trim($editor)); |
|
86 | - } |
|
7 | + public $name = 'post_content'; |
|
8 | + |
|
9 | + public $is_searchable = true; |
|
10 | + |
|
11 | + public $search_operators = ['is', 'isnot', 'contains', 'starts_with', 'ends_with']; |
|
12 | + |
|
13 | + public $_gf_field_class_name = 'GF_Field_Post_Content'; |
|
14 | + |
|
15 | + public $group = 'post'; |
|
16 | + |
|
17 | + public $icon = 'dashicons-editor-alignleft'; |
|
18 | + |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + $this->label = esc_html__('Post Content', 'gravityview'); |
|
22 | + parent::__construct(); |
|
23 | + } |
|
24 | + |
|
25 | + public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
26 | + { |
|
27 | + unset($field_options['show_as_link']); |
|
28 | + |
|
29 | + if ('edit' === $context) { |
|
30 | + return $field_options; |
|
31 | + } |
|
32 | + |
|
33 | + $this->add_field_support('dynamic_data', $field_options); |
|
34 | + |
|
35 | + return $field_options; |
|
36 | + } |
|
37 | + |
|
38 | + /** |
|
39 | + * Returns the field inner markup. |
|
40 | + * |
|
41 | + * @param array $form The Form Object currently being processed. |
|
42 | + * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
|
43 | + * @param null|array $entry Null or the Entry Object currently being edited. |
|
44 | + * |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + public function get_field_input($form, $value = '', $entry = null, GF_Field_Post_Content $field) |
|
48 | + { |
|
49 | + $id = (int) $field->id; |
|
50 | + $input_name = "input_{$id}"; |
|
51 | + $class = esc_attr($field->size); |
|
52 | + $tabindex = $field->get_tabindex(); |
|
53 | + |
|
54 | + $editor_settings = [ |
|
55 | + 'editor_class' => "textarea {$class}", |
|
56 | + 'textarea_name' => $input_name, |
|
57 | + 'textarea_rows' => 15, |
|
58 | + 'tabindex' => $tabindex, |
|
59 | + 'media_buttons' => false, |
|
60 | + 'quicktags' => false, |
|
61 | + 'logic_event' => $field->get_conditional_logic_event('keyup'), |
|
62 | + 'placeholder' => $field->get_field_placeholder_attribute(), |
|
63 | + ]; |
|
64 | + |
|
65 | + /** |
|
66 | + * @filter `gravityview/edit_entry/post_content/wp_editor_settings` Modify the settings passed to the Post Content wp_editor() |
|
67 | + * |
|
68 | + * @see wp_editor() For the options available |
|
69 | + * @since 1.7 |
|
70 | + * |
|
71 | + * @param array $editor_settings Array of settings to be passed to wp_editor(). Note: there are also two additional values in the array: `logic_event` and `placehodler`, added to the textarea HTML by GravityView. |
|
72 | + */ |
|
73 | + $editor_settings = apply_filters('gravityview/edit_entry/post_content/wp_editor_settings', $editor_settings); |
|
74 | + |
|
75 | + ob_start(); |
|
76 | + wp_editor($value, $input_name, $editor_settings); |
|
77 | + $editor = ob_get_clean(); |
|
78 | + |
|
79 | + $logic_event = \GV\Utils::get($editor_settings, 'logic_event'); |
|
80 | + $placeholder = \GV\Utils::get($editor_settings, 'placeholder'); |
|
81 | + |
|
82 | + /** @internal Instead of using `add_filter('the_editor')` and doing the same thing, it's cleaner here. */ |
|
83 | + $editor = str_replace('<textarea ', "<textarea {$logic_event} {$placeholder}", $editor); |
|
84 | + |
|
85 | + return sprintf("<div class='ginput_container ginput_container_post_content'>%s</div>", trim($editor)); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | new GravityView_Field_Post_Content(); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | public $is_searchable = true; |
10 | 10 | |
11 | - public $search_operators = ['is', 'isnot', 'contains', 'starts_with', 'ends_with']; |
|
11 | + public $search_operators = [ 'is', 'isnot', 'contains', 'starts_with', 'ends_with' ]; |
|
12 | 12 | |
13 | 13 | public $_gf_field_class_name = 'GF_Field_Post_Content'; |
14 | 14 | |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __construct() |
20 | 20 | { |
21 | - $this->label = esc_html__('Post Content', 'gravityview'); |
|
21 | + $this->label = esc_html__( 'Post Content', 'gravityview' ); |
|
22 | 22 | parent::__construct(); |
23 | 23 | } |
24 | 24 | |
25 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
25 | + public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) |
|
26 | 26 | { |
27 | - unset($field_options['show_as_link']); |
|
27 | + unset( $field_options[ 'show_as_link' ] ); |
|
28 | 28 | |
29 | - if ('edit' === $context) { |
|
29 | + if ( 'edit' === $context ) { |
|
30 | 30 | return $field_options; |
31 | 31 | } |
32 | 32 | |
33 | - $this->add_field_support('dynamic_data', $field_options); |
|
33 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
34 | 34 | |
35 | 35 | return $field_options; |
36 | 36 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return string |
46 | 46 | */ |
47 | - public function get_field_input($form, $value = '', $entry = null, GF_Field_Post_Content $field) |
|
47 | + public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field ) |
|
48 | 48 | { |
49 | - $id = (int) $field->id; |
|
49 | + $id = (int)$field->id; |
|
50 | 50 | $input_name = "input_{$id}"; |
51 | - $class = esc_attr($field->size); |
|
51 | + $class = esc_attr( $field->size ); |
|
52 | 52 | $tabindex = $field->get_tabindex(); |
53 | 53 | |
54 | 54 | $editor_settings = [ |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'tabindex' => $tabindex, |
59 | 59 | 'media_buttons' => false, |
60 | 60 | 'quicktags' => false, |
61 | - 'logic_event' => $field->get_conditional_logic_event('keyup'), |
|
61 | + 'logic_event' => $field->get_conditional_logic_event( 'keyup' ), |
|
62 | 62 | 'placeholder' => $field->get_field_placeholder_attribute(), |
63 | 63 | ]; |
64 | 64 | |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param array $editor_settings Array of settings to be passed to wp_editor(). Note: there are also two additional values in the array: `logic_event` and `placehodler`, added to the textarea HTML by GravityView. |
72 | 72 | */ |
73 | - $editor_settings = apply_filters('gravityview/edit_entry/post_content/wp_editor_settings', $editor_settings); |
|
73 | + $editor_settings = apply_filters( 'gravityview/edit_entry/post_content/wp_editor_settings', $editor_settings ); |
|
74 | 74 | |
75 | 75 | ob_start(); |
76 | - wp_editor($value, $input_name, $editor_settings); |
|
76 | + wp_editor( $value, $input_name, $editor_settings ); |
|
77 | 77 | $editor = ob_get_clean(); |
78 | 78 | |
79 | - $logic_event = \GV\Utils::get($editor_settings, 'logic_event'); |
|
80 | - $placeholder = \GV\Utils::get($editor_settings, 'placeholder'); |
|
79 | + $logic_event = \GV\Utils::get( $editor_settings, 'logic_event' ); |
|
80 | + $placeholder = \GV\Utils::get( $editor_settings, 'placeholder' ); |
|
81 | 81 | |
82 | 82 | /** @internal Instead of using `add_filter('the_editor')` and doing the same thing, it's cleaner here. */ |
83 | - $editor = str_replace('<textarea ', "<textarea {$logic_event} {$placeholder}", $editor); |
|
83 | + $editor = str_replace( '<textarea ', "<textarea {$logic_event} {$placeholder}", $editor ); |
|
84 | 84 | |
85 | - return sprintf("<div class='ginput_container ginput_container_post_content'>%s</div>", trim($editor)); |
|
85 | + return sprintf( "<div class='ginput_container ginput_container_post_content'>%s</div>", trim( $editor ) ); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * @file class-gravityview-field-post-content.php |
4 | 4 | */ |
5 | -class GravityView_Field_Post_Content extends GravityView_Field |
|
6 | -{ |
|
5 | +class GravityView_Field_Post_Content extends GravityView_Field { |
|
7 | 6 | public $name = 'post_content'; |
8 | 7 | |
9 | 8 | public $is_searchable = true; |
@@ -16,14 +15,12 @@ discard block |
||
16 | 15 | |
17 | 16 | public $icon = 'dashicons-editor-alignleft'; |
18 | 17 | |
19 | - public function __construct() |
|
20 | - { |
|
18 | + public function __construct() { |
|
21 | 19 | $this->label = esc_html__('Post Content', 'gravityview'); |
22 | 20 | parent::__construct(); |
23 | 21 | } |
24 | 22 | |
25 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
26 | - { |
|
23 | + public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) { |
|
27 | 24 | unset($field_options['show_as_link']); |
28 | 25 | |
29 | 26 | if ('edit' === $context) { |
@@ -44,8 +41,7 @@ discard block |
||
44 | 41 | * |
45 | 42 | * @return string |
46 | 43 | */ |
47 | - public function get_field_input($form, $value = '', $entry = null, GF_Field_Post_Content $field) |
|
48 | - { |
|
44 | + public function get_field_input($form, $value = '', $entry = null, GF_Field_Post_Content $field) { |
|
49 | 45 | $id = (int) $field->id; |
50 | 46 | $input_name = "input_{$id}"; |
51 | 47 | $class = esc_attr($field->size); |
@@ -6,63 +6,63 @@ |
||
6 | 6 | */ |
7 | 7 | class GravityView_Field_Workflow_Current_Status_Timestamp extends GravityView_Field |
8 | 8 | { |
9 | - public $name = 'workflow_current_status_timestamp'; |
|
9 | + public $name = 'workflow_current_status_timestamp'; |
|
10 | 10 | |
11 | - public $group = 'add-ons'; |
|
11 | + public $group = 'add-ons'; |
|
12 | 12 | |
13 | - public $contexts = ['multiple', 'single']; |
|
13 | + public $contexts = ['multiple', 'single']; |
|
14 | 14 | |
15 | - public $entry_meta_key = 'workflow_current_status_timestamp'; |
|
15 | + public $entry_meta_key = 'workflow_current_status_timestamp'; |
|
16 | 16 | |
17 | - public $is_numeric = true; |
|
17 | + public $is_numeric = true; |
|
18 | 18 | |
19 | - public $icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMS43IDExLjIiPjxwYXRoIGQ9Ik0xNC43IDUuOWwtNy00Yy0xLjItLjctMi41LS44LTMuNy0uMy0xLjcuNy0yLjYgMS45LTIuNyAzLjYtLjEgMS41LjQgMi43IDEuNCAzLjcgMS4xIDEuMSAyLjYgMS40IDQuMy45LjIgMCAuNS0uMiAxLjEtLjQuMi0uMS4zLS4xLjQtLjEuMyAwIC41LjEuNi40LjEuMyAwIC41LS4zLjctMS4yLjctMi40LjktMy44LjgtMS4zLS4yLTIuNS0uNy0zLjQtMS42Qy41IDguNS0uMSA3LjEgMCA1LjVjLjEtMi40IDEuMi00IDMuMy01QzQuNS0uMSA1LjgtLjIgNy4yLjJjLjIuMS42LjIgMS4yLjZsNyAzLjkuNC0uNi44IDIuMS0yLjIuMy4zLS42em0tNy44LS41bDcgNGMxLjIuNyAyLjUuOCAzLjcuMyAxLjctLjcgMi42LTEuOSAyLjgtMy42LjEtMS40LS40LTIuNi0xLjUtMy43cy0yLjUtMS40LTQuMy0xYy0uNC4xLS44LjMtMS4xLjRsLS40LjFjLS4zIDAtLjUtLjEtLjYtLjQtLjEtLjMgMC0uNS4zLS43IDEuMS0uNyAyLjQtLjkgMy44LS44IDEuNC4yIDIuNS43IDMuNCAxLjcgMS4yIDEuMiAxLjcgMi41IDEuNiA0LjEtLjEgMi4zLTEuMiA0LTMuMyA1LTEuNC42LTIuNy42LTMuOS4yLS4zLS4xLS43LS4zLTEuMS0uNWwtNy0zLjktLjQuNUw1LjEgNWwyLjItLjMtLjQuN3oiLz48L3N2Zz4='; |
|
19 | + public $icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMS43IDExLjIiPjxwYXRoIGQ9Ik0xNC43IDUuOWwtNy00Yy0xLjItLjctMi41LS44LTMuNy0uMy0xLjcuNy0yLjYgMS45LTIuNyAzLjYtLjEgMS41LjQgMi43IDEuNCAzLjcgMS4xIDEuMSAyLjYgMS40IDQuMy45LjIgMCAuNS0uMiAxLjEtLjQuMi0uMS4zLS4xLjQtLjEuMyAwIC41LjEuNi40LjEuMyAwIC41LS4zLjctMS4yLjctMi40LjktMy44LjgtMS4zLS4yLTIuNS0uNy0zLjQtMS42Qy41IDguNS0uMSA3LjEgMCA1LjVjLjEtMi40IDEuMi00IDMuMy01QzQuNS0uMSA1LjgtLjIgNy4yLjJjLjIuMS42LjIgMS4yLjZsNyAzLjkuNC0uNi44IDIuMS0yLjIuMy4zLS42em0tNy44LS41bDcgNGMxLjIuNyAyLjUuOCAzLjcuMyAxLjctLjcgMi42LTEuOSAyLjgtMy42LjEtMS40LS40LTIuNi0xLjUtMy43cy0yLjUtMS40LTQuMy0xYy0uNC4xLS44LjMtMS4xLjRsLS40LjFjLS4zIDAtLjUtLjEtLjYtLjQtLjEtLjMgMC0uNS4zLS43IDEuMS0uNyAyLjQtLjkgMy44LS44IDEuNC4yIDIuNS43IDMuNCAxLjcgMS4yIDEuMiAxLjcgMi41IDEuNiA0LjEtLjEgMi4zLTEuMiA0LTMuMyA1LTEuNC42LTIuNy42LTMuOS4yLS4zLS4xLS43LS4zLTEuMS0uNWwtNy0zLjktLjQuNUw1LjEgNWwyLjItLjMtLjQuN3oiLz48L3N2Zz4='; |
|
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->label = esc_html__('Workflow Current Status Timestamp', 'gravityview'); |
|
24 | - $this->add_hooks(); |
|
25 | - parent::__construct(); |
|
26 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->label = esc_html__('Workflow Current Status Timestamp', 'gravityview'); |
|
24 | + $this->add_hooks(); |
|
25 | + parent::__construct(); |
|
26 | + } |
|
27 | 27 | |
28 | - public function add_hooks() |
|
29 | - { |
|
30 | - add_filter('gravityview_field_entry_value_workflow_current_status_timestamp', [$this, 'modify_entry_value_workflow_current_status_timestamp'], 10, 4); |
|
31 | - } |
|
28 | + public function add_hooks() |
|
29 | + { |
|
30 | + add_filter('gravityview_field_entry_value_workflow_current_status_timestamp', [$this, 'modify_entry_value_workflow_current_status_timestamp'], 10, 4); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Convert a timestamp into a nice format. |
|
35 | - * |
|
36 | - * @param string $output HTML value output |
|
37 | - * @param array $entry The GF entry array |
|
38 | - * @param array $field_settings Settings for the particular GV field, |
|
39 | - * @param array $field Current field being displayed |
|
40 | - * |
|
41 | - * @since 1.17 |
|
42 | - * |
|
43 | - * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
|
44 | - */ |
|
45 | - public function modify_entry_value_workflow_current_status_timestamp($output, $entry, $field_settings, $field) |
|
46 | - { |
|
47 | - $timestamp = gform_get_meta($entry['id'], 'workflow_current_status_timestamp'); |
|
33 | + /** |
|
34 | + * Convert a timestamp into a nice format. |
|
35 | + * |
|
36 | + * @param string $output HTML value output |
|
37 | + * @param array $entry The GF entry array |
|
38 | + * @param array $field_settings Settings for the particular GV field, |
|
39 | + * @param array $field Current field being displayed |
|
40 | + * |
|
41 | + * @since 1.17 |
|
42 | + * |
|
43 | + * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
|
44 | + */ |
|
45 | + public function modify_entry_value_workflow_current_status_timestamp($output, $entry, $field_settings, $field) |
|
46 | + { |
|
47 | + $timestamp = gform_get_meta($entry['id'], 'workflow_current_status_timestamp'); |
|
48 | 48 | |
49 | - if (!$timestamp) { |
|
50 | - return $timestamp; |
|
51 | - } |
|
49 | + if (!$timestamp) { |
|
50 | + return $timestamp; |
|
51 | + } |
|
52 | 52 | |
53 | - return GVCommon::format_date(date('Y-m-d H:i:s', $timestamp), 'format='.\GV\Utils::get($field_settings, 'date_display')); |
|
54 | - } |
|
53 | + return GVCommon::format_date(date('Y-m-d H:i:s', $timestamp), 'format='.\GV\Utils::get($field_settings, 'date_display')); |
|
54 | + } |
|
55 | 55 | |
56 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
57 | - { |
|
58 | - if ($context == 'edit') { |
|
59 | - return $field_options; |
|
60 | - } |
|
56 | + public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
57 | + { |
|
58 | + if ($context == 'edit') { |
|
59 | + return $field_options; |
|
60 | + } |
|
61 | 61 | |
62 | - $this->add_field_support('date_display', $field_options); |
|
62 | + $this->add_field_support('date_display', $field_options); |
|
63 | 63 | |
64 | - return $field_options; |
|
65 | - } |
|
64 | + return $field_options; |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | new GravityView_Field_Workflow_Current_Status_Timestamp(); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | public $group = 'add-ons'; |
12 | 12 | |
13 | - public $contexts = ['multiple', 'single']; |
|
13 | + public $contexts = [ 'multiple', 'single' ]; |
|
14 | 14 | |
15 | 15 | public $entry_meta_key = 'workflow_current_status_timestamp'; |
16 | 16 | |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct() |
22 | 22 | { |
23 | - $this->label = esc_html__('Workflow Current Status Timestamp', 'gravityview'); |
|
23 | + $this->label = esc_html__( 'Workflow Current Status Timestamp', 'gravityview' ); |
|
24 | 24 | $this->add_hooks(); |
25 | 25 | parent::__construct(); |
26 | 26 | } |
27 | 27 | |
28 | 28 | public function add_hooks() |
29 | 29 | { |
30 | - add_filter('gravityview_field_entry_value_workflow_current_status_timestamp', [$this, 'modify_entry_value_workflow_current_status_timestamp'], 10, 4); |
|
30 | + add_filter( 'gravityview_field_entry_value_workflow_current_status_timestamp', [ $this, 'modify_entry_value_workflow_current_status_timestamp' ], 10, 4 ); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -42,24 +42,24 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
44 | 44 | */ |
45 | - public function modify_entry_value_workflow_current_status_timestamp($output, $entry, $field_settings, $field) |
|
45 | + public function modify_entry_value_workflow_current_status_timestamp( $output, $entry, $field_settings, $field ) |
|
46 | 46 | { |
47 | - $timestamp = gform_get_meta($entry['id'], 'workflow_current_status_timestamp'); |
|
47 | + $timestamp = gform_get_meta( $entry[ 'id' ], 'workflow_current_status_timestamp' ); |
|
48 | 48 | |
49 | - if (!$timestamp) { |
|
49 | + if ( ! $timestamp ) { |
|
50 | 50 | return $timestamp; |
51 | 51 | } |
52 | 52 | |
53 | - return GVCommon::format_date(date('Y-m-d H:i:s', $timestamp), 'format='.\GV\Utils::get($field_settings, 'date_display')); |
|
53 | + return GVCommon::format_date( date( 'Y-m-d H:i:s', $timestamp ), 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
54 | 54 | } |
55 | 55 | |
56 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
56 | + public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) |
|
57 | 57 | { |
58 | - if ($context == 'edit') { |
|
58 | + if ( $context == 'edit' ) { |
|
59 | 59 | return $field_options; |
60 | 60 | } |
61 | 61 | |
62 | - $this->add_field_support('date_display', $field_options); |
|
62 | + $this->add_field_support( 'date_display', $field_options ); |
|
63 | 63 | |
64 | 64 | return $field_options; |
65 | 65 | } |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @since develop |
6 | 6 | */ |
7 | -class GravityView_Field_Workflow_Current_Status_Timestamp extends GravityView_Field |
|
8 | -{ |
|
7 | +class GravityView_Field_Workflow_Current_Status_Timestamp extends GravityView_Field { |
|
9 | 8 | public $name = 'workflow_current_status_timestamp'; |
10 | 9 | |
11 | 10 | public $group = 'add-ons'; |
@@ -18,15 +17,13 @@ discard block |
||
18 | 17 | |
19 | 18 | public $icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMS43IDExLjIiPjxwYXRoIGQ9Ik0xNC43IDUuOWwtNy00Yy0xLjItLjctMi41LS44LTMuNy0uMy0xLjcuNy0yLjYgMS45LTIuNyAzLjYtLjEgMS41LjQgMi43IDEuNCAzLjcgMS4xIDEuMSAyLjYgMS40IDQuMy45LjIgMCAuNS0uMiAxLjEtLjQuMi0uMS4zLS4xLjQtLjEuMyAwIC41LjEuNi40LjEuMyAwIC41LS4zLjctMS4yLjctMi40LjktMy44LjgtMS4zLS4yLTIuNS0uNy0zLjQtMS42Qy41IDguNS0uMSA3LjEgMCA1LjVjLjEtMi40IDEuMi00IDMuMy01QzQuNS0uMSA1LjgtLjIgNy4yLjJjLjIuMS42LjIgMS4yLjZsNyAzLjkuNC0uNi44IDIuMS0yLjIuMy4zLS42em0tNy44LS41bDcgNGMxLjIuNyAyLjUuOCAzLjcuMyAxLjctLjcgMi42LTEuOSAyLjgtMy42LjEtMS40LS40LTIuNi0xLjUtMy43cy0yLjUtMS40LTQuMy0xYy0uNC4xLS44LjMtMS4xLjRsLS40LjFjLS4zIDAtLjUtLjEtLjYtLjQtLjEtLjMgMC0uNS4zLS43IDEuMS0uNyAyLjQtLjkgMy44LS44IDEuNC4yIDIuNS43IDMuNCAxLjcgMS4yIDEuMiAxLjcgMi41IDEuNiA0LjEtLjEgMi4zLTEuMiA0LTMuMyA1LTEuNC42LTIuNy42LTMuOS4yLS4zLS4xLS43LS4zLTEuMS0uNWwtNy0zLjktLjQuNUw1LjEgNWwyLjItLjMtLjQuN3oiLz48L3N2Zz4='; |
20 | 19 | |
21 | - public function __construct() |
|
22 | - { |
|
20 | + public function __construct() { |
|
23 | 21 | $this->label = esc_html__('Workflow Current Status Timestamp', 'gravityview'); |
24 | 22 | $this->add_hooks(); |
25 | 23 | parent::__construct(); |
26 | 24 | } |
27 | 25 | |
28 | - public function add_hooks() |
|
29 | - { |
|
26 | + public function add_hooks() { |
|
30 | 27 | add_filter('gravityview_field_entry_value_workflow_current_status_timestamp', [$this, 'modify_entry_value_workflow_current_status_timestamp'], 10, 4); |
31 | 28 | } |
32 | 29 | |
@@ -42,8 +39,7 @@ discard block |
||
42 | 39 | * |
43 | 40 | * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
44 | 41 | */ |
45 | - public function modify_entry_value_workflow_current_status_timestamp($output, $entry, $field_settings, $field) |
|
46 | - { |
|
42 | + public function modify_entry_value_workflow_current_status_timestamp($output, $entry, $field_settings, $field) { |
|
47 | 43 | $timestamp = gform_get_meta($entry['id'], 'workflow_current_status_timestamp'); |
48 | 44 | |
49 | 45 | if (!$timestamp) { |
@@ -53,8 +49,7 @@ discard block |
||
53 | 49 | return GVCommon::format_date(date('Y-m-d H:i:s', $timestamp), 'format='.\GV\Utils::get($field_settings, 'date_display')); |
54 | 50 | } |
55 | 51 | |
56 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
57 | - { |
|
52 | + public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) { |
|
58 | 53 | if ($context == 'edit') { |
59 | 54 | return $field_options; |
60 | 55 | } |
@@ -4,36 +4,36 @@ |
||
4 | 4 | */ |
5 | 5 | class GravityView_Field_Quiz extends GravityView_Field |
6 | 6 | { |
7 | - public $name = 'quiz'; |
|
7 | + public $name = 'quiz'; |
|
8 | 8 | |
9 | - public $group = 'advanced'; |
|
9 | + public $group = 'advanced'; |
|
10 | 10 | |
11 | - public $icon = 'dashicons-forms'; |
|
11 | + public $icon = 'dashicons-forms'; |
|
12 | 12 | |
13 | - public function __construct() |
|
14 | - { |
|
15 | - $this->label = esc_html__('Quiz', 'gravityview'); |
|
16 | - parent::__construct(); |
|
17 | - } |
|
13 | + public function __construct() |
|
14 | + { |
|
15 | + $this->label = esc_html__('Quiz', 'gravityview'); |
|
16 | + parent::__construct(); |
|
17 | + } |
|
18 | 18 | |
19 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
20 | - { |
|
21 | - if ('edit' === $context) { |
|
22 | - return $field_options; |
|
23 | - } |
|
19 | + public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
20 | + { |
|
21 | + if ('edit' === $context) { |
|
22 | + return $field_options; |
|
23 | + } |
|
24 | 24 | |
25 | - $new_fields = [ |
|
26 | - 'quiz_show_explanation' => [ |
|
27 | - 'type' => 'checkbox', |
|
28 | - 'label' => __('Show Answer Explanation?', 'gravityview'), |
|
29 | - 'desc' => __('If the field has an answer explanation, show it?', 'gravityview'), |
|
30 | - 'value' => false, |
|
31 | - 'merge_tags' => false, |
|
32 | - ], |
|
33 | - ]; |
|
25 | + $new_fields = [ |
|
26 | + 'quiz_show_explanation' => [ |
|
27 | + 'type' => 'checkbox', |
|
28 | + 'label' => __('Show Answer Explanation?', 'gravityview'), |
|
29 | + 'desc' => __('If the field has an answer explanation, show it?', 'gravityview'), |
|
30 | + 'value' => false, |
|
31 | + 'merge_tags' => false, |
|
32 | + ], |
|
33 | + ]; |
|
34 | 34 | |
35 | - return $new_fields + $field_options; |
|
36 | - } |
|
35 | + return $new_fields + $field_options; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | new GravityView_Field_Quiz(); |
@@ -12,21 +12,21 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - $this->label = esc_html__('Quiz', 'gravityview'); |
|
15 | + $this->label = esc_html__( 'Quiz', 'gravityview' ); |
|
16 | 16 | parent::__construct(); |
17 | 17 | } |
18 | 18 | |
19 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
19 | + public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) |
|
20 | 20 | { |
21 | - if ('edit' === $context) { |
|
21 | + if ( 'edit' === $context ) { |
|
22 | 22 | return $field_options; |
23 | 23 | } |
24 | 24 | |
25 | 25 | $new_fields = [ |
26 | 26 | 'quiz_show_explanation' => [ |
27 | 27 | 'type' => 'checkbox', |
28 | - 'label' => __('Show Answer Explanation?', 'gravityview'), |
|
29 | - 'desc' => __('If the field has an answer explanation, show it?', 'gravityview'), |
|
28 | + 'label' => __( 'Show Answer Explanation?', 'gravityview' ), |
|
29 | + 'desc' => __( 'If the field has an answer explanation, show it?', 'gravityview' ), |
|
30 | 30 | 'value' => false, |
31 | 31 | 'merge_tags' => false, |
32 | 32 | ], |
@@ -2,22 +2,19 @@ |
||
2 | 2 | /** |
3 | 3 | * @file class-gravityview-field-gquiz.php |
4 | 4 | */ |
5 | -class GravityView_Field_Quiz extends GravityView_Field |
|
6 | -{ |
|
5 | +class GravityView_Field_Quiz extends GravityView_Field { |
|
7 | 6 | public $name = 'quiz'; |
8 | 7 | |
9 | 8 | public $group = 'advanced'; |
10 | 9 | |
11 | 10 | public $icon = 'dashicons-forms'; |
12 | 11 | |
13 | - public function __construct() |
|
14 | - { |
|
12 | + public function __construct() { |
|
15 | 13 | $this->label = esc_html__('Quiz', 'gravityview'); |
16 | 14 | parent::__construct(); |
17 | 15 | } |
18 | 16 | |
19 | - public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) |
|
20 | - { |
|
17 | + public function field_options($field_options, $template_id, $field_id, $context, $input_type, $form_id) { |
|
21 | 18 | if ('edit' === $context) { |
22 | 19 | return $field_options; |
23 | 20 | } |