updated plugin GP Premium
version 2.5.0
This commit is contained in:
parent
627ec103fe
commit
a35dc419bc
7
wp-content/plugins/gp-premium/dist/block-elements-rtl.css
vendored
Normal file
7
wp-content/plugins/gp-premium/dist/block-elements-rtl.css
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.inline-post-meta-area.block-editor-block-list__layout,.inline-post-meta-area>.gb-inside-container.block-editor-block-list__layout,.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout{align-items:center;display:flex}.inline-post-meta-area.block-editor-block-list__layout>.wp-block.block-list-appender,.inline-post-meta-area>.gb-inside-container.block-editor-block-list__layout>.wp-block.block-list-appender,.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block.block-list-appender{margin-right:20px}.inline-post-meta-area.block-editor-block-list__layout>.wp-block-image,.inline-post-meta-area>.gb-inside-container.block-editor-block-list__layout>.wp-block-image,.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block-image{line-height:0}.inline-post-meta-area.block-editor-block-list__layout>.wp-block-image figcaption,.inline-post-meta-area>.gb-inside-container.block-editor-block-list__layout>.wp-block-image figcaption,.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block-image figcaption{display:none}.inline-post-meta-area .wp-block{margin-right:0;margin-left:0}.gpp-dynamic-container-bg-dropdown .components-popover__content{width:275px}.gpp-dynamic-container-bg-dropdown .components-popover__content .components-base-control:not(:last-child){margin-bottom:20px}.gpp-dynamic-container-bg-dropdown .components-popover__content .components-base-control:last-child .components-base-control__field{margin-bottom:0}.gpp-dynamic-container-bg-dropdown .components-popover__content .components-base-control:last-child .components-base-control__help{margin-top:3px}
|
||||
.gpp-dynamic-headline-text-dropdown .components-popover__content{width:275px}.gpp-dynamic-headline-text-dropdown .components-popover__content .components-base-control:not(:last-child){margin-bottom:20px}.gpp-dynamic-headline-text-dropdown .components-popover__content .components-base-control:last-child .components-base-control__field{margin-bottom:0}.gpp-dynamic-headline-text-dropdown .components-popover__content .components-base-control:last-child .components-base-control__help{margin-top:3px}.gpp-blocks-dynamic-text-replace-field{display:none}.gpp-block-dynamic-year .components-base-control__help{margin-top:2px}
|
||||
.wp-block[data-type="generatepress/dynamic-content"]{margin-bottom:0;margin-top:0}
|
||||
.wp-block[data-type="generatepress/dynamic-image"]{color:#fff;margin-bottom:0;margin-top:0}.wp-block[data-type="generatepress/dynamic-image"] .components-gpp-dynamic-image-placeholder__label{align-items:center;bottom:0;color:#fff;display:flex;font-size:1em;justify-content:center;right:0;position:absolute;left:0;top:0}.wp-block[data-type="generatepress/dynamic-image"] .components-gpp-dynamic-image-placeholder__label>.gpp-dynamic-featured-image__label{margin-right:10px}.wp-block[data-type="generatepress/dynamic-image"] .gpp-dynamic-image-placeholder{background:#000;vertical-align:middle}.wp-block[data-type="generatepress/dynamic-image"] .components-placeholder{width:100%}.wp-block[data-type="generatepress/dynamic-image"] .gpp-dynamic-image-preview{display:inline-block;position:relative}.wp-block[data-type="generatepress/dynamic-image"] .dynamic-author-image-rounded{border-radius:100%}
|
||||
.components-generatepress-units-control-header__units{align-items:center;display:flex;justify-content:space-between;margin-bottom:5px}.components-generatepress-control__units .components-generatepress-control-buttons__units button.components-button{background:#fff;border:0;border-radius:0!important;box-shadow:none!important;color:#929da7;font-size:10px;height:auto;line-height:20px;padding:0 5px;position:relative;text-align:center;text-shadow:none}.components-generatepress-control__units .components-generatepress-control-buttons__units button.components-button.is-primary{background:#fff!important;color:#000!important;cursor:default;font-weight:700;z-index:1}
|
||||
.editor-styles-wrapper .is-root-container>.wp-block{margin-right:auto;margin-left:auto;max-width:var(--gp-block-element-width)}.left-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout,.right-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout{padding:10px}.gpp-block-element-panel>.components-base-control{margin-bottom:20px}.gpp-block-element-panel .components-notice,.gpp-block-element-panel .components-notice .components-notice__content{margin:0}.gpp-element-panel-label .components-panel__body-toggle.components-button{display:flex;flex-direction:row-reverse;justify-content:flex-end}.gpp-element-panel-label .components-panel__body-toggle.components-button svg.components-panel__icon{margin:0 0 0 10px}button.gpp-block-elements-template-button{background:#fff;border:1px solid #ddd;border-radius:5px;cursor:pointer;margin:0 0 10px;padding:5px}button.gpp-block-elements-template-button:hover{border-color:var(--wp-admin-theme-color)}button.gpp-block-elements-template-button .gpp-block-template-label{color:#888;font-size:13px;padding:5px}.element-has-parent #generate_premium_elements{display:none}.gpp-block-element-template-panel{background:#fafafa}
|
||||
.gp-select-search .select-search-container{--select-search-background:#fff;--select-search-border:#949494;--select-search-selected:var(--wp-admin-theme-color);--select-search-text:#2c3338;--select-search-subtle-text:#6c6f85;--select-search-inverted-text:var(--select-search-background);--select-search-highlight:#eff1f5;box-sizing:border-box;color:var(--select-search-text);font-family:var(--select-search-font);position:relative;width:100%}.gp-select-search .select-search-container *,.gp-select-search .select-search-container :after,.gp-select-search .select-search-container :before{box-sizing:inherit}.gp-select-search .select-search-input{-webkit-appearance:none;border:1px solid var(--select-search-border);border-radius:3px;color:var(--select-search-text);display:block;font-size:13px;height:30px;letter-spacing:.01rem;line-height:30px;outline:none;padding:0 8px 0 26px;position:relative;text-align:right;text-overflow:ellipsis;width:100%;z-index:1;-webkit-font-smoothing:antialiased;background:var(--select-search-background) url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E") no-repeat left 5px top 55%;background-size:13px 13px}.gp-select-search .select-search-is-multiple .select-search-input{border-radius:3px 3px 0 0;margin-bottom:-2px}.gp-select-search .select-search-input::-webkit-search-cancel-button,.gp-select-search .select-search-input::-webkit-search-decoration,.gp-select-search .select-search-input::-webkit-search-results-button,.gp-select-search .select-search-input::-webkit-search-results-decoration{-webkit-appearance:none}.gp-select-search .select-search-input[readonly]{cursor:pointer}.gp-select-search .select-search-is-disabled .select-search-input{cursor:not-allowed}.gp-select-search .select-search-container:not(.select-search-is-disabled) .select-search-input:hover,.gp-select-search .select-search-container:not(.select-search-is-disabled).select-search-has-focus .select-search-input{border-color:var(--select-search-selected)}.gp-select-search .select-search-select{background:var(--select-search-background);border:1px solid var(--select-search-border);box-shadow:0 .0625rem .125rem #00000026;max-height:360px;overflow:auto}.gp-select-search .select-search-container:not(.select-search-is-multiple) .select-search-select{border-radius:3px;display:none;right:0;position:absolute;left:0;top:35px;z-index:2}.gp-select-search .select-search-container:not(.select-search-is-multiple).select-search-has-focus .select-search-select{display:block}.gp-select-search .select-search-has-focus .select-search-select{border-color:var(--select-search-selected)}.gp-select-search .select-search-options{list-style:none}.gp-select-search .select-search-not-found,.gp-select-search .select-search-option{background:var(--select-search-background);border:none;color:var(--select-search-text);cursor:pointer;display:block;font-family:monospace;font-size:11px;height:30px;letter-spacing:.01rem;outline:none;padding:0 8px;text-align:right;width:100%;-webkit-font-smoothing:antialiased}.gp-select-search .select-search-option:disabled{background:#0000!important;cursor:not-allowed;opacity:.5}.gp-select-search .select-search-is-highlighted,.gp-select-search .select-search-option:not(.select-search-is-selected):hover{background:var(--select-search-highlight)}.gp-select-search .select-search-is-selected{color:var(--select-search-selected);font-weight:700}.gp-select-search .select-search-group-header{font-size:12px;font-weight:700;letter-spacing:.1rem;padding:10px 8px;text-transform:uppercase}
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-server-side-render'), 'version' => 'cf85acaca6a9b96dc3a3');
|
||||
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-server-side-render'), 'version' => '3e4b04d9f2c101e0232f');
|
||||
|
@ -4,4 +4,4 @@
|
||||
.wp-block[data-type="generatepress/dynamic-image"]{color:#fff;margin-bottom:0;margin-top:0}.wp-block[data-type="generatepress/dynamic-image"] .components-gpp-dynamic-image-placeholder__label{align-items:center;bottom:0;color:#fff;display:flex;font-size:1em;justify-content:center;left:0;position:absolute;right:0;top:0}.wp-block[data-type="generatepress/dynamic-image"] .components-gpp-dynamic-image-placeholder__label>.gpp-dynamic-featured-image__label{margin-left:10px}.wp-block[data-type="generatepress/dynamic-image"] .gpp-dynamic-image-placeholder{background:#000;vertical-align:middle}.wp-block[data-type="generatepress/dynamic-image"] .components-placeholder{width:100%}.wp-block[data-type="generatepress/dynamic-image"] .gpp-dynamic-image-preview{display:inline-block;position:relative}.wp-block[data-type="generatepress/dynamic-image"] .dynamic-author-image-rounded{border-radius:100%}
|
||||
.components-generatepress-units-control-header__units{align-items:center;display:flex;justify-content:space-between;margin-bottom:5px}.components-generatepress-control__units .components-generatepress-control-buttons__units button.components-button{background:#fff;border:0;border-radius:0!important;box-shadow:none!important;color:#929da7;font-size:10px;height:auto;line-height:20px;padding:0 5px;position:relative;text-align:center;text-shadow:none}.components-generatepress-control__units .components-generatepress-control-buttons__units button.components-button.is-primary{background:#fff!important;color:#000!important;cursor:default;font-weight:700;z-index:1}
|
||||
.editor-styles-wrapper .is-root-container>.wp-block{margin-left:auto;margin-right:auto;max-width:var(--gp-block-element-width)}.left-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout,.right-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout{padding:10px}.gpp-block-element-panel>.components-base-control{margin-bottom:20px}.gpp-block-element-panel .components-notice,.gpp-block-element-panel .components-notice .components-notice__content{margin:0}.gpp-element-panel-label .components-panel__body-toggle.components-button{display:flex;flex-direction:row-reverse;justify-content:flex-end}.gpp-element-panel-label .components-panel__body-toggle.components-button svg.components-panel__icon{margin:0 10px 0 0}button.gpp-block-elements-template-button{background:#fff;border:1px solid #ddd;border-radius:5px;cursor:pointer;margin:0 0 10px;padding:5px}button.gpp-block-elements-template-button:hover{border-color:var(--wp-admin-theme-color)}button.gpp-block-elements-template-button .gpp-block-template-label{color:#888;font-size:13px;padding:5px}.element-has-parent #generate_premium_elements{display:none}.gpp-block-element-template-panel{background:#fafafa}
|
||||
.gp-select-search .select-search-container{--select-search-background:#fff;--select-search-border:#949494;--select-search-selected:var(--wp-admin-theme-color);--select-search-text:#2c3338;--select-search-subtle-text:#6c6f85;--select-search-inverted-text:var(--select-search-background);--select-search-highlight:#eff1f5;box-sizing:border-box;color:var(--select-search-text);font-family:var(--select-search-font);position:relative;width:100%}.gp-select-search .select-search-container *,.gp-select-search .select-search-container :after,.gp-select-search .select-search-container :before{box-sizing:inherit}.gp-select-search .select-search-input{-webkit-font-smoothing:antialiased;-webkit-appearance:none;background:var(--select-search-background) url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E") no-repeat right 5px top 55%;background-size:13px 13px;border:1px solid var(--select-search-border);border-radius:3px;color:var(--select-search-text);display:block;font-size:13px;height:30px;letter-spacing:.01rem;line-height:30px;outline:none;padding:0 26px 0 8px;position:relative;text-align:left;text-overflow:ellipsis;width:100%;z-index:1}.gp-select-search .select-search-is-multiple .select-search-input{border-radius:3px 3px 0 0;margin-bottom:-2px}.gp-select-search .select-search-input::-webkit-search-cancel-button,.gp-select-search .select-search-input::-webkit-search-decoration,.gp-select-search .select-search-input::-webkit-search-results-button,.gp-select-search .select-search-input::-webkit-search-results-decoration{-webkit-appearance:none}.gp-select-search .select-search-input[readonly]{cursor:pointer}.gp-select-search .select-search-is-disabled .select-search-input{cursor:not-allowed}.gp-select-search .select-search-container:not(.select-search-is-disabled) .select-search-input:hover,.gp-select-search .select-search-container:not(.select-search-is-disabled).select-search-has-focus .select-search-input{border-color:var(--select-search-selected)}.gp-select-search .select-search-select{background:var(--select-search-background);border:1px solid var(--select-search-border);box-shadow:0 .0625rem .125rem rgba(0,0,0,.15);max-height:360px;overflow:auto}.gp-select-search .select-search-container:not(.select-search-is-multiple) .select-search-select{border-radius:3px;display:none;left:0;position:absolute;right:0;top:35px;z-index:2}.gp-select-search .select-search-container:not(.select-search-is-multiple).select-search-has-focus .select-search-select{display:block}.gp-select-search .select-search-has-focus .select-search-select{border-color:var(--select-search-selected)}.gp-select-search .select-search-options{list-style:none}.gp-select-search .select-search-not-found,.gp-select-search .select-search-option{-webkit-font-smoothing:antialiased;background:var(--select-search-background);border:none;color:var(--select-search-text);cursor:pointer;display:block;font-family:monospace;font-size:10px;height:30px;letter-spacing:.01rem;outline:none;padding:0 16px;text-align:left;width:100%}.gp-select-search .select-search-option:disabled{background:transparent!important;cursor:not-allowed;opacity:.5}.gp-select-search .select-search-is-highlighted,.gp-select-search .select-search-option:not(.select-search-is-selected):hover{background:var(--select-search-highlight)}.gp-select-search .select-search-is-selected{color:var(--select-search-selected);font-weight:700}.gp-select-search .select-search-group-header{font-size:12px;font-weight:700;letter-spacing:.1rem;padding:10px 16px;text-transform:uppercase}
|
||||
.gp-select-search .select-search-container{--select-search-background:#fff;--select-search-border:#949494;--select-search-selected:var(--wp-admin-theme-color);--select-search-text:#2c3338;--select-search-subtle-text:#6c6f85;--select-search-inverted-text:var(--select-search-background);--select-search-highlight:#eff1f5;box-sizing:border-box;color:var(--select-search-text);font-family:var(--select-search-font);position:relative;width:100%}.gp-select-search .select-search-container *,.gp-select-search .select-search-container :after,.gp-select-search .select-search-container :before{box-sizing:inherit}.gp-select-search .select-search-input{-webkit-appearance:none;border:1px solid var(--select-search-border);border-radius:3px;color:var(--select-search-text);display:block;font-size:13px;height:30px;letter-spacing:.01rem;line-height:30px;outline:none;padding:0 26px 0 8px;position:relative;text-align:left;text-overflow:ellipsis;width:100%;z-index:1;-webkit-font-smoothing:antialiased;background:var(--select-search-background) url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E") no-repeat right 5px top 55%;background-size:13px 13px}.gp-select-search .select-search-is-multiple .select-search-input{border-radius:3px 3px 0 0;margin-bottom:-2px}.gp-select-search .select-search-input::-webkit-search-cancel-button,.gp-select-search .select-search-input::-webkit-search-decoration,.gp-select-search .select-search-input::-webkit-search-results-button,.gp-select-search .select-search-input::-webkit-search-results-decoration{-webkit-appearance:none}.gp-select-search .select-search-input[readonly]{cursor:pointer}.gp-select-search .select-search-is-disabled .select-search-input{cursor:not-allowed}.gp-select-search .select-search-container:not(.select-search-is-disabled) .select-search-input:hover,.gp-select-search .select-search-container:not(.select-search-is-disabled).select-search-has-focus .select-search-input{border-color:var(--select-search-selected)}.gp-select-search .select-search-select{background:var(--select-search-background);border:1px solid var(--select-search-border);box-shadow:0 .0625rem .125rem #00000026;max-height:360px;overflow:auto}.gp-select-search .select-search-container:not(.select-search-is-multiple) .select-search-select{border-radius:3px;display:none;left:0;position:absolute;right:0;top:35px;z-index:2}.gp-select-search .select-search-container:not(.select-search-is-multiple).select-search-has-focus .select-search-select{display:block}.gp-select-search .select-search-has-focus .select-search-select{border-color:var(--select-search-selected)}.gp-select-search .select-search-options{list-style:none}.gp-select-search .select-search-not-found,.gp-select-search .select-search-option{background:var(--select-search-background);border:none;color:var(--select-search-text);cursor:pointer;display:block;font-family:monospace;font-size:11px;height:30px;letter-spacing:.01rem;outline:none;padding:0 8px;text-align:left;width:100%;-webkit-font-smoothing:antialiased}.gp-select-search .select-search-option:disabled{background:#0000!important;cursor:not-allowed;opacity:.5}.gp-select-search .select-search-is-highlighted,.gp-select-search .select-search-option:not(.select-search-is-selected):hover{background:var(--select-search-highlight)}.gp-select-search .select-search-is-selected{color:var(--select-search-selected);font-weight:700}.gp-select-search .select-search-group-header{font-size:12px;font-weight:700;letter-spacing:.1rem;padding:10px 8px;text-transform:uppercase}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('wp-hooks', 'wp-i18n'), 'version' => '4ec1543129b0728cd3b0');
|
||||
<?php return array('dependencies' => array('wp-hooks', 'wp-i18n'), 'version' => '542c4e5db7eed60770ec');
|
||||
|
@ -1 +1 @@
|
||||
!function(){"use strict";function e(o){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(o)}function o(o){var r=function(o,r){if("object"!==e(o)||null===o)return o;var t=o[Symbol.toPrimitive];if(void 0!==t){var n=t.call(o,"string");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(o);return"symbol"===e(r)?r:String(r)}var r=window.wp.hooks,t=window.wp.i18n;function n(e,o){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);o&&(t=t.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),r.push.apply(r,t)}return r}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){var n,a,i;n=e,a=r,i=t[r],(a=o(a))in n?Object.defineProperty(n,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[a]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}))}return e}(0,r.addFilter)("generate_typography_element_groups","generatepress-pro/customizer/add-typography-groups",(function(e){var o={};return gpCustomizerControls.hasSecondaryNav&&(o.secondaryNavigation=(0,t.__)("Secondary Navigation","gp-premium")),gpCustomizerControls.hasMenuPlus&&(o.offCanvasPanel=(0,t.__)("Off-Canvas Panel","gp-premium")),gpCustomizerControls.hasWooCommerce&&(o.wooCommerce=(0,t.__)("WooCommerce","gp-premium")),a(a({},e),o)})),(0,r.addFilter)("generate_typography_elements","generatepress-pro/customizer/add-typography-elements",(function(e){var o={};return gpCustomizerControls.hasSecondaryNav&&(o["secondary-nav-menu-items"]={module:"secondary-nav",group:"secondaryNavigation",label:(0,t.__)("Secondary Menu Items","gp-premium"),placeholders:{fontSize:{value:"13",min:6,max:30,step:1}}},o["secondary-nav-sub-menu-items"]={module:"secondary-nav",group:"secondaryNavigation",label:(0,t.__)("Secondary Sub-Menu Items","gp-premium"),placeholders:{fontSize:{value:"12",min:6,max:30,step:1}}},o["secondary-nav-menu-toggle"]={module:"secondary-nav",group:"secondaryNavigation",label:(0,t.__)("Secondary Mobile Menu Toggle","gp-premium"),placeholders:{fontSize:{value:"13",min:6,max:30,step:1}}}),gpCustomizerControls.hasMenuPlus&&(o["off-canvas-panel-menu-items"]={module:"off-canvas-panel",group:"offCanvasPanel",label:(0,t.__)("Off-Canvas Menu Items","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:30,step:1}}},o["off-canvas-panel-sub-menu-items"]={module:"off-canvas-panel",group:"offCanvasPanel",label:(0,t.__)("Off-Canvas Sub-Menu Items","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:30,step:1}}}),gpCustomizerControls.hasWooCommerce&&(o["woocommerce-catalog-product-titles"]={module:"woocommerce",group:"wooCommerce",label:(0,t.__)("Catalog Product Titles","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:50,step:1}}},o["woocommerce-related-product-titles"]={module:"woocommerce",group:"wooCommerce",label:(0,t.__)("Related/Upsell Product Titles","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:50,step:1}}}),a(a({},e),o)}))}();
|
||||
(()=>{"use strict";const e=window.wp.hooks,o=window.wp.i18n;(0,e.addFilter)("generate_typography_element_groups","generatepress-pro/customizer/add-typography-groups",(function(e){const a={};return gpCustomizerControls.hasSecondaryNav&&(a.secondaryNavigation=(0,o.__)("Secondary Navigation","gp-premium")),gpCustomizerControls.hasMenuPlus&&(a.offCanvasPanel=(0,o.__)("Off-Canvas Panel","gp-premium")),gpCustomizerControls.hasWooCommerce&&(a.wooCommerce=(0,o.__)("WooCommerce","gp-premium")),{...e,...a}})),(0,e.addFilter)("generate_typography_elements","generatepress-pro/customizer/add-typography-elements",(function(e){const a={};return gpCustomizerControls.hasSecondaryNav&&(a["secondary-nav-menu-items"]={module:"secondary-nav",group:"secondaryNavigation",label:(0,o.__)("Secondary Menu Items","gp-premium"),placeholders:{fontSize:{value:"13",min:6,max:30,step:1}}},a["secondary-nav-sub-menu-items"]={module:"secondary-nav",group:"secondaryNavigation",label:(0,o.__)("Secondary Sub-Menu Items","gp-premium"),placeholders:{fontSize:{value:"12",min:6,max:30,step:1}}},a["secondary-nav-menu-toggle"]={module:"secondary-nav",group:"secondaryNavigation",label:(0,o.__)("Secondary Mobile Menu Toggle","gp-premium"),placeholders:{fontSize:{value:"13",min:6,max:30,step:1}}}),gpCustomizerControls.hasMenuPlus&&(a["off-canvas-panel-menu-items"]={module:"off-canvas-panel",group:"offCanvasPanel",label:(0,o.__)("Off-Canvas Menu Items","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:30,step:1}}},a["off-canvas-panel-sub-menu-items"]={module:"off-canvas-panel",group:"offCanvasPanel",label:(0,o.__)("Off-Canvas Sub-Menu Items","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:30,step:1}}}),gpCustomizerControls.hasWooCommerce&&(a["woocommerce-catalog-product-titles"]={module:"woocommerce",group:"wooCommerce",label:(0,o.__)("Catalog Product Titles","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:50,step:1}}},a["woocommerce-related-product-titles"]={module:"woocommerce",group:"wooCommerce",label:(0,o.__)("Related/Upsell Product Titles","gp-premium"),placeholders:{fontSize:{value:"",min:6,max:50,step:1}}}),{...e,...a}}))})();
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '0ab64c3a1832f10e060d');
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '6a732fdaaa86f685bd9f');
|
||||
|
File diff suppressed because one or more lines are too long
1
wp-content/plugins/gp-premium/dist/editor-rtl.css
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/editor-rtl.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.gpp-active-element-type{color:#555;font-size:11px;text-transform:uppercase}
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-edit-post', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-plugins'), 'version' => 'd1ae659d7b937f65b15d');
|
||||
<?php return array('dependencies' => array('react', 'wp-edit-post', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-plugins'), 'version' => '81f036c27194ee54b73d');
|
||||
|
2
wp-content/plugins/gp-premium/dist/editor.js
vendored
2
wp-content/plugins/gp-premium/dist/editor.js
vendored
@ -1 +1 @@
|
||||
!function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,c=void 0,c=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i),"symbol"===e(c)?c:String(c)),o)}var i,c}function n(e,t){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},n(e,t)}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}var o=window.React,i=window.wp.i18n,c=window.wp.plugins,l=window.wp.editPost,u=window.wp.element,a=window.wp.htmlEntities;function p(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,i=r(t);if(n){var c=r(this).constructor;o=Reflect.construct(i,arguments,c)}else o=i.apply(this,arguments);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(this,o)}}var f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)}(s,e);var r,c,f=p(s);function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),f.apply(this,arguments)}return r=s,(c=[{key:"render",value:function(){var e=gpPremiumEditor.activeElements;return!e||e.length<1?null:gpPremiumEditor.postTypeIsPublic?(0,o.createElement)(l.PluginDocumentSettingPanel,{name:"generatepress-elements-info",title:(0,i.__)("Active Elements","gp-premium"),className:"gpp-element-info-panel gpp-element-panel-label"},(0,o.createElement)(u.Fragment,null,(0,o.createElement)("ul",{className:"gpp-active-elements"},Object.keys(e).map((function(t,n){return(0,o.createElement)("li",{key:"gpp-active-block-element-".concat(n)},(0,o.createElement)("a",{href:e[t].url+"&action=edit"},(0,a.decodeEntities)(e[t].name))," ",(0,o.createElement)("span",{className:"gpp-active-element-type"},"- ",e[t].type))}))),(0,o.createElement)("a",{href:gpPremiumEditor.elementsUrl,className:"components-button is-secondary"},(0,i.__)("All Elements","gp-premium")))):null}}])&&t(r.prototype,c),Object.defineProperty(r,"prototype",{writable:!1}),s}(u.Component);(0,c.registerPlugin)("generatepress-elements-info-panel",{icon:null,render:f})}();
|
||||
(()=>{"use strict";const e=window.React,t=window.wp.i18n,n=window.wp.plugins,l=window.wp.editPost,i=window.wp.element,m=window.wp.htmlEntities;class s extends i.Component{render(){const n=gpPremiumEditor.activeElements;return!n||n.length<1?null:gpPremiumEditor.postTypeIsPublic?(0,e.createElement)(l.PluginDocumentSettingPanel,{name:"generatepress-elements-info",title:(0,t.__)("Active Elements","gp-premium"),className:"gpp-element-info-panel gpp-element-panel-label"},(0,e.createElement)(i.Fragment,null,(0,e.createElement)("ul",{className:"gpp-active-elements"},Object.keys(n).map(((t,l)=>(0,e.createElement)("li",{key:`gpp-active-block-element-${l}`},(0,e.createElement)("a",{href:n[t].url+"&action=edit"},(0,m.decodeEntities)(n[t].name))," ",(0,e.createElement)("span",{className:"gpp-active-element-type"},"- ",n[t].type))))),(0,e.createElement)("a",{href:gpPremiumEditor.elementsUrl,className:"components-button is-secondary"},(0,t.__)("All Elements","gp-premium")))):null}}(0,n.registerPlugin)("generatepress-elements-info-panel",{icon:null,render:s})})();
|
1
wp-content/plugins/gp-premium/dist/font-library-rtl.css
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/font-library-rtl.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.gp-font-library{box-sizing:border-box;margin:40px auto 0;max-width:1200px;padding:0 20px}.gp-font-library .components-tab-panel__tabs{background-color:#fff;border-bottom:1px solid #e7e7e7}.gp-font-library .components-tab-panel__tabs .components-tab-panel__tabs-item{padding:30px 20px}.gp-font-library .components-tab-panel__tabs .components-tab-panel__tabs-item.active-tab{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}.gp-font-library .components-tab-panel__tabs .components-tab-panel__tabs-item:first-child{margin-right:20px}.gp-font-library .components-tab-panel__tabs .gp-tab-header{font-size:14px}.gp-font-library .components-tab-panel__tab-content{background-color:#fff;box-sizing:border-box;margin:0 auto;max-width:1200px;min-height:600px;padding:30px 40px}.gp-font-library .components-tab-panel__tab-content h2{font-size:20px;line-height:1.2em;margin-bottom:20px;margin-top:0}.gp-font-library__text{max-width:700px}.gp-font-library__list{font-size:16px}.gp-font-library__list li{margin-bottom:0}.gp-font-library__list li+li{margin-top:-1px}.gp-font-library__notice{margin-bottom:30px}.gp-font-library__results li{align-items:center;display:flex;gap:2px}.gp-font-library__result--success svg{fill:#4ab866}.gp-font-library__result--failure svg{fill:#cc1818}.gp-font-library-authorize-fonts{border:1px solid #aaa;border-radius:3px;margin:50px auto 0;max-width:350px;padding:25px}.gp-font-library-authorize-fonts h3{font-size:1.5em;margin-top:10px}.gp-font-library-authorize-fonts .components-button{margin:10px 0}.gp-font-library-variant{padding:30px}.gp-font-library-variant__header{display:flex;justify-content:space-between}.gp-font-library-variant__label{color:#777;font-size:14px}.gp-font-library-card{align-items:center;border:1px solid #e0e0e0;display:flex;font-style:italic;gap:10px;height:auto;padding:16px;text-align:right;width:100%}.gp-font-library-card :where(input,label),.gp-font-library-card:where(button,a){cursor:pointer}.gp-font-library-card+.gp-font-library-card{margin-top:-1px}.gp-font-library-card__variants{align-items:center;display:flex;gap:10px;margin-right:auto}.gp-font-library-card__categories{margin:auto;min-width:7.69em;text-transform:capitalize}.gp-font-library-card .gp-font-library-preview{min-width:25%}.gp-font-library-card:hover img{filter:invert(39%) sepia(67%) saturate(7078%) hue-rotate(213deg) brightness(96%) contrast(98%)}.gp-font-library-preview{align-items:center;display:flex;font-style:normal}.gp-font-library-preview__image{display:block;max-width:100%}.gp-font-library-preview__fallback{font-size:19px}.gp-font-library-edit h3{margin-top:20px}.gp-font-library-edit__control-notice{max-width:500px}.gp-font-library-edit__control label{display:block}.gp-font-library-edit__control .components-input-control__container,.gp-font-library-edit__control input[type=text]{max-width:250px!important}.gp-font-library-edit__footer{margin-top:40px}.gp-font-library-edit__variants{list-style:none;padding-right:0;width:250px}.gp-font-library-edit__variant{align-items:center;display:flex;justify-content:space-between}.gp-font-library-edit__variant .components-checkbox-control{--checkbox-input-size:24px}.gp-font-library-edit__variant .components-checkbox-control .components-base-control__field{align-items:center;display:flex}.gp-font-library-edit__variant--delete .components-checkbox-control{opacity:.5;text-decoration:line-through}.gp-font-library-edit__advanced{margin-bottom:20px}.gp-font-library-edit__advanced>.gb-stack{margin-top:20px}.gp-font-library-google__header-container{container-type:inline-size}.gp-font-library-google__header{align-items:flex-start;display:flex;margin-bottom:30px}.gp-font-library-google__header-content{flex-grow:1}.gp-font-library-google__header-content>:last-child{margin-bottom:0}.gp-font-library-google__header-content h2{margin-top:0}.gp-font-library-google__description{width:100%}.gp-font-library-google__filters{display:flex;flex-wrap:wrap;gap:10px;justify-content:space-between;margin-bottom:10px}.gp-font-library-google__filters select{height:40px!important}.gp-font-library-google__results{font-size:12px;font-style:italic;font-weight:500}.gp-font-library-google__results .components-button{margin-right:1em}.gp-font-library-google__pagination{align-items:flex-end;display:flex;gap:10px}.gp-font-library-google__pagination-numbers{align-items:center;display:flex;gap:10px;margin-left:auto}.gp-font-library-google__footer{align-items:center;display:flex;flex-wrap:wrap;gap:10px}.gp-font-library-settings{width:500px}.gp-font-library-settings__controls{margin-bottom:40px}.gp-font-library-settings__controls .components-base-control>:last-child{margin-bottom:0}.gp-font-library-settings__auth{background-color:#cc181833;border:1px solid #cc1818;border-radius:4px;font-size:14px;padding:10px}.gp-font-library-settings__auth :first-child{margin-top:0}.gp-font-library-settings__auth :last-child{margin-bottom:0}
|
1
wp-content/plugins/gp-premium/dist/font-library.asset.php
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/font-library.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '70fe87ecb0efc8fb0659');
|
1
wp-content/plugins/gp-premium/dist/font-library.css
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/font-library.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.gp-font-library{box-sizing:border-box;margin:40px auto 0;max-width:1200px;padding:0 20px}.gp-font-library .components-tab-panel__tabs{background-color:#fff;border-bottom:1px solid #e7e7e7}.gp-font-library .components-tab-panel__tabs .components-tab-panel__tabs-item{padding:30px 20px}.gp-font-library .components-tab-panel__tabs .components-tab-panel__tabs-item.active-tab{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}.gp-font-library .components-tab-panel__tabs .components-tab-panel__tabs-item:first-child{margin-left:20px}.gp-font-library .components-tab-panel__tabs .gp-tab-header{font-size:14px}.gp-font-library .components-tab-panel__tab-content{background-color:#fff;box-sizing:border-box;margin:0 auto;max-width:1200px;min-height:600px;padding:30px 40px}.gp-font-library .components-tab-panel__tab-content h2{font-size:20px;line-height:1.2em;margin-bottom:20px;margin-top:0}.gp-font-library__text{max-width:700px}.gp-font-library__list{font-size:16px}.gp-font-library__list li{margin-bottom:0}.gp-font-library__list li+li{margin-top:-1px}.gp-font-library__notice{margin-bottom:30px}.gp-font-library__results li{align-items:center;display:flex;gap:2px}.gp-font-library__result--success svg{fill:#4ab866}.gp-font-library__result--failure svg{fill:#cc1818}.gp-font-library-authorize-fonts{border:1px solid #aaa;border-radius:3px;margin:50px auto 0;max-width:350px;padding:25px}.gp-font-library-authorize-fonts h3{font-size:1.5em;margin-top:10px}.gp-font-library-authorize-fonts .components-button{margin:10px 0}.gp-font-library-variant{padding:30px}.gp-font-library-variant__header{display:flex;justify-content:space-between}.gp-font-library-variant__label{color:#777;font-size:14px}.gp-font-library-card{align-items:center;border:1px solid #e0e0e0;display:flex;font-style:italic;gap:10px;height:auto;padding:16px;text-align:left;width:100%}.gp-font-library-card :where(input,label),.gp-font-library-card:where(button,a){cursor:pointer}.gp-font-library-card+.gp-font-library-card{margin-top:-1px}.gp-font-library-card__variants{align-items:center;display:flex;gap:10px;margin-left:auto}.gp-font-library-card__categories{margin:auto;min-width:7.69em;text-transform:capitalize}.gp-font-library-card .gp-font-library-preview{min-width:25%}.gp-font-library-card:hover img{filter:invert(39%) sepia(67%) saturate(7078%) hue-rotate(213deg) brightness(96%) contrast(98%)}.gp-font-library-preview{align-items:center;display:flex;font-style:normal}.gp-font-library-preview__image{display:block;max-width:100%}.gp-font-library-preview__fallback{font-size:19px}.gp-font-library-edit h3{margin-top:20px}.gp-font-library-edit__control-notice{max-width:500px}.gp-font-library-edit__control label{display:block}.gp-font-library-edit__control .components-input-control__container,.gp-font-library-edit__control input[type=text]{max-width:250px!important}.gp-font-library-edit__footer{margin-top:40px}.gp-font-library-edit__variants{list-style:none;padding-left:0;width:250px}.gp-font-library-edit__variant{align-items:center;display:flex;justify-content:space-between}.gp-font-library-edit__variant .components-checkbox-control{--checkbox-input-size:24px}.gp-font-library-edit__variant .components-checkbox-control .components-base-control__field{align-items:center;display:flex}.gp-font-library-edit__variant--delete .components-checkbox-control{opacity:.5;text-decoration:line-through}.gp-font-library-edit__advanced{margin-bottom:20px}.gp-font-library-edit__advanced>.gb-stack{margin-top:20px}.gp-font-library-google__header-container{container-type:inline-size}.gp-font-library-google__header{align-items:flex-start;display:flex;margin-bottom:30px}.gp-font-library-google__header-content{flex-grow:1}.gp-font-library-google__header-content>:last-child{margin-bottom:0}.gp-font-library-google__header-content h2{margin-top:0}.gp-font-library-google__description{width:100%}.gp-font-library-google__filters{display:flex;flex-wrap:wrap;gap:10px;justify-content:space-between;margin-bottom:10px}.gp-font-library-google__filters select{height:40px!important}.gp-font-library-google__results{font-size:12px;font-style:italic;font-weight:500}.gp-font-library-google__results .components-button{margin-left:1em}.gp-font-library-google__pagination{align-items:flex-end;display:flex;gap:10px}.gp-font-library-google__pagination-numbers{align-items:center;display:flex;gap:10px;margin-right:auto}.gp-font-library-google__footer{align-items:center;display:flex;flex-wrap:wrap;gap:10px}.gp-font-library-settings{width:500px}.gp-font-library-settings__controls{margin-bottom:40px}.gp-font-library-settings__controls .components-base-control>:last-child{margin-bottom:0}.gp-font-library-settings__auth{background-color:#cc181833;border:1px solid #cc1818;border-radius:4px;font-size:14px;padding:10px}.gp-font-library-settings__auth :first-child{margin-top:0}.gp-font-library-settings__auth :last-child{margin-bottom:0}
|
11
wp-content/plugins/gp-premium/dist/font-library.js
vendored
Normal file
11
wp-content/plugins/gp-premium/dist/font-library.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
wp-content/plugins/gp-premium/dist/packages-rtl.css
vendored
Normal file
2
wp-content/plugins/gp-premium/dist/packages-rtl.css
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.mnc9nIWbe_UvWqh_EGSg{position:relative;width:100%}.lvIdqq0VcOc4Fsgp6edt{display:flex;gap:0 4px}.JQD57VZha1Nz_puhbEGL{flex-grow:1;position:relative}.uPu9muJa3zAmugfyIwKm[type=text]{appearance:none;border-color:#8c8f94;border-radius:3px;box-shadow:none;color:#2c3338;cursor:pointer;font-size:16px;line-height:2;min-height:30px;min-width:0;padding:0 8px 0 24px;vertical-align:middle;width:100%}@media(min-width:600px){.uPu9muJa3zAmugfyIwKm[type=text]{font-size:13px}}.uPu9muJa3zAmugfyIwKm[type=text].WNS5v6eZssWgR0abiuiV{outline-offset:2px}.uPu9muJa3zAmugfyIwKm[type=text].MgYZFTRJHzGT5kJMx1EN{padding-left:44px}.BI9El7N6XuVkzJ0yYqjN{display:block;height:12px;width:12px}.FIMlw2_F2weKvrhreh8G{background:#0000;border:none;box-shadow:none;height:100%;left:0;top:0}.FIMlw2_F2weKvrhreh8G,.HfEDCyNjbWPw8DWxXwEJ{position:absolute}.HfEDCyNjbWPw8DWxXwEJ{background-color:#fff;border:1px solid #d3d6d9;color:#0b0c0c;margin:8px 0 0;max-height:342px;overflow-x:hidden;padding:0;transform:translateZ(0);width:calc(100% - 2px);z-index:200}.HfEDCyNjbWPw8DWxXwEJ.GguvZjj87n5NGDn8J2P6{display:block}.HfEDCyNjbWPw8DWxXwEJ.BJaSrnsPhERUxtRDC6Vu{display:none}.GzNl93gsU8KelMCsQSyZ{border-bottom:1px solid #d3d6d9;border-right-width:0;border-left-width:0;border-top-width:1px;cursor:pointer;display:block;margin:0;padding:7px;position:relative}.GzNl93gsU8KelMCsQSyZ>*{pointer-events:none}.GzNl93gsU8KelMCsQSyZ:first-of-type{border-top-width:0}.GzNl93gsU8KelMCsQSyZ:last-of-type{border-bottom-width:0;margin-bottom:0}.GzNl93gsU8KelMCsQSyZ:where(:nth-child(odd)){background-color:#fafafa}.GzNl93gsU8KelMCsQSyZ.WNS5v6eZssWgR0abiuiV,.GzNl93gsU8KelMCsQSyZ:hover{background-color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));border-color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));color:#fff;outline:0}.kUveEVlY9D_n5Zmz_dXD{height:30px!important;min-width:16px!important;padding:0!important;position:absolute;left:24px;top:0;width:16px!important}@media(-ms-high-contrast:active),(forced-colors:active){.HfEDCyNjbWPw8DWxXwEJ{border-color:FieldText}.GzNl93gsU8KelMCsQSyZ{background-color:Field;color:FieldText}.GzNl93gsU8KelMCsQSyZ:hover,.HKlvLGhxs7ir32hUBNzQ{background-color:SelectedItem;border-color:SelectedItem;color:SelectedItemText;forced-color-adjust:none;outline-color:SelectedItemText}}.Uy2rTDWqjs4vgNH0aeBm .components-base-control__field{align-items:center;display:flex}.Uy2rTDWqjs4vgNH0aeBm .components-base-control__field .components-base-control__label{flex:1;margin:0}.qLXIpwst_CtGTtmsg3mN{height:auto;min-height:auto;padding:4px}.UVmA1eywUsKVQzLMDooq{background:linear-gradient(45deg,#0000 48%,#0003 0,#0003 52%,#0000 0);border:1px solid #0003;border-radius:50%;height:25px;width:25px}.eTonGpRD1VuB2tbLNegK .components-popover__content{max-width:365px;min-width:max-content;padding:15px}.eTonGpRD1VuB2tbLNegK .components-popover__content>div{padding:0}.eTonGpRD1VuB2tbLNegK .components-base-control__field{margin-bottom:0}.eTonGpRD1VuB2tbLNegK .react-colorful{width:100%!important}.eTonGpRD1VuB2tbLNegK .react-colorful .react-colorful__pointer{height:20px;width:20px}.eTonGpRD1VuB2tbLNegK .react-colorful .react-colorful__saturation{height:150px}.eTonGpRD1VuB2tbLNegK .components-circular-option-picker__option-wrapper{height:25px;width:25px}.nc5TMqH__oA5bcPGTm0D{display:flex;margin-top:15px}.nc5TMqH__oA5bcPGTm0D ._ubMuvqZvhc0awiEVNAL{flex:1}.nc5TMqH__oA5bcPGTm0D .f5wwshdAOOkfChALEoo2{height:auto}.nc5TMqH__oA5bcPGTm0D .components-base-control__field{margin-bottom:0}.OhNX_C7EMJcWKe5tqpKQ{margin-top:15px}.OhNX_C7EMJcWKe5tqpKQ .components-circular-option-picker{display:flex;flex-wrap:wrap}.OhNX_C7EMJcWKe5tqpKQ .components-circular-option-picker .components-circular-option-picker__swatches{display:flex;flex-wrap:wrap;gap:6px}.OhNX_C7EMJcWKe5tqpKQ .components-circular-option-picker .components-circular-option-picker__swatches .components-circular-option-picker__option-wrapper{margin:0}.mos6VIbAjooq2LMyKr88{display:flex;margin-top:15px}.mos6VIbAjooq2LMyKr88 .components-range-control{flex-grow:1;padding-right:5px}.UFXv660XisMp2k7oIkOA{margin:0}.cuno_GtO4bhcM59n00B2{--icon-size:1rem;display:grid;gap:.625rem;grid-template-columns:36px minmax(0,1fr);position:relative}.cuno_GtO4bhcM59n00B2 .components-button svg{display:block;height:var(--icon-size);width:var(--icon-size)}.fOOS92b6g0h9pAqn_2JI{border-radius:0;height:100%;position:relative;z-index:2}.rDe4XxEMyRee1hSKKXzn{display:flex;flex-wrap:wrap;gap:var(--gap,10px)}.Yg1nkwz9mFYMuk6zv1DW.b6i6J_7eUIspcsEZ3Qia>*+*{margin-inline-start:var(--gap,10px)}.dfG8sfdNVPzQp7pqgYJQ.b6i6J_7eUIspcsEZ3Qia>*+*{margin-block-start:var(--gap,10px)}.dfG8sfdNVPzQp7pqgYJQ.rDe4XxEMyRee1hSKKXzn{flex-direction:column}.l03h0IHl5WOI4XvelHt3{border-collapse:collapse;width:100%}.l03h0IHl5WOI4XvelHt3 td,.l03h0IHl5WOI4XvelHt3 th{box-sizing:border-box}.l03h0IHl5WOI4XvelHt3.pz9cxM_c8wpWcOh3bw5v tr:nth-child(2n){background-color:rgba(var(--wp-admin-theme-color--rgb),.04)}
|
||||
|
1
wp-content/plugins/gp-premium/dist/packages.asset.php
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/packages.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '50ca20852d9e1cd8d9dc');
|
2
wp-content/plugins/gp-premium/dist/packages.css
vendored
Normal file
2
wp-content/plugins/gp-premium/dist/packages.css
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.mnc9nIWbe_UvWqh_EGSg{position:relative;width:100%}.lvIdqq0VcOc4Fsgp6edt{display:flex;gap:0 4px}.JQD57VZha1Nz_puhbEGL{flex-grow:1;position:relative}.uPu9muJa3zAmugfyIwKm[type=text]{appearance:none;border-color:#8c8f94;border-radius:3px;box-shadow:none;color:#2c3338;cursor:pointer;font-size:16px;line-height:2;min-height:30px;min-width:0;padding:0 24px 0 8px;vertical-align:middle;width:100%}@media(min-width:600px){.uPu9muJa3zAmugfyIwKm[type=text]{font-size:13px}}.uPu9muJa3zAmugfyIwKm[type=text].WNS5v6eZssWgR0abiuiV{outline-offset:2px}.uPu9muJa3zAmugfyIwKm[type=text].MgYZFTRJHzGT5kJMx1EN{padding-right:44px}.BI9El7N6XuVkzJ0yYqjN{display:block;height:12px;width:12px}.FIMlw2_F2weKvrhreh8G{background:#0000;border:none;box-shadow:none;height:100%;right:0;top:0}.FIMlw2_F2weKvrhreh8G,.HfEDCyNjbWPw8DWxXwEJ{position:absolute}.HfEDCyNjbWPw8DWxXwEJ{background-color:#fff;border:1px solid #d3d6d9;color:#0b0c0c;margin:8px 0 0;max-height:342px;overflow-x:hidden;padding:0;transform:translateZ(0);width:calc(100% - 2px);z-index:200}.HfEDCyNjbWPw8DWxXwEJ.GguvZjj87n5NGDn8J2P6{display:block}.HfEDCyNjbWPw8DWxXwEJ.BJaSrnsPhERUxtRDC6Vu{display:none}.GzNl93gsU8KelMCsQSyZ{border-bottom:1px solid #d3d6d9;border-left-width:0;border-right-width:0;border-top-width:1px;cursor:pointer;display:block;margin:0;padding:7px;position:relative}.GzNl93gsU8KelMCsQSyZ>*{pointer-events:none}.GzNl93gsU8KelMCsQSyZ:first-of-type{border-top-width:0}.GzNl93gsU8KelMCsQSyZ:last-of-type{border-bottom-width:0;margin-bottom:0}.GzNl93gsU8KelMCsQSyZ:where(:nth-child(odd)){background-color:#fafafa}.GzNl93gsU8KelMCsQSyZ.WNS5v6eZssWgR0abiuiV,.GzNl93gsU8KelMCsQSyZ:hover{background-color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));border-color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));color:#fff;outline:0}.kUveEVlY9D_n5Zmz_dXD{height:30px!important;min-width:16px!important;padding:0!important;position:absolute;right:24px;top:0;width:16px!important}@media(-ms-high-contrast:active),(forced-colors:active){.HfEDCyNjbWPw8DWxXwEJ{border-color:FieldText}.GzNl93gsU8KelMCsQSyZ{background-color:Field;color:FieldText}.GzNl93gsU8KelMCsQSyZ:hover,.HKlvLGhxs7ir32hUBNzQ{background-color:SelectedItem;border-color:SelectedItem;color:SelectedItemText;forced-color-adjust:none;outline-color:SelectedItemText}}.Uy2rTDWqjs4vgNH0aeBm .components-base-control__field{align-items:center;display:flex}.Uy2rTDWqjs4vgNH0aeBm .components-base-control__field .components-base-control__label{flex:1;margin:0}.qLXIpwst_CtGTtmsg3mN{height:auto;min-height:auto;padding:4px}.UVmA1eywUsKVQzLMDooq{background:linear-gradient(-45deg,#0000 48%,#0003 0,#0003 52%,#0000 0);border:1px solid #0003;border-radius:50%;height:25px;width:25px}.eTonGpRD1VuB2tbLNegK .components-popover__content{max-width:365px;min-width:max-content;padding:15px}.eTonGpRD1VuB2tbLNegK .components-popover__content>div{padding:0}.eTonGpRD1VuB2tbLNegK .components-base-control__field{margin-bottom:0}.eTonGpRD1VuB2tbLNegK .react-colorful{width:100%!important}.eTonGpRD1VuB2tbLNegK .react-colorful .react-colorful__pointer{height:20px;width:20px}.eTonGpRD1VuB2tbLNegK .react-colorful .react-colorful__saturation{height:150px}.eTonGpRD1VuB2tbLNegK .components-circular-option-picker__option-wrapper{height:25px;width:25px}.nc5TMqH__oA5bcPGTm0D{display:flex;margin-top:15px}.nc5TMqH__oA5bcPGTm0D ._ubMuvqZvhc0awiEVNAL{flex:1}.nc5TMqH__oA5bcPGTm0D .f5wwshdAOOkfChALEoo2{height:auto}.nc5TMqH__oA5bcPGTm0D .components-base-control__field{margin-bottom:0}.OhNX_C7EMJcWKe5tqpKQ{margin-top:15px}.OhNX_C7EMJcWKe5tqpKQ .components-circular-option-picker{display:flex;flex-wrap:wrap}.OhNX_C7EMJcWKe5tqpKQ .components-circular-option-picker .components-circular-option-picker__swatches{display:flex;flex-wrap:wrap;gap:6px}.OhNX_C7EMJcWKe5tqpKQ .components-circular-option-picker .components-circular-option-picker__swatches .components-circular-option-picker__option-wrapper{margin:0}.mos6VIbAjooq2LMyKr88{display:flex;margin-top:15px}.mos6VIbAjooq2LMyKr88 .components-range-control{flex-grow:1;padding-left:5px}.UFXv660XisMp2k7oIkOA{margin:0}.cuno_GtO4bhcM59n00B2{--icon-size:1rem;display:grid;gap:.625rem;grid-template-columns:36px minmax(0,1fr);position:relative}.cuno_GtO4bhcM59n00B2 .components-button svg{display:block;height:var(--icon-size);width:var(--icon-size)}.fOOS92b6g0h9pAqn_2JI{border-radius:0;height:100%;position:relative;z-index:2}.rDe4XxEMyRee1hSKKXzn{display:flex;flex-wrap:wrap;gap:var(--gap,10px)}.Yg1nkwz9mFYMuk6zv1DW.b6i6J_7eUIspcsEZ3Qia>*+*{margin-inline-start:var(--gap,10px)}.dfG8sfdNVPzQp7pqgYJQ.b6i6J_7eUIspcsEZ3Qia>*+*{margin-block-start:var(--gap,10px)}.dfG8sfdNVPzQp7pqgYJQ.rDe4XxEMyRee1hSKKXzn{flex-direction:column}.l03h0IHl5WOI4XvelHt3{border-collapse:collapse;width:100%}.l03h0IHl5WOI4XvelHt3 td,.l03h0IHl5WOI4XvelHt3 th{box-sizing:border-box}.l03h0IHl5WOI4XvelHt3.pz9cxM_c8wpWcOh3bw5v tr:nth-child(2n){background-color:rgba(var(--wp-admin-theme-color--rgb),.04)}
|
||||
|
0
wp-content/plugins/gp-premium/dist/packages.js
vendored
Normal file
0
wp-content/plugins/gp-premium/dist/packages.js
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/site-library-rtl.css
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/site-library-rtl.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '6e43dc7500e77c46bb9b');
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'a6719ff1717f5c4541f7');
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
wp-content/plugins/gp-premium/dist/style-dashboard-rtl.css
vendored
Normal file
4
wp-content/plugins/gp-premium/dist/style-dashboard-rtl.css
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.generatepress-module-action{display:inline-block;font-size:12px;font-weight:400;line-height:1;margin-right:10px;text-decoration:none}.generatepress-dashboard__section-item-settings{align-items:center;display:flex}.generatepress-dashboard__section-item-settings button{font-size:11px;height:30px;justify-content:center!important}.generatepress-dashboard__section-item-settings button .components-spinner{margin-top:0}.generatepress-dashboard__section-item-settings button svg{height:20px;margin:0!important;width:20px}.generatepress-dashboard__section-item-settings button:not(:last-child){margin-left:5px}
|
||||
.generatepress-license-key-area .generatepress-dashboard__section-item-message{background:#fff}.generatepress-license-key-area .generatepress-dashboard__section-item{flex-wrap:wrap;justify-content:flex-start}.generatepress-license-key-area .generatepress-dashboard__section-license-key{display:flex;flex:1}.generatepress-license-key-area .generatepress-dashboard__section-license-key .components-base-control{flex:1}.generatepress-license-key-area .generatepress-dashboard__section-license-key button{height:31px;margin-right:8px}.generatepress-license-key-area .generatepress-dashboard__section-beta-tester{align-items:center;display:flex;flex-basis:100%;margin-top:30px}.generatepress-license-key-area .generatepress-dashboard__section-license-notice{flex-basis:100%;margin:0 0 20px}.generatepress-license-key-area .components-base-control__field,.generatepress-license-key-area .components-base-control__help{margin-bottom:0}
|
||||
.generatepress-dashboard__section-item-action input[type=file]{border:1px solid #ddd;padding:5px}.generatepress-dashboard__section-item-export-popover .components-popover__content{padding:20px}
|
||||
.generatepress-dashboard__section-item-modules{margin-top:20px}
|
@ -46,9 +46,9 @@ td.generate-element-row-content {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
#generate_premium_elements .handlediv,
|
||||
#generate_premium_elements .hndle,
|
||||
#generate_premium_elements .postbox-header {
|
||||
.metabox-holder #generate_premium_elements .handlediv,
|
||||
.metabox-holder #generate_premium_elements .hndle,
|
||||
.metabox-holder #generate_premium_elements .postbox-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -140,6 +140,10 @@ ul.element-metabox-tabs {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.edit-post-layout__metaboxes ul.element-metabox-tabs {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ul.element-metabox-tabs li {
|
||||
width: auto;
|
||||
flex: none;
|
||||
|
@ -112,7 +112,7 @@ class GeneratePress_Elements_Helper {
|
||||
public static function should_execute_php() {
|
||||
$php = true;
|
||||
|
||||
if ( defined( 'DISALLOW_FILE_EDIT' ) ) {
|
||||
if ( defined( 'DISALLOW_FILE_EDIT' ) && true === DISALLOW_FILE_EDIT ) {
|
||||
$php = false;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ class GeneratePress_Elements_Metabox {
|
||||
*/
|
||||
public function register_metabox() {
|
||||
// Title not translated on purpose.
|
||||
add_meta_box( 'generate_premium_elements', 'Element', array( $this, 'element_fields' ), 'gp_elements', 'normal', 'high' );
|
||||
add_meta_box( 'generate_premium_elements', __( 'Display Rules', 'gp-premium' ), array( $this, 'element_fields' ), 'gp_elements', 'normal', 'high' );
|
||||
add_meta_box( 'generate_page_hero_template_tags', __( 'Template Tags', 'gp-premium' ), array( $this, 'template_tags' ), 'gp_elements', 'side', 'low' );
|
||||
remove_meta_box( 'slugdiv', 'gp_elements', 'normal' );
|
||||
}
|
||||
@ -279,7 +279,7 @@ class GeneratePress_Elements_Metabox {
|
||||
|
||||
<li data-type="hook" <?php echo ( 'hook' === $type || 'block' === $type ) ? 'class="is-selected" ' : ''; ?>data-tab="hook-settings">
|
||||
<a href="#">
|
||||
<?php echo 'block' === $type ? esc_attr__( 'Display Rules', 'gp-premium' ) : esc_attr__( 'Settings', 'gp-premium' ); ?>
|
||||
<?php echo 'block' === $type ? esc_attr__( 'Rules', 'gp-premium' ) : esc_attr__( 'Settings', 'gp-premium' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
@ -93,6 +93,7 @@ function generate_elements_dashboard_tab( $tabs ) {
|
||||
'name' => __( 'Elements', 'gp-premium' ),
|
||||
'url' => admin_url( 'edit.php?post_type=gp_elements' ),
|
||||
'class' => 'edit-gp_elements' === $screen->id ? 'active' : '',
|
||||
'id' => 'gp-elements-tab',
|
||||
);
|
||||
|
||||
return $tabs;
|
||||
|
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Font Library CPT.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
/**
|
||||
* Font library CPT class.
|
||||
*/
|
||||
class GeneratePress_Pro_Font_Library_CPT extends GeneratePress_Pro_Singleton {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function init() {
|
||||
add_action( 'init', array( $this, 'register_cpt' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up our custom post type.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*/
|
||||
public function register_cpt() {
|
||||
$labels = array(
|
||||
'name' => _x( 'Fonts', 'Post Type General Name', 'gp-premium' ),
|
||||
'singular_name' => _x( 'Font', 'Post Type Singular Name', 'gp-premium' ),
|
||||
'menu_name' => __( 'Fonts', 'gp-premium' ),
|
||||
'all_items' => __( 'All Fonts', 'gp-premium' ),
|
||||
'add_new' => __( 'Add New Font', 'gp-premium' ),
|
||||
'add_new_item' => __( 'Add New Font', 'gp-premium' ),
|
||||
'new_item' => __( 'New Font', 'gp-premium' ),
|
||||
'edit_item' => __( 'Edit Font', 'gp-premium' ),
|
||||
'update_item' => __( 'Update Font', 'gp-premium' ),
|
||||
'search_items' => __( 'Search Font', 'gp-premium' ),
|
||||
'item_published' => __( 'Font published.', 'gp-premium' ),
|
||||
'item_updated' => __( 'Font updated.', 'gp-premium' ),
|
||||
'item_scheduled' => __( 'Font scheduled.', 'gp-premium' ),
|
||||
'item_reverted_to_draft' => __( 'Font reverted to draft.', 'gp-premium' ),
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'labels' => $labels,
|
||||
'supports' => array( 'title', 'custom-fields' ),
|
||||
'hierarchical' => false,
|
||||
'public' => false,
|
||||
'show_ui' => false,
|
||||
'show_in_menu' => true,
|
||||
'has_archive' => false,
|
||||
'exclude_from_search' => true,
|
||||
'show_in_rest' => true,
|
||||
);
|
||||
|
||||
register_post_type( GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT, $args );
|
||||
|
||||
// Font variants.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_variants',
|
||||
array(
|
||||
'type' => 'array',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// Font family alias.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_family_alias',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// Font display value.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_display',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// Font source.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_source',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// Font family fallback.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_fallback',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// Font family preview.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_preview',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// Font family variable.
|
||||
register_post_meta(
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'gp_font_variable',
|
||||
array(
|
||||
'type' => 'string',
|
||||
'show_in_rest' => false,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Pro_Font_Library_CPT::get_instance()->init();
|
@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* Font Optimizations
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
/**
|
||||
* Font library class.
|
||||
*/
|
||||
class GeneratePress_Pro_Font_Library_Optimize extends GeneratePress_Pro_Singleton {
|
||||
/**
|
||||
* User Agent to be used to make requests to the Google Fonts API.
|
||||
*/
|
||||
const USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0';
|
||||
|
||||
/**
|
||||
* Get the optimized font variants for download.
|
||||
*
|
||||
* @param array $font Array of data for the font to optimize.
|
||||
* @param array $variants The variants to optimize.
|
||||
*
|
||||
* @return array The fonts object.
|
||||
*/
|
||||
public static function get_variants( $font, $variants ) {
|
||||
$font_family = $font['name'] ?? '';
|
||||
$slug = $font['slug'] ?? '';
|
||||
|
||||
$variants = wp_list_sort(
|
||||
wp_list_sort( $variants, 'fontWeight', 'ASC' ),
|
||||
'fontStyle',
|
||||
'DESC'
|
||||
);
|
||||
|
||||
$fonts_object = self::convert_to_fonts_object(
|
||||
self::fetch_stylesheet(
|
||||
$font_family,
|
||||
$variants
|
||||
)
|
||||
);
|
||||
|
||||
return $fonts_object[ $slug ]['variants'] ?? $fonts_object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL for the google fonts stylesheet to fetch.
|
||||
*
|
||||
* @param string $font_family The font-family name with no fallback.
|
||||
* @param array $variants The list of variants to include.
|
||||
* @return string
|
||||
*/
|
||||
private static function get_google_css_url( $font_family, $variants ) {
|
||||
$encoded_name = str_replace( ' ', '+', $font_family );
|
||||
$weights = wp_list_pluck( $variants, 'fontWeight' );
|
||||
$styles = wp_list_pluck( $variants, 'fontStyle' );
|
||||
$has_italics = in_array( 'italic', $styles, true );
|
||||
// Build the URL.
|
||||
$url = 'https://fonts.googleapis.com/css2?family=' . $encoded_name;
|
||||
|
||||
// If there's only one variant and it's regular, return the URL immediately.
|
||||
$only_regular = count( $variants ) === 1 && 'normal' === $styles[0];
|
||||
if ( $only_regular ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
if ( $has_italics ) {
|
||||
$url .= ':ital,wght@';
|
||||
} else {
|
||||
$url .= ':wght@' . implode( ';', $weights );
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
// If some variants are italic, build the weight string.
|
||||
foreach ( $variants as $variant ) {
|
||||
|
||||
$is_italic = 'italic' === $variant['fontStyle'];
|
||||
$first_value = $is_italic ? 1 : 0;
|
||||
$url .= "{$first_value},{$variant['fontWeight']};";
|
||||
}
|
||||
|
||||
return rtrim( $url, ';' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Stylesheet.
|
||||
*
|
||||
* @param string $font_family The font-family name.
|
||||
* @param array $variants The variants to optimize.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function fetch_stylesheet( $font_family, $variants ) {
|
||||
$url = self::get_google_css_url( $font_family, $variants );
|
||||
|
||||
// Get the remote stylesheet.
|
||||
$response = wp_remote_get(
|
||||
$url,
|
||||
array(
|
||||
'user-agent' => self::USER_AGENT,
|
||||
)
|
||||
);
|
||||
|
||||
$code = wp_remote_retrieve_response_code( $response );
|
||||
|
||||
if ( 200 !== $code ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return wp_remote_retrieve_body( $response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the stylesheet and build it into a font object which OMGF can understand.
|
||||
*
|
||||
* @param string $stylesheet A valid CSS stylesheet.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function convert_to_fonts_object( $stylesheet ) {
|
||||
preg_match_all( '/font-family:\s\'(.*?)\';/', $stylesheet, $font_families );
|
||||
|
||||
if ( empty( $font_families[1] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$font_families = array_unique( $font_families[1] );
|
||||
$object = array();
|
||||
|
||||
foreach ( $font_families as $font_family ) {
|
||||
$slug = sanitize_title( $font_family );
|
||||
$object[ $slug ] = array(
|
||||
'slug' => $slug,
|
||||
'fontFamily' => $font_family,
|
||||
'variants' => self::parse_variants( $stylesheet, $font_family ),
|
||||
'subsets' => self::parse_subsets( $stylesheet, $font_family ),
|
||||
);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a stylesheet from Google Fonts' API into a valid Font Object.
|
||||
*
|
||||
* @param string $stylesheet The stylesheet to parse.
|
||||
* @param string $font_family The font family used in the parse.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function parse_variants( $stylesheet, $font_family ) {
|
||||
/**
|
||||
* This also captures the commented Subset name.
|
||||
*/
|
||||
preg_match_all( '/\/\*\s.*?}/s', $stylesheet, $font_faces );
|
||||
|
||||
if ( empty( $font_faces[0] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$font_object = array();
|
||||
|
||||
foreach ( $font_faces[0] as $font_face ) {
|
||||
// Check for exact match of font-family.
|
||||
if ( ! preg_match( '/font-family:[\s\'"]*?' . $font_family . '[\'"]?;/', $font_face ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match( '/font-style:\s(normal|italic);/', $font_face, $font_style );
|
||||
preg_match( '/font-weight:\s([0-9]+);/', $font_face, $font_weight );
|
||||
preg_match( '/src:\surl\((.*?woff2)\)/', $font_face, $font_src );
|
||||
preg_match( '/\/\*\s([a-z\-0-9\[\]]+?)\s\*\//', $font_face, $subset );
|
||||
preg_match( '/unicode-range:\s(.*?);/', $font_face, $range );
|
||||
|
||||
$subset = ! empty( $subset[1] ) ? trim( $subset[1], '[]' ) : '';
|
||||
|
||||
/**
|
||||
* Remove variants that have subset the user doesn't need.
|
||||
*/
|
||||
$allowed_subsets = apply_filters(
|
||||
'generatepress_google_font_subsets',
|
||||
GeneratePress_Pro_Font_Library::get_settings( 'preferred_subset' )
|
||||
);
|
||||
|
||||
if ( empty( $allowed_subsets ) ) {
|
||||
$allowed_subsets = array( 'latin' );
|
||||
}
|
||||
|
||||
if ( ! empty( $subset ) && ! in_array( $subset, $allowed_subsets, true ) && ! is_numeric( $subset ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* If $subset is empty, assume it's a logographic (Chinese, Japanese, etc.) character set.
|
||||
*
|
||||
* @TODO: Apply subset setting here.
|
||||
*/
|
||||
if ( is_numeric( $subset ) ) {
|
||||
$subset = 'logogram-' . $subset;
|
||||
}
|
||||
|
||||
$key = $subset . '-' . $font_weight[1] . ( 'normal' === $font_style[1] ? '' : '-' . $font_style[1] );
|
||||
|
||||
// Setup font object data.
|
||||
$font_object[ $key ] = array(
|
||||
'fontFamily' => $font_family,
|
||||
'fontStyle' => $font_style[1],
|
||||
'fontWeight' => $font_weight[1],
|
||||
'src' => $font_src[1],
|
||||
);
|
||||
|
||||
if ( ! empty( $subset ) ) {
|
||||
$font_object[ $key ]['subset'] = $subset;
|
||||
}
|
||||
|
||||
if ( ! empty( $range ) && isset( $range[1] ) ) {
|
||||
$font_object[ $key ]['range'] = $range[1];
|
||||
}
|
||||
}
|
||||
|
||||
return $font_object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse stylesheets for subsets, which in Google Fonts stylesheets are always
|
||||
* included, commented above each @font-face statements, e.g. /* latin-ext
|
||||
*
|
||||
* @param string $stylesheet The stylesheet to parse.
|
||||
* @param string $font_family The font family used in the parse.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function parse_subsets( $stylesheet, $font_family ) {
|
||||
|
||||
preg_match_all( '/\/\*\s([a-z\-]+?)\s\*\//', $stylesheet, $subsets );
|
||||
|
||||
if ( empty( $subsets[1] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$subsets = array_unique( $subsets[1] );
|
||||
|
||||
return $subsets;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,579 @@
|
||||
<?php
|
||||
/**
|
||||
* Rest API functions.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
/**
|
||||
* Font library REST API endpoints class.
|
||||
*/
|
||||
class GeneratePress_Pro_Font_Library_Rest extends WP_REST_Controller {
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @access private
|
||||
* @var object Instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'generatepress-font-library/v';
|
||||
|
||||
/**
|
||||
* Version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $version = '1';
|
||||
|
||||
/**
|
||||
* Initiator.
|
||||
*
|
||||
* @return object initialized object of class.
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* GenerateBlocks_Rest constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register rest routes.
|
||||
*/
|
||||
public function register_routes() {
|
||||
$namespace = $this->namespace . $this->version;
|
||||
|
||||
// Get fonts from CPT.
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/get-fonts/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_fonts' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Download a Google font.
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/download-google-font/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'download_google_font' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Upload a font.
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/upload-fonts/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'upload_fonts' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Delete a font family.
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/delete-font/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'delete_font' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Get font library settings.
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/get-settings/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_settings' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Set font library settings.
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/set-settings/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'set_settings' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/optimize-google-fonts/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'optimize_google_fonts' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/update-font-post/',
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'update_font_post' ),
|
||||
'permission_callback' => array( $this, 'edit_posts_permission' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font posts.
|
||||
*
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* @return array The response.
|
||||
*/
|
||||
public function get_fonts( WP_REST_Request $request ) {
|
||||
$name = $request->get_param( 'name' );
|
||||
$response = GeneratePress_Pro_Font_Library::get_fonts( $name );
|
||||
|
||||
return $this->success( $response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate font CSS.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function build_css_file() {
|
||||
|
||||
$result = GeneratePress_Pro_Font_Library::build_css_file();
|
||||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
return $this->error( 'font_css_generation_failed', __( 'Failed to generate font CSS.', 'gp-premium' ) );
|
||||
}
|
||||
|
||||
return $this->success( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a specific font from the library and the associated CPT post.
|
||||
*
|
||||
* @param WP_REST_Request $request request object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete_font( WP_REST_Request $request ) {
|
||||
$font_id = $request->get_param( 'fontId' );
|
||||
$slug = get_post_field( 'post_name', $font_id );
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$font_base_path = trailingslashit( $upload_dir['basedir'] ) . 'generatepress/fonts/' . $slug . '/';
|
||||
|
||||
// Delete the font post.
|
||||
$success = wp_delete_post( $font_id, true );
|
||||
|
||||
if ( ! $success ) {
|
||||
return $this->error(
|
||||
'font_post_delete_failed',
|
||||
__( 'Failed to delete font post.', 'gp-premium' )
|
||||
);
|
||||
}
|
||||
|
||||
// Delete the font sub folder if it exists.
|
||||
if ( file_exists( $font_base_path ) ) {
|
||||
GeneratePress_Pro_Font_Library::delete_directory( $font_base_path );
|
||||
}
|
||||
|
||||
// Regenerate the font CSS.
|
||||
$this->build_css_file();
|
||||
|
||||
// Return success.
|
||||
return $this->success( __( 'Font successfully deleted!', 'gp-premium' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a specific Google font and update the CPT.
|
||||
*
|
||||
* @param WP_REST_Request $request request object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function optimize_google_fonts( WP_REST_Request $request ) {
|
||||
$font = $request->get_param( 'font' ) ?? array();
|
||||
$variants = $request->get_param( 'variants' ) ?? array();
|
||||
|
||||
if ( ! $font || ! $variants ) {
|
||||
return $this->failed( 'No font or variants provided' );
|
||||
}
|
||||
|
||||
$optimized_variants = GeneratePress_Pro_Font_Library_Optimize::get_variants( $font, $variants );
|
||||
|
||||
if ( $optimized_variants ) {
|
||||
foreach ( $optimized_variants as $key => $optimized_variant ) {
|
||||
foreach ( $variants as &$variant ) {
|
||||
$style_match = $variant['fontStyle'] === $optimized_variant['fontStyle'];
|
||||
$weight_match = $variant['fontWeight'] === $optimized_variant['fontWeight'];
|
||||
|
||||
if ( $style_match && $weight_match ) {
|
||||
$variant['src'] = $optimized_variant['src'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success( $variants );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a font post exists by slug and create it if it doesn't exist.
|
||||
*
|
||||
* @param array $variant The font variant to check.
|
||||
* @param array $slug The font slug.
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_font_post( $variant, $slug ) {
|
||||
global $wpdb;
|
||||
|
||||
$font_post = $wpdb->get_row(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = %s",
|
||||
$slug,
|
||||
GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT
|
||||
)
|
||||
);
|
||||
|
||||
if ( $font_post ) {
|
||||
return $font_post->ID;
|
||||
}
|
||||
|
||||
$font_post = wp_insert_post(
|
||||
array(
|
||||
'post_title' => $variant['fontFamily'],
|
||||
'post_name' => $slug,
|
||||
'post_type' => GeneratePress_Pro_Font_Library::FONT_LIBRARY_CPT,
|
||||
'post_status' => 'publish',
|
||||
'wp_error' => true,
|
||||
'meta_input' => array(
|
||||
'gp_font_family_alias' => '',
|
||||
'gp_font_variants' => array(),
|
||||
'gp_font_display' => 'auto',
|
||||
'gp_font_fallback' => '',
|
||||
'gp_font_variable' => GeneratePress_Pro_Font_Library::CSS_VAR_PREFIX . $slug,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
return $font_post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a specific custom font and update the CPT.
|
||||
*
|
||||
* @param WP_REST_Request $request request object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function upload_fonts( WP_REST_Request $request ) {
|
||||
$font = $request->get_param( 'font' ) ?? array();
|
||||
$variants = $request->get_param( 'variants' );
|
||||
$source = $request->get_param( 'source' );
|
||||
$slug = $request->get_param( 'slug' ) ?? $font['slug'] ?? '';
|
||||
$results = array(
|
||||
'ID' => null,
|
||||
'variants' => array(),
|
||||
);
|
||||
|
||||
// Tweaks variants based on the source if needed.
|
||||
if ( 'custom' === $source ) {
|
||||
// Decode the FormData sent via POST.
|
||||
$variants = json_decode( $variants, true );
|
||||
}
|
||||
|
||||
foreach ( $variants as $variant ) {
|
||||
// Move the uploaded font asset from the temp folder to the fonts directory.
|
||||
if ( ! function_exists( 'wp_handle_upload' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
}
|
||||
|
||||
$file = $variant['src'];
|
||||
|
||||
// If custom assume the font is being uploaded.
|
||||
if ( 'custom' === $source ) {
|
||||
$file_params = $request->get_file_params();
|
||||
$file = $file_params[ $variant['src'] ] ?? $variant['src'];
|
||||
}
|
||||
|
||||
$font_file = GeneratePress_Pro_Font_Library::handle_font_file_upload( $variant, $slug, $file );
|
||||
|
||||
if ( is_wp_error( $font_file ) ) {
|
||||
$results['error'][] = array(
|
||||
'font' => $variant,
|
||||
'message' => $font_file->get_error_message(),
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the font post for this variant.
|
||||
$font_post = self::get_font_post( $variant, $slug );
|
||||
|
||||
if ( is_wp_error( $font_post ) ) {
|
||||
return $this->error( 500, __( 'Failed to create font post.', 'gp-premium' ) );
|
||||
}
|
||||
|
||||
if ( 'google' === $source ) {
|
||||
$font_family = explode( ', ', $font['fontFamily'] ?? '' );
|
||||
// Remove the main font-family.
|
||||
array_shift( $font_family );
|
||||
|
||||
// Set the fallback if we can infer one.
|
||||
if ( $font_family ) {
|
||||
$fallback = implode( ', ', $font_family );
|
||||
update_post_meta( $font_post, 'gp_font_fallback', $fallback );
|
||||
}
|
||||
}
|
||||
|
||||
$existing_variants = get_post_meta( $font_post, 'gp_font_variants', true );
|
||||
|
||||
if ( ! is_array( $variants ) ) {
|
||||
$existing_variants = array();
|
||||
}
|
||||
|
||||
$checked_variants = GeneratePress_Pro_Font_Library::check_variants(
|
||||
$existing_variants,
|
||||
array(
|
||||
'src' => $font_file['url'],
|
||||
'fontFamily' => $variant['fontFamily'],
|
||||
'fontStyle' => $variant['fontStyle'],
|
||||
'fontWeight' => $variant['fontWeight'],
|
||||
'name' => GeneratePress_Pro_Font_Library::get_variant_name( $variant ),
|
||||
'isVariable' => $variant['isVariable'] ?? false,
|
||||
'source' => 'custom',
|
||||
'disabled' => false,
|
||||
'preview' => '',
|
||||
)
|
||||
);
|
||||
|
||||
// Update the font post meta with merged variants.
|
||||
update_post_meta( $font_post, 'gp_font_variants', $checked_variants );
|
||||
|
||||
// Generate the font CSS.
|
||||
$generate_css = $this->build_css_file();
|
||||
|
||||
if ( false === $generate_css->success ) {
|
||||
return $this->error( 500, __( 'CSS Generation failed', 'gp-premium' ) );
|
||||
}
|
||||
|
||||
$results['ID'] = $font_post;
|
||||
$results['variants'] = $checked_variants;
|
||||
}
|
||||
|
||||
return $this->success( $results );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font library settings.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_settings() {
|
||||
return $this->success( get_option( 'gp_font_library_settings', array() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update font library settings.
|
||||
*
|
||||
* @param WP_REST_Request $request request object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function set_settings( WP_REST_Request $request ) {
|
||||
$settings = $request->get_param( 'settings' );
|
||||
$sanitized_settings = array();
|
||||
|
||||
foreach ( $settings as $setting => $value ) {
|
||||
if ( 'google_gdpr' === $setting ) {
|
||||
$sanitized_settings[ $setting ] = (bool) $value;
|
||||
} elseif ( 'preferred_subset' === $setting ) {
|
||||
// Stored as an array to support multiple preferred subsets in the future.
|
||||
$sanitized_settings[ $setting ] = array( sanitize_text_field( $value ) );
|
||||
} else {
|
||||
$sanitized_settings[ $setting ] = sanitize_text_field( $value );
|
||||
}
|
||||
}
|
||||
|
||||
$updated = update_option(
|
||||
GeneratePress_Pro_Font_Library::SETTINGS_OPTION,
|
||||
$sanitized_settings,
|
||||
false
|
||||
);
|
||||
|
||||
if ( $updated ) {
|
||||
// Return success.
|
||||
return $this->success(
|
||||
array(
|
||||
'message' => __( 'Font settings successfully updated!', 'gp-premium' ),
|
||||
'response' => $updated,
|
||||
'settings' => $sanitized_settings,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->failed(
|
||||
array(
|
||||
'message' => __( 'Failed to update font settings.', 'gp-premium' ),
|
||||
'settings' => $sanitized_settings,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a font post.
|
||||
*
|
||||
* @param WP_REST_Request $request request object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update_font_post( WP_REST_Request $request ) {
|
||||
$font_id = $request->get_param( 'id' );
|
||||
$status = $request->get_param( 'status' );
|
||||
$font_family_alias = $request->get_param( 'alias' );
|
||||
$new_variants = $request->get_param( 'newVariants' );
|
||||
$delete_variants = $request->get_param( 'deleteVariants' );
|
||||
$font_display = $request->get_param( 'fontDisplay' );
|
||||
$fallback = $request->get_param( 'fallback' );
|
||||
$css_variable = $request->get_param( 'cssVariable' );
|
||||
$slug = get_post_field( 'post_name', $font_id );
|
||||
|
||||
// Update the font post.
|
||||
wp_update_post(
|
||||
array(
|
||||
'ID' => $font_id,
|
||||
'post_status' => $status,
|
||||
'meta_input' => array(
|
||||
'gp_font_family_alias' => $font_family_alias,
|
||||
'gp_font_variants' => $new_variants,
|
||||
'gp_font_display' => $font_display,
|
||||
'gp_font_fallback' => $fallback,
|
||||
'gp_font_variable' => $css_variable,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$base_path = trailingslashit( $upload_dir['basedir'] ) . 'generatepress/fonts/' . $slug . '/';
|
||||
foreach ( $delete_variants as $variant ) {
|
||||
if ( isset( $variant['deleteStatus'] ) && $variant['deleteStatus'] ) {
|
||||
$file_path = $base_path . basename( $variant['src'] );
|
||||
if ( file_exists( $file_path ) ) {
|
||||
unlink( $file_path );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Regenerate the font CSS.
|
||||
$this->build_css_file();
|
||||
|
||||
// Return success.
|
||||
return $this->success( __( 'Font post successfully updated!', 'gp-premium' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edit options permissions.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function update_settings_permission() {
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edit posts permissions.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function edit_posts_permission() {
|
||||
return current_user_can( 'edit_posts' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Success rest.
|
||||
*
|
||||
* @param mixed $response response data.
|
||||
* @param mixed $data data.
|
||||
* @return mixed
|
||||
*/
|
||||
public function success( $response, $data = null ) {
|
||||
return new WP_REST_Response(
|
||||
array(
|
||||
'success' => true,
|
||||
'response' => $response,
|
||||
'data' => $data,
|
||||
),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Failed rest.
|
||||
*
|
||||
* @param mixed $response response data.
|
||||
* @return mixed
|
||||
*/
|
||||
public function failed( $response ) {
|
||||
return new WP_REST_Response(
|
||||
array(
|
||||
'success' => false,
|
||||
'response' => $response,
|
||||
),
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Error rest.
|
||||
*
|
||||
* @param mixed $code error code.
|
||||
* @param mixed $response response data.
|
||||
* @return mixed
|
||||
*/
|
||||
public function error( $code, $response ) {
|
||||
return new WP_REST_Response(
|
||||
array(
|
||||
'error' => true,
|
||||
'success' => false,
|
||||
'error_code' => $code,
|
||||
'response' => $response,
|
||||
),
|
||||
500
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Pro_Font_Library_Rest::get_instance();
|
@ -0,0 +1,840 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Font Library.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
/**
|
||||
* Font library class.
|
||||
*/
|
||||
class GeneratePress_Pro_Font_Library extends GeneratePress_Pro_Singleton {
|
||||
const FONT_LIBRARY_CPT = 'gp_font';
|
||||
const FONTS_MAX_QUERY = 100;
|
||||
const CSS_VAR_PREFIX = '--gp-font--';
|
||||
const SETTINGS_OPTION = 'gp_font_library_settings';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function init() {
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_font_css' ), 1 );
|
||||
|
||||
if ( ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'block_editor_settings_all', array( $this, 'add_fonts_to_editor' ) );
|
||||
add_filter( 'generate_dashboard_tabs', array( $this, 'add_dashboard_tab' ) );
|
||||
add_action( 'admin_menu', array( $this, 'add_menu' ), 100 );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_filter( 'generate_dashboard_screens', array( $this, 'add_dashboard_screen' ) );
|
||||
add_action( 'admin_head', array( $this, 'add_head_tags' ), 0 );
|
||||
add_action( 'import_post_meta', array( $this, 'update_post_meta' ), 100, 3 );
|
||||
add_action( 'wp_import_existing_post', array( $this, 'maybe_font_exists' ), 10, 2 );
|
||||
add_action( 'save_post_' . self::FONT_LIBRARY_CPT, array( $this, 'build_css_file' ), 100, 3 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Font Library tab to our Dashboard tabs.
|
||||
*
|
||||
* @param array $tabs Existing tabs.
|
||||
* @return array New tabs.
|
||||
*/
|
||||
public function add_dashboard_tab( $tabs ) {
|
||||
$screen = get_current_screen();
|
||||
|
||||
$tabs['Fonts'] = array(
|
||||
'name' => __( 'Font Library', 'gp-premium' ),
|
||||
'url' => self::get_font_library_uri(),
|
||||
'class' => 'appearance_page_generatepress-font-library' === $screen->id ? 'active' : '',
|
||||
'id' => 'gp-font-library-tab',
|
||||
);
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our menu item.
|
||||
*/
|
||||
public function add_menu() {
|
||||
add_submenu_page(
|
||||
'themes.php',
|
||||
__( 'Font Library', 'gp-premium' ),
|
||||
__( 'Font Library', 'gp-premium' ),
|
||||
'manage_options',
|
||||
'generatepress-font-library',
|
||||
array( $this, 'library_page' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our page.
|
||||
*/
|
||||
public function library_page() {
|
||||
echo '<div id="gp-font-library" class="gp-font-library gp-premium"></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tags to the head element for the font library page.
|
||||
*/
|
||||
public function add_head_tags() {
|
||||
$screen = get_current_screen();
|
||||
$user_id = get_current_user_id();
|
||||
$google_gdpr = (bool) self::get_settings( 'google_gdpr' );
|
||||
|
||||
// Stop if we're not on the right page or the user hasn't opted in to google fonts.
|
||||
if ( 'appearance_page_generatepress-font-library' !== $screen->id || ! $google_gdpr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '
|
||||
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin="anonymous" id="gp-preconnect-gstatic">
|
||||
<link href="https://fonts.googleapis.com" rel="preconnect" id="gp-preconnect-google-api">
|
||||
<link href="https://s.w.org" rel="preconnect" id="gp-preconnect-wp-cdn">
|
||||
';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our scripts.
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( 'appearance_page_generatepress-font-library' === $screen->id ) {
|
||||
$assets = generate_premium_get_enqueue_assets( 'font-library' );
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
|
||||
wp_enqueue_script(
|
||||
'generatepress-pro-font-library',
|
||||
GP_PREMIUM_DIR_URL . 'dist/font-library.js',
|
||||
$assets['dependencies'],
|
||||
$assets['version'],
|
||||
true
|
||||
);
|
||||
|
||||
if ( function_exists( 'wp_set_script_translations' ) ) {
|
||||
wp_set_script_translations( 'generatepress-pro-font-library', 'gp-premium', GP_PREMIUM_DIR_PATH . 'langs' );
|
||||
}
|
||||
|
||||
wp_localize_script(
|
||||
'generatepress-pro-font-library',
|
||||
'gppFontLibrary',
|
||||
array(
|
||||
'uploadsUrl' => $upload_dir['baseurl'],
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'generatepress-pro-font-library',
|
||||
GP_PREMIUM_DIR_URL . 'dist/font-library.css',
|
||||
array( 'wp-components' ),
|
||||
GP_PREMIUM_VERSION
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell GeneratePress this is an admin page.
|
||||
*
|
||||
* @param array $screens Existing screens.
|
||||
*/
|
||||
public function add_dashboard_screen( $screens ) {
|
||||
$screens[] = 'appearance_page_generatepress-font-library';
|
||||
|
||||
return $screens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font posts.
|
||||
*
|
||||
* @param string $name font name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_fonts( $name = null ) {
|
||||
$args = array(
|
||||
'post_type' => self::FONT_LIBRARY_CPT,
|
||||
'post_status' => 'any',
|
||||
'numberposts' => GeneratePress_Pro_Font_Library::FONTS_MAX_QUERY, // phpcs:ignore
|
||||
'fields' => 'ids',
|
||||
'no_found_rows' => true,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
'order' => 'ASC',
|
||||
);
|
||||
|
||||
if ( $name ) {
|
||||
$args['name'] = $name;
|
||||
}
|
||||
|
||||
$all_fonts = get_posts( $args );
|
||||
$response = array();
|
||||
|
||||
if ( is_array( $all_fonts ) ) {
|
||||
foreach ( $all_fonts as $font_post ) {
|
||||
$font_name = get_the_title( $font_post );
|
||||
$alias = get_post_meta( $font_post, 'gp_font_family_alias', true );
|
||||
$slug = get_post_field( 'post_name', $font_post );
|
||||
$status = get_post_status( $font_post );
|
||||
$fallback = get_post_meta( $font_post, 'gp_font_fallback', true );
|
||||
$preview = get_post_meta( $font_post, 'gp_font_preview', true );
|
||||
$font_family = empty( $alias ) ? $font_name : $alias;
|
||||
|
||||
$font_family = "\"$font_family\"";
|
||||
|
||||
if ( $fallback ) {
|
||||
$font_family .= ", $fallback";
|
||||
}
|
||||
|
||||
// Setup the font data.
|
||||
$response[] = array(
|
||||
'id' => $font_post,
|
||||
'name' => $font_name,
|
||||
'fontFamily' => $font_family,
|
||||
'disabled' => 'publish' !== $status,
|
||||
'slug' => get_post_field( 'post_name', $font_post ),
|
||||
'alias' => get_post_meta( $font_post, 'gp_font_family_alias', true ),
|
||||
'variants' => get_post_meta( $font_post, 'gp_font_variants', true ),
|
||||
'source' => get_post_meta( $font_post, 'gp_font_source', true ),
|
||||
'fallback' => $fallback,
|
||||
'fontDisplay' => get_post_meta( $font_post, 'gp_font_display', true ),
|
||||
'preview' => empty( $preview ) ? '' : $preview,
|
||||
'cssVariable' => get_post_meta( $font_post, 'gp_font_variable', true ),
|
||||
);
|
||||
}
|
||||
|
||||
return $response;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font library URI.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_font_library_uri() {
|
||||
return admin_url( 'themes.php?page=generatepress-font-library' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Font format mappings.
|
||||
*
|
||||
* @param array $font Array of font data.
|
||||
* @return string
|
||||
*/
|
||||
public static function get_font_face_rule( $font ) {
|
||||
$css = '';
|
||||
if ( ! empty( $font['variants'] ) ) {
|
||||
$font_family = $font['alias'] ? $font['alias'] : $font['name'];
|
||||
|
||||
foreach ( $font['variants'] as $variant ) {
|
||||
$is_disabled = $variant['disabled'] ?? false;
|
||||
|
||||
if ( $is_disabled ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$format = self::get_font_format( $variant['src'] );
|
||||
$css .= "@font-face {
|
||||
font-display: {$font['fontDisplay']};
|
||||
font-family: \"$font_family\";
|
||||
font-style: {$variant['fontStyle']};
|
||||
font-weight: {$variant['fontWeight']};
|
||||
src: url('{$variant['src']}')$format;
|
||||
}\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font format mappings.
|
||||
*
|
||||
* @param string $font_url File extension.
|
||||
* @return string|null
|
||||
*/
|
||||
private static function get_font_format( $font_url ) {
|
||||
$extension = pathinfo( $font_url, PATHINFO_EXTENSION );
|
||||
|
||||
$format_map = array(
|
||||
'woff' => 'woff',
|
||||
'woff2' => 'woff2',
|
||||
'ttf' => 'truetype',
|
||||
'otf' => 'opentype',
|
||||
);
|
||||
|
||||
$format_string = isset( $format_map[ $extension ] ) ? $format_map[ $extension ] : null;
|
||||
return $format_string ? " format('$format_string')" : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a font variant string to determine weight and style.
|
||||
* Returns an array with 'weight', 'style'.
|
||||
*
|
||||
* @param string $variant Font variant string.
|
||||
* @return array
|
||||
*/
|
||||
private static function parse_font_variant( $variant ) {
|
||||
$weight = '400';
|
||||
$style = 'normal';
|
||||
|
||||
if ( 'regular' === $variant ) {
|
||||
return array(
|
||||
'weight' => $weight,
|
||||
'style' => $style,
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'italic' === $variant || strpos( $variant, 'italic' ) !== false ) {
|
||||
$style = 'italic';
|
||||
if ( strpos( $variant, 'italic' ) !== false ) {
|
||||
$variant = str_replace( 'italic', '', $variant );
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'weight' => empty( $variant ) ? $weight : $variant,
|
||||
'style' => $style,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the existing font variant exists.
|
||||
*
|
||||
* Overwrite it if it exists, and delete associated font file if different.
|
||||
* Otherwise, add new variant if not found in the list.
|
||||
*
|
||||
* @param array $variants Font variants.
|
||||
* @param int $new_variant New variant to be added.
|
||||
* @param string $base_path Base path.
|
||||
*
|
||||
* @return array The resolved list of variants.
|
||||
*/
|
||||
public static function check_variants( $variants, $new_variant ) {
|
||||
$checked_variants = $variants;
|
||||
if ( empty( $variants ) ) {
|
||||
return array( $new_variant );
|
||||
}
|
||||
|
||||
$found = false;
|
||||
foreach ( $variants as $key => $variant ) {
|
||||
if ( $variant['name'] === $new_variant['name'] ) {
|
||||
$checked_variants[ $key ] = $new_variant;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $found ) {
|
||||
$checked_variants[] = $new_variant;
|
||||
}
|
||||
|
||||
return $checked_variants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format uploaded font variant.
|
||||
*
|
||||
* @param array $variant Font variant.
|
||||
* @return string The formatted variant name.
|
||||
*/
|
||||
public static function get_variant_name( $variant ) {
|
||||
// Force variant to array-like structure.
|
||||
$is_italic = 'italic' === $variant['fontStyle'];
|
||||
|
||||
$labels = array(
|
||||
'100' => 'Thin 100',
|
||||
'200' => 'ExtraLight 200',
|
||||
'250' => 'ExtraLight 250',
|
||||
'300' => 'Light 300',
|
||||
'400' => 'Regular 400',
|
||||
'regular' => 'Regular 400',
|
||||
'500' => 'Medium 500',
|
||||
'600' => 'SemiBold 600',
|
||||
'700' => 'Bold 700',
|
||||
'800' => 'ExtraBold 800',
|
||||
'900' => 'Black 900',
|
||||
);
|
||||
|
||||
$resolved_label = $labels[ $variant['fontWeight'] ];
|
||||
|
||||
if ( $resolved_label ) {
|
||||
return $resolved_label . ( $is_italic ? ' Italic' : '' );
|
||||
}
|
||||
|
||||
return str_replace( ' ', '-', $variant['fontWeight'] ) . ' ' . __( '(Variable)', 'gp-premium' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a font file name to remove spaces, commas.
|
||||
*
|
||||
* @param string $name Font name.
|
||||
* @return string
|
||||
*/
|
||||
public static function format_font_filename( $name ) {
|
||||
// Replace spaces and commas in file name with hyphen.
|
||||
$name = preg_replace( '/[ ,]/', '-', $name );
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected mime-type values for font files, depending on PHP version.
|
||||
*
|
||||
* This is needed because font mime types vary by PHP version, so checking the PHP version
|
||||
* is necessary until a list of valid mime-types for each file extension can be provided to
|
||||
* the 'upload_mimes' filter.
|
||||
*
|
||||
* @return array A collection of mime types keyed by file extension.
|
||||
*/
|
||||
public static function get_allowed_font_mime_types() {
|
||||
$php_7_ttf_mime_type = PHP_VERSION_ID >= 70300 ? 'application/font-sfnt' : 'application/x-font-ttf';
|
||||
|
||||
return array(
|
||||
'otf' => 'application/vnd.ms-opentype',
|
||||
'ttf' => PHP_VERSION_ID >= 70400 ? 'font/sfnt' : $php_7_ttf_mime_type,
|
||||
'woff' => PHP_VERSION_ID >= 80112 ? 'font/woff' : 'application/font-woff',
|
||||
'woff2' => PHP_VERSION_ID >= 80112 ? 'font/woff2' : 'application/font-woff2',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font CSS file.
|
||||
*
|
||||
* @param string $type Type of path to return. Can return the `path` or `url` to the file.
|
||||
* @return string
|
||||
*/
|
||||
public static function get_font_css_file( $type ) {
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$file_path = 'generatepress/fonts/fonts.css';
|
||||
$base = '';
|
||||
|
||||
if ( 'url' === $type ) {
|
||||
$base = $upload_dir['baseurl'];
|
||||
} elseif ( 'path' === $type ) {
|
||||
$base = $upload_dir['basedir'];
|
||||
}
|
||||
|
||||
return $base ? trailingslashit( $base ) . $file_path : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font CSS file URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_font_css_file_url() {
|
||||
$css_file_url = self::get_font_css_file( 'url' );
|
||||
$css_file_dir = self::get_font_css_file( 'path' );
|
||||
|
||||
return file_exists( $css_file_dir )
|
||||
? $css_file_url
|
||||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add our font CSS.
|
||||
*/
|
||||
public function enqueue_font_css() {
|
||||
$font_file_url = self::get_font_css_file_url();
|
||||
|
||||
// Enqueue the custom fonts CSS if the file exists.
|
||||
if ( $font_file_url ) {
|
||||
$version = filemtime( self::get_font_css_file( 'path' ) ) ?? GP_PREMIUM_VERSION;
|
||||
|
||||
wp_enqueue_style( 'generatepress-fonts', $font_file_url, array(), $version );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a font to the uploads directory either from $_FILES or a remote URL.
|
||||
*
|
||||
* @param array $variant Font variant object.
|
||||
* @param string $slug Font slug.
|
||||
* @param array|null $file Single file item from $_FILES or null.
|
||||
* @return array|WP_Error Array containing uploaded file attributes on success, or WP_Error object on failure.
|
||||
*/
|
||||
public static function handle_font_file_upload( $variant, $slug, $file ) {
|
||||
if ( ! $slug ) {
|
||||
$slug = $variant['slug'] ?? '';
|
||||
}
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$base_path = trailingslashit( $upload_dir['basedir'] ) . 'generatepress/fonts/' . $slug . '/';
|
||||
|
||||
// Ensure the directory exists.
|
||||
if ( ! file_exists( $base_path ) ) {
|
||||
wp_mkdir_p( $base_path );
|
||||
}
|
||||
|
||||
/**
|
||||
* If $file is an array, assume it's a param from $_FILES.
|
||||
*/
|
||||
if ( is_array( $file ) ) {
|
||||
$file_name = basename( $file['name'] );
|
||||
$file_path = $base_path . $file_name;
|
||||
|
||||
// Check if the font file exists and delete it if so.
|
||||
if ( file_exists( $file_path ) ) {
|
||||
unlink( $file_path );
|
||||
}
|
||||
|
||||
$set_upload_dir = function ( $font_dir ) use ( $base_path, $slug ) {
|
||||
$font_dir['path'] = $base_path;
|
||||
$font_dir['url'] = untrailingslashit(
|
||||
content_url( 'uploads/generatepress/fonts/' . $slug )
|
||||
);
|
||||
$font_dir['subdir'] = '';
|
||||
return $font_dir;
|
||||
};
|
||||
|
||||
add_filter( 'upload_mimes', array( __CLASS__, 'get_allowed_font_mime_types' ) );
|
||||
add_filter( 'upload_dir', $set_upload_dir );
|
||||
|
||||
$overrides = array(
|
||||
'upload_error_handler' => array( __CLASS__, 'handle_font_file_upload_error' ),
|
||||
// Not testing a form submission.
|
||||
'test_form' => false,
|
||||
// Only allow uploading font files for this request.
|
||||
'mimes' => self::get_allowed_font_mime_types(),
|
||||
);
|
||||
|
||||
$uploaded_file = wp_handle_upload( $file, $overrides );
|
||||
|
||||
remove_filter( 'upload_dir', $set_upload_dir );
|
||||
remove_filter( 'upload_mimes', array( __CLASS__, 'get_allowed_font_mime_types' ) );
|
||||
|
||||
return $uploaded_file;
|
||||
}
|
||||
|
||||
$file_name = basename( $variant['src'] );
|
||||
$file_path = $base_path . $file_name;
|
||||
|
||||
$response = wp_remote_get( $variant['src'] );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
$error_message = $response->get_error_message();
|
||||
return new WP_Error( 500, "Failed to download {$variant['fontFamily']} from {$variant['src']}: $error_message" );
|
||||
}
|
||||
|
||||
// Save the file.
|
||||
$filesystem = generate_premium_get_wp_filesystem();
|
||||
|
||||
if ( ! $filesystem ) {
|
||||
return new WP_Error( 500, 'Error setting up the file system object.' );
|
||||
}
|
||||
|
||||
$file_contents = wp_remote_retrieve_body( $response );
|
||||
|
||||
if ( ! $file_contents ) {
|
||||
return new WP_Error( 500, "Failed to download $variant from {$variant['src']}: Empty body" );
|
||||
}
|
||||
|
||||
// Assuming $filesystem is already set up correctly.
|
||||
$chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : 0644;
|
||||
|
||||
if ( is_writable( $file_path ) || is_writable( dirname( $file_path ) ) ) {
|
||||
if ( $filesystem->put_contents( $file_path, $file_contents, $chmod_file ) ) {
|
||||
return array(
|
||||
'file' => $file_path,
|
||||
'url' => trailingslashit( $upload_dir['baseurl'] ) . 'generatepress/fonts/' . $slug . '/' . $file_name,
|
||||
);
|
||||
} else {
|
||||
return new WP_Error( 500, "Failed to download $variant from {$variant['src']}." );
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_Error( 500, 'Unable to write to file path.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles file upload error.
|
||||
*
|
||||
* @param array $file File upload data.
|
||||
* @param string $message Error message from wp_handle_upload().
|
||||
* @return WP_Error WP_Error object.
|
||||
*/
|
||||
public static function handle_font_file_upload_error( $file, $message ) {
|
||||
$status = 500;
|
||||
$code = 'rest_font_upload_unknown_error';
|
||||
|
||||
// Note: The absence of a text domain is intentional here as it's checking against a WP core string.
|
||||
if ( __( 'Sorry, you are not allowed to upload this file type.' ) === $message ) {
|
||||
$status = 400;
|
||||
$code = 'rest_font_upload_invalid_file_type';
|
||||
}
|
||||
|
||||
return new WP_Error( $code, $message, array( 'status' => $status ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs on wp_after_insert_post to download remote font files.
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
* @param string $key The meta key that was imported.
|
||||
* @param mixed $value The meta value that was imported.
|
||||
* @return void
|
||||
*/
|
||||
public function update_post_meta( $post_id, $key, $value ) {
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
// Bail if we're not working with a font library post variant meta value.
|
||||
if ( get_post_type( $post_id ) !== self::FONT_LIBRARY_CPT || 'gp_font_variants' !== $key ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the src of each variant and if the URL is remote, download the file.
|
||||
$variants = $value;
|
||||
|
||||
// Stop here if variants aren't found.
|
||||
if ( ! $variants ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $variants as &$variant ) {
|
||||
$site_hostname = wp_parse_url( site_url(), PHP_URL_HOST );
|
||||
|
||||
// Bail if the variant src is already on this site.
|
||||
if ( strpos( $variant['src'], $site_hostname ) !== false ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$font_slug = get_post_field( 'post_name', $post_id );
|
||||
$font_dir = trailingslashit( $upload_dir['basedir'] ) . 'generatepress/fonts/' . $font_slug . '/';
|
||||
$font_base_url = trailingslashit( $upload_dir['baseurl'] ) . 'generatepress/fonts/' . $font_slug . '/';
|
||||
$response = wp_remote_get( $variant['src'] );
|
||||
$response_code = (int) wp_remote_retrieve_response_code( $response );
|
||||
|
||||
if ( is_wp_error( $response ) || 200 !== $response_code ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$file_name = basename( $variant['src'] );
|
||||
$file_path = $font_dir . $file_name;
|
||||
|
||||
// If the directory exists, remove it and it's contents.
|
||||
if ( ! file_exists( $font_dir ) ) {
|
||||
wp_mkdir_p( $font_dir );
|
||||
}
|
||||
|
||||
// Setup filesystem.
|
||||
$filesystem = generate_premium_get_wp_filesystem();
|
||||
|
||||
// Bail here if the filesystem can't initialize.
|
||||
if ( ! $filesystem ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$file_contents = wp_remote_retrieve_body( $response );
|
||||
|
||||
// Bail if file contents are empty or not found.
|
||||
if ( ! $file_contents ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : 0644;
|
||||
|
||||
if ( is_writable( $file_path ) || is_writable( dirname( $file_path ) ) ) {
|
||||
// Bail if the file can't be written.
|
||||
if ( ! $filesystem->put_contents( $file_path, $file_contents, $chmod_file ) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$variant['src'] = $font_base_url . $file_name;
|
||||
}
|
||||
|
||||
// Update the meta value with the new src for each variant.
|
||||
update_post_meta( $post_id, 'gp_font_variants', $variants );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive function to delete a directory and its contents.
|
||||
*
|
||||
* @param string $dir directory path.
|
||||
* @return bool
|
||||
*/
|
||||
public static function delete_directory( $dir ) {
|
||||
if ( ! file_exists( $dir ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! is_dir( $dir ) ) {
|
||||
return unlink( $dir );
|
||||
}
|
||||
|
||||
foreach ( scandir( $dir ) as $item ) {
|
||||
if ( '.' === $item || '..' === $item ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! self::delete_directory( $dir . DIRECTORY_SEPARATOR . $item ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return rmdir( $dir );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the post exists by checking the title.
|
||||
*
|
||||
* @param bool $post_exists Unused. The default post_exists function value.
|
||||
* @param array $font The font post array.
|
||||
* @return int Post ID on success, 0 on failure.
|
||||
*/
|
||||
public function maybe_font_exists( $post_exists, $font ) {
|
||||
/**
|
||||
* The value of $font here is a post array from the XML import, not our standard
|
||||
* font array. We need to check if the font exists by title.
|
||||
*/
|
||||
return post_exists( $font['post_title'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the CSS variables and values for each font-family.
|
||||
*
|
||||
* @return string The color palette variable CSS declaration.
|
||||
*/
|
||||
public static function get_css_variables() {
|
||||
$fonts = self::get_fonts();
|
||||
|
||||
if ( ! $fonts ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$variables = ":root {\n";
|
||||
|
||||
foreach ( $fonts as $font ) {
|
||||
if ( isset( $font['disabled'] ) && $font['disabled'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$variables .= sprintf(
|
||||
"%s: %s;\n",
|
||||
$font['cssVariable'],
|
||||
$font['fontFamily']
|
||||
);
|
||||
}
|
||||
|
||||
$variables .= "}\n";
|
||||
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSS variable definitions to the block editor.
|
||||
*
|
||||
* @param string $css The generated CSS for the stylesheet.
|
||||
* @return void
|
||||
**/
|
||||
public function add_variable_definitions_to_editor( $css ) {
|
||||
wp_add_inline_style( 'generateblocks-pro', self::get_css_variables() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the font CSS file.
|
||||
*
|
||||
* @return string|WP_Error The file path on success, WP_Error on failure.
|
||||
*/
|
||||
public static function build_css_file() {
|
||||
$generated_css = self::generate_font_css();
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
|
||||
// Save the generated font CSS to a file.
|
||||
$base_path_dir = trailingslashit( $upload_dir['basedir'] ) . 'generatepress/fonts/';
|
||||
$file_path = $base_path_dir . 'fonts.css';
|
||||
$filesystem = generate_premium_get_wp_filesystem();
|
||||
|
||||
if ( ! $filesystem ) {
|
||||
return new WP_Error( 500, __( 'Error setting up the file system object.', 'gp-premium' ) );
|
||||
}
|
||||
|
||||
// Assuming $filesystem is already set up correctly.
|
||||
$chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : 0644;
|
||||
|
||||
if ( empty( $generated_css ) ) {
|
||||
if ( file_exists( $file_path ) ) {
|
||||
$filesystem->delete( $file_path );
|
||||
}
|
||||
} else {
|
||||
if ( is_writable( $file_path ) || is_writable( dirname( $file_path ) ) ) {
|
||||
if ( ! $filesystem->put_contents( $file_path, $generated_css, $chmod_file ) ) {
|
||||
return new WP_Error( 500, __( 'Failed to write Google font CSS to file.', 'gp-premium' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate font CSS.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function generate_font_css() {
|
||||
$fonts = self::get_fonts();
|
||||
$variables = self::get_css_variables();
|
||||
$css = $variables . "\n";
|
||||
|
||||
if ( $fonts ) {
|
||||
foreach ( $fonts as $font ) {
|
||||
// Add the generated CSS.
|
||||
$css .= self::get_font_face_rule( $font );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'generatepress_font_css', $css, $fonts );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the font CSS to the block editor.
|
||||
*
|
||||
* @param array $settings The block editor settings.
|
||||
* @return array
|
||||
*/
|
||||
public function add_fonts_to_editor( $settings ) {
|
||||
$font_file_url = self::get_font_css_file_url();
|
||||
|
||||
if ( ! $font_file_url ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$fonts_import = sprintf(
|
||||
'@import url("%s");',
|
||||
$font_file_url
|
||||
);
|
||||
|
||||
$settings['styles'][] = array( 'css' => $fonts_import );
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font library settings. At the moment this is just the Google GDPR setting.
|
||||
*
|
||||
* @param string $setting The setting to retrieve.
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_settings( $setting = null ) {
|
||||
|
||||
$settings = get_option( self::SETTINGS_OPTION, array() );
|
||||
|
||||
if ( $setting ) {
|
||||
return $settings[ $setting ] ?? null;
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePress_Pro_Font_Library::get_instance()->init();
|
@ -3,8 +3,8 @@
|
||||
* Plugin Name: GP Premium
|
||||
* Plugin URI: https://generatepress.com
|
||||
* Description: The entire collection of GeneratePress premium modules.
|
||||
* Version: 2.4.1
|
||||
* Requires at least: 5.2
|
||||
* Version: 2.5.0
|
||||
* Requires at least: 6.1
|
||||
* Requires PHP: 7.2
|
||||
* Author: Tom Usborne
|
||||
* Author URI: https://generatepress.com
|
||||
@ -19,13 +19,16 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
define( 'GP_PREMIUM_VERSION', '2.4.1' );
|
||||
define( 'GP_PREMIUM_VERSION', '2.5.0' );
|
||||
define( 'GP_PREMIUM_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
||||
define( 'GP_PREMIUM_DIR_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'GP_LIBRARY_DIRECTORY', plugin_dir_path( __FILE__ ) . 'library/' );
|
||||
define( 'GP_LIBRARY_DIRECTORY_URL', plugin_dir_url( __FILE__ ) . 'library/' );
|
||||
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/functions.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/deprecated.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/class-rest.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/class-singleton.php';
|
||||
|
||||
if ( ! function_exists( 'generatepress_is_module_active' ) ) {
|
||||
/**
|
||||
@ -132,12 +135,10 @@ function generate_premium_load_modules() {
|
||||
}
|
||||
|
||||
// General functionality.
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/functions.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'general/class-external-file-css.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'general/smooth-scroll.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'general/icons.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'general/enqueue-scripts.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/deprecated.php';
|
||||
|
||||
// Load our Dashboard functions once the theme has loaded.
|
||||
require_once GP_PREMIUM_DIR_PATH . 'inc/class-dashboard.php';
|
||||
@ -155,6 +156,16 @@ if ( is_admin() ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( generatepress_is_module_active( 'generate_package_font_library', 'GENERATE_FONT_LIBRARY' ) ) {
|
||||
require_once GP_PREMIUM_DIR_PATH . 'font-library/class-font-library.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'font-library/class-font-library-rest.php';
|
||||
require_once GP_PREMIUM_DIR_PATH . 'font-library/class-font-library-optimize.php';
|
||||
|
||||
if ( is_admin() ) {
|
||||
require_once GP_PREMIUM_DIR_PATH . 'font-library/class-font-library-cpt.php';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_premium_updater' ) ) {
|
||||
add_action( 'admin_init', 'generate_premium_updater', 0 );
|
||||
/**
|
||||
|
@ -108,6 +108,12 @@ class GeneratePress_Pro_Dashboard {
|
||||
'key' => 'generate_package_elements',
|
||||
'isActive' => 'activated' === get_option( 'generate_package_elements', false ),
|
||||
),
|
||||
'Font Library' => array(
|
||||
'title' => __( 'Font Library', 'gp-premium' ),
|
||||
'description' => __( 'Download and localize fonts from the Google Fonts library.', 'gp-premium' ),
|
||||
'key' => 'generate_package_font_library',
|
||||
'isActive' => 'activated' === get_option( 'generate_package_font_library', false ),
|
||||
),
|
||||
'Hooks' => array(
|
||||
'title' => __( 'Hooks', 'gp-premium' ),
|
||||
'description' => __( 'This module has been deprecated. Please use Elements instead.', 'gp-premium' ),
|
||||
@ -298,10 +304,10 @@ class GeneratePress_Pro_Dashboard {
|
||||
|
||||
if ( $license_key && strlen( $license_key ) > 4 ) {
|
||||
$hidden_length = strlen( $license_key ) - 4;
|
||||
$safe_part = substr( $license_key, 0, 4 );
|
||||
$hidden_part = implode('', array_fill( 0, $hidden_length, '*' ) );
|
||||
$safe_part = substr( $license_key, -4 );
|
||||
$hidden_part = implode( '', array_fill( 0, $hidden_length, '*' ) );
|
||||
|
||||
return $safe_part . $hidden_part;
|
||||
return $hidden_part . $safe_part;
|
||||
}
|
||||
|
||||
return $license_key;
|
||||
@ -318,7 +324,16 @@ class GeneratePress_Pro_Dashboard {
|
||||
$dashboard_pages = GeneratePress_Dashboard::get_pages();
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
|
||||
if ( in_array( $current_screen->id, $dashboard_pages ) ) {
|
||||
$packages_info = generate_premium_get_enqueue_assets( 'packages' );
|
||||
wp_enqueue_style(
|
||||
'generatepress-pro-packages',
|
||||
GP_PREMIUM_DIR_URL . 'dist/packages.css',
|
||||
array(),
|
||||
$packages_info['version']
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'generate-pro-dashboard',
|
||||
GP_PREMIUM_DIR_URL . 'dist/style-dashboard.css',
|
||||
@ -343,6 +358,7 @@ class GeneratePress_Pro_Dashboard {
|
||||
array(
|
||||
'modules' => self::get_modules(),
|
||||
'exportableModules' => self::get_exportable_modules(),
|
||||
'fontLibraryUrl' => admin_url( 'themes.php?page=generatepress-font-library' ),
|
||||
'siteLibraryUrl' => admin_url( 'themes.php?page=generatepress-library' ),
|
||||
'elementsUrl' => admin_url( 'edit.php?post_type=gp_elements' ),
|
||||
'hasWooCommerce' => class_exists( 'WooCommerce' ),
|
||||
|
58
wp-content/plugins/gp-premium/inc/class-singleton.php
Normal file
58
wp-content/plugins/gp-premium/inc/class-singleton.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* GenerateBlocks Pro singleton class.
|
||||
*
|
||||
* @package Generateblocks
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* The Singleton class.
|
||||
*/
|
||||
abstract class GeneratePress_Pro_Singleton {
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @access private
|
||||
* @var array Instances
|
||||
*/
|
||||
private static $instances = array();
|
||||
|
||||
/**
|
||||
* The Singleton's constructor should always be private to prevent direct
|
||||
* construction calls with the `new` operator.
|
||||
*/
|
||||
protected function __construct() { }
|
||||
|
||||
/**
|
||||
* Singletons should not be cloneable.
|
||||
*/
|
||||
protected function __clone() { }
|
||||
|
||||
/**
|
||||
* Singletons should not be restorable from strings.
|
||||
*
|
||||
* @throws Exception Cannot unserialize a singleton.
|
||||
*/
|
||||
public function __wakeup() {
|
||||
throw new Exception( 'Cannot unserialize a singleton.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiator.
|
||||
*
|
||||
* @return object initialized object of class.
|
||||
*/
|
||||
public static function get_instance() {
|
||||
$cls = static::class;
|
||||
|
||||
if ( ! isset( self::$instances[ $cls ] ) ) {
|
||||
self::$instances[ $cls ] = new static();
|
||||
}
|
||||
|
||||
return self::$instances[ $cls ];
|
||||
}
|
||||
}
|
@ -150,3 +150,34 @@ function generate_premium_get_wp_filesystem() {
|
||||
|
||||
return $wp_filesystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get our script dependencies and version.
|
||||
*
|
||||
* @param string $filename The filename to use.
|
||||
* @param array $fallback_assets The assets to fallback to.
|
||||
*/
|
||||
function generate_premium_get_enqueue_assets(
|
||||
$filename = '',
|
||||
$fallback_assets = array(
|
||||
'dependencies' => array(),
|
||||
'version' => '',
|
||||
)
|
||||
) {
|
||||
if ( ! $filename ) {
|
||||
return $fallback_assets;
|
||||
}
|
||||
|
||||
$assets_file = GP_PREMIUM_DIR_PATH . 'dist/' . $filename . '.asset.php';
|
||||
$compiled_assets = file_exists( $assets_file )
|
||||
? require $assets_file
|
||||
: false;
|
||||
|
||||
$assets =
|
||||
isset( $compiled_assets['dependencies'] ) &&
|
||||
isset( $compiled_assets['version'] )
|
||||
? $compiled_assets
|
||||
: $fallback_assets;
|
||||
|
||||
return $assets;
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
Contributors: edge22
|
||||
Donate link: https://generatepress.com
|
||||
Tags: generatepress
|
||||
Requires at least: 5.2
|
||||
Tested up to: 6.4
|
||||
Requires at least: 6.1
|
||||
Tested up to: 6.6
|
||||
Requires PHP: 7.2
|
||||
Stable tag: 2.4.1
|
||||
Stable tag: 2.5.0
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@ -27,6 +27,17 @@ In most cases, #1 will work fine and is way easier.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.5.0 =
|
||||
* Feature: Font Library
|
||||
* Feature: Install Google Fonts locally
|
||||
* Feature: Upload custom fonts locally
|
||||
* Fix: Apply button color settings to WooCommerce block buttons
|
||||
* Fix: WooCommerce button typography
|
||||
* Fix: Check if `DISALLOW_FILE_EDIT` is set to true for PHP Elements
|
||||
* Fix: Use up to date react render functions
|
||||
* Tweak: Allow Display Rules metabox to collapse
|
||||
* Accessibility: Add aria-label to secondary navigation
|
||||
|
||||
= 2.4.1 =
|
||||
* Security: Harden variable against XSS attacks
|
||||
|
||||
|
@ -702,13 +702,36 @@ if ( ! function_exists( 'generate_secondary_navigation_position' ) ) {
|
||||
if ( has_nav_menu( 'secondary' ) ) :
|
||||
do_action( 'generate_before_secondary_navigation' );
|
||||
|
||||
$microdata = ' itemtype="https://schema.org/SiteNavigationElement" itemscope="itemscope"';
|
||||
$classes = generate_get_secondary_navigation_class();
|
||||
$classes = implode( ' ', $classes );
|
||||
$attributes = [
|
||||
'id' => 'secondary-navigation',
|
||||
'aria-label' => esc_attr__( 'Secondary', 'gp-premium' ),
|
||||
'class' => $classes,
|
||||
];
|
||||
$microdata = '';
|
||||
|
||||
if ( function_exists( 'generate_get_schema_type' ) && 'microdata' !== generate_get_schema_type() ) {
|
||||
$microdata = '';
|
||||
if ( function_exists( 'generate_get_schema_type' ) && 'microdata' === generate_get_schema_type() ) {
|
||||
$attributes['itemtype'] = 'https://schema.org/SiteNavigationElement';
|
||||
$attributes['itemscope'] = true;
|
||||
$microdata = ' itemtype="https://schema.org/SiteNavigationElement" itemscope="itemscope"';
|
||||
}
|
||||
|
||||
$secondary_nav_attributes = sprintf(
|
||||
'id="secondary-navigation" aria-label="%1$s" class="%2$s"%3$s"',
|
||||
esc_attr__( 'Secondary', 'gp-premium' ),
|
||||
esc_attr( $classes ),
|
||||
$microdata
|
||||
);
|
||||
|
||||
if ( function_exists( 'generate_get_attr' ) ) {
|
||||
$secondary_nav_attributes = generate_get_attr(
|
||||
'secondary-navigation',
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
?>
|
||||
<nav id="secondary-navigation" <?php generate_secondary_navigation_class(); ?><?php echo $microdata; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<nav <?php echo $secondary_nav_attributes; // phpcs:ignore -- No escaping needed. ?>>
|
||||
<div <?php generate_inside_secondary_navigation_class(); ?>>
|
||||
<?php do_action( 'generate_inside_secondary_navigation' ); ?>
|
||||
<button class="menu-toggle secondary-menu-toggle">
|
||||
|
@ -180,6 +180,7 @@ class GeneratePress_Site_Library {
|
||||
'name' => __( 'Site Library', 'gp-premium' ),
|
||||
'url' => admin_url( 'themes.php?page=generatepress-library' ),
|
||||
'class' => 'appearance_page_generatepress-library' === $screen->id ? 'active' : '',
|
||||
'id' => 'gp-site-library-tab',
|
||||
);
|
||||
|
||||
return $tabs;
|
||||
|
29
wp-content/plugins/gp-premium/webpack.config.js
Normal file
29
wp-content/plugins/gp-premium/webpack.config.js
Normal file
@ -0,0 +1,29 @@
|
||||
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
|
||||
|
||||
const defaultEntries = defaultConfig.entry();
|
||||
|
||||
module.exports = {
|
||||
...defaultConfig,
|
||||
// Needed for the 'lib-font' package to work.
|
||||
resolve: {
|
||||
fallback: {
|
||||
fs: false,
|
||||
zlib: false,
|
||||
},
|
||||
symlinks: false,
|
||||
},
|
||||
entry: {
|
||||
...defaultEntries,
|
||||
'block-elements': './src/block-elements.js',
|
||||
'font-library': './src/font-library.js',
|
||||
'site-library': './src/site-library.js',
|
||||
customizer: './src/customizer.js',
|
||||
dashboard: './src/dashboard.js',
|
||||
editor: './src/editor.js',
|
||||
packages: './src/packages.scss',
|
||||
},
|
||||
output: {
|
||||
...defaultConfig.output,
|
||||
path: __dirname + '/dist',
|
||||
},
|
||||
};
|
@ -14,21 +14,18 @@
|
||||
.woocommerce #wc-column-container.wc-mobile-columns-1 .products,
|
||||
.wc-related-upsell-mobile-columns-1 .related ul.products,
|
||||
.wc-related-upsell-mobile-columns-1 .up-sells ul.products {
|
||||
-ms-grid-columns: 1fr;
|
||||
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.woocommerce #wc-column-container.wc-mobile-columns-2 .products,
|
||||
.wc-related-upsell-mobile-columns-2 .related ul.products,
|
||||
.wc-related-upsell-mobile-columns-2 .up-sells ul.products {
|
||||
-ms-grid-columns: 1fr 1fr;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.woocommerce #wc-column-container.wc-mobile-columns-3 .products,
|
||||
.wc-related-upsell-mobile-columns-3 .related ul.products,
|
||||
.wc-related-upsell-mobile-columns-3 .up-sells ul.products {
|
||||
-ms-grid-columns: 1fr 1fr 1fr;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
.woocommerce-product-gallery{margin-right:0}.woocommerce .woocommerce-ordering,.woocommerce-page .woocommerce-ordering{float:none}.woocommerce .woocommerce-ordering select{max-width:100%}.wc-related-upsell-mobile-columns-1 .related ul.products,.wc-related-upsell-mobile-columns-1 .up-sells ul.products,.woocommerce #wc-column-container.wc-mobile-columns-1 .products{-ms-grid-columns:1fr;grid-template-columns:repeat(1,minmax(0,1fr))}.wc-related-upsell-mobile-columns-2 .related ul.products,.wc-related-upsell-mobile-columns-2 .up-sells ul.products,.woocommerce #wc-column-container.wc-mobile-columns-2 .products{-ms-grid-columns:1fr 1fr;grid-template-columns:repeat(2,minmax(0,1fr))}.wc-related-upsell-mobile-columns-3 .related ul.products,.wc-related-upsell-mobile-columns-3 .up-sells ul.products,.woocommerce #wc-column-container.wc-mobile-columns-3 .products{-ms-grid-columns:1fr 1fr 1fr;grid-template-columns:repeat(3,minmax(0,1fr))}.woocommerce ul.products li.product a img{width:auto;margin-left:auto;margin-right:auto}.woocommerce div.product .woocommerce-tabs .panel,.woocommerce div.product .woocommerce-tabs ul.tabs{float:none;width:100%}.woocommerce div.product .woocommerce-tabs .panel{margin-top:20px}.wc-tabs .active a:after{transform:rotate(90deg);padding-right:3px}.woocommerce .col2-set,.woocommerce-page .col2-set{width:100%;float:none;margin-right:0}#customer_details+#wc_checkout_add_ons,#order_review,#order_review_heading{width:100%;float:none;margin-right:0}.woocommerce ul.products li.product.woocommerce-image-align-left .wc-product-image,.woocommerce ul.products li.product.woocommerce-image-align-right .wc-product-image{float:none;margin:0}.woocommerce ul.products li.product.woocommerce-image-align-left a .wc-product-image img,.woocommerce ul.products li.product.woocommerce-image-align-right a .wc-product-image img{width:100%}.woocommerce .related ul.products li.product,.woocommerce .up-sells ul.products li.product,.woocommerce-page .related ul.products li.product,.woocommerce-page .up-sells ul.products li.product,.woocommerce-page[class*=columns-] .related ul.products li.product,.woocommerce-page[class*=columns-] .up-sells ul.products li.product,.woocommerce[class*=columns-] .related ul.products li.product,.woocommerce[class*=columns-] .up-sells ul.products li.product{width:100%;margin-left:0;margin-right:0}.woocommerce form .woocommerce-billing-fields__field-wrapper .form-row-first,.woocommerce form .woocommerce-billing-fields__field-wrapper .form-row-last,.woocommerce-page form .woocommerce-billing-fields__field-wrapper .form-row-first,.woocommerce-page form .woocommerce-billing-fields__field-wrapper .form-row-last{float:none;width:100%}.woocommerce-account .woocommerce-MyAccount-navigation{width:100%}.woocommerce-MyAccount-navigation li.is-active a:after{content:"\e901"}#wc-mini-cart{display:none}.do-quantity-buttons div.quantity{justify-content:flex-end}.woocommerce div.product .woocommerce-tabs ul.tabs{flex-direction:column}.woocommerce div.product .woocommerce-tabs ul.tabs li{border-left-width:1px}.woocommerce div.product .woocommerce-tabs ul.tabs li:last-child{border-bottom-color:rgba(0,0,0,.08);border-bottom-width:1px}.woocommerce .coupon .button{font-size:14px;padding:10px}.woocommerce .woocommerce-ordering{margin-bottom:0}.add-to-cart-panel{bottom:0;top:auto;transform:translateY(0)!important}.add-to-cart-panel .continue-shopping:not(.has-svg-icon):before{content:"\f00d";font-family:'GP Premium';line-height:1em;width:1.28571429em;text-align:center;display:inline-block;padding:10px}#wc-sticky-cart-panel .quantity,.add-to-cart-panel .continue-shopping-link{display:none}.add-to-cart-panel .continue-shopping{order:5;margin-left:auto;margin-right:0;position:absolute;top:-20px;left:10px;height:50px;width:50px;text-align:center;border-radius:50%;line-height:50px;cursor:pointer}.add-to-cart-panel .continue-shopping .gp-icon{display:block}.add-to-cart-panel .cart,.add-to-cart-panel .product-image{flex-shrink:0}.add-to-cart-panel .product-title{padding-right:20px;margin-left:10px}.add-to-cart-panel .cart-info{margin-right:auto}.add-to-cart-panel .product-price{font-size:13px}.add-to-cart-panel:not(.item-added):not(.show-sticky-add-to-cart){pointer-events:none}
|
||||
.woocommerce-product-gallery{margin-right:0}.woocommerce .woocommerce-ordering,.woocommerce-page .woocommerce-ordering{float:none}.woocommerce .woocommerce-ordering select{max-width:100%}.wc-related-upsell-mobile-columns-1 .related ul.products,.wc-related-upsell-mobile-columns-1 .up-sells ul.products,.woocommerce #wc-column-container.wc-mobile-columns-1 .products{grid-template-columns:repeat(1,minmax(0,1fr))}.wc-related-upsell-mobile-columns-2 .related ul.products,.wc-related-upsell-mobile-columns-2 .up-sells ul.products,.woocommerce #wc-column-container.wc-mobile-columns-2 .products{grid-template-columns:repeat(2,minmax(0,1fr))}.wc-related-upsell-mobile-columns-3 .related ul.products,.wc-related-upsell-mobile-columns-3 .up-sells ul.products,.woocommerce #wc-column-container.wc-mobile-columns-3 .products{grid-template-columns:repeat(3,minmax(0,1fr))}.woocommerce ul.products li.product a img{width:auto;margin-left:auto;margin-right:auto}.woocommerce div.product .woocommerce-tabs .panel,.woocommerce div.product .woocommerce-tabs ul.tabs{float:none;width:100%}.woocommerce div.product .woocommerce-tabs .panel{margin-top:20px}.wc-tabs .active a:after{transform:rotate(90deg);padding-right:3px}.woocommerce .col2-set,.woocommerce-page .col2-set{width:100%;float:none;margin-right:0}#customer_details+#wc_checkout_add_ons,#order_review,#order_review_heading{width:100%;float:none;margin-right:0}.woocommerce ul.products li.product.woocommerce-image-align-left .wc-product-image,.woocommerce ul.products li.product.woocommerce-image-align-right .wc-product-image{float:none;margin:0}.woocommerce ul.products li.product.woocommerce-image-align-left a .wc-product-image img,.woocommerce ul.products li.product.woocommerce-image-align-right a .wc-product-image img{width:100%}.woocommerce .related ul.products li.product,.woocommerce .up-sells ul.products li.product,.woocommerce-page .related ul.products li.product,.woocommerce-page .up-sells ul.products li.product,.woocommerce-page[class*=columns-] .related ul.products li.product,.woocommerce-page[class*=columns-] .up-sells ul.products li.product,.woocommerce[class*=columns-] .related ul.products li.product,.woocommerce[class*=columns-] .up-sells ul.products li.product{width:100%;margin-left:0;margin-right:0}.woocommerce form .woocommerce-billing-fields__field-wrapper .form-row-first,.woocommerce form .woocommerce-billing-fields__field-wrapper .form-row-last,.woocommerce-page form .woocommerce-billing-fields__field-wrapper .form-row-first,.woocommerce-page form .woocommerce-billing-fields__field-wrapper .form-row-last{float:none;width:100%}.woocommerce-account .woocommerce-MyAccount-navigation{width:100%}.woocommerce-MyAccount-navigation li.is-active a:after{content:"\e901"}#wc-mini-cart{display:none}.do-quantity-buttons div.quantity{justify-content:flex-end}.woocommerce div.product .woocommerce-tabs ul.tabs{flex-direction:column}.woocommerce div.product .woocommerce-tabs ul.tabs li{border-left-width:1px}.woocommerce div.product .woocommerce-tabs ul.tabs li:last-child{border-bottom-color:rgba(0,0,0,.08);border-bottom-width:1px}.woocommerce .coupon .button{font-size:14px;padding:10px}.woocommerce .woocommerce-ordering{margin-bottom:0}.add-to-cart-panel{bottom:0;top:auto;transform:translateY(0)!important}.add-to-cart-panel .continue-shopping:not(.has-svg-icon):before{content:"\f00d";font-family:'GP Premium';line-height:1em;width:1.28571429em;text-align:center;display:inline-block;padding:10px}#wc-sticky-cart-panel .quantity,.add-to-cart-panel .continue-shopping-link{display:none}.add-to-cart-panel .continue-shopping{order:5;margin-left:auto;margin-right:0;position:absolute;top:-20px;left:10px;height:50px;width:50px;text-align:center;border-radius:50%;line-height:50px;cursor:pointer}.add-to-cart-panel .continue-shopping .gp-icon{display:block}.add-to-cart-panel .cart,.add-to-cart-panel .product-image{flex-shrink:0}.add-to-cart-panel .product-title{padding-right:20px;margin-left:10px}.add-to-cart-panel .cart-info{margin-right:auto}.add-to-cart-panel .product-price{font-size:13px}.add-to-cart-panel:not(.item-added):not(.show-sticky-add-to-cart){pointer-events:none}
|
@ -176,7 +176,6 @@
|
||||
.wc-columns-container .products,
|
||||
.woocommerce .related ul.products,
|
||||
.woocommerce .up-sells ul.products {
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-gap: 50px;
|
||||
width: 100%;
|
||||
|
File diff suppressed because one or more lines are too long
@ -824,9 +824,10 @@ function generatepress_wc_css() {
|
||||
}
|
||||
|
||||
// Primary button.
|
||||
$css->set_selector( '.woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button' );
|
||||
$css->set_selector( '.woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .wc-block-components-button' );
|
||||
$css->add_property( 'color', esc_attr( $settings['form_button_text_color'] ) );
|
||||
$css->add_property( 'background-color', esc_attr( $settings['form_button_background_color'] ) );
|
||||
$css->add_property( 'text-decoration', 'none' );
|
||||
|
||||
if ( ! $using_dynamic_typography && isset( $settings['buttons_font_size'] ) ) {
|
||||
$css->add_property( 'font-weight', esc_attr( $settings['buttons_font_weight'] ) );
|
||||
@ -842,10 +843,21 @@ function generatepress_wc_css() {
|
||||
|
||||
foreach ( (array) $typography as $key => $data ) {
|
||||
if ( 'buttons' === $data['selector'] ) {
|
||||
$unit = isset( $data['fontSizeUnit'] ) ? $data['fontSizeUnit'] : 'px';
|
||||
$unit = isset( $data['fontSizeUnit'] ) ? $data['fontSizeUnit'] : '';
|
||||
|
||||
if ( ! empty( $data['fontSize'] ) ) {
|
||||
$css->add_property( 'font-size', floatval( $data['fontSize'] ), false, $unit );
|
||||
|
||||
// Check for legacy font size values.
|
||||
// @see https://github.com/tomusborne/generatepress/pull/548.
|
||||
if ( is_numeric( $data['fontSize'] ) ) {
|
||||
$data['fontSize'] = floatval( $data['fontSize'] );
|
||||
|
||||
if ( ! $unit ) {
|
||||
$unit = 'px';
|
||||
}
|
||||
}
|
||||
|
||||
$css->add_property( 'font-size', esc_attr( $data['fontSize'] ), false, $unit );
|
||||
}
|
||||
|
||||
if ( ! empty( $data['fontWeight'] ) ) {
|
||||
@ -858,13 +870,35 @@ function generatepress_wc_css() {
|
||||
|
||||
if ( ! empty( $data['fontSizeTablet'] ) ) {
|
||||
$css->start_media_query( generate_premium_get_media_query( 'tablet' ) );
|
||||
$css->add_property( 'font-size', floatval( $data['fontSizeTablet'] ), false, $unit );
|
||||
|
||||
// Check for legacy font size values.
|
||||
// @see https://github.com/tomusborne/generatepress/pull/548.
|
||||
if ( is_numeric( $data['fontSizeTablet'] ) ) {
|
||||
$data['fontSizeTablet'] = floatval( $data['fontSizeTablet'] );
|
||||
|
||||
if ( ! $unit ) {
|
||||
$unit = 'px';
|
||||
}
|
||||
}
|
||||
|
||||
$css->add_property( 'font-size', esc_attr( $data['fontSizeTablet'] ), false, $unit );
|
||||
$css->stop_media_query();
|
||||
}
|
||||
|
||||
if ( ! empty( $data['fontSizeMobile'] ) ) {
|
||||
$css->start_media_query( generate_premium_get_media_query( 'mobile' ) );
|
||||
$css->add_property( 'font-size', floatval( $data['fontSizeMobile'] ), false, $unit );
|
||||
|
||||
// Check for legacy font size values.
|
||||
// @see https://github.com/tomusborne/generatepress/pull/548.
|
||||
if ( is_numeric( $data['fontSizeMobile'] ) ) {
|
||||
$data['fontSizeMobile'] = floatval( $data['fontSizeMobile'] );
|
||||
|
||||
if ( ! $unit ) {
|
||||
$unit = 'px';
|
||||
}
|
||||
}
|
||||
|
||||
$css->add_property( 'font-size', esc_attr( $data['fontSizeMobile'] ), false, $unit );
|
||||
$css->stop_media_query();
|
||||
}
|
||||
}
|
||||
@ -872,7 +906,7 @@ function generatepress_wc_css() {
|
||||
}
|
||||
|
||||
// Primary button hover.
|
||||
$css->set_selector( '.woocommerce #respond input#submit:hover, .woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover' );
|
||||
$css->set_selector( '.woocommerce #respond input#submit:hover, .woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover, .wc-block-components-button:hover' );
|
||||
$css->add_property( 'color', esc_attr( $settings['form_button_text_color_hover'] ) );
|
||||
$css->add_property( 'background-color', esc_attr( $settings['form_button_background_color_hover'] ) );
|
||||
|
||||
@ -886,6 +920,11 @@ function generatepress_wc_css() {
|
||||
$css->add_property( 'color', esc_attr( $settings['wc_alt_button_text_hover'] ) );
|
||||
$css->add_property( 'background-color', esc_attr( $settings['wc_alt_button_background_hover'] ) );
|
||||
|
||||
// WooBlocks panel button font-size.
|
||||
// We don't want to treat this like a normal button.
|
||||
$css->set_selector( 'button.wc-block-components-panel__button' );
|
||||
$css->add_property( 'font-size', 'inherit' );
|
||||
|
||||
// Star rating.
|
||||
$css->set_selector( '.woocommerce .star-rating span:before, .woocommerce p.stars:hover a::before' );
|
||||
$css->add_property( 'color', esc_attr( $settings['wc_rating_stars'] ) );
|
||||
|
Loading…
Reference in New Issue
Block a user