| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Admin\Options; | |
| 3 | +namespace WPAdminify\Inc\Admin\Options; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Utils; | |
| 6 | -use PXLBSAdminify\Inc\Admin\AdminSettingsModel; | |
| 5 | +use WPAdminify\Inc\Utils; | |
| 6 | +use WPAdminify\Inc\Admin\AdminSettingsModel; | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | if (!defined('ABSPATH')) { |
| 10 | 10 | die; |
| @@ -25,9 +25,12 @@ | ||
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | 27 | 'performance' => [ |
| 28 | 28 | 'performance_enable' => true, |
| 29 | - 'performance_data' => [] | |
| 29 | + 'performance_data' => [ | |
| 30 | + 'version_strings', | |
| 31 | + 'emoji', | |
| 32 | + ] | |
| 30 | 33 | ], |
| 31 | 34 | 'disable_embeds' => false, // Gutenberg |
| 32 | 35 | // Gutenberg |
| 33 | 36 | 'disable_gutenberg' => [ |
| @@ -38,9 +41,9 @@ | ||
| 38 | 41 | 'enabled' => false, |
| 39 | 42 | 'backend' => 'default', |
| 40 | 43 | 'backend_modify' => 60, |
| 41 | 44 | 'on_post_create' => 'default', |
| 42 | - 'on_post_create_modify' => 60, | |
| 45 | + 'on_post_create_modify' => 15, | |
| 43 | 46 | 'on_frontend' => 'default', |
| 44 | 47 | 'on_frontend_modify' => 60 |
| 45 | 48 | ], |
| 46 | 49 | 'adminify_assets' => [], |
| @@ -71,21 +74,21 @@ | ||
| 71 | 74 | [ |
| 72 | 75 | 'id' => 'disable_gutenberg_enable', |
| 73 | 76 | 'type' => 'switcher', |
| 74 | 77 | 'class' => 'adminify-pl-0 adminify-pt-0', |
| 75 | - 'title' => '', | |
| 78 | + 'title' => __('', 'adminify'), | |
| 76 | 79 | 'text_on' => __('Show', 'adminify'), |
| 77 | 80 | 'text_off' => __('Hide', 'adminify'), |
| 78 | 81 | 'text_width' => 80, |
| 79 | - // 'default' => $this->get_default_field('disable_gutenberg')['disable_gutenberg_enable'], | |
| 82 | + 'default' => $this->get_default_field('disable_gutenberg')['disable_gutenberg_enable'], | |
| 80 | 83 | ], |
| 81 | 84 | [ |
| 82 | 85 | 'id' => 'disable_for', |
| 83 | 86 | 'type' => 'checkbox', |
| 84 | - 'title' => '', | |
| 87 | + 'title' => __('', 'adminify'), | |
| 85 | 88 | 'class' => 'adminify-one-col', |
| 86 | 89 | 'options' => $disable_gutenberg_for, |
| 87 | - // 'default' => $this->get_default_field('disable_gutenberg')['disable_for'], | |
| 90 | + 'default' => $this->get_default_field('disable_gutenberg')['disable_for'], | |
| 88 | 91 | 'dependency' => ['disable_gutenberg_enable', '==', 'true', true], |
| 89 | 92 | ] |
| 90 | 93 | ]; |
| 91 | 94 | |
| @@ -105,9 +108,9 @@ | ||
| 105 | 108 | */ |
| 106 | 109 | public function performances(&$fields) |
| 107 | 110 | { |
| 108 | 111 | $performance_data = [ |
| 109 | - 'dashicons' => __('Remove Dashicons from front-end for Public Visitors', 'adminify'), | |
| 112 | + 'dashicons' => __('Remove Dashicons from front-end for Public Visitons', 'adminify'), | |
| 110 | 113 | 'version_strings' => __('Remove Versions from Styles/Scripts', 'adminify'), |
| 111 | 114 | 'gravatar_query_strings' => __('Remove Gravatar Query Strings', 'adminify'), |
| 112 | 115 | 'emoji' => __('Remove All Emoji styles and scripts from head section', 'adminify'), |
| 113 | 116 | 'jquery_migrate_front' => __('Remove front end jQuery Migrate script.', 'adminify'), |
| @@ -120,19 +123,21 @@ | ||
| 120 | 123 | [ |
| 121 | 124 | 'id' => 'performance_enable', |
| 122 | 125 | 'type' => 'switcher', |
| 123 | 126 | 'class' => 'adminify-pl-0 adminify-pt-0', |
| 124 | - 'title' => '', | |
| 127 | + 'title' => __('', 'adminify'), | |
| 125 | 128 | 'text_on' => __('Show', 'adminify'), |
| 126 | 129 | 'text_off' => __('Hide', 'adminify'), |
| 127 | - 'text_width' => 80 | |
| 130 | + 'text_width' => 80, | |
| 131 | + 'default' => $this->get_default_field('performance')['performance_enable'], | |
| 128 | 132 | ], |
| 129 | 133 | [ |
| 130 | 134 | 'id' => 'performance_data', |
| 131 | 135 | 'type' => 'checkbox', |
| 132 | - 'title' => '', | |
| 136 | + 'title' => __('', 'adminify'), | |
| 133 | 137 | 'class' => 'adminify-one-col', |
| 134 | 138 | 'options' => $performance_data, |
| 139 | + 'default' => $this->get_default_field('performance')['performance_data'], | |
| 135 | 140 | 'dependency' => ['performance_enable', '==', 'true', true], |
| 136 | 141 | ] |
| 137 | 142 | ]; |
| 138 | 143 | |
| @@ -158,25 +163,24 @@ | ||
| 158 | 163 | */ |
| 159 | 164 | public function disable_embeds(&$disable_embeds) |
| 160 | 165 | { |
| 161 | 166 | $disable_embeds[] = [ |
| 162 | - 'id' => 'performance_subheading', | |
| 167 | + 'id' => 'performance_subheading', | |
| 163 | 168 | 'type' => 'subheading', |
| 164 | - 'content' => Utils::help_urls( | |
| 165 | - '<span></span>', | |
| 166 | - 'https://wpadminify.com/docs/adminify/performance/disable-embeds', | |
| 167 | - 'https://www.youtube.com/watch?v=xALg4WWZ_bE', | |
| 169 | + 'content' => Utils::adminfiy_help_urls( | |
| 170 | + __('<span></span>', 'adminify'), | |
| 171 | + 'https://wpadminify.com/kb/performance/', | |
| 172 | + '', | |
| 168 | 173 | 'https://www.facebook.com/groups/jeweltheme', |
| 169 | - \PXLBSAdminify\Inc\Admin\AdminSettings::support_url() | |
| 174 | + 'https://wpadminify.com/support/' | |
| 170 | 175 | ), |
| 171 | - ]; | |
| 176 | + ]; | |
| 172 | 177 | |
| 173 | 178 | $disable_embeds[] = [ |
| 174 | 179 | 'id' => 'disable_embeds', |
| 175 | 180 | 'type' => 'switcher', |
| 176 | 181 | 'class' => 'adminify-pro-fieldset adminify-pro-notice', |
| 177 | - /* translators: %s: pro upgrade badge HTML */ | |
| 178 | - 'title' => sprintf(__('Disable Embeds %s', 'adminify'), Utils::upgrade_pro_badge()), | |
| 182 | + 'title' => sprintf(__('Disable Embeds %s', 'adminify'), Utils::adminify_upgrade_pro_badge()), | |
| 179 | 183 | 'subtitle' => __('Disable all Embeds from everywhere like - REST API, Head Tag, Tinymce Editor, Remote results etc.', 'adminify'), |
| 180 | 184 | 'text_on' => __('Yes', 'adminify'), |
| 181 | 185 | 'text_off' => __('No', 'adminify'), |
| 182 | 186 | 'text_width' => 80, |
| @@ -184,37 +188,13 @@ | ||
| 184 | 188 | ]; |
| 185 | 189 | } |
| 186 | 190 | |
| 187 | 191 | public function control_heartbit_api_settings(&$fields){ |
| 188 | - | |
| 189 | - /* | |
| 190 | - * heartbeat.js accepts 1-3600 seconds, but core draws the safe line at 120. | |
| 191 | - * Its own note on `minimalInterval` reads "setting it to longer than 120 | |
| 192 | - * seconds will limit or disable some of the functionality (like post locks)", | |
| 193 | - * and the Heartbeat API handbook describes the tick as running "every 15-120 | |
| 194 | - * seconds". Anything past that is offered but labelled, and withheld entirely | |
| 195 | - * on post screens - where the post lock and autosave live, and where core | |
| 196 | - * deliberately disables idle suspension to keep the lock alive | |
| 197 | - * (wp_heartbeat_set_suspension). | |
| 198 | - */ | |
| 199 | - $safe_intervals = array( | |
| 200 | - '15' => __('15 seconds', 'adminify'), | |
| 201 | - '30' => __('30 seconds', 'adminify'), | |
| 202 | - '60' => __('1 Minute', 'adminify'), | |
| 203 | - '120' => __('2 Minute', 'adminify'), | |
| 204 | - ); | |
| 205 | - | |
| 206 | - $interval_options = $safe_intervals + array( | |
| 207 | - '180' => __('3 Minute (not recommended)', 'adminify'), | |
| 208 | - '300' => __('5 Minute (not recommended)', 'adminify'), | |
| 209 | - '600' => __('10 Minute (not recommended)', 'adminify'), | |
| 210 | - ); | |
| 211 | - | |
| 212 | 192 | $fields[] = [ |
| 213 | 193 | 'id' => 'enabled', |
| 214 | 194 | 'type' => 'switcher', |
| 215 | 195 | 'class' => 'adminify-pt-0 adminify-pl-0', |
| 216 | - 'title' => '', | |
| 196 | + 'title' => __('', 'adminify'), | |
| 217 | 197 | 'text_on' => __('Show', 'adminify'), |
| 218 | 198 | 'text_off' => __('Hide', 'adminify'), |
| 219 | 199 | 'text_width' => 80, |
| 220 | 200 | 'default' => $this->get_default_field('heartbeat_api')['enabled'], |
| @@ -222,9 +202,9 @@ | ||
| 222 | 202 | $fields[] = [ |
| 223 | 203 | 'id' => 'backend', |
| 224 | 204 | 'type' => 'radio', |
| 225 | 205 | 'inline' => true, |
| 226 | - 'class' => Utils::upgrade_pro_notice_class(), | |
| 206 | + 'class' => Utils::upgrade_pro_class(), | |
| 227 | 207 | 'title' => __('WordPress Dashboard', 'adminify'), |
| 228 | 208 | 'subtitle' => __('Backend Post Types', 'adminify'), |
| 229 | 209 | 'options' => [ |
| 230 | 210 | 'default' => __('Default', 'adminify'), |
| @@ -237,10 +217,18 @@ | ||
| 237 | 217 | $fields[] = [ |
| 238 | 218 | 'id' => 'backend_modify', |
| 239 | 219 | 'type' => 'select', |
| 240 | 220 | 'title' => __('Set interval to once every', 'adminify'), |
| 241 | - 'subtitle' => __('Default: 1 Minute. Intervals over 2 minutes can delay post locks.', 'adminify'), | |
| 242 | - 'options' => $interval_options, | |
| 221 | + 'subtitle' => __('Default: 1 Minute', 'adminify'), | |
| 222 | + 'options' => array( | |
| 223 | + '15' => __('15 seconds', 'adminify'), | |
| 224 | + '30' => __('30 seconds', 'adminify'), | |
| 225 | + '60' => __('1 Minute', 'adminify'), | |
| 226 | + '120' => __('2 Minute', 'adminify'), | |
| 227 | + '180' => __('3 Minute', 'adminify'), | |
| 228 | + '300' => __('5 Minute', 'adminify'), | |
| 229 | + '600' => __('10 Minute', 'adminify'), | |
| 230 | + ), | |
| 243 | 231 | 'default' => $this->get_default_field('heartbeat_api')['backend_modify'], |
| 244 | 232 | 'dependency' => ['enabled|backend', '==|==', 'true|modify', 'true'], |
| 245 | 233 | ]; |
| 246 | 234 | |
| @@ -246,9 +234,9 @@ | ||
| 246 | 234 | |
| 247 | 235 | $fields[] = [ |
| 248 | 236 | 'id' => 'on_post_create', |
| 249 | 237 | 'type' => 'radio', |
| 250 | - 'class' => Utils::upgrade_pro_notice_class(), | |
| 238 | + 'class' => Utils::upgrade_pro_class(), | |
| 251 | 239 | 'inline' => true, |
| 252 | 240 | 'title' => __('Create Post Editor', 'adminify'), |
| 253 | 241 | 'subtitle' => __('On post creation and edit screens', 'adminify'), |
| 254 | 242 | 'options' => [ |
| @@ -263,10 +251,18 @@ | ||
| 263 | 251 | $fields[] = [ |
| 264 | 252 | 'id' => 'on_post_create_modify', |
| 265 | 253 | 'type' => 'select', |
| 266 | 254 | 'title' => __('Set interval to once every', 'adminify'), |
| 267 | - 'subtitle' => __('Default: 1 Minute. Capped at 2 minutes so post locks and autosave keep working.', 'adminify'), | |
| 268 | - 'options' => $safe_intervals, | |
| 255 | + 'subtitle' => __('Default: 15 seconds', 'adminify'), | |
| 256 | + 'options' => array( | |
| 257 | + '15' => __('15 seconds', 'adminify'), | |
| 258 | + '30' => __('30 seconds', 'adminify'), | |
| 259 | + '60' => __('1 Minute', 'adminify'), | |
| 260 | + '120' => __('2 Minute', 'adminify'), | |
| 261 | + '180' => __('3 Minute', 'adminify'), | |
| 262 | + '300' => __('5 Minute', 'adminify'), | |
| 263 | + '600' => __('10 Minute', 'adminify'), | |
| 264 | + ), | |
| 269 | 265 | 'default' => $this->get_default_field('heartbeat_api')['on_post_create_modify'], |
| 270 | 266 | 'dependency' => ['enabled|on_post_create', '==|==', 'true|modify', 'true'], |
| 271 | 267 | ]; |
| 272 | 268 | |
| @@ -272,9 +268,9 @@ | ||
| 272 | 268 | |
| 273 | 269 | $fields[] = [ |
| 274 | 270 | 'id' => 'on_frontend', |
| 275 | 271 | 'type' => 'radio', |
| 276 | - 'class' => Utils::upgrade_pro_notice_class(), | |
| 272 | + 'class' => Utils::upgrade_pro_class(), | |
| 277 | 273 | 'inline' => true, |
| 278 | 274 | 'title' => __('Frontend', 'adminify'), |
| 279 | 275 | 'subtitle' => __('Frontend Heartbits', 'adminify'), |
| 280 | 276 | 'options' => [ |
| @@ -289,10 +285,18 @@ | ||
| 289 | 285 | $fields[] = [ |
| 290 | 286 | 'id' => 'on_frontend_modify', |
| 291 | 287 | 'type' => 'select', |
| 292 | 288 | 'title' => __('Set interval to once every', 'adminify'), |
| 293 | - 'subtitle' => __('Default: 1 Minute. Intervals over 2 minutes can delay post locks.', 'adminify'), | |
| 294 | - 'options' => $interval_options, | |
| 289 | + 'subtitle' => __('Default: 1 Minute', 'adminify'), | |
| 290 | + 'options' => array( | |
| 291 | + '15' => __('15 seconds', 'adminify'), | |
| 292 | + '30' => __('30 seconds', 'adminify'), | |
| 293 | + '60' => __('1 Minute', 'adminify'), | |
| 294 | + '120' => __('2 Minute', 'adminify'), | |
| 295 | + '180' => __('3 Minute', 'adminify'), | |
| 296 | + '300' => __('5 Minute', 'adminify'), | |
| 297 | + '600' => __('10 Minute', 'adminify'), | |
| 298 | + ), | |
| 295 | 299 | 'default' => $this->get_default_field('heartbeat_api')['on_frontend_modify'], |
| 296 | 300 | 'dependency' => ['enabled|on_frontend', '==|==', 'true|modify', 'true'], |
| 297 | 301 | ]; |
| 298 | 302 | } |
| @@ -308,10 +312,9 @@ | ||
| 308 | 312 | $fields[] = array( |
| 309 | 313 | 'id' => 'heartbeat_api', |
| 310 | 314 | 'type' => 'fieldset', |
| 311 | 315 | 'class' => 'adminify-nopadding', |
| 312 | - /* translators: %s: pro upgrade badge HTML */ | |
| 313 | - 'title' => sprintf(__('Control Heartbeat API %s', 'adminify'), Utils::upgrade_pro_badge()), | |
| 316 | + 'title' => sprintf(__('Control Heartbeat API %s', 'adminify'), Utils::adminify_upgrade_pro_badge()), | |
| 314 | 317 | 'class' => 'adminify-pro-fieldset', |
| 315 | 318 | 'subtitle' => __('Modify the interval of the WordPress Heartbeat API or disable it on admin pages, post creation/edit screens, and the frontend to reduce CPU load on the server', 'adminify'), |
| 316 | 319 | 'fields' => $heartbeat_settings |
| 317 | 320 | ); |
| @@ -327,9 +330,9 @@ | ||
| 327 | 330 | $revisions_settings[] = [ |
| 328 | 331 | 'id' => 'revisions_enable', |
| 329 | 332 | 'type' => 'switcher', |
| 330 | 333 | 'class' => 'adminify-p-0 adminify-pro-feature', |
| 331 | - 'title' => '', | |
| 334 | + 'title' => __('', 'adminify'), | |
| 332 | 335 | 'text_on' => __('Show', 'adminify'), |
| 333 | 336 | 'text_off' => __('Hide', 'adminify'), |
| 334 | 337 | 'text_width' => 80, |
| 335 | 338 | |
| @@ -350,9 +353,9 @@ | ||
| 350 | 353 | 'type' => 'checkbox', |
| 351 | 354 | 'title' => __('Apply for Post Types', 'adminify'), |
| 352 | 355 | 'class' => 'adminify-pro-feature adminify-pro-notice', |
| 353 | 356 | 'subtitle' => __('Disable all Embeds from everywhere like - REST API, Head Tag, Tinymce Editor, Remote results etc.', 'adminify'), |
| 354 | - 'options' => 'PXLBSAdminify\Inc\Admin\Options\Productivity::get_all_post_types', | |
| 357 | + 'options' => 'WPAdminify\Inc\Admin\Options\Productivity::get_all_post_types', | |
| 355 | 358 | 'default' => $this->get_default_field('revisions')['post_types'], |
| 356 | 359 | 'dependency' => ['revisions_enable', '==', 'true', 'true'], |
| 357 | 360 | ]; |
| 358 | 361 | |
| @@ -367,10 +370,9 @@ | ||
| 367 | 370 | |
| 368 | 371 | $fields[] = array( |
| 369 | 372 | 'id' => 'revisions', |
| 370 | 373 | 'type' => 'fieldset', |
| 371 | - /* translators: %s: pro upgrade badge HTML */ | |
| 372 | - 'title' => sprintf(__('Control Revisions %s', 'adminify'), Utils::upgrade_pro_badge()), | |
| 374 | + 'title' => sprintf(__('Control Revisions %s', 'adminify'), Utils::adminify_upgrade_pro_badge()), | |
| 373 | 375 | 'subtitle' => __('Limit the number of revisions kept for post types supporting revisions to prevent database bloat.', 'adminify'), |
| 374 | 376 | 'fields' => $revisions_settings, |
| 375 | 377 | 'default' => $this->get_default_field('revisions'), |
| 376 | 378 | ); |
| @@ -385,15 +387,15 @@ | ||
| 385 | 387 | |
| 386 | 388 | $fields = []; |
| 387 | 389 | |
| 388 | 390 | $this->disable_embeds( $fields ); |
| 389 | - $this->control_heartbit_api( $fields ); | |
| 391 | + // $this->control_heartbit_api( $fields ); | |
| 390 | 392 | // $this->control_revisions( $fields ); |
| 391 | 393 | $this->performances( $fields ); |
| 392 | 394 | $this->gutenberg_settings($fields); |
| 393 | 395 | |
| 394 | 396 | |
| 395 | - $fields = apply_filters('pxlbsadminify_settings/performance', $fields, $this); | |
| 397 | + $fields = apply_filters('adminify_settings/performance', $fields, $this); | |
| 396 | 398 | |
| 397 | 399 | // Optimization Section |
| 398 | 400 | \ADMINIFY::createSection( |
| 399 | 401 | $this->prefix, |