Version Description
- Initial release
Download this release
Release Info
Developer | artbees |
Plugin | ![]() |
Version | 1.7.0 |
Comparing to | |
See all releases |
Version 1.7.0
- assets/images/warning-badge.svg +1 -0
- includes/compiler/class-compiler.php +1019 -0
- includes/compiler/functions.php +411 -0
- includes/compiler/preprocess-aliases.ini +277 -0
- includes/compiler/vendors/js-minifier.php +396 -0
- includes/compiler/vendors/lessc.php +3694 -0
- includes/control-panel/class-image-sizes.php +95 -0
- includes/control-panel/class-settings.php +120 -0
- includes/control-panel/functions.php +112 -0
- includes/control-panel/includes/class-filesystem.php +613 -0
- includes/control-panel/includes/class-helpers.php +492 -0
- includes/control-panel/install-template.php +1852 -0
- includes/control-panel/views/image-sizes.php +64 -0
- includes/control-panel/views/install-templates.php +73 -0
- includes/control-panel/views/settings.php +83 -0
- includes/customizer/functions.php +15 -0
- includes/customizer/vendors/kirki/LICENSE +21 -0
- includes/customizer/vendors/kirki/assets/css/kirki-styles.css +0 -0
- includes/customizer/vendors/kirki/assets/images/1c.png +0 -0
- includes/customizer/vendors/kirki/assets/images/2cl.png +0 -0
- includes/customizer/vendors/kirki/assets/images/2cr.png +0 -0
- includes/customizer/vendors/kirki/assets/images/3cl.png +0 -0
- includes/customizer/vendors/kirki/assets/images/3cm.png +0 -0
- includes/customizer/vendors/kirki/assets/images/3cr.png +0 -0
- includes/customizer/vendors/kirki/assets/images/jquery.fs.stepper-arrows.png +0 -0
- includes/customizer/vendors/kirki/assets/images/kirki-bottom.png +0 -0
- includes/customizer/vendors/kirki/assets/images/kirki-bottom.svg +91 -0
- includes/customizer/vendors/kirki/assets/images/kirki-logo.svg +48 -0
- includes/customizer/vendors/kirki/assets/vendor/fontawesome/fontawesome.json +8315 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/css/select2.css +484 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/css/select2.min.css +1 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/css/selectWoo.css +484 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/css/selectWoo.min.css +1 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ar.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/az.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/bg.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ca.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/cs.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/da.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/de.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/el.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/en.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/es.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/et.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/eu.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/fa.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/fi.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/fr.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/gl.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/he.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/hi.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/hr.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/hu.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/hy.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/id.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/is.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/it.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ja.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/km.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ko.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/lt.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/lv.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/mk.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ms.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/nb.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/nl.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/pl.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/pt-BR.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/pt.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ro.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/ru.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/sk.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/sl.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/sr-Cyrl.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/sr.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/sv.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/th.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/tr.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/uk.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/vi.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/zh-CN.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/i18n/zh-TW.js +3 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/select2.full.js +6553 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/select2.full.min.js +1 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/select2.js +5842 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/select2.min.js +1 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/selectWoo.full.js +6553 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/selectWoo.full.min.js +1 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/selectWoo.js +5842 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/js/selectWoo.min.js +1 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/kirki.css +28 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/kirki.css.map +7 -0
- includes/customizer/vendors/kirki/assets/vendor/selectWoo/kirki.scss +53 -0
- includes/customizer/vendors/kirki/assets/vendor/wp-color-picker-alpha/wp-color-picker-alpha.js +477 -0
- includes/customizer/vendors/kirki/class-kirki-autoload.php +201 -0
- includes/customizer/vendors/kirki/controls/class-kirki-controls.php +72 -0
- includes/customizer/vendors/kirki/controls/css/styles.css +658 -0
- includes/customizer/vendors/kirki/controls/js/script.js +3662 -0
- includes/customizer/vendors/kirki/controls/js/script.min.js +1 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-background.php +126 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-base.php +234 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-checkbox.php +56 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-code.php +48 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-color-palette.php +79 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-color.php +60 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-cropped-image.php +37 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-custom.php +62 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-dashicons.php +157 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-date.php +51 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-dimension.php +65 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-dimensions.php +143 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-editor.php +55 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-generic.php +30 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-image.php +84 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-multicheck.php +57 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-multicolor.php +79 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-number.php +29 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-palette.php +62 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-radio-buttonset.php +53 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-radio-image.php +82 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-radio.php +29 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-repeater.php +482 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-select.php +59 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-slider.php +74 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-sortable.php +72 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-switch.php +63 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-toggle.php +54 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-typography.php +259 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-control-upload.php +37 -0
- includes/customizer/vendors/kirki/controls/php/class-kirki-settings-repeater-setting.php +84 -0
- includes/customizer/vendors/kirki/controls/views/code.php +36 -0
- includes/customizer/vendors/kirki/controls/views/color.php +47 -0
- includes/customizer/vendors/kirki/controls/views/generic.php +43 -0
- includes/customizer/vendors/kirki/controls/views/number.php +37 -0
- includes/customizer/vendors/kirki/controls/views/radio.php +48 -0
- includes/customizer/vendors/kirki/controls/views/select.php +72 -0
- includes/customizer/vendors/kirki/controls/views/textarea.php +41 -0
- includes/customizer/vendors/kirki/core/class-kirki-config.php +179 -0
- includes/customizer/vendors/kirki/core/class-kirki-control.php +116 -0
- includes/customizer/vendors/kirki/core/class-kirki-field.php +720 -0
- includes/customizer/vendors/kirki/core/class-kirki-helper.php +462 -0
- includes/customizer/vendors/kirki/core/class-kirki-init.php +324 -0
- includes/customizer/vendors/kirki/core/class-kirki-l10n.php +156 -0
- includes/customizer/vendors/kirki/core/class-kirki-modules.php +156 -0
- includes/customizer/vendors/kirki/core/class-kirki-panel.php +57 -0
- includes/customizer/vendors/kirki/core/class-kirki-sanitize-values.php +198 -0
- includes/customizer/vendors/kirki/core/class-kirki-section.php +64 -0
- includes/customizer/vendors/kirki/core/class-kirki-sections.php +48 -0
- includes/customizer/vendors/kirki/core/class-kirki-setting-site-option.php +73 -0
- includes/customizer/vendors/kirki/core/class-kirki-setting-user-meta.php +97 -0
- includes/customizer/vendors/kirki/core/class-kirki-settings.php +148 -0
- includes/customizer/vendors/kirki/core/class-kirki-toolkit.php +45 -0
- includes/customizer/vendors/kirki/core/class-kirki-util.php +192 -0
- includes/customizer/vendors/kirki/core/class-kirki-values.php +158 -0
- includes/customizer/vendors/kirki/core/class-kirki.php +290 -0
- includes/customizer/vendors/kirki/core/dynamic-css.php +41 -0
- includes/customizer/vendors/kirki/deprecated/classes.php +20 -0
- includes/customizer/vendors/kirki/deprecated/deprecated.php +19 -0
- includes/customizer/vendors/kirki/deprecated/filters.php +116 -0
- includes/customizer/vendors/kirki/deprecated/functions.php +56 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-background.php +122 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-checkbox.php +68 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-code.php +119 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-color-alpha.php +30 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-color-palette.php +27 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-color.php +89 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-custom.php +45 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-dashicons.php +42 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-date.php +43 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-dimension.php +38 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-dimensions.php +76 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-editor.php +54 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-fontawesome.php +43 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-generic.php +15 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-group-title.php +16 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-image.php +112 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-kirki-generic.php +60 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-link.php +15 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-multicheck.php +55 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-multicolor.php +69 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-number.php +85 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-palette.php +27 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-preset.php +44 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-radio-buttonset.php +27 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-radio-image.php +27 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-radio.php +58 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-repeater.php +175 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-select.php +118 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-select2-multiple.php +29 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-select2.php +17 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-slider.php +27 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-sortable.php +62 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-spacing.php +43 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-switch.php +48 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-text.php +47 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-textarea.php +29 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-toggle.php +27 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-typography.php +222 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-upload.php +43 -0
- includes/customizer/vendors/kirki/field/class-kirki-field-url.php +47 -0
- includes/customizer/vendors/kirki/kirki.php +106 -0
- includes/customizer/vendors/kirki/lib/class-aricolor.php +982 -0
- includes/customizer/vendors/kirki/lib/class-kirki-color.php +342 -0
- includes/customizer/vendors/kirki/modules/css-vars/class-kirki-modules-css-vars.php +114 -0
- includes/customizer/vendors/kirki/modules/css-vars/script.js +59 -0
- includes/customizer/vendors/kirki/modules/css/class-kirki-css-to-file.php +162 -0
- includes/customizer/vendors/kirki/modules/css/class-kirki-modules-css-generator.php +276 -0
- includes/customizer/vendors/kirki/modules/css/class-kirki-modules-css.php +315 -0
- includes/customizer/vendors/kirki/modules/css/class-kirki-output.php +340 -0
- includes/customizer/vendors/kirki/modules/css/field/class-kirki-output-field-background.php +48 -0
- includes/customizer/vendors/kirki/modules/css/field/class-kirki-output-field-dimensions.php +56 -0
- includes/customizer/vendors/kirki/modules/css/field/class-kirki-output-field-image.php +48 -0
- includes/customizer/vendors/kirki/modules/css/field/class-kirki-output-field-multicolor.php +54 -0
- includes/customizer/vendors/kirki/modules/css/field/class-kirki-output-field-typography.php +94 -0
- includes/customizer/vendors/kirki/modules/css/property/class-kirki-output-property-background-image.php +40 -0
- includes/customizer/vendors/kirki/modules/css/property/class-kirki-output-property-background-position.php +72 -0
- includes/customizer/vendors/kirki/modules/css/property/class-kirki-output-property-font-family.php +65 -0
- includes/customizer/vendors/kirki/modules/css/property/class-kirki-output-property.php +64 -0
- includes/customizer/vendors/kirki/modules/custom-sections/class-kirki-modules-custom-sections.php +162 -0
- includes/customizer/vendors/kirki/modules/custom-sections/panels/class-kirki-panels-nested-panel.php +59 -0
- includes/customizer/vendors/kirki/modules/custom-sections/sections.css +20 -0
- includes/customizer/vendors/kirki/modules/custom-sections/sections.js +256 -0
- includes/customizer/vendors/kirki/modules/custom-sections/sections/class-kirki-sections-default-section.php +25 -0
- includes/customizer/vendors/kirki/modules/custom-sections/sections/class-kirki-sections-expanded-section.php +25 -0
- includes/customizer/vendors/kirki/modules/custom-sections/sections/class-kirki-sections-nested-section.php +66 -0
- includes/customizer/vendors/kirki/modules/customizer-branding/branding.js +14 -0
- includes/customizer/vendors/kirki/modules/customizer-branding/class-kirki-modules-customizer-branding.php +89 -0
- includes/customizer/vendors/kirki/modules/customizer-styling/class-kirki-modules-customizer-styling.php +425 -0
- includes/customizer/vendors/kirki/modules/field-dependencies/class-kirki-modules-field-dependencies.php +71 -0
- includes/customizer/vendors/kirki/modules/field-dependencies/field-dependencies.js +241 -0
- includes/customizer/vendors/kirki/modules/icons/class-kirki-modules-icons.php +108 -0
- includes/customizer/vendors/kirki/modules/icons/icons.js +30 -0
- includes/customizer/vendors/kirki/modules/loading/class-kirki-modules-loading.php +169 -0
- includes/customizer/vendors/kirki/modules/post-meta/class-kirki-modules-post-meta.php +91 -0
- includes/customizer/vendors/kirki/modules/post-meta/customize-controls.js +23 -0
- includes/customizer/vendors/kirki/modules/post-meta/customize-preview.js +14 -0
- includes/customizer/vendors/kirki/modules/postmessage/class-kirki-modules-postmessage.php +75 -0
- includes/customizer/vendors/kirki/modules/postmessage/postmessage.js +308 -0
- includes/customizer/vendors/kirki/modules/preset/class-kirki-modules-preset.php +68 -0
- includes/customizer/vendors/kirki/modules/preset/preset.js +32 -0
- includes/customizer/vendors/kirki/modules/selective-refresh/class-kirki-modules-selective-refresh.php +86 -0
- includes/customizer/vendors/kirki/modules/tooltips/class-kirki-modules-tooltips.php +123 -0
- includes/customizer/vendors/kirki/modules/tooltips/tooltip.css +30 -0
- includes/customizer/vendors/kirki/modules/tooltips/tooltip.js +55 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/class-kirki-modules-webfont-loader.php +83 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/closure.js +2 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/cssclassname.js +46 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/domhelper.js +405 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/eventdispatcher.js +195 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/font.js +140 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/fontmodule.js +16 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/fontmoduleloader.js +47 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/fontruler.js +60 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/fontwatcher.js +171 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/fontwatchrunner.js +249 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/initialize.js +97 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/nativefontwatchrunner.js +69 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/stylesheetwaiter.js +48 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/core/webfont.js +97 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules.yml +34 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/custom.js +63 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/fontdeck.js +66 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/google/fontapiparser.js +181 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/google/fontapiurlbuilder.js +77 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/google/googlefontapi.js +54 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/monotype.js +110 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/src/modules/typekit.js +73 -0
- includes/customizer/vendors/kirki/modules/webfont-loader/vendor-typekit/webfontloader.js +17 -0
- includes/customizer/vendors/kirki/modules/webfonts/class-kirki-fonts-google-local.php +482 -0
- includes/customizer/vendors/kirki/modules/webfonts/class-kirki-fonts-google.php +263 -0
- includes/customizer/vendors/kirki/modules/webfonts/class-kirki-fonts.php +263 -0
- includes/customizer/vendors/kirki/modules/webfonts/class-kirki-modules-webfonts-async.php +146 -0
- includes/customizer/vendors/kirki/modules/webfonts/class-kirki-modules-webfonts-local.php +105 -0
- includes/customizer/vendors/kirki/modules/webfonts/class-kirki-modules-webfonts.php +163 -0
- includes/customizer/vendors/kirki/modules/webfonts/webfont-files.json +1 -0
- includes/customizer/vendors/kirki/modules/webfonts/webfont-names.json +1 -0
- includes/customizer/vendors/kirki/modules/webfonts/webfonts.json +1 -0
- includes/customizer/vendors/kirki/readme.txt +1178 -0
- includes/customizer/vendors/kirki/upgrade-notifications.php +38 -0
- includes/dashboard/class.php +116 -0
- includes/dashboard/widgets/class-overview.php +314 -0
- includes/google-tag/functions.php +63 -0
- includes/parse-css/class.php +206 -0
- includes/parse-css/functions.php +28 -0
- includes/parse-css/vendors/autoload.php +7 -0
- includes/parse-css/vendors/composer/ClassLoader.php +445 -0
- includes/parse-css/vendors/composer/LICENSE +21 -0
- includes/parse-css/vendors/composer/autoload_classmap.php +9 -0
- includes/parse-css/vendors/composer/autoload_namespaces.php +10 -0
- includes/parse-css/vendors/composer/autoload_psr4.php +10 -0
- includes/parse-css/vendors/composer/autoload_real.php +52 -0
- includes/parse-css/vendors/composer/autoload_static.php +42 -0
- includes/parse-css/vendors/composer/installed.json +99 -0
- includes/parse-css/vendors/prestashop/php-css-parser/CHANGELOG.md +214 -0
- includes/parse-css/vendors/prestashop/php-css-parser/Doxyfile +2310 -0
- includes/parse-css/vendors/prestashop/php-css-parser/README.md +641 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php +48 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSBlockList.php +82 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php +157 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/CSSList/Document.php +105 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/CSSList/KeyFrame.php +56 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Comment/Comment.php +51 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Comment/Commentable.php +23 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/OutputFormat.php +289 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Parser.php +798 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Parsing/OutputException.php +12 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Parsing/SourceException.php +18 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php +31 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Property/AtRule.php +15 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Property/CSSNamespace.php +75 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Property/Charset.php +66 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Property/Import.php +69 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Property/Selector.php +74 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Renderable.php +9 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Rule/Rule.php +197 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php +44 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php +608 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/RuleSet/RuleSet.php +178 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Settings.php +54 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/CSSFunction.php +40 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/CSSString.php +32 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/CalcFunction.php +8 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/CalcRuleValueList.php +14 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/Color.php +41 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/LineName.php +18 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/PrimitiveValue.php +10 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/RuleValueList.php +9 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/Size.php +73 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/URL.php +31 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/Value.php +24 -0
- includes/parse-css/vendors/prestashop/php-css-parser/lib/Sabberworm/CSS/Value/ValueList.php +47 -0
- includes/parse-css/vendors/prestashop/php-css-parser/phpunit.xml +10 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/Sabberworm/CSS/CSSList/AtRuleBlockListTest.php +27 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/Sabberworm/CSS/CSSList/DocumentTest.php +26 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php +170 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/Sabberworm/CSS/ParserTest.php +644 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php +267 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php +76 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/bootstrap.php +10 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-calc-no-space-around-minus.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-charset-after-rule.css +5 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-charset-in-block.css +3 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-empty-grid-linename.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-empty.css +0 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-end-token-2.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-end-token.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-fault-tolerance.css +15 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/-tobedone.css +9 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/1readme.css +10 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/2readme.css +5 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/atrules.css +57 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/calc.css +5 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/case-insensitivity.css +15 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/colortest.css +12 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/comments.css +17 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/create-shorthands.css +6 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/docuwiki.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/empty-grid-linename.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/expand-shorthands.css +7 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/functions.css +21 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/grid-linename.css +2 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/ie-hacks.css +9 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/ie.css +6 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/important.css +8 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/inner-color.css +3 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/line-numbers.css +32 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/ms-filter.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/namespaces.css +18 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/nested.css +17 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/slashed.css +4 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/specificity.css +7 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/trailing-whitespace.css +2 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/unicode.css +12 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/unopened-close-brackets.css +3 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/url.css +4 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/values.css +14 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/webkit.css +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/files/whitespace.css +3 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/phpunit.xml +1 -0
- includes/parse-css/vendors/prestashop/php-css-parser/tests/quickdump.php +20 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/CHANGELOG.md +6 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/LICENSE +7 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/README.md +184 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/phpunit.xml +17 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/FlipOptions.php +68 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/RtlCss.php +255 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/AbstractFlipLeftRight.php +25 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipBackground.php +386 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipBorderRadius.php +52 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipCursor.php +67 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipDirection.php +33 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipLeftProperty.php +30 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipLeftValue.php +16 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipMarginPaddingBorder.php +40 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipRightProperty.php +30 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipShadow.php +75 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipTransform.php +123 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipTransformOrigin.php +94 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/FlipTransition.php +16 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/Operation/SizeFlipper.php +27 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/TransformationException.php +7 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/TransformationInterface.php +28 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/src/Transformation/Value/TransformableStringValue.php +140 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/tests/CSSJanus/CSSJanusTest.php +90 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/tests/CSSJanus/cssjanus-1.2.1-adapted.json +927 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/tests/CSSJanus/cssjanus-1.2.1.json +862 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/tests/PrestaShop/RtlCss/RtlCssTest.php +1209 -0
- includes/parse-css/vendors/prestashop/rtlcss-php/tests/bootstrap.php +2 -0
- includes/post-type/class.php +173 -0
- includes/updater/functions.php +121 -0
- includes/updater/views/html-notice-update-extensions-themes-inline.php +51 -0
- includes/widget-area/functions.php +86 -0
- includes/widgets/class.php +587 -0
- includes/widgets/functions.php +40 -0
- includes/widgets/widget-nav-menu.php +187 -0
- includes/widgets/widget-posts.php +491 -0
- includes/widgets/widget-social.php +317 -0
- jupiterx-core.php +475 -0
- languages/jupiterx-core.pot +814 -0
- readme.txt +25 -0
assets/images/warning-badge.svg
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="16" fill="#da3749"/><path d="M17.5 8h-3v10h3V8zM16 20c-1.1 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This class compiles and minifies CSS, LESS and JS.
|
4 |
+
*
|
5 |
+
* @package JupiterX\Framework\API\Compiler
|
6 |
+
*
|
7 |
+
* @since 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Compiles and minifies CSS, LESS and JS.
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
* @ignore
|
15 |
+
* @access private
|
16 |
+
*
|
17 |
+
* @package JupiterX\Framework\API\Compiler
|
18 |
+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
19 |
+
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
|
20 |
+
*/
|
21 |
+
final class _JupiterX_Compiler {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Compiler's runtime configuration parameters.
|
25 |
+
*
|
26 |
+
* @var array
|
27 |
+
*/
|
28 |
+
private $config;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Cache dir.
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $dir;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Cache url.
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
private $url;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The fragment currently being processed.
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
private $current_fragment;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The compiled content.
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
private $compiled_content;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Compiled content's filename.
|
60 |
+
*
|
61 |
+
* @var string
|
62 |
+
*/
|
63 |
+
private $filename;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Create a new Compiler.
|
67 |
+
*
|
68 |
+
* @since 1.0.0
|
69 |
+
*
|
70 |
+
* @param array $config Runtime configuration parameters for the Compiler.
|
71 |
+
*/
|
72 |
+
public function __construct( array $config ) {
|
73 |
+
$this->config = $this->init_config( $config );
|
74 |
+
$this->dir = jupiterx_get_compiler_dir( is_admin() ) . $this->config['id'];
|
75 |
+
$this->url = jupiterx_get_compiler_url( is_admin() ) . $this->config['id'];
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Run the compiler.
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
*
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
public function run_compiler() {
|
86 |
+
// Modify the WP Filesystem method.
|
87 |
+
add_filter( 'filesystem_method', array( $this, 'modify_filesystem_method' ) );
|
88 |
+
|
89 |
+
$this->set_fragments();
|
90 |
+
$this->set_filename();
|
91 |
+
|
92 |
+
if ( ! $this->cache_file_exist() ) {
|
93 |
+
$this->filesystem();
|
94 |
+
$this->maybe_make_dir();
|
95 |
+
$this->combine_fragments();
|
96 |
+
$this->cache_file();
|
97 |
+
}
|
98 |
+
|
99 |
+
if ( $this->config['enqueue'] ) {
|
100 |
+
$this->enqueue_file();
|
101 |
+
}
|
102 |
+
|
103 |
+
// Keep it safe and reset the WP Filesystem method.
|
104 |
+
remove_filter( 'filesystem_method', array( $this, 'modify_filesystem_method' ) );
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Callback to set the WP Filesystem method.
|
109 |
+
*
|
110 |
+
* @since 1.0.0
|
111 |
+
*
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
public function modify_filesystem_method() {
|
115 |
+
return 'direct';
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Initialise the WP Filesystem.
|
120 |
+
*
|
121 |
+
* @since 1.0.0
|
122 |
+
*
|
123 |
+
* @return bool|void
|
124 |
+
*/
|
125 |
+
public function filesystem() {
|
126 |
+
|
127 |
+
// If the WP_Filesystem is not already loaded, load it.
|
128 |
+
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
129 |
+
require_once ABSPATH . '/wp-admin/includes/file.php';
|
130 |
+
}
|
131 |
+
|
132 |
+
// If the WP_Filesystem is not initialized or is not set to WP_Filesystem_Direct, then initialize it.
|
133 |
+
if ( $this->is_wp_filesystem_direct() ) {
|
134 |
+
return true;
|
135 |
+
}
|
136 |
+
|
137 |
+
// Initialize the filesystem.
|
138 |
+
$response = WP_Filesystem();
|
139 |
+
|
140 |
+
// If the filesystem did not initialize, then generate a report and exit.
|
141 |
+
if ( true !== $response || ! $this->is_wp_filesystem_direct() ) {
|
142 |
+
return $this->kill();
|
143 |
+
}
|
144 |
+
|
145 |
+
return true;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Check if the filesystem is set to "direct".
|
150 |
+
*
|
151 |
+
* @since 1.0.0
|
152 |
+
*
|
153 |
+
* @return bool
|
154 |
+
*/
|
155 |
+
private function is_wp_filesystem_direct() {
|
156 |
+
return isset( $GLOBALS['wp_filesystem'] ) && is_a( $GLOBALS['wp_filesystem'], 'WP_Filesystem_Direct' );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Make directory.
|
161 |
+
*
|
162 |
+
* @since 1.0.0
|
163 |
+
*
|
164 |
+
* @return bool
|
165 |
+
*/
|
166 |
+
private function maybe_make_dir() {
|
167 |
+
|
168 |
+
if ( ! @is_dir( $this->dir ) ) { // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- This is a valid use case.
|
169 |
+
wp_mkdir_p( $this->dir );
|
170 |
+
}
|
171 |
+
|
172 |
+
return is_writable( $this->dir );
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Set class fragments.
|
177 |
+
*
|
178 |
+
* @since 1.0.0
|
179 |
+
*
|
180 |
+
* @return void
|
181 |
+
*/
|
182 |
+
public function set_fragments() {
|
183 |
+
global $_jupiterx_compiler_added_fragments;
|
184 |
+
|
185 |
+
$added_fragments = jupiterx_get( $this->config['id'], $_jupiterx_compiler_added_fragments[ $this->config['format'] ] );
|
186 |
+
|
187 |
+
if ( $added_fragments ) {
|
188 |
+
$this->config['fragments'] = array_merge( $this->config['fragments'], $added_fragments );
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Filter the compiler fragment files.
|
193 |
+
*
|
194 |
+
* The dynamic portion of the hook name, $this->config['id'], refers to the compiler id used as a reference.
|
195 |
+
*
|
196 |
+
* @since 1.0.0
|
197 |
+
*
|
198 |
+
* @param array $fragments An array of fragment files.
|
199 |
+
*/
|
200 |
+
$this->config['fragments'] = apply_filters( 'jupiterx_compiler_fragments_' . $this->config['id'], $this->config['fragments'] );
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Set the filename for the compiled asset.
|
205 |
+
*
|
206 |
+
* @since 1.0.0
|
207 |
+
*
|
208 |
+
* @return void
|
209 |
+
*/
|
210 |
+
public function set_filename() {
|
211 |
+
$hash = $this->hash( $this->config );
|
212 |
+
|
213 |
+
if ( empty( _jupiterx_get_cache_busting() ) ) {
|
214 |
+
$this->config['version'] = $hash;
|
215 |
+
|
216 |
+
$hash = 'style';
|
217 |
+
|
218 |
+
if ( 'script' === $this->config['type'] ) {
|
219 |
+
$hash = 'script';
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
$this->filename = $hash . '.' . $this->get_extension();
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Hash the given array.
|
228 |
+
*
|
229 |
+
* @since 1.0.0
|
230 |
+
*
|
231 |
+
* @param array $given_array Given array to be hashed.
|
232 |
+
*
|
233 |
+
* @return string
|
234 |
+
*/
|
235 |
+
public function hash( array $given_array ) {
|
236 |
+
return substr( md5( @serialize( $given_array ) ), 0, 7 ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged, WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize -- Valid use case.
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Checks if the file exists on the filesystem, meaning it's been cached.
|
241 |
+
*
|
242 |
+
* @since 1.0.0
|
243 |
+
*
|
244 |
+
* @return bool
|
245 |
+
*/
|
246 |
+
public function cache_file_exist() {
|
247 |
+
$filename = $this->get_filename();
|
248 |
+
|
249 |
+
if ( ( _jupiterx_is_compiler_dev_mode() ) || is_preview() ) {
|
250 |
+
return false;
|
251 |
+
}
|
252 |
+
|
253 |
+
if ( empty( $filename ) ) {
|
254 |
+
return false;
|
255 |
+
}
|
256 |
+
|
257 |
+
return file_exists( $filename );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get the absolute path of the cached and compiled file.
|
262 |
+
*
|
263 |
+
* @since 1.0.0
|
264 |
+
*
|
265 |
+
* @return string
|
266 |
+
*/
|
267 |
+
public function get_filename() {
|
268 |
+
if ( isset( $this->filename ) ) {
|
269 |
+
return $this->dir . '/' . $this->filename;
|
270 |
+
}
|
271 |
+
|
272 |
+
return '';
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Create cached file.
|
277 |
+
*
|
278 |
+
* @since 1.0.0
|
279 |
+
*
|
280 |
+
* @return bool
|
281 |
+
*/
|
282 |
+
public function cache_file() {
|
283 |
+
$filename = $this->get_filename();
|
284 |
+
|
285 |
+
if ( empty( $filename ) ) {
|
286 |
+
return false;
|
287 |
+
}
|
288 |
+
|
289 |
+
// It is safe to access the filesystem because we made sure it was set.
|
290 |
+
return $GLOBALS['wp_filesystem']->put_contents( $filename, $this->compiled_content, FS_CHMOD_FILE );
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Enqueue cached file.
|
295 |
+
*
|
296 |
+
* @since 1.0.0
|
297 |
+
*
|
298 |
+
* @return void|bool
|
299 |
+
*/
|
300 |
+
private function enqueue_file() {
|
301 |
+
|
302 |
+
// Enqueue CSS file.
|
303 |
+
if ( 'style' === $this->config['type'] ) {
|
304 |
+
return wp_enqueue_style(
|
305 |
+
$this->config['id'],
|
306 |
+
$this->get_url(),
|
307 |
+
$this->config['dependencies'],
|
308 |
+
$this->config['version']
|
309 |
+
);
|
310 |
+
}
|
311 |
+
|
312 |
+
// Enqueue JS file.
|
313 |
+
if ( 'script' === $this->config['type'] ) {
|
314 |
+
return wp_enqueue_script(
|
315 |
+
$this->config['id'],
|
316 |
+
$this->get_url(),
|
317 |
+
$this->config['dependencies'],
|
318 |
+
$this->config['version'],
|
319 |
+
$this->config['in_footer']
|
320 |
+
);
|
321 |
+
}
|
322 |
+
|
323 |
+
return false;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Get cached file url.
|
328 |
+
*
|
329 |
+
* @since 1.0.0
|
330 |
+
*
|
331 |
+
* @return string
|
332 |
+
*/
|
333 |
+
public function get_url() {
|
334 |
+
$url = trailingslashit( $this->url ) . $this->filename;
|
335 |
+
|
336 |
+
if ( is_ssl() ) {
|
337 |
+
$url = str_replace( 'http://', 'https://', $url );
|
338 |
+
}
|
339 |
+
|
340 |
+
return $url;
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Get the file extension from the configured "type".
|
345 |
+
*
|
346 |
+
* @since 1.0.0
|
347 |
+
*
|
348 |
+
* @return string|null
|
349 |
+
*/
|
350 |
+
public function get_extension() {
|
351 |
+
|
352 |
+
if ( 'style' === $this->config['type'] ) {
|
353 |
+
return 'css';
|
354 |
+
}
|
355 |
+
|
356 |
+
if ( 'script' === $this->config['type'] ) {
|
357 |
+
return 'js';
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Combine content of the fragments.
|
363 |
+
*
|
364 |
+
* @since 1.0.0
|
365 |
+
*
|
366 |
+
* @return void
|
367 |
+
*/
|
368 |
+
public function combine_fragments() {
|
369 |
+
$content = '';
|
370 |
+
|
371 |
+
// Loop through fragments.
|
372 |
+
foreach ( $this->config['fragments'] as $fragment ) {
|
373 |
+
|
374 |
+
// Stop here if the fragment is empty.
|
375 |
+
if ( empty( $fragment ) ) {
|
376 |
+
continue;
|
377 |
+
}
|
378 |
+
|
379 |
+
$fragment_content = $this->get_content( $fragment );
|
380 |
+
|
381 |
+
// Stop here if no content or content is an html page.
|
382 |
+
if ( ! $fragment_content || preg_match( '#^\s*\<#', $fragment_content ) ) {
|
383 |
+
continue;
|
384 |
+
}
|
385 |
+
|
386 |
+
// Continue processing style.
|
387 |
+
if ( 'style' === $this->config['type'] ) {
|
388 |
+
$fragment_content = $this->replace_css_url( $fragment_content );
|
389 |
+
$fragment_content = $this->add_content_media_query( $fragment_content );
|
390 |
+
}
|
391 |
+
|
392 |
+
// If there's content, start a new line.
|
393 |
+
if ( $content ) {
|
394 |
+
$content .= "\n\n";
|
395 |
+
}
|
396 |
+
|
397 |
+
$content .= $fragment_content;
|
398 |
+
}
|
399 |
+
|
400 |
+
$this->compiled_content = ! empty( $content ) ? $this->format_content( $content ) : '';
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Get the fragment's content.
|
405 |
+
*
|
406 |
+
* @since 1.0.0
|
407 |
+
*
|
408 |
+
* @param string|callable $fragment The given fragment from which to get the content.
|
409 |
+
*
|
410 |
+
* @return bool|string
|
411 |
+
*/
|
412 |
+
private function get_content( $fragment ) {
|
413 |
+
// Set the current fragment used by other functions.
|
414 |
+
$this->current_fragment = $fragment;
|
415 |
+
|
416 |
+
// If the fragment is callable, call it to get the content.
|
417 |
+
if ( $this->is_function( $fragment ) ) {
|
418 |
+
return $this->get_function_content();
|
419 |
+
}
|
420 |
+
|
421 |
+
$content = $this->get_internal_content();
|
422 |
+
|
423 |
+
// Try remote content if the internal content returned false.
|
424 |
+
if ( empty( $content ) ) {
|
425 |
+
$content = $this->get_remote_content();
|
426 |
+
}
|
427 |
+
|
428 |
+
return $content;
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Get internal file content.
|
433 |
+
*
|
434 |
+
* @since 1.0.0
|
435 |
+
*
|
436 |
+
* @return string|bool
|
437 |
+
*/
|
438 |
+
public function get_internal_content() {
|
439 |
+
$fragment = $this->current_fragment;
|
440 |
+
|
441 |
+
if ( ! file_exists( $fragment ) ) {
|
442 |
+
|
443 |
+
// Replace URL with path.
|
444 |
+
$fragment = jupiterx_url_to_path( $fragment );
|
445 |
+
|
446 |
+
// Stop here if it isn't a valid file.
|
447 |
+
if ( ! file_exists( $fragment ) || 0 === @filesize( $fragment ) ) { // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Valid use case.
|
448 |
+
return false;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
+
// It is safe to access the filesystem because we made sure it was set.
|
453 |
+
return $GLOBALS['wp_filesystem']->get_contents( $fragment );
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Get external file content.
|
458 |
+
*
|
459 |
+
* @since 1.0.0
|
460 |
+
*
|
461 |
+
* @return string|bool
|
462 |
+
*/
|
463 |
+
public function get_remote_content() {
|
464 |
+
$fragment = $this->current_fragment;
|
465 |
+
|
466 |
+
if ( empty( $fragment ) ) {
|
467 |
+
return false;
|
468 |
+
}
|
469 |
+
|
470 |
+
// For a relative URL, add http: to it.
|
471 |
+
if ( substr( $fragment, 0, 2 ) === '//' ) {
|
472 |
+
$fragment = 'http:' . $fragment;
|
473 |
+
} elseif ( substr( $fragment, 0, 1 ) === '/' ) { // Add domain if it is local but could not be fetched as a file.
|
474 |
+
$fragment = site_url( $fragment );
|
475 |
+
}
|
476 |
+
|
477 |
+
$request = wp_remote_get( $fragment );
|
478 |
+
|
479 |
+
if ( is_wp_error( $request ) ) {
|
480 |
+
return '';
|
481 |
+
}
|
482 |
+
|
483 |
+
// If no content was received and the URL is not https, then convert the URL to SSL and retry.
|
484 |
+
if (
|
485 |
+
( ! isset( $request['body'] ) || 200 !== $request['response']['code'] ) &&
|
486 |
+
( substr( $fragment, 0, 8 ) !== 'https://' )
|
487 |
+
) {
|
488 |
+
$fragment = str_replace( 'http://', 'https://', $fragment );
|
489 |
+
$request = wp_remote_get( $fragment );
|
490 |
+
|
491 |
+
if ( is_wp_error( $request ) ) {
|
492 |
+
return '';
|
493 |
+
}
|
494 |
+
}
|
495 |
+
|
496 |
+
if ( ( ! isset( $request['body'] ) || 200 !== $request['response']['code'] ) ) {
|
497 |
+
return false;
|
498 |
+
}
|
499 |
+
|
500 |
+
return wp_remote_retrieve_body( $request );
|
501 |
+
}
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Get function content.
|
505 |
+
*
|
506 |
+
* @since 1.0.0
|
507 |
+
*
|
508 |
+
* @return string|bool
|
509 |
+
*/
|
510 |
+
public function get_function_content() {
|
511 |
+
|
512 |
+
if ( ! is_callable( $this->current_fragment ) ) {
|
513 |
+
return false;
|
514 |
+
}
|
515 |
+
|
516 |
+
return call_user_func( $this->current_fragment );
|
517 |
+
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* Wrap content in query.
|
521 |
+
*
|
522 |
+
* @since 1.0.0
|
523 |
+
*
|
524 |
+
* @param string $content Given content to process.
|
525 |
+
*
|
526 |
+
* @return string
|
527 |
+
*/
|
528 |
+
public function add_content_media_query( $content ) {
|
529 |
+
|
530 |
+
// Ignore if the fragment is a function.
|
531 |
+
if ( $this->is_function( $this->current_fragment ) ) {
|
532 |
+
return $content;
|
533 |
+
}
|
534 |
+
|
535 |
+
$query = wp_parse_url( $this->current_fragment, PHP_URL_QUERY );
|
536 |
+
|
537 |
+
// Bail out if there are no query args or no media query.
|
538 |
+
if ( empty( $query ) || false === stripos( $query, 'jupiterx_compiler_media_query' ) ) {
|
539 |
+
return $content;
|
540 |
+
}
|
541 |
+
|
542 |
+
// Wrap the content in the query.
|
543 |
+
return sprintf(
|
544 |
+
"@media %s {\n%s\n}\n",
|
545 |
+
jupiterx_get( 'jupiterx_compiler_media_query', wp_parse_args( $query ) ),
|
546 |
+
$content
|
547 |
+
);
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Format CSS, LESS and JS content.
|
552 |
+
*
|
553 |
+
* @since 1.0.0
|
554 |
+
*
|
555 |
+
* @param string $content Given content to process.
|
556 |
+
*
|
557 |
+
* @return string
|
558 |
+
*/
|
559 |
+
public function format_content( $content ) {
|
560 |
+
|
561 |
+
if ( 'style' === $this->config['type'] ) {
|
562 |
+
|
563 |
+
if ( 'less' === $this->config['format'] ) {
|
564 |
+
|
565 |
+
if ( ! class_exists( 'JupiterX_Lessc' ) ) {
|
566 |
+
jupiterx_core()->load_files( [ 'compiler/vendors/lessc' ] );
|
567 |
+
}
|
568 |
+
|
569 |
+
$parser = new JupiterX_Lessc();
|
570 |
+
|
571 |
+
$parser = $this->register_less_functions( $parser );
|
572 |
+
|
573 |
+
$parser->setVariables( $this->config['variables'] );
|
574 |
+
|
575 |
+
$content = $parser->compile( $content );
|
576 |
+
}
|
577 |
+
|
578 |
+
if ( ! function_exists( 'jupiterx_parse_css' ) ) {
|
579 |
+
return $content;
|
580 |
+
}
|
581 |
+
|
582 |
+
$content = jupiterx_parse_css( $content );
|
583 |
+
|
584 |
+
if ( ! _jupiterx_is_compiler_dev_mode() ) {
|
585 |
+
$content = $this->minify_style( $content );
|
586 |
+
}
|
587 |
+
|
588 |
+
return $content;
|
589 |
+
}
|
590 |
+
|
591 |
+
if ( 'script' === $this->config['type'] && ! _jupiterx_is_compiler_dev_mode() && $this->config['minify_js'] ) {
|
592 |
+
|
593 |
+
if ( ! class_exists( 'JSMin' ) ) {
|
594 |
+
jupiterx_core()->load_files( [ 'compiler/vendors/js-minifier' ] );
|
595 |
+
}
|
596 |
+
|
597 |
+
$js_min = new JSMin( $content );
|
598 |
+
return $js_min->min();
|
599 |
+
}
|
600 |
+
|
601 |
+
return $content;
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Replace CSS URL shortcuts with a valid URL.
|
606 |
+
*
|
607 |
+
* @since 1.0.0
|
608 |
+
*
|
609 |
+
* @param string $content Given content to process.
|
610 |
+
*
|
611 |
+
* @return string
|
612 |
+
*/
|
613 |
+
public function replace_css_url( $content ) {
|
614 |
+
return preg_replace_callback(
|
615 |
+
'#url\s*\(\s*[\'"]*?([^\'"\)]+)[\'"]*\s*\)#i',
|
616 |
+
array( $this, 'replace_css_url_callback' ),
|
617 |
+
$content
|
618 |
+
);
|
619 |
+
}
|
620 |
+
|
621 |
+
/**
|
622 |
+
* Convert any CSS URL relative paths to absolute URLs.
|
623 |
+
*
|
624 |
+
* @since 1.0.0
|
625 |
+
*
|
626 |
+
* @param array $matches Matches to process, where 0 is the CSS' URL() and 1 is the URI.
|
627 |
+
*
|
628 |
+
* @return string
|
629 |
+
*/
|
630 |
+
public function replace_css_url_callback( $matches ) {
|
631 |
+
|
632 |
+
// If the URI is absolute, bail out and return the CSS.
|
633 |
+
if ( _jupiterx_is_uri( $matches[1] ) ) {
|
634 |
+
return $matches[0];
|
635 |
+
}
|
636 |
+
|
637 |
+
$base = $this->current_fragment;
|
638 |
+
|
639 |
+
// Separate the placeholders and path.
|
640 |
+
$paths = explode( '../', $matches[1] );
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Walk backwards through each of the the fragment's directories, one-by-one. The `foreach` loop
|
644 |
+
* provides us with a performant way to walk the fragment back to its base path based upon the
|
645 |
+
* number of placeholders.
|
646 |
+
*/
|
647 |
+
foreach ( $paths as $path ) {
|
648 |
+
$base = dirname( $base );
|
649 |
+
}
|
650 |
+
|
651 |
+
// Make sure it is a valid base.
|
652 |
+
if ( '.' === $base ) {
|
653 |
+
$base = '';
|
654 |
+
}
|
655 |
+
|
656 |
+
// Rebuild the URL and make sure it is valid using the jupiterx_path_to_url function.
|
657 |
+
$url = jupiterx_path_to_url( trailingslashit( $base ) . ltrim( end( $paths ), '/\\' ) );
|
658 |
+
|
659 |
+
// Return the rebuilt path converted to an URL.
|
660 |
+
return 'url("' . $url . '")';
|
661 |
+
}
|
662 |
+
|
663 |
+
/**
|
664 |
+
* Register LESS_PHP functions.
|
665 |
+
*
|
666 |
+
* @since 1.0.0
|
667 |
+
*
|
668 |
+
* @param object $parser The LESS parser.
|
669 |
+
*
|
670 |
+
* @todo Refactoring is required.
|
671 |
+
*
|
672 |
+
* @return object
|
673 |
+
*/
|
674 |
+
private function register_less_functions( $parser ) {
|
675 |
+
$parser->registerFunction( 'jupiterx_value', function( $arg ) {
|
676 |
+
$output = '';
|
677 |
+
|
678 |
+
if ( isset( $arg[2][1][2][0] ) ) {
|
679 |
+
$output = $arg[2][1][2][0]; // Default.
|
680 |
+
}
|
681 |
+
|
682 |
+
if ( ! empty( $arg[2][0][2][1][1] ) ) {
|
683 |
+
return $arg[2][0][2][1][1]; // E.g. ~"@{@{var}-width}".
|
684 |
+
}
|
685 |
+
|
686 |
+
if ( ! empty( $arg[2][0][1] ) ) {
|
687 |
+
$value = $arg[2][0][1]; // E.g. @text-size.
|
688 |
+
$unit = empty( $arg[2][0][2] ) ? '' : $arg[2][0][2]; // E.g. @text-size unit.
|
689 |
+
|
690 |
+
return $value . $unit;
|
691 |
+
}
|
692 |
+
|
693 |
+
return $output;
|
694 |
+
} );
|
695 |
+
|
696 |
+
$parser->registerFunction( 'jupiterx_value_pattern', function( $arg ) {
|
697 |
+
if ( 0 === strlen( $arg[2][0][1] ) ) {
|
698 |
+
return '';
|
699 |
+
}
|
700 |
+
|
701 |
+
list($type, $value, $unit) = $arg[2][0];
|
702 |
+
|
703 |
+
$format = $arg[2][1][2][0];
|
704 |
+
|
705 |
+
// When value is 0px, parser automatically remove px (but not %) from it.
|
706 |
+
if ( 0 == $arg[2][0][1] ) { // @codingStandardsIgnoreLine
|
707 |
+
$unit = '%';
|
708 |
+
}
|
709 |
+
|
710 |
+
return sprintf( $format, $value . $unit );
|
711 |
+
} );
|
712 |
+
|
713 |
+
$parser->registerFunction( 'jupiterx_replace', function( $args ) {
|
714 |
+
list( $string, $search, $replace ) = $args[2];
|
715 |
+
|
716 |
+
// Arrange if string is from a variable use the true condition. e.g. @{var-name}.
|
717 |
+
$string = isset( $string[2][1][1] ) ? $string[2][1][1] : $string[2][0];
|
718 |
+
$search = $search[2][0];
|
719 |
+
$replace = $replace[2][0];
|
720 |
+
|
721 |
+
return str_replace( $search, $replace, $string );
|
722 |
+
} );
|
723 |
+
|
724 |
+
return $parser;
|
725 |
+
}
|
726 |
+
|
727 |
+
/**
|
728 |
+
* Initialize the configuration.
|
729 |
+
*
|
730 |
+
* @since 1.0.0
|
731 |
+
*
|
732 |
+
* @param array $config Runtime configuration parameters for the Compiler.
|
733 |
+
*
|
734 |
+
* @return array
|
735 |
+
*/
|
736 |
+
private function init_config( array $config ) {
|
737 |
+
// Fix dependencies, if "depedencies" is specified.
|
738 |
+
if ( isset( $config['depedencies'] ) ) {
|
739 |
+
$config['dependencies'] = $config['depedencies'];
|
740 |
+
unset( $config['depedencies'] );
|
741 |
+
}
|
742 |
+
|
743 |
+
$defaults = [
|
744 |
+
'id' => false,
|
745 |
+
'type' => false,
|
746 |
+
'format' => false,
|
747 |
+
'fragments' => [],
|
748 |
+
'variables' => apply_filters( 'jupiterx_compiler_less_variables', [] ),
|
749 |
+
'dependencies' => false,
|
750 |
+
'in_footer' => false,
|
751 |
+
'minify_js' => true,
|
752 |
+
'version' => JUPITERX_VERSION,
|
753 |
+
'enqueue' => true,
|
754 |
+
];
|
755 |
+
|
756 |
+
return array_merge( $defaults, $config );
|
757 |
+
}
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Get the fragments' modification times.
|
761 |
+
*
|
762 |
+
* @since 1.0.0
|
763 |
+
*
|
764 |
+
* @return array
|
765 |
+
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
|
766 |
+
*/
|
767 |
+
private function get_fragments_filemtime() {
|
768 |
+
$fragments_filemtime = array();
|
769 |
+
|
770 |
+
foreach ( $this->config['fragments'] as $index => $fragment ) {
|
771 |
+
|
772 |
+
// Skip this one if the fragment is a function.
|
773 |
+
if ( $this->is_function( $fragment ) ) {
|
774 |
+
if ( ! is_callable( $fragment ) ) {
|
775 |
+
continue;
|
776 |
+
}
|
777 |
+
|
778 |
+
$fragments_filemtime[ $index ] = $this->hash( [ call_user_func( $fragment ) ] );
|
779 |
+
|
780 |
+
}
|
781 |
+
|
782 |
+
if ( file_exists( $fragment ) ) {
|
783 |
+
$fragments_filemtime[ $index ] = @filemtime( $fragment ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Valid use case.
|
784 |
+
}
|
785 |
+
}
|
786 |
+
|
787 |
+
return $fragments_filemtime;
|
788 |
+
}
|
789 |
+
|
790 |
+
/**
|
791 |
+
* Get the new hash for the given fragments' modification times.
|
792 |
+
*
|
793 |
+
* @since 1.0.0
|
794 |
+
*
|
795 |
+
* @param string $hash The original hash to modify.
|
796 |
+
* @param array $fragments_filemtime Array of fragments' modification times.
|
797 |
+
*
|
798 |
+
* @return string
|
799 |
+
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
|
800 |
+
*/
|
801 |
+
private function get_new_hash( $hash, array $fragments_filemtime ) {
|
802 |
+
|
803 |
+
if ( empty( $fragments_filemtime ) ) {
|
804 |
+
return $hash;
|
805 |
+
}
|
806 |
+
|
807 |
+
// Set filemtime hash.
|
808 |
+
$_hash = $this->hash( $fragments_filemtime );
|
809 |
+
|
810 |
+
$this->remove_modified_files( $hash, $_hash );
|
811 |
+
|
812 |
+
// Set the new hash which will trigger a new compiling.
|
813 |
+
return $hash . '-' . $_hash;
|
814 |
+
}
|
815 |
+
|
816 |
+
/**
|
817 |
+
* Remove any modified files. A file is considered modified when:
|
818 |
+
*
|
819 |
+
* 1. It has both a base hash and filemtime hash, separated by '-'.
|
820 |
+
* 2. Its base hash matches the given hash.
|
821 |
+
* 3. Its filemtime hash does not match the given filemtime hash.
|
822 |
+
*
|
823 |
+
* @since 1.0.0
|
824 |
+
*
|
825 |
+
* @param string $hash Base hash.
|
826 |
+
* @param string $filemtime_hash The filemtime hash (from hashing the fragments).
|
827 |
+
*
|
828 |
+
* @return void
|
829 |
+
*/
|
830 |
+
private function remove_modified_files( $hash, $filemtime_hash ) {
|
831 |
+
|
832 |
+
if ( ! is_dir( $this->dir ) ) {
|
833 |
+
return;
|
834 |
+
}
|
835 |
+
|
836 |
+
$items = @scandir( $this->dir ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Valid use case.
|
837 |
+
unset( $items[0], $items[1] );
|
838 |
+
|
839 |
+
if ( empty( $items ) ) {
|
840 |
+
return;
|
841 |
+
}
|
842 |
+
|
843 |
+
foreach ( $items as $item ) {
|
844 |
+
|
845 |
+
// Skip this one if it's a directory.
|
846 |
+
if ( @is_dir( $item ) ) { // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Valid use case.
|
847 |
+
continue;
|
848 |
+
}
|
849 |
+
|
850 |
+
// Skip this one if it's not the same type.
|
851 |
+
if ( pathinfo( $item, PATHINFO_EXTENSION ) !== $this->get_extension() ) {
|
852 |
+
continue;
|
853 |
+
}
|
854 |
+
|
855 |
+
// Skip this one if it does not have a '-' in the filename.
|
856 |
+
if ( strpos( $item, '-' ) === false ) {
|
857 |
+
continue;
|
858 |
+
}
|
859 |
+
|
860 |
+
$hash_parts = explode( '-', pathinfo( $item, PATHINFO_FILENAME ) );
|
861 |
+
|
862 |
+
// Skip this one if it does not match the given base hash.
|
863 |
+
if ( $hash_parts[0] !== $hash ) {
|
864 |
+
continue;
|
865 |
+
}
|
866 |
+
|
867 |
+
// Skip this one if it does match the given filemtime's hash.
|
868 |
+
if ( $hash_parts[1] === $filemtime_hash ) {
|
869 |
+
continue;
|
870 |
+
}
|
871 |
+
|
872 |
+
// Clean up other modified files.
|
873 |
+
@unlink( $this->dir . '/' . $item ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Valid use case.
|
874 |
+
}
|
875 |
+
}
|
876 |
+
|
877 |
+
/**
|
878 |
+
* Minify the CSS.
|
879 |
+
*
|
880 |
+
* @since 1.0.0
|
881 |
+
*
|
882 |
+
* @param string $content Given content to process.
|
883 |
+
*
|
884 |
+
* @return string
|
885 |
+
*/
|
886 |
+
private function minify_style( $content ) {
|
887 |
+
$replace = array(
|
888 |
+
'/([^\r\n{}]+)(,(?=[^}]*{)|\s*{)}/' => '', // Strip empty selectors.
|
889 |
+
'/@media\s\(.*\).*{}/' => '', // Strip empty @media.
|
890 |
+
'#/\*.*?\*/#s' => '', // Strip comments.
|
891 |
+
'#\s\s+#' => ' ', // Strip excess whitespace.
|
892 |
+
);
|
893 |
+
|
894 |
+
$search = array_keys( $replace );
|
895 |
+
$content = preg_replace( $search, $replace, $content );
|
896 |
+
|
897 |
+
$replace = array(
|
898 |
+
': ' => ':',
|
899 |
+
'; ' => ';',
|
900 |
+
' {' => '{',
|
901 |
+
' }' => '}',
|
902 |
+
', ' => ',',
|
903 |
+
'{ ' => '{',
|
904 |
+
';}' => '}', // Strip optional semicolons.
|
905 |
+
',\n' => ',', // Don't wrap multiple selectors.
|
906 |
+
'\n}' => '}', // Don't wrap closing braces.
|
907 |
+
'} ' => "}\n", // Put each rule on it's own line.
|
908 |
+
'\n' => '', // Remove all line breaks.
|
909 |
+
);
|
910 |
+
|
911 |
+
$search = array_keys( $replace );
|
912 |
+
|
913 |
+
return trim( str_replace( $search, $replace, $content ) );
|
914 |
+
}
|
915 |
+
|
916 |
+
/**
|
917 |
+
* Check if the given fragment is a callable.
|
918 |
+
*
|
919 |
+
* @since 1.0.0
|
920 |
+
*
|
921 |
+
* @param mixed $fragment Given fragment to check.
|
922 |
+
*
|
923 |
+
* @return bool
|
924 |
+
*/
|
925 |
+
private function is_function( $fragment ) {
|
926 |
+
return ( is_array( $fragment ) || is_callable( $fragment ) );
|
927 |
+
}
|
928 |
+
|
929 |
+
/**
|
930 |
+
* Kill it :(
|
931 |
+
*
|
932 |
+
* @since 1.0.0
|
933 |
+
*
|
934 |
+
* @return void
|
935 |
+
*/
|
936 |
+
private function kill() {
|
937 |
+
|
938 |
+
// Send report if set.
|
939 |
+
if ( jupiterx_get( 'jupiterx_send_compiler_report' ) ) { // @codingStandardsIgnoreLine
|
940 |
+
// $this->report(); // @codingStandardsIgnoreLine
|
941 |
+
}
|
942 |
+
|
943 |
+
$html = jupiterx_output( 'jupiterx_compiler_error_title_text', sprintf(
|
944 |
+
'<h2>%s</h2>',
|
945 |
+
__( 'Not cool, Jupiter cannot work its magic :(', 'jupiterx-core' )
|
946 |
+
) );
|
947 |
+
|
948 |
+
$html .= jupiterx_output( 'jupiterx_compiler_error_message_text', sprintf(
|
949 |
+
'<p>%s</p>',
|
950 |
+
__( 'Your current install or file permission prevents Jupiter from working its magic. Please get in touch with Jupiter support. We will gladly get you started within 24 - 48 hours (working days).', 'jupiterx-core' )
|
951 |
+
) );
|
952 |
+
|
953 |
+
$html .= jupiterx_output( 'jupiterx_compiler_error_contact_text', sprintf(
|
954 |
+
'<a class="button" href="https://themes.artbees.net/support/" target="_blank">%s</a>',
|
955 |
+
__( 'Contact Jupiter Support', 'jupiterx-core' )
|
956 |
+
) );
|
957 |
+
|
958 |
+
$html .= jupiterx_output( 'jupiterx_compiler_error_report_text', sprintf(
|
959 |
+
'<p style="margin-top: 12px; font-size: 12px;"><a href="' . add_query_arg( 'jupiterx_send_compiler_report', true ) . '">%1$s</a>. %2$s</p>',
|
960 |
+
__( 'Send us an automatic report', 'jupiterx-core' ),
|
961 |
+
__( 'We respect your time and understand you might not be able to contact us.', 'jupiterx-core' )
|
962 |
+
) );
|
963 |
+
|
964 |
+
wp_die( wp_kses_post( $html ) );
|
965 |
+
}
|
966 |
+
|
967 |
+
/**
|
968 |
+
* Send report.
|
969 |
+
*
|
970 |
+
* @since 1.0.0
|
971 |
+
*
|
972 |
+
* @todo Decide if we want to use and change the report recipient.
|
973 |
+
*
|
974 |
+
* @return void
|
975 |
+
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
|
976 |
+
*/
|
977 |
+
private function report() {
|
978 |
+
// Send report.
|
979 |
+
wp_mail(
|
980 |
+
'hello@getjupiter.io',
|
981 |
+
'Compiler error',
|
982 |
+
'Compiler error reported by ' . home_url(),
|
983 |
+
array(
|
984 |
+
'MIME-Version: 1.0' . "\r\n",
|
985 |
+
'Content-type: text/html; charset=utf-8' . "\r\n",
|
986 |
+
"X-Mailer: PHP \r\n",
|
987 |
+
'From: ' . wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) . ' < ' . get_option( 'admin_email' ) . '>' . "\r\n",
|
988 |
+
'Reply-To: ' . get_option( 'admin_email' ) . "\r\n",
|
989 |
+
)
|
990 |
+
);
|
991 |
+
|
992 |
+
// Die and display message.
|
993 |
+
$message = jupiterx_output(
|
994 |
+
'jupiterx_compiler_report_error_text',
|
995 |
+
sprintf(
|
996 |
+
'<p>%s<p>',
|
997 |
+
__( 'Thanks for your contribution by reporting this issue. We hope to hear from you again.', 'jupiterx-core' )
|
998 |
+
)
|
999 |
+
);
|
1000 |
+
|
1001 |
+
wp_die( wp_kses_post( $message ) );
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/**
|
1005 |
+
* Get the property's value.
|
1006 |
+
*
|
1007 |
+
* @since 1.0.0
|
1008 |
+
*
|
1009 |
+
* @param string $property Name of the property to get.
|
1010 |
+
*
|
1011 |
+
* @return mixed
|
1012 |
+
*/
|
1013 |
+
public function __get( $property ) {
|
1014 |
+
|
1015 |
+
if ( property_exists( $this, $property ) ) {
|
1016 |
+
return $this->{$property};
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
}
|
includes/compiler/functions.php
ADDED
@@ -0,0 +1,411 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Compile and cache CSS, LESS and JS files.
|
4 |
+
*
|
5 |
+
* The Jupiter Compiler compiles multiple internal or external CSS, LESS and JS files on a
|
6 |
+
* per page basis. LESS content will automatically be converted to CSS.
|
7 |
+
*
|
8 |
+
* Internal file changes are automatically detected if development mode is enabled.
|
9 |
+
* Third party enqueued styles and scripts can be compiled and cached into a single file.
|
10 |
+
*
|
11 |
+
* @package API\Compiler
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Compile CSS fragments and enqueue compiled file.
|
16 |
+
*
|
17 |
+
* This function should be used in a similar fashion to
|
18 |
+
* {@link http://codex.wordpress.org/Function_Reference/wp_enqueue_script wp_enqueue_script()}.
|
19 |
+
*
|
20 |
+
* Fragments can be added to the compiler using {@see jupiterx_compiler_add_fragment()}.
|
21 |
+
*
|
22 |
+
* @since 1.0.0
|
23 |
+
*
|
24 |
+
* @param string $id A unique string used as a reference. Similar to the WordPress scripts
|
25 |
+
* $handle argument.
|
26 |
+
* @param string|array $fragments File(s) absolute path. Internal or external file(s) url accepted but may increase
|
27 |
+
* compiling time.
|
28 |
+
* @param array $args {
|
29 |
+
* Optional. Array of arguments used by the compiler.
|
30 |
+
*
|
31 |
+
* @type array $depedencies An array of registered handles this script depends on. Default false.
|
32 |
+
* }
|
33 |
+
*
|
34 |
+
* @return object Compiler object.
|
35 |
+
*/
|
36 |
+
function jupiterx_compile_css_fragments( $id, $fragments, $args = array() ) {
|
37 |
+
|
38 |
+
if ( empty( $fragments ) ) {
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
$params = array(
|
43 |
+
'id' => $id,
|
44 |
+
'type' => 'style',
|
45 |
+
'format' => 'css',
|
46 |
+
'fragments' => (array) $fragments,
|
47 |
+
);
|
48 |
+
|
49 |
+
$compiler = new _JupiterX_Compiler( array_merge( $params, $args ) );
|
50 |
+
$compiler->run_compiler();
|
51 |
+
|
52 |
+
return $compiler;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Compile LESS fragments, convert to CSS and enqueue compiled file.
|
57 |
+
*
|
58 |
+
* This function should be used in a similar fashion to
|
59 |
+
* {@link http://codex.wordpress.org/Function_Reference/wp_enqueue_script wp_enqueue_script()}.
|
60 |
+
*
|
61 |
+
* Fragments can be added to the compiler using {@see jupiterx_compiler_add_fragment()}.
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
*
|
65 |
+
* @param string $id The compiler ID. Similar to the WordPress scripts $handle argument.
|
66 |
+
* @param string|array $fragments File(s) absolute path. Internal or external file(s) url accepted but may increase
|
67 |
+
* compiling time.
|
68 |
+
* @param array $args {
|
69 |
+
* Optional. Array of arguments used by the compiler.
|
70 |
+
*
|
71 |
+
* @type array $depedencies An array of registered handles this script depends on. Default false.
|
72 |
+
* }
|
73 |
+
*
|
74 |
+
* @return object Compiler object.
|
75 |
+
*/
|
76 |
+
function jupiterx_compile_less_fragments( $id, $fragments, $args = array() ) {
|
77 |
+
|
78 |
+
if ( empty( $fragments ) ) {
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
|
82 |
+
$params = array(
|
83 |
+
'id' => $id,
|
84 |
+
'type' => 'style',
|
85 |
+
'format' => 'less',
|
86 |
+
'fragments' => (array) $fragments,
|
87 |
+
);
|
88 |
+
|
89 |
+
$compiler = new _JupiterX_Compiler( array_merge( $params, $args ) );
|
90 |
+
$compiler->run_compiler();
|
91 |
+
|
92 |
+
return $compiler;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Compile LESS fragments, convert to CSS and enqueue compiled file.
|
97 |
+
*
|
98 |
+
* This function should be used in a similar fashion to
|
99 |
+
* {@link http://codex.wordpress.org/Function_Reference/wp_enqueue_script wp_enqueue_script()}.
|
100 |
+
*
|
101 |
+
* Fragments can be added to the compiler using {@see jupiterx_compiler_add_fragment()}.
|
102 |
+
*
|
103 |
+
* @since 1.0.0
|
104 |
+
*
|
105 |
+
* @param string $id The compiler ID. Similar to the WordPress scripts $handle argument.
|
106 |
+
* @param string|array $fragments File(s) absolute path. Internal or external file(s) url accepted but may increase
|
107 |
+
* compiling time.
|
108 |
+
* @param array $args {
|
109 |
+
* Optional. Array of arguments used by the compiler.
|
110 |
+
*
|
111 |
+
* @type array $depedencies An array of registered handles this script depends on. Default false.
|
112 |
+
* }
|
113 |
+
*
|
114 |
+
* @return object Compiler object.
|
115 |
+
*/
|
116 |
+
function jupiterx_compile_scss_fragments( $id, $fragments, $args = array() ) {
|
117 |
+
|
118 |
+
if ( empty( $fragments ) ) {
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
$params = array(
|
123 |
+
'id' => $id,
|
124 |
+
'type' => 'style',
|
125 |
+
'format' => 'scss',
|
126 |
+
'fragments' => (array) $fragments,
|
127 |
+
);
|
128 |
+
|
129 |
+
$compiler = new _JupiterX_Compiler( array_merge( $params, $args ) );
|
130 |
+
$compiler->run_compiler();
|
131 |
+
|
132 |
+
return $compiler;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Compile JS fragments and enqueue compiled file.
|
137 |
+
*
|
138 |
+
* This function should be used in a similar fashion to
|
139 |
+
* {@link http://codex.wordpress.org/Function_Reference/wp_enqueue_script wp_enqueue_script()}.
|
140 |
+
*
|
141 |
+
* Fragments can be added to the compiler using {@see jupiterx_compiler_add_fragment()}.
|
142 |
+
*
|
143 |
+
* @since 1.0.0
|
144 |
+
*
|
145 |
+
* @param string $id The compiler ID. Similar to the WordPress scripts $handle argument.
|
146 |
+
* @param string|array $fragments File(s) absolute path. Internal or external file(s) URL accepted but may increase
|
147 |
+
* compiling time.
|
148 |
+
* @param array $args {
|
149 |
+
* Optional. Array of arguments used by the compiler.
|
150 |
+
*
|
151 |
+
* @type array $depedencies An array of registered handles this script depends on. Default false.
|
152 |
+
* @type bool $in_footer Whether to enqueue the script before </head> or before </body>. Default false.
|
153 |
+
* @type bool $minify_js Whether the JavaScript should be minified or not. Be aware that minifying
|
154 |
+
* the JavaScript can considerably slow down the process of compiling files.
|
155 |
+
* Default false.
|
156 |
+
* }
|
157 |
+
*
|
158 |
+
* @return object Compiler object.
|
159 |
+
*/
|
160 |
+
function jupiterx_compile_js_fragments( $id, $fragments, $args = array() ) {
|
161 |
+
|
162 |
+
if ( empty( $fragments ) ) {
|
163 |
+
return false;
|
164 |
+
}
|
165 |
+
|
166 |
+
$params = array(
|
167 |
+
'id' => $id,
|
168 |
+
'type' => 'script',
|
169 |
+
'format' => 'js',
|
170 |
+
'fragments' => (array) $fragments,
|
171 |
+
);
|
172 |
+
|
173 |
+
$compiler = new _JupiterX_Compiler( array_merge( $params, $args ) );
|
174 |
+
$compiler->run_compiler();
|
175 |
+
|
176 |
+
return $compiler;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Add CSS, LESS or JS fragments to a compiler.
|
181 |
+
*
|
182 |
+
* This function should be used in a similar fashion to
|
183 |
+
* {@link http://codex.wordpress.org/Function_Reference/wp_enqueue_script wp_enqueue_script()}.
|
184 |
+
*
|
185 |
+
* @since 1.0.0
|
186 |
+
*
|
187 |
+
* @param string $id The compiler ID. Similar to the WordPress scripts $handle argument.
|
188 |
+
* @param string|array $fragments File(s) absolute path. Internal or external file(s) url accepted but may increase
|
189 |
+
* compiling time.
|
190 |
+
* @param string $format Compiler format the fragments should be added to. Accepts 'css',
|
191 |
+
* 'less' or 'js'.
|
192 |
+
*
|
193 |
+
* @return void|bool
|
194 |
+
* @SuppressWarnings(PHPMD.ElseExpression)
|
195 |
+
*/
|
196 |
+
function jupiterx_compiler_add_fragment( $id, $fragments, $format ) {
|
197 |
+
|
198 |
+
if ( empty( $fragments ) ) {
|
199 |
+
return false;
|
200 |
+
}
|
201 |
+
|
202 |
+
global $_jupiterx_compiler_added_fragments;
|
203 |
+
|
204 |
+
foreach ( (array) $fragments as $key => $fragment ) {
|
205 |
+
|
206 |
+
// Stop here if the format isn't valid.
|
207 |
+
if ( ! isset( $_jupiterx_compiler_added_fragments[ $format ] ) ) {
|
208 |
+
continue;
|
209 |
+
}
|
210 |
+
|
211 |
+
// Register a new compiler ID if it doesn't exist and add fragment.
|
212 |
+
if ( ! isset( $_jupiterx_compiler_added_fragments[ $format ][ $id ] ) ) {
|
213 |
+
$_jupiterx_compiler_added_fragments[ $format ][ $id ] = array( $fragment );
|
214 |
+
} else { // Add fragment to existing compiler.
|
215 |
+
$_jupiterx_compiler_added_fragments[ $format ][ $id ][] = $fragment;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Flush cached compiler files.
|
222 |
+
*
|
223 |
+
* Each compiler has its own folder which contains the cached CSS and JS files. The file format
|
224 |
+
* of the cached file can be specified if needed.
|
225 |
+
*
|
226 |
+
* @since 1.0.0
|
227 |
+
*
|
228 |
+
* @param string $id The compiler ID. Similar to the WordPress scripts $handle argument.
|
229 |
+
* @param string|bool $file_format Optional. Define which file format(s) should be removed. Both CSS and JS
|
230 |
+
* files will be removed if set to false. Accepts 'false', 'css' or 'js'.
|
231 |
+
* @param bool $admin Optional. Whether it is an admin compiler or not.
|
232 |
+
*
|
233 |
+
* @return void|bool
|
234 |
+
*/
|
235 |
+
function jupiterx_flush_compiler( $id, $file_format = false, $admin = false ) {
|
236 |
+
static $jupiterx_flushed = false;
|
237 |
+
|
238 |
+
$cache_dir = jupiterx_get_compiler_dir( $admin );
|
239 |
+
|
240 |
+
// Always flush Jupiter' global cache.
|
241 |
+
if ( ! $jupiterx_flushed ) {
|
242 |
+
$jupiterx_flushed = true;
|
243 |
+
|
244 |
+
jupiterx_flush_compiler( 'jupiterx', $file_format, $admin );
|
245 |
+
}
|
246 |
+
|
247 |
+
$dir = trailingslashit( $cache_dir ) . $id;
|
248 |
+
|
249 |
+
// Stop here if directory doesn't exist.
|
250 |
+
if ( ! is_dir( $dir ) ) {
|
251 |
+
return;
|
252 |
+
}
|
253 |
+
|
254 |
+
// Remove only the specified file format.
|
255 |
+
if ( $file_format ) {
|
256 |
+
$items = scandir( $dir );
|
257 |
+
unset( $items[0], $items[1] );
|
258 |
+
|
259 |
+
foreach ( $items as $item ) {
|
260 |
+
if ( false !== stripos( $item, '.' . $file_format ) ) {
|
261 |
+
@unlink( trailingslashit( $dir ) . $item ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Valid use case.
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
return;
|
266 |
+
}
|
267 |
+
|
268 |
+
// Remove all file formats.
|
269 |
+
jupiterx_remove_dir( $dir );
|
270 |
+
|
271 |
+
jupiterx_flush_cache_plugins();
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Flush admin cached compiler files.
|
276 |
+
*
|
277 |
+
* This function is a shortcut of {@see jupiterx_flush_compiler()}.
|
278 |
+
*
|
279 |
+
* @since 1.0.0
|
280 |
+
*
|
281 |
+
* @param string $id The compiler ID. Similar to the WordPress scripts $handle argument.
|
282 |
+
* @param string|bool $file_format Optional. Define which file formats should be removed. Both CSS and JS
|
283 |
+
* files will be removed if set to false. Accepts 'false', 'css' or 'js'.
|
284 |
+
*
|
285 |
+
* @return void
|
286 |
+
*/
|
287 |
+
function jupiterx_flush_admin_compiler( $id, $file_format = false ) {
|
288 |
+
jupiterx_flush_compiler( $id, $file_format, true );
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Flush cache plugins
|
293 |
+
*
|
294 |
+
* @since 1.0.0
|
295 |
+
*
|
296 |
+
* @return void
|
297 |
+
*/
|
298 |
+
function jupiterx_flush_cache_plugins() {
|
299 |
+
|
300 |
+
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
|
301 |
+
w3tc_pgcache_flush();
|
302 |
+
}
|
303 |
+
|
304 |
+
if ( function_exists( 'wp_cache_clear_cache' ) ) {
|
305 |
+
wp_cache_clear_cache();
|
306 |
+
}
|
307 |
+
|
308 |
+
if ( function_exists( 'rocket_clean_domain' ) ) {
|
309 |
+
rocket_clean_domain();
|
310 |
+
}
|
311 |
+
|
312 |
+
if ( class_exists( 'WpFastestCache' ) ) {
|
313 |
+
$GLOBALS['wp_fastest_cache']->deleteCache();
|
314 |
+
}
|
315 |
+
|
316 |
+
if ( class_exists( 'autoptimizeCache' ) ) {
|
317 |
+
autoptimizeCache::clearall();
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Get absolute path to the Jupiter' compiler directory.
|
323 |
+
*
|
324 |
+
* @since 1.0.0
|
325 |
+
*
|
326 |
+
* @param bool $is_admin Optional. When true, gets the admin compiler directory. Default is false.
|
327 |
+
*
|
328 |
+
* @return string
|
329 |
+
*/
|
330 |
+
function jupiterx_get_compiler_dir( $is_admin = false ) {
|
331 |
+
$wp_upload_dir = wp_upload_dir();
|
332 |
+
$suffix = $is_admin ? 'jupiterx/admin-compiler/' : 'jupiterx/compiler/';
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Deprecated. Filter the Jupiter compiler directory.
|
336 |
+
*
|
337 |
+
* This filter is deprecated for security and compatibility purposes.
|
338 |
+
*
|
339 |
+
* @since 1.0.0
|
340 |
+
* @deprecated 1.3.0
|
341 |
+
*/
|
342 |
+
apply_filters( 'jupiterx_compiler_dir', false, $is_admin );
|
343 |
+
|
344 |
+
return wp_normalize_path( trailingslashit( $wp_upload_dir['basedir'] ) . $suffix );
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Get absolute URL to the Jupiter' compiler directory.
|
349 |
+
*
|
350 |
+
* @since 1.0.0
|
351 |
+
*
|
352 |
+
* @param bool $is_admin Optional. When true, gets the admin compiler directory. Default is false.
|
353 |
+
*
|
354 |
+
* @return string
|
355 |
+
*/
|
356 |
+
function jupiterx_get_compiler_url( $is_admin = false ) {
|
357 |
+
$wp_upload_dir = wp_upload_dir();
|
358 |
+
$suffix = $is_admin ? 'jupiterx/admin-compiler/' : 'jupiterx/compiler/';
|
359 |
+
|
360 |
+
return trailingslashit( $wp_upload_dir['baseurl'] ) . $suffix;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Check if development mode is enabled.
|
365 |
+
*
|
366 |
+
* Takes legacy constant into consideration.
|
367 |
+
*
|
368 |
+
* @since 1.0.0
|
369 |
+
* @ignore
|
370 |
+
* @access private
|
371 |
+
*
|
372 |
+
* @return bool
|
373 |
+
*/
|
374 |
+
function _jupiterx_is_compiler_dev_mode() {
|
375 |
+
|
376 |
+
if ( defined( 'JUPITERX_COMPILER_DEV_MODE' ) ) {
|
377 |
+
return JUPITERX_COMPILER_DEV_MODE;
|
378 |
+
}
|
379 |
+
|
380 |
+
return get_option( 'jupiterx_dev_mode', false );
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Get cache busting method.
|
385 |
+
*
|
386 |
+
* @since 1.0.0
|
387 |
+
* @access private
|
388 |
+
*
|
389 |
+
* @return bool
|
390 |
+
*/
|
391 |
+
function _jupiterx_get_cache_busting() {
|
392 |
+
return get_option( 'jupiterx_cache_busting', true );
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Initialize added fragments global.
|
397 |
+
*
|
398 |
+
* @since 1.0.0
|
399 |
+
* @ignore
|
400 |
+
* @access private
|
401 |
+
*/
|
402 |
+
global $_jupiterx_compiler_added_fragments;
|
403 |
+
|
404 |
+
if ( ! isset( $_jupiterx_compiler_added_fragments ) ) {
|
405 |
+
$_jupiterx_compiler_added_fragments = array(
|
406 |
+
'css' => array(),
|
407 |
+
'less' => array(),
|
408 |
+
'scss' => array(),
|
409 |
+
'js' => array(),
|
410 |
+
);
|
411 |
+
}
|
includes/compiler/preprocess-aliases.ini
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|