mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-18 09:48:39 +01:00
Promote 2023.23 to Stable
This commit is contained in:
commit
52be52d429
204 changed files with 947 additions and 978 deletions
15
externals/cowsay/INSTALL
vendored
15
externals/cowsay/INSTALL
vendored
|
@ -1,15 +0,0 @@
|
|||
=================
|
||||
Installing cowsay
|
||||
=================
|
||||
|
||||
If you really want to get things installed a nice and pretty way,
|
||||
|
||||
sh install.sh
|
||||
|
||||
It will ask approximately one question. If you can't answer it,
|
||||
you need serious help.
|
||||
|
||||
If the install goes well, you can start cowing immediately! Just
|
||||
be sure to read the manual page first...
|
||||
|
||||
$Id: INSTALL,v 1.1 1999/08/14 08:03:17 tony Exp $
|
11
externals/cowsay/MANIFEST
vendored
11
externals/cowsay/MANIFEST
vendored
|
@ -1,11 +0,0 @@
|
|||
ChangeLog Changes to recent versions.
|
||||
INSTALL Instructions for installing cowsay.
|
||||
LICENSE The license for use and redistribution of cowsay.
|
||||
MANIFEST This file.
|
||||
README Read this first. Really.
|
||||
Wrap.pm.diff Diff for Text/Wrap.pm.
|
||||
cows/* Support files used by cowsay.
|
||||
cowsay Main cowsay executable.
|
||||
cowsay.1 Main cowsay manual page.
|
||||
install.sh cowsay installation script.
|
||||
pgp_public_key.txt Verify the signature file with this key.
|
8
externals/cowsay/README
vendored
8
externals/cowsay/README
vendored
|
@ -36,3 +36,11 @@ this directory.
|
|||
-- Tony Monroe (tony@nog.net)
|
||||
|
||||
$Id: README,v 1.3 2000/05/28 06:24:46 tony Exp $
|
||||
|
||||
----
|
||||
|
||||
In September 2015, Phabricator imported the Perl version of cowsay
|
||||
in the core, to use its nice template files. Anyway, the logic now
|
||||
is not in Perl. It was re-implemented in PHP, here:
|
||||
|
||||
src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
|
||||
|
|
47
externals/cowsay/Wrap.pm.diff
vendored
47
externals/cowsay/Wrap.pm.diff
vendored
|
@ -1,47 +0,0 @@
|
|||
*** Wrap.pm.in Thu May 22 00:21:42 1997
|
||||
--- Wrap.pm Fri Nov 12 10:00:15 1999
|
||||
***************
|
||||
*** 3,9 ****
|
||||
require Exporter;
|
||||
|
||||
@ISA = (Exporter);
|
||||
! @EXPORT = qw(wrap);
|
||||
@EXPORT_OK = qw($columns);
|
||||
|
||||
$VERSION = 97.011701;
|
||||
--- 3,9 ----
|
||||
require Exporter;
|
||||
|
||||
@ISA = (Exporter);
|
||||
! @EXPORT = qw(wrap fill);
|
||||
@EXPORT_OK = qw($columns);
|
||||
|
||||
$VERSION = 97.011701;
|
||||
***************
|
||||
*** 66,71 ****
|
||||
--- 66,90 ----
|
||||
|
||||
print "-----------$r---------\n" if $debug;;
|
||||
return $r;
|
||||
+ }
|
||||
+
|
||||
+ ## Copied up from below.
|
||||
+ sub fill
|
||||
+ {
|
||||
+ my ($ip, $xp, @raw) = @_;
|
||||
+ my @para;
|
||||
+ my $pp;
|
||||
+
|
||||
+ for $pp (split(/\n\s+/, join("\n",@raw))) {
|
||||
+ $pp =~ s/\s+/ /g;
|
||||
+ my $x = wrap($ip, $xp, $pp);
|
||||
+ push(@para, $x);
|
||||
+ }
|
||||
+
|
||||
+ # if paragraph_indent is the same as line_indent,
|
||||
+ # separate paragraphs with blank lines
|
||||
+
|
||||
+ return join ($ip eq $xp ? "\n\n" : "\n", @para);
|
||||
}
|
||||
|
||||
1;
|
187
externals/cowsay/cowsay
vendored
187
externals/cowsay/cowsay
vendored
|
@ -1,187 +0,0 @@
|
|||
#%BANGPERL%
|
||||
|
||||
##
|
||||
## Cowsay 3.03
|
||||
##
|
||||
## This file is part of cowsay. (c) 1999-2000 Tony Monroe.
|
||||
##
|
||||
|
||||
use Text::Tabs qw(expand);
|
||||
use Text::Wrap qw(wrap fill $columns);
|
||||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use Cwd;
|
||||
|
||||
$version = "3.03";
|
||||
$progname = basename($0);
|
||||
$eyes = "oo";
|
||||
$tongue = " ";
|
||||
$cowpath = $ENV{'COWPATH'} || '%PREFIX%/share/cows';
|
||||
@message = ();
|
||||
$thoughts = "";
|
||||
|
||||
## Yeah, this is rude, I know. But hopefully it gets around a nasty
|
||||
## little version dependency.
|
||||
|
||||
$Text::Wrap::initial_tab = 8;
|
||||
$Text::Wrap::subsequent_tab = 8;
|
||||
$Text::Wrap::tabstop = 8;
|
||||
|
||||
## One of these days, we'll get it ported to Windows. Yeah, right.
|
||||
|
||||
if (($^O eq "MSWin32") or ($^O eq "Windows_NT")) { ## Many perls, eek!
|
||||
$pathsep = ';';
|
||||
} else {
|
||||
$pathsep = ':';
|
||||
}
|
||||
|
||||
%opts = (
|
||||
'e' => 'oo',
|
||||
'f' => 'default.cow',
|
||||
'n' => 0,
|
||||
'T' => ' ',
|
||||
'W' => 40,
|
||||
);
|
||||
|
||||
getopts('bde:f:ghlLnNpstT:wW:y', \%opts);
|
||||
|
||||
&display_usage if $opts{'h'};
|
||||
&list_cowfiles if $opts{'l'};
|
||||
|
||||
$borg = $opts{'b'};
|
||||
$dead = $opts{'d'};
|
||||
$greedy = $opts{'g'};
|
||||
$paranoid = $opts{'p'};
|
||||
$stoned = $opts{'s'};
|
||||
$tired = $opts{'t'};
|
||||
$wired = $opts{'w'};
|
||||
$young = $opts{'y'};
|
||||
$eyes = substr($opts{'e'}, 0, 2);
|
||||
$tongue = substr($opts{'T'}, 0, 2);
|
||||
$the_cow = "";
|
||||
|
||||
&slurp_input;
|
||||
$Text::Wrap::columns = $opts{'W'};
|
||||
@message = ($opts{'n'} ? expand(@message) :
|
||||
split("\n", fill("", "", @message)));
|
||||
&construct_balloon;
|
||||
&construct_face;
|
||||
&get_cow;
|
||||
print @balloon_lines;
|
||||
print $the_cow;
|
||||
|
||||
sub list_cowfiles {
|
||||
my $basedir;
|
||||
my @dirfiles;
|
||||
chop($basedir = cwd);
|
||||
for my $d (split(/$pathsep/, $cowpath)) {
|
||||
print "Cow files in $d:\n";
|
||||
opendir(COWDIR, $d) || die "$0: Cannot open $d\n";
|
||||
for my $file (readdir COWDIR) {
|
||||
if ($file =~ s/\.cow$//) {
|
||||
push(@dirfiles, $file);
|
||||
}
|
||||
}
|
||||
closedir(COWDIR);
|
||||
print wrap("", "", sort @dirfiles), "\n";
|
||||
@dirfiles = ();
|
||||
chdir($basedir);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
sub slurp_input {
|
||||
unless ($ARGV[0]) {
|
||||
chomp(@message = <STDIN>);
|
||||
} else {
|
||||
&display_usage if $opts{'n'};
|
||||
@message = join(' ', @ARGV);
|
||||
}
|
||||
}
|
||||
|
||||
sub maxlength {
|
||||
my ($l, $m);
|
||||
$m = -1;
|
||||
for my $i (@_) {
|
||||
$l = length $i;
|
||||
$m = $l if ($l > $m);
|
||||
}
|
||||
return $m;
|
||||
}
|
||||
|
||||
sub construct_balloon {
|
||||
my $max = &maxlength(@message);
|
||||
my $max2 = $max + 2; ## border space fudge.
|
||||
my $format = "%s %-${max}s %s\n";
|
||||
my @border; ## up-left, up-right, down-left, down-right, left, right
|
||||
if ($0 =~ /think/i) {
|
||||
$thoughts = 'o';
|
||||
@border = qw[ ( ) ( ) ( ) ];
|
||||
} elsif (@message < 2) {
|
||||
$thoughts = '\\';
|
||||
@border = qw[ < > ];
|
||||
} else {
|
||||
$thoughts = '\\';
|
||||
if ($V and $V gt v5.6.0) { # Thanks, perldelta.
|
||||
@border = qw[ / \\ \\ / | | ];
|
||||
} else {
|
||||
@border = qw[ / \ \ / | | ];
|
||||
}
|
||||
}
|
||||
push(@balloon_lines,
|
||||
" " . ("_" x $max2) . " \n" ,
|
||||
sprintf($format, $border[0], $message[0], $border[1]),
|
||||
(@message < 2 ? "" :
|
||||
map { sprintf($format, $border[4], $_, $border[5]) }
|
||||
@message[1 .. $#message - 1]),
|
||||
(@message < 2 ? "" :
|
||||
sprintf($format, $border[2], $message[$#message], $border[3])),
|
||||
" " . ("-" x $max2) . " \n"
|
||||
);
|
||||
}
|
||||
|
||||
sub construct_face {
|
||||
if ($borg) { $eyes = "=="; }
|
||||
if ($dead) { $eyes = "xx"; $tongue = "U "; }
|
||||
if ($greedy) { $eyes = "\$\$"; }
|
||||
if ($paranoid) { $eyes = "@@"; }
|
||||
if ($stoned) { $eyes = "**"; $tongue = "U "; }
|
||||
if ($tired) { $eyes = "--"; }
|
||||
if ($wired) { $eyes = "OO"; }
|
||||
if ($young) { $eyes = ".."; }
|
||||
}
|
||||
|
||||
sub get_cow {
|
||||
##
|
||||
## Get a cow from the specified cowfile; otherwise use the default cow
|
||||
## which was defined above in $the_cow.
|
||||
##
|
||||
my $f = $opts{'f'};
|
||||
my $full = "";
|
||||
if ($opts{'f'} =~ m,/,) {
|
||||
$full = $opts{'f'};
|
||||
} else {
|
||||
for my $d (split(/:/, $cowpath)) {
|
||||
if (-f "$d/$f") {
|
||||
$full = "$d/$f";
|
||||
last;
|
||||
} elsif (-f "$d/$f.cow") {
|
||||
$full = "$d/$f.cow";
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($full eq "") {
|
||||
die "$progname: Could not find $f cowfile!\n";
|
||||
}
|
||||
}
|
||||
do $full;
|
||||
die "$progname: $@\n" if $@;
|
||||
}
|
||||
|
||||
sub display_usage {
|
||||
die <<EOF;
|
||||
cow{say,think} version $version, (c) 1999 Tony Monroe
|
||||
Usage: $progname [-bdgpstwy] [-h] [-e eyes] [-f cowfile]
|
||||
[-l] [-n] [-T tongue] [-W wrapcolumn] [message]
|
||||
EOF
|
||||
}
|
168
externals/cowsay/cowsay.1
vendored
168
externals/cowsay/cowsay.1
vendored
|
@ -1,168 +0,0 @@
|
|||
.\"
|
||||
.\" cowsay.1
|
||||
.\"
|
||||
.\" $Id: cowsay.1,v 1.4 1999/11/04 19:50:40 tony Exp $
|
||||
.\"
|
||||
.\" This file is part of cowsay. (c) 1999 Tony Monroe.
|
||||
.\"
|
||||
.ds Nm Cowsay
|
||||
.ds nm cowsay
|
||||
.ds Vn 3.02
|
||||
.TH \*(nm 1 "$Date: 1999/11/04 19:50:40 $"
|
||||
.SH NAME
|
||||
\*(nm/cowthink \- configurable speaking/thinking cow (and a bit more)
|
||||
.SH SYNOPSIS
|
||||
cowsay
|
||||
.RB [ \-e
|
||||
.IR eye_string ]
|
||||
.RB [ \-f
|
||||
.IR cowfile ]
|
||||
.RB [ \-h ]
|
||||
.RB [ \-l ]
|
||||
.RB [ \-n ]
|
||||
.RB [ \-T
|
||||
.IR tongue_string ]
|
||||
.RB [ \-W
|
||||
.IR column ]
|
||||
.RB [ \-bdgpstwy ]
|
||||
.SH DESCRIPTION
|
||||
.I Cowsay
|
||||
generates an ASCII picture of a cow saying something provided by the
|
||||
user. If run with no arguments, it accepts standard input, word-wraps
|
||||
the message given at about 40 columns, and prints the cow saying the
|
||||
given message on standard output.
|
||||
.PP
|
||||
To aid in the use of arbitrary messages with arbitrary whitespace,
|
||||
use the
|
||||
.B \-n
|
||||
option. If it is specified, the given message will not be
|
||||
word-wrapped. This is possibly useful if you want to make the cow
|
||||
think or speak in figlet(6). If
|
||||
.B \-n
|
||||
is specified, there must not be any command-line arguments left
|
||||
after all the switches have been processed.
|
||||
.PP
|
||||
The
|
||||
.B \-W
|
||||
specifies roughly (where the message should be wrapped. The default
|
||||
is equivalent to
|
||||
.B \-W 40
|
||||
i.e. wrap words at or before the 40th column.
|
||||
.PP
|
||||
If any command-line arguments are left over after all switches have
|
||||
been processed, they become the cow's message. The program will not
|
||||
accept standard input for a message in this case.
|
||||
.PP
|
||||
There are several provided modes which change the appearance of the
|
||||
cow depending on its particular emotional/physical state. The
|
||||
.B \-b
|
||||
option initiates Borg mode;
|
||||
.B \-d
|
||||
causes the cow to appear dead;
|
||||
.B \-g
|
||||
invokes greedy mode;
|
||||
.B \-p
|
||||
causes a state of paranoia to come over the cow;
|
||||
.B \-s
|
||||
makes the cow appear thoroughly stoned;
|
||||
.B \-t
|
||||
yields a tired cow;
|
||||
.B \-w
|
||||
is somewhat the opposite of
|
||||
.BR \-t ,
|
||||
and initiates wired mode;
|
||||
.B \-y
|
||||
brings on the cow's youthful appearance.
|
||||
.PP
|
||||
The user may specify the
|
||||
.B \-e
|
||||
option to select the appearance of the cow's eyes, in which case
|
||||
the first two characters of the argument string
|
||||
.I eye_string
|
||||
will be used. The default eyes are 'oo'. The tongue is similarly
|
||||
configurable through
|
||||
.B \-T
|
||||
and
|
||||
.IR tongue_string ;
|
||||
it must be two characters and does not appear by default. However,
|
||||
it does appear in the 'dead' and 'stoned' modes. Any configuration
|
||||
done by
|
||||
.B \-e
|
||||
and
|
||||
.B \-T
|
||||
will be lost if one of the provided modes is used.
|
||||
.PP
|
||||
The
|
||||
.B \-f
|
||||
option specifies a particular cow picture file (``cowfile'') to
|
||||
use. If the cowfile spec contains '/' then it will be interpreted
|
||||
as a path relative to the current directory. Otherwise, cowsay
|
||||
will search the path specified in the
|
||||
.B COWPATH
|
||||
environment variable.
|
||||
To list all cowfiles on the current
|
||||
.BR COWPATH ,
|
||||
invoke
|
||||
.B \*(nm
|
||||
with the
|
||||
.B \-l
|
||||
switch.
|
||||
.PP
|
||||
If the program is invoked as
|
||||
.B cowthink
|
||||
then the cow will think its message instead of saying it.
|
||||
.PP
|
||||
.SH COWFILE FORMAT
|
||||
A cowfile is made up of a simple block of
|
||||
.BR perl (1)
|
||||
code, which assigns a picture of a cow to the variable
|
||||
.BR $the_cow .
|
||||
Should you wish to customize the eyes or the tongue of the cow,
|
||||
then the variables
|
||||
.B $eyes
|
||||
and
|
||||
.B $tongue
|
||||
may be used. The trail leading up to the cow's message balloon is
|
||||
composed of the character(s) in the
|
||||
.B $thoughts
|
||||
variable. Any backslashes must be reduplicated to prevent
|
||||
interpolation. The name of a cowfile should end with
|
||||
.BR .cow ,
|
||||
otherwise it is assumed not to be a cowfile. Also, at-signs (``@'')
|
||||
must be backslashed because that is what Perl 5 expects.
|
||||
.PP
|
||||
.SH COMPATIBILITY WITH OLDER VERSIONS
|
||||
.PP
|
||||
What older versions? :-)
|
||||
.PP
|
||||
Version 3.x is fully backward-compatible with 2.x versions. If
|
||||
you're still using a 1.x version, consider upgrading. And tell me
|
||||
where you got the older versions, since I didn't exactly put them
|
||||
up for world-wide access.
|
||||
.PP
|
||||
Oh, just so you know, this manual page documents version \*(Vn of
|
||||
cowsay.
|
||||
.SH ENVIRONMENT
|
||||
The COWPATH environment variable, if present, will be used to search
|
||||
for cowfiles. It contains a colon-separated list of directories,
|
||||
much like
|
||||
.B PATH or
|
||||
.BR MANPATH .
|
||||
It should always contain the
|
||||
.B /usr/local/share/cows
|
||||
directory, or at least a directory with a file called
|
||||
.B default.cow
|
||||
in it.
|
||||
.SH FILES
|
||||
.B %PREFIX%/share/cows
|
||||
holds a sample set of cowfiles. If your
|
||||
.B COWPATH
|
||||
is not explicitly set, it automatically contains this directory.
|
||||
.SH BUGS
|
||||
If there are any, please notify the author at the address below.
|
||||
.SH AUTHOR
|
||||
Tony Monroe (tony@nog.net), with suggestions from Shannon
|
||||
Appel (appel@CSUA.Berkeley.EDU) and contributions from Anthony Polito
|
||||
(aspolito@CSUA.Berkeley.EDU).
|
||||
.SH SEE ALSO
|
||||
perl(1), wall(1), nwrite(1), figlet(6)
|
92
externals/cowsay/install.sh
vendored
92
externals/cowsay/install.sh
vendored
|
@ -1,92 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
##
|
||||
## install.sh
|
||||
##
|
||||
## Installation script for cowsay.
|
||||
##
|
||||
## $Id: install.sh,v 1.5 1999/11/01 20:19:21 tony Exp $
|
||||
##
|
||||
## This file is part of cowsay. (c) 1999 Tony Monroe.
|
||||
##
|
||||
|
||||
rcs_id='$Id: install.sh,v 1.5 1999/11/01 20:19:21 tony Exp $'
|
||||
|
||||
filelist='cows'
|
||||
|
||||
cat <<DOG
|
||||
===================
|
||||
cowsay Installation
|
||||
===================
|
||||
|
||||
Searching for useful perl executables...
|
||||
DOG
|
||||
|
||||
backdoor=$1
|
||||
|
||||
pathdirs=`echo $PATH | tr : " "`
|
||||
for p in $pathdirs; do
|
||||
set $p/perl $p/perl5*
|
||||
while [ ! -z "$1" ]; do
|
||||
if [ -x "$1" ]; then
|
||||
echo Found perl in $1
|
||||
perls="$perls $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
done
|
||||
for perl in $perls; do
|
||||
if $perl -MText::Wrap -e0 >/dev/null 2>&1; then
|
||||
echo Found a good perl in $perl
|
||||
goodperls="$goodperls $perl"
|
||||
fi
|
||||
done
|
||||
echo The following perl executables will run cowsay:
|
||||
echo $goodperls
|
||||
echo I recommend the latest stable perl you can find.
|
||||
set $goodperls
|
||||
if [ -z "$1" ]; then
|
||||
echo Ack! You do not have Perl 5 installed correctly!
|
||||
echo Get thee to CPAN!
|
||||
exit 1
|
||||
fi
|
||||
usethisperl=$1
|
||||
echo I will be using $1 because I know it will work.
|
||||
|
||||
echo Now I need an installation prefix. I will use /usr/local unless
|
||||
printf "you give me a better idea here: "
|
||||
if [ -n "$backdoor" ]; then
|
||||
prefix=$backdoor
|
||||
printf "%s (specified on command line)\n" $prefix
|
||||
else
|
||||
read prefix
|
||||
fi
|
||||
|
||||
PREFIX=${prefix:-/usr/local}
|
||||
|
||||
echo Okay, time to install this puppy.
|
||||
|
||||
echo s,%BANGPERL%,!$usethisperl,\; > install.pl
|
||||
echo s,%PREFIX%,$PREFIX,\; >> install.pl
|
||||
set -x
|
||||
mkdir -p $PREFIX/bin || (mkdir $PREFIX; mkdir $PREFIX/bin)
|
||||
$usethisperl -p install.pl cowsay > $PREFIX/bin/cowsay
|
||||
chmod a+x $PREFIX/bin/cowsay
|
||||
ln -s cowsay $PREFIX/bin/cowthink
|
||||
mkdir -p $PREFIX/man/man1 || ($mkdir $PREFIX; mkdir $PREFIX/man; mkdir $PREFIX/man/man1)
|
||||
$usethisperl -p install.pl cowsay.1 > $PREFIX/man/man1/cowsay.1
|
||||
chmod a+r $PREFIX/man/man1/cowsay.1
|
||||
ln -s cowsay.1 $PREFIX/man/man1/cowthink.1
|
||||
mkdir -p $PREFIX/share/cows || (mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/cows)
|
||||
tar -cf - $filelist | (cd $PREFIX/share && tar -xvf -)
|
||||
set +x
|
||||
|
||||
echo Okay, let us see if the install actually worked.
|
||||
|
||||
if [ ! -f $PREFIX/share/cows/default.cow ]; then
|
||||
echo The default cow file did not make it across!
|
||||
echo Ooops, it failed...sorry!
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Installation complete! Enjoy the cows!
|
14
externals/cowsay/pgp_public_key.txt
vendored
14
externals/cowsay/pgp_public_key.txt
vendored
|
@ -1,14 +0,0 @@
|
|||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: 2.6.2
|
||||
|
||||
mQCNAzNS+H4AAAEEAMilCcxLMIqMNXhZoeHjbeJGnHoKP0JpKDejz66qBlDwP+du
|
||||
FvVBHkyNIuU3orKe7l/aXIR8TcpjrxdcmrjjzwuB1aV48V4swT7v9UXvv9YP41Pd
|
||||
1pXYXNelXHmE0eKSfcnkkFmYTJBXPaPNTJ3rpZpZOEW3SfgrrheqQm6w/6IJAAUR
|
||||
tBpUb255IE1vbnJvZSA8dG9ueUBub2cubmV0PrQdVG9ueSBNb25yb2UgPHRtb25y
|
||||
b2VAbm9nLm5ldD6JAJUDBRA2bDA5F6pCbrD/ogkBASOZA/9XtYSpcPjpi62MTEZl
|
||||
l+wV1svtlUlPvKkDE7FB9bwnMbF1FgGhTe/H4/8qDu20m5eGxMX58Ri7HPXWjjJ/
|
||||
CrUWMzGVbg1JBkgh+d9QvEywmR0j4WezaifW1nCbxk0GrW1PjJyGb3kx7vrIF1Km
|
||||
xt6VwxTgfJzjIioBJFb4EiDyaLQnVG9ueSBNb25yb2UgPHRtb25yb2VAQ1NVQS5C
|
||||
ZXJrZWxleS5FRFU+
|
||||
=WpM4
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
27
externals/pear-figlet/Text/Figlet.php
vendored
27
externals/pear-figlet/Text/Figlet.php
vendored
|
@ -140,20 +140,23 @@ class Text_Figlet
|
|||
if (!$compressed) {
|
||||
/* ZIPed font */
|
||||
if (fread($fp, 2) == 'PK') {
|
||||
if (!function_exists('zip_open')) {
|
||||
return self::raiseError('Cannot load ZIP compressed fonts since'
|
||||
. ' ZIP PHP extension is not available.',
|
||||
5);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
if (!($fp = zip_open($filename))) {
|
||||
return self::raiseError('Cannot open figlet font file ' . $filename, 2);
|
||||
$zip = new ZipArchive();
|
||||
|
||||
$zip_flags = 0;
|
||||
if(defined('ZipArchive::RDONLY')) {
|
||||
$zip_flags = ZipArchive::RDONLY; // Flag available since PHP 7.4, unnecessary before
|
||||
}
|
||||
|
||||
$name = zip_entry_name(zip_read($fp));
|
||||
zip_close($fp);
|
||||
$open_result = $zip->open($filename, $zip_flags);
|
||||
if ($open_result !== true) {
|
||||
return self::raiseError('Cannot open figlet font file ' .
|
||||
$filename . ', got error: ' . $open_result, 2);
|
||||
}
|
||||
|
||||
$name = $zip->getNameIndex(0);
|
||||
$zip->close();
|
||||
|
||||
if (!($fp = fopen('zip://' . realpath($filename) . '#' . $name, 'rb'))) {
|
||||
return self::raiseError('Cannot open figlet font file ' . $filename, 2);
|
||||
|
@ -231,7 +234,7 @@ class Text_Figlet
|
|||
$i = hexdec(substr($i, 2));
|
||||
} else {
|
||||
// If octal
|
||||
if ($i{0} === '0' && $i !== '0' || substr($i, 0, 2) == '-0') {
|
||||
if ($i[0] === '0' && $i !== '0' || substr($i, 0, 2) == '-0') {
|
||||
$i = octdec($i);
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +277,7 @@ class Text_Figlet
|
|||
$lt = hexdec(substr($str, $i+2, 4));
|
||||
$i += 5;
|
||||
} else {
|
||||
$lt = ord($str{$i});
|
||||
$lt = ord($str[$i]);
|
||||
}
|
||||
|
||||
$hb = preg_quote($this->hardblank, '/');
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
*/
|
||||
return array(
|
||||
'names' => array(
|
||||
'conpherence.pkg.css' => '0e3cf785',
|
||||
'conpherence.pkg.css' => '76ed87e3',
|
||||
'conpherence.pkg.js' => '020aebcf',
|
||||
'core.pkg.css' => 'b239afaa',
|
||||
'core.pkg.js' => '66c49ca1',
|
||||
'core.pkg.css' => '0cb47e9d',
|
||||
'core.pkg.js' => '2eeda9e0',
|
||||
'dark-console.pkg.js' => '187792c2',
|
||||
'differential.pkg.css' => '609e63d4',
|
||||
'differential.pkg.js' => 'c60bec1b',
|
||||
'differential.pkg.css' => '525f9a1d',
|
||||
'differential.pkg.js' => '46fcb3af',
|
||||
'diffusion.pkg.css' => '42c75c37',
|
||||
'diffusion.pkg.js' => '78c9885d',
|
||||
'maniphest.pkg.css' => '35995d6d',
|
||||
|
@ -41,7 +41,7 @@ return array(
|
|||
'rsrc/css/application/base/main-menu-view.css' => '89fc16b6',
|
||||
'rsrc/css/application/base/notification-menu.css' => '4df1ee30',
|
||||
'rsrc/css/application/base/phui-theme.css' => '35883b37',
|
||||
'rsrc/css/application/base/standard-page-view.css' => 'a374f94c',
|
||||
'rsrc/css/application/base/standard-page-view.css' => 'e08c7462',
|
||||
'rsrc/css/application/chatlog/chatlog.css' => 'abdc76ee',
|
||||
'rsrc/css/application/conduit/conduit-api.css' => 'ce2cfc41',
|
||||
'rsrc/css/application/config/config-options.css' => '16c920ae',
|
||||
|
@ -53,7 +53,7 @@ return array(
|
|||
'rsrc/css/application/conpherence/header-pane.css' => 'c9a3db8e',
|
||||
'rsrc/css/application/conpherence/menu.css' => '67f4680d',
|
||||
'rsrc/css/application/conpherence/message-pane.css' => 'd244db1e',
|
||||
'rsrc/css/application/conpherence/notification.css' => '6a3d4e58',
|
||||
'rsrc/css/application/conpherence/notification.css' => '85c48def',
|
||||
'rsrc/css/application/conpherence/participant-pane.css' => '69e0058a',
|
||||
'rsrc/css/application/conpherence/transaction.css' => '3a3f5e7e',
|
||||
'rsrc/css/application/contentsource/content-source-view.css' => 'cdf0d579',
|
||||
|
@ -63,7 +63,7 @@ return array(
|
|||
'rsrc/css/application/diff/diff-tree-view.css' => 'e2d3e222',
|
||||
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
|
||||
'rsrc/css/application/differential/add-comment.css' => '7e5900d9',
|
||||
'rsrc/css/application/differential/changeset-view.css' => 'bf159129',
|
||||
'rsrc/css/application/differential/changeset-view.css' => '8b9caefe',
|
||||
'rsrc/css/application/differential/core.css' => '7300a73e',
|
||||
'rsrc/css/application/differential/phui-inline-comment.css' => 'a864426f',
|
||||
'rsrc/css/application/differential/revision-comment.css' => '7dbc8d1d',
|
||||
|
@ -77,7 +77,7 @@ return array(
|
|||
'rsrc/css/application/feed/feed.css' => 'd8b6e3f8',
|
||||
'rsrc/css/application/files/global-drag-and-drop.css' => '1d2713a4',
|
||||
'rsrc/css/application/flag/flag.css' => '2b77be8d',
|
||||
'rsrc/css/application/harbormaster/harbormaster.css' => 'd98decda',
|
||||
'rsrc/css/application/harbormaster/harbormaster.css' => 'cd0ce059',
|
||||
'rsrc/css/application/herald/herald-test.css' => '7e7bbdae',
|
||||
'rsrc/css/application/herald/herald.css' => '648d39e2',
|
||||
'rsrc/css/application/maniphest/report.css' => '3d53188b',
|
||||
|
@ -110,7 +110,7 @@ return array(
|
|||
'rsrc/css/application/tokens/tokens.css' => 'ce5a50bd',
|
||||
'rsrc/css/application/uiexample/example.css' => 'b4795059',
|
||||
'rsrc/css/core/core.css' => 'a708bd25',
|
||||
'rsrc/css/core/remarkup.css' => '5baa3bd9',
|
||||
'rsrc/css/core/remarkup.css' => '3480e1fe',
|
||||
'rsrc/css/core/syntax.css' => '548567f6',
|
||||
'rsrc/css/core/z-index.css' => 'ac3bfcd4',
|
||||
'rsrc/css/diviner/diviner-shared.css' => '4bd263b0',
|
||||
|
@ -121,10 +121,10 @@ return array(
|
|||
'rsrc/css/fuel/fuel-handle-list.css' => '2c4cbeca',
|
||||
'rsrc/css/fuel/fuel-map.css' => 'd6e31510',
|
||||
'rsrc/css/fuel/fuel-menu.css' => '21f5d199',
|
||||
'rsrc/css/layout/phabricator-source-code-view.css' => '6b31244f',
|
||||
'rsrc/css/layout/phabricator-source-code-view.css' => '49656486',
|
||||
'rsrc/css/phui/button/phui-button-bar.css' => 'a4aa75c4',
|
||||
'rsrc/css/phui/button/phui-button-simple.css' => '1ff278aa',
|
||||
'rsrc/css/phui/button/phui-button.css' => 'e434f171',
|
||||
'rsrc/css/phui/button/phui-button.css' => 'f9d0f9c8',
|
||||
'rsrc/css/phui/calendar/phui-calendar-day.css' => '9597d706',
|
||||
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'ccd7e4e2',
|
||||
'rsrc/css/phui/calendar/phui-calendar-month.css' => 'cb758c42',
|
||||
|
@ -133,12 +133,12 @@ return array(
|
|||
'rsrc/css/phui/object-item/phui-oi-color.css' => 'b517bfa0',
|
||||
'rsrc/css/phui/object-item/phui-oi-drag-ui.css' => 'da15d3dc',
|
||||
'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '490e2e2e',
|
||||
'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'af98a277',
|
||||
'rsrc/css/phui/object-item/phui-oi-list-view.css' => '9275ff55',
|
||||
'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => '6a30fa46',
|
||||
'rsrc/css/phui/phui-action-list.css' => '1b0085b2',
|
||||
'rsrc/css/phui/phui-action-panel.css' => '6c386cbf',
|
||||
'rsrc/css/phui/phui-badge.css' => '666e25ad',
|
||||
'rsrc/css/phui/phui-basic-nav-view.css' => '56ebd66d',
|
||||
'rsrc/css/phui/phui-basic-nav-view.css' => 'a5693cf0',
|
||||
'rsrc/css/phui/phui-big-info-view.css' => '362ad37b',
|
||||
'rsrc/css/phui/phui-box.css' => '5ed3b8cb',
|
||||
'rsrc/css/phui/phui-bulk-editor.css' => '374d5e30',
|
||||
|
@ -182,8 +182,8 @@ return array(
|
|||
'rsrc/css/phui/phui-two-column-view.css' => 'f96d319f',
|
||||
'rsrc/css/phui/workboards/phui-workboard-color.css' => '3a1c21ff',
|
||||
'rsrc/css/phui/workboards/phui-workboard.css' => '74fc9d98',
|
||||
'rsrc/css/phui/workboards/phui-workcard.css' => '913441b6',
|
||||
'rsrc/css/phui/workboards/phui-workpanel.css' => '3ae89b20',
|
||||
'rsrc/css/phui/workboards/phui-workcard.css' => '62056e3b',
|
||||
'rsrc/css/phui/workboards/phui-workpanel.css' => 'bc06f022',
|
||||
'rsrc/css/sprite-login.css' => '35d1510c',
|
||||
'rsrc/css/sprite-tokens.css' => 'f1896dc5',
|
||||
'rsrc/css/syntax/syntax-default.css' => '055fc231',
|
||||
|
@ -461,6 +461,7 @@ return array(
|
|||
'rsrc/js/core/MultirowRowManager.js' => '5b54c823',
|
||||
'rsrc/js/core/Notification.js' => 'a9b91e3f',
|
||||
'rsrc/js/core/Prefab.js' => '5793d835',
|
||||
'rsrc/js/core/RemarkupMetadata.js' => 'e40c4991',
|
||||
'rsrc/js/core/ShapedRequest.js' => '995f5102',
|
||||
'rsrc/js/core/TextAreaUtils.js' => 'f340a484',
|
||||
'rsrc/js/core/Title.js' => '43bc9360',
|
||||
|
@ -473,7 +474,7 @@ return array(
|
|||
'rsrc/js/core/behavior-copy.js' => 'cf32921f',
|
||||
'rsrc/js/core/behavior-detect-timezone.js' => '78bc5d94',
|
||||
'rsrc/js/core/behavior-device.js' => 'ac2b1e01',
|
||||
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '3277c62d',
|
||||
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6bc7ccf7',
|
||||
'rsrc/js/core/behavior-fancy-datepicker.js' => 'b545d0a0',
|
||||
'rsrc/js/core/behavior-form.js' => '55d7b788',
|
||||
'rsrc/js/core/behavior-gesture.js' => 'b58d1a2a',
|
||||
|
@ -489,7 +490,7 @@ return array(
|
|||
'rsrc/js/core/behavior-more.js' => '506aa3f4',
|
||||
'rsrc/js/core/behavior-object-selector.js' => '98ef467f',
|
||||
'rsrc/js/core/behavior-oncopy.js' => 'da8f5259',
|
||||
'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => '54262396',
|
||||
'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => '6d347847',
|
||||
'rsrc/js/core/behavior-read-only-warning.js' => 'b9109f8f',
|
||||
'rsrc/js/core/behavior-redirect.js' => '407ee861',
|
||||
'rsrc/js/core/behavior-refresh-csrf.js' => '46116c01',
|
||||
|
@ -553,13 +554,13 @@ return array(
|
|||
'conpherence-header-pane-css' => 'c9a3db8e',
|
||||
'conpherence-menu-css' => '67f4680d',
|
||||
'conpherence-message-pane-css' => 'd244db1e',
|
||||
'conpherence-notification-css' => '6a3d4e58',
|
||||
'conpherence-notification-css' => '85c48def',
|
||||
'conpherence-participant-pane-css' => '69e0058a',
|
||||
'conpherence-thread-manager' => 'aec8e38c',
|
||||
'conpherence-transaction-css' => '3a3f5e7e',
|
||||
'd3' => '9d068042',
|
||||
'diff-tree-view-css' => 'e2d3e222',
|
||||
'differential-changeset-view-css' => 'bf159129',
|
||||
'differential-changeset-view-css' => '8b9caefe',
|
||||
'differential-core-view-css' => '7300a73e',
|
||||
'differential-revision-add-comment-css' => '7e5900d9',
|
||||
'differential-revision-comment-css' => '7dbc8d1d',
|
||||
|
@ -578,7 +579,7 @@ return array(
|
|||
'fuel-map-css' => 'd6e31510',
|
||||
'fuel-menu-css' => '21f5d199',
|
||||
'global-drag-and-drop-css' => '1d2713a4',
|
||||
'harbormaster-css' => 'd98decda',
|
||||
'harbormaster-css' => 'cd0ce059',
|
||||
'herald-css' => '648d39e2',
|
||||
'herald-rule-editor' => '2633bef7',
|
||||
'herald-test-css' => '7e7bbdae',
|
||||
|
@ -589,7 +590,7 @@ return array(
|
|||
'javelin-behavior-aphlict-listen' => '4e61fa88',
|
||||
'javelin-behavior-aphlict-status' => 'c3703a16',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => '3b4899b0',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '3277c62d',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '6bc7ccf7',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => '55d7b788',
|
||||
'javelin-behavior-aphront-more' => '506aa3f4',
|
||||
'javelin-behavior-audio-source' => '3dc5ad43',
|
||||
|
@ -653,7 +654,7 @@ return array(
|
|||
'javelin-behavior-phabricator-notification-example' => '29819b75',
|
||||
'javelin-behavior-phabricator-object-selector' => '98ef467f',
|
||||
'javelin-behavior-phabricator-oncopy' => 'da8f5259',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => '54262396',
|
||||
'javelin-behavior-phabricator-remarkup-assist' => '6d347847',
|
||||
'javelin-behavior-phabricator-reveal-content' => 'b105a3a6',
|
||||
'javelin-behavior-phabricator-search-typeahead' => '1cb7d027',
|
||||
'javelin-behavior-phabricator-show-older-transactions' => '8b5c7d65',
|
||||
|
@ -799,12 +800,13 @@ return array(
|
|||
'phabricator-object-selector-css' => 'ee77366f',
|
||||
'phabricator-phtize' => '2f1db1ed',
|
||||
'phabricator-prefab' => '5793d835',
|
||||
'phabricator-remarkup-css' => '5baa3bd9',
|
||||
'phabricator-remarkup-css' => '3480e1fe',
|
||||
'phabricator-remarkup-metadata' => 'e40c4991',
|
||||
'phabricator-search-results-css' => '9ea70ace',
|
||||
'phabricator-shaped-request' => '995f5102',
|
||||
'phabricator-slowvote-css' => '1694baed',
|
||||
'phabricator-source-code-view-css' => '6b31244f',
|
||||
'phabricator-standard-page-view' => 'a374f94c',
|
||||
'phabricator-source-code-view-css' => '49656486',
|
||||
'phabricator-standard-page-view' => 'e08c7462',
|
||||
'phabricator-textareautils' => 'f340a484',
|
||||
'phabricator-title' => '43bc9360',
|
||||
'phabricator-tooltip' => '83754533',
|
||||
|
@ -822,12 +824,12 @@ return array(
|
|||
'phriction-document-css' => '03380da0',
|
||||
'phui-action-panel-css' => '6c386cbf',
|
||||
'phui-badge-view-css' => '666e25ad',
|
||||
'phui-basic-nav-view-css' => '56ebd66d',
|
||||
'phui-basic-nav-view-css' => 'a5693cf0',
|
||||
'phui-big-info-view-css' => '362ad37b',
|
||||
'phui-box-css' => '5ed3b8cb',
|
||||
'phui-bulk-editor-css' => '374d5e30',
|
||||
'phui-button-bar-css' => 'a4aa75c4',
|
||||
'phui-button-css' => 'e434f171',
|
||||
'phui-button-css' => 'f9d0f9c8',
|
||||
'phui-button-simple-css' => '1ff278aa',
|
||||
'phui-calendar-css' => 'f11073aa',
|
||||
'phui-calendar-day-css' => '9597d706',
|
||||
|
@ -868,7 +870,7 @@ return array(
|
|||
'phui-oi-color-css' => 'b517bfa0',
|
||||
'phui-oi-drag-ui-css' => 'da15d3dc',
|
||||
'phui-oi-flush-ui-css' => '490e2e2e',
|
||||
'phui-oi-list-view-css' => 'af98a277',
|
||||
'phui-oi-list-view-css' => '9275ff55',
|
||||
'phui-oi-simple-ui-css' => '6a30fa46',
|
||||
'phui-pager-css' => 'd022c7ad',
|
||||
'phui-pinboard-view-css' => '1f08f5d8',
|
||||
|
@ -884,8 +886,8 @@ return array(
|
|||
'phui-two-column-view-css' => 'f96d319f',
|
||||
'phui-workboard-color-css' => '3a1c21ff',
|
||||
'phui-workboard-view-css' => '74fc9d98',
|
||||
'phui-workcard-view-css' => '913441b6',
|
||||
'phui-workpanel-view-css' => '3ae89b20',
|
||||
'phui-workcard-view-css' => '62056e3b',
|
||||
'phui-workpanel-view-css' => 'bc06f022',
|
||||
'phuix-action-list-view' => 'c68f183f',
|
||||
'phuix-action-view' => 'a8f573a9',
|
||||
'phuix-autocomplete' => '2fbe234d',
|
||||
|
@ -1201,13 +1203,6 @@ return array(
|
|||
'javelin-install',
|
||||
'javelin-util',
|
||||
),
|
||||
'3277c62d' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-json',
|
||||
'phabricator-drag-and-drop-file-upload',
|
||||
'phabricator-textareautils',
|
||||
),
|
||||
'32db8374' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -1252,9 +1247,6 @@ return array(
|
|||
'trigger-rule',
|
||||
'trigger-rule-type',
|
||||
),
|
||||
'3ae89b20' => array(
|
||||
'phui-workcard-view-css',
|
||||
),
|
||||
'3b4899b0' => array(
|
||||
'javelin-behavior',
|
||||
'phabricator-prefab',
|
||||
|
@ -1424,17 +1416,6 @@ return array(
|
|||
'541f81c3' => array(
|
||||
'javelin-install',
|
||||
),
|
||||
54262396 => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
'phabricator-phtize',
|
||||
'phabricator-textareautils',
|
||||
'javelin-workflow',
|
||||
'javelin-vector',
|
||||
'phuix-autocomplete',
|
||||
'javelin-mask',
|
||||
),
|
||||
'548567f6' => array(
|
||||
'syntax-default-css',
|
||||
),
|
||||
|
@ -1567,6 +1548,13 @@ return array(
|
|||
'javelin-workflow',
|
||||
'javelin-magical-init',
|
||||
),
|
||||
'6bc7ccf7' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'phabricator-drag-and-drop-file-upload',
|
||||
'phabricator-textareautils',
|
||||
'phabricator-remarkup-metadata',
|
||||
),
|
||||
'6cfa0008' => array(
|
||||
'javelin-dom',
|
||||
'javelin-dynval',
|
||||
|
@ -1575,6 +1563,18 @@ return array(
|
|||
'javelin-install',
|
||||
'javelin-util',
|
||||
),
|
||||
'6d347847' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
'phabricator-phtize',
|
||||
'phabricator-textareautils',
|
||||
'phabricator-remarkup-metadata',
|
||||
'javelin-workflow',
|
||||
'javelin-vector',
|
||||
'phuix-autocomplete',
|
||||
'javelin-mask',
|
||||
),
|
||||
70245195 => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -1699,6 +1699,9 @@ return array(
|
|||
'javelin-dom',
|
||||
'phabricator-busy',
|
||||
),
|
||||
'8b9caefe' => array(
|
||||
'phui-inline-comment-view-css',
|
||||
),
|
||||
'8badee71' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
@ -1999,8 +2002,8 @@ return array(
|
|||
'javelin-uri',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'bf159129' => array(
|
||||
'phui-inline-comment-view-css',
|
||||
'bc06f022' => array(
|
||||
'phui-workcard-view-css',
|
||||
),
|
||||
'c03f2fb4' => array(
|
||||
'javelin-install',
|
||||
|
@ -2126,6 +2129,11 @@ return array(
|
|||
'javelin-dom',
|
||||
'phuix-dropdown-menu',
|
||||
),
|
||||
'e40c4991' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-json',
|
||||
),
|
||||
'e4c7622a' => array(
|
||||
'javelin-magical-init',
|
||||
'javelin-install',
|
||||
|
|
|
@ -3,80 +3,6 @@
|
|||
|
||||
require_once dirname(dirname(__FILE__)).'/__init_script__.php';
|
||||
|
||||
$args = new PhutilArgumentParser($argv);
|
||||
$args->setTagline(pht('regenerate CSS sprite sheets'));
|
||||
$args->setSynopsis(<<<EOHELP
|
||||
**sprites**
|
||||
Rebuild CSS sprite sheets.
|
||||
|
||||
EOHELP
|
||||
);
|
||||
$args->parseStandardArguments();
|
||||
$args->parse(
|
||||
array(
|
||||
array(
|
||||
'name' => 'force',
|
||||
'help' => pht('Force regeneration even if sources have not changed.'),
|
||||
),
|
||||
));
|
||||
|
||||
$root = dirname(phutil_get_library_root('phabricator'));
|
||||
$webroot = $root.'/webroot/rsrc';
|
||||
$webroot = Filesystem::readablePath($webroot);
|
||||
|
||||
$generator = new CeleritySpriteGenerator();
|
||||
|
||||
$sheets = array(
|
||||
'tokens' => $generator->buildTokenSheet(),
|
||||
'login' => $generator->buildLoginSheet(),
|
||||
);
|
||||
|
||||
list($err) = exec_manual('optipng');
|
||||
if ($err) {
|
||||
$have_optipng = false;
|
||||
echo phutil_console_format(
|
||||
"<bg:red> %s </bg> %s\n%s\n",
|
||||
pht('WARNING'),
|
||||
pht('`%s` not found in PATH.', 'optipng'),
|
||||
pht('Sprites will not be optimized! Install `%s`!', 'optipng'));
|
||||
} else {
|
||||
$have_optipng = true;
|
||||
}
|
||||
|
||||
foreach ($sheets as $name => $sheet) {
|
||||
|
||||
$sheet->setBasePath($root);
|
||||
|
||||
$manifest_path = $root.'/resources/sprite/manifest/'.$name.'.json';
|
||||
if (!$args->getArg('force')) {
|
||||
if (Filesystem::pathExists($manifest_path)) {
|
||||
$data = Filesystem::readFile($manifest_path);
|
||||
$data = phutil_json_decode($data);
|
||||
if (!$sheet->needsRegeneration($data)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sheet
|
||||
->generateCSS($webroot."/css/sprite-{$name}.css")
|
||||
->generateManifest($root."/resources/sprite/manifest/{$name}.json");
|
||||
|
||||
foreach ($sheet->getScales() as $scale) {
|
||||
if ($scale == 1) {
|
||||
$sheet_name = "sprite-{$name}.png";
|
||||
} else {
|
||||
$sheet_name = "sprite-{$name}-X{$scale}.png";
|
||||
}
|
||||
|
||||
$full_path = "{$webroot}/image/{$sheet_name}";
|
||||
$sheet->generateImage($full_path, $scale);
|
||||
|
||||
if ($have_optipng) {
|
||||
echo pht('Optimizing...')."\n";
|
||||
phutil_passthru('optipng -o7 -clobber %s', $full_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo pht('Done.')."\n";
|
||||
echo pht('This script was replaced with `%s`!.', './bin/celerity sprites');
|
||||
echo "\n";
|
||||
exit(13);
|
||||
|
|
|
@ -318,6 +318,7 @@ phutil_register_library_map(array(
|
|||
'CelerityDefaultPostprocessor' => 'applications/celerity/postprocessor/CelerityDefaultPostprocessor.php',
|
||||
'CelerityHighContrastPostprocessor' => 'applications/celerity/postprocessor/CelerityHighContrastPostprocessor.php',
|
||||
'CelerityLargeFontPostprocessor' => 'applications/celerity/postprocessor/CelerityLargeFontPostprocessor.php',
|
||||
'CelerityManagementGenerateSpritesWorkflow' => 'applications/celerity/management/CelerityManagementGenerateSpritesWorkflow.php',
|
||||
'CelerityManagementMapWorkflow' => 'applications/celerity/management/CelerityManagementMapWorkflow.php',
|
||||
'CelerityManagementSyntaxWorkflow' => 'applications/celerity/management/CelerityManagementSyntaxWorkflow.php',
|
||||
'CelerityManagementWorkflow' => 'applications/celerity/management/CelerityManagementWorkflow.php',
|
||||
|
@ -2975,6 +2976,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCountdownApplication' => 'applications/countdown/application/PhabricatorCountdownApplication.php',
|
||||
'PhabricatorCountdownController' => 'applications/countdown/controller/PhabricatorCountdownController.php',
|
||||
'PhabricatorCountdownCountdownPHIDType' => 'applications/countdown/phid/PhabricatorCountdownCountdownPHIDType.php',
|
||||
'PhabricatorCountdownCreateCapability' => 'applications/countdown/capability/PhabricatorCountdownCreateCapability.php',
|
||||
'PhabricatorCountdownDAO' => 'applications/countdown/storage/PhabricatorCountdownDAO.php',
|
||||
'PhabricatorCountdownDefaultEditCapability' => 'applications/countdown/capability/PhabricatorCountdownDefaultEditCapability.php',
|
||||
'PhabricatorCountdownDefaultViewCapability' => 'applications/countdown/capability/PhabricatorCountdownDefaultViewCapability.php',
|
||||
|
@ -6310,6 +6312,7 @@ phutil_register_library_map(array(
|
|||
'CelerityDefaultPostprocessor' => 'CelerityPostprocessor',
|
||||
'CelerityHighContrastPostprocessor' => 'CelerityPostprocessor',
|
||||
'CelerityLargeFontPostprocessor' => 'CelerityPostprocessor',
|
||||
'CelerityManagementGenerateSpritesWorkflow' => 'CelerityManagementWorkflow',
|
||||
'CelerityManagementMapWorkflow' => 'CelerityManagementWorkflow',
|
||||
'CelerityManagementSyntaxWorkflow' => 'CelerityManagementWorkflow',
|
||||
'CelerityManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
|
@ -9376,6 +9379,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCountdownApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorCountdownController' => 'PhabricatorController',
|
||||
'PhabricatorCountdownCountdownPHIDType' => 'PhabricatorPHIDType',
|
||||
'PhabricatorCountdownCreateCapability' => 'PhabricatorPolicyCapability',
|
||||
'PhabricatorCountdownDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorCountdownDefaultEditCapability' => 'PhabricatorPolicyCapability',
|
||||
'PhabricatorCountdownDefaultViewCapability' => 'PhabricatorPolicyCapability',
|
||||
|
|
|
@ -448,7 +448,7 @@ final class AphrontRequest extends Phobject {
|
|||
}
|
||||
|
||||
private function getPrefixedCookieName($name) {
|
||||
if (strlen($this->cookiePrefix)) {
|
||||
if (phutil_nonempty_string($this->cookiePrefix)) {
|
||||
return $this->cookiePrefix.'_'.$name;
|
||||
} else {
|
||||
return $name;
|
||||
|
|
|
@ -8,7 +8,16 @@ final class AphrontFileResponse extends AphrontResponse {
|
|||
private $compressResponse;
|
||||
|
||||
private $mimeType;
|
||||
|
||||
/**
|
||||
* Download filename
|
||||
*
|
||||
* This is NULL as default or a string.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $download;
|
||||
|
||||
private $rangeMin;
|
||||
private $rangeMax;
|
||||
private $allowOrigins = array();
|
||||
|
@ -18,14 +27,30 @@ final class AphrontFileResponse extends AphrontResponse {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a download filename
|
||||
*
|
||||
* @param $download string
|
||||
* @return self
|
||||
*/
|
||||
public function setDownload($download) {
|
||||
|
||||
// Make sure we have a populated string
|
||||
if (!phutil_nonempty_string($download)) {
|
||||
$download = 'untitled';
|
||||
}
|
||||
|
||||
$this->download = $download;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the download filename
|
||||
*
|
||||
* If this was never set, NULL is given.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDownload() {
|
||||
return $this->download;
|
||||
}
|
||||
|
@ -113,7 +138,7 @@ final class AphrontFileResponse extends AphrontResponse {
|
|||
$headers[] = array('Content-Length', $content_len);
|
||||
}
|
||||
|
||||
if (strlen($this->getDownload())) {
|
||||
if (phutil_nonempty_string($this->getDownload())) {
|
||||
$headers[] = array('X-Download-Options', 'noopen');
|
||||
|
||||
$filename = $this->getDownload();
|
||||
|
|
|
@ -327,7 +327,7 @@ abstract class AphrontResponse extends Phobject {
|
|||
}
|
||||
|
||||
if ($value instanceof PhutilSafeHTML) {
|
||||
// TODO: Javelin supports implicity conversion of '__html' objects to
|
||||
// TODO: Javelin supports implicit conversion of '__html' objects to
|
||||
// JX.HTML, but only for Ajax responses, not behaviors. Just leave things
|
||||
// as they are for now (where behaviors treat responses as HTML or plain
|
||||
// text at their discretion).
|
||||
|
|
|
@ -700,7 +700,7 @@ final class PhabricatorAuditEditor
|
|||
PhabricatorAuditTransaction::MAILTAG_COMMIT =>
|
||||
pht('A commit is created.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_CONCERN =>
|
||||
pht('A commit has a concerned raised against it.'),
|
||||
pht('A commit has a concern raised against it.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_ACCEPT =>
|
||||
pht('A commit is accepted.'),
|
||||
PhabricatorAuditTransaction::MAILTAG_ACTION_RESIGN =>
|
||||
|
|
|
@ -89,7 +89,7 @@ final class PhabricatorCookies extends Phobject {
|
|||
// temporary and clearing it when users log out.
|
||||
|
||||
$value = $request->getCookie(self::COOKIE_CLIENTID);
|
||||
if (!strlen($value)) {
|
||||
if (!phutil_nonempty_string($value)) {
|
||||
$request->setTemporaryCookie(
|
||||
self::COOKIE_CLIENTID,
|
||||
Filesystem::readRandomCharacters(16));
|
||||
|
@ -164,7 +164,7 @@ final class PhabricatorCookies extends Phobject {
|
|||
// Old cookies look like: /uri
|
||||
// New cookies look like: timestamp,/uri
|
||||
|
||||
if (!strlen($cookie)) {
|
||||
if (!phutil_nonempty_string($cookie)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ abstract class PhabricatorAuthController extends PhabricatorController {
|
|||
$viewer,
|
||||
PhabricatorAuthLoginMessageType::MESSAGEKEY);
|
||||
|
||||
if (!strlen($text)) {
|
||||
if (!phutil_nonempty_string($text)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ final class PhabricatorAuthRegisterController
|
|||
$invite = $this->loadInvite();
|
||||
|
||||
$is_setup = false;
|
||||
if (strlen($account_key)) {
|
||||
if (phutil_nonempty_string($account_key)) {
|
||||
$result = $this->loadAccountForRegistrationOrLinking($account_key);
|
||||
list($account, $provider, $response) = $result;
|
||||
$is_default = false;
|
||||
|
@ -244,9 +244,9 @@ final class PhabricatorAuthRegisterController
|
|||
|
||||
$require_real_name = PhabricatorEnv::getEnvConfig('user.require-real-name');
|
||||
|
||||
$e_username = strlen($value_username) ? null : true;
|
||||
$e_username = phutil_nonempty_string($value_username) ? null : true;
|
||||
$e_realname = $require_real_name ? true : null;
|
||||
$e_email = strlen($value_email) ? null : true;
|
||||
$e_email = phutil_nonempty_string($value_email) ? null : true;
|
||||
$e_password = true;
|
||||
$e_captcha = true;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ final class PhabricatorAuthSSHKeyEditController
|
|||
$cancel_uri);
|
||||
|
||||
$v_name = $key->getName();
|
||||
$e_name = strlen($v_name) ? null : true;
|
||||
$e_name = phutil_nonempty_string($v_name) ? null : true;
|
||||
|
||||
$v_key = $key->getEntireKey();
|
||||
$e_key = strlen($v_key) ? null : true;
|
||||
|
|
|
@ -98,7 +98,7 @@ final class PhabricatorAuthStartController
|
|||
}
|
||||
|
||||
$next_uri = $request->getStr('next');
|
||||
if (!strlen($next_uri)) {
|
||||
if (!phutil_nonempty_string($next_uri)) {
|
||||
if ($this->getDelegatingController()) {
|
||||
// Only set a next URI from the request path if this controller was
|
||||
// delegated to, which happens when a user tries to view a page which
|
||||
|
@ -112,7 +112,7 @@ final class PhabricatorAuthStartController
|
|||
}
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
if (strlen($next_uri)) {
|
||||
if (phutil_nonempty_string($next_uri)) {
|
||||
PhabricatorCookies::setNextURICookie($request, $next_uri);
|
||||
}
|
||||
PhabricatorCookies::setClientIDCookie($request);
|
||||
|
|
|
@ -99,10 +99,10 @@ final class PhabricatorAuthEditController
|
|||
|
||||
if (!$errors) {
|
||||
if ($is_new) {
|
||||
if (!strlen($config->getProviderType())) {
|
||||
if (!phutil_nonempty_string($config->getProviderType())) {
|
||||
$config->setProviderType($provider->getProviderType());
|
||||
}
|
||||
if (!strlen($config->getProviderDomain())) {
|
||||
if (!phutil_nonempty_string($config->getProviderDomain())) {
|
||||
$config->setProviderDomain($provider->getProviderDomain());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ final class PhabricatorAuthMessageViewController
|
|||
->setViewer($viewer);
|
||||
|
||||
$full_description = $message_type->getFullDescription();
|
||||
if (strlen($full_description)) {
|
||||
if (phutil_nonempty_string($full_description)) {
|
||||
$view->addTextContent(new PHUIRemarkupView($viewer, $full_description));
|
||||
} else {
|
||||
$short_description = $message_type->getShortDescription();
|
||||
|
@ -111,7 +111,7 @@ final class PhabricatorAuthMessageViewController
|
|||
}
|
||||
|
||||
$message_text = $message->getMessageText();
|
||||
if (strlen($message_text)) {
|
||||
if (phutil_nonempty_string($message_text)) {
|
||||
$view->addSectionHeader(
|
||||
pht('Message Preview'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
|
@ -120,7 +120,7 @@ final class PhabricatorAuthMessageViewController
|
|||
}
|
||||
|
||||
$default_text = $message_type->getDefaultMessageText();
|
||||
if (strlen($default_text)) {
|
||||
if (phutil_nonempty_string($default_text)) {
|
||||
$view->addSectionHeader(
|
||||
pht('Default Message'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
|
|
|
@ -83,7 +83,7 @@ final class PhabricatorAuthFactorProviderViewController
|
|||
|
||||
|
||||
$custom_enroll = $provider->getEnrollMessage();
|
||||
if (strlen($custom_enroll)) {
|
||||
if (phutil_nonempty_string($custom_enroll)) {
|
||||
$view->addSectionHeader(
|
||||
pht('Custom Enroll Message'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
|
|
|
@ -413,8 +413,8 @@ abstract class PhabricatorAuthFactor extends Phobject {
|
|||
$sync_type = PhabricatorAuthMFASyncTemporaryTokenType::TOKENTYPE;
|
||||
$sync_token = null;
|
||||
|
||||
$sync_key = $request->getStr($this->getMFASyncTokenFormKey());
|
||||
if (strlen($sync_key)) {
|
||||
$sync_key = $request->getStr($this->getMFASyncTokenFormKey(), '');
|
||||
if ($sync_key !== '') {
|
||||
$sync_key_digest = PhabricatorHash::digestWithNamedKey(
|
||||
$sync_key,
|
||||
PhabricatorAuthMFASyncTemporaryTokenType::DIGEST_KEY);
|
||||
|
|
|
@ -169,7 +169,7 @@ final class PhabricatorPhabricatorAuthProvider
|
|||
phutil_tag(
|
||||
'tt',
|
||||
array(),
|
||||
'`example.oauthserver`'))));
|
||||
'example.oauthserver'))));
|
||||
} else {
|
||||
$form
|
||||
->appendChild(
|
||||
|
|
|
@ -56,7 +56,7 @@ final class PhabricatorAuthChallenge
|
|||
AphrontRequest $request) {
|
||||
assert_instances_of($challenges, __CLASS__);
|
||||
|
||||
$token_list = $request->getStr(self::HTTPKEY);
|
||||
$token_list = $request->getStr(self::HTTPKEY, '');
|
||||
$token_list = explode(' ', $token_list);
|
||||
|
||||
$token_map = array();
|
||||
|
|
|
@ -235,6 +235,11 @@ abstract class PhabricatorApplication
|
|||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Application Overview in raw Remarkup
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getOverview() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ abstract class PhabricatorController extends AphrontController {
|
|||
$session_engine = new PhabricatorAuthSessionEngine();
|
||||
|
||||
$phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION);
|
||||
if (strlen($phsid)) {
|
||||
if (phutil_nonempty_string($phsid)) {
|
||||
$session_user = $session_engine->loadUserForSession(
|
||||
PhabricatorAuthSession::TYPE_WEB,
|
||||
$phsid);
|
||||
|
|
|
@ -56,7 +56,7 @@ final class PhabricatorCalendarICSFileImportEngine
|
|||
public function getDisplayName(PhabricatorCalendarImport $import) {
|
||||
$filename_key = PhabricatorCalendarImportICSFileTransaction::PARAMKEY_NAME;
|
||||
$filename = $import->getParameter($filename_key);
|
||||
if (strlen($filename)) {
|
||||
if (phutil_nonempty_string($filename)) {
|
||||
return pht('ICS File "%s"', $filename);
|
||||
} else {
|
||||
return pht('ICS File');
|
||||
|
|
|
@ -53,7 +53,7 @@ final class PhabricatorCalendarImportICSFileTransaction
|
|||
$new_value = $object->getParameter(self::PARAMKEY_FILE);
|
||||
foreach ($xactions as $xaction) {
|
||||
$new_value = $xaction->getNewValue();
|
||||
if (!strlen($new_value)) {
|
||||
if (!phutil_nonempty_string($new_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ abstract class CelerityResourceController extends PhabricatorController {
|
|||
|
||||
$range = AphrontRequest::getHTTPHeader('Range');
|
||||
|
||||
if (strlen($range)) {
|
||||
if (phutil_nonempty_string($range)) {
|
||||
$response->setContentLength(strlen($data));
|
||||
|
||||
list($range_begin, $range_end) = $response->parseHTTPRange($range);
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
final class CelerityManagementGenerateSpritesWorkflow
|
||||
extends CelerityManagementWorkflow {
|
||||
|
||||
protected function didConstruct() {
|
||||
$this
|
||||
->setName('sprites')
|
||||
->setExamples('**sprites** [options]')
|
||||
->setSynopsis(pht('Rebuild CSS sprite sheets.'))
|
||||
->setArguments(
|
||||
array(
|
||||
array(
|
||||
'name' => 'force',
|
||||
'help' => pht('Force regeneration even no sources have changed.'),
|
||||
),
|
||||
array(
|
||||
'name' => 'no-map',
|
||||
'help' =>
|
||||
pht(
|
||||
'Do not invoke `%s` after updating sprites',
|
||||
'celerity map'),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$resources_map = CelerityPhysicalResources::getAll();
|
||||
|
||||
$console = PhutilConsole::getConsole();
|
||||
|
||||
$root = dirname(phutil_get_library_root('phorge'));
|
||||
$webroot = $root.'/webroot/rsrc';
|
||||
$webroot = Filesystem::readablePath($webroot);
|
||||
|
||||
$generator = new CeleritySpriteGenerator();
|
||||
|
||||
$sheets = array(
|
||||
'tokens' => $generator->buildTokenSheet(),
|
||||
'login' => $generator->buildLoginSheet(),
|
||||
);
|
||||
|
||||
list($err) = exec_manual('optipng');
|
||||
if ($err) {
|
||||
$have_optipng = false;
|
||||
$console->writeErr(
|
||||
"<bg:red> %s </bg> %s\n%s\n",
|
||||
pht('WARNING'),
|
||||
pht('`%s` not found in PATH.', 'optipng'),
|
||||
pht('Sprites will not be optimized! Install `%s`!', 'optipng'));
|
||||
} else {
|
||||
$have_optipng = true;
|
||||
}
|
||||
|
||||
foreach ($sheets as $name => $sheet) {
|
||||
|
||||
$sheet->setBasePath($root);
|
||||
|
||||
$manifest_path = $root.'/resources/sprite/manifest/'.$name.'.json';
|
||||
if (!$args->getArg('force')) {
|
||||
if (Filesystem::pathExists($manifest_path)) {
|
||||
$data = Filesystem::readFile($manifest_path);
|
||||
$data = phutil_json_decode($data);
|
||||
if (!$sheet->needsRegeneration($data)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sheet
|
||||
->generateCSS($webroot."/css/sprite-{$name}.css")
|
||||
->generateManifest($root."/resources/sprite/manifest/{$name}.json");
|
||||
|
||||
foreach ($sheet->getScales() as $scale) {
|
||||
if ($scale == 1) {
|
||||
$sheet_name = "sprite-{$name}.png";
|
||||
} else {
|
||||
$sheet_name = "sprite-{$name}-X{$scale}.png";
|
||||
}
|
||||
|
||||
$full_path = "{$webroot}/image/{$sheet_name}";
|
||||
$sheet->generateImage($full_path, $scale);
|
||||
|
||||
if ($have_optipng) {
|
||||
$console->writeOut("%s\n", pht('Optimizing...'));
|
||||
phutil_passthru('optipng -o7 -clobber %s', $full_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$run_map = !$args->getArg('no-map');
|
||||
|
||||
if ($run_map) {
|
||||
$console->writeOut(
|
||||
"%s\n",
|
||||
pht('Done generating sprites - updating map...'));
|
||||
$map_flow = id($args->getWorkflows())['map'];
|
||||
// this is very hacky, but it works because `map` has no arguments.
|
||||
$map_flow->execute($args);
|
||||
} else {
|
||||
$console->writeOut("%s\n", pht('Done.'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -37,7 +37,7 @@ final class PhabricatorConduitAPIController
|
|||
// TODO: The relationship between ConduitAPIRequest and ConduitCall is a
|
||||
// little odd here and could probably be improved. Specifically, the
|
||||
// APIRequest is a sub-object of the Call, which does not parallel the
|
||||
// role of AphrontRequest (which is an indepenent object).
|
||||
// role of AphrontRequest (which is an independent object).
|
||||
// In particular, the setUser() and getUser() existing independently on
|
||||
// the Call and APIRequest is very awkward.
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ final class PhabricatorConduitSearchEngine
|
|||
$query->withIsInternal(false);
|
||||
|
||||
$contains = $saved->getParameter('nameContains');
|
||||
if (strlen($contains)) {
|
||||
if (phutil_nonempty_string($contains)) {
|
||||
$query->withNameContains($contains);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,17 @@ final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck {
|
|||
|
||||
switch ($vcs['versionControlSystem']) {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||
$bad_versions = array();
|
||||
$bad_versions = array(
|
||||
// We need 2.5.0 to use "git cat-file -t -- <hash>:<file>"
|
||||
// https://we.phorge.it/T15179
|
||||
'< 2.5.0' => pht(
|
||||
'The minimum supported version of Git on the server is %s, '.
|
||||
'which was released in %s. In older versions, the Git server '.
|
||||
'may not be able to escape arguments with the "--" operator. '.
|
||||
'Note: your users do not require a particular version of Git.',
|
||||
'2.5.0',
|
||||
'2015'),
|
||||
);
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
$bad_versions = array(
|
||||
|
|
|
@ -53,7 +53,7 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
|
|||
}
|
||||
|
||||
$expect_user = PhabricatorEnv::getEnvConfig('phd.user');
|
||||
if (strlen($expect_user)) {
|
||||
if (phutil_nonempty_string($expect_user)) {
|
||||
|
||||
try {
|
||||
$all_daemons = id(new PhabricatorDaemonLogQuery())
|
||||
|
|
|
@ -106,7 +106,7 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
|
|||
'The "InnoDB" engine is not available in MySQL (on host "%s"). '.
|
||||
'Enable InnoDB in your MySQL configuration.'.
|
||||
"\n\n".
|
||||
'(If you aleady created tables, MySQL incorrectly used some other '.
|
||||
'(If you already created tables, MySQL incorrectly used some other '.
|
||||
'engine to create them. You need to convert them or drop and '.
|
||||
'reinitialize them.)',
|
||||
$ref_key);
|
||||
|
|
|
@ -85,14 +85,14 @@ final class PhabricatorConfigConsoleController
|
|||
$rows = array();
|
||||
foreach ($versions as $name => $info) {
|
||||
$branchpoint = $info['branchpoint'];
|
||||
if (strlen($branchpoint)) {
|
||||
if (phutil_nonempty_string($branchpoint)) {
|
||||
$branchpoint = substr($branchpoint, 0, 12);
|
||||
} else {
|
||||
$branchpoint = null;
|
||||
}
|
||||
|
||||
$version = $info['hash'];
|
||||
if (strlen($version)) {
|
||||
if (phutil_nonempty_string($version)) {
|
||||
$version = substr($version, 0, 12);
|
||||
} else {
|
||||
$version = pht('Unknown');
|
||||
|
|
|
@ -9,7 +9,7 @@ final class PhabricatorConfigModuleController
|
|||
|
||||
$all_modules = PhabricatorConfigModule::getAllModules();
|
||||
|
||||
if (!strlen($key)) {
|
||||
if (!phutil_nonempty_string($key)) {
|
||||
$key = head_key($all_modules);
|
||||
}
|
||||
|
||||
|
|
|
@ -837,7 +837,7 @@ final class PhabricatorConfigDatabaseStatusController
|
|||
|
||||
$parts = array();
|
||||
foreach ($properties as $key => $property) {
|
||||
if (!strlen($property)) {
|
||||
if (!phutil_nonempty_string($property)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ final class PhabricatorConfigSettingsListController
|
|||
$viewer = $request->getViewer();
|
||||
|
||||
$filter = $request->getURIData('filter');
|
||||
if (!strlen($filter)) {
|
||||
if (!phutil_nonempty_string($filter)) {
|
||||
$filter = 'settings';
|
||||
}
|
||||
|
||||
|
|
|
@ -156,11 +156,22 @@ final class PhabricatorConfigOption
|
|||
return $this->summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the human Description of this Config
|
||||
*
|
||||
* @param string|null $description Description as raw Remarkup
|
||||
* @return self
|
||||
*/
|
||||
public function setDescription($description) {
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human Description of this Config
|
||||
*
|
||||
* @return string|null Description as raw Remarkup
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
@ -205,7 +216,7 @@ final class PhabricatorConfigOption
|
|||
|
||||
public function newDescriptionRemarkupView(PhabricatorUser $viewer) {
|
||||
$description = $this->getDescription();
|
||||
if (!strlen($description)) {
|
||||
if (!phutil_nonempty_string($description)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ of each approach are:
|
|||
- If you use mailing lists, recipients may sometimes get duplicate
|
||||
mail.
|
||||
- Getting threading to work properly is easier, and threading settings
|
||||
can be customzied by each user.
|
||||
can be customized by each user.
|
||||
- "Reply All" will never send extra mail to other users involved in the
|
||||
thread.
|
||||
- Required if private reply-to addresses are configured.
|
||||
|
|
|
@ -73,20 +73,22 @@ final class PhabricatorSetupIssueView extends AphrontView {
|
|||
'Install these %d PHP extension(s):', count($extensions));
|
||||
|
||||
$install_info = pht(
|
||||
'You can usually install a PHP extension using %s or %s. Common '.
|
||||
'package names are %s or %s. Try commands like these:',
|
||||
'You can usually install a PHP extension using %s, %s, or %s. A '.
|
||||
'common package name is %s. Try commands like these:',
|
||||
phutil_tag('tt', array(), 'apt-get'),
|
||||
phutil_tag('tt', array(), 'dnf'),
|
||||
phutil_tag('tt', array(), 'yum'),
|
||||
hsprintf('<tt>php-<em>%s</em></tt>', pht('extname')),
|
||||
hsprintf('<tt>php5-<em>%s</em></tt>', pht('extname')));
|
||||
hsprintf('<tt>php-<em>%s</em></tt>', pht('extname')));
|
||||
|
||||
// TODO: We should do a better job of detecting how to install extensions
|
||||
// on the current system.
|
||||
$install_commands = hsprintf(
|
||||
"\$ sudo apt-get install php5-<em>extname</em> ".
|
||||
"\$ sudo apt-get install php-<em>extname</em> ".
|
||||
"# Debian / Ubuntu\n".
|
||||
"\$ sudo yum install php-<em>extname</em> ".
|
||||
"# Red Hat / Derivatives");
|
||||
"\$ sudo dnf install php-<em>extname</em> ".
|
||||
"# Red Hat / Derivatives\n".
|
||||
"\$ sudo yum install php-<em>extname</em> ".
|
||||
"# Older Red Hat versions");
|
||||
|
||||
$fallback_info = pht(
|
||||
"If those commands don't work, try Google. The process of installing ".
|
||||
|
|
|
@ -135,7 +135,8 @@ final class ConpherenceThreadQuery
|
|||
}
|
||||
|
||||
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||
if ($this->participantPHIDs !== null || strlen($this->fulltext)) {
|
||||
if ($this->participantPHIDs !== null ||
|
||||
phutil_nonempty_string($this->fulltext)) {
|
||||
return qsprintf($conn_r, 'GROUP BY thread.id');
|
||||
} else {
|
||||
return $this->buildApplicationSearchGroupClause($conn_r);
|
||||
|
@ -152,7 +153,7 @@ final class ConpherenceThreadQuery
|
|||
id(new ConpherenceParticipant())->getTableName());
|
||||
}
|
||||
|
||||
if (strlen($this->fulltext)) {
|
||||
if (phutil_nonempty_string($this->fulltext)) {
|
||||
$joins[] = qsprintf(
|
||||
$conn,
|
||||
'JOIN %T idx ON idx.threadPHID = thread.phid',
|
||||
|
@ -234,7 +235,7 @@ final class ConpherenceThreadQuery
|
|||
$this->participantPHIDs);
|
||||
}
|
||||
|
||||
if (strlen($this->fulltext)) {
|
||||
if (phutil_nonempty_string($this->fulltext)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)',
|
||||
|
|
|
@ -106,7 +106,7 @@ final class ConpherenceThreadSearchEngine
|
|||
$engines = array();
|
||||
|
||||
$fulltext = $query->getParameter('fulltext');
|
||||
if (strlen($fulltext) && $conpherences) {
|
||||
if (phutil_nonempty_string($fulltext) && $conpherences) {
|
||||
$context = $this->loadContextMessages($conpherences, $fulltext);
|
||||
|
||||
$author_phids = array();
|
||||
|
|
|
@ -25,8 +25,9 @@ final class DarkConsoleController extends PhabricatorController {
|
|||
return $response;
|
||||
}
|
||||
|
||||
// This should be '0' when closed and '1' when opened
|
||||
$visible = $request->getStr('visible');
|
||||
if (strlen($visible)) {
|
||||
if (phutil_nonempty_string($visible)) {
|
||||
$this->writeDarkConsoleSetting(
|
||||
PhabricatorDarkConsoleVisibleSetting::SETTINGKEY,
|
||||
(int)$visible);
|
||||
|
|
|
@ -124,6 +124,9 @@ final class DarkConsoleCore extends Phobject {
|
|||
} else if (is_resource($data)) {
|
||||
return '<resource>';
|
||||
} else {
|
||||
// This is very probably not a string in strict sense
|
||||
$data = phutil_string_cast($data);
|
||||
|
||||
// Truncate huge strings. Since the data doesn't really matter much,
|
||||
// just truncate bytes to avoid PhutilUTF8StringTruncator overhead.
|
||||
$length = strlen($data);
|
||||
|
|
|
@ -50,6 +50,10 @@ final class PhabricatorCountdownApplication extends PhabricatorApplication {
|
|||
|
||||
protected function getCustomCapabilities() {
|
||||
return array(
|
||||
PhabricatorCountdownCreateCapability::CAPABILITY => array(
|
||||
'default' => PhabricatorPolicies::POLICY_USER,
|
||||
'caption' => pht('Default create policy for countdowns.'),
|
||||
),
|
||||
PhabricatorCountdownDefaultViewCapability::CAPABILITY => array(
|
||||
'caption' => pht('Default view policy for new countdowns.'),
|
||||
'template' => PhabricatorCountdownCountdownPHIDType::TYPECONST,
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorCountdownCreateCapability
|
||||
extends PhabricatorPolicyCapability {
|
||||
|
||||
const CAPABILITY = 'countdown.create';
|
||||
|
||||
public function getCapabilityName() {
|
||||
return pht('Can Create Countdowns');
|
||||
}
|
||||
|
||||
public function describeCapabilityRejection() {
|
||||
return pht('You do not have permission to create a countdown.');
|
||||
}
|
||||
|
||||
}
|
|
@ -70,6 +70,11 @@ final class PhabricatorCountdownEditEngine
|
|||
return $object->getURI();
|
||||
}
|
||||
|
||||
protected function getCreateNewObjectPolicy() {
|
||||
return $this->getApplication()->getPolicy(
|
||||
PhabricatorCountdownCreateCapability::CAPABILITY);
|
||||
}
|
||||
|
||||
protected function buildCustomEditFields($object) {
|
||||
$epoch_value = $object->getEpoch();
|
||||
if ($epoch_value === null) {
|
||||
|
|
|
@ -13,12 +13,12 @@ final class PhabricatorDashboardQueryPanelInstallController
|
|||
$e_name = true;
|
||||
|
||||
$v_engine = $request->getStr('engine');
|
||||
if (!strlen($v_engine)) {
|
||||
if (!phutil_nonempty_string($v_engine)) {
|
||||
$v_engine = $request->getURIData('engineKey');
|
||||
}
|
||||
|
||||
$v_query = $request->getStr('query');
|
||||
if (!strlen($v_query)) {
|
||||
if (!phutil_nonempty_string($v_query)) {
|
||||
$v_query = $request->getURIData('queryKey');
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ final class PhabricatorDashboardPanelEditController
|
|||
// editing.
|
||||
|
||||
$context_phid = $request->getStr('contextPHID');
|
||||
if (strlen($context_phid)) {
|
||||
if (phutil_nonempty_string($context_phid)) {
|
||||
$context = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($context_phid))
|
||||
|
|
|
@ -17,16 +17,16 @@ abstract class PhabricatorDashboardObjectInstallWorkflow
|
|||
$target_identifier = head($target_tokens);
|
||||
}
|
||||
|
||||
if (!strlen($target_identifier)) {
|
||||
if (!phutil_nonempty_string($target_identifier)) {
|
||||
$target_identifier = $request->getStr('target');
|
||||
}
|
||||
|
||||
if (!strlen($target_identifier)) {
|
||||
if (!phutil_nonempty_string($target_identifier)) {
|
||||
$target_identifier = $this->getMode();
|
||||
}
|
||||
|
||||
$target = null;
|
||||
if (strlen($target_identifier)) {
|
||||
if (phutil_nonempty_string($target_identifier)) {
|
||||
$targets = array();
|
||||
|
||||
if (ctype_digit($target_identifier)) {
|
||||
|
@ -74,7 +74,7 @@ abstract class PhabricatorDashboardObjectInstallWorkflow
|
|||
}
|
||||
|
||||
$errors = array();
|
||||
if (strlen($target_identifier)) {
|
||||
if (phutil_nonempty_string($target_identifier)) {
|
||||
if (!$target) {
|
||||
$errors[] = pht('Choose a valid object.');
|
||||
} else if (!$can_edit) {
|
||||
|
|
|
@ -111,9 +111,11 @@ final class PhabricatorDashboardTabsPanelType
|
|||
$name = pht('Unnamed Tab');
|
||||
}
|
||||
|
||||
$is_selected = (string)$idx === (string)$selected;
|
||||
|
||||
$tab_view = id(new PHUIListItemView())
|
||||
->setHref('#')
|
||||
->setSelected((string)$idx === (string)$selected)
|
||||
->setSelected($is_selected)
|
||||
->addSigil('dashboard-tab-panel-tab')
|
||||
->setMetadata(array('panelKey' => $idx))
|
||||
->setName($name);
|
||||
|
@ -286,7 +288,7 @@ final class PhabricatorDashboardTabsPanelType
|
|||
'div',
|
||||
array(
|
||||
'id' => $content_id,
|
||||
'style' => ($idx == $selected) ? null : 'display: none',
|
||||
'style' => $is_selected ? null : 'display: none',
|
||||
),
|
||||
$panel_content);
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ final class DifferentialBranchField
|
|||
}
|
||||
|
||||
private function getBranchDescription(DifferentialDiff $diff) {
|
||||
$branch = $diff->getBranch();
|
||||
$bookmark = $diff->getBookmark();
|
||||
$branch = coalesce($diff->getBranch(), '');
|
||||
$bookmark = coalesce($diff->getBookmark(), '');
|
||||
|
||||
if (strlen($branch) && strlen($bookmark)) {
|
||||
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
|
||||
|
|
|
@ -307,7 +307,7 @@ final class DifferentialRevisionEditEngine
|
|||
pht('Hold as Draft'))
|
||||
->setTransactionType(
|
||||
DifferentialRevisionHoldDraftTransaction::TRANSACTIONTYPE)
|
||||
->setDescription(pht('Hold revision as as draft.'))
|
||||
->setDescription(pht('Hold revision as draft.'))
|
||||
->setConduitDescription(
|
||||
pht(
|
||||
'Change autosubmission from draft state after builds finish.'))
|
||||
|
|
|
@ -218,7 +218,7 @@ final class DifferentialTransactionEditor
|
|||
|
||||
// No "$", to allow for branches like T123_demo.
|
||||
$match = null;
|
||||
if (preg_match('/^T(\d+)/i', $branch, $match)) {
|
||||
if ($branch !== null && preg_match('/^T(\d+)/i', $branch, $match)) {
|
||||
$task_id = $match[1];
|
||||
$tasks = id(new ManiphestTaskQuery())
|
||||
->setViewer($this->getActor())
|
||||
|
|
|
@ -86,7 +86,7 @@ final class DifferentialRevisionPlanChangesTransaction
|
|||
if ($object->isClosed()) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'You can not plan changes to this this revision because it has '.
|
||||
'You can not plan changes to this revision because it has '.
|
||||
'already been closed.'));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ final class DiffusionBranchQueryConduitAPIMethod
|
|||
$repository = $drequest->getRepository();
|
||||
|
||||
$contains = $request->getValue('contains');
|
||||
if (strlen($contains)) {
|
||||
if (phutil_nonempty_string($contains)) {
|
||||
|
||||
// See PHI958 (and, earlier, PHI720). If "patterns" are provided, pass
|
||||
// them to "git branch ..." to let callers test for reachability from
|
||||
|
@ -80,7 +80,7 @@ final class DiffusionBranchQueryConduitAPIMethod
|
|||
->setRepository($repository);
|
||||
|
||||
$contains = $request->getValue('contains');
|
||||
if (strlen($contains)) {
|
||||
if (phutil_nonempty_string($contains)) {
|
||||
$query->withContainsCommit($contains);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ final class DiffusionBranchTableController extends DiffusionController {
|
|||
);
|
||||
|
||||
$contains = $drequest->getSymbolicCommit();
|
||||
if (strlen($contains)) {
|
||||
if (phutil_nonempty_string($contains)) {
|
||||
$params['contains'] = $contains;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,19 +97,19 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
AphrontRequest $request) {
|
||||
|
||||
$short_name = $request->getURIData('repositoryShortName');
|
||||
if (strlen($short_name)) {
|
||||
if (phutil_nonempty_string($short_name)) {
|
||||
// If the short name ends in ".git", ignore it.
|
||||
$short_name = preg_replace('/\\.git\z/', '', $short_name);
|
||||
return $short_name;
|
||||
}
|
||||
|
||||
$identifier = $request->getURIData('repositoryCallsign');
|
||||
if (strlen($identifier)) {
|
||||
if (phutil_nonempty_string($identifier)) {
|
||||
return $identifier;
|
||||
}
|
||||
|
||||
$id = $request->getURIData('repositoryID');
|
||||
if (strlen($id)) {
|
||||
if (phutil_nonempty_string($id)) {
|
||||
return (int)$id;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
|
||||
if (!$spec['commit'] && !$spec['tags'] && !$spec['branches']) {
|
||||
$branch_name = $drequest->getBranch();
|
||||
if (strlen($branch_name)) {
|
||||
if (phutil_nonempty_string($branch_name)) {
|
||||
$repository_name .= ' ('.$branch_name.')';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ final class DiffusionRepositoryManagePanelsController
|
|||
}
|
||||
|
||||
$selected = $request->getURIData('panel');
|
||||
if (!strlen($selected)) {
|
||||
if (!phutil_nonempty_string($selected)) {
|
||||
$selected = head_key($panels);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ final class DiffusionServeController extends DiffusionController {
|
|||
return null;
|
||||
}
|
||||
|
||||
$content_type = $request->getHTTPHeader('Content-Type');
|
||||
$user_agent = idx($_SERVER, 'HTTP_USER_AGENT');
|
||||
$content_type = $request->getHTTPHeader('Content-Type', '');
|
||||
$user_agent = idx($_SERVER, 'HTTP_USER_AGENT', '');
|
||||
$request_type = $request->getHTTPHeader('X-Phabricator-Request-Type');
|
||||
|
||||
// This may have a "charset" suffix, so only match the prefix.
|
||||
|
|
|
@ -219,7 +219,7 @@ final class DiffusionRepositoryBasicsManagementPanel
|
|||
$view->addProperty(pht('Type'), $type);
|
||||
|
||||
$callsign = $repository->getCallsign();
|
||||
if (!strlen($callsign)) {
|
||||
if (!phutil_nonempty_string($callsign)) {
|
||||
$callsign = phutil_tag('em', array(), pht('No Callsign'));
|
||||
}
|
||||
$view->addProperty(pht('Callsign'), $callsign);
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
final class DiffusionGitRequest extends DiffusionRequest {
|
||||
|
||||
protected function isStableCommit($symbol) {
|
||||
if ($symbol === null) {
|
||||
return false;
|
||||
}
|
||||
return preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ final class DiffusionRepositoryDatasource
|
|||
$parts[] = $name;
|
||||
|
||||
$slug = $repository->getRepositorySlug();
|
||||
if (strlen($slug)) {
|
||||
if (phutil_nonempty_string($slug)) {
|
||||
$parts[] = $slug;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ final class DivinerBookQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
$this->phids);
|
||||
}
|
||||
|
||||
if (strlen($this->nameLike)) {
|
||||
if (phutil_nonempty_string($this->nameLike)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'name LIKE %~',
|
||||
|
@ -147,7 +147,7 @@ final class DivinerBookQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
$this->names);
|
||||
}
|
||||
|
||||
if (strlen($this->namePrefix)) {
|
||||
if (phutil_nonempty_string($this->namePrefix)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'name LIKE %>',
|
||||
|
|
|
@ -182,7 +182,7 @@ final class DivinerLiveSymbol extends DivinerDAO
|
|||
public function setTitle($value) {
|
||||
$this->writeField('title', $value);
|
||||
|
||||
if (strlen($value)) {
|
||||
if (phutil_nonempty_string($value)) {
|
||||
$slug = DivinerAtomRef::normalizeTitleString($value);
|
||||
$hash = PhabricatorHash::digestForIndex($slug);
|
||||
$this->titleSlugHash = $hash;
|
||||
|
|
|
@ -194,7 +194,7 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
|
|||
|
||||
$identifier = $args->getArg('repository');
|
||||
$repository = null;
|
||||
if (strlen($identifier)) {
|
||||
if (phutil_nonempty_string($identifier)) {
|
||||
$repository = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withIdentifiers(array($identifier))
|
||||
|
|
|
@ -183,12 +183,21 @@ final class PhabricatorFilesComposeAvatarBuiltinFile
|
|||
'image/png');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a color from RGBA to a value usable in PHP-GD.
|
||||
* Each RGB color should be expressed as an integer from 0 to 255.
|
||||
* The Alpha Channel should be expressed as a float from 0 to 1.
|
||||
* @param array $rgba array( int Red, int Green, int Blue, float Alpha )
|
||||
* @return int
|
||||
*/
|
||||
private static function rgba2gd($rgba) {
|
||||
// When working with a truecolor image, we can use bitwise operations
|
||||
// https://www.php.net/manual/en/function.imagecolorallocate.php#49168
|
||||
$r = $rgba[0];
|
||||
$g = $rgba[1];
|
||||
$b = $rgba[2];
|
||||
$a = $rgba[3];
|
||||
$a = (1 - $a) * 255;
|
||||
$a = round(((1 - $a) * 255), 0);
|
||||
return ($a << 24) | ($r << 16) | ($g << 8) | $b;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ final class PhabricatorFileDataController extends PhabricatorFileController {
|
|||
$request_kind = $request->getURIData('kind');
|
||||
$is_download = ($request_kind === 'download');
|
||||
|
||||
if (!strlen($alt) || $main_domain == $alt_domain) {
|
||||
if (!phutil_nonempty_string($alt) || $main_domain == $alt_domain) {
|
||||
// No alternate domain.
|
||||
$should_redirect = false;
|
||||
$is_alternate_domain = false;
|
||||
|
@ -69,7 +69,7 @@ final class PhabricatorFileDataController extends PhabricatorFileController {
|
|||
// an initial request for bytes 0-1 of the audio file, and things go south
|
||||
// if we can't respond with a 206 Partial Content.
|
||||
$range = $request->getHTTPHeader('range');
|
||||
if (strlen($range)) {
|
||||
if (phutil_nonempty_string($range)) {
|
||||
list($begin, $end) = $response->parseHTTPRange($range);
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
|
|||
$file->getStorageHandle());
|
||||
|
||||
$custom_alt = $file->getCustomAltText();
|
||||
if (strlen($custom_alt)) {
|
||||
if (phutil_nonempty_string($custom_alt)) {
|
||||
$finfo->addProperty(pht('Custom Alt Text'), $custom_alt);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,12 +60,12 @@ abstract class PhabricatorDocumentRenderingEngine
|
|||
}
|
||||
|
||||
$encode_setting = $request->getStr('encode');
|
||||
if (strlen($encode_setting)) {
|
||||
if (phutil_nonempty_string($encode_setting)) {
|
||||
$engine->setEncodingConfiguration($encode_setting);
|
||||
}
|
||||
|
||||
$highlight_setting = $request->getStr('highlight');
|
||||
if (strlen($highlight_setting)) {
|
||||
if (phutil_nonempty_string($highlight_setting)) {
|
||||
$engine->setHighlightingConfiguration($highlight_setting);
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ final class PhabricatorEmbedFileRemarkupRule
|
|||
$alt = $options['alt'];
|
||||
}
|
||||
|
||||
if (!strlen($alt)) {
|
||||
if (!phutil_nonempty_string($alt)) {
|
||||
$alt = $file->getAltText();
|
||||
}
|
||||
|
||||
|
@ -346,10 +346,11 @@ final class PhabricatorEmbedFileRemarkupRule
|
|||
}
|
||||
|
||||
private function parseDimension($string) {
|
||||
$string = trim($string);
|
||||
|
||||
if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) {
|
||||
return $string;
|
||||
if ($string !== null) {
|
||||
$string = trim($string);
|
||||
if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) {
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1278,7 +1278,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
public function getAltText() {
|
||||
$alt = $this->getCustomAltText();
|
||||
|
||||
if (strlen($alt)) {
|
||||
if (phutil_nonempty_string($alt)) {
|
||||
return $alt;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ final class PhabricatorGlobalUploadTargetView extends AphrontView {
|
|||
require_celerity_resource('global-drag-and-drop-css');
|
||||
|
||||
$hint_text = $this->getHintText();
|
||||
if (!strlen($hint_text)) {
|
||||
if (!phutil_nonempty_string($hint_text)) {
|
||||
$hint_text = "\xE2\x87\xAA ".pht('Drop Files to Upload');
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ final class PhabricatorFileAltTextTransaction
|
|||
$old_value = $this->getOldValue();
|
||||
$new_value = $this->getNewValue();
|
||||
|
||||
if (!strlen($old_value)) {
|
||||
if (!phutil_nonempty_string($old_value)) {
|
||||
return pht(
|
||||
'%s set the alternate text for this file to %s.',
|
||||
$this->renderAuthor(),
|
||||
$this->renderNewValue());
|
||||
} else if (!strlen($new_value)) {
|
||||
} else if (!phutil_nonempty_string($new_value)) {
|
||||
return pht(
|
||||
'%s removed the alternate text for this file (was %s).',
|
||||
$this->renderAuthor(),
|
||||
|
|
|
@ -99,7 +99,7 @@ final class HarbormasterBuildMessageResumeTransaction
|
|||
throw new HarbormasterMessageException(
|
||||
pht('Unable to Resume Build'),
|
||||
pht(
|
||||
'You can not resume this build beacuse it is already resuming.'));
|
||||
'You can not resume this build because it is already resuming.'));
|
||||
}
|
||||
|
||||
if ($build->isRestarting()) {
|
||||
|
|
|
@ -22,7 +22,7 @@ final class HeraldRuleDatasource
|
|||
$query = id(new HeraldRuleQuery())
|
||||
->setViewer($viewer);
|
||||
|
||||
if (preg_match('/^[hH]\d+\z/', $raw_query)) {
|
||||
if (($raw_query !== null) && preg_match('/^[hH]\d+\z/', $raw_query)) {
|
||||
$id = trim($raw_query, 'hH');
|
||||
$id = (int)$id;
|
||||
$query->withIDs(array($id));
|
||||
|
|
|
@ -31,7 +31,7 @@ final class PhabricatorHomeLauncherProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ final class PhabricatorHomeProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,12 +127,12 @@ final class LegalpadDocumentSignatureSearchEngine
|
|||
}
|
||||
|
||||
$name_contains = $saved->getParameter('nameContains');
|
||||
if (strlen($name_contains)) {
|
||||
if (phutil_nonempty_string($name_contains)) {
|
||||
$query->withNameContains($name_contains);
|
||||
}
|
||||
|
||||
$email_contains = $saved->getParameter('emailContains');
|
||||
if (strlen($email_contains)) {
|
||||
if (phutil_nonempty_string($email_contains)) {
|
||||
$query->withEmailContains($email_contains);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,10 @@ final class ManiphestReportController extends ManiphestController {
|
|||
switch ($row['transactionType']) {
|
||||
case ManiphestTaskStatusTransaction::TRANSACTIONTYPE:
|
||||
// NOTE: Hack to avoid json_decode().
|
||||
$oldv = trim($row['oldValue'], '"');
|
||||
$oldv = $row['oldValue'];
|
||||
if ($oldv !== null) {
|
||||
$oldv = trim($oldv, '"');
|
||||
}
|
||||
$newv = trim($row['newValue'], '"');
|
||||
break;
|
||||
case ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE:
|
||||
|
|
|
@ -97,8 +97,17 @@ final class ManiphestTaskPointsTransaction
|
|||
return 'fa-calculator';
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize your Story Points from generic stuff to double or null.
|
||||
* @param mixed $value Your raw Story Points
|
||||
* @return double|null
|
||||
*/
|
||||
private function getValueForPoints($value) {
|
||||
if (!strlen($value)) {
|
||||
// The Point can be various types also thanks to Conduit API
|
||||
// like integers, floats, null, and strings of course.
|
||||
// Everything meaningful must be printable as a string.
|
||||
$is_empty = phutil_string_cast($value) === '';
|
||||
if ($is_empty) {
|
||||
$value = null;
|
||||
}
|
||||
if ($value !== null) {
|
||||
|
|
|
@ -114,7 +114,7 @@ final class PhabricatorApplicationDetailViewController
|
|||
}
|
||||
|
||||
$overview = $application->getOverview();
|
||||
if (strlen($overview)) {
|
||||
if (phutil_nonempty_string($overview)) {
|
||||
$overview = new PHUIRemarkupView($viewer, $overview);
|
||||
$properties->addSectionHeader(
|
||||
pht('Overview'), PHUIPropertyListView::ICON_SUMMARY);
|
||||
|
|
|
@ -24,7 +24,13 @@ abstract class PhabricatorApplicationConfigurationPanel
|
|||
return $this->application;
|
||||
}
|
||||
|
||||
public function getPanelURI($path = null) {
|
||||
/**
|
||||
* Get the URI for this application configuration panel.
|
||||
*
|
||||
* @param string? Optional path to append.
|
||||
* @return string Relative URI for the panel.
|
||||
*/
|
||||
public function getPanelURI($path = '') {
|
||||
$app_key = get_class($this->getApplication());
|
||||
$panel_key = $this->getPanelKey();
|
||||
$base = "/applications/panel/{$app_key}/{$panel_key}/";
|
||||
|
|
|
@ -45,7 +45,7 @@ final class PhabricatorAppSearchEngine
|
|||
->withUnlisted(false);
|
||||
|
||||
$name = $saved->getParameter('name');
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
$query->withNameContains($name);
|
||||
}
|
||||
|
||||
|
|
|
@ -421,7 +421,7 @@ final class PhabricatorMetaMTAMailViewController
|
|||
$properties->addProperty(pht('Message PHID'), $mail->getPHID());
|
||||
|
||||
$details = $mail->getMessage();
|
||||
if (!strlen($details)) {
|
||||
if (!phutil_nonempty_string($details)) {
|
||||
$details = phutil_tag('em', array(), pht('None'));
|
||||
}
|
||||
$properties->addProperty(pht('Status Details'), $details);
|
||||
|
|
|
@ -10,7 +10,7 @@ final class MultimeterSampleController extends MultimeterController {
|
|||
$viewer = $this->getViewer();
|
||||
$group_map = $this->getColumnMap();
|
||||
|
||||
$group = explode('.', $request->getStr('group'));
|
||||
$group = explode('.', $request->getStr('group', ''));
|
||||
$group = array_intersect($group, array_keys($group_map));
|
||||
$group = array_fuse($group);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ final class PhabricatorOwnersPackageDatasource
|
|||
|
||||
// If the user is querying by monogram explicitly, like "O123", do an ID
|
||||
// search. Otherwise, do an ngram substring search.
|
||||
if (preg_match('/^[oO]\d+\z/', $raw_query)) {
|
||||
if ($raw_query && preg_match('/^[oO]\d+\z/', $raw_query)) {
|
||||
$id = trim($raw_query, 'oO');
|
||||
$id = (int)$id;
|
||||
$query->withIDs(array($id));
|
||||
|
|
|
@ -91,6 +91,9 @@ final class PhabricatorUserProfileImageCacheType
|
|||
}
|
||||
|
||||
public function isRawCacheDataValid(PhabricatorUser $user, $key, $data) {
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
$parts = explode(',', $data, 2);
|
||||
$version = reset($parts);
|
||||
return ($version === $this->getCacheVersion($user));
|
||||
|
|
|
@ -118,14 +118,14 @@ final class PhabricatorPeopleWelcomeMailEngine
|
|||
$recipient = $this->getRecipient();
|
||||
|
||||
$custom_body = $this->getWelcomeMessage();
|
||||
if (strlen($custom_body)) {
|
||||
if (phutil_nonempty_string($custom_body)) {
|
||||
return $this->newRemarkupText($custom_body);
|
||||
}
|
||||
|
||||
$default_body = PhabricatorAuthMessage::loadMessageText(
|
||||
$recipient,
|
||||
PhabricatorAuthWelcomeMailMessageType::MESSAGEKEY);
|
||||
if (strlen($default_body)) {
|
||||
if (phutil_nonempty_string($default_body)) {
|
||||
return $this->newRemarkupText($default_body);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorPeopleBadgesProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorPeopleCommitsProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorPeopleManageProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorPeopleRevisionsProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorPeopleTasksProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ final class PhabricatorPeopleSearchEngine
|
|||
protected function getBuiltinQueryNames() {
|
||||
$names = array(
|
||||
'active' => pht('Active'),
|
||||
'admin' => pht('Administrators'),
|
||||
'all' => pht('All'),
|
||||
);
|
||||
|
||||
|
@ -221,6 +222,9 @@ final class PhabricatorPeopleSearchEngine
|
|||
case 'active':
|
||||
return $query
|
||||
->setParameter('isDisabled', false);
|
||||
case 'admin':
|
||||
return $query
|
||||
->setParameter('isAdmin', true);
|
||||
case 'approval':
|
||||
return $query
|
||||
->setParameter('needsApproval', true)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue