[theme-reviewers] tracking code in themes

George Mamadashvili georgemamadashvili at gmail.com
Thu Mar 8 12:25:32 UTC 2012


I think it should be disabled by default, and theme author may include
option to enable it if user want to share data.

On Thu, Mar 8, 2012 at 4:12 PM, yulian yordanov <yul.yordanov at gmail.com>wrote:

> Currently reviewing a theme which has tracking code in its functions from
> a service called "PressTrends" http://presstrends.io/ This service
> fetches details about users to theme's author for statistical purposes, but
> I'm wondering is it's OK for a theme in WP repository?
>
> That's how the code looks like:
>
> // Add your PressTrends and Theme API Keys
> $api_key = '-----'; (deleted by me)
> $auth = '------'; (deleted by me)
>
> $data = get_transient( 'presstrends_data' );
> if (!$data || $data == ''){
> $api_base = 'http://api.presstrends.io/index.php/api/sites/add/auth/';
> $url = $api_base . $auth . '/api/' . $api_key . '/';
> $data = array();
> $count_posts = wp_count_posts();
> $count_pages = wp_count_posts('page');
> $comments_count = wp_count_comments();
> $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
> $plugin_count = count(get_option('active_plugins'));
> $all_plugins = get_plugins();
> foreach($all_plugins as $plugin_file => $plugin_data) {
> $plugin_name .= $plugin_data['Name'];
> $plugin_name .= '&';
> }
> $data['url'] = stripslashes(str_replace(array('http://', '/', ':' ), '',
> site_url()));
> $data['posts'] = $count_posts->publish;
> $data['pages'] = $count_pages->publish;
> $data['comments'] = $comments_count->total_comments;
> $data['approved'] = $comments_count->approved;
> $data['spam'] = $comments_count->spam;
> $data['theme_version'] = $theme_data['Version'];
> $data['theme_name'] = $theme_data['Name'];
> $data['site_name'] = str_replace( ' ', '', get_bloginfo( 'name' ));
> $data['plugins'] = $plugin_count;
> $data['plugin'] = urlencode($plugin_name);
> $data['wpversion'] = get_bloginfo('version');
> foreach ( $data as $k => $v ) {
> $url .= $k . '/' . $v . '/';
> }
> $response = wp_remote_get( $url );
> set_transient('presstrends_data', $data, 60*60*24);
> }}
> add_action('admin_init', 'if_presstrends');
>
>
> --
> Yulian Yordanov
> post-scriptum.info
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120308/989a4d9c/attachment.htm>


More information about the theme-reviewers mailing list