PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / trunk
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! vtrunk
3.8.0 3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 All 112 releases
templately / modules / settings / Settings.php

Settings.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! trunk, at modules/settings/Settings.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Templately\Modules\Settings;
4
5 use Templately\Utils\Base;
6 use Templately\Utils\Helper;
7
8 class Settings extends Base {
9
10 public function __construct() {
11 add_action('admin_menu', [$this, 'admin_menu']);
12 add_action('wp_head', [$this, 'add_custom_css']);
13 }
14
15 public function admin_menu() {
16 // No $position — see the note in Core/Admin.php::admin_menu(). The old
17 // '58.7' was a copied top-level slot, past the end of this submenu, so
18 // it always appended; below WP 6.0 it also warned on every admin load.
19 add_submenu_page( 'templately', 'Settings', 'Settings', 'delete_posts', 'templately_settings', [$this, 'display_settings'] );
20 }
21
22
23 public function display_settings() {
24 Helper::views( 'settings' );
25 }
26
27 public function add_custom_css() {
28 $custom_css = get_option('templately_custom_css');
29 if($custom_css){
30 // Strip tags before echoing INSIDE the <style> element: a stored value
31 // containing `</style><script>…` would otherwise break out of it.
32 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- the wrapper is a literal; the value is tag-stripped above.
33 echo "\n<style id='templately-custom-css'>\n" . wp_strip_all_tags( $custom_css ) . "\n</style>\n";
34 }
35 }
36 }
37