@@ -224,17 +224,18 @@ public static function available_modes($mode = null)
224224 * Retrieve plugin modes with descriptions.
225225 * Modes include predefined options with support for WooCommerce and developer-specific settings.
226226 *
227- * @param string|null $mode Optional specific mode key to retrieve.
227+ * @param string|null $mode Optional specific mode key to retrieve.
228+ * @param mixed $default Optional default mode.
228229 * @return array|string Modes array with labels or specific mode description.
229230 */
230- public static function plugin_mode ($ mode = null )
231+ public static function plugin_mode ($ mode = null , $ default =[] )
231232 {
232233 // Get available modes
233234 $ available_modes = self ::available_modes ();
234235
235236 // Map available modes to their descriptions
236237 $ modes = [
237- 'phantom ' => __ ('Phantom Mode (ultra fast DOM-based transliteration, experimental ) ' , 'serbian-transliteration ' ),
238+ 'phantom ' => __ ('Phantom Mode (ultra fast DOM-based transliteration) ' , 'serbian-transliteration ' ),
238239 'light ' => __ ('Light mode (basic parts of the site) ' , 'serbian-transliteration ' ),
239240 'standard ' => __ ('Standard mode (content, themes, plugins, translations, menu) ' , 'serbian-transliteration ' ),
240241 'advanced ' => __ ('Advanced mode (content, widgets, themes, plugins, translations, menu, permalinks, media) ' , 'serbian-transliteration ' ),
@@ -251,10 +252,14 @@ public static function plugin_mode($mode = null)
251252
252253 // Return specific mode description if $mode is provided
253254 if ($ mode ) {
254- return $ filtered_modes [$ mode ] ?? [] ;
255+ return $ filtered_modes [$ mode ] ?? $ default ;
255256 }
256257
257- return $ filtered_modes ;
258+ if ($ mode === null ) {
259+ return $ filtered_modes ;
260+ }
261+
262+ return $ default ;
258263 }
259264
260265 /*
@@ -1621,12 +1626,12 @@ public static function debug_render_all_settings_fields($format = 'html')
16211626 foreach ($ val as $ i => $ prop ) {
16221627 echo '<tr> ' ;
16231628 echo '<td style="border:1px solid #efefef;padding:8px;"> ' . esc_html ($ i ) . '</td> ' ;
1624- echo '<td style="border:1px solid #efefef;padding:8px;"> ' . esc_html ($ prop ) . '</td> ' ;
1629+ echo '<td style="border:1px solid #efefef;padding:8px;"> ' . esc_html ( self :: __debug_translate_values ( $ prop) ) . '</td> ' ;
16251630 echo '</tr> ' ;
16261631 }
16271632 echo '</table> ' ;
1628- } else {
1629- echo esc_html ($ val );
1633+ } else {
1634+ echo esc_html ( self :: __debug_translate_values ( $ val) );
16301635 }
16311636
16321637 echo '</td> ' ;
@@ -1636,6 +1641,44 @@ public static function debug_render_all_settings_fields($format = 'html')
16361641 echo '</table> ' ;
16371642 }
16381643
1644+ private static function __debug_translate_values ($ val = '' ) {
1645+ switch ($ val ) {
1646+ case 'yes ' :
1647+ return __ ('Yes ' );
1648+ break ;
1649+
1650+ case 'no ' :
1651+ return __ ('No ' );
1652+ break ;
1653+
1654+ case 'auto ' :
1655+ return __ ('Automatic ' , 'serbian-transliteration ' );
1656+ break ;
1657+
1658+ case 'cyr_to_lat ' :
1659+ return __ ('Cyrillic to Latin ' , 'serbian-transliteration ' );
1660+ break ;
1661+
1662+ case 'lat_to_cyr ' :
1663+ return __ ('Latin to Cyrillic ' , 'serbian-transliteration ' );
1664+ break ;
1665+
1666+ case 'lat ' :
1667+ return __ ('Latin ' , 'serbian-transliteration ' );
1668+ break ;
1669+
1670+ case 'cyr ' :
1671+ return __ ('Cyrillic ' , 'serbian-transliteration ' );
1672+ break ;
1673+
1674+ case 'none ' :
1675+ return __ ('Disabled ' , 'serbian-transliteration ' );
1676+ break ;
1677+ }
1678+
1679+ return self ::plugin_mode ((string ) $ val , $ val );
1680+ }
1681+
16391682 /**
16401683 * Hook to capture language when Polylang announces it. Runs very early.
16411684 * @param string $slug
0 commit comments