@@ -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 |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * 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 |
184 | 184 | * @param string $attr the attribute, like it was used in calibre |
185 | - * @return the normalized attribute name |
|
185 | + * @return string normalized attribute name |
|
186 | 186 | */ |
187 | 187 | public static function normalizeAttribute($attr) { |
188 | 188 | $attr = strtolower($attr); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * Creates a comparing filter |
300 | 300 | * |
301 | 301 | * @param string $attr The attribute that is filtered. |
302 | - * @param mixed $value The value with which to compare. |
|
302 | + * @param string $value The value with which to compare. |
|
303 | 303 | * @param string $op The operator that is used for comparing, optional. |
304 | 304 | */ |
305 | 305 | public function __construct($attr, $value, $op = "=") { |