Completed
Branch master (31966b)
by Markus
09:57
created
epubfs.php 3 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,70 +9,70 @@
 block discarded – undo
9 9
 require_once ("config.php");
10 10
 require_once ("base.php");
11 11
 
12
-function getComponentContent ($book, $component, $add) {
13
-    $data = $book->component ($component);
12
+function getComponentContent($book, $component, $add) {
13
+    $data = $book->component($component);
14 14
 
15
-    $callback = function ($m) use ($book, $component, $add) {
15
+    $callback = function($m) use ($book, $component, $add) {
16 16
         $method = $m[1];
17 17
         $path = $m[2];
18 18
         $end = "";
19
-        if (preg_match ("/^src\s*:/", $method)) {
19
+        if (preg_match("/^src\s*:/", $method)) {
20 20
             $end = ")";
21 21
         }
22
-        if (preg_match ("/^#/", $path)) {
22
+        if (preg_match("/^#/", $path)) {
23 23
             return "{$method}'{$path}'{$end}";
24 24
         }
25 25
         $hash = "";
26
-        if (preg_match ("/^(.+)#(.+)$/", $path, $matches)) {
26
+        if (preg_match("/^(.+)#(.+)$/", $path, $matches)) {
27 27
             $path = $matches [1];
28 28
             $hash = "#" . $matches [2];
29 29
         }
30
-        $comp = $book->getComponentName ($component, $path);
30
+        $comp = $book->getComponentName($component, $path);
31 31
         if (!$comp) return "{$method}'#'{$end}";
32 32
         $out = "{$method}'epubfs.php?{$add}comp={$comp}{$hash}'{$end}";
33 33
         if ($end) {
34 34
             return $out;
35 35
         }
36
-        return str_replace ("&", "&", $out);
36
+        return str_replace("&", "&", $out);
37 37
     };
38 38
 
39
-    $data = preg_replace_callback ("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
40
-    $data = preg_replace_callback ("/(href=)[\"']([^:]*?)[\"']/", $callback, $data);
41
-    $data = preg_replace_callback ("/(\@import\s+)[\"'](.*?)[\"'];/", $callback, $data);
42
-    $data = preg_replace_callback ("/(src\s*:\s*url\()(.*?)\)/", $callback, $data);
39
+    $data = preg_replace_callback("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
40
+    $data = preg_replace_callback("/(href=)[\"']([^:]*?)[\"']/", $callback, $data);
41
+    $data = preg_replace_callback("/(\@import\s+)[\"'](.*?)[\"'];/", $callback, $data);
42
+    $data = preg_replace_callback("/(src\s*:\s*url\()(.*?)\)/", $callback, $data);
43 43
 
44 44
     return $data;
45 45
 }
46 46
 
47 47
 if (php_sapi_name() === 'cli') { return; }
48 48
 
49
-$idData = getURLParam ("data", NULL);
49
+$idData = getURLParam("data", NULL);
50 50
 $add = "data=$idData&";
51
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
51
+if (!is_null(GetUrlParam(DB))) $add .= DB . "=" . GetUrlParam(DB) . "&";
52 52
 $myBook = Book::getBookByDataId($idData);
53 53
 
54
-$book = new EPub ($myBook->getFilePath ("EPUB", $idData));
54
+$book = new EPub($myBook->getFilePath("EPUB", $idData));
55 55
 
56
-$book->initSpineComponent ();
56
+$book->initSpineComponent();
57 57
 
58 58
 if (!isset ($_GET["comp"])) {
59
-    notFound ();
59
+    notFound();
60 60
     return;
61 61
 }
62 62
 
63 63
 $component = $_GET["comp"];
64 64
 
65 65
 try {
66
-    $data = getComponentContent ($book, $component, $add);
66
+    $data = getComponentContent($book, $component, $add);
67 67
 
68
-    $expires = 60*60*24*14;
68
+    $expires = 60 * 60 * 24 * 14;
69 69
     header("Pragma: public");
70
-    header("Cache-Control: maxage=".$expires);
71
-    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
72
-    header ("Content-Type: " . $book->componentContentType($component));
70
+    header("Cache-Control: maxage=" . $expires);
71
+    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
72
+    header("Content-Type: " . $book->componentContentType($component));
73 73
     echo $data;
74 74
 }
75 75
 catch (Exception $e) {
76
-    error_log ($e);
77
-    notFound ();
76
+    error_log($e);
77
+    notFound();
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,8 @@  discard block
 block discarded – undo
9 9
 require_once ("config.php");
10 10
 require_once ("base.php");
11 11
 
12
-function getComponentContent ($book, $component, $add) {
12
+function getComponentContent ($book, $component, $add)
13
+{
13 14
     $data = $book->component ($component);
14 15
 
15 16
     $callback = function ($m) use ($book, $component, $add) {
@@ -28,7 +29,9 @@  discard block
 block discarded – undo
28 29
             $hash = "#" . $matches [2];
29 30
         }
30 31
         $comp = $book->getComponentName ($component, $path);
31
-        if (!$comp) return "{$method}'#'{$end}";
32
+        if (!$comp) {
33
+            return "{$method}'#'{$end}";
34
+        }
32 35
         $out = "{$method}'epubfs.php?{$add}comp={$comp}{$hash}'{$end}";
33 36
         if ($end) {
34 37
             return $out;
@@ -48,7 +51,9 @@  discard block
 block discarded – undo
48 51
 
49 52
 $idData = getURLParam ("data", NULL);
50 53
 $add = "data=$idData&";
51
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
54
+if (!is_null (GetUrlParam (DB))) {
55
+    $add .= DB . "=" . GetUrlParam (DB) . "&";
56
+}
52 57
 $myBook = Book::getBookByDataId($idData);
53 58
 
54 59
 $book = new EPub ($myBook->getFilePath ("EPUB", $idData));
@@ -71,8 +76,7 @@  discard block
 block discarded – undo
71 76
     header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
72 77
     header ("Content-Type: " . $book->componentContentType($component));
73 78
     echo $data;
74
-}
75
-catch (Exception $e) {
79
+} catch (Exception $e) {
76 80
     error_log ($e);
77 81
     notFound ();
78 82
 }
79 83
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
 if (php_sapi_name() === 'cli') { return; }
48 48
 
49
-$idData = getURLParam ("data", NULL);
49
+$idData = getURLParam ("data", null);
50 50
 $add = "data=$idData&";
51 51
 if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
52 52
 $myBook = Book::getBookByDataId($idData);
Please login to merge, or discard this patch.
publisher.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,45 +21,45 @@
 block discarded – undo
21 21
         $this->name = $post->name;
22 22
     }
23 23
 
24
-    public function getUri () {
25
-        return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id";
24
+    public function getUri() {
25
+        return "?page=" . parent::PAGE_PUBLISHER_DETAIL . "&id=$this->id";
26 26
     }
27 27
 
28
-    public function getEntryId () {
29
-        return self::ALL_PUBLISHERS_ID.":".$this->id;
28
+    public function getEntryId() {
29
+        return self::ALL_PUBLISHERS_ID . ":" . $this->id;
30 30
     }
31 31
 
32 32
     public static function getCount() {
33 33
         // str_format (localize("publishers.alphabetical", count(array))
34
-        return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
34
+        return parent::getCountGeneric("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
35 35
     }
36 36
 
37
-    public static function getPublisherByBookId ($bookId) {
38
-        $result = parent::getDb ()->prepare('select publishers.id as id, name
37
+    public static function getPublisherByBookId($bookId) {
38
+        $result = parent::getDb()->prepare('select publishers.id as id, name
39 39
 from books_publishers_link, publishers
40 40
 where publishers.id = publisher and book = ?');
41
-        $result->execute (array ($bookId));
42
-        if ($post = $result->fetchObject ()) {
43
-            return new Publisher ($post);
41
+        $result->execute(array($bookId));
42
+        if ($post = $result->fetchObject()) {
43
+            return new Publisher($post);
44 44
         }
45 45
         return NULL;
46 46
     }
47 47
 
48
-    public static function getPublisherById ($publisherId) {
49
-        $result = parent::getDb ()->prepare('select id, name
48
+    public static function getPublisherById($publisherId) {
49
+        $result = parent::getDb()->prepare('select id, name
50 50
 from publishers where id = ?');
51
-        $result->execute (array ($publisherId));
52
-        if ($post = $result->fetchObject ()) {
53
-            return new Publisher ($post);
51
+        $result->execute(array($publisherId));
52
+        if ($post = $result->fetchObject()) {
53
+            return new Publisher($post);
54 54
         }
55 55
         return NULL;
56 56
     }
57 57
 
58 58
     public static function getAllPublishers() {
59
-        return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher");
59
+        return Base::getEntryArrayWithBookNumber(self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array(), "Publisher");
60 60
     }
61 61
 
62 62
     public static function getAllPublishersByQuery($query) {
63
-        return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher");
63
+        return Base::getEntryArrayWithBookNumber(self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array('%' . $query . '%'), "Publisher");
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@  discard block
 block discarded – undo
6 6
  * @author     At Libitum <[email protected]>
7 7
  */
8 8
 
9
-class Publisher extends Base {
9
+class Publisher extends Base
10
+{
10 11
     const ALL_PUBLISHERS_ID = "cops:publishers";
11 12
     const PUBLISHERS_COLUMNS = "publishers.id as id, publishers.name as name, count(*) as count";
12 13
     const SQL_ALL_PUBLISHERS = "select {0} from publishers, books_publishers_link where publishers.id = publisher group by publishers.id, publishers.name order by publishers.name";
@@ -16,25 +17,30 @@  discard block
 block discarded – undo
16 17
     public $id;
17 18
     public $name;
18 19
 
19
-    public function __construct($post) {
20
+    public function __construct($post)
21
+    {
20 22
         $this->id = $post->id;
21 23
         $this->name = $post->name;
22 24
     }
23 25
 
24
-    public function getUri () {
26
+    public function getUri ()
27
+    {
25 28
         return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id";
26 29
     }
27 30
 
28
-    public function getEntryId () {
31
+    public function getEntryId ()
32
+    {
29 33
         return self::ALL_PUBLISHERS_ID.":".$this->id;
30 34
     }
31 35
 
32
-    public static function getCount() {
36
+    public static function getCount()
37
+    {
33 38
         // str_format (localize("publishers.alphabetical", count(array))
34 39
         return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
35 40
     }
36 41
 
37
-    public static function getPublisherByBookId ($bookId) {
42
+    public static function getPublisherByBookId ($bookId)
43
+    {
38 44
         $result = parent::getDb ()->prepare('select publishers.id as id, name
39 45
 from books_publishers_link, publishers
40 46
 where publishers.id = publisher and book = ?');
@@ -45,7 +51,8 @@  discard block
 block discarded – undo
45 51
         return NULL;
46 52
     }
47 53
 
48
-    public static function getPublisherById ($publisherId) {
54
+    public static function getPublisherById ($publisherId)
55
+    {
49 56
         $result = parent::getDb ()->prepare('select id, name
50 57
 from publishers where id = ?');
51 58
         $result->execute (array ($publisherId));
@@ -55,11 +62,13 @@  discard block
 block discarded – undo
55 62
         return NULL;
56 63
     }
57 64
 
58
-    public static function getAllPublishers() {
65
+    public static function getAllPublishers()
66
+    {
59 67
         return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher");
60 68
     }
61 69
 
62
-    public static function getAllPublishersByQuery($query) {
70
+    public static function getAllPublishersByQuery($query)
71
+    {
63 72
         return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher");
64 73
     }
65 74
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         if ($post = $result->fetchObject ()) {
43 43
             return new Publisher ($post);
44 44
         }
45
-        return NULL;
45
+        return null;
46 46
     }
47 47
 
48 48
     public static function getPublisherById ($publisherId) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         if ($post = $result->fetchObject ()) {
53 53
             return new Publisher ($post);
54 54
         }
55
-        return NULL;
55
+        return null;
56 56
     }
57 57
 
58 58
     public static function getAllPublishers() {
Please login to merge, or discard this patch.
OPDS_renderer.php 3 patches
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -13,266 +13,266 @@
 block discarded – undo
13 13
     private $xmlStream = NULL;
14 14
     private $updated = NULL;
15 15
 
16
-    private function getUpdatedTime () {
17
-        if (is_null ($this->updated)) {
16
+    private function getUpdatedTime() {
17
+        if (is_null($this->updated)) {
18 18
             $this->updated = time();
19 19
         }
20
-        return date (DATE_ATOM, $this->updated);
20
+        return date(DATE_ATOM, $this->updated);
21 21
     }
22 22
 
23
-    private function getXmlStream () {
24
-        if (is_null ($this->xmlStream)) {
23
+    private function getXmlStream() {
24
+        if (is_null($this->xmlStream)) {
25 25
             $this->xmlStream = new XMLWriter();
26 26
             $this->xmlStream->openMemory();
27
-            $this->xmlStream->setIndent (true);
27
+            $this->xmlStream->setIndent(true);
28 28
         }
29 29
         return $this->xmlStream;
30 30
     }
31 31
 
32
-    public function getOpenSearch () {
32
+    public function getOpenSearch() {
33 33
         global $config;
34
-        $xml = new XMLWriter ();
35
-        $xml->openMemory ();
36
-        $xml->setIndent (true);
37
-        $xml->startDocument('1.0','UTF-8');
38
-            $xml->startElement ("OpenSearchDescription");
39
-                $xml->writeAttribute ("xmlns", "http://a9.com/-/spec/opensearch/1.1/");
40
-                $xml->startElement ("ShortName");
41
-                    $xml->text ("My catalog");
42
-                $xml->endElement ();
43
-                $xml->startElement ("Description");
44
-                    $xml->text ("Search for ebooks");
45
-                $xml->endElement ();
46
-                $xml->startElement ("InputEncoding");
47
-                    $xml->text ("UTF-8");
48
-                $xml->endElement ();
49
-                $xml->startElement ("OutputEncoding");
50
-                    $xml->text ("UTF-8");
51
-                $xml->endElement ();
52
-                $xml->startElement ("Image");
53
-                    $xml->writeAttribute ("type", "image/x-icon");
54
-                    $xml->writeAttribute ("width", "16");
55
-                    $xml->writeAttribute ("height", "16");
56
-                    $xml->text ($config['cops_icon']);
57
-                $xml->endElement ();
58
-                $xml->startElement ("Url");
59
-                    $xml->writeAttribute ("type", 'application/atom+xml');
34
+        $xml = new XMLWriter();
35
+        $xml->openMemory();
36
+        $xml->setIndent(true);
37
+        $xml->startDocument('1.0', 'UTF-8');
38
+            $xml->startElement("OpenSearchDescription");
39
+                $xml->writeAttribute("xmlns", "http://a9.com/-/spec/opensearch/1.1/");
40
+                $xml->startElement("ShortName");
41
+                    $xml->text("My catalog");
42
+                $xml->endElement();
43
+                $xml->startElement("Description");
44
+                    $xml->text("Search for ebooks");
45
+                $xml->endElement();
46
+                $xml->startElement("InputEncoding");
47
+                    $xml->text("UTF-8");
48
+                $xml->endElement();
49
+                $xml->startElement("OutputEncoding");
50
+                    $xml->text("UTF-8");
51
+                $xml->endElement();
52
+                $xml->startElement("Image");
53
+                    $xml->writeAttribute("type", "image/x-icon");
54
+                    $xml->writeAttribute("width", "16");
55
+                    $xml->writeAttribute("height", "16");
56
+                    $xml->text($config['cops_icon']);
57
+                $xml->endElement();
58
+                $xml->startElement("Url");
59
+                    $xml->writeAttribute("type", 'application/atom+xml');
60 60
                     $urlparam = "?query={searchTerms}";
61
-                    if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
62
-                    $urlparam = str_replace ("%7B", "{", $urlparam);
63
-                    $urlparam = str_replace ("%7D", "}", $urlparam);
64
-                    $xml->writeAttribute ("template", $config['cops_full_url'] . 'feed.php' . $urlparam);
65
-                $xml->endElement ();
66
-                $xml->startElement ("Query");
67
-                    $xml->writeAttribute ("role", "example");
68
-                    $xml->writeAttribute ("searchTerms", "robot");
69
-                $xml->endElement ();
70
-            $xml->endElement ();
61
+                    if (!is_null(GetUrlParam(DB))) $urlparam = addURLParameter($urlparam, DB, GetUrlParam(DB));
62
+                    $urlparam = str_replace("%7B", "{", $urlparam);
63
+                    $urlparam = str_replace("%7D", "}", $urlparam);
64
+                    $xml->writeAttribute("template", $config['cops_full_url'] . 'feed.php' . $urlparam);
65
+                $xml->endElement();
66
+                $xml->startElement("Query");
67
+                    $xml->writeAttribute("role", "example");
68
+                    $xml->writeAttribute("searchTerms", "robot");
69
+                $xml->endElement();
70
+            $xml->endElement();
71 71
         $xml->endDocument();
72 72
         return $xml->outputMemory(true);
73 73
     }
74 74
 
75
-    private function startXmlDocument ($page) {
75
+    private function startXmlDocument($page) {
76 76
         global $config;
77
-        self::getXmlStream ()->startDocument('1.0','UTF-8');
78
-        self::getXmlStream ()->startElement ("feed");
79
-            self::getXmlStream ()->writeAttribute ("xmlns", "http://www.w3.org/2005/Atom");
80
-            self::getXmlStream ()->writeAttribute ("xmlns:xhtml", "http://www.w3.org/1999/xhtml");
81
-            self::getXmlStream ()->writeAttribute ("xmlns:opds", "http://opds-spec.org/2010/catalog");
82
-            self::getXmlStream ()->writeAttribute ("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/");
83
-            self::getXmlStream ()->writeAttribute ("xmlns:dcterms", "http://purl.org/dc/terms/");
84
-            self::getXmlStream ()->startElement ("title");
85
-                self::getXmlStream ()->text ($page->title);
86
-            self::getXmlStream ()->endElement ();
77
+        self::getXmlStream()->startDocument('1.0', 'UTF-8');
78
+        self::getXmlStream()->startElement("feed");
79
+            self::getXmlStream()->writeAttribute("xmlns", "http://www.w3.org/2005/Atom");
80
+            self::getXmlStream()->writeAttribute("xmlns:xhtml", "http://www.w3.org/1999/xhtml");
81
+            self::getXmlStream()->writeAttribute("xmlns:opds", "http://opds-spec.org/2010/catalog");
82
+            self::getXmlStream()->writeAttribute("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/");
83
+            self::getXmlStream()->writeAttribute("xmlns:dcterms", "http://purl.org/dc/terms/");
84
+            self::getXmlStream()->startElement("title");
85
+                self::getXmlStream()->text($page->title);
86
+            self::getXmlStream()->endElement();
87 87
             if ($page->subtitle != "")
88 88
             {
89
-                self::getXmlStream ()->startElement ("subtitle");
90
-                    self::getXmlStream ()->text ($page->subtitle);
91
-                self::getXmlStream ()->endElement ();
89
+                self::getXmlStream()->startElement("subtitle");
90
+                    self::getXmlStream()->text($page->subtitle);
91
+                self::getXmlStream()->endElement();
92 92
             }
93
-            self::getXmlStream ()->startElement ("id");
93
+            self::getXmlStream()->startElement("id");
94 94
                 if ($page->idPage)
95 95
                 {
96 96
                     $idPage = $page->idPage;
97
-                    if (!is_null (GetUrlParam (DB))) $idPage = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $idPage);
98
-                    self::getXmlStream ()->text ($idPage);
97
+                    if (!is_null(GetUrlParam(DB))) $idPage = str_replace("cops:", "cops:" . GetUrlParam(DB) . ":", $idPage);
98
+                    self::getXmlStream()->text($idPage);
99 99
                 }
100 100
                 else
101 101
                 {
102
-                    self::getXmlStream ()->text ($_SERVER['REQUEST_URI']);
102
+                    self::getXmlStream()->text($_SERVER['REQUEST_URI']);
103 103
                 }
104
-            self::getXmlStream ()->endElement ();
105
-            self::getXmlStream ()->startElement ("updated");
106
-                self::getXmlStream ()->text (self::getUpdatedTime ());
107
-            self::getXmlStream ()->endElement ();
108
-            self::getXmlStream ()->startElement ("icon");
109
-                self::getXmlStream ()->text ($page->favicon);
110
-            self::getXmlStream ()->endElement ();
111
-            self::getXmlStream ()->startElement ("author");
112
-                self::getXmlStream ()->startElement ("name");
113
-                    self::getXmlStream ()->text ($page->authorName);
114
-                self::getXmlStream ()->endElement ();
115
-                self::getXmlStream ()->startElement ("uri");
116
-                    self::getXmlStream ()->text ($page->authorUri);
117
-                self::getXmlStream ()->endElement ();
118
-                self::getXmlStream ()->startElement ("email");
119
-                    self::getXmlStream ()->text ($page->authorEmail);
120
-                self::getXmlStream ()->endElement ();
121
-            self::getXmlStream ()->endElement ();
122
-            $link = new LinkNavigation ("", "start", "Home");
123
-            self::renderLink ($link);
124
-            $link = new LinkNavigation ("?" . getQueryString (), "self");
125
-            self::renderLink ($link);
104
+            self::getXmlStream()->endElement();
105
+            self::getXmlStream()->startElement("updated");
106
+                self::getXmlStream()->text(self::getUpdatedTime());
107
+            self::getXmlStream()->endElement();
108
+            self::getXmlStream()->startElement("icon");
109
+                self::getXmlStream()->text($page->favicon);
110
+            self::getXmlStream()->endElement();
111
+            self::getXmlStream()->startElement("author");
112
+                self::getXmlStream()->startElement("name");
113
+                    self::getXmlStream()->text($page->authorName);
114
+                self::getXmlStream()->endElement();
115
+                self::getXmlStream()->startElement("uri");
116
+                    self::getXmlStream()->text($page->authorUri);
117
+                self::getXmlStream()->endElement();
118
+                self::getXmlStream()->startElement("email");
119
+                    self::getXmlStream()->text($page->authorEmail);
120
+                self::getXmlStream()->endElement();
121
+            self::getXmlStream()->endElement();
122
+            $link = new LinkNavigation("", "start", "Home");
123
+            self::renderLink($link);
124
+            $link = new LinkNavigation("?" . getQueryString(), "self");
125
+            self::renderLink($link);
126 126
             $urlparam = "?";
127
-            if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
127
+            if (!is_null(GetUrlParam(DB))) $urlparam = addURLParameter($urlparam, DB, GetUrlParam(DB));
128 128
             if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader|FBReader)/", $_SERVER['HTTP_USER_AGENT'])) {
129 129
                 // Good and compliant way of handling search
130
-                $urlparam = addURLParameter ($urlparam, "page", Base::PAGE_OPENSEARCH);
131
-                $link = new Link ("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here");
130
+                $urlparam = addURLParameter($urlparam, "page", Base::PAGE_OPENSEARCH);
131
+                $link = new Link("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here");
132 132
             }
133 133
             else
134 134
             {
135 135
                 // Bad way, will be removed when OPDS client are fixed
136
-                $urlparam = addURLParameter ($urlparam, "query", "{searchTerms}");
137
-                $urlparam = str_replace ("%7B", "{", $urlparam);
138
-                $urlparam = str_replace ("%7D", "}", $urlparam);
139
-                $link = new Link ($config['cops_full_url'] . 'feed.php' . $urlparam, "application/atom+xml", "search", "Search here");
136
+                $urlparam = addURLParameter($urlparam, "query", "{searchTerms}");
137
+                $urlparam = str_replace("%7B", "{", $urlparam);
138
+                $urlparam = str_replace("%7D", "}", $urlparam);
139
+                $link = new Link($config['cops_full_url'] . 'feed.php' . $urlparam, "application/atom+xml", "search", "Search here");
140 140
             }
141
-            self::renderLink ($link);
142
-            if ($page->containsBook () && !is_null ($config['cops_books_filter']) && count ($config['cops_books_filter']) > 0) {
143
-                $Urlfilter = getURLParam ("tag", "");
141
+            self::renderLink($link);
142
+            if ($page->containsBook() && !is_null($config['cops_books_filter']) && count($config['cops_books_filter']) > 0) {
143
+                $Urlfilter = getURLParam("tag", "");
144 144
                 foreach ($config['cops_books_filter'] as $lib => $filter) {
145
-                    $link = new LinkFacet ("?" . addURLParameter (getQueryString (), "tag", $filter), $lib, localize ("tagword.title"), $filter == $Urlfilter);
146
-                    self::renderLink ($link);
145
+                    $link = new LinkFacet("?" . addURLParameter(getQueryString(), "tag", $filter), $lib, localize("tagword.title"), $filter == $Urlfilter);
146
+                    self::renderLink($link);
147 147
                 }
148 148
             }
149 149
     }
150 150
 
151
-    private function endXmlDocument () {
152
-        self::getXmlStream ()->endElement ();
153
-        self::getXmlStream ()->endDocument ();
154
-        return self::getXmlStream ()->outputMemory(true);
151
+    private function endXmlDocument() {
152
+        self::getXmlStream()->endElement();
153
+        self::getXmlStream()->endDocument();
154
+        return self::getXmlStream()->outputMemory(true);
155 155
     }
156 156
 
157
-    private function renderLink ($link) {
158
-        self::getXmlStream ()->startElement ("link");
159
-            self::getXmlStream ()->writeAttribute ("href", $link->href);
160
-            self::getXmlStream ()->writeAttribute ("type", $link->type);
161
-            if (!is_null ($link->rel)) {
162
-                self::getXmlStream ()->writeAttribute ("rel", $link->rel);
157
+    private function renderLink($link) {
158
+        self::getXmlStream()->startElement("link");
159
+            self::getXmlStream()->writeAttribute("href", $link->href);
160
+            self::getXmlStream()->writeAttribute("type", $link->type);
161
+            if (!is_null($link->rel)) {
162
+                self::getXmlStream()->writeAttribute("rel", $link->rel);
163 163
             }
164
-            if (!is_null ($link->title)) {
165
-                self::getXmlStream ()->writeAttribute ("title", $link->title);
164
+            if (!is_null($link->title)) {
165
+                self::getXmlStream()->writeAttribute("title", $link->title);
166 166
             }
167
-            if (!is_null ($link->facetGroup)) {
168
-                self::getXmlStream ()->writeAttribute ("opds:facetGroup", $link->facetGroup);
167
+            if (!is_null($link->facetGroup)) {
168
+                self::getXmlStream()->writeAttribute("opds:facetGroup", $link->facetGroup);
169 169
             }
170 170
             if ($link->activeFacet) {
171
-                self::getXmlStream ()->writeAttribute ("opds:activeFacet", "true");
171
+                self::getXmlStream()->writeAttribute("opds:activeFacet", "true");
172 172
             }
173
-        self::getXmlStream ()->endElement ();
173
+        self::getXmlStream()->endElement();
174 174
     }
175 175
 
176 176
     private function getPublicationDate($book) {
177 177
         $dateYmd = substr($book->pubdate, 0, 10);
178 178
         $pubdate = \DateTime::createFromFormat('Y-m-d', $dateYmd);
179 179
         if ($pubdate === false ||
180
-            $pubdate->format ("Y") == "0101" ||
181
-            $pubdate->format ("Y") == "0100") {
180
+            $pubdate->format("Y") == "0101" ||
181
+            $pubdate->format("Y") == "0100") {
182 182
             return "";
183 183
         }
184 184
         return $pubdate->format("Y-m-d");
185 185
     }
186 186
 
187
-    private function renderEntry ($entry) {
188
-        self::getXmlStream ()->startElement ("title");
189
-            self::getXmlStream ()->text ($entry->title);
190
-        self::getXmlStream ()->endElement ();
191
-        self::getXmlStream ()->startElement ("updated");
192
-            self::getXmlStream ()->text (self::getUpdatedTime ());
193
-        self::getXmlStream ()->endElement ();
194
-        self::getXmlStream ()->startElement ("id");
195
-            self::getXmlStream ()->text ($entry->id);
196
-        self::getXmlStream ()->endElement ();
197
-        self::getXmlStream ()->startElement ("content");
198
-            self::getXmlStream ()->writeAttribute ("type", $entry->contentType);
187
+    private function renderEntry($entry) {
188
+        self::getXmlStream()->startElement("title");
189
+            self::getXmlStream()->text($entry->title);
190
+        self::getXmlStream()->endElement();
191
+        self::getXmlStream()->startElement("updated");
192
+            self::getXmlStream()->text(self::getUpdatedTime());
193
+        self::getXmlStream()->endElement();
194
+        self::getXmlStream()->startElement("id");
195
+            self::getXmlStream()->text($entry->id);
196
+        self::getXmlStream()->endElement();
197
+        self::getXmlStream()->startElement("content");
198
+            self::getXmlStream()->writeAttribute("type", $entry->contentType);
199 199
             if ($entry->contentType == "text") {
200
-                self::getXmlStream ()->text ($entry->content);
200
+                self::getXmlStream()->text($entry->content);
201 201
             } else {
202
-                self::getXmlStream ()->writeRaw ($entry->content);
202
+                self::getXmlStream()->writeRaw($entry->content);
203 203
             }
204
-        self::getXmlStream ()->endElement ();
204
+        self::getXmlStream()->endElement();
205 205
         foreach ($entry->linkArray as $link) {
206
-            self::renderLink ($link);
206
+            self::renderLink($link);
207 207
         }
208 208
 
209
-        if (get_class ($entry) != "EntryBook") {
209
+        if (get_class($entry) != "EntryBook") {
210 210
             return;
211 211
         }
212 212
 
213
-        foreach ($entry->book->getAuthors () as $author) {
214
-            self::getXmlStream ()->startElement ("author");
215
-                self::getXmlStream ()->startElement ("name");
216
-                    self::getXmlStream ()->text ($author->name);
217
-                self::getXmlStream ()->endElement ();
218
-                self::getXmlStream ()->startElement ("uri");
219
-                    self::getXmlStream ()->text ("feed.php" . $author->getUri ());
220
-                self::getXmlStream ()->endElement ();
221
-            self::getXmlStream ()->endElement ();
213
+        foreach ($entry->book->getAuthors() as $author) {
214
+            self::getXmlStream()->startElement("author");
215
+                self::getXmlStream()->startElement("name");
216
+                    self::getXmlStream()->text($author->name);
217
+                self::getXmlStream()->endElement();
218
+                self::getXmlStream()->startElement("uri");
219
+                    self::getXmlStream()->text("feed.php" . $author->getUri());
220
+                self::getXmlStream()->endElement();
221
+            self::getXmlStream()->endElement();
222 222
         }
223
-        foreach ($entry->book->getTags () as $category) {
224
-            self::getXmlStream ()->startElement ("category");
225
-                self::getXmlStream ()->writeAttribute ("term", $category->name);
226
-                self::getXmlStream ()->writeAttribute ("label", $category->name);
227
-            self::getXmlStream ()->endElement ();
223
+        foreach ($entry->book->getTags() as $category) {
224
+            self::getXmlStream()->startElement("category");
225
+                self::getXmlStream()->writeAttribute("term", $category->name);
226
+                self::getXmlStream()->writeAttribute("label", $category->name);
227
+            self::getXmlStream()->endElement();
228 228
         }
229
-        if ($entry->book->getPubDate () != "") {
230
-            self::getXmlStream ()->startElement ("dcterms:issued");
231
-                self::getXmlStream ()->text (self::getPublicationDate($entry->book));
232
-            self::getXmlStream ()->endElement ();
233
-            self::getXmlStream ()->startElement ("published");
234
-                self::getXmlStream ()->text (self::getPublicationDate($entry->book) . "T08:08:08Z");
235
-            self::getXmlStream ()->endElement ();
229
+        if ($entry->book->getPubDate() != "") {
230
+            self::getXmlStream()->startElement("dcterms:issued");
231
+                self::getXmlStream()->text(self::getPublicationDate($entry->book));
232
+            self::getXmlStream()->endElement();
233
+            self::getXmlStream()->startElement("published");
234
+                self::getXmlStream()->text(self::getPublicationDate($entry->book) . "T08:08:08Z");
235
+            self::getXmlStream()->endElement();
236 236
         }
237 237
 
238
-        $lang = $entry->book->getLanguages ();
238
+        $lang = $entry->book->getLanguages();
239 239
         if (!empty ($lang)) {
240
-            self::getXmlStream ()->startElement ("dcterms:language");
241
-                self::getXmlStream ()->text ($lang);
242
-            self::getXmlStream ()->endElement ();
240
+            self::getXmlStream()->startElement("dcterms:language");
241
+                self::getXmlStream()->text($lang);
242
+            self::getXmlStream()->endElement();
243 243
         }
244 244
 
245 245
     }
246 246
 
247
-    public function render ($page) {
247
+    public function render($page) {
248 248
         global $config;
249
-        self::startXmlDocument ($page);
250
-        if ($page->isPaginated ())
249
+        self::startXmlDocument($page);
250
+        if ($page->isPaginated())
251 251
         {
252
-            self::getXmlStream ()->startElement ("opensearch:totalResults");
253
-                self::getXmlStream ()->text ($page->totalNumber);
254
-            self::getXmlStream ()->endElement ();
255
-            self::getXmlStream ()->startElement ("opensearch:itemsPerPage");
256
-                self::getXmlStream ()->text ($config['cops_max_item_per_page']);
257
-            self::getXmlStream ()->endElement ();
258
-            self::getXmlStream ()->startElement ("opensearch:startIndex");
259
-                self::getXmlStream ()->text (($page->n - 1) * $config['cops_max_item_per_page'] + 1);
260
-            self::getXmlStream ()->endElement ();
261
-            $prevLink = $page->getPrevLink ();
262
-            $nextLink = $page->getNextLink ();
263
-            if (!is_null ($prevLink)) {
264
-                self::renderLink ($prevLink);
252
+            self::getXmlStream()->startElement("opensearch:totalResults");
253
+                self::getXmlStream()->text($page->totalNumber);
254
+            self::getXmlStream()->endElement();
255
+            self::getXmlStream()->startElement("opensearch:itemsPerPage");
256
+                self::getXmlStream()->text($config['cops_max_item_per_page']);
257
+            self::getXmlStream()->endElement();
258
+            self::getXmlStream()->startElement("opensearch:startIndex");
259
+                self::getXmlStream()->text(($page->n - 1) * $config['cops_max_item_per_page'] + 1);
260
+            self::getXmlStream()->endElement();
261
+            $prevLink = $page->getPrevLink();
262
+            $nextLink = $page->getNextLink();
263
+            if (!is_null($prevLink)) {
264
+                self::renderLink($prevLink);
265 265
             }
266
-            if (!is_null ($nextLink)) {
267
-                self::renderLink ($nextLink);
266
+            if (!is_null($nextLink)) {
267
+                self::renderLink($nextLink);
268 268
             }
269 269
         }
270 270
         foreach ($page->entryArray as $entry) {
271
-            self::getXmlStream ()->startElement ("entry");
272
-                self::renderEntry ($entry);
273
-            self::getXmlStream ()->endElement ();
271
+            self::getXmlStream()->startElement("entry");
272
+                self::renderEntry($entry);
273
+            self::getXmlStream()->endElement();
274 274
         }
275
-        return self::endXmlDocument ();
275
+        return self::endXmlDocument();
276 276
     }
277 277
 }
278 278
 
Please login to merge, or discard this patch.
Braces   +32 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,14 +13,16 @@  discard block
 block discarded – undo
13 13
     private $xmlStream = NULL;
14 14
     private $updated = NULL;
15 15
 
16
-    private function getUpdatedTime () {
16
+    private function getUpdatedTime ()
17
+    {
17 18
         if (is_null ($this->updated)) {
18 19
             $this->updated = time();
19 20
         }
20 21
         return date (DATE_ATOM, $this->updated);
21 22
     }
22 23
 
23
-    private function getXmlStream () {
24
+    private function getXmlStream ()
25
+    {
24 26
         if (is_null ($this->xmlStream)) {
25 27
             $this->xmlStream = new XMLWriter();
26 28
             $this->xmlStream->openMemory();
@@ -29,7 +31,8 @@  discard block
 block discarded – undo
29 31
         return $this->xmlStream;
30 32
     }
31 33
 
32
-    public function getOpenSearch () {
34
+    public function getOpenSearch ()
35
+    {
33 36
         global $config;
34 37
         $xml = new XMLWriter ();
35 38
         $xml->openMemory ();
@@ -58,7 +61,9 @@  discard block
 block discarded – undo
58 61
                 $xml->startElement ("Url");
59 62
                     $xml->writeAttribute ("type", 'application/atom+xml');
60 63
                     $urlparam = "?query={searchTerms}";
61
-                    if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
64
+                    if (!is_null (GetUrlParam (DB))) {
65
+                        $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
66
+                    }
62 67
                     $urlparam = str_replace ("%7B", "{", $urlparam);
63 68
                     $urlparam = str_replace ("%7D", "}", $urlparam);
64 69
                     $xml->writeAttribute ("template", $config['cops_full_url'] . 'feed.php' . $urlparam);
@@ -72,7 +77,8 @@  discard block
 block discarded – undo
72 77
         return $xml->outputMemory(true);
73 78
     }
74 79
 
75
-    private function startXmlDocument ($page) {
80
+    private function startXmlDocument ($page)
81
+    {
76 82
         global $config;
77 83
         self::getXmlStream ()->startDocument('1.0','UTF-8');
78 84
         self::getXmlStream ()->startElement ("feed");
@@ -84,21 +90,19 @@  discard block
 block discarded – undo
84 90
             self::getXmlStream ()->startElement ("title");
85 91
                 self::getXmlStream ()->text ($page->title);
86 92
             self::getXmlStream ()->endElement ();
87
-            if ($page->subtitle != "")
88
-            {
93
+            if ($page->subtitle != "") {
89 94
                 self::getXmlStream ()->startElement ("subtitle");
90 95
                     self::getXmlStream ()->text ($page->subtitle);
91 96
                 self::getXmlStream ()->endElement ();
92 97
             }
93 98
             self::getXmlStream ()->startElement ("id");
94
-                if ($page->idPage)
95
-                {
99
+                if ($page->idPage) {
96 100
                     $idPage = $page->idPage;
97
-                    if (!is_null (GetUrlParam (DB))) $idPage = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $idPage);
101
+                    if (!is_null (GetUrlParam (DB))) {
102
+                        $idPage = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $idPage);
103
+                    }
98 104
                     self::getXmlStream ()->text ($idPage);
99
-                }
100
-                else
101
-                {
105
+                } else {
102 106
                     self::getXmlStream ()->text ($_SERVER['REQUEST_URI']);
103 107
                 }
104 108
             self::getXmlStream ()->endElement ();
@@ -124,14 +128,14 @@  discard block
 block discarded – undo
124 128
             $link = new LinkNavigation ("?" . getQueryString (), "self");
125 129
             self::renderLink ($link);
126 130
             $urlparam = "?";
127
-            if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
131
+            if (!is_null (GetUrlParam (DB))) {
132
+                $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
133
+            }
128 134
             if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader|FBReader)/", $_SERVER['HTTP_USER_AGENT'])) {
129 135
                 // Good and compliant way of handling search
130 136
                 $urlparam = addURLParameter ($urlparam, "page", Base::PAGE_OPENSEARCH);
131 137
                 $link = new Link ("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here");
132
-            }
133
-            else
134
-            {
138
+            } else {
135 139
                 // Bad way, will be removed when OPDS client are fixed
136 140
                 $urlparam = addURLParameter ($urlparam, "query", "{searchTerms}");
137 141
                 $urlparam = str_replace ("%7B", "{", $urlparam);
@@ -148,13 +152,15 @@  discard block
 block discarded – undo
148 152
             }
149 153
     }
150 154
 
151
-    private function endXmlDocument () {
155
+    private function endXmlDocument ()
156
+    {
152 157
         self::getXmlStream ()->endElement ();
153 158
         self::getXmlStream ()->endDocument ();
154 159
         return self::getXmlStream ()->outputMemory(true);
155 160
     }
156 161
 
157
-    private function renderLink ($link) {
162
+    private function renderLink ($link)
163
+    {
158 164
         self::getXmlStream ()->startElement ("link");
159 165
             self::getXmlStream ()->writeAttribute ("href", $link->href);
160 166
             self::getXmlStream ()->writeAttribute ("type", $link->type);
@@ -173,7 +179,8 @@  discard block
 block discarded – undo
173 179
         self::getXmlStream ()->endElement ();
174 180
     }
175 181
 
176
-    private function getPublicationDate($book) {
182
+    private function getPublicationDate($book)
183
+    {
177 184
         $dateYmd = substr($book->pubdate, 0, 10);
178 185
         $pubdate = \DateTime::createFromFormat('Y-m-d', $dateYmd);
179 186
         if ($pubdate === false ||
@@ -184,7 +191,8 @@  discard block
 block discarded – undo
184 191
         return $pubdate->format("Y-m-d");
185 192
     }
186 193
 
187
-    private function renderEntry ($entry) {
194
+    private function renderEntry ($entry)
195
+    {
188 196
         self::getXmlStream ()->startElement ("title");
189 197
             self::getXmlStream ()->text ($entry->title);
190 198
         self::getXmlStream ()->endElement ();
@@ -244,11 +252,11 @@  discard block
 block discarded – undo
244 252
 
245 253
     }
246 254
 
247
-    public function render ($page) {
255
+    public function render ($page)
256
+    {
248 257
         global $config;
249 258
         self::startXmlDocument ($page);
250
-        if ($page->isPaginated ())
251
-        {
259
+        if ($page->isPaginated ()) {
252 260
             self::getXmlStream ()->startElement ("opensearch:totalResults");
253 261
                 self::getXmlStream ()->text ($page->totalNumber);
254 262
             self::getXmlStream ()->endElement ();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
 
11 11
 class OPDSRenderer
12 12
 {
13
-    private $xmlStream = NULL;
14
-    private $updated = NULL;
13
+    private $xmlStream = null;
14
+    private $updated = null;
15 15
 
16 16
     private function getUpdatedTime () {
17 17
         if (is_null ($this->updated)) {
Please login to merge, or discard this patch.
customcolumn.php 3 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,80 +19,80 @@
 block discarded – undo
19 19
         $this->customId = $pcustomId;
20 20
     }
21 21
 
22
-    public function getUri () {
23
-        return "?page=".parent::PAGE_CUSTOM_DETAIL."&custom={$this->customId}&id={$this->id}";
22
+    public function getUri() {
23
+        return "?page=" . parent::PAGE_CUSTOM_DETAIL . "&custom={$this->customId}&id={$this->id}";
24 24
     }
25 25
 
26
-    public function getEntryId () {
27
-        return self::ALL_CUSTOMS_ID.":".$this->customId.":".$this->id;
26
+    public function getEntryId() {
27
+        return self::ALL_CUSTOMS_ID . ":" . $this->customId . ":" . $this->id;
28 28
     }
29 29
 
30
-    public static function getTableName ($customId) {
30
+    public static function getTableName($customId) {
31 31
         return "custom_column_{$customId}";
32 32
     }
33 33
 
34
-    public static function getTableLinkName ($customId) {
34
+    public static function getTableLinkName($customId) {
35 35
         return "books_custom_column_{$customId}_link";
36 36
     }
37 37
 
38
-    public static function getTableLinkColumn ($customId) {
38
+    public static function getTableLinkColumn($customId) {
39 39
         return "value";
40 40
     }
41 41
 
42
-    public static function getAllCustomsId ($customId) {
42
+    public static function getAllCustomsId($customId) {
43 43
         return self::ALL_CUSTOMS_ID . ":" . $customId;
44 44
     }
45 45
 
46
-    public static function getUriAllCustoms ($customId) {
46
+    public static function getUriAllCustoms($customId) {
47 47
         return "?page=" . parent::PAGE_ALL_CUSTOMS . "&custom={$customId}";
48 48
     }
49 49
 
50
-    public static function getAllTitle ($customId) {
51
-        $result = parent::getDb ()->prepare('select name from custom_columns where id = ?');
52
-        $result->execute (array ($customId));
53
-        $post = $result->fetchObject ();
50
+    public static function getAllTitle($customId) {
51
+        $result = parent::getDb()->prepare('select name from custom_columns where id = ?');
52
+        $result->execute(array($customId));
53
+        $post = $result->fetchObject();
54 54
         return $post->name;
55 55
     }
56 56
 
57
-    public static function getCustomId ($lookup) {
58
-        $result = parent::getDb ()->prepare('select id from custom_columns where label = ?');
59
-        $result->execute (array ($lookup));
60
-        if ($post = $result->fetchObject ()) {
57
+    public static function getCustomId($lookup) {
58
+        $result = parent::getDb()->prepare('select id from custom_columns where label = ?');
59
+        $result->execute(array($lookup));
60
+        if ($post = $result->fetchObject()) {
61 61
             return $post->id;
62 62
         }
63 63
         return NULL;
64 64
     }
65 65
 
66 66
     public static function getCount($customId) {
67
-        $nCustoms = parent::executeQuerySingle ('select count(*) from ' . self::getTableName ($customId));
68
-        $entry = new Entry (self::getAllTitle ($customId), self::getAllCustomsId ($customId),
69
-            str_format (localize("tags.alphabetical", $nCustoms), $nCustoms), "text",
70
-            array ( new LinkNavigation (self::getUriAllCustoms ($customId))), "", $nCustoms);
67
+        $nCustoms = parent::executeQuerySingle('select count(*) from ' . self::getTableName($customId));
68
+        $entry = new Entry(self::getAllTitle($customId), self::getAllCustomsId($customId),
69
+            str_format(localize("tags.alphabetical", $nCustoms), $nCustoms), "text",
70
+            array(new LinkNavigation(self::getUriAllCustoms($customId))), "", $nCustoms);
71 71
         return $entry;
72 72
     }
73 73
 
74
-    public static function getCustomById ($customId, $id) {
75
-        $result = parent::getDb ()->prepare('select id, value as name from ' . self::getTableName ($customId) . ' where id = ?');
76
-        $result->execute (array ($id));
77
-        if ($post = $result->fetchObject ()) {
78
-            return new CustomColumn ($post->id, $post->name, $customId);
74
+    public static function getCustomById($customId, $id) {
75
+        $result = parent::getDb()->prepare('select id, value as name from ' . self::getTableName($customId) . ' where id = ?');
76
+        $result->execute(array($id));
77
+        if ($post = $result->fetchObject()) {
78
+            return new CustomColumn($post->id, $post->name, $customId);
79 79
         }
80 80
         return NULL;
81 81
     }
82 82
 
83 83
     public static function getAllCustoms($customId) {
84
-        $result = parent::getDb ()->query(str_format ('select {0}.id as id, {0}.value as name, count(*) as count
84
+        $result = parent::getDb()->query(str_format('select {0}.id as id, {0}.value as name, count(*) as count
85 85
 from {0}, {1}
86 86
 where {0}.id = {1}.{2}
87 87
 group by {0}.id, {0}.value
88
-order by {0}.value', self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)));
88
+order by {0}.value', self::getTableName($customId), self::getTableLinkName($customId), self::getTableLinkColumn($customId)));
89 89
         $entryArray = array();
90
-        while ($post = $result->fetchObject ())
90
+        while ($post = $result->fetchObject())
91 91
         {
92
-            $customColumn = new CustomColumn ($post->id, $post->name, $customId);
93
-            array_push ($entryArray, new Entry ($customColumn->name, $customColumn->getEntryId (),
94
-                str_format (localize("bookword", $post->count), $post->count), "text",
95
-                array ( new LinkNavigation ($customColumn->getUri ())), "", $post->count));
92
+            $customColumn = new CustomColumn($post->id, $post->name, $customId);
93
+            array_push($entryArray, new Entry($customColumn->name, $customColumn->getEntryId(),
94
+                str_format(localize("bookword", $post->count), $post->count), "text",
95
+                array(new LinkNavigation($customColumn->getUri())), "", $post->count));
96 96
         }
97 97
         return $entryArray;
98 98
     }
Please login to merge, or discard this patch.
Braces   +29 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,55 +6,66 @@  discard block
 block discarded – undo
6 6
  * @author     Sébastien Lucas <[email protected]>
7 7
  */
8 8
 
9
-class CustomColumn extends Base {
9
+class CustomColumn extends Base
10
+{
10 11
     const ALL_CUSTOMS_ID = "cops:custom";
11 12
 
12 13
     public $id;
13 14
     public $name;
14 15
     public $customId;
15 16
 
16
-    public function __construct($pid, $pname, $pcustomId) {
17
+    public function __construct($pid, $pname, $pcustomId)
18
+    {
17 19
         $this->id = $pid;
18 20
         $this->name = $pname;
19 21
         $this->customId = $pcustomId;
20 22
     }
21 23
 
22
-    public function getUri () {
24
+    public function getUri ()
25
+    {
23 26
         return "?page=".parent::PAGE_CUSTOM_DETAIL."&custom={$this->customId}&id={$this->id}";
24 27
     }
25 28
 
26
-    public function getEntryId () {
29
+    public function getEntryId ()
30
+    {
27 31
         return self::ALL_CUSTOMS_ID.":".$this->customId.":".$this->id;
28 32
     }
29 33
 
30
-    public static function getTableName ($customId) {
34
+    public static function getTableName ($customId)
35
+    {
31 36
         return "custom_column_{$customId}";
32 37
     }
33 38
 
34
-    public static function getTableLinkName ($customId) {
39
+    public static function getTableLinkName ($customId)
40
+    {
35 41
         return "books_custom_column_{$customId}_link";
36 42
     }
37 43
 
38
-    public static function getTableLinkColumn ($customId) {
44
+    public static function getTableLinkColumn ($customId)
45
+    {
39 46
         return "value";
40 47
     }
41 48
 
42
-    public static function getAllCustomsId ($customId) {
49
+    public static function getAllCustomsId ($customId)
50
+    {
43 51
         return self::ALL_CUSTOMS_ID . ":" . $customId;
44 52
     }
45 53
 
46
-    public static function getUriAllCustoms ($customId) {
54
+    public static function getUriAllCustoms ($customId)
55
+    {
47 56
         return "?page=" . parent::PAGE_ALL_CUSTOMS . "&custom={$customId}";
48 57
     }
49 58
 
50
-    public static function getAllTitle ($customId) {
59
+    public static function getAllTitle ($customId)
60
+    {
51 61
         $result = parent::getDb ()->prepare('select name from custom_columns where id = ?');
52 62
         $result->execute (array ($customId));
53 63
         $post = $result->fetchObject ();
54 64
         return $post->name;
55 65
     }
56 66
 
57
-    public static function getCustomId ($lookup) {
67
+    public static function getCustomId ($lookup)
68
+    {
58 69
         $result = parent::getDb ()->prepare('select id from custom_columns where label = ?');
59 70
         $result->execute (array ($lookup));
60 71
         if ($post = $result->fetchObject ()) {
@@ -63,7 +74,8 @@  discard block
 block discarded – undo
63 74
         return NULL;
64 75
     }
65 76
 
66
-    public static function getCount($customId) {
77
+    public static function getCount($customId)
78
+    {
67 79
         $nCustoms = parent::executeQuerySingle ('select count(*) from ' . self::getTableName ($customId));
68 80
         $entry = new Entry (self::getAllTitle ($customId), self::getAllCustomsId ($customId),
69 81
             str_format (localize("tags.alphabetical", $nCustoms), $nCustoms), "text",
@@ -71,7 +83,8 @@  discard block
 block discarded – undo
71 83
         return $entry;
72 84
     }
73 85
 
74
-    public static function getCustomById ($customId, $id) {
86
+    public static function getCustomById ($customId, $id)
87
+    {
75 88
         $result = parent::getDb ()->prepare('select id, value as name from ' . self::getTableName ($customId) . ' where id = ?');
76 89
         $result->execute (array ($id));
77 90
         if ($post = $result->fetchObject ()) {
@@ -80,15 +93,15 @@  discard block
 block discarded – undo
80 93
         return NULL;
81 94
     }
82 95
 
83
-    public static function getAllCustoms($customId) {
96
+    public static function getAllCustoms($customId)
97
+    {
84 98
         $result = parent::getDb ()->query(str_format ('select {0}.id as id, {0}.value as name, count(*) as count
85 99
 from {0}, {1}
86 100
 where {0}.id = {1}.{2}
87 101
 group by {0}.id, {0}.value
88 102
 order by {0}.value', self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)));
89 103
         $entryArray = array();
90
-        while ($post = $result->fetchObject ())
91
-        {
104
+        while ($post = $result->fetchObject ()) {
92 105
             $customColumn = new CustomColumn ($post->id, $post->name, $customId);
93 106
             array_push ($entryArray, new Entry ($customColumn->name, $customColumn->getEntryId (),
94 107
                 str_format (localize("bookword", $post->count), $post->count), "text",
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         if ($post = $result->fetchObject ()) {
61 61
             return $post->id;
62 62
         }
63
-        return NULL;
63
+        return null;
64 64
     }
65 65
 
66 66
     public static function getCount($customId) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         if ($post = $result->fetchObject ()) {
78 78
             return new CustomColumn ($post->id, $post->name, $customId);
79 79
         }
80
-        return NULL;
80
+        return null;
81 81
     }
82 82
 
83 83
     public static function getAllCustoms($customId) {
Please login to merge, or discard this patch.
epubreader.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 require_once ("config.php");
12 12
 require_once ("base.php");
13 13
 
14
-header ("Content-Type: text/html;charset=utf-8");
14
+header("Content-Type: text/html;charset=utf-8");
15 15
 
16
-$idData = getURLParam ("data", NULL);
16
+$idData = getURLParam("data", NULL);
17 17
 $add = "data=$idData&";
18
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
18
+if (!is_null(GetUrlParam(DB))) $add .= DB . "=" . GetUrlParam(DB) . "&";
19 19
 $myBook = Book::getBookByDataId($idData);
20 20
 
21
-$book = new EPub ($myBook->getFilePath ("EPUB", $idData));
22
-$book->initSpineComponent ();
21
+$book = new EPub($myBook->getFilePath("EPUB", $idData));
22
+$book->initSpineComponent();
23 23
 
24 24
 ?>
25 25
 <head>
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
         Monocle.DEBUG = true;
36 36
         var bookData = {
37 37
           getComponents: function () {
38
-            <?php echo "return [" . implode (", ", array_map (function ($comp) { return "'" . $comp . "'"; }, $book->components ())) . "];"; ?>
38
+            <?php echo "return [" . implode(", ", array_map(function($comp) { return "'" . $comp . "'"; }, $book->components())) . "];"; ?>
39 39
           },
40 40
           getContents: function () {
41
-            <?php echo "return [" . implode (", ", array_map (function ($content) { return "{title: '" . addslashes($content["title"]) . "', src: '". $content["src"] . "'}"; }, $book->contents ())) . "];"; ?>
41
+            <?php echo "return [" . implode(", ", array_map(function($content) { return "{title: '" . addslashes($content["title"]) . "', src: '" . $content["src"] . "'}"; }, $book->contents())) . "];"; ?>
42 42
           },
43 43
           getComponent: function (componentId) {
44 44
             return { url: "epubfs.php?<?php echo $add ?>comp="  + componentId };
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
15 15
 
16 16
 $idData = getURLParam ("data", NULL);
17 17
 $add = "data=$idData&";
18
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
18
+if (!is_null (GetUrlParam (DB))) {
19
+    $add .= DB . "=" . GetUrlParam (DB) . "&";
20
+}
19 21
 $myBook = Book::getBookByDataId($idData);
20 22
 
21 23
 $book = new EPub ($myBook->getFilePath ("EPUB", $idData));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 header ("Content-Type: text/html;charset=utf-8");
15 15
 
16
-$idData = getURLParam ("data", NULL);
16
+$idData = getURLParam ("data", null);
17 17
 $add = "data=$idData&";
18 18
 if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
19 19
 $myBook = Book::getBookByDataId($idData);
Please login to merge, or discard this patch.
feed.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
     require_once ("config.php");
11 11
     require_once ("base.php");
12 12
 
13
-    header ("Content-Type:application/xml");
14
-    $page = getURLParam ("page", Base::PAGE_INDEX);
15
-    $query = getURLParam ("query");
16
-    $n = getURLParam ("n", "1");
13
+    header("Content-Type:application/xml");
14
+    $page = getURLParam("page", Base::PAGE_INDEX);
15
+    $query = getURLParam("query");
16
+    $n = getURLParam("n", "1");
17 17
     if ($query)
18 18
         $page = Base::PAGE_OPENSEARCH_QUERY;
19
-    $qid = getURLParam ("id");
19
+    $qid = getURLParam("id");
20 20
 
21 21
     if ($config ['cops_fetch_protect'] == "1") {
22 22
         session_start();
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
         }
26 26
     }
27 27
 
28
-    $OPDSRender = new OPDSRenderer ();
28
+    $OPDSRender = new OPDSRenderer();
29 29
 
30 30
     switch ($page) {
31 31
         case Base::PAGE_OPENSEARCH :
32
-            echo $OPDSRender->getOpenSearch ();
32
+            echo $OPDSRender->getOpenSearch();
33 33
             return;
34 34
         default:
35
-            $currentPage = Page::getPage ($page, $qid, $query, $n);
36
-            $currentPage->InitializeContent ();
37
-            echo $OPDSRender->render ($currentPage);
35
+            $currentPage = Page::getPage($page, $qid, $query, $n);
36
+            $currentPage->InitializeContent();
37
+            echo $OPDSRender->render($currentPage);
38 38
             return;
39 39
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
     $page = getURLParam ("page", Base::PAGE_INDEX);
15 15
     $query = getURLParam ("query");
16 16
     $n = getURLParam ("n", "1");
17
-    if ($query)
18
-        $page = Base::PAGE_OPENSEARCH_QUERY;
17
+    if ($query) {
18
+            $page = Base::PAGE_OPENSEARCH_QUERY;
19
+    }
19 20
     $qid = getURLParam ("id");
20 21
 
21 22
     if ($config ['cops_fetch_protect'] == "1") {
Please login to merge, or discard this patch.
JSON_renderer.php 4 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
         }
47 47
 
48 48
         return array ("id" => $book->id,
49
-                      "hasCover" => $book->hasCover,
50
-                      "preferedData" => $preferedData,
51
-                      "rating" => $book->getRating (),
52
-                      "publisherName" => $pn,
53
-                      "publisherurl" => $pu,
54
-                      "pubDate" => $book->getPubDate (),
55
-                      "languagesName" => $book->getLanguages (),
56
-                      "authorsName" => $book->getAuthorsName (),
57
-                      "tagsName" => $book->getTagsName (),
58
-                      "seriesName" => $sn,
59
-                      "seriesIndex" => $book->seriesIndex,
60
-                      "seriesCompleteName" => $scn,
61
-                      "seriesurl" => $su);
49
+                        "hasCover" => $book->hasCover,
50
+                        "preferedData" => $preferedData,
51
+                        "rating" => $book->getRating (),
52
+                        "publisherName" => $pn,
53
+                        "publisherurl" => $pu,
54
+                        "pubDate" => $book->getPubDate (),
55
+                        "languagesName" => $book->getLanguages (),
56
+                        "authorsName" => $book->getAuthorsName (),
57
+                        "tagsName" => $book->getTagsName (),
58
+                        "seriesName" => $sn,
59
+                        "seriesIndex" => $book->seriesIndex,
60
+                        "seriesCompleteName" => $scn,
61
+                        "seriesurl" => $su);
62 62
     }
63 63
 
64 64
     public static function getFullBookContentArray ($book) {
@@ -125,44 +125,44 @@  discard block
 block discarded – undo
125 125
         $out = $in;
126 126
 
127 127
         $out ["c"] = array ("version" => VERSION, "i18n" => array (
128
-                           "coverAlt" => localize("i18n.coversection"),
129
-                           "authorsTitle" => localize("authors.title"),
130
-                           "bookwordTitle" => localize("bookword.title"),
131
-                           "tagsTitle" => localize("tags.title"),
132
-                           "seriesTitle" => localize("series.title"),
133
-                           "customizeTitle" => localize ("customize.title"),
134
-                           "aboutTitle" => localize ("about.title"),
135
-                           "previousAlt" => localize ("paging.previous.alternate"),
136
-                           "nextAlt" => localize ("paging.next.alternate"),
137
-                           "searchAlt" => localize ("search.alternate"),
138
-                           "sortAlt" => localize ("sort.alternate"),
139
-                           "homeAlt" => localize ("home.alternate"),
140
-                           "cogAlt" => localize ("cog.alternate"),
141
-                           "permalinkAlt" => localize ("permalink.alternate"),
142
-                           "publisherName" => localize("publisher.name"),
143
-                           "pubdateTitle" => localize("pubdate.title"),
144
-                           "languagesTitle" => localize("language.title"),
145
-                           "contentTitle" => localize("content.summary"),
146
-                           "sortorderAsc" => localize("search.sortorder.asc"),
147
-                           "sortorderDesc" => localize("search.sortorder.desc"),
148
-                           "customizeEmail" => localize("customize.email")),
149
-                       "url" => array (
150
-                           "detailUrl" => "index.php?page=13&id={0}&db={1}",
151
-                           "coverUrl" => "fetch.php?id={0}&db={1}",
152
-                           "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
153
-                       "config" => array (
154
-                           "use_fancyapps" => $config ["cops_use_fancyapps"],
155
-                           "max_item_per_page" => $config['cops_max_item_per_page'],
156
-                           "kindleHack"        => "",
157
-                           "server_side_rendering" => useServerSideRendering (),
158
-                           "html_tag_filter" => $config['cops_html_tag_filter']));
128
+                            "coverAlt" => localize("i18n.coversection"),
129
+                            "authorsTitle" => localize("authors.title"),
130
+                            "bookwordTitle" => localize("bookword.title"),
131
+                            "tagsTitle" => localize("tags.title"),
132
+                            "seriesTitle" => localize("series.title"),
133
+                            "customizeTitle" => localize ("customize.title"),
134
+                            "aboutTitle" => localize ("about.title"),
135
+                            "previousAlt" => localize ("paging.previous.alternate"),
136
+                            "nextAlt" => localize ("paging.next.alternate"),
137
+                            "searchAlt" => localize ("search.alternate"),
138
+                            "sortAlt" => localize ("sort.alternate"),
139
+                            "homeAlt" => localize ("home.alternate"),
140
+                            "cogAlt" => localize ("cog.alternate"),
141
+                            "permalinkAlt" => localize ("permalink.alternate"),
142
+                            "publisherName" => localize("publisher.name"),
143
+                            "pubdateTitle" => localize("pubdate.title"),
144
+                            "languagesTitle" => localize("language.title"),
145
+                            "contentTitle" => localize("content.summary"),
146
+                            "sortorderAsc" => localize("search.sortorder.asc"),
147
+                            "sortorderDesc" => localize("search.sortorder.desc"),
148
+                            "customizeEmail" => localize("customize.email")),
149
+                        "url" => array (
150
+                            "detailUrl" => "index.php?page=13&id={0}&db={1}",
151
+                            "coverUrl" => "fetch.php?id={0}&db={1}",
152
+                            "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
153
+                        "config" => array (
154
+                            "use_fancyapps" => $config ["cops_use_fancyapps"],
155
+                            "max_item_per_page" => $config['cops_max_item_per_page'],
156
+                            "kindleHack"        => "",
157
+                            "server_side_rendering" => useServerSideRendering (),
158
+                            "html_tag_filter" => $config['cops_html_tag_filter']));
159 159
         if ($config['cops_thumbnail_handling'] == "1") {
160 160
             $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
161 161
         } else if (!empty ($config['cops_thumbnail_handling'])) {
162 162
             $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
163 163
         }
164 164
         if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) {
165
-          $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"';
165
+            $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"';
166 166
         }
167 167
         return $out;
168 168
     }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         }
222 222
         if (!is_null (getURLParam ("complete")) || $complete) {
223 223
             $out = self::addCompleteArray ($out);
224
-       }
224
+        }
225 225
 
226 226
         $out ["containsBook"] = 0;
227 227
         if ($currentPage->containsBook ()) {
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -10,135 +10,135 @@  discard block
 block discarded – undo
10 10
 
11 11
 class JSONRenderer
12 12
 {
13
-    public static function getBookContentArray ($book) {
13
+    public static function getBookContentArray($book) {
14 14
         global $config;
15 15
         $i = 0;
16
-        $preferedData = array ();
16
+        $preferedData = array();
17 17
         foreach ($config['cops_prefered_format'] as $format)
18 18
         {
19 19
             if ($i == 2) { break; }
20
-            if ($data = $book->getDataFormat ($format)) {
20
+            if ($data = $book->getDataFormat($format)) {
21 21
                 $i++;
22
-                array_push ($preferedData, array ("url" => $data->getHtmlLink (), "name" => $format));
22
+                array_push($preferedData, array("url" => $data->getHtmlLink(), "name" => $format));
23 23
             }
24 24
         }
25 25
 
26 26
         $publisher = $book->getPublisher();
27
-        if (is_null ($publisher)) {
27
+        if (is_null($publisher)) {
28 28
             $pn = "";
29 29
             $pu = "";
30 30
         } else {
31 31
             $pn = $publisher->name;
32
-            $link = new LinkNavigation ($publisher->getUri ());
33
-            $pu = $link->hrefXhtml ();
32
+            $link = new LinkNavigation($publisher->getUri());
33
+            $pu = $link->hrefXhtml();
34 34
         }
35 35
 
36
-        $serie = $book->getSerie ();
37
-        if (is_null ($serie)) {
36
+        $serie = $book->getSerie();
37
+        if (is_null($serie)) {
38 38
             $sn = "";
39 39
             $scn = "";
40 40
             $su = "";
41 41
         } else {
42 42
             $sn = $serie->name;
43
-            $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name);
44
-            $link = new LinkNavigation ($serie->getUri ());
45
-            $su = $link->hrefXhtml ();
43
+            $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name);
44
+            $link = new LinkNavigation($serie->getUri());
45
+            $su = $link->hrefXhtml();
46 46
         }
47 47
 
48
-        return array ("id" => $book->id,
48
+        return array("id" => $book->id,
49 49
                       "hasCover" => $book->hasCover,
50 50
                       "preferedData" => $preferedData,
51
-                      "rating" => $book->getRating (),
51
+                      "rating" => $book->getRating(),
52 52
                       "publisherName" => $pn,
53 53
                       "publisherurl" => $pu,
54
-                      "pubDate" => $book->getPubDate (),
55
-                      "languagesName" => $book->getLanguages (),
56
-                      "authorsName" => $book->getAuthorsName (),
57
-                      "tagsName" => $book->getTagsName (),
54
+                      "pubDate" => $book->getPubDate(),
55
+                      "languagesName" => $book->getLanguages(),
56
+                      "authorsName" => $book->getAuthorsName(),
57
+                      "tagsName" => $book->getTagsName(),
58 58
                       "seriesName" => $sn,
59 59
                       "seriesIndex" => $book->seriesIndex,
60 60
                       "seriesCompleteName" => $scn,
61 61
                       "seriesurl" => $su);
62 62
     }
63 63
 
64
-    public static function getFullBookContentArray ($book) {
64
+    public static function getFullBookContentArray($book) {
65 65
         global $config;
66
-        $out = self::getBookContentArray ($book);
67
-        $database = GetUrlParam (DB);
68
-
69
-        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
70
-        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
71
-        $out ["content"] = $book->getComment (false);
72
-        $out ["datas"] = array ();
73
-        $dataKindle = $book->GetMostInterestingDataToSendToKindle ();
66
+        $out = self::getBookContentArray($book);
67
+        $database = GetUrlParam(DB);
68
+
69
+        $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml();
70
+        $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml();
71
+        $out ["content"] = $book->getComment(false);
72
+        $out ["datas"] = array();
73
+        $dataKindle = $book->GetMostInterestingDataToSendToKindle();
74 74
         foreach ($book->getDatas() as $data) {
75
-            $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0, "readerUrl" => "");
76
-            if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) {
75
+            $tab = array("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink(), "mail" => 0, "readerUrl" => "");
76
+            if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) {
77 77
                 $tab ["mail"] = 1;
78 78
             }
79 79
             if ($data->format == "EPUB") {
80 80
                 $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}";
81 81
             }
82
-            array_push ($out ["datas"], $tab);
82
+            array_push($out ["datas"], $tab);
83 83
         }
84
-        $out ["authors"] = array ();
85
-        foreach ($book->getAuthors () as $author) {
86
-            $link = new LinkNavigation ($author->getUri ());
87
-            array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ()));
84
+        $out ["authors"] = array();
85
+        foreach ($book->getAuthors() as $author) {
86
+            $link = new LinkNavigation($author->getUri());
87
+            array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml()));
88 88
         }
89
-        $out ["tags"] = array ();
90
-        foreach ($book->getTags () as $tag) {
91
-            $link = new LinkNavigation ($tag->getUri ());
92
-            array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ()));
89
+        $out ["tags"] = array();
90
+        foreach ($book->getTags() as $tag) {
91
+            $link = new LinkNavigation($tag->getUri());
92
+            array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml()));
93 93
         }
94 94
         ;
95 95
         return $out;
96 96
     }
97 97
 
98
-    public static function getContentArray ($entry) {
98
+    public static function getContentArray($entry) {
99 99
         if ($entry instanceof EntryBook) {
100
-            $out = array ( "title" => $entry->title);
101
-            $out ["book"] = self::getBookContentArray ($entry->book);
100
+            $out = array("title" => $entry->title);
101
+            $out ["book"] = self::getBookContentArray($entry->book);
102 102
             return $out;
103 103
         }
104
-        return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement );
104
+        return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement);
105 105
     }
106 106
 
107
-    public static function getContentArrayTypeahead ($page) {
108
-        $out = array ();
107
+    public static function getContentArrayTypeahead($page) {
108
+        $out = array();
109 109
         foreach ($page->entryArray as $entry) {
110 110
             if ($entry instanceof EntryBook) {
111
-                array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ()));
111
+                array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl()));
112 112
             } else {
113
-                if (empty ($entry->className) xor Base::noDatabaseSelected ()) {
114
-                    array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ()));
113
+                if (empty ($entry->className) xor Base::noDatabaseSelected()) {
114
+                    array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink()));
115 115
                 } else {
116
-                    array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ()));
116
+                    array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink()));
117 117
                 }
118 118
             }
119 119
         }
120 120
         return $out;
121 121
     }
122 122
 
123
-    public static function addCompleteArray ($in) {
123
+    public static function addCompleteArray($in) {
124 124
         global $config;
125 125
         $out = $in;
126 126
 
127
-        $out ["c"] = array ("version" => VERSION, "i18n" => array (
127
+        $out ["c"] = array("version" => VERSION, "i18n" => array(
128 128
                            "coverAlt" => localize("i18n.coversection"),
129 129
                            "authorsTitle" => localize("authors.title"),
130 130
                            "bookwordTitle" => localize("bookword.title"),
131 131
                            "tagsTitle" => localize("tags.title"),
132 132
                            "seriesTitle" => localize("series.title"),
133
-                           "customizeTitle" => localize ("customize.title"),
134
-                           "aboutTitle" => localize ("about.title"),
135
-                           "previousAlt" => localize ("paging.previous.alternate"),
136
-                           "nextAlt" => localize ("paging.next.alternate"),
137
-                           "searchAlt" => localize ("search.alternate"),
138
-                           "sortAlt" => localize ("sort.alternate"),
139
-                           "homeAlt" => localize ("home.alternate"),
140
-                           "cogAlt" => localize ("cog.alternate"),
141
-                           "permalinkAlt" => localize ("permalink.alternate"),
133
+                           "customizeTitle" => localize("customize.title"),
134
+                           "aboutTitle" => localize("about.title"),
135
+                           "previousAlt" => localize("paging.previous.alternate"),
136
+                           "nextAlt" => localize("paging.next.alternate"),
137
+                           "searchAlt" => localize("search.alternate"),
138
+                           "sortAlt" => localize("sort.alternate"),
139
+                           "homeAlt" => localize("home.alternate"),
140
+                           "cogAlt" => localize("cog.alternate"),
141
+                           "permalinkAlt" => localize("permalink.alternate"),
142 142
                            "publisherName" => localize("publisher.name"),
143 143
                            "pubdateTitle" => localize("pubdate.title"),
144 144
                            "languagesTitle" => localize("language.title"),
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
                            "sortorderAsc" => localize("search.sortorder.asc"),
147 147
                            "sortorderDesc" => localize("search.sortorder.desc"),
148 148
                            "customizeEmail" => localize("customize.email")),
149
-                       "url" => array (
149
+                       "url" => array(
150 150
                            "detailUrl" => "index.php?page=13&id={0}&db={1}",
151 151
                            "coverUrl" => "fetch.php?id={0}&db={1}",
152 152
                            "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
153
-                       "config" => array (
153
+                       "config" => array(
154 154
                            "use_fancyapps" => $config ["cops_use_fancyapps"],
155 155
                            "max_item_per_page" => $config['cops_max_item_per_page'],
156 156
                            "kindleHack"        => "",
157
-                           "server_side_rendering" => useServerSideRendering (),
157
+                           "server_side_rendering" => useServerSideRendering(),
158 158
                            "html_tag_filter" => $config['cops_html_tag_filter']));
159 159
         if ($config['cops_thumbnail_handling'] == "1") {
160 160
             $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
@@ -167,32 +167,32 @@  discard block
 block discarded – undo
167 167
         return $out;
168 168
     }
169 169
 
170
-    public static function getJson ($complete = false) {
170
+    public static function getJson($complete = false) {
171 171
         global $config;
172
-        $page = getURLParam ("page", Base::PAGE_INDEX);
173
-        $query = getURLParam ("query");
174
-        $search = getURLParam ("search");
175
-        $qid = getURLParam ("id");
176
-        $n = getURLParam ("n", "1");
177
-        $database = GetUrlParam (DB);
172
+        $page = getURLParam("page", Base::PAGE_INDEX);
173
+        $query = getURLParam("query");
174
+        $search = getURLParam("search");
175
+        $qid = getURLParam("id");
176
+        $n = getURLParam("n", "1");
177
+        $database = GetUrlParam(DB);
178 178
 
179
-        $currentPage = Page::getPage ($page, $qid, $query, $n);
180
-        $currentPage->InitializeContent ();
179
+        $currentPage = Page::getPage($page, $qid, $query, $n);
180
+        $currentPage->InitializeContent();
181 181
 
182 182
         if ($search) {
183
-            return self::getContentArrayTypeahead ($currentPage);
183
+            return self::getContentArrayTypeahead($currentPage);
184 184
         }
185 185
 
186
-        $out = array ( "title" => $currentPage->title);
187
-        $entries = array ();
186
+        $out = array("title" => $currentPage->title);
187
+        $entries = array();
188 188
         foreach ($currentPage->entryArray as $entry) {
189
-            array_push ($entries, self::getContentArray ($entry));
189
+            array_push($entries, self::getContentArray($entry));
190 190
         }
191
-        if (!is_null ($currentPage->book)) {
192
-            $out ["book"] = self::getFullBookContentArray ($currentPage->book);
191
+        if (!is_null($currentPage->book)) {
192
+            $out ["book"] = self::getFullBookContentArray($currentPage->book);
193 193
         }
194
-        $out ["databaseId"] = GetUrlParam (DB, "");
195
-        $out ["databaseName"] = Base::getDbName ();
194
+        $out ["databaseId"] = GetUrlParam(DB, "");
195
+        $out ["databaseName"] = Base::getDbName();
196 196
         if ($out ["databaseId"] == "") {
197 197
             $out ["databaseName"] = "";
198 198
         }
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
             $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"];
202 202
         }
203 203
         $out ["page"] = $page;
204
-        $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0;
204
+        $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0;
205 205
         $out ["entries"] = $entries;
206 206
         $out ["isPaginated"] = 0;
207
-        if ($currentPage->isPaginated ()) {
208
-            $prevLink = $currentPage->getPrevLink ();
209
-            $nextLink = $currentPage->getNextLink ();
207
+        if ($currentPage->isPaginated()) {
208
+            $prevLink = $currentPage->getPrevLink();
209
+            $nextLink = $currentPage->getNextLink();
210 210
             $out ["isPaginated"] = 1;
211 211
             $out ["prevLink"] = "";
212
-            if (!is_null ($prevLink)) {
213
-                $out ["prevLink"] = $prevLink->hrefXhtml ();
212
+            if (!is_null($prevLink)) {
213
+                $out ["prevLink"] = $prevLink->hrefXhtml();
214 214
             }
215 215
             $out ["nextLink"] = "";
216
-            if (!is_null ($nextLink)) {
217
-                $out ["nextLink"] = $nextLink->hrefXhtml ();
216
+            if (!is_null($nextLink)) {
217
+                $out ["nextLink"] = $nextLink->hrefXhtml();
218 218
             }
219
-            $out ["maxPage"] = $currentPage->getMaxPage ();
219
+            $out ["maxPage"] = $currentPage->getMaxPage();
220 220
             $out ["currentPage"] = $currentPage->n;
221 221
         }
222
-        if (!is_null (getURLParam ("complete")) || $complete) {
223
-            $out = self::addCompleteArray ($out);
222
+        if (!is_null(getURLParam("complete")) || $complete) {
223
+            $out = self::addCompleteArray($out);
224 224
        }
225 225
 
226 226
         $out ["containsBook"] = 0;
227
-        if ($currentPage->containsBook ()) {
227
+        if ($currentPage->containsBook()) {
228 228
             $out ["containsBook"] = 1;
229 229
         }
230 230
 
231
-        $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database);
231
+        $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database);
232 232
 
233 233
         if ($page == Base::PAGE_ABOUT) {
234
-            $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
234
+            $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
235 235
             $out ["fullhtml"] = $temp;
236 236
         }
237 237
 
238 238
         $out ["homeurl"] = "index.php";
239
-        if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
239
+        if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database);
240 240
 
241 241
         return $out;
242 242
     }
Please login to merge, or discard this patch.
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 class JSONRenderer
12 12
 {
13
-    public static function getBookContentArray ($book) {
13
+    public static function getBookContentArray ($book)
14
+    {
14 15
         global $config;
15 16
         $i = 0;
16 17
         $preferedData = array ();
17
-        foreach ($config['cops_prefered_format'] as $format)
18
-        {
18
+        foreach ($config['cops_prefered_format'] as $format) {
19 19
             if ($i == 2) { break; }
20 20
             if ($data = $book->getDataFormat ($format)) {
21 21
                 $i++;
@@ -61,7 +61,8 @@  discard block
 block discarded – undo
61 61
                       "seriesurl" => $su);
62 62
     }
63 63
 
64
-    public static function getFullBookContentArray ($book) {
64
+    public static function getFullBookContentArray ($book)
65
+    {
65 66
         global $config;
66 67
         $out = self::getBookContentArray ($book);
67 68
         $database = GetUrlParam (DB);
@@ -95,7 +96,8 @@  discard block
 block discarded – undo
95 96
         return $out;
96 97
     }
97 98
 
98
-    public static function getContentArray ($entry) {
99
+    public static function getContentArray ($entry)
100
+    {
99 101
         if ($entry instanceof EntryBook) {
100 102
             $out = array ( "title" => $entry->title);
101 103
             $out ["book"] = self::getBookContentArray ($entry->book);
@@ -104,7 +106,8 @@  discard block
 block discarded – undo
104 106
         return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement );
105 107
     }
106 108
 
107
-    public static function getContentArrayTypeahead ($page) {
109
+    public static function getContentArrayTypeahead ($page)
110
+    {
108 111
         $out = array ();
109 112
         foreach ($page->entryArray as $entry) {
110 113
             if ($entry instanceof EntryBook) {
@@ -120,7 +123,8 @@  discard block
 block discarded – undo
120 123
         return $out;
121 124
     }
122 125
 
123
-    public static function addCompleteArray ($in) {
126
+    public static function addCompleteArray ($in)
127
+    {
124 128
         global $config;
125 129
         $out = $in;
126 130
 
@@ -167,7 +171,8 @@  discard block
 block discarded – undo
167 171
         return $out;
168 172
     }
169 173
 
170
-    public static function getJson ($complete = false) {
174
+    public static function getJson ($complete = false)
175
+    {
171 176
         global $config;
172 177
         $page = getURLParam ("page", Base::PAGE_INDEX);
173 178
         $query = getURLParam ("query");
@@ -236,7 +241,9 @@  discard block
 block discarded – undo
236 241
         }
237 242
 
238 243
         $out ["homeurl"] = "index.php";
239
-        if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
244
+        if ($page != Base::PAGE_INDEX && !is_null ($database)) {
245
+            $out ["homeurl"] = $out ["homeurl"] .  "?" . addURLParameter ("", DB, $database);
246
+        }
240 247
 
241 248
         return $out;
242 249
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
         $out = self::getBookContentArray ($book);
67 67
         $database = GetUrlParam (DB);
68 68
 
69
-        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml ();
70
-        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
69
+        $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", null)->hrefXhtml ();
70
+        $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", null, null, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml ();
71 71
         $out ["content"] = $book->getComment (false);
72 72
         $out ["datas"] = array ();
73 73
         $dataKindle = $book->GetMostInterestingDataToSendToKindle ();
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@
 block discarded – undo
37 37
     header ("Content-Type:text/html;charset=utf-8");
38 38
 
39 39
     $data = array("title"                 => $config['cops_title_default'],
40
-                  "version"               => VERSION,
41
-                  "opds_url"              => $config['cops_full_url'] . "feed.php",
42
-                  "customHeader"          => "",
43
-                  "template"              => getCurrentTemplate (),
44
-                  "server_side_rendering" => useServerSideRendering (),
45
-                  "current_css"           => getCurrentCss (),
46
-                  "favico"                => $config['cops_icon'],
47
-                  "getjson_url"           => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
40
+                    "version"               => VERSION,
41
+                    "opds_url"              => $config['cops_full_url'] . "feed.php",
42
+                    "customHeader"          => "",
43
+                    "template"              => getCurrentTemplate (),
44
+                    "server_side_rendering" => useServerSideRendering (),
45
+                    "current_css"           => getCurrentCss (),
46
+                    "favico"                => $config['cops_icon'],
47
+                    "getjson_url"           => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
48 48
     if (preg_match("/Kindle/", $_SERVER['HTTP_USER_AGENT'])) {
49 49
         $data ["customHeader"] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>';
50 50
     }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
         exit ();
17 17
     }
18 18
 
19
-    $page = getURLParam ("page", Base::PAGE_INDEX);
20
-    $query = getURLParam ("query");
21
-    $qid = getURLParam ("id");
22
-    $n = getURLParam ("n", "1");
23
-    $database = GetUrlParam (DB);
19
+    $page = getURLParam("page", Base::PAGE_INDEX);
20
+    $query = getURLParam("query");
21
+    $qid = getURLParam("id");
22
+    $n = getURLParam("n", "1");
23
+    $database = GetUrlParam(DB);
24 24
 
25 25
 
26 26
     // Access the database ASAP to be sure it's readable, redirect if that's not the case.
27 27
     // It has to be done before any header is sent.
28
-    Base::checkDatabaseAvailability ();
28
+    Base::checkDatabaseAvailability();
29 29
 
30 30
     if ($config ['cops_fetch_protect'] == "1") {
31 31
         session_start();
@@ -34,32 +34,32 @@  discard block
 block discarded – undo
34 34
         }
35 35
     }
36 36
 
37
-    header ("Content-Type:text/html;charset=utf-8");
37
+    header("Content-Type:text/html;charset=utf-8");
38 38
 
39 39
     $data = array("title"                 => $config['cops_title_default'],
40 40
                   "version"               => VERSION,
41 41
                   "opds_url"              => $config['cops_full_url'] . "feed.php",
42 42
                   "customHeader"          => "",
43
-                  "template"              => getCurrentTemplate (),
44
-                  "server_side_rendering" => useServerSideRendering (),
45
-                  "current_css"           => getCurrentCss (),
43
+                  "template"              => getCurrentTemplate(),
44
+                  "server_side_rendering" => useServerSideRendering(),
45
+                  "current_css"           => getCurrentCss(),
46 46
                   "favico"                => $config['cops_icon'],
47
-                  "getjson_url"           => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
47
+                  "getjson_url"           => "getJSON.php?" . addURLParameter(getQueryString(), "complete", 1));
48 48
     if (preg_match("/Kindle/", $_SERVER['HTTP_USER_AGENT'])) {
49 49
         $data ["customHeader"] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>';
50 50
     }
51
-    $headcontent = file_get_contents('templates/' . getCurrentTemplate () . '/file.html');
52
-    $template = new doT ();
53
-    $dot = $template->template ($headcontent, NULL);
54
-    echo ($dot ($data));
51
+    $headcontent = file_get_contents('templates/' . getCurrentTemplate() . '/file.html');
52
+    $template = new doT();
53
+    $dot = $template->template($headcontent, NULL);
54
+    echo ($dot($data));
55 55
 ?><body>
56 56
 <?php
57
-if (useServerSideRendering ()) {
57
+if (useServerSideRendering()) {
58 58
     // Get the data
59 59
     require_once ("JSON_renderer.php");
60
-    $data = JSONRenderer::getJson (true);
60
+    $data = JSONRenderer::getJson(true);
61 61
 
62
-    echo serverSideRender ($data);
62
+    echo serverSideRender($data);
63 63
 }
64 64
 ?>
65 65
 </body>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     }
51 51
     $headcontent = file_get_contents('templates/' . getCurrentTemplate () . '/file.html');
52 52
     $template = new doT ();
53
-    $dot = $template->template ($headcontent, NULL);
53
+    $dot = $template->template ($headcontent, null);
54 54
     echo ($dot ($data));
55 55
 ?><body>
56 56
 <?php
Please login to merge, or discard this patch.
getJSON.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     require_once ("config.php");
11 11
 
12
-    header ("Content-Type:application/json;charset=utf-8");
12
+    header("Content-Type:application/json;charset=utf-8");
13 13
 
14 14
 
15
-    echo json_encode (JSONRenderer::getJson ());
15
+    echo json_encode(JSONRenderer::getJson());
16 16
 
Please login to merge, or discard this patch.