errors)) { //no errors found if ($debug > 0) { print "
".$url."
"; print "
";
			print_r ($args);
			print "
"; print "
";
			print_r ($_SESSION);
			print "
"; } return $response['body']; } else { print "error in APWTRemoteGet {APWT154}"; print $url."
"; print_r ($response->errors); exit; } } function APWTCookieSessionHandler() { //formerly cookiesessionhandler if (isset($_SESSION['PHPSESSID'])) { $cookie = new WP_Http_Cookie( 'PHPSESSID' ); $cookie->name = 'PHPSESSID'; $cookie->value = $_SESSION['PHPSESSID']; $cookie->expires = mktime( 0, 0, 0, date('m'), date('d') + 7, date('Y') ); // expires in 7 days $cookie->path = '/'; $cookie->domain = ''; $cookies[] = $cookie; $args = array( 'cookies' => $cookies ); return $args; } } function APWT_enqueue_scripts() { wp_register_script('APWTajax', plugins_url( '/js/apwt-leadbox.js', dirname(__FILE__) ), array(), '1', 'all' ); wp_enqueue_script( 'APWTajax'); wp_localize_script( 'APWTajax', 'APWTajaxurl', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); wp_enqueue_script('jquery'); } class APWTLeadBox extends WP_Widget { public function __construct() { add_action( 'wp_ajax_nopriv_APWTLeadBox', array(&$this,'submit')); add_action( 'wp_ajax_APWTLeadBox', array(&$this,'submit')); $widget_ops = array( 'classname' => 'APWTLeadBox', 'description' => 'Display your AllProWebTools Leadsbox', ); parent::__construct( 'APWTLeadBox', 'AllProWebTools LeadBox', $widget_ops ); } function form($instance) { //get a title variable defined by the user $instance = wp_parse_args( (array) $instance, array( 'APWTLeadBoxID' => '' ) ); $APWTLeadBoxID = $instance['APWTLeadBoxID']; //get the ids for the lead box $thisurl = "/wordpress/wpapi.php?action=leadboxids&".APWTLBAPIAuth(); $thereturn = APWTRemoteGet($thisurl); $leadboxes = explode("-|-",$thereturn); array_pop($leadboxes); foreach ($leadboxes as $val) { $pieces = explode("-*-",$val); $newarray[$pieces[0]] = $pieces[1]; } $APWTLeadBoxID = empty($instance['APWTLeadBoxID']) ? ' ' : apply_filters('widget_title', $instance['APWTLeadBoxID']); $thisfieldid = sanitize_text_field($this->get_field_id('APWTLeadBoxID')); $thisfieldname = sanitize_text_field($this->get_field_name('APWTLeadBoxID')); ?>

0) { $thisurl = "/wordpress/wpapi.php?action=getleadbox&leadboxid=".$APWTLeadBoxID."&".APWTLBAPIAuth(); $thereturn = APWTRemoteGet($thisurl); // echo $before_title . $thereturn . $after_title; echo $thereturn; } else { echo "

No Leadbox defined

"; } // echo $after_widget; } public static function submit() { if (isset($_REQUEST['apwtleadbox'])) { $query = http_build_query($_REQUEST['apwtvalues']); $thisurl = "/wordpress/wpapi.php?action=submitleadbox&".$query."&".APWTLBAPIAuth(); $thereturn = APWTRemoteGet($thisurl); echo $thereturn; } die(0); } } //end class extend APWTLeadBox