| Server IP : 108.167.142.43 / Your IP : 216.73.216.223 Web Server : Apache System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64 User : delarice ( 2406) PHP Version : 8.3.36 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home2/delarice/public_html/wp-content/plugins/templately/modules/settings/ |
Upload File : |
<?php
namespace Templately\Modules\Settings;
use Templately\Utils\Base;
use Templately\Utils\Helper;
class Settings extends Base {
public function __construct() {
add_action('admin_menu', [$this, 'admin_menu']);
add_action('wp_head', [$this, 'add_custom_css']);
}
public function admin_menu() {
// No $position — see the note in Core/Admin.php::admin_menu(). The old
// '58.7' was a copied top-level slot, past the end of this submenu, so
// it always appended; below WP 6.0 it also warned on every admin load.
add_submenu_page( 'templately', 'Settings', 'Settings', 'delete_posts', 'templately_settings', [$this, 'display_settings'] );
}
public function display_settings() {
Helper::views( 'settings' );
}
public function add_custom_css() {
$custom_css = get_option('templately_custom_css');
if($custom_css){
// Strip tags before echoing INSIDE the <style> element: a stored value
// containing `</style><script>…` would otherwise break out of it.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the wrapper is a literal; the value is tag-stripped above.
echo "\n<style id='templately-custom-css'>\n" . wp_strip_all_tags( $custom_css ) . "\n</style>\n";
}
}
}