0) { if(count($lables) === 1) { $uri .= '&labels=' . urlencode($labels[0]); } else { foreach($labels as $label) { $uri .= '&labels[]=' . urlencode($label); } } } elseif(!is_null($labels) && is_string($labels)) { $uri .= '&labels=' . urlencode($labels); } // Add maintainer if(!empty($maintainer)) { $uri .= '&assignee=' . urlencode($maintainer); } return $uri; } /** * Returns the exception message as HTML string * * @param object $e Exception The exception to show * @param object $bridge object The bridge object * @return string|null Returns the exception as HTML string or null. * * @todo This function belongs inside a class */ function buildBridgeException($e, $bridge){ if(( !($e instanceof \Exception) && !($e instanceof \Error)) || !($bridge instanceof \BridgeInterface)) { return null; } $title = $bridge->getName() . ' failed with error ' . $e->getCode(); // Build a GitHub compatible message $body = 'Error message: `' . $e->getMessage() . "`\nQuery string: `" . $_SERVER['QUERY_STRING'] . "`\nVersion: `" . Configuration::getVersion() . '`'; $body_html = nl2br($body); $link = buildGitHubIssueQuery($title, $body, 'bug report', $bridge->getMaintainer()); $header = buildHeader($e, $bridge); $message = <<{$bridge->getName()} was unable to receive or process the remote website's content!
{$body_html} EOD; $section = buildSection($e, $bridge, $message, $link); return $section; } /** * Returns the exception message as HTML string * * @param object $e Exception The exception to show * @param object $bridge object The bridge object * @return string|null Returns the exception as HTML string or null. * * @todo This function belongs inside a class */ function buildTransformException($e, $bridge){ if(( !($e instanceof \Exception) && !($e instanceof \Error)) || !($bridge instanceof \BridgeInterface)) { return null; } $title = $bridge->getName() . ' failed with error ' . $e->getCode(); // Build a GitHub compatible message $body = 'Error message: `' . $e->getMessage() . "`\nQuery string: `" . $_SERVER['QUERY_STRING'] . '`'; $link = buildGitHubIssueQuery($title, $body, 'bug report', $bridge->getMaintainer()); $header = buildHeader($e, $bridge); $message = "RSS-Bridge was unable to transform the contents returned by {$bridge->getName()}!"; $section = buildSection($e, $bridge, $message, $link); return buildPage($title, $header, $section); } /** * Builds a new HTML header with data from a exception an a bridge * * @param object $e The exception object * @param object $bridge The bridge object * @return string The HTML header * * @todo This function belongs inside a class */ function buildHeader($e, $bridge){ return <<

Error {$e->getCode()}

{$e->getMessage()}

{$bridge->getName()}

EOD; } /** * Builds a new HTML section * * @param object $e The exception object * @param object $bridge The bridge object * @param string $message The message to display * @param string $link The link to include in the anchor * @return string The HTML section * * @todo This function belongs inside a class */ function buildSection($e, $bridge, $message, $link){ return <<

{$message}

  • Press Return to check your input parameters
  • Press F5 to retry
  • Open a GitHub Issue if this error persists

{$bridge->getMaintainer()}

EOD; } /** * Builds a new HTML page * * @param string $title The HTML title * @param string $header The HTML header * @param string $section The HTML section * @return string The HTML page * * @todo This function belongs inside a class */ function buildPage($title, $header, $section){ return << {$title} {$header} {$section} EOD; }