/home/altere25/infinet.finance/wp-content/plugins/weforms/includes/fields
Edit: /home/altere25/infinet.finance/wp-content/plugins/weforms/includes/fields/class-field-image.php (5485B)
name = __( 'Image Upload', 'weforms' );
$this->input_type = 'image_upload';
$this->icon = 'file-image-o';
}
/**
* Render the text field
*
* @param array $field_settings
* @param int $form_id
*
* @return void
*/
public function render( $field_settings, $form_id ) {
$form_settings = weforms()->form->get( $form_id )->get_settings();
$use_theme_css = isset( $form_settings['use_theme_css'] ) ? $form_settings['use_theme_css'] : 'wpuf-style';
$unique_id = sprintf( '%s-%d', $field_settings['name'], $form_id ); ?>
print_list_attributes( $field_settings ); ?>>
print_label( $field_settings, $form_id ); ?>
help_text( $field_settings ); ?>
get_default_option_settings( true, ['dynamic', 'width'] ); // exclude dynamic
$settings = [
[
'name' => 'max_size',
'title' => __( 'Max. file size', 'weforms' ),
'type' => 'text',
'section' => 'advanced',
'priority' => 20,
'help_text' => __( 'Enter maximum upload size limit in KB', 'weforms' ),
],
[
'name' => 'count',
'title' => __( 'Max. files', 'weforms' ),
'type' => 'text',
'section' => 'advanced',
'priority' => 21,
'help_text' => __( 'Number of images can be uploaded', 'weforms' ),
],
[
'name' => 'button_label',
'title' => __( 'Button Label', 'weforms' ),
'type' => 'text',
'default' => __( 'Select Image', 'weforms' ),
'section' => 'basic',
'priority' => 22,
'help_text' => __( 'Enter a label for the Select button', 'weforms' ),
],
];
return array_merge( $default_options, $settings );
}
/**
* Get the field props
*
* @return array
*/
public function get_field_props() {
$defaults = $this->default_attributes();
$props = [
'max_size' => '1024',
'count' => '1',
'button_label' => __( 'Select Image', 'weforms' ),
];
return array_merge( $defaults, $props );
}
/**
* Prepare entry
*
* @param $field
*
* @return @return mixed
*/
public function prepare_entry( $field, $args = [] ) {
if( empty( $_POST[ '_wpnonce' ] ) ) {
wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
}
if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'wpuf_form_add' ) ) {
wp_send_json_error( __( 'Unauthorized operation', 'weforms' ) );
}
$args = ! empty( $args ) ? $args : weforms_clean( $_POST );
return isset( $args['wpuf_files'][$field['name']] ) ? $args['wpuf_files'][$field['name']] : [];
}
}