Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../lib
File: wfHelperString.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
class wfHelperString {
[3] Fix | Delete
[4] Fix | Delete
/**
[5] Fix | Delete
* cycle through arguments
[6] Fix | Delete
*
[7] Fix | Delete
* @return mixed
[8] Fix | Delete
*/
[9] Fix | Delete
public static function cycle() {
[10] Fix | Delete
static $counter = 0;
[11] Fix | Delete
$args = func_get_args();
[12] Fix | Delete
if (empty($args)) {
[13] Fix | Delete
$counter = 0;
[14] Fix | Delete
return null;
[15] Fix | Delete
}
[16] Fix | Delete
$return_val = $args[$counter % count($args)];
[17] Fix | Delete
$counter++;
[18] Fix | Delete
return $return_val;
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
public static function plainTextTable($table, $maxColumnWidth = 60) {
[22] Fix | Delete
if (count($table) === 0) {
[23] Fix | Delete
return '';
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
$colLengths = array();
[27] Fix | Delete
for ($row = 0; $row < count($table); $row++) {
[28] Fix | Delete
if (is_string($table[$row])) { //Special handling to show a sub-header/divider
[29] Fix | Delete
continue;
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
for ($col = 0; $col < count($table[$row]); $col++) {
[33] Fix | Delete
$table[$row][$col] = wordwrap(str_replace("\t", " ", $table[$row][$col]), $maxColumnWidth, "\n", true);
[34] Fix | Delete
[35] Fix | Delete
foreach (explode("\n", $table[$row][$col]) as $colText) {
[36] Fix | Delete
if (!isset($colLengths[$col])) {
[37] Fix | Delete
$colLengths[$col] = strlen($colText);
[38] Fix | Delete
continue;
[39] Fix | Delete
}
[40] Fix | Delete
$len = strlen($colText);
[41] Fix | Delete
if ($len > $colLengths[$col]) {
[42] Fix | Delete
$colLengths[$col] = $len;
[43] Fix | Delete
}
[44] Fix | Delete
}
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
$totalWidth = array_sum($colLengths) + (count($colLengths) * 3) + 1;
[48] Fix | Delete
$hr = str_repeat('-', $totalWidth);
[49] Fix | Delete
$output = $hr . "\n";
[50] Fix | Delete
for ($row = 0; $row < count($table); $row++) {
[51] Fix | Delete
if (is_string($table[$row])) { //Special handling to show a sub-header/divider
[52] Fix | Delete
if ($row > 1) { $output .= $hr . "\n"; }
[53] Fix | Delete
$output .= '| ' . str_pad($table[$row], $totalWidth - 4, ' ', STR_PAD_BOTH) . ' ' . "|\n";
[54] Fix | Delete
$output .= $hr . "\n";
[55] Fix | Delete
continue;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
$colHeight = 0;
[59] Fix | Delete
for ($col = 0; $col < count($table[$row]); $col++) {
[60] Fix | Delete
$height = substr_count($table[$row][$col], "\n");
[61] Fix | Delete
if ($height > $colHeight) {
[62] Fix | Delete
$colHeight = $height;
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
for ($colRow = 0; $colRow <= $colHeight; $colRow++) {
[66] Fix | Delete
for ($col = 0; $col < count($table[$row]); $col++) {
[67] Fix | Delete
$colRows = explode("\n", $table[$row][$col]);
[68] Fix | Delete
$output .= '| ' . str_pad(isset($colRows[$colRow]) ? $colRows[$colRow] : '', $colLengths[$col], ' ', STR_PAD_RIGHT) . ' ';
[69] Fix | Delete
}
[70] Fix | Delete
$output .= "|\n";
[71] Fix | Delete
}
[72] Fix | Delete
if ($row === 0) {
[73] Fix | Delete
$output .= $hr . "\n";
[74] Fix | Delete
}
[75] Fix | Delete
}
[76] Fix | Delete
return trim($output . (count($table) > 1 ? $hr : ''));
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function