diff --git a/README.md b/README.md index e1a78f9..164f113 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,22 @@ Define `TENUP_DISABLE_ACTIVITYLOG` as `true` to disable Activity Log. To enhance user awareness and minimize the risk of making unintended changes, 10up Experience includes a visual indicator integrated into the admin bar. This feature clearly displays which environment (e.g., development, staging, production) the user is currently working in. +#### Filters + +- `tenup_experience_environments` + +Allows customization of environment indicator labels, icons, and colors for the four supported WordPress environment types (production, staging, development, local). + +**Example:** + +```php +add_filter( 'tenup_experience_environments', function( $environments ) { + $environments['staging']['icon'] = 'dashicons-star-filled'; + $environments['staging']['background_color'] = '#ff6b00'; + return $environments; +} ); +``` + ### Comments diff --git a/assets/css/admin.css b/assets/css/admin.css index bb67896..67ff825 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -10,46 +10,3 @@ height: 32px; width: 20px; } - -/* Environment Indicator Styling */ -.tenup-experience-environment-indicator { - color: #fff; - pointer-events: none; -} - -.tenup-experience-environment-indicator--production { - background-color: #b92a2a !important; -} - -.tenup-experience-environment-indicator--staging { - background-color: #d79d00 !important; -} - -.tenup-experience-environment-indicator--development { - background-color: #34863b !important; -} - -.tenup-experience-environment-indicator--local { - background-color: #0073aa !important; -} - -.tenup-experience-environment-indicator .ab-icon::before { - content: "\f174"; - top: 3px; -} - -.tenup-experience-environment-indicator--production .ab-icon::before { - content: "\f319"; -} - -.tenup-experience-environment-indicator--staging .ab-icon::before { - content: "\f111"; -} - -.tenup-experience-environment-indicator--development .ab-icon::before { - content: "\f107"; -} - -.tenup-experience-environment-indicator--local .ab-icon::before { - content: "\f102"; -} diff --git a/dist/css/admin.asset.php b/dist/css/admin.asset.php index 862c51d..037d6d1 100644 --- a/dist/css/admin.asset.php +++ b/dist/css/admin.asset.php @@ -1 +1 @@ - array(), 'version' => 'ff828bb7ea0e2d76d8ea'); + array(), 'version' => '9c247eb8cd54451023c8'); diff --git a/dist/css/admin.css b/dist/css/admin.css index 773db50..f4293d8 100644 --- a/dist/css/admin.css +++ b/dist/css/admin.css @@ -1,62 +1 @@ -/*!**************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./assets/css/admin.css ***! - \**************************************************************************************************************************************************************************/ -.tenup-company-photo { - text-align: center; -} - -#wpadminbar .tenup-icon { - background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMzIgNTEyIDUxMiI+PHBhdGggZmlsbD0iIzlFQTNBOCIgZD0iTTI1NS45OTQgMzJDMTE0LjU4OSAzMi4wMTQgMCAxNDYuNjEgMCAyODcuOTkxIDAgMzI3LjAzMSA5LjAxMSAzNjMuOTE1IDI0LjYxMyAzOTdsMi42ODMgMi43NzIgMTU4LjE1LTE1OC4xNDctNDkuNzMxLTQ5LjczNWgyMTYuNDA4djIxNi4zOTNsLTQ5LjczMS00OS43MzgtMTU5LjA1NSAxNTkuMDY0YzM0LjAzMiAxNi43MTYgNzIuMTg5IDI2LjM5IDExMi42NzUgMjYuMzkgMTQxLjM3OSAwIDI1Ni4wMDMtMTE0LjYwNiAyNTYuMDAzLTI1Ni4wMDktLjAwMy0xNDEuMzgxLTExNC42MjUtMjU1Ljk5MS0yNTYuMDE5LTI1NS45OTF6Ii8+PC9zdmc+Cg==") !important; - background-position: center; - background-repeat: no-repeat; - background-size: 20px; - height: 32px; - width: 20px; -} - -/* Environment Indicator Styling */ - -.tenup-experience-environment-indicator { - color: #fff; - pointer-events: none; -} - -.tenup-experience-environment-indicator--production { - background-color: #b92a2a !important; -} - -.tenup-experience-environment-indicator--staging { - background-color: #d79d00 !important; -} - -.tenup-experience-environment-indicator--development { - background-color: #34863b !important; -} - -.tenup-experience-environment-indicator--local { - background-color: #0073aa !important; -} - -.tenup-experience-environment-indicator .ab-icon::before { - content: "\f174"; - top: 3px; -} - -.tenup-experience-environment-indicator--production .ab-icon::before { - content: "\f319"; -} - -.tenup-experience-environment-indicator--staging .ab-icon::before { - content: "\f111"; -} - -.tenup-experience-environment-indicator--development .ab-icon::before { - content: "\f107"; -} - -.tenup-experience-environment-indicator--local .ab-icon::before { - content: "\f102"; -} - - -/*# sourceMappingURL=admin.css.map*/ \ No newline at end of file +.tenup-company-photo{text-align:center}#wpadminbar .tenup-icon{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMzIgNTEyIDUxMiI+PHBhdGggZmlsbD0iIzlFQTNBOCIgZD0iTTI1NS45OTQgMzJDMTE0LjU4OSAzMi4wMTQgMCAxNDYuNjEgMCAyODcuOTkxIDAgMzI3LjAzMSA5LjAxMSAzNjMuOTE1IDI0LjYxMyAzOTdsMi42ODMgMi43NzIgMTU4LjE1LTE1OC4xNDctNDkuNzMxLTQ5LjczNWgyMTYuNDA4djIxNi4zOTNsLTQ5LjczMS00OS43MzgtMTU5LjA1NSAxNTkuMDY0YzM0LjAzMiAxNi43MTYgNzIuMTg5IDI2LjM5IDExMi42NzUgMjYuMzkgMTQxLjM3OSAwIDI1Ni4wMDMtMTE0LjYwNiAyNTYuMDAzLTI1Ni4wMDktLjAwMy0xNDEuMzgxLTExNC42MjUtMjU1Ljk5MS0yNTYuMDE5LTI1NS45OTF6Ii8+PC9zdmc+")!important;background-position:50%;background-repeat:no-repeat;background-size:20px;height:32px;width:20px} diff --git a/dist/css/admin.css.map b/dist/css/admin.css.map deleted file mode 100644 index 1c0be29..0000000 --- a/dist/css/admin.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"css/admin.css","mappings":";;;AAAA;CACC,kBAAkB;AACnB;;AAEA;CACC,8kBAA8kB;CAC9kB,2BAA2B;CAC3B,4BAA4B;CAC5B,qBAAqB;CACrB,YAAY;CACZ,WAAW;AACZ;;AAEA,kCAAkC;;AAClC;CACC,WAAW;CACX,oBAAoB;AACrB;;AAEA;CACC,oCAAoC;AACrC;;AAEA;CACC,oCAAoC;AACrC;;AAEA;CACC,oCAAoC;AACrC;;AAEA;CACC,oCAAoC;AACrC;;AAEA;CACC,gBAAgB;CAChB,QAAQ;AACT;;AAEA;CACC,gBAAgB;AACjB;;AAEA;CACC,gBAAgB;AACjB;;AAEA;CACC,gBAAgB;AACjB;;AAEA;CACC,gBAAgB;AACjB","sources":["webpack://10up-experience/./assets/css/admin.css"],"sourcesContent":[".tenup-company-photo {\n\ttext-align: center;\n}\n\n#wpadminbar .tenup-icon {\n\tbackground-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMzIgNTEyIDUxMiI+PHBhdGggZmlsbD0iIzlFQTNBOCIgZD0iTTI1NS45OTQgMzJDMTE0LjU4OSAzMi4wMTQgMCAxNDYuNjEgMCAyODcuOTkxIDAgMzI3LjAzMSA5LjAxMSAzNjMuOTE1IDI0LjYxMyAzOTdsMi42ODMgMi43NzIgMTU4LjE1LTE1OC4xNDctNDkuNzMxLTQ5LjczNWgyMTYuNDA4djIxNi4zOTNsLTQ5LjczMS00OS43MzgtMTU5LjA1NSAxNTkuMDY0YzM0LjAzMiAxNi43MTYgNzIuMTg5IDI2LjM5IDExMi42NzUgMjYuMzkgMTQxLjM3OSAwIDI1Ni4wMDMtMTE0LjYwNiAyNTYuMDAzLTI1Ni4wMDktLjAwMy0xNDEuMzgxLTExNC42MjUtMjU1Ljk5MS0yNTYuMDE5LTI1NS45OTF6Ii8+PC9zdmc+Cg==\") !important;\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n\tbackground-size: 20px;\n\theight: 32px;\n\twidth: 20px;\n}\n\n/* Environment Indicator Styling */\n.tenup-experience-environment-indicator {\n\tcolor: #fff;\n\tpointer-events: none;\n}\n\n.tenup-experience-environment-indicator--production {\n\tbackground-color: #b92a2a !important;\n}\n\n.tenup-experience-environment-indicator--staging {\n\tbackground-color: #d79d00 !important;\n}\n\n.tenup-experience-environment-indicator--development {\n\tbackground-color: #34863b !important;\n}\n\n.tenup-experience-environment-indicator--local {\n\tbackground-color: #0073aa !important;\n}\n\n.tenup-experience-environment-indicator .ab-icon::before {\n\tcontent: \"\\f174\";\n\ttop: 3px;\n}\n\n.tenup-experience-environment-indicator--production .ab-icon::before {\n\tcontent: \"\\f319\";\n}\n\n.tenup-experience-environment-indicator--staging .ab-icon::before {\n\tcontent: \"\\f111\";\n}\n\n.tenup-experience-environment-indicator--development .ab-icon::before {\n\tcontent: \"\\f107\";\n}\n\n.tenup-experience-environment-indicator--local .ab-icon::before {\n\tcontent: \"\\f102\";\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/css/passwords-styles.asset.php b/dist/css/passwords-styles.asset.php index 724d9f1..d6ccf86 100644 --- a/dist/css/passwords-styles.asset.php +++ b/dist/css/passwords-styles.asset.php @@ -1 +1 @@ - array(), 'version' => '42ff815e0022e137ff3a'); + array(), 'version' => 'ea6cee1408ca8733c5eb'); diff --git a/dist/css/passwords-styles.css b/dist/css/passwords-styles.css index 2bb4d7d..8c62c99 100644 --- a/dist/css/passwords-styles.css +++ b/dist/css/passwords-styles.css @@ -1,18 +1 @@ -/*!******************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./assets/css/passwords.css ***! - \******************************************************************************************************************************************************************************/ -.pw-weak { - display: none !important; -} - -#login p.description.indicator-hint { - margin-top: 12px; -} - -.pw-message { - color: #666; /* stylelint-disable-line sh-waqar/declaration-use-variable */ - font-style: italic; -} - - -/*# sourceMappingURL=passwords-styles.css.map*/ \ No newline at end of file +.pw-weak{display:none!important}#login p.description.indicator-hint{margin-top:12px}.pw-message{color:#666;font-style:italic} diff --git a/dist/css/passwords-styles.css.map b/dist/css/passwords-styles.css.map deleted file mode 100644 index f2cf06a..0000000 --- a/dist/css/passwords-styles.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"css/passwords-styles.css","mappings":";;;AAAA;CACC,wBAAwB;AACzB;;AAEA;CACC,gBAAgB;AACjB;;AAEA;CACC,WAAW,EAAE,6DAA6D;CAC1E,kBAAkB;AACnB","sources":["webpack://10up-experience/./assets/css/passwords.css"],"sourcesContent":[".pw-weak {\n\tdisplay: none !important;\n}\n\n#login p.description.indicator-hint {\n\tmargin-top: 12px;\n}\n\n.pw-message {\n\tcolor: #666; /* stylelint-disable-line sh-waqar/declaration-use-variable */\n\tfont-style: italic;\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/css/tenup-pages.asset.php b/dist/css/tenup-pages.asset.php index 1c0385e..2ae7373 100644 --- a/dist/css/tenup-pages.asset.php +++ b/dist/css/tenup-pages.asset.php @@ -1 +1 @@ - array(), 'version' => '67ef8cc6a25ac4c9264d'); + array(), 'version' => 'c553b0877dc085aaae4d'); diff --git a/dist/css/tenup-pages.css b/dist/css/tenup-pages.css index 5953dd5..d169f0a 100644 --- a/dist/css/tenup-pages.css +++ b/dist/css/tenup-pages.css @@ -1,88 +1 @@ -/*!********************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./assets/css/tenup-pages.css ***! - \********************************************************************************************************************************************************************************/ -.tenup-badge { - background: url("../img/logo.png") no-repeat top left; - background-size: cover; - display: inline-block; - height: 126px; - overflow: hidden; - position: absolute; - right: 0; - text-indent: 100%; - top: 0; - white-space: nowrap; - width: 110px; -} - -@media - only screen and ( min-resolution: 192dppx), only screen and ( min-resolution: 2dppx) { - - .tenup-badge { - background: url("../img/logo@2x.png") no-repeat top left; - background-size: 110px 126px; - } -} - -.about-wrap img { - max-width: 100%; -} - -.about-wrap .full-width-img img { - display: block; - margin: 0 auto; -} - -.about-wrap .nav-tab-active { - background-color: #f1f1f1; /* stylelint-disable-line sh-waqar/declaration-use-variable */ - border-bottom-color: #f6f7fb; /* stylelint-disable-line sh-waqar/declaration-use-variable */ -} - -.about-wrap .section { - margin: 0 auto; - overflow: hidden; - padding-bottom: 20px; -} - -.about-wrap .center { - text-align: center; -} - -.about-wrap .section ul { - list-style: disc; - margin-left: 25px; -} - -@media screen and (max-width: 480px) { - - .about-wrap h2.nav-tab-wrapper { - padding-right: 0; - } - - .about-wrap h2 .nav-tab { - box-sizing: border-box; - margin-right: 0; - margin-top: 0; - width: 100%; - } - - .about-wrap h1 { - padding-right: 55px; - } - - .tenup-badge { - height: 63px; - width: 55px; - } - - .section-wrapper { - padding: 20px 0; - } - - .about-wrap .section-about { - padding: 0 20px; - } -} - - -/*# sourceMappingURL=tenup-pages.css.map*/ \ No newline at end of file +.tenup-badge{background:url(../img/logo.png) no-repeat 0 0;background-size:cover;display:inline-block;height:126px;overflow:hidden;position:absolute;right:0;text-indent:100%;top:0;white-space:nowrap;width:110px}@media only screen and (-webkit-min-device-pixel-ratio:192),only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-resolution:192dppx),only screen and (min-resolution:2dppx){.tenup-badge{background:url(../img/logo@2x.png) no-repeat 0 0;background-size:110px 126px}}.about-wrap img{max-width:100%}.about-wrap .full-width-img img{display:block;margin:0 auto}.about-wrap .nav-tab-active{background-color:#f1f1f1;border-bottom-color:#f6f7fb}.about-wrap .section{margin:0 auto;overflow:hidden;padding-bottom:20px}.about-wrap .center{text-align:center}.about-wrap .section ul{list-style:disc;margin-left:25px}@media screen and (max-width:480px){.about-wrap h2.nav-tab-wrapper{padding-right:0}.about-wrap h2 .nav-tab{box-sizing:border-box;margin-right:0;margin-top:0;width:100%}.about-wrap h1{padding-right:55px}.tenup-badge{height:63px;width:55px}.section-wrapper{padding:20px 0}.about-wrap .section-about{padding:0 20px}} diff --git a/dist/css/tenup-pages.css.map b/dist/css/tenup-pages.css.map deleted file mode 100644 index c78d3b2..0000000 --- a/dist/css/tenup-pages.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"css/tenup-pages.css","mappings":";;;AAAA;CACC,qDAAqD;CACrD,sBAAsB;CACtB,qBAAqB;CACrB,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,QAAQ;CACR,iBAAiB;CACjB,MAAM;CACN,mBAAmB;CACnB,YAAY;AACb;;AAEA;;;CAIC;EACC,wDAAwD;EACxD,4BAA4B;CAC7B;AACD;;AAEA;CACC,eAAe;AAChB;;AAEA;CACC,cAAc;CACd,cAAc;AACf;;AAEA;CACC,yBAAyB,EAAE,6DAA6D;CACxF,4BAA4B,EAAE,6DAA6D;AAC5F;;AAEA;CACC,cAAc;CACd,gBAAgB;CAChB,oBAAoB;AACrB;;AAEA;CACC,kBAAkB;AACnB;;AAEA;CACC,gBAAgB;CAChB,iBAAiB;AAClB;;AAEA;;CAEC;EACC,gBAAgB;CACjB;;CAEA;EACC,sBAAsB;EACtB,eAAe;EACf,aAAa;EACb,WAAW;CACZ;;CAEA;EACC,mBAAmB;CACpB;;CAEA;EACC,YAAY;EACZ,WAAW;CACZ;;CAEA;EACC,eAAe;CAChB;;CAEA;EACC,eAAe;CAChB;AACD","sources":["webpack://10up-experience/./assets/css/tenup-pages.css"],"sourcesContent":[".tenup-badge {\n\tbackground: url(\"../img/logo.png\") no-repeat top left;\n\tbackground-size: cover;\n\tdisplay: inline-block;\n\theight: 126px;\n\toverflow: hidden;\n\tposition: absolute;\n\tright: 0;\n\ttext-indent: 100%;\n\ttop: 0;\n\twhite-space: nowrap;\n\twidth: 110px;\n}\n\n@media\n\tonly screen and ( min-resolution: 192dppx),\n\tonly screen and ( min-resolution: 2dppx) {\n\n\t.tenup-badge {\n\t\tbackground: url(\"../img/logo@2x.png\") no-repeat top left;\n\t\tbackground-size: 110px 126px;\n\t}\n}\n\n.about-wrap img {\n\tmax-width: 100%;\n}\n\n.about-wrap .full-width-img img {\n\tdisplay: block;\n\tmargin: 0 auto;\n}\n\n.about-wrap .nav-tab-active {\n\tbackground-color: #f1f1f1; /* stylelint-disable-line sh-waqar/declaration-use-variable */\n\tborder-bottom-color: #f6f7fb; /* stylelint-disable-line sh-waqar/declaration-use-variable */\n}\n\n.about-wrap .section {\n\tmargin: 0 auto;\n\toverflow: hidden;\n\tpadding-bottom: 20px;\n}\n\n.about-wrap .center {\n\ttext-align: center;\n}\n\n.about-wrap .section ul {\n\tlist-style: disc;\n\tmargin-left: 25px;\n}\n\n@media screen and (max-width: 480px) {\n\n\t.about-wrap h2.nav-tab-wrapper {\n\t\tpadding-right: 0;\n\t}\n\n\t.about-wrap h2 .nav-tab {\n\t\tbox-sizing: border-box;\n\t\tmargin-right: 0;\n\t\tmargin-top: 0;\n\t\twidth: 100%;\n\t}\n\n\t.about-wrap h1 {\n\t\tpadding-right: 55px;\n\t}\n\n\t.tenup-badge {\n\t\theight: 63px;\n\t\twidth: 55px;\n\t}\n\n\t.section-wrapper {\n\t\tpadding: 20px 0;\n\t}\n\n\t.about-wrap .section-about {\n\t\tpadding: 0 20px;\n\t}\n}\n"],"names":[],"ignoreList":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/img/10up-image-1.jpg b/dist/img/10up-image-1.jpg index 4e14bee..5ed17b1 100644 Binary files a/dist/img/10up-image-1.jpg and b/dist/img/10up-image-1.jpg differ diff --git a/dist/img/10up-image-2.jpg b/dist/img/10up-image-2.jpg index ae20e53..a787380 100644 Binary files a/dist/img/10up-image-2.jpg and b/dist/img/10up-image-2.jpg differ diff --git a/dist/img/logo.png b/dist/img/logo.png index f53977b..be5ec9e 100644 Binary files a/dist/img/logo.png and b/dist/img/logo.png differ diff --git a/dist/img/logo@2x.png b/dist/img/logo@2x.png index c3b8508..1e26c52 100644 Binary files a/dist/img/logo@2x.png and b/dist/img/logo@2x.png differ diff --git a/dist/img/planet.png b/dist/img/planet.png index 121dadf..61bf0f2 100644 Binary files a/dist/img/planet.png and b/dist/img/planet.png differ diff --git a/dist/img/tenup.svg b/dist/img/tenup.svg index be56d77..f50f1e7 100644 --- a/dist/img/tenup.svg +++ b/dist/img/tenup.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/dist/js/notices.asset.php b/dist/js/notices.asset.php index c304a56..f501eae 100644 --- a/dist/js/notices.asset.php +++ b/dist/js/notices.asset.php @@ -1 +1 @@ - array('jquery'), 'version' => 'eee016358ed86555bc87'); + array('jquery'), 'version' => '4d01ee8c6266942b7267'); diff --git a/dist/js/notices.js b/dist/js/notices.js index b9f11f6..4d9ffa3 100644 --- a/dist/js/notices.js +++ b/dist/js/notices.js @@ -1,121 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "jquery": -/*!*************************!*\ - !*** external "jQuery" ***! - \*************************/ -/***/ (function(module) { - -module.exports = window["jQuery"]; - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Check if module exists (development only) -/******/ if (__webpack_modules__[moduleId] === undefined) { -/******/ var e = new Error("Cannot find module '" + moduleId + "'"); -/******/ e.code = 'MODULE_NOT_FOUND'; -/******/ throw e; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. -!function() { -/*!******************************!*\ - !*** ./assets/js/notices.js ***! - \******************************/ -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); -/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); - /* eslint-disable-line import/no-unresolved */ - -const { - tenupWelcome, - ajaxurl -} = window; -const dismiss = document.querySelector('.notice-10up-experience-welcome'); -if (dismiss) { - const data = { - action: 'tenup_dismiss_welcome', - nonce: tenupWelcome.nonce - }; - jquery__WEBPACK_IMPORTED_MODULE_0___default()(dismiss).on('click', 'button', () => { - jquery__WEBPACK_IMPORTED_MODULE_0___default().ajax({ - method: 'post', - data, - url: ajaxurl - }); - }); -} -}(); -/******/ })() -; -//# sourceMappingURL=notices.js.map \ No newline at end of file +!function(){"use strict";var e={n:function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,{a:t}),t},d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}},n=window.jQuery,t=e.n(n);const{tenupWelcome:o,ajaxurl:r}=window,c=document.querySelector(".notice-10up-experience-welcome");if(c){const e={action:"tenup_dismiss_welcome",nonce:o.nonce};t()(c).on("click","button",(()=>{t().ajax({method:"post",data:e,url:r})}))}}(); \ No newline at end of file diff --git a/dist/js/notices.js.map b/dist/js/notices.js.map deleted file mode 100644 index 29d6692..0000000 --- a/dist/js/notices.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"js/notices.js","mappings":";;;;;;;;;;AAAA,kC;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WC5BA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,8CAA8C,yD;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;ACN4B,CAAC;;AAE7B,MAAM;EAAEC,YAAY;EAAEC;AAAQ,CAAC,GAAGC,MAAM;AAExC,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,iCAAiC,CAAC;AAEzE,IAAIF,OAAO,EAAE;EACZ,MAAMG,IAAI,GAAG;IACZC,MAAM,EAAE,uBAAuB;IAC/BC,KAAK,EAAER,YAAY,CAACQ;EACrB,CAAC;EAEDT,6CAAM,CAACI,OAAO,CAAC,CAACM,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM;IAC3CV,kDAAW,CAAC;MACXY,MAAM,EAAE,MAAM;MACdL,IAAI;MACJM,GAAG,EAAEX;IACN,CAAC,CAAC;EACH,CAAC,CAAC;AACH,C","sources":["webpack://10up-experience/external window \"jQuery\"","webpack://10up-experience/webpack/bootstrap","webpack://10up-experience/webpack/runtime/compat get default export","webpack://10up-experience/webpack/runtime/define property getters","webpack://10up-experience/webpack/runtime/hasOwnProperty shorthand","webpack://10up-experience/webpack/runtime/make namespace object","webpack://10up-experience/./assets/js/notices.js"],"sourcesContent":["module.exports = window[\"jQuery\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import jQuery from 'jquery'; /* eslint-disable-line import/no-unresolved */\n\nconst { tenupWelcome, ajaxurl } = window;\n\nconst dismiss = document.querySelector('.notice-10up-experience-welcome');\n\nif (dismiss) {\n\tconst data = {\n\t\taction: 'tenup_dismiss_welcome',\n\t\tnonce: tenupWelcome.nonce,\n\t};\n\n\tjQuery(dismiss).on('click', 'button', () => {\n\t\tjQuery.ajax({\n\t\t\tmethod: 'post',\n\t\t\tdata,\n\t\t\turl: ajaxurl,\n\t\t});\n\t});\n}\n"],"names":["jQuery","tenupWelcome","ajaxurl","window","dismiss","document","querySelector","data","action","nonce","on","ajax","method","url"],"ignoreList":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js/passwords.asset.php b/dist/js/passwords.asset.php index a7ea034..0bc084f 100644 --- a/dist/js/passwords.asset.php +++ b/dist/js/passwords.asset.php @@ -1 +1 @@ - array(), 'version' => '2ef14d4606864fc5e66d'); + array(), 'version' => '8d1a61557b2b5cd5fb38'); diff --git a/dist/js/passwords.js b/dist/js/passwords.js index 72c1706..ce0d150 100644 --- a/dist/js/passwords.js +++ b/dist/js/passwords.js @@ -1,17 +1 @@ -/******/ (function() { // webpackBootstrap -/*!********************************!*\ - !*** ./assets/js/passwords.js ***! - \********************************/ -const { - tenupPasswords -} = window; -const passwordWrapper = document.querySelectorAll('#your-profile .wp-pwd, #resetpassform .wp-pwd'); -if (passwordWrapper.length) { - const passwordMessage = document.createElement('span'); - passwordMessage.classList.add('pw-message'); - passwordMessage.innerText = tenupPasswords.message; - passwordWrapper[0].appendChild(passwordMessage); -} -/******/ })() -; -//# sourceMappingURL=passwords.js.map \ No newline at end of file +!function(){const{tenupPasswords:e}=window,s=document.querySelectorAll("#your-profile .wp-pwd, #resetpassform .wp-pwd");if(s.length){const n=document.createElement("span");n.classList.add("pw-message"),n.innerText=e.message,s[0].appendChild(n)}}(); \ No newline at end of file diff --git a/dist/js/passwords.js.map b/dist/js/passwords.js.map deleted file mode 100644 index 647c754..0000000 --- a/dist/js/passwords.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"js/passwords.js","mappings":";;;;AAAA,MAAM;EAAEA;AAAe,CAAC,GAAGC,MAAM;AAEjC,MAAMC,eAAe,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,+CAA+C,CAAC;AAElG,IAAIF,eAAe,CAACG,MAAM,EAAE;EAC3B,MAAMC,eAAe,GAAGH,QAAQ,CAACI,aAAa,CAAC,MAAM,CAAC;EAEtDD,eAAe,CAACE,SAAS,CAACC,GAAG,CAAC,YAAY,CAAC;EAC3CH,eAAe,CAACI,SAAS,GAAGV,cAAc,CAACW,OAAO;EAElDT,eAAe,CAAC,CAAC,CAAC,CAACU,WAAW,CAACN,eAAe,CAAC;AAChD,C","sources":["webpack://10up-experience/./assets/js/passwords.js"],"sourcesContent":["const { tenupPasswords } = window;\n\nconst passwordWrapper = document.querySelectorAll('#your-profile .wp-pwd, #resetpassform .wp-pwd');\n\nif (passwordWrapper.length) {\n\tconst passwordMessage = document.createElement('span');\n\n\tpasswordMessage.classList.add('pw-message');\n\tpasswordMessage.innerText = tenupPasswords.message;\n\n\tpasswordWrapper[0].appendChild(passwordMessage);\n}\n"],"names":["tenupPasswords","window","passwordWrapper","document","querySelectorAll","length","passwordMessage","createElement","classList","add","innerText","message","appendChild"],"ignoreList":[],"sourceRoot":""} \ No newline at end of file diff --git a/includes/classes/AdminCustomizations/EnvironmentIndicator.php b/includes/classes/AdminCustomizations/EnvironmentIndicator.php index ff68906..28b5658 100644 --- a/includes/classes/AdminCustomizations/EnvironmentIndicator.php +++ b/includes/classes/AdminCustomizations/EnvironmentIndicator.php @@ -22,59 +22,130 @@ class EnvironmentIndicator { * @since 1.7 */ public function setup() { - // Add an admin bar item if in wp-admin. add_action( 'admin_bar_menu', [ $this, 'add_toolbar_item' ], 7 ); + add_action( 'admin_head', [ $this, 'add_inline_styles' ] ); + add_action( 'wp_head', [ $this, 'add_inline_styles' ] ); } + /** + * Get the environments + * + * WordPress only allows four possible environment types: 'production', 'staging', 'development', and 'local'. + * + * @see https://developer.wordpress.org/reference/functions/wp_get_environment_type/ + * + * @return array Array of environments. + */ + public function get_the_environments(): array { + $default_environments = [ + 'production' => [ + 'label' => __( 'Production', 'tenup' ), + 'icon' => 'dashicons-admin-site', + 'background_color' => '#b92a2a', + 'text_color' => '#fff', + ], + 'staging' => [ + 'label' => __( 'Staging', 'tenup' ), + 'icon' => 'dashicons-admin-generic', + 'background_color' => '#d79d00', + 'text_color' => '#fff', + ], + 'development' => [ + 'label' => __( 'Development', 'tenup' ), + 'icon' => 'dashicons-admin-tools', + 'background_color' => '#34863b', + 'text_color' => '#fff', + ], + 'local' => [ + 'label' => __( 'Local', 'tenup' ), + 'icon' => 'dashicons-admin-home', + 'background_color' => '#0073aa', + 'text_color' => '#fff', + ], + ]; + + /** + * Filter environment indicator configurations + * + * Allows customization of environment indicator labels, icons, and colors. + * Can be used to modify existing environments or add custom environments. + * + * @param array $environments Environment configurations array. + * Each environment should have: + * - label (string): Human-readable label + * - icon (string): Dashicons class name (e.g., 'dashicons-warning') + * - background_color (string): Hex color code + * - text_color (string): Hex color code + */ + $environments = apply_filters( 'tenup_experience_environments', $default_environments ); + + return is_array( $environments ) ? wp_parse_args( $environments, $default_environments ) : $default_environments; + } + + /** * Add environment indicator to admin bar * * @param WP_Admin_Bar $admin_bar Admin bar instance + * + * @return void */ public function add_toolbar_item( $admin_bar ) { - $environment = wp_get_environment_type(); + $type = wp_get_environment_type(); // If the const isn't set, and we're on a local URL, assume we're in a development environment. if ( ! defined( 'WP_ENVIRONMENT_TYPE' ) && $this->is_local_url() ) { - $environment = 'local'; + $type = 'local'; + } + + $environments = $this->get_the_environments(); + if ( empty( $environments ) ) { + return; } + $environment = $environments[ $type ] ?? $environments['production']; + $admin_bar->add_menu( [ 'id' => 'tenup-experience-environment-indicator', 'parent' => 'top-secondary', - 'title' => '' . esc_html( $this->get_environment_label( $environment ) ) . '', + 'title' => sprintf( '%s', esc_attr( $environment['icon'] ), esc_html( $environment['label'] ) ), 'meta' => [ - 'class' => esc_attr( "tenup-experience-environment-indicator tenup-experience-environment-indicator--$environment" ), + 'class' => esc_attr( "tenup-experience-environment-indicator tenup-experience-environment-indicator--$type" ), ], ] ); } /** - * Get human readable label for environment - * - * @param string $environment Environment type + * Add inline styles for environment indicator * - * @return string + * @return void */ - public function get_environment_label( $environment ) { - switch ( $environment ) { - case 'local': - $label = __( 'Local', 'tenup' ); - break; - case 'development': - $label = __( 'Development', 'tenup' ); - break; - case 'staging': - $label = __( 'Staging', 'tenup' ); - break; - default: - $label = __( 'Production', 'tenup' ); - break; + public function add_inline_styles() { + if ( ! is_admin_bar_showing() ) { + return; + } + + $environments = $this->get_the_environments(); + if ( empty( $environments ) ) { + return; + } + + $css = ''; + $css .= '.tenup-experience-environment-indicator { pointer-events: none; }'; + $css .= '.tenup-experience-environment-indicator .ab-icon { top: 3px; }'; + + foreach ( $environments as $type => $environment ) { + $css .= sprintf( + ' .tenup-experience-environment-indicator--%s .ab-item { background-color: %s !important; color: %s !important; }', + esc_attr( $type ), + esc_attr( $environment['background_color'] ), + esc_attr( $environment['text_color'] ) + ); } - return $label; + printf( '', esc_attr( wp_strip_all_tags( $css ) ) ); } /**