Changeset 3140508
- Timestamp:
- 08/23/2024 06:41:56 PM (19 months ago)
- Location:
- woo-2checkout
- Files:
-
- 154 added
- 30 edited
-
tags/3.0.3 (added)
-
tags/3.0.3/README.txt (added)
-
tags/3.0.3/build (added)
-
tags/3.0.3/build/convert-plus-block.asset.php (added)
-
tags/3.0.3/build/convert-plus-block.js (added)
-
tags/3.0.3/changelog.txt (added)
-
tags/3.0.3/images (added)
-
tags/3.0.3/images/2checkout-dark.svg (added)
-
tags/3.0.3/images/2checkout-light.svg (added)
-
tags/3.0.3/includes (added)
-
tags/3.0.3/includes/API.php (added)
-
tags/3.0.3/includes/Common.php (added)
-
tags/3.0.3/includes/ConvertPlus (added)
-
tags/3.0.3/includes/ConvertPlus/ConvertPlus_Block.php (added)
-
tags/3.0.3/includes/ConvertPlus/ConvertPlus_Gateway.php (added)
-
tags/3.0.3/includes/Extended_Plugin_Upgrade_Notice.php (added)
-
tags/3.0.3/includes/Payment_Gateway.php (added)
-
tags/3.0.3/includes/Plugin.php (added)
-
tags/3.0.3/includes/functions.php (added)
-
tags/3.0.3/languages (added)
-
tags/3.0.3/languages/woo-2checkout.pot (added)
-
tags/3.0.3/uninstall.php (added)
-
tags/3.0.3/vendor (added)
-
tags/3.0.3/vendor/autoload.php (added)
-
tags/3.0.3/vendor/autoload_packages.php (added)
-
tags/3.0.3/vendor/automattic (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/CHANGELOG.md (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/LICENSE.txt (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/README.md (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/SECURITY.md (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/composer.json (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/AutoloadFileWriter.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/AutoloadProcessor.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/ManifestGenerator.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/autoload.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-autoloader.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-container.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-hook-manager.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-manifest-reader.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-path-processor.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-shutdown-handler.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-version-loader.php (added)
-
tags/3.0.3/vendor/automattic/jetpack-autoloader/src/class-version-selector.php (added)
-
tags/3.0.3/vendor/composer (added)
-
tags/3.0.3/vendor/composer/ClassLoader.php (added)
-
tags/3.0.3/vendor/composer/InstalledVersions.php (added)
-
tags/3.0.3/vendor/composer/LICENSE (added)
-
tags/3.0.3/vendor/composer/autoload_classmap.php (added)
-
tags/3.0.3/vendor/composer/autoload_namespaces.php (added)
-
tags/3.0.3/vendor/composer/autoload_psr4.php (added)
-
tags/3.0.3/vendor/composer/autoload_real.php (added)
-
tags/3.0.3/vendor/composer/autoload_static.php (added)
-
tags/3.0.3/vendor/composer/installed.json (added)
-
tags/3.0.3/vendor/composer/installed.php (added)
-
tags/3.0.3/vendor/composer/jetpack_autoload_classmap.php (added)
-
tags/3.0.3/vendor/composer/platform_check.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-autoloader-handler.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-autoloader-locator.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-autoloader.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-container.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-hook-manager.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-latest-autoloader-guard.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-manifest-reader.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-path-processor.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-php-autoloader.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-plugin-locator.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-plugins-handler.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-shutdown-handler.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-version-loader.php (added)
-
tags/3.0.3/vendor/jetpack-autoloader/class-version-selector.php (added)
-
tags/3.0.3/vendor/storepress (added)
-
tags/3.0.3/vendor/storepress/admin-utils (added)
-
tags/3.0.3/vendor/storepress/admin-utils/README.md (added)
-
tags/3.0.3/vendor/storepress/admin-utils/build (added)
-
tags/3.0.3/vendor/storepress/admin-utils/build/admin-settings-rtl.css (added)
-
tags/3.0.3/vendor/storepress/admin-utils/build/admin-settings.asset.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/build/admin-settings.css (added)
-
tags/3.0.3/vendor/storepress/admin-utils/build/admin-settings.js (added)
-
tags/3.0.3/vendor/storepress/admin-utils/composer.json (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Common.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Field.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Fields.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Menu.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/REST_API.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Section.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Settings.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Updater.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/Upgrade_Notice.php (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/templates (added)
-
tags/3.0.3/vendor/storepress/admin-utils/includes/templates/classic-template.php (added)
-
tags/3.0.3/woo-2checkout.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/build/convert-plus-block.asset.php (modified) (1 diff)
-
trunk/build/convert-plus-block.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/API.php (modified) (2 diffs)
-
trunk/includes/ConvertPlus/ConvertPlus_Gateway.php (modified) (2 diffs)
-
trunk/includes/Plugin.php (modified) (1 diff)
-
trunk/languages/woo-2checkout.pot (modified) (7 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/autoload_packages.php (added)
-
trunk/vendor/automattic (added)
-
trunk/vendor/automattic/jetpack-autoloader (added)
-
trunk/vendor/automattic/jetpack-autoloader/CHANGELOG.md (added)
-
trunk/vendor/automattic/jetpack-autoloader/LICENSE.txt (added)
-
trunk/vendor/automattic/jetpack-autoloader/README.md (added)
-
trunk/vendor/automattic/jetpack-autoloader/SECURITY.md (added)
-
trunk/vendor/automattic/jetpack-autoloader/composer.json (added)
-
trunk/vendor/automattic/jetpack-autoloader/src (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/AutoloadFileWriter.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/AutoloadGenerator.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/AutoloadProcessor.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/ManifestGenerator.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/autoload.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-autoloader-handler.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-autoloader-locator.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-autoloader.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-container.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-hook-manager.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-latest-autoloader-guard.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-manifest-reader.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-path-processor.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-php-autoloader.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-plugin-locator.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-plugins-handler.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-shutdown-handler.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-version-loader.php (added)
-
trunk/vendor/automattic/jetpack-autoloader/src/class-version-selector.php (added)
-
trunk/vendor/composer/ClassLoader.php (modified) (27 diffs)
-
trunk/vendor/composer/InstalledVersions.php (modified) (4 diffs)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (4 diffs)
-
trunk/vendor/composer/installed.json (modified) (4 diffs)
-
trunk/vendor/composer/installed.php (modified) (3 diffs)
-
trunk/vendor/composer/jetpack_autoload_classmap.php (added)
-
trunk/vendor/composer/platform_check.php (modified) (1 diff)
-
trunk/vendor/jetpack-autoloader (added)
-
trunk/vendor/jetpack-autoloader/class-autoloader-handler.php (added)
-
trunk/vendor/jetpack-autoloader/class-autoloader-locator.php (added)
-
trunk/vendor/jetpack-autoloader/class-autoloader.php (added)
-
trunk/vendor/jetpack-autoloader/class-container.php (added)
-
trunk/vendor/jetpack-autoloader/class-hook-manager.php (added)
-
trunk/vendor/jetpack-autoloader/class-latest-autoloader-guard.php (added)
-
trunk/vendor/jetpack-autoloader/class-manifest-reader.php (added)
-
trunk/vendor/jetpack-autoloader/class-path-processor.php (added)
-
trunk/vendor/jetpack-autoloader/class-php-autoloader.php (added)
-
trunk/vendor/jetpack-autoloader/class-plugin-locator.php (added)
-
trunk/vendor/jetpack-autoloader/class-plugins-handler.php (added)
-
trunk/vendor/jetpack-autoloader/class-shutdown-handler.php (added)
-
trunk/vendor/jetpack-autoloader/class-version-loader.php (added)
-
trunk/vendor/jetpack-autoloader/class-version-selector.php (added)
-
trunk/vendor/storepress/admin-utils/README.md (modified) (10 diffs)
-
trunk/vendor/storepress/admin-utils/build (added)
-
trunk/vendor/storepress/admin-utils/build/admin-settings-rtl.css (added)
-
trunk/vendor/storepress/admin-utils/build/admin-settings.asset.php (added)
-
trunk/vendor/storepress/admin-utils/build/admin-settings.css (added)
-
trunk/vendor/storepress/admin-utils/build/admin-settings.js (added)
-
trunk/vendor/storepress/admin-utils/composer.json (modified) (1 diff)
-
trunk/vendor/storepress/admin-utils/includes/Common.php (added)
-
trunk/vendor/storepress/admin-utils/includes/Field.php (modified) (56 diffs)
-
trunk/vendor/storepress/admin-utils/includes/Fields.php (modified) (10 diffs)
-
trunk/vendor/storepress/admin-utils/includes/Menu.php (modified) (3 diffs)
-
trunk/vendor/storepress/admin-utils/includes/REST_API.php (modified) (17 diffs)
-
trunk/vendor/storepress/admin-utils/includes/Section.php (modified) (10 diffs)
-
trunk/vendor/storepress/admin-utils/includes/Settings.php (modified) (56 diffs)
-
trunk/vendor/storepress/admin-utils/includes/Updater.php (modified) (27 diffs)
-
trunk/vendor/storepress/admin-utils/includes/Upgrade_Notice.php (modified) (8 diffs)
-
trunk/vendor/storepress/admin-utils/includes/templates/classic-template.php (modified) (2 diffs)
-
trunk/woo-2checkout.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woo-2checkout/trunk/README.txt
r3081706 r3140508 2 2 Contributors: EmranAhmed, getwooplugins 3 3 Tags: 2checkout, 2checkout for woocommerce, 2checkout payment gateway, payment gateway, woocommerce payment gateway 4 Stable tag: 3.0. 24 Stable tag: 3.0.3 5 5 Requires PHP: 7.4 6 6 Requires at least: 6.1 … … 84 84 7. Activate the plugin 85 85 86 == Frequently Asked Questions == 87 88 = Do I need to create products on 2Checkout? = 89 90 No, you don't need to create any products on 2Checkout. 91 92 = Does it support WooCommerce Checkout Block? = 93 94 Yes, this payment gateway plugin support woocommerce checkout block too. 95 96 = Is there any known issue? = 97 98 Yes, Please make sure your can generate link on 2checkout account with "Dynamic Products". 99 86 100 == Changelog == 101 102 = 3.0.3 = 103 104 * Add: WC 9.2+ compatibility. 105 * Add: WP 6.6+ compatibility. 87 106 88 107 = 3.0.2 = -
woo-2checkout/trunk/build/convert-plus-block.asset.php
r3044506 r3140508 1 <?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => ' 8b5ecf98ba2c2e217c51');1 <?php return array('dependencies' => array('react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '3feed1c8c9f5d2c504d6'); -
woo-2checkout/trunk/build/convert-plus-block.js
r3044506 r3140508 1 (()=>{"use strict"; const e=window.React,t=window.wp.i18n,n=window.wc.wcBlocksRegistry,o=window.wp.htmlEntities,c=window.wc.wcSettings,s="woo-2checkout",r=window.wp.element,a=(0,c.getPaymentMethodData)(s,{}),l=(0,o.decodeEntities)(a?.title||(0,t.__)("2Checkout","woo-2checkout")),i=(0,o.decodeEntities)(a?.order_button_text||(0,t.__)("Proceed to 2Checkout","woo-2checkout")),u=a?.icon_uri,m=a?.is_demo;function w(){const n=(0,o.decodeEntities)(a.description||"");return m?(0,e.createElement)(e.Fragment,null,n,(0,e.createElement)("br",null),(0,e.createElement)("strong",null,(0,t.__)("DEMO MODE ENABLED.","woo-2checkout"))," ",(0,t.__)("Use a","woo-2checkout")," ",(0,e.createElement)("a",{target:"_blank",href:"https://verifone.cloud/docs/2checkout/Documentation/09Test_ordering_system/01Test_payment_methods",rel:"noreferrer"},(0,t.__)("test payment cards","woo-2checkout"))):n}const d={name:s,label:(0,e.createElement)((function(t){const{PaymentMethodLabel:n}=t.components;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n,{text:l})," ",(0,e.createElement)("img",{alt:l,className:"woo-2checkout-gateway-pay-image",src:u}))}),null),content:(0,e.createElement)((function(t){return function(e,t){const{eventRegistration:n,emitResponse:o}=e,{onCheckoutFail:c}=n;(0,r.useEffect)((()=>{const e=c((({processingResponse:e})=>{const{paymentDetails:t,paymentStatus:n}=e;return"failure"!==n||{type:o.responseTypes.ERROR,message:t?.messages,messageContext:o.noticeContexts.PAYMENTS,retry:!0}}));return()=>{e()}}),[o.responseTypes.ERROR,o.responseTypes.SUCCESS,o.noticeContexts.PAYMENTS,c])}(t),(0,e.createElement)(w,null)}),null),edit:(0,e.createElement)((function(){return(0,e.createElement)(w,null)}),null),canMakePayment:function(){return!0},placeOrderButtonLabel:i,icons:null,ariaLabel:l,supports:{features:a.supports}};(0,n.registerPaymentMethod)(d)})();1 (()=>{"use strict";var e={20:(e,t,o)=>{var n=o(609),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,o){var n,s={},u=null,p=null;for(n in void 0!==o&&(u=""+o),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(p=t.ref),t)c.call(t,n)&&!a.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:r,type:e,key:u,ref:p,props:s,_owner:i.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},848:(e,t,o)=>{e.exports=o(20)},609:e=>{e.exports=window.React}},t={};const o=window.wp.i18n,n=window.wc.wcBlocksRegistry,r=window.wp.htmlEntities,s=window.wc.wcSettings,c="woo-2checkout",i=window.wp.element;var a=function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}(848);const u=(0,s.getPaymentMethodData)(c,{}),p=(0,r.decodeEntities)(u?.title||(0,o.__)("2Checkout","woo-2checkout")),d=(0,r.decodeEntities)(u?.order_button_text||(0,o.__)("Proceed to 2Checkout","woo-2checkout")),l=u?.icon_uri,_=u?.is_demo;function w(e){const{PaymentMethodLabel:t}=e.components;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t,{text:p})," ",(0,a.jsx)("img",{alt:p,className:"woo-2checkout-gateway-pay-image",src:l})]})}function f(e){return function(e){const{eventRegistration:t,emitResponse:o}=e,{onCheckoutFail:n}=t;(0,i.useEffect)((()=>{const e=n((({processingResponse:e})=>{const{paymentDetails:t,paymentStatus:n}=e;return"failure"!==n||{type:o.responseTypes.ERROR,message:t?.messages,messageContext:o.noticeContexts.PAYMENTS,retry:!0}}));return()=>{e()}}),[o.responseTypes.ERROR,o.responseTypes.SUCCESS,o.noticeContexts.PAYMENTS,n])}(e),(0,a.jsx)(m,{})}function m(){const e=(0,r.decodeEntities)(u.description||"");return _?(0,a.jsxs)(a.Fragment,{children:[e,(0,a.jsx)("br",{}),(0,a.jsx)("strong",{children:(0,o.__)("DEMO MODE ENABLED.","woo-2checkout")})," ",(0,o.__)("Use a","woo-2checkout")," ",(0,a.jsx)("a",{target:"_blank",href:"https://verifone.cloud/docs/2checkout/Documentation/09Test_ordering_system/01Test_payment_methods",rel:"noreferrer",children:(0,o.__)("test payment cards","woo-2checkout")})]}):e}function y(){return(0,a.jsx)(m,{})}const x={name:c,label:(0,a.jsx)(w,{}),content:(0,a.jsx)(f,{}),edit:(0,a.jsx)(y,{}),canMakePayment:function(){return!0},placeOrderButtonLabel:d,icons:null,ariaLabel:p,supports:{features:u.supports}};(0,n.registerPaymentMethod)(x)})(); -
woo-2checkout/trunk/changelog.txt
r3081706 r3140508 1 1 == Payment Gateway - 2Checkout for WooCommerce == 2 3 = 3.0.3 - 2024-08-21 = 4 5 * Add - WC 9.1+ compatibility. 6 * Add - WP 6.6+ compatibility. 2 7 3 8 = 3.0.2 - 2024-05-05 = -
woo-2checkout/trunk/includes/API.php
r3081706 r3140508 110 110 'return-url', 111 111 'return-type', 112 //'back-url', 112 113 'expiration', 113 114 'order-ext-ref', … … 121 122 'price', 122 123 'qty', 124 //'tangible', 123 125 'type', 124 126 'opt', -
woo-2checkout/trunk/includes/ConvertPlus/ConvertPlus_Gateway.php
r3081706 r3140508 260 260 if ( $order->has_billing_address() ) { 261 261 $args['address'] = esc_html( $order->get_billing_address_1() ); 262 $args['address2'] = esc_html( $order->get_billing_address_2() ); 262 if( $order->get_billing_address_2() ){ 263 $args['address2'] = esc_html( $order->get_billing_address_2() ); 264 } 263 265 } 264 266 … … 441 443 $parameters = $this->payment_args( $order ); 442 444 445 ksort( $parameters); 446 443 447 $this->log( "PAYMENT ARGS:\n" . print_r( $parameters, true ) ); // phpcs:ignore. 444 448 445 449 $payment_url = $this->get_payment_url( $parameters ); 450 451 $this->log( "PAYMENT LINK:\n" . $payment_url ); // phpcs:ignore. 446 452 447 453 if ( ! empty( $payment_url ) ) { -
woo-2checkout/trunk/includes/Plugin.php
r3044506 r3140508 121 121 * Includes. 122 122 * 123 * @throws Exception When class files loading fails. 123 124 * @since 1.0.0 124 125 */ 125 126 public function includes() { 126 127 127 if ( file_exists( $this->vendor_path() . '/autoload .php' ) ) {128 require_once $this->vendor_path() . '/autoload .php';128 if ( file_exists( $this->vendor_path() . '/autoload_packages.php' ) ) { 129 require_once $this->vendor_path() . '/autoload_packages.php'; 129 130 require_once __DIR__ . '/functions.php'; 130 } 131 return; 132 } 133 134 throw new Exception( '"vendor/autoload_packages.php" file missing. Please run `composer install`' ); 131 135 } 132 136 -
woo-2checkout/trunk/languages/woo-2checkout.pot
r3081706 r3140508 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Payment Gateway - 2Checkout for WooCommerce 3.0. 2\n"5 "Project-Id-Version: Payment Gateway - 2Checkout for WooCommerce 3.0.3\n" 6 6 "Report-Msgid-Bugs-To: https://getwooplugins.com/new-ticket/\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024-0 5-06T06:54:50+00:00\n"12 "POT-Creation-Date: 2024-08-23T18:38:11+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.1 0.0\n"14 "X-Generator: WP-CLI 2.11.0\n" 15 15 "language-team: LANGUAGE <EMAIL@ADDRESS>\n" 16 16 "X-Domain: woo-2checkout\n" … … 48 48 #: includes/Payment_Gateway.php:102 49 49 #: includes/Payment_Gateway.php:260 50 #: src/convert-plus-block.js:2750 #: build/convert-plus-block.js:1 51 51 msgid "Proceed to 2Checkout" 52 52 msgstr "" … … 55 55 #: includes/Payment_Gateway.php:100 56 56 #: includes/Payment_Gateway.php:245 57 #: src/convert-plus-block.js:2357 #: build/convert-plus-block.js:1 58 58 msgid "2Checkout" 59 59 msgstr "" … … 66 66 67 67 #. translators: Shipping Method Name 68 #: includes/ConvertPlus/ConvertPlus_Gateway.php:40 168 #: includes/ConvertPlus/ConvertPlus_Gateway.php:403 69 69 msgid "Shipping via %s" 70 70 msgstr "" 71 71 72 #: includes/ConvertPlus/ConvertPlus_Gateway.php:4 5472 #: includes/ConvertPlus/ConvertPlus_Gateway.php:460 73 73 msgid "Failed to Generate 2Checkout ConvertPlus URL." 74 74 msgstr "" … … 259 259 msgstr "" 260 260 261 #: includes/Plugin.php:1 77261 #: includes/Plugin.php:181 262 262 msgid "Payment Gateway - 2Checkout for WooCommerce - Pro " 263 263 msgstr "" 264 264 265 265 #. translators: %s: Pro version link. 266 #: includes/Plugin.php:18 1266 #: includes/Plugin.php:185 267 267 msgid "Upgrade to %s to get WooCommerce Subscriptions payments, issue refunds from wp admin, inline popup checkout and more." 268 268 msgstr "" 269 269 270 #: includes/Plugin.php:48 0270 #: includes/Plugin.php:484 271 271 msgid "Settings" 272 272 msgstr "" … … 280 280 msgstr "" 281 281 282 #: src/convert-plus-block.js:89282 #: build/convert-plus-block.js:1 283 283 msgid "DEMO MODE ENABLED." 284 284 msgstr "" 285 285 286 #: src/convert-plus-block.js:91286 #: build/convert-plus-block.js:1 287 287 msgid "Use a" 288 288 msgstr "" 289 289 290 #: src/convert-plus-block.js:98290 #: build/convert-plus-block.js:1 291 291 msgid "test payment cards" 292 292 msgstr "" -
woo-2checkout/trunk/vendor/autoload.php
r3081706 r3140508 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit ce260624bbcd03fad5e82c3fe1f7a15c::getLoader();25 return ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d::getLoader(); -
woo-2checkout/trunk/vendor/composer/ClassLoader.php
r3044506 r3140508 46 46 private static $includeFile; 47 47 48 /** @var ?string*/48 /** @var string|null */ 49 49 private $vendorDir; 50 50 51 51 // PSR-4 52 52 /** 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 53 * @var array<string, array<string, int>> 55 54 */ 56 55 private $prefixLengthsPsr4 = array(); 57 56 /** 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 57 * @var array<string, list<string>> 60 58 */ 61 59 private $prefixDirsPsr4 = array(); 62 60 /** 63 * @var array[] 64 * @psalm-var array<string, string> 61 * @var list<string> 65 62 */ 66 63 private $fallbackDirsPsr4 = array(); … … 68 65 // PSR-0 69 66 /** 70 * @var array[] 71 * @psalm-var array<string, array<string, string[]>> 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 72 72 */ 73 73 private $prefixesPsr0 = array(); 74 74 /** 75 * @var array[] 76 * @psalm-var array<string, string> 75 * @var list<string> 77 76 */ 78 77 private $fallbackDirsPsr0 = array(); … … 82 81 83 82 /** 84 * @var string[] 85 * @psalm-var array<string, string> 83 * @var array<string, string> 86 84 */ 87 85 private $classMap = array(); … … 91 89 92 90 /** 93 * @var bool[] 94 * @psalm-var array<string, bool> 91 * @var array<string, bool> 95 92 */ 96 93 private $missingClasses = array(); 97 94 98 /** @var ?string*/95 /** @var string|null */ 99 96 private $apcuPrefix; 100 97 101 98 /** 102 * @var self[]99 * @var array<string, self> 103 100 */ 104 101 private static $registeredLoaders = array(); 105 102 106 103 /** 107 * @param ?string$vendorDir104 * @param string|null $vendorDir 108 105 */ 109 106 public function __construct($vendorDir = null) … … 114 111 115 112 /** 116 * @return string[]113 * @return array<string, list<string>> 117 114 */ 118 115 public function getPrefixes() … … 126 123 127 124 /** 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 125 * @return array<string, list<string>> 130 126 */ 131 127 public function getPrefixesPsr4() … … 135 131 136 132 /** 137 * @return array[] 138 * @psalm-return array<string, string> 133 * @return list<string> 139 134 */ 140 135 public function getFallbackDirs() … … 144 139 145 140 /** 146 * @return array[] 147 * @psalm-return array<string, string> 141 * @return list<string> 148 142 */ 149 143 public function getFallbackDirsPsr4() … … 153 147 154 148 /** 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 149 * @return array<string, string> Array of classname => path 157 150 */ 158 151 public function getClassMap() … … 162 155 163 156 /** 164 * @param string[] $classMap Class to filename map 165 * @psalm-param array<string, string> $classMap 157 * @param array<string, string> $classMap Class to filename map 166 158 * 167 159 * @return void … … 180 172 * appending or prepending to the ones previously set for this prefix. 181 173 * 182 * @param string $prefix The prefix183 * @param string[]|string $paths The PSR-0 root directories184 * @param bool $prepend Whether to prepend the directories174 * @param string $prefix The prefix 175 * @param list<string>|string $paths The PSR-0 root directories 176 * @param bool $prepend Whether to prepend the directories 185 177 * 186 178 * @return void … … 188 180 public function add($prefix, $paths, $prepend = false) 189 181 { 182 $paths = (array) $paths; 190 183 if (!$prefix) { 191 184 if ($prepend) { 192 185 $this->fallbackDirsPsr0 = array_merge( 193 (array)$paths,186 $paths, 194 187 $this->fallbackDirsPsr0 195 188 ); … … 197 190 $this->fallbackDirsPsr0 = array_merge( 198 191 $this->fallbackDirsPsr0, 199 (array)$paths192 $paths 200 193 ); 201 194 } … … 206 199 $first = $prefix[0]; 207 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 208 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 209 202 210 203 return; … … 212 205 if ($prepend) { 213 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 214 (array)$paths,207 $paths, 215 208 $this->prefixesPsr0[$first][$prefix] 216 209 ); … … 218 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 219 212 $this->prefixesPsr0[$first][$prefix], 220 (array)$paths213 $paths 221 214 ); 222 215 } … … 227 220 * appending or prepending to the ones previously set for this namespace. 228 221 * 229 * @param string $prefix The prefix/namespace, with trailing '\\'230 * @param string[]|string $paths The PSR-4 base directories231 * @param bool $prepend Whether to prepend the directories222 * @param string $prefix The prefix/namespace, with trailing '\\' 223 * @param list<string>|string $paths The PSR-4 base directories 224 * @param bool $prepend Whether to prepend the directories 232 225 * 233 226 * @throws \InvalidArgumentException … … 237 230 public function addPsr4($prefix, $paths, $prepend = false) 238 231 { 232 $paths = (array) $paths; 239 233 if (!$prefix) { 240 234 // Register directories for the root namespace. 241 235 if ($prepend) { 242 236 $this->fallbackDirsPsr4 = array_merge( 243 (array)$paths,237 $paths, 244 238 $this->fallbackDirsPsr4 245 239 ); … … 247 241 $this->fallbackDirsPsr4 = array_merge( 248 242 $this->fallbackDirsPsr4, 249 (array)$paths243 $paths 250 244 ); 251 245 } … … 257 251 } 258 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 259 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 260 254 } elseif ($prepend) { 261 255 // Prepend directories for an already registered namespace. 262 256 $this->prefixDirsPsr4[$prefix] = array_merge( 263 (array)$paths,257 $paths, 264 258 $this->prefixDirsPsr4[$prefix] 265 259 ); … … 268 262 $this->prefixDirsPsr4[$prefix] = array_merge( 269 263 $this->prefixDirsPsr4[$prefix], 270 (array)$paths264 $paths 271 265 ); 272 266 } … … 277 271 * replacing any others previously set for this prefix. 278 272 * 279 * @param string $prefix The prefix280 * @param string[]|string $paths The PSR-0 base directories273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 281 275 * 282 276 * @return void … … 295 289 * replacing any others previously set for this namespace. 296 290 * 297 * @param string $prefix The prefix/namespace, with trailing '\\'298 * @param string[]|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 299 293 * 300 294 * @throws \InvalidArgumentException … … 430 424 { 431 425 if ($file = $this->findFile($class)) { 432 (self::$includeFile)($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 433 428 434 429 return true; … … 481 476 482 477 /** 483 * Returns the currently registered loaders indexed by their corresponding vendor directories.484 * 485 * @return self[]478 * Returns the currently registered loaders keyed by their corresponding vendor directories. 479 * 480 * @return array<string, self> 486 481 */ 487 482 public static function getRegisteredLoaders() … … 561 556 } 562 557 563 private static function initializeIncludeClosure(): void 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 564 562 { 565 563 if (self::$includeFile !== null) { … … 575 573 * @return void 576 574 */ 577 self::$includeFile = static function($file) {575 self::$includeFile = \Closure::bind(static function($file) { 578 576 include $file; 579 } ;577 }, null, null); 580 578 } 581 579 } -
woo-2checkout/trunk/vendor/composer/InstalledVersions.php
r3044506 r3140508 99 99 foreach (self::getInstalled() as $installed) { 100 100 if (isset($installed['versions'][$packageName])) { 101 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);101 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; 102 102 } 103 103 } … … 120 120 public static function satisfies(VersionParser $parser, $packageName, $constraint) 121 121 { 122 $constraint = $parser->parseConstraints( $constraint);122 $constraint = $parser->parseConstraints((string) $constraint); 123 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 124 124 … … 329 329 $installed[] = self::$installedByVendor[$vendorDir]; 330 330 } elseif (is_file($vendorDir.'/composer/installed.php')) { 331 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; 331 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 332 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 333 335 self::$installed = $installed[count($installed) - 1]; … … 341 343 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 342 344 if (substr(__DIR__, -8, 1) !== 'C') { 343 self::$installed = require __DIR__ . '/installed.php'; 345 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 346 $required = require __DIR__ . '/installed.php'; 347 self::$installed = $required; 344 348 } else { 345 349 self::$installed = array(); 346 350 } 347 351 } 348 $installed[] = self::$installed; 352 353 if (self::$installed !== array()) { 354 $installed[] = self::$installed; 355 } 349 356 350 357 return $installed; -
woo-2checkout/trunk/vendor/composer/autoload_classmap.php
r3044506 r3140508 7 7 8 8 return array( 9 'Automattic\\Jetpack\\Autoloader\\AutoloadFileWriter' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadFileWriter.php', 10 'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php', 11 'Automattic\\Jetpack\\Autoloader\\AutoloadProcessor' => $vendorDir . '/automattic/jetpack-autoloader/src/AutoloadProcessor.php', 12 'Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin' => $vendorDir . '/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php', 13 'Automattic\\Jetpack\\Autoloader\\ManifestGenerator' => $vendorDir . '/automattic/jetpack-autoloader/src/ManifestGenerator.php', 9 14 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 15 'StorePress\\AdminUtils\\Common' => $vendorDir . '/storepress/admin-utils/includes/Common.php', 10 16 'StorePress\\AdminUtils\\Field' => $vendorDir . '/storepress/admin-utils/includes/Field.php', 11 17 'StorePress\\AdminUtils\\Fields' => $vendorDir . '/storepress/admin-utils/includes/Fields.php', -
woo-2checkout/trunk/vendor/composer/autoload_psr4.php
r3044506 r3140508 9 9 'StorePress\\TwoCheckoutPaymentGateway\\' => array($baseDir . '/includes'), 10 10 'StorePress\\AdminUtils\\' => array($vendorDir . '/storepress/admin-utils/includes'), 11 'Automattic\\Jetpack\\Autoloader\\' => array($vendorDir . '/automattic/jetpack-autoloader/src'), 11 12 ); -
woo-2checkout/trunk/vendor/composer/autoload_real.php
r3081706 r3140508 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit ce260624bbcd03fad5e82c3fe1f7a15c5 class ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit ce260624bbcd03fad5e82c3fe1f7a15c', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit ce260624bbcd03fad5e82c3fe1f7a15c', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitfbd493a17f366db9959bbabb6910870d', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit ce260624bbcd03fad5e82c3fe1f7a15c::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitfbd493a17f366db9959bbabb6910870d::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
woo-2checkout/trunk/vendor/composer/autoload_static.php
r3081706 r3140508 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit ce260624bbcd03fad5e82c3fe1f7a15c7 class ComposerStaticInitfbd493a17f366db9959bbabb6910870d 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 12 12 'StorePress\\TwoCheckoutPaymentGateway\\' => 37, 13 13 'StorePress\\AdminUtils\\' => 22, 14 ), 15 'A' => 16 array ( 17 'Automattic\\Jetpack\\Autoloader\\' => 30, 14 18 ), 15 19 ); … … 24 28 0 => __DIR__ . '/..' . '/storepress/admin-utils/includes', 25 29 ), 30 'Automattic\\Jetpack\\Autoloader\\' => 31 array ( 32 0 => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src', 33 ), 26 34 ); 27 35 28 36 public static $classMap = array ( 37 'Automattic\\Jetpack\\Autoloader\\AutoloadFileWriter' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/AutoloadFileWriter.php', 38 'Automattic\\Jetpack\\Autoloader\\AutoloadGenerator' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/AutoloadGenerator.php', 39 'Automattic\\Jetpack\\Autoloader\\AutoloadProcessor' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/AutoloadProcessor.php', 40 'Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/CustomAutoloaderPlugin.php', 41 'Automattic\\Jetpack\\Autoloader\\ManifestGenerator' => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src/ManifestGenerator.php', 29 42 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 43 'StorePress\\AdminUtils\\Common' => __DIR__ . '/..' . '/storepress/admin-utils/includes/Common.php', 30 44 'StorePress\\AdminUtils\\Field' => __DIR__ . '/..' . '/storepress/admin-utils/includes/Field.php', 31 45 'StorePress\\AdminUtils\\Fields' => __DIR__ . '/..' . '/storepress/admin-utils/includes/Fields.php', … … 48 62 { 49 63 return \Closure::bind(function () use ($loader) { 50 $loader->prefixLengthsPsr4 = ComposerStaticInit ce260624bbcd03fad5e82c3fe1f7a15c::$prefixLengthsPsr4;51 $loader->prefixDirsPsr4 = ComposerStaticInit ce260624bbcd03fad5e82c3fe1f7a15c::$prefixDirsPsr4;52 $loader->classMap = ComposerStaticInit ce260624bbcd03fad5e82c3fe1f7a15c::$classMap;64 $loader->prefixLengthsPsr4 = ComposerStaticInitfbd493a17f366db9959bbabb6910870d::$prefixLengthsPsr4; 65 $loader->prefixDirsPsr4 = ComposerStaticInitfbd493a17f366db9959bbabb6910870d::$prefixDirsPsr4; 66 $loader->classMap = ComposerStaticInitfbd493a17f366db9959bbabb6910870d::$classMap; 53 67 54 68 }, null, ClassLoader::class); -
woo-2checkout/trunk/vendor/composer/installed.json
r3081706 r3140508 2 2 "packages": [ 3 3 { 4 "name": "automattic/jetpack-autoloader", 5 "version": "v3.0.9", 6 "version_normalized": "3.0.9.0", 7 "source": { 8 "type": "git", 9 "url": "https://github.com/Automattic/jetpack-autoloader.git", 10 "reference": "a571038214fc3e142e10f38d1bb97e470fa7b0ec" 11 }, 12 "dist": { 13 "type": "zip", 14 "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/a571038214fc3e142e10f38d1bb97e470fa7b0ec", 15 "reference": "a571038214fc3e142e10f38d1bb97e470fa7b0ec", 16 "shasum": "" 17 }, 18 "require": { 19 "composer-plugin-api": "^1.1 || ^2.0", 20 "php": ">=7.0" 21 }, 22 "require-dev": { 23 "automattic/jetpack-changelogger": "^4.2.5", 24 "composer/composer": "^1.1 || ^2.0", 25 "yoast/phpunit-polyfills": "1.1.0" 26 }, 27 "time": "2024-07-10T07:51:07+00:00", 28 "type": "composer-plugin", 29 "extra": { 30 "autotagger": true, 31 "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin", 32 "mirror-repo": "Automattic/jetpack-autoloader", 33 "changelogger": { 34 "link-template": "https://github.com/Automattic/jetpack-autoloader/compare/v${old}...v${new}" 35 }, 36 "version-constants": { 37 "::VERSION": "src/AutoloadGenerator.php" 38 }, 39 "branch-alias": { 40 "dev-trunk": "3.0.x-dev" 41 } 42 }, 43 "installation-source": "dist", 44 "autoload": { 45 "psr-4": { 46 "Automattic\\Jetpack\\Autoloader\\": "src" 47 }, 48 "classmap": [ 49 "src/AutoloadGenerator.php" 50 ] 51 }, 52 "notification-url": "https://packagist.org/downloads/", 53 "license": [ 54 "GPL-2.0-or-later" 55 ], 56 "description": "Creates a custom autoloader for a plugin or theme.", 57 "keywords": [ 58 "autoload", 59 "autoloader", 60 "composer", 61 "jetpack", 62 "plugin", 63 "wordpress" 64 ], 65 "support": { 66 "source": "https://github.com/Automattic/jetpack-autoloader/tree/v3.0.9" 67 }, 68 "install-path": "../automattic/jetpack-autoloader" 69 }, 70 { 4 71 "name": "storepress/admin-utils", 5 "version": "1.8. 5",6 "version_normalized": "1.8. 5.0",72 "version": "1.8.8", 73 "version_normalized": "1.8.8.0", 7 74 "source": { 8 75 "type": "git", 9 76 "url": "https://github.com/EmranAhmed/storepress-admin-utils.git", 10 "reference": " 36b4d595519ae25f3be2625f70e16b9ef8769cfa"77 "reference": "69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837" 11 78 }, 12 79 "dist": { 13 80 "type": "zip", 14 "url": "https://api.github.com/repos/EmranAhmed/storepress-admin-utils/zipball/ 36b4d595519ae25f3be2625f70e16b9ef8769cfa",15 "reference": " 36b4d595519ae25f3be2625f70e16b9ef8769cfa",81 "url": "https://api.github.com/repos/EmranAhmed/storepress-admin-utils/zipball/69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837", 82 "reference": "69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837", 16 83 "shasum": "" 17 84 }, 18 "require": { 19 "php": ">=7.4" 85 "require-dev": { 86 "automattic/vipwpcs": "^3.0", 87 "php-stubs/woocommerce-stubs": "^9.0", 88 "phpcompatibility/phpcompatibility-wp": "^2.1.5", 89 "phpstan/extension-installer": "^1.4", 90 "phpstan/phpstan-strict-rules": "^1.6", 91 "szepeviktor/phpstan-wordpress": "^1.3", 92 "woocommerce/woocommerce-sniffs": "^1.0.0", 93 "wp-cli/i18n-command": "^v2.6.0", 94 "wp-coding-standards/wpcs": "^3.1.0" 20 95 }, 21 "require-dev": { 22 "phpcompatibility/phpcompatibility-wp": "^2.1.4", 23 "wp-coding-standards/wpcs": "^3.0.1" 24 }, 25 "time": "2024-04-24T07:44:14+00:00", 96 "time": "2024-07-01T12:29:55+00:00", 26 97 "type": "library", 27 98 "installation-source": "dist", … … 33 104 "notification-url": "https://packagist.org/downloads/", 34 105 "license": [ 35 "GPL- 3.0-or-later"106 "GPL-2.0-or-later" 36 107 ], 37 108 "authors": [ … … 42 113 ], 43 114 "description": "Utility Classes for WordPress Plugin Projects.", 115 "homepage": "https://github.com/EmranAhmed/storepress-admin-utils#readme", 44 116 "keywords": [ 45 117 "plugin", … … 53 125 "support": { 54 126 "issues": "https://github.com/EmranAhmed/storepress-admin-utils/issues", 55 "source": "https://github.com/EmranAhmed/storepress-admin-utils/tree/1.8. 5"127 "source": "https://github.com/EmranAhmed/storepress-admin-utils/tree/1.8.8" 56 128 }, 57 129 "install-path": "../storepress/admin-utils" -
woo-2checkout/trunk/vendor/composer/installed.php
r3081706 r3140508 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => 'b b7bfb37f35a118844290275253ed6720fa7a5ab',6 'reference' => 'be918cf066aec0cb8d530068b20d3f1ec069e8a8', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 11 11 ), 12 12 'versions' => array( 13 'automattic/jetpack-autoloader' => array( 14 'pretty_version' => 'v3.0.9', 15 'version' => '3.0.9.0', 16 'reference' => 'a571038214fc3e142e10f38d1bb97e470fa7b0ec', 17 'type' => 'composer-plugin', 18 'install_path' => __DIR__ . '/../automattic/jetpack-autoloader', 19 'aliases' => array(), 20 'dev_requirement' => false, 21 ), 13 22 'storepress/admin-utils' => array( 14 'pretty_version' => '1.8. 5',15 'version' => '1.8. 5.0',16 'reference' => ' 36b4d595519ae25f3be2625f70e16b9ef8769cfa',23 'pretty_version' => '1.8.8', 24 'version' => '1.8.8.0', 25 'reference' => '69b5cb4b5a2b4625dbdb2a6bd3344c5e35fa5837', 17 26 'type' => 'library', 18 27 'install_path' => __DIR__ . '/../storepress/admin-utils', … … 23 32 'pretty_version' => 'dev-master', 24 33 'version' => 'dev-master', 25 'reference' => 'b b7bfb37f35a118844290275253ed6720fa7a5ab',34 'reference' => 'be918cf066aec0cb8d530068b20d3f1ec069e8a8', 26 35 'type' => 'wordpress-plugin', 27 36 'install_path' => __DIR__ . '/../../', -
woo-2checkout/trunk/vendor/composer/platform_check.php
r3044506 r3140508 5 5 $issues = array(); 6 6 7 if (!(PHP_VERSION_ID >= 70 400)) {8 $issues[] = 'Your Composer dependencies require a PHP version ">= 7. 4.0". You are running ' . PHP_VERSION . '.';7 if (!(PHP_VERSION_ID >= 70000)) { 8 $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.'; 9 9 } 10 10 -
woo-2checkout/trunk/vendor/storepress/admin-utils/README.md
r3044506 r3140508 11 11 ## Usage 12 12 13 ### Plugin Class 13 ### Plugin instance 14 14 15 ```php 15 16 <?php … … 27 28 28 29 ### Plugin `AdminPage.php` 30 29 31 ```php 30 32 <?php … … 86 88 // URL will be: `/wp-json/<page_id>/<rest_api_version>/settings` 87 89 public function show_in_rest(): ?string { 88 return false;89 }90 return false; 91 } 90 92 // NOTE: You have to create and proper access to get REST API response. 91 93 // Create: "Application Passwords" from "WP Admin -> Users -> Profile" to use. 92 94 // Will return: /wp-json/my-custom-uri/settings 93 public function show_in_rest(): ?string {94 return 'my-custom-uri';95 }95 public function show_in_rest(): ?string { 96 return 'my-custom-uri'; 97 } 96 98 97 99 // Settings and Rest API Display Capability. Default is: manage_options 98 public function capability(): string {100 public function capability(): string { 99 101 return 'edit_posts'; 100 102 } 101 103 102 104 // Change rest api version. Default is: v1 103 public function rest_api_version(): string {105 public function rest_api_version(): string { 104 106 return 'v2'; 105 107 } … … 296 298 } 297 299 ``` 298 ### Section data structure. 300 301 ### Section data structure 302 299 303 ```php 300 304 array( … … 304 308 ) 305 309 ``` 306 ### Field data structure. 310 311 ### Field data structure 312 307 313 ```php 308 314 array( … … 360 366 } 361 367 ``` 368 362 369 - Now use `Settings::instance();` on `Plugin::init()` 363 370 … … 366 373 - URL will be: `/wp-json/<page_id>/<rest_api_version>/settings` 367 374 368 ### Upgrade Notice: 375 ### Upgrade Notice 376 369 377 - Show notice for incompatible extended plugin. 378 370 379 ```php 371 380 namespace Plugin_A; … … 411 420 - Now use `Upgrade_Notice::instance();` on `Plugin::init()` 412 421 413 ### Plugin Update: 422 ### Plugin Update 423 414 424 - You must add `Update URI:` on plugin file header to perform update. 425 415 426 ```php 416 427 <?php … … 421 432 */ 422 433 ``` 434 423 435 ### Plugin `Updater.php` file 436 424 437 ```php 425 438 <?php … … 484 497 - Now use `Updater::instance();` on `Plugin::init()` 485 498 486 ## Update Server :499 ## Update Server 487 500 488 501 ```php -
woo-2checkout/trunk/vendor/storepress/admin-utils/composer.json
r3081706 r3140508 1 1 { 2 "name" : "storepress/admin-utils", 3 "description" : "Utility Classes for WordPress Plugin Projects.", 4 "version" : "1.8.5", 5 "license" : "GPL-3.0-or-later", 6 "type" : "library", 7 "keywords" : [ 8 "wordpress", 9 "storepress", 10 "plugin-settings-panel", 11 "plugin-settings-api", 12 "plugin-settings-rest-api", 13 "plugin-updater", 14 "plugin" 15 ], 16 "authors" : [ 17 { 18 "name" : "Emran Ahmed", 19 "email" : "emran.bd.08@gmail.com" 20 } 21 ], 22 "minimum-stability" : "dev", 23 "require" : { 24 "php" : ">=7.4" 25 }, 26 "require-dev" : { 27 "phpcompatibility/phpcompatibility-wp" : "^2.1.4", 28 "wp-coding-standards/wpcs" : "^3.0.1" 29 }, 30 "autoload" : { 31 "psr-4" : { 32 "StorePress\\AdminUtils\\" : "includes/" 33 } 34 }, 35 "config" : { 36 "optimize-autoloader" : true, 37 "sort-packages" : true, 38 "allow-plugins" : { 39 "dealerdirect/phpcodesniffer-composer-installer" : true 40 } 41 } 2 "name" : "storepress/admin-utils", 3 "description" : "Utility Classes for WordPress Plugin Projects.", 4 "version" : "1.8.8", 5 "license" : "GPL-2.0-or-later", 6 "type" : "library", 7 "keywords" : [ 8 "wordpress", 9 "storepress", 10 "plugin-settings-panel", 11 "plugin-settings-api", 12 "plugin-settings-rest-api", 13 "plugin-updater", 14 "plugin" 15 ], 16 "authors" : [ 17 { 18 "name" : "Emran Ahmed", 19 "email" : "emran.bd.08@gmail.com" 20 } 21 ], 22 "homepage" : "https://github.com/EmranAhmed/storepress-admin-utils#readme", 23 "minimum-stability" : "dev", 24 "require-dev" : { 25 "automattic/vipwpcs" : "^3.0", 26 "phpcompatibility/phpcompatibility-wp" : "^2.1.5", 27 "woocommerce/woocommerce-sniffs" : "^1.0.0", 28 "wp-cli/i18n-command" : "^v2.6.0", 29 "wp-coding-standards/wpcs" : "^3.1.0", 30 "php-stubs/woocommerce-stubs" : "^9.0", 31 "phpstan/extension-installer" : "^1.4", 32 "phpstan/phpstan-strict-rules" : "^1.6", 33 "szepeviktor/phpstan-wordpress" : "^1.3" 34 }, 35 "autoload" : { 36 "psr-4" : { 37 "StorePress\\AdminUtils\\" : "includes/" 38 } 39 }, 40 "config" : { 41 "optimize-autoloader" : true, 42 "sort-packages" : true, 43 "allow-plugins" : { 44 "dealerdirect/phpcodesniffer-composer-installer" : true, 45 "phpstan/extension-installer" : true 46 } 47 }, 48 "scripts" : { 49 "phpstan" : "./vendor/bin/phpstan analyse . --memory-limit=2G -vvv", 50 "phpstan-report" : "./vendor/bin/phpstan analyse . --memory-limit=2G -vvv > phpstan.report.txt", 51 "format" : "./vendor/bin/phpcbf --standard=phpcs.xml", 52 "lint" : "./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=6 --report-summary --report-source --ignore-annotations --report-full=phpcs-report.txt" 53 } 42 54 } -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Field.php
r3044506 r3140508 1 1 <?php 2 2 /** 3 * Admin Settings Field 3 * Admin Settings Field Class File. 4 4 * 5 5 * @package StorePress/AdminUtils 6 * @version 1.0 6 * @since 1.0.0 7 * @version 1.0.0 7 8 */ 8 9 10 declare(strict_types=1); 11 9 12 namespace StorePress\AdminUtils; 10 13 11 14 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 12 13 15 14 16 if ( ! class_exists( '\StorePress\AdminUtils\Field' ) ) { 15 17 /** 16 * Admin Settings Field 18 * Admin Settings Field Class. 17 19 * 18 20 * @name Field … … 20 22 class Field { 21 23 22 /** 23 * @var array 24 use Common; 25 26 /** 27 * Single field. 28 * 29 * @var string[]|array<string, mixed> 24 30 */ 25 31 private array $field; 26 32 /** 33 * Setting Object. 34 * 27 35 * @var Settings 28 36 */ … … 30 38 31 39 /** 40 * Setting ID. 41 * 32 42 * @var string 33 43 */ … … 35 45 36 46 /** 37 * Field38 * 39 * @param array$field field Array.47 * Construct Field 48 * 49 * @param string[]|array<string, mixed> $field field Array. 40 50 */ 41 51 public function __construct( array $field ) { … … 43 53 } 44 54 45 /*** 46 * @param Settings $settings 47 * @param array $values 55 /** 56 * Add Settings. 57 * 58 * @param Settings $settings Settings Object. 59 * @param array<string, mixed> $values Settings values. Default is: array(). 48 60 * 49 61 * @return self … … 52 64 $this->settings = $settings; 53 65 54 if ( empty( $values ) ) {66 if ( $this->is_empty_array( $values ) ) { 55 67 $this->populate_option_values(); 56 68 } else { … … 64 76 65 77 /** 78 * Populate all values. 79 * 66 80 * @return void 67 81 */ … … 81 95 82 96 /** 83 * @param array $values 97 * Populate from passed values. 98 * 99 * @param array<string, mixed> $values Values. 84 100 * 85 101 * @return void … … 92 108 } 93 109 94 /*** 110 /** 111 * Get Settings Object. 112 * 95 113 * @return Settings 96 114 */ … … 100 118 101 119 /** 102 * @param mixed $value 120 * Add value. 121 * 122 * @param string|string[]|numeric|bool|null $value Pass value. 103 123 * 104 124 * @return self … … 111 131 112 132 /** 133 * Get settings id. 134 * 113 135 * @return string 114 136 */ … … 118 140 119 141 /** 120 * @param string $settings_id 142 * Add settings id. 143 * 144 * @param string $settings_id Settings ID. 121 145 * 122 146 * @return self … … 129 153 130 154 /** 131 * @return mixed|null 155 * Get default value. 156 * 157 * @return string|string[]|bool|numeric|null 132 158 */ 133 159 public function get_default_value() { … … 136 162 137 163 /** 138 * @param boolean $is_group 164 * Generate setting name 165 * 166 * @param boolean $is_group Pass group name to get name based on group. 139 167 * 140 168 * @return string … … 148 176 149 177 /** 178 * Generate private name. 179 * 150 180 * @return string 151 181 */ … … 158 188 159 189 /** 190 * Check field is private or not. 191 * 160 192 * @return bool 161 193 */ … … 165 197 166 198 /** 167 * @param $default 168 * 169 * @return mixed|null 170 */ 171 public function get_value( $default = null ) { 172 return $this->get_attribute( 'value', $default ?? $this->get_default_value() ); 173 } 174 175 /** 176 * @return array 199 * Get value 200 * 201 * @param bool|string|string[]|null $default_value Default value. 202 * 203 * @return bool|string|string[]|null 204 */ 205 public function get_value( $default_value = null ) { 206 return $this->get_attribute( 'value', $default_value ?? $this->get_default_value() ); 207 } 208 209 /** 210 * Get available options 211 * 212 * @return string[]|array<string, string> 177 213 */ 178 214 public function get_options(): array { … … 181 217 182 218 /** 219 * Get field type. 220 * 183 221 * @return string 184 222 */ … … 188 226 $keys = array_keys( $alias ); 189 227 190 if ( in_array( $type, $keys ) ) {228 if ( in_array( $type, $keys, true ) ) { 191 229 return $alias[ $type ]; 192 230 } … … 196 234 197 235 /** 236 * Get field raw type 237 * 198 238 * @return string 199 239 */ … … 203 243 204 244 /** 245 * Check field has custom sanitize function. 246 * 205 247 * @return bool 206 248 */ … … 210 252 211 253 /** 254 * Check field has custom escaping function. 255 * 212 256 * @return bool 213 257 */ … … 232 276 case 'email': 233 277 return 'sanitize_email'; 234 break;235 278 case 'url': 236 279 return 'sanitize_url'; 237 break;238 280 case 'textarea': 239 281 return 'sanitize_textarea_field'; 240 break;241 282 case 'color': 242 283 return 'sanitize_hex_color'; 243 break;244 284 case 'number': 245 285 return 'absint'; 246 break;247 286 default: 248 287 return 'sanitize_text_field'; 249 break; 250 } 251 } 252 253 /** 254 * Escape data before display from database. Escape data on output. 288 } 289 } 290 291 /** 292 * Escaping function. escape data before display from database. Escape data on output. 255 293 * 256 294 * @return string … … 267 305 case 'email': 268 306 return 'sanitize_email'; 269 break;270 307 case 'url': 271 308 return 'esc_url'; 272 break;273 309 case 'textarea': 274 310 return 'esc_textarea'; 275 break;276 311 case 'color': 277 312 return 'sanitize_hex_color'; 278 break;279 313 case 'number': 280 314 return 'absint'; 281 break;282 315 default: 283 316 return 'esc_html'; 284 break; 285 } 286 } 287 288 /** 317 } 318 } 319 320 /** 321 * Check is group type. 322 * 289 323 * @return bool 290 324 */ … … 294 328 295 329 /** 330 * Get field id. 331 * 296 332 * @return string|null 297 333 */ … … 300 336 } 301 337 338 /** 339 * Get available field sizes. 340 * 341 * @return string[] 342 */ 302 343 public function get_field_size_css_classes(): array { 303 344 return array( 'regular-text', 'small-text', 'tiny-text', 'large-text' ); … … 305 346 306 347 /** 307 * @param mixed $classes 308 * @param mixed $default 348 * Prepare field classes. 349 * 350 * @param string|string[] $classes Class names. 351 * @param string|string[] $default_value Default value. 309 352 * 310 353 * @return string[] 311 354 */ 312 public function prepare_classes( $classes, $default = '' ): array {313 314 $default_classnames = is_array( $default ) ? $default : explode( ' ', $default);355 public function prepare_classes( $classes, $default_value = '' ): array { 356 357 $default_classnames = is_array( $default_value ) ? $default_value : explode( ' ', $default_value ); 315 358 $setting_classnames = is_array( $classes ) ? $classes : explode( ' ', $classes ); 316 359 … … 318 361 $remove_default_size_class = false; 319 362 363 /** 364 * Settings Classes. 365 * 366 * @var string[] $setting_classnames 367 */ 320 368 foreach ( $setting_classnames as $setting_classname ) { 321 if ( in_array( $setting_classname, $this->get_field_size_css_classes() ) ) {369 if ( in_array( $setting_classname, $this->get_field_size_css_classes(), true ) ) { 322 370 $remove_default_size_class = true; 323 371 } 324 372 } 325 373 374 /** 375 * Default Classes. 376 * 377 * @var string[] $default_classnames 378 */ 326 379 foreach ( $default_classnames as $default_classname ) { 327 if ( $remove_default_size_class && in_array( $default_classname, $this->get_field_size_css_classes() ) ) {380 if ( $remove_default_size_class && in_array( $default_classname, $this->get_field_size_css_classes(), true ) ) { 328 381 continue; 329 382 } … … 335 388 336 389 /** 337 * @return string|array 390 * Get field class. 391 * 392 * @return string|string[] 338 393 */ 339 394 public function get_css_class() { … … 342 397 343 398 /** 344 * @return string 399 * Get field suffix. 400 * 401 * @return string|null 345 402 */ 346 403 public function get_suffix(): ?string { … … 349 406 350 407 /** 408 * Get field title. 409 * 351 410 * @return string|null 352 411 */ … … 356 415 357 416 /** 358 * @return array 417 * Get field data. 418 * 419 * @return string[]|array<string, mixed> 359 420 */ 360 421 public function get_field(): array { … … 362 423 } 363 424 364 365 /** 366 * @param string $attribute 425 /** 426 * Check has attribute. 427 * 428 * @param string $attribute Attribute name to check. 367 429 * 368 430 * @return bool … … 375 437 376 438 /** 377 * @param string $attribute 378 * @param mixed $default . Default null. 379 * 380 * @return mixed|null 381 */ 382 public function get_attribute( string $attribute, $default = null ) { 439 * Check field shown in rest api. 440 * 441 * @return bool 442 */ 443 public function has_show_in_rest(): bool { 444 445 if ( ! $this->has_attribute( 'show_in_rest' ) ) { 446 return false; 447 } 448 449 if ( false === $this->get_attribute( 'show_in_rest' ) ) { 450 return false; 451 } 452 453 if ( is_string( $this->get_attribute( 'show_in_rest' ) ) && $this->is_empty_string( $this->get_attribute( 'show_in_rest' ) ) ) { 454 return false; 455 } 456 457 return true; 458 } 459 460 /** 461 * Get attribute. 462 * 463 * @param string $attribute Attribute name. 464 * @param string|string[]|null|bool $default_value Default value. Default null. 465 * 466 * @return string|string[]|null|bool 467 */ 468 public function get_attribute( string $attribute, $default_value = null ) { 383 469 $field = $this->get_field(); 384 470 385 return $field[ $attribute ] ?? $default; 386 } 387 471 return $field[ $attribute ] ?? $default_value; 472 } 473 474 /** 475 * Get group inputs. 476 * 477 * @return string[] 478 */ 388 479 public function group_inputs(): array { 389 480 return array( 'radio', 'checkbox', 'group' ); … … 391 482 392 483 /** 393 * @param array $attrs 394 * @param array $additional_attrs . Default array 395 * 396 * @return string 397 */ 398 public function get_html_attributes( array $attrs, array $additional_attrs = array() ): string { 484 * Get HTML Attributes. 485 * 486 * @param array<string, mixed> $attrs Attributes. 487 * @param array<string, mixed> $additional_attrs Additional attributes. Default array(). 488 * 489 * @return string 490 */ 491 public function get_input_attributes( array $attrs, array $additional_attrs = array() ): string { 399 492 400 493 $attributes = wp_parse_args( $additional_attrs, $attrs ); 401 494 402 return implode( 403 ' ', 404 array_map( 405 function ( $key ) use ( $attributes ) { 406 407 if ( is_bool( $attributes[ $key ] ) ) { 408 return $attributes[ $key ] ? $key : ''; 409 } 410 411 $value = $attributes[ $key ]; 412 413 if ( in_array( $key, array( 'class' ) ) ) { 414 415 if ( is_array( $attributes[ $key ] ) ) { 416 // Class name sanitized. 417 $value = implode( ' ', array_unique( $attributes[ $key ] ) ); 418 } 419 } 420 421 return sprintf( '%s="%s"', esc_attr( $key ), esc_attr( $value ) ); 422 }, 423 array_keys( $attributes ) 424 ) 425 ); 426 } 427 495 return $this->get_html_attributes( $attributes ); 496 } 497 498 /** 499 * Creating custom input field. 500 * 501 * @return string 502 */ 428 503 public function custom_input(): string { 429 504 … … 435 510 436 511 $message = sprintf( 'Field: "%s" not implemented. Please add "Settings::custom_field" method to implement.', $type ); 437 $this->get_settings()->trigger_error( '', $message );512 wp_trigger_error( '', $message ); 438 513 439 514 return ''; 440 515 } 441 516 442 public function text_input( $css_class = 'regular-text' ): string { 517 /** 518 * Text input markup. 519 * 520 * @param string $css_class Input CSS class. 521 * 522 * @return string 523 */ 524 public function text_input( string $css_class = 'regular-text' ): string { 443 525 444 526 $id = $this->get_id(); … … 475 557 } 476 558 477 return sprintf( '<input %s> %s', $this->get_html_attributes( $attributes, $additional_attributes ), $this->get_suffix() ); 478 } 479 480 public function textarea_input( $css_class = 'regular-text' ): string { 559 return sprintf( '<input %s /> %s', $this->get_input_attributes( $attributes, $additional_attributes ), $this->get_suffix() ); 560 } 561 562 /** 563 * TextArea Input Markup. 564 * 565 * @param string $css_class TextArea css class. 566 * 567 * @return string 568 */ 569 public function textarea_input( string $css_class = 'regular-text' ): string { 481 570 482 571 $id = $this->get_id(); … … 507 596 } 508 597 509 return sprintf( '<textarea %s>%s</textarea>', $this->get_html_attributes( $attributes, $additional_attributes ), $value ); 510 } 511 598 return sprintf( '<textarea %s>%s</textarea>', $this->get_input_attributes( $attributes, $additional_attributes ), $value ); 599 } 600 601 /** 602 * Checkbox Input 603 * 604 * @return string 605 */ 512 606 public function check_input(): string { 513 607 … … 519 613 $options = $this->get_options(); 520 614 521 // group checkbox615 // Group checkbox. Options will be an array. 522 616 if ( 'checkbox' === $type && count( $options ) > 1 ) { 523 617 $name = $this->get_name( true ); 524 618 } 525 619 526 // single checkbox527 if ( 'checkbox' === $type && empty( $options ) ) {620 // Single checkbox. Option will be string. 621 if ( 'checkbox' === $type && $this->is_empty_array( $options ) ) { 528 622 $options = array( 'yes' => $title ); 529 623 } 530 624 531 // check radio input have options declared.532 if ( 'radio' === $type && empty( $options ) ) {533 $message = sprintf( 'Input Field: "%s". Title: "%s" need options to choose. ', $id, $title );534 $this->get_settings()->trigger_error( '', $message );625 // Check radio input have options declared. 626 if ( 'radio' === $type && $this->is_empty_array( $options ) ) { 627 $message = sprintf( 'Input Field: "%s". Title: "%s" need options to choose. "option"=>["key"=>"value"]', $id, $title ); 628 wp_trigger_error( '', $message ); 535 629 536 630 return ''; … … 539 633 $inputs = array(); 540 634 635 /** 636 * Group Options. 637 * 638 * @var array<string, string> $options 639 */ 541 640 foreach ( $options as $option_key => $option_value ) { 542 641 $uniq_id = sprintf( '%s-%s', $id, $option_key ); … … 547 646 'name' => $name, 548 647 'value' => esc_attr( $option_key ), 549 'checked' => ( 'checkbox' === $type ) ? in_array( $option_key, is_array( $value ) ? $value : array( $value ) ) : $value === $option_key,648 'checked' => ( 'checkbox' === $type ) ? in_array( $option_key, is_array( $value ) ? $value : array( $value ), true ) : $value === $option_key, 550 649 ); 551 650 552 $inputs[] = sprintf( '<label for="%s"><input %s /><span>%s</span></label>', esc_attr( $uniq_id ), $this->get_ html_attributes( $attributes ), esc_html( $option_value ) );651 $inputs[] = sprintf( '<label for="%s"><input %s /><span>%s</span></label>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $option_value ) ); 553 652 } 554 653 … … 556 655 } 557 656 657 /** 658 * Select Input box. 659 * 660 * @return string 661 */ 558 662 public function select_input(): string { 559 663 … … 598 702 599 703 foreach ( $options as $option_key => $option_value ) { 600 $selected = ( $is_multiple ) ? in_array( $option_key, is_array( $value ) ? $value : array( $value ) ) : $value === $option_key; 601 $inputs[] = sprintf( '<option %s value="%s"><span>%s</span></option>', $this->get_html_attributes( array( 'selected' => $selected ) ), esc_attr( $option_key ), esc_html( $option_value ) ); 602 } 603 604 return sprintf( '<select %s>%s</select>', $this->get_html_attributes( $attributes, $additional_attributes ), implode( '', $inputs ) ); 605 } 606 607 /** 608 * @return self[] 704 $selected = ( $is_multiple ) ? in_array( $option_key, is_array( $value ) ? $value : array( $value ), true ) : $value === $option_key; 705 $inputs[] = sprintf( '<option %s value="%s"><span>%s</span></option>', $this->get_input_attributes( array( 'selected' => $selected ) ), esc_attr( $option_key ), esc_html( $option_value ) ); 706 } 707 708 return sprintf( '<select %s>%s</select>', $this->get_input_attributes( $attributes, $additional_attributes ), implode( '', $inputs ) ); 709 } 710 711 /** 712 * Get group fields. 713 * 714 * @return Field[] 609 715 */ 610 716 public function get_group_fields(): array { … … 616 722 $fields = array(); 617 723 724 /** 725 * Group Filed object array 726 * 727 * @var array<string, string|string[]> $group_fields $group_fields 728 */ 729 618 730 foreach ( $group_fields as $field ) { 619 731 $fields[] = ( new Field( $field ) )->add_settings( $this->get_settings(), $group_value )->add_settings_id( $name ); … … 623 735 } 624 736 737 /** 738 * Get REST API Group values. 739 * 740 * @return array<string, string|string[]> 741 */ 625 742 public function get_rest_group_values(): array { 626 743 … … 629 746 foreach ( $this->get_group_fields() as $field ) { 630 747 631 if ( empty( $field->get_attribute( 'show_in_rest' )) ) {748 if ( false === $field->has_show_in_rest() ) { 632 749 continue; 633 750 } … … 643 760 } 644 761 762 /** 763 * Get REST API Value. 764 * 765 * @return mixed 766 */ 645 767 public function get_rest_value() { 646 768 $escape_callback = $this->get_escape_callback(); … … 649 771 } 650 772 773 /** 774 * Get Group Values. 775 * 776 * @return array<string, mixed> 777 */ 651 778 public function get_group_values(): array { 652 779 … … 663 790 664 791 /** 665 * @param string $field_id 666 * @param mixed $default 667 * 668 * @return mixed|null 669 */ 670 public function get_group_value( string $field_id, $default = null ) { 792 * Get Group value. 793 * 794 * @param string $field_id Field ID. 795 * @param bool|null|string|string[] $default_value Default group value. 796 * 797 * @return bool|null|string|string[] 798 */ 799 public function get_group_value( string $field_id, $default_value = null ) { 671 800 672 801 foreach ( $this->get_group_fields() as $field ) { 673 802 $id = $field->get_id(); 674 803 if ( $id === $field_id ) { 675 return $field->get_value( $default );804 return $field->get_value( $default_value ); 676 805 } 677 806 } 678 807 679 return $default; 680 } 681 682 public function group_input( $css_class = 'small-text' ): string { 808 return $default_value; 809 } 810 811 /** 812 * Group Input Markup. 813 * 814 * @param string $css_class Css Class. 815 * 816 * @return string 817 */ 818 public function group_input( string $css_class = 'small-text' ): string { 683 819 684 820 $id = $this->get_id(); … … 714 850 ); 715 851 716 // Group checkbox name 717 if ( 'checkbox' === $field_type && $field_options &&count( $field_options ) > 1 ) {852 // Group checkbox name. 853 if ( 'checkbox' === $field_type && count( $field_options ) > 1 ) { 718 854 $attributes['name'] = $field->get_name( true ); 719 855 } 720 856 721 if ( in_array( $field_type, $this->group_inputs() ) ) {857 if ( in_array( $field_type, $this->group_inputs(), true ) ) { 722 858 723 859 $attributes['class'] = array(); 724 860 725 // Single checkbox 726 if ( 'checkbox' === $field_type && empty( $field_options ) ) {861 // Single checkbox. 862 if ( 'checkbox' === $field_type && $this->is_empty_array( $field_options ) ) { 727 863 $attributes['value'] = 'yes'; 728 864 $attributes['checked'] = 'yes' === $field_value; 729 865 730 $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><input %s /><span>%s</span></label></p>', esc_attr( $uniq_id ), $this->get_ html_attributes( $attributes ), esc_html( $field_title ) );866 $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><input %s /><span>%s</span></label></p>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $field_title ) ); 731 867 732 868 continue; 733 869 } 734 870 735 // Checkbox and Radio 871 // Checkbox and Radio. 736 872 $inputs[] = '<ul class="input-wrapper">'; 873 /** 874 * Group Options. 875 * 876 * @var array<string, string> $field_options 877 */ 737 878 foreach ( $field_options as $option_key => $option_value ) { 738 879 $uniq_id = sprintf( '%s-%s-%s__group', $id, $field_id, $option_key ); 739 880 $attributes['value'] = esc_attr( $option_key ); 740 $attributes['checked'] = is_array( $field_value ) ? in_array( $option_key, $field_value ) : $option_key == $field_value;881 $attributes['checked'] = is_array( $field_value ) ? in_array( $option_key, $field_value, true ) : $option_key == $field_value; 741 882 $attributes['id'] = $uniq_id; 742 $inputs[] = sprintf( '<li><label for="%s"><input %s /><span>%s</span></label></li>', esc_attr( $uniq_id ), $this->get_ html_attributes( $attributes ), esc_html( $option_value ) );883 $inputs[] = sprintf( '<li><label for="%s"><input %s /><span>%s</span></label></li>', esc_attr( $uniq_id ), $this->get_input_attributes( $attributes ), esc_html( $option_value ) ); 743 884 } 744 885 $inputs[] = '</ul>'; 745 886 887 } elseif ( 'textarea' === $field_type ) { 888 // Input box. 889 $attributes['value'] = false; 890 $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <textarea %s>%s</textarea></p>', esc_attr( $uniq_id ), esc_html( $field_title ), $this->get_input_attributes( $attributes, $field_attributes ), $field_value ); 746 891 } else { 747 // Input 748 749 if ( 'textarea' === $field_type ) { 750 $attributes['value'] = false; 751 $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <textarea %s>%s</textarea></p>', esc_attr( $uniq_id ), esc_html( $field_title ), $this->get_html_attributes( $attributes, $field_attributes ), $field_value ); 752 } else { 753 $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <input %s /> %s</p>', esc_attr( $uniq_id ), esc_html( $field_title ), $this->get_html_attributes( $attributes, $field_attributes ), esc_html( $field_suffix ) ); 754 } 892 $inputs[] = sprintf( '<p class="input-wrapper"><label for="%s"><span>%s</span></label> <input %s /> %s</p>', esc_attr( $uniq_id ), esc_html( $field_title ), $this->get_input_attributes( $attributes, $field_attributes ), esc_html( $field_suffix ) ); 755 893 } 756 894 } … … 759 897 } 760 898 761 public function get_rest_type(): ?string { 899 /** 900 * Get REST Type Primitive Types. 901 * 902 * @return string 903 * @see https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types 904 * @example array( 'number', 'integer', 'string', 'boolean', 'array', 'object' ) 905 */ 906 public function get_rest_type(): string { 762 907 763 908 $type = $this->get_type(); 764 909 $options = $this->get_options(); 765 $is_single = empty( $options );910 $is_single = $this->is_empty_array( $options ); 766 911 $is_multiple = $this->has_attribute( 'multiple' ); 767 912 768 // array( 'number', 'integer', 'string', 'boolean', 'array', 'object' )769 770 913 switch ( $type ) { 771 case 'textarea' ;772 case 'email' ;773 case 'url' ;774 case 'text' ;775 case 'regular-text' ;776 case 'color' ;777 case 'small-text' ;778 case 'tiny-text' ;779 case 'large-text' ;780 case 'radio' ;781 case 'code' ;914 case 'textarea': 915 case 'email': 916 case 'url': 917 case 'text': 918 case 'regular-text': 919 case 'color': 920 case 'small-text': 921 case 'tiny-text': 922 case 'large-text': 923 case 'radio': 924 case 'code': 782 925 return 'string'; 783 break; 784 case 'number'; 926 case 'number': 785 927 return 'number'; 786 break; 787 case 'checkbox'; 928 case 'checkbox': 788 929 return $is_single ? 'string' : 'array'; 789 break; 790 case 'select2'; 791 case 'select'; 930 case 'select2': 931 case 'select': 792 932 return $is_multiple ? 'array' : 'string'; 793 break; 794 case 'group'; 933 case 'group': 795 934 return 'object'; 796 break;797 935 } 798 936 … … 801 939 802 940 /** 941 * Label Markup. 942 * 803 943 * @return string 804 944 * @todo Label based on input … … 810 950 $type = $this->get_type(); 811 951 812 if ( in_array( $type, $this->group_inputs() ) ) {952 if ( in_array( $type, $this->group_inputs(), true ) ) { 813 953 return $title; 814 954 } … … 822 962 823 963 /** 964 * Get field type alias. 965 * 824 966 * @return string[] 825 967 */ … … 836 978 } 837 979 838 /*** 980 /** 981 * Get Input Markups 982 * 839 983 * @return string 840 984 * @todo Add More Fields 841 985 * @see Settings::sanitize_fields() 986 * @example: input, code, textarea, select, select2, regular-text, small-text, tiny-text, large-text, color 842 987 */ 843 988 public function get_input_markup(): string { 844 989 $type = $this->get_type(); 845 // input, code, textarea, select, select2, regular-text, small-text, tiny-text, large-text, color846 990 847 991 switch ( $type ) { 848 case 'text' ;849 case 'regular-text' ;850 case 'code' ;992 case 'text': 993 case 'regular-text': 994 case 'code': 851 995 return $this->text_input(); 852 break; 853 case 'color'; 854 case 'number'; 855 case 'small-text'; 996 case 'color': 997 case 'number': 998 case 'small-text': 856 999 return $this->text_input( 'small-text' ); 857 break; 858 case 'tiny-text'; 1000 case 'tiny-text': 859 1001 return $this->text_input( 'tiny-text' ); 860 break; 861 case 'large-text'; 1002 case 'large-text': 862 1003 return $this->text_input( 'large-text' ); 863 break; 864 case 'radio'; 865 case 'checkbox'; 1004 case 'radio': 1005 case 'checkbox': 866 1006 return $this->check_input(); 867 break; 868 case 'select'; 869 case 'select2'; 1007 case 'select': 1008 case 'select2': 870 1009 return $this->select_input(); 871 break; 872 case 'group'; 1010 case 'group': 873 1011 return $this->group_input(); 874 break; 875 case 'textarea'; 1012 case 'textarea': 876 1013 return $this->textarea_input(); 877 break;878 1014 default: 879 1015 return $this->custom_input(); 880 break; 881 } 882 } 883 884 /** 1016 } 1017 } 1018 1019 /** 1020 * Get field description markup. 1021 * 885 1022 * @return string 886 1023 */ … … 892 1029 893 1030 /** 1031 * Display generated field 1032 * 894 1033 * @return string 895 1034 */ -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Fields.php
r3044506 r3140508 1 1 <?php 2 /** 3 * Admin Settings Fields Class File. 4 * 5 * @package StorePress/AdminUtils 6 * @since 1.0.0 7 * @version 1.0.0 8 */ 9 10 declare(strict_types=1); 2 11 3 12 namespace StorePress\AdminUtils; … … 5 14 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 6 15 16 if ( ! class_exists( '\StorePress\AdminUtils\Fields' ) ) { 7 17 /** 8 * Admin Settings 18 * Admin Settings Fields Class. 9 19 * 10 * @package StorePress/AdminUtils11 20 * @name Fields 12 * @version 1.013 21 */ 22 class Fields { 14 23 15 if ( ! class_exists( '\StorePress\AdminUtils\Fields' ) ) { 16 class Fields { 24 use Common; 25 17 26 /** 18 * @var array 27 * Sections. 28 * 29 * @var array<string, object> 19 30 */ 20 31 private array $sections = array(); 21 32 /** 33 * Last section ID. 34 * 22 35 * @var string 23 36 */ … … 25 38 26 39 /** 27 * @param array $fields 28 * @param Settings $settings 40 * Class Construct. 41 * 42 * @param array<string, string|string[]> $fields Field list. 43 * @param Settings $settings Settings Class Instance. 29 44 */ 30 45 public function __construct( array $fields, Settings $settings ) { 31 46 47 /** 48 * Fields 49 * 50 * @var array<string, string|string[]> $fields 51 */ 32 52 foreach ( $fields as $field ) { 33 53 … … 48 68 49 69 // Generate section id when section not available on a tab. 50 if ( empty( $this->last_section_id ) ) {70 if ( $this->is_empty_string( $this->last_section_id ) ) { 51 71 $this->sections[ $section_id ] = new Section( 52 72 array( … … 58 78 59 79 if ( $this->is_field( $field ) ) { 60 // $value = $this->get_saved_value( $_field );61 // $f = $_field->add_value( $value )->add_settings_id( $this->get_settings()->get_settings_id() );62 80 $this->sections[ $this->last_section_id ]->add_field( $_field ); 63 81 } … … 66 84 67 85 /** 68 * @param array $field 86 * Check is section or not. 87 * 88 * @param array<string, string> $field Single field. 69 89 * 70 90 * @return bool … … 75 95 76 96 /** 77 * @param array $field 97 * Check is field or not. 98 * 99 * @param array<string, string> $field Field array. 78 100 * 79 101 * @return bool … … 84 106 85 107 /** 108 * Get section id. 109 * 86 110 * @return string 87 111 */ … … 91 115 92 116 /** 93 * @param array $field117 * Get Field ID. 94 118 * 95 * @return mixed 119 * @param array<string, string> $field Field array. 120 * 121 * @return string 96 122 */ 97 public function get_field_id( array $field ) {123 public function get_field_id( array $field ): string { 98 124 return $field['id']; 99 125 } 100 126 101 127 /** 102 * @return array 128 * Get Sections. 129 * 130 * @return array<string, object> 103 131 */ 104 132 public function get_sections(): array { … … 107 135 108 136 /** 137 * Display fields with section wrapped. 138 * 109 139 * @return void 110 140 */ 111 141 public function display() { 142 143 $allowed_input_html = $this->get_kses_allowed_input_html(); 112 144 /** 145 * Section Instance. 146 * 113 147 * @var Section $section 114 148 */ 115 149 foreach ( $this->get_sections() as $section ) { 116 echo $section->display();150 echo wp_kses_post( $section->display() ); 117 151 118 152 if ( $section->has_fields() ) { 119 153 120 echo $section->before_display_fields();154 echo wp_kses_post( $section->before_display_fields() ); 121 155 /** 156 * Field Instance. 157 * 122 158 * @var Field $field 123 159 */ 124 160 foreach ( $section->get_fields() as $field ) { 125 echo $field->display();161 echo wp_kses( $field->display(), $allowed_input_html ); 126 162 } 127 163 128 echo $section->after_display_fields();164 echo wp_kses_post( $section->after_display_fields() ); 129 165 } 130 166 } -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Menu.php
r3044506 r3140508 1 1 <?php 2 3 namespace StorePress\AdminUtils;4 5 defined( 'ABSPATH' ) || die( 'Keep Silent' );6 7 2 /** 8 * Admin Menu3 * Admin Settings Menu Class File. 9 4 * 10 5 * @package StorePress/AdminUtils 6 * @since 1.0.0 7 * @version 1.0.0 8 */ 9 10 declare(strict_types=1); 11 12 namespace StorePress\AdminUtils; 13 14 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 15 16 if ( ! class_exists( '\StorePress\AdminUtils\Menu' ) ) { 17 /** 18 * Admin Settings Menu Class. 19 * 11 20 * @name Menu 12 * @version 1.013 21 */ 14 if ( ! class_exists( '\StorePress\AdminUtils\Menu' ) ) { 15 16 abstract class Menu { 17 18 private static int $position = 2; 19 private static array $slug_usages = array(); 20 private string $current_page_slug = ''; 21 22 /** 23 * Menu constructor. 24 */ 25 public function __construct() { 26 27 add_action( 'admin_menu', function () { 28 global $submenu, $menu; 29 30 // Bail if submenu 22 abstract class Menu { 23 24 use Common; 25 26 /** 27 * Menu Position 28 * 29 * @var int $position Menu Position. 30 */ 31 private static int $position = 2; 32 33 /** 34 * Used menu slugs. 35 * 36 * @var array<string, int> $slug_usages Slug used in menu. 37 */ 38 39 private static array $slug_usages = array(); 40 41 /** 42 * Current Page Slug. 43 * 44 * @var string $current_page_slug Store Current visiting page slug. 45 */ 46 private string $current_page_slug = ''; 47 48 /** 49 * Menu constructor. 50 */ 51 public function __construct() { 52 53 add_action( 54 'admin_menu', 55 function () { 56 // Bail if submenu. 31 57 if ( $this->is_submenu() ) { 32 58 return; 33 59 } 34 35 // Create uniqueMenu.36 foreach ( $menu as $m ) {37 if ( $m[ 2 ] === $this->get_parent_slug() ) { 38 return;39 }60 61 // Create Unique Parent Menu. 62 $parent_menu_url = (bool) trim( menu_page_url( $this->get_parent_slug(), false ) ); 63 64 if ( $parent_menu_url ) { 65 return; 40 66 } 41 67 42 68 $capability = $this->get_capability(); 43 44 $separator_menu_position = sprintf( '%s.%s', $this->get_menu_position(), self::$position );69 70 $separator_menu_position = (float) sprintf( '%d.%d', $this->get_menu_position(), self::$position ); 45 71 $this->admin_menu_separator( $separator_menu_position, $this->get_parent_slug(), $capability ); 46 self::$position ++; 47 48 $menu_position = sprintf( '%s.%s', $this->get_menu_position(), self::$position ); 49 add_menu_page( $this->get_parent_menu_title(), $this->get_parent_menu_title(), $capability, $this->get_parent_slug(), '', $this->get_menu_icon(), $menu_position ); 50 self::$position ++; 51 }, 9 ); 52 53 add_action( 'admin_menu', function () { 54 global $submenu, $menu; 55 72 self::$position++; 73 74 $menu_position = (float) sprintf( '%d.%d', $this->get_menu_position(), self::$position ); 75 add_menu_page( 76 $this->get_parent_menu_title(), 77 $this->get_parent_menu_title(), 78 $capability, 79 $this->get_parent_slug(), 80 '__return_false', 81 $this->get_menu_icon(), 82 $menu_position 83 ); 84 self::$position++; 85 }, 86 9 87 ); 88 89 add_action( 90 'admin_menu', 91 function () { 92 56 93 $parent_slug = $this->get_parent_slug(); 57 94 58 95 $menu_slug = $this->get_page_slug(); 59 96 60 97 if ( ! isset( self::$slug_usages[ $menu_slug ] ) ) { 61 98 self::$slug_usages[ $menu_slug ] = 0; … … 63 100 self::$slug_usages[ $menu_slug ] += 1; 64 101 } 65 102 66 103 if ( 0 === self::$slug_usages[ $menu_slug ] ) { 67 104 $this->current_page_slug = sprintf( '%s', $menu_slug ); … … 69 106 $this->current_page_slug = sprintf( '%s-%s', $menu_slug, self::$slug_usages[ $menu_slug ] ); 70 107 } 71 108 72 109 $capability = $this->get_capability(); 73 74 $settings_page = add_submenu_page( $parent_slug, $this->page_title(), $this->menu_title(), $capability, $this->get_current_page_slug(), function () { 75 76 if ( ! current_user_can( $this->get_capability() ) ) { 77 return; 110 111 $settings_page = add_submenu_page( 112 $parent_slug, 113 $this->page_title(), 114 $this->menu_title(), 115 $capability, 116 $this->get_current_page_slug(), 117 function () { 118 119 if ( ! current_user_can( $this->get_capability() ) ) { 120 return; 121 } 122 123 $this->display_settings_page(); 78 124 } 79 80 $this->display_settings_page(); 81 } ); 82 83 add_action( 'load-' . $settings_page, function () { 84 85 if ( ! current_user_can( $this->get_capability() ) ) { 86 return; 125 ); 126 127 add_action( 128 'load-' . $settings_page, 129 function () { 130 131 if ( ! current_user_can( $this->get_capability() ) ) { 132 return; 133 } 134 135 $this->settings_page_init(); 87 136 } 88 89 $this->settings_page_init();90 } );91 }, 12);92 93 add_action( 'admin_menu', function () {94 95 global $submenu, $menu;96 137 ); 138 }, 139 12 140 ); 141 142 add_action( 143 'admin_menu', 144 function () { 145 97 146 if ( $this->is_submenu() ) { 98 147 return; 99 148 } 100 101 $slug = $this->get_parent_slug(); 102 103 if ( ! isset( $submenu[ $slug ] ) ) { 104 return; 105 } 106 107 unset( $submenu[ $slug ][ 0 ] ); 108 }, 60 ); 109 110 add_action( 'admin_init', function () { 111 112 // Settings Actions 149 150 // Remove duplicate menu. 151 $menu_slug = $this->get_parent_slug(); 152 153 remove_submenu_page( $menu_slug, $menu_slug ); 154 }, 155 60 156 ); 157 158 add_action( 159 'admin_init', 160 function () { 161 162 // Process Settings Actions. 113 163 $this->settings_actions(); 114 115 // Settings Init164 165 // Load Settings. 116 166 $this->settings_init(); 117 } ); 118 119 add_action( 'rest_api_init', function () { 120 // Settings REST Init 167 } 168 ); 169 170 add_action( 171 'rest_api_init', 172 function () { 173 // Settings REST Init. 121 174 $this->rest_api_init(); 122 } ); 175 } 176 ); 177 178 add_action( 179 'admin_enqueue_scripts', 180 function () { 181 wp_add_inline_style( 'admin-menu', '#adminmenu li.menu-top.wp-menu-separator { min-height: auto; }' ); 182 } 183 ); 184 } 185 186 /** 187 * REST API Init. 188 * 189 * @return void 190 */ 191 abstract public function rest_api_init(); 192 193 /** 194 * Settings Init. 195 * 196 * @return void 197 */ 198 abstract public function settings_init(); 199 200 /** 201 * Load Settings Page. 202 * 203 * @return void 204 */ 205 abstract public function settings_page_init(); 206 207 /** 208 * Process Settings Actions. 209 * 210 * @return void 211 */ 212 abstract public function settings_actions(); 213 214 /** 215 * Process Single Settings action. 216 * 217 * @param string $current_action action key. 218 * 219 * @return void 220 */ 221 abstract public function process_actions( string $current_action ); 222 223 /** 224 * Set Parent Menu Slug 225 * 226 * @return string 227 */ 228 abstract public function parent_menu(): string; 229 230 /** 231 * Settings template. Can override for custom ui page. 232 * 233 * @see https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions 234 * @return void 235 */ 236 abstract public function display_settings_page(); 237 238 /** 239 * Get Parent Menu or Main Menu name 240 * 241 * @return string 242 */ 243 public function get_parent_menu(): string { 244 return $this->parent_menu(); 245 } 246 247 /** 248 * Set Parent Menu Title 249 * 250 * @return string 251 */ 252 abstract public function parent_menu_title(): string; 253 254 /** 255 * Get Parent or Main Menu Title 256 * 257 * @return string menu title; 258 */ 259 public function get_parent_menu_title(): string { 260 return $this->parent_menu_title(); 261 } 262 263 /** 264 * Assign Parent Menu Icon 265 * 266 * @return string 267 */ 268 abstract public function menu_icon(): string; 269 270 /** 271 * Get Main Menu Icon 272 * 273 * @return string menu icon; 274 */ 275 public function get_menu_icon(): string { 276 return $this->menu_icon(); 277 } 278 279 /** 280 * Assign Parent Menu Position 281 * 282 * @return int 283 */ 284 abstract public function menu_position(): int; 285 286 /** 287 * Get Main Menu Position 288 * 289 * @return int menu position; 290 */ 291 public function get_menu_position(): int { 292 return $this->menu_position(); 293 } 294 295 /** 296 * Assign Settings Page Title. 297 * 298 * @return string Settings Page Title. 299 */ 300 abstract public function page_title(): string; 301 302 /** 303 * Get Settings Page Title. 304 * 305 * @return string Get Settings Page Title. 306 */ 307 public function get_page_title(): string { 308 return $this->page_title(); 309 } 310 311 /** 312 * Assign Settings Page Menu Title. 313 * 314 * @return string Settings Page Menu Title. 315 */ 316 abstract public function menu_title(): string; 317 318 /** 319 * Get Settings Page Menu Title. 320 * 321 * @return string 322 */ 323 public function get_menu_title(): string { 324 return $this->menu_title(); 325 } 326 327 /** 328 * Assign Settings Page ID. 329 * 330 * @return string Settings Page ID. 331 */ 332 abstract public function page_id(): string; 333 334 /** 335 * Get Settings Page ID. 336 * 337 * @return string 338 */ 339 public function get_page_id(): string { 340 return $this->page_id(); 341 } 342 343 /** 344 * Assign Settings Page Showing Capability. 345 * 346 * @return string 347 */ 348 abstract public function capability(): string; 349 350 /** 351 * Get Settings Page Showing Capability. 352 * 353 * @return string 354 */ 355 public function get_capability(): string { 356 return $this->capability(); 357 } 358 359 /** 360 * Add Menu Separator. 361 * 362 * @return bool 363 */ 364 public function add_menu_separator(): bool { 365 return true; 366 } 367 368 /** 369 * Adding Main Admin Menu Separator 370 * 371 * @param float $position Separator Position. 372 * @param string $separator_additional_class Separator Additional Class. Default: empty. 373 * @param string $capability Menu Separator Capability. Default: manage_options. 374 * 375 * @return void 376 */ 377 private function admin_menu_separator( float $position, string $separator_additional_class = '', string $capability = 'manage_options' ): void { 378 379 if ( ! current_user_can( $capability ) ) { 380 return; 123 381 } 124 125 abstract public function rest_api_init(); 126 127 abstract public function settings_init(); 128 129 abstract public function settings_page_init(); 130 131 abstract public function settings_actions(); 132 133 abstract public function process_actions( $current_action ); 134 135 /** 136 * Parent Menu Slug 137 * 138 * @return string 139 */ 140 abstract public function parent_menu(): string; 141 142 /** 143 * Get Parent or Main Menu name 144 * 145 * @return string menu unique name; 146 */ 147 public function get_parent_menu(): string { 148 return $this->parent_menu(); 382 383 if ( ! $this->add_menu_separator() ) { 384 return; 149 385 } 150 151 /** 152 * Parent Menu and Page Title 153 * 154 * @return string 155 */ 156 abstract public function parent_menu_title(): string; 157 158 /** 159 * Get Parent or Main Menu Title 160 * 161 * @return string menu title; 162 */ 163 public function get_parent_menu_title(): string { 164 return $this->parent_menu_title(); 165 } 166 167 /** 168 * Parent Menu Icon 169 * 170 * @return string 171 */ 172 abstract public function menu_icon(): string; 173 174 /** 175 * Get Main Menu Icon 176 * 177 * @return string menu icon; 178 */ 179 public function get_menu_icon(): string { 180 return $this->menu_icon(); 181 } 182 183 /** 184 * Parent Menu Position 185 * 186 * @return string 187 */ 188 abstract public function menu_position(): string; 189 190 /** 191 * Get Main Menu Position 192 * 193 * @return string menu position; 194 */ 195 public function get_menu_position(): string { 196 return $this->menu_position(); 197 } 198 199 /** 200 * @return string 201 */ 202 abstract public function page_title(): string; 203 204 /** 205 * @return string 206 */ 207 public function get_page_title(): string { 208 return $this->page_title(); 209 } 210 211 /** 212 * @return string 213 */ 214 abstract public function menu_title(): string; 215 216 /** 217 * @return string 218 */ 219 public function get_menu_title(): string { 220 return $this->menu_title(); 221 } 222 223 /** 224 * @return string 225 */ 226 abstract public function page_id(): string; 227 228 /** 229 * @return string 230 */ 231 public function get_page_id(): string { 232 return $this->page_id(); 233 } 234 235 /** 236 * @return string 237 */ 238 abstract public function capability(): string; 239 240 /** 241 * @return string 242 */ 243 public function get_capability(): string { 244 return $this->capability(); 245 } 246 247 /** 248 * @return bool 249 */ 250 public function add_menu_separator(): bool { 251 return true; 252 } 253 254 /** 255 * Adding Main Admin Menu Separator 256 * 257 * @param numeric-string $position Separator Position 258 * @param string $separator_additional_class Separator Additional Class. Default: empty. 259 * @param string $capability Menu Separator Capability. Default: manage_options. 260 * 261 * @return void 262 */ 263 private function admin_menu_separator( string $position, string $separator_additional_class = '', string $capability = 'manage_options' ): void { 264 global $menu; 265 266 if ( ! current_user_can( $capability ) ) { 267 return; 268 } 269 270 if ( ! $this->add_menu_separator() ) { 271 return; 272 } 273 274 $menu[ $position ] = array( 275 '', 276 'read', 277 sprintf( 'separator-%s', strtolower( $separator_additional_class ) ), 278 '', 279 sprintf( 'wp-menu-separator %s', strtolower( $separator_additional_class ) ), 280 ); 281 ksort( $menu ); 282 } 283 284 /** 285 * Check if menu is main menu or submenu 286 * 287 * @return boolean 288 */ 289 public function is_submenu(): bool { 290 return str_contains( $this->get_parent_slug(), '.php' ); 291 } 292 293 /** 294 * @return string 295 */ 296 private function get_page_slug(): string { 297 return $this->get_page_id(); 298 } 299 300 /** 301 * @return string 302 */ 303 public function get_current_page_slug(): string { 304 return $this->current_page_slug; 305 } 306 307 /** 308 * @return string 309 */ 310 public function get_parent_slug(): string { 311 return $this->get_parent_menu(); 312 } 313 314 /** 315 * @param string $function_name 316 * @param string $message 317 * 318 * @return void 319 */ 320 final public function trigger_error( string $function_name, string $message ) { 321 322 // Bail out if WP_DEBUG is not turned on. 323 if ( ! WP_DEBUG ) { 324 return; 325 } 326 327 if ( function_exists( 'wp_trigger_error' ) ) { 328 wp_trigger_error( $function_name, $message ); 329 } else { 330 331 if ( ! empty( $function_name ) ) { 332 $message = sprintf( '%s(): %s', $function_name, $message ); 333 } 334 335 $message = wp_kses( $message, array( 336 'a' => array( 'href' ), 337 'br', 338 'code', 339 'em', 340 'strong', 341 ), array( 'http', 'https' ) ); 342 343 trigger_error( $message ); 344 } 345 } 386 387 $menu_slug = sprintf( 'menu_separator_%s wp-menu-separator', strtolower( $separator_additional_class ) ); 388 389 add_menu_page( 390 '', 391 '', 392 $capability, 393 $menu_slug, 394 '__return_false', 395 'none', 396 $position 397 ); 398 } 399 400 /** 401 * Check if menu is main menu or submenu 402 * 403 * @return boolean 404 */ 405 public function is_submenu(): bool { 406 return str_contains( $this->get_parent_slug(), '.php' ); 407 } 408 409 /** 410 * Get Page ID. 411 * 412 * @return string 413 */ 414 private function get_page_slug(): string { 415 return $this->get_page_id(); 416 } 417 418 /** 419 * Get Current Page Slug. 420 * 421 * @return string 422 */ 423 public function get_current_page_slug(): string { 424 return $this->current_page_slug; 425 } 426 427 /** 428 * Get parent page slug. 429 * 430 * @return string 431 */ 432 public function get_parent_slug(): string { 433 return $this->get_parent_menu(); 346 434 } 347 435 } 436 } -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/REST_API.php
r3081706 r3140508 1 1 <?php 2 3 namespace StorePress\AdminUtils;4 5 defined( 'ABSPATH' ) || die( 'Keep Silent' );6 7 2 /** 8 * Settings REST API3 * Admin Settings Rest API Class File. 9 4 * 10 5 * @package StorePress/AdminUtils 6 * @since 1.0.0 7 * @version 1.0.0 8 */ 9 10 declare(strict_types=1); 11 12 namespace StorePress\AdminUtils; 13 14 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 15 16 if ( ! class_exists( '\StorePress\AdminUtils\REST_API' ) ) { 17 /** 18 * Admin Settings REST API Class. 19 * 11 20 * @name REST_API 12 * @see WP_REST_Controller21 * @see \WP_REST_Controller 13 22 * @example Default REST URL /wp-json/<plugin-page-id>/v1/settings 14 * @version 1.015 23 */ 16 17 if ( ! class_exists( '\StorePress\AdminUtils\REST_API' ) ) {18 24 class REST_API extends \WP_REST_Controller { 19 25 20 /** 21 * Constructor. 26 use Common; 27 28 /** 29 * Settings Object. 30 * 31 * @var Settings 22 32 */ 23 33 protected Settings $settings; 34 /** 35 * API Display Permission. 36 * 37 * @var string 38 */ 24 39 protected string $permission; 25 40 41 /** 42 * API Namespace. 43 * 44 * @var string 45 */ 26 46 protected $namespace; 47 48 /** 49 * Rest base. 50 * 51 * @var string 52 */ 27 53 protected $rest_base = 'settings'; 28 54 55 /** 56 * Construct. 57 * 58 * @param Settings $settings Setting Class Instance. 59 */ 29 60 public function __construct( Settings $settings ) { 30 61 $this->settings = $settings; … … 34 65 35 66 /** 67 * Get Settings Object. 68 * 36 69 * @return Settings 37 70 */ … … 43 76 * Registers the routes for the StorePress's settings. 44 77 * 78 * @return void 45 79 * @see register_rest_route() 46 80 */ 47 81 public function register_routes() { 48 82 49 if ( empty( $this->namespace ) ) {83 if ( $this->is_empty_string( $this->namespace ) ) { 50 84 return; 51 85 } 52 86 53 // See: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/87 // @see: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/ 54 88 register_rest_route( 55 89 $this->namespace, … … 71 105 * Checks if a given request has access to read and manage settings. 72 106 * 107 * @phpstan-param \WP_REST_Request $request 73 108 * @param \WP_REST_Request $request Full details about the request. 74 109 * 75 * @return bool True if the request has read access for the item, otherwise false. 110 * @return bool TRUE if the request has read access for the item, otherwise FALSE. 111 * @phpstan-ignore missingType.generics, method.childReturnType 76 112 */ 77 113 public function get_item_permissions_check( $request ): bool { … … 85 121 * 86 122 * @return \WP_REST_Response|\WP_Error Array on success, or WP_Error object on failure. 123 * @see \WP_REST_Settings_Controller::get_item() 124 * @phpstan-ignore missingType.generics 87 125 */ 88 126 public function get_item( $request ) { 89 $options = $this->get_registered_options();90 $page_id = $this->get_settings()->get_page_id();127 $options = $this->get_registered_options(); 128 $page_id = $this->get_settings()->get_page_id(); 91 129 $response = array(); 92 130 … … 103 141 * @param string $name Setting name (as shown in REST API responses). 104 142 * @param array $args Custom field array with value. 143 * @since 1.0.0 105 144 */ 106 $response[ $name ] = apply_filters( " rest_pre_get_{$page_id}_setting", null, $name, $args );145 $response[ $name ] = apply_filters( "storepress_rest_pre_get_{$page_id}_setting", null, $name, $args ); 107 146 108 147 if ( is_null( $response[ $name ] ) ) { 109 // Set value 148 // Set value. 110 149 $response[ $name ] = $args['value']; 111 150 } … … 117 156 $response[ $name ] = $this->prepare_value( $response[ $name ], $args['schema'] ); 118 157 } 119 158 120 159 return new \WP_REST_Response( $response, 200 ); 121 // return $response;122 160 } 123 161 … … 125 163 * Prepares a value for output based off a schema array. 126 164 * 127 * @param mixed $value Value to prepare.128 * @param array $schema Schema to match.165 * @param mixed $value Value to prepare. 166 * @param array<string, string|string[]> $schema Schema to match. 129 167 * 130 168 * @return mixed The prepared value. 131 169 */ 132 protected function prepare_value( $value, $schema ) {170 protected function prepare_value( $value, array $schema ) { 133 171 /* 134 172 * If the value is not valid by the schema, set the value to null. … … 146 184 * Retrieves all the registered options for the Settings API. 147 185 * 148 * @return array Array of registered options. 186 * @return array<string, mixed> Array of registered options. 187 * @see https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/ 149 188 */ 150 189 protected function get_registered_options(): array { 151 190 $rest_options = array(); 152 191 153 // See: https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/ .154 155 192 foreach ( $this->get_settings()->get_all_fields() as $name => $field ) { 156 193 157 if ( empty( $field->get_attribute( 'show_in_rest' )) ) {194 if ( ! $field->has_show_in_rest() ) { 158 195 continue; 159 196 } … … 166 203 167 204 $defaults = array( 168 'name' => ! empty( $rest_args['name'] ) ? $rest_args['name'] :$field->get_id(),205 'name' => $rest_args['name'] ?? $field->get_id(), 169 206 'schema' => array(), 170 207 ); … … 175 212 'type' => $field->get_rest_type(), 176 213 'description' => $field->get_title(), 177 / /'readonly' => true,214 /** 'readonly' => true, 178 215 // 'context' => array( 'view' ), 179 216 // 'default' => $field->get_default_value(), 217 */ 180 218 ); 181 219 … … 191 229 $default_schema['format'] = 'uri'; 192 230 } 193 231 194 232 if ( 'email' === $field->get_type() ) { 195 233 $default_schema['format'] = 'email'; … … 206 244 $id = $group_field->get_id(); 207 245 208 if ( empty( $group_field->get_attribute( 'show_in_rest' )) ) {246 if ( ! $group_field->has_show_in_rest() ) { 209 247 continue; 210 248 } … … 225 263 226 264 if ( 'color' === $group_field->get_type() ) { 265 // @phpstan-ignore offsetAssign.dimType 227 266 $default_properties[ $id ]['type']['format'] = 'hex-color'; 228 267 } … … 253 292 254 293 // Skip over settings that don't have a defined type in the schema. 255 if ( empty( $rest_args['schema']['type'] ) ) {294 if ( $this->is_empty_string( $rest_args['schema']['type'] ) ) { 256 295 continue; 257 296 } … … 276 315 * Retrieves the site setting schema, conforming to JSON Schema. 277 316 * 278 * @return array Item schema data.317 * @return array<string, mixed> Item schema data. 279 318 */ 280 319 public function get_item_schema(): array { 281 if ( $this-> schema) {320 if ( $this->is_empty_array( $this->schema ) ) { 282 321 return $this->add_additional_fields_schema( $this->schema ); 283 322 } … … 316 355 * 317 356 * @return mixed|\WP_Error 318 */ 319 public function sanitize_callback( $value, $request, $param ) { 357 * @phpstan-ignore missingType.generics 358 */ 359 public function sanitize_callback( $value, \WP_REST_Request $request, string $param ) { 320 360 if ( is_null( $value ) ) { 321 361 return $value; -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Section.php
r3044506 r3140508 1 1 <?php 2 /** 3 * Admin Settings Section Class File. 4 * 5 * @package StorePress/AdminUtils 6 * @since 1.0.0 7 * @version 1.0.0 8 */ 9 10 declare(strict_types=1); 2 11 3 12 namespace StorePress\AdminUtils; … … 5 14 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 6 15 16 if ( ! class_exists( '\StorePress\AdminUtils\Section' ) ) { 7 17 /** 8 * Admin Settings 18 * Admin Settings Section Class. 9 19 * 10 * @package StorePress/AdminUtils11 20 * @name Section 12 * @version 1.013 21 */ 14 if ( ! class_exists( '\StorePress\AdminUtils\Section' ) ) {15 22 class Section { 16 23 24 use Common; 25 17 26 /** 18 * @var array 27 * Section data. 28 * 29 * @var array<string, mixed> 19 30 */ 20 31 private array $section; 21 32 22 33 /** 23 * @param array $section 34 * Construct section from array. 35 * 36 * @param array<string, mixed> $section Section array. 24 37 */ 25 38 public function __construct( array $section ) { … … 36 49 37 50 /** 51 * Get section ID. 52 * 38 53 * @return string 39 54 */ … … 43 58 44 59 /** 60 * Get Section title. 61 * 45 62 * @return string 46 63 */ … … 49 66 } 50 67 51 public function has_title(): string { 52 return ! empty( $this->section['title'] ); 68 /** 69 * Check section title. 70 * 71 * @return bool 72 */ 73 public function has_title(): bool { 74 return ! $this->is_empty_string( $this->section['title'] ); 53 75 } 54 76 55 77 /** 78 * Get section description. 79 * 56 80 * @return string 57 81 */ … … 60 84 } 61 85 62 public function has_description(): string { 63 return ! empty( $this->section['description'] ); 86 /** 87 * Check section has description defined. 88 * 89 * @return bool 90 */ 91 public function has_description(): bool { 92 return ! $this->is_empty_string( $this->section['description'] ); 64 93 } 65 94 66 95 /** 67 * @return array 96 * Get fields array from section. 97 * 98 * @return array<string, mixed> 68 99 */ 69 100 public function get_fields(): array { … … 72 103 73 104 /** 105 * Check fields available on section. 106 * 74 107 * @return bool 75 108 */ 76 109 public function has_fields(): bool { 77 return ! empty( $this->section['fields'] );110 return ! $this->is_empty_array( $this->section['fields'] ); 78 111 } 79 112 80 113 /** 81 * @param Field $field 114 * Add field to section. 115 * 116 * @param Field $field Field object. 82 117 * 83 118 * @return self … … 90 125 91 126 /** 127 * Return section display. 128 * 92 129 * @return string 93 130 */ … … 101 138 102 139 /** 140 * Markup before display section fields. 141 * 103 142 * @return string 104 143 */ … … 112 151 113 152 /** 153 * Markup after display section fields. 154 * 114 155 * @return string 115 156 */ -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Settings.php
r3081706 r3140508 1 1 <?php 2 3 namespace StorePress\AdminUtils;4 5 defined( 'ABSPATH' ) || die( 'Keep Silent' );6 7 2 /** 8 * Admin Settings 3 * Admin Settings Class file. 9 4 * 10 5 * @package StorePress/AdminUtils 6 * @since 1.0.0 7 * @version 1.0.0 8 */ 9 10 declare(strict_types=1); 11 12 namespace StorePress\AdminUtils; 13 14 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 15 16 if ( ! class_exists( '\StorePress\AdminUtils\Settings' ) ) { 17 18 /** 19 * Admin Settings Class 20 * 11 21 * @name Settings 12 * @ version 1.022 * @see Menu 13 23 */ 14 if ( ! class_exists( '\StorePress\AdminUtils\Settings' ) ) {15 24 abstract class Settings extends Menu { 16 25 17 26 /** 27 * Fields callback function name convention. 28 * 18 29 * @var string $fields_callback_fn_name_convention 19 30 */ 20 31 private string $fields_callback_fn_name_convention = 'add_%s_settings_fields'; 21 32 /** 33 * Sidebar callback function name convention. 34 * 22 35 * @var string $sidebar_callback_fn_name_convention 23 36 */ 24 37 private string $sidebar_callback_fn_name_convention = 'add_%s_settings_sidebar'; 25 38 /** 39 * Page callback function name convention. 40 * 26 41 * @var string $page_callback_fn_name_convention 27 42 */ 28 43 private string $page_callback_fn_name_convention = 'add_%s_settings_page'; 29 44 /** 30 * @var array $options Store All Saved Options 45 * Store All Saved Options 46 * 47 * @var array<string, mixed> $options 31 48 */ 32 49 private array $options = array(); 33 50 34 51 /** 52 * Add Setting ID. 53 * 35 54 * @return string 36 55 */ … … 38 57 39 58 /** 59 * Plugin File name. 60 * 40 61 * @return string 41 62 */ … … 43 64 44 65 /** 45 * Show Settings in REST. If empty rest api will disable. 46 * 66 * Show Settings in REST. If empty or false rest api will disable. 67 * 68 * @return string|bool 47 69 * @example GET: /wp-json/<page-id>/<rest-api-version>/settings 48 * @return string|bool 49 */ 50 public function show_in_rest(): ?string { 70 */ 71 public function show_in_rest() { 51 72 return sprintf( '%s/%s', $this->get_page_id(), $this->rest_api_version() ); 52 73 } … … 70 91 } 71 92 93 /** 94 * Settings Hook 95 * 96 * @return void 97 */ 72 98 final public function settings_init() { 73 99 add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ), 20 ); 74 add_action( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file() ), array( $this, 'plugin_action_links' ) ); 75 } 76 100 add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file() ), array( $this, 'plugin_action_links' ) ); 101 } 102 103 /** 104 * Setting Action 105 * 106 * @return void 107 */ 77 108 final public function settings_actions() { 78 109 79 $plugin_page = sanitize_text_field( wp_unslash( $_GET['page'] ?? false ) ); 80 $current_action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ?? false ) ); 81 82 if ( $plugin_page && $current_action && $plugin_page === $this->get_current_page_slug() ) { 110 if ( ! isset( $_REQUEST['action'] ) || ! isset( $_GET['page'] ) || $_GET['page'] !== $this->get_current_page_slug() ) { 111 return; 112 } 113 114 check_admin_referer( $this->get_nonce_action() ); 115 116 $plugin_page = sanitize_text_field( wp_unslash( $_GET['page'] ) ); 117 $current_action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); 118 119 $has_plugin_page = ! $this->is_empty_string( $plugin_page ); 120 $has_action = ! $this->is_empty_string( $current_action ); 121 122 if ( $has_plugin_page && $has_action && $plugin_page === $this->get_current_page_slug() ) { 83 123 $this->process_actions( $current_action ); 84 124 } 85 125 } 86 126 87 // GET: /wp-json/<page-id>/<rest-api-version>/settings 127 /** 128 * Init rest api. 129 * 130 * @example GET /wp-json/<page-id>/<rest-api-version>/settings 131 * @return void 132 */ 88 133 public function rest_api_init() { 89 134 ( new REST_API( $this ) )->register_routes(); 90 135 } 91 136 92 public function plugin_action_links( $links ): array { 137 /** 138 * Plugin page plugin action link. 139 * 140 * @param string[] $links Plugin action available links. 141 * 142 * @return string[] 143 */ 144 public function plugin_action_links( array $links ): array { 93 145 94 146 $strings = $this->localize_strings(); 95 147 96 $action_links = array(97 'settings' => sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $this->get_settings_uri() ), esc_html( $strings['settings_link_text'] ) ), 98 );99 100 return array_merge( $action_links, $links );101 } 102 103 /** 104 * Admin Scripts148 $action_links = sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $this->get_settings_uri() ), esc_html( $strings['settings_link_text'] ) ); 149 150 $links[] = $action_links; 151 152 return $links; 153 } 154 155 /** 156 * Register admin Scripts 105 157 * 106 158 * @return void … … 112 164 $plugin_dir_path = untrailingslashit( plugin_dir_path( $this->get_plugin_file() ) ); 113 165 114 $script_src_url = $plugin_dir_url . '/vendor/storepress/admin-utils/ assets/admin-settings.js';115 $style_src_url = $plugin_dir_url . '/vendor/storepress/admin-utils/ assets/admin-settings.css';116 $script_asset_file = $plugin_dir_path . '/vendor/storepress/admin-utils/ assets/admin-settings.asset.php';166 $script_src_url = $plugin_dir_url . '/vendor/storepress/admin-utils/build/admin-settings.js'; 167 $style_src_url = $plugin_dir_url . '/vendor/storepress/admin-utils/build/admin-settings.css'; 168 $script_asset_file = $plugin_dir_path . '/vendor/storepress/admin-utils/build/admin-settings.asset.php'; 117 169 $script_assets = include $script_asset_file; 118 170 … … 124 176 125 177 /** 178 * Enqueue Scripts. 179 * 126 180 * @return void 127 181 */ … … 132 186 133 187 /** 134 * Translated Strings 188 * Translated Strings. 135 189 * 136 190 * @abstract 191 * 137 192 * @return array{ 193 * 'unsaved_warning_text': string, 194 * 'reset_warning_text': string, 195 * 'reset_button_text': string, 196 * 'settings_nav_label_text': string, 197 * 'settings_link_text': string, 198 * 'settings_error_message_text': string, 199 * 'settings_updated_message_text': string, 200 * 'settings_deleted_message_text': string 201 * } 202 * @example array{ 138 203 * unsaved_warning_text: string, 139 204 * reset_warning_text: string, 140 205 * reset_button_text: string, 206 * settings_nav_label_text: string, 141 207 * settings_link_text: string, 208 * settings_error_message_text: string, 142 209 * settings_updated_message_text: string, 143 210 * settings_deleted_message_text:string … … 146 213 public function localize_strings(): array { 147 214 148 $message = esc_html__( 'not implemented. Must be overridden in subclass.' ); 149 $this->trigger_error( __METHOD__, $message ); 215 /* translators: %s: Method name. */ 216 $message = sprintf( esc_html__( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ); 217 wp_trigger_error( __METHOD__, $message ); 150 218 151 219 return array( … … 153 221 'reset_warning_text' => 'Are you sure to reset?', 154 222 'reset_button_text' => 'Reset All', 223 'settings_nav_label_text' => 'Secondary menu', 155 224 'settings_link_text' => 'Settings', 225 'settings_error_message_text' => 'Settings not saved', 156 226 'settings_updated_message_text' => 'Settings Saved', 157 227 'settings_deleted_message_text' => 'Settings Reset', … … 160 230 161 231 /** 232 * Get localize string by string key. Previously added on localize_strings() 233 * 234 * @param string $string_key Localized string key. 235 * @see localize_strings() 236 * @return string 237 */ 238 public function get_localized_string( string $string_key ): string { 239 $strings = $this->localize_strings(); 240 241 return $strings[ $string_key ] ?? ''; 242 } 243 244 /** 245 * Add Settings. 246 * 162 247 * @abstract 163 * @return array 248 * @return array<string, mixed> 164 249 */ 165 250 public function add_settings(): array { 166 251 167 $message = esc_html__( 'not implemented. Must be overridden in subclass.' );168 $ this->trigger_error( __METHOD__, $message);169 252 /* translators: %s: Method name. */ 253 $message = sprintf( esc_html__( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ); 254 wp_trigger_error( __METHOD__, $message ); 170 255 return array(); 171 256 } 172 257 173 258 /** 174 * @return array 259 * Get settings. 260 * 261 * @return array<string, mixed> 175 262 */ 176 263 final public function get_settings(): array { … … 178 265 } 179 266 180 / / used on ui template.181 182 /**267 /** 268 * Display Sidebar. Used on UI template. 269 * 183 270 * @return void 184 271 */ 185 272 final public function display_sidebar() { 186 273 $tab_sidebar = $this->get_tab_sidebar(); 187 274 // Load sidebar based on callback. 188 275 if ( is_callable( $tab_sidebar ) ) { 189 276 call_user_func( $tab_sidebar ); 190 277 } else { 191 // load default sidebar278 // Load default sidebar. 192 279 $this->get_default_sidebar(); 193 280 } … … 195 282 196 283 /** 284 * Get tab sidebar callback. 285 * 197 286 * @return callable|null 198 287 */ … … 204 293 205 294 /** 295 * Get default sidebar. 296 * 206 297 * @abstract 207 298 * @return void … … 210 301 $current_tab = $this->get_current_tab(); 211 302 $callback_function = sprintf( $this->sidebar_callback_fn_name_convention, $current_tab ); 212 $message = sprintf( __( 'not implemented. Must be overridden in subclass. Create "%1$s" method for "%2$s" tab sidebar.' ), $callback_function, $current_tab ); 213 $this->trigger_error( __METHOD__, $message ); 214 } 215 216 // used on ui template. 217 218 /** 303 304 /* translators: %s: Method name. */ 305 $message = sprintf( esc_html__( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ); 306 $message .= sprintf( 'Create "%1$s" method for "%2$s" tab sidebar.', $callback_function, $current_tab ); 307 wp_trigger_error( __METHOD__, $message ); 308 } 309 310 /** 311 * Display Fields. Used on UI template. 312 * 219 313 * @return void 220 314 */ … … 246 340 $page_fn_name = sprintf( $this->page_callback_fn_name_convention, $current_tab ); 247 341 $message = sprintf( 'Should return fields array from "<strong>%s()</strong>". Or For custom page create "<strong>%s()</strong>"', $fields_fn_name, $page_fn_name ); 248 $this->trigger_error( '', $message ); 249 } 250 } 251 252 /** 342 wp_trigger_error( '', $message ); 343 } 344 } 345 346 /** 347 * Display action buttons. 348 * 253 349 * @return void 254 350 */ 255 351 public function display_buttons() { 256 $submit_button = get_submit_button( null, 'primary large', 'submit', false, null ); 257 $reset_button = $this->get_reset_button(); 258 printf( '<p class="submit">%s %s</p>', $submit_button, $reset_button ); 259 } 260 261 /** 352 $submit_button = get_submit_button( '', 'primary large', 'submit', false, '' ); 353 $reset_button = $this->get_reset_button(); 354 $allowed_input_html = $this->get_kses_allowed_input_html(); 355 printf( '<p class="submit">%s %s</p>', wp_kses( $submit_button, $allowed_input_html ), wp_kses_post( $reset_button ) ); 356 } 357 358 /** 359 * Get settings reset button. 360 * 262 361 * @return string 263 362 */ … … 273 372 274 373 /** 374 * Get tab field callable function. 375 * 275 376 * @return callable|null 276 377 */ … … 282 383 283 384 /** 385 * Get tab page callable function. 386 * 284 387 * @return callable|null 285 388 */ … … 290 393 } 291 394 292 / / used on ui template.293 294 /**395 /** 396 * Display page. Used on UI Template. 397 * 295 398 * @return void 296 399 */ … … 304 407 305 408 /** 306 * @return array 409 * Get tabs. 410 * 411 * @return array<int|string, mixed> 307 412 */ 308 413 final public function get_tabs(): array { … … 310 415 $navs = array(); 311 416 417 $first_key = array_key_first( $tabs ); 418 312 419 foreach ( $tabs as $key => $tab ) { 313 if ( empty( $key ) ) { 420 if ( is_string( $first_key ) && $this->is_empty_string( $first_key ) ) { 421 $key = $this->default_tab_name(); 422 } 423 424 if ( 0 === $first_key ) { 314 425 $key = $this->default_tab_name(); 315 426 } … … 323 434 'css-classes' => array(), 324 435 'sidebar' => true, 325 // 'page_callback' => null, 326 // 'fields_callback' => null, 327 // 'sidebar_callback' => null, 436 /** 437 * More item. 438 * 439 * @example: 440 * 'page_callback' => null, 441 * 'fields_callback' => null, 442 * 'sidebar_callback' => null, 443 */ 328 444 ); 329 445 … … 343 459 $navs[ $key ]['fields_callback'] = is_callable( $fields_callback ) ? $fields_callback : null; 344 460 $navs[ $key ]['sidebar_callback'] = is_callable( $sidebar_callback ) ? $sidebar_callback : null; 345 346 461 } 347 462 … … 349 464 } 350 465 351 /*** 466 /** 467 * Get Fields 468 * 352 469 * @return Field[] 353 470 */ 354 471 public function get_all_fields(): array { 355 $tabs = $this->get_tabs(); 472 $tabs = $this->get_tabs(); 473 356 474 $all_fields = array(); 357 475 … … 369 487 370 488 $all_fields[ $field['id'] ] = $_field; 371 // $all_fields[ $field[ 'id' ] ] = $field;372 489 } 373 490 } … … 378 495 379 496 /** 497 * Check unique field ids. 498 * 380 499 * @return void 381 500 */ … … 392 511 $fields = call_user_func( $fields_callback ); 393 512 /** 394 * @var array $field 513 * Fields. 514 * 515 * @var array<string, mixed> $field 395 516 */ 396 517 foreach ( $fields as $field ) { … … 404 525 $message = sprintf( 'Duplicate field id "<strong>%s</strong>" found. Please use unique field id.', $field['id'] ); 405 526 406 $this->trigger_error( $fields_fn_name, $message );527 wp_trigger_error( $fields_fn_name, $message ); 407 528 408 529 } else { … … 418 539 419 540 /** 541 * Display tabs. Used on UI template. 542 * 420 543 * @return void 421 544 */ 422 545 final public function display_tabs() { 423 echo implode( '', $this->get_navs() ); 424 } 425 426 /** 427 * @return array 546 echo wp_kses_post( implode( '', $this->get_navs() ) ); 547 } 548 549 /** 550 * Get navigations. 551 * 552 * @return string[] 428 553 */ 429 554 private function get_navs(): array { … … 435 560 $navs = array(); 436 561 /** 437 * @var array $tab 562 * Available tabs. 563 * 564 * @var array<int|string, mixed> $tab 438 565 */ 566 567 439 568 foreach ( $tabs as $tab_id => $tab ) { 440 569 441 if ( ! empty( $tab['hidden'] )) {570 if ( true === $tab['hidden'] ) { 442 571 continue; 443 572 } … … 450 579 } 451 580 452 $tab_url = empty( $tab['external'] )? $this->get_tab_uri( $tab_id ) : $tab['external'];453 $tab_target = empty( $tab['external'] )? '_self' : '_blank';454 $icon = empty( $tab['icon'] ) ? '' : sprintf( '<span class="%s"></span>', $tab['icon'] );581 $tab_url = false === $tab['external'] ? $this->get_tab_uri( $tab_id ) : $tab['external']; 582 $tab_target = false === $tab['external'] ? '_self' : '_blank'; 583 $icon = is_null( $tab['icon'] ) ? '' : sprintf( '<span class="%s"></span>', $tab['icon'] ); 455 584 $attributes = $tab['attributes']; 456 585 … … 459 588 array_map( 460 589 function ( $key ) use ( $attributes ) { 461 462 if ( in_array( $key, array( 'target', 'href', 'class' ), true ) ) {463 return '';464 }465 590 466 591 if ( is_bool( $attributes[ $key ] ) ) { … … 480 605 } 481 606 482 // used on ui template. 483 484 /** 485 * @return string 486 */ 487 final public function get_action_uri(): string { 488 return $this->get_settings_uri(); 489 } 490 491 // used on ui template. 492 493 /** 607 /** 608 * Get action uri. used on settings form. 609 * 610 * @param array<string, mixed> $extra Extra arguments. 611 * @return string 612 */ 613 final public function get_action_uri( array $extra = array() ): string { 614 return $this->get_settings_uri( $extra ); 615 } 616 617 /** 618 * Get reset uri. used on ui template. 619 * 494 620 * @return string 495 621 */ 496 622 final public function get_reset_uri(): string { 497 // return wp_nonce_url( $this->get_settings_uri( array( $this->action_query_args() => 'reset' ) ), $this->get_nonce() ); 498 return wp_nonce_url( $this->get_settings_uri( array( 'action' => 'reset' ) ), $this->get_nonce() ); 499 } 500 501 /** 502 * @return string 503 */ 504 final public function get_nonce(): string { 623 return wp_nonce_url( $this->get_settings_uri( array( 'action' => 'reset' ) ), $this->get_nonce_action() ); 624 } 625 626 /** 627 * Get nonce action. 628 * 629 * @return string 630 */ 631 final public function get_nonce_action(): string { 505 632 $group = $this->get_option_group_name(); 506 633 … … 509 636 510 637 /** 638 * Get option group name for ui template. 639 * 511 640 * @return string 512 641 */ … … 519 648 520 649 /** 650 * Get plugin file. 651 * 521 652 * @return string 522 653 */ … … 526 657 527 658 /** 659 * Get settings ID. 660 * 528 661 * @return string 529 662 */ … … 532 665 } 533 666 534 // override for custom ui page 535 536 /** 667 /** 668 * Settings template. Can override for custom ui page. 669 * 670 * @see https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions 537 671 * @return void 538 672 */ 539 673 public function display_settings_page() { 540 // Follow: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions 541 include __DIR__ . '/templates/classic-template.php'; 542 } 543 544 545 public function process_actions( $current_action ) { 674 include_once __DIR__ . '/templates/classic-template.php'; 675 } 676 677 /** 678 * Process actions. 679 * 680 * @param string $current_action Current requested action. 681 * 682 * @return void 683 */ 684 public function process_actions( string $current_action ) { 546 685 547 686 if ( 'update' === $current_action ) { … … 555 694 556 695 /** 696 * Process update settings. 697 * 698 * @see wp_removable_query_args() 557 699 * @return void 558 700 */ 559 701 public function process_action_update() { 560 702 561 check_admin_referer( $this->get_nonce() ); 562 563 $_post = wp_unslash( $_POST[ $this->get_settings_id() ] ); 703 check_admin_referer( $this->get_nonce_action() ); 704 705 if ( ! isset( $_POST[ $this->get_settings_id() ] ) ) { 706 wp_safe_redirect( 707 $this->get_action_uri( 708 array( 709 'message' => 'error', 710 ) 711 ) 712 ); 713 exit; 714 } 715 716 $_post = map_deep( wp_unslash( $_POST[ $this->get_settings_id() ] ), 'sanitize_text_field' ); 564 717 565 718 $data = $this->sanitize_fields( $_post ); … … 567 720 $this->update_options( $data ); 568 721 569 wp_safe_redirect( add_query_arg( 'message', 'updated', $this->get_action_uri() ) ); 722 wp_safe_redirect( 723 $this->get_action_uri( 724 array( 'message' => 'updated' ) 725 ) 726 ); 570 727 exit; 571 728 } 572 729 573 730 /** 731 * Process reset action. 732 * 733 * @see wp_removable_query_args() 574 734 * @return void 575 735 */ 576 736 public function process_action_reset() { 577 737 578 check_admin_referer( $this->get_nonce () );738 check_admin_referer( $this->get_nonce_action() ); 579 739 580 740 $this->delete_options(); 581 741 582 wp_safe_redirect( add_query_arg( 'message', 'deleted', $this->get_action_uri() ) ); 742 wp_safe_redirect( 743 $this->get_action_uri( 744 array( 'message' => 'deleted' ) 745 ) 746 ); 583 747 exit; 584 748 } 585 749 586 750 /** 751 * Settings messages 752 * 753 * @see process_action_update() 754 * @see process_action_reset() 755 * @see wp_removable_query_args() 587 756 * @return void 588 757 */ 589 758 public function settings_messages() { 759 760 // We are just checking message request from uri redirect. 761 if ( ! isset( $_GET['message'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 762 return; 763 } 764 590 765 $strings = $this->localize_strings(); 591 $message = sanitize_text_field( wp_slash( $_GET['message'] ?? '' ) ); 766 767 $message = sanitize_text_field( $_GET['message'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended 768 592 769 if ( 'updated' === $message ) { 593 $this->add_settings_message( esc_html( $strings['settings_updated_message_text'] ));770 $this->add_settings_message( $strings['settings_updated_message_text'] ); 594 771 } 595 772 if ( 'deleted' === $message ) { 596 $this->add_settings_message( esc_html( $strings['settings_deleted_message_text'] ) ); 597 } 598 } 599 600 /** 601 * @param array $default . Default: empty array 602 * 603 * @return array|false|mixed|null 604 */ 605 public function get_options( array $default = array() ) { 606 607 if ( ! empty( $this->options ) ) { 773 $this->add_settings_message( $strings['settings_deleted_message_text'] ); 774 } 775 if ( 'error' === $message ) { 776 $this->add_settings_message( $strings['settings_error_message_text'], 'error' ); 777 } 778 } 779 780 /** 781 * Get All Saved Options 782 * 783 * @param array<string, mixed> $default_value Default Value. Default: empty array. 784 * 785 * @return bool|array<string, mixed>|null 786 */ 787 public function get_options( array $default_value = array() ) { 788 789 if ( ! $this->is_empty_array( $this->options ) ) { 608 790 return $this->options; 609 791 } 610 $this->options = get_option( $this->get_settings_id(), $default );792 $this->options = get_option( $this->get_settings_id(), $default_value ); 611 793 612 794 return $this->options; … … 614 796 615 797 /** 798 * Delete Option 799 * 616 800 * @return bool 617 801 */ … … 621 805 622 806 /** 623 * @param array $data 624 * 625 * @return void 626 */ 627 final private function update_options( array $data ) { 807 * Update Option 808 * 809 * @param array<string, mixed> $data Updated data. 810 * 811 * @return void 812 */ 813 private function update_options( array $data ) { 628 814 629 815 $old_data = $this->get_options(); 630 816 631 if ( ! empty( $old_data ) ) {817 if ( ! $this->is_empty_array( $old_data ) ) { 632 818 $current_data = array_merge( $old_data, $data['public'] ); 633 819 } else { … … 643 829 644 830 /** 645 * @param string $field_id 646 * @param mixed $default . Default null 831 * Get Option 832 * 833 * @param string $field_id Option field id. 834 * @param mixed $default_value Pass default value. Default is null. 647 835 * 648 836 * @return mixed|null 649 837 */ 650 public function get_option( string $field_id, $default = null ) {838 public function get_option( string $field_id, $default_value = null ) { 651 839 $field = $this->get_field( $field_id ); 652 840 653 return $field->get_value( $default ); 654 } 655 656 /** 657 * @param string $group_id 658 * @param string $field_id 659 * @param mixed $default . Default: null 841 return $field->get_value( $default_value ); 842 } 843 844 /** 845 * Get Group Option 846 * 847 * @param string $group_id Group Id. 848 * @param string $field_id Field Id. 849 * @param mixed $default_value Default: null. 660 850 * 661 851 * @return mixed|null 662 852 */ 663 public function get_group_option( string $group_id, string $field_id, $default = null ) {853 public function get_group_option( string $group_id, string $field_id, $default_value = null ) { 664 854 $field = $this->get_field( $group_id ); 665 855 666 return $field->get_group_value( $field_id, $default );667 } 668 669 / / Current tab fields670 671 /***856 return $field->get_group_value( $field_id, $default_value ); 857 } 858 859 /** 860 * Get Available fields. 861 * 672 862 * @return Field[] 673 863 */ … … 678 868 $fields = call_user_func( $field_cb ); 679 869 /** 680 * @var array $field 870 * Field 871 * 872 * @var array<string, mixed> $field 681 873 */ 682 874 foreach ( $fields as $field ) { … … 691 883 } 692 884 693 / / Current tab694 695 /**696 * @param string $field_id 885 /** 886 * Get available field. 887 * 888 * @param string $field_id Field id. 697 889 * 698 890 * @return Field|null 891 * @phpstan-ignore method.unused 699 892 */ 700 893 private function get_available_field( string $field_id ): ?Field { … … 705 898 706 899 /** 707 * @param string $field_id 900 * Get field. 901 * 902 * @param string $field_id Field id. 708 903 * 709 904 * @return Field|null … … 716 911 717 912 /** 718 * 719 * @param array $_post 720 * 721 * @return array{ public: array, private: array } 913 * Sanitize fields. 914 * 915 * @param array<string, mixed> $_post global post. 916 * 917 * @return array{ public: array<string, mixed>, private: array<string, mixed> } 722 918 */ 723 919 private function sanitize_fields( array $_post ): array { … … 742 938 switch ( $type ) { 743 939 case 'checkbox': 744 // Add default checkbox value 940 // Add default checkbox value. 745 941 if ( ! isset( $_post[ $key ] ) ) { 746 942 $_post[ $key ] = ( count( $options ) > 0 ) ? array() : 'no'; … … 759 955 $group_sanitize_callback = $field->get_sanitize_callback(); 760 956 761 // Add default checkbox value 957 // Add default checkbox value. 762 958 if ( 'checkbox' === $group_field_type ) { 763 959 if ( ! isset( $_post[ $key ][ $group_field_id ] ) ) { … … 783 979 784 980 /** 981 * Settings page init. 982 * 785 983 * @return void 786 984 */ … … 791 989 792 990 /** 793 * used on ui template.991 * Display settings message. Used on ui template. 794 992 * 795 993 * @return void … … 800 998 801 999 /** 802 * @param string $message Message 1000 * Add settings message. 1001 * 1002 * @param string $message Message. 803 1003 * @param string $type Message type. Optional. Message type, controls HTML class. Possible values include 'error', 804 1004 * 'success', 'warning', 'info', 'updated'. Default: 'updated'. … … 813 1013 814 1014 /** 1015 * Parent menu slug. 1016 * 815 1017 * @return string Parent Menu Slug 816 1018 */ … … 819 1021 } 820 1022 1023 /** 1024 * Get settings capability. 1025 * 1026 * @return string 1027 */ 821 1028 public function capability(): string { 822 1029 return 'manage_options'; 823 1030 } 824 1031 825 public function menu_position(): string { 826 return '45'; 827 } 828 1032 /** 1033 * Menu position. 1034 * 1035 * @return int 1036 */ 1037 public function menu_position(): int { 1038 return 45; 1039 } 1040 1041 /** 1042 * Menu Icon. 1043 * 1044 * @return string 1045 */ 829 1046 public function menu_icon(): string { 830 1047 return 'dashicons-admin-settings'; 831 1048 } 832 1049 1050 /** 1051 * Default tab name. 1052 * 1053 * @return string 1054 */ 833 1055 public function default_tab_name(): string { 834 1056 return 'general'; 835 1057 } 836 1058 1059 /** 1060 * Get current tab. 1061 * 1062 * @return string 1063 */ 837 1064 final public function get_current_tab(): string { 838 1065 $default_tab_query_key = $this->default_tab_name(); … … 840 1067 $available_tab_keys = array_keys( $this->get_tabs() ); 841 1068 842 $tab_query_key = in_array( $default_tab_query_key, $available_tab_keys, true ) ? $default_tab_query_key : $available_tab_keys[0]; 843 844 return empty( $_GET['tab'] ) ? $tab_query_key : sanitize_title( wp_unslash( $_GET['tab'] ) ); // WPCS: input var okay, CSRF ok. 845 } 846 847 final public function get_tab( $tab_id = '' ) { 1069 $tab_query_key = in_array( $default_tab_query_key, $available_tab_keys, true ) ? $default_tab_query_key : (string) $available_tab_keys[0]; 1070 1071 return ! isset( $_GET['tab'] ) ? sanitize_title( $tab_query_key ) : sanitize_title( wp_unslash( $_GET['tab'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended 1072 } 1073 1074 /** 1075 * Get tab. 1076 * 1077 * @param string $tab_id tab id. 1078 * 1079 * @return array<string, mixed> 1080 */ 1081 final public function get_tab( string $tab_id = '' ): array { 848 1082 $tabs = $this->get_tabs(); 849 1083 850 $_tab_id = empty( $tab_id ) ? $this->get_current_tab() : $tab_id; 851 852 return $tabs[ $_tab_id ] ?? array('page_callback'=>function(){ 853 echo '<div class="notice error"><p>Settings Tab is not available.</p></div>'; 854 }); 855 } 856 1084 $_tab_id = $this->is_empty_string( $tab_id ) ? $this->get_current_tab() : $tab_id; 1085 1086 return $tabs[ $_tab_id ] ?? array( 1087 'page_callback' => function () { 1088 echo '<div class="notice error"><p>Settings Tab is not available.</p></div>'; 1089 }, 1090 ); 1091 } 1092 1093 /** 1094 * Have save button. 1095 * 1096 * @return bool 1097 */ 857 1098 final public function has_save_button(): bool { 858 1099 $data = $this->get_tab(); 859 1100 860 return ! empty( $data['buttons'] ); 861 } 862 1101 return true === $data['buttons']; 1102 } 1103 1104 /** 1105 * Has sidebar. 1106 * 1107 * @return bool 1108 */ 863 1109 final public function has_sidebar(): bool { 864 1110 $data = $this->get_tab(); 865 1111 866 return ! empty( $data['sidebar'] ); 867 } 868 869 /** 870 * @param $tab_id 871 * 872 * @return string 873 */ 874 public function get_tab_uri( $tab_id ): string { 1112 return true === $data['sidebar']; 1113 } 1114 1115 /** 1116 * Get Tab URI. 1117 * 1118 * @param string $tab_id Tab id. 1119 * 1120 * @return string 1121 */ 1122 public function get_tab_uri( string $tab_id ): string { 875 1123 return $this->get_settings_uri( array( 'tab' => $tab_id ) ); 876 1124 } 877 1125 878 1126 /** 879 * @param array $extra 1127 * Get Settings uri. 1128 * 1129 * @param array<string, mixed> $extra Extra arguments for uri. 880 1130 * 881 1131 * @return string … … 890 1140 891 1141 /** 892 * @param array $extra 893 * 894 * @return array 1142 * Get Settings URI Arguments. 1143 * 1144 * @param array<string, mixed> $extra Extra arguments. 1145 * 1146 * @return array<string, mixed> 895 1147 */ 896 1148 public function get_uri_args( array $extra = array() ): array { … … 902 1154 ); 903 1155 904 if ( ! empty( $current_tab ) ) {1156 if ( ! $this->is_empty_string( $current_tab ) ) { 905 1157 $args['tab'] = $current_tab; 906 1158 } … … 910 1162 911 1163 /** 1164 * Check is admin page. 1165 * 912 1166 * @return bool 913 1167 */ 914 1168 public function is_admin_page(): bool { 915 return ( is_admin() && isset( $_GET['page'] ) && $this->get_current_page_slug() === $_GET['page'] ); 1169 // We have to check is valid current page. 1170 return ( is_admin() && isset( $_GET['page'] ) && $this->get_current_page_slug() === $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended 916 1171 } 917 1172 } -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Updater.php
r3044506 r3140508 1 1 <?php 2 2 /** 3 * Plugin Updater API 3 * Plugin Updater API Class File. 4 4 * 5 5 * @package StorePress/AdminUtils 6 * @version 1.0 6 * @since 1.0.0 7 * @version 1.0.0 7 8 */ 8 9 10 declare(strict_types=1); 11 9 12 namespace StorePress\AdminUtils; 10 13 … … 14 17 15 18 /** 16 * Plugin Updater API 19 * Plugin Updater API Class. 17 20 * 18 21 * @name Updater … … 20 23 abstract class Updater { 21 24 25 use Common; 26 22 27 /** 23 28 * Plugin Data. 24 29 * 25 * @var array 30 * @var array<string, mixed> 26 31 */ 27 32 private array $plugin_data = array(); … … 54 59 $plugin_data = $this->get_plugin_data(); 55 60 56 if ( empty( $plugin_data['UpdateURI'] ) ) {61 if ( ! isset( $plugin_data['UpdateURI'] ) ) { 57 62 $msg = 'Plugin "Update URI" is not available. Please add "Update URI" field on plugin file header.'; 58 $this->trigger_error( __METHOD__, $msg );63 wp_trigger_error( __METHOD__, $msg ); 59 64 60 65 return; 61 66 } 62 67 63 if ( empty( $plugin_data['Tested up to'] ) ) {68 if ( ! isset( $plugin_data['Tested up to'] ) ) { 64 69 $msg = 'Plugin "Tested up to" is not available. Please add "Tested up to" field on plugin file header.'; 65 $this->trigger_error( __METHOD__, $msg );70 wp_trigger_error( __METHOD__, $msg ); 66 71 67 72 return; … … 76 81 77 82 // Check plugin update information from server. 78 add_filter( "update_plugins_{$plugin_hostname}", array( $this, 'update_check' ), 10, 4);83 add_filter( "update_plugins_{$plugin_hostname}", array( $this, 'update_check' ), 10, 3 ); 79 84 80 85 // Add some info at the end of plugin update notice like: notice to update license data. 81 add_action( "in_plugin_update_message-{$plugin_id}", array( $this, 'update_message' ) , 10, 2);86 add_action( "in_plugin_update_message-{$plugin_id}", array( $this, 'update_message' ) ); 82 87 83 88 // Add force update check link. … … 88 93 } 89 94 95 /** 96 * Absolute Plugin File. 97 * 98 * @return string 99 */ 90 100 abstract public function plugin_file(): string; 91 101 102 /** 103 * License Key. 104 * 105 * @return string 106 */ 92 107 abstract public function license_key(): string; 93 108 109 /** 110 * License key empty message text. 111 * 112 * @return string 113 */ 94 114 abstract public function license_key_empty_message(): string; 95 115 116 /** 117 * Check update link text. 118 * 119 * @return string 120 */ 96 121 abstract public function check_update_link_text(): string; 97 122 123 /** 124 * Product ID for update server. 125 * 126 * @return string 127 */ 98 128 abstract public function product_id(): string; 99 129 100 final private function get_plugin_data(): array { 101 102 if ( ! empty( $this->plugin_data ) ) { 130 /** 131 * Get Provided Plugin Data. 132 * 133 * @return array<string, mixed> 134 */ 135 public function get_plugin_data(): array { 136 137 if ( array_key_exists( 'Name', $this->plugin_data ) ) { 103 138 return $this->plugin_data; 104 139 } … … 109 144 } 110 145 146 /** 147 * Get Plugin absolute file 148 * 149 * @return string 150 */ 111 151 public function get_plugin_file(): string { 112 152 return $this->plugin_file(); … … 133 173 } 134 174 175 /** 176 * Get license key. 177 * 178 * @return string 179 */ 135 180 public function get_license_key(): string { 136 181 return $this->license_key(); 137 182 } 138 183 184 /** 185 * Get Product ID. 186 * 187 * @return string 188 */ 139 189 public function get_product_id(): string { 140 190 return $this->product_id(); 141 191 } 142 192 193 /** 194 * Add additional request for Updater Rest API. 195 * 196 * @return array<string, string> 197 */ 143 198 public function additional_request_args(): array { 144 199 return array(); … … 154 209 $update_server_hostname = untrailingslashit( $data['UpdateURI'] ); 155 210 156 return wp_parse_url( sanitize_url( $update_server_hostname ), PHP_URL_HOST ); 157 } 158 211 return (string) wp_parse_url( sanitize_url( $update_server_hostname ), PHP_URL_HOST ); 212 } 213 214 /** 215 * Get Update server uri. 216 * 217 * @return string 218 */ 159 219 final public function get_update_server_uri(): string { 160 220 … … 208 268 } 209 269 270 /** 271 * Check plugin update forcefully. 272 * 273 * @return void 274 */ 210 275 final public function force_update_check() { 211 276 if ( current_user_can( 'update_plugins' ) ) { … … 219 284 220 285 wp_safe_redirect( admin_url( 'plugins.php' ) ); 221 } 222 } 223 286 exit; 287 } 288 } 289 290 /** 291 * Get check update action id. 292 * 293 * @return string 294 */ 224 295 private function get_action_id(): string { 225 296 return sprintf( '%s_check_update', $this->get_plugin_dirname() ); 226 297 } 227 298 228 public function check_for_update_link( $links, $file ): array { 229 230 if ( $file === $this->get_plugin_slug() && current_user_can( 'update_plugins' ) ) { 231 232 $id = $this->get_action_id(); 233 $url = wp_nonce_url( add_query_arg( array( 'action' => $id ), admin_url( 'plugins.php' ) ), $this->get_plugin_slug() ); 234 $text = $this->check_update_link_text(); 235 236 $row_meta[ $id ] = sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $url ), esc_html( $text ) ); 237 238 return array_merge( $links, $row_meta ); 239 } 240 241 return $links; 242 } 243 244 public function add_tested_upto_info( $headers ): array { 299 /** 300 * Check for update link. 301 * 302 * @param string[] $plugin_meta An array of the plugin's metadata, including 303 * the version, author, author URI, and plugin URI. 304 * @param string $plugin_file Path to the plugin file relative to the plugins directory. 305 * 306 * @return array<string, string> 307 */ 308 public function check_for_update_link( array $plugin_meta, string $plugin_file ): array { 309 310 if ( $plugin_file === $this->get_plugin_slug() && current_user_can( 'update_plugins' ) ) { 311 312 $id = $this->get_action_id(); 313 $url = wp_nonce_url( add_query_arg( array( 'action' => $id ), admin_url( 'plugins.php' ) ), $this->get_plugin_slug() ); 314 $text = $this->check_update_link_text(); 315 $row_meta = sprintf( '<a href="%1$s" aria-label="%2$s">%2$s</a>', esc_url( $url ), esc_html( $text ) ); 316 317 $plugin_meta[] = $row_meta; 318 } 319 320 return $plugin_meta; 321 } 322 323 /** 324 * Add tested upto support on plugin header. 325 * 326 * @param string[] $headers Available plugin header info. 327 * 328 * @return string[] 329 */ 330 public function add_tested_upto_info( array $headers ): array { 245 331 return array_merge( $headers, array( 'Tested up to' ) ); 246 332 } 247 333 334 /** 335 * Get Plugin Banners. 336 * 337 * @return array<string, string> 338 * @example [ 'high' => '', 'low' => '' ] 339 */ 248 340 public function get_plugin_info_banners(): array { 249 341 … … 259 351 * Add Plugin banners. 260 352 * 261 * @return array [ 262 * '2x' => '', 263 * '1x' => '' 264 * ] 353 * @return array<string, string> 354 * @example [ '2x' => '', '1x' => '' ] 265 355 */ 266 356 abstract public function plugin_banners(): array; … … 269 359 * Get Plugin Banners. 270 360 * 271 * @return array [ 272 * '2x' => '', 273 * '1x' => '' 274 * ] 361 * @return array<string, string> 362 * @example [ '2x' => '', '1x' => '' ] 275 363 */ 276 364 public function get_plugin_banners(): array { … … 281 369 * Add Plugin Icons. 282 370 * 283 * @return array [ 284 * '2x' => '', 285 * '1x' => '', 286 * 'svg' => '' 287 * ] Plugin Icons array. 371 * @return array<string, string> 372 * @example [ '2x' => '', '1x' => '', 'svg' => '' ] 288 373 */ 289 374 abstract public function plugin_icons(): array; … … 292 377 * Get Plugin Icons. 293 378 * 294 * @return array [ 295 * '2x' => '', 296 * '1x' => '', 297 * 'svg' => '', 298 * ] 379 * @return array<string, string> 380 * @example [ '2x' => '', '1x' => '', 'svg' => '' ] 299 381 */ 300 382 public function get_plugin_icons(): array { … … 321 403 322 404 /** 323 * @return array 405 * Get request argument for request. 406 * 407 * @return array<string, mixed> 324 408 */ 325 409 protected function get_request_args(): array { 326 410 return array( 327 'timeout' => 10,328 411 'body' => array( 329 412 'type' => 'plugins', … … 342 425 * Remote plugin data. 343 426 * 344 * @return false|string[]427 * @return bool|array<string, string> 345 428 */ 346 429 public function get_remote_plugin_data() { 347 430 $params = $this->get_request_args(); 348 431 349 $raw_response = wp_ remote_get( $this->get_update_server_uri(), $params );432 $raw_response = wp_safe_remote_get( $this->get_update_server_uri(), $params ); 350 433 351 434 if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) { … … 357 440 358 441 /** 359 * @param $update 360 * @param array $plugin_data 361 * @param string $plugin_file 362 * @param string[] $locales 363 * 364 * @return array|mixed 442 * Update check. 443 * 444 * @param bool|array<string, mixed> $update The plugin update data with the latest details. 445 * @param array<string, mixed> $plugin_data Plugin headers. 446 * @param string $plugin_file Plugin filename. 447 * 448 * @return bool|array<string, mixed> 365 449 * @see WP_Site_Health::detect_plugin_theme_auto_update_issues() 366 450 * @see wp_update_plugins() 367 451 */ 368 final public function update_check( $update, array $plugin_data, string $plugin_file , $locales) {452 final public function update_check( $update, array $plugin_data, string $plugin_file ) { 369 453 370 454 if ( $plugin_file !== $this->get_plugin_slug() ) { … … 372 456 } 373 457 374 if ( ! empty( $update ) ) {458 if ( is_array( $update ) ) { 375 459 return $update; 376 460 } … … 379 463 $plugin_data = $this->get_plugin_data(); 380 464 381 if ( empty( $remote_data )) {465 if ( false === $remote_data ) { 382 466 return $update; 383 467 } … … 388 472 $requires_php = $plugin_data['RequiresPHP']; 389 473 390 /** 391 * @var string $plugin_id plugin unique id. Example: w.org/plugins/xyz-plugin. 392 */ 393 $plugin_id = url_shorten( $plugin_uri, 150 ); 474 $plugin_id = url_shorten( (string) $plugin_uri, 150 ); 394 475 395 476 $item = array( 396 'id' => $plugin_id, // w.org/plugins/xyz-plugin397 'slug' => $this->get_plugin_dirname(), // xyz-plugin398 'plugin' => $this->get_plugin_slug(), // xyz-plugin/xyz-plugin.php477 'id' => $plugin_id, // @example: w.org/plugins/xyz-plugin 478 'slug' => $this->get_plugin_dirname(), // @example: xyz-plugin 479 'plugin' => $this->get_plugin_slug(), // @example: xyz-plugin/xyz-plugin.php 399 480 'version' => $plugin_version, 400 481 'url' => $plugin_uri, … … 413 494 414 495 /** 415 * @param array|false $remote_data 416 * 417 * @return array [ 496 * Prepare Remote data to use. 497 * 498 * @param bool|array<string, mixed> $remote_data Remote data. 499 * 500 * @return array<string, mixed> 501 * @example 502 * array [ 418 503 * 419 504 * 'description'=>'', … … 448 533 $item = array(); 449 534 450 if ( empty( $remote_data) ) {535 if ( ( is_bool( $remote_data ) && false === $remote_data ) || ( is_array( $remote_data ) && $this->is_empty_array( $remote_data ) ) ) { 451 536 return $item; 452 537 } 453 538 454 539 if ( isset( $remote_data['description'] ) ) { 455 $item['sections']['description'] = wp_kses_post( $remote_data['description'] );540 $item['sections']['description'] = $remote_data['description']; 456 541 } 457 542 458 543 if ( isset( $remote_data['changelog'] ) ) { 459 $item['sections']['changelog'] = wp_kses_post( $remote_data['changelog'] );544 $item['sections']['changelog'] = $remote_data['changelog']; 460 545 } 461 546 … … 500 585 501 586 /** 502 * @param $default 503 * @param $action 504 * @param $args 505 * 506 * @return array|mixed 587 * Plugin Information. 588 * 589 * @param false|object|array<string, mixed> $result The result object or array. Default false. 590 * @param string $action The type of information being requested from the Plugin Installation API. 591 * @param object $args Plugin API arguments. 592 * 593 * @return false|array<string, mixed>|object 507 594 * @see plugins_api() 508 595 * @example https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&slug=hello-dolly 509 596 */ 510 final public function plugin_information( $ default, $action,$args ) {597 final public function plugin_information( $result, string $action, object $args ) { 511 598 512 599 if ( ! ( 'plugin_information' === $action ) ) { 513 return $ default;600 return $result; 514 601 } 515 602 … … 523 610 $version = $plugin_data['Version']; 524 611 525 $get_description = $this->get_plugin_description_section();526 $get_changelog = $this->get_plugin_changelog_section();527 $description = empty( $get_description ) ? wpautop( $plugin_description ): $get_description;612 $get_description = trim( $this->get_plugin_description_section() ); 613 $get_changelog = trim( $this->get_plugin_changelog_section() ); 614 $description = '' === $get_description ? $plugin_description : $get_description; 528 615 529 616 $item = array( … … 533 620 'banners' => $this->get_plugin_info_banners(), 534 621 'author' => $author, 535 'homepage' => esc_url( $plugin_homepage ),622 'homepage' => $plugin_homepage, 536 623 'sections' => array( 537 'description' => wp_kses_post( $description ),624 'description' => $description, 538 625 ), 539 626 ); 540 627 541 if ( ! empty( $get_changelog )) {628 if ( strlen( $get_changelog ) > 0 ) { 542 629 $item['sections']['changelog'] = $get_changelog; 543 630 } … … 552 639 } 553 640 554 return $default; 555 } 556 557 public function update_message( $plugin_data, $response ) { 558 559 $license_key = trim( $this->get_license_key() ); 560 $upgrade_notice = $plugin_data['upgrade_notice'] ?? false; 561 562 if ( empty( $license_key ) ) { 641 return $result; 642 } 643 644 /** 645 * Plugin Update Message. 646 * 647 * @param array<string, string> $plugin_data An array of plugin metadata. 648 * 649 * @return void 650 */ 651 public function update_message( array $plugin_data ) { 652 653 $license_key = $this->get_license_key(); 654 $upgrade_notice = $plugin_data['upgrade_notice'] ?? ''; 655 656 if ( $this->is_empty_string( $license_key ) ) { 563 657 printf( ' <strong>%s</strong>', esc_html( $this->license_key_empty_message() ) ); 564 658 } 565 659 566 if ( $upgrade_notice) {660 if ( ! $this->is_empty_string( $upgrade_notice ) ) { 567 661 printf( ' <br /><br /><strong><em>%s</em></strong>', esc_html( $upgrade_notice ) ); 568 }569 }570 571 /**572 * @param string $function_name573 * @param string $message574 *575 * @return void576 */577 final public function trigger_error( string $function_name, string $message ) {578 579 // Bail out if WP_DEBUG is not turned on.580 if ( ! WP_DEBUG ) {581 return;582 }583 584 if ( function_exists( 'wp_trigger_error' ) ) {585 wp_trigger_error( $function_name, $message );586 } else {587 588 if ( ! empty( $function_name ) ) {589 $message = sprintf( '%s(): %s', $function_name, $message );590 }591 592 $message = wp_kses(593 $message,594 array(595 'a' => array( 'href' ),596 'br',597 'code',598 'em',599 'strong',600 ),601 array( 'http', 'https' )602 );603 604 trigger_error( $message );605 662 } 606 663 } -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/Upgrade_Notice.php
r3072401 r3140508 1 1 <?php 2 2 /** 3 * Upgrade Notice3 * Plugin Upgrade Notice Class File. 4 4 * 5 5 * @package StorePress/AdminUtils 6 * @version 1.0 6 * @since 1.0.0 7 * @version 1.0.0 7 8 */ 9 10 declare(strict_types=1); 8 11 9 12 namespace StorePress\AdminUtils; … … 13 16 if ( ! class_exists( '\StorePress\AdminUtils\Upgrade_Notice' ) ) { 14 17 /** 15 * Upgrade Notice18 * Plugin Upgrade Notice Class. 16 19 */ 17 20 abstract class Upgrade_Notice { … … 20 23 * Plugin Data. 21 24 * 22 * @var array 25 * @var array<string, string|bool> 23 26 */ 24 27 private array $data = array(); … … 32 35 33 36 /** 34 * Upgrade notice.37 * Class construct. 35 38 */ 36 39 protected function __construct() { … … 41 44 42 45 /** 43 * Get absolute file path 46 * Get absolute file path. 44 47 * 45 48 * @param string $plugin_file relative or absolute path. … … 214 217 */ 215 218 private function is_compatible(): bool { 216 $current_version = sanitize_text_field( $this->data['Version'] );219 $current_version = sanitize_text_field( (string) $this->data['Version'] ); 217 220 $required_version = $this->compatible_version(); 218 221 … … 227 230 public function get_notice_content(): string { 228 231 229 $name = sanitize_text_field( $this->data['Name'] );230 $version = sanitize_text_field( $this->data['Version'] );232 $name = sanitize_text_field( (string) $this->data['Name'] ); 233 $version = sanitize_text_field( (string) $this->data['Version'] ); 231 234 $compatible_version = $this->compatible_version(); 232 235 … … 237 240 * Notice string format. 238 241 * 242 * @abstract 239 243 * @return string 240 244 */ 241 245 public function localize_notice_format(): string { 242 246 243 $message = esc_html__( 'not implemented. Must be overridden in subclass.' ); 244 $this->trigger_error( __METHOD__, $message ); 247 /* translators: %s: Method name. */ 248 $message = sprintf( esc_html__( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ); 249 wp_trigger_error( __METHOD__, $message ); 245 250 246 251 // translators: 1: Extended Plugin Name. 2: Extended Plugin Version. 3: Extended Plugin Compatible Version. 247 252 return 'You are using an incompatible version of <strong>%1$s - (%2$s)</strong>. Please upgrade to version <strong>%3$s</strong> or upper.'; 248 253 } 249 250 /**251 * Trigger user error.252 *253 * @param string $function_name Function name.254 * @param string $message Message.255 *256 * @return void257 */258 final public function trigger_error( string $function_name, string $message ) {259 260 // Bail out if WP_DEBUG is not turned on.261 if ( ! WP_DEBUG ) {262 return;263 }264 265 if ( function_exists( 'wp_trigger_error' ) ) {266 wp_trigger_error( $function_name, $message );267 } else {268 269 if ( ! empty( $function_name ) ) {270 $message = sprintf( '%s(): %s', $function_name, $message );271 }272 273 $message = wp_kses(274 $message,275 array(276 'a' => array( 'href' ),277 'br',278 'code',279 'em',280 'strong',281 ),282 array( 'http', 'https' )283 );284 285 trigger_error( $message ); // phpcs:ignore.286 }287 }288 254 } 289 255 } -
woo-2checkout/trunk/vendor/storepress/admin-utils/includes/templates/classic-template.php
r3044506 r3140508 1 1 <?php 2 3 2 /** 4 * StorePress Settings Template.3 * Admin Settings Template File. 5 4 * 6 * @global \StorePress\AdminUtils\Settings $this - Settings Class Instance. 5 * @package StorePress/AdminUtils 6 * @var \StorePress\AdminUtils\Settings $this - Settings Class Instance. 7 * @since 1.0.0 8 * @version 1.0.0 7 9 */ 8 10 9 11 defined( 'ABSPATH' ) || die( 'Keep Silent' ); 10 11 12 ?> 12 13 <div class="wrap storepress-settings-wrapper"> 13 14 <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> 14 15 15 16 <?php 16 17 $this->display_settings_messages(); 17 18 ?> 18 19 19 <nav class="nav-tab-wrapper storepress-nav-tab-wrapper" aria-label=" Secondary menu">20 <nav class="nav-tab-wrapper storepress-nav-tab-wrapper" aria-label="<?php echo esc_attr( $this->get_localized_string( 'settings_nav_label_text' ) ); ?>"> 20 21 <?php $this->display_tabs(); ?> 21 22 </nav> … … 31 32 <?php endif; ?> 32 33 </div> 33 34 34 35 <?php if ( $this->has_sidebar() ) : ?> 35 36 <div class="storepress-settings-sidebar"> -
woo-2checkout/trunk/woo-2checkout.php
r3081706 r3140508 10 10 * Description: 2Checkout Payment Gateway for WooCommerce. 11 11 * Author: Emran Ahmed 12 * Version: 3.0. 212 * Version: 3.0.3 13 13 * Requires PHP: 7.4 14 14 * Requires at least: 6.1 15 * Tested up to: 6. 515 * Tested up to: 6.6 16 16 * WC requires at least: 8.1 17 * WC tested up to: 8.817 * WC tested up to: 9.2 18 18 * Text Domain: woo-2checkout 19 19 * Author URI: https://getwooplugins.com/
Note: See TracChangeset
for help on using the changeset viewer.