From aa600b01cdbebf5ef539e21b17afd16cca39de72 Mon Sep 17 00:00:00 2001 From: Kim Coleman Date: Wed, 4 Feb 2026 04:35:45 -0500 Subject: [PATCH 001/109] Modernizing color schemes, upgrade script, theme.json filter (#200) * labeling tweaks * remove the need to use the translate function when adding settings/controls via the helper method * separated all those settings and controls into their own helpers to make the register function easier to manage * resolved issue with missing color settings, need to update them to use helpers * put back missing color settings, updated helper * wordpress formatting * colors needed a little organizing too * Fixes based on co-pilot's PR review, added a stylesheet for customizer and some comments to functions that were missing any * new helpers for new sections in customizer, move some core sections into custom panels, re-organizing where settings live after feedback * panels/sections properly ordered via priority * colors in the correct order, a little styling * Wording tweaks; moving some settings around; Adding columns ratio to posts and blog separate setting inherits pages setting * Spaces > Tabs * Replacing webfonts with latin-extended versions for broader language support * Spaces > Tabs * Cleanup of line indentation * Reordering page settings * creating variables and converting arrays into functions while keeping filters intact - work in progress * breaking stuff * pause here before contemplating refactoring to class based, don't want to get too lost in the rabbit hole * commit before switching branches * resolved undefined error I was getting, cleaned up color/color scheme code with functions * Decided to create a new default based on the 4.6 one so we can group theme variation color schemes and separate legacy. Too many colors in legacy which can make styling tougher. * adding in hook I removed, thinking about how to call schemes from customizer file * slowly updating customizer js to keep old color scheme working * colors are saving on an individual level (overrides) for legacy but color scheme settings themselves are not saving the value... * migration function added so those on legacy color schemes can have their values preserved and the new color scheme setting will read 'leagacy' on it * kind of works, a bit funky * trying a different approach to color scheme handling, testing * removing old stuff * looks like it's working, needs regression testing * try adding a new color scheme as an example * only show existing dark mode setting if value is detected, we want to deprecate/replace this in the future * remove theme support for color palette, we don't need it * add styles to the editor stylesheet for fonts, update theme.json so buttons use body font, not heading font * adjust button styles a bit, added a pmpro setting to customizer to override pmpro colors with customizer colors * show pmpro color overrides in live preview * commit before I start breaking things while fixing default colors/overrides in the preview/front-end * formatting and comments * adding documentation for color schemes and presets * more documentation * updated JS to use get_theme_mod to check for legacy, adjusting sync function * commit before switching branches * do we even need to set default for new theme? * trying to fix default value loaded in customizer * corrections * it looks like it's working now PHP wise yay, just tweaking the JS for live preview * we're closer * see if I can get the legacy scheme permanently added as part of the new color scheme setting * working on individual color pickers * looks like it's mostly working on front-end and customizer except the site tagline * stable here before I add new color schemes from Kim * starting to clean up and update comments * cleaned up * bring over Kim's changes in the theme.json * formatting and updated docs * Merging dev * Removing additions to editor.css * initial attempt at documenting project structure * site tagline customizer fix, minor tweak to what CSS var headings use in styles * corrected some minor things that PHP Storm was complaining about, old web prefixes, incorrect values, redundant px etc. * corrected some old prefixes, incorrect values and redundancy in the stylesheet. Also added fixes mostly for headings that wasn't in the theme.json, need to organize keys better... * Fixing an incorrect background color relationship * Reverting some adjustments to a happy medium * Resolving if site title and tagline are hidden * Color scheme tweaking * Fix for header text color properly storing as WP intends * Updating color schemes * Filtering header and body font to theme.json like colors * paces to tabs --------- Co-authored-by: unknown --- css/bbp.css | 2 +- css/customizer.css | 8 + css/editor.css | 2 +- css/lifterlms.css | 8 +- css/rtl.css | 380 ++--- css/theme-my-login.css | 4 +- docs/CUSTOMIZER.md | 94 ++ docs/PROJECT_STRUCTURE.md | 115 ++ functions.php | 367 ++--- inc/custom-header.php | 18 +- inc/customizer.php | 512 ++---- inc/defaults.php | 615 +++++++- inc/deprecated.php | 318 ++++ inc/extras.php | 13 +- inc/font-awesome.php | 22 +- inc/updates.php | 131 +- js/admin-page_banners.js | 16 +- js/customizer-controls.js | 234 ++- js/customizer.js | 104 +- js/memberlite.js | 4 +- js/multi-post-thumbnails-admin.js | 88 +- shortcodes/banners.php | 28 +- shortcodes/buttons.php | 30 +- shortcodes/columns.php | 38 +- shortcodes/messages.php | 10 +- shortcodes/subpagelist.php | 6 +- shortcodes/tabs.php | 80 +- style.css | 45 +- theme.json | 2408 +++++++++++++++-------------- 29 files changed, 3305 insertions(+), 2395 deletions(-) create mode 100644 docs/CUSTOMIZER.md create mode 100644 docs/PROJECT_STRUCTURE.md diff --git a/css/bbp.css b/css/bbp.css index e1b19673..1f311f27 100644 --- a/css/bbp.css +++ b/css/bbp.css @@ -5,7 +5,7 @@ @media screen and (min-width: 46.8em) { body.buddypress #page .site-content { - padding-top: 0; + padding-top: 0; } } diff --git a/css/customizer.css b/css/customizer.css index 3b702b61..05bb9009 100644 --- a/css/customizer.css +++ b/css/customizer.css @@ -20,3 +20,11 @@ margin: 8px -12px 0; padding: 10px; } + +.customize-control-description { + margin-bottom: 10px; +} + +label + .customize-control-description { + margin-top: 5px; +} diff --git a/css/editor.css b/css/editor.css index a868ccbb..8ed45529 100644 --- a/css/editor.css +++ b/css/editor.css @@ -1 +1 @@ -/** Block Editor Custom Styles **/ +/** Block Editor Custom Styles **/ \ No newline at end of file diff --git a/css/lifterlms.css b/css/lifterlms.css index 64c92149..00f38e45 100644 --- a/css/lifterlms.css +++ b/css/lifterlms.css @@ -562,11 +562,11 @@ a.llms-button-secondary { } .single-llms_quiz .llms-quiz-buttons form { - align-items: top; - display: flex; - flex-direction: row; + align-items: top; + display: flex; + flex-direction: row; gap: 2.9rem; - margin-top: 2.9rem; + margin-top: 2.9rem; } .single-llms_quiz .llms-quiz-results .llms-donut.passing { diff --git a/css/rtl.css b/css/rtl.css index 853983b7..1a91960b 100644 --- a/css/rtl.css +++ b/css/rtl.css @@ -1,398 +1,398 @@ /* Adding support for languages written in a Right To Left (RTL) direction. */ body { - direction: rtl; - unicode-bidi: embed; + direction: rtl; + unicode-bidi: embed; } caption, th, td{ - text-align: right; + text-align: right; } blockquote{ - padding: 2.9rem 2.9rem 1px 2.9rem ; - border-right: 5px solid #CCC; - border-left: none; + padding: 2.9rem 2.9rem 1px 2.9rem ; + border-right: 5px solid #CCC; + border-left: none; } blockquote.quote, .testimonials-widget blockquote{ - padding: 0 3.7rem 0 0 ; + padding: 0 3.7rem 0 0 ; } blockquote.quote:before{ - right: 0rem; - left: auto; + right: 0rem; + left: auto; } blockquote cite, .testimonials-widget blockquote .credit{ - text-align: left; + text-align: left; } .testimonials-widget-testimonial .open-quote:before{ - padding-left: 1rem; - padding-right: 0; + padding-left: 1rem; + padding-right: 0; } .testimonials-widget-testimonial .close-quote:after{ - padding-right: 1rem; - padding-left: 0; + padding-right: 1rem; + padding-left: 0; } details > summary:before{ - float: left; + float: left; } ul, ol{ - margin: 0 3.2rem 2.9rem 0 ; + margin: 0 3.2rem 2.9rem 0 ; } ul li, ol li{ - margin: 0 0 1rem 0 ; + margin: 0 0 1rem 0 ; } dt{ - padding: 2.9rem 0 0 0 ; + padding: 2.9rem 0 0 0 ; } textarea{ - padding-right: 1.45rem; - padding-left: 0; + padding-right: 1.45rem; + padding-left: 0; } .pmpro_content_message a{ - margin: 5px 0 0 5px ; + margin: 5px 0 0 5px ; } .main-navigation ul{ - margin-right: 0; + margin-right: 0; } .main-navigation li{ - float: right; + float: right; } .main-navigation a{ - border-right: 1px dotted #CCC; - border-left: none; + border-right: 1px dotted #CCC; + border-left: none; } .main-navigation li:first-child a{ - border-right: none; - border-left: none; - padding-left: 1.45rem; + border-right: none; + border-left: none; + padding-left: 1.45rem; } .meta-navigation ul, .header-right .widget_nav_menu ul, .footer-navigation ul{ - margin: 0 0 1.45rem 0 ; - padding-right: 0; + margin: 0 0 1.45rem 0 ; + padding-right: 0; } .meta-navigation ul li, .header-right .widget_nav_menu ul li, .footer-navigation ul li{ - border-left: 1px solid #CCC; - border-right: none; + border-left: 1px solid #CCC; + border-right: none; } .meta-navigation li:last-child, .header-right .widget_nav_menu li:last-child, .footer-navigation li:last-child{ - border-left: none; - border-right: none; - padding-left: 0; + border-left: none; + border-right: none; + padding-left: 0; } .main-navigation ul.sub-menu, .meta-navigation ul.sub-menu, .header-right .widget_nav_menu ul.sub-menu{ - float: right; - right: -9999em; - left: auto; - text-align: right; + float: right; + right: -9999em; + left: auto; + text-align: right; } .meta-navigation ul.sub-menu ul.sub-menu, .header-right .widget_nav_menu ul.sub-menu ul.sub-menu{ - right: -9999em; - left: auto; + right: -9999em; + left: auto; } .main-navigation ul.sub-menu a, .meta-navigation ul.sub-menu a, .header-right .widget_nav_menu ul.sub-menu a{ - border-right: none; - border-left: none; + border-right: none; + border-left: none; } .main-navigation ul li:hover > ul{ - right: auto; - left: auto; + right: auto; + left: auto; } .main-navigation ul li:first-child:hover > ul{ - right: -1.5rem; - left: auto; + right: -1.5rem; + left: auto; } .main-navigation ul li:hover > ul li:hover > ul{ - right: 100%; - left: auto; + right: 100%; + left: auto; } .meta-navigation ul li:hover > ul, .header-right .widget_nav_menu ul li:hover > ul{ - right: 0; - left: auto; + right: 0; + left: auto; } .main-navigation ul ul li:hover > ul, .meta-navigation ul ul li:hover > ul, .header-right .widget_nav_menu ul ul li:hover > ul{ - right: 100%; - left: auto; + right: 100%; + left: auto; } .main-navigation ul ul li:first-child a, .main-navigation ul li:first-child ul li a, .meta-navigation ul ul li:first-child a, .header-right .widget_nav_menu ul ul li:first-child a{ - padding-right: 1.5rem; - padding-left: 0; + padding-right: 1.5rem; + padding-left: 0; } #site-navigation .search-form{ - float: left; + float: left; } #mobile-navigation{ - right: -100%; - left: auto; + right: -100%; + left: auto; } #mobile-navigation-height-col{ - right: -100%; - left: auto; + right: -100%; + left: auto; } #mobile-navigation ul.menu ul.sub-menu{ - margin-right: 0; + margin-right: 0; } #mobile-navigation ul.menu ul.sub-menu li a{ - padding-right: 1.5rem; - padding-left: 0; + padding-right: 1.5rem; + padding-left: 0; } .comment-navigation .nav-previous, .paging-navigation .nav-previous, .post-navigation .nav-previous, .page-navigation .nav-previous{ - float: right; - text-align: right; + float: right; + text-align: right; } .comment-navigation .nav-next, .paging-navigation .nav-next, .post-navigation .nav-next, .page-navigation .nav-next{ - float: left; - text-align: left; + float: left; + text-align: left; } .screen-reader-text:hover, .screen-reader-text:active, .screen-reader-text:focus{ - right: 5px; - left: auto; + right: 5px; + left: auto; } .alignleft{ - float: right; - margin-left: 1.5em; - margin-right: auto; + float: right; + margin-left: 1.5em; + margin-right: auto; } .alignright{ - float: left; - margin-right: 1.5em; - margin-left: auto; + float: left; + margin-right: 1.5em; + margin-left: auto; } .text-left{ - text-align: right; + text-align: right; } .text-right{ - text-align: left; + text-align: left; } .site-header .widget_search{ - border-right: 1px solid #CCC; - border-left: none; - margin: 0 1.45rem 0 0 ; - padding: 0 1.45rem 0 0 ; + border-right: 1px solid #CCC; + border-left: none; + margin: 0 1.45rem 0 0 ; + padding: 0 1.45rem 0 0 ; } #secondary .widget_calendar #wp-calendar tfoot td#next{ - text-align: left; + text-align: left; } .sidebar-content #primary, .sidebar-left #primary, .blog.sidebar-blog-left #primary, .archive.sidebar-blog-left #primary, .search.sidebar-blog-left #primary, .single.sidebar-blog-left #primary{ - float: left; + float: left; } .content-sidebar #primary, .blog.sidebar-blog-right #primary, .archive.sidebar-blog-right #primary, .search.sidebar-blog-right #primary, .single.sidebar-blog-right #primary{ - float: right; + float: right; } .site-branding { - float: right; + float: right; } .site-branding a.custom-logo-link{ - float: right; + float: right; } .header-right{ - text-align: left; + text-align: left; } #meta-member .meta-member-inner{ - border-bottom-left-radius: 3px; - border-bottom-right-radius: 3px; - margin: 0 0 1.45rem 0 ; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + margin: 0 0 1.45rem 0 ; } #meta-member .user{ - border-left: 1px solid #DDD; - border-right: none; + border-left: 1px solid #DDD; + border-right: none; } #meta-member .member-navigation, #meta-member .member-navigation ul { - float: left; + float: left; } #meta-member .member-navigation li{ - border-left: 1px solid #DDD; - border-right: none; + border-left: 1px solid #DDD; + border-right: none; } #meta-member .member-navigation .sub-menu{ - right: -9999em; - left: auto; - text-align: right; + right: -9999em; + left: auto; + text-align: right; } #meta-member .member-navigation ul li:hover > ul{ - right: auto; - left: auto; + right: auto; + left: auto; } .masthead{ - padding: 2.9rem 0 5.8rem 0 ; + padding: 2.9rem 0 5.8rem 0 ; } .masthead-post-byline{ - margin: 1.45rem 0 0 0 ; + margin: 1.45rem 0 0 0 ; } .masthead-banner .masthead-post-byline{ - margin: 16rem 0 0 0 ; + margin: 16rem 0 0 0 ; } .masthead h1{ - margin: 2.9rem 0 0 0 ; + margin: 2.9rem 0 0 0 ; } .masthead a.pmpro_btn{ - margin: 2rem 0 0 0 ; + margin: 2rem 0 0 0 ; } .home .home-content p.subtitle{ - margin: 0 0 3rem 0 ; + margin: 0 0 3rem 0 ; } .interstitial .masthead .btn{ - left: 0; - right: auto; + left: 0; + right: auto; } #primary .hentry .entry-header .entry-title{ - margin: 0 0 .7rem 0 ; + margin: 0 0 .7rem 0 ; } .hentry.format-audio h1.entry-title:before, .hentry.format-image h1.entry-title:before, .hentry.format-link h1.entry-title:before, .hentry.format-video h1.entry-title:before, .single-format-audio .masthead-post-byline h1.entry-title:before, .single-format-image .masthead-post-byline h1.entry-title:before, .single-format-link .masthead-post-byline h1.entry-title:before, .single-format-video .masthead-post-byline h1.entry-title:before{ - padding-left: 10px; - padding-right: 0; + padding-left: 10px; + padding-right: 0; } .hentry.pmpro-level-required h1.entry-title:before, .pmpro-body-level-required .masthead-post-byline h1.entry-title:before{ - padding-left: 10px; - padding-right: 0; + padding-left: 10px; + padding-right: 0; } .pmpro-level-required.pmpro-has-access h1.entry-title:before, .pmpro-body-level-required.pmpro-body-has-access h1.entry-title:before{ - padding-left: 0; + padding-left: 0; } .format-status .entry-content .post_author_avatar{ - float: right; - margin: 0 0 2.9rem 2.9rem ; + float: right; + margin: 0 0 2.9rem 2.9rem ; } .format-image .wp-post-image{ - padding-left: 0; - padding-right: 0; + padding-left: 0; + padding-right: 0; } .error-404 .entry-content{ - padding: 0 0 5.8rem 0 ; + padding: 0 0 5.8rem 0 ; } .comment{ - margin: 0 2.9rem 2.9rem 2.9rem ; + margin: 0 2.9rem 2.9rem 2.9rem ; } .bypostauthor{ - border-right-width: 10px; - border-left-width: unset; + border-right-width: 10px; + border-left-width: unset; } .bypostauthor .comment-meta .comment-author.vcard .fn:after{ - margin-right: 5px; - margin-left: auto; + margin-right: 5px; + margin-left: auto; } .comment-meta .comment-metadata, .comment-awaiting-moderation{ - margin: 0 0 1.45rem 0 ; + margin: 0 0 1.45rem 0 ; } .comment .comment-meta .comment-metadata{ - margin-right: 50px; - margin-left: auto; + margin-right: 50px; + margin-left: auto; } .comment-meta .comment-metadata .edit-link{ - border-right: 1px solid #CCC; - border-left: none; - margin: 0 .7rem 0 0 ; - padding: 0 .7rem 0 0 ; + border-right: 1px solid #CCC; + border-left: none; + margin: 0 .7rem 0 0 ; + padding: 0 .7rem 0 0 ; } .comment-respond label{ - text-align: left; - margin: 0 0 0 .7rem ; + text-align: left; + margin: 0 0 0 .7rem ; } .comment-respond p.comment-form-cookies-consent label{ - text-align: right; - margin: 0 .7rem 0 0 ; + text-align: right; + margin: 0 .7rem 0 0 ; } .comment-repond input[type="checkbox"], .comment-repond input[type="radio"]{ - margin-left: .5em; - margin-right: auto; + margin-left: .5em; + margin-right: auto; } .comment-respond .comment-form-author span.required, .comment-respond .comment-form-email span.required{ - left: 0; - right: auto; + left: 0; + right: auto; } .comment-respond .form-allowed-tags, .comment-respond .form-submit, .comment-respond .comment-subscription-form{ - margin-right: 13%; - margin-left: auto; + margin-right: 13%; + margin-left: auto; } .footer-widgets h3{ - margin: 0 0 1.45rem 0 ; + margin: 0 0 1.45rem 0 ; } .footer-widgets p{ - margin: .7rem 0 0 0 ; + margin: .7rem 0 0 0 ; } .footer-widgets .post_author_avatar{ - float: right; - margin: 0 0 0 20px ; + float: right; + margin: 0 0 0 20px ; } .footer-widgets ul{ - margin: .7rem 0 0 0 ; + margin: .7rem 0 0 0 ; } #banner_bottom h1, #banner_bottom h2, #banner_bottom h3, #banner_bottom h4, #banner_bottom h5{ - margin: 0 0 1.6rem 0 ; + margin: 0 0 1.6rem 0 ; } .memberlite_tabbable ul.memberlite_tabs li{ - float: right; - margin: 0 0 0 .5rem ; + float: right; + margin: 0 0 0 .5rem ; } .memberlite_tabbable ul.memberlite_tabs li > a{ - border-top-right-radius: 3px; - border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; } #pmpro_levels .post h2, .pmpro_signup_form h2{ - margin: 0 0 1rem 0 ; + margin: 0 0 1rem 0 ; } #pmpro_levels.pmpro_levels-table.pmpro_level-highlight, #pmpro_levels.pmpro_levels-div .pmpro_level-highlight, #pmpro_levels.pmpro_levels-2col .pmpro_level-highlight, #pmpro_levels.pmpro_levels-3col .pmpro_level-highlight, #pmpro_levels.pmpro_levels-4col .pmpro_level-highlight { - border-right: 1px solid #CCC; - border-left: 1px solid #CCC; + border-right: 1px solid #CCC; + border-left: 1px solid #CCC; } #pmpro_levels.pmpro_levels-table .pmpro_level-highlight td:first-child{ - border-right: 15px solid var(--memberlite-color-secondary); - border-left: none; + border-right: 15px solid var(--memberlite-color-secondary); + border-left: none; } #pmpro_levels.pmpro_levels-table .pmpro_level-highlight td:last-child{ - border-left: 15px solid var(--memberlite-color-secondary); - border-right: none; + border-left: 15px solid var(--memberlite-color-secondary); + border-right: none; } #pmpro_levels.pmpro_advanced_levels-compare_table tbody td:first-child{ - text-align: left; + text-align: left; } #pmpro_levels.pmpro_advanced_levels-compare_table thead th.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tbody td.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tfoot td.pmpro_level-highlight{ - border-right: 1rem solid var(--memberlite-color-secondary); - border-left: 1rem solid var(--memberlite-color-secondary); + border-right: 1rem solid var(--memberlite-color-secondary); + border-left: 1rem solid var(--memberlite-color-secondary); } #pmpro_levels.pmpro_advanced_levels-compare_table_responsive .pmpro_level-highlight{ - border-right: 1px solid #CCC; - border-left: 1px solid #CCC; + border-right: 1px solid #CCC; + border-left: 1px solid #CCC; } #pmpro_levels.pmpro_advanced_levels-compare_table tbody td:hover::after, #pmpro_levels.pmpro_advanced_levels-compare_table tbody tr:nth-child(even) td:hover::after{ - right: 0; - left: auto; + right: 0; + left: auto; } .pmpro_levels-div .pmpro_btn-select, .pmpro_levels-2col .pmpro_btn-select{ - margin-right: 3rem; - margin-left: auto; + margin-right: 3rem; + margin-left: auto; } form.pmpro_form hr{ - margin: 0 0 2.9rem 0 ; + margin: 0 0 2.9rem 0 ; } form#pmpro_form .pmpro_checkout h3 span.pmpro_checkout-h3-msg{ - float: left; + float: left; } form#pmpro_form .pmpro_sslseal{ - padding: 1.45rem 0 1.45rem 1.45rem ; + padding: 1.45rem 0 1.45rem 1.45rem ; } form.pmpro_form .pmpro_checkout #other_discount_code_p, form.pmpro_form .pmpro_checkout #other_discount_code_div{ - margin: 1.45rem 0 0 0 ; - padding: 1.45rem 0 0 0 ; + margin: 1.45rem 0 0 0 ; + padding: 1.45rem 0 0 0 ; } #pmpro_account #pmpro_account-membership table .pmpro_actionlinks{ - text-align: right; + text-align: right; } .testimonials-widget-testimonial span.image{ - margin: 0 1rem 0 2rem ; + margin: 0 1rem 0 2rem ; } @media only screen and (max-width: 767px){ - .menu-toggle{ - left: .5rem; - right: auto; - } - .comment-respond label{ - text-align: right; - } - .comment-respond .form-allowed-tags, .comment-respond .form-submit, .comment-respond .comment-subscription-form{ - margin-right: 0; - } - form#pmpro_form .pmpro_checkout-fields{ - padding: 1rem 0 0 0 ; - } - .pmpro_levels-div .entry-footer .alignright, .pmpro_levels-2col .entry-footer .alignright{ - margin: 0 0 1.5rem 0 ; - } + .menu-toggle{ + left: .5rem; + right: auto; + } + .comment-respond label{ + text-align: right; + } + .comment-respond .form-allowed-tags, .comment-respond .form-submit, .comment-respond .comment-subscription-form{ + margin-right: 0; + } + form#pmpro_form .pmpro_checkout-fields{ + padding: 1rem 0 0 0 ; + } + .pmpro_levels-div .entry-footer .alignright, .pmpro_levels-2col .entry-footer .alignright{ + margin: 0 0 1.5rem 0 ; + } } diff --git a/css/theme-my-login.css b/css/theme-my-login.css index cb89fe91..19b763fd 100644 --- a/css/theme-my-login.css +++ b/css/theme-my-login.css @@ -120,8 +120,8 @@ display: grid; grid-template-columns: 80px auto; grid-template-areas: - "avatar user-links" - "avatar nav"; + "avatar user-links" + "avatar nav"; } .tml.tml-user-panel .tml-user-avatar { grid-area: avatar; diff --git a/docs/CUSTOMIZER.md b/docs/CUSTOMIZER.md new file mode 100644 index 00000000..f248786f --- /dev/null +++ b/docs/CUSTOMIZER.md @@ -0,0 +1,94 @@ +# Customizer Documentation + +## Overview + +Memberlite is a hybrid theme that supports both the classic WordPress customizer and block-editing (Gutenberg). +In version 6.6.2, we have implemented a system to manage color schemes and variations that work seamlessly across both systems. Customizer +serves as the "source of truth" for colors and fonts that are then converted to CSS variables in the `:root` of the +site in `inc/customizer.php` in the `header_output()` function. The color scheme with 7 colors also match what's defined +in the `theme.json` file. In the `header_output()` function, we use Memberlite CSS variables as aliases to the variables that WordPress +creates by default from the theme.json. + +Within stylesheets, either CSS variable type can be referenced, but for consistency's sake, we recommend using the CSS variables prefixed +with `--memberlite-`. + +You can adjust editor styles in the `css/editor.css` file. + +## Customizer Presets (defaults) + +You can find most of the magic in `inc/customizer.php`, in the `register()` function. + +### What's the difference between a color scheme and a variation? + +Both are presets meant for customizer settings but a color scheme exists within the variation as a whole. +Variations include other settings outside of colors such as typography, layout, and more. + +### Color Scheme History + +Memberlite version 6.6.1 and earlier included a color scheme of 16 colors including two "defaults" where one was legacy, and another for version 4.6. +In version 6.6.2, we decided to refactor to make color schemes more manageable and introduce one source of truth in the theme +for default colors. This was also a necessary step to prepare for full site editing compatibility in future versions. As a result, +to support backwards compatibility, we kept the existing `memberlite_color_schemes` filter hook and presets as "legacy". +We then introduced a new color scheme setting that would pull the smaller color scheme with new keys for Memberlite versions 6.6.2 and onward. +The new color scheme would also sync with the theme.json file to ensure consistency across the board. + +In `functions.php`: + +- `memberlite_sync_legacy_to_variation_scheme()` - Syncs legacy color scheme selection to the new variation scheme setting on theme update. This is so users don't lose their legacy color scheme when updating to Memberlite 6.6.2+. +- `memberlite_filter_theme_json()` - Filters theme.json to set the color palette based on customizer selection. + +In `inc/defaults.php`: + +- `memberlite_get_colors()` - Returns 7 color values for default scheme. There are other functions for other color schemes named similarly. +- `memberlite_map_colors_to_settings()` - Maps color values to customizer settings +- `memberlite_map_legacy_colors_to_settings()` - Maps legacy color values to customizer settings (pre V6.6.2) +- `memberlite_get_defaults()` - Returns default customizer settings for default scheme. +- `memberlite_get_defaults_legacy()` - Returns default customizer settings for legacy scheme +- `memberlite_get_color_schemes()` - Returns new color scheme presets +- `memberlite_format_scheme_colors()` - Helper to format color scheme data for theme.json +- `memberlite_get_legacy_color_schemes()` - Returns legacy color scheme presets (Pre V6.6.2) +- `memberlite_get_active_colors()` - Returns active color values based on current scheme selection. This is where the `theme.json` pulls colors from. + +In `inc/customizer.php`: + +- `get_color_schemes()` - Returns full scheme data from globals (for JS) +- `get_legacy_color_schemes()` - Returns full scheme data from globals (for JS) +- `get_color_scheme_choices()` - Extracts just the labels for dropdown (new schemes) + +In `js/customizer.js`: + +This is where we handle the live preview in customizer. + +In `js/customizer-controls.js`: + +This is where we handle loading color schemes into their respective customizer settings. + +### How to add a new color scheme preset (And variation) + +You can add a new color scheme and a new variation presets with in `inc/defaults.php`. For the sake +of example, let's pretend we're calling our new color scheme/variation "hamburger". + +Here are the steps to add your new presets for "hamburger": + +- Add a new `memberlite_get_colors()` function for the new variation. The function name should keep the `memberlite_get_` prefix and end with `_colors()` due to the `memberlite_get_active_colors` relying on that naming convention. +- If you're presetting customizer settings other than colors, add a new `memberlite_get_defaults_hamburger()` function. This function is responsible for setting the default values for several customizer settings, even the non-color related ones. + - Make sure the `apply_filters( 'memberlite_defaults_hamburger', $defaults )` is unique so others can customize the defaults with this hook if they want. + +### Known Issues + +Each color picker setting comes with a "default" button that resets the color to the default value. However, due to the way the customizer works, +if you switch between color schemes and then hit the default button, it may not reset to the expected color for that scheme. +This is a known issue with the WordPress customizer and not specific to Memberlite. + +As a workaround, users can manually reselect the desired color scheme after hitting the default button to ensure the correct colors are applied. + +## How to add a new customizer setting + +In `inc/customizer.php`, we have two helper functions. Each with their own sanitize functions. + +- `add_memberlite_setting_control()` - For standard settings +- `add_memberlite_color_setting_control()` - For color picker settings + +You do not need to include the translate functions in the label or description as they are handled within the helper functions. + + diff --git a/docs/PROJECT_STRUCTURE.md b/docs/PROJECT_STRUCTURE.md new file mode 100644 index 00000000..80ffc1af --- /dev/null +++ b/docs/PROJECT_STRUCTURE.md @@ -0,0 +1,115 @@ +# Project Structure + +This document describes the **top-level structure** of the Memberlite theme repository and explains the responsibility of each directory. It is intended to help developers quickly understand where code lives and where changes should be made. + +## General Guidelines + +* **Business back-end logic → `/inc`** +* **Reusable markup → `/components`** +* **Static assets → `/assets`** +* **Front-end CSS → `stylesheet.css` in root** +* **CSS for the editor, admin, print, utilities, etc. → `/css`** +* **JS for the front or back-end (including customizer) → `/js`** + +When adding new functionality, prefer extending existing directories rather than creating new top-level folders unless there is a clear architectural need. + +--- + +## Top-Level Directories + +### `/assets` + +Front-end assets for the theme. + +Typically contains: + +* CSS (Not compiled, we do not have a build process.) +* JavaScript used on the front end +* Images (mostly icons atm) +* Fonts that are used to customize Memberlite via the customizer settings or the block editor options + +--- + +### `/bbpress` + +bbPress specific template override for single user content. + +--- + +### `/components` + +Reusable theme components and partials for the header, footer, page and post templates. + +--- + +### `/docs` + +Where Memberlite's documentation files live. Ideally they are written and pushed with related code in PRs to ensure the docs are always up to date. + +--- + +### `/font-awesome` + +Icon fonts for the Memberlite theme. + +--- + +### `/inc` + +Theme PHP logic and internal APIs. + +Typically contains: + +* Theme setup and configuration +* Customizer logic +* Hooks, filters, and helper functions +* Integration logic with WordPress core and plugins + +**Notes:** + +* This is the primary “back-end” directory for the theme. +* Most extension points (filters/actions) live here. + +--- + +### `/languages` + +Translation files for internationalization. + +Typically contains: + +* `.pot`, `.po`, and `.mo` files + +**Notes:** + +* Used for theme localization. +* Strings throughout the theme should be wrapped in translation functions. + +--- + +### `/shortodes` + +Where the theme's custom shortcodes are defined. This was previously part of Memberlite's Shortcode/Elements Add Ons. + +--- + +### `/templates` + +Top-level page templates. + +Typically contains: + +* Custom page templates registered with WordPress +* Specialized templates that don’t fit cleanly into the default hierarchy + +--- + +## Root-Level PHP Files + +In addition to the folders above, the theme root contains key PHP files such as: + +* `functions.php` – Bootstraps the theme and loads files from `/inc` +* Template hierarchy files (`index.php`, `single.php`, `page.php`, etc.) +* `style.css` – Theme metadata and base styles +* `theme.json` – Block editor configuration. Memberlite is a hybrid WordPress theme, so the theme.json is minimal and syncs colors and fonts with the customizer settings. + diff --git a/functions.php b/functions.php index af003118..34feca6e 100644 --- a/functions.php +++ b/functions.php @@ -140,7 +140,7 @@ function memberlite_load_local_webfonts() { }@font-face { font-family: ; @@ -249,7 +249,7 @@ function memberlite_setup() { 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), - 'unlink-homepage-logo' => false, + 'unlink-homepage-logo' => false, ); add_theme_support( 'custom-logo', $logo_defaults ); @@ -326,155 +326,6 @@ function memberlite_setup() { ) ); add_theme_support( 'custom-background', $custom_background ); - - // Build unique array of Color Scheme values to include in Block Editor - $color_scheme = array(); - - // Primary Color - $color_scheme[] = array( - 'name' => __( 'Primary', 'memberlite' ), - 'slug' => 'color-primary', - 'color' => get_theme_mod( 'color_primary', $memberlite_defaults['color_primary'] ) - ); - - // Secondary Color - $color_scheme[] = array( - 'name' => __( 'Secondary', 'memberlite' ), - 'slug' => 'color-secondary', - 'color' => get_theme_mod( 'color_secondary', $memberlite_defaults['color_secondary'] ) - ); - - // Action Color - $color_scheme[] = array( - 'name' => __( 'Action', 'memberlite' ), - 'slug' => 'color-action', - 'color' => get_theme_mod( 'color_action', $memberlite_defaults['color_action'] ) - ); - - // Primary Navigation Background Color - $color_scheme[] = array( - 'name' => __( 'Navigation Background', 'memberlite' ), - 'slug' => 'site-navigation-background', - 'color' => get_theme_mod( 'bgcolor_site_navigation', $memberlite_defaults['bgcolor_site_navigation'] ) - ); - - // Link Color - $color_scheme[] = array( - 'name' => __( 'Links', 'memberlite' ), - 'slug' => 'memberlite-links', - 'color' => get_theme_mod( 'color_link', $memberlite_defaults['color_link'] ) - ); - - // Primary Navigation Color - $color_scheme[] = array( - 'name' => __( 'Navigation Links', 'memberlite' ), - 'slug' => 'site-navigation-link', - 'color' => get_theme_mod( 'color_site_navigation', $memberlite_defaults['color_site_navigation'] ) - ); - - // Meta Link Color - $color_scheme[] = array( - 'name' => __( 'Meta Links ', 'memberlite' ), - 'slug' => 'meta-link', - 'color' => get_theme_mod( 'color_meta_link', $memberlite_defaults['color_meta_link'] ) - ); - - // Button Color - $color_scheme[] = array( - 'name' => __( 'Buttons', 'memberlite' ), - 'slug' => 'buttons', - 'color' => get_theme_mod( 'color_button', $memberlite_defaults['color_button'] ) - ); - - // White Color - $color_scheme[] = array( - 'name' => __( 'White', 'memberlite' ), - 'slug' => 'white', - 'color' => get_theme_mod( 'color_white', $memberlite_defaults['color_white'] ) - ); - - // Borders Color - $color_scheme[] = array( - 'name' => __( 'Borders', 'memberlite' ), - 'slug' => 'borders', - 'color' => get_theme_mod( 'color_borders', $memberlite_defaults['color_borders'] ) - ); - - // v4.6 added four new colors. For this reason, we need to set the fallback colors if they are using a built in scheme. - // Get the current color scheme - $this_color_scheme = get_theme_mod( 'memberlite_color_scheme' ); - - // Set the defaults to the primary color from the current scheme if it isn't the new default. - if ( $this_color_scheme != 'default_v4.6' ) { - $memberlite_defaults['bgcolor_page_masthead'] = $color_scheme[0]['color']; - $memberlite_defaults['color_page_masthead'] = $memberlite_defaults['color_white']; - $memberlite_defaults['bgcolor_footer_widgets'] = $color_scheme[0]['color']; - $memberlite_defaults['color_footer_widgets'] = $memberlite_defaults['color_white']; - } - - // Page Masthead Background Color - $color_scheme[] = array( - 'name' => __( 'Page Masthead Background Color', 'memberlite' ), - 'slug' => 'page-masthead-background', - 'color' => get_theme_mod( 'bgcolor_page_masthead', $memberlite_defaults['bgcolor_page_masthead'] ) - ); - - // Page Masthead Color - $color_scheme[] = array( - 'name' => __( 'Page Masthead Color', 'memberlite' ), - 'slug' => 'page-masthead', - 'color' => get_theme_mod( 'color_page_masthead', $memberlite_defaults['color_page_masthead'] ) - ); - - // Footer Widgets Background Color - $color_scheme[] = array( - 'name' => __( 'Footer Widgets Background Color', 'memberlite' ), - 'slug' => 'footer-widgets-background', - 'color' => get_theme_mod( 'bgcolor_footer_widgets', $memberlite_defaults['bgcolor_footer_widgets'] ) - ); - - // Footer Widgets Color - $color_scheme[] = array( - 'name' => __( 'Footer Widgets Color', 'memberlite' ), - 'slug' => 'footer-widgets', - 'color' => get_theme_mod( 'color_footer_widgets', $memberlite_defaults['color_footer_widgets'] ) - ); - - // Get all unique color values. - $color_scheme_temp = array_unique( array_column( $color_scheme, 'color' ) ); - $color_scheme = array_intersect_key( $color_scheme, $color_scheme_temp ); - - // Always ensure the body text color is set. - $color_scheme[] = array( - 'name' => __( 'Text', 'memberlite' ), - 'slug' => 'body-text', - 'color' => get_theme_mod( 'color_text', $memberlite_defaults['color_text'] ) - ); - - // Always ensure the base color is set. - $base_color = get_theme_mod( 'background_color', $memberlite_defaults['background_color'] ); - // Add a # if it's missing. - if ( strpos( $base_color, '#' ) === false ) { - $base_color = '#' . $base_color; - } - $color_scheme[] = array( - 'name' => __( 'Base', 'memberlite' ), - 'slug' => 'base', - 'color' => esc_attr( $base_color ) - ); - - // Build colors array for palette. - $colors = array(); - foreach( $color_scheme as $color ) { - $colors[] = array( - 'name' => $color['name'], - 'slug' => $color['slug'], - 'color' => $color['color'], - ); - } - - // Add color values to Block Editor - add_theme_support( 'editor-color-palette', apply_filters( 'memberlite_editor_color_palette', $colors ) ); // Indicate widget sidebars can use selective refresh in the Customizer. add_theme_support( 'customize-selective-refresh-widgets' ); @@ -484,12 +335,12 @@ function memberlite_setup() { /** * Load the Memberlite theme textdomain on init (WP 6.7+ requirement). - * + * * If you're building a theme based on Memberlite, use a find and replace * to change 'memberlite' to the name of your theme in all the template files. */ function memberlite_load_textdomain() { - load_theme_textdomain( 'memberlite', get_template_directory() . '/languages' ); + load_theme_textdomain( 'memberlite', get_template_directory() . '/languages' ); } add_action( 'init', 'memberlite_load_textdomain' ); @@ -504,12 +355,12 @@ function memberlite_check_for_translations() { if ( function_exists( 'pmproum_check_for_translations' ) ) { return; } - + // If the library isn't loaded, bail. if ( ! function_exists( 'Memberlite\Required\Traduttore_Registry\add_project' ) ) { return; } - + // Only check for updates when on the update page, plugins, themes page, or the Memberlite support page $is_update_or_plugins_page = strpos( $_SERVER['REQUEST_URI'], 'update-core.php' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'plugins.php' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'themes.php' ) !== false; $is_memberlite_admin_page = isset( $_REQUEST['page'] ) && $_REQUEST['page'] === 'memberlite-support'; @@ -936,47 +787,6 @@ function memberlite_frontpage_template_hierarchy( $templates ) { } add_filter( 'frontpage_template_hierarchy', 'memberlite_frontpage_template_hierarchy', 5 ); -/** - * Formats custom property to be used in CSS. - * - * @param string $property The property name. - * @return string - */ -function memberlite_format_custom_property( string $property ): string { - if ( ! str_contains( $property, 'var:' ) ) { - return $property; - } - - return str_replace( - [ 'var:', '|' ], - [ 'var(--wp--', '--' ], - $property - ) . ')'; -} - -/** - * Generate custom properties from global styles. - * - * @return string - */ -function memberlite_get_custom_properties(): string { - $custom_properties = []; - $custom_properties[ "--memberlite-header-font" ] = memberlite_get_font( 'header_font', true ); - $custom_properties[ "--memberlite-body-font" ] = memberlite_get_font( 'body_font', true ); - - if ( is_array( $custom_properties ) ) { - $css = []; - - foreach ( $custom_properties as $key => $value ) { - $css[] = $key . ':' . memberlite_format_custom_property( $value ) . ';'; - } - - return 'body{' . implode( '', $css ) . '}'; - } - - return ''; -} - /** * Enqueue block editor styles. * @@ -985,19 +795,12 @@ function memberlite_get_custom_properties(): string { * @return void */ function memberlite_enqueue_block_assets() { - // Enqueue the editor stylesheet to attach the inline styles to. wp_enqueue_style( 'memberlite-block-editor-style', MEMBERLITE_URL . '/css/editor.css', [], MEMBERLITE_VERSION ); - - // Add custom inline styles to the block editor. - wp_add_inline_style( - 'memberlite-block-editor-style', - memberlite_get_custom_properties() - ); } add_action( 'enqueue_block_assets', 'memberlite_enqueue_block_assets' ); @@ -1007,8 +810,8 @@ function memberlite_enqueue_block_assets() { function memberlite_theme_mod_copyright_textbox( $copyright_text ) { // Don't filter the text in the admin. if ( is_admin() ) { - return $copyright_text; - } + return $copyright_text; + } // Return if the text is not a string. if ( ! is_string( $copyright_text ) ) { @@ -1016,16 +819,152 @@ function memberlite_theme_mod_copyright_textbox( $copyright_text ) { } $data = array( - 'current_year' => date( 'Y' ), - 'site_title' => (string) get_option( 'blogname' ), - 'site_url' => (string) get_option( 'siteurl' ), - 'tagline' => (string) get_option( 'blogdescription' ), - ); + 'current_year' => date( 'Y' ), + 'site_title' => (string) get_option( 'blogname' ), + 'site_url' => (string) get_option( 'siteurl' ), + 'tagline' => (string) get_option( 'blogdescription' ), + ); - foreach ( $data as $key => $value ) { - $copyright_text = str_replace( "!!" . $key . "!!", $value, $copyright_text ); - } + foreach ( $data as $key => $value ) { + $copyright_text = str_replace( "!!" . $key . "!!", $value, $copyright_text ); + } - return $copyright_text; + return $copyright_text; } add_filter( 'theme_mod_copyright_textbox', 'memberlite_theme_mod_copyright_textbox' ); + +/** + * Filter theme.json data to inject Customizer colors + * This makes Customizer colors available in the block editor + * + * @since TBD + * + * @param $theme_json + * + * @return mixed + */ +function memberlite_filter_theme_json( $theme_json ) { + $active_colors = memberlite_get_active_colors(); + + // Build the color palette. + // These colors will be deduplicated (first occurrence wins). + $color_scheme = array( + array( + 'slug' => 'color-primary', + 'color' => $active_colors['color_primary'], + 'name' => __( 'Primary', 'memberlite' ), + ), + array( + 'slug' => 'color-secondary', + 'color' => $active_colors['color_secondary'], + 'name' => __( 'Secondary', 'memberlite' ), + ), + array( + 'slug' => 'action', + 'color' => $active_colors['color_action'], + 'name' => __( 'Action', 'memberlite' ), + ), + array( + 'slug' => 'memberlite-links', + 'color' => $active_colors['color_link'], + 'name' => __( 'Links', 'memberlite' ), + ), + array( + 'slug' => 'meta-link', + 'color' => $active_colors['color_meta_link'], + 'name' => __( 'Meta Links', 'memberlite' ), + ), + array( + 'slug' => 'buttons', + 'color' => $active_colors['color_button'], + 'name' => __( 'Buttons', 'memberlite' ), + ), + array( + 'slug' => 'white', + 'color' => '#FFFFFF', + 'name' => __( 'White', 'memberlite' ), + ), + array( + 'slug' => 'borders', + 'color' => $active_colors['color_borders'], + 'name' => __( 'Borders', 'memberlite' ), + ), + array( + 'slug' => 'page-masthead-background', + 'color' => $active_colors['bgcolor_page_masthead'], + 'name' => __( 'Page Masthead Background', 'memberlite' ), + ), + array( + 'slug' => 'page-masthead', + 'color' => $active_colors['color_page_masthead'], + 'name' => __( 'Page Masthead', 'memberlite' ), + ), + array( + 'slug' => 'footer-widgets-background', + 'color' => $active_colors['bgcolor_footer_widgets'], + 'name' => __( 'Footer Widgets Background', 'memberlite' ), + ), + array( + 'slug' => 'footer-widgets', + 'color' => $active_colors['color_footer_widgets'], + 'name' => __( 'Footer Widgets', 'memberlite' ), + ), + ); + + // Deduplicate: keep first occurrence of each unique color value. + $color_scheme_temp = array_unique( array_column( $color_scheme, 'color' ) ); + $color_scheme = array_intersect_key( $color_scheme, $color_scheme_temp ); + + // Always ensure the body text color is included (added after deduplication). + $color_scheme[] = array( + 'slug' => 'body-text', + 'color' => $active_colors['color_text'], + 'name' => __( 'Text', 'memberlite' ), + ); + + // Always ensure the base/background color is included (added after deduplication). + $base_color = $active_colors['background_color']; + // Add a # if it's missing. + if ( strpos( $base_color, '#' ) === false ) { + $base_color = '#' . $base_color; + } + $color_scheme[] = array( + 'slug' => 'base', + 'color' => esc_attr( $base_color ), + 'name' => __( 'Base', 'memberlite' ), + ); + + // Reindex the array to ensure sequential keys. + $color_palette = array_values( $color_scheme ); + + // Merge with existing theme.json data. + $theme_json_data = $theme_json->get_data(); + + // Update the color palette. + if ( ! isset( $theme_json_data['settings'] ) ) { + $theme_json_data['settings'] = array(); + } + if ( ! isset( $theme_json_data['settings']['color'] ) ) { + $theme_json_data['settings']['color'] = array(); + } + + $theme_json_data['settings']['color']['palette'] = $color_palette; + + // Add font family custom properties. + if ( ! isset( $theme_json_data['settings']['custom'] ) ) { + $theme_json_data['settings']['custom'] = array(); + } + if ( ! isset( $theme_json_data['settings']['custom']['heading'] ) ) { + $theme_json_data['settings']['custom']['heading'] = array(); + } + if ( ! isset( $theme_json_data['settings']['custom']['body'] ) ) { + $theme_json_data['settings']['custom']['body'] = array(); + } + + $theme_json_data['settings']['custom']['heading']['fontFamily'] = memberlite_get_font( 'header_font', true ); + $theme_json_data['settings']['custom']['body']['fontFamily'] = memberlite_get_font( 'body_font', true ); + + // Update the theme.json object. + return $theme_json->update_with( $theme_json_data ); +} +add_filter( 'wp_theme_json_data_theme', 'memberlite_filter_theme_json' ); diff --git a/inc/custom-header.php b/inc/custom-header.php index de92180b..f2572e64 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -13,7 +13,7 @@ * @uses memberlite_admin_header_image() */ function memberlite_custom_header_setup() { - $custom_header = apply_filters( + $custom_header = apply_filters( 'memberlite_custom_header_args', array( 'default-text-color' => '2c3e50', @@ -23,18 +23,18 @@ function memberlite_custom_header_setup() { 'flex-height' => true, 'wp-head-callback' => 'memberlite_header_style', ) - ); - add_theme_support( 'custom-header', $custom_header ); + ); + add_theme_support( 'custom-header', $custom_header ); } add_action('after_setup_theme', 'memberlite_custom_header_setup'); if ( ! function_exists( 'memberlite_header_style' ) ) : - /** - * Styles the header image and text displayed on the blog - * - * @see memberlite_custom_header_setup(). - */ - function memberlite_header_style() { + /** + * Styles the header image and text displayed on the blog + * + * @see memberlite_custom_header_setup(). + */ + function memberlite_header_style() { $header_image = get_header_image(); // If no custom options for text are set, let's bail. diff --git a/inc/customizer.php b/inc/customizer.php index 6e57984e..523a5b59 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -81,7 +81,7 @@ public static function register( WP_Customize_Manager $wp_customize ) { */ public static function set_customizer_panels_sections( WP_Customize_Manager $wp_customize ) { /* Site Identity --------------------------------- */ - $wp_customize->get_section('title_tagline')->priority = 0; + $wp_customize->get_section('title_tagline')->priority = 0; /* Typography ------------------------------------ */ $wp_customize->add_section( @@ -169,35 +169,45 @@ public static function set_typography_settings( WP_Customize_Manager $wp_customi /** * Sets color-related customizer settings * - * @since 6.1.1 - * * @param WP_Customize_Manager $wp_customize + * * @return void */ public static function set_customizer_color_settings( WP_Customize_Manager $wp_customize ) { - // COLORS: Color Scheme ================= - self::add_memberlite_setting_control( $wp_customize, 'memberlite_color_scheme', 'Memberlite Color Scheme', 'colors', array( - 'type' => 'select', - 'sanitize_callback' => array( 'Memberlite_Customize', 'sanitize_color_scheme' ), - 'sanitize_js_callback' => array( 'Memberlite_Customize', 'sanitize_js_color_scheme' ), - 'choices' => array_merge( - Memberlite_Customize::get_color_scheme_choices(), - array( - 'custom' => 'Custom', - ) - ), - 'priority' => 1, - ) ); + // COLORS: Color Scheme ================ + self::add_memberlite_setting_control( + $wp_customize, + 'memberlite_color_scheme', + 'Color Scheme', + 'colors', + array( + 'type' => 'select', + 'description' => 'Choose a color scheme preset. Individual colors below will update to match. Customize any color to switch to "Custom" mode.', + 'sanitize_callback' => array( 'Memberlite_Customize', 'sanitize_color_scheme' ), + 'choices' => memberlite_get_color_scheme_choices(), + 'priority' => 1, + ) + ); - // COLORS: Dark Mode ==================== + // COLORS: Dark Mode ================ self::add_memberlite_setting_control( $wp_customize, 'memberlite_darkcss', 'Use Dark Mode Colors', 'colors', array( 'type' => 'checkbox', 'sanitize_callback' => array( 'Memberlite_Customize', 'sanitize_checkbox' ), 'description' => 'Check this box if you have chosen a dark background color and light default text color for your site.', - 'priority' => 2, + 'priority' => 2, ) ); - // COLORS: Header Colors Heading ======== + // COLORS: PMPro Override ================ + if ( is_pmpro_active() ) { + self::add_memberlite_setting_control( $wp_customize, 'memberlite_pmpro_color_override', 'Override PMPro Colors', 'colors', array( + 'type' => 'checkbox', + 'sanitize_callback' => array( 'Memberlite_Customize', 'sanitize_checkbox' ), + 'description' => 'By default, PMPro will use colors from its own settings. Check this box to have PMPro use the colors you have chosen here instead.', + 'priority' => 2, + ) ); + } + + // COLORS: Header Colors ================ self::add_memberlite_heading( $wp_customize, 'memberlite_header_colors', 'Header Colors', 'colors' ); self::add_memberlite_color_control( $wp_customize, 'memberlite_bgcolor_header', 'Header Background Color', 'bgcolor_header' ); @@ -206,21 +216,21 @@ public static function set_customizer_color_settings( WP_Customize_Manager $wp_c self::add_memberlite_color_control( $wp_customize, 'memberlite_color_site_navigation', 'Primary Navigation Link Color', 'color_site_navigation' ); - // COLORS: Footer Colors Heading ======== + // COLORS: Footer Colors ================ self::add_memberlite_heading( $wp_customize, 'memberlite_footer_colors', 'Footer Colors', 'colors' ); self::add_memberlite_color_control( $wp_customize, 'memberlite_bgcolor_footer_widgets', 'Footer Widgets Background Color', 'bgcolor_footer_widgets' ); self::add_memberlite_color_control( $wp_customize, 'memberlite_color_footer_widgets', 'Footer Widgets Text Color', 'color_footer_widgets' ); - // COLORS: Masthead Colors Heading ====== + // COLORS: Masthead Colors ================ self::add_memberlite_heading( $wp_customize, 'memberlite_masthead_colors', 'Masthead Colors', 'colors' ); self::add_memberlite_color_control( $wp_customize, 'memberlite_bgcolor_page_masthead', 'Page Masthead Background Color', 'bgcolor_page_masthead' ); self::add_memberlite_color_control( $wp_customize, 'memberlite_color_page_masthead', 'Page Masthead Text Color', 'color_page_masthead' ); - // COLORS: Site Colors Heading ========== + // COLORS: Site Colors ================ self::add_memberlite_heading( $wp_customize, 'memberlite_body_colors', 'Site Colors', 'colors' ); // Move core controls down in the Colors section @@ -245,12 +255,15 @@ public static function set_customizer_color_settings( WP_Customize_Manager $wp_c self::add_memberlite_color_control( $wp_customize, 'memberlite_color_secondary', 'Secondary Color', 'color_secondary' ); self::add_memberlite_color_control( $wp_customize, 'memberlite_color_action', 'Action Color', 'color_action', array( - 'description' => 'Used for CTA buttons and links.' + 'description' => 'Used for CTA buttons and links.', ) ); self::add_memberlite_color_control( $wp_customize, 'memberlite_color_button', 'Default Button Color', 'color_button' ); + + self::add_memberlite_color_control( $wp_customize, 'memberlite_color_borders', 'Border Color', 'color_borders' ); } + /** * Sets breadcrumb-related customizer settings * @@ -782,18 +795,6 @@ public static function header_output() { $color_site_navigation = $memberlite_defaults['color_site_navigation']; } - // v4.6 added four new colors. For this reason, we need to set the fallback colors if they are using a built in scheme. - // Get the current color scheme - $this_color_scheme = get_theme_mod( 'memberlite_color_scheme' ); - - // Set the defaults to the primary color from the current scheme if it isn't the new default. - if ( $this_color_scheme != 'default_v4.6' ) { - $memberlite_defaults['bgcolor_page_masthead'] = $color_primary; - $memberlite_defaults['color_page_masthead'] = $memberlite_defaults['color_white']; - $memberlite_defaults['bgcolor_footer_widgets'] = $color_primary; - $memberlite_defaults['color_footer_widgets'] = $memberlite_defaults['color_white']; - } - $color_page_masthead_background = get_theme_mod( 'bgcolor_page_masthead' ); if ( empty( $color_page_masthead_background ) ) { $color_page_masthead_background = $memberlite_defaults['bgcolor_page_masthead']; @@ -814,10 +815,14 @@ public static function header_output() { $color_footer_widgets = $memberlite_defaults['color_footer_widgets']; } + $color_borders = get_theme_mod( 'color_borders' ); + if ( empty( $color_borders ) ) { + $color_borders = $memberlite_defaults['color_borders']; + } + // Get theme settings from defaults. $hover_brightness = $memberlite_defaults['hover_brightness']; $color_white = $memberlite_defaults['color_white']; - $color_borders = $memberlite_defaults['color_borders']; ?> @@ -928,330 +932,6 @@ public static function get_all_fonts() { return array_merge( Memberlite_Customize::get_google_fonts(), Memberlite_Customize::get_web_safe_fonts() ); } - /** - * Register color schemes for Memberlite. - * Based on code from the Twentyfifteen theme. (https://themes.svn.wordpress.org/twentyfifteen/1.2/inc/customizer.php) - * - * Can be filtered with {@see 'memberlite_color_schemes'}. - * - * The order of colors in a colors array: - * 1. Header Text Color - * 2. Background Color - * 3. Header Background Color - * 4. Primary Navigation Background Color - * 5. Primary Navigation Link Color - * 6. Text Color - * 7. Link Color - * 8. Meta Link Color - * 9. Primary Color - * 10. Secondary Color - * 11. Action Color - * 12. Default Button Color - * 13. Page Masthead Text Color - * 14. Page Masthead Background Color - * 15. Footer Widgets Text Color - * 16. Footer Widgets Background Color - * - * @return array An associative array of color scheme options. - * @since Memberlite 1.0 - * - */ - public static function get_color_schemes() { - return apply_filters( - 'memberlite_color_schemes', array( - 'default_v4.6' => array( - 'label' => __( 'Default', 'memberlite' ), - 'colors' => array( - '#011935', - '#FFFFFF', - '#FFFFFF', - '#F9FAFB', - '#444444', - '#222222', - '#011935', - '#011935', - '#011935', - '#00A59D', - '#E87102', - '#3C4B5A', - '#011935', - '#FFFFFF', - '#F9FAFB', - '#444444', - ), - ), - 'default' => array( - 'label' => __( 'Default (Legacy)', 'memberlite' ), - 'colors' => array( - '#2C3E50', - '#FFFFFF', - '#FFFFFF', - '#FAFAFA', - '#777777', - '#222222', - '#2C3E50', - '#2C3E50', - '#2C3E50', - '#18BC9C', - '#F39C12', - '#798D8F', - '#2C3E50', - '#FFFFFF', - '#2C3E50', - '#FFFFFF', - ), - ), - 'education' => array( - 'label' => __( 'Education', 'memberlite' ), - 'colors' => array( - '#3A9AD9', - '#F4EFEA', - '#F4EFEA', - '#E2DED9', - '#354458', - '#222222', - '#3A9AD9', - '#3A9AD9', - '#354458', - '#EB7260', - '#29ABA4', - '#798D8F', - '#354458', - '#FFFFFF', - '#354458', - '#FFFFFF', - ), - ), - 'modern_teal' => array( - 'label' => __( 'Modern Teal', 'memberlite' ), - 'colors' => array( - '#424242', - '#EFEFEF', - '#EFEFEF', - '#424242', - '#EFEFEF', - '#222222', - '#00CCD6', - '#00CCD6', - '#00CCD6', - '#424242', - '#FFD900', - '#798D8F', - '#00CCD6', - '#FFFFFF', - '#00CCD6', - '#FFFFFF', - ), - ), - 'mono_blue' => array( - 'label' => __( 'Mono Blue', 'memberlite' ), - 'colors' => array( - '#00AEEF', - '#FFFFFF', - '#FFFFFF', - '#00AEEF', - '#FFFFFF', - '#222222', - '#00AEEF', - '#00AEEF', - '#333333', - '#555555', - '#00AEEF', - '#798D8F', - '#333333', - '#FFFFFF', - '#333333', - '#FFFFFF', - ), - ), - 'mono_green' => array( - 'label' => __( 'Mono Green', 'memberlite' ), - 'colors' => array( - '#00A651', - '#FFFFFF', - '#FFFFFF', - '#00A651', - '#FFFFFF', - '#222222', - '#00A651', - '#00A651', - '#333333', - '#555555', - '#00A651', - '#798D8F', - '#333333', - '#FFFFFF', - '#333333', - '#FFFFFF', - ), - ), - 'mono_orange' => array( - 'label' => __( 'Mono Orange', 'memberlite' ), - 'colors' => array( - '#F39C12', - '#FFFFFF', - '#FFFFFF', - '#F39C12', - '#FFFFFF', - '#222222', - '#F39C12', - '#F39C12', - '#333333', - '#555555', - '#F39C12', - '#798D8F', - '#333333', - '#FFFFFF', - '#333333', - '#FFFFFF', - ), - ), - 'mono_pink' => array( - 'label' => __( 'Mono Pink', 'memberlite' ), - 'colors' => array( - '#ED0977', - '#FFFFFF', - '#FFFFFF', - '#ED0977', - '#FFFFFF', - '#222222', - '#ED0977', - '#ED0977', - '#333333', - '#555555', - '#ED0977', - '#798D8F', - '#333333', - '#FFFFFF', - '#333333', - '#FFFFFF', - ), - ), - 'pop' => array( - 'label' => __( 'Pop!', 'memberlite' ), - 'colors' => array( - '#53BBF4', - '#FFFFFF', - '#FFFFFF', - '#B1EB00', - '#666666', - '#222222', - '#B1EB00', - '#B1EB00', - '#53BBF4', - '#FFAC00', - '#FF85CB', - '#798D8F', - '#53BBF4', - '#FFFFFF', - '#53BBF4', - '#FFFFFF', - ), - ), - 'primary' => array( - 'label' => __( 'Not So Primary', 'memberlite' ), - 'colors' => array( - '#1352A2', - '#F0F1EE', - '#F0F1EE', - '#FFFFFF', - '#555555', - '#222222', - '#FB6964', - '#FB6964', - '#1352A2', - '#FB6964', - '#FFD464', - '#798D8F', - '#1352A2', - '#FFFFFF', - '#1352A2', - '#FFFFFF', - ), - ), - 'raspberry_lime' => array( - 'label' => __( 'Raspberry Lime', 'memberlite' ), - 'colors' => array( - '#AA2159', - '#FFFFFF', - '#FFFFFF', - '#700035', - '#EFEFEF', - '#222222', - '#009D97', - '#AA2159', - '#AA2159', - '#009D97', - '#BCC747', - '#798D8F', - '#AA2159', - '#FFFFFF', - '#AA2159', - '#FFFFFF', - ), - ), - 'slate_blue' => array( - 'label' => __( 'Slate Blue', 'memberlite' ), - 'colors' => array( - '#6991AC', - '#F5F5F5', - '#F5F5F5', - '#FFFFFF', - '#67727A', - '#222222', - '#6991AC', - '#6991AC', - '#67727A', - '#6991AC', - '#D75C37', - '#798D8F', - '#67727A', - '#FFFFFF', - '#67727A', - '#FFFFFF', - ), - ), - 'watermelon' => array( - 'label' => __( 'Watermelon Seed', 'memberlite' ), - 'colors' => array( - '#363635', - '#F9F9F7', - '#F9F9F7', - '#363635', - '#FFFFFF', - '#222222', - '#83BF17', - '#83BF17', - '#83BF17', - '#363635', - '#F15D58', - '#798D8F', - '#83BF17', - '#FFFFFF', - '#83BF17', - '#FFFFFF', - ), - ), - ) - ); - } - - /** - * Returns an array of color scheme choices registered for Memberlite. - * - * @return array Array of color schemes. - * @since Memberlite 2.0 - * - */ - public static function get_color_scheme_choices() { - $color_schemes = Memberlite_Customize::get_color_schemes(); - $color_scheme_control_options = array(); - foreach ( $color_schemes as $color_scheme => $value ) { - $color_scheme_control_options[ $color_scheme ] = $value['label']; - } - - return $color_scheme_control_options; - } /** * Sanitize Checkbox input values @@ -1311,38 +991,18 @@ public static function sanitize_select( $input, $setting ) { /** * Sanitization callback for color schemes. * + * @since 6.2 * @param string $value Color scheme name value. - * * @return string Color scheme name. - * @since Memberlite 2.0 - * */ public static function sanitize_color_scheme( $value ) { - $color_schemes = array_merge( - Memberlite_Customize::get_color_scheme_choices(), - array( - 'custom' => 'Custom', - ) - ); - if ( ! array_key_exists( $value, $color_schemes ) ) { - $value = 'default'; - } + $color_schemes = memberlite_get_color_scheme_choices(); - return $value; - } - - public static function sanitize_js_color_scheme( $value ) { - $color_schemes = array_merge( - Memberlite_Customize::get_color_scheme_choices(), - array( - 'custom' => 'Custom', - ) - ); if ( ! array_key_exists( $value, $color_schemes ) ) { $value = 'default'; } - return esc_js( $value ); + return $value; } /** @@ -1388,20 +1048,32 @@ public static function sanitize_js_text_with_links( $value ) { /** * Binds JS listener to make Customizer color_scheme control. * - * Passes color scheme data as colorScheme global. + * Passes color scheme data as colorSchemes global. * - * Also enqueue stylesheet for customizer setting controls. - * - * @since Twenty Fifteen 1.0 + * @since 6.2 */ public static function customizer_controls_js() { - wp_enqueue_script( 'Memberlite_Customizer-controls', MEMBERLITE_URL . '/js/customizer-controls.js', array( - 'customize-controls', - 'iris', - 'underscore', - 'wp-util' - ), MEMBERLITE_VERSION, true ); - wp_localize_script( 'Memberlite_Customizer-controls', 'colorSchemes', Memberlite_Customize::get_color_schemes() ); + wp_enqueue_script( + 'Memberlite_Customizer-controls', + MEMBERLITE_URL . '/js/customizer-controls.js', + array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), + MEMBERLITE_VERSION, + true + ); + + // Pass color schemes to JS - convert to format JS expects + $schemes = memberlite_get_color_schemes(); + $js_schemes = array(); + + foreach ( $schemes as $key => $scheme ) { + $js_schemes[ $key ] = array( + 'label' => $scheme['label'], + 'colors' => $scheme['colors'], + ); + } + + wp_localize_script( 'Memberlite_Customizer-controls', 'colorSchemes', $js_schemes ); + wp_localize_script( 'Memberlite_Customizer-controls', 'colorSettingKeys', memberlite_get_color_setting_keys() ); wp_enqueue_style( 'memberlite-customizer-css', @@ -1434,3 +1106,49 @@ public function render_content() { // Enqueue live preview javascript in Theme Customizer admin screen add_action( 'customize_preview_init', array( 'Memberlite_Customize', 'live_preview' ) ); + +/** + * When the color scheme changes, save all 18 colors to theme_mods. + * + * This ensures the individual color settings are always the source of truth. + * + * @since 6.2 + */ +add_action( 'customize_save_after', 'memberlite_save_scheme_colors' ); + +function memberlite_save_scheme_colors( WP_Customize_Manager $wp_customize ) { + $scheme_setting = $wp_customize->get_setting( 'memberlite_color_scheme' ); + + if ( ! $scheme_setting ) { + return; + } + + $scheme_key = $scheme_setting->value(); + + // Don't save colors if it's custom mode + if ( 'custom' === $scheme_key ) { + return; + } + + // Get the scheme colors + $scheme_colors = memberlite_get_scheme_colors( $scheme_key ); + + if ( ! $scheme_colors ) { + return; + } + + // Save all colors to theme_mods + foreach ( $scheme_colors as $key => $value ) { + // Skip header_textcolor if currently 'blank' (user chose to hide site title/tagline) + if ( 'header_textcolor' === $key && 'blank' === get_theme_mod( 'header_textcolor' ) ) { + continue; + } + + // WordPress core stores header_textcolor and background_color without the # prefix + if ( 'header_textcolor' === $key || 'background_color' === $key ) { + $value = ltrim( $value, '#' ); + } + + set_theme_mod( $key, $value ); + } +} diff --git a/inc/defaults.php b/inc/defaults.php index 27c2a4cd..e1e86f2c 100644 --- a/inc/defaults.php +++ b/inc/defaults.php @@ -1,67 +1,552 @@ '#011935', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#F9FAFB', + 'color_site_navigation' => '#222222', + 'color_text' => '#222222', + 'color_link' => '#011935', + 'color_meta_link' => '#011935', + 'color_primary' => '#011935', + 'color_secondary' => '#3C4B5A', + 'color_action' => '#00A59D', + 'color_button' => '#011935', + 'bgcolor_page_masthead' => '#011935', + 'color_page_masthead' => '#FFFFFF', + 'bgcolor_footer_widgets' => '#011935', + 'color_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ); +} + +/** + * Evergreen color scheme + * + * Rich forest greens with a vibrant pink accent. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_evergreen_colors(): array { + return array( + 'header_textcolor' => '#174B49', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#F9FAFB', + 'color_site_navigation' => '#0F0F0F', + 'color_text' => '#0F0F0F', + 'color_link' => '#174B49', + 'color_meta_link' => '#174B49', + 'color_primary' => '#174B49', + 'color_secondary' => '#2E7061', + 'color_action' => '#F83773', + 'color_button' => '#174B49', + 'bgcolor_page_masthead' => '#174B49', + 'color_page_masthead' => '#FFFFFF', + 'bgcolor_footer_widgets' => '#174B49', + 'color_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ); +} + +/** + * Seaside Linen color scheme + * + * Warm tan background with deep blue and chartreuse accent. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_seaside_linen_colors(): array { + return array( + 'header_textcolor' => '#1F3A4A', + 'background_color' => '#ECEBE3', + 'bgcolor_header' => '#ECEBE3', + 'bgcolor_site_navigation' => '#ECEBE3', + 'color_site_navigation' => '#25292B', + 'color_text' => '#25292B', + 'color_link' => '#1F3A4A', + 'color_meta_link' => '#1F3A4A', + 'color_primary' => '#1F3A4A', + 'color_secondary' => '#4E6A78', + 'color_action' => '#EBF9A8', + 'color_button' => '#1F3A4A', + 'bgcolor_page_masthead' => '#1F3A4A', + 'color_page_masthead' => '#FFFFFF', + 'bgcolor_footer_widgets' => '#ECEBE3', + 'color_footer_widgets' => '#25292B', + 'color_borders' => '#E0E0E0', + ); +} + +/** + * Deep Harbor color scheme + * + * Cool blue tones with sage green accent. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_deep_harbor_colors(): array { + return array( + 'header_textcolor' => '#2A2F36', + 'background_color' => '#F7F9FC', + 'bgcolor_header' => '#F7F9FC', + 'bgcolor_site_navigation' => '#F7F9FC', + 'color_site_navigation' => '#2A2F36', + 'color_text' => '#2A2F36', + 'color_link' => '#1F3A5F', + 'color_meta_link' => '#2F5F8F', + 'color_primary' => '#1F3A5F', + 'color_secondary' => '#2F5F8F', + 'color_action' => '#8FAEA0', + 'color_button' => '#1F3A5F', + 'bgcolor_page_masthead' => '#1F3A5F', + 'color_page_masthead' => '#F7F9FC', + 'bgcolor_footer_widgets' => '#F7F9FC', + 'color_footer_widgets' => '#2A2F36', + 'color_borders' => '#E0E0E0', + ); +} + +/** + * Midnight Violet color scheme + * + * Dark mode with purple accents. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_midnight_violet_colors(): array { + return array( + 'header_textcolor' => '#F2F2F3', + 'background_color' => '#0B0B0D', + 'bgcolor_header' => '#0B0B0D', + 'bgcolor_site_navigation' => '#1C1D21', + 'color_site_navigation' => '#F2F2F3', + 'color_text' => '#F2F2F3', + 'color_link' => '#7C4DFF', + 'color_meta_link' => '#9A9AA0', + 'color_primary' => '#7C4DFF', + 'color_secondary' => '#9A9AA0', + 'color_action' => '#7C4DFF', + 'color_button' => '#7C4DFF', + 'bgcolor_page_masthead' => '#1C1D21', + 'color_page_masthead' => '#F2F2F3', + 'bgcolor_footer_widgets' => '#1C1D21', + 'color_footer_widgets' => '#F2F2F3', + 'color_borders' => '#1C1D21', + ); +} + +/** + * Cocoa Ash color scheme + * + * Warm browns with orange accent. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_cocoa_ash_colors(): array { + return array( + 'header_textcolor' => '#DDD7CF', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#1F1B18', + 'bgcolor_site_navigation' => '#A8A29A', + 'color_site_navigation' => '#1F1B18', + 'color_text' => '#1F1B18', + 'color_link' => '#2E2623', + 'color_meta_link' => '#DDD7CF', + 'color_primary' => '#2E2623', + 'color_secondary' => '#6F6A66', + 'color_action' => '#D89A5A', + 'color_button' => '#2E2623', + 'bgcolor_page_masthead' => '#A8A29A', + 'color_page_masthead' => '#1F1B18', + 'bgcolor_footer_widgets' => '#2E2623', + 'color_footer_widgets' => '#DDD7CF', + 'color_borders' => '#A8A29A', + ); +} + +/** + * Soft Spruce color scheme + * + * Clean grays with restrained green accents. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_soft_spruce_colors(): array { + return array( + 'header_textcolor' => '#2B2E2D', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#F5F7F6', + 'color_site_navigation' => '#2B2E2D', + 'color_text' => '#2B2E2D', + 'color_link' => '#0E7A49', + 'color_meta_link' => '#7A7F7C', + 'color_primary' => '#0E7A49', + 'color_secondary' => '#7A7F7C', + 'color_action' => '#D18A3A', + 'color_button' => '#0E7A49', + 'bgcolor_page_masthead' => '#F5F7F6', + 'color_page_masthead' => '#2B2E2D', + 'bgcolor_footer_widgets' => '#F5F7F6', + 'color_footer_widgets' => '#2B2E2D', + 'color_borders' => '#E3E6E4', + ); +} + +/** + * Iron Ember color scheme + * + * Dark charcoal with rust orange accent. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_iron_ember_colors(): array { + return array( + 'header_textcolor' => '#1F252B', + 'background_color' => '#F6F7F6', + 'bgcolor_header' => '#F6F7F6', + 'bgcolor_site_navigation' => '#E9ECEA', + 'color_site_navigation' => '#1F252B', + 'color_text' => '#1F252B', + 'color_link' => '#1F252B', + 'color_meta_link' => '#4A5A6A', + 'color_primary' => '#1F252B', + 'color_secondary' => '#4A5A6A', + 'color_action' => '#C84F1A', + 'color_button' => '#1F252B', + 'bgcolor_page_masthead' => '#1F252B', + 'color_page_masthead' => '#FFFFFF', + 'bgcolor_footer_widgets' => '#1F252B', + 'color_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ); +} + +/** + * Slate Harbor color scheme + * + * Deep navy with teal and coral accents. + * + * @since TBD + * @return array 17-color associative array. + */ +function memberlite_get_slate_harbor_colors(): array { + return array( + 'header_textcolor' => '#0B1233', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#EEF2F6', + 'color_site_navigation' => '#0B1233', + 'color_text' => '#111827', + 'color_link' => '#0B1233', + 'color_meta_link' => '#0F6E7A', + 'color_primary' => '#0B1233', + 'color_secondary' => '#0F6E7A', + 'color_action' => '#F26B3A', + 'color_button' => '#0B1233', + 'bgcolor_page_masthead' => '#0B1233', + 'color_page_masthead' => '#FFFFFF', + 'bgcolor_footer_widgets' => '#0B1233', + 'color_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E4E9F0', + ); +} + +/** + * Get default theme settings + * + * Merges non-color defaults with the default color scheme. + * + * @since TBD + * @return array + */ +function memberlite_get_defaults(): array { + $defaults = array( + // Typography + 'memberlite_header_font' => 'Lato', + 'memberlite_body_font' => 'Lato', + + // Layout + 'columns_ratio' => '8-4', + 'columns_ratio_blog' => '8-4', + 'columns_ratio_header' => '4-8', + 'sidebar_location' => 'sidebar-right', + 'sidebar_location_blog' => 'sidebar-blog-right', + + // Archives + 'content_archives' => 'content', + 'memberlite_loop_images' => 'show_none', + + // Post Meta + 'posts_entry_meta_before' => __( 'Posted on {post_date} by {post_author_posts_link}', 'memberlite' ), + 'posts_entry_meta_after' => __( 'This entry was posted in {post_categories} and tagged {post_tags}. Bookmark the {post_permalink}.', 'memberlite' ), + 'author_block' => false, + + // Footer + 'memberlite_footerwidgets' => '4', + 'copyright_textbox' => '© !!current_year!! !!site_title!!', + 'memberlite_back_to_top' => true, + + // Color Scheme + 'memberlite_color_scheme' => 'default', + + // Other + 'delimiter' => ' / ', + 'memberlite_darkcss' => false, + 'hover_brightness' => '1.1', + 'color_white' => '#FFFFFF', + ); + + // Merge with default color scheme + $defaults = array_merge( $defaults, memberlite_get_default_colors() ); + + /** + * Filter Memberlite default settings. + * + * @since TBD + * @param array $defaults Associative array of default settings. + */ + return apply_filters( 'memberlite_defaults', $defaults ); +} + +/** + * Get all available color schemes. + * + * Each scheme contains a label and the full 17-color associative array. + * The 'custom' scheme is a special case handled separately in the customizer. + * + * @since TBD + * @return array Associative array of color schemes. + */ +function memberlite_get_color_schemes(): array { + $schemes = array( + 'default' => array( + 'label' => __( 'Default', 'memberlite' ), + 'colors' => memberlite_get_default_colors(), + ), + 'evergreen' => array( + 'label' => __( 'Evergreen', 'memberlite' ), + 'colors' => memberlite_get_evergreen_colors(), + ), + 'seaside_linen' => array( + 'label' => __( 'Seaside Linen', 'memberlite' ), + 'colors' => memberlite_get_seaside_linen_colors(), + ), + 'deep_harbor' => array( + 'label' => __( 'Deep Harbor', 'memberlite' ), + 'colors' => memberlite_get_deep_harbor_colors(), + ), + 'midnight_violet' => array( + 'label' => __( 'Midnight Violet', 'memberlite' ), + 'colors' => memberlite_get_midnight_violet_colors(), + ), + 'cocoa_ash' => array( + 'label' => __( 'Cocoa Ash', 'memberlite' ), + 'colors' => memberlite_get_cocoa_ash_colors(), + ), + 'soft_spruce' => array( + 'label' => __( 'Soft Spruce', 'memberlite' ), + 'colors' => memberlite_get_soft_spruce_colors(), + ), + 'iron_ember' => array( + 'label' => __( 'Iron Ember', 'memberlite' ), + 'colors' => memberlite_get_iron_ember_colors(), + ), + 'slate_harbor' => array( + 'label' => __( 'Slate Harbor', 'memberlite' ), + 'colors' => memberlite_get_slate_harbor_colors(), + ), + ); + + /** + * Filter Memberlite color schemes. + * + * @since TBD + * @param array $schemes Associative array of color schemes. + */ + return apply_filters( 'memberlite_color_schemes', $schemes ); +} + +/** + * Get color scheme choices for the customizer dropdown. + * + * Returns scheme keys and labels, plus 'custom' option. + * + * @since TBD + * @return array Associative array of scheme_key => label. + */ +function memberlite_get_color_scheme_choices(): array { + $schemes = memberlite_get_color_schemes(); + $choices = array(); + + foreach ( $schemes as $key => $scheme ) { + $choices[ $key ] = $scheme['label']; + } + + // Add custom option at the end + $choices['custom'] = __( 'Custom', 'memberlite' ); + + return $choices; +} + +/** + * Detect which color scheme (if any) matches the current theme_mod colors. + * + * Compares all 17 color values. Returns 'custom' if no exact match. + * + * @since TBD + * @return string Scheme key or 'custom'. + */ +function memberlite_detect_current_scheme(): string { + $schemes = memberlite_get_color_schemes(); + $color_keys = memberlite_get_color_setting_keys(); + + // Get current colors from theme_mods + $current_colors = array(); + foreach ( $color_keys as $key ) { + $current_colors[ $key ] = strtoupper( get_theme_mod( $key, '' ) ); + } + + // Compare against each scheme + foreach ( $schemes as $scheme_key => $scheme ) { + $match = true; + foreach ( $color_keys as $key ) { + // Skip header_textcolor comparison if set to 'blank' (hidden site title) + if ( 'header_textcolor' === $key && 'blank' === get_theme_mod( 'header_textcolor' ) ) { + continue; + } + + $scheme_color = strtoupper( $scheme['colors'][ $key ] ?? '' ); + $current_color = $current_colors[ $key ]; + + if ( $scheme_color !== $current_color ) { + $match = false; + break; + } + } + + if ( $match ) { + return $scheme_key; + } + } + + return 'custom'; +} + +/** + * Get all active colors from theme_mods. + * + * Returns the 17 color values currently saved in theme_mods, + * falling back to defaults for any missing values. + * + * @since TBD + * @return array Associative array of all 17 color values. + */ +function memberlite_get_active_colors(): array { + global $memberlite_defaults; + + $color_keys = memberlite_get_color_setting_keys(); + $colors = array(); + + foreach ( $color_keys as $key ) { + $value = get_theme_mod( $key, '' ); + $colors[ $key ] = ! empty( $value ) ? $value : ( $memberlite_defaults[ $key ] ?? '' ); + } + + return $colors; +} + +/** + * Get colors for a specific scheme by key. + * + * @since TBD + * @param string $scheme_key The scheme key (e.g., 'default', 'evergreen'). + * @return array|null The 17-color array or null if not found. + */ +function memberlite_get_scheme_colors( string $scheme_key ): ?array { + $schemes = memberlite_get_color_schemes(); + + if ( isset( $schemes[ $scheme_key ] ) ) { + return $schemes[ $scheme_key ]['colors']; + } + + return null; +} + +// Initialize global defaults global $memberlite_defaults; -$memberlite_defaults = apply_filters( 'memberlite_defaults', array( - 'memberlite_webfonts' => 'Lato_Lato', // Unused property for backwards compatibility - 'memberlite_header_font' => 'Lato', - 'memberlite_body_font' => 'Lato', - 'columns_ratio' => '8-4', - 'columns_ratio_header' => '4-8', - 'columns_ratio_blog' => '8-4', - 'sidebar_location' => 'sidebar-right', - 'sidebar_location_blog' => 'sidebar-blog-right', - 'content_archives' => 'content', - 'memberlite_loop_images' => 'show_none', - 'posts_entry_meta_before' => __( 'Posted on {post_date} by {post_author_posts_link}', 'memberlite' ), - 'posts_entry_meta_after' => __( 'This entry was posted in {post_categories} and tagged {post_tags}. Bookmark the {post_permalink}.', 'memberlite' ), - 'author_block' => false, - 'memberlite_footerwidgets' => '4', - 'copyright_textbox' => '© !!current_year!! !!site_title!!', - 'memberlite_back_to_top' => true, - 'memberlite_color_scheme' => 'Default', - 'memberlite_darkcss' => false, - 'background_color' => '#FFFFFF', - 'bgcolor_header' => '', - 'bgcolor_site_navigation' => '#F9FAFB', - 'color_site_navigation' => '#444444', - 'color_link' => '#011935', - 'color_meta_link' => '#011935', - 'color_primary' => '#011935', - 'color_secondary' => '#00A59D', - 'color_action' => '#E87102', - 'color_button' => '#3C4B5A', - 'bgcolor_page_masthead' => '#011935', - 'color_page_masthead' => '#FFFFFF', - 'bgcolor_footer_widgets' => '#F9FAFB', - 'color_footer_widgets' => '#444444', - 'bgcolor_header_elements' => '#masthead', - 'bgcolor_site_navigation_elements' => '#site-navigation, .main-navigation ul.sub-menu', - 'color_site_navigation_elements' => '.main-navigation a', - 'color_site_navigation_hover_elements' => '.main-navigation li:hover, .main-navigation li:hover > a', - 'color_link_color_elements' => '.content-area a:link:not(.wp-block-button__link), .content-area a:link:not(.btn), .content-area a:link:not(.comment-reply-link), .footer-navigation a, .site-info a', - 'color_meta_link_color_elements' => '.header-right .menu a', - 'color_primary_background_elements' => '#mobile-navigation, #mobile-navigation-height-col, .masthead, .footer-widgets, .btn_primary, .btn_primary:link, .menu-toggle, .bg_primary, .banner_primary, .has-color-primary-background-color', - 'color_primary_background_hover_elements' => '.btn_primary:hover', - 'color_primary_color_elements' => '#pmpro_levels .post h2, .pmpro_signup_form h2, .primary, .has-text-color.has-color-primary-color', - 'color_secondary_background_elements' => '.header-right #meta-member .meta-member-inner, #meta-member .member-navigation .sub-menu, .btn_secondary, .btn_secondary:link, .memberlite_tabbable ul.memberlite_tabs li.memberlite_active a, .memberlite_tabbable ul.memberlite_tabs li.memberlite_active a:hover, .banner_secondary, #banner_bottom, .has-color-secondary-background-color', - 'color_secondary_background_hover_elements' => '.btn_secondary:hover', - 'color_secondary_border_elements' => '#pmpro_levels .pmpro_level-highlight, #pmpro_levels.pmpro_levels-2col .pmpro_level-highlight, #pmpro_levels.pmpro_levels-3col .pmpro_level-highlight, #pmpro_levels.pmpro_levels-4col .pmpro_level-highlight, #pmpro_levels.pmpro_levels-div .pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table thead tr:first-child th.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tfoot tr:last-child td.pmpro_level-highlight, .memberlite_tabbable ul.memberlite_tabs li.memberlite_active a, .memberlite_tabbable .memberlite_tab_content', - 'color_secondary_border_left_elements' => '#pmpro_levels.pmpro_advanced_levels-compare_table thead th.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tbody td.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tfoot td.pmpro_level-highlight, #pmpro_levels.pmpro_levels-table .pmpro_level-highlight td:first-child, .memberlite_tabbable ul.memberlite_tabs li.memberlite_active a', - 'color_secondary_border_right_elements' => '#pmpro_levels.pmpro_advanced_levels-compare_table thead th.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tbody td.pmpro_level-highlight, #pmpro_levels.pmpro_advanced_levels-compare_table tfoot td.pmpro_level-highlight, #pmpro_levels.pmpro_levels-table .pmpro_level-highlight td:last-child, .memberlite_tabbable ul.memberlite_tabs li.memberlite_active a', - 'color_secondary_color_elements' => 'blockquote.quote:before, q:before, .testimonials-widget-testimonial .open-quote::before, .testimonials-widget-testimonial .close-quote::after, .woocommerce ul.products li.product .price, .woocommerce-page ul.products li.product .price, .woocommerce #content div.product p.price, .woocommerce #content div.product span.price, .woocommerce div.product p.price, .woocommerce div.product span.price, .woocommerce-page #content div.product p.price, .woocommerce-page #content div.product span.price, .woocommerce-page div.product p.price, .woocommerce-page div.product span.price, .secondary, .has-text-color.has-color-secondary-color', - 'color_action_background_elements' => '.btn_action, .btn_action:link, .pmpro_content_message a, .pmpro_content_message a:link, .pmpro_content_message a:visited, .pmpro_btn, .pmpro_btn:link, .pmpro_btn:visited, a.pmpro_btn, a.pmpro_btn:link, a.pmpro_btn:visited, input[type=button].pmpro_btn, input[type=submit].pmpro_btn, #loginform input[type=submit].button.button-primary, .woocommerce #content input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce-page #respond input#submit.alt, .woocommerce-page a.button.alt, .woocommerce-page button.button.alt, .woocommerce-page input.button.alt, .bg_action, .banner_action, .has-color-action-background-color', - 'color_action_background_hover_elements' => '.btn_action:hover, .pmpro_content_message a:hover, .pmpro_btn:hover, a.pmpro_btn:hover, input[type=button].pmpro_btn:hover, input[type=submit].pmpro_btn:hover, .woocommerce #content input.button.alt:hover, .woocommerce #respond input#submit.alt:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover, .woocommerce-page #content input.button.alt:hover, .woocommerce-page #respond input#submit.alt:hover, .woocommerce-page a.button.alt:hover, .woocommerce-page button.button.alt:hover, .woocommerce-page input.button.alt:hover', - 'color_action_color_elements' => '.action, .has-text-color.has-color-action-color', - 'color_button_background_elements' => 'button, input[type=button], input[type=reset], input[type=submit],.btn,.btn:link, a.comment-reply-link, a.comment-reply-link:link, #main div.em-search-main button.em-search-submit', - 'color_button_background_hover_elements' => 'button:hover, input[type=button]:hover, input[type=reset]:hover, input[type=submit]:hover, button:focus, input[type=button]:focus, input[type=reset]:focus, input[type=submit]:focus, button:active, input[type=button]:active, input[type=reset]:active, input[type=submit]:active,.btn:hover,.btn:active,.btn:focus, #main div.em-search-main button.em-search-submit:hover', - 'bgcolor_page_masthead_elements' => '.masthead', - 'color_page_masthead_elements' => '.masthead, .masthead h1 a, .masthead h2 a, .masthead h3 a, .masthead p a:not(.btn), .memberlite-breadcrumb, .masthead .memberlite-breadcrumb a', - 'bgcolor_footer_widgets_elements' => '.footer-widgets', - 'color_footer_widgets_elements' => '.footer-widgets, .footer-widgets a, .footer-widgets a:hover', - 'delimiter' => ' / ', - 'memberlite_darkcss' => false, - 'hover_brightness' => '1.1', - 'color_white' => '#FFFFFF', - 'color_text' => '#222222', - 'color_borders' => '#03543F21', - 'header_textcolor' => '#222222', -) ); +$memberlite_defaults = memberlite_get_defaults(); diff --git a/inc/deprecated.php b/inc/deprecated.php index 65c47f18..c358f6fe 100644 --- a/inc/deprecated.php +++ b/inc/deprecated.php @@ -223,3 +223,321 @@ function memberlite_deprecated_plugins_action_links( $actions, $plugin_file ) { return $actions; } add_filter( 'plugin_action_links', 'memberlite_deprecated_plugins_action_links', 10, 2 ); + +/** + * Get legacy color scheme definitions in 17-color associative format. + * Used by upgrade script to migrate legacy schemes to individual theme_mods. + * + * @since TBD + * @return array Legacy color schemes with 17-color associative arrays. + */ +function memberlite_get_legacy_color_scheme_definitions(): array { + /** + * The order of colors matches the original indexed array order: + * 1. Header Text Color -> header_textcolor + * 2. Background Color -> background_color + * 3. Header Background Color -> bgcolor_header + * 4. Primary Nav BG Color -> bgcolor_site_navigation + * 5. Primary Nav Link Color -> color_site_navigation + * 6. Text Color -> color_text + * 7. Link Color -> color_link + * 8. Meta Link Color -> color_meta_link + * 9. Primary Color -> color_primary + * 10. Secondary Color -> color_secondary + * 11. Action Color -> color_action + * 12. Default Button Color -> color_button + * 13. Page Masthead Text -> color_page_masthead + * 14. Page Masthead BG -> bgcolor_page_masthead + * 15. Footer Widgets Text -> color_footer_widgets + * 16. Footer Widgets BG -> bgcolor_footer_widgets + * 17. Border Color -> color_borders + */ + return array( + 'default_v4.6' => array( + 'label' => __( 'Default V4.6 (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#011935', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#F9FAFB', + 'color_site_navigation' => '#444444', + 'color_text' => '#222222', + 'color_link' => '#011935', + 'color_meta_link' => '#011935', + 'color_primary' => '#011935', + 'color_secondary' => '#00A59D', + 'color_action' => '#E87102', + 'color_button' => '#3C4B5A', + 'color_page_masthead' => '#011935', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#F9FAFB', + 'bgcolor_footer_widgets' => '#444444', + 'color_borders' => '#E0E0E0', + ), + ), + 'default' => array( + 'label' => __( 'Default (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#2C3E50', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#FAFAFA', + 'color_site_navigation' => '#777777', + 'color_text' => '#222222', + 'color_link' => '#2C3E50', + 'color_meta_link' => '#2C3E50', + 'color_primary' => '#2C3E50', + 'color_secondary' => '#18BC9C', + 'color_action' => '#F39C12', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#2C3E50', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#2C3E50', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'education' => array( + 'label' => __( 'Education (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#3A9AD9', + 'background_color' => '#F4EFEA', + 'bgcolor_header' => '#F4EFEA', + 'bgcolor_site_navigation' => '#E2DED9', + 'color_site_navigation' => '#354458', + 'color_text' => '#222222', + 'color_link' => '#3A9AD9', + 'color_meta_link' => '#3A9AD9', + 'color_primary' => '#354458', + 'color_secondary' => '#EB7260', + 'color_action' => '#29ABA4', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#354458', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#354458', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'modern_teal' => array( + 'label' => __( 'Modern Teal (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#424242', + 'background_color' => '#EFEFEF', + 'bgcolor_header' => '#EFEFEF', + 'bgcolor_site_navigation' => '#424242', + 'color_site_navigation' => '#EFEFEF', + 'color_text' => '#222222', + 'color_link' => '#00CCD6', + 'color_meta_link' => '#00CCD6', + 'color_primary' => '#00CCD6', + 'color_secondary' => '#424242', + 'color_action' => '#FFD900', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#00CCD6', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#00CCD6', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'mono_blue' => array( + 'label' => __( 'Mono Blue (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#00AEEF', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#00AEEF', + 'color_site_navigation' => '#FFFFFF', + 'color_text' => '#222222', + 'color_link' => '#00AEEF', + 'color_meta_link' => '#00AEEF', + 'color_primary' => '#333333', + 'color_secondary' => '#555555', + 'color_action' => '#00AEEF', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#333333', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#333333', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'mono_green' => array( + 'label' => __( 'Mono Green (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#00A651', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#00A651', + 'color_site_navigation' => '#FFFFFF', + 'color_text' => '#222222', + 'color_link' => '#00A651', + 'color_meta_link' => '#00A651', + 'color_primary' => '#333333', + 'color_secondary' => '#555555', + 'color_action' => '#00A651', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#333333', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#333333', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'mono_orange' => array( + 'label' => __( 'Mono Orange (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#F39C12', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#F39C12', + 'color_site_navigation' => '#FFFFFF', + 'color_text' => '#222222', + 'color_link' => '#F39C12', + 'color_meta_link' => '#F39C12', + 'color_primary' => '#333333', + 'color_secondary' => '#555555', + 'color_action' => '#F39C12', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#333333', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#333333', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'mono_pink' => array( + 'label' => __( 'Mono Pink (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#ED0977', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#ED0977', + 'color_site_navigation' => '#FFFFFF', + 'color_text' => '#222222', + 'color_link' => '#ED0977', + 'color_meta_link' => '#ED0977', + 'color_primary' => '#333333', + 'color_secondary' => '#555555', + 'color_action' => '#ED0977', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#333333', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#333333', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'pop' => array( + 'label' => __( 'Pop! (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#53BBF4', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#B1EB00', + 'color_site_navigation' => '#666666', + 'color_text' => '#222222', + 'color_link' => '#B1EB00', + 'color_meta_link' => '#B1EB00', + 'color_primary' => '#53BBF4', + 'color_secondary' => '#FFAC00', + 'color_action' => '#FF85CB', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#53BBF4', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#53BBF4', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'primary' => array( + 'label' => __( 'Not So Primary (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#1352A2', + 'background_color' => '#F0F1EE', + 'bgcolor_header' => '#F0F1EE', + 'bgcolor_site_navigation' => '#FFFFFF', + 'color_site_navigation' => '#555555', + 'color_text' => '#222222', + 'color_link' => '#FB6964', + 'color_meta_link' => '#FB6964', + 'color_primary' => '#1352A2', + 'color_secondary' => '#FB6964', + 'color_action' => '#FFD464', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#1352A2', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#1352A2', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'raspberry_lime' => array( + 'label' => __( 'Raspberry Lime (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#AA2159', + 'background_color' => '#FFFFFF', + 'bgcolor_header' => '#FFFFFF', + 'bgcolor_site_navigation' => '#700035', + 'color_site_navigation' => '#EFEFEF', + 'color_text' => '#222222', + 'color_link' => '#009D97', + 'color_meta_link' => '#AA2159', + 'color_primary' => '#AA2159', + 'color_secondary' => '#009D97', + 'color_action' => '#BCC747', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#AA2159', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#AA2159', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'slate_blue' => array( + 'label' => __( 'Slate Blue (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#6991AC', + 'background_color' => '#F5F5F5', + 'bgcolor_header' => '#F5F5F5', + 'bgcolor_site_navigation' => '#FFFFFF', + 'color_site_navigation' => '#67727A', + 'color_text' => '#222222', + 'color_link' => '#6991AC', + 'color_meta_link' => '#6991AC', + 'color_primary' => '#67727A', + 'color_secondary' => '#6991AC', + 'color_action' => '#D75C37', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#67727A', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#67727A', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + 'watermelon' => array( + 'label' => __( 'Watermelon Seed (Legacy)', 'memberlite' ), + 'colors' => array( + 'header_textcolor' => '#363635', + 'background_color' => '#F9F9F7', + 'bgcolor_header' => '#F9F9F7', + 'bgcolor_site_navigation' => '#363635', + 'color_site_navigation' => '#FFFFFF', + 'color_text' => '#222222', + 'color_link' => '#83BF17', + 'color_meta_link' => '#83BF17', + 'color_primary' => '#83BF17', + 'color_secondary' => '#363635', + 'color_action' => '#F15D58', + 'color_button' => '#798D8F', + 'color_page_masthead' => '#83BF17', + 'bgcolor_page_masthead' => '#FFFFFF', + 'color_footer_widgets' => '#83BF17', + 'bgcolor_footer_widgets' => '#FFFFFF', + 'color_borders' => '#E0E0E0', + ), + ), + ); +} diff --git a/inc/extras.php b/inc/extras.php index 90e8390a..eb3bddf8 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -376,7 +376,7 @@ function memberlite_more_content() { /** * Get the featured block image to insert into the post content. - * + * */ function memberlite_loop_image() { global $memberlite_defaults; @@ -967,7 +967,7 @@ function memberlite_parse_tags( $meta, $post = null ) { if ( strpos( $meta, '{post_comments}' ) !== false ) { $searches[] = '{post_comments}'; - + // Get comments count (exclude Trackbacks and Pingbacks). $comment_args = array( 'post_id' => $post->ID, @@ -1064,3 +1064,12 @@ function memberlite_banner_image_setup() { } } add_action( 'wp_loaded', 'memberlite_banner_image_setup' ); + +/** + * Check if Paid Memberships Pro is active + * + * @return bool + */ +function is_pmpro_active() : bool { + return is_plugin_active('paid-memberships-pro/paid-memberships-pro.php' ); +} diff --git a/inc/font-awesome.php b/inc/font-awesome.php index b88966fa..8f53d969 100644 --- a/inc/font-awesome.php +++ b/inc/font-awesome.php @@ -12,15 +12,15 @@ * @return array */ function memberlite_get_font_awesome_icons( $type = NULL ) { - if ( $type === 'brand' ) { - return array( '42-group', '500px', 'accessible-icon', 'accusoft', 'adn', 'adversal', 'affiliatetheme', 'airbnb', 'algolia', 'alipay', 'amazon-pay', 'amazon', 'amilia', 'android', 'angellist', 'angrycreative', 'angular', 'app-store-ios', 'app-store', 'apper', 'apple-pay', 'apple', 'artstation', 'asymmetrik', 'atlassian', 'audible', 'autoprefixer', 'avianex', 'aviato', 'aws', 'bandcamp', 'battle-net', 'behance', 'bilibili', 'bimobject', 'bitbucket', 'bitcoin', 'bity', 'black-tie', 'blackberry', 'blogger-b', 'blogger', 'bluesky', 'bluetooth-b', 'bluetooth', 'bootstrap', 'bots', 'brave-reverse', 'brave', 'btc', 'buffer', 'buromobelexperte', 'buy-n-large', 'buysellads', 'canadian-maple-leaf', 'cc-amazon-pay', 'cc-amex', 'cc-apple-pay', 'cc-diners-club', 'cc-discover', 'cc-jcb', 'cc-mastercard', 'cc-paypal', 'cc-stripe', 'cc-visa', 'centercode', 'centos', 'chrome', 'chromecast', 'cloudflare', 'cloudscale', 'cloudsmith', 'cloudversify', 'cmplid', 'codepen', 'codiepie', 'confluence', 'connectdevelop', 'contao', 'cotton-bureau', 'cpanel', 'creative-commons-by', 'creative-commons-nc-eu', 'creative-commons-nc-jp', 'creative-commons-nc', 'creative-commons-nd', 'creative-commons-pd-alt', 'creative-commons-pd', 'creative-commons-remix', 'creative-commons-sa', 'creative-commons-sampling-plus', 'creative-commons-sampling', 'creative-commons-share', 'creative-commons-zero', 'creative-commons', 'critical-role', 'css3-alt', 'css3', 'cuttlefish', 'd-and-d-beyond', 'd-and-d', 'dailymotion', 'dart-lang', 'dashcube', 'debian', 'deezer', 'delicious', 'deploydog', 'deskpro', 'dev', 'deviantart', 'dhl', 'diaspora', 'digg', 'digital-ocean', 'discord', 'discourse', 'dochub', 'docker', 'draft2digital', 'dribbble', 'dropbox', 'drupal', 'dyalog', 'earlybirds', 'ebay', 'edge-legacy', 'edge', 'elementor', 'ello', 'ember', 'empire', 'envira', 'erlang', 'ethereum', 'etsy', 'evernote', 'expeditedssl', 'facebook-f', 'facebook-messenger', 'facebook', 'fantasy-flight-games', 'fedex', 'fedora', 'figma', 'firefox-browser', 'firefox', 'first-order-alt', 'first-order', 'firstdraft', 'flickr', 'flipboard', 'flutter', 'fly', 'font-awesome', 'fonticons-fi', 'fonticons', 'fort-awesome-alt', 'fort-awesome', 'forumbee', 'foursquare', 'free-code-camp', 'freebsd', 'fulcrum', 'galactic-republic', 'galactic-senate', 'get-pocket', 'gg-circle', 'gg', 'git-alt', 'git', 'github-alt', 'github', 'gitkraken', 'gitlab', 'gitter', 'glide-g', 'glide', 'gofore', 'golang', 'goodreads-g', 'goodreads', 'google-drive', 'google-pay', 'google-play', 'google-plus-g', 'google-plus', 'google-scholar', 'google-wallet', 'google', 'gratipay', 'grav', 'gripfire', 'grunt', 'guilded', 'gulp', 'hacker-news', 'hackerrank', 'hashnode', 'hips', 'hire-a-helper', 'hive', 'hooli', 'hornbill', 'hotjar', 'houzz', 'html5', 'hubspot', 'ideal', 'imdb', 'instagram', 'instalod', 'intercom', 'internet-explorer', 'invision', 'ioxhost', 'itch-io', 'itunes-note', 'itunes', 'java', 'jedi-order', 'jenkins', 'jira', 'joget', 'joomla', 'js', 'jsfiddle', 'jxl', 'kaggle', 'keybase', 'keycdn', 'kickstarter-k', 'kickstarter', 'korvue', 'laravel', 'lastfm', 'leanpub', 'less', 'letterboxd', 'line', 'linkedin-in', 'linkedin', 'linode', 'linux', 'lyft', 'magento', 'mailchimp', 'mandalorian', 'markdown', 'mastodon', 'maxcdn', 'mdb', 'medapps', 'medium', 'medrt', 'meetup', 'megaport', 'mendeley', 'meta', 'microblog', 'microsoft', 'mintbit', 'mix', 'mixcloud', 'mixer', 'mizuni', 'modx', 'monero', 'napster', 'neos', 'nfc-directional', 'nfc-symbol', 'nimblr', 'node-js', 'node', 'npm', 'ns8', 'nutritionix', 'octopus-deploy', 'odnoklassniki', 'odysee', 'old-republic', 'opencart', 'openid', 'opensuse', 'opera', 'optin-monster', 'orcid', 'osi', 'padlet', 'page4', 'pagelines', 'palfed', 'patreon', 'paypal', 'perbyte', 'periscope', 'phabricator', 'phoenix-framework', 'phoenix-squadron', 'php', 'pied-piper-alt', 'pied-piper-hat', 'pied-piper-pp', 'pied-piper', 'pinterest-p', 'pinterest', 'pix', 'pixiv', 'playstation', 'product-hunt', 'pushed', 'python', 'qq', 'quinscape', 'quora', 'r-project', 'raspberry-pi', 'ravelry', 'react', 'reacteurope', 'readme', 'rebel', 'red-river', 'reddit-alien', 'reddit', 'redhat', 'renren', 'replyd', 'researchgate', 'resolving', 'rev', 'rocketchat', 'rockrms', 'rust', 'safari', 'salesforce', 'sass', 'schlix', 'screenpal', 'scribd', 'searchengin', 'sellcast', 'sellsy', 'servicestack', 'shirtsinbulk', 'shoelace', 'shopify', 'shopware', 'signal-messenger', 'simplybuilt', 'sistrix', 'sith', 'sitrox', 'sketch', 'skyatlas', 'skype', 'slack', 'slideshare', 'snapchat', 'soundcloud', 'sourcetree', 'space-awesome', 'speakap', 'speaker-deck', 'spotify', 'square-behance', 'square-dribbble', 'square-facebook', 'square-font-awesome-stroke', 'square-font-awesome', 'square-git', 'square-github', 'square-gitlab', 'square-google-plus', 'square-hacker-news', 'square-instagram', 'square-js', 'square-lastfm', 'square-letterboxd', 'square-odnoklassniki', 'square-pied-piper', 'square-pinterest', 'square-reddit', 'square-snapchat', 'square-steam', 'square-threads', 'square-tumblr', 'square-twitter', 'square-upwork', 'square-viadeo', 'square-vimeo', 'square-web-awesome-stroke', 'square-web-awesome', 'square-whatsapp', 'square-x-twitter', 'square-xing', 'square-youtube', 'squarespace', 'stack-exchange', 'stack-overflow', 'stackpath', 'staylinked', 'steam-symbol', 'steam', 'sticker-mule', 'strava', 'stripe-s', 'stripe', 'stubber', 'studiovinari', 'stumbleupon-circle', 'stumbleupon', 'superpowers', 'supple', 'suse', 'swift', 'symfony', 'teamspeak', 'telegram', 'tencent-weibo', 'the-red-yeti', 'themeco', 'themeisle', 'think-peaks', 'threads', 'tiktok', 'trade-federation', 'trello', 'tumblr', 'twitch', 'twitter', 'typo3', 'uber', 'ubuntu', 'uikit', 'umbraco', 'uncharted', 'uniregistry', 'unity', 'unsplash', 'untappd', 'ups', 'upwork', 'usb', 'usps', 'ussunnah', 'vaadin', 'viacoin', 'viadeo', 'viber', 'vimeo-v', 'vimeo', 'vine', 'vk', 'vnv', 'vuejs', 'watchman-monitoring', 'waze', 'web-awesome', 'webflow', 'weebly', 'weibo', 'weixin', 'whatsapp', 'whmcs', 'wikipedia-w', 'windows', 'wirsindhandwerk', 'wix', 'wizards-of-the-coast', 'wodu', 'wolf-pack-battalion', 'wordpress-simple', 'wordpress', 'wpbeginner', 'wpexplorer', 'wpforms', 'wpressr', 'x-twitter', 'xbox', 'xing', 'y-combinator', 'yahoo', 'yammer', 'yandex-international', 'yandex', 'yarn', 'yelp', 'yoast', 'youtube', 'zhihu' ); - } elseif ( $type === 'regular' ) { - return array( 'address-book', 'address-card', 'bell-slash', 'bell', 'bookmark', 'building', 'calendar-check', 'calendar-days', 'calendar-minus', 'calendar-plus', 'calendar-xmark', 'calendar', 'chart-bar', 'chess-bishop', 'chess-king', 'chess-knight', 'chess-pawn', 'chess-queen', 'chess-rook', 'circle-check', 'circle-dot', 'circle-down', 'circle-left', 'circle-pause', 'circle-play', 'circle-question', 'circle-right', 'circle-stop', 'circle-up', 'circle-user', 'circle-xmark', 'circle', 'clipboard', 'clock', 'clone', 'closed-captioning', 'comment-dots', 'comment', 'comments', 'compass', 'copy', 'copyright', 'credit-card', 'envelope-open', 'envelope', 'eye-slash', 'eye', 'face-angry', 'face-dizzy', 'face-flushed', 'face-frown-open', 'face-frown', 'face-grimace', 'face-grin-beam-sweat', 'face-grin-beam', 'face-grin-hearts', 'face-grin-squint-tears', 'face-grin-squint', 'face-grin-stars', 'face-grin-tears', 'face-grin-tongue-squint', 'face-grin-tongue-wink', 'face-grin-tongue', 'face-grin-wide', 'face-grin-wink', 'face-grin', 'face-kiss-beam', 'face-kiss-wink-heart', 'face-kiss', 'face-laugh-beam', 'face-laugh-squint', 'face-laugh-wink', 'face-laugh', 'face-meh-blank', 'face-meh', 'face-rolling-eyes', 'face-sad-cry', 'face-sad-tear', 'face-smile-beam', 'face-smile-wink', 'face-smile', 'face-surprise', 'face-tired', 'file-audio', 'file-code', 'file-excel', 'file-image', 'file-lines', 'file-pdf', 'file-powerpoint', 'file-video', 'file-word', 'file-zipper', 'file', 'flag', 'floppy-disk', 'folder-closed', 'folder-open', 'folder', 'font-awesome', 'futbol', 'gem', 'hand-back-fist', 'hand-lizard', 'hand-peace', 'hand-point-down', 'hand-point-left', 'hand-point-right', 'hand-point-up', 'hand-pointer', 'hand-scissors', 'hand-spock', 'hand', 'handshake', 'hard-drive', 'heart', 'hospital', 'hourglass-half', 'hourglass', 'id-badge', 'id-card', 'image', 'images', 'keyboard', 'lemon', 'life-ring', 'lightbulb', 'map', 'message', 'money-bill-1', 'moon', 'newspaper', 'note-sticky', 'object-group', 'object-ungroup', 'paper-plane', 'paste', 'pen-to-square', 'rectangle-list', 'rectangle-xmark', 'registered', 'share-from-square', 'snowflake', 'square-caret-down', 'square-caret-left', 'square-caret-right', 'square-caret-up', 'square-check', 'square-full', 'square-minus', 'square-plus', 'square', 'star-half-stroke', 'star-half', 'star', 'sun', 'thumbs-down', 'thumbs-up', 'trash-can', 'user', 'window-maximize', 'window-minimize', 'window-restore' ); - } elseif ( $type === 'solid' ) { - return array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'address-book', 'address-card', 'align-center', 'align-justify', 'align-left', 'align-right', 'anchor-circle-check', 'anchor-circle-exclamation', 'anchor-circle-xmark', 'anchor-lock', 'anchor', 'angle-down', 'angle-left', 'angle-right', 'angle-up', 'angles-down', 'angles-left', 'angles-right', 'angles-up', 'ankh', 'apple-whole', 'archway', 'arrow-down-1-9', 'arrow-down-9-1', 'arrow-down-a-z', 'arrow-down-long', 'arrow-down-short-wide', 'arrow-down-up-across-line', 'arrow-down-up-lock', 'arrow-down-wide-short', 'arrow-down-z-a', 'arrow-down', 'arrow-left-long', 'arrow-left', 'arrow-pointer', 'arrow-right-arrow-left', 'arrow-right-from-bracket', 'arrow-right-long', 'arrow-right-to-bracket', 'arrow-right-to-city', 'arrow-right', 'arrow-rotate-left', 'arrow-rotate-right', 'arrow-trend-down', 'arrow-trend-up', 'arrow-turn-down', 'arrow-turn-up', 'arrow-up-1-9', 'arrow-up-9-1', 'arrow-up-a-z', 'arrow-up-from-bracket', 'arrow-up-from-ground-water', 'arrow-up-from-water-pump', 'arrow-up-long', 'arrow-up-right-dots', 'arrow-up-right-from-square', 'arrow-up-short-wide', 'arrow-up-wide-short', 'arrow-up-z-a', 'arrow-up', 'arrows-down-to-line', 'arrows-down-to-people', 'arrows-left-right-to-line', 'arrows-left-right', 'arrows-rotate', 'arrows-spin', 'arrows-split-up-and-left', 'arrows-to-circle', 'arrows-to-dot', 'arrows-to-eye', 'arrows-turn-right', 'arrows-turn-to-dots', 'arrows-up-down-left-right', 'arrows-up-down', 'arrows-up-to-line', 'asterisk', 'at', 'atom', 'audio-description', 'austral-sign', 'award', 'b', 'baby-carriage', 'baby', 'backward-fast', 'backward-step', 'backward', 'bacon', 'bacteria', 'bacterium', 'bag-shopping', 'bahai', 'baht-sign', 'ban-smoking', 'ban', 'bandage', 'bangladeshi-taka-sign', 'barcode', 'bars-progress', 'bars-staggered', 'bars', 'baseball-bat-ball', 'baseball', 'basket-shopping', 'basketball', 'bath', 'battery-empty', 'battery-full', 'battery-half', 'battery-quarter', 'battery-three-quarters', 'bed-pulse', 'bed', 'beer-mug-empty', 'bell-concierge', 'bell-slash', 'bell', 'bezier-curve', 'bicycle', 'binoculars', 'biohazard', 'bitcoin-sign', 'blender-phone', 'blender', 'blog', 'bold', 'bolt-lightning', 'bolt', 'bomb', 'bone', 'bong', 'book-atlas', 'book-bible', 'book-bookmark', 'book-journal-whills', 'book-medical', 'book-open-reader', 'book-open', 'book-quran', 'book-skull', 'book-tanakh', 'book', 'bookmark', 'border-all', 'border-none', 'border-top-left', 'bore-hole', 'bottle-droplet', 'bottle-water', 'bowl-food', 'bowl-rice', 'bowling-ball', 'box-archive', 'box-open', 'box-tissue', 'box', 'boxes-packing', 'boxes-stacked', 'braille', 'brain', 'brazilian-real-sign', 'bread-slice', 'bridge-circle-check', 'bridge-circle-exclamation', 'bridge-circle-xmark', 'bridge-lock', 'bridge-water', 'bridge', 'briefcase-medical', 'briefcase', 'broom-ball', 'broom', 'brush', 'bucket', 'bug-slash', 'bug', 'bugs', 'building-circle-arrow-right', 'building-circle-check', 'building-circle-exclamation', 'building-circle-xmark', 'building-columns', 'building-flag', 'building-lock', 'building-ngo', 'building-shield', 'building-un', 'building-user', 'building-wheat', 'building', 'bullhorn', 'bullseye', 'burger', 'burst', 'bus-simple', 'bus', 'business-time', 'c', 'cable-car', 'cake-candles', 'calculator', 'calendar-check', 'calendar-day', 'calendar-days', 'calendar-minus', 'calendar-plus', 'calendar-week', 'calendar-xmark', 'calendar', 'camera-retro', 'camera-rotate', 'camera', 'campground', 'candy-cane', 'cannabis', 'capsules', 'car-battery', 'car-burst', 'car-on', 'car-rear', 'car-side', 'car-tunnel', 'car', 'caravan', 'caret-down', 'caret-left', 'caret-right', 'caret-up', 'carrot', 'cart-arrow-down', 'cart-flatbed-suitcase', 'cart-flatbed', 'cart-plus', 'cart-shopping', 'cash-register', 'cat', 'cedi-sign', 'cent-sign', 'certificate', 'chair', 'chalkboard-user', 'chalkboard', 'champagne-glasses', 'charging-station', 'chart-area', 'chart-bar', 'chart-column', 'chart-gantt', 'chart-line', 'chart-pie', 'chart-simple', 'check-double', 'check-to-slot', 'check', 'cheese', 'chess-bishop', 'chess-board', 'chess-king', 'chess-knight', 'chess-pawn', 'chess-queen', 'chess-rook', 'chess', 'chevron-down', 'chevron-left', 'chevron-right', 'chevron-up', 'child-combatant', 'child-dress', 'child-reaching', 'child', 'children', 'church', 'circle-arrow-down', 'circle-arrow-left', 'circle-arrow-right', 'circle-arrow-up', 'circle-check', 'circle-chevron-down', 'circle-chevron-left', 'circle-chevron-right', 'circle-chevron-up', 'circle-dollar-to-slot', 'circle-dot', 'circle-down', 'circle-exclamation', 'circle-h', 'circle-half-stroke', 'circle-info', 'circle-left', 'circle-minus', 'circle-nodes', 'circle-notch', 'circle-pause', 'circle-play', 'circle-plus', 'circle-question', 'circle-radiation', 'circle-right', 'circle-stop', 'circle-up', 'circle-user', 'circle-xmark', 'circle', 'city', 'clapperboard', 'clipboard-check', 'clipboard-list', 'clipboard-question', 'clipboard-user', 'clipboard', 'clock-rotate-left', 'clock', 'clone', 'closed-captioning', 'cloud-arrow-down', 'cloud-arrow-up', 'cloud-bolt', 'cloud-meatball', 'cloud-moon-rain', 'cloud-moon', 'cloud-rain', 'cloud-showers-heavy', 'cloud-showers-water', 'cloud-sun-rain', 'cloud-sun', 'cloud', 'clover', 'code-branch', 'code-commit', 'code-compare', 'code-fork', 'code-merge', 'code-pull-request', 'code', 'coins', 'colon-sign', 'comment-dollar', 'comment-dots', 'comment-medical', 'comment-slash', 'comment-sms', 'comment', 'comments-dollar', 'comments', 'compact-disc', 'compass-drafting', 'compass', 'compress', 'computer-mouse', 'computer', 'cookie-bite', 'cookie', 'copy', 'copyright', 'couch', 'cow', 'credit-card', 'crop-simple', 'crop', 'cross', 'crosshairs', 'crow', 'crown', 'crutch', 'cruzeiro-sign', 'cube', 'cubes-stacked', 'cubes', 'd', 'database', 'delete-left', 'democrat', 'desktop', 'dharmachakra', 'diagram-next', 'diagram-predecessor', 'diagram-project', 'diagram-successor', 'diamond-turn-right', 'diamond', 'dice-d6', 'dice-d20', 'dice-five', 'dice-four', 'dice-one', 'dice-six', 'dice-three', 'dice-two', 'dice', 'disease', 'display', 'divide', 'dna', 'dog', 'dollar-sign', 'dolly', 'dong-sign', 'door-closed', 'door-open', 'dove', 'down-left-and-up-right-to-center', 'down-long', 'download', 'dragon', 'draw-polygon', 'droplet-slash', 'droplet', 'drum-steelpan', 'drum', 'drumstick-bite', 'dumbbell', 'dumpster-fire', 'dumpster', 'dungeon', 'e', 'ear-deaf', 'ear-listen', 'earth-africa', 'earth-americas', 'earth-asia', 'earth-europe', 'earth-oceania', 'egg', 'eject', 'elevator', 'ellipsis-vertical', 'ellipsis', 'envelope-circle-check', 'envelope-open-text', 'envelope-open', 'envelope', 'envelopes-bulk', 'equals', 'eraser', 'ethernet', 'euro-sign', 'exclamation', 'expand', 'explosion', 'eye-dropper', 'eye-low-vision', 'eye-slash', 'eye', 'f', 'face-angry', 'face-dizzy', 'face-flushed', 'face-frown-open', 'face-frown', 'face-grimace', 'face-grin-beam-sweat', 'face-grin-beam', 'face-grin-hearts', 'face-grin-squint-tears', 'face-grin-squint', 'face-grin-stars', 'face-grin-tears', 'face-grin-tongue-squint', 'face-grin-tongue-wink', 'face-grin-tongue', 'face-grin-wide', 'face-grin-wink', 'face-grin', 'face-kiss-beam', 'face-kiss-wink-heart', 'face-kiss', 'face-laugh-beam', 'face-laugh-squint', 'face-laugh-wink', 'face-laugh', 'face-meh-blank', 'face-meh', 'face-rolling-eyes', 'face-sad-cry', 'face-sad-tear', 'face-smile-beam', 'face-smile-wink', 'face-smile', 'face-surprise', 'face-tired', 'fan', 'faucet-drip', 'faucet', 'fax', 'feather-pointed', 'feather', 'ferry', 'file-arrow-down', 'file-arrow-up', 'file-audio', 'file-circle-check', 'file-circle-exclamation', 'file-circle-minus', 'file-circle-plus', 'file-circle-question', 'file-circle-xmark', 'file-code', 'file-contract', 'file-csv', 'file-excel', 'file-export', 'file-image', 'file-import', 'file-invoice-dollar', 'file-invoice', 'file-lines', 'file-medical', 'file-pdf', 'file-pen', 'file-powerpoint', 'file-prescription', 'file-shield', 'file-signature', 'file-video', 'file-waveform', 'file-word', 'file-zipper', 'file', 'fill-drip', 'fill', 'film', 'filter-circle-dollar', 'filter-circle-xmark', 'filter', 'fingerprint', 'fire-burner', 'fire-extinguisher', 'fire-flame-curved', 'fire-flame-simple', 'fire', 'fish-fins', 'fish', 'flag-checkered', 'flag-usa', 'flag', 'flask-vial', 'flask', 'floppy-disk', 'florin-sign', 'folder-closed', 'folder-minus', 'folder-open', 'folder-plus', 'folder-tree', 'folder', 'font-awesome', 'font', 'football', 'forward-fast', 'forward-step', 'forward', 'franc-sign', 'frog', 'futbol', 'g', 'gamepad', 'gas-pump', 'gauge-high', 'gauge-simple-high', 'gauge-simple', 'gauge', 'gavel', 'gear', 'gears', 'gem', 'genderless', 'ghost', 'gift', 'gifts', 'glass-water-droplet', 'glass-water', 'glasses', 'globe', 'golf-ball-tee', 'gopuram', 'graduation-cap', 'greater-than-equal', 'greater-than', 'grip-lines-vertical', 'grip-lines', 'grip-vertical', 'grip', 'group-arrows-rotate', 'guarani-sign', 'guitar', 'gun', 'h', 'hammer', 'hamsa', 'hand-back-fist', 'hand-dots', 'hand-fist', 'hand-holding-dollar', 'hand-holding-droplet', 'hand-holding-hand', 'hand-holding-heart', 'hand-holding-medical', 'hand-holding', 'hand-lizard', 'hand-middle-finger', 'hand-peace', 'hand-point-down', 'hand-point-left', 'hand-point-right', 'hand-point-up', 'hand-pointer', 'hand-scissors', 'hand-sparkles', 'hand-spock', 'hand', 'handcuffs', 'hands-asl-interpreting', 'hands-bound', 'hands-bubbles', 'hands-clapping', 'hands-holding-child', 'hands-holding-circle', 'hands-holding', 'hands-praying', 'hands', 'handshake-angle', 'handshake-simple-slash', 'handshake-simple', 'handshake-slash', 'handshake', 'hanukiah', 'hard-drive', 'hashtag', 'hat-cowboy-side', 'hat-cowboy', 'hat-wizard', 'head-side-cough-slash', 'head-side-cough', 'head-side-mask', 'head-side-virus', 'heading', 'headphones-simple', 'headphones', 'headset', 'heart-circle-bolt', 'heart-circle-check', 'heart-circle-exclamation', 'heart-circle-minus', 'heart-circle-plus', 'heart-circle-xmark', 'heart-crack', 'heart-pulse', 'heart', 'helicopter-symbol', 'helicopter', 'helmet-safety', 'helmet-un', 'highlighter', 'hill-avalanche', 'hill-rockslide', 'hippo', 'hockey-puck', 'holly-berry', 'horse-head', 'horse', 'hospital-user', 'hospital', 'hot-tub-person', 'hotdog', 'hotel', 'hourglass-end', 'hourglass-half', 'hourglass-start', 'hourglass', 'house-chimney-crack', 'house-chimney-medical', 'house-chimney-user', 'house-chimney-window', 'house-chimney', 'house-circle-check', 'house-circle-exclamation', 'house-circle-xmark', 'house-crack', 'house-fire', 'house-flag', 'house-flood-water-circle-arrow-right', 'house-flood-water', 'house-laptop', 'house-lock', 'house-medical-circle-check', 'house-medical-circle-exclamation', 'house-medical-circle-xmark', 'house-medical-flag', 'house-medical', 'house-signal', 'house-tsunami', 'house-user', 'house', 'hryvnia-sign', 'hurricane', 'i-cursor', 'i', 'ice-cream', 'icicles', 'icons', 'id-badge', 'id-card-clip', 'id-card', 'igloo', 'image-portrait', 'image', 'images', 'inbox', 'indent', 'indian-rupee-sign', 'industry', 'infinity', 'info', 'italic', 'j', 'jar-wheat', 'jar', 'jedi', 'jet-fighter-up', 'jet-fighter', 'joint', 'jug-detergent', 'k', 'kaaba', 'key', 'keyboard', 'khanda', 'kip-sign', 'kit-medical', 'kitchen-set', 'kiwi-bird', 'l', 'land-mine-on', 'landmark-dome', 'landmark-flag', 'landmark', 'language', 'laptop-code', 'laptop-file', 'laptop-medical', 'laptop', 'lari-sign', 'layer-group', 'leaf', 'left-long', 'left-right', 'lemon', 'less-than-equal', 'less-than', 'life-ring', 'lightbulb', 'lines-leaning', 'link-slash', 'link', 'lira-sign', 'list-check', 'list-ol', 'list-ul', 'list', 'litecoin-sign', 'location-arrow', 'location-crosshairs', 'location-dot', 'location-pin-lock', 'location-pin', 'lock-open', 'lock', 'locust', 'lungs-virus', 'lungs', 'm', 'magnet', 'magnifying-glass-arrow-right', 'magnifying-glass-chart', 'magnifying-glass-dollar', 'magnifying-glass-location', 'magnifying-glass-minus', 'magnifying-glass-plus', 'magnifying-glass', 'manat-sign', 'map-location-dot', 'map-location', 'map-pin', 'map', 'marker', 'mars-and-venus-burst', 'mars-and-venus', 'mars-double', 'mars-stroke-right', 'mars-stroke-up', 'mars-stroke', 'mars', 'martini-glass-citrus', 'martini-glass-empty', 'martini-glass', 'mask-face', 'mask-ventilator', 'mask', 'masks-theater', 'mattress-pillow', 'maximize', 'medal', 'memory', 'menorah', 'mercury', 'message', 'meteor', 'microchip', 'microphone-lines-slash', 'microphone-lines', 'microphone-slash', 'microphone', 'microscope', 'mill-sign', 'minimize', 'minus', 'mitten', 'mobile-button', 'mobile-retro', 'mobile-screen-button', 'mobile-screen', 'mobile', 'money-bill-1-wave', 'money-bill-1', 'money-bill-transfer', 'money-bill-trend-up', 'money-bill-wave', 'money-bill-wheat', 'money-bill', 'money-bills', 'money-check-dollar', 'money-check', 'monument', 'moon', 'mortar-pestle', 'mosque', 'mosquito-net', 'mosquito', 'motorcycle', 'mound', 'mountain-city', 'mountain-sun', 'mountain', 'mug-hot', 'mug-saucer', 'music', 'n', 'naira-sign', 'network-wired', 'neuter', 'newspaper', 'not-equal', 'notdef', 'note-sticky', 'notes-medical', 'o', 'object-group', 'object-ungroup', 'oil-can', 'oil-well', 'om', 'otter', 'outdent', 'p', 'pager', 'paint-roller', 'paintbrush', 'palette', 'pallet', 'panorama', 'paper-plane', 'paperclip', 'parachute-box', 'paragraph', 'passport', 'paste', 'pause', 'paw', 'peace', 'pen-clip', 'pen-fancy', 'pen-nib', 'pen-ruler', 'pen-to-square', 'pen', 'pencil', 'people-arrows', 'people-carry-box', 'people-group', 'people-line', 'people-pulling', 'people-robbery', 'people-roof', 'pepper-hot', 'percent', 'person-arrow-down-to-line', 'person-arrow-up-from-line', 'person-biking', 'person-booth', 'person-breastfeeding', 'person-burst', 'person-cane', 'person-chalkboard', 'person-circle-check', 'person-circle-exclamation', 'person-circle-minus', 'person-circle-plus', 'person-circle-question', 'person-circle-xmark', 'person-digging', 'person-dots-from-line', 'person-dress-burst', 'person-dress', 'person-drowning', 'person-falling-burst', 'person-falling', 'person-half-dress', 'person-harassing', 'person-hiking', 'person-military-pointing', 'person-military-rifle', 'person-military-to-person', 'person-praying', 'person-pregnant', 'person-rays', 'person-rifle', 'person-running', 'person-shelter', 'person-skating', 'person-skiing-nordic', 'person-skiing', 'person-snowboarding', 'person-swimming', 'person-through-window', 'person-walking-arrow-loop-left', 'person-walking-arrow-right', 'person-walking-dashed-line-arrow-right', 'person-walking-luggage', 'person-walking-with-cane', 'person-walking', 'person', 'peseta-sign', 'peso-sign', 'phone-flip', 'phone-slash', 'phone-volume', 'phone', 'photo-film', 'piggy-bank', 'pills', 'pizza-slice', 'place-of-worship', 'plane-arrival', 'plane-circle-check', 'plane-circle-exclamation', 'plane-circle-xmark', 'plane-departure', 'plane-lock', 'plane-slash', 'plane-up', 'plane', 'plant-wilt', 'plate-wheat', 'play', 'plug-circle-bolt', 'plug-circle-check', 'plug-circle-exclamation', 'plug-circle-minus', 'plug-circle-plus', 'plug-circle-xmark', 'plug', 'plus-minus', 'plus', 'podcast', 'poo-storm', 'poo', 'poop', 'power-off', 'prescription-bottle-medical', 'prescription-bottle', 'prescription', 'print', 'pump-medical', 'pump-soap', 'puzzle-piece', 'q', 'qrcode', 'question', 'quote-left', 'quote-right', 'r', 'radiation', 'radio', 'rainbow', 'ranking-star', 'receipt', 'record-vinyl', 'rectangle-ad', 'rectangle-list', 'rectangle-xmark', 'recycle', 'registered', 'repeat', 'reply-all', 'reply', 'republican', 'restroom', 'retweet', 'ribbon', 'right-from-bracket', 'right-left', 'right-long', 'right-to-bracket', 'ring', 'road-barrier', 'road-bridge', 'road-circle-check', 'road-circle-exclamation', 'road-circle-xmark', 'road-lock', 'road-spikes', 'road', 'robot', 'rocket', 'rotate-left', 'rotate-right', 'rotate', 'route', 'rss', 'ruble-sign', 'rug', 'ruler-combined', 'ruler-horizontal', 'ruler-vertical', 'ruler', 'rupee-sign', 'rupiah-sign', 's', 'sack-dollar', 'sack-xmark', 'sailboat', 'satellite-dish', 'satellite', 'scale-balanced', 'scale-unbalanced-flip', 'scale-unbalanced', 'school-circle-check', 'school-circle-exclamation', 'school-circle-xmark', 'school-flag', 'school-lock', 'school', 'scissors', 'screwdriver-wrench', 'screwdriver', 'scroll-torah', 'scroll', 'sd-card', 'section', 'seedling', 'server', 'shapes', 'share-from-square', 'share-nodes', 'share', 'sheet-plastic', 'shekel-sign', 'shield-cat', 'shield-dog', 'shield-halved', 'shield-heart', 'shield-virus', 'shield', 'ship', 'shirt', 'shoe-prints', 'shop-lock', 'shop-slash', 'shop', 'shower', 'shrimp', 'shuffle', 'shuttle-space', 'sign-hanging', 'signal', 'signature', 'signs-post', 'sim-card', 'sink', 'sitemap', 'skull-crossbones', 'skull', 'slash', 'sleigh', 'sliders', 'smog', 'smoking', 'snowflake', 'snowman', 'snowplow', 'soap', 'socks', 'solar-panel', 'sort-down', 'sort-up', 'sort', 'spa', 'spaghetti-monster-flying', 'spell-check', 'spider', 'spinner', 'splotch', 'spoon', 'spray-can-sparkles', 'spray-can', 'square-arrow-up-right', 'square-caret-down', 'square-caret-left', 'square-caret-right', 'square-caret-up', 'square-check', 'square-envelope', 'square-full', 'square-h', 'square-minus', 'square-nfi', 'square-parking', 'square-pen', 'square-person-confined', 'square-phone-flip', 'square-phone', 'square-plus', 'square-poll-horizontal', 'square-poll-vertical', 'square-root-variable', 'square-rss', 'square-share-nodes', 'square-up-right', 'square-virus', 'square-xmark', 'square', 'staff-snake', 'stairs', 'stamp', 'stapler', 'star-and-crescent', 'star-half-stroke', 'star-half', 'star-of-david', 'star-of-life', 'star', 'sterling-sign', 'stethoscope', 'stop', 'stopwatch-20', 'stopwatch', 'store-slash', 'store', 'street-view', 'strikethrough', 'stroopwafel', 'subscript', 'suitcase-medical', 'suitcase-rolling', 'suitcase', 'sun-plant-wilt', 'sun', 'superscript', 'swatchbook', 'synagogue', 'syringe', 't', 'table-cells-column-lock', 'table-cells-large', 'table-cells-row-lock', 'table-cells-row-unlock', 'table-cells', 'table-columns', 'table-list', 'table-tennis-paddle-ball', 'table', 'tablet-button', 'tablet-screen-button', 'tablet', 'tablets', 'tachograph-digital', 'tag', 'tags', 'tape', 'tarp-droplet', 'tarp', 'taxi', 'teeth-open', 'teeth', 'temperature-arrow-down', 'temperature-arrow-up', 'temperature-empty', 'temperature-full', 'temperature-half', 'temperature-high', 'temperature-low', 'temperature-quarter', 'temperature-three-quarters', 'tenge-sign', 'tent-arrow-down-to-line', 'tent-arrow-left-right', 'tent-arrow-turn-left', 'tent-arrows-down', 'tent', 'tents', 'terminal', 'text-height', 'text-slash', 'text-width', 'thermometer', 'thumbs-down', 'thumbs-up', 'thumbtack-slash', 'thumbtack', 'ticket-simple', 'ticket', 'timeline', 'toggle-off', 'toggle-on', 'toilet-paper-slash', 'toilet-paper', 'toilet-portable', 'toilet', 'toilets-portable', 'toolbox', 'tooth', 'torii-gate', 'tornado', 'tower-broadcast', 'tower-cell', 'tower-observation', 'tractor', 'trademark', 'traffic-light', 'trailer', 'train-subway', 'train-tram', 'train', 'transgender', 'trash-arrow-up', 'trash-can-arrow-up', 'trash-can', 'trash', 'tree-city', 'tree', 'triangle-exclamation', 'trophy', 'trowel-bricks', 'trowel', 'truck-arrow-right', 'truck-droplet', 'truck-fast', 'truck-field-un', 'truck-field', 'truck-front', 'truck-medical', 'truck-monster', 'truck-moving', 'truck-pickup', 'truck-plane', 'truck-ramp-box', 'truck', 'tty', 'turkish-lira-sign', 'turn-down', 'turn-up', 'tv', 'u', 'umbrella-beach', 'umbrella', 'underline', 'universal-access', 'unlock-keyhole', 'unlock', 'up-down-left-right', 'up-down', 'up-long', 'up-right-and-down-left-from-center', 'up-right-from-square', 'upload', 'user-astronaut', 'user-check', 'user-clock', 'user-doctor', 'user-gear', 'user-graduate', 'user-group', 'user-injured', 'user-large-slash', 'user-large', 'user-lock', 'user-minus', 'user-ninja', 'user-nurse', 'user-pen', 'user-plus', 'user-secret', 'user-shield', 'user-slash', 'user-tag', 'user-tie', 'user-xmark', 'user', 'users-between-lines', 'users-gear', 'users-line', 'users-rays', 'users-rectangle', 'users-slash', 'users-viewfinder', 'users', 'utensils', 'v', 'van-shuttle', 'vault', 'vector-square', 'venus-double', 'venus-mars', 'venus', 'vest-patches', 'vest', 'vial-circle-check', 'vial-virus', 'vial', 'vials', 'video-slash', 'video', 'vihara', 'virus-covid-slash', 'virus-covid', 'virus-slash', 'virus', 'viruses', 'voicemail', 'volcano', 'volleyball', 'volume-high', 'volume-low', 'volume-off', 'volume-xmark', 'vr-cardboard', 'w', 'walkie-talkie', 'wallet', 'wand-magic-sparkles', 'wand-magic', 'wand-sparkles', 'warehouse', 'water-ladder', 'water', 'wave-square', 'web-awesome', 'weight-hanging', 'weight-scale', 'wheat-awn-circle-exclamation', 'wheat-awn', 'wheelchair-move', 'wheelchair', 'whiskey-glass', 'wifi', 'wind', 'window-maximize', 'window-minimize', 'window-restore', 'wine-bottle', 'wine-glass-empty', 'wine-glass', 'won-sign', 'worm', 'wrench', 'x-ray', 'x', 'xmark', 'xmarks-lines', 'y', 'yen-sign', 'yin-yang', 'z' ); - } else { - $font_awesome_icons_array = array_unique( array_merge( memberlite_get_font_awesome_icons( 'brand' ), memberlite_get_font_awesome_icons( 'regular' ), memberlite_get_font_awesome_icons( 'solid' ) ) ); - asort( $font_awesome_icons_array ); - return $font_awesome_icons_array; - } + if ( $type === 'brand' ) { + return array( '42-group', '500px', 'accessible-icon', 'accusoft', 'adn', 'adversal', 'affiliatetheme', 'airbnb', 'algolia', 'alipay', 'amazon-pay', 'amazon', 'amilia', 'android', 'angellist', 'angrycreative', 'angular', 'app-store-ios', 'app-store', 'apper', 'apple-pay', 'apple', 'artstation', 'asymmetrik', 'atlassian', 'audible', 'autoprefixer', 'avianex', 'aviato', 'aws', 'bandcamp', 'battle-net', 'behance', 'bilibili', 'bimobject', 'bitbucket', 'bitcoin', 'bity', 'black-tie', 'blackberry', 'blogger-b', 'blogger', 'bluesky', 'bluetooth-b', 'bluetooth', 'bootstrap', 'bots', 'brave-reverse', 'brave', 'btc', 'buffer', 'buromobelexperte', 'buy-n-large', 'buysellads', 'canadian-maple-leaf', 'cc-amazon-pay', 'cc-amex', 'cc-apple-pay', 'cc-diners-club', 'cc-discover', 'cc-jcb', 'cc-mastercard', 'cc-paypal', 'cc-stripe', 'cc-visa', 'centercode', 'centos', 'chrome', 'chromecast', 'cloudflare', 'cloudscale', 'cloudsmith', 'cloudversify', 'cmplid', 'codepen', 'codiepie', 'confluence', 'connectdevelop', 'contao', 'cotton-bureau', 'cpanel', 'creative-commons-by', 'creative-commons-nc-eu', 'creative-commons-nc-jp', 'creative-commons-nc', 'creative-commons-nd', 'creative-commons-pd-alt', 'creative-commons-pd', 'creative-commons-remix', 'creative-commons-sa', 'creative-commons-sampling-plus', 'creative-commons-sampling', 'creative-commons-share', 'creative-commons-zero', 'creative-commons', 'critical-role', 'css3-alt', 'css3', 'cuttlefish', 'd-and-d-beyond', 'd-and-d', 'dailymotion', 'dart-lang', 'dashcube', 'debian', 'deezer', 'delicious', 'deploydog', 'deskpro', 'dev', 'deviantart', 'dhl', 'diaspora', 'digg', 'digital-ocean', 'discord', 'discourse', 'dochub', 'docker', 'draft2digital', 'dribbble', 'dropbox', 'drupal', 'dyalog', 'earlybirds', 'ebay', 'edge-legacy', 'edge', 'elementor', 'ello', 'ember', 'empire', 'envira', 'erlang', 'ethereum', 'etsy', 'evernote', 'expeditedssl', 'facebook-f', 'facebook-messenger', 'facebook', 'fantasy-flight-games', 'fedex', 'fedora', 'figma', 'firefox-browser', 'firefox', 'first-order-alt', 'first-order', 'firstdraft', 'flickr', 'flipboard', 'flutter', 'fly', 'font-awesome', 'fonticons-fi', 'fonticons', 'fort-awesome-alt', 'fort-awesome', 'forumbee', 'foursquare', 'free-code-camp', 'freebsd', 'fulcrum', 'galactic-republic', 'galactic-senate', 'get-pocket', 'gg-circle', 'gg', 'git-alt', 'git', 'github-alt', 'github', 'gitkraken', 'gitlab', 'gitter', 'glide-g', 'glide', 'gofore', 'golang', 'goodreads-g', 'goodreads', 'google-drive', 'google-pay', 'google-play', 'google-plus-g', 'google-plus', 'google-scholar', 'google-wallet', 'google', 'gratipay', 'grav', 'gripfire', 'grunt', 'guilded', 'gulp', 'hacker-news', 'hackerrank', 'hashnode', 'hips', 'hire-a-helper', 'hive', 'hooli', 'hornbill', 'hotjar', 'houzz', 'html5', 'hubspot', 'ideal', 'imdb', 'instagram', 'instalod', 'intercom', 'internet-explorer', 'invision', 'ioxhost', 'itch-io', 'itunes-note', 'itunes', 'java', 'jedi-order', 'jenkins', 'jira', 'joget', 'joomla', 'js', 'jsfiddle', 'jxl', 'kaggle', 'keybase', 'keycdn', 'kickstarter-k', 'kickstarter', 'korvue', 'laravel', 'lastfm', 'leanpub', 'less', 'letterboxd', 'line', 'linkedin-in', 'linkedin', 'linode', 'linux', 'lyft', 'magento', 'mailchimp', 'mandalorian', 'markdown', 'mastodon', 'maxcdn', 'mdb', 'medapps', 'medium', 'medrt', 'meetup', 'megaport', 'mendeley', 'meta', 'microblog', 'microsoft', 'mintbit', 'mix', 'mixcloud', 'mixer', 'mizuni', 'modx', 'monero', 'napster', 'neos', 'nfc-directional', 'nfc-symbol', 'nimblr', 'node-js', 'node', 'npm', 'ns8', 'nutritionix', 'octopus-deploy', 'odnoklassniki', 'odysee', 'old-republic', 'opencart', 'openid', 'opensuse', 'opera', 'optin-monster', 'orcid', 'osi', 'padlet', 'page4', 'pagelines', 'palfed', 'patreon', 'paypal', 'perbyte', 'periscope', 'phabricator', 'phoenix-framework', 'phoenix-squadron', 'php', 'pied-piper-alt', 'pied-piper-hat', 'pied-piper-pp', 'pied-piper', 'pinterest-p', 'pinterest', 'pix', 'pixiv', 'playstation', 'product-hunt', 'pushed', 'python', 'qq', 'quinscape', 'quora', 'r-project', 'raspberry-pi', 'ravelry', 'react', 'reacteurope', 'readme', 'rebel', 'red-river', 'reddit-alien', 'reddit', 'redhat', 'renren', 'replyd', 'researchgate', 'resolving', 'rev', 'rocketchat', 'rockrms', 'rust', 'safari', 'salesforce', 'sass', 'schlix', 'screenpal', 'scribd', 'searchengin', 'sellcast', 'sellsy', 'servicestack', 'shirtsinbulk', 'shoelace', 'shopify', 'shopware', 'signal-messenger', 'simplybuilt', 'sistrix', 'sith', 'sitrox', 'sketch', 'skyatlas', 'skype', 'slack', 'slideshare', 'snapchat', 'soundcloud', 'sourcetree', 'space-awesome', 'speakap', 'speaker-deck', 'spotify', 'square-behance', 'square-dribbble', 'square-facebook', 'square-font-awesome-stroke', 'square-font-awesome', 'square-git', 'square-github', 'square-gitlab', 'square-google-plus', 'square-hacker-news', 'square-instagram', 'square-js', 'square-lastfm', 'square-letterboxd', 'square-odnoklassniki', 'square-pied-piper', 'square-pinterest', 'square-reddit', 'square-snapchat', 'square-steam', 'square-threads', 'square-tumblr', 'square-twitter', 'square-upwork', 'square-viadeo', 'square-vimeo', 'square-web-awesome-stroke', 'square-web-awesome', 'square-whatsapp', 'square-x-twitter', 'square-xing', 'square-youtube', 'squarespace', 'stack-exchange', 'stack-overflow', 'stackpath', 'staylinked', 'steam-symbol', 'steam', 'sticker-mule', 'strava', 'stripe-s', 'stripe', 'stubber', 'studiovinari', 'stumbleupon-circle', 'stumbleupon', 'superpowers', 'supple', 'suse', 'swift', 'symfony', 'teamspeak', 'telegram', 'tencent-weibo', 'the-red-yeti', 'themeco', 'themeisle', 'think-peaks', 'threads', 'tiktok', 'trade-federation', 'trello', 'tumblr', 'twitch', 'twitter', 'typo3', 'uber', 'ubuntu', 'uikit', 'umbraco', 'uncharted', 'uniregistry', 'unity', 'unsplash', 'untappd', 'ups', 'upwork', 'usb', 'usps', 'ussunnah', 'vaadin', 'viacoin', 'viadeo', 'viber', 'vimeo-v', 'vimeo', 'vine', 'vk', 'vnv', 'vuejs', 'watchman-monitoring', 'waze', 'web-awesome', 'webflow', 'weebly', 'weibo', 'weixin', 'whatsapp', 'whmcs', 'wikipedia-w', 'windows', 'wirsindhandwerk', 'wix', 'wizards-of-the-coast', 'wodu', 'wolf-pack-battalion', 'wordpress-simple', 'wordpress', 'wpbeginner', 'wpexplorer', 'wpforms', 'wpressr', 'x-twitter', 'xbox', 'xing', 'y-combinator', 'yahoo', 'yammer', 'yandex-international', 'yandex', 'yarn', 'yelp', 'yoast', 'youtube', 'zhihu' ); + } elseif ( $type === 'regular' ) { + return array( 'address-book', 'address-card', 'bell-slash', 'bell', 'bookmark', 'building', 'calendar-check', 'calendar-days', 'calendar-minus', 'calendar-plus', 'calendar-xmark', 'calendar', 'chart-bar', 'chess-bishop', 'chess-king', 'chess-knight', 'chess-pawn', 'chess-queen', 'chess-rook', 'circle-check', 'circle-dot', 'circle-down', 'circle-left', 'circle-pause', 'circle-play', 'circle-question', 'circle-right', 'circle-stop', 'circle-up', 'circle-user', 'circle-xmark', 'circle', 'clipboard', 'clock', 'clone', 'closed-captioning', 'comment-dots', 'comment', 'comments', 'compass', 'copy', 'copyright', 'credit-card', 'envelope-open', 'envelope', 'eye-slash', 'eye', 'face-angry', 'face-dizzy', 'face-flushed', 'face-frown-open', 'face-frown', 'face-grimace', 'face-grin-beam-sweat', 'face-grin-beam', 'face-grin-hearts', 'face-grin-squint-tears', 'face-grin-squint', 'face-grin-stars', 'face-grin-tears', 'face-grin-tongue-squint', 'face-grin-tongue-wink', 'face-grin-tongue', 'face-grin-wide', 'face-grin-wink', 'face-grin', 'face-kiss-beam', 'face-kiss-wink-heart', 'face-kiss', 'face-laugh-beam', 'face-laugh-squint', 'face-laugh-wink', 'face-laugh', 'face-meh-blank', 'face-meh', 'face-rolling-eyes', 'face-sad-cry', 'face-sad-tear', 'face-smile-beam', 'face-smile-wink', 'face-smile', 'face-surprise', 'face-tired', 'file-audio', 'file-code', 'file-excel', 'file-image', 'file-lines', 'file-pdf', 'file-powerpoint', 'file-video', 'file-word', 'file-zipper', 'file', 'flag', 'floppy-disk', 'folder-closed', 'folder-open', 'folder', 'font-awesome', 'futbol', 'gem', 'hand-back-fist', 'hand-lizard', 'hand-peace', 'hand-point-down', 'hand-point-left', 'hand-point-right', 'hand-point-up', 'hand-pointer', 'hand-scissors', 'hand-spock', 'hand', 'handshake', 'hard-drive', 'heart', 'hospital', 'hourglass-half', 'hourglass', 'id-badge', 'id-card', 'image', 'images', 'keyboard', 'lemon', 'life-ring', 'lightbulb', 'map', 'message', 'money-bill-1', 'moon', 'newspaper', 'note-sticky', 'object-group', 'object-ungroup', 'paper-plane', 'paste', 'pen-to-square', 'rectangle-list', 'rectangle-xmark', 'registered', 'share-from-square', 'snowflake', 'square-caret-down', 'square-caret-left', 'square-caret-right', 'square-caret-up', 'square-check', 'square-full', 'square-minus', 'square-plus', 'square', 'star-half-stroke', 'star-half', 'star', 'sun', 'thumbs-down', 'thumbs-up', 'trash-can', 'user', 'window-maximize', 'window-minimize', 'window-restore' ); + } elseif ( $type === 'solid' ) { + return array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'address-book', 'address-card', 'align-center', 'align-justify', 'align-left', 'align-right', 'anchor-circle-check', 'anchor-circle-exclamation', 'anchor-circle-xmark', 'anchor-lock', 'anchor', 'angle-down', 'angle-left', 'angle-right', 'angle-up', 'angles-down', 'angles-left', 'angles-right', 'angles-up', 'ankh', 'apple-whole', 'archway', 'arrow-down-1-9', 'arrow-down-9-1', 'arrow-down-a-z', 'arrow-down-long', 'arrow-down-short-wide', 'arrow-down-up-across-line', 'arrow-down-up-lock', 'arrow-down-wide-short', 'arrow-down-z-a', 'arrow-down', 'arrow-left-long', 'arrow-left', 'arrow-pointer', 'arrow-right-arrow-left', 'arrow-right-from-bracket', 'arrow-right-long', 'arrow-right-to-bracket', 'arrow-right-to-city', 'arrow-right', 'arrow-rotate-left', 'arrow-rotate-right', 'arrow-trend-down', 'arrow-trend-up', 'arrow-turn-down', 'arrow-turn-up', 'arrow-up-1-9', 'arrow-up-9-1', 'arrow-up-a-z', 'arrow-up-from-bracket', 'arrow-up-from-ground-water', 'arrow-up-from-water-pump', 'arrow-up-long', 'arrow-up-right-dots', 'arrow-up-right-from-square', 'arrow-up-short-wide', 'arrow-up-wide-short', 'arrow-up-z-a', 'arrow-up', 'arrows-down-to-line', 'arrows-down-to-people', 'arrows-left-right-to-line', 'arrows-left-right', 'arrows-rotate', 'arrows-spin', 'arrows-split-up-and-left', 'arrows-to-circle', 'arrows-to-dot', 'arrows-to-eye', 'arrows-turn-right', 'arrows-turn-to-dots', 'arrows-up-down-left-right', 'arrows-up-down', 'arrows-up-to-line', 'asterisk', 'at', 'atom', 'audio-description', 'austral-sign', 'award', 'b', 'baby-carriage', 'baby', 'backward-fast', 'backward-step', 'backward', 'bacon', 'bacteria', 'bacterium', 'bag-shopping', 'bahai', 'baht-sign', 'ban-smoking', 'ban', 'bandage', 'bangladeshi-taka-sign', 'barcode', 'bars-progress', 'bars-staggered', 'bars', 'baseball-bat-ball', 'baseball', 'basket-shopping', 'basketball', 'bath', 'battery-empty', 'battery-full', 'battery-half', 'battery-quarter', 'battery-three-quarters', 'bed-pulse', 'bed', 'beer-mug-empty', 'bell-concierge', 'bell-slash', 'bell', 'bezier-curve', 'bicycle', 'binoculars', 'biohazard', 'bitcoin-sign', 'blender-phone', 'blender', 'blog', 'bold', 'bolt-lightning', 'bolt', 'bomb', 'bone', 'bong', 'book-atlas', 'book-bible', 'book-bookmark', 'book-journal-whills', 'book-medical', 'book-open-reader', 'book-open', 'book-quran', 'book-skull', 'book-tanakh', 'book', 'bookmark', 'border-all', 'border-none', 'border-top-left', 'bore-hole', 'bottle-droplet', 'bottle-water', 'bowl-food', 'bowl-rice', 'bowling-ball', 'box-archive', 'box-open', 'box-tissue', 'box', 'boxes-packing', 'boxes-stacked', 'braille', 'brain', 'brazilian-real-sign', 'bread-slice', 'bridge-circle-check', 'bridge-circle-exclamation', 'bridge-circle-xmark', 'bridge-lock', 'bridge-water', 'bridge', 'briefcase-medical', 'briefcase', 'broom-ball', 'broom', 'brush', 'bucket', 'bug-slash', 'bug', 'bugs', 'building-circle-arrow-right', 'building-circle-check', 'building-circle-exclamation', 'building-circle-xmark', 'building-columns', 'building-flag', 'building-lock', 'building-ngo', 'building-shield', 'building-un', 'building-user', 'building-wheat', 'building', 'bullhorn', 'bullseye', 'burger', 'burst', 'bus-simple', 'bus', 'business-time', 'c', 'cable-car', 'cake-candles', 'calculator', 'calendar-check', 'calendar-day', 'calendar-days', 'calendar-minus', 'calendar-plus', 'calendar-week', 'calendar-xmark', 'calendar', 'camera-retro', 'camera-rotate', 'camera', 'campground', 'candy-cane', 'cannabis', 'capsules', 'car-battery', 'car-burst', 'car-on', 'car-rear', 'car-side', 'car-tunnel', 'car', 'caravan', 'caret-down', 'caret-left', 'caret-right', 'caret-up', 'carrot', 'cart-arrow-down', 'cart-flatbed-suitcase', 'cart-flatbed', 'cart-plus', 'cart-shopping', 'cash-register', 'cat', 'cedi-sign', 'cent-sign', 'certificate', 'chair', 'chalkboard-user', 'chalkboard', 'champagne-glasses', 'charging-station', 'chart-area', 'chart-bar', 'chart-column', 'chart-gantt', 'chart-line', 'chart-pie', 'chart-simple', 'check-double', 'check-to-slot', 'check', 'cheese', 'chess-bishop', 'chess-board', 'chess-king', 'chess-knight', 'chess-pawn', 'chess-queen', 'chess-rook', 'chess', 'chevron-down', 'chevron-left', 'chevron-right', 'chevron-up', 'child-combatant', 'child-dress', 'child-reaching', 'child', 'children', 'church', 'circle-arrow-down', 'circle-arrow-left', 'circle-arrow-right', 'circle-arrow-up', 'circle-check', 'circle-chevron-down', 'circle-chevron-left', 'circle-chevron-right', 'circle-chevron-up', 'circle-dollar-to-slot', 'circle-dot', 'circle-down', 'circle-exclamation', 'circle-h', 'circle-half-stroke', 'circle-info', 'circle-left', 'circle-minus', 'circle-nodes', 'circle-notch', 'circle-pause', 'circle-play', 'circle-plus', 'circle-question', 'circle-radiation', 'circle-right', 'circle-stop', 'circle-up', 'circle-user', 'circle-xmark', 'circle', 'city', 'clapperboard', 'clipboard-check', 'clipboard-list', 'clipboard-question', 'clipboard-user', 'clipboard', 'clock-rotate-left', 'clock', 'clone', 'closed-captioning', 'cloud-arrow-down', 'cloud-arrow-up', 'cloud-bolt', 'cloud-meatball', 'cloud-moon-rain', 'cloud-moon', 'cloud-rain', 'cloud-showers-heavy', 'cloud-showers-water', 'cloud-sun-rain', 'cloud-sun', 'cloud', 'clover', 'code-branch', 'code-commit', 'code-compare', 'code-fork', 'code-merge', 'code-pull-request', 'code', 'coins', 'colon-sign', 'comment-dollar', 'comment-dots', 'comment-medical', 'comment-slash', 'comment-sms', 'comment', 'comments-dollar', 'comments', 'compact-disc', 'compass-drafting', 'compass', 'compress', 'computer-mouse', 'computer', 'cookie-bite', 'cookie', 'copy', 'copyright', 'couch', 'cow', 'credit-card', 'crop-simple', 'crop', 'cross', 'crosshairs', 'crow', 'crown', 'crutch', 'cruzeiro-sign', 'cube', 'cubes-stacked', 'cubes', 'd', 'database', 'delete-left', 'democrat', 'desktop', 'dharmachakra', 'diagram-next', 'diagram-predecessor', 'diagram-project', 'diagram-successor', 'diamond-turn-right', 'diamond', 'dice-d6', 'dice-d20', 'dice-five', 'dice-four', 'dice-one', 'dice-six', 'dice-three', 'dice-two', 'dice', 'disease', 'display', 'divide', 'dna', 'dog', 'dollar-sign', 'dolly', 'dong-sign', 'door-closed', 'door-open', 'dove', 'down-left-and-up-right-to-center', 'down-long', 'download', 'dragon', 'draw-polygon', 'droplet-slash', 'droplet', 'drum-steelpan', 'drum', 'drumstick-bite', 'dumbbell', 'dumpster-fire', 'dumpster', 'dungeon', 'e', 'ear-deaf', 'ear-listen', 'earth-africa', 'earth-americas', 'earth-asia', 'earth-europe', 'earth-oceania', 'egg', 'eject', 'elevator', 'ellipsis-vertical', 'ellipsis', 'envelope-circle-check', 'envelope-open-text', 'envelope-open', 'envelope', 'envelopes-bulk', 'equals', 'eraser', 'ethernet', 'euro-sign', 'exclamation', 'expand', 'explosion', 'eye-dropper', 'eye-low-vision', 'eye-slash', 'eye', 'f', 'face-angry', 'face-dizzy', 'face-flushed', 'face-frown-open', 'face-frown', 'face-grimace', 'face-grin-beam-sweat', 'face-grin-beam', 'face-grin-hearts', 'face-grin-squint-tears', 'face-grin-squint', 'face-grin-stars', 'face-grin-tears', 'face-grin-tongue-squint', 'face-grin-tongue-wink', 'face-grin-tongue', 'face-grin-wide', 'face-grin-wink', 'face-grin', 'face-kiss-beam', 'face-kiss-wink-heart', 'face-kiss', 'face-laugh-beam', 'face-laugh-squint', 'face-laugh-wink', 'face-laugh', 'face-meh-blank', 'face-meh', 'face-rolling-eyes', 'face-sad-cry', 'face-sad-tear', 'face-smile-beam', 'face-smile-wink', 'face-smile', 'face-surprise', 'face-tired', 'fan', 'faucet-drip', 'faucet', 'fax', 'feather-pointed', 'feather', 'ferry', 'file-arrow-down', 'file-arrow-up', 'file-audio', 'file-circle-check', 'file-circle-exclamation', 'file-circle-minus', 'file-circle-plus', 'file-circle-question', 'file-circle-xmark', 'file-code', 'file-contract', 'file-csv', 'file-excel', 'file-export', 'file-image', 'file-import', 'file-invoice-dollar', 'file-invoice', 'file-lines', 'file-medical', 'file-pdf', 'file-pen', 'file-powerpoint', 'file-prescription', 'file-shield', 'file-signature', 'file-video', 'file-waveform', 'file-word', 'file-zipper', 'file', 'fill-drip', 'fill', 'film', 'filter-circle-dollar', 'filter-circle-xmark', 'filter', 'fingerprint', 'fire-burner', 'fire-extinguisher', 'fire-flame-curved', 'fire-flame-simple', 'fire', 'fish-fins', 'fish', 'flag-checkered', 'flag-usa', 'flag', 'flask-vial', 'flask', 'floppy-disk', 'florin-sign', 'folder-closed', 'folder-minus', 'folder-open', 'folder-plus', 'folder-tree', 'folder', 'font-awesome', 'font', 'football', 'forward-fast', 'forward-step', 'forward', 'franc-sign', 'frog', 'futbol', 'g', 'gamepad', 'gas-pump', 'gauge-high', 'gauge-simple-high', 'gauge-simple', 'gauge', 'gavel', 'gear', 'gears', 'gem', 'genderless', 'ghost', 'gift', 'gifts', 'glass-water-droplet', 'glass-water', 'glasses', 'globe', 'golf-ball-tee', 'gopuram', 'graduation-cap', 'greater-than-equal', 'greater-than', 'grip-lines-vertical', 'grip-lines', 'grip-vertical', 'grip', 'group-arrows-rotate', 'guarani-sign', 'guitar', 'gun', 'h', 'hammer', 'hamsa', 'hand-back-fist', 'hand-dots', 'hand-fist', 'hand-holding-dollar', 'hand-holding-droplet', 'hand-holding-hand', 'hand-holding-heart', 'hand-holding-medical', 'hand-holding', 'hand-lizard', 'hand-middle-finger', 'hand-peace', 'hand-point-down', 'hand-point-left', 'hand-point-right', 'hand-point-up', 'hand-pointer', 'hand-scissors', 'hand-sparkles', 'hand-spock', 'hand', 'handcuffs', 'hands-asl-interpreting', 'hands-bound', 'hands-bubbles', 'hands-clapping', 'hands-holding-child', 'hands-holding-circle', 'hands-holding', 'hands-praying', 'hands', 'handshake-angle', 'handshake-simple-slash', 'handshake-simple', 'handshake-slash', 'handshake', 'hanukiah', 'hard-drive', 'hashtag', 'hat-cowboy-side', 'hat-cowboy', 'hat-wizard', 'head-side-cough-slash', 'head-side-cough', 'head-side-mask', 'head-side-virus', 'heading', 'headphones-simple', 'headphones', 'headset', 'heart-circle-bolt', 'heart-circle-check', 'heart-circle-exclamation', 'heart-circle-minus', 'heart-circle-plus', 'heart-circle-xmark', 'heart-crack', 'heart-pulse', 'heart', 'helicopter-symbol', 'helicopter', 'helmet-safety', 'helmet-un', 'highlighter', 'hill-avalanche', 'hill-rockslide', 'hippo', 'hockey-puck', 'holly-berry', 'horse-head', 'horse', 'hospital-user', 'hospital', 'hot-tub-person', 'hotdog', 'hotel', 'hourglass-end', 'hourglass-half', 'hourglass-start', 'hourglass', 'house-chimney-crack', 'house-chimney-medical', 'house-chimney-user', 'house-chimney-window', 'house-chimney', 'house-circle-check', 'house-circle-exclamation', 'house-circle-xmark', 'house-crack', 'house-fire', 'house-flag', 'house-flood-water-circle-arrow-right', 'house-flood-water', 'house-laptop', 'house-lock', 'house-medical-circle-check', 'house-medical-circle-exclamation', 'house-medical-circle-xmark', 'house-medical-flag', 'house-medical', 'house-signal', 'house-tsunami', 'house-user', 'house', 'hryvnia-sign', 'hurricane', 'i-cursor', 'i', 'ice-cream', 'icicles', 'icons', 'id-badge', 'id-card-clip', 'id-card', 'igloo', 'image-portrait', 'image', 'images', 'inbox', 'indent', 'indian-rupee-sign', 'industry', 'infinity', 'info', 'italic', 'j', 'jar-wheat', 'jar', 'jedi', 'jet-fighter-up', 'jet-fighter', 'joint', 'jug-detergent', 'k', 'kaaba', 'key', 'keyboard', 'khanda', 'kip-sign', 'kit-medical', 'kitchen-set', 'kiwi-bird', 'l', 'land-mine-on', 'landmark-dome', 'landmark-flag', 'landmark', 'language', 'laptop-code', 'laptop-file', 'laptop-medical', 'laptop', 'lari-sign', 'layer-group', 'leaf', 'left-long', 'left-right', 'lemon', 'less-than-equal', 'less-than', 'life-ring', 'lightbulb', 'lines-leaning', 'link-slash', 'link', 'lira-sign', 'list-check', 'list-ol', 'list-ul', 'list', 'litecoin-sign', 'location-arrow', 'location-crosshairs', 'location-dot', 'location-pin-lock', 'location-pin', 'lock-open', 'lock', 'locust', 'lungs-virus', 'lungs', 'm', 'magnet', 'magnifying-glass-arrow-right', 'magnifying-glass-chart', 'magnifying-glass-dollar', 'magnifying-glass-location', 'magnifying-glass-minus', 'magnifying-glass-plus', 'magnifying-glass', 'manat-sign', 'map-location-dot', 'map-location', 'map-pin', 'map', 'marker', 'mars-and-venus-burst', 'mars-and-venus', 'mars-double', 'mars-stroke-right', 'mars-stroke-up', 'mars-stroke', 'mars', 'martini-glass-citrus', 'martini-glass-empty', 'martini-glass', 'mask-face', 'mask-ventilator', 'mask', 'masks-theater', 'mattress-pillow', 'maximize', 'medal', 'memory', 'menorah', 'mercury', 'message', 'meteor', 'microchip', 'microphone-lines-slash', 'microphone-lines', 'microphone-slash', 'microphone', 'microscope', 'mill-sign', 'minimize', 'minus', 'mitten', 'mobile-button', 'mobile-retro', 'mobile-screen-button', 'mobile-screen', 'mobile', 'money-bill-1-wave', 'money-bill-1', 'money-bill-transfer', 'money-bill-trend-up', 'money-bill-wave', 'money-bill-wheat', 'money-bill', 'money-bills', 'money-check-dollar', 'money-check', 'monument', 'moon', 'mortar-pestle', 'mosque', 'mosquito-net', 'mosquito', 'motorcycle', 'mound', 'mountain-city', 'mountain-sun', 'mountain', 'mug-hot', 'mug-saucer', 'music', 'n', 'naira-sign', 'network-wired', 'neuter', 'newspaper', 'not-equal', 'notdef', 'note-sticky', 'notes-medical', 'o', 'object-group', 'object-ungroup', 'oil-can', 'oil-well', 'om', 'otter', 'outdent', 'p', 'pager', 'paint-roller', 'paintbrush', 'palette', 'pallet', 'panorama', 'paper-plane', 'paperclip', 'parachute-box', 'paragraph', 'passport', 'paste', 'pause', 'paw', 'peace', 'pen-clip', 'pen-fancy', 'pen-nib', 'pen-ruler', 'pen-to-square', 'pen', 'pencil', 'people-arrows', 'people-carry-box', 'people-group', 'people-line', 'people-pulling', 'people-robbery', 'people-roof', 'pepper-hot', 'percent', 'person-arrow-down-to-line', 'person-arrow-up-from-line', 'person-biking', 'person-booth', 'person-breastfeeding', 'person-burst', 'person-cane', 'person-chalkboard', 'person-circle-check', 'person-circle-exclamation', 'person-circle-minus', 'person-circle-plus', 'person-circle-question', 'person-circle-xmark', 'person-digging', 'person-dots-from-line', 'person-dress-burst', 'person-dress', 'person-drowning', 'person-falling-burst', 'person-falling', 'person-half-dress', 'person-harassing', 'person-hiking', 'person-military-pointing', 'person-military-rifle', 'person-military-to-person', 'person-praying', 'person-pregnant', 'person-rays', 'person-rifle', 'person-running', 'person-shelter', 'person-skating', 'person-skiing-nordic', 'person-skiing', 'person-snowboarding', 'person-swimming', 'person-through-window', 'person-walking-arrow-loop-left', 'person-walking-arrow-right', 'person-walking-dashed-line-arrow-right', 'person-walking-luggage', 'person-walking-with-cane', 'person-walking', 'person', 'peseta-sign', 'peso-sign', 'phone-flip', 'phone-slash', 'phone-volume', 'phone', 'photo-film', 'piggy-bank', 'pills', 'pizza-slice', 'place-of-worship', 'plane-arrival', 'plane-circle-check', 'plane-circle-exclamation', 'plane-circle-xmark', 'plane-departure', 'plane-lock', 'plane-slash', 'plane-up', 'plane', 'plant-wilt', 'plate-wheat', 'play', 'plug-circle-bolt', 'plug-circle-check', 'plug-circle-exclamation', 'plug-circle-minus', 'plug-circle-plus', 'plug-circle-xmark', 'plug', 'plus-minus', 'plus', 'podcast', 'poo-storm', 'poo', 'poop', 'power-off', 'prescription-bottle-medical', 'prescription-bottle', 'prescription', 'print', 'pump-medical', 'pump-soap', 'puzzle-piece', 'q', 'qrcode', 'question', 'quote-left', 'quote-right', 'r', 'radiation', 'radio', 'rainbow', 'ranking-star', 'receipt', 'record-vinyl', 'rectangle-ad', 'rectangle-list', 'rectangle-xmark', 'recycle', 'registered', 'repeat', 'reply-all', 'reply', 'republican', 'restroom', 'retweet', 'ribbon', 'right-from-bracket', 'right-left', 'right-long', 'right-to-bracket', 'ring', 'road-barrier', 'road-bridge', 'road-circle-check', 'road-circle-exclamation', 'road-circle-xmark', 'road-lock', 'road-spikes', 'road', 'robot', 'rocket', 'rotate-left', 'rotate-right', 'rotate', 'route', 'rss', 'ruble-sign', 'rug', 'ruler-combined', 'ruler-horizontal', 'ruler-vertical', 'ruler', 'rupee-sign', 'rupiah-sign', 's', 'sack-dollar', 'sack-xmark', 'sailboat', 'satellite-dish', 'satellite', 'scale-balanced', 'scale-unbalanced-flip', 'scale-unbalanced', 'school-circle-check', 'school-circle-exclamation', 'school-circle-xmark', 'school-flag', 'school-lock', 'school', 'scissors', 'screwdriver-wrench', 'screwdriver', 'scroll-torah', 'scroll', 'sd-card', 'section', 'seedling', 'server', 'shapes', 'share-from-square', 'share-nodes', 'share', 'sheet-plastic', 'shekel-sign', 'shield-cat', 'shield-dog', 'shield-halved', 'shield-heart', 'shield-virus', 'shield', 'ship', 'shirt', 'shoe-prints', 'shop-lock', 'shop-slash', 'shop', 'shower', 'shrimp', 'shuffle', 'shuttle-space', 'sign-hanging', 'signal', 'signature', 'signs-post', 'sim-card', 'sink', 'sitemap', 'skull-crossbones', 'skull', 'slash', 'sleigh', 'sliders', 'smog', 'smoking', 'snowflake', 'snowman', 'snowplow', 'soap', 'socks', 'solar-panel', 'sort-down', 'sort-up', 'sort', 'spa', 'spaghetti-monster-flying', 'spell-check', 'spider', 'spinner', 'splotch', 'spoon', 'spray-can-sparkles', 'spray-can', 'square-arrow-up-right', 'square-caret-down', 'square-caret-left', 'square-caret-right', 'square-caret-up', 'square-check', 'square-envelope', 'square-full', 'square-h', 'square-minus', 'square-nfi', 'square-parking', 'square-pen', 'square-person-confined', 'square-phone-flip', 'square-phone', 'square-plus', 'square-poll-horizontal', 'square-poll-vertical', 'square-root-variable', 'square-rss', 'square-share-nodes', 'square-up-right', 'square-virus', 'square-xmark', 'square', 'staff-snake', 'stairs', 'stamp', 'stapler', 'star-and-crescent', 'star-half-stroke', 'star-half', 'star-of-david', 'star-of-life', 'star', 'sterling-sign', 'stethoscope', 'stop', 'stopwatch-20', 'stopwatch', 'store-slash', 'store', 'street-view', 'strikethrough', 'stroopwafel', 'subscript', 'suitcase-medical', 'suitcase-rolling', 'suitcase', 'sun-plant-wilt', 'sun', 'superscript', 'swatchbook', 'synagogue', 'syringe', 't', 'table-cells-column-lock', 'table-cells-large', 'table-cells-row-lock', 'table-cells-row-unlock', 'table-cells', 'table-columns', 'table-list', 'table-tennis-paddle-ball', 'table', 'tablet-button', 'tablet-screen-button', 'tablet', 'tablets', 'tachograph-digital', 'tag', 'tags', 'tape', 'tarp-droplet', 'tarp', 'taxi', 'teeth-open', 'teeth', 'temperature-arrow-down', 'temperature-arrow-up', 'temperature-empty', 'temperature-full', 'temperature-half', 'temperature-high', 'temperature-low', 'temperature-quarter', 'temperature-three-quarters', 'tenge-sign', 'tent-arrow-down-to-line', 'tent-arrow-left-right', 'tent-arrow-turn-left', 'tent-arrows-down', 'tent', 'tents', 'terminal', 'text-height', 'text-slash', 'text-width', 'thermometer', 'thumbs-down', 'thumbs-up', 'thumbtack-slash', 'thumbtack', 'ticket-simple', 'ticket', 'timeline', 'toggle-off', 'toggle-on', 'toilet-paper-slash', 'toilet-paper', 'toilet-portable', 'toilet', 'toilets-portable', 'toolbox', 'tooth', 'torii-gate', 'tornado', 'tower-broadcast', 'tower-cell', 'tower-observation', 'tractor', 'trademark', 'traffic-light', 'trailer', 'train-subway', 'train-tram', 'train', 'transgender', 'trash-arrow-up', 'trash-can-arrow-up', 'trash-can', 'trash', 'tree-city', 'tree', 'triangle-exclamation', 'trophy', 'trowel-bricks', 'trowel', 'truck-arrow-right', 'truck-droplet', 'truck-fast', 'truck-field-un', 'truck-field', 'truck-front', 'truck-medical', 'truck-monster', 'truck-moving', 'truck-pickup', 'truck-plane', 'truck-ramp-box', 'truck', 'tty', 'turkish-lira-sign', 'turn-down', 'turn-up', 'tv', 'u', 'umbrella-beach', 'umbrella', 'underline', 'universal-access', 'unlock-keyhole', 'unlock', 'up-down-left-right', 'up-down', 'up-long', 'up-right-and-down-left-from-center', 'up-right-from-square', 'upload', 'user-astronaut', 'user-check', 'user-clock', 'user-doctor', 'user-gear', 'user-graduate', 'user-group', 'user-injured', 'user-large-slash', 'user-large', 'user-lock', 'user-minus', 'user-ninja', 'user-nurse', 'user-pen', 'user-plus', 'user-secret', 'user-shield', 'user-slash', 'user-tag', 'user-tie', 'user-xmark', 'user', 'users-between-lines', 'users-gear', 'users-line', 'users-rays', 'users-rectangle', 'users-slash', 'users-viewfinder', 'users', 'utensils', 'v', 'van-shuttle', 'vault', 'vector-square', 'venus-double', 'venus-mars', 'venus', 'vest-patches', 'vest', 'vial-circle-check', 'vial-virus', 'vial', 'vials', 'video-slash', 'video', 'vihara', 'virus-covid-slash', 'virus-covid', 'virus-slash', 'virus', 'viruses', 'voicemail', 'volcano', 'volleyball', 'volume-high', 'volume-low', 'volume-off', 'volume-xmark', 'vr-cardboard', 'w', 'walkie-talkie', 'wallet', 'wand-magic-sparkles', 'wand-magic', 'wand-sparkles', 'warehouse', 'water-ladder', 'water', 'wave-square', 'web-awesome', 'weight-hanging', 'weight-scale', 'wheat-awn-circle-exclamation', 'wheat-awn', 'wheelchair-move', 'wheelchair', 'whiskey-glass', 'wifi', 'wind', 'window-maximize', 'window-minimize', 'window-restore', 'wine-bottle', 'wine-glass-empty', 'wine-glass', 'won-sign', 'worm', 'wrench', 'x-ray', 'x', 'xmark', 'xmarks-lines', 'y', 'yen-sign', 'yin-yang', 'z' ); + } else { + $font_awesome_icons_array = array_unique( array_merge( memberlite_get_font_awesome_icons( 'brand' ), memberlite_get_font_awesome_icons( 'regular' ), memberlite_get_font_awesome_icons( 'solid' ) ) ); + asort( $font_awesome_icons_array ); + return $font_awesome_icons_array; + } } \ No newline at end of file diff --git a/inc/updates.php b/inc/updates.php index e5d956ed..e72090ad 100644 --- a/inc/updates.php +++ b/inc/updates.php @@ -5,31 +5,136 @@ * After running an update, sets memberlite_db_version to the version of the last update run. * Update versions are based on the date they were released. YYYYMMDD01, YYYYMMDD02. * Hopefully we don't release more than 99 updates in any given day. + * + * @package Memberlite + * @since 4.0 + */ + +// Ensure defaults.php and deprecated.php are loaded for color migration functions. +require_once get_template_directory() . '/inc/defaults.php'; +require_once get_template_directory() . '/inc/deprecated.php'; + +/** + * Check for updates and run migration scripts. + * + * @since 4.0 */ function memberlite_checkForUpdates() { - $memberlite_db_version = get_option('memberlite_db_version', 0); + $memberlite_db_version = get_option( 'memberlite_db_version', 0 ); - // default DB version for Memberlite 4.0 + // Default DB version for Memberlite 4.0 if ( empty( $memberlite_db_version ) ) { $memberlite_db_version = '2018080101'; - update_option('memberlite_db_version', $memberlite_db_version, 'no'); + update_option( 'memberlite_db_version', $memberlite_db_version, 'no' ); } // Migrate the theme_mod for webfonts to single properties. - // Update the database version to 2025032601 if ( $memberlite_db_version < '2025032601' ) { $memberlite_webfonts = get_theme_mod( 'memberlite_webfonts' ); if ( ! empty( $memberlite_webfonts ) ) { - // Break the theme mod for custom fonts into two parts. - $fonts_string_parts = explode( '_', $memberlite_webfonts ); + $fonts_string_parts = explode( '_', $memberlite_webfonts ); $memberlite_header_font = $fonts_string_parts[0]; - $memberlite_body_font = $fonts_string_parts[1]; + $memberlite_body_font = $fonts_string_parts[1]; set_theme_mod( 'memberlite_header_font', $memberlite_header_font ); set_theme_mod( 'memberlite_body_font', $memberlite_body_font ); remove_theme_mod( 'memberlite_webfonts' ); } update_option( 'memberlite_db_version', '2025032601', 'no' ); } + + // Migrate color scheme to individual theme_mods. + if ( $memberlite_db_version < '2026020401' ) { + memberlite_migrate_colors_to_theme_mods(); + update_option( 'memberlite_db_version', '2026020401', 'no' ); + } +} + +/** + * Migrate color scheme to individual theme_mods. + * + * This migration handles three scenarios: + * 1. User has a legacy scheme selected (from deprecated.php) → expand to 18 theme_mods, set scheme to 'custom' + * 2. User has a new scheme selected → expand to 18 theme_mods, keep scheme setting + * 3. User has custom colors already → preserve them, set scheme to 'custom' + * + * After migration, the 18 individual color theme_mods are the single source of truth. + * + * @since 6.2 + */ +function memberlite_migrate_colors_to_theme_mods() { + $color_keys = memberlite_get_color_setting_keys(); + + // Check for old scheme theme_mods (could be 'memberlite_color_scheme' or 'memberlite_variation_color_scheme') + $current_scheme = get_theme_mod( 'memberlite_color_scheme', '' ); + if ( empty( $current_scheme ) ) { + $current_scheme = get_theme_mod( 'memberlite_variation_color_scheme', '' ); + } + + $colors = array(); + $final_scheme = 'default'; + + // Try to get colors from a scheme + if ( ! empty( $current_scheme ) && 'custom' !== $current_scheme ) { + // First check if it's a modern scheme + $modern_schemes = memberlite_get_color_schemes(); + + if ( isset( $modern_schemes[ $current_scheme ] ) ) { + $colors = $modern_schemes[ $current_scheme ]['colors']; + $final_scheme = $current_scheme; + } else { + // Check if it's a legacy scheme + $legacy_definitions = memberlite_get_legacy_color_scheme_definitions(); + + if ( isset( $legacy_definitions[ $current_scheme ] ) ) { + $colors = $legacy_definitions[ $current_scheme ]['colors']; + $final_scheme = 'custom'; // Legacy schemes become custom + } + } + } + + // If no scheme colors found, use default + if ( empty( $colors ) ) { + $default_colors = memberlite_get_default_colors(); + $colors = $default_colors; + $final_scheme = 'default'; + } + + // Check if user has any custom color overrides + $has_custom_colors = false; + foreach ( $color_keys as $key ) { + $existing = get_theme_mod( $key, '' ); + if ( ! empty( $existing ) ) { + $has_custom_colors = true; + break; + } + } + + // Save all 18 colors as individual theme_mods + foreach ( $color_keys as $key ) { + $existing_value = get_theme_mod( $key, '' ); + + // If user already has a custom value for this color, preserve it + if ( ! empty( $existing_value ) ) { + continue; + } + + // Otherwise, save the scheme's color value + if ( isset( $colors[ $key ] ) ) { + set_theme_mod( $key, $colors[ $key ] ); + } + } + + // Set the scheme - if they had custom colors, mark as custom + if ( $has_custom_colors ) { + $final_scheme = 'custom'; + } + + set_theme_mod( 'memberlite_color_scheme', $final_scheme ); + + // Clean up old theme_mods and options + remove_theme_mod( 'memberlite_variation_color_scheme' ); + delete_option( 'memberlite_scheme_synced' ); + delete_option( 'memberlite_user_legacy_scheme' ); } /** @@ -66,16 +171,16 @@ function memberlite_get_update_info() { // Query the server if we do not have the local $update_info or we force checking for an update. if ( empty( $update_info ) || ! empty( $_REQUEST['force-check'] ) || current_time('timestamp') > $update_info_timestamp + 86400 ) { /** - * Filter to change the timeout for this wp_remote_get() request for updates. - * @since 6.0 + * Filter to change the timeout for this wp_remote_get() request for updates. + * @since 6.0 * - * @param int $timeout The number of seconds before the request times out - */ - $timeout = apply_filters( 'memberlite_get_update_info_timeout', 5 ); + * @param int $timeout The number of seconds before the request times out + */ + $timeout = apply_filters( 'memberlite_get_update_info_timeout', 5 ); $remote_info = wp_remote_get( PMPRO_LICENSE_SERVER . 'themes/', $timeout ); // Test response. - if ( is_wp_error( $remote_info ) || empty( $remote_info['response'] ) || $remote_info['response']['code'] != '200' ) { + if ( is_wp_error( $remote_info ) || empty( $remote_info['response'] ) || $remote_info['response']['code'] != '200' ) { // Error. return new WP_Error( 'connection_error', 'Could not connect to the PMPro License Server to get update information. Try again later.' ); } else { diff --git a/js/admin-page_banners.js b/js/admin-page_banners.js index 385e54dc..28afd79a 100644 --- a/js/admin-page_banners.js +++ b/js/admin-page_banners.js @@ -23,12 +23,12 @@ jQuery('input[name=memberlite_banner_show]').bind('keyup change', function() { m * Borrowed from CMB2: https://github.com/CMB2/CMB2/pull/1190 */ if (wp.data && window.tinymce) { - wp.data.subscribe(function () { - // the post is currently being saved && we have tinymce editors - if (wp.data.select( 'core/editor' ).isSavingPost() && window.tinymce.editors) { - for (var i = 0; i < tinymce.editors.length; i++) { - tinymce.editors[i].save(); - } - } - }); + wp.data.subscribe(function () { + // the post is currently being saved && we have tinymce editors + if (wp.data.select( 'core/editor' ).isSavingPost() && window.tinymce.editors) { + for (var i = 0; i < tinymce.editors.length; i++) { + tinymce.editors[i].save(); + } + } + }); } \ No newline at end of file diff --git a/js/customizer-controls.js b/js/customizer-controls.js index dcc47159..31d76f44 100644 --- a/js/customizer-controls.js +++ b/js/customizer-controls.js @@ -1,63 +1,185 @@ -( function( $ ) { - var memberlite_color_controls, memberlite_color_controls_listener_flag; - memberlite_color_controls = [ - 'header_textcolor', - 'background_color', - 'memberlite_bgcolor_header', - 'memberlite_bgcolor_site_navigation', - 'memberlite_color_site_navigation', - 'memberlite_color_text', - 'memberlite_color_link', - 'memberlite_color_meta_link', - 'memberlite_color_primary', - 'memberlite_color_secondary', - 'memberlite_color_action', - 'memberlite_color_button', - 'memberlite_bgcolor_page_masthead', - 'memberlite_color_page_masthead', - 'memberlite_bgcolor_footer_widgets', - 'memberlite_color_footer_widgets', - ]; - memberlite_color_controls_listener_flag = true; - - // Update colors when color scheme changes. - wp.customize( - 'memberlite_color_scheme', function( value ) { - value.bind( - function( to ) { - - // ignore "custom" - if (to != 'custom') { - // update colors - var colors, header_logo; - colors = colorSchemes[to].colors; - memberlite_color_controls_listener_flag = false; - header_logo = $( '#customize-control-display_header_text' ).find( 'input:checked' ); - - for (i = 0; i < 15; i++) { - if (header_logo.length || i > 0) { - $( '#customize-control-' + memberlite_color_controls[i] ).find( '.color-picker-hex' ).wpColorPicker( 'color', colors[i] ); - } +(function ($) { + 'use strict'; + + // Get scheme data from localized script (passed from customizer.php) + // colorSchemes: { scheme_key: { label: '...', colors: { key: value, ... } }, ... } + // colorSettingKeys: [ 'header_textcolor', 'background_color', ... ] + + // Flag to prevent infinite loop when programmatically updating colors + let isUpdatingFromScheme = false; + + // Mapping from theme_mod keys to Customizer control IDs + // Most controls use memberlite_ prefix, some are WordPress core + const colorControlMapping = { + 'header_textcolor': 'header_textcolor', + 'background_color': 'background_color', + 'bgcolor_header': 'memberlite_bgcolor_header', + 'bgcolor_site_navigation': 'memberlite_bgcolor_site_navigation', + 'color_site_navigation': 'memberlite_color_site_navigation', + 'color_text': 'memberlite_color_text', + 'color_link': 'memberlite_color_link', + 'color_meta_link': 'memberlite_color_meta_link', + 'color_primary': 'memberlite_color_primary', + 'color_secondary': 'memberlite_color_secondary', + 'color_action': 'memberlite_color_action', + 'color_button': 'memberlite_color_button', + 'bgcolor_page_masthead': 'memberlite_bgcolor_page_masthead', + 'color_page_masthead': 'memberlite_color_page_masthead', + 'bgcolor_footer_widgets': 'memberlite_bgcolor_footer_widgets', + 'color_footer_widgets': 'memberlite_color_footer_widgets', + 'color_borders': 'memberlite_color_borders', + }; + + /** + * Update all color picker controls from a scheme's colors + * + * @param {Object} colors - The 17-color associative array + */ + function updateColorPickersFromScheme(colors) { + isUpdatingFromScheme = true; + + $.each(colorControlMapping, function (colorKey, controlId) { + if (colors[colorKey]) { + let colorValue = colors[colorKey]; + + // Handle header_textcolor and background_color differently (WordPress core) + if (colorKey === 'header_textcolor' || colorKey === 'background_color') { + // Skip header_textcolor if currently set to 'blank' (user chose to hide site title/tagline) + if (colorKey === 'header_textcolor' && wp.customize(controlId)() === 'blank') { + return true; // continue to next iteration + } + // WordPress stores these without the # prefix + if (colorValue && colorValue.charAt(0) === '#') { + colorValue = colorValue.substring(1); + } + wp.customize(controlId).set(colorValue); + } else { + // Standard Memberlite color controls + const $control = $('#customize-control-' + controlId); + if ($control.length) { + const $picker = $control.find('.color-picker-hex'); + if ($picker.length && $picker.wpColorPicker) { + $picker.wpColorPicker('color', colorValue); } - memberlite_color_controls_listener_flag = true; + } + // Also set the customize value directly + if (wp.customize(colorKey)) { + wp.customize(colorKey).set(colorValue); } } - ); + } + }); + + // Use setTimeout to ensure flag is reset after all bindings fire + setTimeout(function () { + isUpdatingFromScheme = false; + }, 100); + } + + /** + * Check if current colors match any scheme + * + * @returns {string} Scheme key or 'custom' + */ + function detectCurrentScheme() { + if (typeof colorSchemes === 'undefined') { + return 'custom'; } - ); - - // Set color scheme to custom when a color is changed specifically - for (i = 0; i < 15; i++) { - wp.customize( - memberlite_color_controls[i].replace( /memberlite_/, '' ), function( value ) { - value.bind( - function( to ) { - if (memberlite_color_controls_listener_flag) { - $( '#customize-control-memberlite_color_scheme' ).find( 'select' ).val( 'custom' ).change(); - } + + for (const schemeKey in colorSchemes) { + if (!colorSchemes.hasOwnProperty(schemeKey)) continue; + + const schemeColors = colorSchemes[schemeKey].colors; + let isMatch = true; + + for (const colorKey in schemeColors) { + if (!schemeColors.hasOwnProperty(colorKey)) continue; + + let currentValue = ''; + if (colorKey === 'header_textcolor' || colorKey === 'background_color') { + currentValue = wp.customize(colorKey)(); + // Skip header_textcolor comparison if set to 'blank' (hidden site title) + if (colorKey === 'header_textcolor' && currentValue === 'blank') { + continue; + } + // Add # if missing for comparison + if (currentValue && currentValue.charAt(0) !== '#') { + currentValue = '#' + currentValue; } - ); + } else { + currentValue = wp.customize(colorKey) ? wp.customize(colorKey)() : ''; + } + + const schemeValue = schemeColors[colorKey].toUpperCase(); + const compareValue = (currentValue || '').toUpperCase(); + + if (schemeValue !== compareValue) { + isMatch = false; + break; + } + } + + if (isMatch) { + return schemeKey; } - ); + } + + return 'custom'; } -} )( jQuery ); + + // Update colors when color scheme dropdown changes + wp.customize('memberlite_color_scheme', function (value) { + value.bind(function (to) { + // Ignore custom - user is manually setting colors + if (to === 'custom') { + return; + } + + // Get the scheme colors + if (typeof colorSchemes !== 'undefined' && colorSchemes[to]) { + updateColorPickersFromScheme(colorSchemes[to].colors); + } + }); + }); + + // When any color is manually changed, check if it matches a scheme or set to custom + const allColorSettings = typeof colorSettingKeys !== 'undefined' ? colorSettingKeys : [ + 'header_textcolor', + 'background_color', + 'bgcolor_header', + 'bgcolor_site_navigation', + 'color_site_navigation', + 'color_text', + 'color_link', + 'color_meta_link', + 'color_primary', + 'color_secondary', + 'color_action', + 'color_button', + 'bgcolor_page_masthead', + 'color_page_masthead', + 'bgcolor_footer_widgets', + 'color_footer_widgets', + 'color_borders', + ]; + + allColorSettings.forEach(function (settingId) { + wp.customize(settingId, function (value) { + value.bind(function () { + // Don't trigger if we're updating from a scheme selection + if (isUpdatingFromScheme) { + return; + } + + // Check if the new color configuration matches any scheme + const detectedScheme = detectCurrentScheme(); + const currentScheme = wp.customize('memberlite_color_scheme')(); + + if (detectedScheme !== currentScheme) { + wp.customize('memberlite_color_scheme').set(detectedScheme); + } + }); + }); + }); + +})(jQuery); diff --git a/js/customizer.js b/js/customizer.js index b4d08b4f..115a91b2 100644 --- a/js/customizer.js +++ b/js/customizer.js @@ -46,21 +46,16 @@ 'text-indent': '0', } ); - - $( '.site-title, .site-description' ).css( + $( '.site-description' ).css( { 'clip': 'auto', - 'color': value, 'position': 'static' } ); - - $( '.site-title a' ).css( - { - 'color': value - } - ); - + // Update CSS variable for site title and tagline color + // WordPress stores header_textcolor without the # prefix + var colorValue = value.charAt(0) === '#' ? value : '#' + value; + document.documentElement.style.setProperty('--memberlite-color-header-text', colorValue ); } } ); @@ -72,40 +67,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-site-background', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-site-background:' + value + '; }' ); - } - ); - } - ); - // Header Background Color. - wp.customize( - 'bgcolor_header', function( setting ) { - setting.bind( - function( value ) { - document.documentElement.style.setProperty('--memberlite-color-header-background', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-header-background:' + value + '; }' ); - } - ); - } - ); - // Primary Navigation Background Color. - wp.customize( - 'bgcolor_site_navigation', function( setting ) { - setting.bind( - function( value ) { - document.documentElement.style.setProperty('--memberlite-color-site-navigation-background', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--bgcolor-site-navigation:' + value + '; }' ); - } - ); - } - ); - // Primary Navigation Color. - wp.customize( - 'color_site_navigation', function( setting ) { - setting.bind( - function( value ) { - document.documentElement.style.setProperty('--memberlite-color-site-navigation', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-site-navigation:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-site-background:' + value + '; }' ); } ); } @@ -116,7 +78,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-link', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-link:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-link:' + value + '; }' ); } ); } @@ -127,7 +89,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-meta-link', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-meta-link:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-meta-link:' + value + '; }' ); } ); } @@ -138,7 +100,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-primary', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-primary:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-primary:' + value + '; }' ); } ); } @@ -149,7 +111,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-secondary', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-secondary:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-secondary:' + value + '; }' ); } ); } @@ -160,7 +122,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-action', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-action:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-action:' + value + '; }' ); } ); } @@ -171,7 +133,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-button', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-button:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-button:' + value + '; }' ); } ); } @@ -182,7 +144,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-page-masthead-background', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--bgcolor-page-masthead:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---bgcolor-page-masthead:' + value + '; }' ); } ); } @@ -193,7 +155,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-page-masthead', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-page-masthead:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-page-masthead:' + value + '; }' ); } ); } @@ -204,7 +166,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-footer-widgets-background', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--bgcolor-footer-widgets:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---bgcolor-footer-widgets:' + value + '; }' ); } ); } @@ -215,7 +177,7 @@ setting.bind( function( value ) { document.documentElement.style.setProperty('--memberlite-color-footer-widgets', value ); - $( '#memberlite-customizer-css' ).append( 'body { --wp--preset--color--color-footer-widgets:' + value + '; }' ); + $( '#memberlite-customizer-css' ).append( 'body { --memberlite---color-footer-widgets:' + value + '; }' ); } ); } @@ -256,4 +218,38 @@ ); } ); + + // Handle PMPro color override checkbox + wp.customize( 'memberlite_pmpro_color_override', function( value ) { + value.bind( function( isChecked ) { + if ( isChecked && memberliteCustomizerPreview.isPMProActive ) { + // Override PMPro colors with theme colors + updatePMProColors(); + } else { + // Remove overrides (let PMPro plugin handle its own colors) + removePMProColorOverrides(); + } + }); + }); + + function updatePMProColors() { + var style = ''; + + // Remove existing override if present + $('#memberlite_pmpro_color_override').remove(); + // Add new override + $('head').append( style ); + } + + function removePMProColorOverrides() { + $('#memberlite-pmpro-color-override').remove(); + } + } )( jQuery ); diff --git a/js/memberlite.js b/js/memberlite.js index 41408760..b30dad33 100644 --- a/js/memberlite.js +++ b/js/memberlite.js @@ -59,9 +59,9 @@ jQuery( document ).ready( // update the URL if(history.pushState) { - history.pushState( null, null, '#' + tab ); + history.pushState( null, null, '#' + tab ); } else { - location.hash = '#' + tab; + location.hash = '#' + tab; } } ); diff --git a/js/multi-post-thumbnails-admin.js b/js/multi-post-thumbnails-admin.js index c6933662..ff866b88 100644 --- a/js/multi-post-thumbnails-admin.js +++ b/js/multi-post-thumbnails-admin.js @@ -1,51 +1,51 @@ window.MemberliteMultiPostThumbnails = { - - setThumbnailHTML: function(html, id, post_type){ - jQuery('.inside', '#' + post_type + '-' + id).html(html); - }, + + setThumbnailHTML: function(html, id, post_type){ + jQuery('.inside', '#' + post_type + '-' + id).html(html); + }, - setThumbnailID: function(thumb_id, id, post_type){ - var field = jQuery('input[value=_' + post_type + '_' + id + '_thumbnail_id]', '#list-table'); - if ( field.size() > 0 ) { - jQuery('#meta\\[' + field.attr('id').match(/[0-9]+/) + '\\]\\[value\\]').text(thumb_id); - } - }, + setThumbnailID: function(thumb_id, id, post_type){ + var field = jQuery('input[value=_' + post_type + '_' + id + '_thumbnail_id]', '#list-table'); + if ( field.size() > 0 ) { + jQuery('#meta\\[' + field.attr('id').match(/[0-9]+/) + '\\]\\[value\\]').text(thumb_id); + } + }, - removeThumbnail: function(id, post_type, nonce){ - jQuery.post(ajaxurl, { - action:'set-' + post_type + '-' + id + '-thumbnail', post_id: jQuery('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) - }, function(str){ - if ( str == '0' ) { - alert( setPostThumbnailL10n.error ); - } else { - MemberliteMultiPostThumbnails.setThumbnailHTML(str, id, post_type); - } - } - ); - }, + removeThumbnail: function(id, post_type, nonce){ + jQuery.post(ajaxurl, { + action:'set-' + post_type + '-' + id + '-thumbnail', post_id: jQuery('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) + }, function(str){ + if ( str == '0' ) { + alert( setPostThumbnailL10n.error ); + } else { + MemberliteMultiPostThumbnails.setThumbnailHTML(str, id, post_type); + } + } + ); + }, - setAsThumbnail: function(thumb_id, id, post_type, nonce){ - var $link = jQuery('a#' + post_type + '-' + id + '-thumbnail-' + thumb_id); + setAsThumbnail: function(thumb_id, id, post_type, nonce){ + var $link = jQuery('a#' + post_type + '-' + id + '-thumbnail-' + thumb_id); $link.data('thumbnail_id', thumb_id); - $link.text( setPostThumbnailL10n.saving ); - jQuery.post(ajaxurl, { - action:'set-' + post_type + '-' + id + '-thumbnail', post_id: post_id, thumbnail_id: thumb_id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) - }, function(str){ - var win = window.dialogArguments || opener || parent || top; - $link.text( setPostThumbnailL10n.setThumbnail ); - if ( str == '0' ) { - alert( setPostThumbnailL10n.error ); - } else { - $link.show(); - $link.text( setPostThumbnailL10n.done ); - $link.fadeOut( 2000, function() { - jQuery('tr.' + post_type + '-' + id + '-thumbnail').hide(); - }); - win.MemberliteMultiPostThumbnails.setThumbnailID(thumb_id, id, post_type); - win.MemberliteMultiPostThumbnails.setThumbnailHTML(str, id, post_type); - } - } - ); - } + $link.text( setPostThumbnailL10n.saving ); + jQuery.post(ajaxurl, { + action:'set-' + post_type + '-' + id + '-thumbnail', post_id: post_id, thumbnail_id: thumb_id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) + }, function(str){ + var win = window.dialogArguments || opener || parent || top; + $link.text( setPostThumbnailL10n.setThumbnail ); + if ( str == '0' ) { + alert( setPostThumbnailL10n.error ); + } else { + $link.show(); + $link.text( setPostThumbnailL10n.done ); + $link.fadeOut( 2000, function() { + jQuery('tr.' + post_type + '-' + id + '-thumbnail').hide(); + }); + win.MemberliteMultiPostThumbnails.setThumbnailID(thumb_id, id, post_type); + win.MemberliteMultiPostThumbnails.setThumbnailHTML(str, id, post_type); + } + } + ); + } } \ No newline at end of file diff --git a/shortcodes/banners.php b/shortcodes/banners.php index e71abd00..96c51294 100755 --- a/shortcodes/banners.php +++ b/shortcodes/banners.php @@ -3,26 +3,26 @@ function memberlite_banner_shortcode($atts, $content = null) { // $atts ::= array of attributes // $content ::= text within enclosing form of shortcode element // examples: [memberlite_banner align="center" background="primary" color="#FFFFFF" title="Banner Title"] - extract(shortcode_atts(array( + extract(shortcode_atts(array( 'align' => '', 'background' => 'primary', 'color' => '', 'title' => '', - ), $atts)); - + ), $atts)); + if ( preg_match( '/^#[a-f0-9]{6}$/i', $background ) ) { - // The background color was specified as a HEX value with the # symbol. + // The background color was specified as a HEX value with the # symbol. $r = '