Use short form array syntax everywhere
- Add short form array syntax to po2php.php generation
This commit is contained in:
parent
77dfbaa0bf
commit
e36f2bb1fb
212 changed files with 5160 additions and 5160 deletions
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/**
|
||||
* When I installed docblox, I had the experience that it does not generate any output at all.
|
||||
* This script may be used to find that kind of problems with the documentation build process.
|
||||
|
@ -12,11 +12,11 @@
|
|||
* If that list can't be build, it cuts it in two parts and tries both parts independently. If only one of them breaks,
|
||||
* it takes that one and tries the same independently. If both break, it assumes this is the smallest set. This assumption
|
||||
* is not necessarily true. Maybe the smallest set consists of two files and both of them were in different parts when
|
||||
* the list was divided, but by now it is my best guess. To make this assumption better, the list is shuffled after every step.
|
||||
* the list was divided, but by now it is my best guess. To make this assumption better, the list is shuffled after every step.
|
||||
*
|
||||
* After that, the script tries to remove a file from the list. It tests if the list breaks and if so, it
|
||||
* assumes that the file it removed belongs to the set of errorneous files.
|
||||
* This is done for all files, so, in the end removing one file leads to a working doc build.
|
||||
* assumes that the file it removed belongs to the set of errorneous files.
|
||||
* This is done for all files, so, in the end removing one file leads to a working doc build.
|
||||
*
|
||||
* @package util
|
||||
* @author Alexander Kampmann
|
||||
|
@ -24,11 +24,11 @@
|
|||
|
||||
/**
|
||||
* This function generates a comma seperated list of file names.
|
||||
*
|
||||
*
|
||||
* @package util
|
||||
*
|
||||
*
|
||||
* @param array $fileset Set of file names
|
||||
*
|
||||
*
|
||||
* @return string comma-seperated list of the file names
|
||||
*/
|
||||
function namesList($fileset) {
|
||||
|
@ -42,9 +42,9 @@ function namesList($fileset) {
|
|||
/**
|
||||
* This functions runs phpdoc on the provided list of files
|
||||
* @package util
|
||||
*
|
||||
*
|
||||
* @param array $fileset Set of filenames
|
||||
*
|
||||
*
|
||||
* @return bool true, if that set can be built
|
||||
*/
|
||||
function runs($fileset) {
|
||||
|
@ -65,12 +65,12 @@ function runs($fileset) {
|
|||
* it was meant to be recursive, but php's maximum stack size is to small. So it just simulates recursion.
|
||||
*
|
||||
* In that version, it does not necessarily generate the smallest set, because it may not alter the elements order enough.
|
||||
*
|
||||
*
|
||||
* @package util
|
||||
*
|
||||
*
|
||||
* @param array $fileset set of filenames
|
||||
* @param int $ps number of files in subsets
|
||||
*
|
||||
*
|
||||
* @return array a part of $fileset, that crashes
|
||||
*/
|
||||
function reduce($fileset, $ps) {
|
||||
|
@ -80,18 +80,18 @@ function reduce($fileset, $ps) {
|
|||
$parts=array_filter($parts, "runs");
|
||||
//melt remaining parts together
|
||||
if(is_array($parts)) {
|
||||
return array_reduce($parts, "array_merge", array());
|
||||
return array_reduce($parts, "array_merge", []);
|
||||
}
|
||||
return array();
|
||||
return [];
|
||||
};
|
||||
|
||||
//return from util folder to frindica base dir
|
||||
$dir='..';
|
||||
|
||||
//stack for dirs to search
|
||||
$dirstack=array();
|
||||
$dirstack=[];
|
||||
//list of source files
|
||||
$filelist=array();
|
||||
$filelist=[];
|
||||
|
||||
//loop over all files in $dir
|
||||
while($dh=opendir($dir)) {
|
||||
|
@ -131,7 +131,7 @@ do {
|
|||
} while(count($res)<$i);
|
||||
|
||||
//check one file after another
|
||||
$needed=array();
|
||||
$needed=[];
|
||||
|
||||
while(count($res)!=0) {
|
||||
$file=array_pop($res);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
$arr = array();
|
||||
$arr = [];
|
||||
|
||||
$files = array('index.php','boot.php');
|
||||
$files = ['index.php','boot.php'];
|
||||
$files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*'));
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
preg_match_all($pat,$str,$matches);
|
||||
preg_match_all($patt, $str, $matchestt);
|
||||
|
||||
|
||||
|
||||
if(count($matches)){
|
||||
foreach($matches[1] as $match) {
|
||||
|
@ -51,7 +51,7 @@ function string_plural_select($n){
|
|||
$s .= ");\n";
|
||||
} else {
|
||||
if(substr($a,0,1) == '$')
|
||||
continue;
|
||||
continue;
|
||||
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
|
||||
}
|
||||
}
|
||||
|
@ -59,5 +59,5 @@ function string_plural_select($n){
|
|||
$zones = timezone_identifiers_list();
|
||||
foreach($zones as $zone)
|
||||
$s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
|
||||
|
||||
|
||||
echo $s;
|
|
@ -58,7 +58,7 @@ if ((isset($title)) && (isset($text)) && (isset($url))) {
|
|||
}
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
|
||||
if (($_POST["friendica_acct_name"] != '') && ($_POST["friendica_password"] != '')) {
|
||||
$acctname = $_POST["friendica_acct_name"];
|
||||
$tmp_account_array = explode("@", $acctname);
|
||||
|
@ -70,32 +70,32 @@ if (isset($_POST['submit'])) {
|
|||
$content = $_POST["content"];
|
||||
|
||||
$url = "http://" . $hostname . '/api/statuses/update';
|
||||
$data = array('status' => $content);
|
||||
|
||||
$data = ['status' => $content];
|
||||
|
||||
// echo "posting to: $url<br/>";
|
||||
|
||||
$c = curl_init();
|
||||
curl_setopt($c, CURLOPT_URL, $url);
|
||||
curl_setopt($c, CURLOPT_URL, $url);
|
||||
curl_setopt($c, CURLOPT_USERPWD, "$username:$password");
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
||||
$c_result = curl_exec($c);
|
||||
if(curl_errno($c)){
|
||||
$c_result = curl_exec($c);
|
||||
if(curl_errno($c)){
|
||||
$error = curl_error($c);
|
||||
showForm($error, $content);
|
||||
}
|
||||
|
||||
|
||||
curl_close($c);
|
||||
if (!isset($error)) {
|
||||
echo '<script language="javascript" type="text/javascript">window.close();</script>';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$error = "Missing account name and/or password...try again please";
|
||||
showForm($error, $content);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
showForm(null, $content);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ if (isset($_POST['submit'])) {
|
|||
function showForm($error, $content) {
|
||||
$username_cookie = $_COOKIE['username'];
|
||||
$password_cookie = $_COOKIE['password'];
|
||||
|
||||
|
||||
echo <<<EOF
|
||||
<div class='wrap1'>
|
||||
<h2><img class='logo' src='friendica-32.png' align='middle';/>
|
||||
|
@ -121,7 +121,7 @@ function showForm($error, $content) {
|
|||
<p></p>
|
||||
</div>
|
||||
EOF;
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ unset($db_host, $db_user, $db_pass, $db_data);
|
|||
* 3. set the flag hidden=1 for the contact entry with the found ID
|
||||
**/
|
||||
$net = Probe::uri($argv[1]);
|
||||
if (in_array($net['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
|
||||
if (in_array($net['network'], [NETWORK_PHANTOM, NETWORK_MAIL])) {
|
||||
echo "This account seems not to exist.";
|
||||
echo "\r\n";
|
||||
exit(1);
|
||||
|
@ -59,7 +59,7 @@ if (in_array($net['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
|
|||
$nurl = normalise_link($net['url']);
|
||||
$contact = dba::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
|
||||
if (DBM::is_result($contact)) {
|
||||
dba::update("contact", array("hidden" => true), array("id" => $contact["id"]));
|
||||
dba::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
|
||||
echo "NOTICE: The account should be silenced from the global community page\r\n";
|
||||
} else {
|
||||
echo "NOTICE: Could not find any entry for this URL (".$nurl.")\r\n";
|
||||
|
|
|
@ -13,7 +13,7 @@ DEFINE("NORM_REGEXP", "|[\\\]|");
|
|||
|
||||
if(! class_exists('App')) {
|
||||
class TmpA {
|
||||
public $strings = Array();
|
||||
public $strings = [];
|
||||
}
|
||||
$a = new TmpA();
|
||||
}
|
||||
|
@ -91,10 +91,10 @@ $out .= "\n";
|
|||
print "\nLoading base message.po...";
|
||||
|
||||
// load base messages.po and extract msgids
|
||||
$base_msgids = array();
|
||||
$norm_base_msgids = array();
|
||||
$base_msgids = [];
|
||||
$norm_base_msgids = [];
|
||||
$base_f = file("util/messages.po") || die("No base messages.po\n");
|
||||
$_f = 0; $_mid = ""; $_mids = array();
|
||||
$_f = 0; $_mid = ""; $_mids = [];
|
||||
foreach( $base_f as $l) {
|
||||
$l = trim($l);
|
||||
//~ print $l."\n";
|
||||
|
@ -108,7 +108,7 @@ foreach( $base_f as $l) {
|
|||
|
||||
$_f = 0;
|
||||
$_mid = "";
|
||||
$_mids = array();
|
||||
$_mids = [];
|
||||
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ foreach( $base_f as $l) {
|
|||
if (startsWith($l, 'msgid ')) {
|
||||
$_f = 1;
|
||||
$_mid = str_replace('msgid ', '' , $l);
|
||||
$_mids = array($_mid);
|
||||
$_mids = [$_mid];
|
||||
//~ print "\t mid: $_mid \n";
|
||||
}
|
||||
//~ print "\t\t\t\t$_f\n\n";
|
||||
|
|
|
@ -44,7 +44,7 @@ function po2php_run(&$argv, &$argc) {
|
|||
$l = "";
|
||||
}
|
||||
if (substr($l, 0, 15) == '"Plural-Forms: ') {
|
||||
$match = array();
|
||||
$match = [];
|
||||
preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match);
|
||||
$cond = str_replace('n', '$n', $match[2]);
|
||||
// define plural select function if not already defined
|
||||
|
@ -82,9 +82,9 @@ function po2php_run(&$argv, &$argc) {
|
|||
|
||||
if (!$arr) {
|
||||
$arr=True;
|
||||
$out .= "array(\n";
|
||||
$out .= "[\n";
|
||||
}
|
||||
$match = array();
|
||||
$match = [];
|
||||
preg_match("|\[([0-9]*)\] (.*)|", $l, $match);
|
||||
$out .= "\t"
|
||||
. preg_replace_callback($escape_s_exp, 'escape_s', $match[1])
|
||||
|
@ -110,7 +110,7 @@ function po2php_run(&$argv, &$argc) {
|
|||
$out .= '"' . $v . '"';
|
||||
}
|
||||
if ($k != "") {
|
||||
$out .= ($arr) ? ");\n" : ";\n";
|
||||
$out .= ($arr) ? "];\n" : ";\n";
|
||||
}
|
||||
$arr = false;
|
||||
$k = str_replace("msgid ", "", $l);
|
||||
|
@ -138,7 +138,7 @@ function po2php_run(&$argv, &$argc) {
|
|||
$out .= '"' . $v . '"';
|
||||
}
|
||||
if ($k != "") {
|
||||
$out .= ($arr ? ");\n" : ";\n");
|
||||
$out .= ($arr ? "];\n" : ";\n");
|
||||
}
|
||||
|
||||
$out = str_replace(DQ_ESCAPE, '\"', $out);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
;
|
||||
$a->strings["%d contact edited."] = array(
|
||||
$a->strings["%d contact edited."] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["Could not access contact record."] = "";
|
||||
$a->strings["Could not locate selected profile."] = "";
|
||||
$a->strings["Contact updated."] = "";
|
||||
|
@ -29,10 +29,10 @@ $a->strings["(Update was successful)"] = "";
|
|||
$a->strings["(Update was not successful)"] = "";
|
||||
$a->strings["Suggest friends"] = "";
|
||||
$a->strings["Network type: %s"] = "";
|
||||
$a->strings["%d contact in common"] = array(
|
||||
$a->strings["%d contact in common"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["View all contacts"] = "";
|
||||
$a->strings["Unblock"] = "";
|
||||
$a->strings["Block"] = "";
|
||||
|
@ -347,10 +347,10 @@ $a->strings["You and %s"] = "";
|
|||
$a->strings["%s and You"] = "";
|
||||
$a->strings["Delete conversation"] = "";
|
||||
$a->strings["D, d M Y - g:i A"] = "";
|
||||
$a->strings["%d message"] = array(
|
||||
$a->strings["%d message"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["Message not available."] = "";
|
||||
$a->strings["Delete message"] = "";
|
||||
$a->strings["No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."] = "";
|
||||
|
@ -546,14 +546,14 @@ $a->strings["Attempt to execute this update step automatically"] = "";
|
|||
$a->strings["\n\t\t\tDear %1\$s,\n\t\t\t\tthe administrator of %2\$s has set up an account for you."] = "";
|
||||
$a->strings["\n\t\t\tThe login details are as follows:\n\n\t\t\tSite Location:\t%1\$s\n\t\t\tLogin Name:\t\t%2\$s\n\t\t\tPassword:\t\t%3\$s\n\n\t\t\tYou may change your password from your account \"Settings\" page after logging\n\t\t\tin.\n\n\t\t\tPlease take a few moments to review the other account settings on that page.\n\n\t\t\tYou may also wish to add some basic information to your default profile\n\t\t\t(on the \"Profiles\" page) so that other people can easily find you.\n\n\t\t\tWe recommend setting your full name, adding a profile photo,\n\t\t\tadding some profile \"keywords\" (very useful in making new friends) - and\n\t\t\tperhaps what country you live in; if you do not wish to be more specific\n\t\t\tthan that.\n\n\t\t\tWe fully respect your right to privacy, and none of these items are necessary.\n\t\t\tIf you are new and do not know anybody here, they may help\n\t\t\tyou to make some new and interesting friends.\n\n\t\t\tThank you and welcome to %4\$s."] = "";
|
||||
$a->strings["Registration details for %s"] = "";
|
||||
$a->strings["%s user blocked/unblocked"] = array(
|
||||
$a->strings["%s user blocked/unblocked"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
$a->strings["%s user deleted"] = array(
|
||||
];
|
||||
$a->strings["%s user deleted"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["User '%s' deleted"] = "";
|
||||
$a->strings["User '%s' unblocked"] = "";
|
||||
$a->strings["User '%s' blocked"] = "";
|
||||
|
@ -616,10 +616,10 @@ $a->strings["Shared Links"] = "";
|
|||
$a->strings["Interesting Links"] = "";
|
||||
$a->strings["Starred"] = "";
|
||||
$a->strings["Favourite Posts"] = "";
|
||||
$a->strings["Warning: This group contains %s member from an insecure network."] = array(
|
||||
$a->strings["Warning: This group contains %s member from an insecure network."] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["Private messages to this group are at risk of public disclosure."] = "";
|
||||
$a->strings["No such group"] = "";
|
||||
$a->strings["Group is empty"] = "";
|
||||
|
@ -653,14 +653,14 @@ $a->strings["Select"] = "";
|
|||
$a->strings["View %s's profile @ %s"] = "";
|
||||
$a->strings["%s from %s"] = "";
|
||||
$a->strings["View in context"] = "";
|
||||
$a->strings["%d comment"] = array(
|
||||
$a->strings["%d comment"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
$a->strings["comment"] = array(
|
||||
];
|
||||
$a->strings["comment"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["show more"] = "";
|
||||
$a->strings["Private Message"] = "";
|
||||
$a->strings["I like this (toggle)"] = "";
|
||||
|
@ -935,10 +935,10 @@ $a->strings["This introduction has already been accepted."] = "";
|
|||
$a->strings["Profile location is not valid or does not contain profile information."] = "";
|
||||
$a->strings["Warning: profile location has no identifiable owner name."] = "";
|
||||
$a->strings["Warning: profile location has no profile photo."] = "";
|
||||
$a->strings["%d required parameter was not found at the given location"] = array(
|
||||
$a->strings["%d required parameter was not found at the given location"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["Introduction complete."] = "";
|
||||
$a->strings["Unrecoverable protocol error."] = "";
|
||||
$a->strings["Profile unavailable."] = "";
|
||||
|
@ -1154,10 +1154,10 @@ $a->strings["%s : Not a valid email address."] = "";
|
|||
$a->strings["Please join us on Friendica"] = "";
|
||||
$a->strings["Invitation limit exceeded. Please contact your site administrator."] = "";
|
||||
$a->strings["%s : Message delivery failed."] = "";
|
||||
$a->strings["%d message sent."] = array(
|
||||
$a->strings["%d message sent."] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["You have no more invitations available"] = "";
|
||||
$a->strings["Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks."] = "";
|
||||
$a->strings["To accept this invitation, please visit and register at %s or any other public Friendica website."] = "";
|
||||
|
@ -1277,10 +1277,10 @@ $a->strings["The error message was:"] = "";
|
|||
$a->strings["Add New Contact"] = "";
|
||||
$a->strings["Enter address or web location"] = "";
|
||||
$a->strings["Example: bob@example.com, http://example.com/barbara"] = "";
|
||||
$a->strings["%d invitation available"] = array(
|
||||
$a->strings["%d invitation available"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["Find People"] = "";
|
||||
$a->strings["Enter name or interest"] = "";
|
||||
$a->strings["Connect/Follow"] = "";
|
||||
|
@ -1426,10 +1426,10 @@ $a->strings["first"] = "";
|
|||
$a->strings["last"] = "";
|
||||
$a->strings["next"] = "";
|
||||
$a->strings["No contacts"] = "";
|
||||
$a->strings["%d Contact"] = array(
|
||||
$a->strings["%d Contact"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["poke"] = "";
|
||||
$a->strings["ping"] = "";
|
||||
$a->strings["pinged"] = "";
|
||||
|
@ -1729,10 +1729,10 @@ $a->strings["Error! Cannot check nickname"] = "";
|
|||
$a->strings["User '%s' already exists on this server!"] = "";
|
||||
$a->strings["User creation error"] = "";
|
||||
$a->strings["User profile creation error"] = "";
|
||||
$a->strings["%d contact not imported"] = array(
|
||||
$a->strings["%d contact not imported"] = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
);
|
||||
];
|
||||
$a->strings["Done. You can now login with your username and password"] = "";
|
||||
$a->strings["toggle mobile"] = "";
|
||||
$a->strings["Theme settings"] = "";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue