Merge branch 'main' into svn-update
This commit is contained in:
commit
7ddac313bd
51 changed files with 3057 additions and 325 deletions
31
.distignore
Normal file
31
.distignore
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# A set of files you probably don't want in your WordPress.org distribution
|
||||||
|
.distignore
|
||||||
|
.editorconfig
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitlab-ci.yml
|
||||||
|
.travis.yml
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
behat.yml
|
||||||
|
bin
|
||||||
|
circle.yml
|
||||||
|
composer.json
|
||||||
|
composer.lock
|
||||||
|
Gruntfile.js
|
||||||
|
package.json
|
||||||
|
phpunit.xml
|
||||||
|
phpunit.xml.dist
|
||||||
|
multisite.xml
|
||||||
|
multisite.xml.dist
|
||||||
|
phpcs.ruleset.xml
|
||||||
|
LICENSE
|
||||||
|
wp-cli.local.yml
|
||||||
|
tests
|
||||||
|
vendor
|
||||||
|
node_modules
|
||||||
|
*.sql
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
|
authors.txt
|
||||||
|
composer.*
|
46
.github/workflows/release-handler.yml
vendored
Normal file
46
.github/workflows/release-handler.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Release Handler
|
||||||
|
|
||||||
|
# Action runs when a new release is published.
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-new:
|
||||||
|
name: Issue new release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build Plugin
|
||||||
|
run: |
|
||||||
|
composer install --no-dev --optimize-autoloader
|
||||||
|
composer run build
|
||||||
|
|
||||||
|
- name: Create release archive
|
||||||
|
uses: montudor/action-zip@v0.1.0
|
||||||
|
with:
|
||||||
|
args: zip -X -r dist/footnotes-${{ github.event.release.tag_name }}.zip dist
|
||||||
|
|
||||||
|
- name: Upload archive as artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: footnotes-${{ github.event.release.tag_name }}
|
||||||
|
path: dist/footnotes-${{ github.event.release.tag_name }}.zip
|
||||||
|
|
||||||
|
- name: Upload archive to release
|
||||||
|
uses: JasonEtco/upload-to-release@master
|
||||||
|
with:
|
||||||
|
args: dist/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 }}
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1,7 @@
|
||||||
.phpdoc/
|
.phpdoc/
|
||||||
|
vendor/
|
||||||
|
dist/
|
||||||
|
tmp/
|
||||||
|
|
||||||
|
*.bak
|
||||||
authors.txt
|
authors.txt
|
||||||
|
|
59
README.md
59
README.md
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
Featured on [wpmudev](http://premium.wpmudev.org/blog/12-surprisingly-useful-wordpress-plugins-you-dont-know-about/) --- cheers for the review, folks!
|
Featured on [wpmudev](http://premium.wpmudev.org/blog/12-surprisingly-useful-wordpress-plugins-you-dont-know-about/) — cheers for the review, folks!
|
||||||
|
|
||||||
**footnotes** aims to be the all-in-one solution for displaying an automatically generated list of references on your Page or Post. The Plugin ships with a set of defaults while also empowering you to control how your footnotes are being displayed.
|
**footnotes** aims to be the all-in-one solution for displaying an automatically generated list of references on your Page or Post. The Plugin ships with a set of defaults while also empowering you to control how your footnotes are being displayed.
|
||||||
|
|
||||||
|
@ -14,21 +14,19 @@ Featured on [wpmudev](http://premium.wpmudev.org/blog/12-surprisingly-useful-wor
|
||||||
|
|
||||||
1. Read the contributing guidelines
|
1. Read the contributing guidelines
|
||||||
1. Clone this repository (`git clone git@github.com:markcheret/footnotes.git`)
|
1. Clone this repository (`git clone git@github.com:markcheret/footnotes.git`)
|
||||||
- We recommend that you use [VVV](https://varyingvagrantvagrants.org/) for your development environment
|
- We recommend that you use [VVV](https://varyingvagrantvagrants.org/) for your local testing environment
|
||||||
1. Install [Composer](https://getcomposer.org/download/), if you don't have it already
|
1. Install [Composer](https://getcomposer.org/download/), if you don't have it already
|
||||||
1. Install dependencies (`composer install`)
|
1. Install dependencies (`composer install`)
|
||||||
1. Create a new branch from `main` (`git checkout -b <your-descriptive-branch-name>`)
|
- You will have to install `php-mbstring` manually if you do not already have it.
|
||||||
1. When you're finished, commit your changes to the remote version of your branch
|
|
||||||
and submit a [pull request](https://github.com/markcheret/footnotes/pulls).
|
|
||||||
|
|
||||||
## Checking WP Coding Standard Compliance
|
## Code Formatting
|
||||||
|
|
||||||
1. Run PHP_CodeSniffer on the file(s) you want to check (`./vendor/bin/phpcs --standard="WordPress" --colors --encoding=utf-8 -n -p <file(s)>`)
|
1. Run `composer run lint-php` to lint all PHP files
|
||||||
1. (If applicable) run the PHP Code Beautifier and Formatter to attempt to automatically fix any errors (`./vendor/bin/phpcbf --standard="WordPress" --encoding=utf-8 -p <file(s)>`)
|
1. Run `composer run lint-php:fix` to attempt to automatically fix errors and warnings
|
||||||
- Add the `-n` flag to ignore warnings (i.e., show only errors)
|
|
||||||
- Add the `-s` flag to show sniff codes (used for disabling errors in the code with `phpcs disable:<sniff code>` — MAKE SURE THAT YOU HAVE `phpcs enable` AT THE EARLIEST POINT POSSIBLE, and provide a justification for disabling the sniff code)
|
## Releasing
|
||||||
- You can run either across the entire project by adding the argument `--ignore=*/vendor/*` and targetting the file `./**/*.php`
|
|
||||||
- You may have to enable double-wildcards in your console first (`shopt -s globstar`)
|
1. Run `composer run release`
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
|
@ -44,43 +42,12 @@ Featured on [wpmudev](http://premium.wpmudev.org/blog/12-surprisingly-useful-wor
|
||||||
|
|
||||||
## Updating Documentation
|
## Updating Documentation
|
||||||
|
|
||||||
1. Install [phpDocumentor](https://phpdoc.org/)
|
1. Run `composer run docs`
|
||||||
1. Run it (`phpDocumentor -d . -t docs`)
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Unit tests are TODO.
|
Unit tests are TODO.
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
1. Read the contributing guidelines
|
|
||||||
1. Clone this repository (`git clone git@github.com:Rumperuu/footnotes.git`)
|
|
||||||
1. Install [Composer](https://getcomposer.org/download/), if you don't have it already
|
|
||||||
1. Install dependencies (`composer install`)
|
|
||||||
1. Create a new branch from `main` (`git checkout -b <your-descriptive-branch-name>`)
|
|
||||||
1. When you're finished, commit your changes to the remote version of your branch
|
|
||||||
and submit a [pull request](https://github.com/Rumperuu/footnotes/pulls).
|
|
||||||
|
|
||||||
## Updating Documentation
|
|
||||||
|
|
||||||
1. Install [phpDocumentor](https://phpdoc.org/)
|
|
||||||
1. Run it (`phpDocumentor -d . -t docs`)
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
1. Read the contributing guidelines
|
|
||||||
1. Clone this repository (`git clone git@github.com:Rumperuu/footnotes.git`)
|
|
||||||
1. Install [Composer](https://getcomposer.org/download/), if you don't have it already
|
|
||||||
1. Install dependencies (`composer install`)
|
|
||||||
1. Create a new branch from `main` (`git checkout -b <your-descriptive-branch-name>`)
|
|
||||||
1. When you're finished, commit your changes to the remote version of your branch
|
|
||||||
and submit a [pull request](https://github.com/Rumperuu/footnotes/pulls).
|
|
||||||
|
|
||||||
## Updating Documentation
|
|
||||||
|
|
||||||
1. Install [phpDocumentor](https://phpdoc.org/)
|
|
||||||
1. Run it (`phpDocumentor -d . -t docs`)
|
|
||||||
|
|
||||||
## Main Features
|
## Main Features
|
||||||
|
|
||||||
- Fully customizable **footnotes** start and end shortcodes;
|
- Fully customizable **footnotes** start and end shortcodes;
|
||||||
|
@ -96,8 +63,8 @@ Unit tests are TODO.
|
||||||
|
|
||||||
These are a few examples of possible ways to delimit footnotes:
|
These are a few examples of possible ways to delimit footnotes:
|
||||||
|
|
||||||
1. Your awesome text((with an awesome footnote))
|
1. Your awesome text`((`with an awesome footnote`))`
|
||||||
2. Your awesome text[ref]with an awesome footnote[/ref]
|
2. Your awesome text`[ref]`with an awesome footnote`[/ref]`
|
||||||
3. Your awesome text`<fn>`with an awesome footnote`</fn>`
|
3. Your awesome text`<fn>`with an awesome footnote`</fn>`
|
||||||
4. Your awesome text`custom-shortcode`with an awesome footnote`custom-shortcode`
|
4. Your awesome text`custom-shortcode`with an awesome footnote`custom-shortcode`
|
||||||
|
|
||||||
|
|
94
_tools/build-stylesheets.sh
Executable file
94
_tools/build-stylesheets.sh
Executable file
|
@ -0,0 +1,94 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Concatenates, minifies (TODO) and deploys stylesheets for distribution.
|
||||||
|
#
|
||||||
|
# 12 unified stylesheets are concatenated out of these files:
|
||||||
|
# - `dev-common.css`
|
||||||
|
# - `dev-tooltips.css`
|
||||||
|
# - `dev-tooltips-alternative.css`
|
||||||
|
# - `dev-layout-reference-container.css`
|
||||||
|
# - `dev-layout-entry-content.css`
|
||||||
|
# - `dev-layout-main-content.css`
|
||||||
|
|
||||||
|
echo "Running $(dirname "$0")/build-stylesheets.sh"
|
||||||
|
|
||||||
|
if [[ $1 == "-c" ]]; then
|
||||||
|
|
||||||
|
echo "Concatenating files and placing in \`css/tmp/\`..."
|
||||||
|
|
||||||
|
mkdir -p ./css/tmp
|
||||||
|
cat ./css/dev-common.css > ./css/tmp/footnotes-nottbrpl0.css
|
||||||
|
cat ./css/dev-{common,layout-reference-container}.css > ./css/tmp/footnotes-nottbrpl1.css
|
||||||
|
cat ./css/dev-{common,layout-entry-content}.css > ./css/tmp/footnotes-nottbrpl2.css
|
||||||
|
cat ./css/dev-{common,layout-main-content}.css > ./css/tmp/footnotes-nottbrpl3.css
|
||||||
|
cat ./css/dev-{common,tooltips}.css > ./css/tmp/footnotes-jqttbrpl0.css
|
||||||
|
cat ./css/dev-{common,tooltips,layout-reference-container}.css > ./css/tmp/footnotes-jqttbrpl1.css
|
||||||
|
cat ./css/dev-{common,tooltips,layout-entry-content}.css > ./css/tmp/footnotes-jqttbrpl2.css
|
||||||
|
cat ./css/dev-{common,tooltips,layout-main-content}.css > ./css/tmp/footnotes-jqttbrpl3.css
|
||||||
|
cat ./css/dev-{common,tooltips,tooltips-alternative}.css > ./css/tmp/footnotes-alttbrpl0.css
|
||||||
|
cat ./css/dev-{common,tooltips,tooltips-alternative,layout-reference-container}.css > ./css/tmp/footnotes-alttbrpl1.css
|
||||||
|
cat ./css/dev-{common,tooltips,tooltips-alternative,layout-entry-content}.css > ./css/tmp/footnotes-alttbrpl2.css
|
||||||
|
cat ./css/dev-{common,tooltips,tooltips-alternative,layout-main-content}.css > ./css/tmp/footnotes-alttbrpl3.css
|
||||||
|
cat ./css/settings.css > ./css/tmp/settings.css
|
||||||
|
|
||||||
|
echo "Stylesheet concatenation complete."
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
elif [[ $1 == "-m" ]]; then
|
||||||
|
|
||||||
|
# TODO: this should automatically minifiy all files, outputting into `.min.css`
|
||||||
|
# files and deleting the original concatenated `.css` files in `css/tmp/`.
|
||||||
|
# Once that's done, we can change the `rm -r` command in the deploy step to
|
||||||
|
# `rmdir`, which will throw us an error if we have any minified files that
|
||||||
|
# haven't been moved over to `dist/css/` for whatever reason. As it currently
|
||||||
|
# stands, we have no error checking in place.
|
||||||
|
echo "Please minify the stylesheets in \`css/tmp/\`, saving them in the same location with the \`.min.css\` file extension."
|
||||||
|
read -p "Are you ready to continue? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
elif [[ $1 == "-d" ]]; then
|
||||||
|
|
||||||
|
# NOTE: I've temporarily replaced the `mv` command
|
||||||
|
# with `cp` and disabled the `rm` command, so the minified
|
||||||
|
# files won't be removed from the source directory.
|
||||||
|
echo "Deploying minified stylesheets to \`dist/css/\`..."
|
||||||
|
rm -r ./dist
|
||||||
|
mkdir -p ./dist/css
|
||||||
|
for f in ./css/tmp/*.min.css; do
|
||||||
|
filename=$(basename $f .css)
|
||||||
|
cp $f ./dist/css
|
||||||
|
#mv $f ./dist/css
|
||||||
|
echo -e '\t' $filename".css moved."
|
||||||
|
done
|
||||||
|
|
||||||
|
# NB: We currently distribute both the minified + concatenated and the
|
||||||
|
# unminified + unconcatenated stylesheets with the Plugin.
|
||||||
|
echo "Deploying development stylesheets to \`dist/css/\`..."
|
||||||
|
for f in ./css/dev-*.css; do
|
||||||
|
filename=$(basename $f .css)
|
||||||
|
cp $f ./dist/css
|
||||||
|
#mv $f ./dist/css
|
||||||
|
echo -e '\t' $filename".css moved."
|
||||||
|
done
|
||||||
|
|
||||||
|
#echo "Deleting temporary files..."
|
||||||
|
#rm -r ./css/tmp
|
||||||
|
echo "All stylesheets added to build."
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
echo -e "Concatenates, minifies (TODO) and deploys stylesheets for distribution.\n"
|
||||||
|
echo -e "12 unified style sheets are concatenated out of these files:\n"
|
||||||
|
echo "\`dev-common.css\`"
|
||||||
|
echo "\`dev-tooltips.css\`"
|
||||||
|
echo "\`dev-tooltips-alternative.css\`"
|
||||||
|
echo "\`dev-layout-reference-container.css\`"
|
||||||
|
echo "\`dev-layout-entry-content.css\`"
|
||||||
|
echo -e "\`dev-layout-main-content.css\`\n"
|
||||||
|
echo "Command: \`-c\`: Concatenate \`dev-*\` CSS files into temporary directory."
|
||||||
|
echo "Command: \`-m\`: Minify files (TODO)."
|
||||||
|
echo "Command: \`-d\`: Deploy minified files to \`dist/css/\` and remove temporary files."
|
||||||
|
echo "No command, \"--help\", or anything else: Output this help section."
|
||||||
|
|
||||||
|
fi
|
31
_tools/build.sh
Executable file
31
_tools/build.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Building Plugin..."
|
||||||
|
|
||||||
|
# Moves everything including the style sheets over to `dist/`
|
||||||
|
echo "Copying directories..."
|
||||||
|
cp -r -t dist class/ css/ js/ languages/ templates/
|
||||||
|
# Among the images, only 2 out of 3 are distributed.
|
||||||
|
echo "Copying the needed images..."
|
||||||
|
mkdir dist/img
|
||||||
|
cp -t dist/img img/fn-wysiwyg.png img/main-menu.png
|
||||||
|
echo "Copying files..."
|
||||||
|
cp -t dist features.txt license.txt readme.txt includes.php wpml-config.xml customized-documentation-schema.txt customized-template-stack.txt CONTRIBUTING.md README.md SECURITY.md
|
||||||
|
echo "Setting production flag..."
|
||||||
|
sed "s/'C_BOOL_CSS_PRODUCTION_MODE', false/'C_BOOL_CSS_PRODUCTION_MODE', true/g" footnotes.php > dist/footnotes.php
|
||||||
|
echo "Production flag set."
|
||||||
|
|
||||||
|
# TODO: once automatic minification is implemented, this should handle that.
|
||||||
|
# For now, we shall have to assume that this command is being run on a repo. with
|
||||||
|
# minimised stylesheet files already in `dist/css/`.
|
||||||
|
echo "Building stylesheets..."
|
||||||
|
./_tools/build-stylesheets.sh -c
|
||||||
|
if [ $? != 0 ]; then echo "Concatenation failed!"; exit 1; fi
|
||||||
|
./_tools/build-stylesheets.sh -m
|
||||||
|
if [ $? != 0 ]; then echo "Minification failed!"; exit 1; fi
|
||||||
|
./_tools/build-stylesheets.sh -d
|
||||||
|
if [ $? != 0 ]; then echo "Deployment failed!"; exit 1; fi
|
||||||
|
echo "Stylesheet build complete."
|
||||||
|
|
||||||
|
echo "Build complete."
|
||||||
|
exit 0
|
246
_tools/release.sh
Executable file
246
_tools/release.sh
Executable file
|
@ -0,0 +1,246 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This is a release helper script aimed at walking maintainers through the
|
||||||
|
# process of issuing new releases of the Plugin, both to reduce the risk of
|
||||||
|
# procedural errors and to provide a framework for future incremental
|
||||||
|
# automation.
|
||||||
|
#
|
||||||
|
# Step 1: Ensure the local copy has checked out the `main` branch
|
||||||
|
# Step 2: Ensure local copy of `main` is up-to-date with remote
|
||||||
|
# Step 3: Check versioning
|
||||||
|
# Step 3(a): Get all version declarations
|
||||||
|
# Step 3(b): Check that all version declarations exists
|
||||||
|
# Step 3(c)(1): Check that all development versions match
|
||||||
|
# Step 3(c)(2): Check that all stable versions match
|
||||||
|
# Step 3(d): Check that the development version is correctly flagged as such
|
||||||
|
# Step 3(e): Check that the 'Stable Tag' field is set to a stable version
|
||||||
|
# Step 3(f): Check that the 'Stable Tag' field points to a real tag on the SVN repo.
|
||||||
|
# Step 3(g): Check that the changelog is up-to-date
|
||||||
|
# Step 4: Build the Plugin
|
||||||
|
# Step 5: Update the version to pre-release
|
||||||
|
# Step 6: Tag the release
|
||||||
|
|
||||||
|
echo "Welcome to the footnotes release helper!"
|
||||||
|
echo "========================================"
|
||||||
|
|
||||||
|
if [[ $1 == "-c" ]]; then
|
||||||
|
read -p "You have passed the \`commit\` flag (\`-c\`). Did you mean to do this? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NB: To run on a branch other than `main`, uncomment this line:
|
||||||
|
#if false; then
|
||||||
|
|
||||||
|
# Step 1: Ensure the local copy has checked out the `main` branch
|
||||||
|
|
||||||
|
if [[ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]]; then
|
||||||
|
echo "ERR: You are not on the \`main\` branch, please check it out and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "- \`main\` branch is checked out."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Ensure local copy of `main` is up-to-date with remote
|
||||||
|
|
||||||
|
if [[ "$(git status | grep -c 'Your branch is up to date')" != 1 ]]; then
|
||||||
|
echo "ERR: Your local copy is not up-to-date with the remote, please update it and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "- Local copy of \`main\` is up-to-date with remote."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NB: To run on a branch other than `main`, uncomment this line:
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Step 3: Check versioning
|
||||||
|
|
||||||
|
# Step 3(a): Get all version declarations
|
||||||
|
|
||||||
|
# NOTE: I'm not sure why, but if you try to get the root header
|
||||||
|
# version without piping it through the second `grep` command,
|
||||||
|
# you'll end up with a list of files before the version
|
||||||
|
# declaration.
|
||||||
|
|
||||||
|
echo "- Checking versions..."
|
||||||
|
|
||||||
|
STABLE_TAG="$(grep "Stable Tag:" readme.txt)"
|
||||||
|
ROOT_HEADER_VERSION="$(grep " Version:" footnotes.php | grep -Po " Version: \d+\.\d+(\.\d+)?[a-z]?$")"
|
||||||
|
JS_VERSION="$(grep "version :" js/wysiwyg-editor.js)"
|
||||||
|
|
||||||
|
# Step 3(b): Check that all version declarations exists
|
||||||
|
|
||||||
|
if [[ -z $STABLE_TAG ]]; then
|
||||||
|
echo "ERR: No 'Stable Tag' field found in \`readme.txt\`!"
|
||||||
|
exit 1
|
||||||
|
else echo "- 'Stable Tag' field set in \`readme.txt\`."
|
||||||
|
fi
|
||||||
|
if [[ -z $ROOT_HEADER_VERSION ]]; then
|
||||||
|
echo "ERR: No 'Version' field found in \`footnotes.php\` file header!"
|
||||||
|
exit 1
|
||||||
|
else echo "- 'Version' field set in \`footnotes.php\` file header."
|
||||||
|
fi
|
||||||
|
if [[ -z $JS_VERSION ]]; then
|
||||||
|
echo "ERR: No \`version\` variable found in \`js/wysiwyg-editor.js\`!"
|
||||||
|
exit 1
|
||||||
|
else echo "- \`version\` variable set in \`js/wysiwyg-editor.js\`."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3(c)(1): Check that all development versions match
|
||||||
|
# NB: This doesn't currently do anything as there is only one place where the
|
||||||
|
# development version is listed.
|
||||||
|
|
||||||
|
if [[ "$(echo $JS_VERSION | grep -Poc '\d+\.\d+(\.\d+)?')" != 1 ]]; then
|
||||||
|
echo "ERR: Development version mismatch!"
|
||||||
|
echo -e "The following versions were found:\n"
|
||||||
|
echo -e '\t' $JS_VERSION '\n'
|
||||||
|
echo "Please ensure that all development versions match and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else echo "- Development versions match."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3(c)(2): Check that all stable versions match
|
||||||
|
|
||||||
|
if [[ "$(echo $ROOT_HEADER_VERSION $STABLE_TAG | grep -Poc '\d+\.\d+(\.\d+)?')" != 1 ]]; then
|
||||||
|
echo "ERR: Stable version mismatch!"
|
||||||
|
echo -e "The following versions were found:\n"
|
||||||
|
echo -e '\t' $ROOT_HEADER_VERSION
|
||||||
|
echo -e '\t' $STABLE_TAG '\n'
|
||||||
|
echo "Please ensure that all stable versions match and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else echo "- Stable versions match."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3(d): Check that the development version is correctly flagged as such
|
||||||
|
|
||||||
|
if [[ "$(echo $JS_VERSION | grep -Poc '\d+d')" != 1 ]]; then
|
||||||
|
echo "ERR: Development version flag not set!"
|
||||||
|
echo -e "The following version was found:\n"
|
||||||
|
echo -e '\t' $JS_VERSION '\n'
|
||||||
|
echo "Please ensure that the development flag ('d') is set and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else echo "- Development version flag is set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEVELOPMENT_VERSION="$(echo $JS_VERSION | grep -Po '\d+\.\d+(\.\d+)?')"
|
||||||
|
|
||||||
|
echo -e "- Development version:" $DEVELOPMENT_VERSION
|
||||||
|
|
||||||
|
# Step 3(e): Check that the 'Stable Tag' field is set to a stable version
|
||||||
|
|
||||||
|
if [[ "$(echo $STABLE_TAG | grep -Poc '\d+\.\d+(\.\d+)?$')" != 1 ]]; then
|
||||||
|
echo "ERR: 'Stable Tag' not set to a stable version!"
|
||||||
|
echo -e "The 'Stable Tag' field is set to the following:\n"
|
||||||
|
echo -e '\t' $STABLE_TAG '\n'
|
||||||
|
echo "Please ensure that the 'Stable Tag' field is set to a stable version and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else echo "- 'Stable Tag' field set to stable version."
|
||||||
|
fi
|
||||||
|
|
||||||
|
STABLE_VERSION="$(echo $STABLE_TAG | grep -Po '\d+\.\d+(\.\d+)?$')"
|
||||||
|
|
||||||
|
echo "- Stable version:" $STABLE_VERSION
|
||||||
|
|
||||||
|
# Step 3(f): Check that the 'Stable Tag' field points to a real tag on the SVN repo.
|
||||||
|
|
||||||
|
echo "- Checking stable tag exists..."
|
||||||
|
git svn tag --dry-run $STABLE_VERSION &>/dev/null
|
||||||
|
|
||||||
|
if [ $? -ne 1 ]; then
|
||||||
|
echo "ERR: 'Stable Tag' does not point to an existing tag!"
|
||||||
|
echo "Please ensure that the 'Stable Tag' field points to an existing stable version and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else echo "- 'Stable Tag' field is set to existing tag."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 3(g): Check that the changelog is up-to-date
|
||||||
|
|
||||||
|
CHANGELOG_LATEST="$(awk -e '/== Changelog ==/,/= [0-9]+\.[0-9]+(\.[0-9]+)? =/' readme.txt | grep -Po '\d+\.\d+(\.\d+)?')"
|
||||||
|
if [[ $CHANGELOG_LATEST != $DEVELOPMENT_VERSION ]]; then
|
||||||
|
echo "ERR: Changelog is not up-to-date!"
|
||||||
|
echo "Current version is $DEVELOPMENT_VERSION"
|
||||||
|
echo "Latest version in changelog is $CHANGELOG_LATEST"
|
||||||
|
echo "Please ensure that the changelog is up-to-date and re-run this command."
|
||||||
|
exit 1
|
||||||
|
else echo "- Changelog is up-to-date."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "- Version check complete.\n"
|
||||||
|
|
||||||
|
# Step 4: Build the Plugin
|
||||||
|
|
||||||
|
echo "- Building Plugin..."
|
||||||
|
composer run build
|
||||||
|
if [ $? != 0 ]; then echo "Build failed!"; exit 1; fi
|
||||||
|
echo -e "- Build complete.\n"
|
||||||
|
|
||||||
|
# Step 5: Update the version to pre-release
|
||||||
|
|
||||||
|
echo "- Setting pre-release version flags..."
|
||||||
|
PRERELEASE_VERSION=$DEVELOPMENT_VERSION'p'
|
||||||
|
sed -i "s/$JS_VERSION/version : \"$PRERELEASE_VERSION\"/g" dist/js/wysiwyg-editor.js
|
||||||
|
echo "- Pre-release flags set."
|
||||||
|
|
||||||
|
# Step 6: Tag the release
|
||||||
|
|
||||||
|
echo "- Tagging release..."
|
||||||
|
git tag -a $DEVELOPMENT_VERSION -m "Pre-release of version $DEVELOPMENT_VERSION"
|
||||||
|
git push --tags
|
||||||
|
echo "- Release tagged."
|
||||||
|
|
||||||
|
# Step 7: Push release to SVN repo.
|
||||||
|
|
||||||
|
# Step 7(a): Create a new local copy of the SVN repo.
|
||||||
|
|
||||||
|
echo -e "\nThe helper will now guide you through the steps to push the new release to the WordPress Plugin Directory SVN repository."
|
||||||
|
echo "For the time being, this part of the process shall remain (mostly) manual."
|
||||||
|
read -p "Are you ready to continue? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
|
|
||||||
|
echo "Creating local copy of SVN repo..."
|
||||||
|
svn checkout https://plugins.svn.wordpress.org/footnotes tmp --depth immediates
|
||||||
|
svn update --quiet tmp/trunk --set-depth infinity
|
||||||
|
svn update --quiet tmp/tags/$PRERELEASE_VERSION --set-depth infinity
|
||||||
|
echo -e "Local copy created.\n"
|
||||||
|
|
||||||
|
# Step 7(b): Update `trunk/`
|
||||||
|
echo -e "Copying files from \`dist/\` to SVN \`trunk/\`...\n"
|
||||||
|
rsync -avhic dist/ tmp/trunk/ --delete | grep -v "^\."
|
||||||
|
read -p "Does the above list of changes look correct? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
|
echo -e "Copying complete.\n"
|
||||||
|
|
||||||
|
# Step 7(c): Set a release message
|
||||||
|
|
||||||
|
echo "Getting commit message from changelog..."
|
||||||
|
CHANGELOG_MESSAGE="$(awk -e "/= $DEVELOPMENT_VERSION =/,/= $STABLE_VERSION =/" readme.txt | grep '^-')"
|
||||||
|
echo -e "The changelog message for this version is:\n"
|
||||||
|
echo -e "$CHANGELOG_MESSAGE\n"
|
||||||
|
read -p "Is this correct? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
|
echo -e "Commit message set.\n"
|
||||||
|
|
||||||
|
# Step 7(d): Review
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "Let's review before pushing to the SVN..."
|
||||||
|
echo -e "Here is my current state:\n"
|
||||||
|
echo "Current version:"
|
||||||
|
echo -e '\t' $PRERELEASE_VERSION
|
||||||
|
echo "Stable version:"
|
||||||
|
echo -e '\t' $STABLE_VERSION '\n'
|
||||||
|
echo "Commit message:\n"
|
||||||
|
echo -e "$CHANGELOG_MESSAGE" '\n'
|
||||||
|
echo -e "Changes made to local \`trunk/\`:\n"
|
||||||
|
svn stat tmp/trunk/
|
||||||
|
echo ""
|
||||||
|
echo -e "\`readme.txt\` header:\n"
|
||||||
|
head tmp/trunk/readme.txt
|
||||||
|
echo ""
|
||||||
|
read -p "Is this all correct? (Y/N): " CONFIRM && [[ $CONFIRM == [yY] || $CONFIRM == [yY][eE][sS] ]] || exit 1
|
||||||
|
|
||||||
|
# Step 7(d): Push to remote `trunk/` (provided the flag is set)
|
||||||
|
|
||||||
|
if [[ $1 == "-c" ]]; then
|
||||||
|
svn ci -m "$CHANGELOG_MESSAGE"
|
||||||
|
else echo "- Commit flag not set, skipping commit step."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 8: Cleanup
|
||||||
|
|
||||||
|
rm -rf {dist/,tmp/}
|
4
_tools/setup.sh
Executable file
4
_tools/setup.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cp contrib/pre-commit .git/hooks/pre-commit
|
||||||
|
chmod +x .git/hooks/pre-commit
|
207
class/dashboard/init.php
Normal file
207
class/dashboard/init.php
Normal file
|
@ -0,0 +1,207 @@
|
||||||
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||||
|
/**
|
||||||
|
* Includes the Plugin settings menu.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @package footnotes
|
||||||
|
* @since 1.5.0
|
||||||
|
* @date 12.09.14 10:26
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the Settings interface of the Plugin.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
class MCI_Footnotes_Layout_Init {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Slug for the Plugin main menu.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const C_STR_MAIN_MENU_SLUG = 'mfmmf';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin main menu name.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const C_STR_MAIN_MENU_TITLE = 'ManFisher';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains layout engine sub classes.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $a_arr_sub_page_classes = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Constructor. Initializes all WordPress hooks for the Plugin Settings.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
foreach ( get_declared_classes() as $l_str_class_name ) {
|
||||||
|
if ( is_subclass_of( $l_str_class_name, 'MCI_Footnotes_Layout_Engine' ) ) {
|
||||||
|
$l_obj_class = new $l_str_class_name();
|
||||||
|
// Append new instance of the layout engine sub class.
|
||||||
|
$this->a_arr_sub_page_classes[ $l_obj_class->get_priority() ] = $l_obj_class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ksort( $this->a_arr_sub_page_classes );
|
||||||
|
|
||||||
|
// Register hooks/actions.
|
||||||
|
add_action( 'admin_init', array( $this, 'initialize_settings' ) );
|
||||||
|
add_action( 'admin_menu', array( $this, 'register_main_menu' ) );
|
||||||
|
// Register AJAX callbacks for Plugin information.
|
||||||
|
add_action( 'wp_ajax_nopriv_footnotes_get_plugin_info', array( $this, 'get_plugin_meta_information' ) );
|
||||||
|
add_action( 'wp_ajax_footnotes_get_plugin_info', array( $this, 'get_plugin_meta_information' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes all sub pages and registers the settings.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function initialize_settings() {
|
||||||
|
MCI_Footnotes_Settings::instance()->register_settings();
|
||||||
|
// Iterate though each sub class of the layout engine and register their sections.
|
||||||
|
foreach ( $this->a_arr_sub_page_classes as $l_obj_layout_engine_sub_class ) {
|
||||||
|
$l_obj_layout_engine_sub_class->register_sections();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the new main menu for the WordPress dashboard.
|
||||||
|
* Registers all sub menu pages for the new main menu.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @see http://codex.wordpress.org/Function_Reference/add_menu_page
|
||||||
|
*/
|
||||||
|
public function register_main_menu() {
|
||||||
|
global $menu;
|
||||||
|
// Iterate through each main menu.
|
||||||
|
foreach ( $menu as $l_arr_main_menu ) {
|
||||||
|
// 3terate through each main menu attribute.
|
||||||
|
foreach ( $l_arr_main_menu as $l_str_attribute ) {
|
||||||
|
// Main menu already added, append sub pages and stop.
|
||||||
|
if ( self::C_STR_MAIN_MENU_SLUG === $l_str_attribute ) {
|
||||||
|
$this->register_sub_pages();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a new main menu page to the WordPress dashboard.
|
||||||
|
add_menu_page(
|
||||||
|
self::C_STR_MAIN_MENU_TITLE, // Page title.
|
||||||
|
self::C_STR_MAIN_MENU_TITLE, // Menu title.
|
||||||
|
'manage_options', // Capability.
|
||||||
|
self::C_STR_MAIN_MENU_SLUG, // Menu slug.
|
||||||
|
array( $this, 'display_other_plugins' ), // Function.
|
||||||
|
plugins_url( 'footnotes/img/main-menu.png' ), // Icon URL.
|
||||||
|
null // Position.
|
||||||
|
);
|
||||||
|
$this->register_sub_pages();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers all SubPages for this Plugin.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
private function register_sub_pages() {
|
||||||
|
// First registered sub menu page MUST NOT contain a unique slug suffix.
|
||||||
|
// Iterate though each sub class of the layout engine and register their sub page.
|
||||||
|
foreach ( $this->a_arr_sub_page_classes as $l_obj_layout_engine_sub_class ) {
|
||||||
|
$l_obj_layout_engine_sub_class->register_sub_page();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays other Plugins from the developers.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function display_other_plugins() {
|
||||||
|
printf( '<br/><br/>' );
|
||||||
|
// Load template file.
|
||||||
|
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'manfisher' );
|
||||||
|
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
echo $l_obj_template->get_content();
|
||||||
|
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
|
||||||
|
printf( '<em>visit <a href="https://cheret.org/footnotes/" target="_blank">Mark Cheret</a></em>' );
|
||||||
|
printf( '<br/><br/>' );
|
||||||
|
|
||||||
|
printf( '</div>' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.Security.NonceVerification.Missing
|
||||||
|
/**
|
||||||
|
* AJAX call. returns a JSON string containing meta information about a specific WordPress Plugin.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function get_plugin_meta_information() {
|
||||||
|
// TODO: add nonce verification.
|
||||||
|
|
||||||
|
// Get plugin internal name from POST data.
|
||||||
|
if ( isset( $_POST['plugin'] ) ) {
|
||||||
|
$l_str_plugin_name = wp_unslash( $_POST['plugin'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $l_str_plugin_name ) ) {
|
||||||
|
echo wp_json_encode( array( 'error' => 'Plugin name invalid.' ) );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$l_str_url = 'https://api.wordpress.org/plugins/info/1.0/' . $l_str_plugin_name . '.json';
|
||||||
|
// Call URL and collect data.
|
||||||
|
$l_arr_response = wp_remote_get( $l_str_url );
|
||||||
|
// Check if response is valid.
|
||||||
|
if ( is_wp_error( $l_arr_response ) ) {
|
||||||
|
echo wp_json_encode( array( 'error' => 'Error receiving Plugin Information from WordPress.' ) );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ( ! array_key_exists( 'body', $l_arr_response ) ) {
|
||||||
|
echo wp_json_encode( array( 'error' => 'Error reading WordPress API response message.' ) );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
// Get the body of the response.
|
||||||
|
$l_str_response = $l_arr_response['body'];
|
||||||
|
// Get plugin object.
|
||||||
|
$l_arr_plugin = json_decode( $l_str_response, true );
|
||||||
|
if ( empty( $l_arr_plugin ) ) {
|
||||||
|
echo wp_json_encode( array( 'error' => 'Error reading Plugin meta information.<br/>URL: ' . $l_str_url . '<br/>Response: ' . $l_str_response ) );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$l_int_num_ratings = array_key_exists( 'num_ratings', $l_arr_plugin ) ? intval( $l_arr_plugin['num_ratings'] ) : 0;
|
||||||
|
$l_int_rating = array_key_exists( 'rating', $l_arr_plugin ) ? floatval( $l_arr_plugin['rating'] ) : 0.0;
|
||||||
|
$l_int_stars = round( 5 * $l_int_rating / 100.0, 1 );
|
||||||
|
|
||||||
|
// Return Plugin information as JSON encoded string.
|
||||||
|
echo wp_json_encode(
|
||||||
|
array(
|
||||||
|
'error' => '',
|
||||||
|
'PluginDescription' => array_key_exists( 'short_description', $l_arr_plugin ) ? html_entity_decode( $l_arr_plugin['short_description'] ) : 'Error reading Plugin information',
|
||||||
|
'PluginAuthor' => array_key_exists( 'author', $l_arr_plugin ) ? html_entity_decode( $l_arr_plugin['author'] ) : 'unknown',
|
||||||
|
'PluginRatingText' => $l_int_stars . ' ' . __( 'rating based on', 'footnotes' ) . ' ' . $l_int_num_ratings . ' ' . __( 'ratings', 'footnotes' ),
|
||||||
|
'PluginRating1' => $l_int_stars >= 0.5 ? 'star-full' : 'star-empty',
|
||||||
|
'PluginRating2' => $l_int_stars >= 1.5 ? 'star-full' : 'star-empty',
|
||||||
|
'PluginRating3' => $l_int_stars >= 2.5 ? 'star-full' : 'star-empty',
|
||||||
|
'PluginRating4' => $l_int_stars >= 3.5 ? 'star-full' : 'star-empty',
|
||||||
|
'PluginRating5' => $l_int_stars >= 4.5 ? 'star-full' : 'star-empty',
|
||||||
|
'PluginRating' => $l_int_num_ratings,
|
||||||
|
'PluginLastUpdated' => array_key_exists( 'last_updated', $l_arr_plugin ) ? $l_arr_plugin['last_updated'] : 'unknown',
|
||||||
|
'PluginDownloads' => array_key_exists( 'downloaded', $l_arr_plugin ) ? $l_arr_plugin['downloaded'] : '---',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
||||||
|
}
|
579
class/dashboard/layout.php
Normal file
579
class/dashboard/layout.php
Normal file
|
@ -0,0 +1,579 @@
|
||||||
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
/**
|
||||||
|
* Includes Layout Engine for the admin dashboard.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @package footnotes
|
||||||
|
* @since 1.5.0
|
||||||
|
* @date 12.09.14 10:56
|
||||||
|
*
|
||||||
|
* @since 2.1.2 add versioning of settings.css for cache busting 2020-11-19T1456+0100
|
||||||
|
* @since 2.1.4 automate passing version number for cache busting 2020-11-30T0648+0100
|
||||||
|
* @since 2.1.4 optional step argument and support for floating in numbox 2020-12-05T0540+0100
|
||||||
|
* @since 2.1.6 fix punctuation-related localization issue in dashboard labels 2020-12-08T1547+0100
|
||||||
|
*
|
||||||
|
* @since 2.5.5 Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Layout Engine for the administration dashboard.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
abstract class MCI_Footnotes_Layout_Engine {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the Hook connection string for the child sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @var null|string
|
||||||
|
*/
|
||||||
|
protected $a_str_sub_page_hook = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores all Sections for the child sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $a_arr_sections = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Priority index. Lower numbers have a higher Priority.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
abstract public function get_priority();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unique slug of the child sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
abstract protected function get_sub_page_slug();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the title of the child sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
abstract protected function get_sub_page_title();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of all registered sections for a sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
abstract protected function get_sections();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of all registered meta boxes.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
abstract protected function get_meta_boxes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array describing a sub page section.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_id Unique ID suffix.
|
||||||
|
* @param string $p_str_title Title of the section.
|
||||||
|
* @param int $p_int_settings_container_index Settings Container Index.
|
||||||
|
* @param bool $p_bool_has_submit_button Should a Submit Button be displayed for this section, default: true.
|
||||||
|
* @return array Array describing the section.
|
||||||
|
*/
|
||||||
|
protected function add_section( $p_str_id, $p_str_title, $p_int_settings_container_index, $p_bool_has_submit_button = true ) {
|
||||||
|
return array(
|
||||||
|
'id' => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '-' . $p_str_id,
|
||||||
|
'title' => $p_str_title,
|
||||||
|
'submit' => $p_bool_has_submit_button,
|
||||||
|
'container' => $p_int_settings_container_index,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array describing a meta box.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_section_id Parent Section ID.
|
||||||
|
* @param string $p_str_id Unique ID suffix.
|
||||||
|
* @param string $p_str_title Title for the meta box.
|
||||||
|
* @param string $p_str_callback_function_name Class method name for callback.
|
||||||
|
* @return array meta box description to be able to append a meta box to the output.
|
||||||
|
*/
|
||||||
|
protected function add_meta_box( $p_str_section_id, $p_str_id, $p_str_title, $p_str_callback_function_name ) {
|
||||||
|
return array(
|
||||||
|
'parent' => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '-' . $p_str_section_id,
|
||||||
|
'id' => $p_str_id,
|
||||||
|
'title' => $p_str_title,
|
||||||
|
'callback' => $p_str_callback_function_name,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function register_sub_page() {
|
||||||
|
global $submenu;
|
||||||
|
|
||||||
|
if ( array_key_exists( plugin_basename( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG ), $submenu ) ) {
|
||||||
|
foreach ( $submenu[ plugin_basename( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG ) ] as $l_arr_sub_menu ) {
|
||||||
|
if ( plugin_basename( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ) === $l_arr_sub_menu[2] ) {
|
||||||
|
remove_submenu_page( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->a_str_sub_page_hook = add_submenu_page(
|
||||||
|
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG,
|
||||||
|
$this->get_sub_page_title(),
|
||||||
|
$this->get_sub_page_title(),
|
||||||
|
'manage_options',
|
||||||
|
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(),
|
||||||
|
array( $this, 'display_content' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers all sections for a sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function register_sections() {
|
||||||
|
foreach ( $this->get_sections() as $l_arr_section ) {
|
||||||
|
// Append tab to the tab-array.
|
||||||
|
$this->a_arr_sections[ $l_arr_section['id'] ] = $l_arr_section;
|
||||||
|
add_settings_section(
|
||||||
|
$l_arr_section['id'],
|
||||||
|
'',
|
||||||
|
array( $this, 'Description' ),
|
||||||
|
$l_arr_section['id']
|
||||||
|
);
|
||||||
|
$this->register_meta_boxes( $l_arr_section['id'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers all Meta boxes for a sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_parent_id Parent section unique id.
|
||||||
|
*/
|
||||||
|
private function register_meta_boxes( $p_str_parent_id ) {
|
||||||
|
// Iterate through each meta box.
|
||||||
|
foreach ( $this->get_meta_boxes() as $l_arr_meta_box ) {
|
||||||
|
if ( $p_str_parent_id !== $l_arr_meta_box['parent'] ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
add_meta_box(
|
||||||
|
$p_str_parent_id . '-' . $l_arr_meta_box['id'],
|
||||||
|
$l_arr_meta_box['title'],
|
||||||
|
array( $this, $l_arr_meta_box['callback'] ),
|
||||||
|
$p_str_parent_id,
|
||||||
|
'main'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append javascript and css files for specific sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
private function append_scripts() {
|
||||||
|
wp_enqueue_script( 'postbox' );
|
||||||
|
wp_enqueue_style( 'wp-color-picker' );
|
||||||
|
wp_enqueue_script( 'wp-color-picker' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers and enqueues the dashboard stylesheet.
|
||||||
|
*
|
||||||
|
* - Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report.
|
||||||
|
*
|
||||||
|
* @since 2.5.5
|
||||||
|
* @date 2021-02-14T1928+0100
|
||||||
|
*
|
||||||
|
* @reporter @docteurfitness
|
||||||
|
* @link https://wordpress.org/support/topic/simply-speed-optimisation/
|
||||||
|
*
|
||||||
|
* See the public stylesheet enqueuing:
|
||||||
|
* @see class/init.php
|
||||||
|
*
|
||||||
|
* added version # after changes started to settings.css from 2.1.2 on.
|
||||||
|
* automated update of version number for cache busting.
|
||||||
|
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
||||||
|
*/
|
||||||
|
if ( C_BOOL_CSS_PRODUCTION_MODE === true ) {
|
||||||
|
|
||||||
|
wp_register_style(
|
||||||
|
'mci-footnotes-admin',
|
||||||
|
plugins_url( 'footnotes/css/settings.min.css' ),
|
||||||
|
array(),
|
||||||
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/settings.min.css'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
wp_register_style(
|
||||||
|
'mci-footnotes-admin',
|
||||||
|
plugins_url( 'footnotes/css/settings.css' ),
|
||||||
|
array(),
|
||||||
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/settings.css'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_enqueue_style( 'mci-footnotes-admin' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
|
||||||
|
/**
|
||||||
|
* Displays the content of specific sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function display_content() {
|
||||||
|
$this->append_scripts();
|
||||||
|
|
||||||
|
// TODO: add nonce verification.
|
||||||
|
|
||||||
|
// Get the current section.
|
||||||
|
reset( $this->a_arr_sections );
|
||||||
|
$l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections );
|
||||||
|
$l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ];
|
||||||
|
|
||||||
|
// Store settings.
|
||||||
|
$l_bool_settings_updated = false;
|
||||||
|
if ( array_key_exists( 'save-settings', $_POST ) ) {
|
||||||
|
if ( 'save' === $_POST['save-settings'] ) {
|
||||||
|
unset( $_POST['save-settings'] );
|
||||||
|
unset( $_POST['submit'] );
|
||||||
|
$l_bool_settings_updated = $this->save_settings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display all sections and highlight the active section.
|
||||||
|
echo '<div class="wrap">';
|
||||||
|
echo '<h2 class="nav-tab-wrapper">';
|
||||||
|
// Iterate through all register sections.
|
||||||
|
foreach ( $this->a_arr_sections as $l_str_id => $l_arr_description ) {
|
||||||
|
$l_str_tab_active = ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '';
|
||||||
|
echo sprintf(
|
||||||
|
'<a class="nav-tab%s" href="?page=%s&t=%s">%s</a>',
|
||||||
|
( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '',
|
||||||
|
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(),
|
||||||
|
$l_str_id,
|
||||||
|
$l_arr_description['title']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
echo '</h2><br/>';
|
||||||
|
|
||||||
|
if ( $l_bool_settings_updated ) {
|
||||||
|
echo sprintf( '<div id="message" class="updated">%s</div>', __( 'Settings saved', 'footnotes' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form to submit the active section.
|
||||||
|
echo '<!--suppress HtmlUnknownTarget --><form method="post" action="">';
|
||||||
|
echo '<input type="hidden" name="save-settings" value="save" />';
|
||||||
|
// Outputs the settings field of the active section.
|
||||||
|
do_settings_sections( $l_arr_active_section['id'] );
|
||||||
|
do_meta_boxes( $l_arr_active_section['id'], 'main', null );
|
||||||
|
|
||||||
|
// Add submit button to active section if defined.
|
||||||
|
if ( $l_arr_active_section['submit'] ) {
|
||||||
|
submit_button();
|
||||||
|
}
|
||||||
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
// Echo JavaScript for the expand/collapse function of the meta boxes.
|
||||||
|
echo '<script type="text/javascript">';
|
||||||
|
echo 'jQuery(document).ready(function ($) {';
|
||||||
|
echo 'jQuery(".mfmmf-color-picker").wpColorPicker();';
|
||||||
|
echo "jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');";
|
||||||
|
echo "postboxes.add_postbox_toggles('" . $this->a_str_sub_page_hook . "');";
|
||||||
|
echo '});';
|
||||||
|
echo '</script>';
|
||||||
|
}
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
|
||||||
|
/**
|
||||||
|
* Save all Plugin settings.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function save_settings() {
|
||||||
|
$l_arr_new_settings = array();
|
||||||
|
|
||||||
|
// TODO: add nonce verification.
|
||||||
|
|
||||||
|
// Get current section.
|
||||||
|
reset( $this->a_arr_sections );
|
||||||
|
$l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections );
|
||||||
|
$l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ];
|
||||||
|
|
||||||
|
foreach ( MCI_Footnotes_Settings::instance()->get_defaults( $l_arr_active_section['container'] ) as $l_str_key => $l_mixed_value ) {
|
||||||
|
if ( array_key_exists( $l_str_key, $_POST ) ) {
|
||||||
|
$l_arr_new_settings[ $l_str_key ] = wp_unslash( $_POST[ $l_str_key ] );
|
||||||
|
} else {
|
||||||
|
// Setting is not defined in the POST array, define it to avoid the Default value.
|
||||||
|
$l_arr_new_settings[ $l_str_key ] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Update settings.
|
||||||
|
return MCI_Footnotes_Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings );
|
||||||
|
}
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the Description of a section. May be overwritten in any section.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function description() {
|
||||||
|
// Default no description will be displayed.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads specific setting and returns an array with the keys [id, name, value].
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_key_name Settings Array key name.
|
||||||
|
* @return array Contains Settings ID, Settings Name and Settings Value.
|
||||||
|
*/
|
||||||
|
protected function load_setting( $p_str_setting_key_name ) {
|
||||||
|
// Get current section.
|
||||||
|
reset( $this->a_arr_sections );
|
||||||
|
$p_arr_return = array();
|
||||||
|
$p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name );
|
||||||
|
$p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name );
|
||||||
|
$p_arr_return['value'] = MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name );
|
||||||
|
return $p_arr_return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a line break to start a new line.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_newline() {
|
||||||
|
return '<br/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a line break to have a space between two lines.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_line_space() {
|
||||||
|
return '<br/><br/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a simple text inside html <span> text.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_text Message to be surrounded with simple html tag (span).
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_text( $p_str_text ) {
|
||||||
|
return sprintf( '<span>%s</span>', $p_str_text );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for an input/select label.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to connect the Label with the input/select field.
|
||||||
|
* @param string $p_str_caption Label caption.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_label( $p_str_setting_name, $p_str_caption ) {
|
||||||
|
if ( empty( $p_str_caption ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove the colon causing localization issues with French, and with
|
||||||
|
* languages not using punctuation at all, and with languages using other
|
||||||
|
* punctuation marks instead of colon, e.g. Greek using a raised dot.
|
||||||
|
* In French, colon is preceded by a space, forcibly non-breaking, and
|
||||||
|
* narrow per new school.
|
||||||
|
* Add colon to label strings for inclusion in localization. Colon after
|
||||||
|
* label is widely preferred best practice, mandatory per
|
||||||
|
* [style guides](https://softwareengineering.stackexchange.com/questions/234546/colons-in-internationalized-ui).
|
||||||
|
*/
|
||||||
|
return sprintf( '<label for="%s">%s</label>', $p_str_setting_name, $p_str_caption );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for an input [type = text].
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to pre load the input field.
|
||||||
|
* @param int $p_str_max_length Maximum length of the input, default 999 characters.
|
||||||
|
* @param bool $p_bool_readonly Set the input to be read only, default false.
|
||||||
|
* @param bool $p_bool_hidden Set the input to be hidden, default false.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_text_box( $p_str_setting_name, $p_str_max_length = 999, $p_bool_readonly = false, $p_bool_hidden = false ) {
|
||||||
|
$l_str_style = '';
|
||||||
|
// Collect data for given settings field.
|
||||||
|
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||||
|
if ( $p_bool_hidden ) {
|
||||||
|
$l_str_style .= 'display:none;';
|
||||||
|
}
|
||||||
|
return sprintf(
|
||||||
|
'<input type="text" name="%s" id="%s" maxlength="%d" style="%s" value="%s" %s/>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
$p_str_max_length,
|
||||||
|
$l_str_style,
|
||||||
|
$l_arr_data['value'],
|
||||||
|
$p_bool_readonly ? 'readonly="readonly"' : ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for an input [type = checkbox].
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to pre load the input field.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_checkbox( $p_str_setting_name ) {
|
||||||
|
// Collect data for given settings field.
|
||||||
|
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||||
|
return sprintf(
|
||||||
|
'<input type="checkbox" name="%s" id="%s" %s/>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
MCI_Footnotes_Convert::to_bool( $l_arr_data['value'] ) ? 'checked="checked"' : ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for a select box.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to pre select the current value.
|
||||||
|
* @param array $p_arr_options Possible options to be selected.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_select_box( $p_str_setting_name, $p_arr_options ) {
|
||||||
|
// Collect data for given settings field.
|
||||||
|
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||||
|
$l_str_options = '';
|
||||||
|
|
||||||
|
foreach ( $p_arr_options as $l_str_value => $l_str_caption ) {
|
||||||
|
$l_str_options .= sprintf(
|
||||||
|
'<option value="%s" %s>%s</option>',
|
||||||
|
$l_str_value,
|
||||||
|
$l_str_value === $l_arr_data['value'] ? 'selected' : '',
|
||||||
|
$l_str_caption
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return sprintf(
|
||||||
|
'<select name="%s" id="%s">%s</select>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
$l_str_options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for a text area.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to pre fill the text area.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_textarea( $p_str_setting_name ) {
|
||||||
|
// Collect data for given settings field.
|
||||||
|
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||||
|
return sprintf(
|
||||||
|
'<textarea name="%s" id="%s">%s</textarea>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
$l_arr_data['value']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for an input [type = text] with color selection class.
|
||||||
|
*
|
||||||
|
* @since 1.5.6
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to pre load the input field.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function add_color_selection( $p_str_setting_name ) {
|
||||||
|
// Collect data for given settings field.
|
||||||
|
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||||
|
return sprintf(
|
||||||
|
'<input type="text" name="%s" id="%s" class="mfmmf-color-picker" value="%s"/>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
$l_arr_data['value']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the html tag for an input [type = num].
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @param string $p_str_setting_name Name of the Settings key to pre load the input field.
|
||||||
|
* @param int $p_in_min Minimum value.
|
||||||
|
* @param int $p_int_max Maximum value.
|
||||||
|
* @param bool $p_bool_deci true if 0.1 steps and floating to string, false if integer (default).
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* Edited:
|
||||||
|
* @since 2.1.4 step argument and number_format() to allow decimals 2020-12-03T0631+0100..2020-12-12T1110+0100
|
||||||
|
*/
|
||||||
|
protected function add_num_box( $p_str_setting_name, $p_in_min, $p_int_max, $p_bool_deci = false ) {
|
||||||
|
// Collect data for given settings field.
|
||||||
|
$l_arr_data = $this->load_setting( $p_str_setting_name );
|
||||||
|
|
||||||
|
if ( $p_bool_deci ) {
|
||||||
|
$l_str_value = number_format( floatval( $l_arr_data['value'] ), 1 );
|
||||||
|
return sprintf(
|
||||||
|
'<input type="number" name="%s" id="%s" value="%s" step="0.1" min="%d" max="%d"/>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
$l_str_value,
|
||||||
|
$p_in_min,
|
||||||
|
$p_int_max
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return sprintf(
|
||||||
|
'<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
||||||
|
$l_arr_data['name'],
|
||||||
|
$l_arr_data['id'],
|
||||||
|
$l_arr_data['value'],
|
||||||
|
$p_in_min,
|
||||||
|
$p_int_max
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
147
class/dashboard/subpage-diagnostics.php
Normal file
147
class/dashboard/subpage-diagnostics.php
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
/**
|
||||||
|
* Includes the Plugin Class to display Diagnostics.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @package footnotes
|
||||||
|
* @since 1.5.0
|
||||||
|
* @date 14.09.14 14:47
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays Diagnostics of the web server, PHP and WordPress.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Priority index. Lower numbers have a higher Priority.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function get_priority() {
|
||||||
|
return 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unique slug of the sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_sub_page_slug() {
|
||||||
|
return '-diagnostics';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the title of the sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_sub_page_title() {
|
||||||
|
return __( 'Diagnostics', 'footnotes' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of all registered sections for the sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function get_sections() {
|
||||||
|
return array(
|
||||||
|
$this->add_section( 'diagnostics', __( 'Diagnostics', 'footnotes' ), null, false ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of all registered meta boxes for each section of the sub page.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function get_meta_boxes() {
|
||||||
|
return array(
|
||||||
|
$this->add_meta_box( 'diagnostics', 'diagnostics', __( 'Displays information about the web server, PHP and WordPress', 'footnotes' ), 'Diagnostics' ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a diagnostics about the web server, php and WordPress.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
public function Diagnostics() {
|
||||||
|
global $wp_version;
|
||||||
|
$l_str_php_extensions = '';
|
||||||
|
// Iterate through each PHP extension.
|
||||||
|
foreach ( get_loaded_extensions() as $l_int_index => $l_str_extension ) {
|
||||||
|
if ( $l_int_index > 0 ) {
|
||||||
|
$l_str_php_extensions .= ' | ';
|
||||||
|
}
|
||||||
|
$l_str_php_extensions .= $l_str_extension . ' ' . phpversion( $l_str_extension );
|
||||||
|
}
|
||||||
|
|
||||||
|
$l_obj_current_theme = wp_get_theme();
|
||||||
|
|
||||||
|
$l_str_wordpress_plugins = '';
|
||||||
|
// Iterate through each installed WordPress Plugin.
|
||||||
|
foreach ( get_plugins() as $l_arr_plugin ) {
|
||||||
|
$l_str_wordpress_plugins .= '<tr>';
|
||||||
|
$l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Name'] . '</td>';
|
||||||
|
// phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found
|
||||||
|
$l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Version'] . ' [' . $l_arr_plugin['PluginURI'] . ']' . '</td>';
|
||||||
|
// phpcs:enable Generic.Strings.UnnecessaryStringConcat.Found
|
||||||
|
$l_str_wordpress_plugins .= '</tr>';
|
||||||
|
}
|
||||||
|
// Load template file.
|
||||||
|
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'diagnostics' );
|
||||||
|
|
||||||
|
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
|
||||||
|
die;
|
||||||
|
} else {
|
||||||
|
$l_str_server_name = wp_unslash( $_SERVER['SERVER_NAME'] );
|
||||||
|
}
|
||||||
|
if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
||||||
|
die;
|
||||||
|
} else {
|
||||||
|
$l_str_http_user_agent = wp_unslash( $_SERVER['HTTP_USER_AGENT'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace all placeholders.
|
||||||
|
$l_obj_template->replace(
|
||||||
|
array(
|
||||||
|
'label-server' => __( 'Server name', 'footnotes' ),
|
||||||
|
'server' => $l_str_server_name,
|
||||||
|
|
||||||
|
'label-php' => __( 'PHP version', 'footnotes' ),
|
||||||
|
'php' => phpversion(),
|
||||||
|
|
||||||
|
'label-user-agent' => __( 'User agent', 'footnotes' ),
|
||||||
|
'user-agent' => $l_str_http_user_agent,
|
||||||
|
|
||||||
|
'label-max-execution-time' => __( 'Max execution time', 'footnotes' ),
|
||||||
|
'max-execution-time' => ini_get( 'max_execution_time' ) . ' ' . __( 'seconds', 'footnotes' ),
|
||||||
|
|
||||||
|
'label-memory-limit' => __( 'Memory limit', 'footnotes' ),
|
||||||
|
'memory-limit' => ini_get( 'memory_limit' ),
|
||||||
|
|
||||||
|
'label-php-extensions' => __( 'PHP extensions', 'footnotes' ),
|
||||||
|
'php-extensions' => $l_str_php_extensions,
|
||||||
|
|
||||||
|
'label-wordpress' => __( 'WordPress version', 'footnotes' ),
|
||||||
|
'wordpress' => $wp_version,
|
||||||
|
|
||||||
|
'label-theme' => __( 'Active Theme', 'footnotes' ),
|
||||||
|
'theme' => $l_obj_current_theme->get( 'Name' ) . ' ' . $l_obj_current_theme->get( 'Version' ) . ', ' . $l_obj_current_theme->get( 'Author' ) . ' [' . $l_obj_current_theme->get( 'AuthorURI' ) . ']',
|
||||||
|
|
||||||
|
'plugins' => $l_str_wordpress_plugins,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// Display template with replaced placeholders.
|
||||||
|
echo $l_obj_template->get_content();
|
||||||
|
}
|
||||||
|
}
|
1261
class/dashboard/subpage-main.php
Normal file
1261
class/dashboard/subpage-main.php
Normal file
File diff suppressed because it is too large
Load diff
|
@ -72,7 +72,6 @@ class MCI_Footnotes {
|
||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
* @contributor Patrizia Lutz @misfist
|
* @contributor Patrizia Lutz @misfist
|
||||||
* @var bool
|
* @var bool
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static $a_bool_alternative_tooltips_enabled = false;
|
public static $a_bool_alternative_tooltips_enabled = false;
|
||||||
|
|
||||||
|
@ -326,7 +325,6 @@ class MCI_Footnotes {
|
||||||
wp_enqueue_script( 'jquery-ui-tooltip' );
|
wp_enqueue_script( 'jquery-ui-tooltip' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -341,7 +339,7 @@ class MCI_Footnotes {
|
||||||
* The Boolean may be set at the bottom of the plugin’s main PHP file.
|
* The Boolean may be set at the bottom of the plugin’s main PHP file.
|
||||||
* @see footnotes.php
|
* @see footnotes.php
|
||||||
*/
|
*/
|
||||||
if ( true === C_BOOL_CSS_PRODUCTION_MODE ) {
|
if ( C_BOOL_CSS_PRODUCTION_MODE ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues a minified united external stylesheet in production.
|
* Enqueues a minified united external stylesheet in production.
|
||||||
|
@ -364,6 +362,7 @@ class MCI_Footnotes {
|
||||||
* @since 2.0.3 add versioning of public.css for cache busting.
|
* @since 2.0.3 add versioning of public.css for cache busting.
|
||||||
* @date 2020-10-29T1413+0100
|
* @date 2020-10-29T1413+0100
|
||||||
* Plugin version number is needed for busting browser caches after each plugin update.
|
* Plugin version number is needed for busting browser caches after each plugin update.
|
||||||
|
*
|
||||||
* @since 2.1.4 automate passing version number for cache busting.
|
* @since 2.1.4 automate passing version number for cache busting.
|
||||||
* @date 2020-11-30T0646+0100
|
* @date 2020-11-30T0646+0100
|
||||||
* The constant C_STR_PACKAGE_VERSION is defined at start of footnotes.php.
|
* The constant C_STR_PACKAGE_VERSION is defined at start of footnotes.php.
|
||||||
|
@ -387,11 +386,9 @@ class MCI_Footnotes {
|
||||||
$l_str_tooltip_mode_long = 'jquery-tooltips';
|
$l_str_tooltip_mode_long = 'jquery-tooltips';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$l_str_tooltip_mode_short = 'nott';
|
$l_str_tooltip_mode_short = 'nott';
|
||||||
$l_str_tooltip_mode_long = 'no-tooltips';
|
$l_str_tooltip_mode_long = 'no-tooltips';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set basic responsive page layout mode for use in stylesheet name.
|
// Set basic responsive page layout mode for use in stylesheet name.
|
||||||
|
@ -419,7 +416,11 @@ class MCI_Footnotes {
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css'
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css'
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
C_STR_PACKAGE_VERSION,
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/footnotes-' . $l_str_tooltip_mode_short . 'ttbrpl' . $l_str_layout_mode . '.min.css'
|
||||||
|
),
|
||||||
'all'
|
'all'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -433,15 +434,51 @@ class MCI_Footnotes {
|
||||||
*
|
*
|
||||||
* This optional layout fix is useful by lack of layout support.
|
* This optional layout fix is useful by lack of layout support.
|
||||||
*/
|
*/
|
||||||
wp_enqueue_style( 'mci-footnotes-common', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-common.css' ), array(), C_STR_PACKAGE_VERSION );
|
wp_enqueue_style(
|
||||||
wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_PACKAGE_VERSION );
|
'mci-footnotes-common',
|
||||||
|
plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-common.css' ),
|
||||||
|
array(),
|
||||||
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/dev-common.css'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
wp_enqueue_style(
|
||||||
|
'mci-footnotes-tooltips',
|
||||||
|
plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ),
|
||||||
|
array(),
|
||||||
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/dev-tooltips.css'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if ( self::$a_bool_amp_enabled ) {
|
if ( self::$a_bool_amp_enabled ) {
|
||||||
wp_enqueue_style( 'mci-footnotes-amp', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-amp-tooltips.css' ), array(), C_STR_PACKAGE_VERSION );
|
wp_enqueue_style(
|
||||||
|
'mci-footnotes-amp',
|
||||||
|
plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-amp-tooltips.css' ),
|
||||||
|
array(),
|
||||||
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/dev-amp-tooltips.css'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self::$a_bool_alternative_tooltips_enabled ) {
|
if ( self::$a_bool_alternative_tooltips_enabled ) {
|
||||||
wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_PACKAGE_VERSION );
|
wp_enqueue_style(
|
||||||
|
'mci-footnotes-alternative',
|
||||||
|
plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ),
|
||||||
|
array(),
|
||||||
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/dev-tooltips-alternative.css'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$l_str_page_layout_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT );
|
$l_str_page_layout_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT );
|
||||||
|
@ -452,7 +489,11 @@ class MCI_Footnotes {
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_page_layout_option . '.css'
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_page_layout_option . '.css'
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
C_STR_PACKAGE_VERSION,
|
filemtime(
|
||||||
|
plugin_dir_path(
|
||||||
|
dirname( __FILE__ )
|
||||||
|
) . 'css/dev-layout-' . $l_str_page_layout_option . '.css'
|
||||||
|
),
|
||||||
'all'
|
'all'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,7 +424,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_Layout_Engine {
|
||||||
$l_obj_template->replace(
|
$l_obj_template->replace(
|
||||||
array(
|
array(
|
||||||
// Translators: The 2 placeholders are the <ref></ref> and <fn></fn> shortcodes.
|
// Translators: The 2 placeholders are the <ref></ref> and <fn></fn> shortcodes.
|
||||||
'description-escapement' => sprintf( __( 'The problems with shortcodes with pointy brackets have been solved. We apologize for the longlasting bugs making the %s and %s shortcodes close to unusable.', 'footnotes' ), '<ref></ref>', '<fn></fn>' ),
|
'description-escapement' => sprintf( __( 'The problems with shortcodes with pointy brackets have been solved. We apologize for the longlasting bugs making the %1$s and %2$s shortcodes close to unusable.', 'footnotes' ), '<ref></ref>', '<fn></fn>' ),
|
||||||
|
|
||||||
'label-short-code-start' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ),
|
'label-short-code-start' => $this->add_label( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __( 'Footnote start tag short code:', 'footnotes' ) ),
|
||||||
'short-code-start' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ),
|
'short-code-start' => $this->add_select_box( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_shortcode_start ),
|
||||||
|
|
|
@ -147,7 +147,6 @@ class MCI_Footnotes_Settings {
|
||||||
* - as in English or US American typesetting;
|
* - as in English or US American typesetting;
|
||||||
* - for better UX thanks to a more button-like appearance;
|
* - for better UX thanks to a more button-like appearance;
|
||||||
* - for stylistic consistency with the expand-collapse button.
|
* - for stylistic consistency with the expand-collapse button.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
const C_STR_FOOTNOTES_STYLING_BEFORE = 'footnote_inputfield_custom_styling_before';
|
const C_STR_FOOTNOTES_STYLING_BEFORE = 'footnote_inputfield_custom_styling_before';
|
||||||
|
|
||||||
|
@ -1414,7 +1413,7 @@ class MCI_Footnotes_Settings {
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// Scope and priority
|
// Scope and priority.
|
||||||
'footnotes_storage_expert' => array(
|
'footnotes_storage_expert' => array(
|
||||||
|
|
||||||
// WordPress hooks with priority level.
|
// WordPress hooks with priority level.
|
||||||
|
|
|
@ -868,6 +868,7 @@ class MCI_Footnotes_Task {
|
||||||
* Dimensions of jQuery tooltips.
|
* Dimensions of jQuery tooltips.
|
||||||
*
|
*
|
||||||
* Position and timing of jQuery tooltips are script defined.
|
* Position and timing of jQuery tooltips are script defined.
|
||||||
|
*
|
||||||
* @see templates/public/tooltip.html.
|
* @see templates/public/tooltip.html.
|
||||||
*/
|
*/
|
||||||
$l_int_max_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH );
|
$l_int_max_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH );
|
||||||
|
@ -877,7 +878,6 @@ class MCI_Footnotes_Task {
|
||||||
echo "}\r\n";
|
echo "}\r\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AMP compatible and alternative tooltips.
|
* AMP compatible and alternative tooltips.
|
||||||
*/
|
*/
|
||||||
|
@ -935,6 +935,7 @@ class MCI_Footnotes_Task {
|
||||||
* AMP compatible tooltips.
|
* AMP compatible tooltips.
|
||||||
*
|
*
|
||||||
* To streamline internal CSS, immutable rules are in external stylesheet.
|
* To streamline internal CSS, immutable rules are in external stylesheet.
|
||||||
|
*
|
||||||
* @see dev-amp-tooltips.css.
|
* @see dev-amp-tooltips.css.
|
||||||
*/
|
*/
|
||||||
if ( MCI_Footnotes::$a_bool_amp_enabled ) {
|
if ( MCI_Footnotes::$a_bool_amp_enabled ) {
|
||||||
|
@ -953,6 +954,7 @@ class MCI_Footnotes_Task {
|
||||||
* Alternative tooltips.
|
* Alternative tooltips.
|
||||||
*
|
*
|
||||||
* To streamline internal CSS, immutable rules are in external stylesheet.
|
* To streamline internal CSS, immutable rules are in external stylesheet.
|
||||||
|
*
|
||||||
* @see dev-tooltips-alternative.css.
|
* @see dev-tooltips-alternative.css.
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
@ -1016,7 +1018,8 @@ class MCI_Footnotes_Task {
|
||||||
document.getElementById(footnote_tooltip_id).classList.add('hidden');
|
document.getElementById(footnote_tooltip_id).classList.add('hidden');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php // Indenting this PHP open tag would mess up the page source.
|
<?php
|
||||||
|
// Indenting this PHP open tag would mess up the page source.
|
||||||
// End internal script.
|
// End internal script.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1172,7 @@ class MCI_Footnotes_Task {
|
||||||
|
|
||||||
$l_int_excerpt_length = (int) _x( '55', 'excerpt_length' );
|
$l_int_excerpt_length = (int) _x( '55', 'excerpt_length' );
|
||||||
$l_int_excerpt_length = (int) apply_filters( 'excerpt_length', $l_int_excerpt_length );
|
$l_int_excerpt_length = (int) apply_filters( 'excerpt_length', $l_int_excerpt_length );
|
||||||
$l_str_excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
|
$l_str_excerpt_more = apply_filters( 'excerpt_more', ' […]' );
|
||||||
|
|
||||||
// Function wp_trim_words() calls wp_strip_all_tags() that wrecks the footnotes.
|
// Function wp_trim_words() calls wp_strip_all_tags() that wrecks the footnotes.
|
||||||
$p_str_content = wp_trim_words( $p_str_content, $l_int_excerpt_length, $l_str_excerpt_more );
|
$p_str_content = wp_trim_words( $p_str_content, $l_int_excerpt_length, $l_str_excerpt_more );
|
||||||
|
@ -1230,7 +1233,7 @@ class MCI_Footnotes_Task {
|
||||||
$l_int_excerpt_length = (int) apply_filters( 'excerpt_length', $l_int_excerpt_length );
|
$l_int_excerpt_length = (int) apply_filters( 'excerpt_length', $l_int_excerpt_length );
|
||||||
|
|
||||||
// Prepare the Read-on string.
|
// Prepare the Read-on string.
|
||||||
$l_str_excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
|
$l_str_excerpt_more = apply_filters( 'excerpt_more', ' […]' );
|
||||||
|
|
||||||
// Safeguard the footnotes.
|
// Safeguard the footnotes.
|
||||||
preg_match_all(
|
preg_match_all(
|
||||||
|
@ -1399,6 +1402,8 @@ class MCI_Footnotes_Task {
|
||||||
/**
|
/**
|
||||||
* Brings the delimiters and unifies their various HTML escapement schemas.
|
* Brings the delimiters and unifies their various HTML escapement schemas.
|
||||||
*
|
*
|
||||||
|
* @param string $p_str_content TODO.
|
||||||
|
*
|
||||||
* - Bugfix: Footnote delimiter short codes: fix numbering bug by cross-editor HTML escapement schema unification, thanks to @patrick_here @alifarahani8000 @gova bug reports.
|
* - Bugfix: Footnote delimiter short codes: fix numbering bug by cross-editor HTML escapement schema unification, thanks to @patrick_here @alifarahani8000 @gova bug reports.
|
||||||
*
|
*
|
||||||
* @reporter @patrick_here
|
* @reporter @patrick_here
|
||||||
|
@ -1696,7 +1701,6 @@ class MCI_Footnotes_Task {
|
||||||
// Load 'templates/public/amp-footnote.html'.
|
// Load 'templates/public/amp-footnote.html'.
|
||||||
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-footnote' );
|
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-footnote' );
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ( MCI_Footnotes::$a_bool_alternative_tooltips_enabled ) {
|
} elseif ( MCI_Footnotes::$a_bool_alternative_tooltips_enabled ) {
|
||||||
|
|
||||||
// Load 'templates/public/footnote-alternative.html'.
|
// Load 'templates/public/footnote-alternative.html'.
|
||||||
|
@ -1711,7 +1715,6 @@ class MCI_Footnotes_Task {
|
||||||
// Load tooltip inline script.
|
// Load tooltip inline script.
|
||||||
$l_obj_template_tooltip = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'tooltip' );
|
$l_obj_template_tooltip = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'tooltip' );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search footnotes short codes in the content.
|
// Search footnotes short codes in the content.
|
||||||
|
@ -1957,7 +1960,6 @@ class MCI_Footnotes_Task {
|
||||||
$l_str_excerpt_text .= self::$a_int_post_id . '_' . self::$a_int_reference_container_id;
|
$l_str_excerpt_text .= self::$a_int_post_id . '_' . self::$a_int_reference_container_id;
|
||||||
$l_str_excerpt_text .= '.toggleClass(class=collapsed, force=false)"';
|
$l_str_excerpt_text .= '.toggleClass(class=collapsed, force=false)"';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Don’t add onclick event in AMP compatibility mode.
|
// Don’t add onclick event in AMP compatibility mode.
|
||||||
|
@ -2390,7 +2392,6 @@ class MCI_Footnotes_Task {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// When combining identical footnotes is turned on, another template is needed.
|
// When combining identical footnotes is turned on, another template is needed.
|
||||||
|
@ -2764,7 +2765,6 @@ class MCI_Footnotes_Task {
|
||||||
// Load 'templates/public/amp-reference-container.html'.
|
// Load 'templates/public/amp-reference-container.html'.
|
||||||
$l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container' );
|
$l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'amp-reference-container' );
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ( 'js' === MCI_Footnotes::$a_str_script_mode ) {
|
} elseif ( 'js' === MCI_Footnotes::$a_str_script_mode ) {
|
||||||
|
|
||||||
// Load 'templates/public/js-reference-container.html'.
|
// Load 'templates/public/js-reference-container.html'.
|
||||||
|
|
21
composer.json
Normal file
21
composer.json
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "markcheret/footnotes",
|
||||||
|
"description": "footnotes aims to be the all-in-one solution for displaying an automatically-generated list of references on your WordPress Page or Post.",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"scripts": {
|
||||||
|
"release": "./_tools/release.sh",
|
||||||
|
"release:commit": "composer run release -- -c",
|
||||||
|
"build": "./_tools/build.sh",
|
||||||
|
"lint-php": "./vendor/bin/phpcs --standard='WordPress' --colors --encoding=utf-8 -n -p --ignore=*/vendor/* ./*.php ./*/*.php ./*/*/*.php",
|
||||||
|
"lint-php:fix": "./vendor/bin/phpcbf --standard='WordPress' --encoding=utf-8 -p --ignore=*/vendor/* ./*.php ./*/*.php ./*/*/*.php",
|
||||||
|
"lint-css": "echo TODO",
|
||||||
|
"lint-js": "echo TODO",
|
||||||
|
"docs": "./vendor/bin/phpdoc -d . -t ./docs --ignore vendor/",
|
||||||
|
"post-install-cmd": "./_tools/setup.sh"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
|
||||||
|
"wp-coding-standards/wpcs": "^2.3",
|
||||||
|
"phpdocumentor/phpdocumentor": "^3.0"
|
||||||
|
}
|
||||||
|
}
|
61
contrib/pre-commit
Normal file
61
contrib/pre-commit
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Modified from: https://github.com/bjornjohansen/wp-pre-commit-hook
|
||||||
|
# Also: https://softdiscover.com/wordpress/perfect-setup-for-a-wordpress-project-development/
|
||||||
|
|
||||||
|
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
|
||||||
|
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
|
||||||
|
|
||||||
|
# Determine if a file list is passed
|
||||||
|
if [ "$#" -eq 1 ]
|
||||||
|
then
|
||||||
|
oIFS=$IFS
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
SFILES="$1"
|
||||||
|
IFS=$oIFS
|
||||||
|
fi
|
||||||
|
SFILES=${SFILES:-$STAGED_FILES_CMD}
|
||||||
|
|
||||||
|
echo "Checking PHP Lint..."
|
||||||
|
for FILE in $SFILES
|
||||||
|
do
|
||||||
|
php -l -d display_errors=0 $PROJECT/$FILE
|
||||||
|
if [ $? != 0 ]
|
||||||
|
then
|
||||||
|
echo "Fix the error before commit."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
FILES="$FILES $PROJECT/$FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f "$PROJECT/phpcs.ruleset.xml" ]
|
||||||
|
then
|
||||||
|
RULESET="$PROJECT/phpcs.ruleset.xml"
|
||||||
|
elif [ -f "$PROJECT/phpcs.xml.dist" ]
|
||||||
|
then
|
||||||
|
RULESET="$PROJECT/phpcs.xml.dist"
|
||||||
|
else
|
||||||
|
RULESET="WordPress"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$FILES" != "" ]
|
||||||
|
then
|
||||||
|
echo "Checking Code Standard Compliance, using $RULESET as ruleset standard..."
|
||||||
|
./vendor/bin/phpcs --standard="$RULESET" --colors --encoding=utf-8 -n -p $FILES
|
||||||
|
if [ $? != 0 ]
|
||||||
|
then
|
||||||
|
echo "Coding standards errors have been detected. Running phpcbf..."
|
||||||
|
./vendor/bin/phpcbf --standard="$RULESET" --encoding=utf-8 -n -p $FILES
|
||||||
|
git add $FILES
|
||||||
|
echo "Running Code Sniffer again..."
|
||||||
|
./vendor/bin/phpcs --standard="$RULESET" --colors --encoding=utf-8 -n -p $FILES
|
||||||
|
if [ $? != 0 ]
|
||||||
|
then
|
||||||
|
echo "Errors found not fixable automatically. You need to manually fix them."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $?
|
|
@ -129,11 +129,11 @@
|
||||||
*
|
*
|
||||||
* - Bugfix: Reference container, tooltips: URL wrap: enable the 'word-wrap: anywhere' rule, thanks to @rebelc0de bug report.
|
* - Bugfix: Reference container, tooltips: URL wrap: enable the 'word-wrap: anywhere' rule, thanks to @rebelc0de bug report.
|
||||||
*
|
*
|
||||||
|
* @since 2.5.4
|
||||||
|
*
|
||||||
* @reporter @rebelc0de
|
* @reporter @rebelc0de
|
||||||
* @link https://wordpress.org/support/topic/footnotes-on-mobile-phones/#post-14037101
|
* @link https://wordpress.org/support/topic/footnotes-on-mobile-phones/#post-14037101
|
||||||
*
|
*
|
||||||
* @since 2.5.4
|
|
||||||
*
|
|
||||||
* These rules turn out useless for the purpose and are commented out:
|
* These rules turn out useless for the purpose and are commented out:
|
||||||
* word-wrap: break-word;
|
* word-wrap: break-word;
|
||||||
* overflow-wrap: break-word;
|
* overflow-wrap: break-word;
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
* Additional stylesheet for alternative tooltips.
|
* Additional stylesheet for alternative tooltips.
|
||||||
*
|
*
|
||||||
* @since 2.5.5
|
* @since 2.5.5
|
||||||
*
|
|
||||||
* System of unified minified style sheets tailored to the instance.
|
* System of unified minified style sheets tailored to the instance.
|
||||||
*
|
*
|
||||||
* @see dev-common.css.
|
* @see full header in dev-common.css.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Position.
|
* Alternative tooltips
|
||||||
*
|
*
|
||||||
* Values are defined by internal CSS.
|
* These default position values may be overridden by internal CSS.
|
||||||
* @see class/task.php
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.footnote_referrer.relative {
|
.footnote_referrer.relative {
|
||||||
|
|
1
css/footnotes-alttbrpl0.min.css
vendored
1
css/footnotes-alttbrpl0.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-alttbrpl1.min.css
vendored
1
css/footnotes-alttbrpl1.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-alttbrpl2.min.css
vendored
1
css/footnotes-alttbrpl2.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-alttbrpl3.min.css
vendored
1
css/footnotes-alttbrpl3.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-jqttbrpl0.min.css
vendored
1
css/footnotes-jqttbrpl0.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-jqttbrpl1.min.css
vendored
1
css/footnotes-jqttbrpl1.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-jqttbrpl2.min.css
vendored
1
css/footnotes-jqttbrpl2.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-jqttbrpl3.min.css
vendored
1
css/footnotes-jqttbrpl3.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-nottbrpl0.min.css
vendored
1
css/footnotes-nottbrpl0.min.css
vendored
|
@ -1 +0,0 @@
|
||||||
.footnotes_validation_error{border:4px solid red;padding:20px 40px;margin:20px 0;background:#ff000055;text-align:start}.footnotes_validation_error p:first-child{font-size:20px;font-weight:700;text-align:center}.footnotes_validation_error p:nth-child(2){font-size:16px;font-style:italic}.footnotes_validation_error p:nth-child(3){font-size:14px;font-weight:700}.footnotes_validation_error p:last-child{font-size:12px}.footnote_url_wrap{word-wrap:anywhere;overflow-wrap:anywhere;word-break:break-all}.footnote_item_base,.footnote_referrer_base{position:relative!important}.footnote_item_anchor,.footnote_referrer_anchor{position:absolute!important}.footnote_plugin_tooltip_text,.footnote_plugin_tooltip_text:hover,.footnote_referrer,.footnote_referrer:hover,.footnote_referrer:link,.footnote_referrer>a,.footnote_referrer>a:hover,.footnote_referrer>a:link,.main-content .footnote_plugin_tooltip_text,.main-content .footnote_plugin_tooltip_text:hover,.main-content .footnote_referrer,.main-content .footnote_referrer:hover,.main-content .footnote_referrer:link,.main-content .footnote_referrer>a,.main-content .footnote_referrer>a:hover,.main-content .footnote_referrer>a:link{text-decoration:none!important;border-bottom:none!important;box-shadow:none!important}.footnote_plugin_tooltip_text{line-height:0;position:relative!important;cursor:pointer}.footnotes_reference_container{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.collapsed{display:none}.unfolded{display:inline}.footnote_container_prepare{display:block!important;padding-top:24px!important}.footnote_container_prepare>p{line-height:1.3!important;margin-top:1em!important;margin-bottom:.25em!important;padding:0!important;font-weight:400!important;display:block!important;-webkit-margin-before:.83em!important;-webkit-margin-after:.83em!important;-webkit-margin-start:0!important;-webkit-margin-end:0!important;text-align:start!important;vertical-align:middle}.footnote_container_prepare>p>span:first-child,.footnote_container_prepare>p>span:nth-child(3){text-align:start!important;font-size:1.5em!important}.footnote_reference_container_collapse_button{cursor:pointer;padding:0 .5em;font-size:1.3em!important;vertical-align:2px;text-decoration:none!important}h2>.footnote_reference_container_collapse_button,h3>.footnote_reference_container_collapse_button,h4>.footnote_reference_container_collapse_button,h5>.footnote_reference_container_collapse_button,h6>.footnote_reference_container_collapse_button{font-size:inherit!important}.footnote_container_prepare>p>span:last-child a,.footnote_reference_container_collapse_button a{text-decoration:none!important}.footnote-reference-container,.footnotes_table{width:100%!important;border:none!important}.footnotes_table caption.accessibility{text-align:start;margin-top:-2px!important;height:1px!important;width:1px!important;white-space:nowrap!important;overflow:hidden!important;color:#ffffff00!important;background-color:#ffffff00!important}.footnotes_table .footnotes_plugin_reference_row th{color:unset!important;background-color:inherit!important}.footnote_plugin_index,.footnote_plugin_index_combi,.footnote_plugin_symbol,.footnote_plugin_text{border:none!important;text-align:start!important;vertical-align:top!important;padding:5px 6px 10px 0!important}html[dir=rtl] .footnote_plugin_index,html[dir=rtl] .footnote_plugin_index_combi,html[dir=rtl] .footnote_plugin_symbol,html[dir=rtl] .footnote_plugin_text{padding:5px 0 10px 6px!important}.footnote_backlink,.footnote_backlink:link,.footnote_plugin_link,.footnote_plugin_link:link,.main-content .footnote_backlink,.main-content .footnote_backlink:link,.main-content .footnote_plugin_link,.main-content .footnote_plugin_link:link{text-decoration:none!important;border-bottom:none!important}.footnote_backlink,.footnote_plugin_link{white-space:nowrap}.footnote_backlink,.footnote_index,.pointer{cursor:pointer}.footnote_backlink:hover,.footnote_plugin_link:hover,.footnote_plugin_text a:hover{text-decoration:unset;text-decoration:underline}.footnote_plugin_text{width:unset}.footnote_plugin_index,.footnote_plugin_index_combi{max-width:100px;width:2.5em}@media only screen and (max-width:768px){.footnote_plugin_index,.footnote_plugin_index_combi{max-width:80px}}.footnotes_reference_container{page-break-inside:avoid}@media print{.footnote_index_arrow,.footnote_reference_container_collapse_button,.footnote_tooltip{display:none}.footnote_plugin_tooltip_text{color:inherit}.footnote_plugin_index a,.footnote_plugin_index_combi a{color:inherit;text-decoration:none!important}div.post-meta-edit-link-wrapper{display:none}}.footnotes_logo,.footnotes_logo:hover{text-decoration:none;font-weight:400}.footnotes_logo_part1{color:#2bb975}.footnotes_logo_part2{color:#545f5a}
|
|
1
css/footnotes-nottbrpl1.min.css
vendored
1
css/footnotes-nottbrpl1.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-nottbrpl2.min.css
vendored
1
css/footnotes-nottbrpl2.min.css
vendored
File diff suppressed because one or more lines are too long
1
css/footnotes-nottbrpl3.min.css
vendored
1
css/footnotes-nottbrpl3.min.css
vendored
File diff suppressed because one or more lines are too long
0
css/settings.css
Executable file → Normal file
0
css/settings.css
Executable file → Normal file
1
css/tmp/footnotes-alttbrpl0.min.css
vendored
Normal file
1
css/tmp/footnotes-alttbrpl0.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-alttbrpl1.min.css
vendored
Normal file
1
css/tmp/footnotes-alttbrpl1.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-alttbrpl2.min.css
vendored
Normal file
1
css/tmp/footnotes-alttbrpl2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-alttbrpl3.min.css
vendored
Normal file
1
css/tmp/footnotes-alttbrpl3.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-jqttbrpl0.min.css
vendored
Normal file
1
css/tmp/footnotes-jqttbrpl0.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.footnotes_validation_error{border:4px solid red;padding:20px 40px;margin:20px 0;background:#ff000055;text-align:start}.footnotes_validation_error p:first-child{font-size:20px;font-weight:700;text-align:center}.footnotes_validation_error p:nth-child(2){font-size:16px;font-style:italic}.footnotes_validation_error p:nth-child(3){font-size:14px;font-weight:700}.footnotes_validation_error p:last-child{font-size:12px}.footnote_url_wrap{word-wrap:anywhere;overflow-wrap:anywhere;word-break:break-all}.footnote_item_base,.footnote_referrer_base{position:absolute}.footnote_item_anchor,.footnote_referrer_anchor{position:relative}.footnote_plugin_tooltip_text,.footnote_plugin_tooltip_text:hover,.footnote_referrer,.footnote_referrer:hover,.footnote_referrer:link,.footnote_referrer>a,.footnote_referrer>a:hover,.footnote_referrer>a:link,.main-content .footnote_plugin_tooltip_text,.main-content .footnote_plugin_tooltip_text:hover,.main-content .footnote_referrer,.main-content .footnote_referrer:hover,.main-content .footnote_referrer:link,.main-content .footnote_referrer>a,.main-content .footnote_referrer>a:hover,.main-content .footnote_referrer>a:link{text-decoration:none!important;border-bottom:none!important;box-shadow:none!important}.footnote_plugin_tooltip_text{line-height:0;position:relative!important;cursor:pointer}.footnotes_reference_container{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.footnote_container_prepare{display:block!important;padding-top:24px!important}.footnote_container_prepare>p{line-height:1.3!important;margin-top:1em!important;margin-bottom:.25em!important;padding:0!important;font-weight:400!important;display:block!important;-webkit-margin-before:.83em!important;-webkit-margin-after:.83em!important;-webkit-margin-start:0!important;-webkit-margin-end:0!important;text-align:start!important;vertical-align:middle}.footnote_container_prepare>p>span:first-child,.footnote_container_prepare>p>span:nth-child(3){text-align:start!important;font-size:1.5em!important}.footnote_reference_container_collapse_button{cursor:pointer;padding:0 .5em;font-size:1.3em!important;vertical-align:2px;text-decoration:none!important}h2>.footnote_reference_container_collapse_button,h3>.footnote_reference_container_collapse_button,h4>.footnote_reference_container_collapse_button,h5>.footnote_reference_container_collapse_button,h6>.footnote_reference_container_collapse_button{font-size:inherit!important}.footnote_container_prepare>p>span:last-child a,.footnote_reference_container_collapse_button a{text-decoration:none!important}.footnote-reference-container,.footnotes_table{width:100%;border:none}.footnote_plugin_index,.footnote_plugin_index_combi,.footnote_plugin_symbol,.footnote_plugin_text{border:none!important;text-align:start!important;vertical-align:top!important;padding:5px 6px 10px 0!important}html[dir=rtl] .footnote_plugin_index,html[dir=rtl] .footnote_plugin_index_combi,html[dir=rtl] .footnote_plugin_symbol,html[dir=rtl] .footnote_plugin_text{padding:5px 0 10px 6px!important}.footnote_backlink,.footnote_backlink:link,.footnote_plugin_link,.footnote_plugin_link:link,.main-content .footnote_backlink,.main-content .footnote_backlink:link,.main-content .footnote_plugin_link,.main-content .footnote_plugin_link:link{text-decoration:none!important;border-bottom:none!important}.footnote_backlink,.footnote_plugin_link{white-space:nowrap}.footnote_backlink,.footnote_index,.pointer{cursor:pointer}.footnote_backlink:hover,.footnote_plugin_link:hover,.footnote_plugin_text a:hover{text-decoration:unset;text-decoration:underline}.footnote_plugin_text{width:unset}.footnote_plugin_index,.footnote_plugin_index_combi{max-width:100px;width:2.5em}@media only screen and (max-width:768px){.footnote_plugin_index,.footnote_plugin_index_combi{max-width:80px}}.footnotes_reference_container{page-break-inside:avoid}@media print{.footnote_index_arrow,.footnote_reference_container_collapse_button,.footnote_tooltip{display:none}.footnote_plugin_tooltip_text{color:inherit}.footnote_plugin_index a,.footnote_plugin_index_combi a{color:inherit;text-decoration:none!important}div.post-meta-edit-link-wrapper{display:none}}.footnotes_logo,.footnotes_logo:hover{text-decoration:none;font-weight:400}.footnotes_logo_part1{color:#2bb975}.footnotes_logo_part2{color:#545f5a}.footnote_tooltip{display:none;z-index:2147483647!important;cursor:auto;text-align:start!important;padding:12px;line-height:1.2;font-weight:400;font-style:normal}.footnote_tooltip_continue{font-style:italic;color:green;text-decoration:none!important;cursor:pointer;white-space:nowrap}.footnote_tooltip_continue:hover{color:#00f;text-decoration:underline!important}
|
1
css/tmp/footnotes-jqttbrpl1.min.css
vendored
Normal file
1
css/tmp/footnotes-jqttbrpl1.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-jqttbrpl2.min.css
vendored
Normal file
1
css/tmp/footnotes-jqttbrpl2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-jqttbrpl3.min.css
vendored
Normal file
1
css/tmp/footnotes-jqttbrpl3.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-nottbrpl0.min.css
vendored
Normal file
1
css/tmp/footnotes-nottbrpl0.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.footnotes_validation_error{border:4px solid red;padding:20px 40px;margin:20px 0;background:#ff000055;text-align:start}.footnotes_validation_error p:first-child{font-size:20px;font-weight:700;text-align:center}.footnotes_validation_error p:nth-child(2){font-size:16px;font-style:italic}.footnotes_validation_error p:nth-child(3){font-size:14px;font-weight:700}.footnotes_validation_error p:last-child{font-size:12px}.footnote_url_wrap{word-wrap:anywhere;overflow-wrap:anywhere;word-break:break-all}.footnote_item_base,.footnote_referrer_base{position:absolute}.footnote_item_anchor,.footnote_referrer_anchor{position:relative}.footnote_plugin_tooltip_text,.footnote_plugin_tooltip_text:hover,.footnote_referrer,.footnote_referrer:hover,.footnote_referrer:link,.footnote_referrer>a,.footnote_referrer>a:hover,.footnote_referrer>a:link,.main-content .footnote_plugin_tooltip_text,.main-content .footnote_plugin_tooltip_text:hover,.main-content .footnote_referrer,.main-content .footnote_referrer:hover,.main-content .footnote_referrer:link,.main-content .footnote_referrer>a,.main-content .footnote_referrer>a:hover,.main-content .footnote_referrer>a:link{text-decoration:none!important;border-bottom:none!important;box-shadow:none!important}.footnote_plugin_tooltip_text{line-height:0;position:relative!important;cursor:pointer}.footnotes_reference_container{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.footnote_container_prepare{display:block!important;padding-top:24px!important}.footnote_container_prepare>p{line-height:1.3!important;margin-top:1em!important;margin-bottom:.25em!important;padding:0!important;font-weight:400!important;display:block!important;-webkit-margin-before:.83em!important;-webkit-margin-after:.83em!important;-webkit-margin-start:0!important;-webkit-margin-end:0!important;text-align:start!important;vertical-align:middle}.footnote_container_prepare>p>span:first-child,.footnote_container_prepare>p>span:nth-child(3){text-align:start!important;font-size:1.5em!important}.footnote_reference_container_collapse_button{cursor:pointer;padding:0 .5em;font-size:1.3em!important;vertical-align:2px;text-decoration:none!important}h2>.footnote_reference_container_collapse_button,h3>.footnote_reference_container_collapse_button,h4>.footnote_reference_container_collapse_button,h5>.footnote_reference_container_collapse_button,h6>.footnote_reference_container_collapse_button{font-size:inherit!important}.footnote_container_prepare>p>span:last-child a,.footnote_reference_container_collapse_button a{text-decoration:none!important}.footnote-reference-container,.footnotes_table{width:100%;border:none}.footnote_plugin_index,.footnote_plugin_index_combi,.footnote_plugin_symbol,.footnote_plugin_text{border:none!important;text-align:start!important;vertical-align:top!important;padding:5px 6px 10px 0!important}html[dir=rtl] .footnote_plugin_index,html[dir=rtl] .footnote_plugin_index_combi,html[dir=rtl] .footnote_plugin_symbol,html[dir=rtl] .footnote_plugin_text{padding:5px 0 10px 6px!important}.footnote_backlink,.footnote_backlink:link,.footnote_plugin_link,.footnote_plugin_link:link,.main-content .footnote_backlink,.main-content .footnote_backlink:link,.main-content .footnote_plugin_link,.main-content .footnote_plugin_link:link{text-decoration:none!important;border-bottom:none!important}.footnote_backlink,.footnote_plugin_link{white-space:nowrap}.footnote_backlink,.footnote_index,.pointer{cursor:pointer}.footnote_backlink:hover,.footnote_plugin_link:hover,.footnote_plugin_text a:hover{text-decoration:unset;text-decoration:underline}.footnote_plugin_text{width:unset}.footnote_plugin_index,.footnote_plugin_index_combi{max-width:100px;width:2.5em}@media only screen and (max-width:768px){.footnote_plugin_index,.footnote_plugin_index_combi{max-width:80px}}.footnotes_reference_container{page-break-inside:avoid}@media print{.footnote_index_arrow,.footnote_reference_container_collapse_button,.footnote_tooltip{display:none}.footnote_plugin_tooltip_text{color:inherit}.footnote_plugin_index a,.footnote_plugin_index_combi a{color:inherit;text-decoration:none!important}div.post-meta-edit-link-wrapper{display:none}}.footnotes_logo,.footnotes_logo:hover{text-decoration:none;font-weight:400}.footnotes_logo_part1{color:#2bb975}.footnotes_logo_part2{color:#545f5a}
|
1
css/tmp/footnotes-nottbrpl1.min.css
vendored
Normal file
1
css/tmp/footnotes-nottbrpl1.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-nottbrpl2.min.css
vendored
Normal file
1
css/tmp/footnotes-nottbrpl2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/tmp/footnotes-nottbrpl3.min.css
vendored
Normal file
1
css/tmp/footnotes-nottbrpl3.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.footnotes_validation_error{border:4px solid red;padding:20px 40px;margin:20px 0;background:#ff000055;text-align:start}.footnotes_validation_error p:first-child{font-size:20px;font-weight:700;text-align:center}.footnotes_validation_error p:nth-child(2){font-size:16px;font-style:italic}.footnotes_validation_error p:nth-child(3){font-size:14px;font-weight:700}.footnotes_validation_error p:last-child{font-size:12px}.footnote_url_wrap{word-wrap:anywhere;overflow-wrap:anywhere;word-break:break-all}.footnote_item_base,.footnote_referrer_base{position:absolute}.footnote_item_anchor,.footnote_referrer_anchor{position:relative}.footnote_plugin_tooltip_text,.footnote_plugin_tooltip_text:hover,.footnote_referrer,.footnote_referrer:hover,.footnote_referrer:link,.footnote_referrer>a,.footnote_referrer>a:hover,.footnote_referrer>a:link,.main-content .footnote_plugin_tooltip_text,.main-content .footnote_plugin_tooltip_text:hover,.main-content .footnote_referrer,.main-content .footnote_referrer:hover,.main-content .footnote_referrer:link,.main-content .footnote_referrer>a,.main-content .footnote_referrer>a:hover,.main-content .footnote_referrer>a:link{text-decoration:none!important;border-bottom:none!important;box-shadow:none!important}.footnote_plugin_tooltip_text{line-height:0;position:relative!important;cursor:pointer}.footnotes_reference_container{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.footnote_container_prepare{display:block!important;padding-top:24px!important}.footnote_container_prepare>p{line-height:1.3!important;margin-top:1em!important;margin-bottom:.25em!important;padding:0!important;font-weight:400!important;display:block!important;-webkit-margin-before:.83em!important;-webkit-margin-after:.83em!important;-webkit-margin-start:0!important;-webkit-margin-end:0!important;text-align:start!important;vertical-align:middle}.footnote_container_prepare>p>span:first-child,.footnote_container_prepare>p>span:nth-child(3){text-align:start!important;font-size:1.5em!important}.footnote_reference_container_collapse_button{cursor:pointer;padding:0 .5em;font-size:1.3em!important;vertical-align:2px;text-decoration:none!important}h2>.footnote_reference_container_collapse_button,h3>.footnote_reference_container_collapse_button,h4>.footnote_reference_container_collapse_button,h5>.footnote_reference_container_collapse_button,h6>.footnote_reference_container_collapse_button{font-size:inherit!important}.footnote_container_prepare>p>span:last-child a,.footnote_reference_container_collapse_button a{text-decoration:none!important}.footnote-reference-container,.footnotes_table{width:100%;border:none}.footnote_plugin_index,.footnote_plugin_index_combi,.footnote_plugin_symbol,.footnote_plugin_text{border:none!important;text-align:start!important;vertical-align:top!important;padding:5px 6px 10px 0!important}html[dir=rtl] .footnote_plugin_index,html[dir=rtl] .footnote_plugin_index_combi,html[dir=rtl] .footnote_plugin_symbol,html[dir=rtl] .footnote_plugin_text{padding:5px 0 10px 6px!important}.footnote_backlink,.footnote_backlink:link,.footnote_plugin_link,.footnote_plugin_link:link,.main-content .footnote_backlink,.main-content .footnote_backlink:link,.main-content .footnote_plugin_link,.main-content .footnote_plugin_link:link{text-decoration:none!important;border-bottom:none!important}.footnote_backlink,.footnote_plugin_link{white-space:nowrap}.footnote_backlink,.footnote_index,.pointer{cursor:pointer}.footnote_backlink:hover,.footnote_plugin_link:hover,.footnote_plugin_text a:hover{text-decoration:unset;text-decoration:underline}.footnote_plugin_text{width:unset}.footnote_plugin_index,.footnote_plugin_index_combi{max-width:100px;width:2.5em}@media only screen and (max-width:768px){.footnote_plugin_index,.footnote_plugin_index_combi{max-width:80px}}.footnotes_reference_container{page-break-inside:avoid}@media print{.footnote_index_arrow,.footnote_reference_container_collapse_button,.footnote_tooltip{display:none}.footnote_plugin_tooltip_text{color:inherit}.footnote_plugin_index a,.footnote_plugin_index_combi a{color:inherit;text-decoration:none!important}div.post-meta-edit-link-wrapper{display:none}}.footnotes_logo,.footnotes_logo:hover{text-decoration:none;font-weight:400}.footnotes_logo_part1{color:#2bb975}.footnotes_logo_part2{color:#545f5a}.main-content,.site-main,div.hentry,main{margin:0 auto}@media (max-width:575px){.main-content,.site-main,div.hentry,main{padding:0 10px}}@media (min-width:576px){.main-content,.site-main,div.hentry,main{max-width:500px}}@media (min-width:768px){.main-content,.site-main,div.hentry,main{max-width:600px}}@media (min-width:992px){.main-content,.site-main,div.hentry,main{max-width:800px}}@media (min-width:1200px){.main-content,.site-main,div.hentry,main{max-width:960px}}
|
|
@ -4,20 +4,21 @@
|
||||||
* Plugin URI: https://wordpress.org/plugins/footnotes/
|
* Plugin URI: https://wordpress.org/plugins/footnotes/
|
||||||
* Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
|
* Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
|
||||||
* Author: Mark Cheret
|
* Author: Mark Cheret
|
||||||
* Package V.: 2.6.5
|
|
||||||
* Version: 2.6.5
|
* Version: 2.6.5
|
||||||
* CAUTION: THIS V. FIELD IS PARSED FOR UPDATE CONFIGURATION.
|
|
||||||
* Author URI: https://cheret.org/footnotes/
|
* Author URI: https://cheret.org/footnotes/
|
||||||
* Text Domain: footnotes
|
* Text Domain: footnotes
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
|
*
|
||||||
* @package footnotes
|
* @package footnotes
|
||||||
* @copyright 2021 Mark Cheret (email: mark@cheret.de)
|
* @copyright 2021 Mark Cheret (email: mark@cheret.de)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Package Version number for stylesheet cache busting.
|
* Package Version number for stylesheet cache busting.
|
||||||
*
|
*
|
||||||
* Please keep this string in sync with the PACKAGE Version ('Package V.').
|
* Please keep this string in sync with the PACKAGE Version ('Package V.').
|
||||||
* Please mirror the 'Version' (NOT 'Package V.') in js/wysiwyg-editor.js.
|
* Please mirror the 'Version' (NOT 'Package V.') in js/wysiwyg-editor.js.
|
||||||
|
*
|
||||||
* @since 2.1.4
|
* @since 2.1.4
|
||||||
* @since 2.5.3 (Hungarian)
|
* @since 2.5.3 (Hungarian)
|
||||||
* @var str
|
* @var str
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
define( 'C_STR_PACKAGE_VERSION', '2.6.5' );
|
define( 'C_STR_PACKAGE_VERSION', '2.6.5' );
|
||||||
/**
|
/**
|
||||||
* Enables toggling the stylesheet enqueuing mode from production (true) to development (false).
|
* Enables toggling the stylesheet enqueuing mode from production (true) to development (false).
|
||||||
|
*
|
||||||
* @see Full docblock below next.
|
* @see Full docblock below next.
|
||||||
*/
|
*/
|
||||||
define( 'C_BOOL_CSS_PRODUCTION_MODE', true );
|
define( 'C_BOOL_CSS_PRODUCTION_MODE', true );
|
||||||
|
@ -115,22 +117,6 @@ define( 'C_BOOL_CSS_PRODUCTION_MODE', true );
|
||||||
* @link https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/
|
* @link https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables toggling the stylesheet enqueuing mode from production (true) to development (false).
|
|
||||||
*
|
|
||||||
* @since 2.5.5
|
|
||||||
* @var bool true: production mode.
|
|
||||||
* false: development mode.
|
|
||||||
* @see class/init.php
|
|
||||||
*
|
|
||||||
* In production, a minified CSS file tailored to the settings is enqueued.
|
|
||||||
*
|
|
||||||
* Developing stylesheets is meant to be easier when this is set to false.
|
|
||||||
* WARNING: This facility designed for development must NOT be used in production.
|
|
||||||
*
|
|
||||||
* @see constant define near version constant above.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin’s main PHP file.
|
* Plugin’s main PHP file.
|
||||||
*
|
*
|
||||||
|
@ -150,3 +136,17 @@ add_filter( "plugin_action_links_{$l_str_plugin_file}", array( 'MCI_Footnotes_Ho
|
||||||
$g_obj_mci_footnotes = new MCI_Footnotes();
|
$g_obj_mci_footnotes = new MCI_Footnotes();
|
||||||
// Run the Plugin.
|
// Run the Plugin.
|
||||||
$g_obj_mci_footnotes->run();
|
$g_obj_mci_footnotes->run();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the stylesheet enqueuing mode for production.
|
||||||
|
*
|
||||||
|
* @since 2.5.5
|
||||||
|
* @var bool
|
||||||
|
* @see class/init.php
|
||||||
|
*
|
||||||
|
* In production, a minified CSS file tailored to the settings is enqueued.
|
||||||
|
*
|
||||||
|
* Developing stylesheets is meant to be easier when this is set to false.
|
||||||
|
* WARNING: This facility designed for development must NOT be used in production.
|
||||||
|
*/
|
||||||
|
define( 'C_BOOL_CSS_PRODUCTION_MODE', false );
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* Created by Stefan on 24.05.14.
|
* Created by Stefan on 24.05.14.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Edit: be careful to maintain version number near EOF 2020-12-11T1225+0100
|
* Edit: be careful to maintain version number near EOF 2020-12-11T1225+0100
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
6
readme.txt
Executable file → Normal file
6
readme.txt
Executable file → Normal file
|
@ -4,10 +4,7 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen
|
||||||
Requires at least: 3.9
|
Requires at least: 3.9
|
||||||
Tested up to: 5.7
|
Tested up to: 5.7
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Package Version: 2.6.5
|
|
||||||
Version: 2.6.5
|
|
||||||
Stable Tag: 2.6.5
|
Stable Tag: 2.6.5
|
||||||
CAUTION: THE S. T. FIELD IS PARSED FOR RELEASE CONFIGURATION.
|
|
||||||
License: GPLv3 or later
|
License: GPLv3 or later
|
||||||
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
@ -146,9 +143,6 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
|
||||||
- Update: Scroll delays: add a setting to configure also a scroll up delay for completeness.
|
- Update: Scroll delays: add a setting to configure also a scroll up delay for completeness.
|
||||||
- Bugfix: Tooltips: Styling: protect padding against removal in surroundings with explicit zero padding.
|
- Bugfix: Tooltips: Styling: protect padding against removal in surroundings with explicit zero padding.
|
||||||
- Bugfix: Tooltips: Display: CSS transitions: fix syntax error.
|
- Bugfix: Tooltips: Display: CSS transitions: fix syntax error.
|
||||||
- Update: Documentation: help and support for contributors by the means of Contributing Guidelines in 'CONTRIBUTING.md', thanks to @rumperuu code contribution.
|
|
||||||
- Update: Documentation: additional readme in markdown format 'README.md' for use with the code repository on GitHub, thanks to @rumperuu code contribution.
|
|
||||||
- Update: Documentation: move 'customized-template-stack.txt' and 'customized-documentation-schema.txt' from the 'development/' folder to root.
|
|
||||||
|
|
||||||
= 2.5.10 =
|
= 2.5.10 =
|
||||||
- Bugfix: Codebase: revert to 2.5.8 with apologies (below), thanks to @little-shiva @watershare @adjayabdg @staho @frav8 @voregnev @dsl225 @alexclassroom @a223123131 @codldmac bug reports.
|
- Bugfix: Codebase: revert to 2.5.8 with apologies (below), thanks to @little-shiva @watershare @adjayabdg @staho @frav8 @voregnev @dsl225 @alexclassroom @a223123131 @codldmac bug reports.
|
||||||
|
|
Reference in a new issue