From 27764b36353b3066a9e92da2a96ac17b546295be Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 22 Feb 2014 16:53:51 -0500 Subject: Improve sharing Previously, the share page can handle only a limited number of shares and only one of each type. Now the configuration has been change to be more flexible and allows an unlimited number of shares. The share description is located in an array and the share configuration is stored along with the user configuration. Note: I tried to include the specific javascript code in a separate file but I did not succeded to import it. --- app/Models/Share.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/Models/Share.php (limited to 'app/Models/Share.php') diff --git a/app/Models/Share.php b/app/Models/Share.php new file mode 100644 index 000000000..b146db722 --- /dev/null +++ b/app/Models/Share.php @@ -0,0 +1,44 @@ + Date: Sun, 2 Mar 2014 09:24:02 -0500 Subject: Add a default URL value --- app/Models/Share.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/Models/Share.php') diff --git a/app/Models/Share.php b/app/Models/Share.php index b146db722..887fcef05 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -3,6 +3,9 @@ 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~', -- cgit v1.2.3 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 +++++++++++---- app/Models/Share.php | 3 --- app/views/helpers/view/normal_view.phtml | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'app/Models/Share.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; } } 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~', diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index ff535c60a..9fd06ebae 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -138,7 +138,7 @@ if (!empty($this->entries)) { -- cgit v1.2.3