/**
  * Add hooks and filters
  *
  * @since 0.1.0
  * @return null
  */
 public function hooks()
 {
     add_action('init', array($this, 'init'));
     add_filter('wds_network_require_login_for_rest_api', array($this, 'maybe_allow_rest_api'));
     if (is_multisite()) {
         $this->network_admin->hooks();
     }
     $this->admin->hooks();
 }
Esempio n. 2
0
 /**
  * Checks if REST API bypass is allowed on this site.
  *
  * @since  0.1.0
  * @return boolean Enabled or disabled
  */
 public function is_required_for_rest($is_required)
 {
     $setting = $this->get_option('allow_rest_api');
     if ('bypass' === $setting) {
         return false;
     }
     if ('require' === $setting) {
         return true;
     }
     if ('use_require_login_setting' === $setting) {
         return $is_required;
     }
     if ($this->network_admin) {
         return (bool) $this->network_admin->is_required_for_rest();
     }
     return $is_required;
 }