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 | 3 | 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 | 1 | public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) { |
|
53 | |||
54 | /** |
||
55 | * Given information provided in an entry, get array of media IDs |
||
56 | * |
||
57 | * This is necessary because GF doesn't expect to need to update post images, only to create them. |
||
58 | * |
||
59 | * @see GFFormsModel::create_post() |
||
60 | * |
||
61 | * @since 1.17 |
||
62 | * |
||
63 | * @param array $form Gravity Forms form array |
||
64 | * @param array $entry Gravity Forms entry array |
||
65 | * |
||
66 | * @return array Array of "Field ID" => "Media IDs" |
||
67 | */ |
||
68 | public static function get_post_field_images( $form, $entry ) { |
||
90 | |||
91 | /** |
||
92 | * Alias of GFFormsModel::get_post_fields(); just making it public |
||
93 | * |
||
94 | * @see GFFormsModel::get_post_fields() |
||
95 | * |
||
96 | * @since 1.17 |
||
97 | * |
||
98 | * @param array $form Gravity Forms form array |
||
99 | * @param array $entry Gravity Forms entry array |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | public static function get_post_fields( $form, $entry ) { |
||
120 | |||
121 | /** |
||
122 | * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
||
123 | * |
||
124 | * @since 1.16.2 |
||
125 | * |
||
126 | * @param string $url URL of the post image to update |
||
127 | * @param int $post_id ID of the post image to update |
||
128 | * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
||
129 | */ |
||
130 | public static function copy_post_image( $url, $post_id ) { |
||
147 | |||
148 | /** |
||
149 | * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
||
150 | * |
||
151 | * Note: The method became public in GF 1.9.17.7 |
||
152 | * |
||
153 | * @see GFFormsModel::media_handle_upload |
||
154 | * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
||
155 | * |
||
156 | * @uses copy_post_image |
||
157 | * @uses wp_insert_attachment |
||
158 | * @uses wp_update_attachment_metadata |
||
159 | * |
||
160 | * @param string $url URL of the post image to update |
||
161 | * @param int $post_id ID of the post image to update |
||
162 | * @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. |
||
163 | * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
||
164 | */ |
||
165 | public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
||
182 | |||
183 | } |