From be94f148a300732e739346c89e61d6348f7230a3 Mon Sep 17 00:00:00 2001 From: Luiz Kowalski Date: Mon, 26 Aug 2024 11:18:45 -0300 Subject: [PATCH 1/5] Jetpack AI: fair usage quota handling on the UI, part 1 (#39043) * Add first draft of fair usage notice, for the generic upgrade prompt * Changelog * Move the fair usage component closer to the exported component * Move the fair usage notice to it's own subcomponent * Rename exported component to a generic name * Update style to expand to 100% of available width * Move width rule to the right place to apply only on image modal * Rename UpgradeMessage component to QuotaExceededMessage * Fix image modal to disable the UI when the site requires an upgrade --- ...tpack-ai-handle-fair-usage-quota-messaging | 4 +++ .../index.tsx | 33 +++++++++++++++---- .../light-nudge.tsx | 0 .../style.scss | 0 .../extensions/blocks/ai-assistant/edit.js | 4 +-- .../components/ai-assistant-bar/index.tsx | 4 +-- .../ai-image/components/ai-image-modal.scss | 4 +++ .../ai-image/components/ai-image-modal.tsx | 6 ++-- .../extend/ai-post-excerpt/index.tsx | 4 +-- 9 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/update-jetpack-ai-handle-fair-usage-quota-messaging rename projects/plugins/jetpack/extensions/blocks/ai-assistant/components/{upgrade-prompt => quota-exceeded-message}/index.tsx (87%) rename projects/plugins/jetpack/extensions/blocks/ai-assistant/components/{upgrade-prompt => quota-exceeded-message}/light-nudge.tsx (100%) rename projects/plugins/jetpack/extensions/blocks/ai-assistant/components/{upgrade-prompt => quota-exceeded-message}/style.scss (100%) diff --git a/projects/plugins/jetpack/changelog/update-jetpack-ai-handle-fair-usage-quota-messaging b/projects/plugins/jetpack/changelog/update-jetpack-ai-handle-fair-usage-quota-messaging new file mode 100644 index 0000000000000..2e8da6cbdde15 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-jetpack-ai-handle-fair-usage-quota-messaging @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +Jetpack AI: handle fair usage limit messaging on the UI. diff --git a/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/index.tsx b/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/index.tsx similarity index 87% rename from projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/index.tsx rename to projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/index.tsx index 2cc2bb849a115..7c3feca5a26e4 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/index.tsx +++ b/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/index.tsx @@ -3,6 +3,7 @@ */ import { getRedirectUrl } from '@automattic/jetpack-components'; import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; +import { Notice } from '@wordpress/components'; import { createInterpolateElement, useCallback } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import debugFactory from 'debug'; @@ -17,7 +18,7 @@ import { LightNudge } from './light-nudge'; import type { ReactElement } from 'react'; import './style.scss'; -type UpgradePromptProps = { +type QuotaExceededMessageProps = { placement?: string; description?: string; useLightNudge?: boolean; @@ -28,14 +29,14 @@ const debug = debugFactory( 'jetpack-ai-assistant:upgrade-prompt' ); * The default upgrade prompt for the AI Assistant block, containing the Upgrade button and linking * to the checkout page or the Jetpack AI interstitial page. * - * @param {UpgradePromptProps} props - Component props. + * @param {QuotaExceededMessageProps} props - Component props. * @return {ReactElement} the Nudge component with the prompt. */ const DefaultUpgradePrompt = ( { placement = null, description = null, useLightNudge = false, -}: UpgradePromptProps ): ReactElement => { +}: QuotaExceededMessageProps ): ReactElement => { const Nudge = useLightNudge ? LightNudge : StandardNudge; const { checkoutUrl } = useAICheckout(); @@ -209,8 +210,28 @@ const VIPUpgradePrompt = ( { ); }; -const UpgradePrompt = props => { - const { upgradeType } = useAiFeature(); +/** + * The fair usage notice component. + * @return {ReactElement} the Notice component with the fair usage message. + */ +const FairUsageNotice = () => { + return ( + + { __( + 'You exceeded your current quota of requests. Check the usage policy for more information.', + 'jetpack' + ) } + + ); +}; + +const QuotaExceededMessage = props => { + const { upgradeType, currentTier } = useAiFeature(); + + // Return notice component for the fair usage limit message, on unlimited plans. + if ( currentTier?.value === 1 ) { + return ; + } // If the user is on a VIP site, show the VIP upgrade prompt. if ( upgradeType === 'vip' ) { @@ -223,4 +244,4 @@ const UpgradePrompt = props => { return DefaultUpgradePrompt( props ); }; -export default UpgradePrompt; +export default QuotaExceededMessage; diff --git a/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/light-nudge.tsx b/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/light-nudge.tsx similarity index 100% rename from projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/light-nudge.tsx rename to projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/light-nudge.tsx diff --git a/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/style.scss b/projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/style.scss similarity index 100% rename from projects/plugins/jetpack/extensions/blocks/ai-assistant/components/upgrade-prompt/style.scss rename to projects/plugins/jetpack/extensions/blocks/ai-assistant/components/quota-exceeded-message/style.scss diff --git a/projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js b/projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js index f5f1107a8b7a0..b8e65c0df2338 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js +++ b/projects/plugins/jetpack/extensions/blocks/ai-assistant/edit.js @@ -29,8 +29,8 @@ import { USAGE_PANEL_PLACEMENT_BLOCK_SETTINGS_SIDEBAR } from '../../plugins/ai-a import { PLAN_TYPE_FREE, usePlanType } from '../../shared/use-plan-type'; import ConnectPrompt from './components/connect-prompt'; import FeedbackControl from './components/feedback-control'; +import QuotaExceededMessage from './components/quota-exceeded-message'; import ToolbarControls from './components/toolbar-controls'; -import UpgradePrompt from './components/upgrade-prompt'; import { getStoreBlockId } from './extensions/ai-assistant/with-ai-assistant'; import useAIAssistant from './hooks/use-ai-assistant'; import useAICheckout from './hooks/use-ai-checkout'; @@ -303,7 +303,7 @@ export default function AIAssistantEdit( { attributes, setAttributes, clientId, const banner = ( <> - { isOverLimit && isSelected && } + { isOverLimit && isSelected && } { ! connected && } ); diff --git a/projects/plugins/jetpack/extensions/blocks/ai-assistant/extensions/jetpack-contact-form/components/ai-assistant-bar/index.tsx b/projects/plugins/jetpack/extensions/blocks/ai-assistant/extensions/jetpack-contact-form/components/ai-assistant-bar/index.tsx index edc6f7bdd4da9..75fbb13963429 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-assistant/extensions/jetpack-contact-form/components/ai-assistant-bar/index.tsx +++ b/projects/plugins/jetpack/extensions/blocks/ai-assistant/extensions/jetpack-contact-form/components/ai-assistant-bar/index.tsx @@ -24,7 +24,7 @@ import React from 'react'; * Internal dependencies */ import ConnectPrompt from '../../../../components/connect-prompt'; -import UpgradePrompt from '../../../../components/upgrade-prompt'; +import QuotaExceededMessage from '../../../../components/quota-exceeded-message'; import useAiFeature from '../../../../hooks/use-ai-feature'; import { isUserConnected } from '../../../../lib/connection'; import { getJetpackFormCustomPrompt } from '../../../../lib/prompt'; @@ -267,7 +267,7 @@ export default function AiAssistantBar( { } ) } tabIndex={ -1 } > - { siteRequireUpgrade && } + { siteRequireUpgrade && } { ! connected && } { upgradePromptVisible && ( - ) } - { isOverLimit && } + { isOverLimit && } Date: Mon, 26 Aug 2024 11:31:42 -0400 Subject: [PATCH 2/5] Custom CSS: remove feature from Jetpack plugin (#38865) * Remove Custom CSS feature from Jetpack plugin * changelog * Remove toggle from setting card * Remove Custom CSS card from Jetpack settings * Remove Custom CSS module from Jetpack plugin * Prevent Phan issues * changelog * Fix bad conflict resolve * Update jetpack-mu-wpcom changelog message * Update masterbar changelog message * Bump package version * Bump masterbar package version --- .../changelog/remove-custom-css-warnings | 5 + .../src/features/custom-css/custom-css.php | 1 - .../changelog/remove-custom-css-warnings | 5 + projects/packages/masterbar/package.json | 2 +- .../masterbar/src/admin-menu/load.php | 1 + .../packages/masterbar/src/class-main.php | 2 +- projects/plugins/jetpack/.phan/baseline.php | 5 - projects/plugins/jetpack/.phan/config.php | 1 - .../components/jetpack-notices/index.jsx | 11 +- .../settings-card/test/component.js | 1 - .../settings-group/test/component.js | 1 - .../_inc/client/writing/custom-css.jsx | 187 - .../jetpack/_inc/client/writing/index.jsx | 1 - .../jetpack/_inc/client/writing/style.scss | 57 - .../client/writing/theme-enhancements.jsx | 7 +- ...-wpcom-rest-api-v2-endpoint-admin-menu.php | 1 + .../changelog/remove-custom-css-warnings | 4 + projects/plugins/jetpack/class.jetpack.php | 3 - .../plugins/jetpack/modules/custom-css.php | 64 - .../csstidy/class.csstidy-ctype.php | 52 - .../csstidy/class.csstidy-optimise.php | 1005 ----- .../csstidy/class.csstidy-print.php | 433 -- .../custom-css/csstidy/class.csstidy.php | 1309 ------ .../modules/custom-css/csstidy/cssparse.css | 118 - .../modules/custom-css/csstidy/cssparsed.css | 29 - .../custom-css/csstidy/data-wp.inc.php | 101 - .../modules/custom-css/csstidy/data.inc.php | 794 ---- .../modules/custom-css/csstidy/lang.inc.php | 303 -- .../custom-css/csstidy/wordpress-standard.tpl | 10 - .../jetpack/modules/custom-css/custom-css.php | 1366 ------ .../custom-css/custom-css/css/blank.css | 1 - .../custom-css/custom-css/css/codemirror.css | 262 -- .../custom-css/css/customizer-control.css | 145 - .../custom-css/js/codemirror.min.js | 11 - .../js/core-customizer-css-preview.js | 42 - .../js/core-customizer-css.core-4.9.js | 93 - .../custom-css/custom-css/preprocessors.php | 76 - .../custom-css/preprocessors/lessc.inc.php | 3775 ----------------- .../modules/masterbar/admin-menu/load.php | 1 + .../plugins/jetpack/modules/module-info.php | 20 - projects/plugins/jetpack/phpunit.xml.dist | 3 - .../csstidy/test-class.jetpack-csstidy.php | 108 - .../jetpack/tests/php/test-get-modules.php | 1 - .../jetpack/tools/webpack.config.css.js | 3 - .../plugins/jetpack/tools/webpack.config.js | 1 - 45 files changed, 22 insertions(+), 10399 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/remove-custom-css-warnings create mode 100644 projects/packages/masterbar/changelog/remove-custom-css-warnings delete mode 100644 projects/plugins/jetpack/_inc/client/writing/custom-css.jsx create mode 100644 projects/plugins/jetpack/changelog/remove-custom-css-warnings delete mode 100644 projects/plugins/jetpack/modules/custom-css.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-ctype.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-optimise.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-print.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/cssparse.css delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/cssparsed.css delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/data.inc.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/csstidy/wordpress-standard.tpl delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/css/blank.css delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.css delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/js/codemirror.min.js delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css-preview.js delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors.php delete mode 100644 projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php delete mode 100644 projects/plugins/jetpack/tests/php/modules/csstidy/test-class.jetpack-csstidy.php diff --git a/projects/packages/jetpack-mu-wpcom/changelog/remove-custom-css-warnings b/projects/packages/jetpack-mu-wpcom/changelog/remove-custom-css-warnings new file mode 100644 index 0000000000000..1f01d21832950 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/remove-custom-css-warnings @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Remove Phan comment + + diff --git a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php index bb7ef3b786e84..eda09f550b0e1 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php @@ -1,7 +1,6 @@ ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanUndeclaredFunction'], 'modules/comments/subscription-modal-on-comment/class-jetpack-subscription-modal-on-comment.php' => ['PhanTypeMismatchReturnNullable'], 'modules/copy-post.php' => ['PhanNoopNew'], - 'modules/custom-css/csstidy/class.csstidy-ctype.php' => ['PhanRedefineFunctionInternal'], - 'modules/custom-css/csstidy/class.csstidy-optimise.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginSimplifyExpressionBool', 'PhanTypeComparisonFromArray', 'PhanTypeConversionFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidRightOperandOfNumericOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchReturnProbablyReal'], - 'modules/custom-css/csstidy/class.csstidy-print.php' => ['PhanPluginRedundantAssignmentInLoop', 'PhanTypeMismatchReturn'], - 'modules/custom-css/csstidy/class.csstidy.php' => ['PhanCompatibleNegativeStringOffset', 'PhanImpossibleCondition', 'PhanInfiniteRecursion', 'PhanParamTooMany', 'PhanRedundantCondition', 'PhanTypeMismatchArgument'], - 'modules/custom-css/custom-css.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], 'modules/custom-post-types/nova.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'], 'modules/custom-post-types/portfolios.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'], 'modules/custom-post-types/testimonial.php' => ['PhanTypeMismatchArgumentProbablyReal'], diff --git a/projects/plugins/jetpack/.phan/config.php b/projects/plugins/jetpack/.phan/config.php index f1bdc31787fbc..f62a26300d741 100644 --- a/projects/plugins/jetpack/.phan/config.php +++ b/projects/plugins/jetpack/.phan/config.php @@ -29,7 +29,6 @@ 'exclude_analysis_directory_list' => array( // This file breaks analysis, Phan gets lost recursing in trying to figure out some types. // @todo Add type declarations so Phan won't have to do it itself. Or update to a modern less lib. - 'modules/custom-css/custom-css/preprocessors/lessc.inc.php', ), 'parse_file_list' => array( // Reference files to handle code checking for stuff from other in-monorepo plugins. diff --git a/projects/plugins/jetpack/_inc/client/components/jetpack-notices/index.jsx b/projects/plugins/jetpack/_inc/client/components/jetpack-notices/index.jsx index 55afb625d29f3..808bdb3bc04f1 100644 --- a/projects/plugins/jetpack/_inc/client/components/jetpack-notices/index.jsx +++ b/projects/plugins/jetpack/_inc/client/components/jetpack-notices/index.jsx @@ -30,13 +30,10 @@ import { userCanConnectSite, userIsSubscriber, getConnectionErrors, - getSiteAdminUrl, isWoASite, } from 'state/initial-state'; import { getLicensingError, clearLicensingError } from 'state/licensing'; -import { getModule } from 'state/modules'; import { getSiteDataErrors } from 'state/site'; -import { StartFreshDeprecationWarning } from '../../writing/custom-css'; import DismissableNotices from './dismissable'; import JetpackConnectionErrors from './jetpack-connection-errors'; import PlanConflictWarning from './plan-conflict-warning'; @@ -272,11 +269,7 @@ class JetpackNotices extends React.Component { onDismissClick={ this.props.clearLicensingError } /> ) } - { this.props.startFreshEnabled && ( - - - - ) } + { showMasterbarNotice && ( { 'markdown', 'infinite-scroll', 'gravatar-hovercards', - 'custom-css', 'sharedaddy', 'widgets', 'shortcodes', diff --git a/projects/plugins/jetpack/_inc/client/components/settings-group/test/component.js b/projects/plugins/jetpack/_inc/client/components/settings-group/test/component.js index 368959bd5c180..187dd7b951410 100644 --- a/projects/plugins/jetpack/_inc/client/components/settings-group/test/component.js +++ b/projects/plugins/jetpack/_inc/client/components/settings-group/test/component.js @@ -16,7 +16,6 @@ describe( 'SettingsGroup', () => { 'markdown', 'infinite-scroll', 'gravatar-hovercards', - 'custom-css', 'sharedaddy', 'widgets', 'shortcodes', diff --git a/projects/plugins/jetpack/_inc/client/writing/custom-css.jsx b/projects/plugins/jetpack/_inc/client/writing/custom-css.jsx deleted file mode 100644 index 948967a397eee..0000000000000 --- a/projects/plugins/jetpack/_inc/client/writing/custom-css.jsx +++ /dev/null @@ -1,187 +0,0 @@ -import { getRedirectUrl } from '@automattic/jetpack-components'; -import { ExternalLink, Notice } from '@wordpress/components'; -import { createInterpolateElement } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; -import Button from 'components/button'; -import { FormLegend } from 'components/forms'; -import { withModuleSettingsFormHelpers } from 'components/module-settings/with-module-settings-form-helpers'; -import { ModuleToggle } from 'components/module-toggle'; -import SettingsGroup from 'components/settings-group'; -import analytics from 'lib/analytics'; -import React from 'react'; -import { connect } from 'react-redux'; -import { currentThemeIsBlockTheme, getSiteAdminUrl } from 'state/initial-state'; -import { getModule } from 'state/modules'; - -const trackVisitGlobalStyles = () => { - analytics.tracks.recordJetpackClick( { - target: 'visit-global-styles', - feature: 'custom-css', - extra: 'not-supported-link', - } ); -}; - -const trackVisitCustomizer = () => { - analytics.tracks.recordJetpackClick( { - target: 'visit-customizer', - feature: 'custom-css', - extra: 'not-supported-link', - } ); -}; - -const CustomizerLink = ( { children, siteAdminUrl } ) => ( - - { children } - -); - -export const StartFreshDeprecationWarning = ( { siteAdminUrl } ) => - createInterpolateElement( - __( - "The Start Fresh option in the CSS customization panel is enabled, which means the theme's original CSS is not applied. This option will no longer be supported after August 6, 2024. See how to keep your site intact.", - 'jetpack' - ), - { - i: , - b: , - a1: , - a2: , - } - ); - -/** - * Custom CSS settings component. - * - * @param {object} props - Component props. - * @return {React.Component} Custom CSS settings component. - */ -function CustomCss( props ) { - const { - customCssActive, - customCssModule: { name, description, module, options }, - isBlockThemeActive, - isSavingAnyOption, - siteAdminUrl, - toggleModuleNow, - } = props; - - const recommendSiteEditor = () => { - return ( -
-
- { createInterpolateElement( - __( - 'Your site has a block theme that allows you to apply custom CSS from the Site Editor. Learn more.', - 'jetpack' - ), - { - a: ( - - ), - } - ) } -
- { ! customCssActive && ( -
- -
- ) } -
- ); - }; - - const customizerLink = () => { - return ( -
- { createInterpolateElement( - __( - 'Additional CSS can be added from the Customizer. Enable the enhanced Custom CSS feature below to add additional features. Access the Customizer here.', - 'jetpack' - ), - { - a: , - } - ) } -
- ); - }; - - const toggleModule = () => { - // If we're using a block theme and the feature is disabled, we don't want to show the toggle. - if ( isBlockThemeActive && ! customCssActive ) { - return null; - } - - return ( - - - { __( 'Enhance CSS customization panel', 'jetpack' ) } - - - ); - }; - - const supportText = () => { - if ( isBlockThemeActive ) { - return {}; - } - - return { - text: description, - link: getRedirectUrl( 'jetpack-support-custom-css' ), - }; - }; - - return ( - - { name } - { options?.replace && ( - - { ' ' } - - ) } - { isBlockThemeActive && recommendSiteEditor() } - { ! isBlockThemeActive && customizerLink() } - { toggleModule() } - - ); -} - -export default withModuleSettingsFormHelpers( - connect( ( state, ownProps ) => { - return { - customCssActive: ownProps.getOptionValue( 'custom-css' ), - customCssModule: getModule( state, 'custom-css' ), - isBlockThemeActive: currentThemeIsBlockTheme( state ), - siteAdminUrl: getSiteAdminUrl( state ), - }; - } )( CustomCss ) -); diff --git a/projects/plugins/jetpack/_inc/client/writing/index.jsx b/projects/plugins/jetpack/_inc/client/writing/index.jsx index 9906411e838d2..0a62e77f137eb 100644 --- a/projects/plugins/jetpack/_inc/client/writing/index.jsx +++ b/projects/plugins/jetpack/_inc/client/writing/index.jsx @@ -36,7 +36,6 @@ export class Writing extends React.Component { const found = [ 'carousel', 'copy-post', - 'custom-css', 'latex', 'masterbar', 'markdown', diff --git a/projects/plugins/jetpack/_inc/client/writing/style.scss b/projects/plugins/jetpack/_inc/client/writing/style.scss index afa37f8f3c365..e69de29bb2d1d 100644 --- a/projects/plugins/jetpack/_inc/client/writing/style.scss +++ b/projects/plugins/jetpack/_inc/client/writing/style.scss @@ -1,57 +0,0 @@ -@import '../scss/calypso-colors'; - -/* Custom CSS settings */ -.jp-custom-css-site-editor { - @include breakpoint('>660px') { - display: flex; - flex-wrap: nowrap; - flex-direction: row; - align-items: center; - } -} - -.jp-custom-css-site-editor__text { - font-size: $font-body-small; - line-height: 1.5; - letter-spacing: -0.3px; - color: $gray-80; - flex-grow: 1; - - @include breakpoint('<660px') { - padding: 0 0 rem(16px); - } - - @include breakpoint('>660px') { - flex-basis: 50%; - padding: 0 rem(16px) 0 0; - } -} - -.jp-custom-css-site-editor__button { - text-align: left; - - button.dops-button.is-primary { - padding: 4px 20px; - font-size: $font-body-small; - - &:focus { - border: 1px solid $white; - box-shadow: 0 0 0 1px $black; - } - } - - @include breakpoint('>660px') { - flex-grow: 0; - margin-left: 64px; - } -} - -.jp-custom-css__module-toggle { - @include breakpoint('>660px') { - padding: rem(16px) 0 0; - } -} - -.jp-custom-css__deprecation-warning { - margin-bottom: 1rem; -} diff --git a/projects/plugins/jetpack/_inc/client/writing/theme-enhancements.jsx b/projects/plugins/jetpack/_inc/client/writing/theme-enhancements.jsx index ccdcf25e52c37..a6c58586402c3 100644 --- a/projects/plugins/jetpack/_inc/client/writing/theme-enhancements.jsx +++ b/projects/plugins/jetpack/_inc/client/writing/theme-enhancements.jsx @@ -11,7 +11,6 @@ import { connect } from 'react-redux'; import { currentThemeSupports } from 'state/initial-state'; import { getModule } from 'state/modules'; import { isModuleFound } from 'state/search'; -import CustomCss from './custom-css'; class ThemeEnhancements extends React.Component { /** @@ -99,10 +98,9 @@ class ThemeEnhancements extends React.Component { }; render() { - const foundInfiniteScroll = this.props.isModuleFound( 'infinite-scroll' ), - foundCustomCSS = this.props.isModuleFound( 'custom-css' ); + const foundInfiniteScroll = this.props.isModuleFound( 'infinite-scroll' ); - if ( ! foundInfiniteScroll && ! foundCustomCSS ) { + if ( ! foundInfiniteScroll ) { return null; } @@ -185,7 +183,6 @@ class ThemeEnhancements extends React.Component { ) } ) } - { foundCustomCSS && } ); } diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php index d157eb2f3e222..c139cbe556363 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php @@ -118,6 +118,7 @@ private function hide_customizer_menu_on_block_theme() { remove_action( 'customize_register', 'Automattic\Jetpack\Masterbar\register_css_nudge_control' ); } + // @phan-suppress-next-line PhanUndeclaredClassInCallable remove_action( 'customize_register', array( 'Jetpack_Custom_CSS_Enhancements', 'customize_register' ) ); } } diff --git a/projects/plugins/jetpack/changelog/remove-custom-css-warnings b/projects/plugins/jetpack/changelog/remove-custom-css-warnings new file mode 100644 index 0000000000000..46af7496437a3 --- /dev/null +++ b/projects/plugins/jetpack/changelog/remove-custom-css-warnings @@ -0,0 +1,4 @@ +Significance: major +Type: major + +Jetpack Custom CSS: remove feature in favor of WordPress core implementation diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index fa0a279635a60..11ac2ae9c2b26 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -159,9 +159,6 @@ class Jetpack { array( 'grunion-contact-form/grunion-contact-form.php', 'Grunion Contact Form' ), array( 'mullet/mullet-contact-form.php', 'Mullet Contact Form' ), ), - 'custom-css' => array( - array( 'safecss/safecss.php', 'WordPress.com Custom CSS' ), - ), 'gravatar-hovercards' => array( array( 'jetpack-gravatar-hovercards/gravatar-hovercards.php', 'Jetpack Gravatar Hovercards' ), ), diff --git a/projects/plugins/jetpack/modules/custom-css.php b/projects/plugins/jetpack/modules/custom-css.php deleted file mode 100644 index b797addb63fbf..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css.php +++ /dev/null @@ -1,64 +0,0 @@ - wp_get_referer() ) - ); - } -} - -// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores -if ( ! apply_filters( 'jetpack_module_configurable_custom-css', null ) ) { - add_action( 'jetpack_modules_loaded', 'custom_css_loaded' ); - - jetpack_load_custom_css(); -} diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-ctype.php b/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-ctype.php deleted file mode 100644 index e91d5936c2a5a..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-ctype.php +++ /dev/null @@ -1,52 +0,0 @@ -. - * - * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2007 - * @author Brett Zamir (brettz9 at yahoo dot com) 2007 - * @author Nikolay Matsievsky (speed at webo dot name) 2009-2010 - */ - -/** - * CSS Optimising Class - * - * This class optimises CSS data generated by csstidy. - * - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2006 - * @version 1.0 - */ -#[AllowDynamicProperties] -class csstidy_optimise { // phpcs:ignore - /** - * Constructor - * - * @param array $css contains the class csstidy. - * @access private - * @version 1.0 - */ - public function __construct( &$css ) { - $this->parser = & $css; - $this->css = & $css->css; - $this->sub_value = & $css->sub_value; - $this->at = & $css->at; - $this->selector = & $css->selector; - $this->property = & $css->property; - $this->value = & $css->value; - } - - /** - * Call constructor function. - * - * @param object $css - the CSS. - */ - public function csstidy_optimise( &$css ) { - $this->__construct( $css ); - } - - /** - * Optimises $css after parsing - * - * @access public - * @version 1.0 - */ - public function postparse() { - if ( $this->parser->get_cfg( 'preserve_css' ) ) { - return; - } - - if ( $this->parser->get_cfg( 'merge_selectors' ) === 2 ) { - foreach ( $this->css as $medium => $value ) { - $this->merge_selectors( $this->css[ $medium ] ); - } - } - - if ( $this->parser->get_cfg( 'discard_invalid_selectors' ) ) { - foreach ( $this->css as $medium => $value ) { - $this->discard_invalid_selectors( $this->css[ $medium ] ); - } - } - - if ( $this->parser->get_cfg( 'optimise_shorthands' ) > 0 ) { - foreach ( $this->css as $medium => $value ) { - foreach ( $value as $selector => $value1 ) { - $this->css[ $medium ][ $selector ] = self::merge_4value_shorthands( $this->css[ $medium ][ $selector ] ); - - if ( $this->parser->get_cfg( 'optimise_shorthands' ) < 2 ) { - continue; - } - - $this->css[ $medium ][ $selector ] = self::merge_font( $this->css[ $medium ][ $selector ] ); - - if ( $this->parser->get_cfg( 'optimise_shorthands' ) < 3 ) { - continue; - } - - $this->css[ $medium ][ $selector ] = self::merge_bg( $this->css[ $medium ][ $selector ] ); - if ( empty( $this->css[ $medium ][ $selector ] ) ) { - unset( $this->css[ $medium ][ $selector ] ); - } - } - } - } - } - - /** - * Optimises values - * - * @access public - * @version 1.0 - */ - public function value() { - $shorthands = & $GLOBALS['csstidy']['shorthands']; - - // optimise shorthand properties. - if ( isset( $shorthands[ $this->property ] ) ) { - $temp = self::shorthand( $this->value ); // FIXME - move. - if ( $temp !== $this->value ) { - $this->parser->log( 'Optimised shorthand notation (' . $this->property . '): Changed "' . $this->value . '" to "' . $temp . '"', 'Information' ); - } - $this->value = $temp; - } - - // Remove whitespace at ! important. - if ( $this->value !== $this->compress_important( $this->value ) ) { - $this->parser->log( 'Optimised !important', 'Information' ); - } - } - - /** - * Optimises shorthands - * - * @access public - * @version 1.0 - */ - public function shorthands() { - $shorthands = & $GLOBALS['csstidy']['shorthands']; - - if ( ! $this->parser->get_cfg( 'optimise_shorthands' ) || $this->parser->get_cfg( 'preserve_css' ) ) { - return; - } - - if ( $this->property === 'font' && $this->parser->get_cfg( 'optimise_shorthands' ) > 1 ) { - $this->css[ $this->at ][ $this->selector ]['font'] = ''; - $this->parser->merge_css_blocks( $this->at, $this->selector, self::dissolve_short_font( $this->value ) ); - } - if ( $this->property === 'background' && $this->parser->get_cfg( 'optimise_shorthands' ) > 2 ) { - $this->css[ $this->at ][ $this->selector ]['background'] = ''; - $this->parser->merge_css_blocks( $this->at, $this->selector, self::dissolve_short_bg( $this->value ) ); - } - if ( isset( $shorthands[ $this->property ] ) ) { - $this->parser->merge_css_blocks( $this->at, $this->selector, self::dissolve_4value_shorthands( $this->property, $this->value ) ); - if ( is_array( $shorthands[ $this->property ] ) ) { - $this->css[ $this->at ][ $this->selector ][ $this->property ] = ''; - } - } - } - - /** - * Optimises a sub-value - * - * @access public - * @version 1.0 - */ - public function subvalue() { - $replace_colors = & $GLOBALS['csstidy']['replace_colors']; - - $this->sub_value = trim( $this->sub_value ); - if ( $this->sub_value === '' ) { - return; - } - - $important = ''; - if ( csstidy::is_important( $this->sub_value ) ) { - $important = '!important'; - } - $this->sub_value = csstidy::gvw_important( $this->sub_value ); - - // Compress font-weight. - if ( $this->property === 'font-weight' && $this->parser->get_cfg( 'compress_font-weight' ) ) { - if ( $this->sub_value === 'bold' ) { - $this->sub_value = '700'; - $this->parser->log( 'Optimised font-weight: Changed "bold" to "700"', 'Information' ); - } elseif ( $this->sub_value === 'normal' ) { - $this->sub_value = '400'; - $this->parser->log( 'Optimised font-weight: Changed "normal" to "400"', 'Information' ); - } - } - - $temp = $this->compress_numbers( $this->sub_value ); - if ( strcasecmp( $temp, $this->sub_value ) !== 0 ) { - if ( strlen( $temp ) > strlen( $this->sub_value ) ) { - $this->parser->log( 'Fixed invalid number: Changed "' . $this->sub_value . '" to "' . $temp . '"', 'Warning' ); - } else { - $this->parser->log( 'Optimised number: Changed "' . $this->sub_value . '" to "' . $temp . '"', 'Information' ); - } - $this->sub_value = $temp; - } - if ( $this->parser->get_cfg( 'compress_colors' ) ) { - $temp = $this->cut_color( $this->sub_value ); - if ( $temp !== $this->sub_value ) { - if ( isset( $replace_colors[ $this->sub_value ] ) ) { - $this->parser->log( 'Fixed invalid color name: Changed "' . $this->sub_value . '" to "' . $temp . '"', 'Warning' ); - } else { - $this->parser->log( 'Optimised color: Changed "' . $this->sub_value . '" to "' . $temp . '"', 'Information' ); - } - $this->sub_value = $temp; - } - } - $this->sub_value .= $important; - } - - /** - * Compresses shorthand values. Example: margin:1px 1px 1px 1px -> margin:1px - * - * @param string $value - the value. - * @access public - * @return string - * @version 1.0 - */ - public static function shorthand( $value ) { - $important = ''; - if ( csstidy::is_important( $value ) ) { - $values = csstidy::gvw_important( $value ); - $important = '!important'; - } else { - $values = $value; - } - - $values = explode( ' ', $values ); - switch ( count( $values ) ) { - case 4: - if ( $values[0] === $values[1] && $values[0] === $values[2] && $values[0] === $values[3] ) { - return $values[0] . $important; - } elseif ( $values[1] === $values[3] && $values[0] === $values[2] ) { - return $values[0] . ' ' . $values[1] . $important; - } elseif ( $values[1] === $values[3] ) { - return $values[0] . ' ' . $values[1] . ' ' . $values[2] . $important; - } - break; - - case 3: - if ( $values[0] === $values[1] && $values[0] === $values[2] ) { - return $values[0] . $important; - } elseif ( $values[0] === $values[2] ) { - return $values[0] . ' ' . $values[1] . $important; - } - break; - - case 2: - if ( $values[0] === $values[1] ) { - return $values[0] . $important; - } - break; - } - - return $value; - } - - /** - * Removes unnecessary whitespace in ! important - * - * @param string $string - the string. - * @return string - * @access public - * @version 1.1 - */ - public function compress_important( &$string ) { - if ( csstidy::is_important( $string ) ) { - $string = csstidy::gvw_important( $string ) . ' !important'; } - return $string; - } - - /** - * Color compression function. Converts all rgb() values to #-values and uses the short-form if possible. Also replaces 4 color names by #-values. - * - * @param string $color - the color. - * @return string - * @version 1.1 - */ - public function cut_color( $color ) { - $replace_colors = & $GLOBALS['csstidy']['replace_colors']; - - // an example: rgb(0,0,0) -> #000000 (or #000 in this case later). - if ( strtolower( substr( $color, 0, 4 ) ) === 'rgb(' ) { - $color_tmp = substr( $color, 4, strlen( $color ) - 5 ); - $color_tmp = explode( ',', $color_tmp ); - for ( $i = 0, $l = count( $color_tmp ); $i < $l; $i++ ) { - $color_tmp[ $i ] = trim( $color_tmp[ $i ] ); - if ( str_ends_with( $color_tmp[ $i ], '%' ) ) { - $color_tmp[ $i ] = round( ( 255 * $color_tmp[ $i ] ) / 100 ); - } - if ( $color_tmp[ $i ] > 255 ) { - $color_tmp[ $i ] = 255; - } - } - $color = '#'; - for ( $i = 0; $i < 3; $i++ ) { - if ( $color_tmp[ $i ] < 16 ) { - $color .= '0' . dechex( $color_tmp[ $i ] ); - } else { - $color .= dechex( $color_tmp[ $i ] ); - } - } - } - - // Fix bad color names. - if ( isset( $replace_colors[ strtolower( $color ) ] ) ) { - $color = $replace_colors[ strtolower( $color ) ]; - } - - // #aabbcc -> #abc - if ( strlen( $color ) === 7 ) { - $color_temp = strtolower( $color ); - if ( $color_temp[0] === '#' && $color_temp[1] === $color_temp[2] && $color_temp[3] === $color_temp[4] && $color_temp[5] === $color_temp[6] ) { - $color = '#' . $color[1] . $color[3] . $color[5]; - } - } - - switch ( strtolower( $color ) ) { - /* color name -> hex code */ - case 'black': - return '#000'; - case 'fuchsia': - return '#f0f'; - case 'white': - return '#fff'; - case 'yellow': - return '#ff0'; - - /* hex code -> color name */ - case '#800000': - return 'maroon'; - case '#ffa500': - return 'orange'; - case '#808000': - return 'olive'; - case '#800080': - return 'purple'; - case '#008000': - return 'green'; - case '#000080': - return 'navy'; - case '#008080': - return 'teal'; - case '#c0c0c0': - return 'silver'; - case '#808080': - return 'gray'; - case '#f00': - return 'red'; - } - - return $color; - } - - /** - * Compresses numbers (ie. 1.0 becomes 1 or 1.100 becomes 1.1 ) - * - * @param string $subvalue - the subvalue. - * @return string - * @version 1.2 - */ - public function compress_numbers( $subvalue ) { - $unit_values = & $GLOBALS['csstidy']['unit_values']; - $color_values = & $GLOBALS['csstidy']['color_values']; - - // for font:1em/1em sans-serif...;. - if ( $this->property === 'font' ) { - $temp = explode( '/', $subvalue ); - } else { - $temp = array( $subvalue ); - } - - for ( $l = 0, $m = count( $temp ); $l < $m; $l++ ) { - // if we are not dealing with a number at this point, do not optimise anything. - $number = $this->analyse_css_number( $temp[ $l ] ); - if ( $number === false ) { - return $subvalue; - } - - // Fix bad colors. - if ( in_array( $this->property, $color_values, true ) ) { - if ( strlen( $temp[ $l ] ) === 3 || strlen( $temp[ $l ] ) === 6 ) { - $temp[ $l ] = '#' . $temp[ $l ]; - } else { - $temp[ $l ] = '0'; - } - continue; - } - - if ( abs( $number[0] ) > 0 ) { - if ( $number[1] === '' && in_array( $this->property, $unit_values, true ) ) { - $number[1] = 'px'; - } - } else { - $number[1] = ''; - } - - $temp[ $l ] = $number[0] . $number[1]; - } - - return ( ( count( $temp ) > 1 ) ? $temp[0] . '/' . $temp[1] : $temp[0] ); - } - - /** - * Checks if a given string is a CSS valid number. If it is, - * an array containing the value and unit is returned - * - * @param string $string - the string we're checking. - * @return array ('unit' if unit is found or '' if no unit exists, number value) or false if no number - */ - public function analyse_css_number( $string ) { - // most simple checks first - if ( $string === '' || ctype_alpha( $string[0] ) ) { - return false; - } - - $units = & $GLOBALS['csstidy']['units']; - $return = array( 0, '' ); - - $return[0] = (float) $string; - if ( abs( $return[0] ) > 0 && abs( $return[0] ) < 1 ) { - // Removes the initial `0` from a decimal number, e.g., `0.7 => .7` or `-0.666 => -.666`. - if ( ! $this->parser->get_cfg( 'preserve_leading_zeros' ) ) { - if ( $return[0] < 0 ) { - $return[0] = '-' . ltrim( substr( $return[0], 1 ), '0' ); - } else { - $return[0] = ltrim( $return[0], '0' ); - } - } - } - - // Look for unit and split from value if exists - foreach ( $units as $unit ) { - $expect_unit_at = strlen( $string ) - strlen( $unit ); - $unit_in_string = stristr( $string, $unit ); - if ( ! $unit_in_string ) { // mb_strpos() fails with "false" - continue; - } - $actual_position = strpos( $string, $unit_in_string ); - if ( $expect_unit_at === $actual_position ) { - $return[1] = $unit; - $string = substr( $string, 0, - strlen( $unit ) ); - break; - } - } - if ( ! is_numeric( $string ) ) { - return false; - } - return $return; - } - - /** - * Merges selectors with same properties. Example: a{color:red} b{color:red} -> a,b{color:red} - * Very basic and has at least one bug. Hopefully there is a replacement soon. - * - * @param array $array - the selector array. - * @access public - * @version 1.2 - */ - public function merge_selectors( &$array ) { - $css = $array; - foreach ( $css as $key => $value ) { - if ( ! isset( $css[ $key ] ) ) { - continue; - } - $newsel = ''; - - // Check if properties also exist in another selector. - $keys = array(); - // PHP bug (?) without $css = $array; here. - foreach ( $css as $selector => $vali ) { - if ( $selector === $key ) { - continue; - } - - if ( $css[ $key ] === $vali ) { - $keys[] = $selector; - } - } - - if ( ! empty( $keys ) ) { - $newsel = $key; - unset( $css[ $key ] ); - foreach ( $keys as $selector ) { - unset( $css[ $selector ] ); - $newsel .= ',' . $selector; - } - $css[ $newsel ] = $value; - } - } - $array = $css; - } - - /** - * Removes invalid selectors and their corresponding rule-sets as - * defined by 4.1.7 in REC-CSS2. This is a very rudimentary check - * and should be replaced by a full-blown parsing algorithm or - * regular expression - * - * @version 1.4 - * - * @param array $array - selector array. - */ - public function discard_invalid_selectors( &$array ) { - foreach ( $array as $selector => $decls ) { - $ok = true; - $selectors = array_map( 'trim', explode( ',', $selector ) ); - foreach ( $selectors as $s ) { - $simple_selectors = preg_split( '/\s*[+>~\s]\s*/', $s ); - foreach ( $simple_selectors as $ss ) { - if ( $ss === '' ) { - $ok = false; - } - // could also check $ss for internal structure, but that probably would be too slow. - } - } - if ( ! $ok ) { - unset( $array[ $selector ] ); - } - } - } - - /** - * Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;... - * - * @param string $property - the property. - * @param string $value - the value. - * @return array - * @version 1.0 - * @see merge_4value_shorthands() - */ - public static function dissolve_4value_shorthands( $property, $value ) { - $shorthands = & $GLOBALS['csstidy']['shorthands']; - if ( ! is_array( $shorthands[ $property ] ) ) { - $return = array(); - $return[ $property ] = $value; - return $return; - } - - $important = ''; - if ( csstidy::is_important( $value ) ) { - $value = csstidy::gvw_important( $value ); - $important = '!important'; - } - $values = explode( ' ', $value ); - - $return = array(); - if ( count( $values ) === 4 ) { - for ( $i = 0; $i < 4; $i++ ) { - $return[ $shorthands[ $property ][ $i ] ] = $values[ $i ] . $important; - } - } elseif ( count( $values ) === 3 ) { - $return[ $shorthands[ $property ][0] ] = $values[0] . $important; - $return[ $shorthands[ $property ][1] ] = $values[1] . $important; - $return[ $shorthands[ $property ][3] ] = $values[1] . $important; - $return[ $shorthands[ $property ][2] ] = $values[2] . $important; - } elseif ( count( $values ) === 2 ) { - for ( $i = 0; $i < 4; $i++ ) { - $return[ $shorthands[ $property ][ $i ] ] = ( ( $i % 2 !== 0 ) ) ? $values[1] . $important : $values[0] . $important; - } - } else { - for ( $i = 0; $i < 4; $i++ ) { - $return[ $shorthands[ $property ][ $i ] ] = $values[0] . $important; - } - } - - return $return; - } - - /** - * Explodes a string as explode() does, however, not if $sep is escaped or within a string. - * - * @param string $sep - seperator. - * @param string $string - the string. - * @return array - * @version 1.0 - */ - public static function explode_ws( $sep, $string ) { - $status = 'st'; - $to = ''; - - $output = array(); - $num = 0; - for ( $i = 0, $len = strlen( $string ); $i < $len; $i++ ) { - switch ( $status ) { - case 'st': - if ( $string[ $i ] === $sep && ! csstidy::escaped( $string, $i ) ) { - ++$num; - } elseif ( $string[ $i ] === '"' || $string[ $i ] === '\'' || $string[ $i ] === '(' && ! csstidy::escaped( $string, $i ) ) { - $status = 'str'; - $to = ( $string[ $i ] === '(' ) ? ')' : $string[ $i ]; - ( isset( $output[ $num ] ) ) ? $output[ $num ] .= $string[ $i ] : $output[ $num ] = $string[ $i ]; - } else { - ( isset( $output[ $num ] ) ) ? $output[ $num ] .= $string[ $i ] : $output[ $num ] = $string[ $i ]; - } - break; - - case 'str': - if ( $string[ $i ] === $to && ! csstidy::escaped( $string, $i ) ) { - $status = 'st'; - } - ( isset( $output[ $num ] ) ) ? $output[ $num ] .= $string[ $i ] : $output[ $num ] = $string[ $i ]; - break; - } - } - - if ( isset( $output[0] ) ) { - return $output; - } else { - return array( $output ); - } - } - - /** - * Merges Shorthand properties again, the opposite of dissolve_4value_shorthands() - * - * @param array $array - the property array. - * @return array - * @version 1.2 - * @see dissolve_4value_shorthands() - */ - public static function merge_4value_shorthands( $array ) { - $return = is_array( $array ) ? $array : array(); - $shorthands = & $GLOBALS['csstidy']['shorthands']; - - foreach ( $shorthands as $key => $value ) { - if ( $value !== 0 && isset( $array[ $value[0] ] ) && isset( $array[ $value[1] ] ) - && isset( $array[ $value[2] ] ) && isset( $array[ $value[3] ] ) ) { - $return[ $key ] = ''; - - $important = ''; - for ( $i = 0; $i < 4; $i++ ) { - $val = $array[ $value[ $i ] ]; - if ( csstidy::is_important( $val ) ) { - $important = '!important'; - $return[ $key ] .= csstidy::gvw_important( $val ) . ' '; - } else { - $return[ $key ] .= $val . ' '; - } - unset( $return[ $value[ $i ] ] ); - } - $return[ $key ] = self::shorthand( trim( $return[ $key ] . $important ) ); - } - } - return $return; - } - - /** - * Dissolve background property - * - * @param string $str_value - the string value. - * @return array - * @version 1.0 - * @see merge_bg() - * @todo full CSS 3 compliance - */ - public static function dissolve_short_bg( $str_value ) { - $have = array(); - // don't try to explose background gradient ! - if ( stripos( $str_value, 'gradient(' ) !== false ) { - return array( 'background' => $str_value ); - } - - $background_prop_default = & $GLOBALS['csstidy']['background_prop_default']; - $repeat = array( 'repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'space' ); - $attachment = array( 'scroll', 'fixed', 'local' ); - $clip = array( 'border', 'padding' ); - $origin = array( 'border', 'padding', 'content' ); - $pos = array( 'top', 'center', 'bottom', 'left', 'right' ); - $important = ''; - $return = array( - 'background-image' => null, - 'background-size' => null, - 'background-repeat' => null, - 'background-position' => null, - 'background-attachment' => null, - 'background-clip' => null, - 'background-origin' => null, - 'background-color' => null, - ); - - if ( csstidy::is_important( $str_value ) ) { - $important = ' !important'; - $str_value = csstidy::gvw_important( $str_value ); - } - - $str_value = self::explode_ws( ',', $str_value ); - for ( $i = 0, $l = count( $str_value ); $i < $l; $i++ ) { - $have['clip'] = false; - $have['pos'] = false; - $have['color'] = false; - $have['bg'] = false; - - if ( is_array( $str_value[ $i ] ) ) { - $str_value[ $i ] = $str_value[ $i ][0]; - } - $str_value[ $i ] = self::explode_ws( ' ', trim( $str_value[ $i ] ) ); - - for ( $j = 0, $k = count( $str_value[ $i ] ); $j < $k; $j++ ) { - if ( $have['bg'] === false && ( str_starts_with( $str_value[ $i ][ $j ], 'url(' ) || $str_value[ $i ][ $j ] === 'none' ) ) { - $return['background-image'] .= $str_value[ $i ][ $j ] . ','; - $have['bg'] = true; - } elseif ( in_array( $str_value[ $i ][ $j ], $repeat, true ) ) { - $return['background-repeat'] .= $str_value[ $i ][ $j ] . ','; - } elseif ( in_array( $str_value[ $i ][ $j ], $attachment, true ) ) { - $return['background-attachment'] .= $str_value[ $i ][ $j ] . ','; - } elseif ( in_array( $str_value[ $i ][ $j ], $clip, true ) && ! $have['clip'] ) { - $return['background-clip'] .= $str_value[ $i ][ $j ] . ','; - $have['clip'] = true; - } elseif ( in_array( $str_value[ $i ][ $j ], $origin, true ) ) { - $return['background-origin'] .= $str_value[ $i ][ $j ] . ','; - } elseif ( $str_value[ $i ][ $j ][0] === '(' ) { - $return['background-size'] .= substr( $str_value[ $i ][ $j ], 1, -1 ) . ','; - } elseif ( in_array( $str_value[ $i ][ $j ], $pos, true ) || is_numeric( $str_value[ $i ][ $j ][0] ) || $str_value[ $i ][ $j ][0] === null || $str_value[ $i ][ $j ][0] === '-' || $str_value[ $i ][ $j ][0] === '.' ) { - $return['background-position'] .= $str_value[ $i ][ $j ]; - if ( ! $have['pos'] ) { - $return['background-position'] .= ' '; - } else { - $return['background-position'] .= ','; - } - $have['pos'] = true; - } elseif ( ! $have['color'] ) { - $return['background-color'] .= $str_value[ $i ][ $j ] . ','; - $have['color'] = true; - } - } - } - - foreach ( $background_prop_default as $bg_prop => $default_value ) { - if ( $return[ $bg_prop ] !== null ) { - $return[ $bg_prop ] = substr( $return[ $bg_prop ], 0, -1 ) . $important; - } else { - $return[ $bg_prop ] = $default_value . $important; - } - } - return $return; - } - - /** - * Merges all background properties - * - * @param array $input_css - inputted CSS. - * @return array - * @version 1.0 - * @see dissolve_short_bg() - * @todo full CSS 3 compliance - */ - public static function merge_bg( $input_css ) { - $background_prop_default = & $GLOBALS['csstidy']['background_prop_default']; - // Max number of background images. CSS3 not yet fully implemented. - $number_of_values = @max( count( self::explode_ws( ',', $input_css['background-image'] ) ), count( self::explode_ws( ',', $input_css['background-color'] ) ), 1 ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged - // Array with background images to check if BG image exists. - $bg_img_array = @self::explode_ws( ',', csstidy::gvw_important( $input_css['background-image'] ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged - $new_bg_value = ''; - $important = ''; - - // if background properties is here and not empty, don't try anything. - if ( isset( $input_css['background'] ) && $input_css['background'] ) { - return $input_css; - } - - for ( $i = 0; $i < $number_of_values; $i++ ) { - foreach ( $background_prop_default as $bg_property => $default_value ) { - // Skip if property does not exist - if ( ! isset( $input_css[ $bg_property ] ) ) { - continue; - } - - $cur_value = $input_css[ $bg_property ]; - // skip all optimisation if gradient() somewhere. - if ( stripos( $cur_value, 'gradient(' ) !== false ) { - return $input_css; - } - - // Skip some properties if there is no background image. - if ( ( ! isset( $bg_img_array[ $i ] ) || $bg_img_array[ $i ] === 'none' ) - && ( $bg_property === 'background-size' || $bg_property === 'background-position' - || $bg_property === 'background-attachment' || $bg_property === 'background-repeat' ) ) { - continue; - } - - // Remove !important. - if ( csstidy::is_important( $cur_value ) ) { - $important = ' !important'; - $cur_value = csstidy::gvw_important( $cur_value ); - } - - // Do not add default values. - if ( $cur_value === $default_value ) { - continue; - } - - $temp = self::explode_ws( ',', $cur_value ); - - if ( isset( $temp[ $i ] ) ) { - if ( $bg_property === 'background-size' ) { - $new_bg_value .= '(' . $temp[ $i ] . ') '; - } else { - $new_bg_value .= $temp[ $i ] . ' '; - } - } - } - - $new_bg_value = trim( $new_bg_value ); - if ( $i !== $number_of_values - 1 ) { - $new_bg_value .= ','; - } - } - - // Delete all background-properties. - foreach ( $background_prop_default as $bg_property => $default_value ) { - unset( $input_css[ $bg_property ] ); - } - - // Add new background property. - if ( $new_bg_value !== '' ) { - $input_css['background'] = $new_bg_value . $important; - } elseif ( isset( $input_css['background'] ) ) { - $input_css['background'] = 'none'; - } - - return $input_css; - } - - /** - * Dissolve font property - * - * @param string $str_value - the string value. - * @return array - * @version 1.3 - * @see merge_font() - */ - public static function dissolve_short_font( $str_value ) { - $have = array(); - $font_prop_default = & $GLOBALS['csstidy']['font_prop_default']; - $font_weight = array( 'normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900' ); - $font_variant = array( 'normal', 'small-caps' ); - $font_style = array( 'normal', 'italic', 'oblique' ); - $important = ''; - $return = array( - 'font-style' => null, - 'font-variant' => null, - 'font-weight' => null, - 'font-size' => null, - 'line-height' => null, - 'font-family' => null, - ); - - if ( csstidy::is_important( $str_value ) ) { - $important = '!important'; - $str_value = csstidy::gvw_important( $str_value ); - } - - $have['style'] = false; - $have['variant'] = false; - $have['weight'] = false; - $have['size'] = false; - // Detects if font-family consists of several words w/o quotes. - $multiwords = false; - - // Workaround with multiple font-family. - $str_value = self::explode_ws( ',', trim( $str_value ) ); - - $str_value[0] = self::explode_ws( ' ', trim( $str_value[0] ) ); - - for ( $j = 0, $k = count( $str_value[0] ); $j < $k; $j++ ) { - if ( $have['weight'] === false && in_array( $str_value[0][ $j ], $font_weight, true ) ) { - $return['font-weight'] = $str_value[0][ $j ]; - $have['weight'] = true; - } elseif ( $have['variant'] === false && in_array( $str_value[0][ $j ], $font_variant, true ) ) { - $return['font-variant'] = $str_value[0][ $j ]; - $have['variant'] = true; - } elseif ( $have['style'] === false && in_array( $str_value[0][ $j ], $font_style, true ) ) { - $return['font-style'] = $str_value[0][ $j ]; - $have['style'] = true; - } elseif ( $have['size'] === false && ( is_numeric( $str_value[0][ $j ][0] ) || $str_value[0][ $j ][0] === null || $str_value[0][ $j ][0] === '.' ) ) { - $size = self::explode_ws( '/', trim( $str_value[0][ $j ] ) ); - $return['font-size'] = $size[0]; - if ( isset( $size[1] ) ) { - $return['line-height'] = $size[1]; - } else { - $return['line-height'] = ''; // don't add 'normal' ! - } - $have['size'] = true; - } elseif ( isset( $return['font-family'] ) ) { - $return['font-family'] .= ' ' . $str_value[0][ $j ]; - $multiwords = true; - } else { - $return['font-family'] = $str_value[0][ $j ]; - } - } - // add quotes if we have several qords in font-family. - if ( $multiwords !== false ) { - $return['font-family'] = '"' . $return['font-family'] . '"'; - } - $i = 1; - while ( isset( $str_value[ $i ] ) ) { - $return['font-family'] .= ',' . trim( $str_value[ $i ] ); - ++$i; - } - - // Fix for 100 and more font-size. - if ( $have['size'] === false && isset( $return['font-weight'] ) && - is_numeric( $return['font-weight'][0] ) - ) { - $return['font-size'] = $return['font-weight']; - unset( $return['font-weight'] ); - } - - foreach ( $font_prop_default as $font_prop => $default_value ) { - if ( $return[ $font_prop ] !== null ) { - $return[ $font_prop ] = $return[ $font_prop ] . $important; - } else { - $return[ $font_prop ] = $default_value . $important; - } - } - return $return; - } - - /** - * Merges all fonts properties - * - * @param array $input_css - input CSS. - * @return array - * @version 1.3 - * @see dissolve_short_font() - */ - public static function merge_font( $input_css ) { - $font_prop_default = & $GLOBALS['csstidy']['font_prop_default']; - $new_font_value = ''; - $important = ''; - // Skip if not font-family and font-size set. - if ( isset( $input_css['font-family'] ) && isset( $input_css['font-size'] ) ) { - // fix several words in font-family - add quotes. - if ( isset( $input_css['font-family'] ) ) { - $families = explode( ',', $input_css['font-family'] ); - $result_families = array(); - foreach ( $families as $family ) { - $family = trim( $family ); - $len = strlen( $family ); - if ( strpos( $family, ' ' ) && - ! ( ( $family[0] === '"' && $family[ $len - 1 ] === '"' ) || - ( $family[0] === "'" && $family[ $len - 1 ] === "'" ) ) ) { - $family = '"' . $family . '"'; - } - $result_families[] = $family; - } - $input_css['font-family'] = implode( ',', $result_families ); - } - foreach ( $font_prop_default as $font_property => $default_value ) { - - // Skip if property does not exist. - if ( ! isset( $input_css[ $font_property ] ) ) { - continue; - } - - $cur_value = $input_css[ $font_property ]; - - // Skip if default value is used. - if ( $cur_value === $default_value ) { - continue; - } - - // Remove !important. - if ( csstidy::is_important( $cur_value ) ) { - $important = '!important'; - $cur_value = csstidy::gvw_important( $cur_value ); - } - - $new_font_value .= $cur_value; - // Add delimiter. - $new_font_value .= ( $font_property === 'font-size' && - isset( $input_css['line-height'] ) ) ? '/' : ' '; - } - - $new_font_value = trim( $new_font_value ); - - // Delete all font-properties. - foreach ( $font_prop_default as $font_property => $default_value ) { - if ( $font_property !== 'font' || ! $new_font_value ) { - unset( $input_css[ $font_property ] ); - } - } - - // Add new font property. - if ( $new_font_value !== '' ) { - $input_css['font'] = $new_font_value . $important; - } - } - - return $input_css; - } -} diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-print.php b/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-print.php deleted file mode 100644 index 10576b17ec2d9..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy-print.php +++ /dev/null @@ -1,433 +0,0 @@ -. - * - * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2007 - * @author Brett Zamir (brettz9 at yahoo dot com) 2007 - * @author Cedric Morin (cedric at yterium dot com) 2010 - */ - -/** - * CSS Printing class - * - * This class prints CSS data generated by csstidy. - * - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2006 - * @version 1.0.1 - */ -#[AllowDynamicProperties] -class csstidy_print { // phpcs:ignore - - /** - * Saves the input CSS string - * - * @var string - * @access private - */ - public $input_css = ''; - /** - * Saves the formatted CSS string - * - * @var string - * @access public - */ - public $output_css = ''; - /** - * Saves the formatted CSS string (plain text) - * - * @var string - * @access public - */ - public $output_css_plain = ''; - - /** - * Constructor - * - * @param csstidy $css contains the class csstidy. - * @access private - * @version 1.0 - */ - public function __construct( &$css ) { - $this->parser = & $css; - $this->css = & $css->css; - $this->template = & $css->template; - $this->tokens = & $css->tokens; - $this->charset = & $css->charset; - $this->import = & $css->import; - $this->namespace = & $css->namespace; - } - - /** - * Call constructor function. - * - * @param csstidy $css - the CSS we're working with. - */ - public function csstidy_print( &$css ) { - $this->__construct( $css ); - } - - /** - * Resets output_css and output_css_plain (new css code) - * - * @access private - * @version 1.0 - */ - public function _reset() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore - $this->output_css = ''; - $this->output_css_plain = ''; - } - - /** - * Returns the CSS code as plain text - * - * @param string $default_media default @media to add to selectors without any @media. - * @return string - * @access public - * @version 1.0 - */ - public function plain( $default_media = '' ) { - $this->_print( true, $default_media ); - return $this->output_css_plain; - } - - /** - * Returns the formatted CSS code - * - * @param string $default_media default @media to add to selectors without any @media. - * @return string - * @access public - * @version 1.0 - */ - public function formatted( $default_media = '' ) { - $this->_print( false, $default_media ); - return $this->output_css; - } - - /** - * Returns the formatted CSS code to make a complete webpage - * - * @param string $doctype shorthand for the document type. - * @param bool $externalcss indicates whether styles to be attached internally or as an external stylesheet. - * @param string $title title to be added in the head of the document. - * @param string $lang two-letter language code to be added to the output. - * @return string - * @access public - * @version 1.4 - */ - public function formatted_page( $doctype = 'xhtml1.1', $externalcss = true, $title = '', $lang = 'en' ) { - switch ( $doctype ) { - case 'xhtml1.0strict': - $doctype_output = ''; - break; - case 'xhtml1.1': - default: - $doctype_output = ''; - break; - } - $cssparsed = ''; - $output = ''; - $this->output_css_plain = & $output; - - $output .= $doctype_output . "\n" . '' : ' lang="' . $lang . '">'; - $output .= "\n\n $title"; - - if ( $externalcss ) { - $output .= "\n "; - } else { - $output .= "\n" . ' '; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet - // } - } - $output .= "\n \n"; - $output .= $this->formatted(); - $output .= '' . "\n" . ''; - return $this->output_css_plain; - } - - /** - * Returns the formatted CSS Code and saves it into $this->output_css and $this->output_css_plain - * - * @param bool $plain plain text or not. - * @param string $default_media default @media to add to selectors without any @media. - * @access private - * @version 2.0 - */ - public function _print( $plain = false, $default_media = '' ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- print is a reserved word anyway. - if ( $this->output_css && $this->output_css_plain ) { - return; - } - - $output = ''; - if ( ! $this->parser->get_cfg( 'preserve_css' ) ) { - $this->convert_raw_css( $default_media ); - } - - $template = & $this->template; - - if ( $plain ) { - $template = array_map( 'strip_tags', $template ); - } - - if ( $this->parser->get_cfg( 'timestamp' ) ) { - array_unshift( $this->tokens, array( COMMENT, ' CSSTidy ' . $this->parser->version . ': ' . gmdate( 'r' ) . ' ' ) ); - } - - if ( ! empty( $this->charset ) ) { - $output .= $template[0] . '@charset ' . $template[5] . $this->charset . $template[6]; - } - - if ( ! empty( $this->import ) ) { - $import_count = is_countable( $this->import ) ? count( $this->import ) : 0; - for ( $i = 0; $i < $import_count; $i++ ) { - $import_components = explode( ' ', $this->import[ $i ] ); - if ( str_starts_with( $import_components[0], 'url(' ) && str_ends_with( $import_components[0], ')' ) ) { - $import_components[0] = '\'' . trim( substr( $import_components[0], 4, -1 ), "'\"" ) . '\''; - $this->import[ $i ] = implode( ' ', $import_components ); - $this->parser->log( 'Optimised @import : Removed "url("', 'Information' ); - } - $output .= $template[0] . '@import ' . $template[5] . $this->import[ $i ] . $template[6]; - } - } - if ( ! empty( $this->namespace ) ) { - if ( str_starts_with( $this->namespace, 'url(' ) && str_ends_with( $this->namespace, ')' ) ) { - $this->namespace = '\'' . substr( $this->namespace, 4, -1 ) . '\''; - $this->parser->log( 'Optimised @namespace : Removed "url("', 'Information' ); - } - $output .= $template[0] . '@namespace ' . $template[5] . $this->namespace . $template[6]; - } - - $output .= $template[13]; - $in_at_out = ''; - $out = & $output; - - foreach ( $this->tokens as $key => $token ) { - switch ( $token[0] ) { - case AT_START: - $out .= $template[0] . $this->htmlsp( $token[1], $plain ) . $template[1]; - $out = & $in_at_out; - break; - - case SEL_START: - if ( $this->parser->get_cfg( 'lowercase_s' ) ) { - $token[1] = strtolower( $token[1] ); - } - $out .= ( $token[1][0] !== '@' ) ? $template[2] . $this->htmlsp( $token[1], $plain ) : $template[0] . $this->htmlsp( $token[1], $plain ); - $out .= $template[3]; - break; - - case PROPERTY: - if ( $this->parser->get_cfg( 'case_properties' ) === 2 ) { - $token[1] = strtoupper( $token[1] ); - } elseif ( $this->parser->get_cfg( 'case_properties' ) === 1 ) { - $token[1] = strtolower( $token[1] ); - } - $out .= $template[4] . $this->htmlsp( $token[1], $plain ) . ':' . $template[5]; - break; - - case VALUE: - $out .= $this->htmlsp( $token[1], $plain ); - if ( $this->seeknocomment( $key, 1 ) === SEL_END && $this->parser->get_cfg( 'remove_last_;' ) ) { - $out .= str_replace( ';', '', $template[6] ); - } else { - $out .= $template[6]; - } - break; - - case SEL_END: - $out .= $template[7]; - if ( $this->seeknocomment( $key, 1 ) !== AT_END ) { - $out .= $template[8]; - } - break; - - case AT_END: - $out = & $output; - $out .= $template[10] . str_replace( "\n", "\n" . $template[10], $in_at_out ); - $in_at_out = ''; - $out .= $template[9]; - break; - - case COMMENT: - $out .= $template[11] . '/*' . $this->htmlsp( $token[1], $plain ) . '*/' . $template[12]; - break; - } - } - - $output = trim( $output ); - - if ( ! $plain ) { - $this->output_css = $output; - $this->_print( true ); - } else { - // If using spaces in the template, don't want these to appear in the plain output - $this->output_css_plain = str_replace( ' ', '', $output ); - } - } - - /** - * Gets the next token type which is $move away from $key, excluding comments - * - * @param integer $key current position. - * @param integer $move move this far. - * @return mixed a token type - * @access private - * @version 1.0 - */ - public function seeknocomment( $key, $move ) { - $go = ( $move > 0 ) ? 1 : -1; - for ( $i = $key + 1; abs( $key - $i ) - 1 < abs( $move ); $i += $go ) { // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed - if ( ! isset( $this->tokens[ $i ] ) ) { - return; - } - if ( $this->tokens[ $i ][0] === COMMENT ) { - ++$move; - continue; - } - return $this->tokens[ $i ][0]; - } - } - - /** - * Converts $this->css array to a raw array ($this->tokens) - * - * @param string $default_media default @media to add to selectors without any @media. - * @access private - * @version 1.0 - */ - public function convert_raw_css( $default_media = '' ) { - $this->tokens = array(); - - foreach ( $this->css as $medium => $val ) { - if ( $this->parser->get_cfg( 'sort_selectors' ) ) { - ksort( $val ); - } - if ( (int) $medium < DEFAULT_AT ) { - $this->parser->_add_token( AT_START, $medium, true ); - } elseif ( $default_media ) { - $this->parser->_add_token( AT_START, $default_media, true ); - } - - foreach ( $val as $selector => $vali ) { - if ( $this->parser->get_cfg( 'sort_properties' ) ) { - ksort( $vali ); - } - $this->parser->_add_token( SEL_START, $selector, true ); - - foreach ( $vali as $property => $valj ) { - $this->parser->_add_token( PROPERTY, $property, true ); - $this->parser->_add_token( VALUE, $valj, true ); - } - - $this->parser->_add_token( SEL_END, $selector, true ); - } - - if ( (int) $medium < DEFAULT_AT ) { - $this->parser->_add_token( AT_END, $medium, true ); - } elseif ( $default_media ) { - $this->parser->_add_token( AT_END, $default_media, true ); - } - } - } - - /** - * Same as htmlspecialchars, only that chars are not replaced if $plain !== true. This makes print_code() cleaner. - * - * @param string $string - the string we're converting. - * @param bool $plain - plain text or not. - * @return string - * @see csstidy_print::_print() - * @access private - * @version 1.0 - */ - public function htmlsp( $string, $plain ) { - if ( ! $plain ) { - return htmlspecialchars( $string, ENT_QUOTES, 'utf-8' ); - } - return $string; - } - - /** - * Get compression ratio - * - * @access public - * @return float - * @version 1.2 - */ - public function get_ratio() { - if ( ! $this->output_css_plain ) { - $this->formatted(); - } - return round( ( strlen( $this->input_css ) - strlen( $this->output_css_plain ) ) / strlen( $this->input_css ), 3 ) * 100; - } - - /** - * Get difference between the old and new code in bytes and prints the code if necessary. - * - * @access public - * @return string - * @version 1.1 - */ - public function get_diff() { - if ( ! $this->output_css_plain ) { - $this->formatted(); - } - - $diff = strlen( $this->output_css_plain ) - strlen( $this->input_css ); - - if ( $diff > 0 ) { - return '+' . $diff; - } elseif ( $diff === 0 ) { - return '+-' . $diff; - } - - return $diff; - } - - /** - * Get the size of either input or output CSS in KB - * - * @param string $loc default is "output". - * @access public - * @return integer - * @version 1.0 - */ - public function size( $loc = 'output' ) { - if ( $loc === 'output' && ! $this->output_css ) { - $this->formatted(); - } - - if ( $loc === 'input' ) { - return ( strlen( $this->input_css ) / 1000 ); - } else { - return ( strlen( $this->output_css_plain ) / 1000 ); - } - } -} diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php b/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php deleted file mode 100644 index cd2277c4df8c1..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php +++ /dev/null @@ -1,1309 +0,0 @@ -. - * - * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2007 - * @author Brett Zamir (brettz9 at yahoo dot com) 2007 - * @author Nikolay Matsievsky (speed at webo dot name) 2009-2010 - * @author Cedric Morin (cedric at yterium dot com) 2010 - */ - -// phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged - -/** - * Defines ctype functions if required - * - * @version 1.0 - */ -require_once __DIR__ . '/class.csstidy-ctype.php'; - -/** - * Various CSS data needed for correct optimisations etc. - * - * @version 1.3 - */ -require __DIR__ . '/data.inc.php'; - -/** - * Contains a class for printing CSS code - * - * @version 1.0 - */ -require __DIR__ . '/class.csstidy-print.php'; - -/** - * Contains a class for optimising CSS code - * - * @version 1.0 - */ -require __DIR__ . '/class.csstidy-optimise.php'; - -/** - * CSS Parser class - - * This class represents a CSS parser which reads CSS code and saves it in an array. - * In opposite to most other CSS parsers, it does not use regular expressions and - * thus has full CSS2 support and a higher reliability. - * Additional to that it applies some optimisations and fixes to the CSS code. - * An online version should be available here: https://cdburnerxp.se/cssparse/css_optimiser.php - * - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2006 - * @version 1.3.1 - */ -#[AllowDynamicProperties] -class csstidy { // phpcs:ignore - - /** - * Saves the parsed CSS. This array is empty if preserve_css is on. - * - * @var array - * @access public - */ - public $css = array(); - /** - * Saves the parsed CSS (raw) - * - * @var array - * @access private - */ - public $tokens = array(); - /** - * Printer class - * - * @see csstidy_print - * @var object - * @access public - */ - public $print; - /** - * Optimiser class - * - * @see csstidy_optimise - * @var object - * @access private - */ - public $optimise; - /** - * Saves the CSS charset (@charset) - * - * @var string - * @access private - */ - public $charset = ''; - /** - * Saves all @import URLs - * - * @var array - * @access private - */ - public $import = array(); - /** - * Saves the namespace - * - * @var string - * @access private - */ - public $namespace = ''; - /** - * Contains the version of csstidy - * - * @var string - * @access private - */ - public $version = '1.3'; - /** - * Stores the settings - * - * @var array - * @access private - */ - public $settings = array(); - /** - * Saves the parser-status. - * - * Possible values: - * - is = in selector - * - ip = in property - * - iv = in value - * - instr = in string (started at " or ' or ( ) - * - ic = in comment (ignore everything) - * - at = in @-block - * - * @var string - * @access private - */ - public $status = 'is'; - /** - * Saves the current at rule (@media) - * - * @var string - * @access private - */ - public $at = ''; - /** - * Saves the current selector - * - * @var string - * @access private - */ - public $selector = ''; - /** - * Saves the current property - * - * @var string - * @access private - */ - public $property = ''; - /** - * Saves the position of , in selectors - * - * @var array - * @access private - */ - public $sel_separate = array(); - /** - * Saves the current value - * - * @var string - * @access private - */ - public $value = ''; - /** - * Saves the current sub-value - * - * Example for a subvalue: - * background:url(foo.png) red no-repeat; - * "url(foo.png)", "red", and "no-repeat" are subvalues, - * separated by whitespace - * - * @var string - * @access private - */ - public $sub_value = ''; - /** - * Array which saves all subvalues for a property. - * - * @var array - * @see sub_value - * @access private - */ - public $sub_value_arr = array(); - /** - * Saves the stack of characters that opened the current strings - * - * @var array - * @access private - */ - public $str_char = array(); - /** - * Current strings. - * - * @var array - * @access private - */ - public $cur_string = array(); - /** - * Status from which the parser switched to ic or instr - * - * @var array - * @access private - */ - public $from = array(); - /** - /** - * =true if in invalid at-rule - * - * @var bool - * @access private - */ - public $invalid_at = false; - /** - * =true if something has been added to the current selector - * - * @var bool - * @access private - */ - public $added = false; - /** - * Array which saves the message log - * - * @var array - * @access private - */ - public $log = array(); - /** - * Saves the line number - * - * @var integer - * @access private - */ - public $line = 1; - /** - * Marks if we need to leave quotes for a string - * - * @var array - * @access private - */ - public $quoted_string = array(); - - /** - * List of tokens - * - * @var string - */ - public $tokens_list = ''; - - /** - * Loads standard template and sets default settings. - * - * @access private - * @version 1.3 - */ - public function __construct() { - $this->settings['remove_bslash'] = true; - $this->settings['compress_colors'] = true; - $this->settings['compress_font-weight'] = true; - $this->settings['lowercase_s'] = false; - - /* - 1 common shorthands optimization - 2 + font property optimization - 3 + background property optimization - */ - $this->settings['optimise_shorthands'] = 1; - $this->settings['remove_last_;'] = true; - /* rewrite all properties with low case, better for later gzip OK, safe*/ - $this->settings['case_properties'] = 1; - - /* - * sort properties in alpabetic order, better for later gzip - * but can cause trouble in case of overiding same propertie or using hack - */ - $this->settings['sort_properties'] = false; - - /* - 1, 3, 5, etc -- enable sorting selectors inside @media: a{}b{}c{} - 2, 5, 8, etc -- enable sorting selectors inside one CSS declaration: a,b,c{} - preserve order by default cause it can break functionnality - */ - $this->settings['sort_selectors'] = 0; - /* is dangeroues to be used: CSS is broken sometimes */ - $this->settings['merge_selectors'] = 0; - /* preserve or not browser hacks */ - $this->settings['discard_invalid_selectors'] = false; - $this->settings['discard_invalid_properties'] = false; - $this->settings['css_level'] = 'CSS2.1'; - $this->settings['preserve_css'] = false; - $this->settings['timestamp'] = false; - $this->settings['template'] = ''; // say that propertie exist. - $this->set_cfg( 'template', 'default' ); // call load_template. - /* Tells csstidy_optimise to keep leading zeros on decimal numbers, e.g., 0.7 */ - $this->settings['preserve_leading_zeros'] = false; - $this->optimise = new csstidy_optimise( $this ); - - $this->tokens_list = & $GLOBALS['csstidy']['tokens']; - } - - /** - * Call the construct function. - */ - public function csstidy() { - $this->__construct(); - } - - /** - * Get the value of a setting. - * - * @param string $setting - the settings. - * @access public - * @return mixed - * @version 1.0 - */ - public function get_cfg( $setting ) { - if ( isset( $this->settings[ $setting ] ) ) { - return $this->settings[ $setting ]; - } - return false; - } - - /** - * Load a template - * - * @param string $template used by set_cfg to load a template via a configuration setting. - * @access private - * @version 1.4 - */ - public function _load_template( $template ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore - switch ( $template ) { - case 'default': - $this->load_template( 'default' ); - break; - - case 'highest': - $this->load_template( 'highest_compression' ); - break; - - case 'high': - $this->load_template( 'high_compression' ); - break; - - case 'low': - $this->load_template( 'low_compression' ); - break; - - default: - $this->load_template( $template ); - break; - } - } - - /** - * Set the value of a setting. - * - * @param string $setting - the setting. - * @param mixed $value - the value we're setting. - * @access public - * @return bool - * @version 1.0 - */ - public function set_cfg( $setting, $value = null ) { - if ( is_array( $setting ) && null === $value ) { - foreach ( $setting as $setprop => $setval ) { - $this->settings[ $setprop ] = $setval; - } - if ( array_key_exists( 'template', $setting ) ) { - $this->_load_template( $this->settings['template'] ); - } - return true; - } elseif ( isset( $this->settings[ $setting ] ) && '' !== $value ) { - $this->settings[ $setting ] = $value; - if ( 'template' === $setting ) { - $this->_load_template( $this->settings['template'] ); - } - return true; - } - return false; - } - - /** - * Adds a token to $this->tokens - * - * @param mixed $type - the type. - * @param string $data - data. - * @param bool $do add a token even if preserve_css is off. - * @access private - * @version 1.0 - */ - public function _add_token( $type, $data, $do = false ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore - if ( $this->get_cfg( 'preserve_css' ) || $do ) { - $this->tokens[] = array( $type, ( COMMENT === $type ) ? $data : trim( $data ) ); - } - } - - /** - * Add a message to the message log - * - * @param string $message - the message. - * @param string $type - the type of message. - * @param integer $line - the line. - * @access private - * @version 1.0 - */ - public function log( $message, $type, $line = -1 ) { - if ( -1 === $line ) { - $line = $this->line; - } - $line = (int) $line; - $add = array( - 'm' => $message, - 't' => $type, - ); - if ( ! isset( $this->log[ $line ] ) || ! in_array( $add, $this->log[ $line ], true ) ) { - $this->log[ $line ][] = $add; - } - } - - /** - * Parse unicode notations and find a replacement character - * - * @param string $string - a string. - * @param integer $i - counting integer. - * @access private - * @return string - * @version 1.2 - */ - public function _unicode( &$string, &$i ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore - ++$i; - $add = ''; - $replaced = false; - - while ( $i < strlen( $string ) && ( ctype_xdigit( $string[ $i ] ) || ctype_space( $string[ $i ] ) ) && strlen( $add ) < 6 ) { // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found - $add .= $string[ $i ]; - - if ( ctype_space( $string[ $i ] ) ) { - break; - } - ++$i; - } - - if ( hexdec( $add ) > 47 && hexdec( $add ) < 58 || hexdec( $add ) > 64 && hexdec( $add ) < 91 || hexdec( $add ) > 96 && hexdec( $add ) < 123 ) { - $this->log( 'Replaced unicode notation: Changed \\' . $add . ' to ' . chr( hexdec( $add ) ), 'Information' ); - $add = chr( hexdec( $add ) ); - $replaced = true; - } else { - $add = trim( '\\' . $add ); - } - - if ( @ctype_xdigit( $string[ $i + 1 ] ) && ctype_space( $string[ $i ] ) - && ! $replaced || ! ctype_space( $string[ $i ] ) ) { - --$i; - } - - if ( '\\' !== $add || ! $this->get_cfg( 'remove_bslash' ) || strpos( $this->tokens_list, $string[ $i + 1 ] ) !== false ) { - return $add; - } - - if ( '\\' === $add ) { - $this->log( 'Removed unnecessary backslash', 'Information' ); - } - return ''; - } - - /** - * Write formatted output to a file - * - * @param string $filename - the file na,e. - * @param string $doctype when printing formatted, is a shorthand for the document type. - * @param bool $externalcss when printing formatted, indicates whether styles to be attached internally or as an external stylesheet. - * @param string $title when printing formatted, is the title to be added in the head of the document. - * @param string $lang when printing formatted, gives a two-letter language code to be added to the output. - * @access public - * @version 1.4 - */ - public function write_page( $filename, $doctype = 'xhtml1.1', $externalcss = true, $title = '', $lang = 'en' ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable - $this->write( $filename, true ); - } - - /** - * Write plain output to a file - * - * @param string $filename the file name. - * @param bool $formatted whether to print formatted or not. - * @param string $doctype when printing formatted, is a shorthand for the document type. - * @param bool $externalcss when printing formatted, indicates whether styles to be attached internally or as an external stylesheet. - * @param string $title when printing formatted, is the title to be added in the head of the document. - * @param string $lang when printing formatted, gives a two-letter language code to be added to the output. - * @param bool $pre_code whether to add pre and code tags around the code (for light HTML formatted templates). - * @access public - * @version 1.4 - */ - public function write( $filename, $formatted = false, $doctype = 'xhtml1.1', $externalcss = true, $title = '', $lang = 'en', $pre_code = true ) { - $filename .= ( $formatted ) ? '.xhtml' : '.css'; - - if ( ! is_dir( 'temp' ) ) { - $madedir = mkdir( 'temp' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_mkdir - if ( ! $madedir ) { - print 'Could not make directory "temp" in ' . __DIR__; - exit; - } - } - $handle = fopen( 'temp/' . $filename, 'w' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen - if ( $handle ) { - if ( ! $formatted ) { - fwrite( $handle, $this->print->plain() ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite - } else { - fwrite( $handle, $this->print->formatted_page( $doctype, $externalcss, $title, $lang, $pre_code ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite - } - } - fclose( $handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose - } - - /** - * Loads a new template - * - * @param string $content either filename (if $from_file == true), content of a template file, "high_compression", "highest_compression", "low_compression", or "default". - * @param bool $from_file uses $content as filename if true. - * @access public - * @version 1.1 - * @see http://csstidy.sourceforge.net/templates.php - */ - public function load_template( $content, $from_file = true ) { - $predefined_templates = & $GLOBALS['csstidy']['predefined_templates']; - if ( 'high_compression' === $content || 'default' === $content || 'highest_compression' === $content || 'low_compression' === $content ) { - $this->template = $predefined_templates[ $content ]; - return; - } - - if ( $from_file ) { - $content = strip_tags( file_get_contents( $content ), '' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents - } - $content = str_replace( "\r\n", "\n", $content ); // Unify newlines (because the output also only uses \n). - $template = explode( '|', $content ); - - $this->template = array_replace( $this->template, $template ); - } - - /** - * Starts parsing from URL - * - * @param string $url - the URL. - * @access public - * @version 1.0 - */ - public function parse_from_url( $url ) { - return $this->parse( @file_get_contents( $url ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents - } - - /** - * Checks if there is a token at the current position - * - * @param string $string - the string we're checking. - * @param integer $i - an int. - * @access public - * @version 1.11 - */ - public function is_token( &$string, $i ) { - return ( strpos( $this->tokens_list, $string[ $i ] ) !== false && ! self::escaped( $string, $i ) ); - } - - /** - * Parses CSS in $string. The code is saved as array in $this->css - * - * @param string $string the CSS code. - * @access public - * @return bool - * @version 1.1 - */ - public function parse( $string ) { - // Temporarily set locale to en_US in order to handle floats properly. - $old = @setlocale( LC_ALL, 0 ); - @setlocale( LC_ALL, 'C' ); - - // PHP bug? Settings need to be refreshed in PHP4. - $this->print = new csstidy_print( $this ); - - $at_rules = & $GLOBALS['csstidy']['at_rules']; - $quoted_string_properties = & $GLOBALS['csstidy']['quoted_string_properties']; - - $this->css = array(); - $this->print->input_css = $string; - $string = str_replace( "\r\n", "\n", $string ) . ' '; - $cur_comment = ''; - - for ( $i = 0, $size = strlen( $string ); $i < $size; $i++ ) { - if ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) { - ++$this->line; - } - - switch ( $this->status ) { - /* Case in at-block */ - case 'at': - if ( self::is_token( $string, $i ) ) { - if ( '/' === $string[ $i ] && '*' === @$string[ $i + 1 ] ) { - $this->status = 'ic'; - ++$i; - $this->from[] = 'at'; - } elseif ( '{' === $string[ $i ] ) { - $this->status = 'is'; - $this->at = $this->css_new_media_section( $this->at ); - $this->_add_token( AT_START, $this->at ); - } elseif ( ',' === $string[ $i ] ) { - $this->at = trim( $this->at ) . ','; - } elseif ( '\\' === $string[ $i ] ) { - $this->at .= $this->_unicode( $string, $i ); - } elseif ( in_array( $string[ $i ], array( '(', ')', ':', '.', '/' ), true ) ) { - // fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5) - // '/' is included for ratios in Opera: (-o-min-device-pixel-ratio: 3/2). - $this->at .= $string[ $i ]; - } - } else { - $lastpos = strlen( $this->at ) - 1; - if ( ! ( ( ctype_space( $this->at[ $lastpos ] ) || self::is_token( $this->at, $lastpos ) && ',' === $this->at[ $lastpos ] ) && ctype_space( $string[ $i ] ) ) ) { - $this->at .= $string[ $i ]; - } - } - break; - - /* Case in-selector */ - case 'is': - if ( self::is_token( $string, $i ) ) { - if ( '/' === $string[ $i ] && '*' === @$string[ $i + 1 ] && '' === trim( $this->selector ) ) { - $this->status = 'ic'; - ++$i; - $this->from[] = 'is'; - } elseif ( '@' === $string[ $i ] && '' === trim( $this->selector ) ) { - // Check for at-rule. - $this->invalid_at = true; - foreach ( $at_rules as $name => $type ) { - if ( ! strcasecmp( substr( $string, $i + 1, strlen( $name ) ), $name ) ) { - ( 'at' === $type ) ? $this->at = '@' . $name : $this->selector = '@' . $name; - $this->status = $type; - $i += strlen( $name ); - $this->invalid_at = false; - } - } - - if ( $this->invalid_at ) { - $this->selector = '@'; - $invalid_at_name = ''; - for ( $j = $i + 1; $j < $size; ++$j ) { - if ( ! ctype_alpha( $string[ $j ] ) ) { - break; - } - $invalid_at_name .= $string[ $j ]; - } - $this->log( 'Invalid @-rule: ' . $invalid_at_name . ' (removed)', 'Warning' ); - } - } elseif ( ( '"' === $string[ $i ] || "'" === $string[ $i ] ) ) { - $this->cur_string[] = $string[ $i ]; - $this->status = 'instr'; - $this->str_char[] = $string[ $i ]; - $this->from[] = 'is'; - /* fixing CSS3 attribute selectors, i.e. a[href$=".mp3" */ - $this->quoted_string[] = ( '=' === $string[ $i - 1 ] ); - } elseif ( $this->invalid_at && ';' === $string[ $i ] ) { - $this->invalid_at = false; - $this->status = 'is'; - } elseif ( '{' === $string[ $i ] ) { - $this->status = 'ip'; - if ( '' === $this->at ) { - $this->at = $this->css_new_media_section( DEFAULT_AT ); - } - $this->selector = $this->css_new_selector( $this->at, $this->selector ); - $this->_add_token( SEL_START, $this->selector ); - $this->added = false; - } elseif ( '}' === $string[ $i ] ) { - $this->_add_token( AT_END, $this->at ); - $this->at = ''; - $this->selector = ''; - $this->sel_separate = array(); - } elseif ( ',' === $string[ $i ] ) { - $this->selector = trim( $this->selector ) . ','; - $this->sel_separate[] = strlen( $this->selector ); - } elseif ( '\\' === $string[ $i ] ) { - $this->selector .= $this->_unicode( $string, $i ); - } elseif ( '*' === $string[ $i ] && @in_array( $string[ $i + 1 ], array( '.', '#', '[', ':' ), true ) ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedElseif - // remove unnecessary universal selector, FS#147. - } else { - $this->selector .= $string[ $i ]; - } - } else { - $lastpos = strlen( $this->selector ) - 1; - if ( -1 === $lastpos || ! ( ( ctype_space( $this->selector[ $lastpos ] ) || self::is_token( $this->selector, $lastpos ) && ',' === $this->selector[ $lastpos ] ) && ctype_space( $string[ $i ] ) ) ) { - $this->selector .= $string[ $i ]; - } elseif ( ctype_space( $string[ $i ] ) && $this->get_cfg( 'preserve_css' ) && ! $this->get_cfg( 'merge_selectors' ) ) { - $this->selector .= $string[ $i ]; - } - } - break; - - /* Case in-property */ - case 'ip': - if ( self::is_token( $string, $i ) ) { - if ( ( ':' === $string[ $i ] || '=' === $string[ $i ] ) && '' !== $this->property ) { - $this->status = 'iv'; - if ( ! $this->get_cfg( 'discard_invalid_properties' ) || self::property_is_valid( $this->property ) ) { - $this->property = $this->css_new_property( $this->at, $this->selector, $this->property ); - $this->_add_token( PROPERTY, $this->property ); - } - } elseif ( '/' === $string[ $i ] && '*' === @$string[ $i + 1 ] && '' === $this->property ) { - $this->status = 'ic'; - ++$i; - $this->from[] = 'ip'; - } elseif ( '}' === $string[ $i ] ) { - $this->explode_selectors(); - $this->status = 'is'; - $this->invalid_at = false; - $this->_add_token( SEL_END, $this->selector ); - $this->selector = ''; - $this->property = ''; - } elseif ( ';' === $string[ $i ] ) { - $this->property = ''; - } elseif ( '\\' === $string[ $i ] ) { - $this->property .= $this->_unicode( $string, $i ); - } elseif ( '' === $this->property && ! ctype_space( $string[ $i ] ) ) { - // else this is dumb IE a hack, keep it. - $this->property .= $string[ $i ]; - } - } elseif ( ! ctype_space( $string[ $i ] ) ) { - $this->property .= $string[ $i ]; - } - break; - - /* Case in-value */ - case 'iv': - $pn = ( ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) && $this->property_is_next( $string, $i + 1 ) || strlen( $string ) - 1 === $i ); - if ( ( self::is_token( $string, $i ) || $pn ) && ( ! ( ',' === $string[ $i ] && ! ctype_space( $string[ $i + 1 ] ) ) ) ) { - if ( '/' === $string[ $i ] && '*' === @$string[ $i + 1 ] ) { - $this->status = 'ic'; - ++$i; - $this->from[] = 'iv'; - } elseif ( ( '"' === $string[ $i ] || "'" === $string[ $i ] || '(' === $string[ $i ] ) ) { - $this->cur_string[] = $string[ $i ]; - $this->str_char[] = ( '(' === $string[ $i ] ) ? ')' : $string[ $i ]; - $this->status = 'instr'; - $this->from[] = 'iv'; - $this->quoted_string[] = in_array( strtolower( $this->property ), $quoted_string_properties, true ); - } elseif ( ',' === $string[ $i ] ) { - $this->sub_value = trim( $this->sub_value ) . ','; - } elseif ( '\\' === $string[ $i ] ) { - $this->sub_value .= $this->_unicode( $string, $i ); - } elseif ( ';' === $string[ $i ] || $pn ) { - if ( '@' === $this->selector[0] && isset( $at_rules[ substr( $this->selector, 1 ) ] ) && 'iv' === $at_rules[ substr( $this->selector, 1 ) ] ) { - $this->status = 'is'; - - switch ( $this->selector ) { - case '@charset': - /* Add quotes to charset */ - $this->sub_value_arr[] = '"' . trim( $this->sub_value ) . '"'; - $this->charset = $this->sub_value_arr[0]; - break; - case '@namespace': - /* Add quotes to namespace */ - $this->sub_value_arr[] = '"' . trim( $this->sub_value ) . '"'; - $this->namespace = implode( ' ', $this->sub_value_arr ); - break; - case '@import': - $this->sub_value = trim( $this->sub_value ); - - if ( empty( $this->sub_value_arr ) ) { - // Quote URLs in imports only if they're not already inside url() and not already quoted. - if ( ! str_starts_with( $this->sub_value, 'url(' ) ) { - if ( ! ( substr( $this->sub_value, -1 ) === $this->sub_value[0] && in_array( $this->sub_value[0], array( "'", '"' ), true ) ) ) { - $this->sub_value = '"' . $this->sub_value . '"'; - } - } - } - - $this->sub_value_arr[] = $this->sub_value; - $this->import[] = implode( ' ', $this->sub_value_arr ); - break; - } - - $this->sub_value_arr = array(); - $this->sub_value = ''; - $this->selector = ''; - $this->sel_separate = array(); - } else { - $this->status = 'ip'; - } - } elseif ( '}' !== $string[ $i ] ) { - $this->sub_value .= $string[ $i ]; - } - if ( ( '}' === $string[ $i ] || ';' === $string[ $i ] || $pn ) && ! empty( $this->selector ) ) { - if ( '' === $this->at ) { - $this->at = $this->css_new_media_section( DEFAULT_AT ); - } - - // case settings. - if ( $this->get_cfg( 'lowercase_s' ) ) { - $this->selector = strtolower( $this->selector ); - } - $this->property = strtolower( $this->property ); - - $this->optimise->subvalue(); - if ( '' !== $this->sub_value ) { - if ( str_starts_with( $this->sub_value, 'format' ) ) { - $format_strings = self::parse_string_list( substr( $this->sub_value, 7, -1 ) ); - if ( ! $format_strings ) { - $this->sub_value = ''; - } else { - $this->sub_value = 'format('; - - foreach ( $format_strings as $format_string ) { - $this->sub_value .= '"' . str_replace( '"', '\\"', $format_string ) . '",'; - } - - $this->sub_value = substr( $this->sub_value, 0, -1 ) . ')'; - } - } - if ( '' !== $this->sub_value ) { - $this->sub_value_arr[] = $this->sub_value; - } - $this->sub_value = ''; - } - - $this->value = array_shift( $this->sub_value_arr ); - while ( $this->sub_value_arr ) { - $this->value .= ' ' . array_shift( $this->sub_value_arr ); - } - - $this->optimise->value(); - - $valid = self::property_is_valid( $this->property ); - if ( ( ! $this->invalid_at || $this->get_cfg( 'preserve_css' ) ) && ( ! $this->get_cfg( 'discard_invalid_properties' ) || $valid ) ) { - $this->css_add_property( $this->at, $this->selector, $this->property, $this->value ); - $this->_add_token( VALUE, $this->value ); - $this->optimise->shorthands(); - } - if ( ! $valid ) { - if ( $this->get_cfg( 'discard_invalid_properties' ) ) { - $this->log( 'Removed invalid property: ' . $this->property, 'Warning' ); - } else { - $this->log( 'Invalid property in ' . strtoupper( $this->get_cfg( 'css_level' ) ) . ': ' . $this->property, 'Warning' ); - } - } - - $this->property = ''; - $this->sub_value_arr = array(); - $this->value = ''; - } - if ( '}' === $string[ $i ] ) { - $this->explode_selectors(); - $this->_add_token( SEL_END, $this->selector ); - $this->status = 'is'; - $this->invalid_at = false; - $this->selector = ''; - } - } elseif ( ! $pn ) { - $this->sub_value .= $string[ $i ]; - - if ( ctype_space( $string[ $i ] ) || ',' === $string[ $i ] ) { - $this->optimise->subvalue(); - if ( '' !== $this->sub_value ) { - $this->sub_value_arr[] = $this->sub_value; - $this->sub_value = ''; - } - } - } - break; - - /* Case in string */ - case 'instr': - $_str_char = $this->str_char[ count( $this->str_char ) - 1 ]; - $_cur_string = $this->cur_string[ count( $this->cur_string ) - 1 ]; - $temp_add = $string[ $i ]; - - // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but - // parentheticals can be nested more than once. - if ( ')' === $_str_char && ( '(' === $string[ $i ] || '"' === $string[ $i ] || '\'' === $string[ $i ] ) && ! self::escaped( $string, $i ) ) { - $this->cur_string[] = $string[ $i ]; - $this->str_char[] = $string[ $i ] === '(' ? ')' : $string[ $i ]; - $this->from[] = 'instr'; - $this->quoted_string[] = ! ( '(' === $string[ $i ] ); - continue 2; - } - - if ( ')' !== $_str_char && ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) && ! ( '\\' === $string[ $i - 1 ] && ! self::escaped( $string, $i - 1 ) ) ) { - $temp_add = '\\A'; - $this->log( 'Fixed incorrect newline in string', 'Warning' ); - } - - $_cur_string .= $temp_add; - - if ( $string[ $i ] === $_str_char && ! self::escaped( $string, $i ) ) { - $_quoted_string = array_pop( $this->quoted_string ); - - $this->status = array_pop( $this->from ); - - if ( ! preg_match( '|[' . implode( '', $GLOBALS['csstidy']['whitespace'] ) . ']|uis', $_cur_string ) && 'content' !== $this->property ) { - if ( ! $_quoted_string ) { - if ( ')' !== $_str_char ) { - // Convert properties like - // font-family: 'Arial'; - // to - // font-family: Arial; - // or - // url("abc") - // to - // url(abc). - $_cur_string = substr( $_cur_string, 1, -1 ); - } - } else { - $_quoted_string = false; - } - } - - array_pop( $this->cur_string ); - array_pop( $this->str_char ); - - if ( ')' === $_str_char ) { - $_cur_string = '(' . trim( substr( $_cur_string, 1, -1 ) ) . ')'; - } - - if ( 'iv' === $this->status ) { - // phpcs:disable Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.BlockComment.NoNewLine - // WPCOM hack: prevents CSSTidy from removing spaces after commas inside - // declaration's values. - // For more information, see D74626-code. - /*if ( ! $_quoted_string ) { - if ( strpos( $_cur_string, ',' ) !== false ) { - // we can on only remove space next to ','. - $_cur_string = implode( ',', array_map( 'trim', explode( ',', $_cur_string ) ) ); - } - // and multiple spaces (too expensive). - if ( strpos( $_cur_string, ' ' ) !== false ) { - $_cur_string = preg_replace( ',\s+,', ' ', $_cur_string ); - } - }*/ - // phpcs:enable Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.BlockComment.NoNewLine - $this->sub_value .= $_cur_string; - } elseif ( 'is' === $this->status ) { - $this->selector .= $_cur_string; - } elseif ( 'instr' === $this->status ) { - $this->cur_string[ count( $this->cur_string ) - 1 ] .= $_cur_string; - } - } else { - $this->cur_string[ count( $this->cur_string ) - 1 ] = $_cur_string; - } - break; - - /* Case in-comment */ - case 'ic': - if ( '*' === $string[ $i ] && '/' === $string[ $i + 1 ] ) { - $this->status = array_pop( $this->from ); - ++$i; - $this->_add_token( COMMENT, $cur_comment ); - $cur_comment = ''; - } else { - $cur_comment .= $string[ $i ]; - } - break; - } - } - - $this->optimise->postparse(); - - $this->print->_reset(); - - @setlocale( LC_ALL, $old ); // Set locale back to original setting. - - return ! ( empty( $this->css ) && empty( $this->import ) && empty( $this->charset ) && empty( $this->tokens ) && empty( $this->namespace ) ); - } - - /** - * Explodes selectors - * - * @access private - * @version 1.0 - */ - public function explode_selectors() { - // Explode multiple selectors. - if ( $this->get_cfg( 'merge_selectors' ) === 1 ) { - $new_sels = array(); - $lastpos = 0; - $this->sel_separate[] = strlen( $this->selector ); - foreach ( $this->sel_separate as $num => $pos ) { - if ( count( $this->sel_separate ) - 1 === $num ) { - ++$pos; - } - - $new_sels[] = substr( $this->selector, $lastpos, $pos - $lastpos - 1 ); - $lastpos = $pos; - } - - if ( count( $new_sels ) > 1 ) { - foreach ( $new_sels as $selector ) { - if ( isset( $this->css[ $this->at ][ $this->selector ] ) ) { - $this->merge_css_blocks( $this->at, $selector, $this->css[ $this->at ][ $this->selector ] ); - } - } - unset( $this->css[ $this->at ][ $this->selector ] ); - } - } - $this->sel_separate = array(); - } - - /** - * Checks if a character is escaped (and returns true if it is) - * - * @param string $string - the string. - * @param integer $pos - the position. - * @access public - * @return bool - * @version 1.02 - */ - public static function escaped( &$string, $pos ) { - return ! ( @( '\\' !== $string[ $pos - 1 ] ) || self::escaped( $string, $pos - 1 ) ); - } - - /** - * Adds a property with value to the existing CSS code - * - * @param string $media - the media. - * @param string $selector - the selector. - * @param string $property - the property. - * @param string $new_val - new value. - * @access private - * @version 1.2 - */ - public function css_add_property( $media, $selector, $property, $new_val ) { - if ( $this->get_cfg( 'preserve_css' ) || '' === trim( $new_val ) ) { - return; - } - - $this->added = true; - if ( isset( $this->css[ $media ][ $selector ][ $property ] ) ) { - if ( ( self::is_important( $this->css[ $media ][ $selector ][ $property ] ) && self::is_important( $new_val ) ) || ! self::is_important( $this->css[ $media ][ $selector ][ $property ] ) ) { - $this->css[ $media ][ $selector ][ $property ] = trim( $new_val ); - } - } else { - $this->css[ $media ][ $selector ][ $property ] = trim( $new_val ); - } - } - - /** - * Start a new media section. - * Check if the media is not already known, - * else rename it with extra spaces - * to avoid merging - * - * @param string $media - the media. - * @return string - */ - public function css_new_media_section( $media ) { - if ( $this->get_cfg( 'preserve_css' ) ) { - return $media; - } - - // if the last @media is the same as this keep it. - if ( ! $this->css || ! is_array( $this->css ) || empty( $this->css ) ) { - return $media; - } - end( $this->css ); - $at = current( $this->css ); - if ( $at === $media ) { - return $media; - } - while ( isset( $this->css[ $media ] ) ) { - if ( is_numeric( $media ) ) { - ++$media; - } else { - $media .= ' '; - } - } - return $media; - } - - /** - * Start a new selector. - * If already referenced in this media section, - * rename it with extra space to avoid merging - * except if merging is required, - * or last selector is the same (merge siblings) - * - * Never merge @font-face - * - * @param string $media - the media. - * @param string $selector - the selector. - * @return string - */ - public function css_new_selector( $media, $selector ) { - if ( $this->get_cfg( 'preserve_css' ) ) { - return $selector; - } - $selector = trim( $selector ); - if ( strncmp( $selector, '@font-face', 10 ) !== 0 ) { - if ( $this->settings['merge_selectors'] ) { - return $selector; - } - - if ( ! $this->css || ! isset( $this->css[ $media ] ) || ! $this->css[ $media ] ) { - return $selector; - } - - // if last is the same, keep it. - end( $this->css[ $media ] ); - $sel = current( $this->css[ $media ] ); - if ( $sel === $selector ) { - return $selector; - } - } - - while ( isset( $this->css[ $media ][ $selector ] ) ) { - $selector .= ' '; - } - return $selector; - } - - /** - * Start a new propertie. - * If already references in this selector, - * rename it with extra space to avoid override - * - * @param string $media - the media. - * @param string $selector - the selector. - * @param string $property - the property. - * @return string - */ - public function css_new_property( $media, $selector, $property ) { - if ( $this->get_cfg( 'preserve_css' ) ) { - return $property; - } - if ( ! $this->css || ! isset( $this->css[ $media ][ $selector ] ) || ! $this->css[ $media ][ $selector ] ) { - return $property; - } - - while ( isset( $this->css[ $media ][ $selector ][ $property ] ) ) { - $property .= ' '; - } - - return $property; - } - - /** - * Adds CSS to an existing media/selector - * - * @param string $media - the media. - * @param string $selector - the selector. - * @param array $css_add - css being added. - * @access private - * @version 1.1 - */ - public function merge_css_blocks( $media, $selector, $css_add ) { - foreach ( $css_add as $property => $value ) { - $this->css_add_property( $media, $selector, $property, $value ); - } - } - - /** - * Checks if $value is !important. - * - * @param string $value - the value. - * @return bool - * @access public - * @version 1.0 - */ - public static function is_important( &$value ) { - return ( ! strcasecmp( substr( str_replace( $GLOBALS['csstidy']['whitespace'], '', $value ), -10, 10 ), '!important' ) ); - } - - /** - * Returns a value without !important - * - * @param string $value - the value. - * @return string - * @access public - * @version 1.0 - */ - public static function gvw_important( $value ) { - if ( self::is_important( $value ) ) { - $value = trim( $value ); - $value = substr( $value, 0, -9 ); - $value = trim( $value ); - $value = substr( $value, 0, -1 ); - $value = trim( $value ); - return $value; - } - return $value; - } - - /** - * Checks if the next word in a string from pos is a CSS property - * - * @param string $istring - if it's a string. - * @param integer $pos - position. - * @return bool - * @access private - * @version 1.2 - */ - public function property_is_next( $istring, $pos ) { - $all_properties = & $GLOBALS['csstidy']['all_properties']; - $istring = substr( $istring, $pos, strlen( $istring ) - $pos ); - $pos = strpos( $istring, ':' ); - if ( false === $pos ) { - return false; - } - $istring = strtolower( trim( substr( $istring, 0, $pos ) ) ); - if ( isset( $all_properties[ $istring ] ) ) { - $this->log( 'Added semicolon to the end of declaration', 'Warning' ); - return true; - } - return false; - } - - /** - * Checks if a property is valid - * - * @param string $property - the property. - * @return bool - * @access public - * @version 1.0 - */ - public function property_is_valid( $property ) { - $property = strtolower( $property ); - if ( in_array( trim( $property ), $GLOBALS['csstidy']['multiple_properties'], true ) ) { - $property = trim( $property ); - } - $all_properties = & $GLOBALS['csstidy']['all_properties']; - return ( isset( $all_properties[ $property ] ) && strpos( $all_properties[ $property ], strtoupper( $this->get_cfg( 'css_level' ) ) ) !== false ); - } - - /** - * Accepts a list of strings (e.g., the argument to format() in a @font-face src property) - * and returns a list of the strings. Converts things like: - * - * Format(abc) => format("abc") - * format(abc def) => format("abc","def") - * format(abc "def") => format("abc","def") - * format(abc, def, ghi) => format("abc","def","ghi") - * format("abc",'def') => format("abc","def") - * format("abc, def, ghi") => format("abc, def, ghi") - * - * @param string $value - the value. - * @return array - */ - public function parse_string_list( $value ) { - $value = trim( $value ); - - // Case: if it's empty. - if ( ! $value ) { - return array(); - } - - $strings = array(); - - $in_str = false; - $current_string = ''; - - for ( $i = 0, $_len = strlen( $value ); $i < $_len; $i++ ) { - if ( ( ',' === $value[ $i ] || ' ' === $value[ $i ] ) && true === $in_str ) { - $in_str = false; - $strings[] = $current_string; - $current_string = ''; - } elseif ( '"' === $value[ $i ] || "'" === $value[ $i ] ) { - if ( $in_str === $value[ $i ] ) { - $strings[] = $current_string; - $in_str = false; - $current_string = ''; - continue; - } elseif ( ! $in_str ) { - $in_str = $value[ $i ]; - } - } elseif ( $in_str ) { - $current_string .= $value[ $i ]; - } elseif ( ! preg_match( '/[\s,]/', $value[ $i ] ) ) { - $in_str = true; - $current_string = $value[ $i ]; - } - } - - if ( $current_string ) { - $strings[] = $current_string; - } - - return $strings; - } -} diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/cssparse.css b/projects/plugins/jetpack/modules/custom-css/csstidy/cssparse.css deleted file mode 100644 index 4dab9b503a2d3..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/cssparse.css +++ /dev/null @@ -1,118 +0,0 @@ -@import url("./cssparsed.css"); - -html, body { -font:0.8em Verdana,Helvetica,sans-serif; -background:#F8F8F6; -} - -code { -font-size:1.2em; -} - -div#rightcol { -padding-left:32em; -} - -fieldset { -display:block; -margin:0.5em 0; -padding:1em; -border:solid #7284AB 2px; -} -fieldset.code_output { -display:inline; -} - -h1 { -font-size:2em; -} - -small { -font-size:0.7em; -} - -fieldset#field_input { -float:left; -margin:0 0.5em 1em 0; -} - -fieldset#options,fieldset#code_layout { -width:31em; -} - -input#submit { -clear:both; -display:block; -margin:1em; -} - -select { -margin:2px 0 0; -} - -label.block { -display:block; -} - -legend { -background:#c4E1C3; -padding:2px 4px; -border:dashed 1px; -} - -textarea#css_text { -width:27em; -height:370px; -display:block; -margin-right:1em; -} - -.help { -cursor:help; -} - -p.important { -border:solid 1px red; -font-weight:bold; -padding:1em; -background:white; -} - -p { -margin:1em 0; -} - -dl { -padding-left:0.5em; -} - -dt { -font-weight:bold; -margin:0; -float:left; -clear:both; -height:1.5em; -} - -dd { -margin:0 0 0 4em; -height:1.5em; -} - -fieldset#messages { -background:white; -padding:0 0 0 1em; -} - -fieldset#messages div { -height:10em; -overflow:auto; -} - -dd.Warning { -color:orange; -} - -dd.Information { -color:green; -} diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/cssparsed.css b/projects/plugins/jetpack/modules/custom-css/csstidy/cssparsed.css deleted file mode 100644 index 5aaf2bb140cea..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/cssparsed.css +++ /dev/null @@ -1,29 +0,0 @@ -code#copytext { - white-space: pre; - font-family: Verdana; -} - -.at { -color:darkblue; -} - -.format { -color:gray; -} - -.property { -color:green; -} - -.selector { -color:blue; -} - -.value { -color:red; -left: 500px; -} - -.comment { -color:orange; -} \ No newline at end of file diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php b/projects/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php deleted file mode 100644 index 486c49ab9e320..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php +++ /dev/null @@ -1,101 +0,0 @@ - $levels ) { - if ( strpos( $levels, ',' ) === false ) { - $GLOBALS['csstidy']['all_properties'][ '-moz-' . $property ] = $levels; - $GLOBALS['csstidy']['all_properties'][ '-webkit-' . $property ] = $levels; - $GLOBALS['csstidy']['all_properties'][ '-ms-' . $property ] = $levels; - $GLOBALS['csstidy']['all_properties'][ '-o-' . $property ] = $levels; - $GLOBALS['csstidy']['all_properties'][ '-khtml-' . $property ] = $levels; - - if ( in_array( $property, $GLOBALS['csstidy']['unit_values'], true ) ) { - $GLOBALS['csstidy']['unit_values'][] = '-moz-' . $property; - $GLOBALS['csstidy']['unit_values'][] = '-webkit-' . $property; - $GLOBALS['csstidy']['unit_values'][] = '-ms-' . $property; - $GLOBALS['csstidy']['unit_values'][] = '-o-' . $property; - $GLOBALS['csstidy']['unit_values'][] = '-khtml-' . $property; - } - - if ( in_array( $property, $GLOBALS['csstidy']['color_values'], true ) ) { - $GLOBALS['csstidy']['color_values'][] = '-moz-' . $property; - $GLOBALS['csstidy']['color_values'][] = '-webkit-' . $property; - $GLOBALS['csstidy']['color_values'][] = '-ms-' . $property; - $GLOBALS['csstidy']['color_values'][] = '-o-' . $property; - $GLOBALS['csstidy']['color_values'][] = '-khtml-' . $property; - } - } -} - -// Add `display` to the list of properties that can be used multiple times in a single selector -$GLOBALS['csstidy']['multiple_properties'][] = 'display'; - -// Allow vendor prefixes for any property that is allowed to be used multiple times inside a single selector -foreach ( $GLOBALS['csstidy']['multiple_properties'] as $property ) { - if ( '-' !== $property[0] ) { - $GLOBALS['csstidy']['multiple_properties'][] = '-o-' . $property; - $GLOBALS['csstidy']['multiple_properties'][] = '-ms-' . $property; - $GLOBALS['csstidy']['multiple_properties'][] = '-webkit-' . $property; - $GLOBALS['csstidy']['multiple_properties'][] = '-moz-' . $property; - $GLOBALS['csstidy']['multiple_properties'][] = '-khtml-' . $property; - } -} - -/** - * CSS Animation - * - * @see https://developer.mozilla.org/en/CSS/CSS_animations - */ -$GLOBALS['csstidy']['at_rules']['-webkit-keyframes'] = 'at'; -$GLOBALS['csstidy']['at_rules']['-moz-keyframes'] = 'at'; -$GLOBALS['csstidy']['at_rules']['-ms-keyframes'] = 'at'; -$GLOBALS['csstidy']['at_rules']['-o-keyframes'] = 'at'; - -/** - * Non-standard viewport rule. - */ -$GLOBALS['csstidy']['at_rules']['viewport'] = 'is'; -$GLOBALS['csstidy']['at_rules']['-webkit-viewport'] = 'is'; -$GLOBALS['csstidy']['at_rules']['-moz-viewport'] = 'is'; -$GLOBALS['csstidy']['at_rules']['-ms-viewport'] = 'is'; - -/** - * Non-standard CSS properties. They're not part of any spec, but we say - * they're in all of them so that we can support them. - */ -$GLOBALS['csstidy']['all_properties']['-webkit-filter'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-moz-filter'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-ms-filter'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['filter'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scrollbar-face-color'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-ms-interpolation-mode'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-rendering'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-webkit-transform-origin-x'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-webkit-transform-origin-y'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-webkit-transform-origin-z'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-webkit-font-smoothing'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-moz-osx-font-smoothing'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-font-smooth'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-o-object-fit'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['object-fit'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['-o-object-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['object-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-overflow'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['zoom'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['pointer-events'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-feature-settings'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-kerning'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-language-override'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-synthesis'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant-alternates'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant-caps'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant-east-asian'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant-ligatures'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant-numeric'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variation-settings'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-height-step'] = 'CSS3.0'; diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/data.inc.php b/projects/plugins/jetpack/modules/custom-css/csstidy/data.inc.php deleted file mode 100644 index 87163a845e502..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/data.inc.php +++ /dev/null @@ -1,794 +0,0 @@ -?[]^`|~'; - -/** - * All CSS units (CSS 3 units included) - * - * @see compress_numbers() - * @global array $GLOBALS['csstidy']['units'] - * @version 1.0 - */ -$GLOBALS['csstidy']['units'] = array( 'in', 'cm', 'mm', 'pt', 'pc', 'px', 'rem', 'em', '%', 'ex', 'gd', 'vw', 'vh', 'vm', 'deg', 'grad', 'rad', 'ms', 's', 'khz', 'hz' ); - -/** - * Available at-rules - * - * @global array $GLOBALS['csstidy']['at_rules'] - * @version 1.0 - */ -$GLOBALS['csstidy']['at_rules'] = array( - 'page' => 'is', - 'font-face' => 'is', - 'charset' => 'iv', - 'import' => 'iv', - 'namespace' => 'iv', - 'media' => 'at', - 'keyframes' => 'at', - 'supports' => 'at', -); - -/** - * Properties that need a value with unit - * - * @todo CSS3 properties - * @see compress_numbers(); - * @global array $GLOBALS['csstidy']['unit_values'] - * @version 1.2 - */ -$GLOBALS['csstidy']['unit_values'] = array( - 'background', - 'background-position', - 'background-size', - 'border', - 'border-top', - 'border-right', - 'border-bottom', - 'border-left', - 'border-width', - 'border-top-width', - 'border-right-width', - 'border-left-width', - 'border-bottom-width', - 'bottom', - 'border-spacing', - 'column-gap', - 'column-width', - 'font-size', - 'height', - 'left', - 'margin', - 'margin-top', - 'margin-right', - 'margin-bottom', - 'margin-left', - 'margin-block', - 'margin-block-start', - 'margin-block-end', - 'max-height', - 'max-width', - 'min-height', - 'min-width', - 'outline', - 'outline-width', - 'padding', - 'padding-top', - 'padding-right', - 'padding-bottom', - 'padding-left', - 'perspective', - 'right', - 'top', - 'text-indent', - 'letter-spacing', - 'word-spacing', - 'width', -); - -/** - * Properties that allow as value - * - * @todo CSS3 properties - * @see compress_numbers(); - * @global array $GLOBALS['csstidy']['color_values'] - * @version 1.0 - */ -$GLOBALS['csstidy']['color_values'] = array(); -$GLOBALS['csstidy']['color_values'][] = 'background-color'; -$GLOBALS['csstidy']['color_values'][] = 'border-color'; -$GLOBALS['csstidy']['color_values'][] = 'border-top-color'; -$GLOBALS['csstidy']['color_values'][] = 'border-right-color'; -$GLOBALS['csstidy']['color_values'][] = 'border-bottom-color'; -$GLOBALS['csstidy']['color_values'][] = 'border-left-color'; -$GLOBALS['csstidy']['color_values'][] = 'color'; -$GLOBALS['csstidy']['color_values'][] = 'outline-color'; -$GLOBALS['csstidy']['color_values'][] = 'column-rule-color'; - -/** - * Default values for the background properties - * - * @todo Possibly property names will change during CSS3 development - * @global array $GLOBALS['csstidy']['background_prop_default'] - * @see dissolve_short_bg() - * @see merge_bg() - * @version 1.0 - */ -$GLOBALS['csstidy']['background_prop_default'] = array(); -$GLOBALS['csstidy']['background_prop_default']['background-image'] = 'none'; -$GLOBALS['csstidy']['background_prop_default']['background-size'] = 'auto'; -$GLOBALS['csstidy']['background_prop_default']['background-repeat'] = 'repeat'; -$GLOBALS['csstidy']['background_prop_default']['background-position'] = '0 0'; -$GLOBALS['csstidy']['background_prop_default']['background-attachment'] = 'scroll'; -$GLOBALS['csstidy']['background_prop_default']['background-clip'] = 'border'; -$GLOBALS['csstidy']['background_prop_default']['background-origin'] = 'padding'; -$GLOBALS['csstidy']['background_prop_default']['background-color'] = 'transparent'; - -/** - * Default values for the font properties - * - * @global array $GLOBALS['csstidy']['font_prop_default'] - * @see merge_fonts() - * @version 1.3 - */ -$GLOBALS['csstidy']['font_prop_default'] = array(); -$GLOBALS['csstidy']['font_prop_default']['font-style'] = 'normal'; -$GLOBALS['csstidy']['font_prop_default']['font-variant'] = 'normal'; -$GLOBALS['csstidy']['font_prop_default']['font-weight'] = 'normal'; -$GLOBALS['csstidy']['font_prop_default']['font-size'] = ''; -$GLOBALS['csstidy']['font_prop_default']['line-height'] = ''; -$GLOBALS['csstidy']['font_prop_default']['font-family'] = ''; - -/** - * A list of non-W3C color names which get replaced by their hex-codes - * - * @global array $GLOBALS['csstidy']['replace_colors'] - * @see cut_color() - * @version 1.0 - */ -$GLOBALS['csstidy']['replace_colors'] = array(); -$GLOBALS['csstidy']['replace_colors']['aliceblue'] = '#f0f8ff'; -$GLOBALS['csstidy']['replace_colors']['antiquewhite'] = '#faebd7'; -$GLOBALS['csstidy']['replace_colors']['aquamarine'] = '#7fffd4'; -$GLOBALS['csstidy']['replace_colors']['azure'] = '#f0ffff'; -$GLOBALS['csstidy']['replace_colors']['beige'] = '#f5f5dc'; -$GLOBALS['csstidy']['replace_colors']['bisque'] = '#ffe4c4'; -$GLOBALS['csstidy']['replace_colors']['blanchedalmond'] = '#ffebcd'; -$GLOBALS['csstidy']['replace_colors']['blueviolet'] = '#8a2be2'; -$GLOBALS['csstidy']['replace_colors']['brown'] = '#a52a2a'; -$GLOBALS['csstidy']['replace_colors']['burlywood'] = '#deb887'; -$GLOBALS['csstidy']['replace_colors']['cadetblue'] = '#5f9ea0'; -$GLOBALS['csstidy']['replace_colors']['chartreuse'] = '#7fff00'; -$GLOBALS['csstidy']['replace_colors']['chocolate'] = '#d2691e'; -$GLOBALS['csstidy']['replace_colors']['coral'] = '#ff7f50'; -$GLOBALS['csstidy']['replace_colors']['cornflowerblue'] = '#6495ed'; -$GLOBALS['csstidy']['replace_colors']['cornsilk'] = '#fff8dc'; -$GLOBALS['csstidy']['replace_colors']['crimson'] = '#dc143c'; -$GLOBALS['csstidy']['replace_colors']['cyan'] = '#00ffff'; -$GLOBALS['csstidy']['replace_colors']['darkblue'] = '#00008b'; -$GLOBALS['csstidy']['replace_colors']['darkcyan'] = '#008b8b'; -$GLOBALS['csstidy']['replace_colors']['darkgoldenrod'] = '#b8860b'; -$GLOBALS['csstidy']['replace_colors']['darkgray'] = '#a9a9a9'; -$GLOBALS['csstidy']['replace_colors']['darkgreen'] = '#006400'; -$GLOBALS['csstidy']['replace_colors']['darkkhaki'] = '#bdb76b'; -$GLOBALS['csstidy']['replace_colors']['darkmagenta'] = '#8b008b'; -$GLOBALS['csstidy']['replace_colors']['darkolivegreen'] = '#556b2f'; -$GLOBALS['csstidy']['replace_colors']['darkorange'] = '#ff8c00'; -$GLOBALS['csstidy']['replace_colors']['darkorchid'] = '#9932cc'; -$GLOBALS['csstidy']['replace_colors']['darkred'] = '#8b0000'; -$GLOBALS['csstidy']['replace_colors']['darksalmon'] = '#e9967a'; -$GLOBALS['csstidy']['replace_colors']['darkseagreen'] = '#8fbc8f'; -$GLOBALS['csstidy']['replace_colors']['darkslateblue'] = '#483d8b'; -$GLOBALS['csstidy']['replace_colors']['darkslategray'] = '#2f4f4f'; -$GLOBALS['csstidy']['replace_colors']['darkturquoise'] = '#00ced1'; -$GLOBALS['csstidy']['replace_colors']['darkviolet'] = '#9400d3'; -$GLOBALS['csstidy']['replace_colors']['deeppink'] = '#ff1493'; -$GLOBALS['csstidy']['replace_colors']['deepskyblue'] = '#00bfff'; -$GLOBALS['csstidy']['replace_colors']['dimgray'] = '#696969'; -$GLOBALS['csstidy']['replace_colors']['dodgerblue'] = '#1e90ff'; -$GLOBALS['csstidy']['replace_colors']['feldspar'] = '#d19275'; -$GLOBALS['csstidy']['replace_colors']['firebrick'] = '#b22222'; -$GLOBALS['csstidy']['replace_colors']['floralwhite'] = '#fffaf0'; -$GLOBALS['csstidy']['replace_colors']['forestgreen'] = '#228b22'; -$GLOBALS['csstidy']['replace_colors']['gainsboro'] = '#dcdcdc'; -$GLOBALS['csstidy']['replace_colors']['ghostwhite'] = '#f8f8ff'; -$GLOBALS['csstidy']['replace_colors']['gold'] = '#ffd700'; -$GLOBALS['csstidy']['replace_colors']['goldenrod'] = '#daa520'; -$GLOBALS['csstidy']['replace_colors']['greenyellow'] = '#adff2f'; -$GLOBALS['csstidy']['replace_colors']['honeydew'] = '#f0fff0'; -$GLOBALS['csstidy']['replace_colors']['hotpink'] = '#ff69b4'; -$GLOBALS['csstidy']['replace_colors']['indianred'] = '#cd5c5c'; -$GLOBALS['csstidy']['replace_colors']['indigo'] = '#4b0082'; -$GLOBALS['csstidy']['replace_colors']['ivory'] = '#fffff0'; -$GLOBALS['csstidy']['replace_colors']['khaki'] = '#f0e68c'; -$GLOBALS['csstidy']['replace_colors']['lavender'] = '#e6e6fa'; -$GLOBALS['csstidy']['replace_colors']['lavenderblush'] = '#fff0f5'; -$GLOBALS['csstidy']['replace_colors']['lawngreen'] = '#7cfc00'; -$GLOBALS['csstidy']['replace_colors']['lemonchiffon'] = '#fffacd'; -$GLOBALS['csstidy']['replace_colors']['lightblue'] = '#add8e6'; -$GLOBALS['csstidy']['replace_colors']['lightcoral'] = '#f08080'; -$GLOBALS['csstidy']['replace_colors']['lightcyan'] = '#e0ffff'; -$GLOBALS['csstidy']['replace_colors']['lightgoldenrodyellow'] = '#fafad2'; -$GLOBALS['csstidy']['replace_colors']['lightgrey'] = '#d3d3d3'; -$GLOBALS['csstidy']['replace_colors']['lightgreen'] = '#90ee90'; -$GLOBALS['csstidy']['replace_colors']['lightpink'] = '#ffb6c1'; -$GLOBALS['csstidy']['replace_colors']['lightsalmon'] = '#ffa07a'; -$GLOBALS['csstidy']['replace_colors']['lightseagreen'] = '#20b2aa'; -$GLOBALS['csstidy']['replace_colors']['lightskyblue'] = '#87cefa'; -$GLOBALS['csstidy']['replace_colors']['lightslateblue'] = '#8470ff'; -$GLOBALS['csstidy']['replace_colors']['lightslategray'] = '#778899'; -$GLOBALS['csstidy']['replace_colors']['lightsteelblue'] = '#b0c4de'; -$GLOBALS['csstidy']['replace_colors']['lightyellow'] = '#ffffe0'; -$GLOBALS['csstidy']['replace_colors']['limegreen'] = '#32cd32'; -$GLOBALS['csstidy']['replace_colors']['linen'] = '#faf0e6'; -$GLOBALS['csstidy']['replace_colors']['magenta'] = '#ff00ff'; -$GLOBALS['csstidy']['replace_colors']['mediumaquamarine'] = '#66cdaa'; -$GLOBALS['csstidy']['replace_colors']['mediumblue'] = '#0000cd'; -$GLOBALS['csstidy']['replace_colors']['mediumorchid'] = '#ba55d3'; -$GLOBALS['csstidy']['replace_colors']['mediumpurple'] = '#9370d8'; -$GLOBALS['csstidy']['replace_colors']['mediumseagreen'] = '#3cb371'; -$GLOBALS['csstidy']['replace_colors']['mediumslateblue'] = '#7b68ee'; -$GLOBALS['csstidy']['replace_colors']['mediumspringgreen'] = '#00fa9a'; -$GLOBALS['csstidy']['replace_colors']['mediumturquoise'] = '#48d1cc'; -$GLOBALS['csstidy']['replace_colors']['mediumvioletred'] = '#c71585'; -$GLOBALS['csstidy']['replace_colors']['midnightblue'] = '#191970'; -$GLOBALS['csstidy']['replace_colors']['mintcream'] = '#f5fffa'; -$GLOBALS['csstidy']['replace_colors']['mistyrose'] = '#ffe4e1'; -$GLOBALS['csstidy']['replace_colors']['moccasin'] = '#ffe4b5'; -$GLOBALS['csstidy']['replace_colors']['navajowhite'] = '#ffdead'; -$GLOBALS['csstidy']['replace_colors']['oldlace'] = '#fdf5e6'; -$GLOBALS['csstidy']['replace_colors']['olivedrab'] = '#6b8e23'; -$GLOBALS['csstidy']['replace_colors']['orangered'] = '#ff4500'; -$GLOBALS['csstidy']['replace_colors']['orchid'] = '#da70d6'; -$GLOBALS['csstidy']['replace_colors']['palegoldenrod'] = '#eee8aa'; -$GLOBALS['csstidy']['replace_colors']['palegreen'] = '#98fb98'; -$GLOBALS['csstidy']['replace_colors']['paleturquoise'] = '#afeeee'; -$GLOBALS['csstidy']['replace_colors']['palevioletred'] = '#d87093'; -$GLOBALS['csstidy']['replace_colors']['papayawhip'] = '#ffefd5'; -$GLOBALS['csstidy']['replace_colors']['peachpuff'] = '#ffdab9'; -$GLOBALS['csstidy']['replace_colors']['peru'] = '#cd853f'; -$GLOBALS['csstidy']['replace_colors']['pink'] = '#ffc0cb'; -$GLOBALS['csstidy']['replace_colors']['plum'] = '#dda0dd'; -$GLOBALS['csstidy']['replace_colors']['powderblue'] = '#b0e0e6'; -$GLOBALS['csstidy']['replace_colors']['rosybrown'] = '#bc8f8f'; -$GLOBALS['csstidy']['replace_colors']['royalblue'] = '#4169e1'; -$GLOBALS['csstidy']['replace_colors']['saddlebrown'] = '#8b4513'; -$GLOBALS['csstidy']['replace_colors']['salmon'] = '#fa8072'; -$GLOBALS['csstidy']['replace_colors']['sandybrown'] = '#f4a460'; -$GLOBALS['csstidy']['replace_colors']['seagreen'] = '#2e8b57'; -$GLOBALS['csstidy']['replace_colors']['seashell'] = '#fff5ee'; -$GLOBALS['csstidy']['replace_colors']['sienna'] = '#a0522d'; -$GLOBALS['csstidy']['replace_colors']['skyblue'] = '#87ceeb'; -$GLOBALS['csstidy']['replace_colors']['slateblue'] = '#6a5acd'; -$GLOBALS['csstidy']['replace_colors']['slategray'] = '#708090'; -$GLOBALS['csstidy']['replace_colors']['snow'] = '#fffafa'; -$GLOBALS['csstidy']['replace_colors']['springgreen'] = '#00ff7f'; -$GLOBALS['csstidy']['replace_colors']['steelblue'] = '#4682b4'; -$GLOBALS['csstidy']['replace_colors']['tan'] = '#d2b48c'; -$GLOBALS['csstidy']['replace_colors']['thistle'] = '#d8bfd8'; -$GLOBALS['csstidy']['replace_colors']['tomato'] = '#ff6347'; -$GLOBALS['csstidy']['replace_colors']['turquoise'] = '#40e0d0'; -$GLOBALS['csstidy']['replace_colors']['violet'] = '#ee82ee'; -$GLOBALS['csstidy']['replace_colors']['violetred'] = '#d02090'; -$GLOBALS['csstidy']['replace_colors']['wheat'] = '#f5deb3'; -$GLOBALS['csstidy']['replace_colors']['whitesmoke'] = '#f5f5f5'; -$GLOBALS['csstidy']['replace_colors']['yellowgreen'] = '#9acd32'; - -/** - * A list of all shorthand properties that are divided into four properties and/or have four subvalues - * - * @global array $GLOBALS['csstidy']['shorthands'] - * @todo Are there new ones in CSS3? - * @see dissolve_4value_shorthands() - * @see merge_4value_shorthands() - * @version 1.0 - */ -$GLOBALS['csstidy']['shorthands'] = array(); -$GLOBALS['csstidy']['shorthands']['border-color'] = array( 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color' ); -$GLOBALS['csstidy']['shorthands']['border-style'] = array( 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style' ); -$GLOBALS['csstidy']['shorthands']['border-width'] = array( 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width' ); -$GLOBALS['csstidy']['shorthands']['margin'] = array( 'margin-top', 'margin-right', 'margin-bottom', 'margin-left' ); -$GLOBALS['csstidy']['shorthands']['margin-block'] = array( 'margin-block-start', 'margin-block-end' ); -$GLOBALS['csstidy']['shorthands']['padding'] = array( 'padding-top', 'padding-right', 'padding-bottom', 'padding-left' ); -$GLOBALS['csstidy']['shorthands']['-moz-border-radius'] = 0; - -/** - * All CSS Properties. Needed for csstidy::property_is_next() - * - * @global array $GLOBALS['csstidy']['all_properties'] - * @todo Add CSS3 properties - * @version 1.0 - * @see csstidy::property_is_next() - */ -$GLOBALS['csstidy']['all_properties']['accent-color'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['align-content'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['align-items'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['align-self'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['alignment-adjust'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['alignment-baseline'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-delay'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-direction'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-duration'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-fill-mode'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-iteration-count'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-name'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-play-state'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['animation-timing-function'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['appearance'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['aspect-ratio'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['azimuth'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['backface-visibility'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-attachment'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-clip'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-color'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-image'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-origin'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-position'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-repeat'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['background-size'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['baseline-shift'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['binding'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['bleed'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['bookmark-label'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['bookmark-level'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['bookmark-state'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['bookmark-target'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-bottom'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-bottom-color'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-bottom-left-radius'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-bottom-right-radius'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-bottom-style'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-bottom-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-collapse'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-color'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-image'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-image-outset'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-image-repeat'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-image-slice'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-image-source'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-image-width'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-left'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-left-color'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-left-style'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-left-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-radius'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-right'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-right-color'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-right-style'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-right-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-spacing'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-style'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-top'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-top-color'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-top-left-radius'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-top-right-radius'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-top-style'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-top-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['border-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['bottom'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['box-decoration-break'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['box-shadow'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['box-sizing'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['break-after'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['break-before'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['break-inside'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['caption-side'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['clear'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['clip'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['clip-path'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['color'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['color-profile'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-count'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-fill'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-gap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-rule'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-rule-color'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-rule-style'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-rule-width'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-span'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['column-width'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['columns'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['content'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['counter-increment'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['counter-reset'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['crop'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['cue'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['cue-after'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['cue-before'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['cursor'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['direction'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['display'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['dominant-baseline'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['drop-initial-after-adjust'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['drop-initial-after-align'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['drop-initial-before-adjust'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['drop-initial-before-align'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['drop-initial-size'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['drop-initial-value'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['elevation'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['empty-cells'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['fill'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['fit'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['fit-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-align'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-basis'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-direction'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-flow'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-grow'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-line-pack'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-order'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-pack'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-shrink'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['flex-wrap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['float'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['float-offset'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-family'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-size'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-size-adjust'] = 'CSS2.0,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-stretch'] = 'CSS2.0,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-style'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-variant'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['font-weight'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['gap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-area'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-auto-columns'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-auto-flow'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-auto-rows'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-column'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-columns'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-column-end'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-column-gap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-column-start'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-gap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-row'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-rows'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-row-end'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-row-gap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-row-start'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-template'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-template-areas'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-template-columns'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['grid-template-rows'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hanging-punctuation'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['height'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hyphenate-after'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hyphenate-before'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hyphenate-character'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hyphenate-lines'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hyphenate-resource'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['hyphens'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['icon'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['image-orientation'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['image-rendering'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['image-resolution'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['inline-box-align'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['justify-content'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['justify-items'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['justify-self'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['left'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['letter-spacing'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-break'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-height'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-stacking'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-stacking-ruby'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-stacking-shift'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['line-stacking-strategy'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['list-style'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['list-style-image'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['list-style-position'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['list-style-type'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin-bottom'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin-left'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin-right'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin-top'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; - -/* - * Part of the W3C Working Draft: - * https://www.w3.org/TR/css-logical-1/#margin-properties - */ -$GLOBALS['csstidy']['all_properties']['margin-block'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin-block-start'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['margin-block-end'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; - -$GLOBALS['csstidy']['all_properties']['marker-offset'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['marks'] = 'CSS2.0,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['marquee-direction'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['marquee-loop'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['marquee-play-count'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['marquee-speed'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['marquee-style'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-clip'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-composite'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-image'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-mode'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-origin'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-repeat'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['mask-size'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['max-height'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['max-width'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['min-height'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['min-width'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['move-to'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['nav-down'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['nav-index'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['nav-left'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['nav-right'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['nav-up'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['object-fit'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['object-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['opacity'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['order'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['orphans'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['outline'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['outline-color'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['outline-offset'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['outline-style'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['outline-width'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['overflow'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['overflow-style'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['overflow-wrap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['overflow-x'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['overflow-y'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['padding'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['padding-bottom'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['padding-left'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['padding-right'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['padding-top'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['page'] = 'CSS2.0,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['page-break-after'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['page-break-before'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['page-break-inside'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['page-policy'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['pause'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['pause-after'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['pause-before'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['perspective'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['perspective-origin'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['phonemes'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['pitch'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['pitch-range'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['play-during'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['position'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['presentation-level'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['punctuation-trim'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['quotes'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['rendering-intent'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['resize'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['rest'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['rest-after'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['rest-before'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['richness'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['right'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['rotation'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['rotation-point'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['ruby-align'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['ruby-overhang'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['ruby-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['ruby-span'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-behavior'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-block'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-block-end'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-block-start'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-bottom'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-inline'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-inline-end'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-inline-start'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-left'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-right'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-margin-top'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-block'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-block-end'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-block-start'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-bottom'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-inline'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-inline-end'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-inline-start'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-left'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-right'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-padding-top'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-snap-align'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['scroll-snap-stop'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['size'] = 'CSS2.0,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['speak'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['speak-header'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['speak-numeral'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['speak-punctuation'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['speech-rate'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['src'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['stress'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['string-set'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['stroke'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['tab-size'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['table-layout'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['target'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['target-name'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['target-new'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['target-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-align'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-align-last'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-decoration'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-decoration-color'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-decoration-line'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-decoration-skip'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-decoration-style'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-emphasis'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-emphasis-color'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-emphasis-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-emphasis-style'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-height'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-indent'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-justify'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-outline'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-shadow'] = 'CSS2.0,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-space-collapse'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-transform'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-underline-offset'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-underline-position'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['text-wrap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['top'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transform'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transform-origin'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transform-style'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transition'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transition-delay'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transition-duration'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transition-property'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['transition-timing-function'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['unicode-bidi'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['vertical-align'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['visibility'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-balance'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-duration'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-family'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-pitch'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-pitch-range'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-rate'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-stress'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['voice-volume'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['volume'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['white-space'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['widows'] = 'CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['word-break'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['word-spacing'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0'; -$GLOBALS['csstidy']['all_properties']['word-wrap'] = 'CSS3.0'; -$GLOBALS['csstidy']['all_properties']['z-index'] = 'CSS2.0,CSS2.1,CSS3.0'; - -/** - * An array containing all properties that can accept a quoted string as a value. - * - * @global array $GLOBALS['csstidy']['quoted_string_properties'] - */ -$GLOBALS['csstidy']['quoted_string_properties'] = array( 'content', 'font', 'font-family', 'quotes' ); - -/** - * An array containing all properties that can be defined multiple times without being overwritten. - * All unit values are included so that units like rem can be supported with fallbacks to px or em. - * - * @global array $GLOBALS['csstidy']['quoted_string_properties'] - */ -$GLOBALS['csstidy']['multiple_properties'] = array_merge( $GLOBALS['csstidy']['color_values'], $GLOBALS['csstidy']['unit_values'], array( 'transition', 'background-image', 'border-image', 'list-style-image' ) ); - -/** - * An array containing all predefined templates. - * - * @global array $GLOBALS['csstidy']['predefined_templates'] - * @version 1.0 - * @see csstidy::load_template() - */ -$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; // string before @rule -$GLOBALS['csstidy']['predefined_templates']['default'][] = ' {' . "\n"; // bracket after @-rule -$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; // string before selector -$GLOBALS['csstidy']['predefined_templates']['default'][] = ' {' . "\n"; // bracket after selector -$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; // string before property -$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; // string after property+before value -$GLOBALS['csstidy']['predefined_templates']['default'][] = ';' . "\n"; // string after value -$GLOBALS['csstidy']['predefined_templates']['default'][] = '}'; // closing bracket - selector -$GLOBALS['csstidy']['predefined_templates']['default'][] = "\n\n"; // space between blocks {...} -$GLOBALS['csstidy']['predefined_templates']['default'][] = "\n" . '}' . "\n\n"; // closing bracket @-rule -$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; // indent in @-rule -$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; // before comment -$GLOBALS['csstidy']['predefined_templates']['default'][] = '' . "\n"; // after comment -$GLOBALS['csstidy']['predefined_templates']['default'][] = "\n"; // after last line @-rule - -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ' {' . "\n"; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '{'; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ';'; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '}'; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n"; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n" . '}' . "\n" . ''; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; // before comment -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = ''; // after comment -$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n"; - -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '{'; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '{'; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ';'; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '}'; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '}'; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; // before comment -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; // after comment -$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = ''; - -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ' {' . "\n"; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '' . "\n" . '{' . "\n"; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ' '; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ''; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ';' . "\n"; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '}'; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = "\n\n"; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = "\n" . '}' . "\n\n"; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ' '; -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ''; // before comment -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '' . "\n"; // after comment -$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = "\n"; - -require __DIR__ . '/data-wp.inc.php'; diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php b/projects/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php deleted file mode 100644 index afb95b5346dae..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php +++ /dev/null @@ -1,303 +0,0 @@ -. - * - * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2007, Brett Zamir (brettz9 at yahoo dot com) 2007 - */ - -if ( isset( $_GET['lang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site, determening language for translations. - $l = sanitize_text_field( wp_unslash( $_GET['lang'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site, determining language for translations. -} elseif ( isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) { - $l = filter_var( wp_unslash( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ); - $l = strtolower( substr( $l, 0, 2 ) ); -} else { - $l = ''; -} - -$l = ( in_array( $l, array( 'de', 'fr', 'zh' ), true ) ) ? $l : 'en'; - -// note 5 in all but French, and 40 in all are orphaned - -$lang = array(); -$lang['en'][0] = 'CSS Formatter and Optimiser/Optimizer (based on CSSTidy '; -$lang['en'][1] = 'CSS Formatter and Optimiser'; -$lang['en'][2] = '(based on'; -$lang['en'][3] = '(plaintext)'; -$lang['en'][4] = 'Important Note:'; -$lang['en'][6] = 'Your code should be well-formed. This is not a validator which points out errors in your CSS code. To make sure that your code is valid, use the W3C Validator.'; -$lang['en'][7] = 'all comments are removed'; -$lang['en'][8] = 'CSS Input:'; -$lang['en'][9] = 'CSS-Code:'; -$lang['en'][10] = 'CSS from URL:'; -$lang['en'][11] = 'Code Layout:'; -$lang['en'][12] = 'Compression (code layout):'; -$lang['en'][13] = 'Highest (no readability, smallest size)'; -$lang['en'][14] = 'High (moderate readability, smaller size)'; -$lang['en'][15] = 'Standard (balance between readability and size)'; -$lang['en'][16] = 'Low (higher readability)'; -$lang['en'][17] = 'Custom (enter below)'; -$lang['en'][18] = 'Custom template'; -$lang['en'][19] = 'Options'; -$lang['en'][20] = 'Sort Selectors (caution)'; -$lang['en'][21] = 'Sort Properties'; -$lang['en'][22] = 'Regroup selectors'; -$lang['en'][23] = 'Optimise shorthands'; -$lang['en'][24] = 'Compress colors'; -$lang['en'][25] = 'Lowercase selectors'; -$lang['en'][26] = 'Case for properties:'; -$lang['en'][27] = 'Lowercase'; -$lang['en'][28] = 'No or invalid CSS input or wrong URL!'; -$lang['en'][29] = 'Uppercase'; -$lang['en'][30] = 'lowercase elementnames needed for XHTML'; -$lang['en'][31] = 'Remove unnecessary backslashes'; -$lang['en'][32] = 'convert !important-hack'; -$lang['en'][33] = 'Output as file'; -$lang['en'][34] = 'Bigger compression because of smaller newlines (copy & paste doesn\'t work)'; -$lang['en'][35] = 'Process CSS'; -$lang['en'][36] = 'Compression Ratio'; -$lang['en'][37] = 'Input'; -$lang['en'][38] = 'Output'; -$lang['en'][39] = 'Language'; -$lang['en'][41] = 'Attention: This may change the behavior of your CSS Code!'; -$lang['en'][42] = 'Remove last ;'; -$lang['en'][43] = 'Discard invalid properties'; -$lang['en'][44] = 'Only safe optimisations'; -$lang['en'][45] = 'Compress font-weight'; -$lang['en'][46] = 'Save comments'; -$lang['en'][47] = 'Do not change anything'; -$lang['en'][48] = 'Only separate selectors (split at ,)'; -$lang['en'][49] = 'Merge selectors with the same properties (fast)'; -$lang['en'][50] = 'Merge selectors intelligently (slow)'; -$lang['en'][51] = 'Preserve CSS'; -$lang['en'][52] = 'Save comments, hacks, etc. Most optimisations can *not* be applied if this is enabled.'; -$lang['en'][53] = 'None'; -$lang['en'][54] = 'Don\'t optimise'; -$lang['en'][55] = 'Safe optimisations'; -$lang['en'][56] = 'All optimisations'; -$lang['en'][57] = 'Add timestamp'; -$lang['en'][58] = 'Copy to clipboard'; -$lang['en'][59] = 'Back to top'; -$lang['en'][60] = 'Your browser doesn\'t support copy to clipboard.'; -$lang['en'][61] = 'For bugs and suggestions feel free to'; -$lang['en'][62] = 'contact me'; -$lang['en'][63] = 'Output CSS code as complete HTML document'; -$lang['en'][64] = 'Code'; -$lang['en'][65] = 'CSS to style CSS output'; -$lang['en'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.'; - -$lang['de'][0] = 'CSS Formatierer und Optimierer (basierend auf CSSTidy '; -$lang['de'][1] = 'CSS Formatierer und Optimierer'; -$lang['de'][2] = '(basierend auf'; -$lang['de'][3] = '(Textversion)'; -$lang['de'][4] = 'Wichtiger Hinweis:'; -$lang['de'][6] = 'Der CSS Code sollte wohlgeformt sein. Der CSS Code wird nicht auf Gültigkeit überprüft. Um sicherzugehen dass dein Code valide ist, benutze den W3C Validierungsservice.'; -$lang['de'][7] = 'alle Kommentare werden entfernt'; -$lang['de'][8] = 'CSS Eingabe:'; -$lang['de'][9] = 'CSS-Code:'; -$lang['de'][10] = 'CSS von URL:'; -$lang['de'][11] = 'Code Layout:'; -$lang['de'][12] = 'Komprimierung (Code Layout):'; -$lang['de'][13] = 'Höchste (keine Lesbarkeit, niedrigste Größe)'; -$lang['de'][14] = 'Hoch (mittelmäßige Lesbarkeit, geringe Größe)'; -$lang['de'][15] = 'Standard (Kompromiss zwischen Lesbarkeit und Größe)'; -$lang['de'][16] = 'Niedrig (höhere Lesbarkeit)'; -$lang['de'][17] = 'Benutzerdefiniert (unten eingeben)'; -$lang['de'][18] = 'Benutzerdefinierte Vorlage'; -$lang['de'][19] = 'Optionen'; -$lang['de'][20] = 'Selektoren sortieren (Vorsicht)'; -$lang['de'][21] = 'Eigenschaften sortieren'; -$lang['de'][22] = 'Selektoren umgruppieren'; -$lang['de'][23] = 'Shorthands optimieren'; -$lang['de'][24] = 'Farben komprimieren'; -$lang['de'][25] = 'Selektoren in Kleinbuchstaben'; -$lang['de'][26] = 'Groß-/Kleinschreibung für Eigenschaften'; -$lang['de'][27] = 'Kleinbuchstaben'; -$lang['de'][28] = 'Keine oder ungültige CSS Eingabe oder falsche URL!'; -$lang['de'][29] = 'Großbuchstaben'; -$lang['de'][30] = 'kleingeschriebene Elementnamen benötigt für XHTML'; -$lang['de'][31] = 'Unnötige Backslashes entfernen'; -$lang['de'][32] = '!important-Hack konvertieren'; -$lang['de'][33] = 'Als Datei ausgeben'; -$lang['de'][34] = 'Größere Komprimierung augrund von kleineren Neuezeile-Zeichen'; -$lang['de'][35] = 'CSS verarbeiten'; -$lang['de'][36] = 'Komprimierungsrate'; -$lang['de'][37] = 'Eingabe'; -$lang['de'][38] = 'Ausgabe'; -$lang['de'][39] = 'Sprache'; -$lang['de'][41] = 'Achtung: Dies könnte das Verhalten ihres CSS-Codes verändern!'; -$lang['de'][42] = 'Letztes ; entfernen'; -$lang['de'][43] = 'Ungültige Eigenschaften entfernen'; -$lang['de'][44] = 'Nur sichere Optimierungen'; -$lang['de'][45] = 'font-weight komprimieren'; -$lang['de'][46] = 'Kommentare beibehalten'; -$lang['de'][47] = 'Nichts ändern'; -$lang['de'][48] = 'Selektoren nur trennen (am Komma)'; -$lang['de'][49] = 'Selektoren mit gleichen Eigenschaften zusammenfassen (schnell)'; -$lang['de'][50] = 'Selektoren intelligent zusammenfassen (langsam!)'; -$lang['de'][51] = 'CSS erhalten'; -$lang['de'][52] = 'Kommentare, Hacks, etc. speichern. Viele Optimierungen sind dann aber nicht mehr möglich.'; -$lang['de'][53] = 'Keine'; -$lang['de'][54] = 'Nicht optimieren'; -$lang['de'][55] = 'Sichere Optimierungen'; -$lang['de'][56] = 'Alle Optimierungen'; -$lang['de'][57] = 'Zeitstempel hinzufügen'; -$lang['de'][58] = 'Copy to clipboard'; -$lang['de'][59] = 'Back to top'; -$lang['de'][60] = 'Your browser doesn\'t support copy to clipboard.'; -$lang['de'][61] = 'For bugs and suggestions feel free to'; -$lang['de'][62] = 'contact me'; -$lang['de'][63] = 'Output CSS code as complete HTML document'; -$lang['de'][64] = 'Code'; -$lang['de'][65] = 'CSS to style CSS output'; -$lang['de'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.'; - -$lang['fr'][0] = 'CSS Formatteur et Optimiseur (basé sur CSSTidy '; -$lang['fr'][1] = 'CSS Formatteur et Optimiseur'; -$lang['fr'][2] = '(basé sur '; -$lang['fr'][3] = '(Version texte)'; -$lang['fr'][4] = 'Note Importante :'; -$lang['fr'][6] = 'Votre code doit être valide. Ce n’est pas un validateur qui signale les erreurs dans votre code CSS. Pour être sûr que votre code est correct, utilisez le validateur : W3C Validator.'; -$lang['fr'][7] = 'tous les commentaires sont enlevés'; -$lang['fr'][8] = 'Champ CSS :'; -$lang['fr'][9] = 'Code CSS :'; -$lang['fr'][10] = 'CSS en provenance d’une URL :
'; -$lang['fr'][11] = 'Mise en page du code :'; -$lang['fr'][12] = 'Compression (mise en page du code) :'; -$lang['fr'][13] = 'La plus élevée (aucune lisibilité, taille minimale)'; -$lang['fr'][14] = 'Élevée (lisibilité modérée, petite taille)'; -$lang['fr'][15] = 'Normale (équilibre entre lisibilité et taille)'; -$lang['fr'][16] = 'Faible (lisibilité élevée)'; -$lang['fr'][17] = 'Sur mesure (entrer ci-dessous)'; -$lang['fr'][18] = 'Gabarit sur mesure'; -$lang['fr'][19] = 'Options'; -$lang['fr'][20] = 'Trier les sélecteurs (attention)'; -$lang['fr'][21] = 'Trier les propriétés'; -$lang['fr'][22] = 'Regrouper les sélecteurs'; -$lang['fr'][23] = 'Propriétés raccourcies'; -$lang['fr'][24] = 'Compresser les couleurs'; -$lang['fr'][25] = 'Sélecteurs en minuscules'; -$lang['fr'][26] = 'Case pour les propriétés :'; -$lang['fr'][27] = 'Minuscule'; -$lang['fr'][28] = 'CSS non valide ou URL incorrecte !'; -$lang['fr'][29] = 'Majuscule'; -$lang['fr'][30] = 'les noms des éléments en minuscules (indispensables pour XHTML)'; -$lang['fr'][31] = 'enlever les antislashs inutiles'; -$lang['fr'][32] = 'convertir !important-hack'; -$lang['fr'][33] = 'Sauver en tant que fichier'; -$lang['fr'][34] = 'Meilleure compression grâce aux caractères de saut de ligne plus petits (copier & coller ne marche pas)'; -$lang['fr'][35] = 'Compresser la CSS'; -$lang['fr'][36] = 'Facteur de Compression'; -$lang['fr'][37] = 'Entrée'; -$lang['fr'][38] = 'Sortie'; -$lang['fr'][39] = 'Langue'; -$lang['fr'][41] = 'Attention : ceci peut changer le comportement de votre code CSS !'; -$lang['fr'][42] = 'Enlever le dernier ;'; -$lang['fr'][43] = 'Supprimer les propriétés non valide'; -$lang['fr'][44] = 'Seulement les optimisations sûres'; -$lang['fr'][45] = 'Compresser font-weight'; -$lang['fr'][46] = 'Sauvegarder les commentaires '; -$lang['fr'][47] = 'Ne rien changer'; -$lang['fr'][48] = 'Sépare les sélecteurs (sépare au niveau de ,)'; -$lang['fr'][49] = 'Fusionne les sélecteurs avec les mêmes propriétés (rapide)'; -$lang['fr'][50] = 'Fusionne les sélecteurs intelligemment (lent)'; -$lang['fr'][51] = 'Préserver la CSS'; -$lang['fr'][52] = 'Sauvegarder les commentaires, hacks, etc. La plupart des optimisations ne peuvent *pas* être appliquées si cela est activé.'; -$lang['fr'][53] = 'Aucun'; -$lang['fr'][54] = 'Ne pas optimiser'; -$lang['fr'][55] = 'Optimisations sûres'; -$lang['fr'][56] = 'Toutes les optimisations'; -$lang['fr'][57] = 'Ajouter un timestamp'; -$lang['fr'][58] = 'Copier dans le presse-papiers'; -$lang['fr'][59] = 'Retour en haut'; -$lang['fr'][60] = 'Votre navigateur ne suporte pas la copie vers le presse-papiers.'; -$lang['fr'][61] = 'Pour signaler des bugs ou pour des suggestions,'; -$lang['fr'][62] = 'contactez-moi'; -$lang['fr'][63] = 'Sauver le code CSS comme document complet HTML'; -$lang['fr'][64] = 'Code'; -$lang['fr'][65] = 'CSS pour colorier la sortie CSS'; -$lang['fr'][66] = 'Vous devez aller dans about:config dans votre barre d’adresse, selectionner \'signed.applets.codebase_principal_support\' dans le champ Filtre et attribuez-lui la valeur \'true\' pour utiliser cette fonctionnalité; toutefois, soyez conscient que cela augmente les risques de sécurité.'; - -$lang['zh'][0] = 'CSS整形與最佳化工具(使用 CSSTidy '; -$lang['zh'][1] = 'CSS整形與最佳化工具'; -$lang['zh'][2] = '(使用'; -$lang['zh'][3] = '(純文字)'; -$lang['zh'][4] = '重要事項:'; -$lang['zh'][6] = '你的原始碼必須是良構的(well-formed). 這個工具沒有內建驗證器(validator). 驗證器能夠指出你CSS原始碼裡的錯誤. 請使用 W3C 驗證器, 確保你的原始碼合乎規範.'; -$lang['zh'][7] = '所有註解都移除了'; -$lang['zh'][8] = 'CSS 輸入:'; -$lang['zh'][9] = 'CSS 原始碼:'; -$lang['zh'][10] = 'CSS 檔案網址(URL):'; -$lang['zh'][11] = '原始碼規劃:'; -$lang['zh'][12] = '壓縮程度(原始碼規劃):'; -$lang['zh'][13] = '最高 (沒有辦法讀, 檔案最小)'; -$lang['zh'][14] = '高 (適度的可讀性, 檔案小)'; -$lang['zh'][15] = '標準 (兼顧可讀性與檔案大小)'; -$lang['zh'][16] = '低 (注重可讀性)'; -$lang['zh'][17] = '自訂 (在下方設定)'; -$lang['zh'][18] = '自訂樣板'; -$lang['zh'][19] = '選項'; -$lang['zh'][20] = '整理選擇符(請謹慎使用)'; -$lang['zh'][21] = '整理屬性'; -$lang['zh'][22] = '重組選擇符'; -$lang['zh'][23] = '速記法(shorthand)最佳化'; -$lang['zh'][24] = '壓縮色彩語法'; -$lang['zh'][25] = '改用小寫選擇符'; -$lang['zh'][26] = '屬性的字形:'; -$lang['zh'][27] = '小寫'; -$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!'; -$lang['zh'][29] = '大寫'; -$lang['zh'][30] = 'XHTML必須使用小寫的元素名稱'; -$lang['zh'][31] = '移除不必要的反斜線'; -$lang['zh'][32] = '轉換 !important-hack'; -$lang['zh'][33] = '輸出成檔案形式'; -$lang['zh'][34] = '由於比較少換行字元, 會有更大的壓縮比率(複製&貼上沒有用)'; -$lang['zh'][35] = '執行'; -$lang['zh'][36] = '壓縮比率'; -$lang['zh'][37] = '輸入'; -$lang['zh'][38] = '輸出'; -$lang['zh'][39] = '語言'; -$lang['zh'][41] = '注意: 這或許會變更你CSS原始碼的行為!'; -$lang['zh'][42] = '除去最後一個分號'; -$lang['zh'][43] = '拋棄不符合規定的屬性'; -$lang['zh'][44] = '只安全地最佳化'; -$lang['zh'][45] = '壓縮 font-weight'; -$lang['zh'][46] = '保留註解'; -$lang['zh'][47] = '什麼都不要改'; -$lang['zh'][48] = '只分開原本用逗號分隔的選擇符'; -$lang['zh'][49] = '合併有相同屬性的選擇符(快速)'; -$lang['zh'][50] = '聰明地合併選擇符(慢速)'; -$lang['zh'][51] = '保護CSS'; -$lang['zh'][52] = '保留註解與 hack 等等. 如果啟用這個選項, 大多數的最佳化程序都不會執行.'; -$lang['zh'][53] = '不改變'; -$lang['zh'][54] = '不做最佳化'; -$lang['zh'][55] = '安全地最佳化'; -$lang['zh'][56] = '全部最佳化'; -$lang['zh'][57] = '加上時間戳記'; -$lang['zh'][58] = '复制到剪贴板'; -$lang['zh'][59] = '回到页面上方'; -$lang['zh'][60] = '你的浏览器不支持复制到剪贴板。'; -$lang['zh'][61] = '如果程序有错误或你有建议,欢迎'; -$lang['zh'][62] = '和我联系'; -$lang['zh'][63] = 'Output CSS code as complete HTML document'; -$lang['zh'][64] = '代码'; -$lang['zh'][65] = 'CSS to style CSS output'; -$lang['zh'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.'; diff --git a/projects/plugins/jetpack/modules/custom-css/csstidy/wordpress-standard.tpl b/projects/plugins/jetpack/modules/custom-css/csstidy/wordpress-standard.tpl deleted file mode 100644 index 9499e8398b509..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/csstidy/wordpress-standard.tpl +++ /dev/null @@ -1,10 +0,0 @@ -| { -|| { -| | |; -|}| - -| -} - -| || -| diff --git a/projects/plugins/jetpack/modules/custom-css/custom-css.php b/projects/plugins/jetpack/modules/custom-css/custom-css.php deleted file mode 100644 index 5b6a473cfcf21..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/custom-css.php +++ /dev/null @@ -1,1366 +0,0 @@ -%1$s', - wp_strip_all_tags( $styles ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - ); - } else { - // Add a cache buster to the url. - $url = home_url( '/' ); - $url = add_query_arg( 'custom-css', substr( md5( $styles ), -10 ), $url ); - - printf( - '', // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet - esc_url( $url ) - ); - } - } - - /** - * Get the ID of a Custom CSS post tying to a given stylesheet. - * - * @param string $stylesheet Stylesheet name. - * - * @return int $post_id Post ID. - */ - public static function post_id( $stylesheet = '' ) { - $post = self::get_css_post( $stylesheet ); - if ( $post instanceof WP_Post ) { - return $post->ID; - } - return 0; - } - - /** - * Partial for use in the Customizer. - */ - public static function echo_custom_css_partial() { - echo wp_get_custom_css(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - } - - /** - * Admin page! - * - * This currently has two main uses -- firstly to display the css for an inactive - * theme if there are no revisions attached it to a legacy bug, and secondly to - * handle folks that have bookmarkes in their browser going to the old page for - * managing Custom CSS in Jetpack. - * - * If we ever add back in a non-Customizer CSS editor, this would be the place. - */ - public static function admin_page() { - $post = null; - $stylesheet = null; - if ( isset( $_GET['id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site. - $post_id = absint( $_GET['id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no changes made to the site - $post = get_post( $post_id ); - if ( $post instanceof WP_Post && 'custom_css' === $post->post_type ) { - $stylesheet = $post->post_title; - } - } - ?> -
- -

- Name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - } else { - esc_html_e( 'Custom CSS', 'jetpack' ); - } - if ( current_user_can( 'customize' ) ) { - printf( - ' %2$s', - esc_url( self::customizer_link() ), - esc_html__( 'Manage with Live Preview', 'jetpack' ) - ); - } - ?> -

-

- -
-

- - post_content_filtered ) : ?> -

- - -
- -
- - - - isset( $_SERVER['REQUEST_URI'] ) ? rawurlencode( filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) : '', - ) - ); - - return add_query_arg( - array( - array( - 'autofocus' => array( - 'section' => 'custom_css', - ), - ), - 'return' => $args['return_url'], - ), - admin_url( 'customize.php' ) - ); - } - - /** - * Handle the enqueueing and localizing for scripts to be used in the Customizer. - */ - public static function customize_controls_enqueue_scripts() { - global $wp_customize; - - wp_enqueue_style( 'jetpack-customizer-css' ); - wp_enqueue_script( 'jetpack-customizer-css' ); - - $setting = $wp_customize->get_setting( 'jetpack_custom_css[replace]' ); - $content_help = __( 'Set a different media width for full size images.', 'jetpack' ); - - if ( ! empty( $GLOBALS['content_width'] ) ) { - $content_help .= sprintf( - // translators: the theme name and then the default width. - _n( ' The default media width for the %1$s theme is %2$d pixel.', ' The default media width for the %1$s theme is %2$d pixels.', (int) $GLOBALS['content_width'], 'jetpack' ), - wp_get_theme()->Name, - (int) $GLOBALS['content_width'] - ); - } - - wp_localize_script( - 'jetpack-customizer-css', - '_jp_css_settings', - array( - /** This filter is documented in modules/custom-css/custom-css.php */ - 'useRichEditor' => ! jetpack_is_mobile() && apply_filters( 'safecss_use_ace', true ), - 'areThereCssRevisions' => self::are_there_css_revisions(), - 'startFresh' => isset( $setting ) && $setting->value(), - 'revisionsUrl' => self::get_revisions_url(), - 'cssHelpUrl' => '//en.support.wordpress.com/custom-design/editing-css/', - 'l10n' => array( - 'mode' => __( 'Start Fresh (deprecated)', 'jetpack' ), - 'mobile' => __( 'On Mobile', 'jetpack' ), - 'contentWidth' => $content_help, - 'revisions' => _x( 'See full history', 'Toolbar button to see full CSS revision history', 'jetpack' ), - 'css_help_title' => _x( 'Help', 'Toolbar button to get help with custom CSS', 'jetpack' ), - 'startFreshCustomizerWarning' => __( "The Start Fresh option in the Additional CSS panel is enabled, which means the theme's original CSS is not applied. This option will no longer be supported after August 6, 2024.", 'jetpack' ), - ), - ) - ); - } - - /** - * Check whether there are CSS Revisions for a given theme. - * - * Going forward, there should always be, but this was necessitated - * early on by https://core.trac.wordpress.org/ticket/30854 - * - * @param string $stylesheet Stylesheet name. - * - * @return bool|null|WP_Post - */ - public static function are_there_css_revisions( $stylesheet = '' ) { - $post = wp_get_custom_css_post( $stylesheet ); - if ( empty( $post ) ) { - return $post; - } - return (bool) wp_get_post_revisions( $post ); - } - - /** - * Core doesn't have a function to get the revisions url for a given post ID. - * - * @param string $stylesheet Stylesheet name. - * - * @return null|string|void - */ - public static function get_revisions_url( $stylesheet = '' ) { - $post = wp_get_custom_css_post( $stylesheet ); - - // If we have any currently saved customizations... - if ( $post instanceof WP_Post ) { - $revisions = wp_get_post_revisions( $post->ID, array( 'posts_per_page' => 1 ) ); - if ( empty( $revisions ) || is_wp_error( $revisions ) ) { - return admin_url( 'themes.php?page=editcss' ); - } - $revision = reset( $revisions ); - return get_edit_post_link( $revision->ID ); - } - - return admin_url( 'themes.php?page=editcss' ); - } - - /** - * Get a map of all theme names and theme stylesheets for mapping stuff. - * - * @return array - */ - public static function get_themes() { - $themes = wp_get_themes( array( 'errors' => null ) ); - $all = array(); - foreach ( $themes as $theme ) { - $all[ $theme->name ] = $theme->stylesheet; - } - return $all; - } - - /** - * When we need to get all themes that have Custom CSS saved. - * - * @return array - */ - public static function get_all_themes_with_custom_css() { - $themes = self::get_themes(); - $custom_css = get_posts( - array( - 'post_type' => 'custom_css', - 'post_status' => get_post_stati(), - 'number' => -1, - 'order' => 'DESC', - 'orderby' => 'modified', - ) - ); - $return = array(); - - foreach ( $custom_css as $post ) { - $stylesheet = $post->post_title; - $label = array_search( $stylesheet, $themes, true ); - - if ( ! $label ) { - continue; - } - - $return[ $stylesheet ] = array( - 'label' => $label, - 'post' => $post, - ); - } - - return $return; - } - - /** - * Handle the enqueueing of scripts for customize previews. - */ - public static function wp_enqueue_scripts() { - if ( is_customize_preview() ) { - wp_enqueue_script( 'jetpack-customizer-css-preview' ); - wp_localize_script( - 'jetpack-customizer-css-preview', - 'jpCustomizerCssPreview', - array( - /** This filter is documented in modules/custom-css/custom-css.php */ - 'preprocessors' => apply_filters( 'jetpack_custom_css_preprocessors', array() ), - ) - ); - } - } - - /** - * Sanitize the CSS for users without `unfiltered_html`. - * - * @param string $css Input CSS. - * @param array $args Array of CSS options. - * - * @return mixed|string - */ - public static function sanitize_css( $css, $args = array() ) { - $args = wp_parse_args( - $args, - array( - 'force' => false, - 'preprocessor' => null, - ) - ); - - if ( $args['force'] || ! current_user_can( 'unfiltered_html' ) ) { - - $warnings = array(); - - safecss_class(); - $csstidy = new csstidy(); - $csstidy->optimise = new safecss( $csstidy ); - - $csstidy->set_cfg( 'remove_bslash', false ); - $csstidy->set_cfg( 'compress_colors', false ); - $csstidy->set_cfg( 'compress_font-weight', false ); - $csstidy->set_cfg( 'optimise_shorthands', 0 ); - $csstidy->set_cfg( 'remove_last_;', false ); - $csstidy->set_cfg( 'case_properties', false ); - $csstidy->set_cfg( 'discard_invalid_properties', true ); - $csstidy->set_cfg( 'css_level', 'CSS3.0' ); - $csstidy->set_cfg( 'preserve_css', true ); - $csstidy->set_cfg( 'template', __DIR__ . '/csstidy/wordpress-standard.tpl' ); - - // Test for some preg_replace stuff. - $prev = $css; - $css = preg_replace( '/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $css ); - // prevent content: '\3434' from turning into '\\3434'. - $css = str_replace( array( '\'\\\\', '"\\\\' ), array( '\'\\', '"\\' ), $css ); - if ( $css !== $prev ) { - $warnings[] = 'preg_replace found stuff'; - } - - // Some people put weird stuff in their CSS, KSES tends to be greedy. - $css = str_replace( '<=', '<=', $css ); - - // Test for some kses stuff. - $prev = $css; - // Why KSES instead of strip_tags? Who knows? - $css = wp_kses_split( $css, array(), array() ); - $css = str_replace( '>', '>', $css ); // kses replaces lone '>' with > - // Why both KSES and strip_tags? Because we just added some '>'. - $css = strip_tags( $css ); // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags -- scared to update this to wp_strip_all_tags since we're building a CSS file here. - - if ( $css !== $prev ) { - $warnings[] = 'kses found stuff'; - } - - // if we're not using a preprocessor. - if ( ! $args['preprocessor'] ) { - - /** This action is documented in modules/custom-css/custom-css.php */ - do_action( 'safecss_parse_pre', $csstidy, $css, $args ); - - $csstidy->parse( $css ); - - /** This action is documented in modules/custom-css/custom-css.php */ - do_action( 'safecss_parse_post', $csstidy, $warnings, $args ); - - $css = $csstidy->print->plain(); - } - } - return $css; - } - - /** - * Override $content_width in customizer previews. - */ - public static function preview_content_width() { - global $wp_customize; - if ( ! is_customize_preview() ) { - return; - } - - $setting = $wp_customize->get_setting( 'jetpack_custom_css[content_width]' ); - if ( ! $setting ) { - return; - } - - $customized_content_width = (int) $setting->post_value(); - if ( ! empty( $customized_content_width ) ) { - $GLOBALS['content_width'] = $customized_content_width; - } - } - - /** - * Filter the current theme's stylesheet for potentially nullifying it. - * - * @param string $current Stylesheet URI for the current theme/child theme. - * - * @return mixed|void - */ - public static function style_filter( $current ) { - if ( is_admin() ) { - return $current; - } elseif ( self::is_freetrial() && ( ! self::is_preview() || ! current_user_can( 'switch_themes' ) ) ) { - return $current; - } elseif ( self::skip_stylesheet() ) { - /** This filter is documented in modules/custom-css/custom-css.php */ - return apply_filters( 'safecss_style_filter_url', plugins_url( 'custom-css/css/blank.css', __FILE__ ) ); - } - - return $current; - } - - /** - * Determine whether or not we should have the theme skip its main stylesheet. - * - * @return mixed The truthiness of this value determines whether the stylesheet should be skipped. - */ - public static function skip_stylesheet() { - /** This filter is documented in modules/custom-css/custom-css.php */ - $skip_stylesheet = apply_filters( 'safecss_skip_stylesheet', null ); - if ( $skip_stylesheet !== null ) { - return $skip_stylesheet; - } - - $jetpack_custom_css = get_theme_mod( 'jetpack_custom_css', array() ); - if ( isset( $jetpack_custom_css['replace'] ) ) { - return $jetpack_custom_css['replace']; - } - - return false; - } - - /** - * Override $content_width in customizer previews. - * - * Runs on `safecss_skip_stylesheet` filter. - * - * @param bool $skip_value Should the stylesheet be skipped. - * - * @return null|bool - */ - public static function preview_skip_stylesheet( $skip_value ) { - global $wp_customize; - if ( ! is_customize_preview() ) { - return $skip_value; - } - - $setting = $wp_customize->get_setting( 'jetpack_custom_css[replace]' ); - if ( ! $setting ) { - return $skip_value; - } - - $customized_replace = $setting->post_value(); - if ( null !== $customized_replace ) { - return $customized_replace; - } - - return $skip_value; - } - - /** - * Add Custom CSS section and controls. - * - * @param WP_Customize_Manager $wp_customize WP_Customize_Manager instance. - */ - public static function customize_register( $wp_customize ) { - - /** - * SETTINGS. - */ - - $wp_customize->add_setting( - 'jetpack_custom_css[preprocessor]', - array( - 'default' => '', - 'transport' => 'postMessage', - 'sanitize_callback' => array( __CLASS__, 'sanitize_preprocessor' ), - ) - ); - - $wp_customize->add_setting( - 'jetpack_custom_css[replace]', - array( - 'default' => false, - 'transport' => 'refresh', - ) - ); - - $wp_customize->add_setting( - 'jetpack_custom_css[content_width]', - array( - 'default' => '', - 'transport' => 'refresh', - 'sanitize_callback' => array( __CLASS__, 'intval_base10' ), - ) - ); - - // Add custom sanitization to the core css customizer setting. - foreach ( $wp_customize->settings() as $setting ) { - if ( $setting instanceof WP_Customize_Custom_CSS_Setting ) { - add_filter( "customize_sanitize_{$setting->id}", array( __CLASS__, 'sanitize_css_callback' ), 10, 2 ); - } - } - - /** - * CONTROLS. - */ - - // Overwrite or Tweak the Core Control. - $core_custom_css = $wp_customize->get_control( 'custom_css' ); - if ( $core_custom_css ) { - if ( $core_custom_css instanceof WP_Customize_Code_Editor_Control ) { - // In WP 4.9, we let the Core CodeMirror control keep running the show, but hook into it to tweak stuff. - $types = array( - 'default' => 'text/css', - 'less' => 'text/x-less', - 'sass' => 'text/x-scss', - ); - $preprocessor = $wp_customize->get_setting( 'jetpack_custom_css[preprocessor]' )->value(); - if ( isset( $types[ $preprocessor ] ) ) { - $core_custom_css->code_type = $types[ $preprocessor ]; - } - } else { - // Core < 4.9 Fallback - $core_custom_css->type = 'jetpackCss'; - } - } - - $wp_customize->selective_refresh->add_partial( - 'custom_css', - array( - 'type' => 'custom_css', - 'selector' => '#wp-custom-css', - 'container_inclusive' => false, - 'fallback_refresh' => false, - 'settings' => array( - 'custom_css[' . $wp_customize->get_stylesheet() . ']', - 'jetpack_custom_css[preprocessor]', - ), - 'render_callback' => array( __CLASS__, 'echo_custom_css_partial' ), - ) - ); - - $wp_customize->add_control( - 'wpcom_custom_css_content_width_control', - array( - 'type' => 'text', - 'label' => __( 'Media Width (deprecated)', 'jetpack' ), - 'section' => 'custom_css', - 'settings' => 'jetpack_custom_css[content_width]', - ) - ); - - $wp_customize->add_control( - 'jetpack_css_mode_control', - array( - 'type' => 'checkbox', - 'label' => __( 'Don\'t use the theme\'s original CSS.', 'jetpack' ), - 'section' => 'custom_css', - 'settings' => 'jetpack_custom_css[replace]', - ) - ); - - /** - * An action to grab on to if another Jetpack Module would like to add its own controls. - * - * @module custom-css - * - * @since 4.4.2 - * - * @param $wp_customize The WP_Customize object. - */ - do_action( 'jetpack_custom_css_customizer_controls', $wp_customize ); - - /** This filter is documented in modules/custom-css/custom-css.php */ - $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); - if ( ! empty( $preprocessors ) ) { - $preprocessor_choices = array( - '' => __( 'None', 'jetpack' ), - ); - - foreach ( $preprocessors as $preprocessor_key => $processor ) { - $preprocessor_choices[ $preprocessor_key ] = $processor['name']; - } - - $wp_customize->add_control( - 'jetpack_css_preprocessors_control', - array( - 'type' => 'select', - 'choices' => $preprocessor_choices, - 'label' => __( 'Preprocessor (deprecated)', 'jetpack' ), - 'section' => 'custom_css', - 'settings' => 'jetpack_custom_css[preprocessor]', - ) - ); - } - } - - /** - * The callback to handle sanitizing the CSS. Takes different arguments, hence the proxy function. - * - * @param mixed $css Value of the setting. - * - * @return mixed|string - */ - public static function sanitize_css_callback( $css ) { - global $wp_customize; - return self::sanitize_css( - $css, - array( - 'preprocessor' => $wp_customize->get_setting( 'jetpack_custom_css[preprocessor]' )->value(), - ) - ); - } - - /** - * Flesh out for wpcom. - * - * @todo - * - * @return bool - */ - public static function is_freetrial() { - return false; - } - - /** - * Flesh out for wpcom. - * - * @todo - * - * @return bool - */ - public static function is_preview() { - return false; - } - - /** - * Output the custom css for customize preview. - * - * @param string $css Custom CSS content. - * - * @return mixed - */ - public static function customize_preview_wp_get_custom_css( $css ) { - global $wp_customize; - - $preprocessor = $wp_customize->get_setting( 'jetpack_custom_css[preprocessor]' )->value(); - - // If it's empty, just return. - if ( empty( $preprocessor ) ) { - return $css; - } - - /** This filter is documented in modules/custom-css/custom-css.php */ - $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); - if ( isset( $preprocessors[ $preprocessor ] ) ) { - return call_user_func( $preprocessors[ $preprocessor ]['callback'], $css ); - } - - return $css; - } - - /** - * Add CSS preprocessing to our CSS if it is supported. - * - * @param mixed $css Value of the setting. - * @param WP_Customize_Setting $setting WP_Customize_Setting instance. - * - * @return string - */ - public static function customize_value_custom_css( $css, $setting ) { - // Find the current preprocessor. - $preprocessor = null; - $jetpack_custom_css = get_theme_mod( 'jetpack_custom_css', array() ); - if ( isset( $jetpack_custom_css['preprocessor'] ) ) { - $preprocessor = $jetpack_custom_css['preprocessor']; - } - - // If it's not supported, just return. - /** This filter is documented in modules/custom-css/custom-css.php */ - $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); - if ( ! isset( $preprocessors[ $preprocessor ] ) ) { - return $css; - } - - // Swap it for the `post_content_filtered` instead. - $post = wp_get_custom_css_post( $setting->stylesheet ); - if ( $post && ! empty( $post->post_content_filtered ) ) { - $css = $post->post_content_filtered; - } - - return $css; - } - - /** - * Store the original pre-processed CSS in `post_content_filtered` - * and then store processed CSS in `post_content`. - * - * @param array $args Content post args. - * @param string $css Original CSS being updated. - * - * @return mixed - */ - public static function customize_update_custom_css_post_content_args( $args, $css ) { - // Find the current preprocessor. - $jetpack_custom_css = get_theme_mod( 'jetpack_custom_css', array() ); - if ( empty( $jetpack_custom_css['preprocessor'] ) ) { - return $args; - } - - $preprocessor = $jetpack_custom_css['preprocessor']; - /** This filter is documented in modules/custom-css/custom-css.php */ - $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); - - // If it's empty, just return. - if ( empty( $preprocessor ) ) { - return $args; - } - - if ( isset( $preprocessors[ $preprocessor ] ) ) { - $args['post_content_filtered'] = $css; - $args['post_content'] = call_user_func( $preprocessors[ $preprocessor ]['callback'], $css ); - } - - return $args; - } - - /** - * Filter to handle the processing of preprocessed css on save. - * - * @param array $args Custom CSS options. - * - * @return mixed - */ - public static function update_custom_css_data( $args ) { - // Find the current preprocessor. - $jetpack_custom_css = get_theme_mod( 'jetpack_custom_css', array() ); - if ( empty( $jetpack_custom_css['preprocessor'] ) ) { - return $args; - } - - /** This filter is documented in modules/custom-css/custom-css.php */ - $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); - $preprocessor = $jetpack_custom_css['preprocessor']; - - // If we have a preprocessor specified ... - if ( isset( $preprocessors[ $preprocessor ] ) ) { - // And no other preprocessor has run ... - if ( empty( $args['preprocessed'] ) ) { - $args['preprocessed'] = $args['css']; - $args['css'] = call_user_func( $preprocessors[ $preprocessor ]['callback'], $args['css'] ); - } else { - trigger_error( 'Jetpack CSS Preprocessor specified, but something else has already modified the argument.', E_USER_WARNING ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - } - } - - return $args; - } - - /** - * When on the edit screen, make sure the custom content width - * setting is applied to the large image size. - * - * @param array $dims Array of image dimensions (width and height). - * @param string $size Size of the resulting image. - * @param null $context Context the image is being resized for. `edit` or `display`. - * - * @return array - */ - public static function editor_max_image_size( $dims, $size = 'medium', $context = null ) { - list( $width, $height ) = $dims; - - if ( 'large' === $size && 'edit' === $context ) { - $width = Jetpack::get_content_width(); - } - - return array( $width, $height ); - } - - /** - * Override the content_width with a custom value if one is set. - * - * @param int $content_width Content Width value to be updated. - * - * @return int - */ - public static function jetpack_content_width( $content_width ) { - $custom_content_width = 0; - - $jetpack_custom_css = get_theme_mod( 'jetpack_custom_css', array() ); - if ( isset( $jetpack_custom_css['content_width'] ) ) { - $custom_content_width = $jetpack_custom_css['content_width']; - } - - if ( $custom_content_width > 0 ) { - return $custom_content_width; - } - - return $content_width; - } - - /** - * Return whether the Start Fresh option of the CSS editor is enabled. - * - * @return boolean - */ - public static function is_start_fresh_option_enabled() { - if ( wp_is_block_theme() ) { - return false; - } - - $start_fresh = null; - - // $wp_customize is not available here. Let's get the value of the `replace` option from the last - // customize_changeset posts. - $posts = get_posts( - array( - 'post_type' => 'customize_changeset', - 'post_status' => 'trash', - 'order_by' => 'post_modified', - 'order' => 'DESC', - ) - ); - - // Bail as soon as we find a post that defines the `replace` option. - foreach ( $posts as $post ) { - $content = $post->post_content; - - if ( empty( $content ) ) { - continue; - } - - $parsed_content = json_decode( $content, true ); - - if ( empty( $parsed_content ) ) { - continue; - } - - foreach ( $parsed_content as $key => $data ) { - if ( str_ends_with( $key, '::jetpack_custom_css[replace]' ) ) { - $start_fresh = $data['value']; - break; - } - } - - if ( isset( $start_fresh ) ) { - break; - } - } - - return $start_fresh; - } - - /** - * Display a deprecation warning on the frontend for site admins only - */ - public static function display_frontend_warning() { - if ( ! current_user_can( 'edit_themes' ) || ! current_user_can( 'edit_theme_options' ) || ! self::is_start_fresh_option_enabled() ) { - return; - } - - $notice = ''; - $notice .= ''; - $notice .= ''; - $notice .= ''; - - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo $notice; - } - - /** - * Update the initial state to include the `replace` option (Start Fresh) in the module data. - */ - public static function update_initial_state() { - if ( 'toplevel_page_jetpack' !== get_current_screen()->base ) { - return; - } - - $val = self::is_start_fresh_option_enabled() ? 'true' : 'false'; - - wp_add_inline_script( - 'react-plugin', - " - try { - var options = window.Initial_State?.getModules?.['custom-css']?.options || {}; - options.replace = $val; - } catch (e) {} - ", - 'after' - ); - } - - /** - * Currently this filter function gets called on - * 'template_redirect' action and - * 'admin_init' action - */ - public static function set_content_width() { - // Don't apply this filter on the Edit CSS page. - if ( isset( $_GET['page'] ) && 'editcss' === $_GET['page'] && is_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- nothing is changed on the site. - return; - } - - $GLOBALS['content_width'] = Jetpack::get_content_width(); - } - - /** - * Make sure the preprocessor we're saving is one we know about. - * - * @param string $preprocessor The preprocessor to sanitize. - * - * @return null|string - */ - public static function sanitize_preprocessor( $preprocessor ) { - /** This filter is documented in modules/custom-css/custom-css.php */ - $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); - if ( empty( $preprocessor ) || array_key_exists( $preprocessor, $preprocessors ) ) { - return $preprocessor; - } - return null; - } - - /** - * Get the base10 intval. - * - * This is used as a setting's sanitize_callback; we can't use just plain - * intval because the second argument is not what intval() expects. - * - * @access public - * - * @param mixed $value Number to convert. - * @return int Integer. - */ - public static function intval_base10( $value ) { - return (int) $value; - } - - /** - * Add a footer action on revision.php to print some customizations for the theme switcher. - */ - public static function load_revision_php() { - add_action( 'admin_footer', array( __CLASS__, 'revision_admin_footer' ) ); - } - - /** - * Print the theme switcher on revision.php and move it into place. - */ - public static function revision_admin_footer() { - $post = get_post(); - if ( 'custom_css' !== $post->post_type ) { - return; - } - $stylesheet = $post->post_title; - ?> - - - - -
- - - -
- label { - position: relative; - width: 100px; -} -#customize-control-wpcom_custom_css_content_width_control .customize-control-title { - padding-bottom: 6px; -} -#customize-controls #customize-control-wpcom_custom_css_content_width_control input[type="text"], /* stronger selector to override new-customizer.css */ -#customize-control-wpcom_custom_css_content_width_control input[type="text"] { - width: 64px; - padding-right: 22px; - text-align: right; -} -#customize-control-wpcom_custom_css_content_width_control input[type="text"] + span { - position: absolute; - left: 43px; - padding-top: 3px; - opacity: .8; -} - -#customize-control-wpcom_custom_css_content_width_control input[type="text"]:focus + span { - opacity: 1; -} - -#customize-control-wpcom_custom_css_content_width_control .description { - display: block; - margin: 28px 0 0 0; - color: #a7aaad; -} - -#customize-control-wpcom_custom_css_content_width_control .description strong { - font-style: normal; -} - -#customize-control-jetpack_custom_css_control { - position: relative; -} - -.css-help { - border-bottom: 1px solid #dcdcde; - background: #ffffff; - position: relative; - right: 0; - left: 0; - width: 100%; - padding: 0; - overflow: hidden; -} - -.css-help a { - float: none; - display: inline-block; - text-decoration: none; - border-bottom: 4px solid transparent; - color: #50575e; - padding: 7px 10px 5px; - transition: .15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out; -} - -.css-help a:hover { - color: #2271b1; - background-color: #f3f3f5; -} - -.css-help a:before { - display: inline-block; - position: relative; - font-family: dashicons; - font-size: 20px; - padding-right: 3px; - top: 5px; - line-height: 1px; -} - -.css-help a:focus { - color: #2271b1; - background-color: #f3f3f5; - border-bottom-color: #2271b1; - box-shadow: none; -} - -.css-help a#revisions-link:before { - content: "\f321"; -} - -.css-help a#help-link:before { - content: "\f223"; -} - -#sub-accordion-section-custom_css .customize-control { - margin: 12px 0; -} - -#sub-accordion-section-custom_css .customize-control-jetpackCss { - margin: 0 -12px; - width: calc( 100% + 24px ); -} - -#customize-theme-controls #sub-accordion-section-custom_css .customize-control-title { - margin-left: 0; - margin-right: 0; -} - -#sub-accordion-section-custom_css #customize-control-jetpack_css_preprocessors_control select { - max-width: 75%; -} - -body.editing-css .wp-full-overlay-sidebar { - width: 500px; -} - -body.editing-css .wp-full-overlay.expanded { - margin-left: 500px; -} - -input[type=jetpackCss] { - display: none; -} diff --git a/projects/plugins/jetpack/modules/custom-css/custom-css/js/codemirror.min.js b/projects/plugins/jetpack/modules/custom-css/custom-css/js/codemirror.min.js deleted file mode 100644 index efc8a0fb7a740..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/custom-css/js/codemirror.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * http://codemirror.net/ - * MIT License - * Includes CSS & LESS modes. - * v3.19.1 - */ -window.CodeMirror=function(){"use strict";function x(a,c){if(!(this instanceof x))return new x(a,c);this.options=c=c||{};for(var d in _c)!c.hasOwnProperty(d)&&_c.hasOwnProperty(d)&&(c[d]=_c[d]);J(c);var e="string"==typeof c.value?0:c.value.first,f=this.display=y(a,e);f.wrapper.CodeMirror=this,G(this),c.autofocus&&!p&&Nb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Xe},E(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var g=c.value;"string"==typeof g&&(g=new ge(c.value,c.mode)),Fb(this,ke)(this,g),b&&setTimeout(ff(Mb,this,!0),20),Pb(this);var h;try{h=document.activeElement==f.input}catch(i){}h||c.autofocus&&!p?setTimeout(ff(mc,this),20):nc(this),Fb(this,function(){for(var a in $c)$c.propertyIsEnumerable(a)&&$c[a](this,c[a],bd);for(var b=0;bb.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function J(a){var b=bf(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function K(a){var b=a.display,c=a.doc.height,d=c+gb(b);b.sizer.style.minHeight=b.heightForcer.style.top=d+"px",b.gutters.style.height=Math.max(d,b.scroller.clientHeight-Ve)+"px";var e=Math.max(d,b.scroller.scrollHeight),f=b.scroller.scrollWidth>b.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?tf(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):(b.scrollbarV.style.display="",b.scrollbarV.firstChild.style.height="0"),f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?tf(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):(b.scrollbarH.style.display="",b.scrollbarH.firstChild.style.width="0"),f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=tf(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=tf(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",l&&0===tf(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=m?"18px":"12px",b.scrollbarV.style.pointerEvents=b.scrollbarH.style.pointerEvents="none")}function L(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-fb(a));var f=Math.ceil(d+e);return{from:qe(b,d),to:qe(b,f)}}function M(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=P(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g=a.display.showingFrom&&h.to<=a.display.showingTo)break}return g&&(Qe(a,"update",a),(a.display.showingFrom!=e||a.display.showingTo!=f)&&Qe(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),g}function R(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.tol&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),w)for(k=pe(Fd(f,le(f,k)));j>l&&Gd(f,le(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:U(m,b),w)for(var i=0;in.from)){m.splice(i--,1);break}n.to=p}for(var q=0,i=0;il&&(n.to=l),n.from>=n.to?m.splice(i--,1):q+=n.to-n.from}if(!d&&q==l-k&&k==e.showingFrom&&l==e.showingTo)return T(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var r=document.activeElement}catch(s){}.7*(l-k)>q&&(e.lineDiv.style.display="none"),W(a,k,l,m,h),e.lineDiv.style.display="",r&&document.activeElement!=r&&r.offsetHeight&&r.focus();var t=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return t&&(e.lastSizeC=e.wrapper.clientHeight,bb(a,400)),e.showingFrom=k,e.showingTo=l,S(a),T(a),!0}}function S(a){for(var f,b=a.display,d=b.lineDiv.offsetTop,e=b.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(c){var g=e.offsetTop+e.offsetHeight;f=g-d,d=g}else{var h=pf(e);f=h.bottom-h.top}var i=e.lineObj.height-f;if(2>f&&(f=Ab(b)),i>.001||-.001>i){oe(e.lineObj,f);var j=e.lineObj.widgets;if(j)for(var k=0;kc;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.ton){for(;k.lineObj!=b;)k=l(k);i&&n>=e&&k.lineNumber&&of(k.lineNumber,O(a.options,n)),k=k.nextSibling}else{if(b.widgets)for(var s,q=0,r=k;r&&20>q;++q,r=r.nextSibling)if(r.lineObj==b&&/div/i.test(r.nodeName)){s=r;break}var t=X(a,b,n,g,s);if(t!=s)j.insertBefore(t,k);else{for(;k!=s;)k=l(k);k=k.nextSibling}t.lineObj=b}++n});k;)k=l(k)}function X(a,b,d,e,f){var k,g=Xd(a,b),h=g.pre,i=b.gutterMarkers,j=a.display,l=g.bgClass?g.bgClass+" "+(b.bgClass||""):b.bgClass;if(!(a.options.lineNumbers||i||l||b.wrapClass||b.widgets))return h;if(f){f.alignable=null;for(var q,m=!0,n=0,o=null,p=f.firstChild;p;p=q)if(q=p.nextSibling,/\bCodeMirror-linewidget\b/.test(p.className)){for(var r=0;rb&&(b=0),e.appendChild(lf("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?f-a:c)+"px; height: "+(d-b)+"px"))}function i(b,d,e){function m(c,d){return ub(a,Bc(b,c),"div",i,d)}var k,l,i=le(c,b),j=i.text.length;return Af(se(i),d||0,null==e?j:e,function(a,b,c){var n,o,p,i=m(a,"left");if(a==b)n=i,o=p=i.left;else{if(n=m(b-1,"right"),"rtl"==c){var q=i;i=n,n=q}o=i.left,p=n.right}null==d&&0==a&&(o=g),n.top-i.top>3&&(h(o,i.top,null,i.bottom),o=g,i.bottoml.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),g+1>o&&(o=g),h(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var b=a.display,c=a.doc,d=a.doc.sel,e=document.createDocumentFragment(),f=b.lineSpace.offsetWidth,g=hb(a.display);if(d.from.line==d.to.line)i(d.from.line,d.from.ch,d.to.ch);else{var j=le(c,d.from.line),k=le(c,d.to.line),l=Fd(c,j)==Fd(c,k),m=i(d.from.line,d.from.ch,l?j.text.length:null).end,n=i(d.to.line,l?0:null,d.to.ch).start;l&&(m.top0&&(b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function bb(a,b){a.doc.mode.startState&&a.doc.frontier=a.display.showingTo)){var f,c=+new Date+a.options.workTime,d=hd(b.mode,eb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Sd(a,g,d);for(var i=!h||h.length!=g.styles.length,j=0;!i&&jc?(bb(a,a.options.workDelay),!0):void 0}),e.length&&Fb(a,function(){for(var a=0;ag;--h){if(h<=f.first)return f.first;var i=le(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Ye(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function eb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=db(a,b,c),g=f>d.first&&le(d,f-1).stateAfter;return g=g?hd(d.mode,g):id(d.mode),d.iter(f,b,function(c){Ud(a,c,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&ff&&0==h&&(f=1)}return e=h>c?"left":c>h?"right":e,"left"==e&&i.leftSide?i=i.leftSide:"right"==e&&i.rightSide&&(i=i.rightSide),{left:c>h?i.right:i.left,right:h>c?i.left:i.right,top:i.top,bottom:i.bottom}}function jb(a,b){for(var c=a.display.measureLineCache,d=0;ds&&(c=s),0>b&&(b=0);for(var d=q.length-2;d>=0;d-=2){var e=q[d],f=q[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){q[d]=Math.min(b,e),q[d+1]=Math.max(c,f);break}}return 0>d&&(d=q.length,q.push(b,c)),{left:a.left-p.left,right:a.right-p.left,top:d,bottom:null}}function u(a){a.bottom=q[a.top+1],a.top=q[a.top]}if(!a.options.lineWrapping&&e.text.length>=a.options.crudeMeasuringFrom)return nb(a,e);var f=a.display,g=ef(e.text.length),h=Xd(a,e,g,!0).pre;if(b&&!c&&!a.options.lineWrapping&&h.childNodes.length>100){for(var i=document.createDocumentFragment(),j=10,k=h.childNodes.length,l=0,m=Math.ceil(k/j);m>l;++l){for(var n=lf("div",null,null,"display: inline-block"),o=0;j>o&&k;++o)n.appendChild(h.firstChild),--k;i.appendChild(n)}h.appendChild(i)}nf(f.measure,h);var p=pf(f.lineDiv),q=[],r=ef(e.text.length),s=h.offsetHeight;d&&f.measure.first!=h&&nf(f.measure,h);for(var v,l=0;l1&&(x=r[l]=t(y[0]),x.rightSide=t(y[y.length-1]))}x||(x=r[l]=t(pf(w))),v.measureRight&&(x.right=pf(v.measureRight).left),v.leftSide&&(x.leftSide=t(pf(v.leftSide)))}mf(a.display.measure);for(var v,l=0;l=a.options.crudeMeasuringFrom)return ib(a,b,b.text.length,f&&f.measure,"right").right;var g=Xd(a,b,null,!0).pre,h=g.appendChild(vf(a.display.measure));return nf(a.display.measure,g),pf(h).right-pf(a.display.lineDiv).left}function pb(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function qb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function rb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function sb(a,b,c,d){if(b.widgets)for(var e=0;ec.from?f(a-1):f(a,d)}d=d||le(a.doc,b.line),e||(e=lb(a,d));var h=se(d),i=b.ch;if(!h)return f(i);var j=Jf(h,i),k=g(i,j);return null!=If&&(k.other=g(i,If)),k}function wb(a,b,c,d){var e=new Bc(a,b);return e.xRel=d,c&&(e.outside=!0),e}function xb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return wb(d.first,0,!0,-1);var e=qe(d,c),f=d.first+d.size-1;if(e>f)return wb(d.first+d.size-1,le(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=le(d,e),h=yb(a,g,e,b,c),i=Ed(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function yb(a,b,c,d,e){function j(d){var e=vb(a,Bc(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:fq)return wb(c,n,r,1);for(;;){if(k?n==m||n==Lf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);kf.test(b.text.charAt(s));)++s;var u=wb(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Lf(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function Ab(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==zb){zb=lf("pre");for(var b=0;49>b;++b)zb.appendChild(document.createTextNode("x")),zb.appendChild(lf("br"));zb.appendChild(document.createTextNode("x"))}nf(a.measure,zb);var c=zb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),mf(a.measure),c||1}function Bb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=lf("span","x"),c=lf("pre",[b]);nf(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function Db(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Cb},Pe++||(Oe=[])}function Eb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&I(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=ob(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+Ve)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);fj&&e.charCodeAt(j)==h.charCodeAt(j);)++j;var l=g.from,m=g.to;j1e3||h.indexOf("\n")>-1?c.value=a.display.prevInput="":a.display.prevInput=h,i&&Eb(a),a.state.pasteIncoming=!1,!0}function Mb(a,c){var e,f,g=a.doc;if(Cc(g.sel.from,g.sel.to))c&&(a.display.prevInput=a.display.input.value="",b&&!d&&(a.display.inputHasSelection=null));else{a.display.prevInput="",e=yf&&(g.sel.to.line-g.sel.from.line>100||(f=a.getSelection()).length>1e3);var h=e?"-":f||a.getSelection();a.display.input.value=h,a.state.focused&&af(a.display.input),b&&!d&&(a.display.inputHasSelection=h)}a.display.inaccurateSelection=e}function Nb(a){"nocursor"==a.options.readOnly||p&&document.activeElement==a.display.input||a.display.input.focus()}function Ob(a){return a.options.readOnly||a.doc.cantEdit}function Pb(a){function e(){a.state.focused&&setTimeout(ff(Nb,a),0)}function h(){null==g&&(g=setTimeout(function(){g=null,c.cachedCharWidth=c.cachedTextHeight=sf=null,pb(a),Hb(a,ff(Ib,a))},100))}function i(){for(var a=c.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(i,5e3):Me(window,"resize",h)}function j(b){Re(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Ee(b))||Ie(b)}function l(){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),af(c.input))}var c=a.display;Le(c.scroller,"mousedown",Fb(a,Ub)),b?Le(c.scroller,"dblclick",Fb(a,function(b){if(!Re(a,b)){var c=Rb(a,b);if(c&&!Xb(a,b)&&!Qb(a.display,b)){Fe(b);var d=Yc(le(a.doc,c.line).text,c);Jc(a.doc,d.from,d.to)}}})):Le(c.scroller,"dblclick",function(b){Re(a,b)||Fe(b)}),Le(c.lineSpace,"selectstart",function(a){Qb(c,a)||Fe(a)}),u||Le(c.scroller,"contextmenu",function(b){pc(a,b)}),Le(c.scroller,"scroll",function(){c.scroller.clientHeight&&(_b(a,c.scroller.scrollTop),ac(a,c.scroller.scrollLeft,!0),Ne(a,"scroll",a))}),Le(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&_b(a,c.scrollbarV.scrollTop)}),Le(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&ac(a,c.scrollbarH.scrollLeft)}),Le(c.scroller,"mousewheel",function(b){dc(a,b)}),Le(c.scroller,"DOMMouseScroll",function(b){dc(a,b)}),Le(c.scrollbarH,"mousedown",e),Le(c.scrollbarV,"mousedown",e),Le(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var g;Le(window,"resize",h),setTimeout(i,5e3),Le(c.input,"keyup",Fb(a,function(b){Re(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Ee(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Le(c.input,"input",function(){b&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Kb(a)}),Le(c.input,"keydown",Fb(a,kc)),Le(c.input,"keypress",Fb(a,lc)),Le(c.input,"focus",ff(mc,a)),Le(c.input,"blur",ff(nc,a)),a.options.dragDrop&&(Le(c.scroller,"dragstart",function(b){$b(a,b)}),Le(c.scroller,"dragenter",j),Le(c.scroller,"dragover",j),Le(c.scroller,"drop",Fb(a,Zb))),Le(c.scroller,"paste",function(b){Qb(c,b)||(Nb(a),Kb(a))}),Le(c.input,"paste",function(){if(f&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Kb(a)}),Le(c.input,"cut",l),Le(c.input,"copy",l),k&&Le(c.sizer,"mouseup",function(){document.activeElement==c.input&&c.input.blur(),Nb(a)})}function Qb(a,b){for(var c=Je(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Rb(a,b,c){var d=a.display;if(!c){var e=Je(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=pf(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return xb(a,f-h.left,g-h.top)}function Ub(a){function q(a){if(!Cc(p,a)){if(p=a,"single"==j)return Jc(c.doc,Gc(e,h),a),void 0;if(n=Gc(e,n),o=Gc(e,o),"double"==j){var b=Yc(le(e,a.line).text,a);Dc(a,n)?Jc(c.doc,b.from,o):Jc(c.doc,n,b.to) -}else"triple"==j&&(Dc(a,n)?Jc(c.doc,o,Gc(e,Bc(a.line,0))):Jc(c.doc,n,Gc(e,Bc(a.line+1,0))))}}function t(a){var b=++s,f=Rb(c,a,!0);if(f)if(Cc(f,l)){var h=a.clientYr.bottom?20:0;h&&setTimeout(Fb(c,function(){s==b&&(d.scroller.scrollTop+=h,t(a))}),50)}else{c.state.focused||mc(c),l=f,q(f);var g=L(d,e);(f.line>=g.to||f.linei-400&&Cc(Tb.pos,h))j="triple",Fe(a),setTimeout(ff(Nb,c),20),Zc(c,h.line);else if(Sb&&Sb.time>i-400&&Cc(Sb.pos,h)){j="double",Tb={time:i,pos:h},Fe(a);var k=Yc(le(e,h.line).text,h);Jc(c.doc,k.from,k.to)}else Sb={time:i,pos:h};var l=h;if(c.options.dragDrop&&qf&&!Ob(c)&&!Cc(g.from,g.to)&&!Dc(h,g.from)&&!Dc(g.to,h)&&"single"==j){var m=Fb(c,function(b){f&&(d.scroller.draggable=!1),c.state.draggingText=!1,Me(document,"mouseup",m),Me(d.scroller,"drop",m),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Fe(b),Jc(c.doc,h),Nb(c))});return f&&(d.scroller.draggable=!0),c.state.draggingText=m,d.scroller.dragDrop&&d.scroller.dragDrop(),Le(document,"mouseup",m),Le(d.scroller,"drop",m),void 0}Fe(a),"single"==j&&Jc(c.doc,Gc(e,h));var n=g.from,o=g.to,p=h,r=pf(d.wrapper),s=0,w=Fb(c,function(a){b||Ke(a)?t(a):v(a)}),x=Fb(c,v);Le(document,"mousemove",w),Le(document,"mouseup",x)}}}function Vb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(pf(a.display.gutters).right))return!1;d&&Fe(b);var h=a.display,i=pf(h.lineDiv);if(g>i.bottom||!Te(a,c))return He(b);g-=i.top-h.viewOffset;for(var j=0;j=f){var l=qe(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),He(b)}}}function Wb(a,b){return Te(a,"gutterContextMenu")?Vb(a,b,"gutterContextMenu",!1,Ne):!1}function Xb(a,b){return Vb(a,b,"gutterClick",!0,Qe)}function Zb(a){var c=this;if(!(Re(c,a)||Qb(c.display,a)||c.options.onDragEvent&&c.options.onDragEvent(c,Ee(a)))){Fe(a),b&&(Yb=+new Date);var d=Rb(c,a,!0),e=a.dataTransfer.files;if(d&&!Ob(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=function(){g[b]=e.result,++h==f&&(d=Gc(c.doc,d),uc(c.doc,{from:d,to:d,text:wf(g.join("\n")),origin:"paste"},"around"))},e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.state.draggingText&&!Dc(d,c.doc.sel.from)&&!Dc(c.doc.sel.to,d))return c.state.draggingText(a),setTimeout(ff(Nb,c),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.doc.sel.from,l=c.doc.sel.to;Lc(c.doc,d,d),c.state.draggingText&&Ac(c.doc,"",k,l,"paste"),c.replaceSelection(g,null,"paste"),Nb(c),mc(c)}}catch(a){}}}}function $b(a,c){if(b&&(!a.state.draggingText||+new Date-Yb<100))return Ie(c),void 0;if(!Re(a,c)&&!Qb(a.display,c)){var d=a.getSelection();if(c.dataTransfer.setData("Text",d),c.dataTransfer.setDragImage&&!j){var e=lf("img",null,null,"position: fixed; left: 0; top: 0;");e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",i&&(e.width=e.height=1,a.display.wrapper.appendChild(e),e._top=e.offsetTop),c.dataTransfer.setDragImage(e,0,0),i&&e.parentNode.removeChild(e)}}}function _b(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||Q(b,[],c),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&Q(b,[]),bb(b,100))}function ac(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,M(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function dc(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var g=b.display,h=g.scroller;if(d&&h.scrollWidth>h.clientWidth||e&&h.scrollHeight>h.clientHeight){if(e&&q&&f)for(var j=c.target;j!=h;j=j.parentNode)if(j.lineObj){b.display.currentWheelTarget=j;break}if(d&&!a&&!i&&null!=cc)return e&&_b(b,Math.max(0,Math.min(h.scrollTop+e*cc,h.scrollHeight-h.clientHeight))),ac(b,Math.max(0,Math.min(h.scrollLeft+d*cc,h.scrollWidth-h.clientWidth))),Fe(c),g.wheelStartX=null,void 0;if(e&&null!=cc){var k=e*cc,l=b.doc.scrollTop,m=l+g.wrapper.clientHeight;0>k?l=Math.max(0,l+k-50):m=Math.min(b.doc.height,m+k+50),Q(b,[],{top:l,bottom:m})}20>bc&&(null==g.wheelStartX?(g.wheelStartX=h.scrollLeft,g.wheelStartY=h.scrollTop,g.wheelDX=d,g.wheelDY=e,setTimeout(function(){if(null!=g.wheelStartX){var a=h.scrollLeft-g.wheelStartX,b=h.scrollTop-g.wheelStartY,c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null,c&&(cc=(cc*bc+c)/(bc+1),++bc)}},200)):(g.wheelDX+=d,g.wheelDY+=e))}}function ec(a,b,c){if("string"==typeof b&&(b=jd[b],!b))return!1;a.display.pollingFast&&Lb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{Ob(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=We}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function fc(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function hc(a,b){var c=ld(a.options.keyMap),e=c.auto;clearTimeout(gc),e&&!nd(b)&&(gc=setTimeout(function(){ld(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e,D(a))},50));var f=od(b,!0),g=!1;if(!f)return!1;var h=fc(a);return g=b.shiftKey?md("Shift-"+f,h,function(b){return ec(a,b,!0)})||md(f,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?ec(a,b):void 0}):md(f,h,function(b){return ec(a,b)}),g&&(Fe(b),ab(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Qe(a,"keyHandled",a,f,b)),g}function ic(a,b,c){var d=md("'"+c+"'",fc(a),function(b){return ec(a,b,!0)});return d&&(Fe(b),ab(a),Qe(a,"keyHandled",a,"'"+c+"'",b)),d}function kc(a){var c=this;if(c.state.focused||mc(c),!(Re(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ee(a)))){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.doc.sel.shift=16==d||a.shiftKey;var e=hc(c,a);i&&(jc=e?d:null,!e&&88==d&&!yf&&(q?a.metaKey:a.ctrlKey)&&c.replaceSelection(""))}}function lc(a){var c=this;if(!(Re(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ee(a)))){var e=a.keyCode,f=a.charCode;if(i&&e==jc)return jc=null,Fe(a),void 0;if(!(i&&(!a.which||a.which<10)||k)||!hc(c,a)){var g=String.fromCharCode(null==f?e:f);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Ob(this)&&this.doc.mode.electricChars.indexOf(g)>-1&&setTimeout(Fb(c,function(){Uc(c,c.doc.sel.to.line,"smart")}),75),ic(c,a,g)||(b&&!d&&(c.display.inputHasSelection=null),Kb(c))}}}function mc(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Ne(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(Mb(a,!0),f&&setTimeout(ff(Mb,a,!0),0))),Jb(a),ab(a))}function nc(a){a.state.focused&&(Ne(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function pc(a,c){function l(){if(null!=e.input.selectionStart){var a=e.input.value="\u200b"+(Cc(f.from,f.to)?"":e.input.value);e.prevInput="\u200b",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function m(){if(e.inputDiv.style.position="relative",e.input.style.cssText=k,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h),Jb(a),null!=e.input.selectionStart){(!b||d)&&l(),clearTimeout(oc);var c=0,f=function(){" "==e.prevInput&&0==e.input.selectionStart?Fb(a,jd.selectAll)(a):c++<10?oc=setTimeout(f,500):Mb(a)};oc=setTimeout(f,200)}}if(!Re(a,c,"contextmenu")){var e=a.display,f=a.doc.sel;if(!Qb(e,c)&&!Wb(a,c)){var g=Rb(a,c),h=e.scroller.scrollTop;if(g&&!i){var j=a.options.resetSelectionOnContextMenu;j&&(Cc(f.from,f.to)||Dc(g,f.from)||!Dc(g,f.to))&&Fb(a,Lc)(a.doc,g,g);var k=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(c.clientY-5)+"px; left: "+(c.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",Nb(a),Mb(a,!0),Cc(f.from,f.to)&&(e.input.value=e.prevInput=" "),b&&!d&&l(),u){Ie(c);var n=function(){Me(window,"mouseup",n),setTimeout(m,20)};Le(window,"mouseup",n)}else setTimeout(m,50)}}}}function rc(a,b,c){if(!Dc(b.from,c))return Gc(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Bc(f,le(a,f).text.length):Hc(c,le(a,e).text.length)}if(c.line==b.to.line+d)return Hc(c,_e(b.text).length+(1==b.text.length?b.from.ch:0)+le(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Hc(c,b.text[g].length+(g?0:b.from.ch))}function sc(a,b,c){if(c&&"object"==typeof c)return{anchor:rc(a,b,c.anchor),head:rc(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=qc(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Dc(a,b.from))return a;if(!Dc(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Bc(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function tc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Gc(a,b)),c&&(this.to=Gc(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Ne(a,"beforeChange",a,d),a.cm&&Ne(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function uc(a,b,c,d){if(a.cm){if(!a.cm.curOp)return Fb(a.cm,uc)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(Te(a,"beforeChange")||a.cm&&Te(a.cm,"beforeChange"))||(b=tc(a,b,!0))){var e=v&&!d&&Bd(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)vc(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&vc(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else vc(a,b,c)}}function vc(a,b,c){if(1!=b.text.length||""!=b.text[0]||!Cc(b.from,b.to)){var d=sc(a,b,c);we(a,b,d,a.cm?a.cm.curOp.id:0/0),yc(a,b,d,zd(a,b));var e=[];je(a,function(a,c){c||-1!=bf(e,a.history)||(Ce(a.history,b),e.push(a.history)),yc(a,b,null,zd(a,b))})}}function wc(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=Te(a,"beforeChange")||a.cm&&Te(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!tc(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(ve(a,h));var i=g?sc(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};yc(a,h,i,Ad(a,h));var j=[];je(a,function(a,b){b||-1!=bf(j,a.history)||(Ce(a.history,h),j.push(a.history)),yc(a,h,null,Ad(a,h))})}}}}function xc(a,b){function c(a){return Bc(a.line+b,a.ch)}a.first+=b,a.cm&&Ib(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function yc(a,b,c,d){if(a.cm&&!a.cm.curOp)return Fb(a.cm,yc)(a,b,c,d);if(b.to.linea.lastLine())){if(b.from.linef&&(b={from:b.from,to:Bc(f,le(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=me(a,b.from,b.to),c||(c=sc(a,b,null)),a.cm?zc(a.cm,b,d,c):ce(a,b,d,c)}}function zc(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=pe(Fd(e,le(e,g.line))),e.iter(j,h.line+1,function(a){return a==f.maxLine?(i=!0,!0):void 0})),Dc(e.sel.head,b.from)||Dc(b.to,e.sel.head)||(a.curOp.cursorActivity=!0),ce(e,b,c,d,B(a)),a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=H(e,a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),e.frontier=Math.min(e.frontier,g.line),bb(a,400);var k=b.text.length-(h.line-g.line)-1;if(Ib(a,g.line,h.line+1,k),Te(a,"change")){var l={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var m=a.curOp.textChanged;m.next;m=m.next);m.next=l}else a.curOp.textChanged=l}}function Ac(a,b,c,d,e){if(d||(d=c),Dc(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=wf(b)),uc(a,{from:c,to:d,text:b,origin:e},null)}function Bc(a,b){return this instanceof Bc?(this.line=a,this.ch=b,void 0):new Bc(a,b)}function Cc(a,b){return a.line==b.line&&a.ch==b.ch}function Dc(a,b){return a.linec?Bc(c,le(a,c).text.length):Hc(b,le(a,b.line).text.length)}function Hc(a,b){var c=a.ch;return null==c||c>b?Bc(a.line,b):0>c?Bc(a.line,0):a}function Ic(a,b){return b>=a.first&&b=f.ch:j.to>f.ch))){if(d&&(Ne(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find()[0>g?"from":"to"];if(Cc(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Gc(a,Bc(l.line-1)):null:l.ch>h.text.length&&(l=l.line(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!n){var f="none"==c.cursor.style.display;f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}}function Pc(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=vb(a,b),g=c&&c!=b?vb(a,c):f,h=Rc(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(_b(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(ac(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Qc(a,b,c,d,e){var f=Rc(a,b,c,d,e);null!=f.scrollTop&&_b(a,f.scrollTop),null!=f.scrollLeft&&ac(a,f.scrollLeft)}function Rc(a,b,c,d,e){var f=a.display,g=Ab(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-Ve,i=f.scroller.scrollTop,j={},k=a.doc.height+gb(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-Ve,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function Sc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function Tc(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function Uc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=eb(a,b);else c="prev";var k,g=a.options.tabSize,h=le(e,b),i=Ye(h.text,null,g),j=h.text.match(/^\s*/)[0];if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==We)){if(!d)return;c="prev"}"prev"==c?k=b>e.first?Ye(le(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";k>m&&(l+=$e(k-m)),l!=j?Ac(a.doc,l,Bc(b,0),Bc(b,j.length),"+input"):e.sel.head.line==b&&e.sel.head.ch=a.first+a.size?j=!1:(f=b,i=le(a,b))}function l(a){var b=(e?Lf:Mf)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?Ef:Df)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=le(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=hf(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Nc(a,Bc(f,g),h,!0);return j||(r.hitSide=!0),r}function Xc(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*Ab(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=xb(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Yc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=hf(e)?hf:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!hf(a)};c>0&&f(a.charAt(c-1));)--c;for(;dg;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e=b:f.to>b);(e||(e=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return e}function yd(a,b,c){if(a)for(var e,d=0;d=b:f.to>b);if(h||"bookmark"==g.type&&f.from==b&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var l=0;ll;++l)o.push(q);o.push(i)}return o}function Ad(a,b){var c=ye(a,b),d=zd(a,b);if(!c)return d;if(!d)return c;for(var e=0;eb)&&(!d||d.widtha.options.maxHighlightLength?(f=!1,i.pos=b.length,j=null):j=c.token(i,d),f&&h==j||(gh;){var e=d[g];e>a&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(b)if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;g>c;c+=2){var i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function Td(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Sd(a,b,b.stateAfter=eb(a,pe(b)))),b.styles}function Ud(a,b,c){var d=a.doc.mode,e=new pd(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos}function Wd(a,b){if(!a)return null;for(;;){var c=a.match(/(?:^|\s)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return Vd[a]||(Vd[a]="cm-"+a.replace(/ +/g," cm-"))}function Xd(a,c,d,g){for(var h,i=c,j=!0;h=Dd(i);)i=le(a.doc,h.find().from.line);var k={pre:lf("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:g};do{i.text&&(j=!1),k.measure=i==c&&d,k.pos=0,k.addToken=k.measure?$d:Zd,(b||f)&&a.getOption("lineWrapping")&&(k.addToken=_d(k.addToken));var l=be(i,k,Td(a,i));d&&i==c&&!k.measuredSomething&&(d[0]=k.pre.appendChild(vf(a.display.measure)),k.measuredSomething=!0),l&&(i=le(a.doc,l.to.line))}while(l);!d||k.measuredSomething||d[0]||(d[0]=k.pre.appendChild(j?lf("span","\xa0"):vf(a.display.measure))),k.pre.firstChild||Gd(a.doc,c)||k.pre.appendChild(document.createTextNode("\xa0"));var m;if(d&&(b||e)&&(m=se(i))){var n=m.length-1;m[n].from==m[n].to&&--n;var o=m[n],p=m[n-1];if(o.from+1==o.to&&p&&o.level="\ud800"&&"\udbff">i&&hi)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||q.marker.sizei&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.replacedWith&&r.push(u)}if(q&&(q.from||0)==i&&(ae(b,(null==q.to?h:q.to)-i,q.marker,null==q.from),null==q.to))return q.marker.find();if(!q&&r.length)for(var s=0;s=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=Wd(c[g++],b)}}else for(var g=1;gp;++p)r.push(new Od(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}else if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new Od(j[p],f(p),e));r.push(new Od(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new Od(j[p],f(p),e));o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Qe(a,"change",a,b),Lc(a,d.anchor,d.head,null,!0)}function de(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function ee(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function je(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;gb){a=d;break}b-=e}return a.lines[b]}function me(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function ne(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function oe(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function pe(a){if(null==a.parent)return null;for(var b=a.parent,c=bf(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function qe(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function re(a,b){b=Fd(a.doc,b);for(var c=0,d=b.parent,e=0;ef-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=_e(g.changes);Cc(b.from,b.to)&&Cc(b.from,h.to)?h.to=qc(b):g.changes.push(ve(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[ve(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;e.done.length>e.undoDepth;)e.done.shift();e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function xe(a){if(!a)return null;for(var c,b=0;b-1&&(_e(g)[k]=i[k],delete i[k])}}return d}function Ae(a,b,c,d){c0}function Ue(a){a.prototype.on=function(a,b){Le(this,a,b)},a.prototype.off=function(a,b){Me(this,a,b)}}function Xe(){this.id=null}function Ye(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)" "==a.charAt(f)?g+=c-g%c:++g;return g}function $e(a){for(;Ze.length<=a;)Ze.push(_e(Ze)+" ");return Ze[a]}function _e(a){return a[a.length-1]}function af(a){if(o)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select()}catch(b){}}function bf(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function cf(a,b){function c(){}c.prototype=a;var d=new c;return b&&df(b,d),d}function df(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function ef(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function ff(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function hf(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||gf.test(a))}function jf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function lf(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)of(e,b);else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild);return a}function nf(a,b){return mf(a).appendChild(b)}function of(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function pf(a){return a.getBoundingClientRect()}function rf(){return!1}function tf(a){if(null!=sf)return sf;var b=lf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return nf(a,b),b.offsetWidth&&(sf=b.offsetHeight-b.clientHeight),sf||0}function vf(a){if(null==uf){var b=lf("span","\u200b");nf(a,lf("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(uf=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return uf?lf("span","\u200b"):lf("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function Af(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function Bf(a){return a.level%2?a.to:a.from}function Cf(a){return a.level%2?a.from:a.to}function Df(a){var b=se(a);return b?Bf(b[0]):0}function Ef(a){var b=se(a);return b?Cf(_e(b)):a.text.length}function Ff(a,b){var c=le(a.doc,b),d=Fd(a.doc,c);d!=c&&(b=pe(d));var e=se(d),f=e?e[0].level%2?Ef(d):Df(d):0;return Bc(b,f)}function Gf(a,b){for(var c,d;c=Ed(d=le(a.doc,b));)b=c.find().to.line;var e=se(d),f=e?e[0].level%2?Df(d):Ef(d):d.text.length;return Bc(b,f)}function Hf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function Jf(a,b){for(var d,c=0;cb)return If=null,c;if(e.from==b||e.to==b){if(null!=d)return Hf(a,e.level,a[d].level)?(If=d,c):(If=c,d);d=c}}return If=null,d}function Kf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&kf.test(a.text.charAt(b)));return b}function Lf(a,b,c,d){var e=se(a);if(!e)return Mf(a,b,c,d);for(var f=Jf(e,b),g=e[f],h=Kf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Kf(a,g.to,-1,d):Kf(a,g.from,1,d)}}function Mf(a,b,c,d){var e=b+c;if(d)for(;e>0&&kf.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=/Trident\/([7-9]|\d{2,})\./,f=/WebKit\//.test(navigator.userAgent),g=f&&/Qt\/\d+\.\d+/.test(navigator.userAgent),h=/Chrome\//.test(navigator.userAgent),i=/Opera\//.test(navigator.userAgent),j=/Apple Computer/.test(navigator.vendor),k=/KHTML\//.test(navigator.userAgent),l=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),n=/PhantomJS/.test(navigator.userAgent),o=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),p=o||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),q=o||/Mac/.test(navigator.platform),r=/win/i.test(navigator.platform),s=i&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);s&&(s=Number(s[1])),s&&s>=15&&(i=!1,f=!0);var zb,Sb,Tb,t=q&&(g||i&&(null==s||12.11>s)),u=a||b&&!d,v=!1,w=!1,Cb=0,Yb=0,bc=0,cc=null;b?cc=-.53:a?cc=15:h?cc=-.7:j&&(cc=-1/3);var gc,oc,jc=null,qc=x.changeEnd=function(a){return a.text?Bc(a.from.line+a.text.length-1,_e(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};x.Pos=Bc,x.prototype={constructor:x,focus:function(){window.focus(),Nb(this),mc(this),Kb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,$c.hasOwnProperty(a)&&Fb(this,$c[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c=d;++d)Uc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Gc(c,a);for(var d=eb(this,a.line,b),e=this.doc.mode,f=le(c,a.line),g=new pd(f.text,this.options.tabSize);g.pos>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]d&&(a=d,c=!0);var e=le(this.doc,a);return sb(this,le(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return Ab(this.display)},defaultCharWidth:function(){return Bb(this.display)},setGutterMarker:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&jf(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Fb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Ib(b,d,d+1),jf(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Fb(null,function(a,b,c){return Nd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Ic(this.doc,a))return null;var b=a;if(a=le(this.doc,a),!a)return null}else{var b=pe(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=vb(this,Gc(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Qc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Fb(null,kc),execCommand:function(a){return jd[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Gc(this.doc,a);b>f&&(g=Wc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Fb(null,function(a,b){var d,c=this.doc.sel;d=c.shift||c.extend||Cc(c.from,c.to)?Wc(this.doc,c.head,a,b,this.options.rtlMoveVisually):0>a?c.from:c.to,Jc(this.doc,d,d,a)}),deleteH:Fb(null,function(a,b){var c=this.doc.sel;Cc(c.from,c.to)?Ac(this.doc,"",c.from,Wc(this.doc,c.head,a,b,!1),"+delete"):Ac(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Gc(this.doc,a);b>g;++g){var i=vb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Xc(this,i,e,c),h.hitSide)break}return h},moveV:Fb(null,function(a,b){var c=this.doc.sel,d=vb(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=Xc(this,d,a,b);"page"==b&&Tc(this,0,ub(this,e,"div").top-d.top),Jc(this.doc,e,e,a),c.goalColumn=d.left}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:Fb(null,function(a,b){Sc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=Ve;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Fb(null,function(a,b){null==a?a={from:this.doc.sel.head,to:null}:"number"==typeof a?a={from:Bc(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),b||(b=0);var c=a;null!=a.from.line&&(this.curOp.scrollToPos={from:a.from,to:a.to,margin:b},c={from:vb(this,a.from),to:vb(this,a.to)});var d=Rc(this,Math.min(c.from.left,c.to.left),Math.min(c.from.top,c.to.top)-b,Math.max(c.from.right,c.to.right),Math.max(c.from.bottom,c.to.bottom)+b);Sc(this,d.scrollLeft,d.scrollTop)}),setSize:Fb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return Hb(this,a)},refresh:Fb(null,function(){var a=null==this.display.cachedTextHeight;pb(this),Sc(this,this.doc.scrollLeft,this.doc.scrollTop),Ib(this),a&&C(this)}),swapDoc:Fb(null,function(a){var b=this.doc;return b.cm=null,ke(this,a),pb(this),Mb(this,!0),Sc(this,a.scrollLeft,a.scrollTop),Qe(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ue(x);var $c=x.optionHandlers={},_c=x.defaults={},bd=x.Init={toString:function(){return"CodeMirror.Init"}};ad("value","",function(a,b){a.setValue(b)},!0),ad("mode",null,function(a,b){a.doc.modeOption=b,z(a)},!0),ad("indentUnit",2,z,!0),ad("indentWithTabs",!1),ad("smartIndent",!0),ad("tabSize",4,function(a){z(a),pb(a),Ib(a)},!0),ad("electricChars",!0),ad("rtlMoveVisually",!r),ad("theme","default",function(a){E(a),F(a)},!0),ad("keyMap","default",D),ad("extraKeys",null),ad("onKeyEvent",null),ad("onDragEvent",null),ad("lineWrapping",!1,A,!0),ad("gutters",[],function(a){J(a.options),F(a)},!0),ad("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?P(a.display)+"px":"0",a.refresh()},!0),ad("coverGutterNextToScrollbar",!1,K,!0),ad("lineNumbers",!1,function(a){J(a.options),F(a)},!0),ad("firstLineNumber",1,F,!0),ad("lineNumberFormatter",function(a){return a},F,!0),ad("showCursorWhenSelecting",!1,Z,!0),ad("resetSelectionOnContextMenu",!0),ad("readOnly",!1,function(a,b){"nocursor"==b?(nc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Mb(a,!0))}),ad("dragDrop",!0),ad("cursorBlinkRate",530),ad("cursorScrollMargin",0),ad("cursorHeight",1),ad("workTime",100),ad("workDelay",100),ad("flattenSpans",!0),ad("pollInterval",100),ad("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),ad("historyEventDelay",500),ad("viewportMargin",10,function(a){a.refresh()},!0),ad("maxHighlightLength",1e4,function(a){z(a),a.refresh()},!0),ad("crudeMeasuringFrom",1e4),ad("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),ad("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),ad("autofocus",null);var cd=x.modes={},dd=x.mimeModes={};x.defineMode=function(a,b){if(x.defaults.mode||"null"==a||(x.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c0&&b.ch=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},x.StringStream=pd,x.TextMarker=qd,Ue(qd),qd.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&Db(a),Te(this,"clear")){var c=this.find();c&&Qe(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;fa.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&Ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Mc(a)),b&&Eb(a)}},qd.prototype.find=function(){for(var a,b,c=0;c=b.display.showingFrom&&a.linec;++c){var e=this.lines[c];this.height-=e.height,Qd(e),Qe(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},ee.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;ca){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new de(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new de(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new ee(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=bf(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new ee(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var fe=0,ge=x.Doc=function(a,b,c){if(!(this instanceof ge))return new ge(a,b,c);null==c&&(c=0),ee.call(this,[new de([new Od("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=te(),this.cleanGeneration=1,this.frontier=c;var d=Bc(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++fe,this.modeOption=b,"string"==typeof a&&(a=wf(a)),ce(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};ge.prototype=cf(ee.prototype,{constructor:ge,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0,e=b.length;e>d;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=ne(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Bc(this.first,0),c=this.first+this.size-1;uc(this,{from:b,to:Bc(c,le(this,c).text.length),text:wf(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Gc(this,b),c=c?Gc(this,c):b,Ac(this,a,b,c,d)},getRange:function(a,b,c){var d=me(this,Gc(this,a),Gc(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Ic(this,a)&&Ac(this,b,Bc(a,0),Gc(this,Bc(a)))},removeLine:function(a){a?Ac(this,"",Gc(this,Bc(a-1)),Gc(this,Bc(a))):Ac(this,"",Bc(0,0),Gc(this,Bc(1,0)))},getLineHandle:function(a){return Ic(this,a)?le(this,a):void 0},getLineNumber:function(a){return pe(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=le(this,a)),Fd(this,a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Gc(this,a)},getCursor:function(a){var c,b=this.sel;return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||a===!1?b.to:b.from,Ec(c)},somethingSelected:function(){return!Cc(this.sel.head,this.sel.anchor)},setCursor:Gb(function(a,b,c){var d=Gc(this,"number"==typeof a?Bc(a,b||0):a);c?Jc(this,d):Lc(this,d,d)}),setSelection:Gb(function(a,b,c){Lc(this,Gc(this,a),Gc(this,b||a),c)}),extendSelection:Gb(function(a,b,c){Jc(this,Gc(this,a),b&&Gc(this,b),c)}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){uc(this,{from:this.sel.from,to:this.sel.to,text:wf(a),origin:c},b||"around")},undo:Gb(function(){wc(this,"undo")}),redo:Gb(function(){wc(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.history=te(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:ze(this.history.done),undone:ze(this.history.undone)}},setHistory:function(a){var b=this.history=te(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return rd(this,Gc(this,a),Gc(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft};return a=Gc(this,a),rd(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Gc(this,a);var b=[],c=le(this,a.line).markedSpans;if(c)for(var d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=e,++c,void 0)}),Gc(this,Bc(c,b))},indexFromPos:function(a){a=Gc(this,a);var b=a.ch;return a.lineb&&(b=a.from),null!=a.to&&a.to=8208&&8212>=c}:f&&(rf=function(a,b){if(b>1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var sf,uf,wf=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};x.splitLines=wf;var xf=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},yf=function(){var a=lf("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),zf={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};x.keyNames=zf,function(){for(var a=0;10>a;a++)zf[a+48]=String(a);for(var a=65;90>=a;a++)zf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)zf[a+111]=zf[a+63235]="F"+a}();var If,Nf=function(){function c(c){return 255>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1791>=c?b.charAt(c-1536):c>=1792&&2220>=c?"r":"L"}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var l,b=a.length,j=[],k=0;b>k;++k)j.push(l=c(a.charCodeAt(k)));for(var k=0,m=i;b>k;++k){var l=j[k];"m"==l?j[k]=m:m=l}for(var k=0,n=i;b>k;++k){var l=j[k];"1"==l&&"r"==n?j[k]="n":f.test(l)&&(n=l,"r"==l&&(j[k]="R"))}for(var k=1,m=j[0];b-1>k;++k){var l=j[k];"+"==l&&"1"==m&&"1"==j[k+1]?j[k]="1":","!=l||m!=j[k+1]||"1"!=m&&"n"!=m||(j[k]=m),m=l}for(var k=0;b>k;++k){var l=j[k];if(","==l)j[k]="N";else if("%"==l){for(var o=k+1;b>o&&"%"==j[o];++o);for(var p=k&&"!"==j[k-1]||b-1>o&&"1"==j[o]?"1":"N",q=k;o>q;++q)j[q]=p;k=o-1}}for(var k=0,n=i;b>k;++k){var l=j[k];"L"==n&&"1"==l?j[k]="L":f.test(l)&&(n=l)}for(var k=0;b>k;++k)if(e.test(j[k])){for(var o=k+1;b>o&&e.test(j[o]);++o);for(var r="L"==(k?j[k-1]:i),s="L"==(b-1>o?j[o]:i),p=r||s?"L":"R",q=k;o>q;++q)j[q]=p;k=o-1}for(var u,t=[],k=0;b>k;)if(g.test(j[k])){var v=k;for(++k;b>k&&g.test(j[k]);++k);t.push({from:v,to:k,level:0})}else{var w=k,x=t.length;for(++k;b>k&&"L"!=j[k];++k);for(var q=w;k>q;)if(h.test(j[q])){q>w&&t.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;k>q&&h.test(j[q]);++q);t.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;k>w&&t.splice(x,0,{from:w,to:k,level:1})}return 1==t[0].level&&(u=a.match(/^\s+/))&&(t[0].from=u[0].length,t.unshift({from:0,to:u[0].length,level:0})),1==_e(t).level&&(u=a.match(/\s+$/))&&(_e(t).to-=u[0].length,t.push({from:b-u[0].length,to:b,level:0})),t[0].level!=_e(t).level&&t.push({from:b,to:b,level:t[0].level}),t}}();return x.version="3.19.1",x}(),CodeMirror.defineMode("css",function(a,b){"use strict";function l(a,b){return k=b,a}function m(a,b){var c=a.next();if(d[c]){var e=d[c](a,b);if(e!==!1)return e}if("@"==c)return a.eatWhile(/[\w\\\-]/),l("def",a.current());if("="==c)l(null,"compare");else{if(("~"==c||"|"==c)&&a.eat("="))return l(null,"compare");if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if("#"==c)return a.eatWhile(/[\w\\\-]/),l("atom","hash");if("!"==c)return a.match(/^\s*\w*/),l("keyword","important");if(/\d/.test(c)||"."==c&&a.eat(/\d/))return a.eatWhile(/[\w.%]/),l("number","unit");if("-"!==c)return/[,+>*\/]/.test(c)?l(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?l("qualifier","qualifier"):":"==c?l("operator",c):/[;{}\[\]\(\)]/.test(c)?l(null,c):"u"==c&&a.match("rl(")?(a.backUp(1),b.tokenize=o,l("property","variable")):(a.eatWhile(/[\w\\\-]/),l("property","variable"));if(/\d/.test(a.peek()))return a.eatWhile(/[\w.%]/),l("number","unit");if(a.match(/^[^-]+-/))return l("meta","meta")}}function n(a,b){return function(c,d){for(var f,e=!1;null!=(f=c.next())&&(f!=a||e);)e=!e&&"\\"==f;return e||(b&&c.backUp(1),d.tokenize=m),l("string","string")}}function o(a,b){return a.next(),b.tokenize=a.match(/\s*[\"\']/,!1)?m:n(")",!0),l(null,"(")}b.propertyKeywords||(b=CodeMirror.resolveMode("text/css"));var c=a.indentUnit||a.tabSize||2,d=b.hooks||{},e=b.atMediaTypes||{},f=b.atMediaFeatures||{},g=b.propertyKeywords||{},h=b.colorKeywords||{},i=b.valueKeywords||{},j=!!b.allowNested,k=null;return{startState:function(a){return{tokenize:m,baseIndent:a||0,stack:[],lastToken:null}},token:function(a,b){if(b.tokenize=b.tokenize||m,b.tokenize==m&&a.eatSpace())return null;var c=b.tokenize(a,b);c&&"string"!=typeof c&&(c=l(c[0],c[1]));var d=b.stack[b.stack.length-1];if("variable"==c)return"variable-definition"==k&&b.stack.push("propertyValue"),b.lastToken="variable-2";if("property"==c){var n=a.current().toLowerCase();"propertyValue"==d?c=i.hasOwnProperty(n)?"string-2":h.hasOwnProperty(n)?"keyword":"variable-2":"rule"==d?g.hasOwnProperty(n)||(c+=" error"):"block"==d?c=g.hasOwnProperty(n)?"property":h.hasOwnProperty(n)?"keyword":i.hasOwnProperty(n)?"string-2":"tag":d&&"@media{"!=d?"@media"==d?c=e[a.current()]?"attribute":/^(only|not)$/.test(n)?"keyword":"and"==n?"error":f.hasOwnProperty(n)?"error":"attribute error":"@mediaType"==d?c=e.hasOwnProperty(n)?"attribute":"and"==n?"operator":/^(only|not)$/.test(n)?"error":"error":"@mediaType("==d?g.hasOwnProperty(n)||(e.hasOwnProperty(n)?c="error":"and"==n?c="operator":/^(only|not)$/.test(n)?c="error":c+=" error"):c="@import"==d?"tag":"error":c="tag"}else"atom"==c?d&&"@media{"!=d&&"block"!=d?"propertyValue"==d?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(a.current())||(c+=" error"):c="error":c="builtin":"@media"==d&&"{"==k&&(c="error");if("{"==k)if("@media"==d||"@mediaType"==d)b.stack[b.stack.length-1]="@media{";else{var o=j?"block":"rule";b.stack.push(o)}else if("}"==k)for("interpolation"==d&&(c="operator");b.stack.length;){var p=b.stack.pop();if(p.indexOf("{")>-1)break}else if("interpolation"==k)b.stack.push("interpolation");else if("@media"==k)b.stack.push("@media");else if("@import"==k)b.stack.push("@import");else if("@media"==d&&/\b(keyword|attribute)\b/.test(c))b.stack[b.stack.length-1]="@mediaType";else if("@mediaType"==d&&","==a.current())b.stack[b.stack.length-1]="@media";else if("("==k)"@media"==d||"@mediaType"==d?(b.stack[b.stack.length-1]="@mediaType",b.stack.push("@mediaType(")):b.stack.push("(");else if(")"==k)for(;b.stack.length;){var p=b.stack.pop();if(p.indexOf("(")>-1)break}else":"==k&&"property"==b.lastToken?b.stack.push("propertyValue"):"propertyValue"==d&&";"==k?b.stack.pop():"@import"==d&&";"==k&&b.stack.pop();return b.lastToken=c},indent:function(a,b){var d=a.stack.length;return/^\}/.test(b)&&(d-="propertyValue"==a.stack[d-1]?2:1),a.baseIndent+d*c},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}),function(){function a(a){for(var b={},c=0;c=2&&">"==d){b.tokenize=null;break}c="-"==d?c+1:0}return["comment","comment"]}return a.eat("!")?(b.tokenize=c,c(a,b)):void 0},"/":function(a,b){return a.eat("*")?(b.tokenize=g,g(a,b)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{atMediaTypes:b,atMediaFeatures:c,propertyKeywords:d,colorKeywords:e,valueKeywords:f,allowNested:!0,hooks:{":":function(a){return a.match(/\s*{/)?[null,"{"]:!1},$:function(a){return a.match(/^[\w-]+/),":"==a.peek()?["variable","variable-definition"]:["variable","variable"]},",":function(a,b){return"propertyValue"==b.stack[b.stack.length-1]?["operator",";"]:void 0},"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=g,g(a,b)):["operator","operator"] -},"#":function(a){return a.eat("{")?["operator","interpolation"]:(a.eatWhile(/[\w\\\-]/),["atom","hash"])}},name:"css"})}(),CodeMirror.defineMode("less",function(a){function d(a,b){return c=b,a}function f(a,b){var f=a.next();if("@"==f)return a.eatWhile(/[\w\-]/),d("meta",a.current());if("/"==f&&a.eat("*"))return b.tokenize=h,h(a,b);if("<"==f&&a.eat("!"))return b.tokenize=i,i(a,b);if("="==f)d(null,"compare");else{if("|"==f&&a.eat("="))return d(null,"compare");if('"'==f||"'"==f)return b.tokenize=j(f),b.tokenize(a,b);if("/"==f){if(a.eat("/"))return b.tokenize=g,g(a,b);if("string"==c||"("==c)return d("string","string");if(void 0!==b.stack[b.stack.length-1])return d(null,f);if(a.eatWhile(/[\a-zA-Z0-9\-_.\s]/),/\/|\)|#/.test(a.peek()||a.eatSpace()&&")"===a.peek())||a.eol())return d("string","string")}else{if("!"==f)return a.match(/^\s*\w*/),d("keyword","important");if(/\d/.test(f))return a.eatWhile(/[\w.%]/),d("number","unit");if(/[,+<>*\/]/.test(f))return"="==a.peek()||"a"==c?d("string","string"):","===f?d(null,f):d(null,"select-op");if(/[;{}:\[\]()~\|]/.test(f)){if(":"==f)return a.eatWhile(/[a-z\\\-]/),e.test(a.current())?d("tag","tag"):":"==a.peek()?(a.next(),a.eatWhile(/[a-z\\\-]/),a.current().match(/\:\:\-(o|ms|moz|webkit)\-/)?d("string","string"):e.test(a.current().substring(1))?d("tag","tag"):d(null,f)):d(null,f);if("~"!=f)return d(null,f);if("r"==c)return d("string","string")}else{if("."==f)return"("==c?d("string","string"):(a.eatWhile(/[\a-zA-Z0-9\-_]/)," "===a.peek()&&a.eatSpace(),")"===a.peek()||":"===c?d("number","unit"):a.current().length>1&&"rule"===b.stack[b.stack.length-1]&&null===a.peek().match(/{|,|\+|\(/)?d("number","unit"):d("tag","tag"));if("#"==f)return a.eatWhile(/[A-Za-z0-9]/),4==a.current().length||7==a.current().length?null!=a.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,!1)?a.current().substring(1)!=a.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,!1)?d("atom","tag"):(a.eatSpace(),/[\/<>.(){!$%^&*_\-\\?=+\|#'~`]/.test(a.peek())?"select-op"===c?d("number","unit"):d("atom","tag"):"}"==a.peek()?d("number","unit"):/[a-zA-Z\\]/.test(a.peek())?d("atom","tag"):a.eol()?d("atom","tag"):d("number","unit")):(a.eatWhile(/[\w\\\-]/),d("atom",a.current())):(a.eatWhile(/[\w\\\-]/),"rule"===b.stack[b.stack.length-1]?d("atom",a.current()):d("atom",a.current()));if("&"==f)return a.eatWhile(/[\w\-]/),d(null,f);if(a.eatWhile(/[\w\\\-_%.{]/),null===a.current().match(/\\/)){if("string"==c)return"{"===b.stack[b.stack.length-1]&&":"===a.peek()?d("variable","variable"):("/"===a.peek()&&a.eatWhile(/[\w\\\-_%.{:\/]/),d(c,a.current()));if(null!=a.current().match(/(^http$|^https$)/))return a.eatWhile(/[\w\\\-_%.{:\/]/),"/"===a.peek()&&a.eatWhile(/[\w\\\-_%.{:\/]/),d("string","string");if("<"==a.peek()||">"==a.peek()||"+"==a.peek())return"("!==c||"n"!==a.current()&&"-n"!==a.current()?d("tag","tag"):d("string",a.current());if(/\(/.test(a.peek()))return"when"===a.current()?d("variable","variable"):"@media"===b.stack[b.stack.length-1]&&"and"===a.current()?d("variable",a.current()):d(null,f);if("/"==a.peek()&&void 0!==b.stack[b.stack.length-1])return"/"===a.peek()&&a.eatWhile(/[\w\\\-_%.{:\/]/),d("string",a.current());if(a.current().match(/\-\d|\-.\d/))return d("number","unit");if(/\/|[\s\)]/.test(a.peek()||a.eol()||a.eatSpace()&&"/"==a.peek())&&-1!==a.current().indexOf("."))return"{"==a.current().substring(a.current().length-1,a.current().length)?(a.backUp(1),d("tag","tag")):(a.eatSpace(),/[{<>.a-zA-Z\/]/.test(a.peek())||a.eol()?d("tag","tag"):d("string","string"));if(a.eol()||"["==a.peek()||"#"==a.peek()||"tag"==c){if("{"==a.current().substring(a.current().length-1,a.current().length))a.backUp(1);else{if("border-color"===b.stack[b.stack.length-1]||"background-position"===b.stack[b.stack.length-1]||"font-family"===b.stack[b.stack.length-1])return d(null,a.current());if("tag"===c)return d("tag","tag");if((":"===c||"unit"===c)&&"rule"===b.stack[b.stack.length-1])return d(null,a.current());if("rule"===b.stack[b.stack.length-1]&&"tag"===c)return d("string",a.current());if(";"===b.stack[b.stack.length-1]&&":"===c)return d(null,a.current());if("#"===a.peek()&&void 0!==c&&null===c.match(/\+|,|tag|select\-op|}|{|;/g))return d("string",a.current());if("variable"===c)return d(null,a.current());if("{"===b.stack[b.stack.length-1]&&"comment"===c)return d("variable",a.current());if(0===b.stack.length&&(";"===c||"comment"===c))return d("tag",a.current());if(("{"===b.stack[b.stack.length-1]||";"===c)&&"@media{"!==b.stack[b.stack.length-1])return d("variable",a.current());if("{"===b.stack[b.stack.length-2]&&";"===b.stack[b.stack.length-1])return d("variable",a.current())}return d("tag","tag")}if("compare"==c||"a"==c||"("==c)return d("string","string");if("|"==c||"-"==a.current()||"["==c)return"|"==c&&null!==a.peek().match(/\]|=|\~/)?d("number",a.current()):"|"==c?d("tag","tag"):"["==c?(a.eatWhile(/\w\-/),d("number",a.current())):d(null,f);if(":"==a.peek()||a.eatSpace()&&":"==a.peek()){a.next();var k=":"==a.peek()?!0:!1;if(k)a.backUp(1);else{var l=a.pos,m=a.current().length;a.eatWhile(/[a-z\\\-]/);var n=a.pos;if(null!=a.current().substring(m-1).match(e))return a.backUp(n-(l-1)),d("tag","tag");a.backUp(n-(l-1))}return k?d("tag","tag"):d("variable","variable")}return"font-family"===b.stack[b.stack.length-1]||"background-position"===b.stack[b.stack.length-1]||"border-color"===b.stack[b.stack.length-1]?d(null,null):null===b.stack[b.stack.length-1]&&":"===c?d(null,a.current()):/\^|\$/.test(a.current())&&null!==a.peek().match(/\~|=/)?d("string","string"):"unit"===c&&"rule"===b.stack[b.stack.length-1]?d(null,"unit"):"unit"===c&&";"===b.stack[b.stack.length-1]?d(null,"unit"):")"===c&&"rule"===b.stack[b.stack.length-1]?d(null,"unit"):c&&null!==c.match("@")&&"rule"===b.stack[b.stack.length-1]?d(null,"unit"):";"!==c&&"}"!==c&&","!==c||";"!==b.stack[b.stack.length-1]?";"===c&&void 0!==a.peek()&&null===a.peek().match(/{|./)||";"===c&&a.eatSpace()&&null===a.peek().match(/{|./)?d("variable",a.current()):"@media"===c&&"@media"===b.stack[b.stack.length-1]||"@namespace"===c?d("tag",a.current()):"{"===c&&";"===b.stack[b.stack.length-1]&&"{"===a.peek()?d("tag","tag"):"{"!==c&&":"!==c||";"!==b.stack[b.stack.length-1]?"{"===b.stack[b.stack.length-1]&&a.eatSpace()&&null===a.peek().match(/.|#/)||"select-op"===c||"rule"===b.stack[b.stack.length-1]&&","===c?d("tag","tag"):"variable"===c&&"rule"===b.stack[b.stack.length-1]?d("tag","tag"):a.eatSpace()&&"{"===a.peek()||a.eol()||"{"===a.peek()?d("tag","tag"):")"!==c||"and"!=a.current()&&"and "!=a.current()?")"!==c||"when"!=a.current()&&"when "!=a.current()?")"===c||"comment"===c||"{"===c?d("tag","tag"):a.sol()?d("tag","tag"):a.eatSpace()&&"#"===a.peek()||"#"===a.peek()?d("tag","tag"):0===b.stack.length?d("tag","tag"):";"===c&&void 0!==a.peek()&&null!==a.peek().match(/^[.|\#]/g)?d("tag","tag"):":"===c?(a.eatSpace(),d(null,a.current())):"and "===a.current()||"and"===a.current()?d("variable",a.current()):";"===c&&"{"===b.stack[b.stack.length-1]?d("variable",a.current()):"rule"===b.stack[b.stack.length-1]?d(null,a.current()):d("tag",a.current()):d("variable","variable"):d("variable","variable"):d(null,a.current()):d("tag",a.current())}if("\\"===a.current().charAt(a.current().length-1)){for(a.eat(/\'|\"|\)|\(/);a.eatWhile(/[\w\\\-_%.{]/);)a.eat(/\'|\"|\)|\(/);return d("string",a.current())}}}}}function g(a,b){return a.skipToEnd(),b.tokenize=f,d("comment","comment")}function h(a,b){for(var e,c=!1;null!=(e=a.next());){if(c&&"/"==e){b.tokenize=f;break}c="*"==e}return d("comment","comment")}function i(a,b){for(var e,c=0;null!=(e=a.next());){if(c>=2&&">"==e){b.tokenize=f;break}c="-"==e?c+1:0}return d("comment","comment")}function j(a){return function(b,c){for(var g,e=!1;null!=(g=b.next())&&(g!=a||e);)e=!e&&"\\"==g;return e||(c.tokenize=f),d("string","string")}}var c,b=a.indentUnit,e=/(^\:root$|^\:nth\-child$|^\:nth\-last\-child$|^\:nth\-of\-type$|^\:nth\-last\-of\-type$|^\:first\-child$|^\:last\-child$|^\:first\-of\-type$|^\:last\-of\-type$|^\:only\-child$|^\:only\-of\-type$|^\:empty$|^\:link|^\:visited$|^\:active$|^\:hover$|^\:focus$|^\:target$|^\:lang$|^\:enabled^\:disabled$|^\:checked$|^\:first\-line$|^\:first\-letter$|^\:before$|^\:after$|^\:not$|^\:required$|^\:invalid$)/;return{startState:function(a){return{tokenize:f,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var e=b.tokenize(a,b),f=b.stack[b.stack.length-1];if("hash"==c&&"rule"==f?e="atom":"variable"==e&&("rule"==f?e=null:f&&"@media{"!=f||(e="when"==a.current()?"variable":/[\s,|\s\)|\s]/.test(a.peek())?"tag":c)),"rule"==f&&/^[\{\};]$/.test(c)&&b.stack.pop(),"{"==c?"@media"==f?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):"}"==c?b.stack.pop():"@media"==c?b.stack.push("@media"):"font-family"===a.current()?b.stack[b.stack.length-1]="font-family":"background-position"===a.current()?b.stack[b.stack.length-1]="background-position":"border-color"===a.current()?b.stack[b.stack.length-1]="border-color":"{"==f&&"comment"!=c&&"tag"!==c?b.stack.push("rule"):":"===a.peek()&&null===a.current().match(/@|#/)&&(e=c),";"!==c||"font-family"!=b.stack[b.stack.length-1]&&"background-position"!=b.stack[b.stack.length-1]&&"border-color"!=b.stack[b.stack.length-1]){if("tag"===c&&")"===a.peek()&&null===a.current().match(/\:/))c=null,e=null;else if("variable"===c&&")"===a.peek()||"variable"===c&&a.eatSpace()&&")"===a.peek())return d(null,a.current())}else b.stack[b.stack.length-1]=a.current();return e},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)?d-="rule"===a.stack[a.stack.length-1]?2:1:"{"===a.stack[a.stack.length-2]&&(d-="rule"===a.stack[a.stack.length-1]?1:0),a.baseIndent+d*b},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),CodeMirror.defineMIME("text/x-less","less"),CodeMirror.mimeModes.hasOwnProperty("text/css")||CodeMirror.defineMIME("text/css","less"); \ No newline at end of file diff --git a/projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css-preview.js b/projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css-preview.js deleted file mode 100644 index 15090ee3559e1..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css-preview.js +++ /dev/null @@ -1,42 +0,0 @@ -// Originally based on https://raw.githubusercontent.com/xwp/wp-custom-scss-demo/master/custom-scss-demo-preview.js -/* globals jpCustomizerCssPreview */ -(function( api, $ ) { - if ( api.settingPreviewHandlers ) { - // No-op the custom_css preview handler since now handled by partial. - api.settingPreviewHandlers.custom_css = function() {}; - } else { - parent.console.warn( 'Missing core patch that adds support for settingPreviewHandlers' ); - } - - api.selectiveRefresh.partialConstructor.custom_css = api.selectiveRefresh.Partial.extend( { - - /** - * Refresh custom_css partial, using selective refresh if pre-processor and direct DOM manipulation if otherwise. - * - * @returns {jQuery.promise} - */ - refresh: function() { - var partial = this, - preprocessor = api( 'jetpack_custom_css[preprocessor]' ).get(), - deferred, setting; - - // Sass or Less require Partial -- so ajax call to get it from PHP. - // We can explicitly override for specific providers by testing if `'sass' === preprocessor` - if ( jpCustomizerCssPreview.preprocessors.hasOwnProperty( preprocessor ) ) { - return api.selectiveRefresh.Partial.prototype.refresh.call( partial ); - } - - // No special providers, just write what we got. - deferred = new $.Deferred(); - setting = api( 'custom_css[' + api.settings.theme.stylesheet + ']' ); - _.each( partial.placements(), function( placement ) { - placement.container.text( setting.get() ); - } ); - - deferred.resolve(); - return deferred.promise(); - } - - } ); - -}( wp.customize, jQuery )); diff --git a/projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js b/projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js deleted file mode 100644 index ee1b37e9273cf..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js +++ /dev/null @@ -1,93 +0,0 @@ -(function( $, customize ){ - /** - * Helper function to qet a control by ID - * @param {string} controlId Control ID - * @return {object} jQuery object of the container - */ - function _getControl ( controlId ) { - var control = customize.control.value( controlId ); - if ( control ) { - return control.container; - } - return null; - } - - /** - * Add some labels that the default checkbox controls don't allow. - * Add CSS Revisions and CSS Help links. - */ - $(document).ready( function(){ - var cssModeControl = _getControl( 'jetpack_css_mode_control' ); - if ( cssModeControl ) { - cssModeControl.prepend( '' + window._jp_css_settings.l10n.mode + '' ); - } - - var mobileCssControl = _getControl( 'jetpack_mobile_css_control' ); - if ( mobileCssControl ) { - mobileCssControl.prepend( '' + window._jp_css_settings.l10n.mobile + '' ); - } - - var widthControl = _getControl( 'wpcom_custom_css_content_width_control' ); - if ( widthControl ) { - widthControl.append( '' + window._jp_css_settings.l10n.contentWidth + '' ); - widthControl.find( 'input' ).after( 'px' ); - } - - $( '
', { - id : 'css-help-links', - 'class' : 'css-help' - }).appendTo( _getControl( 'custom_css' ) ); - - $( '', { - id : 'help-link', - target : '_blank', - rel: 'noopener noreferrer', - href : window._jp_css_settings.cssHelpUrl, - text : window._jp_css_settings.l10n.css_help_title - }).prependTo( '#css-help-links' ); - - // Only show the revisions link if there are revisions - if ( window._jp_css_settings.areThereCssRevisions ) { - $( '', { - id : 'revisions-link', - target : '_blank', - rel: 'noopener noreferrer', - href : window._jp_css_settings.revisionsUrl, - text : window._jp_css_settings.l10n.revisions - }).prependTo( '#css-help-links' ); - } - - // Show deprecation warning if Start Fresh option is enabled - if ( !! window._jp_css_settings.startFresh && window._currentSiteType !== 'atomic' ) { - customize.notifications.add( new customize.Notification( 'start-fresh-warning', { - message: window._jp_css_settings.l10n.startFreshCustomizerWarning, - type: 'warning', - } ) ); - } - - customize( 'jetpack_custom_css[preprocessor]', function( preprocessorSetting ) { - preprocessorSetting.bind( function( curr ) { - var preprocessor_modes = { - 'default' : 'text/css', - less : 'text/x-less', - sass : 'text/x-scss' - }, - new_mode = 'text/css'; - - if ( 'undefined' !== typeof preprocessor_modes[ curr ] ) { - new_mode = preprocessor_modes[ curr ]; - } - - customize.control( 'custom_css' ).deferred.codemirror.done( function ( cm ) { - cm.setOption( 'mode', new_mode ); - if ( 'text/css' === new_mode ) { - cm.setOption( 'lint', true ); - } else { - cm.setOption( 'lint', false ); - } - }); - }); - }); - }); - -})( jQuery, window.wp.customize ); diff --git a/projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors.php b/projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors.php deleted file mode 100644 index ff08d68d5cb23..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors.php +++ /dev/null @@ -1,76 +0,0 @@ - array( 'name' => 'Processor name', 'callback' => [processing function] ); - * - * The callback function accepts a single string argument (non-CSS markup) and returns a string (CSS). - * - * @param array $preprocessors The list of preprocessors added thus far. - * @return array - */ - function jetpack_register_css_preprocessors( $preprocessors ) { - $preprocessors['less'] = array( - 'name' => 'LESS', - 'callback' => 'jetpack_less_css_preprocess', - ); - - $preprocessors['sass'] = array( - 'name' => 'Sass (SCSS Syntax)', - 'callback' => 'jetpack_sass_css_preprocess', - ); - - return $preprocessors; - } -} - -add_filter( 'jetpack_custom_css_preprocessors', 'jetpack_register_css_preprocessors' ); - -if ( ! function_exists( 'jetpack_less_css_preprocess' ) ) { - /** - * Compile less prepocessors? - * - * @param string $less - less. - */ - function jetpack_less_css_preprocess( $less ) { - require_once __DIR__ . '/preprocessors/lessc.inc.php'; - - $compiler = new lessc(); - - // Don't try to load from the filesystem. - $compiler->setImportDir( array() ); - - try { - return $compiler->compile( $less ); - } catch ( Exception $e ) { - return $less; - } - } -} - -if ( ! function_exists( 'jetpack_sass_css_preprocess' ) ) { - /** - * Compile sass prepocessors? - * - * @param string $sass - sass. - */ - function jetpack_sass_css_preprocess( $sass ) { - $compiler = new ScssPhp\ScssPhp\Compiler(); - - // Don't try to load from the filesystem. - $compiler->setImportPaths( array() ); - - try { - return $compiler->compileString( $sass )->getCss(); - } catch ( Exception $e ) { - return $sass; - } - } -} diff --git a/projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php b/projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php deleted file mode 100644 index cd0bad9decaf4..0000000000000 --- a/projects/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php +++ /dev/null @@ -1,3775 +0,0 @@ - - * Licensed under MIT or GPLv3, see LICENSE - */ - - -/** - * The LESS compiler and parser. - * - * Converting LESS to CSS is a three stage process. The incoming file is parsed - * by `lessc_parser` into a syntax tree, then it is compiled into another tree - * representing the CSS structure by `lessc`. The CSS tree is fed into a - * formatter, like `lessc_formatter` which then outputs CSS as a string. - * - * During the first compile, all values are *reduced*, which means that their - * types are brought to the lowest form before being dump as strings. This - * handles math equations, variable dereferences, and the like. - * - * The `parse` function of `lessc` is the entry point. - * - * In summary: - * - * The `lessc` class creates an instance of the parser, feeds it LESS code, - * then transforms the resulting tree to a CSS tree. This class also holds the - * evaluation context, such as all available mixins and variables at any given - * time. - * - * The `lessc_parser` class is only concerned with parsing its input. - * - * The `lessc_formatter` takes a CSS tree, and dumps it to a formatted string, - * handling things like indentation. - */ -class lessc { - static public $VERSION = "v0.5.0"; - - static public $TRUE = array("keyword", "true"); - static public $FALSE = array("keyword", "false"); - - protected $libFunctions = array(); - protected $registeredVars = array(); - protected $preserveComments = false; - - public $vPrefix = '@'; // prefix of abstract properties - public $mPrefix = '$'; // prefix of abstract blocks - public $parentSelector = '&'; - - public $importDisabled = false; - public $importDir = ''; - - protected $numberPrecision = null; - - protected $allParsedFiles = array(); - - // set to the parser that generated the current line when compiling - // so we know how to create error messages - protected $sourceParser = null; - protected $sourceLoc = null; - - static protected $nextImportId = 0; // uniquely identify imports - - // attempts to find the path of an import url, returns null for css files - protected function findImport($url) { - foreach ((array)$this->importDir as $dir) { - $full = $dir.(substr($dir, -1) != '/' ? '/' : '').$url; - if ($this->fileExists($file = $full.'.less') || $this->fileExists($file = $full)) { - return $file; - } - } - - return null; - } - - protected function fileExists($name) { - return is_file($name); - } - - static public function compressList($items, $delim) { - if (!isset($items[1]) && isset($items[0])) return $items[0]; - else return array('list', $delim, $items); - } - - static public function preg_quote($what) { - return preg_quote($what, '/'); - } - - protected function tryImport($importPath, $parentBlock, $out) { - if ($importPath[0] == "function" && $importPath[1] == "url") { - $importPath = $this->flattenList($importPath[2]); - } - - $str = $this->coerceString($importPath); - if ($str === null) return false; - - $url = $this->compileValue($this->lib_e($str)); - - // don't import if it ends in css - if (substr_compare($url, '.css', -4, 4) === 0) return false; - - $realPath = $this->findImport($url); - - if ($realPath === null) return false; - - if ($this->importDisabled) { - return array(false, "/* import disabled */"); - } - - if (isset($this->allParsedFiles[realpath($realPath)])) { - return array(false, null); - } - - $this->addParsedFile($realPath); - $parser = $this->makeParser($realPath); - $root = $parser->parse(file_get_contents($realPath)); - - // set the parents of all the block props - foreach ($root->props as $prop) { - if ($prop[0] == "block") { - $prop[1]->parent = $parentBlock; - } - } - - // copy mixins into scope, set their parents - // bring blocks from import into current block - // TODO: need to mark the source parser these came from this file - foreach ($root->children as $childName => $child) { - if (isset($parentBlock->children[$childName])) { - $parentBlock->children[$childName] = array_merge( - $parentBlock->children[$childName], - $child); - } else { - $parentBlock->children[$childName] = $child; - } - } - - $pi = pathinfo($realPath); - $dir = $pi["dirname"]; - - list($top, $bottom) = $this->sortProps($root->props, true); - $this->compileImportedProps($top, $parentBlock, $out, $parser, $dir); - - return array(true, $bottom, $parser, $dir); - } - - protected function compileImportedProps($props, $block, $out, $sourceParser, $importDir) { - $oldSourceParser = $this->sourceParser; - - $oldImport = $this->importDir; - - // TODO: this is because the importDir api is stupid - $this->importDir = (array)$this->importDir; - array_unshift($this->importDir, $importDir); - - foreach ($props as $prop) { - $this->compileProp($prop, $block, $out); - } - - $this->importDir = $oldImport; - $this->sourceParser = $oldSourceParser; - } - - /** - * Recursively compiles a block. - * - * A block is analogous to a CSS block in most cases. A single LESS document - * is encapsulated in a block when parsed, but it does not have parent tags - * so all of it's children appear on the root level when compiled. - * - * Blocks are made up of props and children. - * - * Props are property instructions, array tuples which describe an action - * to be taken, eg. write a property, set a variable, mixin a block. - * - * The children of a block are just all the blocks that are defined within. - * This is used to look up mixins when performing a mixin. - * - * Compiling the block involves pushing a fresh environment on the stack, - * and iterating through the props, compiling each one. - * - * See lessc::compileProp() - * - */ - protected function compileBlock($block) { - switch ($block->type) { - case "root": - $this->compileRoot($block); - break; - case null: - $this->compileCSSBlock($block); - break; - case "media": - $this->compileMedia($block); - break; - case "directive": - $name = "@" . $block->name; - if (!empty($block->value)) { - $name .= " " . $this->compileValue($this->reduce($block->value)); - } - - $this->compileNestedBlock($block, array($name)); - break; - default: - $this->throwError("unknown block type: $block->type\n"); - } - } - - protected function compileCSSBlock($block) { - $env = $this->pushEnv(); - - $selectors = $this->compileSelectors($block->tags); - $env->selectors = $this->multiplySelectors($selectors); - $out = $this->makeOutputBlock(null, $env->selectors); - - $this->scope->children[] = $out; - $this->compileProps($block, $out); - - $block->scope = $env; // mixins carry scope with them! - $this->popEnv(); - } - - protected function compileMedia($media) { - $env = $this->pushEnv($media); - $parentScope = $this->mediaParent($this->scope); - - $query = $this->compileMediaQuery($this->multiplyMedia($env)); - - $this->scope = $this->makeOutputBlock($media->type, array($query)); - $parentScope->children[] = $this->scope; - - $this->compileProps($media, $this->scope); - - if ( is_countable( $this->scope->lines ) && count( $this->scope->lines ) > 0 ) { - $orphanSelelectors = $this->findClosestSelectors(); - if (!is_null($orphanSelelectors)) { - $orphan = $this->makeOutputBlock(null, $orphanSelelectors); - $orphan->lines = $this->scope->lines; - array_unshift($this->scope->children, $orphan); - $this->scope->lines = array(); - } - } - - $this->scope = $this->scope->parent; - $this->popEnv(); - } - - protected function mediaParent($scope) { - while (!empty($scope->parent)) { - if (!empty($scope->type) && $scope->type != "media") { - break; - } - $scope = $scope->parent; - } - - return $scope; - } - - protected function compileNestedBlock($block, $selectors) { - $this->pushEnv($block); - $this->scope = $this->makeOutputBlock($block->type, $selectors); - $this->scope->parent->children[] = $this->scope; - - $this->compileProps($block, $this->scope); - - $this->scope = $this->scope->parent; - $this->popEnv(); - } - - protected function compileRoot($root) { - $this->pushEnv(); - $this->scope = $this->makeOutputBlock($root->type); - $this->compileProps($root, $this->scope); - $this->popEnv(); - } - - protected function compileProps($block, $out) { - foreach ($this->sortProps($block->props) as $prop) { - $this->compileProp($prop, $block, $out); - } - $out->lines = $this->deduplicate($out->lines); - } - - /** - * Deduplicate lines in a block. Comments are not deduplicated. If a - * duplicate rule is detected, the comments immediately preceding each - * occurence are consolidated. - */ - protected function deduplicate($lines) { - $unique = array(); - $comments = array(); - - foreach($lines as $line) { - if (strpos($line, '/*') === 0) { - $comments[] = $line; - continue; - } - if (!in_array($line, $unique)) { - $unique[] = $line; - } - array_splice($unique, array_search($line, $unique), 0, $comments); - $comments = array(); - } - return array_merge($unique, $comments); - } - - protected function sortProps($props, $split = false) { - $vars = array(); - $imports = array(); - $other = array(); - $stack = array(); - - foreach ($props as $prop) { - switch ($prop[0]) { - case "comment": - $stack[] = $prop; - break; - case "assign": - $stack[] = $prop; - if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) { - $vars = array_merge($vars, $stack); - } else { - $other = array_merge($other, $stack); - } - $stack = array(); - break; - case "import": - $id = self::$nextImportId++; - $prop[] = $id; - $stack[] = $prop; - $imports = array_merge($imports, $stack); - $other[] = array("import_mixin", $id); - $stack = array(); - break; - default: - $stack[] = $prop; - $other = array_merge($other, $stack); - $stack = array(); - break; - } - } - $other = array_merge($other, $stack); - - if ($split) { - return array(array_merge($imports, $vars), $other); - } else { - return array_merge($imports, $vars, $other); - } - } - - protected function compileMediaQuery($queries) { - $compiledQueries = array(); - foreach ($queries as $query) { - $parts = array(); - foreach ($query as $q) { - switch ($q[0]) { - case "mediaType": - $parts[] = implode(" ", array_slice($q, 1)); - break; - case "mediaExp": - if (isset($q[2])) { - $parts[] = "($q[1]: " . - $this->compileValue($this->reduce($q[2])) . ")"; - } else { - $parts[] = "($q[1])"; - } - break; - case "variable": - $parts[] = $this->compileValue($this->reduce($q)); - break; - } - } - - if (count($parts) > 0) { - $compiledQueries[] = implode(" and ", $parts); - } - } - - $out = "@media"; - if (!empty($parts)) { - $out .= " " . - implode($this->formatter->selectorSeparator, $compiledQueries); - } - return $out; - } - - protected function multiplyMedia($env, $childQueries = null) { - if (is_null($env) || - !empty($env->block->type) && $env->block->type != "media") - { - return $childQueries; - } - - // plain old block, skip - if (empty($env->block->type)) { - return $this->multiplyMedia($env->parent, $childQueries); - } - - $out = array(); - $queries = $env->block->queries; - if (is_null($childQueries)) { - $out = $queries; - } else { - foreach ($queries as $parent) { - foreach ($childQueries as $child) { - $out[] = array_merge($parent, $child); - } - } - } - - return $this->multiplyMedia($env->parent, $out); - } - - protected function expandParentSelectors(&$tag, $replace) { - $parts = explode("$&$", $tag); - $count = 0; - foreach ($parts as &$part) { - $part = str_replace($this->parentSelector, $replace, $part, $c); - $count += $c; - } - $tag = implode($this->parentSelector, $parts); - return $count; - } - - protected function findClosestSelectors() { - $env = $this->env; - $selectors = null; - while ($env !== null) { - if (isset($env->selectors)) { - $selectors = $env->selectors; - break; - } - $env = $env->parent; - } - - return $selectors; - } - - - // multiply $selectors against the nearest selectors in env - protected function multiplySelectors($selectors) { - // find parent selectors - - $parentSelectors = $this->findClosestSelectors(); - if (is_null($parentSelectors)) { - // kill parent reference in top level selector - foreach ($selectors as &$s) { - $this->expandParentSelectors($s, ""); - } - - return $selectors; - } - - $out = array(); - foreach ($parentSelectors as $parent) { - foreach ($selectors as $child) { - $count = $this->expandParentSelectors($child, $parent); - - // don't prepend the parent tag if & was used - if ($count > 0) { - $out[] = trim($child); - } else { - $out[] = trim($parent . ' ' . $child); - } - } - } - - return $out; - } - - // reduces selector expressions - protected function compileSelectors($selectors) { - $out = array(); - - foreach ($selectors as $s) { - if (is_array($s)) { - list(, $value) = $s; - $out[] = trim($this->compileValue($this->reduce($value))); - } else { - $out[] = $s; - } - } - - return $out; - } - - protected function eq($left, $right) { - return $left == $right; - } - - protected function patternMatch($block, $orderedArgs, $keywordArgs) { - // match the guards if it has them - // any one of the groups must have all its guards pass for a match - if (!empty($block->guards)) { - $groupPassed = false; - foreach ($block->guards as $guardGroup) { - foreach ($guardGroup as $guard) { - $this->pushEnv(); - $this->zipSetArgs($block->args, $orderedArgs, $keywordArgs); - - $negate = false; - if ($guard[0] == "negate") { - $guard = $guard[1]; - $negate = true; - } - - $passed = $this->reduce($guard) == self::$TRUE; - if ($negate) $passed = !$passed; - - $this->popEnv(); - - if ($passed) { - $groupPassed = true; - } else { - $groupPassed = false; - break; - } - } - - if ($groupPassed) break; - } - - if (!$groupPassed) { - return false; - } - } - - if (empty($block->args)) { - return $block->isVararg || empty($orderedArgs) && empty($keywordArgs); - } - - $remainingArgs = $block->args; - if ($keywordArgs) { - $remainingArgs = array(); - foreach ($block->args as $arg) { - if ($arg[0] == "arg" && isset($keywordArgs[$arg[1]])) { - continue; - } - - $remainingArgs[] = $arg; - } - } - - $i = -1; // no args - // try to match by arity or by argument literal - foreach ($remainingArgs as $i => $arg) { - switch ($arg[0]) { - case "lit": - if (empty($orderedArgs[$i]) || !$this->eq($arg[1], $orderedArgs[$i])) { - return false; - } - break; - case "arg": - // no arg and no default value - if (!isset($orderedArgs[$i]) && !isset($arg[2])) { - return false; - } - break; - case "rest": - $i--; // rest can be empty - break 2; - } - } - - if ($block->isVararg) { - return true; // not having enough is handled above - } else { - $numMatched = $i + 1; - // greater than becuase default values always match - $orderedArgsCount = is_countable( $orderedArgs ) ? count( $orderedArgs ) : 0; - return $numMatched >= $orderedArgsCount; - } - } - - protected function patternMatchAll($blocks, $orderedArgs, $keywordArgs, $skip=array()) { - $matches = null; - foreach ($blocks as $block) { - // skip seen blocks that don't have arguments - if (isset($skip[$block->id]) && !isset($block->args)) { - continue; - } - - if ($this->patternMatch($block, $orderedArgs, $keywordArgs)) { - $matches[] = $block; - } - } - - return $matches; - } - - // attempt to find blocks matched by path and args - protected function findBlocks($searchIn, $path, $orderedArgs, $keywordArgs, $seen=array()) { - if ($searchIn == null) return null; - if (isset($seen[$searchIn->id])) return null; - $seen[$searchIn->id] = true; - - $name = $path[0]; - - if (isset($searchIn->children[$name])) { - $blocks = $searchIn->children[$name]; - if ( is_countable( $path ) && count( $path ) == 1 ) { - $matches = $this->patternMatchAll($blocks, $orderedArgs, $keywordArgs, $seen); - if (!empty($matches)) { - // This will return all blocks that match in the closest - // scope that has any matching block, like lessjs - return $matches; - } - } else { - $matches = array(); - foreach ($blocks as $subBlock) { - $subMatches = $this->findBlocks($subBlock, - array_slice($path, 1), $orderedArgs, $keywordArgs, $seen); - - if (!is_null($subMatches)) { - foreach ($subMatches as $sm) { - $matches[] = $sm; - } - } - } - - return count($matches) > 0 ? $matches : null; - } - } - if ($searchIn->parent === $searchIn) return null; - return $this->findBlocks($searchIn->parent, $path, $orderedArgs, $keywordArgs, $seen); - } - - // sets all argument names in $args to either the default value - // or the one passed in through $values - protected function zipSetArgs($args, $orderedValues, $keywordValues) { - $assignedValues = array(); - - $i = 0; - foreach ($args as $a) { - if ($a[0] == "arg") { - if (isset($keywordValues[$a[1]])) { - // has keyword arg - $value = $keywordValues[$a[1]]; - } elseif (isset($orderedValues[$i])) { - // has ordered arg - $value = $orderedValues[$i]; - $i++; - } elseif (isset($a[2])) { - // has default value - $value = $a[2]; - } else { - $this->throwError("Failed to assign arg " . $a[1]); - $value = null; // :( - } - - $value = $this->reduce($value); - $this->set($a[1], $value); - $assignedValues[] = $value; - } else { - // a lit - $i++; - } - } - - // check for a rest - $last = end($args); - if ($last[0] == "rest") { - $argsCount = is_countable( $args ) ? count( $args ) : 0; - $rest = array_slice($orderedValues, $argsCount - 1); - $this->set($last[1], $this->reduce(array("list", " ", $rest))); - } - - // wow is this the only true use of PHP's + operator for arrays? - $this->env->arguments = $assignedValues + $orderedValues; - } - - // compile a prop and update $lines or $blocks appropriately - protected function compileProp($prop, $block, $out) { - // set error position context - $this->sourceLoc = isset($prop[-1]) ? $prop[-1] : -1; - - switch ($prop[0]) { - case 'assign': - list(, $name, $value) = $prop; - if ($name[0] == $this->vPrefix) { - $this->set($name, $value); - } else { - $out->lines[] = $this->formatter->property($name, - $this->compileValue($this->reduce($value))); - } - break; - case 'block': - list(, $child) = $prop; - $this->compileBlock($child); - break; - case 'mixin': - list(, $path, $args, $suffix) = $prop; - - $orderedArgs = array(); - $keywordArgs = array(); - foreach ((array)$args as $arg) { - $argval = null; - switch ($arg[0]) { - case "arg": - if (!isset($arg[2])) { - $orderedArgs[] = $this->reduce(array("variable", $arg[1])); - } else { - $keywordArgs[$arg[1]] = $this->reduce($arg[2]); - } - break; - - case "lit": - $orderedArgs[] = $this->reduce($arg[1]); - break; - default: - $this->throwError("Unknown arg type: " . $arg[0]); - } - } - - $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs); - - if ($mixins === null) { - $this->throwError("{$prop[1][0]} is undefined"); - } - - foreach ($mixins as $mixin) { - if ($mixin === $block && !$orderedArgs) { - continue; - } - - $haveScope = false; - if (isset($mixin->parent->scope)) { - $haveScope = true; - $mixinParentEnv = $this->pushEnv(); - $mixinParentEnv->storeParent = $mixin->parent->scope; - } - - $haveArgs = false; - if (isset($mixin->args)) { - $haveArgs = true; - $this->pushEnv(); - $this->zipSetArgs($mixin->args, $orderedArgs, $keywordArgs); - } - - $oldParent = $mixin->parent; - if ($mixin != $block) $mixin->parent = $block; - - foreach ($this->sortProps($mixin->props) as $subProp) { - if ($suffix !== null && - $subProp[0] == "assign" && - is_string($subProp[1]) && - $subProp[1][0] != $this->vPrefix) - { - $subProp[2] = array( - 'list', ' ', - array($subProp[2], array('keyword', $suffix)) - ); - } - - $this->compileProp($subProp, $mixin, $out); - } - - $mixin->parent = $oldParent; - - if ($haveArgs) $this->popEnv(); - if ($haveScope) $this->popEnv(); - } - - break; - case 'raw': - $out->lines[] = $prop[1]; - break; - case "directive": - list(, $name, $value) = $prop; - $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';'; - break; - case "comment": - $out->lines[] = $prop[1]; - break; - case "import"; - list(, $importPath, $importId) = $prop; - $importPath = $this->reduce($importPath); - - if (!isset($this->env->imports)) { - $this->env->imports = array(); - } - - $result = $this->tryImport($importPath, $block, $out); - - $this->env->imports[$importId] = $result === false ? - array(false, "@import " . $this->compileValue($importPath).";") : - $result; - - break; - case "import_mixin": - list(,$importId) = $prop; - $import = $this->env->imports[$importId]; - if ($import[0] === false) { - if (isset($import[1])) { - $out->lines[] = $import[1]; - } - } else { - list(, $bottom, $parser, $importDir) = $import; - $this->compileImportedProps($bottom, $block, $out, $parser, $importDir); - } - - break; - default: - $this->throwError("unknown op: {$prop[0]}\n"); - } - } - - - /** - * Compiles a primitive value into a CSS property value. - * - * Values in lessphp are typed by being wrapped in arrays, their format is - * typically: - * - * array(type, contents [, additional_contents]*) - * - * The input is expected to be reduced. This function will not work on - * things like expressions and variables. - */ - public function compileValue($value) { - switch ($value[0]) { - case 'list': - // [1] - delimiter - // [2] - array of values - return implode($value[1], array_map(array($this, 'compileValue'), $value[2])); - case 'raw_color': - if (!empty($this->formatter->compressColors)) { - return $this->compileValue($this->coerceColor($value)); - } - return $value[1]; - case 'keyword': - // [1] - the keyword - return $value[1]; - case 'number': - list(, $num, $unit) = $value; - // [1] - the number - // [2] - the unit - if ($this->numberPrecision !== null) { - $num = round($num, $this->numberPrecision); - } - return $num . $unit; - case 'string': - // [1] - contents of string (includes quotes) - list(, $delim, $content) = $value; - foreach ($content as &$part) { - if (is_array($part)) { - $part = $this->compileValue($part); - } - } - return $delim . implode($content) . $delim; - case 'color': - // [1] - red component (either number or a %) - // [2] - green component - // [3] - blue component - // [4] - optional alpha component - list(, $r, $g, $b) = $value; - $r = round($r); - $g = round($g); - $b = round($b); - - if ( is_countable( $value ) && count( $value ) == 5 && $value[4] != 1 ) { // rgba - return 'rgba('.$r.','.$g.','.$b.','.$value[4].')'; - } - - $h = sprintf("#%02x%02x%02x", $r, $g, $b); - - if (!empty($this->formatter->compressColors)) { - // Converting hex color to short notation (e.g. #003399 to #039) - if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) { - $h = '#' . $h[1] . $h[3] . $h[5]; - } - } - - return $h; - - case 'function': - list(, $name, $args) = $value; - return $name.'('.$this->compileValue($args).')'; - default: // assumed to be unit - $this->throwError("unknown value type: $value[0]"); - } - } - - protected function lib_pow($args) { - list($base, $exp) = $this->assertArgs($args, 2, "pow"); - return pow($this->assertNumber($base), $this->assertNumber($exp)); - } - - protected function lib_pi() { - return pi(); - } - - protected function lib_mod($args) { - list($a, $b) = $this->assertArgs($args, 2, "mod"); - return $this->assertNumber($a) % $this->assertNumber($b); - } - - protected function lib_tan($num) { - return tan($this->assertNumber($num)); - } - - protected function lib_sin($num) { - return sin($this->assertNumber($num)); - } - - protected function lib_cos($num) { - return cos($this->assertNumber($num)); - } - - protected function lib_atan($num) { - $num = atan($this->assertNumber($num)); - return array("number", $num, "rad"); - } - - protected function lib_asin($num) { - $num = asin($this->assertNumber($num)); - return array("number", $num, "rad"); - } - - protected function lib_acos($num) { - $num = acos($this->assertNumber($num)); - return array("number", $num, "rad"); - } - - protected function lib_sqrt($num) { - return sqrt($this->assertNumber($num)); - } - - protected function lib_extract($value) { - list($list, $idx) = $this->assertArgs($value, 2, "extract"); - $idx = $this->assertNumber($idx); - // 1 indexed - if ($list[0] == "list" && isset($list[2][$idx - 1])) { - return $list[2][$idx - 1]; - } - } - - protected function lib_isnumber($value) { - return $this->toBool($value[0] == "number"); - } - - protected function lib_isstring($value) { - return $this->toBool($value[0] == "string"); - } - - protected function lib_iscolor($value) { - return $this->toBool($this->coerceColor($value)); - } - - protected function lib_iskeyword($value) { - return $this->toBool($value[0] == "keyword"); - } - - protected function lib_ispixel($value) { - return $this->toBool($value[0] == "number" && $value[2] == "px"); - } - - protected function lib_ispercentage($value) { - return $this->toBool($value[0] == "number" && $value[2] == "%"); - } - - protected function lib_isem($value) { - return $this->toBool($value[0] == "number" && $value[2] == "em"); - } - - protected function lib_isrem($value) { - return $this->toBool($value[0] == "number" && $value[2] == "rem"); - } - - protected function lib_rgbahex($color) { - $color = $this->coerceColor($color); - if (is_null($color)) - $this->throwError("color expected for rgbahex"); - - return sprintf("#%02x%02x%02x%02x", - isset($color[4]) ? $color[4]*255 : 255, - $color[1],$color[2], $color[3]); - } - - protected function lib_argb($color){ - return $this->lib_rgbahex($color); - } - - /** - * Given an url, decide whether to output a regular link or the base64-encoded contents of the file - * - * @param array $value either an argument list (two strings) or a single string - * @return string formatted url(), either as a link or base64-encoded - */ - protected function lib_data_uri($value) { - $mime = ($value[0] === 'list') ? $value[2][0][2] : null; - $url = ($value[0] === 'list') ? $value[2][1][2][0] : $value[2][0]; - - $fullpath = $this->findImport($url); - - if($fullpath && ($fsize = filesize($fullpath)) !== false) { - // IE8 can't handle data uris larger than 32KB - if($fsize/1024 < 32) { - if(is_null($mime)) { - $mime = jetpack_mime_content_type( $fullpath ); - } - - if(!is_null($mime)) // fallback if the mime type is still unknown - $url = sprintf('data:%s;base64,%s', $mime, base64_encode(file_get_contents($fullpath))); - } - } - - return 'url("'.$url.'")'; - } - - // utility func to unquote a string - protected function lib_e($arg) { - switch ($arg[0]) { - case "list": - $items = $arg[2]; - if (isset($items[0])) { - return $this->lib_e($items[0]); - } - $this->throwError("unrecognised input"); - case "string": - $arg[1] = ""; - return $arg; - case "keyword": - return $arg; - default: - return array("keyword", $this->compileValue($arg)); - } - } - - protected function lib__sprintf($args) { - if ($args[0] != "list") return $args; - $values = $args[2]; - $string = array_shift($values); - $template = $this->compileValue($this->lib_e($string)); - - $i = 0; - if (preg_match_all('/%[dsa]/', $template, $m)) { - foreach ($m[0] as $match) { - $val = isset($values[$i]) ? - $this->reduce($values[$i]) : array('keyword', ''); - - // lessjs compat, renders fully expanded color, not raw color - if ($color = $this->coerceColor($val)) { - $val = $color; - } - - $i++; - $rep = $this->compileValue($this->lib_e($val)); - $template = preg_replace('/'.self::preg_quote($match).'/', - $rep, $template, 1); - } - } - - $d = $string[0] == "string" ? $string[1] : '"'; - return array("string", $d, array($template)); - } - - protected function lib_floor($arg) { - $value = $this->assertNumber($arg); - return array("number", floor($value), $arg[2]); - } - - protected function lib_ceil($arg) { - $value = $this->assertNumber($arg); - return array("number", ceil($value), $arg[2]); - } - - protected function lib_round($arg) { - if($arg[0] != "list") { - $value = $this->assertNumber($arg); - return array("number", round($value), $arg[2]); - } else { - $value = $this->assertNumber($arg[2][0]); - $precision = $this->assertNumber($arg[2][1]); - return array("number", round($value, $precision), $arg[2][0][2]); - } - } - - protected function lib_unit($arg) { - if ($arg[0] == "list") { - list($number, $newUnit) = $arg[2]; - return array("number", $this->assertNumber($number), - $this->compileValue($this->lib_e($newUnit))); - } else { - return array("number", $this->assertNumber($arg), ""); - } - } - - /** - * Helper function to get arguments for color manipulation functions. - * takes a list that contains a color like thing and a percentage - */ - public function colorArgs($args) { - if ( $args[0] != 'list' || ! is_countable( $args[2] ) || count( $args[2] ) < 2 ) { - return array(array('color', 0, 0, 0), 0); - } - list($color, $delta) = $args[2]; - $color = $this->assertColor($color); - $delta = (float) $delta[1]; - - return array($color, $delta); - } - - protected function lib_darken($args) { - list($color, $delta) = $this->colorArgs($args); - - $hsl = $this->toHSL($color); - $hsl[3] = $this->clamp($hsl[3] - $delta, 100); - return $this->toRGB($hsl); - } - - protected function lib_lighten($args) { - list($color, $delta) = $this->colorArgs($args); - - $hsl = $this->toHSL($color); - $hsl[3] = $this->clamp($hsl[3] + $delta, 100); - return $this->toRGB($hsl); - } - - protected function lib_saturate($args) { - list($color, $delta) = $this->colorArgs($args); - - $hsl = $this->toHSL($color); - $hsl[2] = $this->clamp($hsl[2] + $delta, 100); - return $this->toRGB($hsl); - } - - protected function lib_desaturate($args) { - list($color, $delta) = $this->colorArgs($args); - - $hsl = $this->toHSL($color); - $hsl[2] = $this->clamp($hsl[2] - $delta, 100); - return $this->toRGB($hsl); - } - - protected function lib_spin($args) { - list($color, $delta) = $this->colorArgs($args); - - $hsl = $this->toHSL($color); - - $hsl[1] = $hsl[1] + $delta % 360; - if ($hsl[1] < 0) $hsl[1] += 360; - - return $this->toRGB($hsl); - } - - protected function lib_fadeout($args) { - list($color, $delta) = $this->colorArgs($args); - $color[4] = $this->clamp((isset($color[4]) ? $color[4] : 1) - $delta/100); - return $color; - } - - protected function lib_fadein($args) { - list($color, $delta) = $this->colorArgs($args); - $color[4] = $this->clamp((isset($color[4]) ? $color[4] : 1) + $delta/100); - return $color; - } - - protected function lib_hue($color) { - $hsl = $this->toHSL($this->assertColor($color)); - return round($hsl[1]); - } - - protected function lib_saturation($color) { - $hsl = $this->toHSL($this->assertColor($color)); - return round($hsl[2]); - } - - protected function lib_lightness($color) { - $hsl = $this->toHSL($this->assertColor($color)); - return round($hsl[3]); - } - - // get the alpha of a color - // defaults to 1 for non-colors or colors without an alpha - protected function lib_alpha($value) { - if (!is_null($color = $this->coerceColor($value))) { - return isset($color[4]) ? $color[4] : 1; - } - } - - // set the alpha of the color - protected function lib_fade($args) { - list($color, $alpha) = $this->colorArgs($args); - $color[4] = $this->clamp($alpha / 100.0); - return $color; - } - - protected function lib_percentage($arg) { - $num = $this->assertNumber($arg); - return array("number", $num*100, "%"); - } - - // mixes two colors by weight - // mix(@color1, @color2, [@weight: 50%]); - // https://sass-lang.com/documentation/functions/color#mix - protected function lib_mix($args) { - if ( $args[0] != "list" || ! is_countable( $args[2] ) || count( $args[2] ) < 2 ) { - $this->throwError("mix expects (color1, color2, weight)"); - } - - list($first, $second) = $args[2]; - $first = $this->assertColor($first); - $second = $this->assertColor($second); - - $first_a = $this->lib_alpha($first); - $second_a = $this->lib_alpha($second); - - if (isset($args[2][2])) { - $weight = $args[2][2][1] / 100.0; - } else { - $weight = 0.5; - } - - $w = $weight * 2 - 1; - $a = $first_a - $second_a; - - $w1 = (($w * $a == -1 ? $w : ($w + $a)/(1 + $w * $a)) + 1) / 2.0; - $w2 = 1.0 - $w1; - - $new = array('color', - $w1 * $first[1] + $w2 * $second[1], - $w1 * $first[2] + $w2 * $second[2], - $w1 * $first[3] + $w2 * $second[3], - ); - - if ($first_a != 1.0 || $second_a != 1.0) { - $new[] = $first_a * $weight + $second_a * ($weight - 1); - } - - return $this->fixColor($new); - } - - protected function lib_contrast($args) { - $darkColor = array('color', 0, 0, 0); - $lightColor = array('color', 255, 255, 255); - $threshold = 0.43; - - if ( $args[0] == 'list' ) { - $inputColor = ( isset($args[2][0]) ) ? $this->assertColor($args[2][0]) : $lightColor; - $darkColor = ( isset($args[2][1]) ) ? $this->assertColor($args[2][1]) : $darkColor; - $lightColor = ( isset($args[2][2]) ) ? $this->assertColor($args[2][2]) : $lightColor; - $threshold = ( isset($args[2][3]) ) ? $this->assertNumber($args[2][3]) : $threshold; - } - else { - $inputColor = $this->assertColor($args); - } - - $inputColor = $this->coerceColor($inputColor); - $darkColor = $this->coerceColor($darkColor); - $lightColor = $this->coerceColor($lightColor); - - //Figure out which is actually light and dark! - if ( $this->lib_luma($darkColor) > $this->lib_luma($lightColor) ) { - $t = $lightColor; - $lightColor = $darkColor; - $darkColor = $t; - } - - $inputColor_alpha = $this->lib_alpha($inputColor); - if ( ( $this->lib_luma($inputColor) * $inputColor_alpha) < $threshold) { - return $lightColor; - } - return $darkColor; - } - - protected function lib_luma($color) { - $color = $this->coerceColor($color); - return (0.2126 * $color[0] / 255) + (0.7152 * $color[1] / 255) + (0.0722 * $color[2] / 255); - } - - - public function assertColor($value, $error = "expected color value") { - $color = $this->coerceColor($value); - if (is_null($color)) $this->throwError($error); - return $color; - } - - public function assertNumber($value, $error = "expecting number") { - if ($value[0] == "number") return $value[1]; - $this->throwError($error); - } - - public function assertArgs($value, $expectedArgs, $name="") { - if ($expectedArgs == 1) { - return $value; - } else { - if ($value[0] !== "list" || $value[1] != ",") $this->throwError("expecting list"); - $values = $value[2]; - $numValues = is_countable( $values ) ? count( $values ) : 0; - if ($expectedArgs != $numValues) { - if ($name) { - $name = $name . ": "; - } - - $this->throwError("${name}expecting $expectedArgs arguments, got $numValues"); - } - - return $values; - } - } - - protected function toHSL($color) { - if ($color[0] == 'hsl') return $color; - - $r = $color[1] / 255; - $g = $color[2] / 255; - $b = $color[3] / 255; - - $min = min($r, $g, $b); - $max = max($r, $g, $b); - - $L = ($min + $max) / 2; - if ($min == $max) { - $S = $H = 0; - } else { - if ($L < 0.5) - $S = ($max - $min)/($max + $min); - else - $S = ($max - $min)/(2.0 - $max - $min); - - if ($r == $max) $H = ($g - $b)/($max - $min); - elseif ($g == $max) $H = 2.0 + ($b - $r)/($max - $min); - else $H = 4.0 + ($r - $g)/($max - $min); - - } - - $out = array('hsl', - ($H < 0 ? $H + 6 : $H)*60, - $S*100, - $L*100, - ); - - if ( is_countable( $color ) && count( $color ) > 4 ) { - $out[] = $color[4]; // copy alpha - } - return $out; - } - - protected function toRGB_helper($comp, $temp1, $temp2) { - if ($comp < 0) $comp += 1.0; - elseif ($comp > 1) $comp -= 1.0; - - if (6 * $comp < 1) return $temp1 + ($temp2 - $temp1) * 6 * $comp; - if (2 * $comp < 1) return $temp2; - if (3 * $comp < 2) return $temp1 + ($temp2 - $temp1)*((2/3) - $comp) * 6; - - return $temp1; - } - - /** - * Converts a hsl array into a color value in rgb. - * Expects H to be in range of 0 to 360, S and L in 0 to 100 - */ - protected function toRGB($color) { - if ($color[0] == 'color') return $color; - - $H = $color[1] / 360; - $S = $color[2] / 100; - $L = $color[3] / 100; - - if ($S == 0) { - $r = $g = $b = $L; - } else { - $temp2 = $L < 0.5 ? - $L*(1.0 + $S) : - $L + $S - $L * $S; - - $temp1 = 2.0 * $L - $temp2; - - $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2); - $g = $this->toRGB_helper($H, $temp1, $temp2); - $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2); - } - - // $out = array('color', round($r*255), round($g*255), round($b*255)); - $out = array('color', $r*255, $g*255, $b*255); - if ( is_countable( $color ) && count( $color ) > 4 ) { - $out[] = $color[4]; // copy alpha - } - return $out; - } - - protected function clamp($v, $max = 1, $min = 0) { - return min($max, max($min, $v)); - } - - /** - * Convert the rgb, rgba, hsl color literals of function type - * as returned by the parser into values of color type. - */ - protected function funcToColor($func) { - $fname = $func[1]; - if ($func[2][0] != 'list') return false; // need a list of arguments - $rawComponents = $func[2][2]; - - if ($fname == 'hsl' || $fname == 'hsla') { - $hsl = array('hsl'); - $i = 0; - foreach ($rawComponents as $c) { - $val = $this->reduce($c); - $val = isset( $val[1] ) ? (float) $val[1] : 0; - - if ($i == 0) $clamp = 360; - elseif ($i < 3) $clamp = 100; - else $clamp = 1; - - $hsl[] = $this->clamp($val, $clamp); - $i++; - } - - while (count($hsl) < 4) $hsl[] = 0; - return $this->toRGB($hsl); - - } elseif ($fname == 'rgb' || $fname == 'rgba') { - $components = array(); - $i = 1; - foreach ($rawComponents as $c) { - $c = $this->reduce($c); - if ($i < 4) { - if ($c[0] == "number" && $c[2] == "%") { - $components[] = 255 * ($c[1] / 100); - } else { - $components[] = (float) $c[1]; - } - } elseif ($i == 4) { - if ($c[0] == "number" && $c[2] == "%") { - $components[] = 1.0 * ($c[1] / 100); - } else { - $components[] = (float) $c[1]; - } - } else break; - - $i++; - } - while (count($components) < 3) $components[] = 0; - array_unshift($components, 'color'); - return $this->fixColor($components); - } - - return false; - } - - protected function reduce($value, $forExpression = false) { - switch ($value[0]) { - case "interpolate": - $reduced = $this->reduce($value[1]); - $var = $this->compileValue($reduced); - $res = $this->reduce(array("variable", $this->vPrefix . $var)); - - if ($res[0] == "raw_color") { - $res = $this->coerceColor($res); - } - - if (empty($value[2])) $res = $this->lib_e($res); - - return $res; - case "variable": - $key = $value[1]; - if (is_array($key)) { - $key = $this->reduce($key); - $key = $this->vPrefix . $this->compileValue($this->lib_e($key)); - } - - $seen =& $this->env->seenNames; - - if (!empty($seen[$key])) { - $this->throwError("infinite loop detected: $key"); - } - - $seen[$key] = true; - $out = $this->reduce($this->get($key)); - $seen[$key] = false; - return $out; - case "list": - foreach ($value[2] as &$item) { - $item = $this->reduce($item, $forExpression); - } - return $value; - case "expression": - return $this->evaluate($value); - case "string": - foreach ($value[2] as &$part) { - if (is_array($part)) { - $strip = $part[0] == "variable"; - $part = $this->reduce($part); - if ($strip) $part = $this->lib_e($part); - } - } - return $value; - case "escape": - list(,$inner) = $value; - return $this->lib_e($this->reduce($inner)); - case "function": - $color = $this->funcToColor($value); - if ($color) return $color; - - list(, $name, $args) = $value; - if ($name == "%") $name = "_sprintf"; - - $f = isset($this->libFunctions[$name]) ? - $this->libFunctions[$name] : array($this, 'lib_'.str_replace('-', '_', $name)); - - if (is_callable($f)) { - if ($args[0] == 'list') - $args = self::compressList($args[2], $args[1]); - - $ret = call_user_func($f, $this->reduce($args, true), $this); - - if (is_null($ret)) { - return array("string", "", array( - $name, "(", $args, ")" - )); - } - - // convert to a typed value if the result is a php primitive - if (is_numeric($ret)) $ret = array('number', $ret, ""); - elseif (!is_array($ret)) $ret = array('keyword', $ret); - - return $ret; - } - - // plain function, reduce args - $value[2] = $this->reduce($value[2]); - return $value; - case "unary": - list(, $op, $exp) = $value; - $exp = $this->reduce($exp); - - if ($exp[0] == "number") { - switch ($op) { - case "+": - return $exp; - case "-": - $exp[1] *= -1; - return $exp; - } - } - return array("string", "", array($op, $exp)); - } - - if ($forExpression) { - switch ($value[0]) { - case "keyword": - if ($color = $this->coerceColor($value)) { - return $color; - } - break; - case "raw_color": - return $this->coerceColor($value); - } - } - - return $value; - } - - - // coerce a value for use in color operation - protected function coerceColor($value) { - switch($value[0]) { - case 'color': return $value; - case 'raw_color': - $c = array("color", 0, 0, 0); - $colorStr = substr($value[1], 1); - $num = hexdec($colorStr); - $width = strlen($colorStr) == 3 ? 16 : 256; - - for ($i = 3; $i > 0; $i--) { // 3 2 1 - $t = $num % $width; - $num /= $width; - - $c[$i] = $t * (256/$width) + $t * floor(16/$width); - } - - return $c; - case 'keyword': - $name = $value[1]; - if (isset(self::$cssColors[$name])) { - $rgba = explode(',', self::$cssColors[$name]); - - if(isset($rgba[3])) - return array('color', $rgba[0], $rgba[1], $rgba[2], $rgba[3]); - - return array('color', $rgba[0], $rgba[1], $rgba[2]); - } - return null; - } - } - - // make something string like into a string - protected function coerceString($value) { - switch ($value[0]) { - case "string": - return $value; - case "keyword": - return array("string", "", array($value[1])); - } - return null; - } - - // turn list of length 1 into value type - protected function flattenList($value) { - if ( $value[0] == "list" && is_countable( $value[2] ) && count( $value[2] ) == 1 ) { - return $this->flattenList($value[2][0]); - } - return $value; - } - - public function toBool($a) { - if ($a) return self::$TRUE; - else return self::$FALSE; - } - - // evaluate an expression - protected function evaluate($exp) { - list(, $op, $left, $right, $whiteBefore, $whiteAfter) = $exp; - - $left = $this->reduce($left, true); - $right = $this->reduce($right, true); - - if ($leftColor = $this->coerceColor($left)) { - $left = $leftColor; - } - - if ($rightColor = $this->coerceColor($right)) { - $right = $rightColor; - } - - $ltype = $left[0]; - $rtype = $right[0]; - - // operators that work on all types - if ($op == "and") { - return $this->toBool($left == self::$TRUE && $right == self::$TRUE); - } - - if ($op == "=") { - return $this->toBool($this->eq($left, $right) ); - } - - if ($op == "+" && !is_null($str = $this->stringConcatenate($left, $right))) { - return $str; - } - - // type based operators - $fname = "op_${ltype}_${rtype}"; - if (is_callable(array($this, $fname))) { - $out = $this->$fname($op, $left, $right); - if (!is_null($out)) return $out; - } - - // make the expression look it did before being parsed - $paddedOp = $op; - if ($whiteBefore) $paddedOp = " " . $paddedOp; - if ($whiteAfter) $paddedOp .= " "; - - return array("string", "", array($left, $paddedOp, $right)); - } - - protected function stringConcatenate($left, $right) { - if ($strLeft = $this->coerceString($left)) { - if ($right[0] == "string") { - $right[1] = ""; - } - $strLeft[2][] = $right; - return $strLeft; - } - - if ($strRight = $this->coerceString($right)) { - array_unshift($strRight[2], $left); - return $strRight; - } - } - - - // make sure a color's components don't go out of bounds - protected function fixColor($c) { - foreach (range(1, 3) as $i) { - if ($c[$i] < 0) $c[$i] = 0; - if ($c[$i] > 255) $c[$i] = 255; - } - - return $c; - } - - protected function op_number_color($op, $lft, $rgt) { - if ($op == '+' || $op == '*') { - return $this->op_color_number($op, $rgt, $lft); - } - } - - protected function op_color_number($op, $lft, $rgt) { - if ($rgt[0] == '%') $rgt[1] /= 100; - - $lftCount = is_countable( $lft ) ? count( $lft ) : 1; - return $this->op_color_color($op, $lft, - array_fill(1, $lftCount - 1, $rgt[1])); - } - - protected function op_color_color($op, $left, $right) { - $out = array('color'); - $leftCount = is_countable( $left ) ? count( $left ) : 0; - $rightCount = is_countable( $right ) ? count( $right) : 0; - $max = $leftCount > $rightCount ? $leftCount : $rightCount; - foreach (range(1, $max - 1) as $i) { - $lval = isset($left[$i]) ? $left[$i] : 0; - $rval = isset($right[$i]) ? $right[$i] : 0; - switch ($op) { - case '+': - $out[] = $lval + $rval; - break; - case '-': - $out[] = $lval - $rval; - break; - case '*': - $out[] = $lval * $rval; - break; - case '%': - $out[] = $lval % $rval; - break; - case '/': - if ($rval == 0) $this->throwError("evaluate error: can't divide by zero"); - $out[] = $lval / $rval; - break; - default: - $this->throwError('evaluate error: color op number failed on op '.$op); - } - } - return $this->fixColor($out); - } - - function lib_red($color){ - $color = $this->coerceColor($color); - if (is_null($color)) { - $this->throwError('color expected for red()'); - } - - return $color[1]; - } - - function lib_green($color){ - $color = $this->coerceColor($color); - if (is_null($color)) { - $this->throwError('color expected for green()'); - } - - return $color[2]; - } - - function lib_blue($color){ - $color = $this->coerceColor($color); - if (is_null($color)) { - $this->throwError('color expected for blue()'); - } - - return $color[3]; - } - - - // operator on two numbers - protected function op_number_number($op, $left, $right) { - $unit = empty($left[2]) ? $right[2] : $left[2]; - - $value = 0; - switch ($op) { - case '+': - $value = $left[1] + $right[1]; - break; - case '*': - $value = $left[1] * $right[1]; - break; - case '-': - $value = $left[1] - $right[1]; - break; - case '%': - $value = $left[1] % $right[1]; - break; - case '/': - if ($right[1] == 0) $this->throwError('parse error: divide by zero'); - $value = $left[1] / $right[1]; - break; - case '<': - return $this->toBool($left[1] < $right[1]); - case '>': - return $this->toBool($left[1] > $right[1]); - case '>=': - return $this->toBool($left[1] >= $right[1]); - case '=<': - return $this->toBool($left[1] <= $right[1]); - default: - $this->throwError('parse error: unknown number operator: '.$op); - } - - return array("number", $value, $unit); - } - - - /* environment functions */ - - protected function makeOutputBlock($type, $selectors = null) { - $b = new stdclass; - $b->lines = array(); - $b->children = array(); - $b->selectors = $selectors; - $b->type = $type; - $b->parent = $this->scope; - return $b; - } - - // the state of execution - protected function pushEnv($block = null) { - $e = new stdclass; - $e->parent = $this->env; - $e->store = array(); - $e->block = $block; - - $this->env = $e; - return $e; - } - - // pop something off the stack - protected function popEnv() { - $old = $this->env; - $this->env = $this->env->parent; - return $old; - } - - // set something in the current env - protected function set($name, $value) { - $this->env->store[$name] = $value; - } - - - // get the highest occurrence entry for a name - protected function get($name) { - $current = $this->env; - - $isArguments = $name == $this->vPrefix . 'arguments'; - while ($current) { - if ($isArguments && isset($current->arguments)) { - return array('list', ' ', $current->arguments); - } - - if (isset($current->store[$name])) - return $current->store[$name]; - else { - $current = isset($current->storeParent) ? - $current->storeParent : $current->parent; - } - } - - $this->throwError("variable $name is undefined"); - } - - // inject array of unparsed strings into environment as variables - protected function injectVariables($args) { - $this->pushEnv(); - $parser = new lessc_parser($this, __METHOD__); - foreach ($args as $name => $strValue) { - if ($name[0] != '@') $name = '@'.$name; - $parser->count = 0; - $parser->buffer = (string)$strValue; - if (!$parser->propertyValue($value)) { - throw new Exception("failed to parse passed in variable $name: $strValue"); - } - - $this->set($name, $value); - } - } - - /** - * Initialize any static state, can initialize parser for a file - * $opts isn't used yet - */ - public function __construct($fname = null) { - if ($fname !== null) { - // used for deprecated parse method - $this->_parseFile = $fname; - } - } - - public function compile($string, $name = null) { - $locale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); - - $this->parser = $this->makeParser($name); - $root = $this->parser->parse($string); - - $this->env = null; - $this->scope = null; - - $this->formatter = $this->newFormatter(); - - if (!empty($this->registeredVars)) { - $this->injectVariables($this->registeredVars); - } - - $this->sourceParser = $this->parser; // used for error messages - $this->compileBlock($root); - - ob_start(); - $this->formatter->block($this->scope); - $out = ob_get_clean(); - setlocale(LC_NUMERIC, $locale); - return $out; - } - - public function compileFile($fname, $outFname = null) { - if (!is_readable($fname)) { - throw new Exception('load error: failed to find '.$fname); - } - - $pi = pathinfo($fname); - - $oldImport = $this->importDir; - - $this->importDir = (array)$this->importDir; - $this->importDir[] = $pi['dirname'].'/'; - - $this->addParsedFile($fname); - - $out = $this->compile(file_get_contents($fname), $fname); - - $this->importDir = $oldImport; - - if ($outFname !== null) { - return file_put_contents($outFname, $out); - } - - return $out; - } - - // compile only if changed input has changed or output doesn't exist - public function checkedCompile($in, $out) { - if (!is_file($out) || filemtime($in) > filemtime($out)) { - $this->compileFile($in, $out); - return true; - } - return false; - } - - /** - * Execute lessphp on a .less file or a lessphp cache structure - * - * The lessphp cache structure contains information about a specific - * less file having been parsed. It can be used as a hint for future - * calls to determine whether or not a rebuild is required. - * - * The cache structure contains two important keys that may be used - * externally: - * - * compiled: The final compiled CSS - * updated: The time (in seconds) the CSS was last compiled - * - * The cache structure is a plain-ol' PHP associative array and can - * be serialized and unserialized without a hitch. - * - * @param mixed $in Input - * @param bool $force Force rebuild? - * @return array lessphp cache structure - */ - public function cachedCompile($in, $force = false) { - // assume no root - $root = null; - - if (is_string($in)) { - $root = $in; - } elseif (is_array($in) and isset($in['root'])) { - if ($force or ! isset($in['files'])) { - // If we are forcing a recompile or if for some reason the - // structure does not contain any file information we should - // specify the root to trigger a rebuild. - $root = $in['root']; - } elseif (isset($in['files']) and is_array($in['files'])) { - foreach ($in['files'] as $fname => $ftime ) { - if (!file_exists($fname) or filemtime($fname) > $ftime) { - // One of the files we knew about previously has changed - // so we should look at our incoming root again. - $root = $in['root']; - break; - } - } - } - } else { - // TODO: Throw an exception? We got neither a string nor something - // that looks like a compatible lessphp cache structure. - return null; - } - - if ($root !== null) { - // If we have a root value which means we should rebuild. - $out = array(); - $out['root'] = $root; - $out['compiled'] = $this->compileFile($root); - $out['files'] = $this->allParsedFiles(); - $out['updated'] = time(); - return $out; - } else { - // No changes, pass back the structure - // we were given initially. - return $in; - } - - } - - // parse and compile buffer - // This is deprecated - public function parse($str = null, $initialVariables = null) { - if (is_array($str)) { - $initialVariables = $str; - $str = null; - } - - $oldVars = $this->registeredVars; - if ($initialVariables !== null) { - $this->setVariables($initialVariables); - } - - if ($str == null) { - if (empty($this->_parseFile)) { - throw new exception("nothing to parse"); - } - - $out = $this->compileFile($this->_parseFile); - } else { - $out = $this->compile($str); - } - - $this->registeredVars = $oldVars; - return $out; - } - - protected function makeParser($name) { - $parser = new lessc_parser($this, $name); - $parser->writeComments = $this->preserveComments; - - return $parser; - } - - public function setFormatter($name) { - $this->formatterName = $name; - } - - protected function newFormatter() { - $className = "lessc_formatter_lessjs"; - if (!empty($this->formatterName)) { - if (!is_string($this->formatterName)) - return $this->formatterName; - $className = "lessc_formatter_$this->formatterName"; - } - - return new $className; - } - - public function setPreserveComments($preserve) { - $this->preserveComments = $preserve; - } - - public function registerFunction($name, $func) { - $this->libFunctions[$name] = $func; - } - - public function unregisterFunction($name) { - unset($this->libFunctions[$name]); - } - - public function setVariables($variables) { - $this->registeredVars = array_merge($this->registeredVars, $variables); - } - - public function unsetVariable($name) { - unset($this->registeredVars[$name]); - } - - public function setImportDir($dirs) { - $this->importDir = (array)$dirs; - } - - public function addImportDir($dir) { - $this->importDir = (array)$this->importDir; - $this->importDir[] = $dir; - } - - public function allParsedFiles() { - return $this->allParsedFiles; - } - - public function addParsedFile($file) { - $this->allParsedFiles[realpath($file)] = filemtime($file); - } - - /** - * Uses the current value of $this->count to show line and line number - */ - public function throwError($msg = null) { - if ($this->sourceLoc >= 0) { - $this->sourceParser->throwError($msg, $this->sourceLoc); - } - throw new exception($msg); - } - - // compile file $in to file $out if $in is newer than $out - // returns true when it compiles, false otherwise - public static function ccompile($in, $out, $less = null) { - if ($less === null) { - $less = new self; - } - return $less->checkedCompile($in, $out); - } - - public static function cexecute($in, $force = false, $less = null) { - if ($less === null) { - $less = new self; - } - return $less->cachedCompile($in, $force); - } - - static protected $cssColors = array( - 'aliceblue' => '240,248,255', - 'antiquewhite' => '250,235,215', - 'aqua' => '0,255,255', - 'aquamarine' => '127,255,212', - 'azure' => '240,255,255', - 'beige' => '245,245,220', - 'bisque' => '255,228,196', - 'black' => '0,0,0', - 'blanchedalmond' => '255,235,205', - 'blue' => '0,0,255', - 'blueviolet' => '138,43,226', - 'brown' => '165,42,42', - 'burlywood' => '222,184,135', - 'cadetblue' => '95,158,160', - 'chartreuse' => '127,255,0', - 'chocolate' => '210,105,30', - 'coral' => '255,127,80', - 'cornflowerblue' => '100,149,237', - 'cornsilk' => '255,248,220', - 'crimson' => '220,20,60', - 'cyan' => '0,255,255', - 'darkblue' => '0,0,139', - 'darkcyan' => '0,139,139', - 'darkgoldenrod' => '184,134,11', - 'darkgray' => '169,169,169', - 'darkgreen' => '0,100,0', - 'darkgrey' => '169,169,169', - 'darkkhaki' => '189,183,107', - 'darkmagenta' => '139,0,139', - 'darkolivegreen' => '85,107,47', - 'darkorange' => '255,140,0', - 'darkorchid' => '153,50,204', - 'darkred' => '139,0,0', - 'darksalmon' => '233,150,122', - 'darkseagreen' => '143,188,143', - 'darkslateblue' => '72,61,139', - 'darkslategray' => '47,79,79', - 'darkslategrey' => '47,79,79', - 'darkturquoise' => '0,206,209', - 'darkviolet' => '148,0,211', - 'deeppink' => '255,20,147', - 'deepskyblue' => '0,191,255', - 'dimgray' => '105,105,105', - 'dimgrey' => '105,105,105', - 'dodgerblue' => '30,144,255', - 'firebrick' => '178,34,34', - 'floralwhite' => '255,250,240', - 'forestgreen' => '34,139,34', - 'fuchsia' => '255,0,255', - 'gainsboro' => '220,220,220', - 'ghostwhite' => '248,248,255', - 'gold' => '255,215,0', - 'goldenrod' => '218,165,32', - 'gray' => '128,128,128', - 'green' => '0,128,0', - 'greenyellow' => '173,255,47', - 'grey' => '128,128,128', - 'honeydew' => '240,255,240', - 'hotpink' => '255,105,180', - 'indianred' => '205,92,92', - 'indigo' => '75,0,130', - 'ivory' => '255,255,240', - 'khaki' => '240,230,140', - 'lavender' => '230,230,250', - 'lavenderblush' => '255,240,245', - 'lawngreen' => '124,252,0', - 'lemonchiffon' => '255,250,205', - 'lightblue' => '173,216,230', - 'lightcoral' => '240,128,128', - 'lightcyan' => '224,255,255', - 'lightgoldenrodyellow' => '250,250,210', - 'lightgray' => '211,211,211', - 'lightgreen' => '144,238,144', - 'lightgrey' => '211,211,211', - 'lightpink' => '255,182,193', - 'lightsalmon' => '255,160,122', - 'lightseagreen' => '32,178,170', - 'lightskyblue' => '135,206,250', - 'lightslategray' => '119,136,153', - 'lightslategrey' => '119,136,153', - 'lightsteelblue' => '176,196,222', - 'lightyellow' => '255,255,224', - 'lime' => '0,255,0', - 'limegreen' => '50,205,50', - 'linen' => '250,240,230', - 'magenta' => '255,0,255', - 'maroon' => '128,0,0', - 'mediumaquamarine' => '102,205,170', - 'mediumblue' => '0,0,205', - 'mediumorchid' => '186,85,211', - 'mediumpurple' => '147,112,219', - 'mediumseagreen' => '60,179,113', - 'mediumslateblue' => '123,104,238', - 'mediumspringgreen' => '0,250,154', - 'mediumturquoise' => '72,209,204', - 'mediumvioletred' => '199,21,133', - 'midnightblue' => '25,25,112', - 'mintcream' => '245,255,250', - 'mistyrose' => '255,228,225', - 'moccasin' => '255,228,181', - 'navajowhite' => '255,222,173', - 'navy' => '0,0,128', - 'oldlace' => '253,245,230', - 'olive' => '128,128,0', - 'olivedrab' => '107,142,35', - 'orange' => '255,165,0', - 'orangered' => '255,69,0', - 'orchid' => '218,112,214', - 'palegoldenrod' => '238,232,170', - 'palegreen' => '152,251,152', - 'paleturquoise' => '175,238,238', - 'palevioletred' => '219,112,147', - 'papayawhip' => '255,239,213', - 'peachpuff' => '255,218,185', - 'peru' => '205,133,63', - 'pink' => '255,192,203', - 'plum' => '221,160,221', - 'powderblue' => '176,224,230', - 'purple' => '128,0,128', - 'rebeccapurple' => '102,51,153', - 'red' => '255,0,0', - 'rosybrown' => '188,143,143', - 'royalblue' => '65,105,225', - 'saddlebrown' => '139,69,19', - 'salmon' => '250,128,114', - 'sandybrown' => '244,164,96', - 'seagreen' => '46,139,87', - 'seashell' => '255,245,238', - 'sienna' => '160,82,45', - 'silver' => '192,192,192', - 'skyblue' => '135,206,235', - 'slateblue' => '106,90,205', - 'slategray' => '112,128,144', - 'slategrey' => '112,128,144', - 'snow' => '255,250,250', - 'springgreen' => '0,255,127', - 'steelblue' => '70,130,180', - 'tan' => '210,180,140', - 'teal' => '0,128,128', - 'thistle' => '216,191,216', - 'tomato' => '255,99,71', - 'transparent' => '0,0,0,0', - 'turquoise' => '64,224,208', - 'violet' => '238,130,238', - 'wheat' => '245,222,179', - 'white' => '255,255,255', - 'whitesmoke' => '245,245,245', - 'yellow' => '255,255,0', - 'yellowgreen' => '154,205,50' - ); -} - -// responsible for taking a string of LESS code and converting it into a -// syntax tree -class lessc_parser { - static protected $nextBlockId = 0; // used to uniquely identify blocks - - static protected $precedence = array( - '=<' => 0, - '>=' => 0, - '=' => 0, - '<' => 0, - '>' => 0, - - '+' => 1, - '-' => 1, - '*' => 2, - '/' => 2, - '%' => 2, - ); - - static protected $whitePattern; - static protected $commentMulti; - - static protected $commentSingle = "//"; - static protected $commentMultiLeft = "/*"; - static protected $commentMultiRight = "*/"; - - // regex string to match any of the operators - static protected $operatorString; - - // these properties will supress division unless it's inside parenthases - static protected $supressDivisionProps = - array('/border-radius$/i', '/^font$/i'); - - protected $blockDirectives = array("font-face", "keyframes", "page", "-moz-document", "viewport", "-moz-viewport", "-o-viewport", "-ms-viewport"); - protected $lineDirectives = array("charset"); - - /** - * if we are in parens we can be more liberal with whitespace around - * operators because it must evaluate to a single value and thus is less - * ambiguous. - * - * Consider: - * property1: 10 -5; // is two numbers, 10 and -5 - * property2: (10 -5); // should evaluate to 5 - */ - protected $inParens = false; - - // caches preg escaped literals - static protected $literalCache = array(); - - public function __construct($lessc, $sourceName = null) { - $this->eatWhiteDefault = true; - // reference to less needed for vPrefix, mPrefix, and parentSelector - $this->lessc = $lessc; - - $this->sourceName = $sourceName; // name used for error messages - - $this->writeComments = false; - - if (!self::$operatorString) { - self::$operatorString = - '('.implode('|', array_map(array('lessc', 'preg_quote'), - array_keys(self::$precedence))).')'; - - $commentSingle = lessc::preg_quote(self::$commentSingle); - $commentMultiLeft = lessc::preg_quote(self::$commentMultiLeft); - $commentMultiRight = lessc::preg_quote(self::$commentMultiRight); - - self::$commentMulti = $commentMultiLeft.'.*?'.$commentMultiRight; - self::$whitePattern = '/'.$commentSingle.'[^\n]*\s*|('.self::$commentMulti.')\s*|\s+/Ais'; - } - } - - public function parse($buffer) { - $this->count = 0; - $this->line = 1; - - $this->env = null; // block stack - $this->buffer = $this->writeComments ? $buffer : $this->removeComments($buffer); - $this->pushSpecialBlock("root"); - $this->eatWhiteDefault = true; - $this->seenComments = array(); - - // trim whitespace on head - // if (preg_match('/^\s+/', $this->buffer, $m)) { - // $this->line += substr_count($m[0], "\n"); - // $this->buffer = ltrim($this->buffer); - // } - $this->whitespace(); - - // parse the entire file - while (false !== $this->parseChunk()); - - if ($this->count != strlen($this->buffer)) - $this->throwError(); - - // TODO report where the block was opened - if ( !property_exists($this->env, 'parent') || !is_null($this->env->parent) ) - throw new exception('parse error: unclosed block'); - - return $this->env; - } - - /** - * Parse a single chunk off the head of the buffer and append it to the - * current parse environment. - * Returns false when the buffer is empty, or when there is an error. - * - * This function is called repeatedly until the entire document is - * parsed. - * - * This parser is most similar to a recursive descent parser. Single - * functions represent discrete grammatical rules for the language, and - * they are able to capture the text that represents those rules. - * - * Consider the function lessc::keyword(). (all parse functions are - * structured the same) - * - * The function takes a single reference argument. When calling the - * function it will attempt to match a keyword on the head of the buffer. - * If it is successful, it will place the keyword in the referenced - * argument, advance the position in the buffer, and return true. If it - * fails then it won't advance the buffer and it will return false. - * - * All of these parse functions are powered by lessc::match(), which behaves - * the same way, but takes a literal regular expression. Sometimes it is - * more convenient to use match instead of creating a new function. - * - * Because of the format of the functions, to parse an entire string of - * grammatical rules, you can chain them together using &&. - * - * But, if some of the rules in the chain succeed before one fails, then - * the buffer position will be left at an invalid state. In order to - * avoid this, lessc::seek() is used to remember and set buffer positions. - * - * Before parsing a chain, use $s = $this->seek() to remember the current - * position into $s. Then if a chain fails, use $this->seek($s) to - * go back where we started. - */ - protected function parseChunk() { - if (empty($this->buffer)) return false; - $s = $this->seek(); - - if ($this->whitespace()) { - return true; - } - - // setting a property - if ($this->keyword($key) && $this->assign() && - $this->propertyValue($value, $key) && $this->end()) - { - $this->append(array('assign', $key, $value), $s); - return true; - } else { - $this->seek($s); - } - - - // look for special css blocks - if ($this->literal('@', false)) { - $this->count--; - - // media - if ($this->literal('@media')) { - if (($this->mediaQueryList($mediaQueries) || true) - && $this->literal('{')) - { - $media = $this->pushSpecialBlock("media"); - $media->queries = is_null($mediaQueries) ? array() : $mediaQueries; - return true; - } else { - $this->seek($s); - return false; - } - } - - if ($this->literal("@", false) && $this->keyword($dirName)) { - if ($this->isDirective($dirName, $this->blockDirectives)) { - if (($this->openString("{", $dirValue, null, array(";")) || true) && - $this->literal("{")) - { - $dir = $this->pushSpecialBlock("directive"); - $dir->name = $dirName; - if (isset($dirValue)) $dir->value = $dirValue; - return true; - } - } elseif ($this->isDirective($dirName, $this->lineDirectives)) { - if ($this->propertyValue($dirValue) && $this->end()) { - $this->append(array("directive", $dirName, $dirValue)); - return true; - } - } - } - - $this->seek($s); - } - - // setting a variable - if ($this->variable($var) && $this->assign() && - $this->propertyValue($value) && $this->end()) - { - $this->append(array('assign', $var, $value), $s); - return true; - } else { - $this->seek($s); - } - - if ($this->import($importValue)) { - $this->append($importValue, $s); - return true; - } - - // opening parametric mixin - if ($this->tag($tag, true) && $this->argumentDef($args, $isVararg) && - ($this->guards($guards) || true) && - $this->literal('{')) - { - $block = $this->pushBlock($this->fixTags(array($tag))); - $block->args = $args; - $block->isVararg = $isVararg; - if (!empty($guards)) $block->guards = $guards; - return true; - } else { - $this->seek($s); - } - - // opening a simple block - if ($this->tags($tags) && $this->literal('{', false)) { - $tags = $this->fixTags($tags); - $this->pushBlock($tags); - return true; - } else { - $this->seek($s); - } - - // closing a block - if ($this->literal('}', false)) { - try { - $block = $this->pop(); - } catch (exception $e) { - $this->seek($s); - $this->throwError($e->getMessage()); - $block = null; // Rector. - } - - $hidden = false; - if (is_null($block->type)) { - $hidden = true; - if (!isset($block->args)) { - foreach ($block->tags as $tag) { - if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) { - $hidden = false; - break; - } - } - } - - foreach ($block->tags as $tag) { - if (is_string($tag)) { - $this->env->children[$tag][] = $block; - } - } - } - - if (!$hidden) { - $this->append(array('block', $block), $s); - } - - // this is done here so comments aren't bundled into he block that - // was just closed - $this->whitespace(); - return true; - } - - // mixin - if ($this->mixinTags($tags) && - ($this->argumentDef($argv, $isVararg) || true) && - ($this->keyword($suffix) || true) && $this->end()) - { - $tags = $this->fixTags($tags); - $this->append(array('mixin', $tags, $argv, $suffix), $s); - return true; - } else { - $this->seek($s); - } - - // spare ; - if ($this->literal(';')) return true; - - return false; // got nothing, throw error - } - - protected function isDirective($dirname, $directives) { - // TODO: cache pattern in parser - $pattern = implode("|", - array_map(array("lessc", "preg_quote"), $directives)); - $pattern = '/^(-[a-z-]+-)?(' . $pattern . ')$/i'; - - return preg_match($pattern, $dirname); - } - - protected function fixTags($tags) { - // move @ tags out of variable namespace - foreach ($tags as &$tag) { - if ($tag[0] == $this->lessc->vPrefix) - $tag[0] = $this->lessc->mPrefix; - } - return $tags; - } - - // a list of expressions - protected function expressionList(&$exps) { - $values = array(); - - while ($this->expression($exp)) { - $values[] = $exp; - } - - if (count($values) == 0) return false; - - $exps = lessc::compressList($values, ' '); - return true; - } - - /** - * Attempt to consume an expression. - * @link https://en.wikipedia.org/wiki/Operator-precedence_parser#Pseudo-code - */ - protected function expression(&$out) { - if ($this->value($lhs)) { - $out = $this->expHelper($lhs, 0); - - // look for / shorthand - if (!empty($this->env->supressedDivision)) { - unset($this->env->supressedDivision); - $s = $this->seek(); - if ($this->literal("/") && $this->value($rhs)) { - $out = array("list", "", - array($out, array("keyword", "/"), $rhs)); - } else { - $this->seek($s); - } - } - - return true; - } - return false; - } - - /** - * recursively parse infix equation with $lhs at precedence $minP - */ - protected function expHelper($lhs, $minP) { - $this->inExp = true; - $ss = $this->seek(); - - while (true) { - $whiteBefore = isset($this->buffer[$this->count - 1]) && - ctype_space($this->buffer[$this->count - 1]); - - // If there is whitespace before the operator, then we require - // whitespace after the operator for it to be an expression - $needWhite = $whiteBefore && !$this->inParens; - - if ($this->match(self::$operatorString.($needWhite ? '\s' : ''), $m) && self::$precedence[$m[1]] >= $minP) { - if (!$this->inParens && isset($this->env->currentProperty) && $m[1] == "/" && empty($this->env->supressedDivision)) { - foreach (self::$supressDivisionProps as $pattern) { - if (preg_match($pattern, $this->env->currentProperty)) { - $this->env->supressedDivision = true; - break 2; - } - } - } - - - $whiteAfter = isset($this->buffer[$this->count - 1]) && - ctype_space($this->buffer[$this->count - 1]); - - if (!$this->value($rhs)) break; - - // peek for next operator to see what to do with rhs - if ($this->peek(self::$operatorString, $next) && self::$precedence[$next[1]] > self::$precedence[$m[1]]) { - $rhs = $this->expHelper($rhs, self::$precedence[$next[1]]); - } - - $lhs = array('expression', $m[1], $lhs, $rhs, $whiteBefore, $whiteAfter); - $ss = $this->seek(); - - continue; - } - - break; - } - - $this->seek($ss); - - return $lhs; - } - - // consume a list of values for a property - public function propertyValue(&$value, $keyName = null) { - $values = array(); - - if ($keyName !== null) $this->env->currentProperty = $keyName; - - $s = null; - while ($this->expressionList($v)) { - $values[] = $v; - $s = $this->seek(); - if (!$this->literal(',')) break; - } - - if ($s) $this->seek($s); - - if ($keyName !== null) unset($this->env->currentProperty); - - if (count($values) == 0) return false; - - $value = lessc::compressList($values, ', '); - return true; - } - - protected function parenValue(&$out) { - $s = $this->seek(); - - // speed shortcut - if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "(") { - return false; - } - - $inParens = $this->inParens; - if ($this->literal("(") && - ($this->inParens = true) && $this->expression($exp) && - $this->literal(")")) - { - $out = $exp; - $this->inParens = $inParens; - return true; - } else { - $this->inParens = $inParens; - $this->seek($s); - } - - return false; - } - - // a single value - protected function value(&$value) { - $s = $this->seek(); - - // speed shortcut - if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "-") { - // negation - if ($this->literal("-", false) && - (($this->variable($inner) && $inner = array("variable", $inner)) || - $this->unit($inner) || - $this->parenValue($inner))) - { - $value = array("unary", "-", $inner); - return true; - } else { - $this->seek($s); - } - } - - if ($this->parenValue($value)) return true; - if ($this->unit($value)) return true; - if ($this->color($value)) return true; - if ($this->func($value)) return true; - if ($this->string($value)) return true; - - if ($this->keyword($word)) { - $value = array('keyword', $word); - return true; - } - - // try a variable - if ($this->variable($var)) { - $value = array('variable', $var); - return true; - } - - // unquote string (should this work on any type? - if ($this->literal("~") && $this->string($str)) { - $value = array("escape", $str); - return true; - } else { - $this->seek($s); - } - - // css hack: \0 - if ($this->literal('\\') && $this->match('([0-9]+)', $m)) { - $value = array('keyword', '\\'.$m[1]); - return true; - } else { - $this->seek($s); - } - - return false; - } - - // an import statement - protected function import(&$out) { - if (!$this->literal('@import')) return false; - - // @import "something.css" media; - // @import url("something.css") media; - // @import url(something.css) media; - - if ($this->propertyValue($value)) { - $out = array("import", $value); - return true; - } - } - - protected function mediaQueryList(&$out) { - if ($this->genericList($list, "mediaQuery", ",", false)) { - $out = $list[2]; - return true; - } - return false; - } - - protected function mediaQuery(&$out) { - $s = $this->seek(); - - $expressions = null; - $parts = array(); - - if (($this->literal("only") && ($only = true) || $this->literal("not") && ($not = true) || true) && $this->keyword($mediaType)) { - $prop = array("mediaType"); - if (isset($only)) $prop[] = "only"; - if (isset($not)) $prop[] = "not"; - $prop[] = $mediaType; - $parts[] = $prop; - } else { - $this->seek($s); - } - - - if (!empty($mediaType) && !$this->literal("and")) { - // ~ - } else { - $this->genericList($expressions, "mediaExpression", "and", false); - if (is_array($expressions)) $parts = array_merge($parts, $expressions[2]); - } - - if (count($parts) == 0) { - $this->seek($s); - return false; - } - - $out = $parts; - return true; - } - - protected function mediaExpression(&$out) { - $s = $this->seek(); - $value = null; - if ($this->literal("(") && - $this->keyword($feature) && - ($this->literal(":") && $this->expression($value) || true) && - $this->literal(")")) - { - $out = array("mediaExp", $feature); - if ($value) $out[] = $value; - return true; - } elseif ($this->variable($variable)) { - $out = array('variable', $variable); - return true; - } - - $this->seek($s); - return false; - } - - // an unbounded string stopped by $end - protected function openString($end, &$out, $nestingOpen=null, $rejectStrs = null) { - $oldWhite = $this->eatWhiteDefault; - $this->eatWhiteDefault = false; - - $stop = array("'", '"', "@{", $end); - $stop = array_map(array("lessc", "preg_quote"), $stop); - // $stop[] = self::$commentMulti; - - if (!is_null($rejectStrs)) { - $stop = array_merge($stop, $rejectStrs); - } - - $patt = '(.*?)('.implode("|", $stop).')'; - - $nestingLevel = 0; - - $content = array(); - while ($this->match($patt, $m, false)) { - if (!empty($m[1])) { - $content[] = $m[1]; - if ($nestingOpen) { - $nestingLevel += substr_count($m[1], $nestingOpen); - } - } - - $tok = $m[2]; - - $this->count-= strlen($tok); - if ($tok == $end) { - if ($nestingLevel == 0) { - break; - } else { - $nestingLevel--; - } - } - - if (($tok == "'" || $tok == '"') && $this->string($str)) { - $content[] = $str; - continue; - } - - if ($tok == "@{" && $this->interpolation($inter)) { - $content[] = $inter; - continue; - } - - if (!empty($rejectStrs) && in_array($tok, $rejectStrs)) { - break; - } - - $content[] = $tok; - $this->count+= strlen($tok); - } - - $this->eatWhiteDefault = $oldWhite; - - if (count($content) == 0) return false; - - // trim the end - if (is_string(end($content))) { - $content[count($content) - 1] = rtrim(end($content)); - } - - $out = array("string", "", $content); - return true; - } - - protected function string(&$out) { - $s = $this->seek(); - if ($this->literal('"', false)) { - $delim = '"'; - } elseif ($this->literal("'", false)) { - $delim = "'"; - } else { - return false; - } - - $content = array(); - - // look for either ending delim , escape, or string interpolation - $patt = '([^\n]*?)(@\{|\\\\|' . - lessc::preg_quote($delim).')'; - - $oldWhite = $this->eatWhiteDefault; - $this->eatWhiteDefault = false; - - while ($this->match($patt, $m, false)) { - $content[] = $m[1]; - if ($m[2] == "@{") { - $this->count -= strlen($m[2]); - if ($this->interpolation($inter, false)) { - $content[] = $inter; - } else { - $this->count += strlen($m[2]); - $content[] = "@{"; // ignore it - } - } elseif ($m[2] == '\\') { - $content[] = $m[2]; - if ($this->literal($delim, false)) { - $content[] = $delim; - } - } else { - $this->count -= strlen($delim); - break; // delim - } - } - - $this->eatWhiteDefault = $oldWhite; - - if ($this->literal($delim)) { - $out = array("string", $delim, $content); - return true; - } - - $this->seek($s); - return false; - } - - protected function interpolation(&$out) { - $oldWhite = $this->eatWhiteDefault; - $this->eatWhiteDefault = true; - - $s = $this->seek(); - if ($this->literal("@{") && - $this->openString("}", $interp, null, array("'", '"', ";")) && - $this->literal("}", false)) - { - $out = array("interpolate", $interp); - $this->eatWhiteDefault = $oldWhite; - if ($this->eatWhiteDefault) $this->whitespace(); - return true; - } - - $this->eatWhiteDefault = $oldWhite; - $this->seek($s); - return false; - } - - protected function unit(&$unit) { - // speed shortcut - if (isset($this->buffer[$this->count])) { - $char = $this->buffer[$this->count]; - if (!ctype_digit($char) && $char != ".") return false; - } - - if ($this->match('([0-9]+(?:\.[0-9]*)?|\.[0-9]+)([%a-zA-Z]+)?', $m)) { - $unit = array("number", $m[1], empty($m[2]) ? "" : $m[2]); - return true; - } - return false; - } - - // a # color - protected function color(&$out) { - if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) { - if (strlen($m[1]) > 7) { - $out = array("string", "", array($m[1])); - } else { - $out = array("raw_color", $m[1]); - } - return true; - } - - return false; - } - - // consume an argument definition list surrounded by () - // each argument is a variable name with optional value - // or at the end a ... or a variable named followed by ... - // arguments are separated by , unless a ; is in the list, then ; is the - // delimiter. - protected function argumentDef(&$args, &$isVararg) { - $value = null; // Initialize output variable to make wpcom's rector happy. - $rhs = null; // Initialize output variable to make wpcom's rector happy. - $newArg = null; // Initialize variable for rector. - $s = $this->seek(); - if (!$this->literal('(')) return false; - - $values = array(); - $delim = ","; - $method = "expressionList"; - - $isVararg = false; - while (true) { - if ($this->literal("...")) { - $isVararg = true; - break; - } - - if ($this->$method($value)) { - if ($value[0] == "variable") { - $arg = array("arg", $value[1]); - $ss = $this->seek(); - - if ($this->assign() && $this->$method($rhs)) { - $arg[] = $rhs; - } else { - $this->seek($ss); - if ($this->literal("...")) { - $arg[0] = "rest"; - $isVararg = true; - } - } - - $values[] = $arg; - if ($isVararg) break; - continue; - } else { - $values[] = array("lit", $value); - } - } - - - if (!$this->literal($delim)) { - if ($delim == "," && $this->literal(";")) { - // found new delim, convert existing args - $delim = ";"; - $method = "propertyValue"; - - // transform arg list - if (isset($values[1])) { // 2 items - $newList = array(); - foreach ($values as $i => $arg) { - switch($arg[0]) { - case "arg": - if ($i) { - $this->throwError("Cannot mix ; and , as delimiter types"); - } - $newList[] = $arg[2]; - break; - case "lit": - $newList[] = $arg[1]; - break; - case "rest": - $this->throwError("Unexpected rest before semicolon"); - } - } - - $newList = array("list", ", ", $newList); - - switch ($values[0][0]) { - case "arg": - $newArg = array("arg", $values[0][1], $newList); - break; - case "lit": - $newArg = array("lit", $newList); - break; - } - - } elseif ($values) { // 1 item - $newArg = $values[0]; - } - - if ($newArg) { - $values = array($newArg); - } - } else { - break; - } - } - } - - if (!$this->literal(')')) { - $this->seek($s); - return false; - } - - $args = $values; - - return true; - } - - // consume a list of tags - // this accepts a hanging delimiter - protected function tags(&$tags, $simple = false, $delim = ',') { - $tags = array(); - while ($this->tag($tt, $simple)) { - $tags[] = $tt; - if (!$this->literal($delim)) break; - } - if (count($tags) == 0) return false; - - return true; - } - - // list of tags of specifying mixin path - // optionally separated by > (lazy, accepts extra >) - protected function mixinTags(&$tags) { - $tags = array(); - while ($this->tag($tt, true)) { - $tags[] = $tt; - $this->literal(">"); - } - - if (count($tags) == 0) return false; - - return true; - } - - // a bracketed value (contained within in a tag definition) - protected function tagBracket(&$parts, &$hasExpression) { - // speed shortcut - if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "[") { - return false; - } - - $s = $this->seek(); - - $hasInterpolation = false; - - if ($this->literal("[", false)) { - $attrParts = array("["); - // keyword, string, operator - while (true) { - if ($this->literal("]", false)) { - $this->count--; - break; // get out early - } - - if ($this->match('\s+', $m)) { - $attrParts[] = " "; - continue; - } - if ($this->string($str)) { - // escape parent selector, (yuck) - foreach ($str[2] as &$chunk) { - $chunk = str_replace($this->lessc->parentSelector, "$&$", $chunk); - } - - $attrParts[] = $str; - $hasInterpolation = true; - continue; - } - - if ($this->keyword($word)) { - $attrParts[] = $word; - continue; - } - - if ($this->interpolation($inter, false)) { - $attrParts[] = $inter; - $hasInterpolation = true; - continue; - } - - // operator, handles attr namespace too - if ($this->match('[|-~\$\*\^=]+', $m)) { - $attrParts[] = $m[0]; - continue; - } - - break; - } - - if ($this->literal("]", false)) { - $attrParts[] = "]"; - foreach ($attrParts as $part) { - $parts[] = $part; - } - $hasExpression = $hasExpression || $hasInterpolation; - return true; - } - $this->seek($s); - } - - $this->seek($s); - return false; - } - - // a space separated list of selectors - protected function tag(&$tag, $simple = false) { - if ($simple) - $chars = '^@,:;{}\][>\(\) "\''; - else - $chars = '^@,;{}["\''; - - $s = $this->seek(); - - $hasExpression = false; - $parts = array(); - while ($this->tagBracket($parts, $hasExpression)); - - $oldWhite = $this->eatWhiteDefault; - $this->eatWhiteDefault = false; - - while (true) { - if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) { - $parts[] = $m[1]; - if ($simple) break; - - while ($this->tagBracket($parts, $hasExpression)); - continue; - } - - if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") { - if ($this->interpolation($interp)) { - $hasExpression = true; - $interp[2] = true; // don't unescape - $parts[] = $interp; - continue; - } - - if ($this->literal("@")) { - $parts[] = "@"; - continue; - } - } - - if ($this->unit($unit)) { // for keyframes - $parts[] = $unit[1]; - $parts[] = $unit[2]; - continue; - } - - break; - } - - $this->eatWhiteDefault = $oldWhite; - if (!$parts) { - $this->seek($s); - return false; - } - - if ($hasExpression) { - $tag = array("exp", array("string", "", $parts)); - } else { - $tag = trim(implode($parts)); - } - - $this->whitespace(); - return true; - } - - // a css function - protected function func(&$func) { - $s = $this->seek(); - - if ($this->match('(%|[\w\-_][\w\-_:\.]+|[\w_])', $m) && $this->literal('(')) { - $fname = $m[1]; - - $sPreArgs = $this->seek(); - - $args = array(); - while (true) { - $ss = $this->seek(); - // this ugly nonsense is for ie filter properties - if ($this->keyword($name) && $this->literal('=') && $this->expressionList($value)) { - $args[] = array("string", "", array($name, "=", $value)); - } else { - $this->seek($ss); - if ($this->expressionList($value)) { - $args[] = $value; - } - } - - if (!$this->literal(',')) break; - } - $args = array('list', ',', $args); - - if ($this->literal(')')) { - $func = array('function', $fname, $args); - return true; - } elseif ($fname == 'url') { - // couldn't parse and in url? treat as string - $this->seek($sPreArgs); - if ($this->openString(")", $string) && $this->literal(")")) { - $func = array('function', $fname, $string); - return true; - } - } - } - - $this->seek($s); - return false; - } - - // consume a less variable - protected function variable(&$name) { - $s = $this->seek(); - if ($this->literal($this->lessc->vPrefix, false) && - ($this->variable($sub) || $this->keyword($name))) - { - if (!empty($sub)) { - $name = array('variable', $sub); - } else { - $name = $this->lessc->vPrefix.$name; - } - return true; - } - - $name = null; - $this->seek($s); - return false; - } - - /** - * Consume an assignment operator - * Can optionally take a name that will be set to the current property name - */ - protected function assign($name = null) { - if ($name) $this->currentProperty = $name; - return $this->literal(':') || $this->literal('='); - } - - // consume a keyword - protected function keyword(&$word) { - if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) { - $word = $m[1]; - return true; - } - return false; - } - - // consume an end of statement delimiter - protected function end() { - if ($this->literal(';', false)) { - return true; - } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') { - // if there is end of file or a closing block next then we don't need a ; - return true; - } - return false; - } - - protected function guards(&$guards) { - $s = $this->seek(); - - if (!$this->literal("when")) { - $this->seek($s); - return false; - } - - $guards = array(); - - while ($this->guardGroup($g)) { - $guards[] = $g; - if (!$this->literal(",")) break; - } - - if (count($guards) == 0) { - $guards = null; - $this->seek($s); - return false; - } - - return true; - } - - // a bunch of guards that are and'd together - // TODO rename to guardGroup - protected function guardGroup(&$guardGroup) { - $s = $this->seek(); - $guardGroup = array(); - while ($this->guard($guard)) { - $guardGroup[] = $guard; - if (!$this->literal("and")) break; - } - - if (count($guardGroup) == 0) { - $guardGroup = null; - $this->seek($s); - return false; - } - - return true; - } - - protected function guard(&$guard) { - $s = $this->seek(); - $negate = $this->literal("not"); - - if ($this->literal("(") && $this->expression($exp) && $this->literal(")")) { - $guard = $exp; - if ($negate) $guard = array("negate", $guard); - return true; - } - - $this->seek($s); - return false; - } - - /* raw parsing functions */ - - protected function literal($what, $eatWhitespace = null) { - if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault; - - // shortcut on single letter - if (!isset($what[1]) && isset($this->buffer[$this->count])) { - if ($this->buffer[$this->count] == $what) { - if (!$eatWhitespace) { - $this->count++; - return true; - } - // goes below... - } else { - return false; - } - } - - if (!isset(self::$literalCache[$what])) { - self::$literalCache[$what] = lessc::preg_quote($what); - } - - return $this->match(self::$literalCache[$what], $m, $eatWhitespace); - } - - protected function genericList(&$out, $parseItem, $delim="", $flatten=true) { - $value = null; // Initialize output parameter to make wpcom's rector happy. - $s = $this->seek(); - $items = array(); - while ($this->$parseItem($value)) { - $items[] = $value; - if ($delim) { - if (!$this->literal($delim)) break; - } - } - - if (count($items) == 0) { - $this->seek($s); - return false; - } - - if ($flatten && count($items) == 1) { - $out = $items[0]; - } else { - $out = array("list", $delim, $items); - } - - return true; - } - - - // advance counter to next occurrence of $what - // $until - don't include $what in advance - // $allowNewline, if string, will be used as valid char set - protected function to($what, &$out, $until = false, $allowNewline = false) { - if (is_string($allowNewline)) { - $validChars = $allowNewline; - } else { - $validChars = $allowNewline ? "." : "[^\n]"; - } - if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) return false; - if ($until) $this->count -= strlen($what); // give back $what - $out = $m[1]; - return true; - } - - // try to match something on head of buffer - protected function match($regex, &$out, $eatWhitespace = null) { - if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault; - - $r = '/'.$regex.($eatWhitespace && !$this->writeComments ? '\s*' : '').'/Ais'; - if (preg_match($r, $this->buffer, $out, null, $this->count)) { - $this->count += strlen($out[0]); - if ($eatWhitespace && $this->writeComments) $this->whitespace(); - return true; - } - return false; - } - - // match some whitespace - protected function whitespace() { - if ($this->writeComments) { - $gotWhite = false; - while (preg_match(self::$whitePattern, $this->buffer, $m, null, $this->count)) { - if (isset($m[1]) && empty($this->seenComments[$this->count])) { - $this->append(array("comment", $m[1])); - $this->seenComments[$this->count] = true; - } - $this->count += strlen($m[0]); - $gotWhite = true; - } - return $gotWhite; - } else { - $this->match("", $m); - return strlen($m[0]) > 0; - } - } - - // match something without consuming it - protected function peek($regex, &$out = null, $from=null) { - if (is_null($from)) $from = $this->count; - $r = '/'.$regex.'/Ais'; - $result = preg_match($r, $this->buffer, $out, null, $from); - - return $result; - } - - // seek to a spot in the buffer or return where we are on no argument - protected function seek($where = null) { - if ($where === null) return $this->count; - else $this->count = $where; - return true; - } - - /* misc functions */ - - public function throwError($msg = "parse error", $count = null) { - $count = is_null($count) ? $this->count : $count; - - $line = $this->line + - substr_count(substr($this->buffer, 0, $count), "\n"); - - if (!empty($this->sourceName)) { - $loc = "$this->sourceName on line $line"; - } else { - $loc = "line: $line"; - } - - // TODO this depends on $this->count - if ($this->peek("(.*?)(\n|$)", $m, $count)) { - throw new exception("$msg: failed at `$m[1]` $loc"); - } else { - throw new exception("$msg: $loc"); - } - } - - protected function pushBlock($selectors=null, $type=null) { - $b = new stdclass; - $b->parent = $this->env; - - $b->type = $type; - $b->id = self::$nextBlockId++; - - $b->isVararg = false; // TODO: kill me from here - $b->tags = $selectors; - - $b->props = array(); - $b->children = array(); - - $this->env = $b; - return $b; - } - - // push a block that doesn't multiply tags - protected function pushSpecialBlock($type) { - return $this->pushBlock(null, $type); - } - - // append a property to the current block - protected function append($prop, $pos = null) { - if ($pos !== null) $prop[-1] = $pos; - $this->env->props[] = $prop; - } - - // pop something off the stack - protected function pop() { - $old = $this->env; - $this->env = $this->env->parent; - return $old; - } - - // remove comments from $text - // todo: make it work for all functions, not just url - protected function removeComments($text) { - $look = array( - 'url(', '//', '/*', '"', "'" - ); - - $out = ''; - $min = null; - while (true) { - // find the next item - foreach ($look as $token) { - $pos = strpos($text, $token); - if ($pos !== false) { - if (!isset($min) || $pos < $min[1]) $min = array($token, $pos); - } - } - - if (is_null($min)) break; - - $count = $min[1]; - $skip = 0; - $newlines = 0; - switch ($min[0]) { - case 'url(': - if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) - $count += strlen($m[0]) - strlen($min[0]); - break; - case '"': - case "'": - if (preg_match('/'.$min[0].'.*?(?indentLevel = 0; - } - - public function indentStr($n = 0) { - return str_repeat($this->indentChar, max($this->indentLevel + $n, 0)); - } - - public function property($name, $value) { - return $name . $this->assignSeparator . $value . ";"; - } - - protected function isEmpty($block) { - if (empty($block->lines)) { - foreach ($block->children as $child) { - if (!$this->isEmpty($child)) return false; - } - - return true; - } - return false; - } - - public function block($block) { - if ($this->isEmpty($block)) return; - - $inner = $pre = $this->indentStr(); - - $isSingle = !$this->disableSingle && - is_null( $block->type ) && is_countable( $block->lines ) && count( $block->lines ) == 1; - - if (!empty($block->selectors)) { - $this->indentLevel++; - - if ($this->breakSelectors) { - $selectorSeparator = $this->selectorSeparator . $this->break . $pre; - } else { - $selectorSeparator = $this->selectorSeparator; - } - - echo $pre . - implode($selectorSeparator, $block->selectors); - if ($isSingle) { - echo $this->openSingle; - $inner = ""; - } else { - echo $this->open . $this->break; - $inner = $this->indentStr(); - } - - } - - if (!empty($block->lines)) { - $glue = $this->break.$inner; - echo $inner . implode($glue, $block->lines); - if (!$isSingle && !empty($block->children)) { - echo $this->break; - } - } - - foreach ($block->children as $child) { - $this->block($child); - } - - if (!empty($block->selectors)) { - if (!$isSingle && empty($block->children)) echo $this->break; - - if ($isSingle) { - echo $this->closeSingle . $this->break; - } else { - echo $pre . $this->close . $this->break; - } - - $this->indentLevel--; - } - } -} - -class lessc_formatter_compressed extends lessc_formatter_classic { - public $disableSingle = true; - public $open = "{"; - public $selectorSeparator = ","; - public $assignSeparator = ":"; - public $break = ""; - public $compressColors = true; - - public function indentStr($n = 0) { - return ""; - } -} - -class lessc_formatter_lessjs extends lessc_formatter_classic { - public $disableSingle = true; - public $breakSelectors = true; - public $assignSeparator = ": "; - public $selectorSeparator = ","; -} diff --git a/projects/plugins/jetpack/modules/masterbar/admin-menu/load.php b/projects/plugins/jetpack/modules/masterbar/admin-menu/load.php index 2e76c3d7a27fe..3dc6ec485a6f7 100644 --- a/projects/plugins/jetpack/modules/masterbar/admin-menu/load.php +++ b/projects/plugins/jetpack/modules/masterbar/admin-menu/load.php @@ -76,6 +76,7 @@ function () { remove_action( 'customize_register', 'Automattic\Jetpack\Dashboard_Customizations\register_css_nudge_control' ); + // @phan-suppress-next-line PhanUndeclaredClassInCallable remove_action( 'customize_register', array( 'Jetpack_Custom_CSS_Enhancements', 'customize_register' ) ); } } diff --git a/projects/plugins/jetpack/modules/module-info.php b/projects/plugins/jetpack/modules/module-info.php index ad2593daa0f54..8e36382428c83 100644 --- a/projects/plugins/jetpack/modules/module-info.php +++ b/projects/plugins/jetpack/modules/module-info.php @@ -342,26 +342,6 @@ function jetpack_carousel_more_info() { } add_action( 'jetpack_module_more_info_carousel', 'jetpack_carousel_more_info' ); -/** - * Custom CSS support link. - */ -function jetpack_custom_css_more_button() { - echo esc_url( Redirect::get_url( 'jetpack-support-custom-css' ) ); -} -add_action( 'jetpack_learn_more_button_custom-css', 'jetpack_custom_css_more_button' ); - -/** - * Custom CSS description. - */ -function jetpack_custom_css_more_info() { - esc_html_e( - "Add to or replace your theme's CSS including mobile styles, LESS, and SaSS. - Includes syntax coloring, auto-indentation, and immediate CSS validation.", - 'jetpack' - ); -} -add_action( 'jetpack_module_more_info_custom-css', 'jetpack_custom_css_more_info' ); - /** * Masterbar support link. */ diff --git a/projects/plugins/jetpack/phpunit.xml.dist b/projects/plugins/jetpack/phpunit.xml.dist index fd94a7e37f9cf..d70148dc2d951 100644 --- a/projects/plugins/jetpack/phpunit.xml.dist +++ b/projects/plugins/jetpack/phpunit.xml.dist @@ -102,9 +102,6 @@ tests/php/modules/seo-tools - - tests/php/modules/csstidy - tests/php/test_functions.compat.php diff --git a/projects/plugins/jetpack/tests/php/modules/csstidy/test-class.jetpack-csstidy.php b/projects/plugins/jetpack/tests/php/modules/csstidy/test-class.jetpack-csstidy.php deleted file mode 100644 index 99d30cb6909e7..0000000000000 --- a/projects/plugins/jetpack/tests/php/modules/csstidy/test-class.jetpack-csstidy.php +++ /dev/null @@ -1,108 +0,0 @@ -instance = new csstidy(); - $this->instance->set_cfg( 'optimise_shorthands', 0 ); - } - - /** Provides values for CSS preserve leading zeros patterns */ - public function custom_preserve_leading_zeros_provider() { - // phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- false positive - // 'test case description' => [ 'input', 'expected output', 'preserve_leading_zeros' ]. - return array( - 'test_removes_leading_zeros_by_default' => array( 'marquee {line-height:0.7;opacity:0.05;background-color:rgba(255, 255, 255, 0.25);}', "marquee {\nline-height:.7;\nopacity:.05;\nbackground-color:rgba(255, 255, 255, 0.25)\n}", false ), - 'test_decimals_greater_than_one_unchanged_default' => array( 'blink {line-height:1.7;top:-100.55em;}', "blink {\nline-height:1.7;\ntop:-100.55em\n}", false ), - 'test_removes_leading_zeros_by_default_units' => array( 'dfn {margin-left:-0.7px;top:0.55rem;line-height:0.3333;text-indent:-9999%}', "dfn {\nmargin-left:-.7px;\ntop:.55rem;\nline-height:.3333;\ntext-indent:-9999%\n}", false ), - 'test_preserves_leading_zeros' => array( 'aside {line-height:0.7;background-color:rgba(255, 255, 255, 0.25);opacity:0.05;}', "aside {\nline-height:0.7;\nbackground-color:rgba(255, 255, 255, 0.25);\nopacity:0.05\n}", true ), - 'test_preserves_leading_zeros_units' => array( 'code {line-height:.70;margin-left:-00.70px;top:0.55rem;padding:0.3333%;}', "code {\nline-height:0.7;\nmargin-left:-0.7px;\ntop:0.55rem;\npadding:0.3333%\n}", true ), - 'test_decimals_greater_than_one_unchanged_preserve_zeros' => array( 'blink {line-height:1.70;top:100.55em;margin-left:900px;}', "blink {\nline-height:1.7;\ntop:100.55em;\nmargin-left:900px\n}", false ), - ); - } - - /** - * Provides values for testing allowed CSS properties. - * Not all supported/allowed properties are tested here. - */ - public function custom_allowed_css_properties_provider() { - return array( - 'accent-color' => array( - 'body {accent-color:red;accent-color:#74992e;accent-color:rgb(255,255,128);accent-color:hsl(250,100%,34%)}', - // csstidy converts the rgb() color format to hex - "body {\naccent-color:red;\naccent-color:#74992e;\naccent-color:#ffff80;\naccent-color:hsl(250,100%,34%)\n}", - ), - 'aspect-ratio' => array( - 'body {aspect-ratio:1/1;aspect-ratio:1;aspect-ratio:inherit}', - "body {\naspect-ratio:1/1;\naspect-ratio:1;\naspect-ratio:inherit\n}", - ), - 'gap' => array( - 'body {gap:0;gap:10%;gap:calc(20px+10%)}', - "body {\ngap:0;\ngap:10%;\ngap:calc(20px+10%)\n}", - ), - 'text-underline-offset' => array( - 'body {text-underline-offset:auto;text-underline-offset:2em;text-underline-offset:initial}', - "body {\ntext-underline-offset:auto;\ntext-underline-offset:2em;\ntext-underline-offset:initial\n}", - ), - ); - } - - /** - * Test that leading zeros for decimals values are preserved/discarded as expected. - * - * @dataProvider custom_preserve_leading_zeros_provider - * - * @param string $input potential CSS values. - * @param string $expected_output what we expect csstidy to output. - * @param bool $preserve_leading_zeros the value of `preserve_leading_zeros` in csstidy's config. - */ - public function test_preserve_leading_zeros( $input, $expected_output, $preserve_leading_zeros ) { - $this->instance->set_cfg( 'preserve_leading_zeros', $preserve_leading_zeros ); - $this->instance->parse( $input ); - $this->assertEquals( - $expected_output, - $this->instance->print->plain() - ); - } - - /** - * Test that a CSS property is allowed and not removed when parsed by CSSTidy. - * - * @dataProvider custom_allowed_css_properties_provider - * - * @param string $input potential CSS values. - * @param string $expected_output what we expect csstidy to output. - */ - public function test_allowed_css_properties( $input, $expected_output ) { - $this->instance->parse( $input ); - $this->assertEquals( - $expected_output, - $this->instance->print->plain() - ); - } -} diff --git a/projects/plugins/jetpack/tests/php/test-get-modules.php b/projects/plugins/jetpack/tests/php/test-get-modules.php index ae0dfb586b291..11decbd21188b 100644 --- a/projects/plugins/jetpack/tests/php/test-get-modules.php +++ b/projects/plugins/jetpack/tests/php/test-get-modules.php @@ -38,7 +38,6 @@ public function test_get_available_modules() { 'contact-form', 'copy-post', 'custom-content-types', - 'custom-css', 'google-analytics', 'gravatar-hovercards', 'infinite-scroll', diff --git a/projects/plugins/jetpack/tools/webpack.config.css.js b/projects/plugins/jetpack/tools/webpack.config.css.js index 0bbc6ef43de8b..7d29e86a7672d 100644 --- a/projects/plugins/jetpack/tools/webpack.config.css.js +++ b/projects/plugins/jetpack/tools/webpack.config.css.js @@ -164,9 +164,6 @@ for ( const name of [ 'modules/shortcodes/css/recipes', 'modules/shortcodes/css/recipes-print', 'modules/shortcodes/css/slideshow-shortcode', - 'modules/custom-css/csstidy/cssparse', - 'modules/custom-css/csstidy/cssparsed', - 'modules/custom-css/custom-css/css/codemirror', 'modules/post-by-email/post-by-email', 'modules/sharedaddy/admin-sharing', 'modules/videopress/videopress-admin', diff --git a/projects/plugins/jetpack/tools/webpack.config.js b/projects/plugins/jetpack/tools/webpack.config.js index 7a877ec472d0e..a91a9f5fd4694 100644 --- a/projects/plugins/jetpack/tools/webpack.config.js +++ b/projects/plugins/jetpack/tools/webpack.config.js @@ -72,7 +72,6 @@ const supportedModules = [ 'shortcodes', 'widgets', 'widget-visibility', - 'custom-css', 'publicize', 'custom-post-types', 'sharedaddy', From abb0eda7c453c99c676c2cecc9f84136ed99143a Mon Sep 17 00:00:00 2001 From: Igor Zinovyev Date: Mon, 26 Aug 2024 18:36:56 +0300 Subject: [PATCH 3/5] Backport mu-wpcom-plugin 2.5.9, jetpack 13.8-a.7, wpcomsh 5.6.1 Changes (#39080) * Changelog and readme.txt edits. * Init new cycle --- projects/js-packages/ai-client/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/js-packages/ai-client/package.json | 2 +- projects/js-packages/licensing/CHANGELOG.md | 4 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/js-packages/licensing/package.json | 2 +- .../publicize-components/CHANGELOG.md | 10 ++++++ .../changelog/add-enable-more-eslint-rules | 5 --- .../add-social-share-status-feature-flag | 4 --- .../refactor-social-post-publish-panel | 4 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- ...e-social-initial-state-migrate-shares-data | 4 --- .../publicize-components/package.json | 2 +- projects/packages/autoloader/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../autoloader/src/AutoloadGenerator.php | 2 +- .../backup-helper-script-manager/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/backup/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../backup/src/class-package-version.php | 2 +- projects/packages/boost-core/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/boost-core/package.json | 2 +- .../packages/boost-speed-score/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../src/class-speed-score.php | 2 +- .../classic-theme-helper/CHANGELOG.md | 5 +++ ...e-breadcrumbs-classic-theme-helper-package | 4 --- .../classic-theme-helper/package.json | 2 +- .../classic-theme-helper/src/class-main.php | 2 +- .../packages/composer-plugin/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/error/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/explat/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/explat/package.json | 2 +- projects/packages/explat/src/class-explat.php | 2 +- projects/packages/forms/CHANGELOG.md | 5 +++ .../changelog/add-enable-more-eslint-rules | 5 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/forms/package.json | 2 +- .../forms/src/class-jetpack-forms.php | 2 +- projects/packages/image-cdn/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../image-cdn/src/class-image-cdn.php | 2 +- projects/packages/import/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/import/package.json | 2 +- projects/packages/import/src/class-main.php | 2 +- .../packages/jetpack-mu-wpcom/CHANGELOG.md | 13 ++++++++ .../changelog/add-auto-open-upload-theme | 4 --- ...e-breadcrumbs-classic-theme-helper-package | 4 --- .../changelog/fix-coming-soon-after-private | 4 --- ...x-muwpcom-sharing-modal-checkbox-alignment | 4 --- .../update-bump-mu-wpcom-sh-versions | 4 --- .../packages/jetpack-mu-wpcom/package.json | 2 +- .../src/class-jetpack-mu-wpcom.php | 2 +- projects/packages/licensing/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/my-jetpack/CHANGELOG.md | 13 ++++++++ .../add-context-switching-to-videopress-card | 4 --- .../changelog/add-enable-more-eslint-rules | 5 --- .../changelog/fix-my-jetpack-currency | 4 --- ...fix-tooltip-for-watch-time-videopress-card | 4 --- .../my-jetpack-handle-tiers-enabled-better | 4 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- ...update-mj-protect-card-tooltip-in-headings | 5 --- ...pack-protect-card-logins-blocked-font-size | 5 --- projects/packages/my-jetpack/package.json | 2 +- .../my-jetpack/src/class-initializer.php | 2 +- .../packages/plugins-installer/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/protect-models/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/protect-models/package.json | 2 +- .../src/class-protect-models.php | 2 +- projects/packages/protect-status/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/protect-status/package.json | 2 +- .../protect-status/src/class-status.php | 2 +- projects/packages/publicize/CHANGELOG.md | 9 ++++++ .../changelog/add-enable-more-eslint-rules | 5 --- .../add-social-share-status-feature-flag | 4 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- ...e-social-initial-state-migrate-shares-data | 4 --- projects/packages/publicize/package.json | 2 +- projects/packages/search/CHANGELOG.md | 5 +++ .../changelog/add-enable-more-eslint-rules | 5 --- .../add-eslint-array-callback-return | 5 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/search/package.json | 2 +- .../packages/search/src/class-package.php | 2 +- projects/packages/sync/CHANGELOG.md | 8 +++++ ...e-sync-hpos-add-shop-subscription-to-types | 4 --- ...ate-sync-hpos-consider-status-for-checksum | 4 --- .../sync/src/class-package-version.php | 2 +- projects/packages/videopress/CHANGELOG.md | 8 +++++ .../add-context-switching-to-videopress-card | 4 --- .../changelog/add-enable-more-eslint-rules | 5 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/videopress/package.json | 2 +- .../videopress/src/class-package-version.php | 2 +- projects/packages/waf/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../woocommerce-analytics/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../src/class-woocommerce-analytics.php | 2 +- projects/packages/wordads/CHANGELOG.md | 5 +++ .../renovate-yoast-phpunit-polyfills-1.x | 4 --- projects/packages/wordads/package.json | 2 +- .../packages/wordads/src/class-package.php | 2 +- projects/plugins/jetpack/CHANGELOG.md | 31 +++++++++++++++++++ .../jetpack/changelog/add-brief-retry-button | 4 --- .../changelog/add-enable-more-eslint-rules | 5 --- .../changelog/add-enable-more-eslint-rules#2 | 4 --- .../add-eslint-array-callback-return | 5 --- ...e-breadcrumbs-classic-theme-helper-package | 4 --- .../add-social-share-status-feature-flag | 5 --- .../jetpack/changelog/fix-donation-block | 4 --- .../changelog/fix-load-assets-payment-buttons | 4 --- .../fix-load-assets-payment-buttons#2 | 4 --- .../jetpack/changelog/fix-my-jetpack-currency | 5 --- .../jetpack/changelog/fix-top-posts-deleted | 4 --- .../fix-welcome-overlay-close-button-fix | 4 --- ...-newsletter-settings-sender-information-ia | 4 --- ...-prompts-connection => init-release-cycle} | 3 +- .../refactor-social-post-publish-panel | 4 --- .../remove-deprecated-sharedaddy-functions | 4 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- ...tpack-ai-breve-load-dictionary-from-server | 4 --- ...date-jetpack-ai-breve-recompute-highlights | 4 --- ...pdate-jetpack-ai-breve-spelling-suggestion | 4 --- .../update-jetpack-ai-reconnect-text | 4 --- .../update-jetpack-menu-order-stats-first | 4 --- .../jetpack/changelog/update-jetpack-to-test | 5 --- .../changelog/update-legacy-stats-widgets | 4 --- .../update-newsletter-preview-add-tracks | 4 --- .../update-newsletter-preview-feature-flag | 4 --- .../changelog/update-preview-email-no-clicks | 4 --- .../changelog/update-stats-banner-activate | 4 --- ...e-sync-hpos-add-shop-subscription-to-types | 5 --- .../jetpack/changelog/update-sync-locale | 5 --- .../changelog/update-to-test-jetpack-13.8 | 4 --- projects/plugins/jetpack/composer.json | 2 +- projects/plugins/jetpack/jetpack.php | 4 +-- .../modules/theme-tools/site-breadcrumbs.php | 4 +-- projects/plugins/jetpack/package.json | 2 +- projects/plugins/jetpack/readme.txt | 12 +++---- projects/plugins/mu-wpcom-plugin/CHANGELOG.md | 4 +++ .../changelog/2024-08-23-20-00-33-323045 | 5 --- ...e-breadcrumbs-classic-theme-helper-package | 5 --- .../renovate-yoast-phpunit-polyfills-1.x | 4 --- .../changelog/update-locale-to-wpcom | 5 --- ...e-sync-hpos-add-shop-subscription-to-types | 5 --- .../changelog/update-sync-locale | 5 --- .../changelog/update-sync-locale#2 | 5 --- .../changelog/update-sync-locale#3 | 5 --- .../plugins/mu-wpcom-plugin/composer.json | 2 +- .../mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- projects/plugins/wpcomsh/CHANGELOG.md | 4 +++ .../changelog/2024-08-23-20-00-33-498038 | 5 --- ...e-breadcrumbs-classic-theme-helper-package | 5 --- ...e-sync-hpos-add-shop-subscription-to-types | 5 --- projects/plugins/wpcomsh/composer.json | 2 +- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 +-- 169 files changed, 263 insertions(+), 451 deletions(-) delete mode 100644 projects/js-packages/ai-client/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/js-packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/js-packages/publicize-components/changelog/add-enable-more-eslint-rules delete mode 100644 projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag delete mode 100644 projects/js-packages/publicize-components/changelog/refactor-social-post-publish-panel delete mode 100644 projects/js-packages/publicize-components/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/js-packages/publicize-components/changelog/update-social-initial-state-migrate-shares-data delete mode 100644 projects/packages/autoloader/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/backup-helper-script-manager/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/backup/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/boost-core/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/boost-speed-score/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/classic-theme-helper/changelog/add-require-site-breadcrumbs-classic-theme-helper-package delete mode 100644 projects/packages/composer-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/error/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/explat/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/forms/changelog/add-enable-more-eslint-rules delete mode 100644 projects/packages/forms/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/image-cdn/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/import/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-auto-open-upload-theme delete mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-require-site-breadcrumbs-classic-theme-helper-package delete mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-coming-soon-after-private delete mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-muwpcom-sharing-modal-checkbox-alignment delete mode 100644 projects/packages/jetpack-mu-wpcom/changelog/update-bump-mu-wpcom-sh-versions delete mode 100644 projects/packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/my-jetpack/changelog/add-context-switching-to-videopress-card delete mode 100644 projects/packages/my-jetpack/changelog/add-enable-more-eslint-rules delete mode 100644 projects/packages/my-jetpack/changelog/fix-my-jetpack-currency delete mode 100644 projects/packages/my-jetpack/changelog/fix-tooltip-for-watch-time-videopress-card delete mode 100644 projects/packages/my-jetpack/changelog/my-jetpack-handle-tiers-enabled-better delete mode 100644 projects/packages/my-jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/my-jetpack/changelog/update-mj-protect-card-tooltip-in-headings delete mode 100644 projects/packages/my-jetpack/changelog/update-my-jetpack-protect-card-logins-blocked-font-size delete mode 100644 projects/packages/plugins-installer/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/protect-models/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/protect-status/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/publicize/changelog/add-enable-more-eslint-rules delete mode 100644 projects/packages/publicize/changelog/add-social-share-status-feature-flag delete mode 100644 projects/packages/publicize/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/publicize/changelog/update-social-initial-state-migrate-shares-data delete mode 100644 projects/packages/search/changelog/add-enable-more-eslint-rules delete mode 100644 projects/packages/search/changelog/add-eslint-array-callback-return delete mode 100644 projects/packages/search/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/sync/changelog/update-sync-hpos-add-shop-subscription-to-types delete mode 100644 projects/packages/sync/changelog/update-sync-hpos-consider-status-for-checksum delete mode 100644 projects/packages/videopress/changelog/add-context-switching-to-videopress-card delete mode 100644 projects/packages/videopress/changelog/add-enable-more-eslint-rules delete mode 100644 projects/packages/videopress/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/waf/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/woocommerce-analytics/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/packages/wordads/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/plugins/jetpack/changelog/add-brief-retry-button delete mode 100644 projects/plugins/jetpack/changelog/add-enable-more-eslint-rules delete mode 100644 projects/plugins/jetpack/changelog/add-enable-more-eslint-rules#2 delete mode 100644 projects/plugins/jetpack/changelog/add-eslint-array-callback-return delete mode 100644 projects/plugins/jetpack/changelog/add-require-site-breadcrumbs-classic-theme-helper-package delete mode 100644 projects/plugins/jetpack/changelog/add-social-share-status-feature-flag delete mode 100644 projects/plugins/jetpack/changelog/fix-donation-block delete mode 100644 projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons delete mode 100644 projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons#2 delete mode 100644 projects/plugins/jetpack/changelog/fix-my-jetpack-currency delete mode 100644 projects/plugins/jetpack/changelog/fix-top-posts-deleted delete mode 100644 projects/plugins/jetpack/changelog/fix-welcome-overlay-close-button-fix delete mode 100644 projects/plugins/jetpack/changelog/improve-newsletter-settings-sender-information-ia rename projects/plugins/jetpack/changelog/{fix-simple-sites-prompts-connection => init-release-cycle} (57%) delete mode 100644 projects/plugins/jetpack/changelog/refactor-social-post-publish-panel delete mode 100644 projects/plugins/jetpack/changelog/remove-deprecated-sharedaddy-functions delete mode 100644 projects/plugins/jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/plugins/jetpack/changelog/update-jetpack-ai-breve-load-dictionary-from-server delete mode 100644 projects/plugins/jetpack/changelog/update-jetpack-ai-breve-recompute-highlights delete mode 100644 projects/plugins/jetpack/changelog/update-jetpack-ai-breve-spelling-suggestion delete mode 100644 projects/plugins/jetpack/changelog/update-jetpack-ai-reconnect-text delete mode 100644 projects/plugins/jetpack/changelog/update-jetpack-menu-order-stats-first delete mode 100644 projects/plugins/jetpack/changelog/update-jetpack-to-test delete mode 100644 projects/plugins/jetpack/changelog/update-legacy-stats-widgets delete mode 100644 projects/plugins/jetpack/changelog/update-newsletter-preview-add-tracks delete mode 100644 projects/plugins/jetpack/changelog/update-newsletter-preview-feature-flag delete mode 100644 projects/plugins/jetpack/changelog/update-preview-email-no-clicks delete mode 100644 projects/plugins/jetpack/changelog/update-stats-banner-activate delete mode 100644 projects/plugins/jetpack/changelog/update-sync-hpos-add-shop-subscription-to-types delete mode 100644 projects/plugins/jetpack/changelog/update-sync-locale delete mode 100644 projects/plugins/jetpack/changelog/update-to-test-jetpack-13.8 delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/2024-08-23-20-00-33-323045 delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/add-require-site-breadcrumbs-classic-theme-helper-package delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/update-locale-to-wpcom delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/update-sync-hpos-add-shop-subscription-to-types delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#2 delete mode 100644 projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#3 delete mode 100644 projects/plugins/wpcomsh/changelog/2024-08-23-20-00-33-498038 delete mode 100644 projects/plugins/wpcomsh/changelog/add-require-site-breadcrumbs-classic-theme-helper-package delete mode 100644 projects/plugins/wpcomsh/changelog/update-sync-hpos-add-shop-subscription-to-types diff --git a/projects/js-packages/ai-client/CHANGELOG.md b/projects/js-packages/ai-client/CHANGELOG.md index 91c38d1bb8e90..e553ca4c177b1 100644 --- a/projects/js-packages/ai-client/CHANGELOG.md +++ b/projects/js-packages/ai-client/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.16.4] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.16.3] - 2024-08-21 ### Fixed - Revert recent SVG image optimizations. [#38981] @@ -388,6 +392,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. [#31659] - Updated package dependencies. [#31785] +[0.16.4]: https://github.com/Automattic/jetpack-ai-client/compare/v0.16.3...v0.16.4 [0.16.3]: https://github.com/Automattic/jetpack-ai-client/compare/v0.16.2...v0.16.3 [0.16.2]: https://github.com/Automattic/jetpack-ai-client/compare/v0.16.1...v0.16.2 [0.16.1]: https://github.com/Automattic/jetpack-ai-client/compare/v0.16.0...v0.16.1 diff --git a/projects/js-packages/ai-client/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/js-packages/ai-client/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/ai-client/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/ai-client/package.json b/projects/js-packages/ai-client/package.json index 01474520cb0bb..c27839c7497f1 100644 --- a/projects/js-packages/ai-client/package.json +++ b/projects/js-packages/ai-client/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@automattic/jetpack-ai-client", - "version": "0.16.4-alpha", + "version": "0.16.4", "description": "A JS client for consuming Jetpack AI services", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme", "bugs": { diff --git a/projects/js-packages/licensing/CHANGELOG.md b/projects/js-packages/licensing/CHANGELOG.md index 1c1111ee41374..6480d9800ec9d 100644 --- a/projects/js-packages/licensing/CHANGELOG.md +++ b/projects/js-packages/licensing/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.12.26 - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## 0.12.25 - 2024-08-21 ### Changed - Internal updates. diff --git a/projects/js-packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/js-packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/licensing/package.json b/projects/js-packages/licensing/package.json index 1a7ba615b1317..cf9cf23554365 100644 --- a/projects/js-packages/licensing/package.json +++ b/projects/js-packages/licensing/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-licensing", - "version": "0.12.26-alpha", + "version": "0.12.26", "description": "Jetpack licensing flow", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/licensing/#readme", "bugs": { diff --git a/projects/js-packages/publicize-components/CHANGELOG.md b/projects/js-packages/publicize-components/CHANGELOG.md index 6a5e1d755ce8a..0f671ddae6f6e 100644 --- a/projects/js-packages/publicize-components/CHANGELOG.md +++ b/projects/js-packages/publicize-components/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.63.0] - 2024-08-26 +### Added +- Added the new feature flag for the social share status [#39015] + +### Changed +- Moved PostPublishPanels component to publicize-components package [#39049] +- Social: Migrated shares data to the new script data [#38988] +- Updated package dependencies. [#39004] + ## [0.62.0] - 2024-08-21 ### Changed - Social: Migrated the API paths from initial state to the new script data. [#38962] @@ -852,6 +861,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated package dependencies. [#24470] +[0.63.0]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.62.0...v0.63.0 [0.62.0]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.61.0...v0.62.0 [0.61.0]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.60.0...v0.61.0 [0.60.0]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.59.0...v0.60.0 diff --git a/projects/js-packages/publicize-components/changelog/add-enable-more-eslint-rules b/projects/js-packages/publicize-components/changelog/add-enable-more-eslint-rules deleted file mode 100644 index db4cc1e54899d..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag b/projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag deleted file mode 100644 index b7fe45d10716a..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-social-share-status-feature-flag +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Added the new feature flag for the social share status diff --git a/projects/js-packages/publicize-components/changelog/refactor-social-post-publish-panel b/projects/js-packages/publicize-components/changelog/refactor-social-post-publish-panel deleted file mode 100644 index c2d9eb2e4c754..0000000000000 --- a/projects/js-packages/publicize-components/changelog/refactor-social-post-publish-panel +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -Moved PostPublishPanels component to publicize-components package diff --git a/projects/js-packages/publicize-components/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/js-packages/publicize-components/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/js-packages/publicize-components/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/js-packages/publicize-components/changelog/update-social-initial-state-migrate-shares-data b/projects/js-packages/publicize-components/changelog/update-social-initial-state-migrate-shares-data deleted file mode 100644 index 40880a44a4eaa..0000000000000 --- a/projects/js-packages/publicize-components/changelog/update-social-initial-state-migrate-shares-data +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Social: Migrated shares data to the new script data diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json index 7d8aa9c16e324..349241f816c15 100644 --- a/projects/js-packages/publicize-components/package.json +++ b/projects/js-packages/publicize-components/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-publicize-components", - "version": "0.63.0-alpha", + "version": "0.63.0", "description": "A library of JS components required by the Publicize editor plugin", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/publicize-components/#readme", "bugs": { diff --git a/projects/packages/autoloader/CHANGELOG.md b/projects/packages/autoloader/CHANGELOG.md index b253cfe24e48a..317e9131ee7ed 100644 --- a/projects/packages/autoloader/CHANGELOG.md +++ b/projects/packages/autoloader/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.10] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [3.0.9] - 2024-07-10 ### Fixed - Avoid a deprecation notice in `Autoloader_Locator::find_latest_autoloader()`. [#38245] @@ -368,6 +372,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Custom Autoloader +[3.0.10]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.9...v3.0.10 [3.0.9]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.8...v3.0.9 [3.0.8]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.7...v3.0.8 [3.0.7]: https://github.com/Automattic/jetpack-autoloader/compare/v3.0.6...v3.0.7 diff --git a/projects/packages/autoloader/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/autoloader/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/autoloader/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/autoloader/src/AutoloadGenerator.php b/projects/packages/autoloader/src/AutoloadGenerator.php index 0df292a997a66..48f931f2ad16a 100644 --- a/projects/packages/autoloader/src/AutoloadGenerator.php +++ b/projects/packages/autoloader/src/AutoloadGenerator.php @@ -21,7 +21,7 @@ */ class AutoloadGenerator { - const VERSION = '3.0.10-alpha'; + const VERSION = '3.0.10'; /** * IO object. diff --git a/projects/packages/backup-helper-script-manager/CHANGELOG.md b/projects/packages/backup-helper-script-manager/CHANGELOG.md index b39cdad83ee69..620d7ab45e900 100644 --- a/projects/packages/backup-helper-script-manager/CHANGELOG.md +++ b/projects/packages/backup-helper-script-manager/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.7] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.2.6] - 2024-04-08 ### Changed - Internal updates. @@ -37,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Initial release (improved helper script installer logging). [#34297] +[0.2.7]: https://github.com/Automattic/jetpack-backup-helper-script-manager/compare/v0.2.6...v0.2.7 [0.2.6]: https://github.com/Automattic/jetpack-backup-helper-script-manager/compare/v0.2.5...v0.2.6 [0.2.5]: https://github.com/Automattic/jetpack-backup-helper-script-manager/compare/v0.2.4...v0.2.5 [0.2.4]: https://github.com/Automattic/jetpack-backup-helper-script-manager/compare/v0.2.3...v0.2.4 diff --git a/projects/packages/backup-helper-script-manager/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/backup-helper-script-manager/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/backup-helper-script-manager/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/backup/CHANGELOG.md b/projects/packages/backup/CHANGELOG.md index 4ca896ec4d162..d1fbe87d90a08 100644 --- a/projects/packages/backup/CHANGELOG.md +++ b/projects/packages/backup/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.4.5] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [3.4.4] - 2024-08-21 ### Fixed - Decoupled backup connection screens from useConnection hook to avoid unnecessary loading and prevent duplicated API calls. [#38948] @@ -672,6 +676,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add API endpoints and Jetpack Backup package for managing Help… +[3.4.5]: https://github.com/Automattic/jetpack-backup/compare/v3.4.4...v3.4.5 [3.4.4]: https://github.com/Automattic/jetpack-backup/compare/v3.4.3...v3.4.4 [3.4.3]: https://github.com/Automattic/jetpack-backup/compare/v3.4.2...v3.4.3 [3.4.2]: https://github.com/Automattic/jetpack-backup/compare/v3.4.1...v3.4.2 diff --git a/projects/packages/backup/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/backup/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/backup/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/backup/src/class-package-version.php b/projects/packages/backup/src/class-package-version.php index 9ba50fc76f739..14e94858de066 100644 --- a/projects/packages/backup/src/class-package-version.php +++ b/projects/packages/backup/src/class-package-version.php @@ -16,7 +16,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '3.4.5-alpha'; + const PACKAGE_VERSION = '3.4.5'; const PACKAGE_SLUG = 'backup'; diff --git a/projects/packages/boost-core/CHANGELOG.md b/projects/packages/boost-core/CHANGELOG.md index 9e55f68e88956..ac48344245994 100644 --- a/projects/packages/boost-core/CHANGELOG.md +++ b/projects/packages/boost-core/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.9] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.2.8] - 2024-08-15 ### Fixed - Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs. [#38869] @@ -61,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Introduce new package. [#31163] +[0.2.9]: https://github.com/Automattic/jetpack-boost-core/compare/v0.2.8...v0.2.9 [0.2.8]: https://github.com/Automattic/jetpack-boost-core/compare/v0.2.7...v0.2.8 [0.2.7]: https://github.com/Automattic/jetpack-boost-core/compare/v0.2.6...v0.2.7 [0.2.6]: https://github.com/Automattic/jetpack-boost-core/compare/v0.2.5...v0.2.6 diff --git a/projects/packages/boost-core/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/boost-core/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/boost-core/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/boost-core/package.json b/projects/packages/boost-core/package.json index ab3d945d1b34c..7941e894ee8a3 100644 --- a/projects/packages/boost-core/package.json +++ b/projects/packages/boost-core/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-boost-core", - "version": "0.2.9-alpha", + "version": "0.2.9", "description": "Core functionality for boost and relevant packages to depend on", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/boost-core/#readme", "bugs": { diff --git a/projects/packages/boost-speed-score/CHANGELOG.md b/projects/packages/boost-speed-score/CHANGELOG.md index 3ea1de4b29370..dea0fbb7e2ad0 100644 --- a/projects/packages/boost-speed-score/CHANGELOG.md +++ b/projects/packages/boost-speed-score/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.12] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.3.11] - 2024-04-22 ### Changed - Internal updates. @@ -84,6 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add a new package for Boost Speed Score [#30914] - Add a new argument to `Speed_Score` to identify where the request was made from (e.g. 'boost-plugin', 'jetpack-dashboard', etc). [#31012] +[0.3.12]: https://github.com/Automattic/jetpack-boost-speed-score/compare/v0.3.11...v0.3.12 [0.3.11]: https://github.com/Automattic/jetpack-boost-speed-score/compare/v0.3.10...v0.3.11 [0.3.10]: https://github.com/Automattic/jetpack-boost-speed-score/compare/v0.3.9...v0.3.10 [0.3.9]: https://github.com/Automattic/jetpack-boost-speed-score/compare/v0.3.8...v0.3.9 diff --git a/projects/packages/boost-speed-score/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/boost-speed-score/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/boost-speed-score/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/boost-speed-score/src/class-speed-score.php b/projects/packages/boost-speed-score/src/class-speed-score.php index 07b6164ed8892..c229785a2c3d4 100644 --- a/projects/packages/boost-speed-score/src/class-speed-score.php +++ b/projects/packages/boost-speed-score/src/class-speed-score.php @@ -23,7 +23,7 @@ */ class Speed_Score { - const PACKAGE_VERSION = '0.3.12-alpha'; + const PACKAGE_VERSION = '0.3.12'; /** * Array of module slugs that are currently active and can impact speed score. diff --git a/projects/packages/classic-theme-helper/CHANGELOG.md b/projects/packages/classic-theme-helper/CHANGELOG.md index e13979ad0830d..b17d88e20ff0e 100644 --- a/projects/packages/classic-theme-helper/CHANGELOG.md +++ b/projects/packages/classic-theme-helper/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.3] - 2024-08-26 +### Changed +- Site Breadcrumbs: Requiring the feature from the Classic Theme Helper package [#38931] + ## [0.5.2] - 2024-08-23 ### Changed - Updated package dependencies. [#39004] @@ -82,6 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Add wordpress folder on gitignore. [#37177] +[0.5.3]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.5.2...v0.5.3 [0.5.2]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.5.1...v0.5.2 [0.5.1]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.5.0...v0.5.1 [0.5.0]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.4.5...v0.5.0 diff --git a/projects/packages/classic-theme-helper/changelog/add-require-site-breadcrumbs-classic-theme-helper-package b/projects/packages/classic-theme-helper/changelog/add-require-site-breadcrumbs-classic-theme-helper-package deleted file mode 100644 index fc59473129792..0000000000000 --- a/projects/packages/classic-theme-helper/changelog/add-require-site-breadcrumbs-classic-theme-helper-package +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Site Breadcrumbs: Requiring the feature from the Classic Theme Helper package diff --git a/projects/packages/classic-theme-helper/package.json b/projects/packages/classic-theme-helper/package.json index 12048dd18abac..b4b114b097e25 100644 --- a/projects/packages/classic-theme-helper/package.json +++ b/projects/packages/classic-theme-helper/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-classic-theme-helper", - "version": "0.5.3-alpha", + "version": "0.5.3", "description": "Features used with classic themes", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/classic-theme-helper/#readme", "bugs": { diff --git a/projects/packages/classic-theme-helper/src/class-main.php b/projects/packages/classic-theme-helper/src/class-main.php index e6ff95af5de2a..227747fc7eaa0 100644 --- a/projects/packages/classic-theme-helper/src/class-main.php +++ b/projects/packages/classic-theme-helper/src/class-main.php @@ -14,7 +14,7 @@ */ class Main { - const PACKAGE_VERSION = '0.5.3-alpha'; + const PACKAGE_VERSION = '0.5.3'; /** * Modules to include. diff --git a/projects/packages/composer-plugin/CHANGELOG.md b/projects/packages/composer-plugin/CHANGELOG.md index 9963cd1cdd046..fb3d879983d17 100644 --- a/projects/packages/composer-plugin/CHANGELOG.md +++ b/projects/packages/composer-plugin/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.3] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [2.0.2] - 2024-06-03 ### Changed - Internal updates. @@ -102,6 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added the Jetpack Installer package. +[2.0.3]: https://github.com/Automattic/jetpack-composer-plugin/compare/v2.0.2...v2.0.3 [2.0.2]: https://github.com/Automattic/jetpack-composer-plugin/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/Automattic/jetpack-composer-plugin/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/Automattic/jetpack-composer-plugin/compare/v1.1.14...v2.0.0 diff --git a/projects/packages/composer-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/composer-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/composer-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/error/CHANGELOG.md b/projects/packages/error/CHANGELOG.md index 5796cf2f31e36..486f3b5ac18e1 100644 --- a/projects/packages/error/CHANGELOG.md +++ b/projects/packages/error/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.3] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [2.0.2] - 2024-03-25 ### Changed - Internal updates. @@ -140,6 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Packages: Introduce a jetpack-error package +[2.0.3]: https://github.com/Automattic/jetpack-error/compare/v2.0.2...v2.0.3 [2.0.2]: https://github.com/Automattic/jetpack-error/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/Automattic/jetpack-error/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/Automattic/jetpack-error/compare/v1.3.21...v2.0.0 diff --git a/projects/packages/error/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/error/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/error/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/explat/CHANGELOG.md b/projects/packages/explat/CHANGELOG.md index 3d02c4b61424c..c78f47ffc30fa 100644 --- a/projects/packages/explat/CHANGELOG.md +++ b/projects/packages/explat/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.4] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.1.3] - 2024-08-21 ### Changed - Internal updates. @@ -27,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ExPlat: add condition to prevent fetching the experiment assignment if there's not anon id (meaning that Tracks is likely disabled) [#38327] - Updated package dependencies. [#38132] +[0.1.4]: https://github.com/Automattic/jetpack-explat/compare/v0.1.3...v0.1.4 [0.1.3]: https://github.com/Automattic/jetpack-explat/compare/v0.1.2...v0.1.3 [0.1.2]: https://github.com/Automattic/jetpack-explat/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/Automattic/jetpack-explat/compare/v0.1.0...v0.1.1 diff --git a/projects/packages/explat/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/explat/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/explat/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/explat/package.json b/projects/packages/explat/package.json index 1399ca99c41dd..56a1a4dc5f259 100644 --- a/projects/packages/explat/package.json +++ b/projects/packages/explat/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-explat", - "version": "0.1.4-alpha", + "version": "0.1.4", "description": "A package for running A/B tests on the Experimentation Platform (ExPlat) in the plugin.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/explat/#readme", "bugs": { diff --git a/projects/packages/explat/src/class-explat.php b/projects/packages/explat/src/class-explat.php index 61bda64391e38..2e67a042d239b 100644 --- a/projects/packages/explat/src/class-explat.php +++ b/projects/packages/explat/src/class-explat.php @@ -20,7 +20,7 @@ class ExPlat { * * @var string */ - const PACKAGE_VERSION = '0.1.4-alpha'; + const PACKAGE_VERSION = '0.1.4'; /** * Initializer. diff --git a/projects/packages/forms/CHANGELOG.md b/projects/packages/forms/CHANGELOG.md index 9248cb9ee4c5f..d5f19ac9934e7 100644 --- a/projects/packages/forms/CHANGELOG.md +++ b/projects/packages/forms/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.32.11] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.32.10] - 2024-08-21 ### Changed - Internal updates. @@ -634,6 +638,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a new jetpack/forms package [#28409] - Added a public load_contact_form method for initializing the contact form module. [#28416] +[0.32.11]: https://github.com/automattic/jetpack-forms/compare/v0.32.10...v0.32.11 [0.32.10]: https://github.com/automattic/jetpack-forms/compare/v0.32.9...v0.32.10 [0.32.9]: https://github.com/automattic/jetpack-forms/compare/v0.32.8...v0.32.9 [0.32.8]: https://github.com/automattic/jetpack-forms/compare/v0.32.7...v0.32.8 diff --git a/projects/packages/forms/changelog/add-enable-more-eslint-rules b/projects/packages/forms/changelog/add-enable-more-eslint-rules deleted file mode 100644 index db4cc1e54899d..0000000000000 --- a/projects/packages/forms/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/packages/forms/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/forms/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/forms/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/forms/package.json b/projects/packages/forms/package.json index c4d9c2fdfd4c0..8812adb7693aa 100644 --- a/projects/packages/forms/package.json +++ b/projects/packages/forms/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-forms", - "version": "0.32.11-alpha", + "version": "0.32.11", "description": "Jetpack Forms", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme", "bugs": { diff --git a/projects/packages/forms/src/class-jetpack-forms.php b/projects/packages/forms/src/class-jetpack-forms.php index f362e91c1fc15..718faa4df98df 100644 --- a/projects/packages/forms/src/class-jetpack-forms.php +++ b/projects/packages/forms/src/class-jetpack-forms.php @@ -15,7 +15,7 @@ */ class Jetpack_Forms { - const PACKAGE_VERSION = '0.32.11-alpha'; + const PACKAGE_VERSION = '0.32.11'; /** * Load the contact form module. diff --git a/projects/packages/image-cdn/CHANGELOG.md b/projects/packages/image-cdn/CHANGELOG.md index a2a0abf7c24ae..81868c8b93be7 100644 --- a/projects/packages/image-cdn/CHANGELOG.md +++ b/projects/packages/image-cdn/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.6] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.4.5] - 2024-08-19 ### Fixed - Lossless image optimization for images (should improve performance with no visible changes). [#38750] @@ -110,6 +114,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add image CDN package. [#29561] +[0.4.6]: https://github.com/Automattic/jetpack-image-cdn/compare/v0.4.5...v0.4.6 [0.4.5]: https://github.com/Automattic/jetpack-image-cdn/compare/v0.4.4...v0.4.5 [0.4.4]: https://github.com/Automattic/jetpack-image-cdn/compare/v0.4.3...v0.4.4 [0.4.3]: https://github.com/Automattic/jetpack-image-cdn/compare/v0.4.2...v0.4.3 diff --git a/projects/packages/image-cdn/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/image-cdn/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/image-cdn/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/image-cdn/src/class-image-cdn.php b/projects/packages/image-cdn/src/class-image-cdn.php index 1ae35b1174e2c..2aa47aeada031 100644 --- a/projects/packages/image-cdn/src/class-image-cdn.php +++ b/projects/packages/image-cdn/src/class-image-cdn.php @@ -12,7 +12,7 @@ */ final class Image_CDN { - const PACKAGE_VERSION = '0.4.6-alpha'; + const PACKAGE_VERSION = '0.4.6'; /** * Singleton. diff --git a/projects/packages/import/CHANGELOG.md b/projects/packages/import/CHANGELOG.md index 4c8b15fd317bb..270e99dcf3f44 100644 --- a/projects/packages/import/CHANGELOG.md +++ b/projects/packages/import/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.8.7] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.8.6] - 2024-05-27 ### Changed - Update dependencies. @@ -102,6 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed various imported resources hierarchies [#29012] +[0.8.7]: https://github.com/Automattic/jetpack-import/compare/v0.8.6...v0.8.7 [0.8.6]: https://github.com/Automattic/jetpack-import/compare/v0.8.5...v0.8.6 [0.8.5]: https://github.com/Automattic/jetpack-import/compare/v0.8.4...v0.8.5 [0.8.4]: https://github.com/Automattic/jetpack-import/compare/v0.8.3...v0.8.4 diff --git a/projects/packages/import/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/import/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/import/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/import/package.json b/projects/packages/import/package.json index bf13920a4f14c..5c5a161fd5e41 100644 --- a/projects/packages/import/package.json +++ b/projects/packages/import/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-import", - "version": "0.8.7-alpha", + "version": "0.8.7", "description": "Set of REST API routes used in WPCOM Unified Importer.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/import/#readme", "bugs": { diff --git a/projects/packages/import/src/class-main.php b/projects/packages/import/src/class-main.php index 5f298ea1be6ed..df51421d127c5 100644 --- a/projects/packages/import/src/class-main.php +++ b/projects/packages/import/src/class-main.php @@ -20,7 +20,7 @@ class Main { * * @var string */ - const PACKAGE_VERSION = '0.8.7-alpha'; + const PACKAGE_VERSION = '0.8.7'; /** * A list of all the routes. diff --git a/projects/packages/jetpack-mu-wpcom/CHANGELOG.md b/projects/packages/jetpack-mu-wpcom/CHANGELOG.md index e3139ed233f27..58d84015410e0 100644 --- a/projects/packages/jetpack-mu-wpcom/CHANGELOG.md +++ b/projects/packages/jetpack-mu-wpcom/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.59.0] - 2024-08-26 +### Added +- Auto open Upload Theme dialog if query parameter is present [#39045] +- Fixup project versions. [#38931] + +### Changed +- MU WPCOM: Fix Post Publish Modal checkbox alignment [#38990] + +### Fixed +- Bump package version [#39056] +- MU WPCOM: Fix the coming soon isn't configured correctly if the settings changes from Coming Soon -> Private -> Coming Soon [#39010] + ## [5.58.0] - 2024-08-23 ### Added - Sync Calypso locale to Atomic Classic [#39009] @@ -1177,6 +1189,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Testing initial package release. +[5.59.0]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v5.58.0...v5.59.0 [5.58.0]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v5.57.1...v5.58.0 [5.57.1]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v5.57.0...v5.57.1 [5.57.0]: https://github.com/Automattic/jetpack-mu-wpcom/compare/v5.56.0...v5.57.0 diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-auto-open-upload-theme b/projects/packages/jetpack-mu-wpcom/changelog/add-auto-open-upload-theme deleted file mode 100644 index a2cc66580f2bc..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/add-auto-open-upload-theme +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Auto open Upload Theme dialog if query parameter is present diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-require-site-breadcrumbs-classic-theme-helper-package b/projects/packages/jetpack-mu-wpcom/changelog/add-require-site-breadcrumbs-classic-theme-helper-package deleted file mode 100644 index 83a047df5f92f..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/add-require-site-breadcrumbs-classic-theme-helper-package +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Fixup project versions. diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-coming-soon-after-private b/projects/packages/jetpack-mu-wpcom/changelog/fix-coming-soon-after-private deleted file mode 100644 index e07316033b0ef..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/fix-coming-soon-after-private +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -MU WPCOM: Fix the coming soon isn't configured correctly if the settings changes from Coming Soon -> Private -> Coming Soon diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-muwpcom-sharing-modal-checkbox-alignment b/projects/packages/jetpack-mu-wpcom/changelog/fix-muwpcom-sharing-modal-checkbox-alignment deleted file mode 100644 index d27885f92b841..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/fix-muwpcom-sharing-modal-checkbox-alignment +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -MU WPCOM: Fix Post Publish Modal checkbox alignment diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-bump-mu-wpcom-sh-versions b/projects/packages/jetpack-mu-wpcom/changelog/update-bump-mu-wpcom-sh-versions deleted file mode 100644 index 6a02e9e7e749b..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/update-bump-mu-wpcom-sh-versions +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Bump package version diff --git a/projects/packages/jetpack-mu-wpcom/package.json b/projects/packages/jetpack-mu-wpcom/package.json index 8eb47d4aa06bc..112f8d5fbd830 100644 --- a/projects/packages/jetpack-mu-wpcom/package.json +++ b/projects/packages/jetpack-mu-wpcom/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom", - "version": "5.59.0-alpha", + "version": "5.59.0", "description": "Enhances your site with features powered by WordPress.com", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/jetpack-mu-wpcom/#readme", "bugs": { diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 0b3b9861b7a1a..4144312a48b3c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -15,7 +15,7 @@ * Jetpack_Mu_Wpcom main class. */ class Jetpack_Mu_Wpcom { - const PACKAGE_VERSION = '5.59.0-alpha'; + const PACKAGE_VERSION = '5.59.0'; const PKG_DIR = __DIR__ . '/../'; const BASE_DIR = __DIR__ . '/'; const BASE_FILE = __FILE__; diff --git a/projects/packages/licensing/CHANGELOG.md b/projects/packages/licensing/CHANGELOG.md index a2a05fe48bdc5..71ea1cff01a8c 100644 --- a/projects/packages/licensing/CHANGELOG.md +++ b/projects/packages/licensing/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.7] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [2.0.6] - 2024-08-19 ### Changed - Internal updates. @@ -276,6 +280,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Licensing: Add support for Jetpack licenses +[2.0.7]: https://github.com/Automattic/jetpack-licensing/compare/v2.0.6...v2.0.7 [2.0.6]: https://github.com/Automattic/jetpack-licensing/compare/v2.0.5...v2.0.6 [2.0.5]: https://github.com/Automattic/jetpack-licensing/compare/v2.0.4...v2.0.5 [2.0.4]: https://github.com/Automattic/jetpack-licensing/compare/v2.0.3...v2.0.4 diff --git a/projects/packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/licensing/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/my-jetpack/CHANGELOG.md b/projects/packages/my-jetpack/CHANGELOG.md index db4665a4eabcd..bdc0bb51e90b7 100644 --- a/projects/packages/my-jetpack/CHANGELOG.md +++ b/projects/packages/my-jetpack/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.33.0] - 2024-08-26 +### Added +- Add context switching to videopress card from yearly views to monthly views [#38979] + +### Changed +- My Jetpack: AI product class to handle better disabling tiers [#38989] +- Updated package dependencies. [#39004] + +### Fixed +- allow user currency in My Jetpack pricing [#38977] +- Fix tooltip title for videopress card [#39030] + ## [4.32.4] - 2024-08-21 ### Changed - Removed unnecessary WAF dependency in My Jetpack. [#38942] @@ -1657,6 +1669,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Created package +[4.33.0]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.32.4...4.33.0 [4.32.4]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.32.3...4.32.4 [4.32.3]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.32.2...4.32.3 [4.32.2]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.32.1...4.32.2 diff --git a/projects/packages/my-jetpack/changelog/add-context-switching-to-videopress-card b/projects/packages/my-jetpack/changelog/add-context-switching-to-videopress-card deleted file mode 100644 index dcc3c3088c751..0000000000000 --- a/projects/packages/my-jetpack/changelog/add-context-switching-to-videopress-card +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Add context switching to videopress card from yearly views to monthly views diff --git a/projects/packages/my-jetpack/changelog/add-enable-more-eslint-rules b/projects/packages/my-jetpack/changelog/add-enable-more-eslint-rules deleted file mode 100644 index db4cc1e54899d..0000000000000 --- a/projects/packages/my-jetpack/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/packages/my-jetpack/changelog/fix-my-jetpack-currency b/projects/packages/my-jetpack/changelog/fix-my-jetpack-currency deleted file mode 100644 index f30bc187aaa9d..0000000000000 --- a/projects/packages/my-jetpack/changelog/fix-my-jetpack-currency +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: fixed - -allow user currency in My Jetpack pricing diff --git a/projects/packages/my-jetpack/changelog/fix-tooltip-for-watch-time-videopress-card b/projects/packages/my-jetpack/changelog/fix-tooltip-for-watch-time-videopress-card deleted file mode 100644 index 0b1448af2178c..0000000000000 --- a/projects/packages/my-jetpack/changelog/fix-tooltip-for-watch-time-videopress-card +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Fix tooltip title for videopress card diff --git a/projects/packages/my-jetpack/changelog/my-jetpack-handle-tiers-enabled-better b/projects/packages/my-jetpack/changelog/my-jetpack-handle-tiers-enabled-better deleted file mode 100644 index 72600386aa77d..0000000000000 --- a/projects/packages/my-jetpack/changelog/my-jetpack-handle-tiers-enabled-better +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -My Jetpack: AI product class to handle better disabling tiers diff --git a/projects/packages/my-jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/my-jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/my-jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/my-jetpack/changelog/update-mj-protect-card-tooltip-in-headings b/projects/packages/my-jetpack/changelog/update-mj-protect-card-tooltip-in-headings deleted file mode 100644 index 8378243e011b5..0000000000000 --- a/projects/packages/my-jetpack/changelog/update-mj-protect-card-tooltip-in-headings +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: My Jetpack Protect Card: Moved tooltips slightly, next to heading instead of next to data item. - - diff --git a/projects/packages/my-jetpack/changelog/update-my-jetpack-protect-card-logins-blocked-font-size b/projects/packages/my-jetpack/changelog/update-my-jetpack-protect-card-logins-blocked-font-size deleted file mode 100644 index 34f56158267c2..0000000000000 --- a/projects/packages/my-jetpack/changelog/update-my-jetpack-protect-card-logins-blocked-font-size +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Small asthetic change to the font size of an element in a My Jetpack product card. - - diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index a1a7c67cc5e0c..3735b0ac72a5d 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-my-jetpack", - "version": "4.33.0-alpha", + "version": "4.33.0", "description": "WP Admin page with information and configuration shared among all Jetpack stand-alone plugins", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/my-jetpack/#readme", "bugs": { diff --git a/projects/packages/my-jetpack/src/class-initializer.php b/projects/packages/my-jetpack/src/class-initializer.php index d5be08e4ce7e9..b0be741ad3c7b 100644 --- a/projects/packages/my-jetpack/src/class-initializer.php +++ b/projects/packages/my-jetpack/src/class-initializer.php @@ -42,7 +42,7 @@ class Initializer { * * @var string */ - const PACKAGE_VERSION = '4.33.0-alpha'; + const PACKAGE_VERSION = '4.33.0'; /** * HTML container ID for the IDC screen on My Jetpack page. diff --git a/projects/packages/plugins-installer/CHANGELOG.md b/projects/packages/plugins-installer/CHANGELOG.md index d01df0842c93a..e36de6fe51a36 100644 --- a/projects/packages/plugins-installer/CHANGELOG.md +++ b/projects/packages/plugins-installer/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.2] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.4.1] - 2024-08-15 ### Fixed - Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs. [#38869] @@ -90,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix method logic +[0.4.2]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.4.1...v0.4.2 [0.4.1]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.4.0...v0.4.1 [0.4.0]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.5...v0.4.0 [0.3.5]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.4...v0.3.5 diff --git a/projects/packages/plugins-installer/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/plugins-installer/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/plugins-installer/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/protect-models/CHANGELOG.md b/projects/packages/protect-models/CHANGELOG.md index 8df2b48b6691b..b40f798bd160b 100644 --- a/projects/packages/protect-models/CHANGELOG.md +++ b/projects/packages/protect-models/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.1] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.2.0] - 2024-08-09 ### Added - Add Scan History model. [#38117] @@ -13,4 +17,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial version. [#37864] +[0.2.1]: https://github.com/Automattic/jetpack-protect-models/compare/v0.2.0...v0.2.1 [0.2.0]: https://github.com/Automattic/jetpack-protect-models/compare/v0.1.0...v0.2.0 diff --git a/projects/packages/protect-models/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/protect-models/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/protect-models/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/protect-models/package.json b/projects/packages/protect-models/package.json index b57a413a2c01a..599a6aa6abfdb 100644 --- a/projects/packages/protect-models/package.json +++ b/projects/packages/protect-models/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-protect-models", - "version": "0.2.1-alpha", + "version": "0.2.1", "description": "This package contains the models used in Protect. ", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/protect-models/#readme", "bugs": { diff --git a/projects/packages/protect-models/src/class-protect-models.php b/projects/packages/protect-models/src/class-protect-models.php index 52b2561e98e12..a479f90a6fb21 100644 --- a/projects/packages/protect-models/src/class-protect-models.php +++ b/projects/packages/protect-models/src/class-protect-models.php @@ -12,5 +12,5 @@ */ class Protect_Models { - const PACKAGE_VERSION = '0.2.1-alpha'; + const PACKAGE_VERSION = '0.2.1'; } diff --git a/projects/packages/protect-status/CHANGELOG.md b/projects/packages/protect-status/CHANGELOG.md index 911ff4cf4fdbe..a40887a960fdb 100644 --- a/projects/packages/protect-status/CHANGELOG.md +++ b/projects/packages/protect-status/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.1.2] - 2024-08-19 ### Changed - Internal updates. @@ -20,5 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated package dependencies. [#37894] +[0.1.3]: https://github.com/Automattic/jetpack-protect-status/compare/v0.1.2...v0.1.3 [0.1.2]: https://github.com/Automattic/jetpack-protect-status/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/Automattic/jetpack-protect-status/compare/v0.1.0...v0.1.1 diff --git a/projects/packages/protect-status/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/protect-status/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/protect-status/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/protect-status/package.json b/projects/packages/protect-status/package.json index 4acae10ff1b0b..5ba6a5420f228 100644 --- a/projects/packages/protect-status/package.json +++ b/projects/packages/protect-status/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-protect-status", - "version": "0.1.3-alpha", + "version": "0.1.3", "description": "This package contains the Protect Status API functionality to retrieve a site's scan status (WordPress, Themes, and Plugins threats).", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/protect-status/#readme", "bugs": { diff --git a/projects/packages/protect-status/src/class-status.php b/projects/packages/protect-status/src/class-status.php index 9f653605240d6..5d386b3202ddd 100644 --- a/projects/packages/protect-status/src/class-status.php +++ b/projects/packages/protect-status/src/class-status.php @@ -15,7 +15,7 @@ */ class Status { - const PACKAGE_VERSION = '0.1.3-alpha'; + const PACKAGE_VERSION = '0.1.3'; /** * Name of the option where status is stored * diff --git a/projects/packages/publicize/CHANGELOG.md b/projects/packages/publicize/CHANGELOG.md index 1efc95e9a3269..3932e2d010018 100644 --- a/projects/packages/publicize/CHANGELOG.md +++ b/projects/packages/publicize/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.50.0] - 2024-08-26 +### Added +- Added the new feature flag for the social share status [#39015] + +### Changed +- Social: Migrated shares data to the new script data [#38988] +- Updated package dependencies. [#39004] + ## [0.49.2] - 2024-08-21 ### Changed - Social; Migrated the API paths from initial state to the new script data [#38962] @@ -658,6 +666,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. - Update package.json metadata. +[0.50.0]: https://github.com/Automattic/jetpack-publicize/compare/v0.49.2...v0.50.0 [0.49.2]: https://github.com/Automattic/jetpack-publicize/compare/v0.49.1...v0.49.2 [0.49.1]: https://github.com/Automattic/jetpack-publicize/compare/v0.49.0...v0.49.1 [0.49.0]: https://github.com/Automattic/jetpack-publicize/compare/v0.48.0...v0.49.0 diff --git a/projects/packages/publicize/changelog/add-enable-more-eslint-rules b/projects/packages/publicize/changelog/add-enable-more-eslint-rules deleted file mode 100644 index db4cc1e54899d..0000000000000 --- a/projects/packages/publicize/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/packages/publicize/changelog/add-social-share-status-feature-flag b/projects/packages/publicize/changelog/add-social-share-status-feature-flag deleted file mode 100644 index b7fe45d10716a..0000000000000 --- a/projects/packages/publicize/changelog/add-social-share-status-feature-flag +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Added the new feature flag for the social share status diff --git a/projects/packages/publicize/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/publicize/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/publicize/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/publicize/changelog/update-social-initial-state-migrate-shares-data b/projects/packages/publicize/changelog/update-social-initial-state-migrate-shares-data deleted file mode 100644 index 40880a44a4eaa..0000000000000 --- a/projects/packages/publicize/changelog/update-social-initial-state-migrate-shares-data +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Social: Migrated shares data to the new script data diff --git a/projects/packages/publicize/package.json b/projects/packages/publicize/package.json index 200674f4d81d6..b417481070cd8 100644 --- a/projects/packages/publicize/package.json +++ b/projects/packages/publicize/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-publicize", - "version": "0.50.0-alpha", + "version": "0.50.0", "description": "Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/publicize/#readme", "bugs": { diff --git a/projects/packages/search/CHANGELOG.md b/projects/packages/search/CHANGELOG.md index 08e31596626c8..c0adaef065a3f 100644 --- a/projects/packages/search/CHANGELOG.md +++ b/projects/packages/search/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.44.17] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.44.16] - 2024-08-21 ### Changed - Internal updates. @@ -1007,6 +1011,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies. - Update PHPUnit configs to include just what needs coverage rather than include everything then try to exclude stuff that doesn't. +[0.44.17]: https://github.com/Automattic/jetpack-search/compare/v0.44.16...v0.44.17 [0.44.16]: https://github.com/Automattic/jetpack-search/compare/v0.44.15...v0.44.16 [0.44.15]: https://github.com/Automattic/jetpack-search/compare/v0.44.14...v0.44.15 [0.44.14]: https://github.com/Automattic/jetpack-search/compare/v0.44.13...v0.44.14 diff --git a/projects/packages/search/changelog/add-enable-more-eslint-rules b/projects/packages/search/changelog/add-enable-more-eslint-rules deleted file mode 100644 index db4cc1e54899d..0000000000000 --- a/projects/packages/search/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/packages/search/changelog/add-eslint-array-callback-return b/projects/packages/search/changelog/add-eslint-array-callback-return deleted file mode 100644 index f91807380615c..0000000000000 --- a/projects/packages/search/changelog/add-eslint-array-callback-return +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Fix `array-callback-return` eslint sniff. Should be no change to functionality. - - diff --git a/projects/packages/search/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/search/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/search/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/search/package.json b/projects/packages/search/package.json index ec387d612b9c5..aeca4c9411f08 100644 --- a/projects/packages/search/package.json +++ b/projects/packages/search/package.json @@ -1,6 +1,6 @@ { "name": "jetpack-search", - "version": "0.44.17-alpha", + "version": "0.44.17", "description": "Package for Jetpack Search products", "main": "main.js", "directories": { diff --git a/projects/packages/search/src/class-package.php b/projects/packages/search/src/class-package.php index 00e36df579c99..5bbf16dd606e9 100644 --- a/projects/packages/search/src/class-package.php +++ b/projects/packages/search/src/class-package.php @@ -11,7 +11,7 @@ * Search package general information */ class Package { - const VERSION = '0.44.17-alpha'; + const VERSION = '0.44.17'; const SLUG = 'search'; /** diff --git a/projects/packages/sync/CHANGELOG.md b/projects/packages/sync/CHANGELOG.md index 7942649597514..c899a777ccf01 100644 --- a/projects/packages/sync/CHANGELOG.md +++ b/projects/packages/sync/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.8.0] - 2024-08-26 +### Changed +- Sync: Updated allowed order types in HPOS Module [#39022] + +### Fixed +- Sync: Ensure filtering orders by status when doing HPOS Checksums [#39020] + ## [3.7.1] - 2024-08-23 ### Changed - Updated package dependencies. [#39004] @@ -1247,6 +1254,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Packages: Move sync to a classmapped package +[3.8.0]: https://github.com/Automattic/jetpack-sync/compare/v3.7.1...v3.8.0 [3.7.1]: https://github.com/Automattic/jetpack-sync/compare/v3.7.0...v3.7.1 [3.7.0]: https://github.com/Automattic/jetpack-sync/compare/v3.6.0...v3.7.0 [3.6.0]: https://github.com/Automattic/jetpack-sync/compare/v3.5.1...v3.6.0 diff --git a/projects/packages/sync/changelog/update-sync-hpos-add-shop-subscription-to-types b/projects/packages/sync/changelog/update-sync-hpos-add-shop-subscription-to-types deleted file mode 100644 index 77a620f96bb37..0000000000000 --- a/projects/packages/sync/changelog/update-sync-hpos-add-shop-subscription-to-types +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: changed - -Sync: Updated allowed order types in HPOS Module diff --git a/projects/packages/sync/changelog/update-sync-hpos-consider-status-for-checksum b/projects/packages/sync/changelog/update-sync-hpos-consider-status-for-checksum deleted file mode 100644 index 3609fdb7ac546..0000000000000 --- a/projects/packages/sync/changelog/update-sync-hpos-consider-status-for-checksum +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Sync: Ensure filtering orders by status when doing HPOS Checksums diff --git a/projects/packages/sync/src/class-package-version.php b/projects/packages/sync/src/class-package-version.php index b2baf58d2aeb2..138e0ac07bd3c 100644 --- a/projects/packages/sync/src/class-package-version.php +++ b/projects/packages/sync/src/class-package-version.php @@ -12,7 +12,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '3.8.0-alpha'; + const PACKAGE_VERSION = '3.8.0'; const PACKAGE_SLUG = 'sync'; diff --git a/projects/packages/videopress/CHANGELOG.md b/projects/packages/videopress/CHANGELOG.md index f5d38c61a88cd..186aacb68088a 100644 --- a/projects/packages/videopress/CHANGELOG.md +++ b/projects/packages/videopress/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.24.3] - 2024-08-26 +### Added +- Add context switching to videopress card from yearly views to monthly views [#38979] + +### Changed +- Updated package dependencies. [#39004] + ## [0.24.2] - 2024-08-21 ### Changed - Internal updates. @@ -1409,6 +1416,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Created empty package [#24952] +[0.24.3]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.2...v0.24.3 [0.24.2]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.1...v0.24.2 [0.24.1]: https://github.com/Automattic/jetpack-videopress/compare/v0.24.0...v0.24.1 [0.24.0]: https://github.com/Automattic/jetpack-videopress/compare/v0.23.31...v0.24.0 diff --git a/projects/packages/videopress/changelog/add-context-switching-to-videopress-card b/projects/packages/videopress/changelog/add-context-switching-to-videopress-card deleted file mode 100644 index dcc3c3088c751..0000000000000 --- a/projects/packages/videopress/changelog/add-context-switching-to-videopress-card +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Add context switching to videopress card from yearly views to monthly views diff --git a/projects/packages/videopress/changelog/add-enable-more-eslint-rules b/projects/packages/videopress/changelog/add-enable-more-eslint-rules deleted file mode 100644 index db4cc1e54899d..0000000000000 --- a/projects/packages/videopress/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/packages/videopress/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/videopress/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/videopress/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/videopress/package.json b/projects/packages/videopress/package.json index 40ed332f72425..60b63e65566a6 100644 --- a/projects/packages/videopress/package.json +++ b/projects/packages/videopress/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-videopress", - "version": "0.24.3-alpha", + "version": "0.24.3", "description": "VideoPress package", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/videopress/#readme", "bugs": { diff --git a/projects/packages/videopress/src/class-package-version.php b/projects/packages/videopress/src/class-package-version.php index d886445a7d192..87ae115a7475f 100644 --- a/projects/packages/videopress/src/class-package-version.php +++ b/projects/packages/videopress/src/class-package-version.php @@ -11,7 +11,7 @@ * The Package_Version class. */ class Package_Version { - const PACKAGE_VERSION = '0.24.3-alpha'; + const PACKAGE_VERSION = '0.24.3'; const PACKAGE_SLUG = 'videopress'; diff --git a/projects/packages/waf/CHANGELOG.md b/projects/packages/waf/CHANGELOG.md index a258a720b99bf..0ea7bf778f24f 100644 --- a/projects/packages/waf/CHANGELOG.md +++ b/projects/packages/waf/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.18.4] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.18.3] - 2024-08-19 ### Changed - Internal updates. @@ -355,6 +359,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Core: do not ship .phpcs.dir.xml in production builds. +[0.18.4]: https://github.com/Automattic/jetpack-waf/compare/v0.18.3...v0.18.4 [0.18.3]: https://github.com/Automattic/jetpack-waf/compare/v0.18.2...v0.18.3 [0.18.2]: https://github.com/Automattic/jetpack-waf/compare/v0.18.1...v0.18.2 [0.18.1]: https://github.com/Automattic/jetpack-waf/compare/v0.18.0...v0.18.1 diff --git a/projects/packages/waf/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/waf/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/waf/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/woocommerce-analytics/CHANGELOG.md b/projects/packages/woocommerce-analytics/CHANGELOG.md index a36da511da9ad..03e74cbea8dcd 100644 --- a/projects/packages/woocommerce-analytics/CHANGELOG.md +++ b/projects/packages/woocommerce-analytics/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.8] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.1.7] - 2024-06-26 ### Removed - Remove use of `gutenberg_get_block_template()`. Its replacement has been in WP Core since 5.8. [#38015] @@ -43,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix namespace issue with WooCommerce class reference. [#35857] - General: bail early when WooCommerce is not active. [#36278] +[0.1.8]: https://github.com/Automattic/woocommerce-analytics/compare/v0.1.7...v0.1.8 [0.1.7]: https://github.com/Automattic/woocommerce-analytics/compare/v0.1.6...v0.1.7 [0.1.6]: https://github.com/Automattic/woocommerce-analytics/compare/v0.1.5...v0.1.6 [0.1.5]: https://github.com/Automattic/woocommerce-analytics/compare/v0.1.4...v0.1.5 diff --git a/projects/packages/woocommerce-analytics/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/woocommerce-analytics/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/woocommerce-analytics/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php b/projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php index d86a2b8861117..657e7f50a182e 100644 --- a/projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php +++ b/projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php @@ -20,7 +20,7 @@ class Woocommerce_Analytics { /** * Package version. */ - const PACKAGE_VERSION = '0.1.8-alpha'; + const PACKAGE_VERSION = '0.1.8'; /** * Initializer. diff --git a/projects/packages/wordads/CHANGELOG.md b/projects/packages/wordads/CHANGELOG.md index 94f6c7768f7c7..7e3eda6f9945f 100644 --- a/projects/packages/wordads/CHANGELOG.md +++ b/projects/packages/wordads/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.28] - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## [0.3.27] - 2024-08-21 ### Changed - Internal updates. @@ -387,6 +391,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - PHPCS: Fix `WordPress.Security.ValidatedSanitizedInput` - Updated package dependencies. +[0.3.28]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.27...v0.3.28 [0.3.27]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.26...v0.3.27 [0.3.26]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.25...v0.3.26 [0.3.25]: https://github.com/Automattic/jetpack-wordads/compare/v0.3.24...v0.3.25 diff --git a/projects/packages/wordads/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/packages/wordads/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/packages/wordads/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/packages/wordads/package.json b/projects/packages/wordads/package.json index 1e8dd8e536773..e75c2b2a95c9f 100644 --- a/projects/packages/wordads/package.json +++ b/projects/packages/wordads/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-wordads", - "version": "0.3.28-alpha", + "version": "0.3.28", "description": "Earn income by allowing Jetpack to display high quality ads.", "main": "main.js", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/wordads/#readme", diff --git a/projects/packages/wordads/src/class-package.php b/projects/packages/wordads/src/class-package.php index fc5bd456e7c83..a6ce1b349a0c9 100644 --- a/projects/packages/wordads/src/class-package.php +++ b/projects/packages/wordads/src/class-package.php @@ -11,7 +11,7 @@ * WordAds package general information */ class Package { - const VERSION = '0.3.28-alpha'; + const VERSION = '0.3.28'; const SLUG = 'wordads'; /** diff --git a/projects/plugins/jetpack/CHANGELOG.md b/projects/plugins/jetpack/CHANGELOG.md index 4561d34fc2878..fa20f595afcdf 100644 --- a/projects/plugins/jetpack/CHANGELOG.md +++ b/projects/plugins/jetpack/CHANGELOG.md @@ -2,6 +2,37 @@ ### This is a list detailing changes for all Jetpack releases. +## 13.8-a.7 - 2024-08-26 +### Enhancements +- Newsletters: Adds Gutenberg plugin icon to the header, with a plugin sidebar with email preview feature. [#39039] + +### Bug fixes +- Blocks: Ensure that the Contact Info stylesheet is properly loaded. [#39018] +- Blocks: Fix the editor freeze after inserting a pattern with the Donations block. [#38961] +- Blocks: Ensure that the Payment Button stylesheet is properly loaded. [#39018] + +### Other changes +- AI Assistant: Accept Breve typo suggestions [#39008] +- AI Assistant: Add retry for Write Brief. [#38998] +- AI Assistant: Load dictionaries from CDN. [#38943] +- AI Assistant: Recompute Breve highlights when dictionary is loaded. [#38999] +- AI Assistant: Update connection button text. [#39031] +- Dashboard: Remove extra link in banner to invite admins to activate stats. [#39026] +- Newsletters: Don't prompt for connection on Simple sites. [#39064] +- Newsletters: Improve Sender Name and Reply-to settings. [#38833] +- Newsletters: Make preview non-clickable. [#39035] +- General: Adds to-test.md contents for Jetpack 13.8. [#39071] +- General: Adds tracks to featured flagged feature. [#39032] +- General: Fix incorrect case fall-through in `_inc/client/state/site/reducer.js`. [#39000] +- General: Updated package dependencies. [#39004] +- Legacy Widgets: Ensure widgets are available for Simple sites until the block API is fixed. [#38610] +- Social: Moved PostPublishPanels component to publicize-coomponents package. [#39049] +- Stats: Moved stats to the top of the Jetpack menu. [#39061] +- Sharing: Remove functions that were deprecated in Jetpack 11.0. [#38991] +- Site Breadcrumbs: Requiring the feature from the Classic Theme Helper package. [#38931] +- Subscriptions: Render the Close button lower than the Marketing bar. [#39065] +- Top Posts & Pages Block: Ensure deleted content does not display. [#37251] + ## 13.8-a.5 - 2024-08-21 ### Improved compatibility - Sharing Block: Improve performance when hooking the block into single post templates. [#38727] diff --git a/projects/plugins/jetpack/changelog/add-brief-retry-button b/projects/plugins/jetpack/changelog/add-brief-retry-button deleted file mode 100644 index e90d8a616e758..0000000000000 --- a/projects/plugins/jetpack/changelog/add-brief-retry-button +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: other - -Add retry for Write Brief diff --git a/projects/plugins/jetpack/changelog/add-enable-more-eslint-rules b/projects/plugins/jetpack/changelog/add-enable-more-eslint-rules deleted file mode 100644 index 2f20b8281c895..0000000000000 --- a/projects/plugins/jetpack/changelog/add-enable-more-eslint-rules +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Resolve new eslint sniffs. Should be no changes to functionality. - - diff --git a/projects/plugins/jetpack/changelog/add-enable-more-eslint-rules#2 b/projects/plugins/jetpack/changelog/add-enable-more-eslint-rules#2 deleted file mode 100644 index b42e4c050a317..0000000000000 --- a/projects/plugins/jetpack/changelog/add-enable-more-eslint-rules#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Fix incorrect case fall-through in `_inc/client/state/site/reducer.js`. diff --git a/projects/plugins/jetpack/changelog/add-eslint-array-callback-return b/projects/plugins/jetpack/changelog/add-eslint-array-callback-return deleted file mode 100644 index fea829fa4fea6..0000000000000 --- a/projects/plugins/jetpack/changelog/add-eslint-array-callback-return +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Fix `array-callback-return` eslint sniff. Should be no change to functionality. - - diff --git a/projects/plugins/jetpack/changelog/add-require-site-breadcrumbs-classic-theme-helper-package b/projects/plugins/jetpack/changelog/add-require-site-breadcrumbs-classic-theme-helper-package deleted file mode 100644 index 0754bfb8d3d80..0000000000000 --- a/projects/plugins/jetpack/changelog/add-require-site-breadcrumbs-classic-theme-helper-package +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Site Breadcrumbs: Requiring the feature from the Classic Theme Helper package. diff --git a/projects/plugins/jetpack/changelog/add-social-share-status-feature-flag b/projects/plugins/jetpack/changelog/add-social-share-status-feature-flag deleted file mode 100644 index a1c1831fa1ef7..0000000000000 --- a/projects/plugins/jetpack/changelog/add-social-share-status-feature-flag +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Updated composer.lock. - - diff --git a/projects/plugins/jetpack/changelog/fix-donation-block b/projects/plugins/jetpack/changelog/fix-donation-block deleted file mode 100644 index f10ddc0716aaa..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-donation-block +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Donations Block: Fix the editor got stuck after inserting a pattern with the donations block diff --git a/projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons b/projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons deleted file mode 100644 index 5c1ca23b95513..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Payment Button Blocks: ensure that the buttons' stylesheet is properly loaded on the frontend. diff --git a/projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons#2 b/projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons#2 deleted file mode 100644 index 78b6e145d19da..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-load-assets-payment-buttons#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: bugfix - -Contact Info Block: ensure that the buttons' stylesheet is properly loaded on the frontend. diff --git a/projects/plugins/jetpack/changelog/fix-my-jetpack-currency b/projects/plugins/jetpack/changelog/fix-my-jetpack-currency deleted file mode 100644 index a1c1831fa1ef7..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-my-jetpack-currency +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Updated composer.lock. - - diff --git a/projects/plugins/jetpack/changelog/fix-top-posts-deleted b/projects/plugins/jetpack/changelog/fix-top-posts-deleted deleted file mode 100644 index 9a4460a2ad2ac..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-top-posts-deleted +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Top Posts & Pages Block: ensure deleted content does not display. diff --git a/projects/plugins/jetpack/changelog/fix-welcome-overlay-close-button-fix b/projects/plugins/jetpack/changelog/fix-welcome-overlay-close-button-fix deleted file mode 100644 index 5e68d91f44ce4..0000000000000 --- a/projects/plugins/jetpack/changelog/fix-welcome-overlay-close-button-fix +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Subscriptions: Render the Close button lower than the Marketing bar diff --git a/projects/plugins/jetpack/changelog/improve-newsletter-settings-sender-information-ia b/projects/plugins/jetpack/changelog/improve-newsletter-settings-sender-information-ia deleted file mode 100644 index 57d194d0dd2f1..0000000000000 --- a/projects/plugins/jetpack/changelog/improve-newsletter-settings-sender-information-ia +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Jetpack Newsletter Settings: Improve Sender Name and Reply-to IA diff --git a/projects/plugins/jetpack/changelog/fix-simple-sites-prompts-connection b/projects/plugins/jetpack/changelog/init-release-cycle similarity index 57% rename from projects/plugins/jetpack/changelog/fix-simple-sites-prompts-connection rename to projects/plugins/jetpack/changelog/init-release-cycle index 17475b319a723..fdd0d1aa51dd2 100644 --- a/projects/plugins/jetpack/changelog/fix-simple-sites-prompts-connection +++ b/projects/plugins/jetpack/changelog/init-release-cycle @@ -1,4 +1,5 @@ Significance: patch Type: other +Comment: Init 13.8-a.8 + -wpcom only diff --git a/projects/plugins/jetpack/changelog/refactor-social-post-publish-panel b/projects/plugins/jetpack/changelog/refactor-social-post-publish-panel deleted file mode 100644 index a4c11c733d294..0000000000000 --- a/projects/plugins/jetpack/changelog/refactor-social-post-publish-panel +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: other - -Moved PostPublishPanels component to publicize-coomponents package diff --git a/projects/plugins/jetpack/changelog/remove-deprecated-sharedaddy-functions b/projects/plugins/jetpack/changelog/remove-deprecated-sharedaddy-functions deleted file mode 100644 index 6035c051ce360..0000000000000 --- a/projects/plugins/jetpack/changelog/remove-deprecated-sharedaddy-functions +++ /dev/null @@ -1,4 +0,0 @@ -Significance: major -Type: other - -Sharing: remove functions that were deprecated in Jetpack 11.0. diff --git a/projects/plugins/jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/plugins/jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index 1eaea6a769e84..0000000000000 --- a/projects/plugins/jetpack/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Updated package dependencies. diff --git a/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-load-dictionary-from-server b/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-load-dictionary-from-server deleted file mode 100644 index 5c99eb30b2351..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-load-dictionary-from-server +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -AI Assistant: Load dictionaries from CDN diff --git a/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-recompute-highlights b/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-recompute-highlights deleted file mode 100644 index c99d0ff14710f..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-recompute-highlights +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -AI Assistant: Recompute Breve highlights when dictionary is loaded diff --git a/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-spelling-suggestion b/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-spelling-suggestion deleted file mode 100644 index 7d8342a89b286..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-ai-breve-spelling-suggestion +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -AI Assistant: Accept Breve typo suggestions diff --git a/projects/plugins/jetpack/changelog/update-jetpack-ai-reconnect-text b/projects/plugins/jetpack/changelog/update-jetpack-ai-reconnect-text deleted file mode 100644 index 064f2fe993820..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-ai-reconnect-text +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -AI Assistant: Update connection button text diff --git a/projects/plugins/jetpack/changelog/update-jetpack-menu-order-stats-first b/projects/plugins/jetpack/changelog/update-jetpack-menu-order-stats-first deleted file mode 100644 index 9cd02b3b1b79d..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-menu-order-stats-first +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -moves stats to the top of the Jetpack menu diff --git a/projects/plugins/jetpack/changelog/update-jetpack-to-test b/projects/plugins/jetpack/changelog/update-jetpack-to-test deleted file mode 100644 index 13cc3910fb087..0000000000000 --- a/projects/plugins/jetpack/changelog/update-jetpack-to-test +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Changes to to-test.md only. - - diff --git a/projects/plugins/jetpack/changelog/update-legacy-stats-widgets b/projects/plugins/jetpack/changelog/update-legacy-stats-widgets deleted file mode 100644 index e96cff0117470..0000000000000 --- a/projects/plugins/jetpack/changelog/update-legacy-stats-widgets +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Legacy Widgets: ensure Blog Stats and Top Posts and Pages widgets are still available for Simple sites until the block API is fixed. diff --git a/projects/plugins/jetpack/changelog/update-newsletter-preview-add-tracks b/projects/plugins/jetpack/changelog/update-newsletter-preview-add-tracks deleted file mode 100644 index 8762d3992f5ca..0000000000000 --- a/projects/plugins/jetpack/changelog/update-newsletter-preview-add-tracks +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -adds tracks to featured flagged feature diff --git a/projects/plugins/jetpack/changelog/update-newsletter-preview-feature-flag b/projects/plugins/jetpack/changelog/update-newsletter-preview-feature-flag deleted file mode 100644 index e40030947f3ee..0000000000000 --- a/projects/plugins/jetpack/changelog/update-newsletter-preview-feature-flag +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: enhancement - -Adds Gutenberg Newsletter plugin icon to the header, with a plugin sidebar with email preview feature. \ No newline at end of file diff --git a/projects/plugins/jetpack/changelog/update-preview-email-no-clicks b/projects/plugins/jetpack/changelog/update-preview-email-no-clicks deleted file mode 100644 index 638a997147032..0000000000000 --- a/projects/plugins/jetpack/changelog/update-preview-email-no-clicks +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -feature flagged diff --git a/projects/plugins/jetpack/changelog/update-stats-banner-activate b/projects/plugins/jetpack/changelog/update-stats-banner-activate deleted file mode 100644 index 424ad1c172960..0000000000000 --- a/projects/plugins/jetpack/changelog/update-stats-banner-activate +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Dashboard: remove extra link in banner to invite admins to activate stats. diff --git a/projects/plugins/jetpack/changelog/update-sync-hpos-add-shop-subscription-to-types b/projects/plugins/jetpack/changelog/update-sync-hpos-add-shop-subscription-to-types deleted file mode 100644 index a1c1831fa1ef7..0000000000000 --- a/projects/plugins/jetpack/changelog/update-sync-hpos-add-shop-subscription-to-types +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Updated composer.lock. - - diff --git a/projects/plugins/jetpack/changelog/update-sync-locale b/projects/plugins/jetpack/changelog/update-sync-locale deleted file mode 100644 index a1c1831fa1ef7..0000000000000 --- a/projects/plugins/jetpack/changelog/update-sync-locale +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: other -Comment: Updated composer.lock. - - diff --git a/projects/plugins/jetpack/changelog/update-to-test-jetpack-13.8 b/projects/plugins/jetpack/changelog/update-to-test-jetpack-13.8 deleted file mode 100644 index 52b6d86802718..0000000000000 --- a/projects/plugins/jetpack/changelog/update-to-test-jetpack-13.8 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: other - -Added to-test.md contents for Jetpack 13.8. diff --git a/projects/plugins/jetpack/composer.json b/projects/plugins/jetpack/composer.json index 0a62971c55039..989f1ba911ff0 100644 --- a/projects/plugins/jetpack/composer.json +++ b/projects/plugins/jetpack/composer.json @@ -102,7 +102,7 @@ "platform": { "ext-intl": "0.0.0" }, - "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ13_8_a_6", + "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ13_8_a_8", "allow-plugins": { "automattic/jetpack-autoloader": true, "automattic/jetpack-composer-plugin": true diff --git a/projects/plugins/jetpack/jetpack.php b/projects/plugins/jetpack/jetpack.php index a2994902def77..b3f68ab39d133 100644 --- a/projects/plugins/jetpack/jetpack.php +++ b/projects/plugins/jetpack/jetpack.php @@ -4,7 +4,7 @@ * Plugin URI: https://jetpack.com * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. * Author: Automattic - * Version: 13.8-a.6 + * Version: 13.8-a.8 * Author URI: https://jetpack.com * License: GPL2+ * Text Domain: jetpack @@ -34,7 +34,7 @@ define( 'JETPACK__MINIMUM_WP_VERSION', '6.5' ); define( 'JETPACK__MINIMUM_PHP_VERSION', '7.0' ); -define( 'JETPACK__VERSION', '13.8-a.6' ); +define( 'JETPACK__VERSION', '13.8-a.8' ); /** * Constant used to fetch the connection owner token diff --git a/projects/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php b/projects/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php index 5648645cdbfb0..d43df4a6aaa24 100644 --- a/projects/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php +++ b/projects/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php @@ -23,7 +23,7 @@ * @phan-suppress PhanRedefineFunction -- Covered by function_exists check. */ function jetpack_breadcrumbs() { - _deprecated_function( __FUNCTION__, 'jetpack-$$next-version$$' ); + _deprecated_function( __FUNCTION__, 'jetpack-13.8' ); $taxonomy = is_category() ? 'category' : get_query_var( 'taxonomy' ); $is_taxonomy_hierarchical = is_taxonomy_hierarchical( $taxonomy ); @@ -81,7 +81,7 @@ function jetpack_breadcrumbs() { * @return string A list of links to the term parents. */ function jetpack_get_term_parents( $term, $taxonomy, $visited = array() ) { - _deprecated_function( __FUNCTION__, 'jetpack-$$next-version$$' ); + _deprecated_function( __FUNCTION__, 'jetpack-13.8' ); $parent = get_term( $term, $taxonomy ); if ( is_wp_error( $parent ) ) { diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index b9a672b029661..22f10d1c21e24 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -1,6 +1,6 @@ { "name": "Jetpack", - "version": "13.8.0-a.6", + "version": "13.8.0-a.8", "private": true, "description": "[Jetpack](https://jetpack.com/) is a WordPress plugin that supercharges your self-hosted WordPress site with the awesome cloud power of [WordPress.com](https://wordpress.com).", "homepage": "https://jetpack.com", diff --git a/projects/plugins/jetpack/readme.txt b/projects/plugins/jetpack/readme.txt index 6f38bf6fa1fa8..17e333e9980a0 100644 --- a/projects/plugins/jetpack/readme.txt +++ b/projects/plugins/jetpack/readme.txt @@ -326,14 +326,14 @@ Jetpack Backup can do a full website migration to a new host, migrate theme file == Changelog == -### 13.8-a.5 - 2024-08-21 -#### Improved compatibility -- Sharing Block: Improve performance when hooking the block into single post templates. -- WordPress.com Toolbar: Removed feature from self-hosted Jetpack sites. +### 13.8-a.7 - 2024-08-26 +#### Enhancements +- Newsletters: Adds Gutenberg plugin icon to the header, with a plugin sidebar with email preview feature. #### Bug fixes -- Social Icons Widget: Ensure the social network icons are displayed properly. -- Social Menus: Ensure the SVG can be displayed properly. +- Blocks: Ensure that the Contact Info stylesheet is properly loaded. +- Blocks: Fix the editor freeze after inserting a pattern with the Donations block. +- Blocks: Ensure that the Payment Button stylesheet is properly loaded. -------- diff --git a/projects/plugins/mu-wpcom-plugin/CHANGELOG.md b/projects/plugins/mu-wpcom-plugin/CHANGELOG.md index db6753e818788..e80e2b04c4d12 100644 --- a/projects/plugins/mu-wpcom-plugin/CHANGELOG.md +++ b/projects/plugins/mu-wpcom-plugin/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 2.5.9 - 2024-08-26 +### Changed +- Updated package dependencies. [#39004] + ## 2.5.8 - 2024-08-21 ### Changed - Internal updates. diff --git a/projects/plugins/mu-wpcom-plugin/changelog/2024-08-23-20-00-33-323045 b/projects/plugins/mu-wpcom-plugin/changelog/2024-08-23-20-00-33-323045 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/2024-08-23-20-00-33-323045 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/changelog/add-require-site-breadcrumbs-classic-theme-helper-package b/projects/plugins/mu-wpcom-plugin/changelog/add-require-site-breadcrumbs-classic-theme-helper-package deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/add-require-site-breadcrumbs-classic-theme-helper-package +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x b/projects/plugins/mu-wpcom-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x deleted file mode 100644 index c47cb18e82997..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/renovate-yoast-phpunit-polyfills-1.x +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: changed - -Updated package dependencies. diff --git a/projects/plugins/mu-wpcom-plugin/changelog/update-locale-to-wpcom b/projects/plugins/mu-wpcom-plugin/changelog/update-locale-to-wpcom deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/update-locale-to-wpcom +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-hpos-add-shop-subscription-to-types b/projects/plugins/mu-wpcom-plugin/changelog/update-sync-hpos-add-shop-subscription-to-types deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-hpos-add-shop-subscription-to-types +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale b/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#2 b/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#2 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#3 b/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#3 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/mu-wpcom-plugin/changelog/update-sync-locale#3 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index 06761d8c139fe..1ae32bc17eb2d 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_5_9_alpha" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_5_9" } } diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index 110b1dc5349fb..eb7b62e47d0a4 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.5.9-alpha + * Version: 2.5.9 * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index 9db3523b0cfb8..14c2171ae8790 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.5.9-alpha", + "version": "2.5.9", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { diff --git a/projects/plugins/wpcomsh/CHANGELOG.md b/projects/plugins/wpcomsh/CHANGELOG.md index 50c7836675468..3da52e21ac72c 100644 --- a/projects/plugins/wpcomsh/CHANGELOG.md +++ b/projects/plugins/wpcomsh/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 5.6.1 - 2024-08-26 +### Changed +- Internal updates. + ## 5.6.0 - 2024-08-23 ### Added - Added social share status feature [#39023] diff --git a/projects/plugins/wpcomsh/changelog/2024-08-23-20-00-33-498038 b/projects/plugins/wpcomsh/changelog/2024-08-23-20-00-33-498038 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/wpcomsh/changelog/2024-08-23-20-00-33-498038 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/wpcomsh/changelog/add-require-site-breadcrumbs-classic-theme-helper-package b/projects/plugins/wpcomsh/changelog/add-require-site-breadcrumbs-classic-theme-helper-package deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/wpcomsh/changelog/add-require-site-breadcrumbs-classic-theme-helper-package +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/wpcomsh/changelog/update-sync-hpos-add-shop-subscription-to-types b/projects/plugins/wpcomsh/changelog/update-sync-hpos-add-shop-subscription-to-types deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/wpcomsh/changelog/update-sync-hpos-add-shop-subscription-to-types +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index e7b1b3dbd6db5..6f4dac134ddce 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -127,7 +127,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_6_1_alpha" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_6_1" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index 4e0db15fc8a80..2c1ed7594222a 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "5.6.1-alpha", + "version": "5.6.1", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index 4423258eac638..fce7f8c0d00aa 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,14 +2,14 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 5.6.1-alpha + * Version: 5.6.1 * Author: Automattic * Author URI: http://automattic.com/ * * @package wpcomsh */ -define( 'WPCOMSH_VERSION', '5.6.1-alpha' ); +define( 'WPCOMSH_VERSION', '5.6.1' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' ); From e257a9080a0e6dbc3ac735b74a888f5980506247 Mon Sep 17 00:00:00 2001 From: Kosta Date: Mon, 26 Aug 2024 18:14:09 +0200 Subject: [PATCH 4/5] Fix comment redirect (#39027) --- projects/plugins/jetpack/changelog/fix-comment-redirect | 4 ++++ projects/plugins/jetpack/modules/comments/comments.php | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/fix-comment-redirect diff --git a/projects/plugins/jetpack/changelog/fix-comment-redirect b/projects/plugins/jetpack/changelog/fix-comment-redirect new file mode 100644 index 0000000000000..9df54534a9c2e --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-comment-redirect @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Fix redirecting after comment when subscription modal is disabled diff --git a/projects/plugins/jetpack/modules/comments/comments.php b/projects/plugins/jetpack/modules/comments/comments.php index 4a40011a86952..f7cd5fac70061 100644 --- a/projects/plugins/jetpack/modules/comments/comments.php +++ b/projects/plugins/jetpack/modules/comments/comments.php @@ -1010,11 +1010,9 @@ public function capture_comment_post_redirect_to_reload_parent_frame( $url ) {