Example #1
0
if (isset($_POST['submit-form-post-test'])) {
    $url = '/?SiteServe&action=postlead';
    echo '<br/>' . 'Test form submit' . '<br/>';
    $leadData = array('campaign_id' => 'C3634', 'campaign_name' => '2015 Q1|IBM_Non-CA_SWG_BA for Finance|Non-Intel|NYC|USA', 'publisher_id' => 'CFO.COM(00100324)', 'placement_name' => 'CFO.com|Business Analytics for Finance_Content Syndication|0x0', 'source_site' => 'CFO.com', 'unique_order_number' => '16001', 'job_title' => 'CFO', 'last_name' => 'Chin', 'company' => 'KARCHER NORTH AMERICA', 'company_size' => '5,000-9,999', 'address_line_1' => '744 Some where', 'state' => 'CO', 'zip_code' => '801102166', 'country' => 'US', 'first_name' => 'test', 'city' => 'ENGLEWOOD', 'phone' => '7180093401', 'email' => '*****@*****.**', 'ov_code' => 'ov4502', 'tactic' => '101G92BW', 'asset_name' => 'Test Asset', 'response_type' => 'WEBRESP', 'questionnum1_ooemail' => 'Q_XSYS:OOEMAIL', 'email_verification' => 'CHECKED', 'questionnum2_ootele' => 'Q_XSYS:OOTELE', 'phone_verification' => 'CHECKED', 'questionnum3_oopostal' => 'Q_XSYS:OOPOSTAL', 'zipcode_verification' => 'CHECKED');
    echo '<form action="' . $url . '" name="postlead" method="post">';
    foreach ($leadData as $attribute => $value) {
        echo '<label>' . $attribute . '</label>';
        echo '<input type="text" size="100" name="' . $attribute . '" value="' . $value . '"/>' . '<br/>';
    }
    echo '<input type="submit" name="submit" value="submit"/>';
    echo '</form>';
}
if (isset($_POST['submit-form'])) {
    echo 'Testing Site Serve API <br/>';
    $SiteServeAPI = new SiteServeAPI();
    $SiteServeBusinessObject = new SiteServe();
    echo '<br/>';
    echo 'Test Get Authorization Token <br/>';
    $response = $SiteServeAPI->generateAuthorizationToken($SiteServeBusinessObject->getEndPoint());
    $authToken = $response->authorization_token;
    echo $authToken;
    echo '<br/><br/>';
    echo 'Test Get Acces Token <br/>';
    $response = $SiteServeAPI->generateAccessToken($SiteServeBusinessObject->getEndPoint(), $authToken);
    $access_token = $response->access_token;
    $refresh_token = $response->refresh_token;
    echo 'AccessToken: ';
    echo $access_token;
    echo '<br/>';
    echo 'Refresh Token: ' . $refresh_token;
    echo $accesstoken;
Example #2
0
 public static function site_serve_custom_bulk_action()
 {
     // 1. get the action
     $wp_list_table = _get_list_table('WP_Posts_List_Table');
     $wp_site_serve = new SiteServe();
     $action = $wp_list_table->current_action();
     $post_ids = $_GET['post'];
     // 2. security check
     switch ($action) {
         // 3. Perform the action
         case 'update_status':
             foreach ($post_ids as $post_id) {
                 $wp_site_serve->updateLeadStatus($post_id);
             }
             // build the redirect url
             $sendback = add_query_arg(array('post_type' => 'site_serve_lead', 'updated' => $updated, 'ids' => join(',', $post_ids)), $sendback);
             break;
         case 'resend_lead':
             foreach ($post_ids as $post_id) {
                 $data = get_post_meta($post_id);
                 if (!empty($data)) {
                     $data = self::postMetaKeyToArray($data);
                     $status = $wp_site_serve->sendLead($data);
                     wp_delete_post($post_id);
                 }
             }
             $sendback = add_query_arg(array('post_type' => 'site_serve_lead', 'updated' => $updated), $sendback);
             break;
         default:
             return;
     }
     // 4. Redirect client
     wp_redirect($sendback);
     exit;
 }