post_content, $matches ) ) {
return 'html';
}
}
return $r;
}
function atcontent_promote_posts_row ( $colname ){
if ( $colname == 'acpromoting' ) {
global $post;
$ac_postid = get_post_meta( $post -> 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
ID );
}
}
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() {
global $wp_version;
$atcontent_dashboard_key = atcontent_get_menu_key( 2.0 );
$ac_logo = plugins_url( 'assets/logo.png', __FILE__ );
if ( version_compare ( $wp_version, "3.8" ) >= 0 ) {
$ac_logo = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiB3aWR0aD0iNDAiIGhlaWdodD0iNDAiPg0KICAgIDxnIHRyYW5zZm9ybT0ibWF0cml4KDEuMjUsMCwwLC0xLjI1LC00My40NzYwODQsMTU4LjcxNTg2KSI+DQogICAgICAgIDxnIHRyYW5zZm9ybT0ibWF0cml4KDEuMDgyMDc1NCwwLDAsMS4wODIwNzU0LDc0Ljc3ODcwMiw0Ni45NzI2OTMpIj4NCiAgICAgICAgICAgIDxwYXRoIGZpbGw9IiMxMzY2OWQiIGQ9Im0wLDBjOS4xODYsMCwxNy41ODYsMy4zNTEsMjQuMDUxLDguODk1bC0xLjUyNSwzLjMwMS0xLjc1NiwzLjgwOC0xOC4yMjIsMzkuNDg1aC0yLjc0Ni0yLjQwMi0wLjA3OWwtMTUuMzI0LTMzLjIwNi0yLjg1Ni02LjE4OWMtNS4zNDQsNS4zNDEtOC42NSwxMi43MTktOC42NSwyMC44NzIsMCwxNi4zLDEzLjIwOSwyOS41MTEsMjkuNTA5LDI5LjUxMSwyLjk1NSwwLDUuODAzLTAuNDM3LDguNDk2LTEuMjQ0bDIuNzg3LDYuOTQyYy0zLjU1NSwxLjEzOC03LjM0NywxLjc1Ny0xMS4yODMsMS43NTctMjAuNDE3LDAtMzYuOTY0LTE2LjU0OC0zNi45NjQtMzYuOTY2LDAtMjAuNDE3LDE2LjU0Ny0zNi45NjYsMzYuOTY0LTM2Ljk2Nm0wLDIwLjMzM2MzLjUzNiwwLDYuODE1LDEuMTAzLDkuNTExLDIuOTgzbDAuMTkxLTAuNDE1LDAuMDE0LDAuMDExLDAuMjM0LTAuNTA2LDIuMzEzLTUuMTg1LDIuNTg1LTUuNzYyYy00LjM2Mi0yLjU0NC05LjQzNC00LjAwMi0xNC44NDgtNC4wMDItNS40ODEsMC0xMC42MTEsMS40OTYtMTUuMDA3LDQuMDk3bDQuNTUsOS44NjIsMC44OTUsMS45MzhjMi43MDUtMS45MDMsNi4wMDItMy4wMjEsOS41NjItMy4wMjFtNi40MTQsOS43M2MtMS42OC0xLjU2NC0zLjkzNS0yLjUyMS02LjQxNC0yLjUyMS0yLjQ5NiwwLTQuNzY1LDAuOTctNi40NTEsMi41NTRsMC4xOCwwLjM4OSwwLjEzNywwLjI5OSw2LjA2OSwxNC4wNjgsMi4zNjMtNS4yOTYsMy43NjktOC43NCwwLjM0Ny0wLjc1M3oiLz4NCiAgICAgICAgPC9nPg0KICAgIDwvZz4NCjwvc3ZnPg0KDQo=';
}
$repost_title = "Content Feed";
add_submenu_page( 'atcontent', $repost_title, $repost_title, 'publish_posts', 'atcontent_reposts', 'atcontent_reposts_callback' );
add_submenu_page( 'atcontent', 'AtContent Settings', 'Settings', 'edit_posts', 'atcontent', 'atcontent_settings_callback' );
add_menu_page( 'AtContent', 'AtContent', 'edit_posts', 'atcontent', 'atcontent_settings_callback', $ac_logo, $atcontent_dashboard_key );
//add_submenu_page( 'atcontent', 'Monetize Blog', 'Monetize Blog$', 'publish_posts', 'atcontent_monetize', 'atcontent_monetize_callback' );
atcontent_fix_menu( 'atcontent_reposts', 'atcontent', 'atcontent_reposts_callback' );
add_action( 'admin_print_styles', 'atcontent_admin_styles' );
add_action( 'admin_print_footer_scripts', 'atcontent_footer_scripts' );
}
function atcontent_fix_menu( $slug, $parentslug, $function ){
global $_registered_pages;
$hookname = get_plugin_page_hookname( $slug, $parentslug );
if (!empty ( $hookname ))
add_action( $hookname, $function );
$_registered_pages[$hookname] = true;
}
function atcontent_plugin_callback(){
include_once( 'dashboard.php' );
}
function atcontent_settings_callback(){
include_once( 'dashboard.php' );
}
function atcontent_reposts_callback(){
include_once( 'repost.php' );
}
function atcontent_monetize_callback(){
include_once( 'getpaid.php' );
}
function atcontent_admin_styles(){
wp_enqueue_style( 'atcontentAdminStylesheet' );
}
function atcontent_admin_head() {
$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_url = admin_url( "admin.php?page=atcontent" );
$img_url = plugins_url( 'assets/logo.png', dirname( __FILE__ ) );
if ( ( strlen( $ac_api_key ) == 0 || strlen( $ac_syncid ) == 0 ) && user_can( $userid, "edit_posts" ) ) {
?>
ID;
$ac_api_key = get_user_meta( $userid, "ac_api_key", true );
$ac_syncid = get_user_meta( $userid, "ac_syncid", true );
?>