Plugin Directory

Changeset 1007594


Ignore:
Timestamp:
10/15/2014 12:13:26 AM (11 years ago)
Author:
bcole808
Message:

Release of version 1.2.3

Location:
social-metrics-tracker
Files:
68 added
6 edited

Legend:

Unmodified
Added
Removed
  • social-metrics-tracker/trunk/MetricsUpdater.class.php

    r957650 r1007594  
    5151
    5252        // If no post ID specified, use current page
    53         if ($post_id <= 0) $post_id = $post->ID;
     53        if ($post_id <= 0 && $post) $post_id = $post->ID;
    5454
    5555        // Get post types to track
     
    5757
    5858        // Validation
    59         if (is_admin())                             return false;
    60         if ($post_id <= 0)                          return false;
    61         if ($post->post_status != 'publish')        return false; // Allow only published posts
     59        if (is_admin())                                  return false;
     60        if (is_int($post_id) && $post_id <= 0)           return false;
     61        if (!$post || $post->post_status != 'publish')   return false; // Allow only published posts
    6262        if ((count($types) > 0) && !is_singular($types)) return false; // Allow singular view of enabled post types
    6363
     
    7575        }
    7676
    77         return;
     77        return true;
    7878    } // end checkThisPost()
    7979
     
    8383        $types_to_track = array();
    8484
    85         $smt_post_types = get_post_types( array('public'=>true), 'names' );
     85        $smt_post_types = get_post_types( array( 'public' => true ), 'names' );
    8686        unset($smt_post_types['attachment']);
    8787
    8888        foreach ($smt_post_types as $type) {
    89             if ($this->options['smt_options_post_types_'.$type] == $type) $types_to_track[] = $type;
    90         }
    91 
    92         return $types_to_track;
     89            if (isset($this->options['smt_options_post_types_'.$type]) && $this->options['smt_options_post_types_'.$type] == $type) $types_to_track[] = $type;
     90        }
     91
     92        // If none selected, default post types
     93        return ($types_to_track) ? $types_to_track : array_values($smt_post_types);
    9394
    9495    }
     
    148149    */
    149150    public function calculateScoreAggregate($social_num = 0, $views_num = 0, $comment_num = 0) {
     151
     152        // Validate input
     153        if (!is_int($social_num) || !is_int($views_num) || !is_int($comment_num)) return false;
    150154
    151155        // Configuration
     
    335339        }
    336340
    337         return;
     341        return true;
    338342    } // end scheduleFullDataSync()
    339343
  • social-metrics-tracker/trunk/README.md

    r957650 r1007594  
    1 # [Social Metrics Tracker](https://github.com/chapmanu/wp-social-metrics-tracker)
     1[![Build Status](https://travis-ci.org/chapmanu/wp-social-metrics-tracker.svg)](https://travis-ci.org/chapmanu/wp-social-metrics-tracker)
     2
     3# Social Metrics Tracker
    24
    35![screenshot](http://i.imgur.com/JdOEBV7.png)
     
    4648Last Updated Timestamp | socialcount_LAST_UPDATED
    4749
    48 ### Extending the plugin
     50### Action Hooks
    4951
    5052There are some Wordpress action hooks which can be used to extend the functionality of this plugin.
    5153
    52 **social_metrics_post_sync** is called when an individual post is being updated, before new data is downloaded.
    53 **social_metrics_post_sync_complete** is called when an individual post is done being updated.
     54**social_metrics_post_sync** is called just before an individual post is updated.
     55**social_metrics_post_sync_complete** is called when an individual post update completes.
     56
     57### Contributing to development
     58
     59There are some *really super awesome* PHPUnit tests written to help make sure that code changes don't break any existing functionality. If you plan on submitting pull requests, please make sure to [read over the wiki page](https://github.com/chapmanu/wp-social-metrics-tracker/wiki/Plugin-testing-with-PHPUnit) which explains how to get PHPUnit up and running in your development environment.
    5460
    5561# FAQ
     
    6167### Q: What social networks are measured?
    6268
    63 A: Facebook, Twitter, Reddit, LinkedIn, Digg, Delicious, StumbleUpon, Pinterest, and Google+.
     69A: Facebook, Twitter, LinkedIn, StumbleUpon, Pinterest, and Google+.
    6470
    6571### Q: When is the data updated?
  • social-metrics-tracker/trunk/SocialMetricsTrackerWidget.class.php

    r988416 r1007594  
    1717
    1818        $this->options = get_option('smt_settings');
     19
     20        $this->data_max = array();
    1921
    2022        // Do not run if current user not allowed to see this
  • social-metrics-tracker/trunk/data-sources/sharedcount.com.php

    r957650 r1007594  
    1818
    1919        // get social data from api.sharedcount.com
    20         $curl_handle = curl_init();
     20        $shared_count_service_data = $this->getData($post_url);
    2121
    22         curl_setopt($curl_handle, CURLOPT_URL, 'http://api.sharedcount.com/?url='.rawurlencode($post_url));
    23         curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
    24         curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    25 
    26         $json = curl_exec($curl_handle);
    27 
    28         curl_close($curl_handle);
    29 
    30         // reject if no response
    31         if (!strlen($json)) return;
    32 
    33         // decode social data from JSON
    34         $shared_count_service_data = json_decode($json, true);
     22        if ($shared_count_service_data === false) return false;
    3523
    3624        // prepare stats array
     
    6048
    6149    }
     50
     51    // Retrieve and return the data from the remote resource
     52    public function getData($url) {
     53
     54        $curl_handle = curl_init();
     55        curl_setopt($curl_handle, CURLOPT_URL, 'http://api.sharedcount.com/?url='.rawurlencode($url));
     56        curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
     57        curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
     58        $data = curl_exec($curl_handle);
     59        curl_close($curl_handle);
     60
     61        // reject if no response
     62        if (!strlen($data)) return false;
     63
     64        // decode social data from JSON
     65        $shared_count_service_data = json_decode($data, true);
     66    }
     67   
    6268}
  • social-metrics-tracker/trunk/readme.txt

    r1001546 r1007594  
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K2Z4QFWKJ5DM4
    44Tags: admin, dashboard, social, social media, facebook, twitter, metrics, analytics, tracking, engagement, share, sharing, shares
    5 Requires at least: 3.8.1
     5Requires at least: 3.5
    66Tested up to: 4.0
    7 Stable tag: 1.2.2
     7Stable tag: 1.2.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2424= Focus your writing topics: =
    2525
    26 Understand what posts your readers are sharing on social networks so that you can write more of what works well. 
     26Understand what posts your readers are sharing on social networks so that you can write more of what works well.
    2727
    2828= Do more with the data: =
    2929
    30 Export collected data to a spreadsheet for analysis. 
     30Export collected data to a spreadsheet for analysis.
    3131
    32 For web developers, this plugin collects and stores social metrics data in a way that can be accessed by other WP plugins or themes. For example, the social metrics could be used to display a feed of the most popular posts. Metrics are stored as custom post meta fields on each individual post. This is an advanced feature which requires writing custom code. 
     32For web developers, this plugin collects and stores social metrics data in a way that can be accessed by other WP plugins or themes. For example, the social metrics could be used to display a feed of the most popular posts. Metrics are stored as custom post meta fields on each individual post. This is an advanced feature which requires writing custom code.
    3333
    3434
     
    39393. Review the plugin settings under Settings > Social Metrics
    4040
    41 If you do not see any statistics on the Social Metrics dashboard, make sure that you have some posts published and that wp-cron.php is working correctly. This plugin relies on the WordPress Cron system to fetch data updates. This plugin will not work on local or development servers where URLs are not publicly accessible. 
     41If you do not see any statistics on the Social Metrics dashboard, make sure that you have some posts published and that wp-cron.php is working correctly. This plugin relies on the WordPress Cron system to fetch data updates. This plugin will not work on local or development servers where URLs are not publicly accessible.
    4242
    4343
     
    6262= Will this work with WordPress Multisite? =
    6363
    64 Absolutely! This plugin was created with large-scale Multisite blog networks in mind. 
     64Absolutely! This plugin was created with large-scale Multisite blog networks in mind.
    6565
    6666= What about pageviews? =
    6767
    68 You can link with your Google Analytics account to import pageview data for posts. This requires a free Google API Developer Key. 
     68You can link with your Google Analytics account to import pageview data for posts. This requires a free Google API Developer Key.
    6969
    7070= Who created this? =
     
    8181== Changelog ==
    8282
    83 = 1.2.2 =
     83= 1.2.3 =
     84* Fixed bar width when displaying a widget on the admin Dashboard.
     85
     86= 1.2.2 =
    8487* Plugin activation hotfix
    8588
    86 = 1.2.1 = 
     89= 1.2.1 =
    8790* Update Google Analytics setup wizard steps
    8891* Fix various bugs
     
    107110= 1.0.1 =
    108111* Added colors and labels to the graph for each of the nine social networks.
    109 * Bar graph expands on hover to show detail of the breakdown. 
     112* Bar graph expands on hover to show detail of the breakdown.
    110113
    111114= 1.0 =
    112 * Plugin created, wohoo! 
     115* Plugin created, wohoo!
    113116
    114117
    115118== Upgrade Notice ==
     119
     120= 1.2.3 =
     121Squished more bugs!
    116122
    117123= 1.2.2 =
     
    122128
    123129= 1.2.0 =
    124 Added data export tool, and fixed bugs. 
     130Added data export tool, and fixed bugs.
    125131
    126132= 1.1.1 =
     
    128134
    129135= 1.1.0 =
    130 Added some new features including custom post types, Google Analytics, and more. 
     136Added some new features including custom post types, Google Analytics, and more.
    131137
    132138= 1.0.1 =
     
    134140
    135141= 1.0.1 =
    136 Added colors and labels for all nine social networks. 
     142Added colors and labels for all nine social networks.
    137143
    138144
  • social-metrics-tracker/trunk/social-metrics-tracker.php

    r1001546 r1007594  
    44Plugin URI: https://github.com/ChapmanU/wp-social-metrics-tracker
    55Description: Collect and display social network shares, likes, tweets, and view counts of posts.
    6 Version: 1.2.2
     6Version: 1.2.3
    77Author: Ben Cole, Chapman University
    88Author URI: http://www.bencole.net
     
    3333class SocialMetricsTracker {
    3434
    35     private $version = '1.2.2'; // for db upgrade comparison
     35    private $version = '1.2.3'; // for db upgrade comparison
    3636    public $updater;
    3737    public $options;
     
    8686    // Determines if we are on a development or staging environment
    8787    public function is_development_server() {
    88         return (defined('WP_ENV') && strtolower(WP_ENV) != 'production' || $_SERVER['REMOTE_ADDR'] == '127.0.0.1');
     88        return ((defined('WP_ENV') && strtolower(WP_ENV) != 'production') || (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] == '127.0.0.1'));
    8989    }
    9090
     
    190190        $types_to_track = array();
    191191
    192         $smt_post_types = get_post_types( array( 'public' => true ), 'names' ); 
     192        $smt_post_types = get_post_types( array( 'public' => true ), 'names' );
    193193        unset($smt_post_types['attachment']);
    194194
     
    202202
    203203    /***************************************************
    204     * Check the version of the plugin and perform upgrade tasks if necessary 
     204    * Check the version of the plugin and perform upgrade tasks if necessary
    205205    ***************************************************/
    206206    public function version_check() {
     
    211211
    212212            // Do upgrade tasks
    213            
     213
    214214        }
    215215    }
Note: See TracChangeset for help on using the changeset viewer.