first commit

This commit is contained in:
Rachit Bhargava
2023-07-21 17:12:10 -04:00
parent d0fe47dde4
commit 5d0f0734d8
14003 changed files with 2829464 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
(function($) {
'use strict';
if (typeof wpcf7 === 'undefined' || wpcf7 === null) {
return;
}
window.wpcf7dtx = window.wpcf7dtx || {};
wpcf7dtx.taggen = {};
wpcf7dtx.taggen.escapeRegExp = function(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
};
wpcf7dtx.taggen.replaceAll = function(input, f, r, no_escape) {
if (input !== undefined && input !== null && typeof(input) == 'string' && input.trim() !== '' && input.indexOf(f) > -1) {
var rexp = new RegExp(wpcf7dtx.taggen.escapeRegExp(f), 'g');
if (no_escape) { rexp = new RegExp(f, 'g'); }
return input.replace(rexp, r);
}
return input;
};
wpcf7dtx.taggen.updateOption = function(e) {
var $this = $(e.currentTarget),
value = encodeURIComponent(wpcf7dtx.taggen.replaceAll($this.val(), "'", '''));
$this.siblings('input[type="hidden"].option').val(value);
};
$(function() {
$('form.tag-generator-panel input.dtx-option').on('change keyup', wpcf7dtx.taggen.updateOption);
});
})(jQuery);

View File

@@ -0,0 +1,7 @@
.tag-generator-panel table.form-table th {
width: 130px;
}
.tag-generator-panel .control-box input.oneline {
width: 100%;
}

View File

@@ -0,0 +1,216 @@
<?php
/**
* Plugin Name: Contact Form 7 - Dynamic Text Extension
* Plugin URI: https://sevenspark.com/goods/contact-form-7-dynamic-text-extension
* Description: This plugin extends Contact Form 7 by adding dynamic form fields that accept any shortcode to generate default values and placeholder text. Requires Contact Form 7.
* Version: 3.2
* Author: SevenSpark, AuRise Creative
* Author URI: https://sevenspark.com
* License: GPL2
* Requires at least: 5.5
* Requires PHP: 7.4
* Text Domain: contact-form-7-dynamic-text-extension
*/
/*
Copyright 2010-2023 Chris Mavricos, SevenSpark <https://sevenspark.com>
Copyright 2022-2023 Tessa Watkins, AuRise Creative <https://aurisecreative.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Define current version
define('WPCF7DTX_VERSION', '3.2');
// Define root directory
defined('WPCF7DTX_DIR') || define('WPCF7DTX_DIR', __DIR__);
// Define root file
defined('WPCF7DTX_FILE') || define('WPCF7DTX_FILE', __FILE__);
/**
* Initialise Plugin
*
* @return void
*/
function wpcf7dtx_init()
{
add_action('wpcf7_init', 'wpcf7dtx_add_shortcode_dynamictext'); // Add custom form tags to CF7
add_filter('wpcf7_validate_dynamictext*', 'wpcf7dtx_dynamictext_validation_filter', 10, 2); // Validate custom form tags
}
add_action('plugins_loaded', 'wpcf7dtx_init', 20);
/**
* Add Custom Shortcodes to Contact Form 7
*
* @return void
*/
function wpcf7dtx_add_shortcode_dynamictext()
{
//Add the dynamic text and hidden form fields
wpcf7_add_form_tag(
array(
'dynamictext', 'dynamictext*',
'dynamichidden', 'dynamichidden*' //Required hidden fields do nothing
),
'wpcf7dtx_dynamictext_shortcode_handler', //Callback
array('name-attr' => true) //Features
);
}
/**
* Form Tag Handler
*
* @param WPCF7_FormTag $tag
* @return string HTML output of the shortcode
*/
function wpcf7dtx_dynamictext_shortcode_handler($tag)
{
$tag = new WPCF7_FormTag($tag);
if (empty($tag->name)) {
return '';
}
//Validate
$validation_error = wpcf7_get_validation_error($tag->name);
//Configure classes
$class = wpcf7_form_controls_class($tag->type, 'wpcf7dtx-dynamictext');
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
//Configure input attributes
$atts = array();
$atts['name'] = $tag->name;
$atts['id'] = $tag->get_id_option();
$atts['class'] = $tag->get_class_option($class);
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['minlength'] = $tag->get_minlength_option();
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
switch ($tag->basetype) {
case 'dynamichidden':
$atts['type'] = 'hidden'; //Override type as hidden
break;
default: // Includes `dynamictext`
$atts['type'] = 'text'; //Override type as text
break;
}
if ($atts['maxlength'] && $atts['minlength'] && $atts['maxlength'] < $atts['minlength']) {
unset($atts['maxlength'], $atts['minlength']);
}
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required() && $atts['type'] !== 'hidden') {
$atts['aria-required'] = 'true';
}
// Evaluate the dynamic value
$value = wpcf7_get_hangover($tag->name, $tag->get_default_option(strval(reset($tag->values)))); // Input value
$scstr = '[' . $value . ']';
$scval = do_shortcode($scstr); //Shortcode value
if ($scval !== $scstr) {
$value = $scval; //Set the input value to the evaluated shortcode
}
// Identify placeholder
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
//Reverse engineer what JS did (converted quotes to HTML entities --> URL encode) then sanitize
$placeholder = sanitize_text_field(html_entity_decode(urldecode(implode('', (array)$tag->get_option('placeholder'))), ENT_QUOTES));
if ($placeholder) {
$scpstr = '[' . $placeholder . ']';
$scpval = do_shortcode($scpstr); //Shortcode value
if ($scpval !== $scpstr) {
$placeholder = $scpval; //Set the placeholder value to the evaluated shortcode
}
//If a different placeholder text has been specified, set both attributes
$atts['placeholder'] = $placeholder;
$atts['value'] = $value;
} else {
//Default behavior of using the value as the placeholder
$atts['placeholder'] = $value;
}
} else {
$atts['value'] = $value;
}
//Output the HTML
return sprintf(
'<span class="wpcf7-form-control-wrap %s"><input %s />%s</span>',
sanitize_html_class($tag->name),
wpcf7_format_atts($atts), //This function already escapes attribute values
$validation_error
);
}
/**
* Validate Required Dynamic Text Field
*
* @param mixed $result
* @param WPCF7_FormTag $tag
*
* @return mixed
*/
function wpcf7dtx_dynamictext_validation_filter($result, $tag)
{
$tag = new WPCF7_FormTag($tag);
//Sanitize value
$value = empty($_POST[$tag->name]) ? '' : sanitize_text_field(trim(strval($_POST[$tag->name])));
//Validate
if ('dynamictext' == $tag->basetype) {
if ($tag->is_required() && '' == $value) {
$result->invalidate($tag, wpcf7_get_message('invalid_required'));
}
}
if (!empty($value)) {
$maxlength = $tag->get_maxlength_option();
$minlength = $tag->get_minlength_option();
if ($maxlength && $minlength && $maxlength < $minlength) {
$maxlength = $minlength = null;
}
$code_units = wpcf7_count_code_units($value);
if (false !== $code_units) {
if ($maxlength && $maxlength < $code_units) {
$result->invalidate($tag, wpcf7_get_message('invalid_too_long'));
} elseif ($minlength && $code_units < $minlength) {
$result->invalidate($tag, wpcf7_get_message('invalid_too_short'));
}
}
}
return $result;
}
/**
* Include Utility Functions
*/
include_once(WPCF7DTX_DIR . '/includes/utilities.php');
if (is_admin()) {
/**
* Include the Admin Stuff
*/
include_once(WPCF7DTX_DIR . '/includes/admin.php');
}
/**
* Included Shortcodes
*/
include_once(WPCF7DTX_DIR . '/includes/shortcodes.php');

View File

@@ -0,0 +1,221 @@
<?php
/**
* Admin Scripts and Styles
*
* Enqueue scripts and styles to be used on the admin pages
*
* @since 3.1.0
*
* @param string $hook Hook suffix for the current admin page
*/
function wpcf7dtx_enqueue_admin_assets($hook)
{
//Only load on CF7 Form pages
if ($hook == 'toplevel_page_wpcf7') {
$prefix = 'wpcf7dtx-';
$url = plugin_dir_url(WPCF7DTX_FILE);
$path = plugin_dir_path(WPCF7DTX_FILE);
wp_enqueue_style(
$prefix . 'admin', //Handle
$url . 'assets/styles/tag-generator.css', //Source
array('contact-form-7-admin'), //Dependencies
@filemtime($path . 'assets/styles/tag-generator.css') //Version
);
//Plugin Scripts
wp_enqueue_script(
$prefix . 'taggenerator', //Handle
$url . 'assets/scripts/tag-generator.js', //Source
array('jquery', 'wpcf7-admin-taggenerator'), //Dependencies
@filemtime($path . 'assets/scripts/tag-generator.js'), //Version
true //In footer
);
}
}
add_action('admin_enqueue_scripts', 'wpcf7dtx_enqueue_admin_assets'); //Enqueue styles/scripts for admin page
/**
* Create Tag Generators
*
* @return void
*/
function wpcf7dtx_add_tag_generator_dynamictext()
{
if (!class_exists('WPCF7_TagGenerator')) {
return;
}
$tag_generator = WPCF7_TagGenerator::get_instance();
//Dynamic Text Field
$tag_generator->add(
'dynamictext', //id
__('dynamic text', 'contact-form-7-dynamic-text-extension'), //title
'wpcf7dtx_tag_generator_dynamictext', //callback
array('placeholder', 'readonly') //options
);
//Dynamic Hidden Field
$tag_generator->add(
'dynamichidden', //id
__('dynamic hidden', 'contact-form-7-dynamic-text-extension'), //title
'wpcf7dtx_tag_generator_dynamictext' //callback
);
}
add_action('wpcf7_admin_init', 'wpcf7dtx_add_tag_generator_dynamictext', 100);
/**
* Echo HTML for Dynamic Tag Generator
*
* @param WPCF7_ContactForm $contact_form
* @param array $options
* @return void
*/
function wpcf7dtx_tag_generator_dynamictext($contact_form, $options = '')
{
$options = wp_parse_args($options);
$type = $options['id'];
switch ($type) {
case 'dynamichidden': //hiden
$description = __('Generate a form-tag for a hidden input field, with a dynamically generated default value.', 'contact-form-7-dynamic-text-extension');
break;
default:
$description = __('Generate a form-tag for a single-line plain text input field, with a dynamically generated default value.', 'contact-form-7-dynamic-text-extension');
break;
}
$utm_source = urlencode(home_url());
$description .= sprintf(
' %s <a href="https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=form-tag-generator-%s" target="_blank" rel="noopener">%s</a>.',
__('For more details, see', 'contact-form-7-dynamic-text-extension'),
esc_attr($utm_source), //UTM source
esc_attr($type), //UTM content
__('DTX knowledge base', 'contact-form-7-dynamic-text-extension')
);
//Open Form-Tag Generator
printf(
'<div class="control-box"><fieldset><legend>%s</legend><table class="form-table"><tbody>',
wp_kses($description, 'a') //Tag generator description
);
//Input field - Required checkbox (not available for hidden fields)
if ($type != 'dynamichidden') {
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><label><input %s />%s</label></td></tr>',
esc_attr($options['content'] . '-required'), // field id
esc_html__('Field type', 'contact-form-7-dynamic-text-extension'), // field Label
wpcf7_format_atts(array(
'type' => 'checkbox',
'name' => 'required',
'id' => $options['content'] . '-required'
)),
esc_html__('Required field', 'contact-form-7-dynamic-text-extension') // checkbox label
);
}
//Input field - Field Name
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><input %s /></td></tr>',
esc_attr($options['content'] . '-name'), // field id
esc_html__('Name', 'contact-form-7-dynamic-text-extension'), // field label
wpcf7_format_atts(array(
'type' => 'text',
'name' => 'name',
'id' => $options['content'] . '-name',
'class' => 'tg-name oneline'
))
);
//Input field - Dynamic value
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><input %s /><br /><small>%s <a href="https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=form-tag-generator-%s" target="_blank" rel="noopener">%s</a></small></td></tr>',
esc_attr($options['content'] . '-values'), // field id
esc_html__('Dynamic value', 'contact-form-7-dynamic-text-extension'), // field label
wpcf7_format_atts(array(
'type' => 'text',
'name' => 'values',
'id' => $options['content'] . '-values',
'class' => 'oneline',
'placeholder' => "CF7_GET key='foo'"
)),
esc_html__('Can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'),
esc_attr($utm_source), //UTM source
esc_attr($type), //UTM content
esc_html__('View DTX shortcode syntax documentation', 'contact-form-7-dynamic-text-extension') //Link label
);
//Input field - Dynamic placeholder (not available for hidden fields)
if ($type != 'dynamichidden') {
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><input %s /><input %s /><br /><small>%s <a href="https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-attribute-placeholder/?utm_source=%s&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=form-tag-generator-%s" target="_blank" rel="noopener">%s</a></small></td></tr>',
esc_attr($options['content'] . '-placeholder'), // field id
esc_html__('Dynamic placeholder', 'contact-form-7-dynamic-text-extension'), // field label
wpcf7_format_atts(array(
'type' => 'hidden',
'name' => 'placeholder',
'class' => 'option'
)),
wpcf7_format_atts(array(
'type' => 'text',
'name' => 'dtx-placeholder',
'id' => $options['content'] . '-placeholder', // field id
'class' => 'oneline dtx-option',
'placeholder' => 'CF7_get_post_var key=\'post_title\''
)),
esc_html__('Can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'),
esc_attr($utm_source), //UTM source
esc_attr($type), //UTM content
esc_html__('View DTX placeholder documentation', 'contact-form-7-dynamic-text-extension') //Link label
);
}
//Input field - ID attribute
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><input %s /></td></tr>',
esc_attr($options['content'] . '-id'), // field id
esc_html__('Id attribute', 'contact-form-7-dynamic-text-extension'), // field label
wpcf7_format_atts(array(
'type' => 'text',
'name' => 'id',
'id' => $options['content'] . '-id', // field id
'class' => 'idvalue oneline option'
))
);
//Input field - Class attribute
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><input %s /></td></tr>',
esc_attr($options['content'] . '-class'), // field id
esc_html__('Class attribute', 'contact-form-7-dynamic-text-extension'), // field label
wpcf7_format_atts(array(
'type' => 'text',
'name' => 'class',
'id' => $options['content'] . '-class', // field id
'class' => 'classvalue oneline option'
))
);
//Input field - Readonly attribute (not available for hidden fields)
if ($type != 'dynamichidden') {
printf(
'<tr><th scope="row"><label for="%s">%s</label></th><td><label><input %s />%s</label></td></tr>',
esc_attr($options['content'] . '-readonly'), // field id
esc_html__('Read only attribute', 'contact-form-7-dynamic-text-extension'), // field Label
wpcf7_format_atts(array(
'type' => 'checkbox',
'name' => 'readonly',
'id' => $options['content'] . '-readonly',
'class' => 'readonlyvalue option'
)),
esc_html__('Do not let users edit this field', 'contact-form-7-dynamic-text-extension') // checkbox label
);
}
//Close Form-Tag Generator
printf(
'</tbody></table></fieldset></div><div class="insert-box"><input type="text" name="%s" class="tag code" readonly="readonly" onfocus="this.select()" /><div class="submitbox"><input type="button" class="button button-primary insert-tag" value="%s" /></div><br class="clear" /></div>',
esc_attr($type),
esc_html__('Insert Tag', 'contact-form-7-dynamic-text-extension')
);
}

View File

@@ -0,0 +1,358 @@
<?php
/*****************************************************
* Included Shortcodes
*
* See documentation for usage:
* https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/
*
*****************************************************/
/**
* Initialise DTX included shortcodes
*
* Hooked to `init`
*
* @return void
*/
function wpcf7dtx_init_shortcodes()
{
add_shortcode('CF7_GET', 'wpcf7dtx_get');
add_shortcode('CF7_POST', 'wpcf7dtx_post');
add_shortcode('CF7_URL', 'wpcf7dtx_url');
add_shortcode('CF7_referrer', 'wpcf7dtx_referrer');
add_shortcode('CF7_bloginfo', 'wpcf7dtx_bloginfo');
add_shortcode('CF7_get_post_var', 'wpcf7dtx_get_post_var');
add_shortcode('CF7_get_custom_field', 'wpcf7dtx_get_custom_field');
add_shortcode('CF7_get_current_user', 'wpcf7dtx_get_current_user');
add_shortcode('CF7_get_attachment', 'wpcf7dtx_get_attachment');
add_shortcode('CF7_guid', 'wpcf7dtx_guid');
}
add_action('init', 'wpcf7dtx_init_shortcodes'); //Add init hook to add shortcodes
/**
* Get Variable from $_GET Array
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_get($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'key' => 0,
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
$valid_key = (is_numeric($key) && intval($key) > -1) || (is_string($key) && !empty($key));
if ($valid_key && is_array($_GET) && count($_GET) && array_key_exists($key, $_GET) && !empty($_GET[$key])) {
$value = sanitize_text_field(strval($_GET[$key]));
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
return '';
}
/**
* Get Variable from $_POST Array
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_post($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'key' => '',
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
$valid_key = (is_numeric($key) && intval($key) > -1) || (is_string($key) && !empty($key));
if ($valid_key && is_array($_POST) && count($_POST) && array_key_exists($key, $_POST) && !empty($_POST[$key])) {
$value = sanitize_text_field(strval($_POST[$key]));
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
return '';
}
/**
* Get the Current URL
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_url($atts = array(), $content = '', $tag = '') {
extract(shortcode_atts(array(
'allowed_protocols' => 'http,https',
'obfuscate' => '',
'part' => '',
), array_change_key_case((array)$atts, CASE_LOWER)));
$allowed_protocols = explode(',', sanitize_text_field($allowed_protocols));
// Build the full URL from the $_SERVER array
$url = sprintf('http%s://', is_ssl() ? 's' : '');
if (!empty($_SERVER['SERVER_PORT']) && intval($_SERVER['SERVER_PORT']) !== 80) {
$url = $url . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
} else {
$url = $url . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
}
// Determine the value to return
$value = '';
// If an individual part is requested, get that specific value using parse_url()
if( $part ){
$part_constant_map = [
'host' => PHP_URL_HOST,
'query' => PHP_URL_QUERY,
'path' => PHP_URL_PATH,
// 'fragment' => PHP_URL_FRAGMENT, // Can't get fragment because it's not part of the $_SERVER array
];
if( isset( $part_constant_map[$part] ) ) {
$value = sanitize_text_field(parse_url($url, $part_constant_map[$part]));
}
}
// No part requested, return the whole thing
else {
$value = sanitize_url($url, $allowed_protocols);
}
// Obfuscate if requested
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
/**
* Get Referrer
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_referrer($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'allowed_protocols' => 'http,https',
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
$allowed_protocols = explode(',', sanitize_text_field($allowed_protocols));
$value = empty($_SERVER['HTTP_REFERER']) ? '' : sanitize_url($_SERVER['HTTP_REFERER'], $allowed_protocols);
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
/**
* Get Variable from Bloginfo
*
* See possible values: https://developer.wordpress.org/reference/functions/get_bloginfo/
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_bloginfo($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'show' => 'name', //Backwards compatibility
'key' => 'name',
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
$key = $show != $key && $show != 'name' ? $show : $key; //Use old value of "show" if not set to default value
$value = sanitize_text_field(strval(get_bloginfo($key)));
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
/**
* Get Variable from a Post Object
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_get_post_var($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'key' => 'post_title',
'post_id' => '',
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
switch ($key) {
case 'slug':
$key = 'post_name';
break;
case 'title':
$key = 'post_title';
break;
default:
break;
}
$post_id = wpcf7dtx_get_post_id($post_id);
if ($post_id && is_string($key) && !empty($key)) {
$value = sanitize_text_field(trim(strval(get_post_field($key, $post_id))));
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
return '';
}
/**
* Get Value from Post Meta Field
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_get_custom_field($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'key' => '',
'post_id' => '',
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
$post_id = wpcf7dtx_get_post_id($post_id);
if ($post_id && is_string($key) && !empty($key)) {
$value = get_post_meta($post_id, $key, true);
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
return '';
}
/**
* Get Value from Current User
*
* Retreives data from the `users` and `usermeta` tables.
* Documentation: https://developer.wordpress.org/reference/classes/wp_user/get/
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_get_current_user($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'key' => 'user_login',
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
if (is_user_logged_in()) {
$user = wp_get_current_user();
$value = $user->get($key);
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
return $value;
}
return '';
}
/**
* Get Attachment
*
* Retreives an attachment ID or absolute URL depending on attributes
*
* @since 3.1.0
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_get_attachment($atts = array(), $content = '', $tag = '')
{
extract(shortcode_atts(array(
'id' => '', //Get attachment by ID
'size' => 'full', //Define attachment size
'post_id' => '', //If attachment ID is empty but post ID is not, get the featured image
'return' => 'url', //Options are `id` or `url`
'obfuscate' => ''
), array_change_key_case((array)$atts, CASE_LOWER)));
//No attachment ID was provided, check for post ID to get it's featured image
if (empty($id)) {
if ($post_id = sanitize_text_field(strval($post_id))) {
//If a post ID was provided, get it's featured image
if (is_numeric($post_id) && (int)$post_id > 0) {
$id = get_post_thumbnail_id($post_id);
}
} else {
//If no post ID was provided, get current featured image
global $post;
if (isset($post) && property_exists($post, 'ID') && is_numeric($post->ID)) {
$id = get_post_thumbnail_id(intval($post->ID));
}
}
}
//Get the value
$value = '';
if ($id) {
$id = intval(sanitize_text_field(strval($id)));
switch ($return) {
case 'id': //Return the attachment ID
$value = esc_attr($id);
break;
default: //Return attachment URL
$url = wp_get_attachment_image_url(intval($id), sanitize_text_field(strval($size)));
$value = $url ? esc_url($url) : '';
break;
}
if ($obfuscate && !empty($value)) {
return wpcf7dtx_obfuscate($value);
}
}
return $value;
}
/**
* GUID Field
*
* @since 3.1.0
*
* @param array $atts Optional. An associative array of shortcode attributes. Default is an empty array.
* @param string $content Optional. A string of content between the opening and closing tags. Default is an empty string.
* @param string $tag Optional. The shortcode tag. Default is an empty string.
*
* @return string Output of the shortcode
*/
function wpcf7dtx_guid()
{
if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}

View File

@@ -0,0 +1,181 @@
<?php
/**
* Obfuscate a value
*
* @param mixed $value
* @return string obfuscated value
*/
function wpcf7dtx_obfuscate($value = '')
{
$return = '';
$value = strval($value); //Force value to be string
if (!empty($value)) {
foreach (str_split($value) as $letter) {
$return .= '&#' . ord($letter) . ';';
}
}
return sanitize_text_field(trim($return));
}
/**
* Get Post ID
*
* @param mixed $post_id
* @return int An integer value of the passed post ID or the post ID of the current `$post` global object. 0 on Failure.
*/
function wpcf7dtx_get_post_id($post_id)
{
$post_id = is_numeric($post_id) && (int)$post_id > 0 ? intval($post_id) : 0;
if (!$post_id) {
//No post ID was provided, look it up
global $post;
if (isset($post) && property_exists($post, 'ID')) {
$post_id = $post->ID;
}
}
return $post_id;
}
/**
* Mark a shortcode as deprecated and inform when it has been used.
*
* The current behavior is to trigger a user error if WP_DEBUG is true.
*
* This function is to be used in every function that is deprecated.
*
* @since 3.1.0
* @access private
*
* @param string $tag The tag of the shortcode that was called.
* @param string $version The version of the plugin that deprecated the shortcode.
* @param string $replacement Optional. The shortcode that should have been used. Default null.
*/
function wpcf7dtx_deprecated_shortcode($tag, $version, $replacement = null, $documentation = null)
{
/**
* Filter whether to trigger an error for deprecated shortcodes.
*
* @since 3.1.0
*
* @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
*/
if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
if (!is_null($replacement)) {
if (!is_null($documentation)) {
trigger_error(sprintf(
__('%1$s is <strong>deprecated</strong> since version %2$s! Use Contact Form 7\'s built-in attribute "%3$s" instead. Contact Form 7 Documentation: %4$s', 'contact-form-7-dynamic-text-extension'),
$tag,
$version,
$replacement,
$documentation
));
} else {
trigger_error(sprintf(
__('%1$s is <strong>deprecated</strong> since version %2$s! Use Contact Form 7\'s built-in attribute "%3$s" instead.', 'contact-form-7-dynamic-text-extension'),
$tag,
$version,
$replacement
));
}
} else {
trigger_error(sprintf(
__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative currently available.', 'contact-form-7-dynamic-text-extension'),
$tag,
$version
));
}
}
}
/**
* Parse Content for Specified Shortcodes
*
* Parse a string of content for a specific shortcode to retrieve its attributes and content
*
* @since 3.1.0
*
* @param string $content The content to parse
* @param string $tag The shortcode tag
*
* @return array An associative array with `tag` (string) and `shortcodes` (sequential array). If shortcodes were discovered, each one has keys for `atts` (associative array) and `content` (string)
*/
function wpcf7dtx_get_shortcode_atts($content)
{
$return = array(
'tag' => '',
'atts' => array()
);
//Search for shortcodes with attributes
if (false !== ($start = strpos($content, ' '))) {
$return['tag'] = substr($content, 0, $start); //Opens the start tag, assumes there are attributes because of the space
//Parse for shortcode attributes: `shortcode att1='foo' att2='bar'`
//Chop only the attributes e.g. `att1="foo" att2="bar"`
$atts_str = trim(str_replace($return['tag'], '', $content));
if (strpos($atts_str, "'") !== false) {
$atts = explode("' ", substr(
$atts_str,
0,
-1 //Clip off the last character, which is a single quote
));
if (is_array($atts) && count($atts)) {
foreach ($atts as $att_str) {
$pair = explode("='", $att_str);
if (is_array($pair) && count($pair) > 1) {
$key = sanitize_key(trim($pair[0])); //Validate & normalize the key
if (!empty($key)) {
$return['atts'][$key] = sanitize_text_field(html_entity_decode($pair[1]));
}
}
}
}
}
}
return $return;
}
/**
* Array Key Exists and Has Value
*
* @since 3.1.0
*
* @param string|int $key The key to search for in the array.
* @param array $array The array to search.
* @param mixed $default The default value to return if not found or is empty. Default is an empty string.
*
* @return mixed The value of the key found in the array if it exists or the value of `$default` if not found or is empty.
*/
function wpcf7dtx_array_has_key($key, $array = array(), $default = '')
{
//Check if this key exists in the array
$valid_key = (is_string($key) && !empty($key)) || is_numeric($key);
$valid_array = is_array($array) && count($array);
if ($valid_key && $valid_array && array_key_exists($key, $array)) {
//Always return if it's a boolean or number, otherwise only return it if it has any value
if ($array[$key] || is_bool($array[$key]) || is_numeric($array[$key])) {
return $array[$key];
}
}
return $default;
}
if (!function_exists('array_key_first')) {
/**
* Gets the first key of an array
*
* Gets the first key of the given array without affecting the internal array pointer.
*
* @param array $array
* @return int|string|null
*/
function array_key_first($array = array())
{
foreach ($array as $key => $value) {
return $key;
}
return null;
}
}

View File

@@ -0,0 +1,363 @@
=== Contact Form 7 - Dynamic Text Extension ===
Contributors: sevenspark, tessawatkinsllc
Donate link: https://just1voice.com/donate/
Tags: Contact Form 7, contact, contact form, dynamic, text, input, GET, POST, title, slug, autofill, auto-fill, prepopulate, pre-populate, form field
Tested up to: 6.1.1
Stable tag: 3.2
This plugin provides additional form tags for the Contact Form 7 plugin. It allows dynamic generation of content for text or hidden input fields using any shortcode.
== Description ==
Contact Form 7 is an excellent WordPress plugin and one of the top choices of free WordPress plugins for contact forms. Contact Form 7 - Dynamic Text Extension (DTX) makes it even more awesome by adding dynamic content capabilities. While default values in Contact Form 7 are static, DTX lets you create pre-populated fields based on other values. Some examples might include:
* Auto-filling a URL
* Auto-filling a post ID, title, or slug
* Pre-populating a product number
* Referencing other content on the site
* Populating with post info
* Populating with user info
* Populating with custom fields
* Generating unique identifiers for support tickets
* Any value using custom shortcodes
The possibilities are endless!
= WHAT DOES IT DO? =
DTX comes with several built-in shortcodes that will allow the contact form to be populated from HTTPS GET variable or any info from the `get_bloginfo()` function, among others. See below for included shortcodes.
Don't see the shortcode you need on the list? You can write a [custom one](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/custom-shortcodes/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)! Any shortcode that returns a string or numeric value can be used here. The included shortcodes just cover the most common scenarios, but DTX provides the flexibility for you to grab any value you have access to programmatically.
= HOW TO USE IT =
After installing and activating the plugin, you will have 2 new tag types to select from when creating or editing a Contact Form 7 form: the dynamic text field and dynamic hidden field. Most of the options in their tag generators will be familiar to Contact Form 7 users but there have been some upgrades.
**Dynamic Value**
This fields can take a shortcode, with two important provisions:
1. The shortcode should NOT include the normal square brackets (`[` and `]`). So, instead of `[CF7_GET key='value']` you would use `CF7_GET key='value'`.
1. Any parameters in the shortcode must use single quotes. That is: `CF7_GET key='value'` and not `CF7_GET key="value"`
**Dynamic placeholder**
Only available for the dynamic text form tag, this field can take static text or a shortcode. If using a shortcode, the same syntax applies from the dynamic value field. However, this field also has a few more needs:
1. The text/shortcode must first have apostrophes converted to it's HTML entity code, `&#39;`
1. After that, it must be URL encoded so that spaces become `%20` and other non-alphanumeric characters are converted.
**Read Only Attribute**
Only available for the dynamic text form tag, simply check this box if you do not want to let users edit this field. It will add the `readonly` attribute to your form field.
= INCLUDED SHORTCODES =
The plugin includes several shortcodes for use with the Dynamic Text Extension right out of the box. You can write your own as well—any self-closing shortcode will work, even with attributes!
**Current URL or Current URL Part**
Retrieve the current URL: `CF7_URL`
Your Contact Form 7 Tag would look like: `[dynamictext dynamicname "CF7_URL"]`
Optional parameter: `part`, which will return a parsed part of the URL. Valid values are `host`, `query`, and `path`
Host: Just the domain name and tld
`[dynamictext host "CF7_URL part='host'"]`
Query: The query string after the ?, if one exists
`[dynamictext query "CF7_URL part='query'"]`
Path: The URL path, for example, /contact, if one exists
`[dynamictext path "CF7_URL part='path'"]`
**Referrer URL**
Get the referral URL, if it exists. Note that this is not necessarily reliable as not all browsers send this data.
CF7 Tag: `[dynamictext dynamicname "CF7_referrer"]`
**Post/Page Info**
Retrieve information about the current post or page that the contact form is displayed on. The shortcode works as follows:
`CF7_get_post_var key='title'` <-- retrieves the Post's Title
`CF7_get_post_var key='slug'` <-- retrieves the Post's Slug
You can also retrieve any parameter from the global `$post` object. Just set that as the `key` value, for example `post_date`
The Contact Form 7 Tag would look like: `[dynamictext dynamicname "CF7_get_post_var key='title'"]`
Need to pull data from a _different_ post/page? Not a problem! Just specify it's post ID like this:
Dynamic value: `CF7_get_post_var key='title' post_id='245'`
Contact Form 7 Tag: `[dynamictext dynamicname "CF7_get_post_var key='title' post_id='245'"]`
**Post Meta & Custom Fields**
Retrieve custom fields from the current post/page. Just set the custom field as the key in the shortcode.
The dynamic value input becomes: `CF7_get_custom_field key='my_custom_field'`
And the tag looks like this: `[dynamictext dynamicname "CF7_get_custom_field key='my_custom_field'"]`
For the purposes of including an email address, you can obfuscate the custom field value by setting obfuscate='on' in the shortcode like this:
`[dynamictext dynamicname "CF7_get_custom_field key='my_custom_field' obfuscate='on'"]`
**Featured Images & Media Attachments**
Retrieve the current post's featured image, the featured image of a different page, or any attachment from the Media Library with this shortcode!
The base shortcode is simply: `CF7_get_attachment` which returns the absolute URL of the current page's featured image.
By setting the `post_id` attribute to a post ID, you can get the featured image of another page.
By setting the `id` attribute to an attachment ID, you can get the absolute URL of any image uploaded to your WordPress website.
By setting the `size` attribute to any size registered on your website, you can get a specific image size.
Want to return the attachment ID instead of the URL? Also not a problem! Just set `return='id'` in the shortcode.
Most of the optional attributes can be used at the same time. For example, if I wanted to retrieve the attachment ID of a featured image for a different post, then the dynamic text form tag would look like this:
`[dynamictext input_name "CF7_get_attachment post_id='123' return='id'"]`
If I wanted to get a specific image at a specific size, I can use this:
`[dynamictext input_name "CF7_get_attachment id='123' size='thumbnail'"]`
The only two attributes that cant play together is `id` and `post_id`. If both are specified, it will get the attachment specified by `id` and completely ignore the `post_id` attribute. If neither are specified, then it looks to the current featured image assigned to the global `$post` object.
**Current User Info & User Meta**
Get data about the current logged-in user.
Dynamic value: `CF7_get_current_user key='user_displayname'`
CF7 Tag: `[dynamictext dynamicname "CF7_get_current_user"]`
Valid values for `key` include:
* `ID`
* `user_login`
* `display_name`
* `user_email`
* `user_firstname`
* `user_lastname`
* `user_description`
But also custom meta user keys!
For the purposes of including an email address, you can obfuscate the value by setting obfuscate='on' in the shortcode like this:
`[dynamictext dynamicname "CF7_get_current_user key='user_email' obfuscate='on'"]`
**Site/Blog Info**
Want to grab some information from your blog like the URL or the site name? Use the `CF7_bloginfo` shortcode. For example, to get the site's URL:
Enter the following into the "Dynamic Value" input: `CF7_bloginfo show='url'`
Your Content Form 7 Tag will look something like this: `[dynamictext dynamicname "CF7_bloginfo show='url'"]`
Your form's dynamicname text input will then be pre-populated with your site's URL
**HTTP GET Variables**
Want to use a variable from the PHP `$_GET` array? Just use the `CF7_GET` shortcode. For example, if you want to get the foo parameter from the url
`http://mysite.com?foo=bar`
Enter the following into the "Dynamic Value" input: `CF7_GET key='foo'`
Your Content Form 7 Tag will look something like this: `[dynamictext dynamicname "CF7_GET key='foo'"]`
Your form's dynamicname text input will then be pre-populated with the value of `foo`, in this case, `bar`
**HTTP POST Variables**
Grab variables from the PHP `$_POST` array. The shortcode is much like the GET shortcode:
Dynamic value: `CF7_POST key='foo'`
Your Content Form 7 Tag will look something like this: `[dynamictext dynamicname "CF7_POST key='foo'"]`
**GUID**
Generate a globally unique identifier (GUID) in a form field. This is a great utility shortcode for forms that need unique identifiers for support tickets, receipts, reference numbers, etc., without having to expose personally identifiable information (PII). This shortcode takes no parameters: `CF7_guid`
Your Contact Form 7 Tag would look like: `[dynamictext dynamicname "CF7_guid"]`
**Shortcode attribute: obfuscate**
All of the included shortcodes have an `obfuscate` attribute that you can set to any truthy value to provide an additional layer of security for sensitive data.
== Installation ==
There are three (3) ways to install my plugin: automatically, upload, or manually.
= Install Method 1: Automatic Installation =
Automatic installation is the easiest option as WordPress handles the file transfers itself and you dont need to leave your web browser.
1. Log in to your WordPress dashboard.
1. Navigate to **Plugins > Add New**.
1. Where it says “Keyword” in a dropdown, change it to “Author”
1. In the search form, type “TessaWatkinsLLC” (results may begin populating as you type but my plugins will only show when the full name is there)
1. Once youve found my plugin in the search results that appear, click the **Install Now** button and wait for the installation process to complete.
1. Once the installation process is completed, click the **Activate** button to activate my plugin.
= Install Method 2: Upload via WordPress Admin =
This method involves is a little more involved. You dont need to leave your web browser, but youll need to download and then upload the files yourself.
1. [Download my plugin](https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/) from WordPress.org; it will be in the form of a zip file.
1. Log in to your WordPress dashboard.
1. Navigate to **Plugins > Add New**.
1. Click the **Upload Plugin** button at the top of the screen.
1. Select the zip file from your local file system that was downloaded in step 1.
1. Click the **Install Now** button and wait for the installation process to complete.
1. Once the installation process is completed, click the **Activate** button to activate my plugin.
= Install Method 3: Manual Installation =
This method is the most involved as it requires you to be familiar with the process of transferring files using an SFTP client.
1. [Download my plugin](https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/) from WordPress.org; it will be in the form of a zip file.
1. Unzip the contents; you should have a single folder named `contact-form-7-dynamic-text-extension`.
1. Connect to your WordPress server with your favorite SFTP client.
1. Copy the folder from step 2 to the `/wp-content/plugins/` folder in your WordPress directory. Once the folder and all of its files are there, installation is complete.
1. Now log in to your WordPress dashboard.
1. Navigate to **Plugins > Installed Plugins**. You should now see my plugin in your list.
1. Click the **Activate** button under my plugin to activate it.
== Screenshots ==
1. A screenshot of the form-tag generator for the dynamic text field.
== Frequently Asked Questions ==
Please check out the [FAQ on our website](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/frequently-asked-questions/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme).
== Upgrade Notice ==
* 3.1.3 Fixed the syntax error that reappeared in 3.1.2. My apologies!
== Changelog ==
= 3.2 =
* Feature: Add optional 'part' parameter to CF7_URL shortcode to retrieve Host, Query, or Path from current URL
* Updated minimum PHP requirement to 7.4 moving forward
* Update branding assets
* Update Tested Up To to 6.1.1
* Plugin will now be jointly maintained by SevenSpark and AuRise Creative
= 3.1.3 =
* Fix: Fixed the syntax error that reappeared in 3.1.2.
= 3.1.2 =
**Release Date: January 27, 2023**
* Fix: updated the text domain to match the plugin slug
* Fix: updated all of the translated strings to match
= 3.1.1 =
**Release Date: January 26, 2023**
* Fix: Fixed the syntax error: Parse error: syntax error, unexpected `)` in /wp-content/plugins/contact-form-7-dynamic-text extension/includes/admin.php on line 212
= 3.1.0 =
**Release Date: January 25, 2023**
* Feature: Added the `CF7_get_attachment` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-media-attachment/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
* Feature: Added the `CF7_guid` shortcode. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-shortcode-guid/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme).
* Feature: Added the dynamic placeholder option to the dynamic form tags that allows you to specify dynamic or static placeholder content while also setting dynamic values. For usage details, see the [knowledge base](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/shortcodes/dtx-attribute-placeholder/?utm_source=wordpress.org&utm_medium=link&utm_campaign=contact-form-7-dynamic-text-extension&utm_content=readme)
* Feature: Added a "required" dynamic hidden tag (e.g., `[dynamichidden* ...]`). It is identical to the original dynamic hidden tag (as in the field is not actually validated as required because it is hidden); it just doesn't break your website if you use it. This feature was requested by a user.
* Feature: Added the `obfuscate` attribute to all included shortcodes
= 3.0.0 =
**Release Date: January 17, 2023**
* Major: Plugin was adopted by AuRise Creative
* Major: All functions use the `wpcf7dtx_` prefix
* Feature: Added a `post_id` key for the `CF7_get_post_var` shortcode so you can specify a different post
* Feature: Updated the `CF7_get_current_user` shortcode to be able to pull data from user metadata too
* Feature: Added the "obfuscate" option to `CF7_get_custom_field` shortcode
* Feature: Added the "placeholder" checkbox option to the `dynamictext` tag
* Fix: Added additional validation for post ID input
* Fix: Added additional validation for the `key` attribute in the `CF7_GET` and `CF7_POST` shortcodes
* Fix: Shortcode keys are normalized into lowercase before processing
* Security: Sanitizing URLs for the `CF7_URL` and `CF7_referrer` shortcode outputs
* Feature/Security: Added a `allowed_protocols` attribute to the `CF7_URL` and `CF7_referrer` shortcodes that defaults to `http,https`
= 2.0.3 =
* Security: [Fix Reflected XSS](https://web.archive.org/web/20230121180428/https://sevenspark.com/docs/cf7-dtx-security-2019-07-24)
= 2.0.2.1 =
* Update changelog properly for 2.0.2 changes:
= 2.0.2 =
* Update deprecated `get_currentuserinfo()` function to `wp_get_current_user()`
* Update deprecated functions from `WPCF7_add_shortcode` to `WPCF7_add_formtag` and class from `WPCF7_Shortcode` to `WPCF7_FormTag` to comply with CF7 4.6 changes
= 2.0.1 =
* Hook change to guarantee the plugin only runs when Contact Form 7 is present in the admin (avoids errors if Contact Form 7 is disabled, or if there is a plugin sequencing issue)
= 2.0 =
* Complete rewrite for Compatibility with Contact Form 7 v4
= 1.2 =
* Compatibility update for Contact Form 7 v3.9
= 1.1.0.2 =
* Updated to work with Contact Form 7 v3.7.x
= 1.1.0.1 =
* Removed undefined variable warning
= 1.1 =
* Updated for compatibility with Contact Form 7 v3.6
* Added Referrer shortcode
= 1.0.4.2 =
* Fixed a bug that created repeating square brackets around dynamic text values in cases where the form doesn't validate and JavaScript is deactivated.
= 1.0.4.1 =
* Removed trailing whitespace to fix "Headers already sent" errors
= 1.0.4 =
* Added Current User Info shortcode
* Added Post Custom Field shortcode (with obfuscation support)
* Added Hidden Field capability
= 1.0.3 =
* Added $_POST shortcode
* Added current post/page variable shortcode
* Added current URL shortcode
= 1.0.2 =
* Fixed administrative control panel dependency issue
= 1.0.1 =
* Fixed dependency issue.