Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update “shortcode” functions to be compatible with Contact Form 7 v4.6 #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions trunk/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function __construct() {
}

function add_shortcode() {
if ( function_exists( 'wpcf7_add_shortcode' ) ) {
wpcf7_add_shortcode( array( 'ctct', 'ctct*' ), array( $this, 'shortcode_handler' ), true );
if ( function_exists( 'wpcf7_add_form_tag' ) ) {
wpcf7_add_form_tag( array( 'ctct', 'ctct*' ), array( $this, 'shortcode_handler' ), true );
}
}

Expand All @@ -36,12 +36,12 @@ function ajax_generate_dropdowns_from_code() {

// Again, attempt to fix
// https://github.com/katzwebservices/Contact-Form-7-Newsletter/issues/24
if ( ! class_exists( 'WPCF7_ShortcodeManager' ) ) {
if ( ! class_exists( 'WPCF7_FormTagsManager' ) ) {
include_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php';
}

// They must be using version CF7 3.0 or less
if ( ! class_exists( 'WPCF7_ShortcodeManager' ) ) {
if ( ! class_exists( 'WPCF7_FormTagsManager' ) ) {
return;
}

Expand All @@ -53,7 +53,7 @@ function ajax_generate_dropdowns_from_code() {
$code = stripslashes_deep( @$_REQUEST['data'] );

// Get the tags from the form code
$scanned_form_tags = WPCF7_ShortcodeManager::get_instance()->scan_shortcode( $code );
$scanned_form_tags = WPCF7_FormTagsManager::get_instance()->scan_shortcode( $code );

if ( count( $scanned_form_tags ) ) {
foreach ( $scanned_form_tags as $fe ) {
Expand Down Expand Up @@ -141,7 +141,7 @@ public function process_submission_shortcode( $cf7_ctct, $obj ) {

function shortcode_handler( $tag ) {

$tag = new WPCF7_Shortcode( $tag );
$tag = new WPCF7_FormTag( $tag );

if ( empty( $tag->name ) ) {
return '';
Expand All @@ -158,7 +158,7 @@ function shortcode_handler( $tag ) {
/**
* Get the list type
*
* @uses WPCF7_Shortcode::get_option()
* @uses WPCF7_FormTag::get_option()
*/
$options['type'] = $tag->get_option( 'type', 'id', true );
$options['label'] = urldecode( $tag->get_option( 'label', '', true ) );
Expand Down