diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php
index 16a67d54551..5db92b386a7 100644
--- a/actions/DisplayAction.php
+++ b/actions/DisplayAction.php
@@ -151,6 +151,7 @@ public function execute() {
$infos = array(
'name' => $bridge->getName(),
'uri' => $bridge->getURI(),
+ 'donationUri' => $bridge->getDonationURI(),
'icon' => $bridge->getIcon()
);
} catch(Error $e) {
diff --git a/actions/ListAction.php b/actions/ListAction.php
index 92aef0e0f5e..f3509564e2c 100644
--- a/actions/ListAction.php
+++ b/actions/ListAction.php
@@ -39,6 +39,7 @@ public function execute() {
$list->bridges[$bridgeName] = array(
'status' => $status,
'uri' => $bridge->getURI(),
+ 'donationUri' => $bridge->getDonationURI(),
'name' => $bridge->getName(),
'icon' => $bridge->getIcon(),
'parameters' => $bridge->getParameters(),
diff --git a/config.default.ini.php b/config.default.ini.php
index 7d0bdaaa456..0660089212a 100644
--- a/config.default.ini.php
+++ b/config.default.ini.php
@@ -29,6 +29,13 @@
; "" = Disabled (default)
email = ""
+; Show Donation information for bridges if available.
+; This will display a 'Donate' link on the bridge view
+; and a "Donate" button in the HTML view of the bridges feed.
+; true = enabled (default)
+; false = disabled
+donations = true
+
[proxy]
; Sets the proxy url (i.e. "tcp://192.168.0.0:32")
diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php
index ee60418dd64..86d0657d350 100644
--- a/formats/HtmlFormat.php
+++ b/formats/HtmlFormat.php
@@ -6,6 +6,8 @@ public function stringify(){
$extraInfos = $this->getExtraInfos();
$title = htmlspecialchars($extraInfos['name']);
$uri = htmlspecialchars($extraInfos['uri']);
+ $donationUri = htmlspecialchars($extraInfos['donationUri']);
+ $donationsAllowed = Configuration::getConfig('admin', 'donations');
// Dynamically build buttons for all formats (except HTML)
$formatFac = new FormatFactory();
@@ -26,6 +28,17 @@ public function stringify(){
$links .= $this->buildLink($format, $query, $mime) . PHP_EOL;
}
+ if($donationUri !== '' && $donationsAllowed) {
+ $buttons .= ''
+ . PHP_EOL;
+ $links .= ''
+ . PHP_EOL;
+ }
+
$entries = '';
foreach($this->getItems() as $item) {
$entryAuthor = $item->getAuthor() ? '
' . $bridge->getMaintainer() . '
'; + if($donationUri !== '' && $donationsAllowed) { + $card .= '' . $maintainer . ' ~ Donate
'; + } else { + $card .= '' . $maintainer . '
'; + } $card .= ''; return $card; diff --git a/lib/BridgeInterface.php b/lib/BridgeInterface.php index e9309dbf7e8..706251253a0 100644 --- a/lib/BridgeInterface.php +++ b/lib/BridgeInterface.php @@ -120,6 +120,13 @@ public function getParameters(); */ public function getURI(); + /** + * Returns the bridge Donation URI + * + * @return string Bridge Donation URI + */ + public function getDonationURI(); + /** * Returns the cache timeout * diff --git a/lib/Configuration.php b/lib/Configuration.php index 613089ab3d3..7ab8294fc50 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -198,6 +198,9 @@ public static function loadConfiguration() { && !filter_var(self::getConfig('admin', 'email'), FILTER_VALIDATE_EMAIL)) self::reportConfigurationError('admin', 'email', 'Is not a valid email address'); + if(!is_bool(self::getConfig('admin', 'donations'))) + self::reportConfigurationError('admin', 'donations', 'Is not a valid Boolean'); + if(!is_string(self::getConfig('error', 'output'))) self::reportConfigurationError('error', 'output', 'Is not a valid String'); diff --git a/lib/FormatAbstract.php b/lib/FormatAbstract.php index 5c4b87f9800..29e86cb4f8a 100644 --- a/lib/FormatAbstract.php +++ b/lib/FormatAbstract.php @@ -140,7 +140,7 @@ public function getItems(){ * @param array $extraInfos {@inheritdoc} */ public function setExtraInfos(array $extraInfos = array()){ - foreach(array('name', 'uri', 'icon') as $infoName) { + foreach(array('name', 'uri', 'icon', 'donationUri') as $infoName) { if(!isset($extraInfos[$infoName])) { $extraInfos[$infoName] = ''; } diff --git a/static/HtmlFormat.css b/static/HtmlFormat.css index 4ebc79e9acd..77df12969e2 100644 --- a/static/HtmlFormat.css +++ b/static/HtmlFormat.css @@ -96,6 +96,13 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq button:hover { background: #49afff; } + button.highlight { + background: #ff6600; +} + button.highlight:hover { + background: #ff8a3b; +} + @media screen and (max-width: 767px) {