| @@ -9,108 +9,220 @@ | ||
| 9 | 9 | class SRR_Options{ |
| 10 | 10 | |
| 11 | 11 | public static function options(){ |
| 12 | 12 | |
| 13 | - return array( | |
| 13 | + return apply_filters( 'srr_mod_options', array( | |
| 14 | 14 | 'urls' => array( |
| 15 | 15 | 'default' => '', |
| 16 | - 'description' => __( 'The URLs to display RSS feed for. Multiple RSS feed URLs can be separated by a new line or comma' ) | |
| 16 | + 'description' => __( 'The URLs to display RSS feed for. Multiple RSS feed URLs can be separated by a new line or comma.', 'super-rss-reader' ), | |
| 17 | 17 | ), |
| 18 | 18 | 'tab_titles' => array( |
| 19 | 19 | 'default' => '', |
| 20 | - 'description' => __( 'The title of the tab for the respective RSS feed.' ) | |
| 20 | + 'description' => __( 'The title of the tab for the respective RSS feed.', 'super-rss-reader' ) | |
| 21 | 21 | ), |
| 22 | 22 | 'count' => array( |
| 23 | 23 | 'default' => 5, |
| 24 | - 'description' => __( 'The total number of feed items to fetch.' ) | |
| 24 | + 'description' => __( 'The total number of feed items to fetch.', 'super-rss-reader' ) | |
| 25 | 25 | ), |
| 26 | + 'show_title' => array( | |
| 27 | + 'default' => 1, | |
| 28 | + 'description' => __( 'Display the title of the feed item.', 'super-rss-reader' ), | |
| 29 | + 'options' => array( | |
| 30 | + 0 => __( 'Hide title', 'super-rss-reader' ), | |
| 31 | + 1 => __( 'Show title', 'super-rss-reader' ) | |
| 32 | + ) | |
| 33 | + ), | |
| 26 | 34 | 'show_date' => array( |
| 27 | 35 | 'default' => 0, |
| 28 | - 'description' => __( 'Display the date of the feed item' ) | |
| 36 | + 'description' => __( 'Display the date of the feed item.', 'super-rss-reader' ), | |
| 37 | + 'options' => array( | |
| 38 | + 0 => __( 'Hide date', 'super-rss-reader' ), | |
| 39 | + 1 => __( 'Show date', 'super-rss-reader' ) | |
| 40 | + ) | |
| 29 | 41 | ), |
| 30 | 42 | 'show_desc' => array( |
| 31 | 43 | 'default' => 1, |
| 32 | - 'description' => __( 'Display the description/excerpt of the feed item' ) | |
| 44 | + 'description' => __( 'Display the description/excerpt of the feed item.', 'super-rss-reader' ), | |
| 45 | + 'options' => array( | |
| 46 | + 0 => __( 'Hide description', 'super-rss-reader' ), | |
| 47 | + 1 => __( 'Show description', 'super-rss-reader' ) | |
| 48 | + ) | |
| 33 | 49 | ), |
| 34 | 50 | 'show_author' => array( |
| 35 | 51 | 'default' => 0, |
| 36 | - 'description' => __( 'Display the author of the feed item' ) | |
| 52 | + 'description' => __( 'Display the author of the feed item.', 'super-rss-reader' ), | |
| 53 | + 'options' => array( | |
| 54 | + 0 => __( 'Hide author', 'super-rss-reader' ), | |
| 55 | + 1 => __( 'Show author', 'super-rss-reader' ) | |
| 56 | + ) | |
| 37 | 57 | ), |
| 38 | 58 | 'show_thumb' => array( |
| 39 | 59 | 'default' => 1, |
| 40 | - 'description' => __( 'Display the thumbnail of the feed item' ) | |
| 60 | + 'description' => __( 'Display the thumbnail of the feed item.', 'super-rss-reader' ), | |
| 61 | + 'options' => array( | |
| 62 | + 0 => __( 'Hide thumbnail', 'super-rss-reader' ), | |
| 63 | + 1 => __( 'Show thumbnail', 'super-rss-reader' ) | |
| 64 | + ) | |
| 41 | 65 | ), |
| 42 | 66 | 'strip_desc' => array( |
| 43 | 67 | 'default' => 30, |
| 44 | - 'description' => __( 'Trim the description to certain number of words' ) | |
| 68 | + 'description' => __( 'Trim the description to certain number of words.', 'super-rss-reader' ) | |
| 45 | 69 | ), |
| 46 | 70 | 'strip_title' => array( |
| 47 | 71 | 'default' => 0, |
| 48 | - 'description' => __( 'Trim the title text to certain number of words.' ) | |
| 72 | + 'description' => __( 'Trim the title text to certain number of words.', 'super-rss-reader' ) | |
| 49 | 73 | ), |
| 74 | + 'offset' => array( | |
| 75 | + 'default' => 0, | |
| 76 | + 'description' => __( 'The number of RSS feed items to skip from the top.', 'super-rss-reader' ) | |
| 77 | + ), | |
| 78 | + 'date_format' => array( | |
| 79 | + 'default' => 'j F Y', | |
| 80 | + 'description' => __( 'The format of the feed item date.', 'super-rss-reader' ) | |
| 81 | + ), | |
| 82 | + 'date_timezone' => array( | |
| 83 | + 'default' => 'UTC', | |
| 84 | + 'description' => __( 'The timezone of the feed item date.', 'super-rss-reader' ) | |
| 85 | + ), | |
| 86 | + 'order_by' => array( | |
| 87 | + 'default' => 'default', | |
| 88 | + 'description' => __( 'The order of the feed', 'super-rss-reader' ), | |
| 89 | + 'options' => array( | |
| 90 | + 'default' => __( 'Default', 'super-rss-reader' ), | |
| 91 | + 'date' => __( 'Date', 'super-rss-reader' ), | |
| 92 | + 'date_reverse' => __( 'Date reverse', 'super-rss-reader' ), | |
| 93 | + 'random' => __( 'Random', 'super-rss-reader' ) | |
| 94 | + ) | |
| 95 | + ), | |
| 50 | 96 | 'read_more' => array( |
| 51 | 97 | 'default' => '[...]', |
| 52 | - 'description' => __( 'The read more text if the description is stripped.' ) | |
| 98 | + 'description' => __( 'The read more text if the description is trimmed.', 'super-rss-reader' ) | |
| 53 | 99 | ), |
| 54 | 100 | 'rich_desc' => array( |
| 55 | 101 | 'default' => 0, |
| 56 | - 'description' => __( 'Display rich description with all the formatting present in the feed.' ) | |
| 102 | + 'description' => __( 'Display rich description with all the formatting. Note: With rich description text cannot be trimmed.', 'super-rss-reader' ), | |
| 103 | + 'options' => array( | |
| 104 | + 0 => __( 'Normal description', 'super-rss-reader' ), | |
| 105 | + 1 => __( 'Rich description', 'super-rss-reader' ) | |
| 106 | + ) | |
| 57 | 107 | ), |
| 108 | + 'desc_type' => array( | |
| 109 | + 'default' => 'summary', | |
| 110 | + 'description' => __( 'Type of description to prefer', 'super-rss-reader' ), | |
| 111 | + 'options' => array( | |
| 112 | + 'summary' => __( 'Summary', 'super-rss-reader' ), | |
| 113 | + 'full_content' => __( 'Full content', 'super-rss-reader' ) | |
| 114 | + ) | |
| 115 | + ), | |
| 116 | + 'link_desc' => array( | |
| 117 | + 'default' => 0, | |
| 118 | + 'description' => __( 'Link description text with the feed item URL', 'super-rss-reader' ), | |
| 119 | + 'options' => array( | |
| 120 | + 0 => __( 'No link', 'super-rss-reader' ), | |
| 121 | + 1 => __( 'Link description', 'super-rss-reader' ) | |
| 122 | + ) | |
| 123 | + ), | |
| 58 | 124 | 'add_nofollow' => array( |
| 59 | 125 | 'default' => 1, |
| 60 | - 'description' => __( 'Add "nofollow" attribute to feed links' ) | |
| 126 | + 'description' => __( 'Add "nofollow" attribute to feed links.', 'super-rss-reader' ), | |
| 127 | + 'options' => array( | |
| 128 | + 0 => __( 'Do not add nofollow attribute', 'super-rss-reader' ), | |
| 129 | + 1 => __( 'Add nofollow attribute', 'super-rss-reader' ) | |
| 130 | + ) | |
| 61 | 131 | ), |
| 62 | 132 | 'open_newtab' => array( |
| 63 | 133 | 'default' => 1, |
| 64 | - 'description' => __( 'Display the thumbnail of the feed item' ) | |
| 134 | + 'description' => __( 'Open the feed links in new tab.', 'super-rss-reader' ), | |
| 135 | + 'options' => array( | |
| 136 | + 0 => __( 'Open in same tab', 'super-rss-reader' ), | |
| 137 | + 1 => __( 'Open in new tab', 'super-rss-reader' ) | |
| 138 | + ) | |
| 65 | 139 | ), |
| 140 | + 'thumbnail_position' => array( | |
| 141 | + 'default' => 'align_left', | |
| 142 | + 'description' => __( 'The position of the thumbnail.', 'super-rss-reader' ), | |
| 143 | + 'options' => array( | |
| 144 | + 'align_left' => __( 'Align left', 'super-rss-reader' ), | |
| 145 | + 'align_right' => __( 'Align right', 'super-rss-reader' ), | |
| 146 | + 'cover' => __( 'Cover', 'super-rss-reader' ) | |
| 147 | + ) | |
| 148 | + ), | |
| 149 | + 'thumbnail_size' => array( | |
| 150 | + 'default' => '64px', | |
| 151 | + 'description' => __( 'The size of the thumbnail including the units. Example: 64px, 10%', 'super-rss-reader' ) | |
| 152 | + ), | |
| 153 | + 'thumbnail_default' => array( | |
| 154 | + 'default' => '', | |
| 155 | + 'description' => __( 'The URL of the default thumbnail image if not present. Leave empty to not display any thumbnail.', 'super-rss-reader' ) | |
| 156 | + ), | |
| 157 | + 'no_feed_text' => array( | |
| 158 | + 'default' => __( 'No items', 'super-rss-reader' ), | |
| 159 | + 'description' => __( 'Text to display when there are no feed items', 'super-rss-reader' ) | |
| 160 | + ), | |
| 66 | 161 | 'color_style' => array( |
| 67 | 162 | 'default' => 'none', |
| 68 | - 'description' => __( 'The style of the feed display' ) | |
| 163 | + 'description' => __( 'The style of the feed display.', 'super-rss-reader' ), | |
| 164 | + 'options' => array( | |
| 165 | + 'none' => 'No style', | |
| 166 | + 'grey' => 'Grey', | |
| 167 | + 'dark' => 'Dark', | |
| 168 | + 'orange' => 'Orange', | |
| 169 | + 'smodern' => 'Modern 1', | |
| 170 | + 'modern2' => 'Modern 2 (New)' | |
| 171 | + ) | |
| 69 | 172 | ), |
| 70 | 173 | 'display_type' => array( |
| 71 | 174 | 'default' => 'vertical_ticker', |
| 72 | - 'description' => __( 'The type of feed display mode.' ) | |
| 175 | + 'description' => __( 'The type of feed display mode.', 'super-rss-reader' ), | |
| 176 | + 'options' => array( | |
| 177 | + 'normal' => __( 'Normal', 'super-rss-reader' ), | |
| 178 | + 'vertical_ticker' => __( 'Ticker', 'super-rss-reader' ), | |
| 179 | + 'scroll' => __( 'Scroll', 'super-rss-reader' ), | |
| 180 | + ) | |
| 73 | 181 | ), |
| 74 | 182 | 'visible_items' => array( |
| 75 | 183 | 'default' => 5, |
| 76 | - 'description' => __( 'The number of feed items to be visible when ticker is enabled.' ) | |
| 184 | + 'description' => __( 'The number of feed items to be visible when ticker is enabled.', 'super-rss-reader' ) | |
| 77 | 185 | ), |
| 78 | 186 | 'ticker_speed' => array( |
| 79 | 187 | 'default' => 4, |
| 80 | - 'description' => __( 'The speed of the ticker animation in seconds' ) | |
| 188 | + 'description' => __( 'The speed of the ticker animation in seconds. Without units.', 'super-rss-reader' ) | |
| 81 | 189 | ), |
| 82 | - ); | |
| 190 | + 'scroll_height' => array( | |
| 191 | + 'default' => '400px', | |
| 192 | + 'description' => __( 'The maximum height of the RSS feed container.', 'super-rss-reader' ) | |
| 193 | + ), | |
| 194 | + )); | |
| 83 | 195 | |
| 84 | 196 | } |
| 85 | 197 | |
| 86 | - public static function color_themes(){ | |
| 87 | - return array( | |
| 88 | - 'No style' => 'none', | |
| 89 | - 'Grey' => 'grey', | |
| 90 | - 'Dark' => 'dark', | |
| 91 | - 'Orange' => 'orange', | |
| 92 | - 'Simple modern' => 'smodern' | |
| 93 | - ); | |
| 94 | - } | |
| 198 | + public static function defaults(){ | |
| 95 | 199 | |
| 96 | - public static function display_types(){ | |
| 97 | - return array( | |
| 98 | - 'normal' => 'Only feed list', | |
| 99 | - 'vertical_ticker' => 'Feed list + Ticker', | |
| 100 | - ); | |
| 200 | + $defaults = array(); | |
| 201 | + $all_options = self::options(); | |
| 202 | + | |
| 203 | + foreach( $all_options as $id => $props ){ | |
| 204 | + $defaults[ $id ] = $props[ 'default' ]; | |
| 205 | + } | |
| 206 | + | |
| 207 | + return $defaults; | |
| 208 | + | |
| 101 | 209 | } |
| 102 | 210 | |
| 103 | - public static function default_options(){ | |
| 211 | + public static function select_options(){ | |
| 104 | 212 | |
| 105 | - $defaults = array(); | |
| 213 | + $select_options = array(); | |
| 106 | 214 | $all_options = self::options(); |
| 107 | 215 | |
| 108 | 216 | foreach( $all_options as $id => $props ){ |
| 109 | - $defaults[ $id ] = $props[ 'default' ]; | |
| 217 | + $list = array(); | |
| 218 | + if( array_key_exists( 'options', $props ) && is_array( $props[ 'options' ] ) ){ | |
| 219 | + $list = $props[ 'options' ]; | |
| 220 | + } | |
| 221 | + $select_options[ $id ] = $list; | |
| 110 | 222 | } |
| 111 | 223 | |
| 112 | - return $defaults; | |
| 224 | + return $select_options; | |
| 113 | 225 | |
| 114 | 226 | } |
| 115 | 227 | |
| 116 | 228 | } |