@@ -205,7 +205,7 @@ |
||
205 | 205 | private static function start_gzipping() |
206 | 206 | { |
207 | 207 | if(!ob_start('ob_gzhandler')) |
208 | - ob_start(); |
|
208 | + ob_start(); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | } |
212 | 212 | \ No newline at end of file |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | switch($piece) |
53 | 53 | { |
54 | 54 | case 'jquery-1.4.2' : |
55 | - case 'jquery-1.10.2.min' : |
|
55 | + case 'jquery-1.10.2.min' : |
|
56 | 56 | case 'jquery-ui-1.8.2' : |
57 | 57 | case 'ga' : |
58 | 58 | $simple_pieces[] = $piece; |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | foreach($array as $file) |
119 | 119 | { |
120 | 120 | $piece_path = self::get_piece_path($type, $file); |
121 | - $contents .= "/*** {$file} ***/\n\n"; |
|
121 | + $contents .= "/*** {$file} ***/\n\n"; |
|
122 | 122 | $contents .= file_get_contents($piece_path); |
123 | - $contents .= "\n\n\n"; |
|
123 | + $contents .= "\n\n\n"; |
|
124 | 124 | } |
125 | 125 | return self::make_final_file($type, $contents, $site); |
126 | 126 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | //if(!$this->time_to_run($frequency)) |
28 | 28 | // continue; |
29 | - if ($cron != 'TwitterCron') continue; |
|
29 | + if ($cron != 'TwitterCron') continue; |
|
30 | 30 | |
31 | 31 | Loader::load('utility', "cron/{$cron}"); |
32 | 32 | $reflection = new ReflectionClass($cron); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - global $config; |
|
15 | + global $config; |
|
16 | 16 | $this->headers['From'] = self::$FROM; |
17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>"; |
18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>"; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - global $config; |
|
15 | + global $config; |
|
16 | 16 | $this->headers['From'] = self::$FROM; |
17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>"; |
18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>"; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - global $config; |
|
15 | + global $config; |
|
16 | 16 | $this->headers['From'] = self::$FROM; |
17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>"; |
18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>"; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - global $config; |
|
15 | + global $config; |
|
16 | 16 | $this->headers['From'] = self::$FROM; |
17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>"; |
18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>"; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $handle = @fopen($config_path, 'r'); |
9 | 9 | if ($handle === false) { |
10 | - throw new RuntimeException("Could not load config"); |
|
10 | + throw new RuntimeException("Could not load config"); |
|
11 | 11 | } |
12 | 12 | $config = fread($handle, filesize($config_path)); |
13 | 13 | fclose($handle); |
@@ -15,40 +15,40 @@ discard block |
||
15 | 15 | $config = json_decode($config); |
16 | 16 | $last_json_error = json_last_error(); |
17 | 17 | if ($last_json_error !== JSON_ERROR_NONE) { |
18 | - throw new RuntimeException("Could not parse config - JSON error detected"); |
|
18 | + throw new RuntimeException("Could not parse config - JSON error detected"); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // configure the db connections holder |
22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
23 | 23 | $db_connections->setDefault(function () use ($config) { |
24 | - $connection = $config->database->slave; |
|
25 | - return new Aura\Sql\ExtendedPdo( |
|
26 | - "mysql:host={$connection->host}", |
|
27 | - $connection->user, |
|
28 | - $connection->password |
|
29 | - ); |
|
24 | + $connection = $config->database->slave; |
|
25 | + return new Aura\Sql\ExtendedPdo( |
|
26 | + "mysql:host={$connection->host}", |
|
27 | + $connection->user, |
|
28 | + $connection->password |
|
29 | + ); |
|
30 | 30 | }); |
31 | 31 | $db_connections->setWrite('master', function () use ($config) { |
32 | - $connection = $config->database->master; |
|
33 | - return new Aura\Sql\ExtendedPdo( |
|
34 | - "mysql:host={$connection->host}", |
|
35 | - $connection->user, |
|
36 | - $connection->password |
|
37 | - ); |
|
32 | + $connection = $config->database->master; |
|
33 | + return new Aura\Sql\ExtendedPdo( |
|
34 | + "mysql:host={$connection->host}", |
|
35 | + $connection->user, |
|
36 | + $connection->password |
|
37 | + ); |
|
38 | 38 | }); |
39 | 39 | $db_connections->setRead('slave', function () use ($config) { |
40 | - $connection = $config->database->slave; |
|
41 | - $pdo = new Aura\Sql\ExtendedPdo( |
|
42 | - "mysql:host={$connection->host}", |
|
43 | - $connection->user, |
|
44 | - $connection->password |
|
45 | - ); |
|
46 | - |
|
47 | - $profiler = new Aura\Sql\Profiler(); |
|
48 | - $profiler->setActive(true); |
|
49 | - $pdo->setProfiler($profiler); |
|
50 | - |
|
51 | - return $pdo; |
|
40 | + $connection = $config->database->slave; |
|
41 | + $pdo = new Aura\Sql\ExtendedPdo( |
|
42 | + "mysql:host={$connection->host}", |
|
43 | + $connection->user, |
|
44 | + $connection->password |
|
45 | + ); |
|
46 | + |
|
47 | + $profiler = new Aura\Sql\Profiler(); |
|
48 | + $profiler->setActive(true); |
|
49 | + $pdo->setProfiler($profiler); |
|
50 | + |
|
51 | + return $pdo; |
|
52 | 52 | }); |
53 | 53 | |
54 | 54 | // setup the service locator |
@@ -7,132 +7,132 @@ |
||
7 | 7 | class MysqlPostRepository implements PostRepositoryInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** @var ConnectionLocator */ |
|
11 | - protected $connections; |
|
12 | - |
|
13 | - /** |
|
14 | - * @param ConnectonLocator $connections |
|
15 | - */ |
|
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
18 | - $this->connections = $connections; |
|
19 | - } |
|
20 | - |
|
21 | - /** |
|
22 | - * @param integer $id |
|
23 | - * |
|
24 | - * @return array|false |
|
25 | - */ |
|
26 | - public function getPostById($id) |
|
27 | - { |
|
28 | - $query = " |
|
10 | + /** @var ConnectionLocator */ |
|
11 | + protected $connections; |
|
12 | + |
|
13 | + /** |
|
14 | + * @param ConnectonLocator $connections |
|
15 | + */ |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | + $this->connections = $connections; |
|
19 | + } |
|
20 | + |
|
21 | + /** |
|
22 | + * @param integer $id |
|
23 | + * |
|
24 | + * @return array|false |
|
25 | + */ |
|
26 | + public function getPostById($id) |
|
27 | + { |
|
28 | + $query = " |
|
29 | 29 | SELECT * |
30 | 30 | FROM `jpemeric_stream`.`post` |
31 | 31 | WHERE `id` = :id |
32 | 32 | LIMIT 1"; |
33 | - $bindings = [ |
|
34 | - 'id' => $id, |
|
35 | - ]; |
|
36 | - |
|
37 | - return $this |
|
38 | - ->connections |
|
39 | - ->getRead() |
|
40 | - ->fetchOne($query, $bindings); |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * @param string $type |
|
45 | - * @param integer $type_id |
|
46 | - * |
|
47 | - * @return array|false |
|
48 | - */ |
|
49 | - public function getPostByType($type, $type_id) |
|
50 | - { |
|
51 | - $query = " |
|
33 | + $bindings = [ |
|
34 | + 'id' => $id, |
|
35 | + ]; |
|
36 | + |
|
37 | + return $this |
|
38 | + ->connections |
|
39 | + ->getRead() |
|
40 | + ->fetchOne($query, $bindings); |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * @param string $type |
|
45 | + * @param integer $type_id |
|
46 | + * |
|
47 | + * @return array|false |
|
48 | + */ |
|
49 | + public function getPostByType($type, $type_id) |
|
50 | + { |
|
51 | + $query = " |
|
52 | 52 | SELECT * |
53 | 53 | FROM `jpemeric_stream`.`post` |
54 | 54 | WHERE `type` = :type && `type_id` = :type_id |
55 | 55 | LIMIT 1"; |
56 | - $bindings = [ |
|
57 | - 'type' => $type, |
|
58 | - 'type_id' => $type_id, |
|
59 | - ]; |
|
60 | - |
|
61 | - return $this |
|
62 | - ->connections |
|
63 | - ->getRead() |
|
64 | - ->fetchOne($query, $bindings); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * @param integer $limit |
|
69 | - * @param integer $offset |
|
70 | - * |
|
71 | - * @return array|false |
|
72 | - */ |
|
73 | - public function getPosts($limit = null, $offset = 0) |
|
74 | - { |
|
75 | - $query = " |
|
56 | + $bindings = [ |
|
57 | + 'type' => $type, |
|
58 | + 'type_id' => $type_id, |
|
59 | + ]; |
|
60 | + |
|
61 | + return $this |
|
62 | + ->connections |
|
63 | + ->getRead() |
|
64 | + ->fetchOne($query, $bindings); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * @param integer $limit |
|
69 | + * @param integer $offset |
|
70 | + * |
|
71 | + * @return array|false |
|
72 | + */ |
|
73 | + public function getPosts($limit = null, $offset = 0) |
|
74 | + { |
|
75 | + $query = " |
|
76 | 76 | SELECT * |
77 | 77 | FROM `jpemeric_stream`.`post` |
78 | 78 | ORDER BY `date` DESC"; |
79 | - if (!is_null($limit)) { |
|
80 | - $query .= " |
|
79 | + if (!is_null($limit)) { |
|
80 | + $query .= " |
|
81 | 81 | LIMIT {$offset}, {$limit}"; |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | - return $this |
|
85 | - ->connections |
|
86 | - ->getRead() |
|
87 | - ->fetchAll($query); |
|
88 | - } |
|
84 | + return $this |
|
85 | + ->connections |
|
86 | + ->getRead() |
|
87 | + ->fetchAll($query); |
|
88 | + } |
|
89 | 89 | |
90 | - public function getPostsCount() |
|
91 | - { |
|
92 | - $query = " |
|
90 | + public function getPostsCount() |
|
91 | + { |
|
92 | + $query = " |
|
93 | 93 | SELECT COUNT(1) AS `count` |
94 | 94 | FROM `jpemeric_stream`.`post`"; |
95 | 95 | |
96 | - return $this |
|
97 | - ->connections |
|
98 | - ->getRead() |
|
99 | - ->fetchValue($query); |
|
100 | - } |
|
96 | + return $this |
|
97 | + ->connections |
|
98 | + ->getRead() |
|
99 | + ->fetchValue($query); |
|
100 | + } |
|
101 | 101 | |
102 | - public function getPostsByTag($tag, $limit = null, $offset = 0) |
|
103 | - { |
|
104 | - $query = " |
|
102 | + public function getPostsByTag($tag, $limit = null, $offset = 0) |
|
103 | + { |
|
104 | + $query = " |
|
105 | 105 | SELECT * |
106 | 106 | FROM `jpemeric_stream`.`post` |
107 | 107 | WHERE `tag` = :tag |
108 | 108 | ORDER BY `date` DESC"; |
109 | - if (!is_null($limit)) { |
|
110 | - $query .= " |
|
109 | + if (!is_null($limit)) { |
|
110 | + $query .= " |
|
111 | 111 | LIMIT {$offset}, {$limit}"; |
112 | - } |
|
113 | - $bindings = [ |
|
114 | - 'tag' => $tag, |
|
115 | - ]; |
|
116 | - |
|
117 | - return $this |
|
118 | - ->connections |
|
119 | - ->getRead() |
|
120 | - ->fetchAll($query, $bindings); |
|
121 | - } |
|
122 | - |
|
123 | - public function getPostsByTagCount($tag) |
|
124 | - { |
|
125 | - $query = " |
|
112 | + } |
|
113 | + $bindings = [ |
|
114 | + 'tag' => $tag, |
|
115 | + ]; |
|
116 | + |
|
117 | + return $this |
|
118 | + ->connections |
|
119 | + ->getRead() |
|
120 | + ->fetchAll($query, $bindings); |
|
121 | + } |
|
122 | + |
|
123 | + public function getPostsByTagCount($tag) |
|
124 | + { |
|
125 | + $query = " |
|
126 | 126 | SELECT COUNT(1) AS `count` |
127 | 127 | FROM `jpemeric_stream`.`post` |
128 | 128 | WHERE `tag` = :tag"; |
129 | - $bindings = [ |
|
130 | - 'tag' => $tag, |
|
131 | - ]; |
|
132 | - |
|
133 | - return $this |
|
134 | - ->connections |
|
135 | - ->getRead() |
|
136 | - ->fetchAll($query, $bindings); |
|
137 | - } |
|
129 | + $bindings = [ |
|
130 | + 'tag' => $tag, |
|
131 | + ]; |
|
132 | + |
|
133 | + return $this |
|
134 | + ->connections |
|
135 | + ->getRead() |
|
136 | + ->fetchAll($query, $bindings); |
|
137 | + } |
|
138 | 138 | } |