HTML formatting: TWO fixes in one! Fixed a bug introduced in 2.3.0-beta: the stylesheet cannot be defined within the email templates (aka ActionEmail) anymore. Instead, a default (ready for use) stylesheet is provided into /css/email.css and it can be overriden by the configuration parameter email_css. The fix consists in transforming the stylesheet into inline style... which fixes a limitation of gmail and Outlook that support only the inline styles. The implementation relies on a new library: emogrifier. This library has been changed (home-made utility) to be compatible with PHP 5.3 (declaration of arrays).

SVN:trunk[4277]
This commit is contained in:
Romain Quetiez
2016-07-04 15:06:28 +00:00
parent 8582f6da70
commit 396c4564b4
15 changed files with 2922 additions and 3 deletions

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="PPW Coding Standard">
<description>This is the coding standard used for the Emogrifier code.
This standard has been tested with to work with PHP_CodeSniffer >= 2.3.0.
</description>
<!--The complete PSR-2 ruleset-->
<rule ref="PSR2"/>
<!-- Arrays -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<!-- Classes -->
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Squiz.Classes.ClassFileName"/>
<rule ref="Squiz.Classes.DuplicateProperty"/>
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
<rule ref="Squiz.Classes.SelfMemberReference"/>
<!-- Code analysis -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<!-- Commenting -->
<rule ref="Generic.Commenting.Fixme"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="PEAR.Commenting.InlineComment"/>
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
<rule ref="Squiz.Commenting.PostStatementComment"/>
<rule ref="TYPO3SniffPool.Commenting.ClassComment"/>
<rule ref="TYPO3SniffPool.Commenting.DoubleSlashCommentsInNewLine"/>
<rule ref="TYPO3SniffPool.Commenting.SpaceAfterDoubleSlash"/>
<!-- Control structures -->
<rule ref="PEAR.ControlStructures.ControlSignature"/>
<rule ref="TYPO3SniffPool.ControlStructures.DisallowEachInLoopCondition"/>
<rule ref="TYPO3SniffPool.ControlStructures.DisallowElseIfConstruct"/>
<rule ref="TYPO3SniffPool.ControlStructures.ExtraBracesByAssignmentInLoop"/>
<rule ref="TYPO3SniffPool.ControlStructures.SwitchDeclaration"/>
<rule ref="TYPO3SniffPool.ControlStructures.TernaryConditionalOperator"/>
<rule ref="TYPO3SniffPool.ControlStructures.UnusedVariableInForEachLoop"/>
<!-- Debug -->
<rule ref="Generic.Debug.ClosureLinter"/>
<rule ref="TYPO3SniffPool.Debug.DebugCode"/>
<!-- Files -->
<rule ref="Generic.Files.OneClassPerFile"/>
<rule ref="Generic.Files.OneInterfacePerFile"/>
<rule ref="TYPO3SniffPool.Files.FileExtension"/>
<rule ref="TYPO3SniffPool.Files.Filename"/>
<rule ref="TYPO3SniffPool.Files.IncludingFile"/>
<rule ref="Zend.Files.ClosingTag"/>
<!-- Formatting -->
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="PEAR.Formatting.MultiLineAssignment"/>
<!-- Functions -->
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Squiz.Functions.FunctionDuplicateArgument"/>
<rule ref="Squiz.Functions.GlobalFunction"/>
<!-- Metrics -->
<!-- Enable this rule when the cyclomatic complexity of all methods is sufficiently low. -->
<!--<rule ref="Generic.Metrics.CyclomaticComplexity"/>-->
<rule ref="Generic.Metrics.NestingLevel"/>
<!-- Naming conventions -->
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="PEAR.NamingConventions.ValidClassName"/>
<rule ref="TYPO3SniffPool.NamingConventions.ValidFunctionName"/>
<rule ref="TYPO3SniffPool.NamingConventions.ValidVariableName"/>
<!-- Objects -->
<rule ref="Squiz.Objects.ObjectMemberComma"/>
<!-- Operators -->
<rule ref="Squiz.Operators.IncrementDecrementUsage"/>
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
<!-- PHP -->
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.PHP.NoSilencedErrors"/>
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
<property name="maxPercentage" value="70"/>
</properties>
</rule>
<rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
<rule ref="Squiz.PHP.Eval"/>
<rule ref="Squiz.PHP.ForbiddenFunctions"/>
<rule ref="Squiz.PHP.GlobalKeyword"/>
<rule ref="Squiz.PHP.Heredoc"/>
<rule ref="Squiz.PHP.InnerFunctions"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.PHP.NonExecutableCode"/>
<!-- Scope -->
<rule ref="Squiz.Scope.MemberVarScope"/>
<rule ref="Squiz.Scope.StaticThisUsage"/>
<rule ref="TYPO3SniffPool.Scope.AlwaysReturn">
<exclude-pattern>*/Tests/*</exclude-pattern>
</rule>
<!--Strings-->
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
<rule ref="TYPO3SniffPool.Strings.ConcatenationSpacing"/>
<rule ref="TYPO3SniffPool.Strings.UnnecessaryStringConcat"/>
<!-- Whitespace -->
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing"/>
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<rule ref="TYPO3SniffPool.WhiteSpace.NoWhitespaceAtInDecrement"/>
<rule ref="TYPO3SniffPool.WhiteSpace.ScopeClosingBrace"/>
<rule ref="TYPO3SniffPool.WhiteSpace.WhitespaceAfterCommentSigns"/>
</ruleset>