File: /home/primrwxj/thepassiveincomeideas.com/wp-content/plugins/wpauto-pro/admin/class.wpauto-post.php
<?php
class WPAuto_Post {
public static $instance = null;
public function __construct() {
// create wpauto post type
add_action( 'init', array( $this, 'wpauto_register_cpt' ) );
// manage columns of wpauto post type
//add_filter( 'manage_edit-wpauto_columns', array( $this, 'wpauto_custom_edit_columns' ) );
//add_action( 'manage_posts_custom_column', array( $this, 'wpauto_columns_display' ) );
//add filter to ensure the text Book, or book, is displayed when user updates a book
//add_filter( 'post_updated_messages', array( $this, 'wpauto_codex_book_updated_messages' ) );
}
public function wpauto_register_cpt(){
$labels = array(
'name' => esc_html__( 'Campaigns', 'wpauto' ),
'all_items' => esc_html__( 'Campaigns', 'wpauto' ),
'singular_name' => 'wpauto',
'add_new' => esc_html__( 'New Campaign', 'wpauto' ),
'add_new_item' => esc_html__( 'Add New Campaign', 'wpauto' ),
'edit_item' => esc_html__( 'Edit Campaign', 'wpauto' ),
'new_item' => esc_html__( 'New Campaign', 'wpauto' ),
'view_item' => esc_html__( 'View Campaign', 'wpauto' ),
'search_items' => esc_html__( 'Search Campaigns', 'wpauto' ),
'not_found' => esc_html__( 'No Campaigns found', 'wpauto' ),
'not_found_in_trash' => esc_html__( 'No Campaigns found in Trash', 'wpauto' ),
'parent_item_colon' => esc_html__( 'Parent Campaign:', 'wpauto' ),
'menu_name' => esc_html__( 'WPAuto Post', 'wpauto' )
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'Campaigns of Wordpress Automatic',
'supports' => array( 'title' ),
'taxonomies' => array( 'options' ),
'public' => false,
'show_ui' => true,
'show_in_menu' => 'wpauto',//'wpauto'/true,
'show_in_nav_menus' => true,
//'menu_position' => 3,
'publicly_queryable' => false,
'exclude_from_search' => true,
'has_archive' => false,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post',
//'menu_icon' => esc_url( WPAUTO_URL . 'admin/assets/images/robot-man.png' )
);
//admin only
$admin_caps = array( 'capabilities' => array(
'edit_post' => 'manage_options',
'read_post' => 'manage_options',
'delete_post' => 'manage_options',
'edit_posts' => 'manage_options',
'edit_others_posts' => 'manage_options',
'delete_posts' => 'manage_options',
'publish_posts' => 'manage_options',
'read_private_posts' => 'manage_options'
));
$opt = get_option ( 'wpauto_options', array ('OPT_ADMIN_ONLY') );
if( in_array ( 'OPT_ADMIN_ONLY', $opt ) ) {
$args = array_merge($args,$admin_caps);
}
register_post_type( 'wpauto', $args );
}
public function wpauto_show_links( $id ){
$count = get_post_meta( $id, 'links_added',1 );
if( $count != ''){
return ' Additional Info:'.$count.' links added to be posted on the last time a file was uploaded.';
}else{
return '';
}
}
function wpauto_codex_book_updated_messages( $messages ){
global $post, $post_ID;
$messages['wpauto'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( 'Campaign <b>updated</b> successfully.' ),
2 => 'Custom field updated.',
3 => 'Custom field deleted.',
4 => 'Campaign updated.',
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( 'Campaign restored to revision from %s', wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf('Campaign published %s ', $this->wpauto_show_links($post_ID) ),
7 => 'Campaign saved.',
8 => sprintf( 'Campaign submitted. %s', $this->wpauto_show_links($post_ID)),
9 => sprintf( 'Camapaign scheduled for: <strong>%1$s</strong>. %2$s',
// translators: Publish box date format, see http://php.net/date
date_i18n( 'M j, Y @ G:i' , strtotime( $post->post_date ) ), $this->wpauto_show_links($post_ID) ),
10 => sprintf( 'Campaign draft updated. %s', $this->wpauto_show_links($post_ID)),
);
return $messages;
}
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
} WPAuto_Post::instance();