PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.5
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.5
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Modules / CustomHeaderFooter / CustomHeaderFooterSettings.php

CustomHeaderFooterSettings.php in Adminify – White Label, Admin Menu Editor, Login Customizer 1.0.5, at Inc/Modules/CustomHeaderFooter/CustomHeaderFooterSettings.php

200 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Modules\CustomHeaderFooter;
4
5 use WPAdminify\Inc\Utils ;
6 // no direct access allowed
7 if ( !defined( 'ABSPATH' ) ) {
8 exit;
9 }
10 /**
11 * WPAdminify
12 * @package Module: Dashboard Widget
13 *
14 * @author Jewel Theme <support@jeweltheme.com>
15 */
16 class CustomHeaderFooterSettings extends CustomHeaderFooterModel
17 {
18 public function __construct()
19 {
20 // this should be first so the default values get stored
21 $this->custom_header_footer_settings();
22 parent::__construct( (array) get_site_option( $this->prefix ) );
23 }
24
25 public function get_defaults()
26 {
27 return [
28 'custom_scripts' => array(
29 'title' => '',
30 'display_on' => 'full_site',
31 'custom_posts' => '',
32 'custom_category' => '',
33 'custom_post_types' => '',
34 'custom_pages' => '',
35 'custom_tags' => '',
36 'location' => 'header',
37 'device_type' => 'all_devices',
38 'script_type' => 'css',
39 'custom_js' => '',
40 'custom_css' => '',
41 ),
42 ];
43 }
44
45 /**
46 * Settings Fields
47 *
48 * @return void
49 */
50 public function custom_header_footer_setting_fields( &$fields )
51 {
52 $fields[] = array(
53 'id' => 'title',
54 'type' => 'text',
55 'title' => __( 'Snippet Title', WP_ADMINIFY_TD ),
56 'default' => $this->get_default_field( 'custom_scripts' )['title'],
57 );
58 $fields[] = array(
59 'id' => 'display_on',
60 'type' => 'select',
61 'title' => __( 'Display on', WP_ADMINIFY_TD ),
62 'placeholder' => __( 'Select an option', WP_ADMINIFY_TD ),
63 'options' => array(
64 'full_site' => __( 'Full Site', WP_ADMINIFY_TD ),
65 'posts_pro' => __( 'Specific Posts (Pro)', WP_ADMINIFY_TD ),
66 'pages_pro' => __( 'Specific Page (Pro)', WP_ADMINIFY_TD ),
67 'categories_pro' => __( 'Specific Categories (Pro)', WP_ADMINIFY_TD ),
68 'custom_posts_pro' => __( 'Specific Post Types (Pro)', WP_ADMINIFY_TD ),
69 'tags_pro' => __( 'Specific Tags (Pro)', WP_ADMINIFY_TD ),
70 ),
71 'default' => $this->get_default_field( 'custom_scripts' )['display_on'],
72 );
73 $fields[] = array(
74 'id' => 'location',
75 'type' => 'button_set',
76 'title' => __( 'Location', WP_ADMINIFY_TD ),
77 'options' => array(
78 'header' => __( 'Header', WP_ADMINIFY_TD ),
79 'footer' => __( 'Footer', WP_ADMINIFY_TD ),
80 'content_before_pro' => __( 'Before Content (Pro)', WP_ADMINIFY_TD ),
81 'content_after_pro' => __( 'After Content (Pro)', WP_ADMINIFY_TD ),
82 ),
83 'default' => $this->get_default_field( 'custom_scripts' )['location'],
84 );
85 $fields[] = array(
86 'id' => 'device_type_notice',
87 'type' => 'notice',
88 'title' => __( 'Display Device', WP_ADMINIFY_TD ),
89 'style' => 'warning',
90 'content' => Utils::adminify_upgrade_pro(),
91 );
92 $fields[] = array(
93 'id' => 'script_type',
94 'type' => 'button_set',
95 'title' => __( 'Snippet Type', WP_ADMINIFY_TD ),
96 'options' => array(
97 'css' => 'CSS',
98 'js' => 'JS',
99 ),
100 'default' => $this->get_default_field( 'custom_scripts' )['script_type'],
101 );
102 $fields[] = array(
103 'id' => 'custom_js',
104 'type' => 'code_editor',
105 'title' => __( 'Custom JavaScript', WP_ADMINIFY_TD ),
106 'subtitle' => __( 'Add your Custom Script here', WP_ADMINIFY_TD ),
107 'settings' => array(
108 'theme' => 'dracula',
109 'mode' => 'javascript',
110 ),
111 'dependency' => array( 'script_type', '==', 'js' ),
112 'default' => $this->get_default_field( 'custom_scripts' )['custom_js'],
113 );
114 $fields[] = array(
115 'id' => 'custom_css',
116 'type' => 'code_editor',
117 'title' => __( 'Custom CSS', WP_ADMINIFY_TD ),
118 'subtitle' => __( 'Add your Custom CSS here', WP_ADMINIFY_TD ),
119 'settings' => array(
120 'theme' => 'mbo',
121 'mode' => 'css',
122 ),
123 'dependency' => array( 'script_type', '==', 'css' ),
124 'default' => $this->get_default_field( 'custom_scripts' )['custom_css'],
125 );
126 }
127
128 public function custom_header_footer_settings()
129 {
130 if ( !class_exists( 'ADMINIFY' ) ) {
131 return;
132 }
133 // WP Adminify Custom Header & Footer Options
134 \ADMINIFY::createOptions( $this->prefix, array(
135 'framework_title' => 'WP Adminify Custom CSS/JS <small>by WP Adminify</small>',
136 'framework_class' => 'adminify-custom-css-js',
137 'menu_title' => 'Custom CSS / JS',
138 'menu_slug' => 'adminify-custom-css-js',
139 'menu_type' => 'submenu',
140 'menu_capability' => 'manage_options',
141 'menu_icon' => '',
142 'menu_position' => 54,
143 'menu_hidden' => false,
144 'menu_parent' => 'wp-adminify-settings',
145 'footer_text' => ' ',
146 'footer_after' => ' ',
147 'footer_credit' => ' ',
148 'show_bar_menu' => false,
149 'show_sub_menu' => false,
150 'show_in_network' => false,
151 'show_in_customizer' => false,
152 'show_search' => false,
153 'show_reset_all' => false,
154 'show_reset_section' => false,
155 'show_footer' => true,
156 'show_all_options' => true,
157 'show_form_warning' => true,
158 'sticky_header' => false,
159 'save_defaults' => true,
160 'ajax_save' => true,
161 'admin_bar_menu_icon' => '',
162 'admin_bar_menu_priority' => 45,
163 'database' => 'network',
164 'transient_time' => 0,
165 'enqueue_webfont' => true,
166 'async_webfont' => false,
167 'output_css' => false,
168 'nav' => 'normal',
169 'theme' => 'dark',
170 'class' => 'wp-adminify-custom-css-js',
171 ) );
172 $fields = [];
173 $this->custom_header_footer_setting_fields( $fields );
174 // Custom CSS/JS Settings
175 \ADMINIFY::createSection( $this->prefix, array(
176 'title' => __( 'Others', WP_ADMINIFY_TD ),
177 'icon' => 'fas fa-bolt',
178 'fields' => [ [
179 'type' => 'subheading',
180 'content' => Utils::adminfiy_help_urls(
181 __( 'Header/Footer Snippets', WP_ADMINIFY_TD ),
182 'https://wpadminify.com/kb/how-to-add-custom-css-or-js-in-full-site-or-specific-page/',
183 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
184 'https://www.facebook.com/groups/jeweltheme',
185 'https://wpadminify.com/support/header-footer-scripts/'
186 ),
187 ], [
188 'id' => 'custom_scripts',
189 'type' => 'group',
190 'title' => '',
191 'accordion_title_prefix' => __( 'Snippet Name: ', WP_ADMINIFY_TD ),
192 'accordion_title_number' => true,
193 'accordion_title_auto' => true,
194 'button_title' => __( 'Add New Snippet', WP_ADMINIFY_TD ),
195 'fields' => $fields,
196 ] ],
197 ) );
198 }
199
200 }