1 | <?php |
||
8 | class GravityView_GFFormsModel extends GFFormsModel { |
||
9 | |||
10 | /** |
||
11 | * Make sure the method exists, regardless of GF version |
||
12 | * |
||
13 | * @since 1.22.2 |
||
14 | * |
||
15 | * @return string|false False if not set, version string otherwise |
||
16 | */ |
||
17 | 21 | public static function get_database_version() { |
|
25 | |||
26 | /** |
||
27 | * Determines if the field value matches the conditional logic rule value. |
||
28 | * |
||
29 | * @since 1.22.3 |
||
30 | * |
||
31 | * @param mixed $field_value The field value to be checked. |
||
32 | * @param mixed $target_value The conditional logic rule value. |
||
33 | * @param string $operation The conditional logic rule operator. |
||
34 | * @param null|GF_Field|string $source_field The field the rule is based on, or the entry meta |
||
35 | * @param null|array $rule The conditional logic rule properties. |
||
36 | * @param null|array $form The current form. |
||
37 | * |
||
38 | * @return bool |
||
39 | */ |
||
40 | public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) { |
||
41 | |||
42 | if ( in_array( $source_field, array( 'date_created', 'date_updated', 'payment_date' ), true ) ) { |
||
43 | $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
||
44 | $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
||
45 | } |
||
46 | |||
47 | if ( $source_field instanceof GF_Field && $source_field->type == 'date' ) { |
||
|
|||
48 | $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
||
49 | $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
||
50 | } |
||
51 | |||
52 | if ( in_array( $_operation = str_replace( ' ', '_', trim( $operation ) ), array( 'in', 'not_in' ) ) ) { |
||
53 | return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $_operation ); |
||
54 | } |
||
55 | |||
56 | return parent::is_value_match( $field_value, $target_value, $operation, $source_field, $rule, $form ); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Given information provided in an entry, get array of media IDs |
||
61 | * |
||
62 | * This is necessary because GF doesn't expect to need to update post images, only to create them. |
||
63 | * |
||
64 | * @see GFFormsModel::create_post() |
||
65 | * |
||
66 | * @since 1.17 |
||
67 | * |
||
68 | * @param array $form Gravity Forms form array |
||
69 | * @param array $entry Gravity Forms entry array |
||
70 | * |
||
71 | * @return array Array of "Field ID" => "Media IDs" |
||
72 | */ |
||
73 | public static function get_post_field_images( $form, $entry ) { |
||
95 | |||
96 | /** |
||
97 | * Alias of GFFormsModel::get_post_fields(); just making it public |
||
98 | * |
||
99 | * @see GFFormsModel::get_post_fields() |
||
100 | * |
||
101 | * @since 1.17 |
||
102 | * |
||
103 | * @param array $form Gravity Forms form array |
||
104 | * @param array $entry Gravity Forms entry array |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | public static function get_post_fields( $form, $entry ) { |
||
125 | |||
126 | /** |
||
127 | * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
||
128 | * |
||
129 | * @since 1.16.2 |
||
130 | * |
||
131 | * @param string $url URL of the post image to update |
||
132 | * @param int $post_id ID of the post image to update |
||
133 | * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
||
134 | */ |
||
135 | public static function copy_post_image( $url, $post_id ) { |
||
152 | |||
153 | /** |
||
154 | * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
||
155 | * |
||
156 | * Note: The method became public in GF 1.9.17.7 |
||
157 | * |
||
158 | * @see GFFormsModel::media_handle_upload |
||
159 | * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
||
160 | * |
||
161 | * @uses copy_post_image |
||
162 | * @uses wp_insert_attachment |
||
163 | * @uses wp_update_attachment_metadata |
||
164 | * |
||
165 | * @param string $url URL of the post image to update |
||
166 | * @param int $post_id ID of the post image to update |
||
167 | * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
||
168 | * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
||
169 | */ |
||
170 | public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
||
187 | |||
188 | } |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.