1 | <?php |
||
8 | class GravityView_GFFormsModel extends GFFormsModel { |
||
9 | |||
10 | /** |
||
11 | * Given information provided in an entry, get array of media IDs |
||
12 | * |
||
13 | * This is necessary because GF doesn't expect to need to update post images, only to create them. |
||
14 | * |
||
15 | * @see GFFormsModel::create_post() |
||
16 | * |
||
17 | * @since 1.17 |
||
18 | * |
||
19 | * @param array $form Gravity Forms form array |
||
20 | * @param array $entry Gravity Forms entry array |
||
21 | * |
||
22 | * @return array Array of "Field ID" => "Media IDs" |
||
23 | */ |
||
24 | public static function get_post_field_images( $form, $entry ) { |
||
46 | |||
47 | /** |
||
48 | * Alias of GFFormsModel::get_post_fields(); just making it public |
||
49 | * |
||
50 | * @see GFFormsModel::get_post_fields() |
||
51 | * |
||
52 | * @since 1.17 |
||
53 | * |
||
54 | * @param array $form Gravity Forms form array |
||
55 | * @param array $entry Gravity Forms entry array |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | public static function get_post_fields( $form, $entry ) { |
||
76 | |||
77 | /** |
||
78 | * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
||
79 | * |
||
80 | * @since 1.16.2 |
||
81 | * |
||
82 | * @param string $url URL of the post image to update |
||
83 | * @param int $post_id ID of the post image to update |
||
84 | * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
||
85 | */ |
||
86 | public static function copy_post_image( $url, $post_id ) { |
||
103 | |||
104 | /** |
||
105 | * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
||
106 | * |
||
107 | * Note: The method became public in GF 1.9.17.7 |
||
108 | * |
||
109 | * @see GFFormsModel::media_handle_upload |
||
110 | * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
||
111 | * |
||
112 | * @uses copy_post_image |
||
113 | * @uses wp_insert_attachment |
||
114 | * @uses wp_update_attachment_metadata |
||
115 | * |
||
116 | * @param string $url URL of the post image to update |
||
117 | * @param int $post_id ID of the post image to update |
||
118 | * @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. |
||
119 | * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
||
120 | */ |
||
121 | public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
||
138 | |||
139 | } |