'lib', ); static $page_view_options = Array( 'lib' => 'By Library', 'date' => 'By Age', ); var $params; // Normalised URL parameters var $pull_requests; var $last_updated; var $page_url_path; // URL path for this page var $page_view; // Grouped by library, or sorted by age. function __construct($params) { $json_data = json_decode( file_get_contents(BOOST_DATA_DIR.'/pull-requests.json')); $this->pull_requests = $json_data->pull_requests; $this->last_updated = $json_data->last_updated; $this->page_url_path = preg_replace('![#?].*!', '', $_SERVER['REQUEST_URI']); $this->params = array(); foreach (self::$param_defaults as $key => $default) { // Note: Using default for empty values as well as missing values. $this->params[$key] = strtolower(trim( BoostWebsite::array_get($params, $key))) ?: $default; } $this->page_view = $this->params['page_view']; if (!array_key_exists($this->page_view, self::$page_view_options)) { BoostWeb::throw_http_error(400, 'Invalid view type', "Invalid view type: {$this->page_view}"); } } function display() { echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo '

Last updated ', $this->time_ago($this->last_updated), "

\n"; switch ($this->page_view) { case 'lib': $this->by_library(); break; case 'date': $this->by_date(); break; default: echo "Invalid page_view."; } } function by_library() { foreach ($this->pull_requests as $name => $repo_requests) { $repo_count = count($repo_requests); echo "

", html_encode($name), "

\n", "

{$repo_count} open request", ($repo_count != 1 ? 's' : ''), ":

\n"; foreach ($repo_requests as $pull) { $this->pull_request_item($pull); } } } function by_date() { $pull_requests = Array(); foreach ($this->pull_requests as $name => $repo_requests) { foreach ($repo_requests as $pull) { $pull->name = $name; $pull_requests[] = $pull; } } usort($pull_requests, function($x, $y) { return strtotime($x->created_at) - strtotime($y->created_at); }); echo '\n"; } function pull_request_item($pull, $name = null) { echo "
  • ", "", ($name ? html_encode(preg_replace('@^boostorg/@', '', $name)).": " : ''), html_encode(rtrim($pull->title, '.')), "", " (created: ", html_encode(gmdate("j M Y", strtotime($pull->created_at))), ", updated: ", html_encode(gmdate("j M Y", strtotime($pull->updated_at))), ")", "
  • \n"; } function option_link($description, $field, $value) { $value = strtolower($value); $current_value = $this->params[$field]; if ($current_value == $value) { echo '', html_encode($description), ''; } else { $params = $this->params; $params[$field] = $value; $url_params = ''; foreach ($params as $k => $v) { if ($v && $v !== self::$param_defaults[$k]) { $url_params .= $url_params ? '&' : '?'; $url_params .= urlencode($k) . '=' . urlencode($v); } } echo '', html_encode($description), ''; } } function time_ago($date, $now = null) { $date = new DateTime($date); $now = new DateTime($now ?: 'now'); if ($date >= $now) { return ($date - $now <= 2) ? "just now" : "in the future??? (probably an error somewhere)"; } $diff = date_diff($date, $now); $val = false; foreach( Array( 'y' => 'year', 'm' => 'month', 'd' => 'day', 'h' => 'hour', 'i' => 'minute', 's' => 'second', ) as $member => $unit) { if ($val = $diff->{$member}) { return "{$val} {$unit}".($val != 1 ? 's' : '')." ago"; } } } } $page = new PullRequestPage($_GET); ?> Open Pull Requests - Boost C++ Libraries

    Open Pull Requests

    display(); ?>