diff options
| author | 2014-03-08 15:56:54 +0100 | |
|---|---|---|
| committer | 2014-03-08 15:56:54 +0100 | |
| commit | faa9a74324942e9be4682067208e1ef3a8f332a7 (patch) | |
| tree | afbeafd9ae85211015873e2aa64c19f3a25358e2 /app/Models | |
| parent | 859290ec1f79840db031da3af10f25792e98623d (diff) | |
| parent | 20ebf987b4383921be5f3b7a0222a212aad138b9 (diff) | |
Merge pull request #447 from aledeg/share
Sharing optimization
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Configuration.php | 15 | ||||
| -rw-r--r-- | app/Models/Share.php | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 827a1d166..80031369e 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -193,7 +193,9 @@ class FreshRSS_Configuration { if (!is_array($value)) { continue; } - if (array_key_exists('url', $value)) { + + // Verify URL and add default value when needed + if (isset($value['url'])) { $is_url = ( filter_var ($value['url'], FILTER_VALIDATE_URL) || (version_compare(PHP_VERSION, '5.3.3', '<') && @@ -203,10 +205,15 @@ class FreshRSS_Configuration { if (!$is_url) { continue; } - if (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) { - $value['name'] = $value['type']; - } + } else { + $value['url'] = null; } + + // Add a default name + if (empty($value['name'])) { + $value['name'] = $value['type']; + } + $this->data['sharing'][] = $value; } } diff --git a/app/Models/Share.php b/app/Models/Share.php index 887fcef05..b146db722 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -3,9 +3,6 @@ class FreshRSS_Share { static public function generateUrl($options, $selected, $link, $title) { - if (!array_key_exists('url', $selected)) { - $selected['url'] = ''; - } $share = $options[$selected['type']]; $matches = array( '~URL~', |
