'Monitorr', 'enabled' => true, 'image' => 'plugins/images/tabs/monitorr.png', 'category' => 'Monitor', 'settings' => array( 'Enable' => array( array( 'type' => 'switch', 'name' => 'homepageMonitorrEnabled', 'label' => 'Enable', 'value' => $this->config['homepageMonitorrEnabled'] ), array( 'type' => 'select', 'name' => 'homepageMonitorrAuth', 'label' => 'Minimum Authentication', 'value' => $this->config['homepageMonitorrAuth'], 'options' => $this->groupOptions ) ), 'Connection' => array( array( 'type' => 'input', 'name' => 'monitorrURL', 'label' => 'URL', 'value' => $this->config['monitorrURL'], 'help' => 'URL for Monitorr. Please use the revers proxy URL i.e. https://domain.com/monitorr/.', 'placeholder' => 'http://domain.com/monitorr/' ), array( 'type' => 'select', 'name' => 'homepageMonitorrRefresh', 'label' => 'Refresh Seconds', 'value' => $this->config['homepageMonitorrRefresh'], 'options' => $this->timeOptions() ), ), 'Options' => array( array( 'type' => 'input', 'name' => 'monitorrHeader', 'label' => 'Title', 'value' => $this->config['monitorrHeader'], 'help' => 'Sets the title of this homepage module', ), array( 'type' => 'switch', 'name' => 'monitorrHeaderToggle', 'label' => 'Toggle Title', 'value' => $this->config['monitorrHeaderToggle'], 'help' => 'Shows/hides the title of this homepage module' ), array( 'type' => 'switch', 'name' => 'monitorrCompact', 'label' => 'Compact view', 'value' => $this->config['monitorrCompact'], 'help' => 'Toggles the compact view of this homepage module' ), ), ) ); } public function getMonitorrHomepageData() { if (!$this->config['homepageMonitorrEnabled']) { $this->setAPIResponse('error', 'Monitorr homepage item is not enabled', 409); return false; } if (!$this->qualifyRequest($this->config['homepageMonitorrAuth'])) { $this->setAPIResponse('error', 'User not approved to view this homepage item', 401); return false; } if (empty($this->config['monitorrURL'])) { $this->setAPIResponse('error', 'Monitorr URL is not defined', 422); return false; } $api = []; $url = $this->qualifyURL($this->config['monitorrURL']); $dataUrl = $url . '/assets/php/loop.php'; try { $response = Requests::get($dataUrl, ['Token' => $this->config['organizrAPI']], []); if ($response->success) { $html = html_entity_decode($response->body); // This section grabs the names of all services by regex $services = []; $servicesMatch = []; $servicePattern = '/