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 | * Given information provided in an entry, get array of media IDs |
||
28 | * |
||
29 | * This is necessary because GF doesn't expect to need to update post images, only to create them. |
||
30 | * |
||
31 | * @see GFFormsModel::create_post() |
||
32 | * |
||
33 | * @since 1.17 |
||
34 | * |
||
35 | * @param array $form Gravity Forms form array |
||
36 | * @param array $entry Gravity Forms entry array |
||
37 | * |
||
38 | * @return array Array of "Field ID" => "Media IDs" |
||
39 | */ |
||
40 | public static function get_post_field_images( $form, $entry ) { |
||
62 | |||
63 | /** |
||
64 | * Alias of GFFormsModel::get_post_fields(); just making it public |
||
65 | * |
||
66 | * @see GFFormsModel::get_post_fields() |
||
67 | * |
||
68 | * @since 1.17 |
||
69 | * |
||
70 | * @param array $form Gravity Forms form array |
||
71 | * @param array $entry Gravity Forms entry array |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | public static function get_post_fields( $form, $entry ) { |
||
92 | |||
93 | /** |
||
94 | * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
||
95 | * |
||
96 | * @since 1.16.2 |
||
97 | * |
||
98 | * @param string $url URL of the post image to update |
||
99 | * @param int $post_id ID of the post image to update |
||
100 | * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
||
101 | */ |
||
102 | public static function copy_post_image( $url, $post_id ) { |
||
119 | |||
120 | /** |
||
121 | * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
||
122 | * |
||
123 | * Note: The method became public in GF 1.9.17.7 |
||
124 | * |
||
125 | * @see GFFormsModel::media_handle_upload |
||
126 | * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
||
127 | * |
||
128 | * @uses copy_post_image |
||
129 | * @uses wp_insert_attachment |
||
130 | * @uses wp_update_attachment_metadata |
||
131 | * |
||
132 | * @param string $url URL of the post image to update |
||
133 | * @param int $post_id ID of the post image to update |
||
134 | * @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. |
||
135 | * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
||
136 | */ |
||
137 | public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
||
154 | |||
155 | } |