| @@ -234,19 +234,19 @@ | ||
| 234 | 234 | 'paged' => $page, |
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | // add chart type filter to the query arguments |
| 238 | - $type = filter_input( INPUT_GET, 'type' ); | |
| 239 | - if ( $type && in_array( $type, Visualizer_Plugin::getChartTypes() ) ) { | |
| 238 | + $filter = filter_input( INPUT_GET, 'type' ); | |
| 239 | + if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) { | |
| 240 | 240 | $query_args['meta_query'] = array( |
| 241 | 241 | array( |
| 242 | 242 | 'key' => Visualizer_Plugin::CF_CHART_TYPE, |
| 243 | - 'value' => $type, | |
| 243 | + 'value' => $filter, | |
| 244 | 244 | 'compare' => '=', |
| 245 | 245 | ), |
| 246 | 246 | ); |
| 247 | 247 | } else { |
| 248 | - $type = 'all'; | |
| 248 | + $filter = 'all'; | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // fetch charts |
| 252 | 252 | $charts = array(); |
| @@ -253,19 +253,23 @@ | ||
| 253 | 253 | $query = new WP_Query( $query_args ); |
| 254 | 254 | while( $query->have_posts() ) { |
| 255 | 255 | $chart = $query->next_post(); |
| 256 | 256 | |
| 257 | - // faetch and update settings | |
| 257 | + // fetch and update settings | |
| 258 | 258 | $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); |
| 259 | 259 | unset( $settings['height'], $settings['width'] ); |
| 260 | 260 | |
| 261 | + $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 262 | + $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type ); | |
| 263 | + $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type ); | |
| 264 | + | |
| 261 | 265 | // add chart to the array |
| 262 | 266 | $charts['visualizer-' . $chart->ID] = array( |
| 263 | 267 | 'id' => $chart->ID, |
| 264 | - 'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ), | |
| 265 | - 'series' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), | |
| 268 | + 'type' => $type, | |
| 269 | + 'series' => $series, | |
| 266 | 270 | 'settings' => $settings, |
| 267 | - 'data' => unserialize( $chart->post_content ), | |
| 271 | + 'data' => $data, | |
| 268 | 272 | ); |
| 269 | 273 | } |
| 270 | 274 | |
| 271 | 275 | // enqueue charts array |
| @@ -282,9 +286,9 @@ | ||
| 282 | 286 | // render library page |
| 283 | 287 | $render = new Visualizer_Render_Library(); |
| 284 | 288 | |
| 285 | 289 | $render->charts = $charts; |
| 286 | - $render->type = $type; | |
| 290 | + $render->type = $filter; | |
| 287 | 291 | $render->types = self::_getChartTypesLocalized(); |
| 288 | 292 | $render->pagination = paginate_links( array( |
| 289 | 293 | 'base' => add_query_arg( 'vpage', '%#%' ), |
| 290 | 294 | 'format' => '', |