one-click-accessibility/modules/legacy/components/frontend.php
Raz Ohad 35c752611e
[Version] Bumped V3.2.0 (#263)
* Bump WP version

* ♻️ Initial Refactor commit [APP-687] (#109)

* Initial refactor commit

*  Added build and tests CI/CD

* PR Rejects

* Rejects leftover

* Setup base (#110)

* Initial refactor commit

*  Added build and tests CI/CD

* update: add src for admin settings

* update: incorrect constant names

* update: namespace

* add: accessibility settings

* update: webpack to output files inside a folder

* update: build output folders

* update: removed commented code

* update: npm scripts

* add: webpack config

* add: hooks

* update: move admin setting to the module folder

* update: assets loading logic

* update: settings variable

* update: removed duplicate css import

* Update modules/settings/assets/js/api/index.js

Co-authored-by: VasylD <vasyld@elementor.red>

---------

Co-authored-by: Ohad <ohad@elementor.com>
Co-authored-by: VasylD <vasyld@elementor.red>

* [Infra]  updated Github actions (#114)

* updated github actions

* removed composer github auth

* PHPCS

* removed package-lock.json from ignore to allow `npm ci`

* added missing husky

* ignore legacy

* removed unused non existing import

* Add connect modal (#111)

* Initial refactor commit

*  Added build and tests CI/CD

* update: add src for admin settings

* update: incorrect constant names

* update: namespace

* add: accessibility settings

* update: webpack to output files inside a folder

* update: build output folders

* update: removed commented code

* update: npm scripts

* add: webpack config

* add: hooks

* update: move admin setting to the module folder

* update: assets loading logic

* update: add rule to move jsx props to multiline imporving readability

* add: connect modal

* update: hooks import for better readability

* update: replace functions with hooks

* fix: alignment and style

* update: imports

* update: removed conflicting imports

* fix: add compatibility for mobile devices

---------

Co-authored-by: Ohad <ohad@elementor.com>

* [APP 705] add connect module, settings and notification component (#112)

* Initial refactor commit

*  Added build and tests CI/CD

* update: add src for admin settings

* update: incorrect constant names

* update: namespace

* add: accessibility settings

* update: webpack to output files inside a folder

* update: build output folders

* update: removed commented code

* update: npm scripts

* add: webpack config

* add: hooks

* update: move admin setting to the module folder

* update: assets loading logic

* update: add rule to move jsx props to multiline imporving readability

* add: connect modal

* update: hooks import for better readability

* update: replace functions with hooks

* add: connect module

* add: settings and get settings route

* add: hooks and contexts to get settings

* add: hooks

* add: notification component

* add: data api

* add: settings provider and connect settings

* add: husky

* fix: formatting and text-domain

* update: filter names

* fix: hook import

* add: set function for settings

* add: prop-types package

* update: refactor notification component and context

* update: remove filter for authorize url

* update: imports and exports of hooks

* update: plugin settings context filename and relevant imports

---------

Co-authored-by: Ohad <ohad@elementor.com>

* [APP 707] general setting components (#113)

* Initial refactor commit

*  Added build and tests CI/CD

* update: add src for admin settings

* update: incorrect constant names

* update: namespace

* add: accessibility settings

* update: webpack to output files inside a folder

* update: build output folders

* update: removed commented code

* update: npm scripts

* add: webpack config

* add: hooks

* update: move admin setting to the module folder

* update: assets loading logic

* update: add rule to move jsx props to multiline imporving readability

* add: connect modal

* update: hooks import for better readability

* update: replace functions with hooks

* add: connect module

* add: settings and get settings route

* add: hooks and contexts to get settings

* add: hooks

* add: notification component

* add: data api

* add: settings provider and connect settings

* add: husky

* add: icon size control

* fix: icon size control labels

* add: icon select component

* add: color picker component

* add: accessibility icons

* add: icon export

* update: add icons to the component

* fix: styling for the icon select control

* update: color picker with react-colorful component

* update: icon size component with live icon design

* fix: styling of radio boxes

* add: icon design settings layout

* add: position settings layout

* add: layout exports

* add: alignment matrix and position control components

* add: position settings  & position settings for mobile layout

* fix: formatting and text-domain

* update: filter names

* fix: hook import

* add: set function for settings

* add: prop-types package

* update: refactor notification component and context

* update: remove filter for authorize url

* Update modules/settings/assets/js/components/color-picker/style.css

Co-authored-by: Raz Ohad <admin@bainternet.info>

* update: color picker class name

---------

Co-authored-by: Ohad <ohad@elementor.com>
Co-authored-by: Raz Ohad <admin@bainternet.info>

* [App 780] Navigation Sidebar (#115)

* Initial refactor commit

*  Added build and tests CI/CD

* update: add src for admin settings

* update: incorrect constant names

* update: namespace

* add: accessibility settings

* update: webpack to output files inside a folder

* update: build output folders

* update: removed commented code

* update: npm scripts

* add: webpack config

* add: hooks

* update: move admin setting to the module folder

* update: assets loading logic

* update: add rule to move jsx props to multiline imporving readability

* add: connect modal

* update: hooks import for better readability

* update: replace functions with hooks

* add: connect module

* add: settings and get settings route

* add: hooks and contexts to get settings

* add: hooks

* add: notification component

* add: data api

* add: settings provider and connect settings

* add: husky

* fix: formatting and text-domain

* update: filter names

* fix: hook import

* add: set function for settings

* add: prop-types package

* update: refactor notification component and context

* update: remove filter for authorize url

* update: imports and exports of hooks

* update: plugin settings context filename and relevant imports

* update: icons and icon imports

* add: sidebar(wip)

* update: fix width of connect screen on mobile

* update: sidebar layout

* add: credit card and user arrow icons

* update: hidden wpfooter and fixed sidebar height

* update: sidebar layout

* add: basic page layouts

* update: sidebar layout

* add: sidebar menu, sidebar app bar and my account menu components

* update: add sidebar and menu settings

* update: add page layouts

* update: admin top bar

* add: bottom bar

* add: bottom bar and top bar

* add: bottom bar and top bar

* update: page content styling

* fix: styling

* fix: styling

* update: text domain

* update: added translations

* fix: admin top bar layout

* update: exports of icons

* update: exports of components

* add: aliases for imports and fix exports

* fix: height and styling of the layout

* fix: unhide wp footer

* update: keep widget menu open on page load (default)

* update: linter rules to move first prop to new line

* update: linter rules to move first prop to new line

---------

Co-authored-by: Ohad <ohad@elementor.com>

* Fix error on install plugin, add prettier (#116)

* Feature/app 810 assemble icon settings page (#117)

* Initial refactor commit

*  Added build and tests CI/CD

* update: add src for admin settings

* update: incorrect constant names

* update: namespace

* add: accessibility settings

* update: webpack to output files inside a folder

* update: build output folders

* update: removed commented code

* update: npm scripts

* add: webpack config

* add: hooks

* update: move admin setting to the module folder

* update: assets loading logic

* update: add rule to move jsx props to multiline imporving readability

* add: connect modal

* update: hooks import for better readability

* update: replace functions with hooks

* add: connect module

* add: settings and get settings route

* add: hooks and contexts to get settings

* add: hooks

* add: notification component

* add: data api

* add: settings provider and connect settings

* add: husky

* add: icon size control

* fix: icon size control labels

* add: icon select component

* add: color picker component

* add: accessibility icons

* add: icon export

* update: add icons to the component

* fix: styling for the icon select control

* update: color picker with react-colorful component

* update: icon size component with live icon design

* fix: styling of radio boxes

* add: icon design settings layout

* add: position settings layout

* add: layout exports

* add: alignment matrix and position control components

* add: position settings  & position settings for mobile layout

* fix: formatting and text-domain

* update: filter names

* fix: hook import

* add: set function for settings

* add: prop-types package

* update: refactor notification component and context

* update: remove filter for authorize url

* update: imports and exports of hooks

* update: plugin settings context filename and relevant imports

* update: icons and icon imports

* add: sidebar(wip)

* update: fix width of connect screen on mobile

* update: sidebar layout

* Update modules/settings/assets/js/components/color-picker/style.css

Co-authored-by: Raz Ohad <admin@bainternet.info>

* update: color picker class name

* add: credit card and user arrow icons

* update: hidden wpfooter and fixed sidebar height

* update: sidebar layout

* add: basic page layouts

* update: sidebar layout

* add: sidebar menu, sidebar app bar and my account menu components

* update: add sidebar and menu settings

* update: add page layouts

* update: admin top bar

* add: bottom bar

* add: bottom bar and top bar

* add: bottom bar and top bar

* update: page content styling

* fix: styling

* fix: styling

* update: text domain

* add: props to wrapper

* add: icon design and position setting layouts

* add: in page scroll behaviour to the settings

* add: widget icons and getter function

* update: icon design settings getter and setter functions

* update: imports

* add: mobile layout for position settings

* add: icon position settings

* add: icon position settings hooks and handlers

* fix: alignment of controls in AlignmentMatrixControl

* update: useSettings and usePositionSetting hooks and relevant functions

* fix: colors of AlignmentMatrixControl

* fix: styling of components and layouts

* add: aliases

* add: container wrapper to page

* update: accessibility options rendering logic

* fix: order of the icons

* add: aliases for components and hooks imports

* fix: styling of settings panel

* fix: container height for settings page

* update: toggle control states

* add: widget icon settings

* add: load saved widget icon settings

* update: move layout to page for different designs per page

* update: add changes tracking and disable button logic

* add: async/await to save settings

* update: convert options to array of objects

* Update modules/settings/assets/js/components/bottom-bar/index.js

Co-authored-by: VasylD <vasyld@elementor.red>

* Update modules/settings/assets/js/app.js

Co-authored-by: VasylD <vasyld@elementor.red>

* fix: remove duplicate entries

---------

Co-authored-by: Ohad <ohad@elementor.com>
Co-authored-by: Raz Ohad <admin@bainternet.info>
Co-authored-by: VasylD <vasyld@elementor.red>

* Feature/app 708 widget menu settings (#118)

* add: icons for menu settings

* add: placeholder layout for widget preview in menu settings

* update: load saved settings and updated imports

* add: logics for handling and saving menu settings

* add: useSavedSettings hook

* update: set export as default for Sidebar layout

* add: widget menu settings layout and settings

* update: add widget menu settings and widget preview layouts

* add: hide/show minimum option alert notification

* update: styling of the save button

* update: save settings logic to use async/await

* fix: accessibility text icon

* update: app type (#119)

* [APP-834] Update account menu buttons (#121)

* update: account menu buttons

* update: billing link

* add: error handling for switch account

* [APP-835] add service data (#122)

* add: client functions

* add: site register and site info endpoints

* update: add plan data settings

* update: add support for 201 response code

* update: add plan data key

* update: store the plan data on the once the site is registered

* update: add filter for client url

* add: retry registering in there is any error after connect

* update: setting prefix

* add: plan data

* update: add account details to menu

* fix: lint issues

* update: add data checkbox support (#123)

* [APP-928] Settings pointer (#125)

* add: settings pointer

* update: add alias for the settings

* [APP-837] Add post connect modal (#120)

* add: post connect modal

* update: settings prefix

* fix: connect modal design

* update: connect modal text

* add: connect modal graphics

* update: connect modal icon

* update: post connect modal

* update: sidebar menu text

* update: text of icon settings

* update: text

* update: php compatibility with return types

* add: accessibility statement page structure (#126)

* [APP-721] Render widget and global settings (#124)

* add: webhook endpoint

* add: widget module

* add: default widget settings on successful registration

* update: name of global object to ea11yWidget

* update: remove json encoding to make objects available on the frontend

* update: widget url, filter and enqueuing method

* update: removed obsolete code

* update: enqueue script only when connected

* update: add check for valid plan data and key

* update: conditional check

* update: conditional check

* fix: widget loading error (#128)

* [Legacy] Upgrade To New [APP-949] (#127)

* Added `Notice_Base` and `Notices` component to core module

* Always load core module and load all other modules based on legacy status

* added filter in customizer settings

* added bubble / pimple in admin menu to indicate upgrade

* added `Dismissible_Deprecated_Nag` notice to none legacy pages

* added `Dismissible_Deprecated_Nag` notice to legacy pages

* Added `Upgrade` component to legacy module

includes:
* loading of notices
* introduction modal
* admin menu pimple
* customizer notice
* pointer
* confirmation modal
* upgrade logic and handler

*  Fixed legacy module test

* added `local:quick-run` command to run in browser mode

* update phpunit workflow

* ensure wp.ajax is loaded

* wrong translations

* Updated strings

* added "Equally"

* remove unused test

*  use custom version of wp test library (#129)

*  use custom version of wp test library

* cleanup

* update WP versions for testing

* [APP-711] Widget preview (#130)

* add: dynamic script loader for widget

* update: settings name

* update: settings save function and comments

* update: tools settings object structure

* add: widget preview section

* update: added setting page slug as a constant

* update: enqueue widget for preview in the settings

* add: widget icon assets link

* add: widget icon svgs

* update: store widget url in a constant

* update: store widget url in a constant

* update: trigger widget preview update on menu item changes

* update: remove the icon option from the frontend.

* update: add widget URL

* update: plan data setting type

* update: widget plan url

* update: widget plan url and parse plan data

* fix: phpcs error ext-json missing

* fix: widget url

* fix: save and use plan data as a serialized option

* fix: use template string for widget url

* [APP-908] Accessibility generator (#131)

* add: accessibility statement radio icons

* update: add form group on radio buttons

* add: statement generator

* add: statement generator

* add: accessibility statement data option

* update: create page in WordPress and save it to the option

* update: exclude zip file from the git

* update: render statement page conditionally

* add: statement link layout and settings

* add: preload statement data

* update: publish the created page and add link for it

* update: changed Dynamic Script Loader to WidgetLoader

* add: accessibility statement url

* update: text and styling

* update: styling of the preview text

* update: restructure statement generator

* add: support for dynamic update in statement links

* update: remove index.css file for widget loader

* add: widget styling for settings page

* add: empty link when hide link is enabled

* update: statement page structure and logic

* fix: typo

* update: convert component into a styled component

* fix: styling and layout

* update: icons

* update: convert radio buttons to styled component

* fix: typo and style

* add: fading for the link preview

* update: import

* update: styling and spacing

* fix: sidebar layout

* update: wpcs to latest version

* fix: spacing

* fix: wpcs version

* add: check for valid statement page

* fix: jitters on rendering

* fix: use escape attribute

* update: settings menu slug and plugin name

* fix: menu item rendering

* update: definition of the styled text field

* add: addPage function to the API

* fix: add notification on page creation

* add: copy link icon

* update: optimize SVGs

* [APP-908] Additional fixes (#133)

* fix: text domains

* updated: styled component syntax

* update: use await instead of then

* fix: prevent application crash in case widget fails to load

* add: generated info tip card

* update: refactor function

* Fix: Fix the QA bugs [n/a] (#135)

* [APP-830] Add mixpanel events (#134)

* [APP-830] Add mixpanel events

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* [APP-830] Add user to init Mixpanel (#136)

* [APP-830] Add mixpanel events

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* Merge branch 'develop' into feature/APP-830-add-mixpanel

# Conflicts:
#	.gitignore
#	modules/settings/assets/js/components/sidebar-menu/index.js
#	modules/settings/assets/js/pages/accessibility-statement.js

* [APP-830] Add user to init Mixpanel

* [APP-830] Add user to init Mixpanel

* [APP-830] Add user to init Mixpanel

* [APP-830] rename events (#137)

* Connect and Preview Fixes (#139)

* updated connect admin page

* Use unified widget URL instead of hardcoded Js to support envs

* Removed enqueue of fictional widget.js and reuse settings `admin` handle

* Fix: Fix the QA bugs [n/a] (#138)

* New: Finish the BE integration [n/a]

* Fix: Fix some bugs [n/a]

* upgrade flow UI and design tweaks [app-949] (#141)

* Updated Learn More links with UTM's

* Tweaked Pointer strings Icon and CTA

* dismissible notice strings

* sticky notice strings

* updated upgrade flow design for pointer, notices, introduction modal, and confirmation modal

* added build script

* [APP-979] Update links and plugin name (#140)

* Ensure loading of legacy widget based on any saved data and fixed legacy JS

* Bug/app 1002 (#143)

* Bug: Update the logo in the "Hide Widget" modal [APP-1001]

* Fix: Update the side menu spaces [APP-1002]

* [APP-991] Add translation for statement (#142)

* [APP-979] Update links and plugin name

* [APP-991] Add translation for statement

* Set Prod Widget URL

* [APP-1004][APP-1005][APP-1006] Fix generator UI and logic, fix statement UI, fix copy link (#144)

* [APP-1004] Fix generator UI and logic

* [APP-1005] Fix statement UI

* [APP-1005] Fix statement UI

* Mixpanel record session

* Fix: Enhance position values validation [APP-1009] (#146)

* Bug/app 1003 (#147)

* Fix: Add a border to the preview [n/a]

* Fix: Fix Capabilities screen UI [APP-1003]

* [APP-1020] add missed events (#148)

* [APP-1015] fix switch account (#149)

* [APP-1015] fix switch account (#150)

* [APP-1021] Fix switch modal ui (#151)

* fix: ui issues

* fix: translation strings

* [APP-912] add default settings for RTL (#152)

* [APP-912] add default settings for RTL

* [APP-912] add default settings for RTL

* [APP-912] add default settings for RTL

* [APP-1026] Remove HTML breaking <style> tag & update pointer logic (#153)

* fix: remove extra closing tag

* update: hide settings pointer when plugin settings is opened

* update: remove unused functions

* update: add help text to mobile position settings

* Bug/app 1003 (#157)

* Fix: Add missed translations [n/a]

* Fix: Refresh the plan data on page load [n/a]

* New: Add loader to the settings [n/a]

* update: delete lock key after each check (#160)

* New: Update dashboard icon size [n/a] (#158)

* New: Update dashboard icon size [n/a]

* Fix: Fix widget previews [n/a]

* [APP-1018] Help menu change (#155)

* update: remove accessibility word from menu items

* update: remove top bar

* update: add help button to the sidebar

* update: re-add spacing in styled css code

* update: create styled components

* [APP-973] Add an UTM for users upgrading from one click to the new widget (#165)

* update: ui of the statement preview (#166)

* [APP-1011][APP-1013] focus outline and sitemap settings (#161)

* [APP-1011][APP-1013] focus outline and sitemap settings

* [APP-1011][APP-1013] focus outline and sitemap settings

* [APP-1011][APP-1013] focus outline and sitemap settings

* [APP-1011][APP-1013] focus outline and sitemap settings

* update: video link (#167)

* [APP-1051] Fix layout on the small and medium devices (#156)

* fix: layout on the small and medium devices

* update: change components to styled components

* refactor: position settings wrapper into a separate component

* [APP-1012][APP-1085] Add skip to content settings and event for Mixpanel (#169)

* [APP-1012][APP-1085] Add skip to content settings and event for Mixpanel

* [APP-1012][APP-1085] Add skip to content settings and event for Mixpanel

* [APP-1012][APP-1085] Add skip to content settings and event for Mixpanel

* [APP-1012][APP-1085] Add skip to content settings and event for Mixpanel

* [APP-1048] Add tooltip to accessibility statement (#159)

* add: tooltip to accessibility statement

* update: hide infotip when statement link is set

* update: infotip's text

* fix: infotip naming and logic

* [APP-1049] Add back button accessibility statement (#164)

* add: back button to the statement link section

* add: Edit link button to statement page section

* update: add admin_url and generate query args properly

* update: learn more link for accessibility statement page (#168)

* Fix: Update overlay height [n/a] (#171)

* Fix settings and connect issues (#170)

* fix: token fails to refresh after expiry

* update: add 12 hour time for plan data refresh and fix missing subscription id

* update: add check to refresh plan data

* fix: decoding errors and alignment and add logging for errors

* update: refresh logic and formatting

* Update/app 1029 app name (#173)

* update: plugin name

* update: default menu option

* update: menu structure

* update: add inline checks

* update: reduce padding on app icon in menu

* fix: height of the modal

* update: app menu icon color

* update: menu icon colors

* fix: menu icon size

* update: plugin names

* update: HELP_LINK

* update: app name

* update: icon background color

* update: icon size

* fix: admin icon size

* fix: width of the sidebar

* Fix/toggle not working properly (#174)

* fix: toggles not working properly in some cases

* fix: saving of the settings was not working

* add: missing adminUrl in settings data

* fix: switch was not working properly in some cases (#175)

* Fix/app 1093 incorrect position on default (#176)

* fix: switch was not working properly in some cases

* fix: default setting structure for the icon position

* [APP-1096] Text changes (#177)

* fix: switch was not working properly in some cases

* update: plugin name and action buttons title

* fix: revert change to is_active function

* fix: button color

* New: Add the skip link [APP-1012] (#179)

* [APP-1097] Fix preview load (#178)

* [APP-1097] Fix preview load

* [APP-1097] Fix preview load

* [APP-1097] Fix preview load

* Update modules/settings/assets/js/components/widget-loader/index.js

---------

Co-authored-by: Raz Ohad <ohad@elementor.com>

* [APP-1123] Accessibility statement text (#181)

* fix: switch was not working properly in some cases

* update: accessibility statement content

* [APP-1121] Add support for react-jsx-runtime for older WP versions (#180)

* fix: switch was not working properly in some cases

* update: revert wp-scripts version to 28.0.0 to add support for older WordPress versions

* update: revert wp-scripts to 27.9.0

* add: support for react-jsx-runtime in older versions of WordPress

* update: version to the latest wp-scripts 30.3.0

* update: add lib/ to gitignore

* update: plugin name

* Fix: Fix admin widget previews [n/a] (#183)

* [APP-1061] change mixpanel user id (#184)

* [APP-1129] change toggle_event for mixpanel (#186)

* Remove skip to content btn if anchor does not exist (#187)

* fix: hide wp notices to keep the layout from shifting (#189)

* [APP-1143] fix bug with capability display (#195)

* [APP-1143] fix bug with capability display

* [APP-1143] fix bug with capability display

* [APP-1143] fix bug with capability display

* [APP-1143] fix bug with capability display

* add: loading text to widget preview (#196)

* [APP-1142] add 'appType' super props, change identify key (#191)

* [APP-1108][APP-1109][APP-1110] Add analytics backend logic

* [APP-1142] Add 'appType' super props

* [APP-1144] Accessibility statement tooltip text update (#198)

* update: text

* update: switch design

* Tweak: Update widget loaders [n/a] (#197)

* added images to readme (#172)

* added images to readme

* updated readme

* V3.0.0

* updated readme

* updated tested up to

* Fix: Update the skip link rendering hook [APP-1157] (#203)

* bumped v3.0.1 (#206)

* Fix: Adapt widget preview to smaller height viewports [APP-1130] (#217)

* update: convert menu icon to base64 svg (#199)

* update: convert menu icon to base64 svg

* update: logo to svg logo with base64 encoded

* update: svg app icon

* [APP-1201] Improve admin panel accessibility (#220)

* [APP-1201] add accessibility rules

* [APP-1201] add accessibility rules

* [APP-1210] add prop to Mixpanel, move event names to const (#225)

* [APP-1159] Add mismatch URL flow (#210)

* update: convert imports to named imports

* add: function to check if current screen is settings page

* update: rename elementor logo to app logo

* add: url mismatch flow and components

* update: remove obsolete code

* Update modules/connect/rest/authorize.php

Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>

* Update modules/settings/module.php

Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>

* fix: modal was not closing

* update: remove url mismatch notice

* update: mismatch modal and rendering logic

* add: toast notifications for errors

* update: convert components into styled components

* update: remove bottom border from the dialog

* update: text copy

* fix: logo alignment

* update: renamed styled component

---------

Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>

* [APP-1108][APP-1109][APP-1110] Add analytics backend logic (#190)

* [APP-1108][APP-1109][APP-1110] Add analytics backend logic

* [APP-1108][APP-1109][APP-1110] Add analytics backend logic

* Add nonce to the widget settings

* Update routes and DB table

* Fix comments

* Fix comments

* Fix comments

* Fix comments

* Fix comments

* Fix comments

* [APP-1101] Move action button to footer (#208)

* update: add save changes footer to the bottom and remove it from capabilities

* add: logic to save settings for skiptocontent using footer

* update: text

* update: convert component to styled component

* [APP-1198] [APP-1199] Quota bar and notices (#219)

* add: quota bar

* add: openLink helper function

* add: styled elements and visits link placeholder

* update: remove hover state from the box

* add: quota notices

* update: quota access and usage calculations

* add: logic to calculate plan usage

* update: move logic to calculate plan usage to hook

* add: todo note

* add: todos

* add: mixpanel events

* fix: hide quota bar when sidebar is minimized

* fix: settings panel was not expanding when sidebar is minimized

* update: text and structure of the bar

* update: quota calculation logic

* update: remove TODOs

* update: text and values

* fix: height of the container for icon settings

* update: golinks

* update: golinks

* fix: prevent icon options from wrapping on smaller screen sizes (#229)

* [APP-1107] Add dashboard for analytics (#204)

* [APP-1108][APP-1109][APP-1110] Add analytics backend logic

* [APP-1108][APP-1109][APP-1110] Add analytics backend logic

* Add nonce to the widget settings

* Update routes and DB table

* Fix comments

* Fix comments

* Fix comments

* Fix comments

* Fix comments

* Fix comments

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1107] Add dashboard for analytics

* [APP-1201] add accessibility rules

* [APP-1107] fixed API endpoint

* [APP-1107] fixed API endpoint

* [APP-1107] fixed API endpoint

* [APP-1107] add check for is_active

* update to the latest

* update to the latest

* update to the latest

* fix bugs, add changes

* fix bugs, add changes

* fix bugs, add changes

* fix bugs, add changes

* [APP-1105] Add pro capabilities (#205)

* add: volume and solid crown icon

* add: volume and crown icons to export

* update: refactor menu item to a new component

* add: screen reader to the menu items and reorganize them

* add: pro item infotip content

* add: capabilities item and pro info tip to exports

* update: import ProInfoTip component and change disabled logic

* update: imports

* update: refactor pro item infotip into the separate component

* update: refactor infotip and add comments

* add: custom switch component

* add: logo settings layout

* update: switch component

* add: useToggleSetting hook to manage widget settings.

* update: move pro feature key to a separate constant

* fix: pro icon style

* update: remove branding key

* update: pro enable check structure

* update: pro enabled check structure

* update: key name

* update: update key before checking for it

* fix: null error

* add: update logic to get the tools settings based on plan

* update: exclude remove-elementor-label from the minimum option rule

* update: add formlabel and eventnames

* add: logic to deactivate the features which are disabled for the plan

* fix: PHP warning

* fix: keyword name

* add: GOLINKS

* add: open link function

* fix: PHP warning undefined key

* update: logic to show the icon and added golinks

* [APP-1045] Add billing tab (#223)

* add: plan name and subscription link

* update: refactor my account menu

* update: move truncate email to a helper file

* update: simplify truncation logic

* [APP-1270] Delete transient and force info update (#236)

* add: force update site/info on mismatch url

* update: add a constant for the transient

* add: delete_transient for switch account as well

* add: delete_transient for disconnect as well

* [APP-1267] Quota bar undefined (#234)

* fix: undefined was shown when there is no quota data

* add: preloader

* fix: make bottom bar sticky on the settings pages (#237)

* [APP-1268] Pro tip spacing (#235)

* fix: pro tip spacing

* fix: pro icon

* [APP-1271] Align menu icons (#238)

* update: hide info button on minimized sidebar

* fix: alignment of quota bar icon

* fix: conditional logic

* update: improve sidebar motion

* fix: switch account issue

* update: upgrade link for analytics popup (#239)

* [APP-1281] fix usage percentage formatting (#240)

* fix: format display of percentage correctly.

* update: fraction conversion logic

* Force referer and lower transient time to 15 minutes [APP-1286] (#242)

* reduce transient timeout

* force referrer in script tags

* [APP-1262] Enable routes for get statistic on disabled analytics (#233)

* [APP-1262] Enable routes for get statistic on disabled analytics

* [APP-1262] Enable routes for get statistic on disabled analytics

* [APP-1262] Enable routes for get statistic on disabled analytics

* [APP-1262] Enable routes for get statistic on disabled analytics

* [APP-1262] Enable routes for get statistic on disabled analytics

* [APP-1262] Enable routes for get statistic on disabled analytics

* [APP-1243] Admin upgrade notices (#241)

* add: admin quota notices

* add: fix function name and phpcs issues

* fix: formatting issues

* [APP-1287] change Mixpanel check for free trial (#243)

* Fix/quota text (#244)

* fix: wp notice close logic plus banner text

* update: banner text

* [APP-1292] missing mixpanel events (#245)

* add: missing mixpanel events

* update: use variable for hardcoded names

* update: use variable for hardcoded names

* [APP-1293] Add additional checks (#246)

* update: add additional check to prevent fatal error

* fix: formatting

* [APP-1312] minimize client css (#252)

* [APP-1168] widget icon radius

* add: icon radius component

* add: icon radius component

* update: add support for widget radius

* fix: minor ui fixes

* fix: resolve comments

* fix: alignment of the icon

* update: add styled components

* add: corner radius mixpanel event

* fix: corner radius should have default values when no value is set based on icon

* fix: icon radius input style

* add: accessibility attributes

* fix: active states color

* add: logic to control invalid inputs

* update: make aria attributes translatable

* update: styled component names

* add: spacing between the components

* [APP-1342] add super props, store plan scope after register/switch (#250)

* [APP-0000] store plan scope after register/switch

* Update modules/settings/module.php

Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>

* remove deprecated method

* remove deprecated method

* [1342] Add super prop to mixpanel

* [1342] Add super prop to mixpanel

* [1342] Add super prop to mixpanel

---------

Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>

* [Legacy] Added strict settings sanitization (#257)

* [Legacy] Added strict settings sanitization

* use correct esc_x method

* hardcoded 6.8.0

* added svn for wp test library

* fix: default border radius (#258)

* fix: default border radius

* add: default corner radius for new users

* update: add support for default values for users with saved style settings

* updated phpunit workflow

* revert to master

* hardcode 6.8.x

* update: default values for existing users

* update: remove saving default corner radius for new users

* fix: update default radius for text icon

* fix: PHPUnit tests for WP 6.8.0

* align with develop

* set to latest

---------

Co-authored-by: Raz Ohad <admin@bainternet.info>
Co-authored-by: Raz Ohad <ohad@elementor.com>

* fix: widget icon spacing (#262)

* [Version] bumped V3.2.0

* Remove unnecessary

---------

Co-authored-by: Yakir Sitbon <kingyes1@gmail.com>
Co-authored-by: Nirbhay Singh <121793120+nirbhayel@users.noreply.github.com>
Co-authored-by: VasylD <vasyld@elementor.red>
Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>
2025-04-20 13:37:37 +03:00

283 lines
20 KiB
PHP

<?php
namespace EA11y\Modules\Legacy\Components;
use EA11y\Modules\Legacy\Module;
use EA11y\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Class Frontend
*/
class Frontend {
public $svg_icons = null;
public function is_toolbar_active() {
$is_active = 'disable' !== get_option( 'pojo_a11y_toolbar' );
$is_active = apply_filters( 'pojo_a11y_frontend_is_toolbar_active', $is_active );
return $is_active;
}
public function is_toolbar_button_active( $button_type ): bool {
return 'disable' !== get_option( "pojo_a11y_toolbar_button_{$button_type}" );
}
public function get_toolbar_button_title( $button_type ) {
/**
* @var Settings $settings
*/
$settings = Module::get_settings();
$title = $settings->get_default_title_text( "pojo_a11y_toolbar_button_{$button_type}_title" );
return '<span class="pojo-a11y-toolbar-icon">' . $this->get_toolbar_svg( $button_type, $title ) . '</span><span class="pojo-a11y-toolbar-text">' . $title . '</span>';
}
public function enqueue_scripts() {
$assets_url = EA11Y_URL . 'modules/legacy/assets/';
wp_register_script(
'pojo-a11y',
$assets_url . 'js/app.min.js',
[ 'jquery' ],
'1.0.0',
true
);
wp_register_style(
'pojo-a11y',
$assets_url . 'css/style.min.css',
[],
'1.0.0'
);
wp_enqueue_script( 'pojo-a11y' );
wp_enqueue_style( 'pojo-a11y' );
wp_localize_script(
'pojo-a11y',
'PojoA11yOptions',
[
'focusable' => ( 'enable' === get_option( 'pojo_a11y_focusable' ) ),
'remove_link_target' => ( 'enable' === get_option( 'pojo_a11y_remove_link_target' ) ),
'add_role_links' => ( 'enable' === get_option( 'pojo_a11y_add_role_links' ) ),
'enable_save' => ( 'enable' === get_option( 'pojo_a11y_save' ) ),
'save_expiration' => get_option( 'pojo_a11y_save_expiration' ),
]
);
}
public function print_skip_to_content_link() {
$skip_to_content_link = get_option( 'pojo_a11y_skip_to_content_link' );
if ( 'disable' === $skip_to_content_link ) {
return;
}
$element_id = get_option( 'pojo_a11y_skip_to_content_link_element_id', 'content' );
?>
<a id="pojo-a11y-skip-content" class="pojo-skip-link pojo-skip-content" tabindex="1" accesskey="s" href="#<?php echo esc_html( $element_id ); ?>"><?php esc_html_e( 'Skip to content', 'pojo-accessibility' ); ?></a>
<?php
}
public function print_toolbar() {
if ( ! $this->is_toolbar_active() ) {
return;
}
$customizer_options = get_option( POJO_A11Y_CUSTOMIZER_OPTIONS );
$toolbar_position = $customizer_options['a11y_toolbar_position'];
if ( empty( $toolbar_position ) || ! in_array( $toolbar_position, [ 'right', 'left' ] ) ) {
$toolbar_position = 'left';
}
$settings = Module::get_settings();
$toolbar_title = $settings->get_default_title_text( 'pojo_a11y_toolbar_title' );
$toolbar_visibility = get_option( 'pojo_a11y_toolbar' );
$wrapper_classes = [
'pojo-a11y-toolbar-' . $toolbar_position,
];
if ( 'enable' !== $toolbar_visibility ) {
$wrapper_classes[] = 'pojo-a11y-' . $toolbar_visibility;
}
$sitemap_link = get_option( 'pojo_a11y_toolbar_button_sitemap_link' );
$help_link = get_option( 'pojo_a11y_toolbar_button_help_link' );
$feedback_link = get_option( 'pojo_a11y_toolbar_button_feedback_link' );
$has_custom_links = ( ! empty( $sitemap_link ) || ! empty( $help_link ) || ! empty( $feedback_link ) );
$icon = isset( $customizer_options['a11y_toolbar_icon'] ) ? $customizer_options['a11y_toolbar_icon'] : 'one-click';
?>
<nav id="pojo-a11y-toolbar" class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>" role="navigation">
<div class="pojo-a11y-toolbar-toggle">
<a class="pojo-a11y-toolbar-link pojo-a11y-toolbar-toggle-link" href="javascript:void(0);" title="<?php echo esc_attr( $toolbar_title ); ?>" role="button">
<span class="pojo-sr-only sr-only"><?php esc_html_e( 'Open toolbar', 'pojo-accessibility' ); ?></span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="currentColor" width="1em">
<title><?php echo esc_html( $toolbar_title ); ?></title>
<?php echo $this->get_svg_icon( $icon ); ?>
</svg>
</a>
</div>
<div class="pojo-a11y-toolbar-overlay">
<div class="pojo-a11y-toolbar-inner">
<p class="pojo-a11y-toolbar-title"><?php echo $toolbar_title; ?></p>
<ul class="pojo-a11y-toolbar-items pojo-a11y-tools">
<?php do_action( 'pojo_a11y_toolbar_before_buttons' ); ?>
<?php if ( $this->is_toolbar_button_active( 'resize_font' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-resize-font pojo-a11y-btn-resize-plus" data-action="resize-plus" data-action-group="resize" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'resize_font_add' ); ?>
</a>
</li>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-resize-font pojo-a11y-btn-resize-minus" data-action="resize-minus" data-action-group="resize" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'resize_font_less' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( $this->is_toolbar_button_active( 'grayscale' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-background-group pojo-a11y-btn-grayscale" data-action="grayscale" data-action-group="schema" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'grayscale' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( $this->is_toolbar_button_active( 'high_contrast' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-background-group pojo-a11y-btn-high-contrast" data-action="high-contrast" data-action-group="schema" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'high_contrast' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( $this->is_toolbar_button_active( 'negative_contrast' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-background-group pojo-a11y-btn-negative-contrast" data-action="negative-contrast" data-action-group="schema" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'negative_contrast' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( $this->is_toolbar_button_active( 'light_bg' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-background-group pojo-a11y-btn-light-background" data-action="light-background" data-action-group="schema" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'light_bg' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( $this->is_toolbar_button_active( 'links_underline' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-links-underline" data-action="links-underline" data-action-group="toggle" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'links_underline' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( $this->is_toolbar_button_active( 'readable_font' ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-readable-font" data-action="readable-font" data-action-group="toggle" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'readable_font' ); ?>
</a>
</li>
<?php endif; ?>
<?php do_action( 'pojo_a11y_toolbar_after_buttons' ); ?>
<li class="pojo-a11y-toolbar-item">
<a href="#" class="pojo-a11y-toolbar-link pojo-a11y-btn-reset" data-action="reset" tabindex="-1" role="button">
<span class="pojo-a11y-toolbar-icon"><?php echo $this->get_toolbar_svg( 'reset', esc_html__( 'Reset', 'pojo-accessibility' ) ); ?></span>
<span class="pojo-a11y-toolbar-text"><?php esc_html_e( 'Reset', 'pojo-accessibility' ); ?></span>
</a>
</li>
</ul>
<?php if ( $has_custom_links ) : ?>
<ul class="pojo-a11y-toolbar-items pojo-a11y-links">
<?php if ( ! empty( $sitemap_link ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="<?php echo esc_url( $sitemap_link ); ?>" class="pojo-a11y-toolbar-link pojo-a11y-link-sitemap" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'sitemap' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( ! empty( $help_link ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="<?php echo esc_url( $help_link ); ?>" class="pojo-a11y-toolbar-link pojo-a11y-link-help" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'help' ); ?>
</a>
</li>
<?php endif; ?>
<?php if ( ! empty( $feedback_link ) ) : ?>
<li class="pojo-a11y-toolbar-item">
<a href="<?php echo esc_url( $feedback_link ); ?>" class="pojo-a11y-toolbar-link pojo-a11y-link-feedback" tabindex="-1" role="button">
<?php echo $this->get_toolbar_button_title( 'feedback' ); ?>
</a>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>
</div>
</nav>
<?php
}
private function get_toolbar_svg( $icon, $icon_title = '' ) {
$icons = [
'resize_font_add' => '<path fill="currentColor" d="M256 200v16c0 4.25-3.75 8-8 8h-56v56c0 4.25-3.75 8-8 8h-16c-4.25 0-8-3.75-8-8v-56h-56c-4.25 0-8-3.75-8-8v-16c0-4.25 3.75-8 8-8h56v-56c0-4.25 3.75-8 8-8h16c4.25 0 8 3.75 8 8v56h56c4.25 0 8 3.75 8 8zM288 208c0-61.75-50.25-112-112-112s-112 50.25-112 112 50.25 112 112 112 112-50.25 112-112zM416 416c0 17.75-14.25 32-32 32-8.5 0-16.75-3.5-22.5-9.5l-85.75-85.5c-29.25 20.25-64.25 31-99.75 31-97.25 0-176-78.75-176-176s78.75-176 176-176 176 78.75 176 176c0 35.5-10.75 70.5-31 99.75l85.75 85.75c5.75 5.75 9.25 14 9.25 22.5z"></path>',
'resize_font_less' => '<path fill="currentColor" d="M256 200v16c0 4.25-3.75 8-8 8h-144c-4.25 0-8-3.75-8-8v-16c0-4.25 3.75-8 8-8h144c4.25 0 8 3.75 8 8zM288 208c0-61.75-50.25-112-112-112s-112 50.25-112 112 50.25 112 112 112 112-50.25 112-112zM416 416c0 17.75-14.25 32-32 32-8.5 0-16.75-3.5-22.5-9.5l-85.75-85.5c-29.25 20.25-64.25 31-99.75 31-97.25 0-176-78.75-176-176s78.75-176 176-176 176 78.75 176 176c0 35.5-10.75 70.5-31 99.75l85.75 85.75c5.75 5.75 9.25 14 9.25 22.5z"></path>',
'grayscale' => '<path fill="currentColor" d="M15.75 384h-15.75v-352h15.75v352zM31.5 383.75h-8v-351.75h8v351.75zM55 383.75h-7.75v-351.75h7.75v351.75zM94.25 383.75h-7.75v-351.75h7.75v351.75zM133.5 383.75h-15.5v-351.75h15.5v351.75zM165 383.75h-7.75v-351.75h7.75v351.75zM180.75 383.75h-7.75v-351.75h7.75v351.75zM196.5 383.75h-7.75v-351.75h7.75v351.75zM235.75 383.75h-15.75v-351.75h15.75v351.75zM275 383.75h-15.75v-351.75h15.75v351.75zM306.5 383.75h-15.75v-351.75h15.75v351.75zM338 383.75h-15.75v-351.75h15.75v351.75zM361.5 383.75h-15.75v-351.75h15.75v351.75zM408.75 383.75h-23.5v-351.75h23.5v351.75zM424.5 383.75h-8v-351.75h8v351.75zM448 384h-15.75v-352h15.75v352z"></path>',
'high_contrast' => '<path fill="currentColor" d="M192 360v-272c-75 0-136 61-136 136s61 136 136 136zM384 224c0 106-86 192-192 192s-192-86-192-192 86-192 192-192 192 86 192 192z"></path>',
'negative_contrast' => '<path fill="currentColor" d="M416 240c-23.75-36.75-56.25-68.25-95.25-88.25 10 17 15.25 36.5 15.25 56.25 0 61.75-50.25 112-112 112s-112-50.25-112-112c0-19.75 5.25-39.25 15.25-56.25-39 20-71.5 51.5-95.25 88.25 42.75 66 111.75 112 192 112s149.25-46 192-112zM236 144c0-6.5-5.5-12-12-12-41.75 0-76 34.25-76 76 0 6.5 5.5 12 12 12s12-5.5 12-12c0-28.5 23.5-52 52-52 6.5 0 12-5.5 12-12zM448 240c0 6.25-2 12-5 17.25-46 75.75-130.25 126.75-219 126.75s-173-51.25-219-126.75c-3-5.25-5-11-5-17.25s2-12 5-17.25c46-75.5 130.25-126.75 219-126.75s173 51.25 219 126.75c3 5.25 5 11 5 17.25z"></path>',
'light_bg' => '<path fill="currentColor" d="M184 144c0 4.25-3.75 8-8 8s-8-3.75-8-8c0-17.25-26.75-24-40-24-4.25 0-8-3.75-8-8s3.75-8 8-8c23.25 0 56 12.25 56 40zM224 144c0-50-50.75-80-96-80s-96 30-96 80c0 16 6.5 32.75 17 45 4.75 5.5 10.25 10.75 15.25 16.5 17.75 21.25 32.75 46.25 35.25 74.5h57c2.5-28.25 17.5-53.25 35.25-74.5 5-5.75 10.5-11 15.25-16.5 10.5-12.25 17-29 17-45zM256 144c0 25.75-8.5 48-25.75 67s-40 45.75-42 72.5c7.25 4.25 11.75 12.25 11.75 20.5 0 6-2.25 11.75-6.25 16 4 4.25 6.25 10 6.25 16 0 8.25-4.25 15.75-11.25 20.25 2 3.5 3.25 7.75 3.25 11.75 0 16.25-12.75 24-27.25 24-6.5 14.5-21 24-36.75 24s-30.25-9.5-36.75-24c-14.5 0-27.25-7.75-27.25-24 0-4 1.25-8.25 3.25-11.75-7-4.5-11.25-12-11.25-20.25 0-6 2.25-11.75 6.25-16-4-4.25-6.25-10-6.25-16 0-8.25 4.5-16.25 11.75-20.5-2-26.75-24.75-53.5-42-72.5s-25.75-41.25-25.75-67c0-68 64.75-112 128-112s128 44 128 112z"></path>',
'links_underline' => '<path fill="currentColor" d="M364 304c0-6.5-2.5-12.5-7-17l-52-52c-4.5-4.5-10.75-7-17-7-7.25 0-13 2.75-18 8 8.25 8.25 18 15.25 18 28 0 13.25-10.75 24-24 24-12.75 0-19.75-9.75-28-18-5.25 5-8.25 10.75-8.25 18.25 0 6.25 2.5 12.5 7 17l51.5 51.75c4.5 4.5 10.75 6.75 17 6.75s12.5-2.25 17-6.5l36.75-36.5c4.5-4.5 7-10.5 7-16.75zM188.25 127.75c0-6.25-2.5-12.5-7-17l-51.5-51.75c-4.5-4.5-10.75-7-17-7s-12.5 2.5-17 6.75l-36.75 36.5c-4.5 4.5-7 10.5-7 16.75 0 6.5 2.5 12.5 7 17l52 52c4.5 4.5 10.75 6.75 17 6.75 7.25 0 13-2.5 18-7.75-8.25-8.25-18-15.25-18-28 0-13.25 10.75-24 24-24 12.75 0 19.75 9.75 28 18 5.25-5 8.25-10.75 8.25-18.25zM412 304c0 19-7.75 37.5-21.25 50.75l-36.75 36.5c-13.5 13.5-31.75 20.75-50.75 20.75-19.25 0-37.5-7.5-51-21.25l-51.5-51.75c-13.5-13.5-20.75-31.75-20.75-50.75 0-19.75 8-38.5 22-52.25l-22-22c-13.75 14-32.25 22-52 22-19 0-37.5-7.5-51-21l-52-52c-13.75-13.75-21-31.75-21-51 0-19 7.75-37.5 21.25-50.75l36.75-36.5c13.5-13.5 31.75-20.75 50.75-20.75 19.25 0 37.5 7.5 51 21.25l51.5 51.75c13.5 13.5 20.75 31.75 20.75 50.75 0 19.75-8 38.5-22 52.25l22 22c13.75-14 32.25-22 52-22 19 0 37.5 7.5 51 21l52 52c13.75 13.75 21 31.75 21 51z"></path>',
'readable_font' => '<path fill="currentColor" d="M181.25 139.75l-42.5 112.5c24.75 0.25 49.5 1 74.25 1 4.75 0 9.5-0.25 14.25-0.5-13-38-28.25-76.75-46-113zM0 416l0.5-19.75c23.5-7.25 49-2.25 59.5-29.25l59.25-154 70-181h32c1 1.75 2 3.5 2.75 5.25l51.25 120c18.75 44.25 36 89 55 133 11.25 26 20 52.75 32.5 78.25 1.75 4 5.25 11.5 8.75 14.25 8.25 6.5 31.25 8 43 12.5 0.75 4.75 1.5 9.5 1.5 14.25 0 2.25-0.25 4.25-0.25 6.5-31.75 0-63.5-4-95.25-4-32.75 0-65.5 2.75-98.25 3.75 0-6.5 0.25-13 1-19.5l32.75-7c6.75-1.5 20-3.25 20-12.5 0-9-32.25-83.25-36.25-93.5l-112.5-0.5c-6.5 14.5-31.75 80-31.75 89.5 0 19.25 36.75 20 51 22 0.25 4.75 0.25 9.5 0.25 14.5 0 2.25-0.25 4.5-0.5 6.75-29 0-58.25-5-87.25-5-3.5 0-8.5 1.5-12 2-15.75 2.75-31.25 3.5-47 3.5z"></path>',
'reset' => '<path fill="currentColor" d="M384 224c0 105.75-86.25 192-192 192-57.25 0-111.25-25.25-147.75-69.25-2.5-3.25-2.25-8 0.5-10.75l34.25-34.5c1.75-1.5 4-2.25 6.25-2.25 2.25 0.25 4.5 1.25 5.75 3 24.5 31.75 61.25 49.75 101 49.75 70.5 0 128-57.5 128-128s-57.5-128-128-128c-32.75 0-63.75 12.5-87 34.25l34.25 34.5c4.75 4.5 6 11.5 3.5 17.25-2.5 6-8.25 10-14.75 10h-112c-8.75 0-16-7.25-16-16v-112c0-6.5 4-12.25 10-14.75 5.75-2.5 12.75-1.25 17.25 3.5l32.5 32.25c35.25-33.25 83-53 132.25-53 105.75 0 192 86.25 192 192z"></path>',
'sitemap' => '<path fill="currentColor" d="M448 312v80c0 13.25-10.75 24-24 24h-80c-13.25 0-24-10.75-24-24v-80c0-13.25 10.75-24 24-24h24v-48h-128v48h24c13.25 0 24 10.75 24 24v80c0 13.25-10.75 24-24 24h-80c-13.25 0-24-10.75-24-24v-80c0-13.25 10.75-24 24-24h24v-48h-128v48h24c13.25 0 24 10.75 24 24v80c0 13.25-10.75 24-24 24h-80c-13.25 0-24-10.75-24-24v-80c0-13.25 10.75-24 24-24h24v-48c0-17.5 14.5-32 32-32h128v-48h-24c-13.25 0-24-10.75-24-24v-80c0-13.25 10.75-24 24-24h80c13.25 0 24 10.75 24 24v80c0 13.25-10.75 24-24 24h-24v48h128c17.5 0 32 14.5 32 32v48h24c13.25 0 24 10.75 24 24z"></path>',
'help' => '<path fill="currentColor" d="M224 344v-48c0-4.5-3.5-8-8-8h-48c-4.5 0-8 3.5-8 8v48c0 4.5 3.5 8 8 8h48c4.5 0 8-3.5 8-8zM288 176c0-45.75-48-80-91-80-40.75 0-71.25 17.5-92.75 53.25-2.25 3.5-1.25 8 2 10.5l33 25c1.25 1 3 1.5 4.75 1.5 2.25 0 4.75-1 6.25-3 11.75-15 16.75-19.5 21.5-23 4.25-3 12.5-6 21.5-6 16 0 30.75 10.25 30.75 21.25 0 13-6.75 19.5-22 26.5-17.75 8-42 28.75-42 53v9c0 4.5 3.5 8 8 8h48c4.5 0 8-3.5 8-8v0c0-5.75 7.25-18 19-24.75 19-10.75 45-25.25 45-63.25zM384 224c0 106-86 192-192 192s-192-86-192-192 86-192 192-192 192 86 192 192z"></path>',
'feedback' => '<path fill="currentColor" d="M448 224c0 88.5-100.25 160-224 160-12.25 0-24.5-0.75-36.25-2-32.75 29-71.75 49.5-115 60.5-9 2.5-18.75 4.25-28.5 5.5-5.5 0.5-10.75-3.5-12-9.5v-0.25c-1.25-6.25 3-10 6.75-14.5 15.75-17.75 33.75-32.75 45.5-74.5-51.5-29.25-84.5-74.5-84.5-125.25 0-88.25 100.25-160 224-160s224 71.5 224 160z"></path>',
];
if ( isset( $icons[ $icon ] ) ) {
$icon_title_html = '';
if ( ! empty( $icon_title ) ) {
$icon_title_html = '<title>' . esc_html( $icon_title ) . '</title>';
}
return sprintf( '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1em" viewBox="0 0 448 448">%s%s</svg>', $icon_title_html, $icons[ $icon ] );
}
return '';
}
private function get_svg_icon( $icon ) {
if ( null === $this->svg_icons ) {
$this->svg_icons = [
'wheelchair' => '<g><path d="M60.4,78.9c-2.2,4.1-5.3,7.4-9.2,9.8c-4,2.4-8.3,3.6-13,3.6c-6.9,0-12.8-2.4-17.7-7.3c-4.9-4.9-7.3-10.8-7.3-17.7c0-5,1.4-9.5,4.1-13.7c2.7-4.2,6.4-7.2,10.9-9.2l-0.9-7.3c-6.3,2.3-11.4,6.2-15.3,11.8C7.9,54.4,6,60.6,6,67.3c0,5.8,1.4,11.2,4.3,16.1s6.8,8.8,11.7,11.7c4.9,2.9,10.3,4.3,16.1,4.3c7,0,13.3-2.1,18.9-6.2c5.7-4.1,9.6-9.5,11.7-16.2l-5.7-11.4C63.5,70.4,62.5,74.8,60.4,78.9z"/><path d="M93.8,71.3l-11.1,5.5L70,51.4c-0.6-1.3-1.7-2-3.2-2H41.3l-0.9-7.2h22.7v-7.2H39.6L37.5,19c2.5,0.3,4.8-0.5,6.7-2.3c1.9-1.8,2.9-4,2.9-6.6c0-2.5-0.9-4.6-2.6-6.3c-1.8-1.8-3.9-2.6-6.3-2.6c-2,0-3.8,0.6-5.4,1.8c-1.6,1.2-2.7,2.7-3.2,4.6c-0.3,1-0.4,1.8-0.3,2.3l5.4,43.5c0.1,0.9,0.5,1.6,1.2,2.3c0.7,0.6,1.5,0.9,2.4,0.9h26.4l13.4,26.7c0.6,1.3,1.7,2,3.2,2c0.6,0,1.1-0.1,1.6-0.4L97,77.7L93.8,71.3z"/></g>',
'one-click' => '<path d="M50 .8c5.7 0 10.4 4.7 10.4 10.4S55.7 21.6 50 21.6s-10.4-4.7-10.4-10.4S44.3.8 50 .8zM92.2 32l-21.9 2.3c-2.6.3-4.6 2.5-4.6 5.2V94c0 2.9-2.3 5.2-5.2 5.2H60c-2.7 0-4.9-2.1-5.2-4.7l-2.2-24.7c-.1-1.5-1.4-2.5-2.8-2.4-1.3.1-2.2 1.1-2.4 2.4l-2.2 24.7c-.2 2.7-2.5 4.7-5.2 4.7h-.5c-2.9 0-5.2-2.3-5.2-5.2V39.4c0-2.7-2-4.9-4.6-5.2L7.8 32c-2.6-.3-4.6-2.5-4.6-5.2v-.5c0-2.6 2.1-4.7 4.7-4.7h.5c19.3 1.8 33.2 2.8 41.7 2.8s22.4-.9 41.7-2.8c2.6-.2 4.9 1.6 5.2 4.3v1c-.1 2.6-2.1 4.8-4.8 5.1z"/>',
'accessibility' => '<path d="M50 8.1c23.2 0 41.9 18.8 41.9 41.9 0 23.2-18.8 41.9-41.9 41.9C26.8 91.9 8.1 73.2 8.1 50S26.8 8.1 50 8.1M50 0C22.4 0 0 22.4 0 50s22.4 50 50 50 50-22.4 50-50S77.6 0 50 0zm0 11.3c-21.4 0-38.7 17.3-38.7 38.7S28.6 88.7 50 88.7 88.7 71.4 88.7 50 71.4 11.3 50 11.3zm0 8.9c4 0 7.3 3.2 7.3 7.3S54 34.7 50 34.7s-7.3-3.2-7.3-7.3 3.3-7.2 7.3-7.2zm23.7 19.7c-5.8 1.4-11.2 2.6-16.6 3.2.2 20.4 2.5 24.8 5 31.4.7 1.9-.2 4-2.1 4.7-1.9.7-4-.2-4.7-2.1-1.8-4.5-3.4-8.2-4.5-15.8h-2c-1 7.6-2.7 11.3-4.5 15.8-.7 1.9-2.8 2.8-4.7 2.1-1.9-.7-2.8-2.8-2.1-4.7 2.6-6.6 4.9-11 5-31.4-5.4-.6-10.8-1.8-16.6-3.2-1.7-.4-2.8-2.1-2.4-3.9.4-1.7 2.1-2.8 3.9-2.4 19.5 4.6 25.1 4.6 44.5 0 1.7-.4 3.5.7 3.9 2.4.7 1.8-.3 3.5-2.1 3.9z"/>',
];
}
if ( isset( $this->svg_icons[ $icon ] ) ) {
return $this->svg_icons[ $icon ];
}
return $this->svg_icons['accessibility'];
}
public function __construct() {
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
add_action( 'wp_footer', [ $this, 'print_skip_to_content_link' ], 20 );
add_action( 'wp_footer', [ $this, 'print_toolbar' ], 30 );
}
}