Fixes config rendering of nested config arrays
							parent
							
								
									8eed6afd46
								
							
						
					
					
						commit
						f796e100f8
					
				| 
						 | 
					@ -0,0 +1,23 @@
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// render config variables array
 | 
				
			||||||
 | 
					function renderConfig($config) {
 | 
				
			||||||
 | 
					    echo "\n\t\t\t\t\t<ul>";
 | 
				
			||||||
 | 
					    foreach ($config as $config_item => $config_value) {
 | 
				
			||||||
 | 
					        echo "\n\t\t\t\t\t\t<li>";
 | 
				
			||||||
 | 
					        echo htmlspecialchars($config_item) . ': ';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (is_array($config_value)) {
 | 
				
			||||||
 | 
					            // here we render recursively nested arrays
 | 
				
			||||||
 | 
					            renderConfig($config_value);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            // if it's not array, just display it
 | 
				
			||||||
 | 
					            echo htmlspecialchars($config_value ?? '');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        echo '</li>';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    echo "\n\t\t\t\t\t</ul>";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
| 
						 | 
					@ -2,10 +2,10 @@
 | 
				
			||||||
                <!-- widget "config" -->
 | 
					                <!-- widget "config" -->
 | 
				
			||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
                    <p>Jilo web configuration</p>
 | 
					                    <p>Jilo web configuration</p>
 | 
				
			||||||
                    <ul>
 | 
					<?php
 | 
				
			||||||
<?php foreach ($config as $config_item=>$config_value) { ?>
 | 
					include '../app/helpers/render.php';
 | 
				
			||||||
                        <li><?php echo htmlspecialchars($config_item) . ': ' . htmlspecialchars($config_value ?? ''); ?></li>
 | 
					renderConfig($config);
 | 
				
			||||||
<?php } ?>
 | 
					echo "\n";
 | 
				
			||||||
                    </ul>
 | 
					?>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <!-- /widget "config" -->
 | 
					                <!-- /widget "config" -->
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue