Commit graph

21 commits

Author SHA1 Message Date
Rua Haszard
7bd2171866
reinstate phpcs php linting (#1463)
* update squizlabs/php_codesniffer and WP coding standards to latest

* revamp phpcs sniffer rulesets:
- update to php-compatibility (wimg is defunct)
- add version for woocommerce-sniffs

* streamline phpcs config (get it working at all):
- update min WP version to 5.3
- remove references to rules we don't have installed
  - WordPress.VIP
  - WordPress.XSS

* fix 2x phpcs errors (automatically via phpcbf)

* update phps ignore unescaped output comment to current format

* add npm scripts for php linter and linter autofixer

* auto-fix PHP linter errors using phpcbf :

Before phpcbf:

[x] PEAR      Functions           Function call signature multiple arguments          127
[x] Generic   White space         Disallow space indent spaces used                   10
[ ] WordPres  WP                  Enqueued resource parameters missing version        6
[ ] PHPCompa  Language construct  New language constructs t_ns_separator found        4
[ ] WordPres  Security            Escape output output not escaped                    4
[ ] PHPCompa  Parameter values    New HTMLEntities encoding default not set           2
[ ] WordPres  Date time           Restricted functions date_date                      2
[x] Generic   Files               End file newline not found                          1
[x] PEAR      Functions           Function call signature close bracket line          1
[x] PEAR      Functions           Function call signature content after open bracket  1
[x] Squiz     White space         Superfluous whitespace end line                     1
[x] WordPres  Arrays              Comma after array item no comma                     1

phpcbf fixed all [x] violations, all whitespace/formatting

After phpcbf:

WordPres  WP                  Enqueued resource parameters missing version      6
PHPCompa  Language construct  New language constructs t_ns_separator found      4
WordPres  Security            Escape output output not escaped                  4
PHPCompa  Parameter values    New HTMLEntities encoding default not set         2
WordPres  Date time           Restricted functions date_date                    2

Note - this commit does not include auto-fixed files with other
violations. These will follow in separate commit (after fixing!)

* fix phpcs violations:
- numerous formatting issues fixed automatically
- manually fix missing version param in calls to wp_enqueue_style

* fix phpcs violations:
- numerous formatting issues fixed automatically
- fix missing deps param in call to wp_enqueue_style

* update phpcs test php version to match min requirement (5.6)

* fix phpcs violations including some missing escaping:
- numerous formatting issues fixed automatically
- prefer gmdate() over potentially ambiguous date()
- escape output (a real issue!) of comment dates

* fix violations (all automated formatting fixes)

* reinstate WordPress rule/standard in phpcs.xml (minimise PR changes)

* exclude build (pre-zip) ./storefront & tighten excludes for dep folders

* bulk-update Security.EscapeOutput.OutputNotEscaped ignore comment:
- the previous comment format is no longer supported
- bulk replacing these to reduce phpcs warning overhead
2020-09-21 15:50:46 +01:00
Tiago Noronha
ad5df439b8 Remove wp_kses_post() from shortcode output 2018-06-22 16:09:20 +01:00
Tiago Noronha
169c21e35a Fix PHPCS violations 2018-06-22 15:11:39 +01:00
Tiago Noronha
901fa313cd Localize strings in 404 template 2017-06-23 12:42:45 +03:00
James Koster
1906be48f9 deprecate is_woocommerce_activated() and make pluggable
also adds storefront_is_woocommerce_activated()
2016-11-10 10:22:29 +00:00
James Koster
89eb8587d3 coding standards tidy up 2016-08-01 11:17:10 +01:00
opportus
d618424cea improved semantic html - 404 2016-07-28 15:24:39 +02:00
James Koster
1409ee5c66 lots of coding standards tweaks. #326 2016-02-19 16:57:56 +00:00
James Koster
97eebe0924 A large code cleanup and sets $storefront_version as a global var
* Strip spaces
* more efficient syntax
* Coding standards compliance
2016-02-04 13:16:31 +00:00
James Koster
03b74ffffd template file tidy up
Also removes and deprecates `storefront_categorized_blog()`
2016-01-21 10:50:49 +00:00
Caleb Burks
a10ad275a1 storefront_promoted_products() update
Change function name and add in a parameter for the optional fallback.
2015-09-08 13:37:59 -05:00
Caleb Burks
19623e1782 Check for featured then on sale products 2015-09-07 12:33:48 -05:00
Caleb Burks
9a3b139b7d Check for featured products on 404 page 2015-08-25 01:25:12 -05:00
Fränk Klein
759fc7e7c9 Fixes escaping in the 404.php template.
- Static strings (as in `echo 'hey';`) or numbers do not need to be
escaped, as there is no possibility to change them without changing the
code.
- When escaping numbers passed to query functions, `absint()` should be
used instead of `intval()`, to make sure to obtain positive integers.
- Strings that are output in HTML should be escaped with `esc_html()`
instead of `esc_attr()`.
- `esc_attr( __() )` can be written as `esc_attr__()`, same for
`esc_html( __() )`.
- Translations should always be escaped.
2015-07-16 18:25:17 +02:00
James Koster
16db9af905 sanitise & space 2015-07-10 22:52:06 +01:00
James Koster
ce59edb84a 404 2015-07-10 16:50:34 +01:00
James Koster
b2af4b864b sanitize 2015-07-09 16:37:52 +01:00
James Koster
19b6f250ad new fangled 404. closes #190 2015-07-09 16:23:09 +01:00
Claudio Sanches
f6ce0a3ef8 Fixed file chmod 2014-12-12 10:21:33 -02:00
James Koster
a618b30b22 404. #7 2014-09-02 12:15:59 +01:00
James Koster
8f114550aa 0.1a 2014-08-17 16:55:38 +01:00