code
stringlengths 15
9.96M
| docstring
stringlengths 1
10.1k
| func_name
stringlengths 1
124
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 6
186
| url
stringlengths 50
236
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public static function clearCache()
{
self::$frames = array();
} | ---------------------------------------------------------------------- | clearCache | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function buildCache()
{
QRtools::markTime('before_build_cache');
$mask = new QRmask();
for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
$frame = QRspec::newFrame($a);
if (QR_IMAGE) {
$fileName = QR_CACHE_DIR.'frame_'.$a.'.png';
QRimage::png(self::binarize($frame), $fileName, 1, 0);
}
$width = count($frame);
$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
for ($maskNo=0; $maskNo<8; $maskNo++)
$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
}
QRtools::markTime('after_build_cache');
} | ---------------------------------------------------------------------- | buildCache | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function log($outfile, $err)
{
if (QR_LOG_DIR !== false) {
if ($err != '') {
if ($outfile !== false) {
file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
} else {
file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
}
}
}
} | ---------------------------------------------------------------------- | log | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function dumpMask($frame)
{
$width = count($frame);
for($y=0;$y<$width;$y++) {
for($x=0;$x<$width;$x++) {
echo ord($frame[$y][$x]).',';
}
}
} | ---------------------------------------------------------------------- | dumpMask | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function startTimeBenchmark()
{
$GLOBALS['qr_time_bench'] = array();
self::markTime('start');
} | ---------------------------------------------------------------------- | startTimeBenchmark | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function markTime($markerId)
{
list($usec, $sec) = explode(" ", microtime());
$time = ((float)$usec + (float)$sec);
if (!isset($GLOBALS['qr_time_bench']))
$GLOBALS['qr_time_bench'] = array();
$GLOBALS['qr_time_bench'][$markerId] = $time;
if ((!self::$timeBenchmarkStarted)&&($markerId != 'start')) {
self::$timeBenchmarkStarted = true;
$GLOBALS['qr_time_bench']['start'] = $time;
}
} | ---------------------------------------------------------------------- | markTime | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function timeBenchmark()
{
self::markTime('finish');
$lastTime = 0;
$startTime = 0;
$p = 0;
echo '<table cellpadding="3" cellspacing="1">
<thead><tr style="border-bottom:1px solid silver"><td colspan="2" style="text-align:center">BENCHMARK</td></tr></thead>
<tbody>';
foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
if ($p > 0) {
echo '<tr><th style="text-align:right">till '.$markerId.': </th><td>'.number_format($thisTime-$lastTime, 6).'s</td></tr>';
} else {
$startTime = $thisTime;
}
$p++;
$lastTime = $thisTime;
}
echo '</tbody><tfoot>
<tr style="border-top:2px solid black"><th style="text-align:right">TOTAL: </th><td>'.number_format($lastTime-$startTime, 6).'s</td></tr>
</tfoot>
</table>';
} | ---------------------------------------------------------------------- | timeBenchmark | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function lengthIndicator($mode, $version)
{
if ($mode == QR_MODE_STRUCTURE)
return 0;
if ($version <= 9) {
$l = 0;
} else if ($version <= 26) {
$l = 1;
} else {
$l = 2;
}
return self::$lengthTableBits[$mode][$l];
} | ---------------------------------------------------------------------- | lengthIndicator | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function maximumWords($mode, $version)
{
if($mode == QR_MODE_STRUCTURE)
return 3;
if($version <= 9) {
$l = 0;
} else if($version <= 26) {
$l = 1;
} else {
$l = 2;
}
$bits = self::$lengthTableBits[$mode][$l];
$words = (1 << $bits) - 1;
if($mode == QR_MODE_KANJI) {
$words *= 2; // the number of bytes is required
}
return $words;
} | ---------------------------------------------------------------------- | maximumWords | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function getEccSpec($version, $level, array &$spec)
{
if (count($spec) < 5) {
$spec = array(0,0,0,0,0);
}
$b1 = self::$eccTable[$version][$level][0];
$b2 = self::$eccTable[$version][$level][1];
$data = self::getDataLength($version, $level);
$ecc = self::getECCLength($version, $level);
if($b2 == 0) {
$spec[0] = $b1;
$spec[1] = (int)($data / $b1);
$spec[2] = (int)($ecc / $b1);
$spec[3] = 0;
$spec[4] = 0;
} else {
$spec[0] = $b1;
$spec[1] = (int)($data / ($b1 + $b2));
$spec[2] = (int)($ecc / ($b1 + $b2));
$spec[3] = $b2;
$spec[4] = $spec[1] + 1;
}
} | ----------------------------------------------------------------------
CACHEABLE!!! | getEccSpec | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function putAlignmentPattern($version, &$frame, $width)
{
if($version < 2)
return;
$d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
if($d < 0) {
$w = 2;
} else {
$w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
}
if($w * $w - 3 == 1) {
$x = self::$alignmentPattern[$version][0];
$y = self::$alignmentPattern[$version][0];
self::putAlignmentMarker($frame, $x, $y);
return;
}
$cx = self::$alignmentPattern[$version][0];
for($x=1; $x<$w - 1; $x++) {
self::putAlignmentMarker($frame, 6, $cx);
self::putAlignmentMarker($frame, $cx, 6);
$cx += $d;
}
$cy = self::$alignmentPattern[$version][0];
for($y=0; $y<$w-1; $y++) {
$cx = self::$alignmentPattern[$version][0];
for($x=0; $x<$w-1; $x++) {
self::putAlignmentMarker($frame, $cx, $cy);
$cx += $d;
}
$cy += $d;
}
} | ---------------------------------------------------------------------- | putAlignmentPattern | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function getVersionPattern($version)
{
if($version < 7 || $version > QRSPEC_VERSION_MAX)
return 0;
return self::$versionPattern[$version -7];
} | ---------------------------------------------------------------------- | getVersionPattern | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function createFrame($version)
{
$width = self::$capacity[$version][QRCAP_WIDTH];
$frameLine = str_repeat ("\0", $width);
$frame = array_fill(0, $width, $frameLine);
// Finder pattern
self::putFinderPattern($frame, 0, 0);
self::putFinderPattern($frame, $width - 7, 0);
self::putFinderPattern($frame, 0, $width - 7);
// Separator
$yOffset = $width - 7;
for($y=0; $y<7; $y++) {
$frame[$y][7] = "\xc0";
$frame[$y][$width - 8] = "\xc0";
$frame[$yOffset][7] = "\xc0";
$yOffset++;
}
$setPattern = str_repeat("\xc0", 8);
self::set($frame, 0, 7, $setPattern);
self::set($frame, $width-8, 7, $setPattern);
self::set($frame, 0, $width - 8, $setPattern);
// Format info
$setPattern = str_repeat("\x84", 9);
self::set($frame, 0, 8, $setPattern);
self::set($frame, $width - 8, 8, $setPattern, 8);
$yOffset = $width - 8;
for($y=0; $y<8; $y++,$yOffset++) {
$frame[$y][8] = "\x84";
$frame[$yOffset][8] = "\x84";
}
// Timing pattern
for($i=1; $i<$width-15; $i++) {
$frame[6][7+$i] = chr(0x90 | ($i & 1));
$frame[7+$i][6] = chr(0x90 | ($i & 1));
}
// Alignment pattern
self::putAlignmentPattern($version, $frame, $width);
// Version information
if($version >= 7) {
$vinf = self::getVersionPattern($version);
$v = $vinf;
for($x=0; $x<6; $x++) {
for($y=0; $y<3; $y++) {
$frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
$v = $v >> 1;
}
}
$v = $vinf;
for($y=0; $y<6; $y++) {
for($x=0; $x<3; $x++) {
$frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
$v = $v >> 1;
}
}
}
// and a little bit...
$frame[$width - 8][8] = "\x81";
return $frame;
} | ---------------------------------------------------------------------- | createFrame | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function newFrame($version)
{
if($version < 1 || $version > QRSPEC_VERSION_MAX)
return null;
if(!isset(self::$frames[$version])) {
$fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
if (QR_CACHEABLE) {
if (file_exists($fileName)) {
self::$frames[$version] = self::unserial(file_get_contents($fileName));
} else {
self::$frames[$version] = self::createFrame($version);
file_put_contents($fileName, self::serial(self::$frames[$version]));
}
} else {
self::$frames[$version] = self::createFrame($version);
}
}
if(is_null(self::$frames[$version]))
return null;
return self::$frames[$version];
} | ---------------------------------------------------------------------- | newFrame | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function rsBlockNum($spec) { return $spec[0] + $spec[3]; } | @{*/ | rsBlockNum | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function encodeModeNum($version)
{
try {
$words = (int)($this->size / 3);
$bs = new QRbitstream();
$val = 0x1;
$bs->appendNum(4, $val);
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
for($i=0; $i<$words; $i++) {
$val = (ord($this->data[$i*3 ]) - ord('0')) * 100;
$val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
$val += (ord($this->data[$i*3+2]) - ord('0'));
$bs->appendNum(10, $val);
}
if($this->size - $words * 3 == 1) {
$val = ord($this->data[$words*3]) - ord('0');
$bs->appendNum(4, $val);
} else if($this->size - $words * 3 == 2) {
$val = (ord($this->data[$words*3 ]) - ord('0')) * 10;
$val += (ord($this->data[$words*3+1]) - ord('0'));
$bs->appendNum(7, $val);
}
$this->bstream = $bs;
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | encodeModeNum | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function encodeModeAn($version)
{
try {
$words = (int)($this->size / 2);
$bs = new QRbitstream();
$bs->appendNum(4, 0x02);
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
for($i=0; $i<$words; $i++) {
$val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
$val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
$bs->appendNum(11, $val);
}
if($this->size & 1) {
$val = QRinput::lookAnTable(ord($this->data[$words * 2]));
$bs->appendNum(6, $val);
}
$this->bstream = $bs;
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | encodeModeAn | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function encodeMode8($version)
{
try {
$bs = new QRbitstream();
$bs->appendNum(4, 0x4);
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
for($i=0; $i<$this->size; $i++) {
$bs->appendNum(8, ord($this->data[$i]));
}
$this->bstream = $bs;
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | encodeMode8 | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function encodeModeKanji($version)
{
try {
$bs = new QRbitstream();
$bs->appendNum(4, 0x8);
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
for($i=0; $i<$this->size; $i+=2) {
$val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
if($val <= 0x9ffc) {
$val -= 0x8140;
} else {
$val -= 0xc140;
}
$h = ($val >> 8) * 0xc0;
$val = ($val & 0xff) + $h;
$bs->appendNum(13, $val);
}
$this->bstream = $bs;
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | encodeModeKanji | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function encodeModeStructure()
{
try {
$bs = new QRbitstream();
$bs->appendNum(4, 0x03);
$bs->appendNum(4, ord($this->data[1]) - 1);
$bs->appendNum(4, ord($this->data[0]) - 1);
$bs->appendNum(8, ord($this->data[2]));
$this->bstream = $bs;
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | encodeModeStructure | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function estimateBitStreamSizeOfEntry($version)
{
$bits = 0;
if($version == 0)
$version = 1;
switch($this->mode) {
case QR_MODE_NUM: $bits = QRinput::estimateBitsModeNum($this->size); break;
case QR_MODE_AN: $bits = QRinput::estimateBitsModeAn($this->size); break;
case QR_MODE_8: $bits = QRinput::estimateBitsMode8($this->size); break;
case QR_MODE_KANJI: $bits = QRinput::estimateBitsModeKanji($this->size);break;
case QR_MODE_STRUCTURE: return STRUCTURE_HEADER_BITS;
default:
return 0;
}
$l = QRspec::lengthIndicator($this->mode, $version);
$m = 1 << $l;
$num = (int)(($this->size + $m - 1) / $m);
$bits += $num * (4 + $l);
return $bits;
} | ---------------------------------------------------------------------- | estimateBitStreamSizeOfEntry | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function encodeBitStream($version)
{
try {
unset($this->bstream);
$words = QRspec::maximumWords($this->mode, $version);
if($this->size > $words) {
$st1 = new QRinputItem($this->mode, $words, $this->data);
$st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
$st1->encodeBitStream($version);
$st2->encodeBitStream($version);
$this->bstream = new QRbitstream();
$this->bstream->append($st1->bstream);
$this->bstream->append($st2->bstream);
unset($st1);
unset($st2);
} else {
$ret = 0;
switch($this->mode) {
case QR_MODE_NUM: $ret = $this->encodeModeNum($version); break;
case QR_MODE_AN: $ret = $this->encodeModeAn($version); break;
case QR_MODE_8: $ret = $this->encodeMode8($version); break;
case QR_MODE_KANJI: $ret = $this->encodeModeKanji($version);break;
case QR_MODE_STRUCTURE: $ret = $this->encodeModeStructure(); break;
default:
break;
}
if($ret < 0)
return -1;
}
return $this->bstream->size();
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | encodeBitStream | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function __construct($version = 0, $level = QR_ECLEVEL_L)
{
if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
throw new Exception('Invalid version no');
return NULL;
}
$this->version = $version;
$this->level = $level;
} | ---------------------------------------------------------------------- | __construct | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getVersion()
{
return $this->version;
} | ---------------------------------------------------------------------- | getVersion | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function setVersion($version)
{
if($version < 0 || $version > QRSPEC_VERSION_MAX) {
throw new Exception('Invalid version no');
return -1;
}
$this->version = $version;
return 0;
} | ---------------------------------------------------------------------- | setVersion | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getErrorCorrectionLevel()
{
return $this->level;
} | ---------------------------------------------------------------------- | getErrorCorrectionLevel | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function setErrorCorrectionLevel($level)
{
if($level > QR_ECLEVEL_H) {
throw new Exception('Invalid ECLEVEL');
return -1;
}
$this->level = $level;
return 0;
} | ---------------------------------------------------------------------- | setErrorCorrectionLevel | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function appendEntry(QRinputItem $entry)
{
$this->items[] = $entry;
} | ---------------------------------------------------------------------- | appendEntry | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function append($mode, $size, $data)
{
try {
$entry = new QRinputItem($mode, $size, $data);
$this->items[] = $entry;
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | append | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function insertStructuredAppendHeader($size, $index, $parity)
{
if( $size > MAX_STRUCTURED_SYMBOLS ) {
throw new Exception('insertStructuredAppendHeader wrong size');
}
if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
throw new Exception('insertStructuredAppendHeader wrong index');
}
$buf = array($size, $index, $parity);
try {
$entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
array_unshift($this->items, $entry);
return 0;
} catch (Exception $e) {
return -1;
}
} | ---------------------------------------------------------------------- | insertStructuredAppendHeader | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function calcParity()
{
$parity = 0;
foreach($this->items as $item) {
if($item->mode != QR_MODE_STRUCTURE) {
for($i=$item->size-1; $i>=0; $i--) {
$parity ^= $item->data[$i];
}
}
}
return $parity;
} | ---------------------------------------------------------------------- | calcParity | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function checkModeNum($size, $data)
{
for($i=0; $i<$size; $i++) {
if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
return false;
}
}
return true;
} | ---------------------------------------------------------------------- | checkModeNum | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function estimateBitsModeNum($size)
{
$w = (int)$size / 3;
$bits = $w * 10;
switch($size - $w * 3) {
case 1:
$bits += 4;
break;
case 2:
$bits += 7;
break;
default:
break;
}
return $bits;
} | ---------------------------------------------------------------------- | estimateBitsModeNum | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function lookAnTable($c)
{
return (($c > 127)?-1:self::$anTable[$c]);
} | ---------------------------------------------------------------------- | lookAnTable | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function checkModeAn($size, $data)
{
for($i=0; $i<$size; $i++) {
if (self::lookAnTable(ord($data[$i])) == -1) {
return false;
}
}
return true;
} | ---------------------------------------------------------------------- | checkModeAn | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function estimateBitsModeAn($size)
{
$w = (int)($size / 2);
$bits = $w * 11;
if($size & 1) {
$bits += 6;
}
return $bits;
} | ---------------------------------------------------------------------- | estimateBitsModeAn | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function estimateBitsMode8($size)
{
return $size * 8;
} | ---------------------------------------------------------------------- | estimateBitsMode8 | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function estimateBitsModeKanji($size)
{
return (int)(($size / 2) * 13);
} | ---------------------------------------------------------------------- | estimateBitsModeKanji | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function checkModeKanji($size, $data)
{
if($size & 1)
return false;
for($i=0; $i<$size; $i+=2) {
$val = (ord($data[$i]) << 8) | ord($data[$i+1]);
if( $val < 0x8140
|| ($val > 0x9ffc && $val < 0xe040)
|| $val > 0xebbf) {
return false;
}
}
return true;
} | ---------------------------------------------------------------------- | checkModeKanji | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function check($mode, $size, $data)
{
if($size <= 0)
return false;
switch($mode) {
case QR_MODE_NUM: return self::checkModeNum($size, $data); break;
case QR_MODE_AN: return self::checkModeAn($size, $data); break;
case QR_MODE_KANJI: return self::checkModeKanji($size, $data); break;
case QR_MODE_8: return true; break;
case QR_MODE_STRUCTURE: return true; break;
default:
break;
}
return false;
} | ********************************************************************
Validation
******************************************************************** | check | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function estimateVersion()
{
$version = 0;
$prev = 0;
do {
$prev = $version;
$bits = $this->estimateBitStreamSize($prev);
$version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
if ($version < 0) {
return -1;
}
} while ($version > $prev);
return $version;
} | ---------------------------------------------------------------------- | estimateVersion | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function lengthOfCode($mode, $version, $bits)
{
$payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
switch($mode) {
case QR_MODE_NUM:
$chunks = (int)($payload / 10);
$remain = $payload - $chunks * 10;
$size = $chunks * 3;
if($remain >= 7) {
$size += 2;
} else if($remain >= 4) {
$size += 1;
}
break;
case QR_MODE_AN:
$chunks = (int)($payload / 11);
$remain = $payload - $chunks * 11;
$size = $chunks * 2;
if($remain >= 6)
$size++;
break;
case QR_MODE_8:
$size = (int)($payload / 8);
break;
case QR_MODE_KANJI:
$size = (int)(($payload / 13) * 2);
break;
case QR_MODE_STRUCTURE:
$size = (int)($payload / 8);
break;
default:
$size = 0;
break;
}
$maxsize = QRspec::maximumWords($mode, $version);
if($size < 0) $size = 0;
if($size > $maxsize) $size = $maxsize;
return $size;
} | ---------------------------------------------------------------------- | lengthOfCode | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function convertData()
{
$ver = $this->estimateVersion();
if($ver > $this->getVersion()) {
$this->setVersion($ver);
}
for(;;) {
$bits = $this->createBitStream();
if($bits < 0)
return -1;
$ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
if($ver < 0) {
throw new Exception('WRONG VERSION');
return -1;
} else if($ver > $this->getVersion()) {
$this->setVersion($ver);
} else {
break;
}
}
return 0;
} | ---------------------------------------------------------------------- | convertData | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function appendPaddingBit(&$bstream)
{
$bits = $bstream->size();
$maxwords = QRspec::getDataLength($this->version, $this->level);
$maxbits = $maxwords * 8;
if ($maxbits == $bits) {
return 0;
}
if ($maxbits - $bits < 5) {
return $bstream->appendNum($maxbits - $bits, 0);
}
$bits += 4;
$words = (int)(($bits + 7) / 8);
$padding = new QRbitstream();
$ret = $padding->appendNum($words * 8 - $bits + 4, 0);
if($ret < 0)
return $ret;
$padlen = $maxwords - $words;
if($padlen > 0) {
$padbuf = array();
for($i=0; $i<$padlen; $i++) {
$padbuf[$i] = ($i&1)?0x11:0xec;
}
$ret = $padding->appendBytes($padlen, $padbuf);
if($ret < 0)
return $ret;
}
$ret = $bstream->append($padding);
return $ret;
} | ---------------------------------------------------------------------- | appendPaddingBit | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getBitStream()
{
$bstream = $this->mergeBitStream();
if($bstream == null) {
return null;
}
$ret = $this->appendPaddingBit($bstream);
if($ret < 0) {
return null;
}
return $bstream;
} | ---------------------------------------------------------------------- | getBitStream | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getByteStream()
{
$bstream = $this->getBitStream();
if($bstream == null) {
return null;
}
return $bstream->toByte();
} | ---------------------------------------------------------------------- | getByteStream | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function __construct($dataStr, $input, $modeHint)
{
$this->dataStr = $dataStr;
$this->input = $input;
$this->modeHint = $modeHint;
} | ---------------------------------------------------------------------- | __construct | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function isdigitat($str, $pos)
{
if ($pos >= strlen($str))
return false;
return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
} | ---------------------------------------------------------------------- | isdigitat | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function isalnumat($str, $pos)
{
if ($pos >= strlen($str))
return false;
return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
} | ---------------------------------------------------------------------- | isalnumat | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function identifyMode($pos)
{
if ($pos >= strlen($this->dataStr))
return QR_MODE_NUL;
$c = $this->dataStr[$pos];
if(self::isdigitat($this->dataStr, $pos)) {
return QR_MODE_NUM;
} else if(self::isalnumat($this->dataStr, $pos)) {
return QR_MODE_AN;
} else if($this->modeHint == QR_MODE_KANJI) {
if ($pos+1 < strlen($this->dataStr))
{
$d = $this->dataStr[$pos+1];
$word = (ord($c) << 8) | ord($d);
if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
return QR_MODE_KANJI;
}
}
}
return QR_MODE_8;
} | ---------------------------------------------------------------------- | identifyMode | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function eatNum()
{
$ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
$p = 0;
while(self::isdigitat($this->dataStr, $p)) {
$p++;
}
$run = $p;
$mode = $this->identifyMode($p);
if($mode == QR_MODE_8) {
$dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+ QRinput::estimateBitsMode8(1) // + 4 + l8
- QRinput::estimateBitsMode8($run + 1); // - 4 - l8
if($dif > 0) {
return $this->eat8();
}
}
if($mode == QR_MODE_AN) {
$dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+ QRinput::estimateBitsModeAn(1) // + 4 + la
- QRinput::estimateBitsModeAn($run + 1);// - 4 - la
if($dif > 0) {
return $this->eatAn();
}
}
$ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
if($ret < 0)
return -1;
return $run;
} | ---------------------------------------------------------------------- | eatNum | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function eatAn()
{
$la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
$ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
$p = 0;
while(self::isalnumat($this->dataStr, $p)) {
if(self::isdigitat($this->dataStr, $p)) {
$q = $p;
while(self::isdigitat($this->dataStr, $q)) {
$q++;
}
$dif = QRinput::estimateBitsModeAn($p) // + 4 + la
+ QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
- QRinput::estimateBitsModeAn($q); // - 4 - la
if($dif < 0) {
break;
} else {
$p = $q;
}
} else {
$p++;
}
}
$run = $p;
if(!self::isalnumat($this->dataStr, $p)) {
$dif = QRinput::estimateBitsModeAn($run) + 4 + $la
+ QRinput::estimateBitsMode8(1) // + 4 + l8
- QRinput::estimateBitsMode8($run + 1); // - 4 - l8
if($dif > 0) {
return $this->eat8();
}
}
$ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
if($ret < 0)
return -1;
return $run;
} | ---------------------------------------------------------------------- | eatAn | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function eatKanji()
{
$p = 0;
while($this->identifyMode($p) == QR_MODE_KANJI) {
$p += 2;
}
$ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
if($ret < 0)
return -1;
return $run;
} | ---------------------------------------------------------------------- | eatKanji | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function eat8()
{
$la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
$ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
$p = 1;
$dataStrLen = strlen($this->dataStr);
while($p < $dataStrLen) {
$mode = $this->identifyMode($p);
if($mode == QR_MODE_KANJI) {
break;
}
if($mode == QR_MODE_NUM) {
$q = $p;
while(self::isdigitat($this->dataStr, $q)) {
$q++;
}
$dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+ QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
- QRinput::estimateBitsMode8($q); // - 4 - l8
if($dif < 0) {
break;
} else {
$p = $q;
}
} else if($mode == QR_MODE_AN) {
$q = $p;
while(self::isalnumat($this->dataStr, $q)) {
$q++;
}
$dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+ QRinput::estimateBitsModeAn($q - $p) + 4 + $la
- QRinput::estimateBitsMode8($q); // - 4 - l8
if($dif < 0) {
break;
} else {
$p = $q;
}
} else {
$p++;
}
}
$run = $p;
$ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
if($ret < 0)
return -1;
return $run;
} | ---------------------------------------------------------------------- | eat8 | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function splitString()
{
while (strlen($this->dataStr) > 0)
{
if($this->dataStr == '')
return 0;
$mode = $this->identifyMode(0);
switch ($mode) {
case QR_MODE_NUM: $length = $this->eatNum(); break;
case QR_MODE_AN: $length = $this->eatAn(); break;
case QR_MODE_KANJI:
if ($hint == QR_MODE_KANJI)
$length = $this->eatKanji();
else $length = $this->eat8();
break;
default: $length = $this->eat8(); break;
}
if($length == 0) return 0;
if($length < 0) return -1;
$this->dataStr = substr($this->dataStr, $length);
}
} | ---------------------------------------------------------------------- | splitString | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function toUpper()
{
$stringLen = strlen($this->dataStr);
$p = 0;
while ($p<$stringLen) {
$mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
if($mode == QR_MODE_KANJI) {
$p += 2;
} else {
if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) {
$this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
}
$p++;
}
}
return $this->dataStr;
} | ---------------------------------------------------------------------- | toUpper | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true)
{
if(is_null($string) || $string == '\0' || $string == '') {
throw new Exception('empty string!!!');
}
$split = new QRsplit($string, $input, $modeHint);
if(!$casesensitive)
$split->toUpper();
return $split->splitString();
} | ---------------------------------------------------------------------- | splitStringToQRinput | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function __construct()
{
$this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
} | ---------------------------------------------------------------------- | __construct | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function writeFormatInformation($width, &$frame, $mask, $level)
{
$blacks = 0;
$format = QRspec::getFormatInfo($mask, $level);
for($i=0; $i<8; $i++) {
if($format & 1) {
$blacks += 2;
$v = 0x85;
} else {
$v = 0x84;
}
$frame[8][$width - 1 - $i] = chr($v);
if($i < 6) {
$frame[$i][8] = chr($v);
} else {
$frame[$i + 1][8] = chr($v);
}
$format = $format >> 1;
}
for($i=0; $i<7; $i++) {
if($format & 1) {
$blacks += 2;
$v = 0x85;
} else {
$v = 0x84;
}
$frame[$width - 7 + $i][8] = chr($v);
if($i == 0) {
$frame[8][7] = chr($v);
} else {
$frame[8][6 - $i] = chr($v);
}
$format = $format >> 1;
}
return $blacks;
} | ---------------------------------------------------------------------- | writeFormatInformation | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function mask0($x, $y) { return ($x+$y)&1; } | ---------------------------------------------------------------------- | mask0 | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function generateMaskNo($maskNo, $width, $frame)
{
$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
for($y=0; $y<$width; $y++) {
for($x=0; $x<$width; $x++) {
if(ord($frame[$y][$x]) & 0x80) {
$bitMask[$y][$x] = 0;
} else {
$maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
$bitMask[$y][$x] = ($maskFunc == 0)?1:0;
}
}
}
return $bitMask;
} | ---------------------------------------------------------------------- | generateMaskNo | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function serial($bitFrame)
{
$codeArr = array();
foreach ($bitFrame as $line)
$codeArr[] = join('', $line);
return gzcompress(join("\n", $codeArr), 9);
} | ---------------------------------------------------------------------- | serial | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function unserial($code)
{
$codeArr = array();
$codeLines = explode("\n", gzuncompress($code));
foreach ($codeLines as $line)
$codeArr[] = str_split($line);
return $codeArr;
} | ---------------------------------------------------------------------- | unserial | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
{
$b = 0;
$bitMask = array();
$fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
if (QR_CACHEABLE) {
if (file_exists($fileName)) {
$bitMask = self::unserial(file_get_contents($fileName));
} else {
$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
file_put_contents($fileName, self::serial($bitMask));
}
} else {
$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
}
if ($maskGenOnly)
return;
$d = $s;
for($y=0; $y<$width; $y++) {
for($x=0; $x<$width; $x++) {
if($bitMask[$y][$x] == 1) {
$d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
}
$b += (int)(ord($d[$y][$x]) & 1);
}
}
return $b;
} | ---------------------------------------------------------------------- | makeMaskNo | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function makeMask($width, $frame, $maskNo, $level)
{
$masked = array_fill(0, $width, str_repeat("\0", $width));
$this->makeMaskNo($maskNo, $width, $frame, $masked);
$this->writeFormatInformation($width, $masked, $maskNo, $level);
return $masked;
} | ---------------------------------------------------------------------- | makeMask | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function calcN1N3($length)
{
$demerit = 0;
for($i=0; $i<$length; $i++) {
if($this->runLength[$i] >= 5) {
$demerit += (N1 + ($this->runLength[$i] - 5));
}
if($i & 1) {
if(($i >= 3) && ($i < ($length-2)) && ($this->runLength[$i] % 3 == 0)) {
$fact = (int)($this->runLength[$i] / 3);
if(($this->runLength[$i-2] == $fact) &&
($this->runLength[$i-1] == $fact) &&
($this->runLength[$i+1] == $fact) &&
($this->runLength[$i+2] == $fact)) {
if(($this->runLength[$i-3] < 0) || ($this->runLength[$i-3] >= (4 * $fact))) {
$demerit += N3;
} else if((($i+3) >= $length) || ($this->runLength[$i+3] >= (4 * $fact))) {
$demerit += N3;
}
}
}
}
}
return $demerit;
} | ---------------------------------------------------------------------- | calcN1N3 | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function evaluateSymbol($width, $frame)
{
$head = 0;
$demerit = 0;
for($y=0; $y<$width; $y++) {
$head = 0;
$this->runLength[0] = 1;
$frameY = $frame[$y];
if ($y>0)
$frameYM = $frame[$y-1];
for($x=0; $x<$width; $x++) {
if(($x > 0) && ($y > 0)) {
$b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
$w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
if(($b22 | ($w22 ^ 1))&1) {
$demerit += N2;
}
}
if(($x == 0) && (ord($frameY[$x]) & 1)) {
$this->runLength[0] = -1;
$head = 1;
$this->runLength[$head] = 1;
} else if($x > 0) {
if((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
$head++;
$this->runLength[$head] = 1;
} else {
$this->runLength[$head]++;
}
}
}
$demerit += $this->calcN1N3($head+1);
}
for($x=0; $x<$width; $x++) {
$head = 0;
$this->runLength[0] = 1;
for($y=0; $y<$width; $y++) {
if($y == 0 && (ord($frame[$y][$x]) & 1)) {
$this->runLength[0] = -1;
$head = 1;
$this->runLength[$head] = 1;
} else if($y > 0) {
if((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
$head++;
$this->runLength[$head] = 1;
} else {
$this->runLength[$head]++;
}
}
}
$demerit += $this->calcN1N3($head+1);
}
return $demerit;
} | ---------------------------------------------------------------------- | evaluateSymbol | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function __construct($selfId, $sx, $sy)
{
$this->total = 1;
$this->points = array(array($sx,$sy,false));
$this->id = $selfId;
} | ---------------------------------------------------------------------- | __construct | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getGroups()
{
return $this->groups;
} | ---------------------------------------------------------------------- | getGroups | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getPaths()
{
return $this->paths;
} | ---------------------------------------------------------------------- | getPaths | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function getWidth()
{
return $this->width;
} | ---------------------------------------------------------------------- | getWidth | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function dumpTab()
{
echo "<style>";
echo "td { height: 2.5em; color: black; font-size: 8px;
border-top: 1px solid silver; border-left: 1px solid silver }";
echo "table { border-bottom: 1px solid silver; border-right: 1px solid silver }";
echo "</style>";
echo "<table border=0 cellpadding=0 cellspacing=0>";
$colorTab = array();
foreach($this->tab as $line) {
foreach($line as $item) {
if (!isset($colorTab[$item])) {
$colorTab[$item] = 'hsl('.mt_rand(0, 360).', '.floor((mt_rand(0, 25))+75).'%, 50%)';
}
}
}
foreach($this->tab as $line) {
echo "<tr>";
foreach($line as $item) {
if ($item == 0) {
echo "<td> </td>";
} else {
echo "<td style='text-align:center;width: 4em;background:".$colorTab[$item]."'>".$item."</td>";
}
}
echo "</tr>";
}
echo "</table>";
} | ---------------------------------------------------------------------- | dumpTab | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function dumpEdges()
{
$style_off = '1px dotted silver;';
$style_on = '3px solid red;';
$colorAlloc = array();
echo "<table border='0'>";
$py = 0;
foreach($this->tab_edges as $line) {
$px = 0;
echo "<tr>";
foreach($line as $item) {
$styles = 'border-top:';
if ($item[QR_AREA_N])
$styles .= $style_on;
else $styles .= $style_off;
$styles .= 'border-bottom:';
if ($item[QR_AREA_S])
$styles .= $style_on;
else $styles .= $style_off;
$styles .= 'border-right:';
if ($item[QR_AREA_E])
$styles .= $style_on;
else $styles .= $style_off;
$styles .= 'border-left:';
if ($item[QR_AREA_W])
$styles .= $style_on;
else $styles .= $style_off;
$color = '';
$grp = $this->tab[$py][$px];
if ($grp>0) {
if (!isset($colorAlloc[$grp])) {
$colorAlloc[$grp] = 'hsl('.mt_rand(0, 360).', '.floor((mt_rand(0, 25))+75).'%, 50%)';
}
$color = 'background:'.$colorAlloc[$grp];
}
if ($grp == 0)
$grp = ' ';
echo "<td style='text-align:center;width:1.5em;".$styles.$color."'>".$grp."</td>";
$px++;
}
echo "</tr>";
$py++;
}
echo "</table>";
} | ---------------------------------------------------------------------- | dumpEdges | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private static function rle(&$stringData)
{
$outArray = array();
$symbolArray = str_split($stringData);
$last = '';
$run = 1;
while (count($symbolArray) > 0) {
$symbol = array_shift($symbolArray);
if ($symbol != $last) {
if ($run > 1)
$outArray[] = $run;
if ($last != '')
$outArray[] = $last;
$run = 1;
$last = $symbol;
} else {
$run++;
}
}
if ($run > 1)
$outArray[] = $run;
$outArray[] = $last;
$stringData = $outArray;
} | ---------------------------------------------------------------------- | rle | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function getAt($posx, $posy)
{
if (($posx<0)||($posy<0)||($posx>=$this->width)||($posy>=$this->width))
return 0;
return $this->tab[$posy][$posx];
} | ---------------------------------------------------------------------- | getAt | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function getOnElem($elem, $deltax = 0, $deltay = 0)
{
$posx = $elem[0]+$deltax;
$posy = $elem[1]+$deltay;
if (($posx<0)||($posy<0)||($posx>=$this->width)||($posy>=$this->width))
return 0;
return $this->tab[$posy][$posx];
} | ---------------------------------------------------------------------- | getOnElem | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function addGroupElement($groupId, $h, $v, $sx, $sy)
{
$this->groups[$groupId]->total++;
if ($h)
$this->groups[$groupId]->horizontal = true;
if ($v)
$this->groups[$groupId]->vertical = true;
$this->groups[$groupId]->points[] = array($sx, $sy, false);
} | ---------------------------------------------------------------------- | addGroupElement | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function detectGroups()
{
for ($sy = 0; $sy < $this->width; $sy++) {
for ($sx = 0; $sx < $this->width; $sx++) {
if ($this->tab[$sy][$sx] == 1) { // non-allocated
$gid_left = 0;
$gid_top = 0;
$grouped = false;
if ($sx>0) {
$gid_left = $this->tab[$sy][$sx-1]; // previous on left
if ($gid_left > 1) { // if already in group
$this->tab[$sy][$sx] = $gid_left;
$grouped = true;
$this->addGroupElement($gid_left, true, false, $sx, $sy);
}
}
if ($sy > 0) {
$gid_top = $this->tab[$sy-1][$sx]; // previous on top
if ($gid_top > 1) { //if in group
if (!$grouped) { // and not grouped
$this->tab[$sy][$sx] = $gid_top;
$grouped = true;
$this->addGroupElement($gid_top, false, true, $sx, $sy);
} else if($gid_top != $gid_left) { // was in left group
$grouped = true;
$this->groups[$gid_top]->vertical = true;
$this->groups[$gid_top]->horizontal = true;
$this->groups[$gid_top]->total = $this->groups[$gid_top]->total + $this->groups[$gid_left]->total;
foreach($this->groups[$gid_left]->points as $elem)
$this->tab[$elem[1]][$elem[0]] = $gid_top;
$this->groups[$gid_top]->points = array_values(array_merge($this->groups[$gid_top]->points, $this->groups[$gid_left]->points));
unset($this->groups[$gid_left]);
//refarb group
}
}
}
if (!$grouped) {
$this->curr_group++;
$this->tab[$sy][$sx] = $this->curr_group;
$this->groups[$this->curr_group] = new QRareaGroup($this->curr_group, $sx, $sy);
}
}
}
}
} | ---------------------------------------------------------------------- | detectGroups | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function detectAreas()
{
$squares = array();
$points = array();
$lshapes = array();
foreach ($this->groups as $groupId=>&$group) {
if ($group->total > 3) {
if ((!$group->vertical)||(!$group->horizontal)) {
$squareCoord = $this->detectSquare($group);
array_unshift($squareCoord, QR_AREA_RECT);
$this->paths[] = $squareCoord;
} else {
$this->detectPaths($group);
unset($group->points);
foreach($group->paths as &$path)
self::rle($path[2]);
$this->paths[] = array(QR_AREA_PATH, $group->paths);
}
} else if (($group->total == 3)&&($group->vertical)&&($group->horizontal)) {
$squareCoord = $this->detectSquare($group);
$variant = 0;
if ($this->getOnElem($squareCoord, 0, 0) != $group->id)
$variant = 0;
if ($this->getOnElem($squareCoord, 1, 0) != $group->id)
$variant = 1;
if ($this->getOnElem($squareCoord, 0, 1) != $group->id)
$variant = 2;
if ($this->getOnElem($squareCoord, 1, 1) != $group->id)
$variant = 3;
$lshapes[] = $squareCoord[QR_AREA_X];
$lshapes[] = $squareCoord[QR_AREA_Y];
$lshapes[] = $variant;
} else if ($group->total >= 2) {
$squareCoord = $this->detectSquare($group);
$squares = array_merge($squares, $squareCoord);
} else if ($group->total == 1) {
$points[] = $group->points[0][0];
$points[] = $group->points[0][1];
}
}
if (count($points) > 0) {
array_unshift($points, QR_AREA_POINT);
$this->paths[] = $points;
}
if (count($squares) > 0) {
array_unshift($squares, QR_AREA_RECT);
$this->paths[] = $squares;
}
if (count($lshapes) > 0) {
array_unshift($lshapes, QR_AREA_LSHAPE);
$this->paths[] = $lshapes;
}
} | ---------------------------------------------------------------------- | detectAreas | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function reserveEdgeOnElem($elem, $edgeNo)
{
$this->tab_edges[$elem[QR_AREA_Y]][$elem[QR_AREA_X]][$edgeNo] = true;
} | ---------------------------------------------------------------------- | reserveEdgeOnElem | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function reserveEdge($px, $py, $edgeNo)
{
$this->tab_edges[$py][$px][$edgeNo] = true;
} | ---------------------------------------------------------------------- | reserveEdge | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
private function detectPaths(&$group)
{
$this->markAdjacentEdges($group);
$elem = $group->points[0];
$waylist = $this->findPath($group, $elem[QR_AREA_X], $elem[QR_AREA_Y]);
$group->paths[] = array($elem[QR_AREA_X], $elem[QR_AREA_Y], $waylist);
$tab = array();
foreach($group->points as $elem) {
$edgeTab = $this->tab_edges[$elem[QR_AREA_Y]][$elem[QR_AREA_X]];
if (!( $edgeTab[QR_AREA_N]
&& $edgeTab[QR_AREA_E]
&& $edgeTab[QR_AREA_S]
&& $edgeTab[QR_AREA_W])) {
if (!$edgeTab[QR_AREA_S]) {
$waylistw = $this->findPath($group, $elem[QR_AREA_X], $elem[QR_AREA_Y]+1);
$group->paths[] = array($elem[QR_AREA_X], $elem[QR_AREA_Y]+1, $waylistw);
}
}
}
} | ---------------------------------------------------------------------- | detectPaths | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function compact_path(&$pathTab)
{
if (count($pathTab) == 0) {
$pathTab = '';
} else {
$pathTab = count($pathTab).','.join(',', $pathTab);
}
} | ---------------------------------------------------------------------- | compact_path | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function compact_points(&$pointsTab)
{
if (count($pointsTab) == 0) {
$pointsTab = '';
} else {
$compacted = '';
foreach ($pointsTab as $point)
$compacted .= self::encodeNum($point);
$pointsTab = $compacted;
}
} | ---------------------------------------------------------------------- | compact_points | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public static function compactCanvasCommands($ops)
{
$accumulated = array();
$accumulated['SR'] = array();
$accumulated['WR'] = array();
$accumulated['SP'] = array();
$accumulated['WP'] = array();
$accumulated['SB'] = array();
$accumulated['WB'] = array();
$accumulated['SO'] = array();
while (count($ops) > 0) {
$color = array_shift($ops);
$opcode = array_shift($ops);
if (($opcode == 'R') || ($opcode == 'P')) {
do {
$num = array_shift($ops);
if (is_int($num)) {
$accumulated[$color.$opcode][] = $num;
} else {
array_unshift($ops, $num);
}
} while ((count($ops) > 0)&&(is_int($num)));
} else if ($opcode == 'B') {
array_shift($ops);
$px = array_shift($ops);
$py = array_shift($ops);
array_shift($ops);
$conftab = array();
$num = array_shift($ops);
while ((count($ops) > 0)&&(!($num === 'E'))) {
$conftab[] = $num;
$num = array_shift($ops);
}
$cc = count($conftab);
$deltas = '';
$lastposx = $px;
$lastposy = $py;
for($pos=0;$pos <$cc; $pos+=2) {
$dx = $lastposx - $conftab[$pos];
$dy = $lastposy - $conftab[$pos+1];
$lastposx = $conftab[$pos];
$lastposy = $conftab[$pos+1];
if ($dx < 0) {
$deltas .= chr(ord('a')-1-$dx);
} else if ($dx > 0) {
$deltas .= chr(ord('A')-1+$dx);
} else {
$deltas .= '0';
}
if ($dy < 0) {
$deltas .= chr(ord('a')-1-$dy);
} else if ($dy > 0) {
$deltas .= chr(ord('A')-1+$dy);
} else {
$deltas .= '0';
}
}
$deltas = strtr($deltas, array(
'00'=>'1',
'aa'=>'2',
'aA'=>'3',
'Aa'=>'4',
'AA'=>'5',
'aB'=>'6',
'Ab'=>'7',
'bA'=>'8',
'Ba'=>'9'
));
$accumulated[$color.$opcode][] = join(',', array($px, $py, $deltas));
} else if ($opcode == 'O') {
$px = array_shift($ops);
$py = array_shift($ops);
$accumulated[$color.$opcode][] = join(',', array($px, $py));
}
}
self::compact_points($accumulated['SR']);
self::compact_points($accumulated['WR']);
self::compact_points($accumulated['SP']);
self::compact_points($accumulated['WP']);
self::compact_path($accumulated['SB']);
self::compact_path($accumulated['WB']);
if (count($accumulated['SO']) > 0)
$accumulated['SO'] = join(',',$accumulated['SO']);
else $accumulated['SO'] = '';
$mapping = array(
'SO'=>'O',
'SB'=>'B',
'WB'=>'b',
'SR'=>'R',
'WR'=>'r',
'SP'=>'P',
'WP'=>'p'
);
$whole = array();
foreach($mapping as $key=>$symb) {
if ($accumulated[$key]!='')
$whole[] = $symb.','.$accumulated[$key];
}
return join(',', $whole);
} | ---------------------------------------------------------------------- | compactCanvasCommands | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function mapX($px)
{
return $px;
} | ---------------------------------------------------------------------- | mapX | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function mapY($py)
{
return $py;
} | ---------------------------------------------------------------------- | mapY | php | phorgeit/phorge | externals/phpqrcode/phpqrcode.php | https://github.com/phorgeit/phorge/blob/master/externals/phpqrcode/phpqrcode.php | Apache-2.0 |
public function __construct() {
$this->pop_conn = 0;
$this->connected = false;
$this->error = null;
} | Constructor, sets the initial values
@access public
@return POP3 | __construct | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
public function Authorise ($host, $port = false, $tval = false, $username = '', $password = '', $debug_level = 0) {
$this->host = $host;
// If no port value is passed, retrieve it
if ($port == false) {
$this->port = $this->POP3_PORT;
} else {
$this->port = $port;
}
// If no port value is passed, retrieve it
if ($tval == false) {
$this->tval = $this->POP3_TIMEOUT;
} else {
$this->tval = $tval;
}
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
// Refresh the error log
$this->error = null;
// Connect
$result = $this->Connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->Login($this->username, $this->password);
if ($login_result) {
$this->Disconnect();
return true;
}
}
// We need to disconnect regardless if the login succeeded
$this->Disconnect();
return false;
} | Combination of public events - connect, login, disconnect
@access public
@param string $host
@param integer $port
@param integer $tval
@param string $username
@param string $password | Authorise | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
public function Connect ($host, $port = false, $tval = 30) {
// Are we already connected?
if ($this->connected) {
return true;
}
/*
On Windows this will raise a PHP Warning error if the hostname doesn't exist.
Rather than supress it with @fsockopen, let's capture it cleanly instead
*/
set_error_handler(array(&$this, 'catchWarning'));
// Connect to the POP3 server
$this->pop_conn = fsockopen($host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Does the Error Log now contain anything?
if ($this->error && $this->do_debug >= 1) {
$this->displayErrors();
}
// Did we connect?
if ($this->pop_conn == false) {
// It would appear not...
$this->error = array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
} | Connect to the POP3 server
@access public
@param string $host
@param integer $port
@param integer $tval
@return boolean | Connect | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
public function Login ($username = '', $password = '') {
if ($this->connected == false) {
$this->error = 'Not connected to POP3 server';
if ($this->do_debug >= 1) {
$this->displayErrors();
}
}
if (empty($username)) {
$username = $this->username;
}
if (empty($password)) {
$password = $this->password;
}
$pop_username = "USER $username" . $this->CRLF;
$pop_password = "PASS $password" . $this->CRLF;
// Send the Username
$this->sendString($pop_username);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
$this->sendString($pop_password);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
} else {
return false;
}
} else {
return false;
}
} | Login to the POP3 server (does not support APOP yet)
@access public
@param string $username
@param string $password
@return boolean | Login | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
public function Disconnect () {
$this->sendString('QUIT');
fclose($this->pop_conn);
} | Disconnect from the POP3 server
@access public | Disconnect | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
private function getResponse ($size = 128) {
$pop3_response = fgets($this->pop_conn, $size);
return $pop3_response;
} | Get the socket response back.
$size is the maximum number of bytes to retrieve
@access private
@param integer $size
@return string | getResponse | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
private function sendString ($string) {
$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
return $bytes_sent;
} | Send a string down the open socket connection to the POP3 server
@access private
@param string $string
@return integer | sendString | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
private function checkResponse ($string) {
if (substr($string, 0, 3) !== '+OK') {
$this->error = array(
'error' => "Server reported an error: $string",
'errno' => 0,
'errstr' => ''
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
} else {
return true;
}
} | Checks the POP3 server response for +OK or -ERR
@access private
@param string $string
@return boolean | checkResponse | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
private function catchWarning ($errno, $errstr, $errfile, $errline) {
$this->error[] = array(
'error' => "Connecting to the POP3 server raised a PHP warning: ",
'errno' => $errno,
'errstr' => $errstr
);
} | Takes over from PHP for the socket warning handler
@access private
@param integer $errno
@param string $errstr
@param string $errfile
@param integer $errline | catchWarning | php | phorgeit/phorge | externals/phpmailer/class.pop3.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.pop3.php | Apache-2.0 |
public function __construct($exceptions = false) {
$this->exceptions = ($exceptions == true);
} | Constructor
@param boolean $exceptions Should we throw external exceptions? | __construct | php | phorgeit/phorge | externals/phpmailer/class.phpmailer-lite.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.phpmailer-lite.php | Apache-2.0 |
public function IsHTML($ishtml = true) {
if ($ishtml) {
$this->ContentType = 'text/html';
} else {
$this->ContentType = 'text/plain';
}
} | Sets message type to HTML.
@param bool $ishtml
@return void | IsHTML | php | phorgeit/phorge | externals/phpmailer/class.phpmailer-lite.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.phpmailer-lite.php | Apache-2.0 |
public function IsMail() {
$this->Mailer = 'mail';
} | Sets Mailer to send message using PHP mail() function.
@return void | IsMail | php | phorgeit/phorge | externals/phpmailer/class.phpmailer-lite.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.phpmailer-lite.php | Apache-2.0 |
public function IsSendmail() {
if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
$this->Sendmail = '/var/qmail/bin/sendmail';
}
$this->Mailer = 'sendmail';
} | Sets Mailer to send message using the $Sendmail program.
@return void | IsSendmail | php | phorgeit/phorge | externals/phpmailer/class.phpmailer-lite.php | https://github.com/phorgeit/phorge/blob/master/externals/phpmailer/class.phpmailer-lite.php | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.