Merge branch '3.0' into 3.0-redo-settings

This commit is contained in:
Ben Goldsworthy 2021-08-12 11:39:12 +01:00
commit b65d128326
18 changed files with 7122 additions and 672 deletions

3
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,3 @@
# These are supported funding model platforms
custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ']

View file

@ -1,53 +0,0 @@
name: Pre-release Handler
on:
release:
types: [published]
jobs:
build:
name: Build the Plugin for pre-release
if: "github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
composer install --no-dev --optimize-autoloader --no-progress
- name: Build Plugin
run: |
composer run build
- name: Rename dist/ folder
run: |
mv dist/ footnotes/
- name: Create release archive
uses: montudor/action-zip@v0.1.0
with:
args: zip -X -r footnotes-${{ github.event.release.tag_name }}.zip footnotes
- name: Upload archive as artifact
uses: actions/upload-artifact@v2
with:
name: footnotes-${{ github.event.release.tag_name }}
path: footnotes-${{ github.event.release.tag_name }}.zip
- name: Upload archive to release
uses: JasonEtco/upload-to-release@master
with:
args: footnotes-${{ github.event.release.tag_name }}.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Deploy release to Wordpress.org
# uses: 10up/action-wordpress-plugin-deploy@stable
# with:
# generate-zip: true
# env:
# SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
# SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}

87
.github/workflows/release-handler.yml vendored Normal file
View file

@ -0,0 +1,87 @@
# This workflow handles GitHub releases and pre-releases.
# It builds the Plugin, zips up an archive to add to the
# release entry on GitHub and (in the case of a full release)
# pushes the release to the WP Plugin Directory SVN repo.
name: Release Handler
on:
release:
types: [published]
jobs:
build_plugin:
name: Build the Plugin for pre-release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
composer install --no-dev --optimize-autoloader --no-progress
- name: Build Plugin
run: |
composer run build
- name: Rename Plugin folder
run: |
mv dist/ footnotes/
- name: Upload Plugin artifact
uses: actions/upload-artifact@v2
with:
name: footnotes-${{ github.event.release.tag_name }}
path: footnotes
create_archive:
name: Create an archive for the release and add it to GitHub
runs-on: ubuntu-latest
needs: build_plugin
steps:
- name: Download Plugin artifact
uses: actions/download-artifact@v2
with:
name: footnotes-${{ github.event.release.tag_name }}
- name: Create release archive
uses: montudor/action-zip@v0.1.0
with:
args: zip -X -r footnotes-${{ github.event.release.tag_name }}.zip footnotes
#- name: Upload archive as artifact
# uses: actions/upload-artifact@v2
# with:
# name: footnotes-${{ github.event.release.tag_name }}
# path: footnotes-${{ github.event.release.tag_name }}.zip
- name: Upload archive to release
uses: JasonEtco/upload-to-release@master
with:
args: footnotes-${{ github.event.release.tag_name }}.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_to_svn:
name: Push the release to the WordPress Plugin Directory repo.
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
needs: create_archive
steps:
- name: Download Plugin artifact
uses: actions/download-artifact@v2
with:
name: footnotes-${{ github.event.release.tag_name }}
- name: Deploy release to Wordpress.org
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: footnotes/branches/svn-test
ASSETS_DIR: assets

View file

@ -1,6 +1,6 @@
name: Snyk
on: push
on: pull_request
jobs:
security:
@ -13,7 +13,12 @@ jobs:
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/php@master
continue-on-error: true # To make sure that SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --all-projects
args: --all-projects --sarif-file-output=snyk.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: snyk.sarif

View file

