@@ -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 |
@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | $_SERVER['REDIRECT_STATUS'] = 404; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | +/** |
|
| 64 | + * @param string $name |
|
| 65 | + */ |
|
| 63 | 66 | function getURLParam ($name, $default = NULL) { |
| 64 | 67 | if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { |
| 65 | 68 | return $_GET[$name]; |
@@ -95,6 +98,11 @@ discard block |
||
| 95 | 98 | return $url . "?v=" . VERSION; |
| 96 | 99 | } |
| 97 | 100 | |
| 101 | +/** |
|
| 102 | + * @param string $xml |
|
| 103 | + * |
|
| 104 | + * @return string |
|
| 105 | + */ |
|
| 98 | 106 | function xml2xhtml($xml) { |
| 99 | 107 | return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', create_function('$m', ' |
| 100 | 108 | $xhtml_tags = array("br", "hr", "input", "frame", "img", "area", "link", "col", "base", "basefont", "param"); |
@@ -308,6 +316,9 @@ discard block |
||
| 308 | 316 | return $phrase; |
| 309 | 317 | } |
| 310 | 318 | |
| 319 | +/** |
|
| 320 | + * @param string $paramName |
|
| 321 | + */ |
|
| 311 | 322 | function addURLParameter($urlParams, $paramName, $paramValue) { |
| 312 | 323 | if (empty ($urlParams)) { |
| 313 | 324 | $urlParams = ""; |
@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | + /** |
|
| 64 | + * @param string $query |
|
| 65 | + */ |
|
| 63 | 66 | public static function getAuthorsForSearch($query) { |
| 64 | 67 | return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
| 65 | 68 | } |
@@ -68,6 +71,9 @@ discard block |
||
| 68 | 71 | return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $query |
|
| 76 | + */ |
|
| 71 | 77 | public static function getEntryArray ($query, $params) { |
| 72 | 78 | return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
| 73 | 79 | } |
@@ -84,6 +84,9 @@ discard block |
||
| 84 | 84 | return ""; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @return string |
|
| 89 | + */ |
|
| 87 | 90 | public static function getDbDirectory ($database = NULL) { |
| 88 | 91 | global $config; |
| 89 | 92 | if (self::isMultipleDatabaseEnabled ()) { |
@@ -143,10 +146,18 @@ discard block |
||
| 143 | 146 | self::$db = NULL; |
| 144 | 147 | } |
| 145 | 148 | |
| 149 | + /** |
|
| 150 | + * @param string $query |
|
| 151 | + */ |
|
| 146 | 152 | public static function executeQuerySingle ($query, $database = NULL) { |
| 147 | 153 | return self::getDb ($database)->query($query)->fetchColumn(); |
| 148 | 154 | } |
| 149 | 155 | |
| 156 | + /** |
|
| 157 | + * @param string $table |
|
| 158 | + * @param string $id |
|
| 159 | + * @param string $numberOfString |
|
| 160 | + */ |
|
| 150 | 161 | public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
| 151 | 162 | if (!$numberOfString) { |
| 152 | 163 | $numberOfString = $table . ".alphabetical"; |
@@ -159,6 +170,10 @@ discard block |
||
| 159 | 170 | return $entry; |
| 160 | 171 | } |
| 161 | 172 | |
| 173 | + /** |
|
| 174 | + * @param string $columns |
|
| 175 | + * @param string $category |
|
| 176 | + */ |
|
| 162 | 177 | public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) { |
| 163 | 178 | list (, $result) = self::executeQuery ($query, $columns, "", $params, -1); |
| 164 | 179 | $entryArray = array(); |
@@ -177,6 +192,9 @@ discard block |
||
| 177 | 192 | return $entryArray; |
| 178 | 193 | } |
| 179 | 194 | |
| 195 | + /** |
|
| 196 | + * @param string $filter |
|
| 197 | + */ |
|
| 180 | 198 | public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
| 181 | 199 | $totalResult = -1; |
| 182 | 200 | |
@@ -287,6 +287,9 @@ discard block |
||
| 287 | 287 | return reset ($reduced); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | + /** |
|
| 291 | + * @param string $extension |
|
| 292 | + */ |
|
| 290 | 293 | public function getFilePath ($extension, $idData = NULL, $relative = false) |
| 291 | 294 | { |
| 292 | 295 | if ($extension == "jpg") |
@@ -419,6 +422,9 @@ discard block |
||
| 419 | 422 | $this->getLinkArray (), $this); |
| 420 | 423 | } |
| 421 | 424 | |
| 425 | + /** |
|
| 426 | + * @param integer $database |
|
| 427 | + */ |
|
| 422 | 428 | public static function getBookCount($database = NULL) { |
| 423 | 429 | return parent::executeQuerySingle ('select count(*) from books', $database); |
| 424 | 430 | } |
@@ -500,6 +506,10 @@ discard block |
||
| 500 | 506 | return NULL; |
| 501 | 507 | } |
| 502 | 508 | |
| 509 | + /** |
|
| 510 | + * @param integer $database |
|
| 511 | + * @param integer $numberPerPage |
|
| 512 | + */ |
|
| 503 | 513 | public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
| 504 | 514 | $i = 0; |
| 505 | 515 | $critArray = array (); |
@@ -544,6 +554,9 @@ discard block |
||
| 544 | 554 | return $entryArray; |
| 545 | 555 | } |
| 546 | 556 | |
| 557 | + /** |
|
| 558 | + * @param integer $numberPerPage |
|
| 559 | + */ |
|
| 547 | 560 | public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
| 548 | 561 | return self::getEntryArray (self::SQL_BOOKS_BY_FIRST_LETTER, array ($letter . "%"), $n, $database, $numberPerPage); |
| 549 | 562 | } |
@@ -141,6 +141,9 @@ discard block |
||
| 141 | 141 | return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | + /** |
|
| 145 | + * @param Book $book |
|
| 146 | + */ |
|
| 144 | 147 | public static function getDataByBook ($book) { |
| 145 | 148 | $out = array (); |
| 146 | 149 | $result = parent::getDb ()->prepare('select id, format, name |
@@ -154,6 +157,9 @@ discard block |
||
| 154 | 157 | return $out; |
| 155 | 158 | } |
| 156 | 159 | |
| 160 | + /** |
|
| 161 | + * @param string $urlParam |
|
| 162 | + */ |
|
| 157 | 163 | public static function handleThumbnailLink ($urlParam, $height) { |
| 158 | 164 | global $config; |
| 159 | 165 | |
@@ -173,6 +179,10 @@ discard block |
||
| 173 | 179 | return $urlParam; |
| 174 | 180 | } |
| 175 | 181 | |
| 182 | + /** |
|
| 183 | + * @param string $type |
|
| 184 | + * @param string $filename |
|
| 185 | + */ |
|
| 176 | 186 | public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
| 177 | 187 | { |
| 178 | 188 | global $config; |
@@ -8,6 +8,9 @@ |
||
| 8 | 8 | |
| 9 | 9 | class LinkFacet extends Link |
| 10 | 10 | { |
| 11 | + /** |
|
| 12 | + * @param string $phref |
|
| 13 | + */ |
|
| 11 | 14 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
| 12 | 15 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
| 13 | 16 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -8,6 +8,9 @@ |
||
| 8 | 8 | |
| 9 | 9 | class LinkNavigation extends Link |
| 10 | 10 | { |
| 11 | + /** |
|
| 12 | + * @param string $prel |
|
| 13 | + */ |
|
| 11 | 14 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
| 12 | 15 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
| 13 | 16 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -8,6 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class PageCustomize extends Page |
| 10 | 10 | { |
| 11 | + /** |
|
| 12 | + * @param string $key |
|
| 13 | + */ |
|
| 11 | 14 | private function isChecked ($key, $testedValue = 1) { |
| 12 | 15 | $value = getCurrentOption ($key); |
| 13 | 16 | if (is_array ($value)) { |
@@ -22,6 +25,9 @@ discard block |
||
| 22 | 25 | return ""; |
| 23 | 26 | } |
| 24 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $key |
|
| 30 | + */ |
|
| 25 | 31 | private function isSelected ($key, $value) { |
| 26 | 32 | if (getCurrentOption ($key) == $value) { |
| 27 | 33 | return "selected='selected'"; |