ID; $ac_api_key = get_user_meta($userid, "ac_api_key", true ); function stripslashes_array($array) { return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array); } $_GET = stripslashes_array($_GET); $_POST = stripslashes_array($_POST); $_COOKIE = stripslashes_array($_COOKIE); ?>

AtContent Guest Posts 0 ) { ?>">Add New


" . 'Could not connect to atcontent.com. Contact your hosting provider.' . "
"; } if ( strlen( $ac_api_key ) == 0 ) { include("invite.php"); } else { $guestpostid = $_GET["postid"]; if ( strlen( $guestpostid ) == 0 ) { $quotas_result = atcontent_api_get_quotas ( $ac_api_key ); if ( $quotas_result["IsOK"] == true ) { if ( count( $quotas_result["Subscriptions"] ) == 0 ) { echo << To enable guest posting, please choose the appropriate plan. END; } else { $guest_post_quota = intval( $quotas_result["Quotas"]["GuestPost"]["Count"] ); if ( $guest_post_quota > 0 ) { echo <<Availabe guest posts: {$quotas_result["Quotas"]["GuestPost"]["Count"]}

This month you can send or accept {$quotas_result["Quotas"]["GuestPost"]["Count"]} guest posts without upgrading to a bigger plan.

END; } else { echo <<You don't have guest post credits

To send or accept guest posts you need to upgrade to a bigger plan or wait for the next month.

END; } } } $incoming_request = atcontent_api_guestposts_incoming( site_url(), $ac_api_key ); if ( $incoming_request["IsOK"] == true && count($incoming_request["List"]) > 0 ) { ?>

Incoming

type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" id="post-">
Title From Status
Title From Status
”" href="" class="row-title"> ">
0 ) { ?>

Outgoing

type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self" id="post-">
Title To Status
Title To Status
”" href="" class="row-title">
">Edit 0 && $guest_post_quota > 0 ) { ?> | ">Submit | ">Statistics
">
" . 'Could not save draft to atcontent.com. ' . 'To submit guest post you should have Pro account.
' . 'Upgrade for Pro account here' . ""; } else { echo "
" . 'Could not save draft to atcontent.com. ' . $create_result["Reason"] . "
"; } } else { die( '

Post saved!

' . '' ); } $gp_title = $_POST["title"]; $gp_content = $_POST["post_content"]; $gp_targeturi = $_POST["targeturi"]; } } else { $editor_title = "Edit guest post"; if ( $action == "save" ) { if ( $_POST["targetaction"] == "save" ) $status = "Created"; if ( $_POST["targetaction"] == "submit" ) $status = "Submitted"; $post_content = $_POST["post_content"]; $update_result = atcontent_api_guestposts_update( $ac_api_key, $guestpostid, site_url(), $_POST["targeturi"], $_POST["title"], $post_content, $status ); if ( $update_result["IsOK"] != true ) { if ($update_result["ErrorCode"] == 102) { echo "
" . 'Could not save draft to atcontent.com.
' . 'You must have a Pro account to submit guest posts.
' . "
"; echo( '

Upgrade for Pro account here

' ); } else { echo "
" . 'Could not save draft to atcontent.com. ' . $create_result["Reason"] . "
"; } $gp_title = $_POST["title"]; $gp_content = $_POST["post_content"]; $gp_targeturi = $_POST["targeturi"]; } else { die( '

Post saved!

' . '' ); } } else if ( $action == "submit" ) { $update_result = atcontent_api_guestposts_status_update( $ac_api_key, $guestpostid, "Submitted" ); if ( $update_result["IsOK"] != true ) { if ($update_result["ErrorCode"] == 102) { echo "
" . 'Could not update status.
' . 'You must have a Pro account to submit guest posts.
' . "
"; die( '

Upgrade for Pro account here

' ); } else if ( $update_result["Code"] == 103 ) { echo "
" . 'Could not update status. ' . 'You must have guest post quota to submit guest posts.
' . "
"; die( 'Chose the suitable plan.' ); } else { echo "
" . 'Could not update status. ' . $create_result["Reason"] . "
"; } } else { die( '

Post submitted!

' . '' ); } } else if ( $action == "accept") { $preview_result = atcontent_api_guestposts_preview( $ac_api_key, $guestpostid, site_url() ); if ( $preview_result["IsOK"] != true ) { echo "
" . 'Could not preview guest post. ' . $create_result["Reason"] . "
"; } else { // Create post object $new_post = array( 'post_title' => $preview_result["Title"], 'post_content' => '[atcontent id="' . $preview_result["Post4gId"] . '"]', 'post_status' => 'publish', 'post_author' => $userid, 'post_category' => array() ); // Insert the post into the database $new_post_id = wp_insert_post( $new_post ); $original_uri = get_permalink ( $new_post_id ); $update_result = atcontent_api_guestposts_accept( $ac_api_key, $guestpostid, site_url(), $original_uri ); if ( $update_result["IsOK"] != true ) { wp_delete_post( $new_post_id, TRUE ); if ($update_result["Code"] == 102) { echo "
" . 'Could not accept guest post.
' . 'You must have a Pro account to accept guest posts.
' . "
"; die( '

Subscribe for Pro account here

' ); } else if ( $update_result["Code"] == 103 ) { echo "
" . 'Could not accept guest post. ' . 'You must have guest post quota to accept guest posts.
' . "
"; die( 'Chose the suitable plan.' ); } else { echo "
" . 'Could not accept guest post. ' . $create_result["Reason"] . "
"; } } else { die( '

Post accepted and published

' . '' ); } } } else if ( $action == "decline") { $update_result = atcontent_api_guestposts_decline( $ac_api_key, $guestpostid, site_url(), $original_uri ); if ( $update_result["IsOK"] != true ) { if ($update_result["Code"] == 102) { echo "
" . 'Could not decline guest post. ' . 'You must have a Pro account to decline guest posts.
' . "
"; die( 'Subscribe for Pro account here' ); } else { echo "
" . 'Could not decline guest post. ' . $create_result["Reason"] . "
"; } } else { die( '

Post declined

' . '' ); } } else { $gp_result = atcontent_api_guestposts_get( $ac_api_key, $guestpostid ); if ( $gp_result["IsOK"] != true ) { echo "
" . 'Could not load draft from atcontent.com. ' . $create_result["Reason"] . "
"; } else { $gp_content = $gp_result["Item"]["Face"] . ( strlen( $gp_result["Item"]["Body"] ) > 0 ? '' . $gp_result["Item"]["Body"] : '' ); $gp_title = $gp_result["Item"]["Title"]; $gp_targeturi = $gp_result["Item"]["TargetUri"]; } } } ?> ' . $editor_title . ''; echo '
'; echo 'Save Draft '; if ( $guest_post_quota > 0 ) { echo ' or Submit for Consideration'; } else { echo 'To submit a guest post you need to upgrade to a bigger plan or wait for the next month.'; } echo '

Blog\'s URL
'; ?> Check URL



'; echo 'Add image

'; $tinymcescript = plugins_url("atcontent/tinymce/tinymce.min.js"); $tinymcecss = ''; if ( file_exists( get_stylesheet_directory() . '/css/editor-style.css') ) { $tinymcecss .= get_stylesheet_directory_uri() . '/css/editor-style.css'; } if ( file_exists( get_stylesheet_directory() . '/editor-style.css') ) { $tinymcecss .= ( strlen( $tinymcecss ) > 0 ? ',' : '') . get_stylesheet_directory_uri() . '/editor-style.css'; } echo '' . << END; //wp_editor( $gp_content, 'listingeditor', $settings = array('textarea_name' => post_content) ); echo '

'; echo 'Save Draft '; if ( $guest_post_quota > 0 ) { echo ' or Submit for Consideration'; } else { echo 'To submit a guest post you need to upgrade to a bigger plan or wait for the next month.'; } echo ""; } } //end of API Key Check ?>