-
Mohammad Jangda authored
Integrate the Transport "mode" into the Transport "type" dropdown. It's unlikely that you'd have a client that's both push and pull and other.
Mohammad Jangda authoredIntegrate the Transport "mode" into the Transport "type" dropdown. It's unlikely that you'd have a client that's both push and pull and other.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
class-wp-push-syndication-server.php 42.89 KiB
<?php
require_once( dirname( __FILE__ ) . '/class-syndication-client-factory.php' );
class WP_Push_Syndication_Server {
public $push_syndicate_settings;
public $push_syndicate_default_settings;
public $push_syndicate_transports;
private $version = '2.0';
function __construct() {
// initialization
add_action( 'init', array( $this, 'init' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) );
// custom columns
add_filter( 'manage_edit-syn_site_columns', array( $this, 'add_new_columns' ) );
add_action( 'manage_syn_site_posts_custom_column', array( $this, 'manage_columns' ), 10, 2);
// submenus
add_action( 'admin_menu', array( $this, 'register_syndicate_settings' ) );
// defining sites
add_action( 'save_post', array( $this, 'save_site_settings' ) );
// loading necessary styles and scripts
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts_and_styles' ) );
// filter admin notices in custom post types
add_filter( 'post_updated_messages', array( $this, 'push_syndicate_admin_messages' ) );
// syndicating content
add_action( 'add_meta_boxes', array( $this, 'add_post_metaboxes' ) );
add_action( 'transition_post_status', array( $this, 'save_syndicate_settings' ) ); // use transition_post_status instead of save_post because the former is fired earlier which causes race conditions when a site group select and publish happen on the same load
add_action( 'wp_trash_post', array( $this, 'delete_content' ) );
// adding custom time interval
add_filter( 'cron_schedules', array( $this, 'cron_add_pull_time_interval' ) );
// firing a cron job
add_action( 'transition_post_status', array( $this, 'pre_schedule_push_content' ) );
add_action( 'delete_post', array( $this, 'schedule_delete_content' ) );
$this->register_syndicate_actions();
}
public function init() {
$capability = apply_filters( 'syn_syndicate_cap', 'manage_options' );
$post_type_capabilities = array(
'edit_post' => $capability,
'read_post' => $capability,
'delete_post' => $capability,
'edit_posts' => $capability,
'edit_others_posts' => $capability,
'publish_posts' => $capability,
'read_private_posts' => $capability
);
$taxonomy_capabilities = array(
'manage_terms' => 'manage_categories',
'edit_terms' => 'manage_categories',
'delete_terms' => 'manage_categories',
'assign_terms' => 'edit_posts',
);