From e9eca6aff6c7e2e2349b3b6cf714e2e7eb99405e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 5 Mar 2014 20:22:03 -0500 Subject: 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. --- app/Models/Configuration.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'app/Models/Configuration.php') 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; } } -- cgit v1.2.3 From b0a3610db735c7f719e8c35d84ffdc5a4e4987af Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 7 Mar 2014 21:04:16 -0500 Subject: Change test --- app/Models/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models/Configuration.php') diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 85e891b64..3e5cd8bad 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -210,7 +210,7 @@ class FreshRSS_Configuration { } // Add a default name - if (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) { + if (empty($value['name'])) { $value['name'] = $value['type']; } -- cgit v1.2.3 From 339a0dd49c79b9adba67483a3cab55c4cb2e2066 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 8 Mar 2014 09:23:59 -0500 Subject: Change test on URL parameter --- app/Models/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models/Configuration.php') diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 3e5cd8bad..80031369e 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -195,7 +195,7 @@ class FreshRSS_Configuration { } // Verify URL and add default value when needed - if (array_key_exists('url', $value) && $value['url'] !== null) { + if (isset($value['url'])) { $is_url = ( filter_var ($value['url'], FILTER_VALIDATE_URL) || (version_compare(PHP_VERSION, '5.3.3', '<') && -- cgit v1.2.3