Merge branch '8.0.0' of github.com:roots/roots into fix-gulp-rev
Conflicts: gulpfile.js package.json
This commit is contained in:
95
.jscsrc
Normal file
95
.jscsrc
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"requireCurlyBraces": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireOperatorBeforeLineBreak": true,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": true,
|
||||
"maximumLineLength": {
|
||||
"value": 80,
|
||||
"allowComments": true,
|
||||
"allowRegex": true
|
||||
},
|
||||
"validateIndentation": 2,
|
||||
"validateQuoteMarks": "'",
|
||||
"disallowMultipleLineStrings": true,
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowMultipleVarDecl": true,
|
||||
"disallowKeywordsOnNewLine": [
|
||||
"else"
|
||||
],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"return",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceBeforeBinaryOperators": [
|
||||
"=",
|
||||
"+=",
|
||||
"-=",
|
||||
"*=",
|
||||
"/=",
|
||||
"%=",
|
||||
"<<=",
|
||||
">>=",
|
||||
">>>=",
|
||||
"&=",
|
||||
"|=",
|
||||
"^=",
|
||||
"+=",
|
||||
"+",
|
||||
"-",
|
||||
"*",
|
||||
"/",
|
||||
"%",
|
||||
"<<",
|
||||
">>",
|
||||
">>>",
|
||||
"&",
|
||||
"|",
|
||||
"^",
|
||||
"&&",
|
||||
"||",
|
||||
"===",
|
||||
"==",
|
||||
">=",
|
||||
"<=",
|
||||
"<",
|
||||
">",
|
||||
"!=",
|
||||
"!=="
|
||||
],
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireSpacesInFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"disallowSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInsideObjectBrackets": "all",
|
||||
"disallowSpacesInsideArrayBrackets": "all",
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"validateJSDoc": {
|
||||
"checkParamNames": true,
|
||||
"requireParamTypes": true
|
||||
},
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"disallowNewlineBeforeBlockStatements": true
|
||||
}
|
||||
@@ -11,6 +11,5 @@
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"node": true,
|
||||
"strict": false,
|
||||
"trailing": true
|
||||
"strict": false
|
||||
}
|
||||
|
||||
@@ -5,9 +5,15 @@ php:
|
||||
- '5.6'
|
||||
- '5.5'
|
||||
- '5.4'
|
||||
|
||||
before_install:
|
||||
- npm install -g bower
|
||||
- npm install -g bower gulp jscs
|
||||
- npm install
|
||||
- pyrus install pear/PHP_CodeSniffer
|
||||
- phpenv rehash
|
||||
|
||||
script:
|
||||
- npm run build
|
||||
- npm run jshint
|
||||
- npm run jscs
|
||||
- phpcs --standard=ruleset.xml --extensions=php -n -s .
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
### 8.0.0: TBD
|
||||
* Change theme name from Roots to Sage
|
||||
* Bump required PHP version to >=5.4
|
||||
* Add coding standards based on PSR-2
|
||||
* Add namespace
|
||||
* Use short array syntax
|
||||
* Use short echo syntax
|
||||
* Switch from Grunt to gulp, new workflow
|
||||
* Use wiredep for Sass and Less injection
|
||||
* Implement JSON file based asset pipeline
|
||||
* Re-organize asset file structure
|
||||
* Use the theme styles for the editor stylesheet
|
||||
* Remove theme activation, move to [wp-cli-theme-activation](https://github.com/roots/wp-cli-theme-activation)
|
||||
* Add Travis CI
|
||||
* Update to jQuery 1.11.2
|
||||
|
||||
@@ -11,6 +11,13 @@ Sage is a WordPress starter theme based on [HTML5 Boilerplate](http://html5boile
|
||||
* Newsletter: [Subscribe](http://roots.io/subscribe/)
|
||||
* Forum: [http://discourse.roots.io/](http://discourse.roots.io/)
|
||||
|
||||
## Requirements
|
||||
|
||||
* PHP >= 5.4
|
||||
* Node.js >= 0.10
|
||||
* gulp (`npm install -g gulp`)
|
||||
* Bower (`npm install -g bower`)
|
||||
|
||||
## Features
|
||||
|
||||
* [gulp](http://gulpjs.com/) for compiling Sass and LESS, checking for JavaScript errors, live reloading, concatenating and minifying files, and versioning assets
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"app.js": {
|
||||
"main.js": {
|
||||
"files": [
|
||||
"scripts/**/*",
|
||||
"scripts/main.js"
|
||||
|
||||
@@ -16,61 +16,66 @@
|
||||
|
||||
(function($) {
|
||||
|
||||
// Use this variable to set up the common and page specific functions. If you
|
||||
// rename this variable, you will also need to rename the namespace below.
|
||||
var Sage = {
|
||||
// All pages
|
||||
common: {
|
||||
init: function() {
|
||||
// JavaScript to be fired on all pages
|
||||
// Use this variable to set up the common and page specific functions. If you
|
||||
// rename this variable, you will also need to rename the namespace below.
|
||||
var Sage = {
|
||||
// All pages
|
||||
'common': {
|
||||
init: function() {
|
||||
// JavaScript to be fired on all pages
|
||||
},
|
||||
finalize: function() {
|
||||
// JavaScript to be fired on all pages, after page specific JS is fired
|
||||
}
|
||||
},
|
||||
finalize: function() {
|
||||
// JavaScript to be fired on all pages, after page specific JS is fired
|
||||
}
|
||||
},
|
||||
// Home page
|
||||
home: {
|
||||
init: function() {
|
||||
// JavaScript to be fired on the home page
|
||||
// Home page
|
||||
'home': {
|
||||
init: function() {
|
||||
// JavaScript to be fired on the home page
|
||||
},
|
||||
finalize: function() {
|
||||
// JavaScript to be fired on the home page, after the init JS
|
||||
}
|
||||
},
|
||||
finalize: function() {
|
||||
// JavaScript to be fired on the home page, after the init JS
|
||||
// About us page, note the change from about-us to about_us.
|
||||
'about_us': {
|
||||
init: function() {
|
||||
// JavaScript to be fired on the about us page
|
||||
}
|
||||
}
|
||||
},
|
||||
// About us page, note the change from about-us to about_us.
|
||||
about_us: {
|
||||
init: function() {
|
||||
// JavaScript to be fired on the about us page
|
||||
};
|
||||
|
||||
// The routing fires all common scripts, followed by the page specific scripts.
|
||||
// Add additional events for more control over timing e.g. a finalize event
|
||||
var UTIL = {
|
||||
fire: function(func, funcname, args) {
|
||||
var fire;
|
||||
var namespace = Sage;
|
||||
funcname = (funcname === undefined) ? 'init' : funcname;
|
||||
fire = func !== '';
|
||||
fire = fire && namespace[func];
|
||||
fire = fire && typeof namespace[func][funcname] === 'function';
|
||||
|
||||
if (fire) {
|
||||
namespace[func][funcname](args);
|
||||
}
|
||||
},
|
||||
loadEvents: function() {
|
||||
// Fire common init JS
|
||||
UTIL.fire('common');
|
||||
|
||||
// Fire page-specific init JS, and then finalize JS
|
||||
$.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) {
|
||||
UTIL.fire(classnm);
|
||||
UTIL.fire(classnm, 'finalize');
|
||||
});
|
||||
|
||||
// Fire common finalize JS
|
||||
UTIL.fire('common', 'finalize');
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// The routing fires all common scripts, followed by the page specific scripts.
|
||||
// Add additional events for more control over timing e.g. a finalize event
|
||||
var UTIL = {
|
||||
fire: function(func, funcname, args) {
|
||||
var namespace = Sage;
|
||||
funcname = (funcname === undefined) ? 'init' : funcname;
|
||||
if (func !== '' && namespace[func] && typeof namespace[func][funcname] === 'function') {
|
||||
namespace[func][funcname](args);
|
||||
}
|
||||
},
|
||||
loadEvents: function() {
|
||||
// Fire common init JS
|
||||
UTIL.fire('common');
|
||||
|
||||
// Fire page-specific init JS, and then finalize JS
|
||||
$.each(document.body.className.replace(/-/g, '_').split(/\s+/),function(i,classnm) {
|
||||
UTIL.fire(classnm);
|
||||
UTIL.fire(classnm, 'finalize');
|
||||
});
|
||||
|
||||
// Fire common finalize JS
|
||||
UTIL.fire('common', 'finalize');
|
||||
}
|
||||
};
|
||||
|
||||
// Load Events
|
||||
$(document).ready(UTIL.loadEvents);
|
||||
// Load Events
|
||||
$(document).ready(UTIL.loadEvents);
|
||||
|
||||
})(jQuery); // Fully reference jQuery after this point.
|
||||
|
||||
@@ -1,687 +1,5 @@
|
||||
/**
|
||||
* Updating this file with Bootstrap changes:
|
||||
*
|
||||
* 1. Go to http://getbootstrap.com/customize/
|
||||
* 2. Un-toggle everything
|
||||
* 3. Check: 'Typography'
|
||||
* 4. Download
|
||||
* 5. Remove margin property on body tag
|
||||
*/
|
||||
@import "main.less";
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
audio,
|
||||
canvas,
|
||||
progress,
|
||||
video {
|
||||
display: inline-block;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
[hidden],
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
a {
|
||||
background: transparent;
|
||||
}
|
||||
a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
abbr[title] {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
b,
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
mark {
|
||||
background: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
figure {
|
||||
margin: 1em 40px;
|
||||
}
|
||||
hr {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
}
|
||||
pre {
|
||||
overflow: auto;
|
||||
}
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
}
|
||||
button {
|
||||
overflow: visible;
|
||||
}
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
button,
|
||||
html input[type="button"],
|
||||
input[type="reset"],
|
||||
input[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
cursor: pointer;
|
||||
}
|
||||
button[disabled],
|
||||
html input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
input {
|
||||
line-height: normal;
|
||||
}
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
input[type="search"] {
|
||||
-webkit-appearance: textfield;
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
legend {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
optgroup {
|
||||
font-weight: bold;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 0;
|
||||
}
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
*:before,
|
||||
*:after {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html {
|
||||
font-size: 10px;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
body {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.42857143;
|
||||
color: #333333;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
a {
|
||||
color: #428bca;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover,
|
||||
a:focus {
|
||||
color: #2a6496;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:focus {
|
||||
outline: thin dotted;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.img-responsive {
|
||||
display: block;
|
||||
width: 100% \9;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.img-rounded {
|
||||
border-radius: 6px;
|
||||
}
|
||||
.img-thumbnail {
|
||||
padding: 4px;
|
||||
line-height: 1.42857143;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #dddddd;
|
||||
border-radius: 4px;
|
||||
-webkit-transition: all 0.2s ease-in-out;
|
||||
-o-transition: all 0.2s ease-in-out;
|
||||
transition: all 0.2s ease-in-out;
|
||||
display: inline-block;
|
||||
width: 100% \9;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.img-circle {
|
||||
border-radius: 50%;
|
||||
}
|
||||
hr {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
}
|
||||
.sr-only-focusable:active,
|
||||
.sr-only-focusable:focus {
|
||||
position: static;
|
||||
width: auto;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
clip: auto;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
.h1,
|
||||
.h2,
|
||||
.h3,
|
||||
.h4,
|
||||
.h5,
|
||||
.h6 {
|
||||
font-family: inherit;
|
||||
font-weight: 500;
|
||||
line-height: 1.1;
|
||||
color: inherit;
|
||||
}
|
||||
h1 small,
|
||||
h2 small,
|
||||
h3 small,
|
||||
h4 small,
|
||||
h5 small,
|
||||
h6 small,
|
||||
.h1 small,
|
||||
.h2 small,
|
||||
.h3 small,
|
||||
.h4 small,
|
||||
.h5 small,
|
||||
.h6 small,
|
||||
h1 .small,
|
||||
h2 .small,
|
||||
h3 .small,
|
||||
h4 .small,
|
||||
h5 .small,
|
||||
h6 .small,
|
||||
.h1 .small,
|
||||
.h2 .small,
|
||||
.h3 .small,
|
||||
.h4 .small,
|
||||
.h5 .small,
|
||||
.h6 .small {
|
||||
font-weight: normal;
|
||||
line-height: 1;
|
||||
color: #777777;
|
||||
}
|
||||
h1,
|
||||
.h1,
|
||||
h2,
|
||||
.h2,
|
||||
h3,
|
||||
.h3 {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
h1 small,
|
||||
.h1 small,
|
||||
h2 small,
|
||||
.h2 small,
|
||||
h3 small,
|
||||
.h3 small,
|
||||
h1 .small,
|
||||
.h1 .small,
|
||||
h2 .small,
|
||||
.h2 .small,
|
||||
h3 .small,
|
||||
.h3 .small {
|
||||
font-size: 65%;
|
||||
}
|
||||
h4,
|
||||
.h4,
|
||||
h5,
|
||||
.h5,
|
||||
h6,
|
||||
.h6 {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
h4 small,
|
||||
.h4 small,
|
||||
h5 small,
|
||||
.h5 small,
|
||||
h6 small,
|
||||
.h6 small,
|
||||
h4 .small,
|
||||
.h4 .small,
|
||||
h5 .small,
|
||||
.h5 .small,
|
||||
h6 .small,
|
||||
.h6 .small {
|
||||
font-size: 75%;
|
||||
}
|
||||
h1,
|
||||
.h1 {
|
||||
font-size: 36px;
|
||||
}
|
||||
h2,
|
||||
.h2 {
|
||||
font-size: 30px;
|
||||
}
|
||||
h3,
|
||||
.h3 {
|
||||
font-size: 24px;
|
||||
}
|
||||
h4,
|
||||
.h4 {
|
||||
font-size: 18px;
|
||||
}
|
||||
h5,
|
||||
.h5 {
|
||||
font-size: 14px;
|
||||
}
|
||||
h6,
|
||||
.h6 {
|
||||
font-size: 12px;
|
||||
}
|
||||
p {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
.lead {
|
||||
margin-bottom: 20px;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
line-height: 1.4;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.lead {
|
||||
font-size: 21px;
|
||||
}
|
||||
}
|
||||
small,
|
||||
.small {
|
||||
font-size: 85%;
|
||||
}
|
||||
cite {
|
||||
font-style: normal;
|
||||
}
|
||||
mark,
|
||||
.mark {
|
||||
background-color: #fcf8e3;
|
||||
padding: .2em;
|
||||
}
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
.text-justify {
|
||||
text-align: justify;
|
||||
}
|
||||
.text-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.text-lowercase {
|
||||
text-transform: lowercase;
|
||||
}
|
||||
.text-uppercase {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.text-capitalize {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.text-muted {
|
||||
color: #777777;
|
||||
}
|
||||
.text-primary {
|
||||
color: #428bca;
|
||||
}
|
||||
a.text-primary:hover {
|
||||
color: #3071a9;
|
||||
}
|
||||
.text-success {
|
||||
color: #3c763d;
|
||||
}
|
||||
a.text-success:hover {
|
||||
color: #2b542c;
|
||||
}
|
||||
.text-info {
|
||||
color: #31708f;
|
||||
}
|
||||
a.text-info:hover {
|
||||
color: #245269;
|
||||
}
|
||||
.text-warning {
|
||||
color: #8a6d3b;
|
||||
}
|
||||
a.text-warning:hover {
|
||||
color: #66512c;
|
||||
}
|
||||
.text-danger {
|
||||
color: #a94442;
|
||||
}
|
||||
a.text-danger:hover {
|
||||
color: #843534;
|
||||
}
|
||||
.bg-primary {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
}
|
||||
a.bg-primary:hover {
|
||||
background-color: #3071a9;
|
||||
}
|
||||
.bg-success {
|
||||
background-color: #dff0d8;
|
||||
}
|
||||
a.bg-success:hover {
|
||||
background-color: #c1e2b3;
|
||||
}
|
||||
.bg-info {
|
||||
background-color: #d9edf7;
|
||||
}
|
||||
a.bg-info:hover {
|
||||
background-color: #afd9ee;
|
||||
}
|
||||
.bg-warning {
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
a.bg-warning:hover {
|
||||
background-color: #f7ecb5;
|
||||
}
|
||||
.bg-danger {
|
||||
background-color: #f2dede;
|
||||
}
|
||||
a.bg-danger:hover {
|
||||
background-color: #e4b9b9;
|
||||
}
|
||||
.page-header {
|
||||
padding-bottom: 9px;
|
||||
margin: 40px 0 20px;
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
}
|
||||
ul,
|
||||
ol {
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol,
|
||||
ol ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.list-unstyled {
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.list-inline {
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
margin-left: -5px;
|
||||
}
|
||||
.list-inline > li {
|
||||
display: inline-block;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
dt,
|
||||
dd {
|
||||
line-height: 1.42857143;
|
||||
}
|
||||
dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
dd {
|
||||
margin-left: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.dl-horizontal dt {
|
||||
float: left;
|
||||
width: 160px;
|
||||
clear: left;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.dl-horizontal dd {
|
||||
margin-left: 180px;
|
||||
}
|
||||
}
|
||||
abbr[title],
|
||||
abbr[data-original-title] {
|
||||
cursor: help;
|
||||
border-bottom: 1px dotted #777777;
|
||||
}
|
||||
.initialism {
|
||||
font-size: 90%;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
blockquote {
|
||||
padding: 10px 20px;
|
||||
margin: 0 0 20px;
|
||||
font-size: 17.5px;
|
||||
border-left: 5px solid #eeeeee;
|
||||
}
|
||||
blockquote p:last-child,
|
||||
blockquote ul:last-child,
|
||||
blockquote ol:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
blockquote footer,
|
||||
blockquote small,
|
||||
blockquote .small {
|
||||
display: block;
|
||||
font-size: 80%;
|
||||
line-height: 1.42857143;
|
||||
color: #777777;
|
||||
}
|
||||
blockquote footer:before,
|
||||
blockquote small:before,
|
||||
blockquote .small:before {
|
||||
content: '\2014 \00A0';
|
||||
}
|
||||
.blockquote-reverse,
|
||||
blockquote.pull-right {
|
||||
padding-right: 15px;
|
||||
padding-left: 0;
|
||||
border-right: 5px solid #eeeeee;
|
||||
border-left: 0;
|
||||
text-align: right;
|
||||
}
|
||||
.blockquote-reverse footer:before,
|
||||
blockquote.pull-right footer:before,
|
||||
.blockquote-reverse small:before,
|
||||
blockquote.pull-right small:before,
|
||||
.blockquote-reverse .small:before,
|
||||
blockquote.pull-right .small:before {
|
||||
content: '';
|
||||
}
|
||||
.blockquote-reverse footer:after,
|
||||
blockquote.pull-right footer:after,
|
||||
.blockquote-reverse small:after,
|
||||
blockquote.pull-right small:after,
|
||||
.blockquote-reverse .small:after,
|
||||
blockquote.pull-right .small:after {
|
||||
content: '\00A0 \2014';
|
||||
}
|
||||
blockquote:before,
|
||||
blockquote:after {
|
||||
content: "";
|
||||
}
|
||||
address {
|
||||
margin-bottom: 20px;
|
||||
font-style: normal;
|
||||
line-height: 1.42857143;
|
||||
}
|
||||
.clearfix:before,
|
||||
.clearfix:after,
|
||||
.dl-horizontal dd:before,
|
||||
.dl-horizontal dd:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
.clearfix:after,
|
||||
.dl-horizontal dd:after {
|
||||
clear: both;
|
||||
}
|
||||
.center-block {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
.hide {
|
||||
display: none !important;
|
||||
}
|
||||
.show {
|
||||
display: block !important;
|
||||
}
|
||||
.invisible {
|
||||
visibility: hidden;
|
||||
}
|
||||
.text-hide {
|
||||
font: 0/0 a;
|
||||
color: transparent;
|
||||
text-shadow: none;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
}
|
||||
.hidden {
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.affix {
|
||||
position: fixed;
|
||||
-webkit-transform: translate3d(0, 0, 0);
|
||||
transform: translate3d(0, 0, 0);
|
||||
margin: 12px !important;
|
||||
}
|
||||
|
||||
2
base.php
2
base.php
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Roots\Sage;
|
||||
|
||||
use Roots\Sage\Config;
|
||||
use Roots\Sage\Wrapper;
|
||||
|
||||
?>
|
||||
|
||||
<?php get_template_part('templates/head'); ?>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* @link https://github.com/roots/sage/pull/1042
|
||||
*/
|
||||
$sage_includes = array(
|
||||
$sage_includes = [
|
||||
'lib/utils.php', // Utility functions
|
||||
'lib/init.php', // Initial theme setup and constants
|
||||
'lib/wrapper.php', // Theme wrapper class
|
||||
@@ -20,7 +20,7 @@ $sage_includes = array(
|
||||
'lib/nav.php', // Custom nav modifications
|
||||
'lib/gallery.php', // Custom [gallery] modifications
|
||||
'lib/extras.php', // Custom functions
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($sage_includes as $file) {
|
||||
if (!$filepath = locate_template($file)) {
|
||||
|
||||
21
gulpfile.js
21
gulpfile.js
@@ -58,7 +58,7 @@ var revManifest = path.dist + 'assets.json';
|
||||
var cssTasks = function(filename) {
|
||||
return lazypipe()
|
||||
.pipe($.plumber)
|
||||
.pipe(function () {
|
||||
.pipe(function() {
|
||||
return $.if(enabled.maps, $.sourcemaps.init());
|
||||
})
|
||||
.pipe(function() {
|
||||
@@ -78,14 +78,15 @@ var cssTasks = function(filename) {
|
||||
.pipe($.pleeease, {
|
||||
autoprefixer: {
|
||||
browsers: [
|
||||
'last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12'
|
||||
'last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4',
|
||||
'opera 12'
|
||||
]
|
||||
}
|
||||
})
|
||||
.pipe(function () {
|
||||
.pipe(function() {
|
||||
return $.if(enabled.rev, $.rev());
|
||||
})
|
||||
.pipe(function () {
|
||||
.pipe(function() {
|
||||
return $.if(enabled.maps, $.sourcemaps.write('.'));
|
||||
})();
|
||||
};
|
||||
@@ -99,22 +100,22 @@ var cssTasks = function(filename) {
|
||||
// ```
|
||||
var jsTasks = function(filename) {
|
||||
return lazypipe()
|
||||
.pipe(function () {
|
||||
.pipe(function() {
|
||||
return $.if(enabled.maps, $.sourcemaps.init());
|
||||
})
|
||||
.pipe($.concat, filename)
|
||||
.pipe($.uglify)
|
||||
.pipe(function () {
|
||||
.pipe(function() {
|
||||
return $.if(enabled.rev, $.rev());
|
||||
})
|
||||
.pipe(function () {
|
||||
.pipe(function() {
|
||||
return $.if(enabled.maps, $.sourcemaps.write('.'));
|
||||
})();
|
||||
};
|
||||
|
||||
// ### Write to Rev Manifest
|
||||
// If `--production` then write the revved assets to the manifest.
|
||||
var writeToManifest = function (directory) {
|
||||
var writeToManifest = function(directory) {
|
||||
return lazypipe()
|
||||
.pipe(gulp.dest, path.dist + directory)
|
||||
.pipe(require('gulp-debug'))
|
||||
@@ -134,7 +135,7 @@ var writeToManifest = function (directory) {
|
||||
// `gulp styles` - compiles, combines, and optimizes bower css and project css.
|
||||
gulp.task('styles', function() {
|
||||
var merged = merge();
|
||||
manifest.forEachDependency('css', function (dep) {
|
||||
manifest.forEachDependency('css', function(dep) {
|
||||
merged.add(gulp.src(dep.globs)
|
||||
.pipe(cssTasks(dep.name)));
|
||||
});
|
||||
@@ -147,7 +148,7 @@ gulp.task('styles', function() {
|
||||
// javascript and project javascript
|
||||
gulp.task('scripts', ['jshint'], function() {
|
||||
var merged = merge();
|
||||
manifest.forEachDependency('js', function (dep) {
|
||||
manifest.forEachDependency('js', function(dep) {
|
||||
merged.add(
|
||||
gulp.src(dep.globs)
|
||||
.pipe(jsTasks(dep.name))
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace Roots\Sage\Assets;
|
||||
* 1. /theme/dist/styles/main.css
|
||||
*
|
||||
* Enqueue scripts in the following order:
|
||||
* 1. jquery-1.11.2.js via Google CDN
|
||||
* 1. Latest jQuery via Google CDN (if enabled in config.php)
|
||||
* 2. /theme/dist/scripts/modernizr.js
|
||||
* 3. /theme/dist/scripts/app.js
|
||||
* 3. /theme/dist/scripts/main.js
|
||||
*
|
||||
* Google Analytics is loaded after enqueued scripts if:
|
||||
* - An ID has been defined in config.php
|
||||
@@ -54,7 +54,7 @@ function assets() {
|
||||
if (!is_admin() && current_theme_supports('jquery-cdn')) {
|
||||
wp_deregister_script('jquery');
|
||||
|
||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.js', array(), null, true);
|
||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', [], null, true);
|
||||
|
||||
add_filter('script_loader_src', __NAMESPACE__ . '\\jquery_local_fallback', 10, 2);
|
||||
}
|
||||
@@ -63,9 +63,9 @@ function assets() {
|
||||
wp_enqueue_script('comment-reply');
|
||||
}
|
||||
|
||||
wp_enqueue_script('modernizr', asset_path('scripts/modernizr.js'), array(), null, true);
|
||||
wp_enqueue_script('modernizr', asset_path('scripts/modernizr.js'), [], null, true);
|
||||
wp_enqueue_script('jquery');
|
||||
wp_enqueue_script('sage_js', asset_path('scripts/app.js'), array(), null, true);
|
||||
wp_enqueue_script('sage_js', asset_path('scripts/main.js'), [], null, true);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', __NAMESPACE__ . '\\assets', 100);
|
||||
|
||||
@@ -91,23 +91,27 @@ add_action('wp_head', __NAMESPACE__ . '\\jquery_local_fallback');
|
||||
*
|
||||
* Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
|
||||
*/
|
||||
function google_analytics() { ?>
|
||||
<script>
|
||||
<?php if (WP_ENV === 'production') : ?>
|
||||
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
|
||||
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
|
||||
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
|
||||
e.src='//www.google-analytics.com/analytics.js';
|
||||
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
|
||||
<?php else : ?>
|
||||
function ga() {
|
||||
console.log('GoogleAnalytics: ' + [].slice.call(arguments));
|
||||
}
|
||||
<?php endif; ?>
|
||||
ga('create','<?php echo GOOGLE_ANALYTICS_ID; ?>','auto');ga('send','pageview');
|
||||
</script>
|
||||
function google_analytics() {
|
||||
?>
|
||||
<script>
|
||||
<?php if (WP_ENV === 'production' && !current_user_can('manage_options')) : ?>
|
||||
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
|
||||
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
|
||||
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
|
||||
e.src='//www.google-analytics.com/analytics.js';
|
||||
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
|
||||
<?php else : ?>
|
||||
function ga() {
|
||||
if (window.console) {
|
||||
console.log('Google Analytics: ' + [].slice.call(arguments));
|
||||
}
|
||||
}
|
||||
<?php endif; ?>
|
||||
ga('create','<?= GOOGLE_ANALYTICS_ID; ?>','auto');ga('send','pageview');
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
<?php }
|
||||
if (GOOGLE_ANALYTICS_ID && (WP_ENV !== 'production' || !current_user_can('manage_options'))) {
|
||||
if (GOOGLE_ANALYTICS_ID) {
|
||||
add_action('wp_footer', __NAMESPACE__ . '\\google_analytics', 20);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Roots\Sage\Config;
|
||||
|
||||
use Roots\Sage\Sidebar;
|
||||
|
||||
/**
|
||||
@@ -41,28 +42,28 @@ function display_sidebar() {
|
||||
static $display;
|
||||
|
||||
if (!isset($display)) {
|
||||
$sidebar_config = new Sidebar\Sage_Sidebar(
|
||||
$sidebar_config = new Sidebar\SageSidebar(
|
||||
/**
|
||||
* Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
|
||||
* Any of these conditional tags that return true won't show the sidebar
|
||||
*
|
||||
* To use a function that accepts arguments, use the following format:
|
||||
*
|
||||
* array('function_name', array('arg1', 'arg2'))
|
||||
* ['function_name', ['arg1', 'arg2']]
|
||||
*
|
||||
* The second element must be an array even if there's only 1 argument.
|
||||
*/
|
||||
array(
|
||||
[
|
||||
'is_404',
|
||||
'is_front_page'
|
||||
),
|
||||
],
|
||||
/**
|
||||
* Page template checks (via is_page_template())
|
||||
* Any of these page templates that return true won't show the sidebar
|
||||
*/
|
||||
array(
|
||||
[
|
||||
'template-custom.php'
|
||||
)
|
||||
]
|
||||
);
|
||||
$display = apply_filters('sage/display_sidebar', $sidebar_config->display);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ function gallery($attr) {
|
||||
}
|
||||
}
|
||||
|
||||
extract(shortcode_atts(array(
|
||||
extract(shortcode_atts([
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order ID',
|
||||
'id' => $post->ID,
|
||||
@@ -48,7 +48,7 @@ function gallery($attr) {
|
||||
'include' => '',
|
||||
'exclude' => '',
|
||||
'link' => ''
|
||||
), $attr));
|
||||
], $attr));
|
||||
|
||||
$id = intval($id);
|
||||
$columns = (12 % $columns == 0) ? $columns: 4;
|
||||
@@ -59,16 +59,16 @@ function gallery($attr) {
|
||||
}
|
||||
|
||||
if (!empty($include)) {
|
||||
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
|
||||
$_attachments = get_posts(['include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby]);
|
||||
|
||||
$attachments = array();
|
||||
$attachments = [];
|
||||
foreach ($_attachments as $key => $val) {
|
||||
$attachments[$val->ID] = $_attachments[$key];
|
||||
}
|
||||
} elseif (!empty($exclude)) {
|
||||
$attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
|
||||
$attachments = get_children(['post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby]);
|
||||
} else {
|
||||
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
|
||||
$attachments = get_children(['post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby]);
|
||||
}
|
||||
|
||||
if (empty($attachments)) {
|
||||
@@ -93,7 +93,7 @@ function gallery($attr) {
|
||||
$image = wp_get_attachment_link($id, $size, false, false);
|
||||
break;
|
||||
case 'none':
|
||||
$image = wp_get_attachment_image($id, $size, false, array('class' => 'thumbnail img-thumbnail'));
|
||||
$image = wp_get_attachment_image($id, $size, false, ['class' => 'thumbnail img-thumbnail']);
|
||||
break;
|
||||
default:
|
||||
$image = wp_get_attachment_link($id, $size, true, false);
|
||||
|
||||
18
lib/init.php
18
lib/init.php
@@ -16,9 +16,9 @@ function setup() {
|
||||
|
||||
// Register wp_nav_menu() menus
|
||||
// http://codex.wordpress.org/Function_Reference/register_nav_menus
|
||||
register_nav_menus(array(
|
||||
register_nav_menus([
|
||||
'primary_navigation' => __('Primary Navigation', 'sage')
|
||||
));
|
||||
]);
|
||||
|
||||
// Add post thumbnails
|
||||
// http://codex.wordpress.org/Post_Thumbnails
|
||||
@@ -28,14 +28,14 @@ function setup() {
|
||||
|
||||
// Add post formats
|
||||
// http://codex.wordpress.org/Post_Formats
|
||||
add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio'));
|
||||
add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']);
|
||||
|
||||
// Add HTML5 markup for captions
|
||||
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
|
||||
add_theme_support('html5', array('caption', 'comment-form', 'comment-list'));
|
||||
add_theme_support('html5', ['caption', 'comment-form', 'comment-list']);
|
||||
|
||||
// Tell the TinyMCE editor to use a custom stylesheet
|
||||
add_editor_style('/dist/css/editor-style.css');
|
||||
add_editor_style('/dist/styles/editor-style.css');
|
||||
}
|
||||
add_action('after_setup_theme', __NAMESPACE__ . '\\setup');
|
||||
|
||||
@@ -43,22 +43,22 @@ add_action('after_setup_theme', __NAMESPACE__ . '\\setup');
|
||||
* Register sidebars
|
||||
*/
|
||||
function widgets_init() {
|
||||
register_sidebar(array(
|
||||
register_sidebar([
|
||||
'name' => __('Primary', 'sage'),
|
||||
'id' => 'sidebar-primary',
|
||||
'before_widget' => '<section class="widget %1$s %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h3>',
|
||||
'after_title' => '</h3>',
|
||||
));
|
||||
]);
|
||||
|
||||
register_sidebar(array(
|
||||
register_sidebar([
|
||||
'name' => __('Footer', 'sage'),
|
||||
'id' => 'sidebar-footer',
|
||||
'before_widget' => '<section class="widget %1$s %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h3>',
|
||||
'after_title' => '</h3>',
|
||||
));
|
||||
]);
|
||||
}
|
||||
add_action('widgets_init', __NAMESPACE__ . '\\widgets_init');
|
||||
|
||||
22
lib/nav.php
22
lib/nav.php
@@ -9,31 +9,30 @@ namespace Roots\Sage\Nav;
|
||||
* <li id="menu-item-8" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8"><a href="/">Home</a></li>
|
||||
* <li id="menu-item-9" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-9"><a href="/sample-page/">Sample Page</a></l
|
||||
*
|
||||
* Sage_Nav_Walker example output:
|
||||
* SageNavWalker example output:
|
||||
* <li class="menu-home"><a href="/">Home</a></li>
|
||||
* <li class="menu-sample-page"><a href="/sample-page/">Sample Page</a></li>
|
||||
*/
|
||||
class Sage_Nav_Walker extends \Walker_Nav_Menu {
|
||||
function check_current($classes) {
|
||||
class SageNavWalker extends \Walker_Nav_Menu {
|
||||
public function checkCurrent($classes) {
|
||||
return preg_match('/(current[-_])|active|dropdown/', $classes);
|
||||
}
|
||||
|
||||
function start_lvl(&$output, $depth = 0, $args = array()) {
|
||||
// @codingStandardsIgnoreStart
|
||||
function start_lvl(&$output, $depth = 0, $args = []) {
|
||||
$output .= "\n<ul class=\"dropdown-menu\">\n";
|
||||
}
|
||||
|
||||
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
|
||||
function start_el(&$output, $item, $depth = 0, $args = [], $id = 0) {
|
||||
$item_html = '';
|
||||
parent::start_el($item_html, $item, $depth, $args);
|
||||
|
||||
if ($item->is_dropdown && ($depth === 0)) {
|
||||
$item_html = str_replace('<a', '<a class="dropdown-toggle" data-toggle="dropdown" data-target="#"', $item_html);
|
||||
$item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
|
||||
}
|
||||
elseif (stristr($item_html, 'li class="divider')) {
|
||||
} elseif (stristr($item_html, 'li class="divider')) {
|
||||
$item_html = preg_replace('/<a[^>]*>.*?<\/a>/iU', '', $item_html);
|
||||
}
|
||||
elseif (stristr($item_html, 'li class="dropdown-header')) {
|
||||
} elseif (stristr($item_html, 'li class="dropdown-header')) {
|
||||
$item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html);
|
||||
}
|
||||
|
||||
@@ -50,6 +49,7 @@ class Sage_Nav_Walker extends \Walker_Nav_Menu {
|
||||
|
||||
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,10 +82,10 @@ add_filter('nav_menu_item_id', '__return_null');
|
||||
* Clean up wp_nav_menu_args
|
||||
*
|
||||
* Remove the container
|
||||
* Use Sage_Nav_Walker() by default
|
||||
* Use SageNavWalker() by default
|
||||
*/
|
||||
function nav_menu_args($args = '') {
|
||||
$nav_menu_args = array();
|
||||
$nav_menu_args = [];
|
||||
|
||||
$nav_menu_args['container'] = false;
|
||||
|
||||
|
||||
@@ -14,25 +14,25 @@ namespace Roots\Sage\Sidebar;
|
||||
*
|
||||
* @return boolean True will display the sidebar, False will not
|
||||
*/
|
||||
class Sage_Sidebar {
|
||||
class SageSidebar {
|
||||
private $conditionals;
|
||||
private $templates;
|
||||
|
||||
public $display = true;
|
||||
|
||||
function __construct($conditionals = array(), $templates = array()) {
|
||||
public function __construct($conditionals = [], $templates = []) {
|
||||
$this->conditionals = $conditionals;
|
||||
$this->templates = $templates;
|
||||
|
||||
$conditionals = array_map(array($this, 'check_conditional_tag'), $this->conditionals);
|
||||
$templates = array_map(array($this, 'check_page_template'), $this->templates);
|
||||
$conditionals = array_map([$this, 'checkConditionalTag'], $this->conditionals);
|
||||
$templates = array_map([$this, 'checkPageTemplate'], $this->templates);
|
||||
|
||||
if (in_array(true, $conditionals) || in_array(true, $templates)) {
|
||||
$this->display = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function check_conditional_tag($conditional_tag) {
|
||||
private function checkConditionalTag($conditional_tag) {
|
||||
$conditional_arg = is_array($conditional_tag) ? $conditional_tag[1] : false;
|
||||
$conditional_tag = $conditional_arg ? $conditional_tag[0] : $conditional_tag;
|
||||
|
||||
@@ -43,7 +43,7 @@ class Sage_Sidebar {
|
||||
}
|
||||
}
|
||||
|
||||
private function check_page_template($page_template) {
|
||||
private function checkPageTemplate($page_template) {
|
||||
return is_page_template($page_template);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,29 +10,29 @@ namespace Roots\Sage\Wrapper;
|
||||
*/
|
||||
|
||||
function template_path() {
|
||||
return Sage_Wrapping::$main_template;
|
||||
return SageWrapping::$main_template;
|
||||
}
|
||||
|
||||
function sidebar_path() {
|
||||
return new Sage_Wrapping('templates/sidebar.php');
|
||||
return new SageWrapping('templates/sidebar.php');
|
||||
}
|
||||
|
||||
class Sage_Wrapping {
|
||||
class SageWrapping {
|
||||
// Stores the full path to the main template file
|
||||
public static $main_template;
|
||||
|
||||
// basename of template file
|
||||
// Basename of template file
|
||||
public $slug;
|
||||
|
||||
// array of templates
|
||||
// Array of templates
|
||||
public $templates;
|
||||
|
||||
// Stores the base name of the template file; e.g. 'page' for 'page.php' etc.
|
||||
static $base;
|
||||
public static $base;
|
||||
|
||||
public function __construct($template = 'base.php') {
|
||||
$this->slug = basename($template, '.php');
|
||||
$this->templates = array($template);
|
||||
$this->templates = [$template];
|
||||
|
||||
if (self::$base) {
|
||||
$str = substr($template, 0, -4);
|
||||
@@ -45,7 +45,7 @@ class Sage_Wrapping {
|
||||
return locate_template($this->templates);
|
||||
}
|
||||
|
||||
static function wrap($main) {
|
||||
public static function wrap($main) {
|
||||
// Check for other filters returning null
|
||||
if (!is_string($main)) {
|
||||
return $main;
|
||||
@@ -58,7 +58,7 @@ class Sage_Wrapping {
|
||||
self::$base = false;
|
||||
}
|
||||
|
||||
return new Sage_Wrapping();
|
||||
return new SageWrapping();
|
||||
}
|
||||
}
|
||||
add_filter('template_include', array(__NAMESPACE__ . '\\Sage_Wrapping', 'wrap'), 99);
|
||||
add_filter('template_include', [__NAMESPACE__ . '\\SageWrapping', 'wrap'], 99);
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
"scripts": {
|
||||
"build": "bower install && gulp",
|
||||
"docs": "docco -o docco gulpfile.js",
|
||||
"jshint": "gulp jshint"
|
||||
"jshint": "gulp jshint",
|
||||
"jscs": "jscs gulpfile.js assets/scripts/*.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
|
||||
45
ruleset.xml
Normal file
45
ruleset.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Roots">
|
||||
<description>Roots Coding Standards</description>
|
||||
|
||||
<!-- Use PSR-2 as a base -->
|
||||
<rule ref="PSR2">
|
||||
<!-- Allow closing braces for functions and classes to be on the same line -->
|
||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
|
||||
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/>
|
||||
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
||||
|
||||
<!-- Disable newline after opening brace -->
|
||||
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>
|
||||
|
||||
<!-- Allow multiple PHP statements in the same line (usually in template files) -->
|
||||
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>
|
||||
|
||||
<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
|
||||
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/>
|
||||
<exclude name="PSR2.Methods.FunctionCallSignature.Indent"/>
|
||||
</rule>
|
||||
|
||||
<!-- Don't require a blank line after the last `use` in templates/ directory -->
|
||||
<rule ref="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse">
|
||||
<exclude-pattern>templates/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<!-- Allow PHP closing tags on templates -->
|
||||
<rule ref="Zend.Files.ClosingTag.NotAllowed">
|
||||
<exclude-pattern>templates/*</exclude-pattern>
|
||||
<exclude-pattern>404.php</exclude-pattern>
|
||||
<exclude-pattern>index.php</exclude-pattern>
|
||||
<exclude-pattern>page.php</exclude-pattern>
|
||||
<exclude-pattern>single.php</exclude-pattern>
|
||||
<exclude-pattern>template-custom.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<!-- Force 2 spaces indentation -->
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
<property name="indent" value="2"/>
|
||||
<property name="tabIndent" value="false"/>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
if (post_password_required()) {
|
||||
return;
|
||||
}
|
||||
if (post_password_required()) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<section id="comments" class="comments">
|
||||
@@ -9,7 +9,7 @@
|
||||
<h2><?php printf(_nx('One response to “%2$s”', '%1$s responses to “%2$s”', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>'); ?></h2>
|
||||
|
||||
<ol class="comment-list">
|
||||
<?php wp_list_comments(array('style' => 'ol', 'short_ping' => true)); ?>
|
||||
<?php wp_list_comments(['style' => 'ol', 'short_ping' => true]); ?>
|
||||
</ol>
|
||||
|
||||
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<?php the_content(); ?>
|
||||
<?php wp_link_pages(array('before' => '<nav class="pagination">', 'after' => '</nav>')); ?>
|
||||
<?php wp_link_pages(['before' => '<nav class="pagination">', 'after' => '</nav>']); ?>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
<footer>
|
||||
<?php wp_link_pages(array('before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>')); ?>
|
||||
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
|
||||
</footer>
|
||||
<?php comments_template('/templates/comments.php'); ?>
|
||||
</article>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<time class="updated" datetime="<?php echo get_the_time('c'); ?>"><?php echo get_the_date(); ?></time>
|
||||
<p class="byline author vcard"><?php echo __('By', 'sage'); ?> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?php echo get_the_author(); ?></a></p>
|
||||
<time class="updated" datetime="<?= get_the_time('c'); ?>"><?= get_the_date(); ?></time>
|
||||
<p class="byline author vcard"><?= __('By', 'sage'); ?> <a href="<?= get_author_posts_url(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?= get_the_author(); ?></a></p>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">
|
||||
<link rel="alternate" type="application/rss+xml" title="<?= get_bloginfo('name'); ?> Feed" href="<?= esc_url(get_feed_link()); ?>">
|
||||
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
|
||||
<a class="navbar-brand" href="<?= esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
|
||||
</div>
|
||||
|
||||
<nav class="collapse navbar-collapse" role="navigation">
|
||||
<?php
|
||||
if (has_nav_menu('primary_navigation')) :
|
||||
wp_nav_menu(array('theme_location' => 'primary_navigation', 'walker' => new Nav\Sage_Nav_Walker(), 'menu_class' => 'nav navbar-nav'));
|
||||
endif;
|
||||
if (has_nav_menu('primary_navigation')) :
|
||||
wp_nav_menu(['theme_location' => 'primary_navigation', 'walker' => new Nav\SageNavWalker(), 'menu_class' => 'nav navbar-nav']);
|
||||
endif;
|
||||
?>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
<?php echo Titles\title(); ?>
|
||||
<?= Titles\title(); ?>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<form role="search" method="get" class="search-form form-inline" action="<?php echo esc_url(home_url('/')); ?>">
|
||||
<form role="search" method="get" class="search-form form-inline" action="<?= esc_url(home_url('/')); ?>">
|
||||
<label class="sr-only"><?php _e('Search for:', 'sage'); ?></label>
|
||||
<div class="input-group">
|
||||
<input type="search" value="<?php echo get_search_query(); ?>" name="s" class="search-field form-control" placeholder="<?php _e('Search', 'sage'); ?> <?php bloginfo('name'); ?>" required>
|
||||
<input type="search" value="<?= get_search_query(); ?>" name="s" class="search-field form-control" placeholder="<?php _e('Search', 'sage'); ?> <?php bloginfo('name'); ?>" required>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="search-submit btn btn-default"><?php _e('Search', 'sage'); ?></button>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user