Update codebase to be WP Coding Standard-compliant.
This is a squashed copy of `wp-coding-standard--rebase` to try and fix the line-ending diff issue we're having.
This commit is contained in:
parent
9ee72568ef
commit
9a8e7c0851
20 changed files with 1880 additions and 1810 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
||||||
.phpdoc/
|
.phpdoc/
|
||||||
|
vendor/
|
||||||
|
|
||||||
|
*.bak
|
||||||
|
|
|
@ -14,6 +14,7 @@ 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
|
||||||
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>`)
|
1. Create a new branch from `main` (`git checkout -b <your-descriptive-branch-name>`)
|
||||||
|
@ -25,8 +26,8 @@ Featured on [wpmudev](http://premium.wpmudev.org/blog/12-surprisingly-useful-wor
|
||||||
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 PHP_CodeSniffer on the file(s) you want to check (`./vendor/bin/phpcs --standard="WordPress" --colors --encoding=utf-8 -n -p <file(s)>`)
|
||||||
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. (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)>`)
|
||||||
- Add the `-n` flag to ignore warnings (i.e., show only errors)
|
- 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)
|
- 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)
|
||||||
- You can run either across the entire project by adding the argument `--ignore=*/vendor/*` and targetting the file `./*.php ./**/*.php`
|
- You can run either across the entire project by adding the argument `--ignore=*/vendor/*` and targetting the file `./**/*.php`
|
||||||
|
|
||||||
## Updating Documentation
|
## Updating Documentation
|
||||||
|
|
||||||
|
|
4
_tools/setup.sh
Normal file
4
_tools/setup.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cp contrib/pre-commit .git/hooks/pre-commit
|
||||||
|
chmod +x .git/hooks/pre-commit
|
|
@ -1,51 +1,46 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Includes the Plugin Constants class to load all Plugin constant vars like Plugin name, etc.
|
* Includes the Plugin Constants class to load all Plugin constant vars like Plugin name, etc.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 12.09.14 10:56
|
* @since 1.5.0 12.09.14 10:56
|
||||||
*
|
*
|
||||||
* Edited for:
|
* Edited for:
|
||||||
* 2.0.4 add Public Plugin name for dashboard heading 2020-11-01T0452+0100
|
* 2.0.4 add Public Plugin name for dashboard heading 2020-11-01T0452+0100
|
||||||
*
|
*
|
||||||
* Last modified: 2021-02-18T2027+0100
|
* Last modified: 2021-02-18T2027+0100
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all Plugin Constants. Contains no Method or Property.
|
* Contains all Plugin Constants. Contains no Method or Property.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_Config {
|
class MCI_Footnotes_Config {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal Plugin name.
|
* Internal Plugin name.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const C_STR_PLUGIN_NAME = "footnotes";
|
const C_STR_PLUGIN_NAME = 'footnotes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Plugin name.
|
* Public Plugin name.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
* edited classes for v2.0.4
|
* edited classes for v2.0.4
|
||||||
*/
|
*/
|
||||||
const C_STR_PLUGIN_PUBLIC_NAME = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
|
const C_STR_PLUGIN_PUBLIC_NAME = '<span class="footnotes_logo footnotes_logo_part1">foot</span><span class="footnotes_logo footnotes_logo_part2">notes</span>';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Plugin name for dashboard heading
|
* Public Plugin name for dashboard heading
|
||||||
*
|
*
|
||||||
* After properly displaying in dashboard headings until WPv5.4, the above started
|
* After properly displaying in dashboard headings until WPv5.4, the above started
|
||||||
* in WPv5.5 being torn apart as if the headline was text-align:justify and not
|
* in WPv5.5 being torn apart as if the headline was text-align:justify and not
|
||||||
* the last line. That ugly display bug badly affected the plugin’s communication.
|
* the last line. That ugly display bug badly affected the plugin’s communication.
|
||||||
* The only working solution found so far is using position:fixed in one heading
|
* The only working solution found so far is using position:fixed in one heading
|
||||||
* that isn’t translated, and dropping the logo in another, translatable heading.
|
* that isn’t translated, and dropping the logo in another, translatable heading.
|
||||||
|
@ -58,7 +53,6 @@ class MCI_Footnotes_Config {
|
||||||
/**
|
/**
|
||||||
* Html tag for the LOVE symbol.
|
* Html tag for the LOVE symbol.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -75,7 +69,6 @@ class MCI_Footnotes_Config {
|
||||||
/**
|
/**
|
||||||
* Short code to DON'T display the 'LOVE ME' slug on certain pages.
|
* Short code to DON'T display the 'LOVE ME' slug on certain pages.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,20 +3,18 @@
|
||||||
* Includes the Convert Class.
|
* Includes the Convert Class.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 12.09.14 10:56
|
* @since 1.5.0 12.09.14 10:56
|
||||||
*
|
*
|
||||||
* Edited:
|
* Edited:
|
||||||
* @since 2.2.0 add lowercase Roman 2020-12-12T1540+0100
|
* @since 2.2.0 add lowercase Roman 2020-12-12T1540+0100
|
||||||
*
|
*
|
||||||
* Last modified: 2020-12-12T1541+0100
|
* Last modified: 2020-12-12T1541+0100
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts data types and Footnotes specific values.
|
* Converts data types and Footnotes specific values.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_Convert {
|
class MCI_Footnotes_Convert {
|
||||||
|
@ -24,30 +22,29 @@ class MCI_Footnotes_Convert {
|
||||||
/**
|
/**
|
||||||
* Converts a integer into the user-defined counter style for the footnotes.
|
* Converts a integer into the user-defined counter style for the footnotes.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param int $p_int_Index Index to be converted.
|
* @param int $p_int_index Index to be converted.
|
||||||
* @param string $p_str_ConvertStyle Style of the new/converted Index.
|
* @param string $p_str_convert_style Style of the new/converted Index.
|
||||||
* @return string Converted Index as string in the defined counter style.
|
* @return string Converted Index as string in the defined counter style.
|
||||||
*
|
*
|
||||||
* Edited:
|
* Edited:
|
||||||
* @since 2.2.0 lowercase Roman numerals supported
|
* @since 2.2.0 lowercase Roman numerals supported
|
||||||
*/
|
*/
|
||||||
public static function Index($p_int_Index, $p_str_ConvertStyle = "arabic_plain") {
|
public static function index( $p_int_index, $p_str_convert_style = 'arabic_plain' ) {
|
||||||
switch ($p_str_ConvertStyle) {
|
switch ( $p_str_convert_style ) {
|
||||||
case "romanic":
|
case 'romanic':
|
||||||
return self::toRomanic($p_int_Index, true);
|
return self::to_romanic( $p_int_index, true );
|
||||||
case "roman_low":
|
case 'roman_low':
|
||||||
return self::toRomanic($p_int_Index, false);
|
return self::to_romanic( $p_int_index, false );
|
||||||
case "latin_high":
|
case 'latin_high':
|
||||||
return self::toLatin($p_int_Index, true);
|
return self::to_latin( $p_int_index, true );
|
||||||
case "latin_low":
|
case 'latin_low':
|
||||||
return self::toLatin($p_int_Index, false);
|
return self::to_latin( $p_int_index, false );
|
||||||
case "arabic_leading":
|
case 'arabic_leading':
|
||||||
return self::toArabicLeading($p_int_Index);
|
return self::to_arabic_leading( $p_int_index );
|
||||||
case "arabic_plain":
|
case 'arabic_plain':
|
||||||
default:
|
default:
|
||||||
return $p_int_Index;
|
return $p_int_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,175 +52,174 @@ class MCI_Footnotes_Convert {
|
||||||
* Converts an integer into latin ascii characters, either lower or upper-case.
|
* Converts an integer into latin ascii characters, either lower or upper-case.
|
||||||
* Function available from A to ZZ ( means 676 footnotes at 1 page possible).
|
* Function available from A to ZZ ( means 676 footnotes at 1 page possible).
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.0-gamma
|
* @since 1.0-gamma
|
||||||
* @param int $p_int_Value Value/Index to be converted.
|
* @param int $p_int_value Value/Index to be converted.
|
||||||
* @param bool $p_bool_UpperCase True to convert the value to upper case letter, otherwise to lower case.
|
* @param bool $p_bool_upper_case True to convert the value to upper case letter, otherwise to lower case.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function toLatin($p_int_Value, $p_bool_UpperCase) {
|
private static function to_latin( $p_int_value, $p_bool_upper_case ) {
|
||||||
// output string
|
// Output string.
|
||||||
$l_str_Return = "";
|
$l_str_return = '';
|
||||||
$l_int_Offset = 0;
|
$l_int_offset = 0;
|
||||||
// check if the value is higher then 26 = Z
|
// Check if the value is higher then 26 = Z.
|
||||||
while ($p_int_Value > 26) {
|
while ( $p_int_value > 26 ) {
|
||||||
// increase offset and reduce counter
|
// Increase offset and reduce counter.
|
||||||
$l_int_Offset++;
|
$l_int_offset++;
|
||||||
$p_int_Value -= 26;
|
$p_int_value -= 26;
|
||||||
}
|
}
|
||||||
// if offset set (more then Z), then add a new letter in front
|
// If offset set (more then Z), then add a new letter in front.
|
||||||
if ($l_int_Offset > 0) {
|
if ( $l_int_offset > 0 ) {
|
||||||
$l_str_Return = chr($l_int_Offset + 64);
|
$l_str_return = chr( $l_int_offset + 64 );
|
||||||
}
|
}
|
||||||
// add the origin letter
|
// Add the origin letter.
|
||||||
$l_str_Return .= chr($p_int_Value + 64);
|
$l_str_return .= chr( $p_int_value + 64 );
|
||||||
// return the latin character representing the integer
|
// Return the latin character representing the integer.
|
||||||
if ($p_bool_UpperCase) {
|
if ( $p_bool_upper_case ) {
|
||||||
return strtoupper($l_str_Return);
|
return strtoupper( $l_str_return );
|
||||||
}
|
}
|
||||||
return strtolower($l_str_Return);
|
return strtolower( $l_str_return );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an integer to a leading-0 integer.
|
* Converts an integer to a leading-0 integer.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.0-gamma
|
* @since 1.0-gamma
|
||||||
* @param int $p_int_Value Value/Index to be converted.
|
* @param int $p_int_value Value/Index to be converted.
|
||||||
* @return string Value with a leading zero.
|
* @return string Value with a leading zero.
|
||||||
*/
|
*/
|
||||||
private static function toArabicLeading($p_int_Value) {
|
private static function to_arabic_leading( $p_int_value ) {
|
||||||
// add a leading 0 if number lower then 10
|
// Add a leading 0 if number lower then 10.
|
||||||
if ($p_int_Value < 10) {
|
if ( $p_int_value < 10 ) {
|
||||||
return "0" . $p_int_Value;
|
return '0' . $p_int_value;
|
||||||
}
|
}
|
||||||
return $p_int_Value;
|
return $p_int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an integer to a romanic letter.
|
* Converts an integer to a romanic letter.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.0-gamma
|
* @since 1.0-gamma
|
||||||
* @param int $p_int_Value Value/Index to be converted.
|
* @param int $p_int_value Value/Index to be converted.
|
||||||
|
* @param bool $p_bool_upper_case Whether to uppercase.
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* Edited:
|
* Edited:
|
||||||
* @since 2.2.0 optionally lowercase (code from Latin) 2020-12-12T1538+0100
|
* @since 2.2.0 optionally lowercase (code from Latin) 2020-12-12T1538+0100
|
||||||
*/
|
*/
|
||||||
private static function toRomanic($p_int_Value, $p_bool_UpperCase) {
|
private static function to_romanic( $p_int_value, $p_bool_upper_case ) {
|
||||||
// table containing all necessary romanic letters
|
// Table containing all necessary romanic letters.
|
||||||
$l_arr_RomanicLetters = array(
|
$l_arr_romanic_letters = array(
|
||||||
'M' => 1000,
|
'M' => 1000,
|
||||||
'CM' => 900,
|
'CM' => 900,
|
||||||
'D' => 500,
|
'D' => 500,
|
||||||
'CD' => 400,
|
'CD' => 400,
|
||||||
'C' => 100,
|
'C' => 100,
|
||||||
'XC' => 90,
|
'XC' => 90,
|
||||||
'L' => 50,
|
'L' => 50,
|
||||||
'XL' => 40,
|
'XL' => 40,
|
||||||
'X' => 10,
|
'X' => 10,
|
||||||
'IX' => 9,
|
'IX' => 9,
|
||||||
'V' => 5,
|
'V' => 5,
|
||||||
'IV' => 4,
|
'IV' => 4,
|
||||||
'I' => 1
|
'I' => 1,
|
||||||
);
|
);
|
||||||
// return value
|
// Return value.
|
||||||
$l_str_Return = '';
|
$l_str_return = '';
|
||||||
// iterate through integer value until it is reduced to 0
|
// Iterate through integer value until it is reduced to 0.
|
||||||
while ($p_int_Value > 0) {
|
while ( $p_int_value > 0 ) {
|
||||||
foreach ($l_arr_RomanicLetters as $l_str_Romanic => $l_int_Arabic) {
|
foreach ( $l_arr_romanic_letters as $l_str_romanic => $l_int_arabic ) {
|
||||||
if ($p_int_Value >= $l_int_Arabic) {
|
if ( $p_int_value >= $l_int_arabic ) {
|
||||||
$p_int_Value -= $l_int_Arabic;
|
$p_int_value -= $l_int_arabic;
|
||||||
$l_str_Return .= $l_str_Romanic;
|
$l_str_return .= $l_str_romanic;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return romanic letters as string
|
// Return romanic letters as string.
|
||||||
if ($p_bool_UpperCase) {
|
if ( $p_bool_upper_case ) {
|
||||||
return strtoupper($l_str_Return);
|
return strtoupper( $l_str_return );
|
||||||
}
|
}
|
||||||
return strtolower($l_str_Return);
|
return strtolower( $l_str_return );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string depending on its value to a boolean.
|
* Converts a string depending on its value to a boolean.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.0-beta
|
* @since 1.0-beta
|
||||||
* @param string $p_str_Value String to be converted to boolean.
|
* @param string $p_str_value String to be converted to boolean.
|
||||||
* @return bool Boolean representing the string.
|
* @return bool Boolean representing the string.
|
||||||
*/
|
*/
|
||||||
public static function toBool($p_str_Value) {
|
public static function to_bool( $p_str_value ) {
|
||||||
// convert string to lower-case to make it easier
|
// Convert string to lower-case to make it easier.
|
||||||
$p_str_Value = strtolower($p_str_Value);
|
$p_str_value = strtolower( $p_str_value );
|
||||||
// check if string seems to contain a "true" value
|
// Check if string seems to contain a "true" value.
|
||||||
switch ($p_str_Value) {
|
switch ( $p_str_value ) {
|
||||||
case "checked":
|
case 'checked':
|
||||||
case "yes":
|
case 'yes':
|
||||||
case "true":
|
case 'true':
|
||||||
case "on":
|
case 'on':
|
||||||
case "1":
|
case '1':
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// nothing found that says "true", so we return false
|
// Nothing found that says "true", so we return false.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a html Array short code depending on Arrow-Array key index.
|
* Get a html Array short code depending on Arrow-Array key index.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.3.2
|
* @since 1.3.2
|
||||||
* @param int $p_int_Index Index representing the Arrow. If empty all Arrows are specified.
|
* @param int $p_int_index Index representing the Arrow. If empty all Arrows are specified.
|
||||||
* @return array|string Array of all Arrows if Index is empty otherwise html tag of a specific arrow.
|
* @return array|string Array of all Arrows if Index is empty otherwise html tag of a specific arrow.
|
||||||
*/
|
*/
|
||||||
public static function getArrow($p_int_Index = -1) {
|
public static function get_arrow( $p_int_index = -1 ) {
|
||||||
// define all possible arrows
|
// Define all possible arrows.
|
||||||
$l_arr_Arrows = array("↑", "↥", "↟", "↩", "↲", "↵", "⇑", "⇡", "⇧", "↑");
|
$l_arr_arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' );
|
||||||
// convert index to an integer
|
// Convert index to an integer.
|
||||||
if (!is_int($p_int_Index)) {
|
if ( ! is_int( $p_int_index ) ) {
|
||||||
$p_int_Index = intval($p_int_Index);
|
$p_int_index = intval( $p_int_index );
|
||||||
}
|
}
|
||||||
// return the whole arrow array
|
// Return the whole arrow array.
|
||||||
if ($p_int_Index < 0 || $p_int_Index > count($l_arr_Arrows)) {
|
if ( $p_int_index < 0 || $p_int_index > count( $l_arr_arrows ) ) {
|
||||||
return $l_arr_Arrows;
|
return $l_arr_arrows;
|
||||||
}
|
}
|
||||||
// return a single arrow
|
// Return a single arrow.
|
||||||
return $l_arr_Arrows[$p_int_Index];
|
return $l_arr_arrows[ $p_int_index ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_dump
|
||||||
|
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_print_r
|
||||||
/**
|
/**
|
||||||
* Displays a Variable.
|
* Displays a Variable.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param mixed $p_mixed_Value
|
* @param mixed $p_mixed_value The variable to display.
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function debug($p_mixed_Value) {
|
public static function debug( $p_mixed_value ) {
|
||||||
if (empty($p_mixed_Value)) {
|
if ( empty( $p_mixed_value ) ) {
|
||||||
var_dump($p_mixed_Value);
|
var_dump( $p_mixed_value );
|
||||||
|
|
||||||
} else if (is_array($p_mixed_Value)) {
|
} elseif ( is_array( $p_mixed_value ) ) {
|
||||||
printf("<pre>");
|
printf( '<pre>' );
|
||||||
print_r($p_mixed_Value);
|
print_r( $p_mixed_value );
|
||||||
printf("</pre>");
|
printf( '</pre>' );
|
||||||
|
|
||||||
} else if (is_object($p_mixed_Value)) {
|
} elseif ( is_object( $p_mixed_value ) ) {
|
||||||
printf("<pre>");
|
printf( '<pre>' );
|
||||||
print_r($p_mixed_Value);
|
print_r( $p_mixed_value );
|
||||||
printf("</pre>");
|
printf( '</pre>' );
|
||||||
|
|
||||||
} else if (is_numeric($p_mixed_Value) || is_int($p_mixed_Value)) {
|
} elseif ( is_numeric( $p_mixed_value ) || is_int( $p_mixed_value ) ) {
|
||||||
var_dump($p_mixed_Value);
|
var_dump( $p_mixed_value );
|
||||||
|
|
||||||
} else if (is_date($p_mixed_Value)) {
|
} elseif ( is_date( $p_mixed_value ) ) {
|
||||||
var_dump($p_mixed_Value);
|
var_dump( $p_mixed_value );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var_dump($p_mixed_Value);
|
var_dump( $p_mixed_value );
|
||||||
}
|
}
|
||||||
echo "<br/>";
|
echo '<br/>';
|
||||||
}
|
}
|
||||||
|
// phpcs:disable
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Handles all WordPress hooks of this Plugin.
|
* Handles all WordPress hooks of this Plugin.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 12.09.14 10:56
|
* @since 1.5.0 12.09.14 10:56
|
||||||
*
|
*
|
||||||
* Edited:
|
* Edited:
|
||||||
* @since 2.2.0 2020-12-12T1223+0100
|
* @since 2.2.0 2020-12-12T1223+0100
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,6 @@
|
||||||
/**
|
/**
|
||||||
* Registers all WordPress Hooks and executes them on demand.
|
* Registers all WordPress Hooks and executes them on demand.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_Hooks {
|
class MCI_Footnotes_Hooks {
|
||||||
|
@ -21,74 +20,67 @@ class MCI_Footnotes_Hooks {
|
||||||
/**
|
/**
|
||||||
* Registers all WordPress hooks.
|
* Registers all WordPress hooks.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public static function registerHooks() {
|
public static function register_hooks() {
|
||||||
register_activation_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "activatePlugin"));
|
register_activation_hook( dirname( __FILE__ ) . '/../footnotes.php', array( 'MCI_Footnotes_Hooks', 'activate_plugin' ) );
|
||||||
register_deactivation_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "deactivatePlugin"));
|
register_deactivation_hook( dirname( __FILE__ ) . '/../footnotes.php', array( 'MCI_Footnotes_Hooks', 'deactivate_plugin' ) );
|
||||||
register_uninstall_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "uninstallPlugin"));
|
register_uninstall_hook( dirname( __FILE__ ) . '/../footnotes.php', array( 'MCI_Footnotes_Hooks', 'uninstall_plugin' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executed when the Plugin gets activated.
|
* Executed when the Plugin gets activated.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public static function activatePlugin() {
|
public static function activate_plugin() {
|
||||||
// currently unused
|
// Currently unused.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executed when the Plugin gets deactivated.
|
* Executed when the Plugin gets deactivated.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public static function deactivatePlugin() {
|
public static function deactivate_plugin() {
|
||||||
// currently unused
|
// Currently unused.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executed when the Plugin gets uninstalled.
|
* Executed when the Plugin gets uninstalled.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
* Edit: ClearAll didn’t actually work.
|
* Edit: Clear_all didn’t actually work.
|
||||||
* @since 2.2.0 this function is not called any longer when deleting the plugin
|
* @since 2.2.0 this function is not called any longer when deleting the plugin
|
||||||
*/
|
*/
|
||||||
public static function uninstallPlugin() {
|
public static function uninstall_plugin() {
|
||||||
// WordPress User has to be logged in
|
// WordPress User has to be logged in.
|
||||||
if (!is_user_logged_in()) {
|
if ( ! is_user_logged_in() ) {
|
||||||
wp_die(__('You must be logged in to run this script.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
wp_die( wp_kses_post( __( 'You must be logged in to run this script.', 'footnotes' ) ) );
|
||||||
}
|
}
|
||||||
// WordPress User needs the permission to (un)install plugins
|
// WordPress User needs the permission to (un)install plugins.
|
||||||
if (!current_user_can('install_plugins')) {
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
wp_die(__('You do not have permission to run this script.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
wp_die( wp_kses_post( __( 'You do not have permission to run this script.', 'footnotes' ) ) );
|
||||||
}
|
}
|
||||||
// deletes all settings and restore the default values
|
|
||||||
// MCI_Footnotes_Settings::instance()->ClearAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Links to the Plugin in the "installed Plugins" page.
|
* Add Links to the Plugin in the "installed Plugins" page.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param array $p_arr_Links Current Links.
|
* @param array $p_arr_links Current Links.
|
||||||
* @param string $p_str_PluginFileName Plugins init file name.
|
* @param string $p_str_plugin_file_name Plugins init file name.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function PluginLinks($p_arr_Links, $p_str_PluginFileName) {
|
public static function plugin_links( $p_arr_links, $p_str_plugin_file_name ) {
|
||||||
// append link to the WordPress Plugin page
|
// Append link to the WordPress Plugin page.
|
||||||
$p_arr_Links[] = sprintf('<a href="http://wordpress.org/support/plugin/footnotes" target="_blank">%s</a>', __('Support', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
$p_arr_links[] = sprintf( '<a href="http://wordpress.org/support/plugin/footnotes" target="_blank">%s</a>', __( 'Support', 'footnotes' ) );
|
||||||
// append link to the Settings page
|
// Append link to the settings page.
|
||||||
$p_arr_Links[] = sprintf('<a href="%s">%s</a>', admin_url('admin.php?page=mfmmf-footnotes'), __('Settings', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
$p_arr_links[] = sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=mfmmf-footnotes' ), __( 'Settings', 'footnotes' ) );
|
||||||
// append link to the PlayPal Donate function
|
// Append link to the PayPal donate function.
|
||||||
$p_arr_Links[] = sprintf('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ" target="_blank">%s</a>', __('Donate', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
|
$p_arr_links[] = sprintf( '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ" target="_blank">%s</a>', __( 'Donate', 'footnotes' ) );
|
||||||
// return new links
|
// Return new links.
|
||||||
return $p_arr_Links;
|
return $p_arr_links;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
220
class/init.php
220
class/init.php
|
@ -1,12 +1,11 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Includes the main Class of the Plugin.
|
* Includes the main Class of the Plugin.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 12.09.14 10:56
|
* @since 1.5.0 12.09.14 10:56
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @lastmodified 2021-02-19T2031+0100
|
* @lastmodified 2021-02-19T2031+0100
|
||||||
*
|
*
|
||||||
* @since 1.6.5 Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution.
|
* @since 1.6.5 Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution.
|
||||||
|
@ -27,7 +26,6 @@
|
||||||
/**
|
/**
|
||||||
* Entry point of the Plugin. Loads the Dashboard and executes the Task.
|
* Entry point of the Plugin. Loads the Dashboard and executes the Task.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes {
|
class MCI_Footnotes {
|
||||||
|
@ -35,39 +33,38 @@ class MCI_Footnotes {
|
||||||
/**
|
/**
|
||||||
* Reference to the Plugin Task object.
|
* Reference to the Plugin Task object.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var null|MCI_Footnotes_Task
|
* @var null|MCI_Footnotes_Task
|
||||||
*/
|
*/
|
||||||
public $a_obj_Task = null;
|
public $a_obj_task = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template process and script / stylesheet load optimization.
|
* Idenfifies whether tooltips are enabled. Actual value depends on settings.
|
||||||
*
|
|
||||||
* - Bugfix: Templates: optimize template load and processing based on settings, thanks to @misfist code contribution.
|
|
||||||
*
|
|
||||||
* @since 2.4.0
|
|
||||||
* @date 2021-01-04T1355+0100
|
|
||||||
*
|
|
||||||
* @author Patrizia Lutz @misfist
|
|
||||||
*
|
|
||||||
* @link https://wordpress.org/support/topic/template-override-filter/#post-13864301
|
|
||||||
* @link https://github.com/misfist/footnotes/releases/tag/2.4.0d3 repository
|
|
||||||
* @link https://github.com/misfist/footnotes/compare/2.4.0%E2%80%A62.4.0d3 diff
|
|
||||||
*
|
*
|
||||||
|
* @contributor Patrizia Lutz @misfist
|
||||||
* @var bool
|
* @var bool
|
||||||
*
|
*
|
||||||
* Streamline process depending on tooltip enabled status.
|
* @todo Refactor to have defines and assignments only in this class,
|
||||||
* Load tooltip inline script only if jQuery tooltips are enabled.
|
* then re-use these properties also in class/task.php (and elsewhere).
|
||||||
* Actual value depends on settings.
|
* Account for priority level issues. These properties must be assigned before
|
||||||
|
* the hooks—whose priority level may be configured to 0—are called in class/task.php.
|
||||||
*/
|
*/
|
||||||
public static $a_bool_TooltipsEnabled = false;
|
public static $a_bool_tooltips_enabled = false;
|
||||||
public static $a_bool_AlternativeTooltipsEnabled = false;
|
|
||||||
|
/**
|
||||||
|
* Idenfifies whether alternative tooltips are enabled. Actual value depends
|
||||||
|
* on settings.
|
||||||
|
*
|
||||||
|
* @contributor Patrizia Lutz @misfist
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @todo Refactor to have defines only here, and use assignments also in class/task.php.
|
||||||
|
*/
|
||||||
|
public static $a_bool_alternative_tooltips_enabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the Plugin.
|
* Executes the Plugin.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -78,33 +75,32 @@ class MCI_Footnotes {
|
||||||
* @contributor @felipelavinz
|
* @contributor @felipelavinz
|
||||||
* @link https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
|
* @link https://github.com/media-competence-institute/footnotes/commit/87173d2980c7ff90e12ffee94ca7153e11163793
|
||||||
*
|
*
|
||||||
* @see self::initializeWidgets()
|
* @see self::initialize_widgets()
|
||||||
*/
|
*/
|
||||||
public function run() {
|
public function run() {
|
||||||
// register language
|
// Register language.
|
||||||
MCI_Footnotes_Language::registerHooks();
|
MCI_Footnotes_Language::register_hooks();
|
||||||
// register Button hooks
|
// Register Button hooks.
|
||||||
MCI_Footnotes_WYSIWYG::registerHooks();
|
MCI_Footnotes_WYSIWYG::register_hooks();
|
||||||
// register general hooks
|
// Register general hooks.
|
||||||
MCI_Footnotes_Hooks::registerHooks();
|
MCI_Footnotes_Hooks::register_hooks();
|
||||||
|
|
||||||
// initialize the Plugin Dashboard
|
// Initialize the Plugin Dashboard.
|
||||||
$this->initializeDashboard();
|
$this->initialize_dashboard();
|
||||||
// initialize the Plugin Task
|
// Initialize the Plugin Task.
|
||||||
$this->initializeTask();
|
$this->initialize_task();
|
||||||
|
|
||||||
// Register all Public Stylesheets and Scripts
|
// Register all Public Stylesheets and Scripts.
|
||||||
add_action('init', array($this, 'registerPublic'));
|
add_action( 'init', array( $this, 'register_public' ) );
|
||||||
// Enqueue all Public Stylesheets and Scripts
|
// Enqueue all Public Stylesheets and Scripts.
|
||||||
add_action('wp_enqueue_scripts', array($this, 'registerPublic'));
|
add_action( 'wp_enqueue_scripts', array( $this, 'register_public' ) );
|
||||||
// Register all Widgets of the Plugin.
|
// Register all Widgets of the Plugin..
|
||||||
add_action('widgets_init', array($this, 'initializeWidgets'));
|
add_action( 'widgets_init', array( $this, 'initialize_widgets' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes all Widgets of the Plugin.
|
* Initializes all Widgets of the Plugin.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -129,37 +125,34 @@ class MCI_Footnotes {
|
||||||
* and use the bare register_widget() here.
|
* and use the bare register_widget() here.
|
||||||
* @see self::run()
|
* @see self::run()
|
||||||
*
|
*
|
||||||
* Also, the visibility of initializeWidgets() is not private any longer.
|
* Also, the visibility of initialize_widgets() is not private any longer.
|
||||||
*/
|
*/
|
||||||
public function initializeWidgets() {
|
public function initialize_widgets() {
|
||||||
register_widget( "MCI_Footnotes_Widget_ReferenceContainer" );
|
register_widget( 'MCI_Footnotes_Widget_Reference_container' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Dashboard of the Plugin and loads them.
|
* Initializes the Dashboard of the Plugin and loads them.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
private function initializeDashboard() {
|
private function initialize_dashboard() {
|
||||||
new MCI_Footnotes_Layout_Init();
|
new MCI_Footnotes_Layout_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Plugin Task and registers the Task hooks.
|
* Initializes the Plugin Task and registers the Task hooks.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
private function initializeTask() {
|
private function initialize_task() {
|
||||||
$this->a_obj_Task = new MCI_Footnotes_Task();
|
$this->a_obj_task = new MCI_Footnotes_Task();
|
||||||
$this->a_obj_Task->registerHooks();
|
$this->a_obj_task->register_hooks();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers and enqueues scripts and stylesheets to the public pages.
|
* Registers and enqueues scripts and stylesheets to the public pages.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
|
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
|
||||||
|
@ -168,7 +161,7 @@ class MCI_Footnotes {
|
||||||
* @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
|
* @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
|
||||||
* @since 2.1.4 optionally enqueue an extra stylesheet 2020-12-04T2231+0100
|
* @since 2.1.4 optionally enqueue an extra stylesheet 2020-12-04T2231+0100
|
||||||
*/
|
*/
|
||||||
public function registerPublic() {
|
public function register_public() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues external scripts.
|
* Enqueues external scripts.
|
||||||
|
@ -181,10 +174,10 @@ class MCI_Footnotes {
|
||||||
*
|
*
|
||||||
* The condition about tooltips was missing, only the not-alternative-tooltips part was present.
|
* The condition about tooltips was missing, only the not-alternative-tooltips part was present.
|
||||||
*/
|
*/
|
||||||
// set conditions re-used for stylesheet enqueuing:
|
// Set conditions re-used for stylesheet enqueuing.
|
||||||
self::$a_bool_TooltipsEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
|
self::$a_bool_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
|
||||||
self::$a_bool_AlternativeTooltipsEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
|
self::$a_bool_alternative_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
|
||||||
$l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE);
|
$l_str_script_mode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues the jQuery library registered by WordPress.
|
* Enqueues the jQuery library registered by WordPress.
|
||||||
|
@ -195,64 +188,42 @@ class MCI_Footnotes {
|
||||||
*
|
*
|
||||||
* @reporter @hopper87it
|
* @reporter @hopper87it
|
||||||
* @link https://wordpress.org/support/topic/footnotes-wp-rocket/
|
* @link https://wordpress.org/support/topic/footnotes-wp-rocket/
|
||||||
*
|
*
|
||||||
* jQuery is also used for animated scrolling, so it was loaded by default.
|
* jQuery is also used for animated scrolling, so it was loaded by default.
|
||||||
* The function wp_enqueue_script() avoids loading the same library multiple times.
|
* The function wp_enqueue_script() avoids loading the same library multiple times.
|
||||||
* After adding the alternative reference container, jQuery has become optional,
|
* After adding the alternative reference container, jQuery has become optional,
|
||||||
* but still enabled by default.
|
* but still enabled by default.
|
||||||
*/
|
*/
|
||||||
if ( $l_str_ScriptMode == 'jquery' || ( self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled ) ) {
|
if ( 'jquery' === $l_str_script_mode || ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) ) {
|
||||||
|
|
||||||
wp_enqueue_script( 'jquery' );
|
wp_enqueue_script( 'jquery' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled ) {
|
if ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues the jQuery Tools library shipped with the plugin.
|
* Enqueues the jQuery Tools library shipped with the plugin.
|
||||||
*
|
*
|
||||||
* redacted jQuery.browser, completed minification;
|
* Redacted jQuery.browser, completed minification;
|
||||||
* see full header in js/jquery.tools.js
|
* see full header in js/jquery.tools.js.
|
||||||
* added versioning 2020-11-18T2150+0100
|
*
|
||||||
* not use '-js' in the handle, is appended automatically
|
* Add versioning.
|
||||||
|
* @since 2.1.2
|
||||||
|
* @date 2020-11-18T2150+0100
|
||||||
|
*
|
||||||
|
* No '-js' in the handle, is appended automatically.
|
||||||
|
*
|
||||||
|
* Deferring to the footer breaks jQuery tooltip display.
|
||||||
|
* @date 2021-02-23T1105+0100
|
||||||
*/
|
*/
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'mci-footnotes-jquery-tools',
|
'mci-footnotes-jquery-tools',
|
||||||
plugins_url('footnotes/js/jquery.tools.min.js'),
|
plugins_url( 'footnotes/js/jquery.tools.min.js' ),
|
||||||
array(),
|
array(),
|
||||||
'1.2.7.redacted.2'
|
'1.2.7.redacted.2',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers jQuery UI from the JavaScript Content Delivery Network.
|
|
||||||
*
|
|
||||||
* - Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
|
|
||||||
*
|
|
||||||
* @since 2.0.0
|
|
||||||
* Alternatively, fetch jQuery UI from cdnjs.cloudflare.com:
|
|
||||||
* @since 2.0.0 add jQueryUI from Cloudflare 2020-10-26T1907+0100
|
|
||||||
* Used to add jQuery UI following @vonpiernik:
|
|
||||||
* <https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762>:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released.
|
|
||||||
*
|
|
||||||
* Updated for v2.0.4 by adding jQuery UI from WordPress following @check2020de:
|
|
||||||
* <https://wordpress.org/support/topic/gdpr-issue-with-jquery/>
|
|
||||||
* See <https://wordpress.stackexchange.com/questions/273986/correct-way-to-enqueue-jquery-ui>
|
|
||||||
*
|
|
||||||
* This was enabled in Footnotes v2.0.0 through v2.0.3.
|
|
||||||
* Re-added for 2.0.9d1 / 2.1.1d0 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100/2020-11-08T2246+0100
|
|
||||||
*/
|
|
||||||
//wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, false ); // in header 2020-11-09T2003+0100
|
|
||||||
//wp_enqueue_script( 'jQueryUI' );
|
|
||||||
/**
|
|
||||||
* This is then needed instead of the above first instance:
|
|
||||||
* Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100/2020-11-08T2246+0100
|
|
||||||
*/
|
|
||||||
//wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues some jQuery UI libraries registered by WordPress.
|
* Enqueues some jQuery UI libraries registered by WordPress.
|
||||||
*
|
*
|
||||||
|
@ -308,34 +279,43 @@ class MCI_Footnotes {
|
||||||
* The media scope argument 'all' is the default.
|
* The media scope argument 'all' is the default.
|
||||||
* No need to use '-css' in the handle, as this is appended automatically.
|
* No need to use '-css' in the handle, as this is appended automatically.
|
||||||
*/
|
*/
|
||||||
// set tooltip mode for use in stylesheet name:
|
// Set tooltip mode for use in stylesheet name.
|
||||||
if ( self::$a_bool_TooltipsEnabled ) {
|
if ( self::$a_bool_tooltips_enabled ) {
|
||||||
if ( self::$a_bool_AlternativeTooltipsEnabled ) {
|
if ( self::$a_bool_alternative_tooltips_enabled ) {
|
||||||
$l_str_TooltipMode = 'al';
|
$l_str_tooltip_mode = 'al';
|
||||||
$l_str_TComplement = 'ternative-tooltips';
|
$l_str_tcomplement = 'ternative-tooltips';
|
||||||
} else {
|
} else {
|
||||||
$l_str_TooltipMode = 'jq';
|
$l_str_tooltip_mode = 'jq';
|
||||||
$l_str_TComplement = 'uery-tooltips';
|
$l_str_tcomplement = 'uery-tooltips';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$l_str_TooltipMode = 'no';
|
$l_str_tooltip_mode = 'no';
|
||||||
$l_str_TComplement = '-tooltips';
|
$l_str_tcomplement = '-tooltips';
|
||||||
}
|
}
|
||||||
|
|
||||||
// set basic responsive page layout mode for use in stylesheet name:
|
// Set basic responsive page layout mode for use in stylesheet name.
|
||||||
$l_str_PageLayoutOption = 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 );
|
||||||
switch ( $l_str_PageLayoutOption ) {
|
switch ( $l_str_page_layout_option ) {
|
||||||
case "reference-container": $l_str_LayoutMode = '1'; break;
|
case 'reference-container':
|
||||||
case "entry-content" : $l_str_LayoutMode = '2'; break;
|
$l_str_layout_mode = '1';
|
||||||
case "main-content" : $l_str_LayoutMode = '3'; break;
|
break;
|
||||||
case "none": default: $l_str_LayoutMode = '0'; break;
|
case 'entry-content':
|
||||||
|
$l_str_layout_mode = '2';
|
||||||
|
break;
|
||||||
|
case 'main-content':
|
||||||
|
$l_str_layout_mode = '3';
|
||||||
|
break;
|
||||||
|
case 'none':
|
||||||
|
default:
|
||||||
|
$l_str_layout_mode = '0';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// enqueue the tailored united minified stylesheet:
|
// Enqueue the tailored united minified stylesheet.
|
||||||
wp_enqueue_style(
|
wp_enqueue_style(
|
||||||
'mci-footnotes-' . $l_str_TooltipMode . $l_str_TComplement . '-pagelayout-' . $l_str_PageLayoutOption,
|
'mci-footnotes-' . $l_str_tooltip_mode . $l_str_tcomplement . '-pagelayout-' . $l_str_page_layout_option,
|
||||||
plugins_url(
|
plugins_url(
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_TooltipMode . 'ttbrpl' . $l_str_LayoutMode . '.min.css'
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode . 'ttbrpl' . $l_str_layout_mode . '.min.css'
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
C_STR_FOOTNOTES_VERSION,
|
C_STR_FOOTNOTES_VERSION,
|
||||||
|
@ -356,12 +336,12 @@ class MCI_Footnotes {
|
||||||
wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_FOOTNOTES_VERSION );
|
wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_FOOTNOTES_VERSION );
|
||||||
wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_FOOTNOTES_VERSION );
|
wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_FOOTNOTES_VERSION );
|
||||||
|
|
||||||
$l_str_PageLayoutOption = 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 );
|
||||||
if ($l_str_PageLayoutOption != 'none') {
|
if ( 'none' !== $l_str_page_layout_option ) {
|
||||||
wp_enqueue_style(
|
wp_enqueue_style(
|
||||||
'mci-footnotes-layout-' . $l_str_PageLayoutOption,
|
'mci-footnotes-layout-' . $l_str_page_layout_option,
|
||||||
plugins_url(
|
plugins_url(
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_PageLayoutOption . '.css'
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_page_layout_option . '.css'
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
C_STR_FOOTNOTES_VERSION,
|
C_STR_FOOTNOTES_VERSION,
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Loads text domain of current or default language for localization.
|
* Loads text domain of current or default language for localization.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 14.09.14 17:47
|
* @since 1.5.0 14.09.14 17:47
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @lastmodified 2021-02-18T2028+0100
|
* @lastmodified 2021-02-18T2028+0100
|
||||||
*
|
*
|
||||||
* @since 2.0.0 Bugfix: Localization: correct function call apply_filters() with all required arguments after PHP 7.1 promoted warning to error, thanks to @matkus2 bug report and code contribution.
|
* @since 2.0.0 Bugfix: Localization: correct function call apply_filters() with all required arguments after PHP 7.1 promoted warning to error, thanks to @matkus2 bug report and code contribution.
|
||||||
|
@ -16,7 +15,6 @@
|
||||||
/**
|
/**
|
||||||
* Loads text domain of current or default language for localization.
|
* Loads text domain of current or default language for localization.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_Language {
|
class MCI_Footnotes_Language {
|
||||||
|
@ -24,18 +22,16 @@ class MCI_Footnotes_Language {
|
||||||
/**
|
/**
|
||||||
* Register WordPress Hook.
|
* Register WordPress Hook.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public static function registerHooks() {
|
public static function register_hooks() {
|
||||||
add_action('plugins_loaded', array("MCI_Footnotes_Language", "loadTextDomain"));
|
add_action( 'plugins_loaded', array( 'MCI_Footnotes_Language', 'load_text_domain' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the text domain for current WordPress language if exists.
|
* Loads the text domain for current WordPress language if exists.
|
||||||
* Otherwise fallback "en_GB" will be loaded.
|
* Otherwise fallback "en_GB" will be loaded.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -47,8 +43,8 @@ class MCI_Footnotes_Language {
|
||||||
* @contributor @matkus2
|
* @contributor @matkus2
|
||||||
* @link https://wordpress.org/support/topic/error-missing-parameter-if-using-php-7-1-or-later/
|
* @link https://wordpress.org/support/topic/error-missing-parameter-if-using-php-7-1-or-later/
|
||||||
*
|
*
|
||||||
* Add 3rd (empty) argument in apply_filters() to prevent PHP from throwing an error:
|
* Add 3rd (empty) argument in apply_filters() to prevent PHP from throwing an error.
|
||||||
* “Fatal error: Uncaught ArgumentCountError: Too few arguments to function apply_filters()”
|
* “Fatal error: Uncaught Argument_count_error: Too few arguments to function apply_filters()”
|
||||||
*
|
*
|
||||||
* Yet get_locale() is defined w/o parameters in wp-includes/l10n.php:30, and
|
* Yet get_locale() is defined w/o parameters in wp-includes/l10n.php:30, and
|
||||||
* apply_filters() is defined as apply_filters( $tag, $value ) in wp-includes/plugin.php:181.
|
* apply_filters() is defined as apply_filters( $tag, $value ) in wp-includes/plugin.php:181.
|
||||||
|
@ -57,7 +53,7 @@ class MCI_Footnotes_Language {
|
||||||
* But apply_filters() is defined with a 3rd parameter (and w/o the first one) in
|
* But apply_filters() is defined with a 3rd parameter (and w/o the first one) in
|
||||||
* wp-includes/class-wp-hook.php:264, as public function apply_filters( $value, $args ).
|
* wp-includes/class-wp-hook.php:264, as public function apply_filters( $value, $args ).
|
||||||
*
|
*
|
||||||
* Taking it all together, probably the full function definition would be:
|
* Taking it all together, probably the full function definition would be.
|
||||||
* public function apply_filters( $tag, $value, $args ).
|
* public function apply_filters( $tag, $value, $args ).
|
||||||
* In the case of get_locale(), $args is empty.
|
* In the case of get_locale(), $args is empty.
|
||||||
*
|
*
|
||||||
|
@ -65,22 +61,21 @@ class MCI_Footnotes_Language {
|
||||||
* @link https://www.php.net/manual/en/migration71.incompatible.php
|
* @link https://www.php.net/manual/en/migration71.incompatible.php
|
||||||
* @link https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.too-few-arguments-exception
|
* @link https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.too-few-arguments-exception
|
||||||
*/
|
*/
|
||||||
public static function loadTextDomain() {
|
public static function load_text_domain() {
|
||||||
|
|
||||||
// if language file with localization exists:
|
// If language file with localization exists.
|
||||||
if ( self::load( apply_filters( 'plugin_locale', get_locale(), '' ) ) ) {
|
if ( self::load( apply_filters( 'plugin_locale', get_locale(), '' ) ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// else fall back to British English:
|
// Else fall back to British English.
|
||||||
self::load( "en_GB" );
|
self::load( 'en_GB' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a specific text domain.
|
* Loads a specific text domain.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.1
|
* @since 1.5.1
|
||||||
* @param string $p_str_LanguageCode Language Code to load a specific text domain.
|
* @param string $p_str_language_code Language Code to load a specific text domain.
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -92,16 +87,14 @@ class MCI_Footnotes_Language {
|
||||||
* @reporter @nikelaos
|
* @reporter @nikelaos
|
||||||
* @link https://wordpress.org/support/topic/more-feature-ideas/
|
* @link https://wordpress.org/support/topic/more-feature-ideas/
|
||||||
*
|
*
|
||||||
* That is done by using load_plugin_textdomain():
|
* That is done by using load_plugin_textdomain().
|
||||||
* “The .mo file should be named based on the text domain with a dash, and then the locale exactly.”
|
* “The .mo file should be named based on the text domain with a dash, and then the locale exactly.”
|
||||||
* @see wp-includes/l10n.php:857
|
* @see wp-includes/l10n.php:857
|
||||||
*/
|
*/
|
||||||
private static function load($p_str_LanguageCode) {
|
private static function load( $p_str_language_code ) {
|
||||||
return load_plugin_textdomain(
|
return load_plugin_textdomain(
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME,
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME,
|
||||||
// This argument only fills the gap left by a deprecated argument (since WP2.7):
|
|
||||||
false,
|
false,
|
||||||
// The plugin basedir is provided; trailing slash would be clipped:
|
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages'
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
1840
class/task.php
1840
class/task.php
File diff suppressed because it is too large
Load diff
|
@ -1,39 +1,21 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Includes the Template Engine to load and handle all Template files of the Plugin.
|
* Includes the Template Engine to load and handle all Template files of the Plugin.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 14.09.14 10:58
|
* @since 1.5.0 14.09.14 10:58
|
||||||
*
|
*
|
||||||
*
|
* @lastmodified 2021-02-22T1416+0100
|
||||||
* @lastmodified 2021-02-18T2024+0100
|
*
|
||||||
*
|
* @since 2.2.6 Adding: Templates: support for custom templates in sibling folder, thanks to @misfist issue report.
|
||||||
* @since 2.0.3 prettify reference container template
|
* @since 2.5.0 Adding: Templates: Enable template location stack, thanks to @misfist code contribution.
|
||||||
* @since 2.0.3 replace tab with a space
|
|
||||||
* @since 2.0.3 replace 2 spaces with 1
|
|
||||||
* @since 2.0.4 collapse multiple spaces
|
|
||||||
* @since 2.0.6 prettify other templates (footnote, tooltip script, ref container row)
|
|
||||||
* @since 2.2.6 delete a space before a closing pointy bracket
|
|
||||||
*
|
|
||||||
* @since 2.2.6 support for custom templates in fixed location, while failing to add filter thanks to @misfist 2020-12-19T0606+0100
|
|
||||||
* @link https://wordpress.org/support/topic/template-override-filter/
|
|
||||||
*
|
|
||||||
* @since 2.4.0 templates may be in active theme, thanks to @misfist
|
|
||||||
* @link https://wordpress.org/support/topic/template-override-filter/#post-13846598
|
|
||||||
*
|
|
||||||
* @since 2.5.0 Enable template location stack, contributed by @misfist
|
|
||||||
* @link https://wordpress.org/support/topic/template-override-filter/#post-13864301
|
|
||||||
*
|
|
||||||
* @since 2.5.4 collapse HTML comments and PHP/JS docblocks (only)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles each Template file for the Plugin Frontend (e.g. Settings Dashboard, Public pages, ...).
|
* Handles each Template file for the Plugin Frontend (e.g. Settings Dashboard, Public pages, ...).
|
||||||
* Loads a template file, replaces all Placeholders and returns the replaced file content.
|
* Loads a template file, replaces all Placeholders and returns the replaced file content.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_Template {
|
class MCI_Footnotes_Template {
|
||||||
|
@ -41,43 +23,38 @@ class MCI_Footnotes_Template {
|
||||||
/**
|
/**
|
||||||
* Directory name for dashboard templates.
|
* Directory name for dashboard templates.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const C_STR_DASHBOARD = "dashboard";
|
const C_STR_DASHBOARD = 'dashboard';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory name for public templates.
|
* Directory name for public templates.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const C_STR_PUBLIC = "public";
|
const C_STR_PUBLIC = 'public';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the content of the template after initialize.
|
* Contains the content of the template after initialize.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $a_str_OriginalContent = "";
|
private $a_str_original_content = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the content of the template after initialize with replaced place holders.
|
* Contains the content of the template after initialize with replaced place holders.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $a_str_ReplacedContent = "";
|
private $a_str_replaced_content = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin Directory
|
* Plugin Directory
|
||||||
*
|
*
|
||||||
* @author Patrizia Lutz @misfist
|
|
||||||
* @since 2.4.0d3
|
* @since 2.4.0d3
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -87,42 +64,39 @@ class MCI_Footnotes_Template {
|
||||||
/**
|
/**
|
||||||
* Class Constructor. Reads and loads the template file without replace any placeholder.
|
* Class Constructor. Reads and loads the template file without replace any placeholder.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param string $p_str_FileType Template file type (take a look on the Class constants).
|
* @param string $p_str_file_type Template file type (take a look on the Class constants).
|
||||||
* @param string $p_str_FileName Template file name inside the Template directory without the file extension.
|
* @param string $p_str_file_name Template file name inside the Template directory without the file extension.
|
||||||
* @param string $p_str_Extension Optional Template file extension (default: html)
|
* @param string $p_str_extension Optional Template file extension (default: html).
|
||||||
*
|
*
|
||||||
*
|
* - Adding: Templates: support for custom templates in sibling folder, thanks to @misfist issue report.
|
||||||
* @since 2.2.6 support for custom templates 2020-12-19T0606+0100
|
*
|
||||||
|
* @since 2.2.6
|
||||||
|
* @date 2020-12-19T0606+0100
|
||||||
|
*
|
||||||
|
* @reporter @misfist
|
||||||
* @link https://wordpress.org/support/topic/template-override-filter/
|
* @link https://wordpress.org/support/topic/template-override-filter/
|
||||||
*
|
|
||||||
* @since 2.4.0 look for custom template in the active theme first, thanks to @misfist
|
|
||||||
* @link https://wordpress.org/support/topic/template-override-filter/#post-13846598
|
|
||||||
*/
|
*/
|
||||||
public function __construct($p_str_FileType, $p_str_FileName, $p_str_Extension = "html") {
|
public function __construct( $p_str_file_type, $p_str_file_name, $p_str_extension = 'html' ) {
|
||||||
// no template file type and/or file name set
|
// No template file type and/or file name set.
|
||||||
if (empty($p_str_FileType) || empty($p_str_FileName)) {
|
if ( empty( $p_str_file_type ) || empty( $p_str_file_name ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define plugin root path
|
* Define plugin root path.
|
||||||
*
|
*
|
||||||
* @since 2.4.0d3
|
* @since 2.4.0d3
|
||||||
*
|
|
||||||
* @author Patrizia Lutz @misfist
|
|
||||||
*/
|
*/
|
||||||
$this->plugin_directory = plugin_dir_path( dirname( __FILE__ ) );
|
$this->plugin_directory = plugin_dir_path( dirname( __FILE__ ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modularize functions
|
* Modularize functions.
|
||||||
*
|
*
|
||||||
* @since 2.4.0d3
|
* @since 2.4.0d3
|
||||||
*
|
|
||||||
* @author Patrizia Lutz @misfist
|
|
||||||
*/
|
*/
|
||||||
if( $template = $this->get_template( $p_str_FileType, $p_str_FileName, $p_str_Extension ) ) {
|
$template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension );
|
||||||
|
if ( $template ) {
|
||||||
$this->process_template( $template );
|
$this->process_template( $template );
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
@ -133,124 +107,123 @@ class MCI_Footnotes_Template {
|
||||||
/**
|
/**
|
||||||
* Replace all placeholders specified in array.
|
* Replace all placeholders specified in array.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param array $p_arr_Placeholders Placeholders (key = placeholder, value = value).
|
* @param array $p_arr_placeholders Placeholders (key = placeholder, value = value).
|
||||||
* @return bool True on Success, False if Placeholders invalid.
|
* @return bool True on Success, False if Placeholders invalid.
|
||||||
*/
|
*/
|
||||||
public function replace($p_arr_Placeholders) {
|
public function replace( $p_arr_placeholders ) {
|
||||||
// no placeholders set
|
// No placeholders set.
|
||||||
if (empty($p_arr_Placeholders)) {
|
if ( empty( $p_arr_placeholders ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// template content is empty
|
// Template content is empty.
|
||||||
if (empty($this->a_str_ReplacedContent)) {
|
if ( empty( $this->a_str_replaced_content ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// iterate through each placeholder and replace it with its value
|
// Iterate through each placeholder and replace it with its value.
|
||||||
foreach($p_arr_Placeholders as $l_str_Placeholder => $l_str_Value) {
|
foreach ( $p_arr_placeholders as $l_str_placeholder => $l_str_value ) {
|
||||||
$this->a_str_ReplacedContent = str_replace("[[" . $l_str_Placeholder . "]]", $l_str_Value, $this->a_str_ReplacedContent);
|
$this->a_str_replaced_content = str_replace( '[[' . $l_str_placeholder . ']]', $l_str_value, $this->a_str_replaced_content );
|
||||||
}
|
}
|
||||||
// success
|
// Success.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads the original content of the template file.
|
* Reloads the original content of the template file.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public function reload() {
|
public function reload() {
|
||||||
$this->a_str_ReplacedContent = $this->a_str_OriginalContent;
|
$this->a_str_replaced_content = $this->a_str_original_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the content of the template file with replaced placeholders.
|
* Returns the content of the template file with replaced placeholders.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string Template content with replaced placeholders.
|
* @return string Template content with replaced placeholders.
|
||||||
*/
|
*/
|
||||||
public function getContent() {
|
public function get_content() {
|
||||||
return $this->a_str_ReplacedContent;
|
return $this->a_str_replaced_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process template file
|
* Process template file.
|
||||||
*
|
|
||||||
* @author Patrizia Lutz @misfist
|
|
||||||
*
|
*
|
||||||
* @since 2.4.0d3
|
* @since 2.4.0d3
|
||||||
*
|
*
|
||||||
* @param string $template
|
* @param string $template The template to be processed.
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*
|
* @since 2.0.3 Replace tab with a space.
|
||||||
* @since 2.0.3 replace tab with a space
|
* @since 2.0.3 Replace 2 spaces with 1.
|
||||||
* @since 2.0.3 replace 2 spaces with 1
|
* @since 2.0.4 Collapse multiple spaces.
|
||||||
* @since 2.0.4 collapse multiple spaces
|
* @since 2.2.6 Delete a space before a closing pointy bracket.
|
||||||
* @since 2.2.6 delete a space before a closing pointy bracket
|
* @since 2.5.4 Collapse HTML comments and PHP/JS docblocks (only).
|
||||||
* @since 2.5.4 collapse HTML comments and PHP/JS docblocks (only)
|
|
||||||
*/
|
*/
|
||||||
public function process_template( $template ) {
|
public function process_template( $template ) {
|
||||||
$this->a_str_OriginalContent = preg_replace( '#<!--.+?-->#s', "", file_get_contents( $template ) );
|
$this->a_str_original_content = preg_replace( '#<!--.+?-->#s', '', wp_remote_get( $template ) );
|
||||||
$this->a_str_OriginalContent = preg_replace( '#/\*\*.+?\*/#s', "", $this->a_str_OriginalContent );
|
$this->a_str_original_content = preg_replace( '#/\*\*.+?\*/#s', '', $this->a_str_original_content );
|
||||||
$this->a_str_OriginalContent = str_replace( "\n", "", $this->a_str_OriginalContent );
|
$this->a_str_original_content = str_replace( "\n", '', $this->a_str_original_content );
|
||||||
$this->a_str_OriginalContent = str_replace( "\r", "", $this->a_str_OriginalContent );
|
$this->a_str_original_content = str_replace( "\r", '', $this->a_str_original_content );
|
||||||
$this->a_str_OriginalContent = str_replace( "\t", " ", $this->a_str_OriginalContent );
|
$this->a_str_original_content = str_replace( "\t", ' ', $this->a_str_original_content );
|
||||||
$this->a_str_OriginalContent = preg_replace( '# +#', " ", $this->a_str_OriginalContent );
|
$this->a_str_original_content = preg_replace( '# +#', ' ', $this->a_str_original_content );
|
||||||
$this->a_str_OriginalContent = str_replace( " >", ">", $this->a_str_OriginalContent );
|
$this->a_str_original_content = str_replace( ' >', '>', $this->a_str_original_content );
|
||||||
$this->reload();
|
$this->reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the template
|
* Get the template.
|
||||||
|
*
|
||||||
|
* - Adding: Templates: Enable template location stack, thanks to @misfist code contribution.
|
||||||
*
|
*
|
||||||
* @author Patrizia Lutz @misfist
|
* @since 2.4.0d3 Contribution.
|
||||||
|
* @since 2.5.0 Release.
|
||||||
|
*
|
||||||
|
* @contributor @misfist
|
||||||
|
* @link https://wordpress.org/support/topic/template-override-filter/#post-13864301
|
||||||
*
|
*
|
||||||
* @since 2.4.0d3
|
* @param string $p_str_file_type The file type of the template.
|
||||||
*
|
* @param string $p_str_file_name The file name of the template.
|
||||||
* @param string $p_str_FileType
|
* @param string $p_str_extension The file extension of the template.
|
||||||
* @param string $p_str_FileName
|
|
||||||
* @param string $p_str_Extension
|
|
||||||
* @return mixed false | template path
|
* @return mixed false | template path
|
||||||
*/
|
*/
|
||||||
public function get_template( $p_str_FileType, $p_str_FileName, $p_str_Extension = "html" ) {
|
public function get_template( $p_str_file_type, $p_str_file_name, $p_str_extension = 'html' ) {
|
||||||
$located = false;
|
$located = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The directory change be modified
|
* The directory can be changed.
|
||||||
* @usage to change location of templates to `template_parts/footnotes/':
|
*
|
||||||
|
* @usage to change location of templates to 'template_parts/footnotes/':
|
||||||
* add_filter( 'mci_footnotes_template_directory', function( $directory ) {
|
* add_filter( 'mci_footnotes_template_directory', function( $directory ) {
|
||||||
* return 'template_parts/footnotes/;
|
* return 'template_parts/footnotes/';
|
||||||
* } );
|
* } );
|
||||||
*/
|
*/
|
||||||
$template_directory = apply_filters( 'mci_footnotes_template_directory', 'footnotes/templates/' );
|
$template_directory = apply_filters( 'mci_footnotes_template_directory', 'footnotes/templates/' );
|
||||||
$custom_directory = apply_filters( 'mci_footnotes_custom_template_directory', 'footnotes-custom/' );
|
$custom_directory = apply_filters( 'mci_footnotes_custom_template_directory', 'footnotes-custom/' );
|
||||||
$template_name = $p_str_FileType . '/' . $p_str_FileName . '.' . $p_str_Extension;
|
$template_name = $p_str_file_type . '/' . $p_str_file_name . '.' . $p_str_extension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look in active (child) theme
|
* Look in active theme.
|
||||||
*/
|
*/
|
||||||
if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name ) ) {
|
if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name ) ) {
|
||||||
$located = trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name;
|
$located = trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look in parent theme
|
* Look in parent theme in case active is child.
|
||||||
*/
|
*/
|
||||||
} elseif ( file_exists( trailingslashit( get_template_directory() ) . $template_directory . $template_name ) ) {
|
} elseif ( file_exists( trailingslashit( get_template_directory() ) . $template_directory . $template_name ) ) {
|
||||||
$located = trailingslashit( get_template_directory() ) . $template_directory . $template_name;
|
$located = trailingslashit( get_template_directory() ) . $template_directory . $template_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look in custom directory
|
* Look in custom plugin directory.
|
||||||
*/
|
*/
|
||||||
} elseif ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name ) ) {
|
} elseif ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name ) ) {
|
||||||
$located = trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name;
|
$located = trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look in plugin
|
* Fall back to the templates shipped with the plugin.
|
||||||
*/
|
*/
|
||||||
} elseif ( file_exists( $this->plugin_directory . 'templates/' . $template_name ) ) {
|
} elseif ( file_exists( $this->plugin_directory . 'templates/' . $template_name ) ) {
|
||||||
$located = $this->plugin_directory . 'templates/' . $template_name;
|
$located = $this->plugin_directory . 'templates/' . $template_name;
|
||||||
}
|
}
|
||||||
|
@ -258,4 +231,4 @@ class MCI_Footnotes_Template {
|
||||||
return $located;
|
return $located;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of class
|
} // End of class.
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Widget base.
|
* Widget base.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @date 14.09.14 14:30
|
* @date 14.09.14 14:30
|
||||||
*
|
*
|
||||||
* @lastmodified 2021-02-18T0306+0100
|
* @lastmodified 2021-02-18T0306+0100
|
||||||
* @date 2021-02-18T0240+0100
|
* @date 2021-02-18T0240+0100
|
||||||
* @since 1.6.4 Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution.
|
* @since 1.6.4 Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution.
|
||||||
|
@ -21,68 +21,69 @@
|
||||||
* @author Stefan Herndler
|
* @author Stefan Herndler
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
abstract class MCI_Footnotes_WidgetBase extends WP_Widget {
|
abstract class MCI_Footnotes_Widget_Base extends WP_Widget {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an unique ID as string used for the Widget Base ID.
|
* Returns an unique ID as string used for the Widget Base ID.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract protected function getID();
|
abstract protected function get_id();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Public name of child Widget to be displayed in the Configuration page.
|
* Returns the Public name of child Widget to be displayed in the Configuration page.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract protected function getName();
|
abstract protected function get_name();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Description of the child widget.
|
* Returns the Description of the child widget.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract protected function getDescription();
|
abstract protected function get_description();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the width of the Widget. Default width is 250 pixel.
|
* Returns the width of the Widget. Default width is 250 pixel.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function getWidgetWidth() {
|
protected function get_widget_width() {
|
||||||
return 250;
|
return 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Constructor. Registers the child Widget to WordPress.
|
* Class Constructor. Registers the child Widget to WordPress.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
* - Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution.
|
* - Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution.
|
||||||
*
|
*
|
||||||
* @since 1.6.4
|
* @since 1.6.4
|
||||||
* @contributor @dartiss
|
* @contributor @dartiss
|
||||||
* @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720
|
* @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720
|
||||||
* “The called constructor method for WP_Widget in MCI_Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.”
|
* “The called constructor method for WP_Widget in MCI_Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.”
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$l_arr_WidgetOptions = array("classname" => __CLASS__, "description" => $this->getDescription());
|
$l_arr_widget_options = array(
|
||||||
$l_arr_ControlOptions = array("id_base" => strtolower($this->getID()), "width" => $this->getWidgetWidth());
|
'classname' => __CLASS__,
|
||||||
// registers the Widget
|
'description' => $this->get_description(),
|
||||||
|
);
|
||||||
|
$l_arr_control_options = array(
|
||||||
|
'id_base' => strtolower( $this->get_id() ),
|
||||||
|
'width' => $this->get_widget_width(),
|
||||||
|
);
|
||||||
|
// Registers the Widget.
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
strtolower($this->getID()), // unique ID for the widget, has to be lowercase
|
strtolower( $this->get_id() ), // Unique ID for the widget, has to be lowercase.
|
||||||
$this->getName(), // Plugin name to be displayed
|
$this->get_name(), // Plugin name to be displayed.
|
||||||
$l_arr_WidgetOptions, // Optional Widget Options
|
$l_arr_widget_options, // Optional Widget Options.
|
||||||
$l_arr_ControlOptions // Optional Widget Control Options
|
$l_arr_control_options // Optional Widget Control Options.
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,85 +1,78 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Includes the Plugin Widget to put the Reference Container to the Widget area.
|
* Includes the Plugin Widget to put the Reference Container to the Widget area.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 14.09.14 14:26
|
* @since 1.5.0 14.09.14 14:26
|
||||||
*
|
*
|
||||||
* Edited 2.2.0 2020-12-12T2131+0100
|
* Edited 2.2.0 2020-12-12T2131+0100
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a Widget to put the Reference Container to the widget area.
|
* Registers a Widget to put the Reference Container to the widget area.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_Widget_ReferenceContainer extends MCI_Footnotes_WidgetBase {
|
class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an unique ID as string used for the Widget Base ID.
|
* Returns an unique ID as string used for the Widget Base ID.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getID() {
|
protected function get_id() {
|
||||||
return "footnotes_widget";
|
return 'footnotes_widget';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Public name of the Widget to be displayed in the Configuration page.
|
* Returns the Public name of the Widget to be displayed in the Configuration page.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getName() {
|
protected function get_name() {
|
||||||
return MCI_Footnotes_Config::C_STR_PLUGIN_NAME;
|
return MCI_Footnotes_Config::C_STR_PLUGIN_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Description of the child widget.
|
* Returns the Description of the child widget.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* Edit: curly quotes 2.2.0 2020-12-12T2130+0100
|
* Edit: curly quotes 2.2.0 2020-12-12T2130+0100
|
||||||
*/
|
*/
|
||||||
protected function getDescription() {
|
protected function get_description() {
|
||||||
return __('The widget defines the position of the reference container if set to “widget area”.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
|
return __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the Settings of the Widget.
|
* Outputs the Settings of the Widget.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param mixed $instance
|
* @param mixed $instance The instance of the widget.
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* Edit: curly quotes 2.2.0 2020-12-12T2130+0100
|
* Edit: curly quotes 2.2.0 2020-12-12T2130+0100
|
||||||
*/
|
*/
|
||||||
public function form($instance) {
|
public function form( $instance ) {
|
||||||
echo __('The widget defines the position of the reference container if set to “widget area”.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
|
echo wp_kses_post( __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the Content of the Widget.
|
* Outputs the Content of the Widget.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param mixed $args
|
* @param mixed $args The widget's arguments.
|
||||||
* @param mixed $instance
|
* @param mixed $instance The instance of the widget.
|
||||||
*/
|
*/
|
||||||
public function widget($args, $instance) {
|
public function widget( $args, $instance ) {
|
||||||
global $g_obj_MCI_Footnotes;
|
global $g_obj_mci_footnotes;
|
||||||
// reference container positioning is set to "widget area"
|
// Reference container positioning is set to "widget area".
|
||||||
if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "widget") {
|
if ( 'widget' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) {
|
||||||
echo $g_obj_MCI_Footnotes->a_obj_Task->ReferenceContainer();
|
echo wp_kses_post( $g_obj_mci_footnotes->a_obj_task->Reference_Container() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,83 +1,89 @@
|
||||||
<?php
|
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
|
||||||
/**
|
/**
|
||||||
* Includes the Class to handle the WYSIWYG-Buttons.
|
* Includes the Class to handle the WYSIWYG-Buttons.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 14.09.14 17:30
|
* @since 1.5.0 14.09.14 17:30
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Handles the WSYIWYG-Buttons.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class MCI_Footnotes_WYSIWYG {
|
class MCI_Footnotes_WYSIWYG {
|
||||||
|
|
||||||
public static function registerHooks() {
|
/**
|
||||||
add_filter("mce_buttons", array("MCI_Footnotes_WYSIWYG", "newVisualEditorButton"));
|
* Registers Button hooks.
|
||||||
add_action("admin_print_footer_scripts", array("MCI_Footnotes_WYSIWYG", "newPlainTextEditorButton"));
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function register_hooks() {
|
||||||
|
add_filter( 'mce_buttons', array( 'MCI_Footnotes_WYSIWYG', 'new_visual_editor_button' ) );
|
||||||
|
add_action( 'admin_print_footer_scripts', array( 'MCI_Footnotes_WYSIWYG', 'new_plain_text_editor_button' ) );
|
||||||
|
|
||||||
add_filter("mce_external_plugins", array("MCI_Footnotes_WYSIWYG", "includeScripts"));
|
add_filter( 'mce_external_plugins', array( 'MCI_Footnotes_WYSIWYG', 'include_scripts' ) );
|
||||||
|
|
||||||
add_action("wp_ajax_nopriv_footnotes_getTags", array("MCI_Footnotes_WYSIWYG", "ajaxCallback"));
|
add_action( 'wp_ajax_nopriv_footnotes_get_tags', array( 'MCI_Footnotes_WYSIWYG', 'ajax_callback' ) );
|
||||||
add_action("wp_ajax_footnotes_getTags", array("MCI_Footnotes_WYSIWYG", "ajaxCallback"));
|
add_action( 'wp_ajax_footnotes_get_tags', array( 'MCI_Footnotes_WYSIWYG', 'ajax_callback' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a new Button to the WYSIWYG editor of Posts and Pages.
|
* Append a new Button to the WYSIWYG editor of Posts and Pages.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param array $p_arr_Buttons pre defined Buttons from WordPress.
|
* @param array $p_arr_buttons pre defined Buttons from WordPress.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function newVisualEditorButton($p_arr_Buttons) {
|
public static function new_visual_editor_button( $p_arr_buttons ) {
|
||||||
array_push($p_arr_Buttons, MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
|
array_push( $p_arr_buttons, MCI_Footnotes_Config::C_STR_PLUGIN_NAME );
|
||||||
return $p_arr_Buttons;
|
return $p_arr_buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new button to the plain text editor.
|
* Add a new button to the plain text editor.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public static function newPlainTextEditorButton() {
|
public static function new_plain_text_editor_button() {
|
||||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "editor-button");
|
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'editor-button' );
|
||||||
echo $l_obj_Template->getContent();
|
echo wp_kses_post( $l_obj_template->get_content() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes the Plugins WYSIWYG editor script.
|
* Includes the Plugins WYSIWYG editor script.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param array $p_arr_Plugins Scripts to be included to the editor.
|
* @param array $p_arr_plugins Scripts to be included to the editor.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function includeScripts($p_arr_Plugins) {
|
public static function include_scripts( $p_arr_plugins ) {
|
||||||
$p_arr_Plugins[MCI_Footnotes_Config::C_STR_PLUGIN_NAME] = plugins_url('/../js/wysiwyg-editor.js', __FILE__);
|
$p_arr_plugins[ MCI_Footnotes_Config::C_STR_PLUGIN_NAME ] = plugins_url( '/../js/wysiwyg-editor.js', __FILE__ );
|
||||||
return $p_arr_Plugins;
|
return $p_arr_plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AJAX Callback function when the Footnotes Button is clicked. Either in the Plain text or Visual editor.
|
* AJAX Callback function when the Footnotes Button is clicked. Either in the Plain text or Visual editor.
|
||||||
* Returns an JSON encoded array with the Footnotes start and end short code.
|
* Returns an JSON encoded array with the Footnotes start and end short code.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
public static function ajaxCallback() {
|
public static function ajax_callback() {
|
||||||
// get start and end tag for the footnotes short code
|
// Get start and end tag for the footnotes short code.
|
||||||
$l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START);
|
$l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START );
|
||||||
$l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END);
|
$l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END );
|
||||||
if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") {
|
if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) {
|
||||||
$l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED);
|
$l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED );
|
||||||
$l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED);
|
$l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
|
||||||
}
|
}
|
||||||
echo json_encode(array("start" => htmlspecialchars($l_str_StartingTag), "end" => htmlspecialchars($l_str_EndingTag)));
|
echo wp_json_encode(
|
||||||
|
array(
|
||||||
|
'start' => htmlspecialchars( $l_str_starting_tag ),
|
||||||
|
'end' => htmlspecialchars( $l_str_ending_tag ),
|
||||||
|
)
|
||||||
|
);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
composer.json
Normal file
11
composer.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
|
||||||
|
"wp-coding-standards/wpcs": "^2.3"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-install-cmd": [
|
||||||
|
"bash _tools/setup.sh"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
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 $?
|
|
@ -1,14 +1,17 @@
|
||||||
<?php
|
<?php // phpcs:disable Squiz.Commenting.FileComment.Missing
|
||||||
/*
|
// phpcs:disable Squiz.Commenting.FileComment.MissingPackageTag
|
||||||
|
/**
|
||||||
Plugin Name: footnotes
|
Plugin Name: footnotes
|
||||||
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
|
||||||
Version: 2.5.6d4
|
Version: 2.5.6
|
||||||
Author URI: http://cheret.de/plugins/footnotes-2/
|
Author URI: http://cheret.de/plugins/footnotes-2/
|
||||||
Text Domain: footnotes
|
Text Domain: footnotes
|
||||||
Domain Path: /languages
|
Domain Path: /languages
|
||||||
*/
|
*/
|
||||||
|
// phpcs:enable
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021 Mark Cheret (email: mark@cheret.de)
|
* Copyright 2021 Mark Cheret (email: mark@cheret.de)
|
||||||
*/
|
*/
|
||||||
|
@ -18,10 +21,10 @@
|
||||||
* @since 2.1.4
|
* @since 2.1.4
|
||||||
* @since 2.5.3 (Hungarian)
|
* @since 2.5.3 (Hungarian)
|
||||||
* @var str
|
* @var str
|
||||||
* @lastmodified 2021-02-20T0438+0100
|
* @lastmodified 2021-02-20T1911+0100
|
||||||
* @committer @pewgeuges
|
* @committer @pewgeuges
|
||||||
*/
|
*/
|
||||||
define( 'C_STR_FOOTNOTES_VERSION', '2.5.6d4' );
|
define( 'C_STR_FOOTNOTES_VERSION', '2.5.6' );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LICENSE NOTICE
|
LICENSE NOTICE
|
||||||
|
@ -42,34 +45,34 @@ define( 'C_STR_FOOTNOTES_VERSION', '2.5.6d4' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin’s main PHP file.
|
* Plugin’s main PHP file.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Get all common classes and functions
|
// Get all common classes and functions.
|
||||||
require_once(dirname(__FILE__) . "/includes.php");
|
require_once dirname( __FILE__ ) . '/includes.php';
|
||||||
|
|
||||||
// add Plugin Links to the "installed plugins" page
|
// Add Plugin Links to the "installed plugins" page.
|
||||||
$l_str_plugin_file = 'footnotes/footnotes.php';
|
$l_str_plugin_file = 'footnotes/footnotes.php';
|
||||||
add_filter("plugin_action_links_{$l_str_plugin_file}", array("MCI_Footnotes_Hooks", "PluginLinks"), 10, 2);
|
add_filter( "plugin_action_links_{$l_str_plugin_file}", array( 'MCI_Footnotes_Hooks', 'plugin_links' ), 10, 2 );
|
||||||
|
|
||||||
// initialize the Plugin
|
// Initialize the Plugin.
|
||||||
$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.
|
* Sets the stylesheet enqueuing mode for production.
|
||||||
*
|
*
|
||||||
* @since 2.5.5
|
* @since 2.5.5
|
||||||
* @var bool
|
* @var bool
|
||||||
* @see class/init.php
|
* @see class/init.php
|
||||||
*
|
*
|
||||||
* In production, a minified CSS file tailored to the settings is enqueued.
|
* 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.
|
* 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.
|
* WARNING: This facility designed for development must NOT be used in production.
|
||||||
*/
|
*/
|
||||||
define( 'C_BOOL_CSS_PRODUCTION_MODE', true );
|
define( 'C_BOOL_CSS_PRODUCTION_MODE', true );
|
||||||
|
|
37
includes.php
37
includes.php
|
@ -3,36 +3,37 @@
|
||||||
* Includes all common files.
|
* Includes all common files.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author Stefan Herndler
|
* @package footnotes
|
||||||
* @since 1.5.0 14.09.14 13:40
|
* @since 1.5.0 14.09.14 13:40
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requires (require_once) all *.php files inside a specific Directory.
|
* Requires (`require_once`) all `*.php` files inside a specific Directory.
|
||||||
*
|
*
|
||||||
* @author Stefan Herndler
|
* @author Stefan Herndler
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @param string $p_str_Directory Absolute Directory path to lookup for *.php files
|
* @param string $p_str_directory Absolute Directory path to lookup for `*.php` files.
|
||||||
*/
|
*/
|
||||||
function MCI_Footnotes_requirePhpFiles($p_str_Directory) {
|
function mci_footnotes_require_php_files( $p_str_directory ) {
|
||||||
// append slash at the end of the Directory if not exist
|
// Append slash at the end of the Directory if not exist.
|
||||||
if (substr($p_str_Directory, -1) != "/") {
|
if ( '/' !== substr( $p_str_directory, -1 ) ) {
|
||||||
$p_str_Directory .= "/";
|
$p_str_directory .= '/';
|
||||||
|
|
||||||
}
|
}
|
||||||
// get all PHP files inside Directory
|
// Get all PHP files inside Directory.
|
||||||
$l_arr_Files = scandir($p_str_Directory);
|
$l_arr_files = scandir( $p_str_directory );
|
||||||
// iterate through each class
|
// Iterate through each class.
|
||||||
foreach ($l_arr_Files as $l_str_FileName) {
|
foreach ( $l_arr_files as $l_str_file_name ) {
|
||||||
// skip all non *.php files
|
// Skip all non-PHP files.
|
||||||
if (strtolower(substr($l_str_FileName, -4)) != ".php") {
|
if ( '.php' !== strtolower( substr( $l_str_file_name, -4 ) ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// phpcs:disable Generic.Commenting.DocComment.MissingShort
|
||||||
/** @noinspection PhpIncludeInspection */
|
/** @noinspection PhpIncludeInspection */
|
||||||
require_once($p_str_Directory . $l_str_FileName);
|
require_once $p_str_directory . $l_str_file_name;
|
||||||
|
// phpcs:enable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MCI_Footnotes_requirePhpFiles(dirname(__FILE__) . "/class");
|
mci_footnotes_require_php_files( dirname( __FILE__ ) . '/class' );
|
||||||
MCI_Footnotes_requirePhpFiles(dirname(__FILE__) . "/class/dashboard");
|
mci_footnotes_require_php_files( dirname( __FILE__ ) . '/class/layout' );
|
||||||
MCI_Footnotes_requirePhpFiles(dirname(__FILE__) . "/class/widgets");
|
mci_footnotes_require_php_files( dirname( __FILE__ ) . '/class/widgets' );
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
=== footnotes ===
|
=== footnotes ===
|
||||||
Contributors: mark.cheret, lolzim, dartiss, docteurfitness, felipelavinz, martinneumannat, matkus2, meglio, misfist, rumperuu, spaceling, vonpiernik, pewgeuges
|
Contributors: mark.cheret, lolzim, rumperuu, aricura, misfist, ericakfranz, dartiss, docteurfitness, felipelavinz, martinneumannat, matkus2, meglio, spaceling, vonpiernik, pewgeuges
|
||||||
Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing
|
Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing
|
||||||
Requires at least: 3.9
|
Requires at least: 3.9
|
||||||
Tested up to: 5.6.1
|
Tested up to: 5.6.1
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Stable Tag: 2.5.5
|
Stable Tag: 2.5.6
|
||||||
License: GPLv3 or later
|
License: GPLv3 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
|
||||||
= 2.5.6 =
|
= 2.5.6 =
|
||||||
- Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports.
|
- Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports.
|
||||||
- Bugfix: Alternative tooltips: shrink width to short content.
|
- Bugfix: Alternative tooltips: shrink width to short content.
|
||||||
- Update: Documentation: slightly revise / update the plugin’s welcome page on WordPress.org.
|
- Update: Documentation: slightly revise or update the plugin’s welcome page on WordPress.org.
|
||||||
|
|
||||||
= 2.5.5 =
|
= 2.5.5 =
|
||||||
- Update: Stylesheets: increase speed and energy efficiency by tailoring stylesheets to the needs of the instance, thanks to @docteurfitness design contribution.
|
- Update: Stylesheets: increase speed and energy efficiency by tailoring stylesheets to the needs of the instance, thanks to @docteurfitness design contribution.
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/wp-admin/admin-ajax.php',
|
url: '/wp-admin/admin-ajax.php',
|
||||||
data: {
|
data: {
|
||||||
action: 'footnotes_getPluginInfo',
|
action: 'footnotes_get_plugin_info',
|
||||||
plugin: '[[plugin-name]]'
|
plugin: '[[plugin-name]]'
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
|
Reference in a new issue