aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Share.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-12-17 20:28:04 +0100
committerGravatar GitHub <noreply@github.com> 2017-12-17 20:28:04 +0100
commit60f56539c3f30fd3f7ba4f2a3570f7029ac93e5f (patch)
tree1e78bfac7042dceb63898e2215db8fb0c1d7745d /app/Models/Share.php
parentceda55c75b158fc1cf4813fe0f258527754b9289 (diff)
parent0b1516af91792f86868689392f72ad4b6e32cdcf (diff)
Merge pull request #1720 from FreshRSS/dev
FreshRSS 1.9.0
Diffstat (limited to 'app/Models/Share.php')
-rw-r--r--app/Models/Share.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/app/Models/Share.php b/app/Models/Share.php
index 86b1b9ed9..7378b30df 100644
--- a/app/Models/Share.php
+++ b/app/Models/Share.php
@@ -21,9 +21,11 @@ class FreshRSS_Share {
}
$help_url = isset($share_options['help']) ? $share_options['help'] : '';
+ $field = isset($share_options['field']) ? $share_options['field'] : null;
self::$list_sharing[$type] = new FreshRSS_Share(
$type, $share_options['url'], $share_options['transform'],
- $share_options['form'], $help_url
+ $share_options['form'], $help_url, $share_options['method'],
+ $field
);
}
@@ -76,6 +78,8 @@ class FreshRSS_Share {
private $base_url = null;
private $title = null;
private $link = null;
+ private $method = 'GET';
+ private $field;
/**
* Create a FreshRSS_Share object.
@@ -86,9 +90,10 @@ class FreshRSS_Share {
* is typically for a centralized service while "advanced" is for
* decentralized ones.
* @param $help_url is an optional url to give help on this option.
+ * @param $method defines the sharing method (GET or POST)
*/
private function __construct($type, $url_transform, $transform,
- $form_type, $help_url = '') {
+ $form_type, $help_url, $method, $field) {
$this->type = $type;
$this->name = _t('gen.share.' . $type);
$this->url_transform = $url_transform;
@@ -103,6 +108,11 @@ class FreshRSS_Share {
$form_type = 'simple';
}
$this->form_type = $form_type;
+ if (!in_array($method, array('GET', 'POST'))) {
+ $method = 'GET';
+ }
+ $this->method = $method;
+ $this->field = $field;
}
/**
@@ -116,6 +126,8 @@ class FreshRSS_Share {
'url' => 'base_url',
'title' => 'title',
'link' => 'link',
+ 'method' => 'method',
+ 'field' => 'field',
);
foreach ($options as $key => $value) {
@@ -133,6 +145,21 @@ class FreshRSS_Share {
}
/**
+ * Return the current method of the share option.
+ */
+ public function method() {
+ return $this->method;
+ }
+
+ /**
+ * Return the current field of the share option. It's null for shares
+ * using the GET method.
+ */
+ public function field() {
+ return $this->field;
+ }
+
+ /**
* Return the current form type of the share option.
*/
public function formType() {