ID, "ac_postid", true ); if ( strlen( $ac_postid ) == 0 ) { $ac_postid = get_post_meta( $post -> ID, "ac_repost_postid", true ); } if ( strlen( $ac_postid ) > 0 ) { ?> Promote post = 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 ); $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 ); $getpaid_key = atcontent_get_menu_key( 5.0 ); add_menu_page( 'Monetize Blog', 'Monetize Blog$', 'publish_posts', 'atcontent/getpaid.php', '', plugins_url( 'assets/logo.png', __FILE__ ), $getpaid_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_process_comments( $post_id ) { $post = get_post( $post_id ); if ( $post == null ) return; $ac_api_key = get_user_meta( intval( $post->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_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 ); ?>