@@ -58,9 +58,45 @@ public function __construct( Visualizer_Plugin $plugin ) {
58
58
$ this ->_addAction ( 'admin_menu ' , 'registerAdminMenu ' );
59
59
$ this ->_addFilter ( 'media_view_strings ' , 'setupMediaViewStrings ' );
60
60
$ this ->_addFilter ( 'plugin_action_links ' , 'getPluginActionLinks ' , 10 , 2 );
61
- $ this ->_addFilter ( 'plugin_row_meta ' , 'getPluginMetaLinks ' , 10 , 2 );
61
+ $ this ->_addFilter ( 'visualizer_logger_data ' , 'getLoggerData ' );
62
62
}
63
63
64
+ /**
65
+ * Fetches the SDK logger data.
66
+ *
67
+ * @param array $data The default data that needs to be sent.
68
+ *
69
+ * @access public
70
+ */
71
+ public function getLoggerData ( $ data ) {
72
+ return array (
73
+ 'chart_types ' => $ this ->getChartTypesAndCounts (),
74
+ 'wordpress_filters ' => '' ,
75
+ );
76
+ }
77
+
78
+ /**
79
+ * Fetches the types of charts created and their counts.
80
+ *
81
+ * @access private
82
+ */
83
+ private function getChartTypesAndCounts () {
84
+ $ charts = array ();
85
+ // the initial query arguments to fetch charts
86
+ $ query_args = array (
87
+ 'post_type ' => Visualizer_Plugin::CPT_VISUALIZER ,
88
+ 'posts_per_page ' => 300 ,
89
+ 'fields ' => 'ids ' ,
90
+ );
91
+
92
+ $ query = new WP_Query ( $ query_args );
93
+ while ( $ query ->have_posts () ) {
94
+ $ chart_id = $ query ->next_post ();
95
+ $ type = get_post_meta ( $ chart_id , Visualizer_Plugin::CF_CHART_TYPE , true );
96
+ $ charts [ $ type ] = isset ( $ charts [ $ type ] ) ? $ charts [ $ type ] + 1 : 1 ;
97
+ }
98
+ return $ charts ;
99
+ }
64
100
65
101
/**
66
102
* Enqueues media scripts and styles.
0 commit comments