@@ -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 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Includes the booke filter (see $config['cops_books_filter']) |
45 | 45 | * @param Filter $filter |
46 | - * @return string |
|
46 | + * @return Filter |
|
47 | 47 | */ |
48 | 48 | private static function includeBookFilter($filter) { |
49 | 49 | $bookFilter = getURLParam ("tag", NULL); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * Some attributes can be used in plural (e.g. languages) and singular (e.g. language). This function appends a missing s and puts everything to lower case |
208 | 208 | * @param string $attr the attribute, like it was used in calibre |
209 | - * @return the normalized attribute name |
|
209 | + * @return string normalized attribute name |
|
210 | 210 | */ |
211 | 211 | public static function normalizeAttribute($attr) { |
212 | 212 | $attr = strtolower($attr); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | /** |
416 | 416 | * Constructor that combines multiple filters to one filter |
417 | - * @param array $parts An array of Filter objects |
|
417 | + * @param Filter[] $parts An array of Filter objects |
|
418 | 418 | * @param string $op The operator for combining. Either "and" or "or" (case insensitive). |
419 | 419 | */ |
420 | 420 | public function __construct($parts, $op = "and") { |
@@ -106,6 +106,9 @@ |
||
106 | 106 | return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
107 | 107 | } |
108 | 108 | |
109 | + /** |
|
110 | + * @param Page $page |
|
111 | + */ |
|
109 | 112 | public static function getContentArrayTypeahead ($page) { |
110 | 113 | $out = array (); |
111 | 114 | foreach ($page->entryArray as $entry) { |
@@ -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 = ""; |
@@ -400,6 +411,9 @@ discard block |
||
400 | 411 | return $this->href; |
401 | 412 | } |
402 | 413 | |
414 | + /** |
|
415 | + * @return string |
|
416 | + */ |
|
403 | 417 | public function getScriptName() { |
404 | 418 | $parts = explode('/', $_SERVER["SCRIPT_NAME"]); |
405 | 419 | return $parts[count($parts) - 1]; |
@@ -408,6 +422,9 @@ discard block |
||
408 | 422 | |
409 | 423 | class LinkNavigation extends Link |
410 | 424 | { |
425 | + /** |
|
426 | + * @param string $prel |
|
427 | + */ |
|
411 | 428 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
412 | 429 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
413 | 430 | if (!is_null (GetUrlParam (DB))) { |
@@ -425,6 +442,9 @@ discard block |
||
425 | 442 | |
426 | 443 | class LinkFacet extends Link |
427 | 444 | { |
445 | + /** |
|
446 | + * @param string $phref |
|
447 | + */ |
|
428 | 448 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
429 | 449 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
430 | 450 | if (!is_null (GetUrlParam (DB))) { |
@@ -508,6 +528,12 @@ discard block |
||
508 | 528 | { |
509 | 529 | public $book; |
510 | 530 | |
531 | + /** |
|
532 | + * @param string $pid |
|
533 | + * @param string $pcontent |
|
534 | + * @param string $pcontentType |
|
535 | + * @param Book $pbook |
|
536 | + */ |
|
511 | 537 | public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
512 | 538 | parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
513 | 539 | $this->book = $pbook; |
@@ -1110,6 +1136,9 @@ discard block |
||
1110 | 1136 | |
1111 | 1137 | class PageCustomize extends Page |
1112 | 1138 | { |
1139 | + /** |
|
1140 | + * @param string $key |
|
1141 | + */ |
|
1113 | 1142 | private function isChecked ($key, $testedValue = 1) { |
1114 | 1143 | $value = getCurrentOption ($key); |
1115 | 1144 | if (is_array ($value)) { |
@@ -1124,6 +1153,9 @@ discard block |
||
1124 | 1153 | return ""; |
1125 | 1154 | } |
1126 | 1155 | |
1156 | + /** |
|
1157 | + * @param string $key |
|
1158 | + */ |
|
1127 | 1159 | private function isSelected ($key, $value) { |
1128 | 1160 | if (getCurrentOption ($key) == $value) { |
1129 | 1161 | return "selected='selected'"; |
@@ -1273,6 +1305,9 @@ discard block |
||
1273 | 1305 | } |
1274 | 1306 | } |
1275 | 1307 | |
1308 | + /** |
|
1309 | + * @param integer $database |
|
1310 | + */ |
|
1276 | 1311 | public static function getDbName ($database = NULL) { |
1277 | 1312 | global $config; |
1278 | 1313 | if (self::isDatabaseArray ()) { |
@@ -1286,6 +1321,9 @@ discard block |
||
1286 | 1321 | return ""; |
1287 | 1322 | } |
1288 | 1323 | |
1324 | + /** |
|
1325 | + * @return string |
|
1326 | + */ |
|
1289 | 1327 | public static function getDbDirectory ($database = NULL) { |
1290 | 1328 | global $config; |
1291 | 1329 | if (self::isDatabaseArray ()) { |
@@ -1345,6 +1383,9 @@ discard block |
||
1345 | 1383 | self::$db = NULL; |
1346 | 1384 | } |
1347 | 1385 | |
1386 | + /** |
|
1387 | + * @param integer $database |
|
1388 | + */ |
|
1348 | 1389 | public static function executeQuerySingle ($query, $database = NULL) { |
1349 | 1390 | return self::getDb ($database)->query($query)->fetchColumn(); |
1350 | 1391 | } |
@@ -1362,6 +1403,11 @@ discard block |
||
1362 | 1403 | return self::getDb ($database)->query($query)->fetchColumn(); |
1363 | 1404 | } |
1364 | 1405 | |
1406 | + /** |
|
1407 | + * @param string $table |
|
1408 | + * @param string $id |
|
1409 | + * @param string $numberOfString |
|
1410 | + */ |
|
1365 | 1411 | public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
1366 | 1412 | if (!$numberOfString) { |
1367 | 1413 | $numberOfString = $table . ".alphabetical"; |
@@ -1374,6 +1420,9 @@ discard block |
||
1374 | 1420 | return $entry; |
1375 | 1421 | } |
1376 | 1422 | |
1423 | + /** |
|
1424 | + * @param string $category |
|
1425 | + */ |
|
1377 | 1426 | public static function getEntryArrayWithBookNumber ($query, $params, $category) { |
1378 | 1427 | list (, $result) = self::executeFilteredQuery($query, $params, -1); |
1379 | 1428 | $entryArray = array(); |
@@ -1433,6 +1482,12 @@ discard block |
||
1433 | 1482 | return array ($totalResult, $result); |
1434 | 1483 | } |
1435 | 1484 | |
1485 | + /** |
|
1486 | + * @param string $query |
|
1487 | + * @param string $columns |
|
1488 | + * @param string $filter |
|
1489 | + * @param integer $n |
|
1490 | + */ |
|
1436 | 1491 | public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
1437 | 1492 | $totalResult = -1; |
1438 | 1493 |