diff options
| author | 2014-03-05 20:22:03 -0500 | |
|---|---|---|
| committer | 2014-03-08 09:18:06 -0500 | |
| commit | e9eca6aff6c7e2e2349b3b6cf714e2e7eb99405e (patch) | |
| tree | 8643ff4baeddb2c479e21961242726707ee05b16 /app/Models/Configuration.php | |
| parent | 859290ec1f79840db031da3af10f25792e98623d (diff) | |
Sharing optimization
Change the storage and display of sharings to improve the time needed to generate the page.
Instead of looking for a default value when displaying the sharing links, they are added
during the configuration.
Diffstat (limited to 'app/Models/Configuration.php')
| -rw-r--r-- | app/Models/Configuration.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 827a1d166..85e891b64 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 (array_key_exists('url', $value) && $value['url'] !== null) { $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 (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) { + $value['name'] = $value['type']; + } + $this->data['sharing'][] = $value; } } |