@ -1,40 +1,23 @@
# Contributor Covenant Code of Conduct
# Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
community a safe and enjoyable experience for *everyone*.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
All participants in this community must abide by the following policy:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
> Be excellent to each other
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
Treat everyone with respect. Participate while acknowledging that everyone
deserves to be here — and each of us has the right to enjoy our experience
without fear. Consider what you are saying and how it would feel if it were
said to or about you.
## Enforcement Responsibilities
@ -52,6 +35,7 @@ decisions when appropriate.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
@ -59,8 +43,8 @@ representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
mark@cheret.de.
reported to the project leader, [Mark Cheret][mailto:mark@cheret.de].
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
@ -114,15 +98,10 @@ the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
This Code of Conduct is adapted from the [Contributor Covenant][covenant],
version 2.0, [Mozilla's code of conduct enforcement ladder][mozilla] and the
[Google Event Community Guidelines and Anti-Harassment Policy][google].
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.
[covenant]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[mozilla]: https://github.com/mozilla/diversity
[google]: https://www.google.com/events/policy/anti-harassmentpolicy.html

View file

@ -5,7 +5,7 @@
![GitHub contributors](https://img.shields.io/github/contributors/markcheret/footnotes?style=flat-square) ![GitHub commits since tagged version](https://img.shields.io/github/commits-since/markcheret/footnotes/2.7.3?style=flat-square) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/markcheret/footnotes?style=flat-square) ![issues](https://img.shields.io/github/issues/markcheret/footnotes?style=flat-square) ![PRs](https://img.shields.io/github/issues-pr/markcheret/footnotes?style=flat-square)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/markcheret/footnotes?style=flat-square) [![OSSAR](https://github.com/markcheret/footnotes/actions/workflows/ossar-analysis.yml/badge.svg)](https://github.com/markcheret/footnotes/actions/workflows/ossar-analysis.yml) [![PHP Composer](https://github.com/markcheret/footnotes/actions/workflows/php.yml/badge.svg)](https://github.com/markcheret/footnotes/actions/workflows/php.yml)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/markcheret/footnotes?style=flat-square) [![OSSAR](https://github.com/markcheret/footnotes/actions/workflows/ossar-analysis.yml/badge.svg)](https://github.com/markcheret/footnotes/actions/workflows/ossar-analysis.yml) [![Code Linting](https://github.com/markcheret/footnotes/actions/workflows/php.yml/badge.svg)](https://github.com/markcheret/footnotes/actions/workflows/lint-code.yml)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Coverage Status](https://coveralls.io/repos/github/markcheret/footnotes/badge.svg?branch=main)](https://coveralls.io/github/markcheret/footnotes?branch=main)
<!-- markdownlint-enable MD013 -->
@ -27,6 +27,7 @@ Featured on [wpmudev][wpmudev] — cheers for the review, folks!
* [Features](#features)
* [Getting Started](#getting-started)
* [Documentation](#documentation)
* [Testing](#testing)
* [Acknowledgments](#acknowledgements)
* [License](#license)
* [Contact Information](#contact-information)
@ -53,11 +54,20 @@ This Plugin provides:
1. install all dependencies (`composer install`):
* you will have to install `php-mbstring` manually if you do not already
have it.
## Documentation
View the current docs [here][footnotes-docs].
## Testing
This repo. uses [PHPUnit](phpunit) to run automated tests. To run the full test
suite, use `composer run test`.
Test cases are found in the `tests/` directory.
PHPUnit settings are available in the file `phpunit.xml`.
## Acknowledgements
Huge thanks to every **footnotes** user, contributor, bug reporter, feature
@ -86,6 +96,7 @@ This project is licensed under the [GNU GPL v3][gpl-v3].
[prettier]: https://prettier.io/
[eslint]: https://eslint.org/
[stylelint]: https://stylelint.io/
[phpunit]: https://phpunit.de/
[phpdocumentor]: https://phpdoc.org/
[footnotes-docs]: https://markcheret.github.io/footnotes/
[gpl-v3]: https://www.gnu.org/licenses/gpl-3.0.en.html

View file

@ -65,7 +65,7 @@ echo "- Checking versions..."
STABLE_TAG="$(grep "Stable Tag:" src/readme.txt)"
ROOT_HEADER_VERSION="$(grep " Version:" src/footnotes.php | grep -Po " Version: \d+\.\d+(\.\d+)?[a-z]?$")"
JS_VERSION="$(grep "version :" src/js/wysiwyg-editor.js)"
JS_VERSION="$(grep "version:" src/js/wysiwyg-editor.js)"
# Step 3(b): Check that all version declarations exists

View file

@ -24,7 +24,8 @@
"post-install-cmd": "npm install",
"minify": "npm run minify",
"minify:css": "npm run minify:css",
"minify:js": "npm run minify:js"
"minify:js": "npm run minify:js",
"test": "phpunit"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,16 @@
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/js/all.min.js" integrity="sha256-0vuk8LXoyrmCjp1f0O300qo1M75ZQyhH9X3J6d+scmk=" crossorigin="anonymous"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
@ -48,10 +52,11 @@
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace"><a href="namespaces/footnotes.html"><abbr title="\footnotes">footnotes</abbr></a></h4>
<h3 class="phpdocumentor-sidebar__root-namespace"><a href="namespaces/default.html"><abbr title="\">Global</abbr></a></h3>
<h4 class="phpdocumentor-sidebar__root-namespace"><a href="namespaces/footnotes.html"><abbr title="\footnotes">footnotes</abbr></a></h4>
<ul class="phpdocumentor-list">
<li><a href="namespaces/footnotes-admin.html"><abbr title="\footnotes\admin">admin</abbr></a></li>
<li><a href="namespaces/footnotes-includes.html"><abbr title="\footnotes\includes">includes</abbr></a></li>
@ -61,8 +66,7 @@
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="packages/Default.html"><abbr title="\Default">Default</abbr></a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="packages/footnotes.html"><abbr title="\footnotes">footnotes</abbr></a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="packages/footnotes.html"><abbr title="\footnotes">footnotes</abbr></a></h3>
<ul class="phpdocumentor-list">
<li><a href="packages/footnotes-includes.html"><abbr title="\footnotes\includes">includes</abbr></a></li>
</ul>
@ -89,6 +93,12 @@
<h2 class="phpdocumentor-content__title">class-settings.php</h2>
<section class="phpdocumentor-description"></section>
<h3 id="interfaces_class_traits">
Interfaces, Classes and Traits
@ -105,6 +115,7 @@
@ -129,5 +140,9 @@
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

View file

@ -101,6 +101,9 @@
</tr>
<tr>
<td class="phpdocumentor-cell"><a href="reports/deprecated.html#src/includes/settings/general/class-ampcompatsettingsgroup.php">src/includes/settings/general/class-ampcompatsettingsgroup.php</a></td>
</tr>
<tr>
<td class="phpdocumentor-cell"><a href="reports/deprecated.html#src/admin/layout/class-settings.php">src/admin/layout/class-settings.php</a></td>
</tr>
</table>
@ -157,6 +160,20 @@
<td class="phpdocumentor-cell"></td>
</tr>
</table>
<a id="src/admin/layout/class-settings.php"></a>
<h3><abbr title="src/admin/layout/class-settings.php">class-settings.php</abbr></h3>
<table>
<tr>
<th class="phpdocumentor-heading">Line</th>
<th class="phpdocumentor-heading">Element</th>
<th class="phpdocumentor-heading">Reason</th>
</tr>
<tr>
<td class="phpdocumentor-cell">1016</td>
<td class="phpdocumentor-cell"><a href="classes/footnotes-admin-layout-Settings.html#method_custom_css_migration"><abbr title="\footnotes\admin\layout\Settings::custom_css_migration()">Settings::custom_css_migration()</abbr></a></td>
<td class="phpdocumentor-cell"></td>
</tr>
</table>
</div>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">

6798
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -56,10 +56,12 @@
"husky": "^4.3.8",
"lint-staged": "^10.5.4",
"markdownlint-cli": "^0.27.1",
"merge": "^2.1.1",
"minify": "^7.0.1",
"node-sass": "^5.0.0",
"prettier": "^2.2.1",
"stylelint": "^13.12.0",
"stylelint-a11y": "^1.2.3",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-recommended": "^3.0.0",
"stylelint-config-wordpress": "^17.0.0",
@ -73,9 +75,6 @@
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"stylelint-a11y": "^1.2.3"
},
"eslintConfig": {
"env": {
"browser": true,

17
phpunit.xml Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -60,7 +60,7 @@
return {
longname: 'footnotes',
author: 'Mark Cheret',
authorurl: 'https://cheret.org/footnotes/',
authorurl: 'https://cheret.tech/footnotes/',
infourl: 'https://wordpress.org/plugins/footnotes/',
version: '2.7.4d',
};

View file

@ -18,7 +18,7 @@
* Requires at least: 3.9
* Requires PHP: 7.0
* Author: Mark Cheret
* Author URI: https://cheret.org/footnotes
* Author URI: https://cheret.tech/footnotes
* Text Domain: footnotes
* Domain Path: /languages
* License: GPL v3
@ -111,6 +111,8 @@ require_once plugin_dir_path( __FILE__ ) . 'includes/class-core.php';
*
* Since everything within the plugin is registered via hooks, then kicking off
* the plugin from this point in the file does not affect the page life cycle.
* This takes place after the `plugins_loaded` hook, so that other Plugins may
* filter options.
*
* @since 2.8.0
*/
@ -124,4 +126,4 @@ function run_footnotes(): void {
$footnotes = new includes\Core();
$footnotes->run();
}
run_footnotes();
add_action( 'plugins_loaded', run_footnotes() );

8
src/wpml-config.xml Normal file
View file

@ -0,0 +1,8 @@
<wpml-config>
<admin-texts>
<key name="footnotes_storage">
<key name="footnote_inputfield_references_label" />
<key name="footnote_inputfield_readon_label" />
</key>
</admin-texts>
</wpml-config>

13
tests/exampleTest.php Normal file
View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class ExampleTest extends TestCase {
public function testAdd() {
$result = 1 + 2;
$this->assertEquals(3, $result);
}
}