Plugin Directory

Changeset 1330109


Ignore:
Timestamp:
01/17/2016 07:43:16 PM (10 years ago)
Author:
arnesonium
Message:

Add Contact Form 7 Support

Added a separate shortcode for CF7. It appears to work with a couple of
JavaScript warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • openpgp-form-encryption/trunk/wordpress-openpgp.php

    r1194842 r1330109  
    7575    );
    7676
     77    return openpgp_cryptbutton_create($args, $content, $tag);
     78}
     79
     80function openpgp_cryptbutton_wpcf7 ($tag) {
     81    if (!is_array($tag)) return '';
     82
     83    openpgp_enqueue_scripts();
     84
     85    $tag = new WPCF7_Shortcode( $tag );
     86
     87    $args = array(
     88        'textarea' => $tag->get_option('textarea', 'id', true),
     89        'keyurl' => $tag->get_option('keyurl', '.*', true),
     90        'keyid' => $tag->get_option('keyid', 'int', true),
     91        'class' => $tag->get_class_option(),
     92        'style' => $tag->get_option('style', 'class', true),
     93        'text' => $tag->values[0]
     94    );
     95
     96    return openpgp_cryptbutton_create ($args);
     97}
     98
     99function openpgp_cryptbutton_create ($args, $content = null, $tag = null) {
     100   
    77101    $keyurl = $args['keyurl'];
    78102
     
    100124add_action('wp_head', 'openpgp_cryptbutton_header');
    101125add_shortcode('cryptbutton', 'openpgp_cryptbutton_shortcode');
     126
     127// If Contact Form 7 is installed, we can do this, too.
     128add_action('wpcf7_init', function () {
     129    wpcf7_add_shortcode('cryptbutton', 'openpgp_cryptbutton_wpcf7', false);
     130});
     131
Note: See TracChangeset for help on using the changeset viewer.