@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $query |
|
67 | + */ |
|
65 | 68 | public static function getAuthorsForSearch($query) { |
66 | 69 | return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
67 | 70 | } |
@@ -70,6 +73,9 @@ discard block |
||
70 | 73 | return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param string $query |
|
78 | + */ |
|
73 | 79 | public static function getEntryArray ($query, $params) { |
74 | 80 | return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
75 | 81 | } |
@@ -139,6 +139,9 @@ discard block |
||
139 | 139 | return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title); |
140 | 140 | } |
141 | 141 | |
142 | + /** |
|
143 | + * @param Book $book |
|
144 | + */ |
|
142 | 145 | public static function getDataByBook ($book) { |
143 | 146 | $out = array (); |
144 | 147 | $result = parent::getDb ()->prepare('select id, format, name |
@@ -152,6 +155,9 @@ discard block |
||
152 | 155 | return $out; |
153 | 156 | } |
154 | 157 | |
158 | + /** |
|
159 | + * @param string $urlParam |
|
160 | + */ |
|
155 | 161 | public static function handleThumbnailLink ($urlParam, $height) { |
156 | 162 | global $config; |
157 | 163 | |
@@ -171,6 +177,10 @@ discard block |
||
171 | 177 | return $urlParam; |
172 | 178 | } |
173 | 179 | |
180 | + /** |
|
181 | + * @param string $type |
|
182 | + * @param string $filename |
|
183 | + */ |
|
174 | 184 | public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
175 | 185 | { |
176 | 186 | global $config; |
@@ -38,6 +38,9 @@ |
||
38 | 38 | return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); |
39 | 39 | } |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $query |
|
43 | + */ |
|
41 | 44 | public static function getEntryArray ($query, $params) { |
42 | 45 | list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); |
43 | 46 | $entryArray = array(); |
@@ -47,6 +47,9 @@ |
||
47 | 47 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param integer $numberPerPage |
|
52 | + */ |
|
50 | 53 | public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
51 | 54 | $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
52 | 55 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | unlink (TEST_FEED); |
27 | 27 | } |
28 | 28 | |
29 | + /** |
|
30 | + * @param string $relax |
|
31 | + */ |
|
29 | 32 | function jingValidateSchema($feed, $relax = OPDS_RELAX_NG) { |
30 | 33 | $path = ""; |
31 | 34 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
@@ -57,6 +60,9 @@ discard block |
||
57 | 60 | return true; |
58 | 61 | } |
59 | 62 | |
63 | + /** |
|
64 | + * @param string $feed |
|
65 | + */ |
|
60 | 66 | function opdsCompleteValidation ($feed) { |
61 | 67 | return $this->jingValidateSchema($feed) && $this->opdsValidator($feed); |
62 | 68 | } |
@@ -189,6 +189,10 @@ |
||
189 | 189 | $this->assertEquals (14, count($filtered)); |
190 | 190 | } |
191 | 191 | |
192 | + /** |
|
193 | + * @param string $src |
|
194 | + * @param string $out |
|
195 | + */ |
|
192 | 196 | public function normalSearch ($src, $out) |
193 | 197 | { |
194 | 198 | $driver = $this; |
@@ -163,7 +163,7 @@ |
||
163 | 163 | /** |
164 | 164 | * Replaces a Unicode character using the transliteration database. |
165 | 165 | * |
166 | - * @param $ord |
|
166 | + * @param integer $ord |
|
167 | 167 | * An ordinal Unicode character code. |
168 | 168 | * @param $unknown |
169 | 169 | * Replacement string for characters that do not have a suitable ASCII |
@@ -294,6 +294,11 @@ discard block |
||
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
297 | + /** |
|
298 | + * @param string $format |
|
299 | + * |
|
300 | + * @return boolean |
|
301 | + */ |
|
297 | 302 | public function getDataFormat ($format) { |
298 | 303 | $reduced = array_filter ($this->getDatas (), function ($data) use ($format) { |
299 | 304 | return $data->format == $format; |
@@ -301,6 +306,10 @@ discard block |
||
301 | 306 | return reset ($reduced); |
302 | 307 | } |
303 | 308 | |
309 | + /** |
|
310 | + * @param string $extension |
|
311 | + * @param integer $idData |
|
312 | + */ |
|
304 | 313 | public function getFilePath ($extension, $idData = NULL, $relative = false) |
305 | 314 | { |
306 | 315 | if ($extension == "jpg") |
@@ -360,6 +369,9 @@ discard block |
||
360 | 369 | } |
361 | 370 | } |
362 | 371 | |
372 | + /** |
|
373 | + * @param string $outputfile |
|
374 | + */ |
|
363 | 375 | public function getThumbnail ($width, $height, $outputfile = NULL) { |
364 | 376 | if (is_null ($width) && is_null ($height)) { |
365 | 377 | return false; |
@@ -433,6 +445,10 @@ discard block |
||
433 | 445 | $this->getLinkArray (), $this); |
434 | 446 | } |
435 | 447 | |
448 | + /** |
|
449 | + * @param integer $database |
|
450 | + * @param integer $virtualLib |
|
451 | + */ |
|
436 | 452 | public static function getBookCount($database = NULL, $virtualLib = NULL) { |
437 | 453 | return parent::executeFilteredQuerySingle('select count(*) from ({0}) as filter', $database, $virtualLib); |
438 | 454 | } |
@@ -498,6 +514,9 @@ discard block |
||
498 | 514 | return NULL; |
499 | 515 | } |
500 | 516 | |
517 | + /** |
|
518 | + * @param integer $dataId |
|
519 | + */ |
|
501 | 520 | public static function getBookByDataId($dataId) { |
502 | 521 | $result = parent::getDb ()->prepare('select ' . self::BOOK_COLUMNS . ', data.name, data.format |
503 | 522 | from data, books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
@@ -514,6 +533,11 @@ discard block |
||
514 | 533 | return NULL; |
515 | 534 | } |
516 | 535 | |
536 | + /** |
|
537 | + * @param integer $database |
|
538 | + * @param integer $virtualLib |
|
539 | + * @param integer $numberPerPage |
|
540 | + */ |
|
517 | 541 | public static function getBooksByQuery($query, $n, $database = NULL, $virtualLib = NULL, $numberPerPage = NULL) { |
518 | 542 | $i = 0; |
519 | 543 | $critArray = array (); |
@@ -558,6 +582,9 @@ discard block |
||
558 | 582 | return $entryArray; |
559 | 583 | } |
560 | 584 | |
585 | + /** |
|
586 | + * @param integer $numberPerPage |
|
587 | + */ |
|
561 | 588 | public static function getBooksByStartingLetter($letter, $n, $database = NULL, $virtualLib = NULL, $numberPerPage = NULL) { |
562 | 589 | return self::getEntryArray (self::SQL_BOOKS_BY_FIRST_LETTER, array ($letter . "%"), $n, $database, $virtualLib, $numberPerPage); |
563 | 590 | } |
@@ -61,6 +61,9 @@ discard block |
||
61 | 61 | $_SERVER['REDIRECT_STATUS'] = 404; |
62 | 62 | } |
63 | 63 | |
64 | +/** |
|
65 | + * @param string $name |
|
66 | + */ |
|
64 | 67 | function getURLParam ($name, $default = NULL) { |
65 | 68 | if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { |
66 | 69 | return $_GET[$name]; |
@@ -100,6 +103,11 @@ discard block |
||
100 | 103 | return $url . "?v=" . VERSION; |
101 | 104 | } |
102 | 105 | |
106 | +/** |
|
107 | + * @param string $xml |
|
108 | + * |
|
109 | + * @return string |
|
110 | + */ |
|
103 | 111 | function xml2xhtml($xml) { |
104 | 112 | return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', create_function('$m', ' |
105 | 113 | $xhtml_tags = array("br", "hr", "input", "frame", "img", "area", "link", "col", "base", "basefont", "param"); |
@@ -339,6 +347,9 @@ discard block |
||
339 | 347 | return $phrase; |
340 | 348 | } |
341 | 349 | |
350 | +/** |
|
351 | + * @param string $paramName |
|
352 | + */ |
|
342 | 353 | function addURLParameter($urlParams, $paramName, $paramValue) { |
343 | 354 | if (empty ($urlParams)) { |
344 | 355 | $urlParams = ""; |
@@ -403,6 +414,9 @@ discard block |
||
403 | 414 | |
404 | 415 | class LinkNavigation extends Link |
405 | 416 | { |
417 | + /** |
|
418 | + * @param string $prel |
|
419 | + */ |
|
406 | 420 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
407 | 421 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
408 | 422 | if (!is_null (GetUrlParam (DB))) { |
@@ -420,6 +434,9 @@ discard block |
||
420 | 434 | |
421 | 435 | class LinkFacet extends Link |
422 | 436 | { |
437 | + /** |
|
438 | + * @param string $phref |
|
439 | + */ |
|
423 | 440 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
424 | 441 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
425 | 442 | if (!is_null (GetUrlParam (DB))) { |
@@ -502,6 +519,12 @@ discard block |
||
502 | 519 | { |
503 | 520 | public $book; |
504 | 521 | |
522 | + /** |
|
523 | + * @param string $pid |
|
524 | + * @param string $pcontent |
|
525 | + * @param string $pcontentType |
|
526 | + * @param Book $pbook |
|
527 | + */ |
|
505 | 528 | public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
506 | 529 | parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
507 | 530 | $this->book = $pbook; |
@@ -1102,6 +1125,9 @@ discard block |
||
1102 | 1125 | |
1103 | 1126 | class PageCustomize extends Page |
1104 | 1127 | { |
1128 | + /** |
|
1129 | + * @param string $key |
|
1130 | + */ |
|
1105 | 1131 | private function isChecked ($key, $testedValue = 1) { |
1106 | 1132 | $value = getCurrentOption ($key); |
1107 | 1133 | if (is_array ($value)) { |
@@ -1116,6 +1142,9 @@ discard block |
||
1116 | 1142 | return ""; |
1117 | 1143 | } |
1118 | 1144 | |
1145 | + /** |
|
1146 | + * @param string $key |
|
1147 | + */ |
|
1119 | 1148 | private function isSelected ($key, $value) { |
1120 | 1149 | if (getCurrentOption ($key) == $value) { |
1121 | 1150 | return "selected='selected'"; |
@@ -1265,6 +1294,9 @@ discard block |
||
1265 | 1294 | } |
1266 | 1295 | } |
1267 | 1296 | |
1297 | + /** |
|
1298 | + * @param integer $database |
|
1299 | + */ |
|
1268 | 1300 | public static function getDbName ($database = NULL) { |
1269 | 1301 | global $config; |
1270 | 1302 | if (self::isDatabaseArray ()) { |
@@ -1278,6 +1310,9 @@ discard block |
||
1278 | 1310 | return ""; |
1279 | 1311 | } |
1280 | 1312 | |
1313 | + /** |
|
1314 | + * @return string |
|
1315 | + */ |
|
1281 | 1316 | public static function getDbDirectory ($database = NULL) { |
1282 | 1317 | global $config; |
1283 | 1318 | if (self::isDatabaseArray ()) { |
@@ -1337,6 +1372,9 @@ discard block |
||
1337 | 1372 | self::$db = NULL; |
1338 | 1373 | } |
1339 | 1374 | |
1375 | + /** |
|
1376 | + * @param integer $database |
|
1377 | + */ |
|
1340 | 1378 | public static function executeQuerySingle ($query, $database = NULL) { |
1341 | 1379 | return self::getDb ($database)->query($query)->fetchColumn(); |
1342 | 1380 | } |
@@ -1354,6 +1392,11 @@ discard block |
||
1354 | 1392 | return self::getDb ($database)->query($query)->fetchColumn(); |
1355 | 1393 | } |
1356 | 1394 | |
1395 | + /** |
|
1396 | + * @param string $table |
|
1397 | + * @param string $id |
|
1398 | + * @param string $numberOfString |
|
1399 | + */ |
|
1357 | 1400 | public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
1358 | 1401 | if (!$numberOfString) { |
1359 | 1402 | $numberOfString = $table . ".alphabetical"; |
@@ -1366,6 +1409,9 @@ discard block |
||
1366 | 1409 | return $entry; |
1367 | 1410 | } |
1368 | 1411 | |
1412 | + /** |
|
1413 | + * @param string $category |
|
1414 | + */ |
|
1369 | 1415 | public static function getEntryArrayWithBookNumber ($query, $params, $category) { |
1370 | 1416 | list (, $result) = self::executeFilteredQuery($query, $params, -1); |
1371 | 1417 | $entryArray = array(); |
@@ -1425,6 +1471,11 @@ discard block |
||
1425 | 1471 | return array ($totalResult, $result); |
1426 | 1472 | } |
1427 | 1473 | |
1474 | + /** |
|
1475 | + * @param string $query |
|
1476 | + * @param string $columns |
|
1477 | + * @param string $filter |
|
1478 | + */ |
|
1428 | 1479 | public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
1429 | 1480 | $totalResult = -1; |
1430 | 1481 |