Skip to content
Permalink
Browse files

Prevent some connectors from loading on the site frontend

  • Loading branch information...
Luke Carbis
Luke Carbis committed Nov 2, 2016
1 parent c6ed40c commit ed3a6356c6e8fe36bd0e0b748ba3fed8138d3d14
@@ -30,6 +30,20 @@ abstract class Connector {
*/
public $prev_stream = null;
/**
* Register connector in the WP Admin
*
* @var bool
*/
public $register_admin = true;
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = true;
/**
* Register all context hooks
*/
@@ -89,9 +89,22 @@ public function load_connectors() {
continue;
}
$class = new $class_name( $this->plugin->log );
if ( ! method_exists( $class, 'is_dependency_satisfied' ) ) {
// Check if the Connector extends WP_Stream\Connector
if ( ! is_subclass_of( $class, 'WP_Stream\Connector' ) ) {
continue;
}
// Check if the Connector is allowed to be registered in the WP Admin
if ( is_admin() && ! $class->register_admin ) {
continue;
}
// Check if the Connector is allowed to be registered in the WP Frontend
if ( ! is_admin() && ! $class->register_frontend ) {
continue;
}
if ( $class->is_dependency_satisfied() ) {
$classes[ $class->name ] = $class;
}
@@ -23,6 +23,13 @@ class Connector_Editor extends Connector {
*/
private $edited_file = array();
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Register all context hooks
*
@@ -26,6 +26,13 @@ class Connector_Installer extends Connector {
'_core_updated_successfully',
);
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Return translated connector label
*
@@ -33,6 +33,13 @@ class Connector_Jetpack extends Connector {
'wp_ajax_jetpack_post_by_email_disable',
);
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Tracked option keys
*
@@ -20,6 +20,13 @@ class Connector_Menus extends Connector {
'delete_nav_menu',
);
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Return translated connector label
*
@@ -19,6 +19,13 @@ class Connector_Posts extends Connector {
'deleted_post',
);
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Return translated connector label
*
@@ -81,6 +81,13 @@ class Connector_Settings extends Connector {
'new_admin_email',
);
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Register all context hooks
*
@@ -35,6 +35,13 @@ class Connector_Taxonomies extends Connector {
*/
public $context_labels;
/**
* Register connector in the WP Frontend
*
* @var bool
*/
public $register_frontend = false;
/**
* Return translated connector label
*

0 comments on commit ed3a635

Please sign in to comment.
You can’t perform that action at this time.