ActiveDEMAND tracking script to your website. As well this plugin gives you the ability to use shortcodes to embed ActiveDEMAND webforms into your widgets, pages, posts, and sidebars. * Version: 0.0.4 * Author: JumpDEMAND Inc. * Author URI: https://www.ActiveDEMAND.com * License:GPL-2.0+ * License URI:http://www.gnu.org/licenses/gpl-2.0.txt */ /**================================================= * Admin Menu ===================================================*/ function activedemand_menu() { global $activedemand_plugin_hook; $activedemand_plugin_hook = add_options_page('ActiveDEMAND options', 'ActiveDEMAND', 'manage_options', 'activedemand_options', 'activedemand_plugin_options'); add_action( 'admin_init', 'register_activedemand_settings' ); } function register_activedemand_settings() { register_setting( 'activedemand_options', 'activedemand_options_field' ); } function enqueue_scripts() { wp_enqueue_script( 'ActiveDEMAND-Track', 'https://activedemand-static.s3.amazonaws.com/public/javascript/jquery.tracker.compiled.js.gz' ); } function activedemand_getHTML($url,$timeout) { $ch = curl_init($url); // initialize curl with given url curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); // set useragent curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // max. seconds to execute curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );//force IP4 $result=curl_exec($ch); /** if(curl_exec($ch) === false) { echo 'Curl error: ' . curl_error($ch); } else { echo 'Operation completed without any errors'; } */ curl_close($ch); return $result; } function activedemand_process_form_shortcode( $atts,$content=null ) { //[activedemand_form id='123'] //$id exists after this call. extract(shortcode_atts( array('id' => ''), $atts)); $options = get_option('activedemand_options_field'); $activedemand_appkey = $options["activedemand_appkey"]; if (is_numeric($id)) { $form_str = activedemand_getHTML("https://api.activedemand.com/v1/forms/".$id."?api-key=".$activedemand_appkey."", 4000); } return $form_str; } function activedemand_plugin_action_links($links, $file) { static $this_plugin; if (!$this_plugin) { $this_plugin = plugin_basename(__FILE__); } if ($file == $this_plugin) { $settings_link = 'Settings'; array_unshift($links, $settings_link); } return $links; } function activedemand_plugin_options() { ?>
The format of the shortcode is [activedemand_form id='<id>'].
You can find the form ID for your ActiveDEMAND Web Form on the Web Form section of ActiveDEMAND:
You will need to enter your application key in order to enable the form shortcodes. Your can find your ActiveDEMAND API key in your account settings:
Check out the documentation and support forums for help with this plugin.
"; $text .= "Documentation