'agentrank_form', 'description' => __('A Widget for Realty Baron Agent Contact Form ', 'agentrank_form') ); $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'agentrank_form' ); $this->WP_Widget( 'agentrank_form', __('AgentRank Contact Form', 'agentrank_form'), $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; //check options API Key $check_key = get_option('agent_apikey'); $ag_fullname = get_option('agent_fullname'); //if api key not empty, proceed to do api call //else display error message if(!empty($check_key)&&!empty($ag_fullname)){ //start of mini form $action_url_raw = get_bloginfo('url')."/agentrank/contact"; $action_url = esc_url($action_url_raw); $html .= "
"; //subject $html .= '
'; $html .= ""; $html .= '
'; //submit button $html .= '
'; //create hidden value with wordpress nonce and post to contact form for security check. $hidden_value = wp_create_nonce('agentrank-form'); $html .= ""; $html .= ""; $html .= ""; $html .= '
'; //end of mini form $html .= "
"; $html .= '
'; $html .= ""; $html .= "
"; echo $html; }else{ echo ""; echo ""; $plugin_admin_url_structure = get_bloginfo('url')."/wp-admin/options-general.php?page=agentrank_option.php"; echo "AgentRank Admin Settings"; }//end if(!empty($check_key)) echo $after_widget; }//end of function widget function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); return $instance; } function form($instance) { $instance = wp_parse_args( (array) $instance, array( 'title' => '') ); $instance['title'] = strip_tags( $instance['title'] ); ?>