/** * Autoloads files with classes when needed * * @since 0.1.0 * @param string $class_name Name of the class being requested * @return void */ function wds_rest_connect_ui_autoload_classes($class_name) { if (0 !== strpos($class_name, 'WDSRESTCUI_')) { return; } $filename = strtolower(str_replace('_', '-', substr($class_name, strlen('WDSRESTCUI_')))); WDS_REST_Connect_UI::include_file($filename); }
<?php /** * WDS WP REST API Connect UI Compatibility * @version 0.1.0 * @package WDS WP REST API Connect UI */ WDS_REST_Connect_UI::include_file('vendor/wds-wp-rest-api-connect/wds-wp-rest-api-connect'); class WDSRESTCUI_Compatibility extends WDS_WP_REST_API_Connect { /** * Whether plugin should operate on the network settings level. * * @var bool * @since 0.1.0 */ protected $is_network = false; /** * Object constructor * * @since 0.1.0 * * @param boolean $is_network */ public function __construct($is_network = false) { $this->is_network = (bool) $is_network; if ($this->is_network) { add_filter('pre_option_wp_rest_api_connect_error', array($this, 'override_error_option_get'), 10, 2); } }