From 4a12c960d18b946d9597e8b07acb30b1c5dc91ce Mon Sep 17 00:00:00 2001 From: Armand Tresova Date: Wed, 13 Nov 2024 21:06:08 -0500 Subject: [PATCH] Fix for setting new default values --- includes/class.cooked-settings.php | 14 ++- languages/cooked.pot | 174 ++++++++++++++--------------- 2 files changed, 96 insertions(+), 92 deletions(-) diff --git a/includes/class.cooked-settings.php b/includes/class.cooked-settings.php index 5970c95..33e6f18 100644 --- a/includes/class.cooked-settings.php +++ b/includes/class.cooked-settings.php @@ -77,10 +77,14 @@ public static function get() { foreach ( $tab['fields'] as $name => $field ) { if ( $field['type'] == 'nonce' || $field['type'] == 'misc_button' ) continue; - if ( $field['type'] == 'checkboxes' && $cooked_settings_saved && $version_compare >= 0 ) { - $_cooked_settings[$name] = isset($_cooked_settings[$name]) ? $_cooked_settings[$name] : []; - } else { - $_cooked_settings[$name] = isset($_cooked_settings[$name]) ? $_cooked_settings[$name] : ( isset( $field['default'] ) ? $field['default'] : false ); + if ( $cooked_settings_saved && $version_compare >= 0 ) { + if ( $field['type'] == 'checkboxes' ) { + $_cooked_settings[$name] = isset($_cooked_settings[$name]) ? $_cooked_settings[$name] : ( isset( $field['default'] ) ? $field['default'] : [] ); + } else { + $_cooked_settings[$name] = isset($_cooked_settings[$name]) ? $_cooked_settings[$name] : ( isset( $field['default'] ) ? $field['default'] : false ); + } + + // Update the settings only if the version has changed. $update_settings = true; } } @@ -385,7 +389,7 @@ public static function pages_array( $choose_text, $none_text = false ) { if( !empty($pages) ) { $page_array[0] = $choose_text; foreach ($pages as $_page) { - $page_array[$_page->ID] = $_page->post_title; + $page_array[$_page->ID] = $_page->post_title . ' (ID:' . $_page->ID . ')'; } } elseif ( $none_text ) { $page_array[0] = $none_text; diff --git a/languages/cooked.pot b/languages/cooked.pot index 173f03e..61c653b 100644 --- a/languages/cooked.pot +++ b/languages/cooked.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-11-13T17:47:32-05:00\n" +"POT-Creation-Date: 2024-11-13T21:05:43-05:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.11.0\n" "X-Domain: cooked\n" @@ -198,7 +198,7 @@ msgstr "" #: includes/class.cooked-functions.php:125 #: includes/class.cooked-recipe-meta.php:1184 -#: includes/class.cooked-settings.php:166 +#: includes/class.cooked-settings.php:170 msgid "Excerpt" msgstr "" @@ -209,7 +209,7 @@ msgstr "" #: includes/class.cooked-functions.php:129 #: includes/class.cooked-recipe-meta.php:1208 #: includes/class.cooked-recipes.php:641 -#: includes/class.cooked-settings.php:167 +#: includes/class.cooked-settings.php:171 #: includes/class.cooked-shortcodes.php:712 msgid "Notes" msgstr "" @@ -310,7 +310,7 @@ msgid "Begin Import" msgstr "" #: includes/class.cooked-import.php:177 -#: includes/class.cooked-settings.php:522 +#: includes/class.cooked-settings.php:526 msgid "reload" msgstr "" @@ -593,7 +593,7 @@ msgid "cans" msgstr "" #: includes/class.cooked-measurements.php:195 -#: includes/class.cooked-settings.php:171 +#: includes/class.cooked-settings.php:175 msgid "Servings" msgstr "" @@ -992,13 +992,13 @@ msgid "This description is used for SEO purposes and is optional. By default, Co msgstr "" #: includes/class.cooked-recipe-meta.php:381 -#: includes/class.cooked-settings.php:165 +#: includes/class.cooked-settings.php:169 msgid "Difficulty Level" msgstr "" #: includes/class.cooked-recipe-meta.php:390 #: includes/class.cooked-recipe-meta.php:967 -#: includes/class.cooked-settings.php:168 +#: includes/class.cooked-settings.php:172 #: includes/class.cooked-shortcodes.php:401 #: includes/class.cooked-shortcodes.php:609 msgid "Prep Time" @@ -1012,7 +1012,7 @@ msgstr "" #: includes/class.cooked-recipe-meta.php:395 #: includes/class.cooked-recipe-meta.php:968 -#: includes/class.cooked-settings.php:169 +#: includes/class.cooked-settings.php:173 #: includes/class.cooked-shortcodes.php:402 #: includes/class.cooked-shortcodes.php:618 msgid "Cook Time" @@ -1020,7 +1020,7 @@ msgstr "" #: includes/class.cooked-recipe-meta.php:400 #: includes/class.cooked-recipe-meta.php:969 -#: includes/class.cooked-settings.php:170 +#: includes/class.cooked-settings.php:174 #: includes/class.cooked-shortcodes.php:403 #: includes/class.cooked-shortcodes.php:629 #: includes/class.cooked-shortcodes.php:636 @@ -1160,7 +1160,7 @@ msgid "Available Variables" msgstr "" #: includes/class.cooked-recipe-meta.php:966 -#: includes/class.cooked-settings.php:163 +#: includes/class.cooked-settings.php:167 #: includes/class.cooked-shortcodes.php:398 #: includes/class.cooked-shortcodes.php:563 msgid "Author" @@ -1177,7 +1177,7 @@ msgid "Servings Switcher" msgstr "" #: includes/class.cooked-recipe-meta.php:972 -#: includes/class.cooked-settings.php:164 +#: includes/class.cooked-settings.php:168 #: includes/class.cooked-shortcodes.php:656 #: includes/class.cooked-shortcodes.php:659 #: includes/class.cooked-taxonomies.php:39 @@ -1435,12 +1435,12 @@ msgid "Browse" msgstr "" #: includes/class.cooked-recipes.php:975 -#: includes/class.cooked-settings.php:104 +#: includes/class.cooked-settings.php:108 msgid "No categories" msgstr "" #: includes/class.cooked-recipes.php:978 -#: includes/class.cooked-settings.php:151 +#: includes/class.cooked-settings.php:155 #: includes/class.cooked-taxonomies.php:38 #: includes/class.cooked-taxonomies.php:48 msgid "Categories" @@ -1480,309 +1480,309 @@ msgstr "" msgid "Cooked settings has been updated!" msgstr "" -#: includes/class.cooked-settings.php:103 +#: includes/class.cooked-settings.php:107 msgid "Choose a page..." msgstr "" -#: includes/class.cooked-settings.php:103 +#: includes/class.cooked-settings.php:107 msgid "No pages" msgstr "" -#: includes/class.cooked-settings.php:104 +#: includes/class.cooked-settings.php:108 msgid "No default" msgstr "" -#: includes/class.cooked-settings.php:124 +#: includes/class.cooked-settings.php:128 msgid "General" msgstr "" -#: includes/class.cooked-settings.php:128 +#: includes/class.cooked-settings.php:132 msgid "Browse/Search Recipes Page" msgstr "" #. translators: a description on how to add the [cooked-browse] shortcode to a page -#: includes/class.cooked-settings.php:130 +#: includes/class.cooked-settings.php:134 msgid "Create a page with the %s shortcode on it, then choose it from this dropdown." msgstr "" -#: includes/class.cooked-settings.php:136 +#: includes/class.cooked-settings.php:140 msgid "Recipes Per Page" msgstr "" #. translators: a description on how to choose the default number of recipes per page. -#: includes/class.cooked-settings.php:138 +#: includes/class.cooked-settings.php:142 msgid "Choose the default (set via the %s panel) or choose a different number here." msgstr "" #. translators: a description on how to choose the default number of recipes per page. -#: includes/class.cooked-settings.php:138 +#: includes/class.cooked-settings.php:142 msgid "Settings > Reading" msgstr "" -#: includes/class.cooked-settings.php:144 +#: includes/class.cooked-settings.php:148 msgid "Recipe Taxonomies" msgstr "" -#: includes/class.cooked-settings.php:145 +#: includes/class.cooked-settings.php:149 msgid "Choose which taxonomies you want to enable for your recipes." msgstr "" -#: includes/class.cooked-settings.php:156 +#: includes/class.cooked-settings.php:160 msgid "Global Recipe Toggles" msgstr "" -#: includes/class.cooked-settings.php:157 +#: includes/class.cooked-settings.php:161 msgid "You can quickly hide or show different recipe elements (site-wide) with these checkboxes." msgstr "" -#: includes/class.cooked-settings.php:176 +#: includes/class.cooked-settings.php:180 msgid "Carbs Format" msgstr "" -#: includes/class.cooked-settings.php:177 +#: includes/class.cooked-settings.php:181 msgid "You can display carbs as \"Total\" or \"Net\"." msgstr "" -#: includes/class.cooked-settings.php:183 +#: includes/class.cooked-settings.php:187 msgid "Total Carbs" msgstr "" -#: includes/class.cooked-settings.php:184 +#: includes/class.cooked-settings.php:188 msgid "Net Carbs" msgstr "" -#: includes/class.cooked-settings.php:189 +#: includes/class.cooked-settings.php:193 msgid "Author Name Format" msgstr "" -#: includes/class.cooked-settings.php:190 +#: includes/class.cooked-settings.php:194 msgid "You can show the full author's name or just a part of it." msgstr "" -#: includes/class.cooked-settings.php:196 +#: includes/class.cooked-settings.php:200 msgid "Full name" msgstr "" -#: includes/class.cooked-settings.php:197 +#: includes/class.cooked-settings.php:201 msgid "Full first name w/last name initial" msgstr "" -#: includes/class.cooked-settings.php:198 +#: includes/class.cooked-settings.php:202 msgid "First name initial w/full last name" msgstr "" -#: includes/class.cooked-settings.php:199 +#: includes/class.cooked-settings.php:203 msgid "First name only" msgstr "" -#: includes/class.cooked-settings.php:204 +#: includes/class.cooked-settings.php:208 msgid "Author Links" msgstr "" -#: includes/class.cooked-settings.php:205 +#: includes/class.cooked-settings.php:209 msgid "If you do not want the author names to link to the author recipe listings, you can disable them here." msgstr "" -#: includes/class.cooked-settings.php:212 +#: includes/class.cooked-settings.php:216 msgid "Disable Author Links" msgstr "" -#: includes/class.cooked-settings.php:217 +#: includes/class.cooked-settings.php:221 msgid "Default Category" msgstr "" #. translators: a description on how to set the default recipe category for the [cooked-browse] shortcode. -#: includes/class.cooked-settings.php:219 +#: includes/class.cooked-settings.php:223 msgid "Optionally set the default recipe category for your %s shortcode display." msgstr "" -#: includes/class.cooked-settings.php:225 +#: includes/class.cooked-settings.php:229 msgid "Default Sort Order" msgstr "" #. translators: a description on how to set the default sort order for the [cooked-browse] shortcode. -#: includes/class.cooked-settings.php:227 +#: includes/class.cooked-settings.php:231 msgid "Set the default sort order for your %s shortcode display." msgstr "" -#: includes/class.cooked-settings.php:233 +#: includes/class.cooked-settings.php:237 msgid "Newest First" msgstr "" -#: includes/class.cooked-settings.php:234 +#: includes/class.cooked-settings.php:238 msgid "Oldest First" msgstr "" -#: includes/class.cooked-settings.php:235 +#: includes/class.cooked-settings.php:239 msgid "Alphabetical" msgstr "" -#: includes/class.cooked-settings.php:236 +#: includes/class.cooked-settings.php:240 msgid "Alphabetical (reversed)" msgstr "" -#: includes/class.cooked-settings.php:241 +#: includes/class.cooked-settings.php:245 msgid "WP Editor Roles" msgstr "" -#: includes/class.cooked-settings.php:242 +#: includes/class.cooked-settings.php:246 msgid "Choose which user roles can use the WP Editor for the Excerpt, Directions & Notes fields." msgstr "" -#: includes/class.cooked-settings.php:248 +#: includes/class.cooked-settings.php:252 msgid "Advanced Settings" msgstr "" #. translators: an option to only show recipes with the [cooked-recipe] shortcode. -#: includes/class.cooked-settings.php:258 +#: includes/class.cooked-settings.php:262 msgid "Disable Public Recipes" msgstr "" #. translators: an option to only show recipes with the [cooked-recipe] shortcode. -#: includes/class.cooked-settings.php:258 +#: includes/class.cooked-settings.php:262 msgid "Only show recipes using the %s shortcode." msgstr "" #. translators: an option to disable "meta" tags. -#: includes/class.cooked-settings.php:260 +#: includes/class.cooked-settings.php:264 msgid "Disable %s Tags" msgstr "" #. translators: an option to disable "meta" tags. -#: includes/class.cooked-settings.php:260 +#: includes/class.cooked-settings.php:264 msgid "Prevents duplicates when tags already exist." msgstr "" -#: includes/class.cooked-settings.php:261 +#: includes/class.cooked-settings.php:265 msgid "Disable \"Servings Switcher\"" msgstr "" -#: includes/class.cooked-settings.php:261 +#: includes/class.cooked-settings.php:265 msgid "Removes the servings dropdown on recipes." msgstr "" -#: includes/class.cooked-settings.php:262 +#: includes/class.cooked-settings.php:266 msgid "Disable Recipe Schema Output" msgstr "" -#: includes/class.cooked-settings.php:262 +#: includes/class.cooked-settings.php:266 msgid "You should only do this if you're using something else to output schema information." msgstr "" -#: includes/class.cooked-settings.php:263 +#: includes/class.cooked-settings.php:267 msgid "Disable Recipe Archive Page" msgstr "" -#: includes/class.cooked-settings.php:263 +#: includes/class.cooked-settings.php:267 msgid "Prevents the recipe archive from being displayed." msgstr "" -#: includes/class.cooked-settings.php:270 +#: includes/class.cooked-settings.php:274 msgid "Design" msgstr "" -#: includes/class.cooked-settings.php:274 +#: includes/class.cooked-settings.php:278 msgid "Dark Mode" msgstr "" -#: includes/class.cooked-settings.php:275 +#: includes/class.cooked-settings.php:279 msgid "If your site has a dark background, you should enable \"Dark Mode\" so that Cooked can match this style." msgstr "" -#: includes/class.cooked-settings.php:281 +#: includes/class.cooked-settings.php:285 msgid "Enable \"Dark Mode\"" msgstr "" -#: includes/class.cooked-settings.php:286 +#: includes/class.cooked-settings.php:290 msgid "Author Images" msgstr "" -#: includes/class.cooked-settings.php:287 +#: includes/class.cooked-settings.php:291 msgid "If you do not want to display the author images (avatars), you can disable them here." msgstr "" -#: includes/class.cooked-settings.php:294 +#: includes/class.cooked-settings.php:298 msgid "Hide Author Images" msgstr "" -#: includes/class.cooked-settings.php:299 +#: includes/class.cooked-settings.php:303 msgid "Main Color" msgstr "" -#: includes/class.cooked-settings.php:300 +#: includes/class.cooked-settings.php:304 msgid "Used on buttons, cooking timer, etc." msgstr "" -#: includes/class.cooked-settings.php:306 +#: includes/class.cooked-settings.php:310 msgid "Main Color (on hover)" msgstr "" -#: includes/class.cooked-settings.php:307 +#: includes/class.cooked-settings.php:311 msgid "Used when hovering over buttons." msgstr "" -#: includes/class.cooked-settings.php:313 +#: includes/class.cooked-settings.php:317 msgid "First Responsive Breakpoint" msgstr "" -#: includes/class.cooked-settings.php:314 +#: includes/class.cooked-settings.php:318 msgid "Set the first responsive breakpoint. Best for large tablets." msgstr "" -#: includes/class.cooked-settings.php:320 +#: includes/class.cooked-settings.php:324 msgid "Second Responsive Breakpoint" msgstr "" -#: includes/class.cooked-settings.php:321 +#: includes/class.cooked-settings.php:325 msgid "Set the second responsive breakpoint. Best for small tablets." msgstr "" -#: includes/class.cooked-settings.php:327 +#: includes/class.cooked-settings.php:331 msgid "Third Responsive Breakpoint" msgstr "" -#: includes/class.cooked-settings.php:328 +#: includes/class.cooked-settings.php:332 msgid "Set the third responsive breakpoint. Best for phones and other small devices." msgstr "" -#: includes/class.cooked-settings.php:336 +#: includes/class.cooked-settings.php:340 msgid "Permalinks" msgstr "" -#: includes/class.cooked-settings.php:340 +#: includes/class.cooked-settings.php:344 msgid "Recipe Permalink" msgstr "" -#: includes/class.cooked-settings.php:343 +#: includes/class.cooked-settings.php:347 msgid "recipe-name" msgstr "" -#: includes/class.cooked-settings.php:347 +#: includes/class.cooked-settings.php:351 msgid "Recipe Author Permalink" msgstr "" -#: includes/class.cooked-settings.php:350 +#: includes/class.cooked-settings.php:354 msgid "author-name" msgstr "" -#: includes/class.cooked-settings.php:354 +#: includes/class.cooked-settings.php:358 msgid "Recipe Category Permalink" msgstr "" -#: includes/class.cooked-settings.php:357 +#: includes/class.cooked-settings.php:361 msgid "recipe-category-name" msgstr "" #. translators: posts_per_page default -#: includes/class.cooked-settings.php:368 +#: includes/class.cooked-settings.php:372 msgid "WordPress Default %s" msgstr "" -#: includes/class.cooked-settings.php:373 +#: includes/class.cooked-settings.php:377 msgid "Show All (no pagination)" msgstr "" -#: includes/class.cooked-settings.php:517 +#: includes/class.cooked-settings.php:521 msgid "Begin Migration" msgstr ""