Clean up spaces, tabs, indentation, and bracket formatting

This commit is contained in:
Brian Miyaji
2021-11-10 15:41:40 +09:00
parent e58beb1201
commit 3dff686a00
285 changed files with 29638 additions and 24147 deletions

View File

@@ -11,7 +11,7 @@
/**
* Equation Operating System Classes.
*
*
* This class was created for the safe parsing of mathematical equations
* in PHP. There is a need for a way to successfully parse equations
* in PHP that do NOT require the use of `eval`. `eval` at its core
@@ -41,27 +41,28 @@
* @version 2.0
*/
//The following are defines for thrown exceptions
// The following are defines for thrown exceptions
/**
* No matching Open/Close pair
*/
define('EQEOS_E_NO_SET', 5500);
define( 'EQEOS_E_NO_SET', 5500 );
/**
* Division by 0
*/
define('EQEOS_E_DIV_ZERO', 5501);
define( 'EQEOS_E_DIV_ZERO', 5501 );
/**
* No Equation
*/
define('EQEOS_E_NO_EQ', 5502);
define( 'EQEOS_E_NO_EQ', 5502 );
/**
* No variable replacement available
*/
define('EQEOS_E_NO_VAR', 5503);
define( 'EQEOS_E_NO_VAR', 5503 );
if(!defined('DEBUG'))
define('DEBUG', false);
if ( ! defined( 'DEBUG' ) ) {
define( 'DEBUG', false );
}
/**
* Equation Operating System (EOS) Parser
@@ -71,7 +72,7 @@ if(!defined('DEBUG'))
* variables, if the variables are defined (useful for the Graph creation
* that the second and extended class in this file provides. {@see eqGraph})
* This class was created for PHP4 in 2005, updated to fully PHP5 in 2013.
*
*
* @author Jon Lawrence <jlawrence11@gmail.com>
* @copyright Copyright ©2005-2013, Jon Lawrence
* @license http://opensource.org/licenses/LGPL-2.1 LGPL 2.1 License
@@ -80,26 +81,29 @@ if(!defined('DEBUG'))
* @version 2.0
*/
class eqEOS {
/**#@+
*Private variables
*/
/**#@+
* Private variables
*/
private $postFix;
private $inFix;
/**#@-*/
/**#@+
* Protected variables
*/
//What are opening and closing selectors
protected $SEP = array('open' => array('(', '['), 'close' => array(')', ']'));
//Top presedence following operator - not in use
protected $SGL = array('!');
//Order of operations arrays follow
protected $ST = array('^');
protected $ST1 = array('/', '*', '%');
protected $ST2 = array('+', '-');
//Allowed functions
protected $FNC = array('sin', 'cos', 'tan', 'csc', 'sec', 'cot');
/**#@-*/
/**#@-*/
/**#@+
* Protected variables
*/
// What are opening and closing selectors
protected $SEP = array(
'open' => array( '(', '[' ),
'close' => array( ')', ']' ),
);
// Top presedence following operator - not in use
protected $SGL = array( '!' );
// Order of operations arrays follow
protected $ST = array( '^' );
protected $ST1 = array( '/', '*', '%' );
protected $ST2 = array( '+', '-' );
// Allowed functions
protected $FNC = array( 'sin', 'cos', 'tan', 'csc', 'sec', 'cot' );
/**#@-*/
/**
* Construct method
*
@@ -110,11 +114,11 @@ class eqEOS {
* @see eqEOS::solveIF()
* @param String $inFix Standard format equation
*/
public function __construct($inFix = null) {
$this->inFix = (isset($inFix)) ? $inFix : null;
public function __construct( $inFix = null ) {
$this->inFix = ( isset( $inFix ) ) ? $inFix : null;
$this->postFix = array();
}
/**
* Check Infix for opening closing pair matches.
*
@@ -126,17 +130,17 @@ class eqEOS {
* @throws Exception if malformed.
* @return Bool true if passes - throws an exception if not.
*/
private function checkInfix($infix) {
if(trim($infix) == "") {
private function checkInfix( $infix ) {
if ( trim( $infix ) == '' ) {
return 0;
}
//Make sure we have the same number of '(' as we do ')'
// Make sure we have the same number of '(' as we do ')'
// and the same # of '[' as we do ']'
if(substr_count($infix, '(') != substr_count($infix, ')')) {
throw new Exception("Mismatched parenthesis in '{$infix}'", EQEOS_E_NO_SET);
if ( substr_count( $infix, '(' ) != substr_count( $infix, ')' ) ) {
throw new Exception( "Mismatched parenthesis in '{$infix}'", EQEOS_E_NO_SET );
return false;
} elseif(substr_count($infix, '[') != substr_count($infix, ']')) {
throw new Exception("Mismatched brackets in '{$infix}'", EQEOS_E_NO_SET);
} elseif ( substr_count( $infix, '[' ) != substr_count( $infix, ']' ) ) {
throw new Exception( "Mismatched brackets in '{$infix}'", EQEOS_E_NO_SET );
return false;
}
$this->inFix = $infix;
@@ -155,91 +159,96 @@ class eqEOS {
* @param String $infix A standard notation equation
* @return Array Fully formed RPN Stack
*/
public function in2post($infix = null) {
public function in2post( $infix = null ) {
// if an equation was not passed, use the one that was passed in the constructor
$infix = (isset($infix)) ? $infix : $this->inFix;
//check to make sure 'valid' equation
$this->checkInfix($infix);
$pf = array();
$ops = new phpStack();
$infix = ( isset( $infix ) ) ? $infix : $this->inFix;
// check to make sure 'valid' equation
$this->checkInfix( $infix );
$pf = array();
$ops = new phpStack();
$vars = new phpStack();
// remove all white-space
preg_replace("/\s/", "", $infix);
preg_replace( '/\s/', '', $infix );
// Create postfix array index
$pfIndex = 0;
//what was the last character? (useful for decerning between a sign for negation and subtraction)
// what was the last character? (useful for decerning between a sign for negation and subtraction)
$lChar = '';
//loop through all the characters and start doing stuff ^^
for($i=0;$i<strlen($infix);$i++) {
// loop through all the characters and start doing stuff ^^
for ( $i = 0;$i < strlen( $infix );$i++ ) {
// pull out 1 character from the string
$chr = substr($infix, $i, 1);
$chr = substr( $infix, $i, 1 );
// if the character is numerical
if(preg_match('/[0-9.]/i', $chr)) {
if ( preg_match( '/[0-9.]/i', $chr ) ) {
// if the previous character was not a '-' or a number
if((!preg_match('/[0-9.]/i', $lChar) && ($lChar != "")) && (array_key_exists($pfIndex, @$pf) && @$pf[$pfIndex]!="-"))
$pfIndex++; // increase the index so as not to overlap anything
if ( ( ! preg_match( '/[0-9.]/i', $lChar ) && ( $lChar != '' ) ) && ( array_key_exists( $pfIndex, @$pf ) && @$pf[ $pfIndex ] != '-' ) ) {
$pfIndex++; // increase the index so as not to overlap anything
}
// if the array key doesn't exist
if(!array_key_exists($pfIndex, @$pf))
@$pf[$pfIndex] = null; // add index to the array
if ( ! array_key_exists( $pfIndex, @$pf ) ) {
@$pf[ $pfIndex ] = null; // add index to the array
}
// Add the number character to the array
@$pf[$pfIndex] .= $chr;
@$pf[ $pfIndex ] .= $chr;
}
// If the character opens a set e.g. '(' or '['
elseif(in_array($chr, $this->SEP['open'])) {
elseif ( in_array( $chr, $this->SEP['open'] ) ) {
// if the last character was a number, place an assumed '*' on the stack
if(preg_match('/[0-9.]/i', $lChar))
$ops->push('*');
if ( preg_match( '/[0-9.]/i', $lChar ) ) {
$ops->push( '*' );
}
$ops->push($chr);
$ops->push( $chr );
}
// if the character closes a set e.g. ')' or ']'
elseif(in_array($chr, $this->SEP['close'])) {
elseif ( in_array( $chr, $this->SEP['close'] ) ) {
// find what set it was i.e. matches ')' with '(' or ']' with '['
$key = array_search($chr, $this->SEP['close']);
$key = array_search( $chr, $this->SEP['close'] );
// while the operator on the stack isn't the matching pair...pop it off
while($ops->peek() != $this->SEP['open'][$key]) {
while ( $ops->peek() != $this->SEP['open'][ $key ] ) {
$nchr = $ops->pop();
if($nchr)
$pf[++$pfIndex] = $nchr;
else {
throw new Exception("Error while searching for '". $this->SEP['open'][$key] ."' in '{$infix}'.", EQEOS_E_NO_SET);
if ( $nchr ) {
$pf[ ++$pfIndex ] = $nchr;
} else {
throw new Exception( "Error while searching for '" . $this->SEP['open'][ $key ] . "' in '{$infix}'.", EQEOS_E_NO_SET );
return false;
}
}
$ops->pop();
}
// If a special operator that has precedence over everything else
elseif(in_array($chr, $this->ST)) {
$ops->push($chr);
elseif ( in_array( $chr, $this->ST ) ) {
$ops->push( $chr );
$pfIndex++;
}
// Any other operator other than '+' and '-'
elseif(in_array($chr, $this->ST1)) {
while(in_array($ops->peek(), $this->ST1) || in_array($ops->peek(), $this->ST))
$pf[++$pfIndex] = $ops->pop();
elseif ( in_array( $chr, $this->ST1 ) ) {
while ( in_array( $ops->peek(), $this->ST1 ) || in_array( $ops->peek(), $this->ST ) ) {
$pf[ ++$pfIndex ] = $ops->pop();
}
$ops->push($chr);
$ops->push( $chr );
$pfIndex++;
}
// if a '+' or '-'
elseif(in_array($chr, $this->ST2)) {
elseif ( in_array( $chr, $this->ST2 ) ) {
// if it is a '-' and the character before it was an operator or nothingness (e.g. it negates a number)
if((in_array($lChar, array_merge($this->ST1, $this->ST2, $this->ST, $this->SEP['open'])) || $lChar=="") && $chr=="-") {
if ( ( in_array( $lChar, array_merge( $this->ST1, $this->ST2, $this->ST, $this->SEP['open'] ) ) || $lChar == '' ) && $chr == '-' ) {
// increase the index because there is no reason that it shouldn't..
$pfIndex++;
$pf[$pfIndex] = $chr;
$pf[ $pfIndex ] = $chr;
}
// Otherwise it will function like a normal operator
else {
while(in_array($ops->peek(), array_merge($this->ST1, $this->ST2, $this->ST)))
$pf[++$pfIndex] = $ops->pop();
$ops->push($chr);
while ( in_array( $ops->peek(), array_merge( $this->ST1, $this->ST2, $this->ST ) ) ) {
$pf[ ++$pfIndex ] = $ops->pop();
}
$ops->push( $chr );
$pfIndex++;
}
}
@@ -247,12 +256,13 @@ class eqEOS {
$lChar = $chr;
}
// if there is anything on the stack after we are done...add it to the back of the RPN array
while(($tmp = $ops->pop()) !== false)
$pf[++$pfIndex] = $tmp;
while ( ( $tmp = $ops->pop() ) !== false ) {
$pf[ ++$pfIndex ] = $tmp;
}
// re-index the array at 0
$pf = array_values($pf);
$pf = array_values( $pf );
// set the private variable for later use if needed
$this->postFix = $pf;
@@ -262,64 +272,64 @@ class eqEOS {
/**
* Solve Postfix (RPN)
*
*
* This function will solve a RPN array. Default action is to solve
* the RPN array stored in the class from eqEOS::in2post(), can take
* an array input to solve as well, though default action is prefered.
*
* @link http://en.wikipedia.org/wiki/Reverse_Polish_notation Postix Notation
* @param Array $pfArray RPN formatted array. Optional.
* @return Float Result of the operation.
* @return Float Result of the operation.
*/
public function solvePF($pfArray = null) {
public function solvePF( $pfArray = null ) {
// if no RPN array is passed - use the one stored in the private var
$pf = (!is_array($pfArray)) ? $this->postFix : $pfArray;
$pf = ( ! is_array( $pfArray ) ) ? $this->postFix : $pfArray;
// create our temporary function variables
$temp = array();
$tot = 0;
$tot = 0;
$hold = 0;
// Loop through each number/operator
for($i=0;$i<count($pf); $i++) {
// Loop through each number/operator
for ( $i = 0;$i < count( $pf ); $i++ ) {
// If the string isn't an operator, add it to the temp var as a holding place
if(!in_array($pf[$i], array_merge($this->ST, $this->ST1, $this->ST2))) {
$temp[$hold++] = $pf[$i];
if ( ! in_array( $pf[ $i ], array_merge( $this->ST, $this->ST1, $this->ST2 ) ) ) {
$temp[ $hold++ ] = $pf[ $i ];
}
// ...Otherwise perform the operator on the last two numbers
// ...Otherwise perform the operator on the last two numbers
else {
switch ($pf[$i]) {
switch ( $pf[ $i ] ) {
case '+':
$temp[$hold-2] = $temp[$hold-2] + $temp[$hold-1];
$temp[ $hold - 2 ] = $temp[ $hold - 2 ] + $temp[ $hold - 1 ];
break;
case '-':
$temp[$hold-2] = $temp[$hold-2] - $temp[$hold-1];
$temp[ $hold - 2 ] = $temp[ $hold - 2 ] - $temp[ $hold - 1 ];
break;
case '*':
$temp[$hold-2] = $temp[$hold-2] * $temp[$hold-1];
$temp[ $hold - 2 ] = $temp[ $hold - 2 ] * $temp[ $hold - 1 ];
break;
case '/':
if($temp[$hold-1] == 0) {
if ( $temp[ $hold - 1 ] == 0 ) {
return 0;
}
$temp[$hold-2] = $temp[$hold-2] / $temp[$hold-1];
$temp[ $hold - 2 ] = $temp[ $hold - 2 ] / $temp[ $hold - 1 ];
break;
case '^':
$temp[$hold-2] = pow($temp[$hold-2], $temp[$hold-1]);
$temp[ $hold - 2 ] = pow( $temp[ $hold - 2 ], $temp[ $hold - 1 ] );
break;
case '%':
if($temp[$hold-1] == 0) {
if ( $temp[ $hold - 1 ] == 0 ) {
return 0;
}
$temp[$hold-2] = bcmod($temp[$hold-2], $temp[$hold-1]);
$temp[ $hold - 2 ] = bcmod( $temp[ $hold - 2 ], $temp[ $hold - 1 ] );
break;
}
// Decrease the hold var to one above where the last number is
$hold = $hold-1;
// Decrease the hold var to one above where the last number is
$hold = $hold - 1;
}
}
// return the last number in the array
return $temp[$hold-1];
// return the last number in the array
return $temp[ $hold - 1 ];
} //end function solvePF
@@ -332,94 +342,95 @@ class eqEOS {
* The variable array must be in the format of 'variable' => value. If
* variable array is scalar (ie 5), all variables will be replaced with it.
*
* @param String $infix Standard Equation to solve
* @param String $infix Standard Equation to solve
* @param String|Array $vArray Variable replacement
* @return Float Solved equation
*/
function solveIF($infix, $vArray = null) {
$infix = ($infix != "") ? $infix : $this->inFix;
//Check to make sure a 'valid' expression
$this->checkInfix($infix);
function solveIF( $infix, $vArray = null ) {
$infix = ( $infix != '' ) ? $infix : $this->inFix;
$ops = new phpStack();
// Check to make sure a 'valid' expression
$this->checkInfix( $infix );
$ops = new phpStack();
$vars = new phpStack();
//remove all white-space
preg_replace("/\s/", "", $infix);
// remove all white-space
preg_replace( '/\s/', '', $infix );
//Find all the variables that were passed and replaces them
while((preg_match('/(.){0,1}[&$]([a-zA-Z0-9_]+)(.){0,1}/', $infix, $match)) != 0) {
// Find all the variables that were passed and replaces them
while ( ( preg_match( '/(.){0,1}[&$]([a-zA-Z0-9_]+)(.){0,1}/', $infix, $match ) ) != 0 ) {
//remove notices by defining if undefined.
if(!isset($match[3])) {
$match[3] = "";
// remove notices by defining if undefined.
if ( ! isset( $match[3] ) ) {
$match[3] = '';
}
// Ensure that the variable has an operator or something of that sort in front and back - if it doesn't, add an implied '*'
if((!in_array($match[1], array_merge($this->ST, $this->ST1, $this->ST2, $this->SEP['open'])) && $match[1] != "") || is_numeric($match[1])) //$this->SEP['close'] removed
$front = "*";
else
$front = "";
if ( ( ! in_array( $match[1], array_merge( $this->ST, $this->ST1, $this->ST2, $this->SEP['open'] ) ) && $match[1] != '' ) || is_numeric( $match[1] ) ) { // $this->SEP['close'] removed
$front = '*';
} else {
$front = '';
}
if((!in_array($match[3], array_merge($this->ST, $this->ST1, $this->ST2, $this->SEP['close'])) && $match[3] != "") || is_numeric($match[3])) //$this->SEP['open'] removed
$back = "*";
else
$back = "";
//Make sure that the variable does have a replacement
if(!isset($vArray[$match[2]]) && (!is_array($vArray != "") && !is_numeric($vArray))) {
throw new Exception("Variable replacement does not exist for '". substr($match[0], 1, -1) ."' in {$this->inFix}", EQEOS_E_NO_VAR);
if ( ( ! in_array( $match[3], array_merge( $this->ST, $this->ST1, $this->ST2, $this->SEP['close'] ) ) && $match[3] != '' ) || is_numeric( $match[3] ) ) { // $this->SEP['open'] removed
$back = '*';
} else {
$back = '';
}
// Make sure that the variable does have a replacement
if ( ! isset( $vArray[ $match[2] ] ) && ( ! is_array( $vArray != '' ) && ! is_numeric( $vArray ) ) ) {
throw new Exception( "Variable replacement does not exist for '" . substr( $match[0], 1, -1 ) . "' in {$this->inFix}", EQEOS_E_NO_VAR );
return false;
} elseif(!isset($vArray[$match[2]]) && (!is_array($vArray != "") && is_numeric($vArray))) {
$infix = str_replace($match[0], $match[1] . $front. $vArray. $back . $match[3], $infix);
} elseif(isset($vArray[$match[2]])) {
$infix = str_replace($match[0], $match[1] . $front. $vArray[$match[2]]. $back . $match[3], $infix);
} elseif ( ! isset( $vArray[ $match[2] ] ) && ( ! is_array( $vArray != '' ) && is_numeric( $vArray ) ) ) {
$infix = str_replace( $match[0], $match[1] . $front . $vArray . $back . $match[3], $infix );
} elseif ( isset( $vArray[ $match[2] ] ) ) {
$infix = str_replace( $match[0], $match[1] . $front . $vArray[ $match[2] ] . $back . $match[3], $infix );
}
}
// Finds all the 'functions' within the equation and calculates them
// NOTE - when using function, only 1 set of paranthesis will be found, instead use brackets for sets within functions!!
while((preg_match("/(". implode("|", $this->FNC) . ")\(([^\)\(]*(\([^\)]*\)[^\(\)]*)*[^\)\(]*)\)/", $infix, $match)) != 0) {
$func = $this->solveIF($match[2]);
switch($match[1]) {
case "cos":
$ans = cos($func);
// Finds all the 'functions' within the equation and calculates them
// NOTE - when using function, only 1 set of paranthesis will be found, instead use brackets for sets within functions!!
while ( ( preg_match( '/(' . implode( '|', $this->FNC ) . ')\(([^\)\(]*(\([^\)]*\)[^\(\)]*)*[^\)\(]*)\)/', $infix, $match ) ) != 0 ) {
$func = $this->solveIF( $match[2] );
switch ( $match[1] ) {
case 'cos':
$ans = cos( $func );
break;
case "sin":
$ans = sin($func);
case 'sin':
$ans = sin( $func );
break;
case "tan":
$ans = tan($func);
case 'tan':
$ans = tan( $func );
break;
case "sec":
$tmp = cos($func);
if($tmp == 0) {
case 'sec':
$tmp = cos( $func );
if ( $tmp == 0 ) {
return 0;
}
$ans = 1/$tmp;
$ans = 1 / $tmp;
break;
case "csc":
$tmp = sin($func);
if($tmp == 0) {
case 'csc':
$tmp = sin( $func );
if ( $tmp == 0 ) {
return 0;
}
$ans = 1/$tmp;
$ans = 1 / $tmp;
break;
case "cot":
$tmp = tan($func);
if($tmp == 0) {
case 'cot':
$tmp = tan( $func );
if ( $tmp == 0 ) {
return 0;
}
$ans = 1/$tmp;
$ans = 1 / $tmp;
break;
default:
break;
}
$infix = str_replace($match[0], $ans, $infix);
$infix = str_replace( $match[0], $ans, $infix );
}
return $this->solvePF($this->in2post($infix));
return $this->solvePF( $this->in2post( $infix ) );
} //end function solveIF
} //end class 'eqEOS'

View File

@@ -22,9 +22,9 @@ class phpStack {
* Initializes the stack
*/
public function __construct() {
//define the private vars
// define the private vars
$this->locArray = array();
$this->index = -1;
$this->index = -1;
}
/**
@@ -35,10 +35,11 @@ class phpStack {
* @return Mixed An element of the array or false if none exist
*/
public function peek() {
if($this->index > -1)
return $this->locArray[$this->index];
else
if ( $this->index > -1 ) {
return $this->locArray[ $this->index ];
} else {
return false;
}
}
/**
@@ -48,8 +49,8 @@ class phpStack {
*
* @param Mixed Element to add
*/
public function poke($data) {
$this->locArray[++$this->index] = $data;
public function poke( $data ) {
$this->locArray[ ++$this->index ] = $data;
}
/**
@@ -60,9 +61,9 @@ class phpStack {
*
* @param Mixed Element to add
*/
public function push($data) {
//allias for 'poke'
$this->poke($data);
public function push( $data ) {
// allias for 'poke'
$this->poke( $data );
}
/**
@@ -74,13 +75,12 @@ class phpStack {
* @return Mixed Element at end of stack or false if none exist
*/
public function pop() {
if($this->index > -1)
{
if ( $this->index > -1 ) {
$this->index--;
return $this->locArray[$this->index+1];
}
else
return $this->locArray[ $this->index + 1 ];
} else {
return false;
}
}
/**
@@ -89,7 +89,7 @@ class phpStack {
* Clears the stack to be reused.
*/
public function clear() {
$this->index = -1;
$this->index = -1;
$this->locArray = array();
}
@@ -101,13 +101,12 @@ class phpStack {
* @return Mixed Array of stack elements or false if none exist.
*/
public function getStack() {
if($this->index > -1)
{
return array_values($this->locArray);
}
else
if ( $this->index > -1 ) {
return array_values( $this->locArray );
} else {
return false;
}
}
}
?>

View File

@@ -745,7 +745,7 @@ if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
*/
public function install_plugins_page() {
// Store new instance of plugin table in object.
$plugin_table = new TGMPA_List_Table;
$plugin_table = new TGMPA_List_Table();
// Return early if processing a plugin installation action.
if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) {
@@ -947,14 +947,14 @@ if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
$repo_updates = get_site_transient( 'update_plugins' );
if ( ! is_object( $repo_updates ) ) {
$repo_updates = new stdClass;
$repo_updates = new stdClass();
}
foreach ( $plugins as $slug => $plugin ) {
$file_path = $plugin['file_path'];
if ( empty( $repo_updates->response[ $file_path ] ) ) {
$repo_updates->response[ $file_path ] = new stdClass;
$repo_updates->response[ $file_path ] = new stdClass();
}
// We only really need to set package, but let's do all we can in case WP changes something.
@@ -1024,10 +1024,24 @@ if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
if ( true === $GLOBALS['wp_filesystem']->move( $from_path, $to_path ) ) {
return trailingslashit( $to_path );
} else {
return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
return new WP_Error(
'rename_failed',
esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ),
array(
'found' => $subdir_name,
'expected' => $desired_slug,
)
);
}
} elseif ( empty( $subdir_name ) ) {
return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
return new WP_Error(
'packaged_wrong',
esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ),
array(
'found' => $subdir_name,
'expected' => $desired_slug,
)
);
}
}
@@ -1648,7 +1662,13 @@ if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
}
$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
$response = plugins_api(
'plugin_information',
array(
'slug' => $slug,
'fields' => array( 'sections' => false ),
)
);
$api[ $slug ] = false;
@@ -3407,12 +3427,16 @@ if ( ! function_exists( 'tgmpa_load_bulk_installer' ) ) {
* @type array $packages Array of plugin, theme, or core packages to update.
* }
*/
do_action( 'upgrader_process_complete', $this, array(
'action' => 'install', // [TGMPA + ] adjusted.
'type' => 'plugin',
'bulk' => true,
'plugins' => $plugins,
) );
do_action(
'upgrader_process_complete',
$this,
array(
'action' => 'install', // [TGMPA + ] adjusted.
'type' => 'plugin',
'bulk' => true,
'plugins' => $plugins,
)
);
$this->skin->bulk_footer();