'All', 'categorized' => 'Categorized' ); static $filter_fields = Array( 'std-proposal' => 'Standard Proposals', 'std-tr1' => 'TR1 libraries', 'header-only' => '[old]', 'autolink' => '[old]' ); static $sort_fields = Array( 'name' => 'Name', 'boost-version' => 'First Release', 'std-proposal' => 'STD Proposal', 'std-tr1' => 'STD::TR1', 'key' => 'Key' ); static $display_sort_fields = Array( '' => 'Name', 'boost-version' => 'First Release' ); var $params = array(); var $libs; var $categories; var $base_uri = ''; var $view_value = ''; var $category_value = ''; var $filter_value = ''; var $sort_value = 'name'; var $attribute_filter = false; function __construct($params, $libs) { $this->libs = $libs; $this->categories = $libs->get_categories(); $base_uri = $_SERVER['REQUEST_URI']; $base_uri = preg_replace('@[#?].*@', '', $base_uri); $base_uri = preg_replace('@//+@', '/', $base_uri); $this->base_uri = $base_uri; if (array_key_exists('view', $params)) { $view_value = $params['view']; $filter_value = ''; if (!preg_match('@^[-_a-zA-Z0-9]+$@', $view_value)) { die('Invalid view value.'); } if (strpos($view_value, 'filtered_') === 0) { $filter_value = substr($view_value, strlen('filtered_')); if (!array_key_exists($filter_value, self::$filter_fields)) { echo 'Invalid filter field.'; exit(0); } if (self::$filter_fields[$filter_value] == '[old]') { echo 'Filter field no longer supported.'; exit(0); } } else if (strpos($view_value, 'category_') === 0) { $this->category_value = substr($view_value, strlen('category_')); if(!array_key_exists($this->category_value, $this->categories)) { echo 'Invalid category: '.html_encode($this->category_value); exit(0); } } else { if (!array_key_exists($view_value, self::$view_fields)) { echo 'Invalid view value.'; exit(0); } } $this->view_value = $view_value; $this->filter_value = $filter_value; } if (array_key_exists('sort', $params)) { $sort_value = $params['sort']; if (!preg_match('@^[-_a-zA-Z0-9]+$@', $sort_value)) { die('Invalid sort field.'); } if (!array_key_exists($sort_value, self::$sort_fields)) { echo 'Invalid sort field.'; exit(0); } $this->sort_value = $sort_value; } if (!empty($params['filter'])) { $attribute_filter = $params['filter']; if (!preg_match('@^[-_a-zA-Z0-9]+$@', $attribute_filter)) { die('Invalid attribute filter.'); } $this->attribute_filter = $attribute_filter; } // Store the sanitized parameters for quickly generating links later. $this->params = array( 'view' => $this->view_value, 'sort' => $this->sort_value, 'sort' => $this->attribute_filter, ); } function filter($lib) { if (BoostVersion::page()->is_numbered_release() && !$lib['boost-version']->is_release()) { return false; } if ($this->filter_value && empty($lib[$this->filter_value])) { return false; } if ($this->attribute_filter && empty($lib[$this->attribute_filter])) { return false; } if ($this->category_value && (empty($lib['category']) || !in_array($this->category_value, $lib['category']))) { return false; } return true; } function title() { $page_title = BoostVersion::page_title().' Library Documentation'; if ($this->category_value) { $page_title.= ' - '. $this->categories[$this->category_value]['title']; } return $page_title; } function category_subtitle() { if($this->category_value) { echo '

', html_encode($this->categories[$this->category_value]['title']), '

'; } } function view_menu_items() { foreach (self::$view_fields as $key => $description) { echo '
  • '; $this->option_link($description, 'view', $key); echo '
  • '; } } function filter_menu_items() { foreach (self::$filter_fields as $key => $description) { if (!preg_match('@^\[.*\]$@', $description)) { echo '
  • '; $this->option_link($description, 'view', 'filtered_'.$key); echo '
  • '; } } } function sort_menu_items() { foreach (self::$display_sort_fields as $key => $description) { echo '
  • '; $this->option_link($description, 'sort', $key); echo '
  • '; } } function filtered_libraries() { return $this->libs->get_for_version(BoostVersion::page(), $this->sort_value, array($this, 'filter')); } function categorized_libraries() { return $this->libs->get_categorized_for_version(BoostVersion::page(), $this->sort_value, array($this, 'filter')); } // Library display functions: function libref($lib) { if (!empty($lib['documentation'])) { $path_info = filter_input(INPUT_SERVER, 'PATH_INFO', FILTER_SANITIZE_URL); if ($path_info && $path_info != '/') { $docref = '/doc/libs' . $path_info . '/' . $lib['documentation']; } else { $docref = '/doc/libs/release/' . $lib['documentation']; } print '' . html_encode(!empty($lib['name']) ? $lib['name'] : $lib['key']) . ''; } else { print html_encode(!empty($lib['name']) ? $lib['name'] : $lib['key']); } if (!empty($lib['status'])) { print ' (' . html_encode($lib['status']) . ')'; } } function libdescription($lib) { echo !empty($lib['description']) ? html_encode($lib['description'],ENT_NOQUOTES,'UTF-8') : ' '; } function libauthors($lib) { print !empty($lib['authors']) ? html_encode($lib['authors']) : ' '; } function libavailable($lib) { print $lib['boost-version']->is_release() ? html_encode($lib['boost-version']) : ''.html_encode($lib['boost-version']).''; } function libstandard($lib) { $p = array(); if ($lib['std-proposal']) { $p[] = 'Proposed'; } if ($lib['std-tr1']) { $p[] = 'TR1'; } print ($p ? implode(', ', $p) : ' '); } function libcategories($lib) { $first = true; if ($lib['category']) { foreach ($lib['category'] as $category_name) { if (!$first) echo ', '; $first = false; $this->category_link($category_name); } } if ($first) echo ' '; } function option_link($description, $field, $value) { if (!array_key_exists($field, $this->params)) { die("Invalid field: ".html_encode($field)); } $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 (is_string($v) && $v != '') { $url_params .= $url_params ? '&' : '?'; $url_params .= urlencode($k) . '=' . urlencode($v); } } echo '', html_encode($description), ''; } } function category_link($name) { $category = $this->categories[$name]; $this->option_link( isset($category['title']) ? $category['title'] : $name, 'view', 'category_' . $name); } } // Page variables $library_page = new LibraryPage($_GET, BoostLibraries::load()); ?> <?php echo html_encode($library_page->title()); ?>

    title()); ?>

    Sort by:
    view_value != 'categorized'): ?> category_subtitle(); ?>
    filtered_libraries() as $lib): ?>
    libref($lib); ?>

    libdescription($lib); ?>

    Author(s)
    libauthors($lib); ?>
    First Release
    libavailable($lib); ?>
    Standard
    libstandard($lib); ?>
    Categories
    libcategories($lib); ?>

    By Category

    categorized_libraries() as $name => $category) { if(count($category['libraries'])) { echo '

    '; $library_page->category_link($name); echo '

    '; echo '
      '; foreach ($category['libraries'] as $lib) { echo '
    • '; $library_page->libref($lib); echo ': '; $library_page->libdescription($lib); echo '
    • '; } echo '
    '; } } ?>