= 0 ) {
wp_register_style( 'atcontentAdminStylesheet38', plugins_url( 'assets/atcontent38.css?v=8', __FILE__ ) );
wp_enqueue_style( 'atcontentAdminStylesheet38' );
wp_register_script( 'atcontentAdminScript38', plugins_url( 'assets/atcontent38.js?v=1', __FILE__ ), array(), true );
wp_enqueue_script( 'atcontentAdminScript38' );
}
}
function atcontent_get_menu_key( $desired ) {
global $menu;
$menukey = $desired;
while ( array_key_exists((string) $menukey,$menu) ) {
$menukey += 0.0000000001;
}
$menukey = (string) $menukey; //If it's not a string it gets rounded to an int!
return $menukey;
}
function atcontent_add_tools_menu() {
$atcontent_dashboard_key = atcontent_get_menu_key( 2.0 );
add_menu_page( 'AtContent', 'AtContent', 'edit_posts', 'atcontent/dashboard.php', '',
plugins_url( 'assets/logo.png', __FILE__ ), $atcontent_dashboard_key );
//add_submenu_page( 'atcontent/dashboard.php', 'Connect', 'Connect', 'edit_posts', 'atcontent/connect.php', '');
//add_submenu_page( 'atcontent/dashboard.php', 'Settings', 'Settings', 'edit_posts', 'atcontent/settings.php', '');
//add_submenu_page( 'atcontent/dashboard.php', 'Sync', 'Sync', 'edit_posts', 'atcontent/sync.php', '');
//add_submenu_page( 'atcontent/dashboard.php', 'Statistics', 'Statistics', 'publish_posts', 'atcontent/statistics.php', '');
//$guest_key = atcontent_get_menu_key( 5.0 );
//add_menu_page( 'Guest Posts', 'Guest Posts', 'publish_posts', 'atcontent/guestpost.php', '',
// plugins_url( 'assets/logo.png', __FILE__ ), $guest_key );
$since = get_user_meta( wp_get_current_user()->ID, "ac_last_repost_visit", true );
if ( strlen( $since ) == 0 ) $since = "2013-12-31";
$new_reposts_count_answer = atcontent_api_reposts_count( $since );
$repost_title = "Get Content";
if ( $new_reposts_count_answer["IsOK"] && $new_reposts_count_answer["Count"] > 0 ) {
$repost_title .= "{$new_reposts_count_answer['Count']}";
}
$repost_key = atcontent_get_menu_key( 5.0 );
add_menu_page( 'Get Content', $repost_title, 'publish_posts', 'atcontent/repost.php', '',
plugins_url( 'assets/logo.png', __FILE__ ), $repost_key );
add_action( 'admin_print_styles', 'atcontent_admin_styles' );
add_action( 'admin_print_footer_scripts', 'atcontent_footer_scripts' );
}
function atcontent_admin_styles(){
wp_enqueue_style( 'atcontentAdminStylesheet' );
}
function atcontent_comment_post( $comment_id, $status = 1 ) {
$comment = get_comment( $comment_id );
if ( $comment != NULL ) {
atcontent_process_comments( $comment->comment_post_ID );
}
}
function atcontent_ga( $page, $title ) {
?>post_author ), "ac_api_key", true );
if ( strlen( $ac_api_key ) > 0 ) {
$ac_postid = get_post_meta( $post->ID, "ac_postid", true );
$ac_is_process = get_post_meta( $post->ID, "ac_is_process", true );
if ( $ac_is_process == "1" ) {
$comments_json = "";
$comments = get_comments( array(
'post_id' => $post->ID,
'order' => 'ASC',
'orderby' => 'comment_date_gmt',
'status' => 'approve',
) );
if( !empty( $comments ) ){
$comments_json .= json_encode( $comments );
}
atcontent_api_update_publication_comments( $ac_api_key, $ac_postid, $comments_json );
}
}
}
function atcontent_get_statistics_link($postID) {
$ac_postid = get_post_meta( $postID, "ac_postid", true );
if ( strlen( $ac_postid ) > 0 ) {
return admin_url( 'admin.php?page=atcontent/statistics.php' ) . "&postid=" . $ac_postid;
}
return "";
}
function atcontent_column_head($defaults) {
$defaults['atcontent_column'] = 'AtContent';
return $defaults;
}
function atcontent_column_content( $column_name, $post_ID ) {
if ( $column_name == 'atcontent_column' ) {
$stat_link = atcontent_get_statistics_link( $post_ID );
if ( strlen( $stat_link) > 0 ) {
echo "Statistics";
} else {
echo "—";
}
}
}
function atcontent_footer_scripts() {
$userid = wp_get_current_user()->ID;
$ac_api_key = get_user_meta($userid, "ac_api_key", true );
$ac_syncid = get_user_meta($userid, "ac_syncid", true );
?>
Connect to AtContent';
$pointer_content .= '
To activate AtContent features, please, connect your blog to AtContent
Please, select location of your blog
'; ?>