diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-04-15 13:45:45 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-04-15 13:45:45 +0200 |
commit | ae7c596cf4e6a0a09ebcf01fe8ae98789360c5be (patch) | |
tree | f156252e404e9893922cb5d984fdc646644b6c17 /_cs/DokuWiki/Sniffs | |
parent | f41c79d730286e8e8c95deb88a4c876e08e278a2 (diff) | |
parent | 026b314868ee80aca644bf4107f78d8e8052b43e (diff) | |
download | rpg-ae7c596cf4e6a0a09ebcf01fe8ae98789360c5be.tar.gz rpg-ae7c596cf4e6a0a09ebcf01fe8ae98789360c5be.tar.bz2 |
Merge branch 'master' into htmlmail
* master: (382 commits)
Romanian language update
Marathi language update
Arabic Language Update
when there's not enough space for images, make sure they stay proportional (might be FS#2480)
added minimal RTL print styles (part of FS#2185)
moved plugins' rtl.css to their style.css counterpart (part of FS#2185)
removed all browser-specific gradients as the recently (in 42ff6730) introduced svg makes them unnecessary
removed comments from accidentally commented lines in tpl_includeFile()
removed obsolete template file
added tpl_includeFile() to core
Make getTitle method in remote interface public
Changed an error code in XML-RPC interface. This error hasn't anything to do with the rest of the -32600 errors.
BG: language update
Korean language update
fixed performance issues with gradient in Firefox (which also added gradient support for IE9) (FS#2447)
deleted very old (and unused) images
added accidentally removed '<?php' back in (was in 57fc5edd)
wrapped X-UA-Compatible meta tag with conditional comments
added explanation to todo in _forms.css
removed problematic 'overflow: hidden' from lists again ('unfixes' FS#1950)
...
Conflicts:
inc/auth.php
inc/load.php
Diffstat (limited to '_cs/DokuWiki/Sniffs')
3 files changed, 147 insertions, 3 deletions
diff --git a/_cs/DokuWiki/Sniffs/NamingConventions/ConstructorNameSniff.php b/_cs/DokuWiki/Sniffs/NamingConventions/ConstructorNameSniff.php new file mode 100644 index 000000000..7dd6d9366 --- /dev/null +++ b/_cs/DokuWiki/Sniffs/NamingConventions/ConstructorNameSniff.php @@ -0,0 +1,85 @@ +<?php +/** + * Generic_Sniffs_NamingConventions_ConstructorNameSniff. + * + * PHP version 5 + * + * @category PHP + * @package PHP_CodeSniffer + * @author Greg Sherwood <gsherwood@squiz.net> + * @author Leif Wickland <lwickland@rightnow.com> + * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600) + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +if (class_exists('PHP_CodeSniffer_Standards_AbstractScopeSniff', true) === false) { + $error = 'Class PHP_CodeSniffer_Standards_AbstractScopeSniff not found'; + throw new PHP_CodeSniffer_Exception($error); +} + +/** + * Generic_Sniffs_NamingConventions_ConstructorNameSniff. + * + * Favor PHP 5 constructor syntax, which uses "function __construct()". + * Avoid PHP 4 constructor syntax, which uses "function ClassName()". + * + * @category PHP + * @package PHP_CodeSniffer + * @author Leif Wickland <lwickland@rightnow.com> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version Release: 1.3.3 + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class DokuWiki_Sniffs_NamingConventions_ConstructorNameSniff extends Generic_Sniffs_NamingConventions_ConstructorNameSniff +{ + /** + * Processes this test when one of its tokens is encountered. + * + * @param PHP_CodeSniffer_File $phpcsFile The current file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * @param int $currScope A pointer to the start of the scope. + * + * @return void + */ + protected function processTokenWithinScope( + PHP_CodeSniffer_File $phpcsFile, + $stackPtr, + $currScope + ) { + $className = $phpcsFile->getDeclarationName($currScope); + $methodName = $phpcsFile->getDeclarationName($stackPtr); + + if (strcasecmp($methodName, $className) === 0) { + $error = 'PHP4 style constructors are discouraged; use "__construct()" instead'; + $phpcsFile->addWarning($error, $stackPtr, 'OldStyle'); + } else if (strcasecmp($methodName, '__construct') !== 0) { + // Not a constructor. + return; + } + + $tokens = $phpcsFile->getTokens(); + + $parentClassName = $phpcsFile->findExtendedClassName($currScope); + if ($parentClassName === false) { + return; + } + + $endFunctionIndex = $tokens[$stackPtr]['scope_closer']; + $startIndex = $stackPtr; + while ($doubleColonIndex = $phpcsFile->findNext(array(T_DOUBLE_COLON), $startIndex, $endFunctionIndex)) { + if ($tokens[($doubleColonIndex + 1)]['code'] === T_STRING + && $tokens[($doubleColonIndex + 1)]['content'] === $parentClassName + ) { + $error = 'PHP4 style calls to parent constructors are discouraged; use "parent::__construct()" instead'; + $phpcsFile->addWarning($error, ($doubleColonIndex + 1), 'OldStyleCall'); + } + + $startIndex = ($doubleColonIndex + 1); + } + + }//end processTokenWithinScope() + + +}//end class diff --git a/_cs/DokuWiki/Sniffs/PHP/DeprecatedFunctionsSniff.php b/_cs/DokuWiki/Sniffs/PHP/DeprecatedFunctionsSniff.php new file mode 100644 index 000000000..ecd4093b8 --- /dev/null +++ b/_cs/DokuWiki/Sniffs/PHP/DeprecatedFunctionsSniff.php @@ -0,0 +1,61 @@ +<?php +/** + * DokuWiki_Sniffs_PHP_DiscouragedFunctionsSniff. + * + * PHP version 5 + * + * @category PHP + * @package PHP_CodeSniffer + * @author Greg Sherwood <gsherwood@squiz.net> + * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version CVS: $Id: DiscouragedFunctionsSniff.php 265110 2008-08-19 06:36:11Z squiz $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +if (class_exists('Generic_Sniffs_PHP_ForbiddenFunctionsSniff', true) === false) { + throw new PHP_CodeSniffer_Exception('Class Generic_Sniffs_PHP_ForbiddenFunctionsSniff not found'); +} + +/** + * DokuWiki_Sniffs_PHP_DiscouragedFunctionsSniff. + * + * @category PHP + * @package PHP_CodeSniffer + * @author Greg Sherwood <gsherwood@squiz.net> + * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version Release: 1.2.2 + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class DokuWiki_Sniffs_PHP_DeprecatedFunctionsSniff extends Generic_Sniffs_PHP_ForbiddenFunctionsSniff +{ + + /** + * A list of forbidden functions with their alternatives. + * + * The value is NULL if no alternative exists. IE, the + * function should just not be used. + * + * @var array(string => string|null) + */ + protected $forbiddenFunctions = array( + 'setCorrectLocale' => null, + 'html_attbuild' => 'buildAttributes', + 'io_runcmd' => null, + 'p_wiki_xhtml_summary' => 'p_cached_output', + 'search_callback' => 'call_user_func_array', + 'search_backlinks' => 'ft_backlinks', + 'search_fulltext' => 'Fulltext Indexer', + 'search_regex' => 'Fulltext Indexer', + 'tpl_getFavicon' => 'tpl_getMediaFile', + ); + + /** + * If true, an error will be thrown; otherwise a warning. + * + * @var bool + */ + public $error = true; + +}//end class diff --git a/_cs/DokuWiki/Sniffs/PHP/DiscouragedFunctionsSniff.php b/_cs/DokuWiki/Sniffs/PHP/DiscouragedFunctionsSniff.php index c95e0fd33..9cd9a7d36 100644 --- a/_cs/DokuWiki/Sniffs/PHP/DiscouragedFunctionsSniff.php +++ b/_cs/DokuWiki/Sniffs/PHP/DiscouragedFunctionsSniff.php @@ -49,8 +49,6 @@ class DokuWiki_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_F * * @var bool */ - protected $error = false; + public $error = false; }//end class - -?> |