| @@ 59-69 (lines=11) @@ | ||
| 56 | * |
|
| 57 | * @param int $comment_id ID of the comment against which save() is ran |
|
| 58 | */ |
|
| 59 | public function save( $comment_id = null ) { |
|
| 60 | // Unhook action to guarantee single save |
|
| 61 | remove_action( 'edit_comment', array( $this, '_save' ) ); |
|
| 62 | ||
| 63 | $this->set_comment_id( $comment_id ); |
|
| 64 | ||
| 65 | foreach ( $this->fields as $field ) { |
|
| 66 | $field->set_value_from_input( Helper::input() ); |
|
| 67 | $field->save(); |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Get environment array for page request (in admin) |
|
| @@ 62-74 (lines=13) @@ | ||
| 59 | * |
|
| 60 | * @param int $user_id ID of the user against which save() is ran |
|
| 61 | */ |
|
| 62 | public function save( $user_id = null ) { |
|
| 63 | // Unhook action to garantee single save |
|
| 64 | remove_action( 'profile_update', array( $this, '_save' ) ); |
|
| 65 | ||
| 66 | $this->set_user_id( $user_id ); |
|
| 67 | ||
| 68 | foreach ( $this->fields as $field ) { |
|
| 69 | $field->set_value_from_input( Helper::input() ); |
|
| 70 | $field->save(); |
|
| 71 | } |
|
| 72 | ||
| 73 | do_action( 'carbon_fields_user_meta_container_saved', $user_id, $this ); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Get environment array for page request (in admin) |
|
| @@ 105-117 (lines=13) @@ | ||
| 102 | * |
|
| 103 | * @param int $post_id ID of the post against which save() is ran |
|
| 104 | */ |
|
| 105 | public function save( $post_id = null ) { |
|
| 106 | // Unhook action to garantee single save |
|
| 107 | remove_action( 'save_post', array( $this, '_save' ) ); |
|
| 108 | ||
| 109 | $this->set_post_id( $post_id ); |
|
| 110 | ||
| 111 | foreach ( $this->fields as $field ) { |
|
| 112 | $field->set_value_from_input( Helper::input() ); |
|
| 113 | $field->save(); |
|
| 114 | } |
|
| 115 | ||
| 116 | do_action( 'carbon_fields_post_meta_container_saved', $post_id, $this ); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Get environment array for page request (in admin) |
|