@@ -11,9 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | protected function execute() |
| 13 | 13 | {
|
| 14 | - foreach(self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace) |
|
| 14 | + foreach (self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace) |
|
| 15 | 15 | {
|
| 16 | - if(stristr($this->content, $match)) |
|
| 16 | + if (stristr($this->content, $match)) |
|
| 17 | 17 | $this->content = str_replace($match, $replace, $this->content); |
| 18 | 18 | } |
| 19 | 19 | return; |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | protected function execute($title = '') |
| 11 | 11 | {
|
| 12 | 12 | preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches); |
| 13 | - if(count($matches[1]) == 0) |
|
| 13 | + if (count($matches[1]) == 0) |
|
| 14 | 14 | return; |
| 15 | 15 | |
| 16 | - foreach($matches[3] as $key => $match) |
|
| 16 | + foreach ($matches[3] as $key => $match) |
|
| 17 | 17 | {
|
| 18 | 18 | $replacement = $match; |
| 19 | 19 | $replacement = $this->wrap_in_list($replacement); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | {
|
| 30 | 30 | $content_array = explode("\n", $content);
|
| 31 | 31 | |
| 32 | - foreach($content_array as $key => $row) |
|
| 32 | + foreach ($content_array as $key => $row) |
|
| 33 | 33 | {
|
| 34 | 34 | $new_row = ($key % 2 == 0) ? '<li class="even">' : '<li class="odd">'; |
| 35 | 35 | $new_row .= '<p>'; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | private function highlight_code($content, $type) |
| 48 | 48 | {
|
| 49 | - switch($type) |
|
| 49 | + switch ($type) |
|
| 50 | 50 | {
|
| 51 | 51 | default : |
| 52 | 52 | return $content; |
@@ -27,20 +27,20 @@ discard block |
||
| 27 | 27 | protected function execute() |
| 28 | 28 | {
|
| 29 | 29 | $args = func_get_args(); |
| 30 | - if(count($args) < 1) |
|
| 30 | + if (count($args) < 1) |
|
| 31 | 31 | {
|
| 32 | 32 | trigger_error('Someone called SmartTrimContent w/o defining a length... bad!');
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if(count($args) == 2) |
|
| 36 | + if (count($args) == 2) |
|
| 37 | 37 | $etc = $args[1]; |
| 38 | 38 | else |
| 39 | 39 | $etc = self::$ETC; |
| 40 | 40 | |
| 41 | 41 | $length = $args[0]; |
| 42 | 42 | |
| 43 | - if($length < strlen($this->content)) |
|
| 43 | + if ($length < strlen($this->content)) |
|
| 44 | 44 | $this->trim_string($length); |
| 45 | 45 | else |
| 46 | 46 | $etc = ''; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET); |
| 56 | 56 | $last_left_bracket_position = strripos($content, self::$LEFT_BRACKET); |
| 57 | - if($last_left_bracket_position > $last_right_bracket_position) |
|
| 57 | + if ($last_left_bracket_position > $last_right_bracket_position) |
|
| 58 | 58 | $content = substr($content, 0, $last_left_bracket_position); |
| 59 | 59 | $content = trim($content); |
| 60 | 60 | |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | $content = current($content); |
| 74 | 74 | |
| 75 | 75 | $max_length = $length; |
| 76 | - foreach($matches[0] as $match) |
|
| 76 | + foreach ($matches[0] as $match) |
|
| 77 | 77 | {
|
| 78 | 78 | $max_length += strlen($match[0]); |
| 79 | - if($max_length <= $match[1]) |
|
| 79 | + if ($max_length <= $match[1]) |
|
| 80 | 80 | break; |
| 81 | 81 | |
| 82 | 82 | $content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(substr($content, -7) == '</p><p>') |
|
| 85 | + if (substr($content, -7) == '</p><p>') |
|
| 86 | 86 | $content = substr($content, 0, -7); |
| 87 | 87 | |
| 88 | 88 | return $content; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $tags_preg = $this->get_tags_preg(self::$EXCLUDE_TAGS); |
| 95 | 95 | preg_match_all($tags_preg, $content, $matches, PREG_OFFSET_CAPTURE); |
| 96 | 96 | |
| 97 | - if(count($matches[1]) % 2 == 1) |
|
| 97 | + if (count($matches[1]) % 2 == 1) |
|
| 98 | 98 | {
|
| 99 | 99 | $cut_tag = end($matches[1]); |
| 100 | 100 | $cut_tag_position = $cut_tag[1] - 1; |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | preg_match_all($tags_preg, $content, $matches); |
| 113 | 113 | $open_tags = array(); |
| 114 | 114 | |
| 115 | - foreach($matches[1] as $tag) |
|
| 115 | + foreach ($matches[1] as $tag) |
|
| 116 | 116 | {
|
| 117 | - if(in_array($tag, $open_tags)) |
|
| 117 | + if (in_array($tag, $open_tags)) |
|
| 118 | 118 | {
|
| 119 | 119 | $key = array_search($tag, $open_tags); |
| 120 | 120 | unset($open_tags[$key]); |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $open_tags = array_reverse($open_tags); |
| 127 | - if(count($open_tags) > 0) |
|
| 127 | + if (count($open_tags) > 0) |
|
| 128 | 128 | {
|
| 129 | - foreach($open_tags as $key => $open_tag) |
|
| 129 | + foreach ($open_tags as $key => $open_tag) |
|
| 130 | 130 | {
|
| 131 | - if($key == count($open_tags) - 1) |
|
| 131 | + if ($key == count($open_tags) - 1) |
|
| 132 | 132 | $content .= $etc; |
| 133 | 133 | $content .= "</{$open_tag}>";
|
| 134 | 134 | } |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | {
|
| 7 | 7 | |
| 8 | 8 | private static $COOKIE_NAME = 'commenter'; |
| 9 | - private static $COOKIE_DURATION = 31536000; // one year |
|
| 10 | - private static $COOKIE_DOMAIN = 'jacobemerick.com'; |
|
| 9 | + private static $COOKIE_DURATION = 31536000; // one year |
|
| 10 | + private static $COOKIE_DOMAIN = 'jacobemerick.com'; |
|
| 11 | 11 | private static $COOKIE_PATH = '/'; |
| 12 | 12 | |
| 13 | 13 | protected function getName() |
@@ -22,13 +22,13 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function activate() |
| 24 | 24 | {
|
| 25 | - foreach($this->post_array as $post) |
|
| 25 | + foreach ($this->post_array as $post) |
|
| 26 | 26 | {
|
| 27 | 27 | $blog_result = BlogCollector::getBlogByTitle($post->title); |
| 28 | - if($blog_result !== null) |
|
| 28 | + if ($blog_result !== null) |
|
| 29 | 29 | {
|
| 30 | 30 | $comments = CommentCollector::getCommentCountForURL(2, $post->path); |
| 31 | - if($blog_result->comments != $comments) |
|
| 31 | + if ($blog_result->comments != $comments) |
|
| 32 | 32 | {
|
| 33 | 33 | $query = sprintf(self::$UPDATE_COMMENTS_QUERY, $comments, $blog_result->id); |
| 34 | 34 | Database::execute($query); |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function activate() |
| 21 | 21 | {
|
| 22 | - if(!$this->xml) |
|
| 22 | + if (!$this->xml) |
|
| 23 | 23 | return $this->error('Could not connect to feed.');
|
| 24 | 24 | |
| 25 | - foreach($this->xml->channel->item as $item) |
|
| 25 | + foreach ($this->xml->channel->item as $item) |
|
| 26 | 26 | {
|
| 27 | - if(strtotime($item->user_read_at) <= 0) |
|
| 27 | + if (strtotime($item->user_read_at) <= 0) |
|
| 28 | 28 | continue; |
| 29 | 29 | |
| 30 | 30 | $title = $item->title; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $date_added = date('Y-m-d H:i:s', strtotime($item->user_date_created));
|
| 43 | 43 | |
| 44 | 44 | $book_result = BookCollector::getBookByFields($title, $author); |
| 45 | - if($book_result !== null) |
|
| 45 | + if ($book_result !== null) |
|
| 46 | 46 | continue; |
| 47 | 47 | |
| 48 | 48 | $query = sprintf(self::$QUERY, $title, $author, $link, $description, $image, $date_read, $date_added); |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | public function activate() |
| 17 | 17 | {
|
| 18 | 18 | $loop_count = 0; |
| 19 | - for($loop_count = 0; $loop_count < self::$MAXIMUM_LOOP_COUNT; $loop_count++) |
|
| 19 | + for ($loop_count = 0; $loop_count < self::$MAXIMUM_LOOP_COUNT; $loop_count++) |
|
| 20 | 20 | {
|
| 21 | 21 | $changeset_to_check = $this->get_changeset_to_check(); |
| 22 | 22 | $data = $this->get_changeset_page_data($changeset_to_check); |
| 23 | 23 | |
| 24 | - if(!isset($data)) |
|
| 24 | + if (!isset($data)) |
|
| 25 | 25 | break; |
| 26 | 26 | |
| 27 | 27 | $this->save_changeset_data($data); |
| 28 | - if($loop_count > 20) |
|
| 28 | + if ($loop_count > 20) |
|
| 29 | 29 | exit; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | {
|
| 54 | 54 | $changeset = ChangelogCollector::getMostRecentChange(); |
| 55 | 55 | |
| 56 | - if($changeset === null) |
|
| 56 | + if ($changeset === null) |
|
| 57 | 57 | return 1; |
| 58 | 58 | |
| 59 | 59 | $number = $changeset->number; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $changeset_page = $this->get_changeset_page($page); |
| 67 | 67 | |
| 68 | 68 | preg_match('@<h1>(.+)</h1>@', $changeset_page, $match);
|
| 69 | - if(stristr($match[1], 'Error: Invalid Changeset Number') !== false) |
|
| 69 | + if (stristr($match[1], 'Error: Invalid Changeset Number') !== false) |
|
| 70 | 70 | return; |
| 71 | 71 | |
| 72 | 72 | preg_match('@<h1>Changeset (\d+)</h1>@', $changeset_page, $match);
|
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function activate() |
| 22 | 22 | {
|
| 23 | - if(!$this->json) |
|
| 23 | + if (!$this->json) |
|
| 24 | 24 | return $this->error('Could not connect to feed.');
|
| 25 | 25 | |
| 26 | 26 | $count = 0; |
| 27 | - foreach($this->json->entries as $entry) |
|
| 27 | + foreach ($this->json->entries as $entry) |
|
| 28 | 28 | {
|
| 29 | 29 | $type = $entry->workout->activity_type; |
| 30 | 30 | $type = strtolower($type); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $date = date('Y-m-d H:i:s', strtotime($entry->at));
|
| 42 | 42 | |
| 43 | 43 | $distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance); |
| 44 | - if($distance_result !== null) |
|
| 44 | + if ($distance_result !== null) |
|
| 45 | 45 | continue; |
| 46 | 46 | |
| 47 | 47 | $query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date); |
@@ -13,23 +13,23 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function __construct() |
| 15 | 15 | {
|
| 16 | - if(Loader::isLive()) |
|
| 16 | + if (Loader::isLive()) |
|
| 17 | 17 | $handle[] = self::$live_root; |
| 18 | 18 | else |
| 19 | 19 | $handle[] = self::$test_root; |
| 20 | 20 | |
| 21 | 21 | $i = 0; |
| 22 | - while(isset($handle[$i])) |
|
| 22 | + while (isset($handle[$i])) |
|
| 23 | 23 | {
|
| 24 | 24 | $path = $handle[$i]; |
| 25 | 25 | $fh = opendir($path); |
| 26 | - while(false !== ($file = readdir($fh))) |
|
| 26 | + while (false !== ($file = readdir($fh))) |
|
| 27 | 27 | {
|
| 28 | - if($file != '.' && $file != '..') |
|
| 28 | + if ($file != '.' && $file != '..') |
|
| 29 | 29 | {
|
| 30 | - if(is_dir("{$path}/{$file}"))
|
|
| 30 | + if (is_dir("{$path}/{$file}"))
|
|
| 31 | 31 | $handle[] = "{$path}/{$file}";
|
| 32 | - if($file == 'error.log') |
|
| 32 | + if ($file == 'error.log') |
|
| 33 | 33 | $this->error_files[] = "{$path}/{$file}";
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | {
|
| 43 | 43 | $message = ''; |
| 44 | 44 | |
| 45 | - if(count($this->error_files) > 0) |
|
| 45 | + if (count($this->error_files) > 0) |
|
| 46 | 46 | {
|
| 47 | 47 | $message .= "Errors from flat-file logs.\n\n"; |
| 48 | - foreach($this->error_files as $error_file) |
|
| 48 | + foreach ($this->error_files as $error_file) |
|
| 49 | 49 | {
|
| 50 | 50 | $contents = file_get_contents($error_file); |
| 51 | 51 | $message .= "{$error_file}\n{$contents}\n\n";
|
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | $mail->setMessage($message); |
| 61 | 61 | $mail->send(); |
| 62 | 62 | |
| 63 | - if(count($this->error_files) > 0) |
|
| 63 | + if (count($this->error_files) > 0) |
|
| 64 | 64 | {
|
| 65 | - foreach($this->error_files as $error_file) |
|
| 65 | + foreach ($this->error_files as $error_file) |
|
| 66 | 66 | {
|
| 67 | 67 | // if(file_exists($error_file)) |
| 68 | 68 | // unlink($error_file); |