| @@ -66,8 +66,9 @@ | ||
| 66 | 66 | |
| 67 | 67 | $this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 ); |
| 68 | 68 | $this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 ); |
| 69 | 69 | $this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS, 'getDataAs', 10, 3 ); |
| 70 | + $this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 ); | |
| 70 | 71 | register_shutdown_function( array($this, 'onShutdown') ); |
| 71 | 72 | |
| 72 | 73 | } |
| 73 | 74 | |
| @@ -789,6 +790,23 @@ | ||
| 789 | 790 | } |
| 790 | 791 | return array( |
| 791 | 792 | 'csv' => $image, |
| 792 | 793 | ); |
| 794 | + } | |
| 795 | + | |
| 796 | + /** | |
| 797 | + * Filter chart title. | |
| 798 | + * | |
| 799 | + * @access public | |
| 800 | + * @param string $post_title Post title. | |
| 801 | + * @param int $post_id Post ID. | |
| 802 | + * @return string | |
| 803 | + */ | |
| 804 | + public function filterChartTitle( $post_title, $post_id ) { | |
| 805 | + $post_type = get_post_type( $post_id ); | |
| 806 | + $post_title = trim( $post_title ); | |
| 807 | + if ( 'visualizer' === $post_type && 'Visualization' === $post_title ) { | |
| 808 | + return sprintf( '%s #%d', $post_title, $post_id ); | |
| 809 | + } | |
| 810 | + return $post_title; | |
| 793 | 811 | } |
| 794 | 812 | } |