@@ -34,95 +34,95 @@ |
||
34 | 34 | |
35 | 35 | class Calender { |
36 | 36 | |
37 | - protected $calenderID = -1; |
|
38 | - protected $row = null; |
|
39 | - protected $user_row = null; |
|
40 | - |
|
41 | - public function __construct (array $row = null, array $user_row = null) { |
|
42 | - if (!is_null($row) && !empty($row)) { |
|
43 | - $this->calenderID = $row['id']; |
|
44 | - $this->row = $row; |
|
45 | - } |
|
46 | - |
|
47 | - if (!is_null($user_row) && !empty($user_row)) { |
|
48 | - $this->user_row = $user_row; |
|
49 | - } |
|
50 | - } |
|
51 | - |
|
52 | - public function load (int $calenderID) { |
|
53 | - if ($calenderID <= 0) { |
|
54 | - throw new \IllegalArgumentException("calenderID has to be greater than 0."); |
|
55 | - } |
|
56 | - |
|
57 | - if (Cache::contains("plugin-calender", "calender-" . $calenderID)) { |
|
58 | - $this->row = Cache::get("plugin-calender", "calender-" . $calenderID); |
|
59 | - } else { |
|
60 | - //get calender from database |
|
61 | - $row = Database::getInstance()->getRow("SELECT * FROM `{praefix}plugin_calender_calenders` WHERE `id` = :calenderID; ", array( |
|
62 | - 'calenderID' => array( |
|
63 | - 'type' => PDO::PARAM_INT, |
|
64 | - 'value' => $calenderID |
|
65 | - ) |
|
66 | - )); |
|
67 | - |
|
68 | - if (!$row) { |
|
69 | - throw new IllegalStateException("calender with id '" . $calenderID . "' doesnt exists."); |
|
70 | - } |
|
71 | - |
|
72 | - $this->row = $row; |
|
73 | - |
|
74 | - //put row to cache |
|
75 | - Cache::put("plugin-calender", "calender-" . $calenderID, $row); |
|
76 | - } |
|
77 | - |
|
78 | - $this->calenderID = $this->row['id']; |
|
79 | - } |
|
80 | - |
|
81 | - public function getID () : int { |
|
82 | - return $this->calenderID; |
|
83 | - } |
|
84 | - |
|
85 | - public function getTitle () : string { |
|
86 | - return $this->row['title']; |
|
87 | - } |
|
88 | - |
|
89 | - public function getDescription () : string { |
|
90 | - return $this->row['description']; |
|
91 | - } |
|
92 | - |
|
93 | - public function getType () : string { |
|
94 | - return $this->row['type']; |
|
95 | - } |
|
96 | - |
|
97 | - public function getPermission () : string { |
|
98 | - if ($this->user_row == null || empty($this->user_row)) { |
|
99 | - throw new IllegalStateException("user row wasnt set in constructor."); |
|
100 | - } |
|
101 | - |
|
102 | - return $this->user_row['value']; |
|
103 | - } |
|
104 | - |
|
105 | - public function listAllEvents (bool $only_current_events = false) : array { |
|
106 | - //read from database, dont cache |
|
107 | - $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugin_calender_events` WHERE `calenderID` = :calenderID" . ($only_current_events ? " AND DATE(`to_date`) >= DATE(NOW())" : "") . " ORDER BY `from_date`; ", array( |
|
108 | - 'calenderID' => array( |
|
109 | - 'type' => PDO::PARAM_INT, |
|
110 | - 'value' => $this->getID() |
|
111 | - ) |
|
112 | - )); |
|
113 | - |
|
114 | - $events = array(); |
|
115 | - |
|
116 | - foreach ($rows as $row) { |
|
117 | - $events[] = new Event($row); |
|
118 | - } |
|
119 | - |
|
120 | - return $events; |
|
121 | - } |
|
122 | - |
|
123 | - public static function castCalender (Calender $calender) : Calender { |
|
124 | - return $calender; |
|
125 | - } |
|
37 | + protected $calenderID = -1; |
|
38 | + protected $row = null; |
|
39 | + protected $user_row = null; |
|
40 | + |
|
41 | + public function __construct (array $row = null, array $user_row = null) { |
|
42 | + if (!is_null($row) && !empty($row)) { |
|
43 | + $this->calenderID = $row['id']; |
|
44 | + $this->row = $row; |
|
45 | + } |
|
46 | + |
|
47 | + if (!is_null($user_row) && !empty($user_row)) { |
|
48 | + $this->user_row = $user_row; |
|
49 | + } |
|
50 | + } |
|
51 | + |
|
52 | + public function load (int $calenderID) { |
|
53 | + if ($calenderID <= 0) { |
|
54 | + throw new \IllegalArgumentException("calenderID has to be greater than 0."); |
|
55 | + } |
|
56 | + |
|
57 | + if (Cache::contains("plugin-calender", "calender-" . $calenderID)) { |
|
58 | + $this->row = Cache::get("plugin-calender", "calender-" . $calenderID); |
|
59 | + } else { |
|
60 | + //get calender from database |
|
61 | + $row = Database::getInstance()->getRow("SELECT * FROM `{praefix}plugin_calender_calenders` WHERE `id` = :calenderID; ", array( |
|
62 | + 'calenderID' => array( |
|
63 | + 'type' => PDO::PARAM_INT, |
|
64 | + 'value' => $calenderID |
|
65 | + ) |
|
66 | + )); |
|
67 | + |
|
68 | + if (!$row) { |
|
69 | + throw new IllegalStateException("calender with id '" . $calenderID . "' doesnt exists."); |
|
70 | + } |
|
71 | + |
|
72 | + $this->row = $row; |
|
73 | + |
|
74 | + //put row to cache |
|
75 | + Cache::put("plugin-calender", "calender-" . $calenderID, $row); |
|
76 | + } |
|
77 | + |
|
78 | + $this->calenderID = $this->row['id']; |
|
79 | + } |
|
80 | + |
|
81 | + public function getID () : int { |
|
82 | + return $this->calenderID; |
|
83 | + } |
|
84 | + |
|
85 | + public function getTitle () : string { |
|
86 | + return $this->row['title']; |
|
87 | + } |
|
88 | + |
|
89 | + public function getDescription () : string { |
|
90 | + return $this->row['description']; |
|
91 | + } |
|
92 | + |
|
93 | + public function getType () : string { |
|
94 | + return $this->row['type']; |
|
95 | + } |
|
96 | + |
|
97 | + public function getPermission () : string { |
|
98 | + if ($this->user_row == null || empty($this->user_row)) { |
|
99 | + throw new IllegalStateException("user row wasnt set in constructor."); |
|
100 | + } |
|
101 | + |
|
102 | + return $this->user_row['value']; |
|
103 | + } |
|
104 | + |
|
105 | + public function listAllEvents (bool $only_current_events = false) : array { |
|
106 | + //read from database, dont cache |
|
107 | + $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugin_calender_events` WHERE `calenderID` = :calenderID" . ($only_current_events ? " AND DATE(`to_date`) >= DATE(NOW())" : "") . " ORDER BY `from_date`; ", array( |
|
108 | + 'calenderID' => array( |
|
109 | + 'type' => PDO::PARAM_INT, |
|
110 | + 'value' => $this->getID() |
|
111 | + ) |
|
112 | + )); |
|
113 | + |
|
114 | + $events = array(); |
|
115 | + |
|
116 | + foreach ($rows as $row) { |
|
117 | + $events[] = new Event($row); |
|
118 | + } |
|
119 | + |
|
120 | + return $events; |
|
121 | + } |
|
122 | + |
|
123 | + public static function castCalender (Calender $calender) : Calender { |
|
124 | + return $calender; |
|
125 | + } |
|
126 | 126 | |
127 | 127 | } |
128 | 128 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | protected $row = null; |
39 | 39 | protected $user_row = null; |
40 | 40 | |
41 | - public function __construct (array $row = null, array $user_row = null) { |
|
41 | + public function __construct(array $row = null, array $user_row = null) { |
|
42 | 42 | if (!is_null($row) && !empty($row)) { |
43 | 43 | $this->calenderID = $row['id']; |
44 | 44 | $this->row = $row; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - public function load (int $calenderID) { |
|
52 | + public function load(int $calenderID) { |
|
53 | 53 | if ($calenderID <= 0) { |
54 | 54 | throw new \IllegalArgumentException("calenderID has to be greater than 0."); |
55 | 55 | } |
@@ -78,23 +78,23 @@ discard block |
||
78 | 78 | $this->calenderID = $this->row['id']; |
79 | 79 | } |
80 | 80 | |
81 | - public function getID () : int { |
|
81 | + public function getID() : int { |
|
82 | 82 | return $this->calenderID; |
83 | 83 | } |
84 | 84 | |
85 | - public function getTitle () : string { |
|
85 | + public function getTitle() : string { |
|
86 | 86 | return $this->row['title']; |
87 | 87 | } |
88 | 88 | |
89 | - public function getDescription () : string { |
|
89 | + public function getDescription() : string { |
|
90 | 90 | return $this->row['description']; |
91 | 91 | } |
92 | 92 | |
93 | - public function getType () : string { |
|
93 | + public function getType() : string { |
|
94 | 94 | return $this->row['type']; |
95 | 95 | } |
96 | 96 | |
97 | - public function getPermission () : string { |
|
97 | + public function getPermission() : string { |
|
98 | 98 | if ($this->user_row == null || empty($this->user_row)) { |
99 | 99 | throw new IllegalStateException("user row wasnt set in constructor."); |
100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return $this->user_row['value']; |
103 | 103 | } |
104 | 104 | |
105 | - public function listAllEvents (bool $only_current_events = false) : array { |
|
105 | + public function listAllEvents(bool $only_current_events = false) : array { |
|
106 | 106 | //read from database, dont cache |
107 | 107 | $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugin_calender_events` WHERE `calenderID` = :calenderID" . ($only_current_events ? " AND DATE(`to_date`) >= DATE(NOW())" : "") . " ORDER BY `from_date`; ", array( |
108 | 108 | 'calenderID' => array( |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return $events; |
121 | 121 | } |
122 | 122 | |
123 | - public static function castCalender (Calender $calender) : Calender { |
|
123 | + public static function castCalender(Calender $calender) : Calender { |
|
124 | 124 | return $calender; |
125 | 125 | } |
126 | 126 |
@@ -17,8 +17,8 @@ |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | if (!defined("PLUGIN_INSTALLER")) { |
20 | - echo "You cannot access this file directly!"; |
|
21 | - exit; |
|
20 | + echo "You cannot access this file directly!"; |
|
21 | + exit; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -26,8 +26,8 @@ |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | if (!defined("PLUGIN_INSTALLER")) { |
29 | - echo "You cannot access this file directly!"; |
|
30 | - exit; |
|
29 | + echo "You cannot access this file directly!"; |
|
30 | + exit; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | //delete plugin tables |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | class WorkshopsApi { |
29 | 29 | |
30 | - public static function listAllWorkshops () : array { |
|
30 | + public static function listAllWorkshops() : array { |
|
31 | 31 | $res = array(); |
32 | 32 | |
33 | 33 | //read workshops directly from database |
@@ -31,33 +31,33 @@ |
||
31 | 31 | |
32 | 32 | class WorkshopsApi { |
33 | 33 | |
34 | - public static function listAllWorkshops () : array { |
|
35 | - $res = array(); |
|
34 | + public static function listAllWorkshops () : array { |
|
35 | + $res = array(); |
|
36 | 36 | |
37 | - //read workshops directly from database |
|
38 | - $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugin_workshops_workshops` ORDER BY `order`; "); |
|
37 | + //read workshops directly from database |
|
38 | + $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugin_workshops_workshops` ORDER BY `order`; "); |
|
39 | 39 | |
40 | - $array = array(); |
|
40 | + $array = array(); |
|
41 | 41 | |
42 | - foreach ($rows as $row) { |
|
43 | - $array[] = array( |
|
44 | - 'id' => $row['id'], |
|
45 | - 'title' => utf8_encode($row['title']), |
|
46 | - 'description' => utf8_encode($row['description']), |
|
47 | - 'image' => utf8_encode($row['image']), |
|
48 | - 'day' => utf8_encode($row['day']), |
|
49 | - 'time' => utf8_encode($row['time']), |
|
50 | - 'interval' => utf8_encode($row['interval']), |
|
51 | - 'location' => utf8_encode($row['location']), |
|
52 | - 'responsible' => utf8_encode($row['responsible']), |
|
53 | - 'order' => $row['order'] |
|
54 | - ); |
|
55 | - } |
|
42 | + foreach ($rows as $row) { |
|
43 | + $array[] = array( |
|
44 | + 'id' => $row['id'], |
|
45 | + 'title' => utf8_encode($row['title']), |
|
46 | + 'description' => utf8_encode($row['description']), |
|
47 | + 'image' => utf8_encode($row['image']), |
|
48 | + 'day' => utf8_encode($row['day']), |
|
49 | + 'time' => utf8_encode($row['time']), |
|
50 | + 'interval' => utf8_encode($row['interval']), |
|
51 | + 'location' => utf8_encode($row['location']), |
|
52 | + 'responsible' => utf8_encode($row['responsible']), |
|
53 | + 'order' => $row['order'] |
|
54 | + ); |
|
55 | + } |
|
56 | 56 | |
57 | - $res['workshops'] = $array; |
|
57 | + $res['workshops'] = $array; |
|
58 | 58 | |
59 | - return $res; |
|
60 | - } |
|
59 | + return $res; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | } |
63 | 63 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | } |
41 | 41 | $result = 0; |
42 | 42 | for ($i = 0; $i < $kLen; $i++) { |
43 | - $result |= (ord($knownString[$i]) ^ ord($userString[$i])); |
|
43 | + $result |= (ord($knownString[$i])^ord($userString[$i])); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // They are only identical strings if $result is exactly 0... |
@@ -44,7 +44,7 @@ |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -spl_autoload_register(function ($class) { |
|
47 | +spl_autoload_register(function($class) { |
|
48 | 48 | // project-specific namespace prefix |
49 | 49 | $prefix = 'Facebook\\'; |
50 | 50 |
@@ -128,7 +128,7 @@ |
||
128 | 128 | */ |
129 | 129 | public function asArray() |
130 | 130 | { |
131 | - return array_map(function ($value) { |
|
131 | + return array_map(function($value) { |
|
132 | 132 | return $value instanceof Collection ? $value->asArray() : $value; |
133 | 133 | }, $this->items); |
134 | 134 | } |
@@ -85,7 +85,7 @@ |
||
85 | 85 | { |
86 | 86 | $items = $this->asArray(); |
87 | 87 | |
88 | - return array_map(function ($v) { |
|
88 | + return array_map(function($v) { |
|
89 | 89 | if ($v instanceof \DateTime) { |
90 | 90 | return $v->format(\DateTime::ISO8601); |
91 | 91 | } |
@@ -602,8 +602,8 @@ |
||
602 | 602 | } while (!$chunk->isLastChunk()); |
603 | 603 | |
604 | 604 | return [ |
605 | - 'video_id' => $chunk->getVideoId(), |
|
606 | - 'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata), |
|
605 | + 'video_id' => $chunk->getVideoId(), |
|
606 | + 'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata), |
|
607 | 607 | ]; |
608 | 608 | } |
609 | 609 |
@@ -593,7 +593,7 @@ |
||
593 | 593 | $graphVersion = $graphVersion ?: $this->defaultGraphVersion; |
594 | 594 | |
595 | 595 | $uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion); |
596 | - $endpoint = '/'.$target.'/videos'; |
|
596 | + $endpoint = '/' . $target . '/videos'; |
|
597 | 597 | $file = $this->videoToUpload($pathToFile); |
598 | 598 | $chunk = $uploader->start($endpoint, $file); |
599 | 599 |